feat(intel): add queryable codebase intelligence system (#1728)
* feat(intel): add queryable codebase intelligence system
Add persistent codebase intelligence that reduces context overhead:
- lib/intel.cjs: 654-line CLI module with 13 exports (query, status,
diff, snapshot, patch-meta, validate, extract-exports, and more).
Reads config.json directly (not via config-get which hard-exits on
missing keys). Default is DISABLED (user must set intel.enabled: true).
- gsd-tools.cjs: intel case routing with 7 subcommand dispatches
- /gsd-intel command: 4 modes (query, status, diff, refresh). Config
gate uses Read tool. Refresh spawns gsd-intel-updater agent via Task().
- gsd-intel-updater agent: writes 5 artifacts to .planning/intel/
(files.json, apis.json, deps.json, stack.json, arch.md). Uses
gsd-tools intel CLI calls. Completion markers registered in
agent-contracts.md.
- agent-contracts.md: updated with gsd-intel-updater registration
* docs(changelog): add intel system entry for #1688
* test(intel): add comprehensive tests for intel.cjs
Cover disabled gating, query (keys, values, case-insensitive, multi-file,
arch.md text), status (fresh, stale, missing), diff (no baseline, added,
changed), snapshot, validate (missing files, invalid JSON, complete store),
patch-meta, extract-exports (CJS, ESM named, ESM block, missing file),
and gsd-tools CLI routing for intel subcommands.
38 test cases across 10 describe blocks.
* fix(intel): address review feedback — merge markers, redundant requires, gate docs, update route
- Remove merge conflict markers from CHANGELOG.md
- Replace redundant require('path')/require('fs') in isIntelEnabled with top-level bindings
- Add JSDoc notes explaining why intelPatchMeta and intelExtractExports skip isIntelEnabled gate
- Add 'intel update' CLI route in gsd-tools.cjs and update help text
- Fix stale /gsd: colon reference in intelUpdate return message