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:
@@ -28,6 +28,7 @@ import {
|
||||
toPosixPath,
|
||||
planningPaths,
|
||||
} from './helpers.js';
|
||||
import { relPlanningPath } from '../workstream-utils.js';
|
||||
import type { QueryHandler } from './utils.js';
|
||||
|
||||
// ─── Types ─────────────────────────────────────────────────────────────────
|
||||
@@ -154,13 +155,13 @@ function extractObjective(content: string): string | null {
|
||||
* @returns QueryResult with PhaseInfo
|
||||
* @throws GSDError with Validation classification if phase identifier missing
|
||||
*/
|
||||
export const findPhase: QueryHandler = async (args, projectDir) => {
|
||||
export const findPhase: QueryHandler = async (args, projectDir, workstream) => {
|
||||
const phase = args[0];
|
||||
if (!phase) {
|
||||
throw new GSDError('phase identifier required', ErrorClassification.Validation);
|
||||
}
|
||||
|
||||
const phasesDir = planningPaths(projectDir).phases;
|
||||
const phasesDir = planningPaths(projectDir, workstream).phases;
|
||||
const normalized = normalizePhaseName(phase);
|
||||
|
||||
const notFound: PhaseInfo = {
|
||||
@@ -179,7 +180,7 @@ export const findPhase: QueryHandler = async (args, projectDir) => {
|
||||
};
|
||||
|
||||
// Search current phases first
|
||||
const relPhasesDir = '.planning/phases';
|
||||
const relPhasesDir = relPlanningPath(workstream) + '/phases';
|
||||
const current = await searchPhaseInDir(phasesDir, relPhasesDir, normalized);
|
||||
if (current) return { data: current };
|
||||
|
||||
@@ -221,13 +222,13 @@ export const findPhase: QueryHandler = async (args, projectDir) => {
|
||||
* @returns QueryResult with { phase, plans[], waves{}, incomplete[], has_checkpoints }
|
||||
* @throws GSDError with Validation classification if phase identifier missing
|
||||
*/
|
||||
export const phasePlanIndex: QueryHandler = async (args, projectDir) => {
|
||||
export const phasePlanIndex: QueryHandler = async (args, projectDir, workstream) => {
|
||||
const phase = args[0];
|
||||
if (!phase) {
|
||||
throw new GSDError('phase required for phase-plan-index', ErrorClassification.Validation);
|
||||
}
|
||||
|
||||
const phasesDir = planningPaths(projectDir).phases;
|
||||
const phasesDir = planningPaths(projectDir, workstream).phases;
|
||||
const normalized = normalizePhaseName(phase);
|
||||
|
||||
// Find phase directory
|
||||
|
||||
Reference in New Issue
Block a user