@benchcutlogic/repo-checks 0.0.0-stage → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,466 @@
1
+ import { existsSync, readdirSync } from 'node:fs';
2
+ import { join, resolve } from 'node:path';
3
+ import YAML from 'yaml';
4
+ import { isDirectory, isExcludedPath, listRepoFiles, readTextSafe } from '../fs-utils.js';
5
+ /** Rule IDs shipped by @benchcutlogic/sgpack-packs, accepted without a local rule file. */
6
+ export const BUILTIN_SGPACK_RULE_IDS = new Set([
7
+ 'no-defensive-cast-fallback',
8
+ 'no-defensive-empty-fallback',
9
+ 'no-duplicated-drizzle-enum-tuple',
10
+ 'no-json-parse-cast',
11
+ 'no-non-null-lookup',
12
+ 'no-redundant-nullish-undefined',
13
+ 'require-any-cast-rationale',
14
+ 'require-ast-grep-suppression-reason',
15
+ 'require-double-cast-rationale',
16
+ 'require-promise-catch-rationale',
17
+ 'require-silent-catch-rationale',
18
+ 'no-effect-cached-fallible',
19
+ 'no-effect-v3-apis',
20
+ 'no-inline-schema-decoder',
21
+ 'no-nondeterministic-in-effect-gen',
22
+ 'no-runtime-run-outside-boundary',
23
+ 'no-timeout-then-catch-timeout',
24
+ 'no-unclassified-effect-try',
25
+ 'require-effect-catch-rationale',
26
+ 'require-effect-ignore-rationale',
27
+ 'require-effect-promise-rationale',
28
+ 'require-error-cause-in-catch',
29
+ 'no-ambient-crypto',
30
+ 'no-env-outside-config',
31
+ 'no-raw-analytics-or-unscrubbed-sentry',
32
+ 'no-raw-json-parse',
33
+ 'no-raw-outbound-fetch',
34
+ 'no-raw-request-body-read',
35
+ 'no-unbounded-sqlite-in-bind',
36
+ 'no-effect-in-svelte',
37
+ 'no-raw-io-in-browser-ui',
38
+ 'no-svelte-data-slot-on-anchor',
39
+ 'no-svelte-disabled-link-unstripped',
40
+ 'no-svelte-inline-style-csp',
41
+ 'no-svelte-raw-enum-fallback',
42
+ 'no-ambient-clock-or-uuid-in-tests',
43
+ 'no-fake-timers-or-global-stubs',
44
+ 'no-focused-tests',
45
+ 'no-focused-tests-js',
46
+ 'no-test-class-assertions',
47
+ 'no-test-source-file-read',
48
+ 'no-vacuous-test-assertions',
49
+ 'no-alchemy-unretained-stateful-resource',
50
+ 'cheat-catch-to-succeed',
51
+ 'cheat-effect-promise',
52
+ 'cheat-or-die',
53
+ 'cheat-unused-catch-binding',
54
+ 'no-unpaginated-graphql-first'
55
+ ]);
56
+ const EFFECT_V3_API_RE = /\b(Effect\.catchAll(?:Cause|Defect)?|Context\.GenericTag)\b/;
57
+ const NEGATION_RE = /\b(v3|removed|deprecated|ban|banned|forbid|forbidden|never|do not|don't|avoid|instead of|replaced by|no-effect-v3-apis)\b/i;
58
+ function parseFrontmatter(content) {
59
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
60
+ if (!match) {
61
+ return { data: null, error: 'Missing YAML frontmatter block (`--- ... ---`).' };
62
+ }
63
+ try {
64
+ const parsed = YAML.parse(match[1] ?? '');
65
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
66
+ return { data: null, error: 'Frontmatter must parse to a YAML mapping.' };
67
+ }
68
+ return { data: parsed };
69
+ }
70
+ catch (err) {
71
+ return { data: null, error: `Invalid YAML frontmatter: ${err.message}` };
72
+ }
73
+ }
74
+ function collectKnownRuleIds(root, extraKnown) {
75
+ const ids = new Set([...BUILTIN_SGPACK_RULE_IDS, ...extraKnown]);
76
+ const localRulesDir = join(root, 'ast-grep', 'rules');
77
+ if (isDirectory(localRulesDir)) {
78
+ for (const entry of readdirSync(localRulesDir)) {
79
+ if (entry.endsWith('.yml') || entry.endsWith('.yaml')) {
80
+ const text = readTextSafe(join(localRulesDir, entry));
81
+ if (text) {
82
+ for (const doc of YAML.parseAllDocuments(text)) {
83
+ const obj = doc.toJSON();
84
+ if (obj && typeof obj.id === 'string') {
85
+ ids.add(obj.id);
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ const sgpackPath = join(root, 'sgpack.json');
93
+ const sgpackText = readTextSafe(sgpackPath);
94
+ if (sgpackText) {
95
+ try {
96
+ const parsed = JSON.parse(sgpackText);
97
+ if (parsed.overrides && typeof parsed.overrides === 'object') {
98
+ for (const key of Object.keys(parsed.overrides)) {
99
+ ids.add(key);
100
+ }
101
+ }
102
+ }
103
+ catch {
104
+ // invalid sgpack.json handled separately
105
+ }
106
+ }
107
+ return ids;
108
+ }
109
+ function detectEffectV4(root, files, override) {
110
+ if (typeof override === 'boolean')
111
+ return override;
112
+ const pkgFiles = listRepoFiles(root, files).filter((rel) => rel === 'package.json' || rel.endsWith('/package.json'));
113
+ for (const rel of pkgFiles) {
114
+ const text = readTextSafe(join(root, rel));
115
+ if (!text)
116
+ continue;
117
+ try {
118
+ const pkg = JSON.parse(text);
119
+ const allDeps = {
120
+ ...pkg.dependencies,
121
+ ...pkg.devDependencies,
122
+ ...pkg.peerDependencies
123
+ };
124
+ const effectVer = allDeps['effect'];
125
+ if (typeof effectVer === 'string' && /(^|[\^~>=<\s])4(\.|$)/.test(effectVer)) {
126
+ return true;
127
+ }
128
+ }
129
+ catch {
130
+ // ignore malformed package.json
131
+ }
132
+ }
133
+ return false;
134
+ }
135
+ function collectPackageScripts(root) {
136
+ const scripts = new Set();
137
+ const rootPkgText = readTextSafe(join(root, 'package.json'));
138
+ if (rootPkgText) {
139
+ try {
140
+ const pkg = JSON.parse(rootPkgText);
141
+ if (pkg.scripts) {
142
+ for (const name of Object.keys(pkg.scripts)) {
143
+ scripts.add(name);
144
+ }
145
+ }
146
+ }
147
+ catch {
148
+ // ignore
149
+ }
150
+ }
151
+ return scripts;
152
+ }
153
+ export function checkAgentContracts(ctx) {
154
+ const findings = [];
155
+ const skillsDir = join(ctx.root, '.agents', 'skills');
156
+ const actualSkills = new Set();
157
+ // Skills that exist but are excluded: their contents are not checked, but a table
158
+ // entry that names one is not an orphan.
159
+ const excludedSkills = new Set();
160
+ const skillDocs = [];
161
+ const excluded = (rel) => isExcludedPath(rel, ctx.config.files.exclude);
162
+ // Pass 1: SKILL.md frontmatter (`name`, `description`), no `disable-model-invocation`
163
+ if (!excluded('.agents/skills') && isDirectory(skillsDir)) {
164
+ for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
165
+ if (!entry.isDirectory())
166
+ continue;
167
+ const skillName = entry.name;
168
+ if (excluded(`.agents/skills/${skillName}`) ||
169
+ excluded(`.agents/skills/${skillName}/SKILL.md`)) {
170
+ excludedSkills.add(skillName);
171
+ continue;
172
+ }
173
+ actualSkills.add(skillName);
174
+ const relSkill = `.agents/skills/${skillName}/SKILL.md`;
175
+ const content = readTextSafe(join(ctx.root, relSkill));
176
+ if (content === null) {
177
+ findings.push({
178
+ check: 'agent-contracts',
179
+ severity: 'error',
180
+ file: `.agents/skills/${skillName}`,
181
+ rule: 'skill-missing-md',
182
+ message: `Skill directory '${skillName}' is missing SKILL.md.`
183
+ });
184
+ continue;
185
+ }
186
+ skillDocs.push({ rel: relSkill, content });
187
+ const fm = parseFrontmatter(content);
188
+ if (!fm.data) {
189
+ findings.push({
190
+ check: 'agent-contracts',
191
+ severity: 'error',
192
+ file: relSkill,
193
+ line: 1,
194
+ rule: 'skill-frontmatter',
195
+ message: fm.error ?? 'Invalid SKILL.md frontmatter.'
196
+ });
197
+ }
198
+ else {
199
+ if (typeof fm.data['name'] !== 'string' || fm.data['name'].trim().length === 0) {
200
+ findings.push({
201
+ check: 'agent-contracts',
202
+ severity: 'error',
203
+ file: relSkill,
204
+ line: 1,
205
+ rule: 'skill-frontmatter-name',
206
+ message: 'SKILL.md frontmatter must declare a non-empty `name`.'
207
+ });
208
+ }
209
+ if (typeof fm.data['description'] !== 'string' ||
210
+ fm.data['description'].trim().length === 0) {
211
+ findings.push({
212
+ check: 'agent-contracts',
213
+ severity: 'error',
214
+ file: relSkill,
215
+ line: 1,
216
+ rule: 'skill-frontmatter-description',
217
+ message: 'SKILL.md frontmatter must declare a non-empty `description`.'
218
+ });
219
+ }
220
+ if ('disable-model-invocation' in fm.data) {
221
+ findings.push({
222
+ check: 'agent-contracts',
223
+ severity: 'error',
224
+ file: relSkill,
225
+ line: 1,
226
+ rule: 'skill-disable-model-invocation',
227
+ message: 'SKILL.md must not set `disable-model-invocation`.'
228
+ });
229
+ }
230
+ }
231
+ const lines = content.split(/\r?\n/);
232
+ for (let i = 0; i < lines.length; i += 1) {
233
+ if (/\bdisable-model-invocation\b/.test(lines[i] ?? '')) {
234
+ findings.push({
235
+ check: 'agent-contracts',
236
+ severity: 'error',
237
+ file: relSkill,
238
+ line: i + 1,
239
+ rule: 'skill-disable-model-invocation',
240
+ message: 'SKILL.md must not reference `disable-model-invocation`.'
241
+ });
242
+ break;
243
+ }
244
+ }
245
+ }
246
+ }
247
+ const agentsRel = 'AGENTS.md';
248
+ const agentsContent = excluded(agentsRel) ? null : readTextSafe(join(ctx.root, agentsRel));
249
+ // Pass 2: AGENTS.md skill table <-> .agents/skills/ parity
250
+ if (agentsContent !== null && actualSkills.size > 0) {
251
+ const listedSkills = new Map();
252
+ const lines = agentsContent.split(/\r?\n/);
253
+ let inSkillsSection = false;
254
+ for (let i = 0; i < lines.length; i += 1) {
255
+ const line = lines[i] ?? '';
256
+ const heading = line.match(/^(#{1,6})\s+(.+)/);
257
+ if (heading) {
258
+ inSkillsSection = /\bskills?\b/i.test(heading[2] ?? '');
259
+ continue;
260
+ }
261
+ // Match markdown table row: | `skill-name` | ... or | [skill-name](.agents/skills/skill-name/SKILL.md) |
262
+ const pathRef = line.match(/\.agents\/skills\/([a-z0-9._-]+)\/SKILL\.md/);
263
+ if (pathRef?.[1]) {
264
+ listedSkills.set(pathRef[1], i + 1);
265
+ continue;
266
+ }
267
+ if (inSkillsSection && line.trim().startsWith('|')) {
268
+ const cols = line
269
+ .split('|')
270
+ .map((c) => c.trim())
271
+ .filter(Boolean);
272
+ const firstCol = cols[0] ?? '';
273
+ if (!firstCol ||
274
+ /^-+$/.test(firstCol) ||
275
+ /^skill$/i.test(firstCol) ||
276
+ /^name$/i.test(firstCol)) {
277
+ continue;
278
+ }
279
+ const nameMatch = firstCol.match(/^`?([a-z0-9][a-z0-9_-]*)`?$/);
280
+ if (nameMatch?.[1]) {
281
+ listedSkills.set(nameMatch[1], i + 1);
282
+ }
283
+ }
284
+ }
285
+ if (listedSkills.size > 0) {
286
+ for (const [listed, lineNo] of listedSkills) {
287
+ if (!actualSkills.has(listed) && !excludedSkills.has(listed)) {
288
+ findings.push({
289
+ check: 'agent-contracts',
290
+ severity: 'error',
291
+ file: agentsRel,
292
+ line: lineNo,
293
+ rule: 'skills-table-orphan',
294
+ message: `AGENTS.md lists skill '${listed}', which does not exist in .agents/skills/.`
295
+ });
296
+ }
297
+ }
298
+ for (const actual of actualSkills) {
299
+ if (!listedSkills.has(actual)) {
300
+ findings.push({
301
+ check: 'agent-contracts',
302
+ severity: 'error',
303
+ file: agentsRel,
304
+ rule: 'skills-table-missing',
305
+ message: `Skill '.agents/skills/${actual}' is missing from the AGENTS.md skills table.`
306
+ });
307
+ }
308
+ }
309
+ }
310
+ }
311
+ // Pass 3: Referenced sgpack / ast-grep rule IDs exist
312
+ const knownRuleIds = collectKnownRuleIds(ctx.root, ctx.config.agentContracts.knownRuleIds);
313
+ const docsToInspect = [
314
+ ...(agentsContent !== null ? [{ rel: agentsRel, content: agentsContent }] : []),
315
+ ...skillDocs
316
+ ];
317
+ for (const doc of docsToInspect) {
318
+ const lines = doc.content.split(/\r?\n/);
319
+ for (let i = 0; i < lines.length; i += 1) {
320
+ const line = lines[i] ?? '';
321
+ // Explicit ast-grep-ignore: <rule-id> or rule mentions like `sgpack` rule IDs (`no-*`, `require-*`, `cheat-*`)
322
+ const ignoreRe = /ast-grep-ignore:\s*([a-z0-9-]+)/g;
323
+ let m;
324
+ while ((m = ignoreRe.exec(line)) !== null) {
325
+ const ruleId = m[1];
326
+ if (!knownRuleIds.has(ruleId)) {
327
+ findings.push({
328
+ check: 'agent-contracts',
329
+ severity: 'error',
330
+ file: doc.rel,
331
+ line: i + 1,
332
+ rule: 'unknown-sgpack-rule-id',
333
+ message: `Referenced ast-grep rule ID '${ruleId}' does not exist in local rules or @benchcutlogic/sgpack-packs.`
334
+ });
335
+ }
336
+ }
337
+ // Explicit rule-id references when line mentions ast-grep / sgpack / rule
338
+ if (/\b(ast-grep|sgpack|rule)\b/i.test(line)) {
339
+ const backtickRuleRe = /`((?:no|require|cheat)-[a-z0-9-]+)`/g;
340
+ let rm;
341
+ while ((rm = backtickRuleRe.exec(line)) !== null) {
342
+ const ruleId = rm[1];
343
+ if (!knownRuleIds.has(ruleId)) {
344
+ findings.push({
345
+ check: 'agent-contracts',
346
+ severity: 'error',
347
+ file: doc.rel,
348
+ line: i + 1,
349
+ rule: 'unknown-sgpack-rule-id',
350
+ message: `Referenced rule ID \`${ruleId}\` does not exist in local rules or @benchcutlogic/sgpack-packs.`
351
+ });
352
+ }
353
+ }
354
+ }
355
+ }
356
+ }
357
+ // Pass 4: No stale Effect v3 API references in AGENTS.md / SKILL.md when repo uses Effect v4
358
+ const usesEffectV4 = detectEffectV4(ctx.root, ctx.config.files, ctx.config.agentContracts.effectV4);
359
+ if (usesEffectV4) {
360
+ for (const doc of docsToInspect) {
361
+ const lines = doc.content.split(/\r?\n/);
362
+ for (let i = 0; i < lines.length; i += 1) {
363
+ const line = lines[i] ?? '';
364
+ const match = line.match(EFFECT_V3_API_RE);
365
+ if (match && !NEGATION_RE.test(line)) {
366
+ findings.push({
367
+ check: 'agent-contracts',
368
+ severity: 'error',
369
+ file: doc.rel,
370
+ line: i + 1,
371
+ rule: 'stale-effect-v3-doc',
372
+ message: `Stale Effect v3 API reference '${match[1]}' in Effect v4 repository docs.`
373
+ });
374
+ }
375
+ }
376
+ }
377
+ }
378
+ // Pass 5: Repo facts / Skill repo facts references valid scripts and paths
379
+ const pkgScripts = collectPackageScripts(ctx.root);
380
+ const hasRootPkg = existsSync(join(ctx.root, 'package.json'));
381
+ for (const doc of docsToInspect) {
382
+ const lines = doc.content.split(/\r?\n/);
383
+ let inRepoFacts = false;
384
+ let sectionDepth = 0;
385
+ for (let i = 0; i < lines.length; i += 1) {
386
+ const line = lines[i] ?? '';
387
+ const heading = line.match(/^(#{1,6})\s+(.+)/);
388
+ if (heading) {
389
+ const depth = heading[1].length;
390
+ const title = heading[2].trim();
391
+ if (/^(skill\s+)?repo\s+facts\b/i.test(title)) {
392
+ inRepoFacts = true;
393
+ sectionDepth = depth;
394
+ }
395
+ else if (inRepoFacts && depth <= sectionDepth) {
396
+ inRepoFacts = false;
397
+ }
398
+ continue;
399
+ }
400
+ if (!inRepoFacts)
401
+ continue;
402
+ // Validate `pnpm <script>` or `npm run <script>`
403
+ if (hasRootPkg) {
404
+ const builtinPnpm = new Set([
405
+ 'install',
406
+ 'i',
407
+ 'add',
408
+ 'remove',
409
+ 'rm',
410
+ 'exec',
411
+ 'dlx',
412
+ 'run',
413
+ 'update',
414
+ 'up',
415
+ 'why',
416
+ 'list',
417
+ 'ls',
418
+ 'pack',
419
+ 'publish',
420
+ 'store',
421
+ 'env',
422
+ 'audit',
423
+ 'outdated',
424
+ 'prune'
425
+ ]);
426
+ const scriptRe = /`(?:pnpm(?:\s+run)?|npm\s+run)\s+([a-zA-Z0-9:_-]+)(?:\s[^`]*)?`/g;
427
+ let sm;
428
+ while ((sm = scriptRe.exec(line)) !== null) {
429
+ const scriptName = sm[1];
430
+ if (builtinPnpm.has(scriptName))
431
+ continue;
432
+ if (!pkgScripts.has(scriptName)) {
433
+ findings.push({
434
+ check: 'agent-contracts',
435
+ severity: 'error',
436
+ file: doc.rel,
437
+ line: i + 1,
438
+ rule: 'repo-facts-missing-script',
439
+ message: `Repo facts references script '${scriptName}', which is not defined in package.json.`
440
+ });
441
+ }
442
+ }
443
+ }
444
+ // Validate backticked file paths in Repo facts section
445
+ const pathRe = /`((?:\.\.?\/)?[a-zA-Z0-9._@-]+(?:\/[a-zA-Z0-9._@-]+)+\/?)`/g;
446
+ let pm;
447
+ while ((pm = pathRe.exec(line)) !== null) {
448
+ const candidate = pm[1];
449
+ if (candidate.startsWith('@') || candidate.includes('://'))
450
+ continue;
451
+ const abs = resolve(ctx.root, candidate.replace(/\/+$/, ''));
452
+ if (!existsSync(abs)) {
453
+ findings.push({
454
+ check: 'agent-contracts',
455
+ severity: 'error',
456
+ file: doc.rel,
457
+ line: i + 1,
458
+ rule: 'repo-facts-missing-path',
459
+ message: `Repo facts references path \`${candidate}\`, which does not exist on disk.`
460
+ });
461
+ }
462
+ }
463
+ }
464
+ }
465
+ return { check: 'agent-contracts', findings };
466
+ }
@@ -0,0 +1,2 @@
1
+ import type { CheckContext, CheckResult } from '../types.js';
2
+ export declare function checkAgentsBudget(ctx: CheckContext): CheckResult;
@@ -0,0 +1,122 @@
1
+ import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { isDirectory, isExcludedPath } from '../fs-utils.js';
4
+ export function checkAgentsBudget(ctx) {
5
+ const findings = [];
6
+ const agentsPath = join(ctx.root, 'AGENTS.md');
7
+ const claudePath = join(ctx.root, 'CLAUDE.md');
8
+ const excluded = (rel) => isExcludedPath(rel, ctx.config.files.exclude);
9
+ if (!excluded('AGENTS.md') && existsSync(agentsPath)) {
10
+ const buf = readFileSync(agentsPath);
11
+ const byteLen = buf.byteLength;
12
+ const { warnBytes, maxBytes } = ctx.config.agentsBudget;
13
+ if (byteLen > maxBytes) {
14
+ findings.push({
15
+ check: 'agents-budget',
16
+ severity: 'error',
17
+ file: 'AGENTS.md',
18
+ rule: 'agents-md-size-limit',
19
+ message: `AGENTS.md is ${byteLen} bytes, exceeding the hard ${maxBytes}-byte limit. Move details into skills or linked docs.`
20
+ });
21
+ }
22
+ else if (byteLen > warnBytes) {
23
+ findings.push({
24
+ check: 'agents-budget',
25
+ severity: ctx.strict ? 'error' : 'warning',
26
+ file: 'AGENTS.md',
27
+ rule: 'agents-md-size-warn',
28
+ message: `AGENTS.md is ${byteLen} bytes, above the ${warnBytes}-byte warning threshold (hard limit ${maxBytes} B).`
29
+ });
30
+ }
31
+ if (excluded('CLAUDE.md')) {
32
+ // the consumer excluded CLAUDE.md, so its presence and contents are not checked
33
+ }
34
+ else if (!existsSync(claudePath)) {
35
+ findings.push({
36
+ check: 'agents-budget',
37
+ severity: 'error',
38
+ file: 'CLAUDE.md',
39
+ rule: 'claude-md-missing',
40
+ message: 'AGENTS.md exists without CLAUDE.md. Add a symlink to AGENTS.md or a 1-line CLAUDE.md containing `@AGENTS.md`.'
41
+ });
42
+ }
43
+ else {
44
+ const stat = lstatSync(claudePath);
45
+ if (stat.isSymbolicLink()) {
46
+ const resolvedClaude = realpathSync(claudePath);
47
+ const resolvedAgents = realpathSync(agentsPath);
48
+ if (resolvedClaude !== resolvedAgents) {
49
+ findings.push({
50
+ check: 'agents-budget',
51
+ severity: 'error',
52
+ file: 'CLAUDE.md',
53
+ rule: 'claude-md-symlink-target',
54
+ message: 'CLAUDE.md symlink does not resolve to AGENTS.md.'
55
+ });
56
+ }
57
+ }
58
+ else {
59
+ const claudeText = readFileSync(claudePath, 'utf8');
60
+ if (!claudeText.includes('@AGENTS.md')) {
61
+ findings.push({
62
+ check: 'agents-budget',
63
+ severity: 'error',
64
+ file: 'CLAUDE.md',
65
+ rule: 'claude-md-import',
66
+ message: 'CLAUDE.md must either symlink to AGENTS.md or include `@AGENTS.md`.'
67
+ });
68
+ }
69
+ }
70
+ }
71
+ }
72
+ const agentsSkillsPath = join(ctx.root, '.agents', 'skills');
73
+ const claudeSkillsPath = join(ctx.root, '.claude', 'skills');
74
+ if (!excluded('.agents/skills') && isDirectory(agentsSkillsPath)) {
75
+ if (excluded('.claude/skills')) {
76
+ // the consumer excluded .claude/skills, so parity with .agents/skills is not checked
77
+ }
78
+ else if (!existsSync(claudeSkillsPath)) {
79
+ findings.push({
80
+ check: 'agents-budget',
81
+ severity: 'error',
82
+ file: '.claude/skills',
83
+ rule: 'claude-skills-missing',
84
+ message: '.agents/skills/ exists without .claude/skills parity. Create symlink `.claude/skills -> ../.agents/skills`.'
85
+ });
86
+ }
87
+ else {
88
+ const stat = lstatSync(claudeSkillsPath);
89
+ if (stat.isSymbolicLink()) {
90
+ const resolvedClaude = realpathSync(claudeSkillsPath);
91
+ const resolvedAgents = realpathSync(agentsSkillsPath);
92
+ if (resolvedClaude !== resolvedAgents) {
93
+ findings.push({
94
+ check: 'agents-budget',
95
+ severity: 'error',
96
+ file: '.claude/skills',
97
+ rule: 'claude-skills-symlink-target',
98
+ message: '.claude/skills symlink does not resolve to .agents/skills.'
99
+ });
100
+ }
101
+ }
102
+ else if (stat.isDirectory()) {
103
+ const agentEntries = new Set(readdirSync(agentsSkillsPath));
104
+ const claudeEntries = new Set(readdirSync(claudeSkillsPath));
105
+ for (const name of agentEntries) {
106
+ if (excluded(`.agents/skills/${name}`))
107
+ continue;
108
+ if (!claudeEntries.has(name)) {
109
+ findings.push({
110
+ check: 'agents-budget',
111
+ severity: 'error',
112
+ file: '.claude/skills',
113
+ rule: 'claude-skills-parity',
114
+ message: `Skill '${name}' exists in .agents/skills/ but is missing from .claude/skills/.`
115
+ });
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ return { check: 'agents-budget', findings };
122
+ }
@@ -0,0 +1,2 @@
1
+ import type { CheckContext, CheckResult } from '../types.js';
2
+ export declare function checkDocPaths(ctx: CheckContext): CheckResult;