* feat(#22): add plan_review.source_grounding + _authority config keys Two additive opt-out keys for the drift guard: source_grounding (bool, default true) gates the source-grounded reviewer pass; _authority (enum grep|intel|treesitter|lsp|scip, default grep) selects the resolver rung. No existing default changed. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(#22): add intel api-surface renderer + CLI subcommand Renders .planning/intel/api-map.json into a human-readable API-SURFACE.md for planner injection. Empty/missing map still writes a surface that announces itself incomplete (absence = unknown, not 'does not exist'). Gated on intel.enabled like all intel functions. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(#22): add source-grounding pass to plan-review-convergence Default-on reviewer pass (plan_review.source_grounding) that enumerates every symbol a plan cites, excludes declared new artifacts, resolves each against source via the configured authority adapter, and records three-valued verdicts. rung-0/1 MISSING is needs-acknowledgement, not a hard block; UNCHECKABLE is logged in a REVIEWS.md coverage section. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(#22): inject API-SURFACE.md into planner + require Artifacts section When intel.enabled, plan-phase regenerates API-SURFACE.md and injects it as a HINT (prefer, may be incomplete, absence = unknown), never a hard rule. Every plan must now emit an 'Artifacts this phase produces' section so the source-grounding reviewer can separate new symbols from references to existing code. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(#22): surface drift-guard in setup + settings, add docs /gsd:new-project asks to enable plan_review.source_grounding (default Y); /gsd:settings exposes the toggle and authority knob. Documents both config keys in CONFIGURATION.md, the intel api-surface command in COMMANDS.md, the drift guard in USER-GUIDE.md, and links ADR 22 from ARCHITECTURE.md. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(#22): respect AskUserQuestion 4-option cap and plan-phase XL line budget settings drift-guard toggle moved to its own 2-option question; #22 plan-phase additions condensed to bring the file back under the 1810-line XL budget without dropping the intel gate, the incomplete-surface hint, or the Artifacts-section requirement. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(#22): use live slash-command forms in drift-guard docs Doc-parity gate requires every slash-command token in docs/*.md to resolve to a registered command. Corrected the command form(s) referenced in the #22 drift-guard / api-surface documentation. The unresolved token was /gsd-core, matched from the GitHub repo reference "open-gsd/gsd-core#22" in docs/adr/22-plan-drift-guard.md. This is the same pattern as the existing 'test-runner' exemption (open-gsd/gsd-test-runner). Added 'core' to INTERNAL_COMPONENT_SLUGS with a matching explanatory comment. Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(#22): add changeset fragment for drift guard (PR #487) Refs #22 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: CI Rebase Check <ci@gsd-redux> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
199 lines
8.0 KiB
JavaScript
199 lines
8.0 KiB
JavaScript
// allow-test-rule: docs-parity
|
|
// Verifies that issue #22 drift-guard surfacing changes are present:
|
|
// - new-project workflow mentions plan_review.source_grounding
|
|
// - CONFIGURATION.md documents both new config keys
|
|
// - COMMANDS.md mentions gsd-tools intel api-surface
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const ROOT = path.join(__dirname, '..');
|
|
|
|
const NEW_PROJECT_PATH = path.join(ROOT, 'get-shit-done', 'workflows', 'new-project.md');
|
|
const SETTINGS_PATH = path.join(ROOT, 'get-shit-done', 'workflows', 'settings.md');
|
|
const CONFIGURATION_PATH = path.join(ROOT, 'docs', 'CONFIGURATION.md');
|
|
const COMMANDS_PATH = path.join(ROOT, 'docs', 'COMMANDS.md');
|
|
const USER_GUIDE_PATH = path.join(ROOT, 'docs', 'USER-GUIDE.md');
|
|
const ARCHITECTURE_PATH = path.join(ROOT, 'docs', 'ARCHITECTURE.md');
|
|
|
|
describe('feat-22-surfacing-docs', () => {
|
|
// ── A1: new-project workflow ─────────────────────────────────────────────
|
|
|
|
test('new-project workflow mentions source_grounding', () => {
|
|
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('source_grounding'),
|
|
'new-project.md must mention source_grounding'
|
|
);
|
|
});
|
|
|
|
test('new-project workflow has Drift Guard question', () => {
|
|
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('Drift Guard'),
|
|
'new-project.md must include a "Drift Guard" question header'
|
|
);
|
|
});
|
|
|
|
test('new-project workflow wires source_grounding into config-new-project call', () => {
|
|
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('"plan_review":{"source_grounding":'),
|
|
'new-project.md config-new-project call must include plan_review.source_grounding'
|
|
);
|
|
});
|
|
|
|
test('new-project workflow has Drift Guard default-yes option', () => {
|
|
const content = fs.readFileSync(NEW_PROJECT_PATH, 'utf-8');
|
|
// Both question blocks (auto and interactive) should have the yes option
|
|
const count = (content.match(/Yes \(Recommended\).*catches hallucinated names/g) || []).length;
|
|
assert.ok(
|
|
count >= 1,
|
|
'new-project.md must have at least one Drift Guard "Yes (Recommended)" option'
|
|
);
|
|
});
|
|
|
|
// ── A2: settings workflow ────────────────────────────────────────────────
|
|
|
|
test('settings workflow mentions source_grounding in read_current step', () => {
|
|
const content = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('plan_review.source_grounding'),
|
|
'settings.md must mention plan_review.source_grounding in the read_current step'
|
|
);
|
|
});
|
|
|
|
test('settings workflow has Drift Guard AskUserQuestion toggle', () => {
|
|
const content = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('Drift Guard'),
|
|
'settings.md must include a "Drift Guard" question header'
|
|
);
|
|
});
|
|
|
|
test('settings workflow update_config includes plan_review.source_grounding', () => {
|
|
const content = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('"source_grounding": true/false'),
|
|
'settings.md update_config block must include source_grounding: true/false'
|
|
);
|
|
});
|
|
|
|
test('settings workflow mentions source_grounding_authority', () => {
|
|
const content = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('source_grounding_authority'),
|
|
'settings.md must mention source_grounding_authority'
|
|
);
|
|
});
|
|
|
|
test('settings confirm table includes Plan Drift Guard row', () => {
|
|
const content = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('Plan Drift Guard'),
|
|
'settings.md confirm table must include a "Plan Drift Guard" row'
|
|
);
|
|
});
|
|
|
|
// ── B1: CONFIGURATION.md ─────────────────────────────────────────────────
|
|
|
|
test('CONFIGURATION.md documents plan_review.source_grounding', () => {
|
|
const content = fs.readFileSync(CONFIGURATION_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('`plan_review.source_grounding`'),
|
|
'CONFIGURATION.md must document plan_review.source_grounding'
|
|
);
|
|
});
|
|
|
|
test('CONFIGURATION.md documents plan_review.source_grounding_authority', () => {
|
|
const content = fs.readFileSync(CONFIGURATION_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('`plan_review.source_grounding_authority`'),
|
|
'CONFIGURATION.md must document plan_review.source_grounding_authority'
|
|
);
|
|
});
|
|
|
|
test('CONFIGURATION.md documents grep as default authority', () => {
|
|
const content = fs.readFileSync(CONFIGURATION_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('`grep`') && content.includes('source_grounding_authority'),
|
|
'CONFIGURATION.md must document grep as the default source_grounding_authority'
|
|
);
|
|
});
|
|
|
|
test('CONFIGURATION.md lists all five authority enum values', () => {
|
|
const content = fs.readFileSync(CONFIGURATION_PATH, 'utf-8');
|
|
const authorities = ['grep', 'intel', 'treesitter', 'lsp', 'scip'];
|
|
const missing = authorities.filter(a => !content.includes(a));
|
|
assert.deepStrictEqual(
|
|
missing,
|
|
[],
|
|
`CONFIGURATION.md must list all authority values; missing: ${missing.join(', ')}`
|
|
);
|
|
});
|
|
|
|
// ── B2: COMMANDS.md ───────────────────────────────────────────────────────
|
|
|
|
test('COMMANDS.md mentions intel api-surface', () => {
|
|
const content = fs.readFileSync(COMMANDS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('intel api-surface'),
|
|
'COMMANDS.md must document the gsd-tools intel api-surface command'
|
|
);
|
|
});
|
|
|
|
test('COMMANDS.md documents api-surface gating on intel.enabled', () => {
|
|
const content = fs.readFileSync(COMMANDS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('intel.enabled'),
|
|
'COMMANDS.md intel api-surface section must mention the intel.enabled gate'
|
|
);
|
|
});
|
|
|
|
test('COMMANDS.md mentions API-SURFACE.md output', () => {
|
|
const content = fs.readFileSync(COMMANDS_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('API-SURFACE.md'),
|
|
'COMMANDS.md must mention the API-SURFACE.md output file'
|
|
);
|
|
});
|
|
|
|
// ── B3: USER-GUIDE.md ─────────────────────────────────────────────────────
|
|
|
|
test('USER-GUIDE.md has Plan Drift Guard subsection', () => {
|
|
const content = fs.readFileSync(USER_GUIDE_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('### Plan Drift Guard'),
|
|
'USER-GUIDE.md must have a "### Plan Drift Guard" subsection'
|
|
);
|
|
});
|
|
|
|
test('USER-GUIDE.md mentions needs-acknowledgement behavior', () => {
|
|
const content = fs.readFileSync(USER_GUIDE_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('needs-acknowledgement'),
|
|
'USER-GUIDE.md drift guard section must describe needs-acknowledgement behavior'
|
|
);
|
|
});
|
|
|
|
test('USER-GUIDE.md explains drift guard works without intel', () => {
|
|
const content = fs.readFileSync(USER_GUIDE_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('without intel') || content.includes('Works without intel'),
|
|
'USER-GUIDE.md must explain that the drift guard works without intel'
|
|
);
|
|
});
|
|
|
|
// ── B4: ARCHITECTURE.md ───────────────────────────────────────────────────
|
|
|
|
test('ARCHITECTURE.md links to ADR 22', () => {
|
|
const content = fs.readFileSync(ARCHITECTURE_PATH, 'utf-8');
|
|
assert.ok(
|
|
content.includes('adr/22-plan-drift-guard.md') || content.includes('ADR 22'),
|
|
'ARCHITECTURE.md must link to ADR 22 (adr/22-plan-drift-guard.md)'
|
|
);
|
|
});
|
|
});
|