fix(#1000): align gsd-intel-updater output to canonical intel filenames (#1037)

* fix(#1000): align gsd-intel-updater output to canonical intel filenames

The intel-updater agent was instructed to write short names (files.json,
apis.json, deps.json) and a markdown arch.md, but the intel library + gsd-tools
intel CLI read only the canonical long names from INTEL_FILES (file-roles.json,
api-map.json, dependency-graph.json, arch-decisions.json as JSON). After
/gsd:map-codebase --query refresh the agent output was orphaned — intel status
and validate reported the canonical files missing and intel query returned
nothing.

Renames every short reference to its INTEL_FILES canonical name and converts the
arch output from markdown to queryable arch-decisions.json. Adds a drift-proof
regression test (derived from the exported INTEL_FILES map) in the owning
module's test file tests/intel.test.cjs, reviving the maintainer-approved
approach from closed PR #608.

Closes #1000

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore(#1000): backfill changeset PR number to 1037

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-11 11:36:18 -04:00
committed by GitHub
parent 5599e5a9cf
commit 12d6285b4f
3 changed files with 81 additions and 40 deletions

View File

@@ -25,6 +25,7 @@ const {
intelApiSurface,
ensureIntelDir,
isIntelEnabled,
INTEL_FILES,
} = require('../gsd-core/bin/lib/intel.cjs');
// ─── Helpers ────────────────────────────────────────────────────────────────
@@ -846,3 +847,42 @@ describe('intelApiSurface', () => {
assert.ok('stale' in result, 'result must have stale field');
});
});
describe('#1000 regression: gsd-intel-updater emits canonical intel filenames', () => {
// allow-test-rule: source-text-is-the-product — agents/gsd-intel-updater.md IS the
// system prompt the intel-updater agent runs under; asserting its filename references
// verifies the deployed agent surface contract matches the INTEL_FILES the CLI reads.
const agentPromptPath = path.join(__dirname, '..', 'agents', 'gsd-intel-updater.md');
const agentPrompt = fs.readFileSync(agentPromptPath, 'utf8');
test('references every canonical INTEL_FILES name', () => {
for (const filename of Object.values(INTEL_FILES)) {
assert.ok(
agentPrompt.includes(filename),
`gsd-intel-updater.md must instruct writing the canonical intel file "${filename}" (from INTEL_FILES) that the gsd-tools intel CLI reads; it was missing.`,
);
}
});
test('does not reference orphaned short filenames the CLI never reads', () => {
// Short forms `${key}.json` that are NOT canonical INTEL_FILES values are orphaned —
// the agent must not emit them. Also forbid the markdown arch.md output.
const canonical = new Set(Object.values(INTEL_FILES));
const forbidden = Object.keys(INTEL_FILES)
.map((k) => `${k}.json`)
.filter((short) => !canonical.has(short));
forbidden.push('arch.md');
for (const shortName of forbidden) {
// Guard against substring false-positives (e.g. 'files.json' inside 'file-roles.json'):
// canonical long names never contain these short tokens, verified by the canonical set.
const offendingLines = agentPrompt
.split('\n')
.filter((line) => line.includes(shortName));
assert.strictEqual(
offendingLines.length,
0,
`gsd-intel-updater.md must not reference orphaned short name "${shortName}" the intel CLI never reads. Offending line(s):\n${offendingLines.join('\n')}`,
);
}
});
});