diff --git a/lib/docs-audit-apply.ts b/lib/docs-audit-apply.ts index d73528ea5..cc9f6f0ce 100644 --- a/lib/docs-audit-apply.ts +++ b/lib/docs-audit-apply.ts @@ -12,7 +12,7 @@ import * as path from 'node:path'; /** Files a documentation edit never touches: release metadata, manifests and lockfiles the parent owns. */ const PROTECTED = [/^CHANGELOG\.md$/, /^TODOS\.md$/, /^VERSION$/, /(^|\/)package(-lock)?\.json$/, /(^|\/)(bun\.lockb?|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock|Gemfile\.lock)$/, /(^|\/)sections\/manifest\.json$/, /^agents-digest\//]; -const GENERATED = /^(?:[^\n]*\n){0,2}\nold\n'; + fs.mkdirSync(path.join(root, 'x')); fs.writeFileSync(path.join(root, 'x', 'SKILL.md'), text); + const out = [JSON.stringify({ path: 'x/SKILL.md', action: 'edit', kind: 'stale', summary: 's', old: 'old', new: 'new' }), JSON.stringify({ schema_version: 1, audit_id: 'a1', documentation_section: 'Docs.' })].join('\n'); + const res = applyDocsFindings(root, { audit_id: 'a1', mode: 'write', docs: ['x/SKILL.md'] }, out); + expect(res.result?.blockers.join('\n')).toContain('generated file'); + expect(fs.readFileSync(path.join(root, 'x', 'SKILL.md'), 'utf8')).toBe(text); + } finally { fs.rmSync(root, { recursive: true, force: true }); } + }); +});