feat(sdk): add --ws flag for workstream-aware execution (#1884)
Add a --ws <name> CLI flag that routes all .planning/ paths to .planning/workstreams/<name>/, enabling multi-workstream projects without directory conflicts. Changes: - workstream-utils.ts: validateWorkstreamName() and relPlanningPath() helpers - cli.ts: Parse --ws flag with input validation - types.ts: Add workstream? to GSDOptions - gsd-tools.ts: Inject --ws <name> into all gsd-tools.cjs invocations - config.ts: Resolve workstream-aware config path with root fallback - context-engine.ts: Constructor accepts workstream via positional param - index.ts: GSD class propagates workstream to all subsystems - ws-flag.test.ts: 22 tests covering all workstream functionality Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,7 @@ export class GSD {
|
||||
private readonly defaultMaxBudgetUsd: number;
|
||||
private readonly defaultMaxTurns: number;
|
||||
private readonly autoMode: boolean;
|
||||
private readonly workstream?: string;
|
||||
readonly eventStream: GSDEventStream;
|
||||
|
||||
constructor(options: GSDOptions) {
|
||||
@@ -54,6 +55,7 @@ export class GSD {
|
||||
this.defaultMaxBudgetUsd = options.maxBudgetUsd ?? 5.0;
|
||||
this.defaultMaxTurns = options.maxTurns ?? 50;
|
||||
this.autoMode = options.autoMode ?? false;
|
||||
this.workstream = options.workstream;
|
||||
this.eventStream = new GSDEventStream();
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ export class GSD {
|
||||
const plan = await parsePlanFile(absolutePlanPath);
|
||||
|
||||
// Load project config
|
||||
const config = await loadConfig(this.projectDir);
|
||||
const config = await loadConfig(this.projectDir, this.workstream);
|
||||
|
||||
// Try to load agent definition for tool restrictions
|
||||
const agentDef = await this.loadAgentDefinition();
|
||||
@@ -117,6 +119,7 @@ export class GSD {
|
||||
return new GSDTools({
|
||||
projectDir: this.projectDir,
|
||||
gsdToolsPath: this.gsdToolsPath,
|
||||
workstream: this.workstream,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -133,8 +136,8 @@ export class GSD {
|
||||
async runPhase(phaseNumber: string, options?: PhaseRunnerOptions): Promise<PhaseRunnerResult> {
|
||||
const tools = this.createTools();
|
||||
const promptFactory = new PromptFactory();
|
||||
const contextEngine = new ContextEngine(this.projectDir);
|
||||
const config = await loadConfig(this.projectDir);
|
||||
const contextEngine = new ContextEngine(this.projectDir, undefined, undefined, this.workstream);
|
||||
const config = await loadConfig(this.projectDir, this.workstream);
|
||||
|
||||
// Auto mode: force auto_advance on and skip_discuss off so self-discuss kicks in
|
||||
if (this.autoMode) {
|
||||
@@ -314,6 +317,9 @@ export { CLITransport } from './cli-transport.js';
|
||||
export { WSTransport } from './ws-transport.js';
|
||||
export type { WSTransportOptions } from './ws-transport.js';
|
||||
|
||||
// Workstream utilities
|
||||
export { validateWorkstreamName, relPlanningPath } from './workstream-utils.js';
|
||||
|
||||
// Init workflow
|
||||
export { InitRunner } from './init-runner.js';
|
||||
export type { InitRunnerDeps } from './init-runner.js';
|
||||
|
||||
Reference in New Issue
Block a user