fix(sdk): forward --ws workstream flag through query dispatch (#2546)

* fix(sdk): forward --ws workstream flag through query dispatch (closes #2524)

- cli.ts: pass args.ws as workstream to registry.dispatch()
- registry.ts: add workstream? param to dispatch(), thread to handler
- utils.ts: add optional workstream? to QueryHandler type signature
- helpers.ts: planningPaths() accepts workstream? and uses relPlanningPath()
- All ~26 query handlers updated to receive and pass workstream to planningPaths()
- Config/commit/intel handlers use _workstream (project-global, not scoped)
- Add failing-then-passing test: tests/bug-2524-sdk-query-ws-flag.test.cjs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(sdk): forward workstream to all downstream query helpers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(test): rewrite #2524 test as static source assertions — no sdk/dist build in CI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-04-21 20:33:24 -04:00
committed by GitHub
parent 7bb6b6452a
commit 5676e2e4ef
31 changed files with 337 additions and 219 deletions

View File

@@ -36,7 +36,7 @@ async function readFileSafe(filePath: string): Promise<string | null> {
}
}
export const checkGates: QueryHandler = async (args, projectDir) => {
export const checkGates: QueryHandler = async (args, projectDir, workstream) => {
const workflow = args[0];
if (!workflow) {
throw new GSDError('workflow name required for check gates', ErrorClassification.Validation);
@@ -51,7 +51,7 @@ export const checkGates: QueryHandler = async (args, projectDir) => {
const blockers: Blocker[] = [];
const warnings: Warning[] = [];
const paths = planningPaths(projectDir);
const paths = planningPaths(projectDir, workstream);
// Gate 1: .continue-here.md in project root
const continueHerePath = join(projectDir, '.continue-here.md');
@@ -82,7 +82,7 @@ export const checkGates: QueryHandler = async (args, projectDir) => {
// Gate 3: Verification debt — check VERIFICATION.md in phase dir if phase provided
if (phaseNum) {
const phaseRes = await findPhase([phaseNum], projectDir);
const phaseRes = await findPhase([phaseNum], projectDir, workstream);
const pdata = phaseRes.data as Record<string, unknown>;
if (pdata.found && pdata.directory) {
const phaseDirFull = join(projectDir, pdata.directory as string);