Repository navigation
Expand file tree
/
Copy pathlefthook.yml
More file actions
203 lines (198 loc) · 7.5 KB
/
Copy pathlefthook.yml
File metadata and controls
203 lines (198 loc) · 7.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
pre-commit:
output: true
commands:
json-validity:
glob: "**/*.json"
exclude:
- "cli/tests/fixtures/**"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "❌ node not available; cannot validate JSON"
exit 1
fi
node scripts/validate-json.mjs {files}
yaml-validity:
glob: "**/*.{yml,yaml}"
exclude:
- "plugins/*/skills/*/assets/**"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "❌ node not available; cannot validate YAML"
exit 1
fi
node scripts/validate-yaml.mjs {files}
scripts-tests:
glob: "{scripts,plugins,cli/src}/**"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping scripts-tests"
exit 0
fi
# `node --test <dir>` fails on a directory, so a glob is required — and a glob
# matching nothing exits 0 in silence, so a renamed folder must be caught by a count.
found=$(ls scripts/__tests__/*.test.js 2>/dev/null | wc -l | tr -d ' ')
if [ "$found" -eq 0 ]; then
echo "❌ no test files under scripts/__tests__/; the runner is not wired"
exit 1
fi
# Wrapped: a suite writing into this repository's own .git/hooks passes every
# assertion and destroys an install nothing can restore — `.git` is in no history.
node scripts/check-tests-leave-git-alone.js -- \
node --test 'scripts/__tests__/**/*.test.js'
skill-frontmatter:
glob: "plugins/*/skills/*/SKILL.md"
run: |
for f in {files}; do
[ -f "$f" ] || continue
if ! head -10 "$f" | grep -q "^name:"; then
echo "❌ missing 'name:' frontmatter: $f"
exit 1
fi
if ! head -10 "$f" | grep -q "^description:"; then
echo "❌ missing 'description:' frontmatter: $f"
exit 1
fi
done
check-skill-argument-hints:
glob: "plugins/*/skills/**"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping check-skill-argument-hints"
exit 0
fi
node scripts/check-skill-argument-hints.mjs
architecture-rules:
glob: "plugins/*/{skills,agents}/**/*.md"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping architecture-rules"
exit 0
fi
node scripts/check-architecture-rules.js {files}
context-imports:
# Two patterns: "**/" needs a literal slash, so it never matches a repository-root file.
glob:
- "{CLAUDE,AGENTS,copilot-instructions}.md"
- "**/{CLAUDE,AGENTS,copilot-instructions}.md"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping context-imports"
exit 0
fi
node scripts/check-context-imports.js
context-reference-form:
# The whole repository, not the staged files: the hook rewrites every target at once,
# so a partial view could call one file clean while its sibling drifted.
glob:
- "{CLAUDE,AGENTS,copilot-instructions}.md"
- "**/{CLAUDE,AGENTS,copilot-instructions}.md"
- "plugins/aidd-context/hooks/update_memory.js"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping context-reference-form"
exit 0
fi
node scripts/check-context-reference-form.js
referenced-paths:
glob: "{*.md,docs/**,aidd_docs/memory/**}"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping referenced-paths"
exit 0
fi
node scripts/check-referenced-paths.js
doc-duplication:
glob: "**/*.md"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping doc-duplication"
exit 0
fi
node scripts/check-doc-duplication.js
markdown-links:
glob: "**/*.md"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping markdown-links"
exit 0
fi
# Both ignored trees hold deliberately unresolvable targets — fixture paths and
# `@src/foo.ts` agent mentions — not links a reader is meant to follow.
node scripts/check-markdown-links.js --ignore cli/tests/fixtures --ignore cli/aidd_docs/tasks
summarize-plugin-catalogs:
run: |
[ -d plugins ] || exit 0
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping summarize-plugin-catalogs"
exit 0
fi
for plugin in plugins/*/; do
name=$(basename "$plugin")
node scripts/summarize-markdown.js "$plugin" "${plugin}CATALOG.md" \
--depth=4 \
--fields=description \
--title="$name catalog" \
--tagline="Auto-generated index of skills, agents, references and assets shipped by the \`$name\` plugin." \
>/dev/null
git add "${plugin}CATALOG.md" 2>/dev/null || true
done
summarize-telemetry-prompts-doc:
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping summarize-telemetry-prompts-doc"
exit 0
fi
node scripts/summarize-markdown.js plugins/aidd-telemetry docs/prompts-documentation.md \
--depth=3 \
--fields=description \
>/dev/null
git add docs/prompts-documentation.md 2>/dev/null || true
sync-readme-counts:
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping sync-readme-counts"
exit 0
fi
node scripts/sync-readme-counts.mjs >/dev/null
git add README.md 2>/dev/null || true
cli-biome:
glob: "cli/**"
run: cd cli && pnpm lint
cli-architecture:
# The suite reads source as text only, and reads well beyond cli/src: narrower globs
# kept going stale, so this one is the whole surface plus the automation files.
glob: "{cli/**,lefthook.yml,.github/workflows/**}"
run: cd cli && pnpm test:arch
cli-typecheck:
glob: "cli/**"
run: cd cli && pnpm typecheck
cli-type-honesty:
# Type honesty only; dependency direction between layers belongs to biome
# (cli/biome.json's noRestrictedImports overrides), not here.
glob: "{cli/src/**,cli/tests/**}"
run: |
if ! command -v node >/dev/null 2>&1; then
echo "ℹ️ node not available; skipping cli-type-honesty"
exit 0
fi
node scripts/check-cli-type-honesty.mjs
pre-push:
commands:
cli-knip:
glob: "cli/**"
run: node scripts/gate-witness.js cli-knip -- pnpm --dir cli knip
cli-test:
glob: "cli/**"
run: node scripts/gate-witness.js cli-test -- pnpm --dir cli test
commit-msg:
commands:
commitlint:
run: pnpm exec commitlint --edit {1}
# lefthook owns prepare-commit-msg here and regenerates it on install, so `aidd telemetry on`'s
# delegate is called from a job instead. Absent delegate, nothing runs — opt-in per machine.
prepare-commit-msg:
commands:
aidd-session-trailer:
run: |
delegate="$(git rev-parse --git-common-dir)/hooks/aidd-session-trailer.sh"
if [ -f "$delegate" ]; then sh "$delegate" {1} {2}; fi