refactor: remove stale SDK router shim wrappers (#298)

* refactor(#297): remove stale sdk router shim wrappers

* test: remove sdk-era refusal wording fixtures
This commit is contained in:
Tom Boucher
2026-05-26 12:21:04 -04:00
committed by GitHub
parent e905ca1c32
commit e4f29feabc
8 changed files with 27 additions and 68 deletions

View File

@@ -9,12 +9,9 @@ const { createHub, ERROR_KINDS, makeInvalidArgs } = require('./command-routing-h
* Manifest-backed phase subcommand router.
* Keeps gsd-tools.cjs thin while preserving existing command semantics.
*
* #175: Hub is CJS-only. The SDK bridge is still separately invokable via
* bin/lib/cjs-sdk-bridge.cjs, but the Hub no longer routes to it.
*
* SDK-only (unsupported in CJS router — error returned before dispatch):
* - list-plans: SDK-only.
* - list-artifacts: SDK-only.
* Unsupported in this router (error returned before dispatch):
* - list-plans.
* - list-artifacts.
* - scaffold: routed through top-level scaffold command.
*
* CJS-only subcommands: mvp-mode (dispatched directly, before hub).
@@ -23,11 +20,11 @@ const { createHub, ERROR_KINDS, makeInvalidArgs } = require('./command-routing-h
* and observable CLI behaviour are unchanged.
*/
function routePhaseCommand({ phase, args, cwd, raw, error }) {
// ── Unsupported / SDK-only subcommands ─────────────────────────────────────
// ── Unsupported subcommands ────────────────────────────────────────────────
// Resolved before dispatch so the error message matches the pre-#3788 text.
const UNSUPPORTED = {
'list-plans': 'phase list-plans is SDK-only. Use: gsd-sdk query phase.list-plans ...',
'list-artifacts': 'phase list-artifacts is SDK-only. Use: gsd-sdk query phase.list-artifacts ...',
'list-plans': 'phase list-plans is not supported in this router.',
'list-artifacts': 'phase list-artifacts is not supported in this router.',
scaffold: 'phase scaffold is routed through the top-level scaffold command.',
};
@@ -149,7 +146,7 @@ function routePhaseCommand({ phase, args, cwd, raw, error }) {
// ── Build manifest (available subcommands for UnknownCommand detection) ─────
// `availableSubcommands` is what the error message shows. It excludes
// SDK-only unsupported commands (already handled above) but does NOT include
// unsupported commands (already handled above) but does NOT include
// 'mvp-mode' because it was absent from PHASE_SUBCOMMANDS in the original
// and was not shown in the "Available:" list there either.
//

View File

@@ -7,25 +7,14 @@ const { routeCjsCommandFamily } = require('./cjs-command-router-adapter.cjs');
* Manifest-backed phases subcommand router.
* Keeps gsd-tools.cjs thin while preserving current CJS semantics.
*
* Phase 6: phases.list and phases.clear are dispatched via executeForCjs when
* the SDK is available. CJS fallback retained when:
* - GSD_WORKSTREAM is active (workstream-scoped requests fall through to CJS).
* - SDK is unavailable (build not present).
*
* SDK-only (not in CJS router, treated as unknown):
* - archive: `phases archive` is SDK-only (`phases.archive` handler in SDK
* query registry). CJS `gsd-tools phases` intentionally supports list/clear only.
* `archive` is excluded from the subcommands list so it falls through to the
* "unknown subcommand" error path (matching pre-Phase 6 behavior).
*
* CJS-only subcommands: none.
* Unsupported in this router (treated as unknown):
* - archive: `phases archive` is excluded from the subcommands list so it
* falls through to the unknown-subcommand error path.
*/
function routePhasesCommand({ phase, milestone, args, cwd, raw, error }) {
routeCjsCommandFamily({
args,
// Exclude 'archive' — it's SDK-only and not supported in CJS. Excluding
// from this list causes it to hit the unknownMessage path, preserving the
// pre-Phase 6 error message for callers that pass 'archive'.
// Exclude 'archive' so it hits the unknownMessage path.
subcommands: PHASES_SUBCOMMANDS.filter((s) => s !== 'archive'),
error,
unknownMessage: (_subcommand, available) => `Unknown phases subcommand. Available: ${available.join(', ')}`,

View File

@@ -6,14 +6,6 @@ const { routeCjsCommandFamily } = require('./cjs-command-router-adapter.cjs');
/**
* Manifest-backed roadmap subcommand router.
* Keeps gsd-tools.cjs thin while preserving existing command semantics.
*
* Phase 6: all roadmap.* subcommands have SDK equivalents and are dispatched
* via executeForCjs (the sync bridge). CJS fallback retained when:
* - GSD_WORKSTREAM is active (workstream-scoped requests fall through to CJS).
* - SDK is unavailable (build not present).
*
* CJS-only subcommands: none.
* SDK-only (unsupported in CJS router): none.
*/
function routeRoadmapCommand({ roadmap, args, cwd, raw, error }) {
routeCjsCommandFamily({

View File

@@ -6,14 +6,6 @@ const { routeCjsCommandFamily } = require('./cjs-command-router-adapter.cjs');
/**
* Manifest-backed verify subcommand router.
* Keeps gsd-tools.cjs thin while preserving existing command semantics.
*
* Phase 6: all verify.* subcommands have SDK equivalents and are dispatched
* via executeForCjs (the sync bridge). CJS fallback retained when:
* - GSD_WORKSTREAM is active (workstream-scoped requests fall through to CJS).
* - SDK is unavailable (build not present).
*
* CJS-only subcommands: none.
* SDK-only (unsupported in CJS router): none.
*/
function routeVerifyCommand({ verify, args, cwd, raw, error }) {
routeCjsCommandFamily({
@@ -37,9 +29,7 @@ function routeVerifyCommand({ verify, args, cwd, raw, error }) {
},
// verify codebase-drift dispatches direct to CJS — drift is out-of-seam
// per ADR/PRD 3524 §3 / L160 (CJS-only by design). Routing through
// sdkHandler would re-enter the SDK bridge, and Phase 6's removed
// verifyCodebaseDrift stub used to execFileSync back to the CLI,
// creating an infinite spawn loop.
// recursive dispatch would re-enter this router path.
'codebase-drift': () => verify.cmdVerifyCodebaseDrift(cwd, raw),
},
});