refactor(#1281): T2 — migrate 12 single-leaf callers off the core spine (batch 1) (#1282)

Per the T1 design rubber-duck, batch by FILE so each tranche drops
convergence-lint allowlist entries. Migrate 12 files' core imports to the
leaf modules directly (behaviour-identical — leaves are the objects core
re-exports by reference):
- io (output/error/ERROR_REASON): agent-command-router, capability-state,
  capability-writer, frontmatter, gsd2-import, learnings, loop-resolver,
  task-command-router
- roadmap-command-router -> config-loader; workstream-inventory -> core-utils
- milestone, verify -> their full leaf sets (both were multi-leaf, not
  single-leaf as first scoped; migrated completely)

All 12 files now import zero core symbols and are removed from the
allowlist (30 -> 18). core.cts re-exports untouched (still serve the
remaining 18 files); teardown is T-final. Stale core.cjs docstrings in the
migrated files corrected to reference io.cjs. No behaviour change.

Closes #1281

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-15 16:18:54 -04:00
committed by GitHub
parent 13414cb168
commit a5f213e73e
13 changed files with 59 additions and 72 deletions

View File

@@ -19,11 +19,11 @@
* Both pure functions (resolveLoopHooks, renderLoopHooks) take explicit
* registry/config arguments so they are trivially testable without I/O.
*
* Dependencies (leaf modules only — no core.cjs circular risk):
* Dependencies (leaf modules only — no circular risk):
* - node:fs / node:path (raw config.json read for capability-key activation)
* - ./config-loader.cjs (loadConfig)
* - ./planning-workspace.cjs (planningDir — to locate config.json)
* - ./core.cjs (output, error)
* - ./io.cjs (output, error)
* - loop-host-contract.cjs (CANONICAL_POINTS via LOOP_HOST_CONTRACT)
* - capability-registry.cjs (byLoopPoint, consumed at call time)
*/
@@ -32,8 +32,8 @@ import fs from 'node:fs';
import path from 'node:path';
// eslint-disable-next-line @typescript-eslint/no-require-imports
import core = require('./core.cjs');
const { output: coreOutput, error: coreError } = core;
import ioMod = require('./io.cjs');
const { output: coreOutput, error: coreError } = ioMod;
// eslint-disable-next-line @typescript-eslint/no-require-imports
import configLoaderModule = require('./config-loader.cjs');
@@ -284,7 +284,7 @@ interface ResolveLoopHooksResult {
* Pure resolver: given a point, registry, and config, returns the active hooks.
*
* Throws if `point` is not one of the 12 canonical points (caller converts to
* core.error). Never throws for malformed registry/hook entries — skips and
* io.error). Never throws for malformed registry/hook entries — skips and
* continues.
*
* Ordering: steps first, then contributions, then gates. Within each array,
@@ -571,7 +571,7 @@ function renderLoopHooks(resolved: ResolveLoopHooksResult): string {
* Command entry point: load registry + config, resolve + render, emit envelope.
*
* Envelope: { point, activeHooks, rendered }
* On invalid point, emits core.error instead of throwing.
* On invalid point, emits io.error instead of throwing.
*
* Config note: FIX 1 replaced _loadMergedConfig (whole-config deep-merge) with a
* per-hook single-key activation resolver (_resolveActivationValue). The resolver