feat: auto --init flag, headless prompts, and prompt sanitizer (#1417)

* fix: Created 10 headless prompt files (5 workflows + 5 agents) in sdk/p…

- "sdk/prompts/workflows/execute-plan.md"
- "sdk/prompts/workflows/research-phase.md"
- "sdk/prompts/workflows/plan-phase.md"
- "sdk/prompts/workflows/verify-phase.md"
- "sdk/prompts/workflows/discuss-phase.md"
- "sdk/prompts/agents/gsd-executor.md"
- "sdk/prompts/agents/gsd-phase-researcher.md"
- "sdk/prompts/agents/gsd-planner.md"

GSD-Task: S01/T02

* feat: Created prompt-sanitizer.ts, wired headless prompt loading into P…

- "sdk/src/prompt-sanitizer.ts"
- "sdk/src/phase-prompt.ts"
- "sdk/src/gsd-tools.ts"
- "sdk/src/gsd-tools.test.ts"
- "sdk/src/phase-runner-types.test.ts"

GSD-Task: S01/T01

* test: Added 111 unit tests covering sanitizePrompt(), headless prompt l…

- "sdk/src/prompt-sanitizer.test.ts"
- "sdk/src/headless-prompts.test.ts"
- "sdk/src/phase-prompt.test.ts"

GSD-Task: S01/T03

* feat: Wired sdkPromptsDir preference and sanitizePrompt into InitRunner…

- "sdk/src/init-runner.ts"
- "sdk/package.json"

GSD-Task: S02/T01

* feat: add --init flag to auto command for single-command PRD-to-execution

gsd-sdk auto --init @path/to/prd.md now bootstraps the project (init)
then immediately runs the autonomous phase execution loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: add remaining headless prompt files and templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: Extended init-runner.test.ts with 7 sdkPromptsDir preference and…

- "sdk/src/init-runner.test.ts"

GSD-Task: S02/T03

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES
2026-03-26 22:40:34 -06:00
committed by GitHub
parent 0fde35acf9
commit 89f95c43ba
38 changed files with 5146 additions and 49 deletions

View File

@@ -198,6 +198,51 @@ describe('parseCliArgs', () => {
expect(result.initInput).toBeUndefined();
});
// ─── Auto --init parsing ──────────────────────────────────────────────
it('parses auto --init with @file', () => {
const result = parseCliArgs(['auto', '--init', '@prd.md']);
expect(result.command).toBe('auto');
expect(result.init).toBe('@prd.md');
expect(result.initInput).toBeUndefined();
});
it('parses auto --init with raw text', () => {
const result = parseCliArgs(['auto', '--init', 'build a todo app']);
expect(result.command).toBe('auto');
expect(result.init).toBe('build a todo app');
});
it('parses auto --init with other options', () => {
const result = parseCliArgs([
'auto',
'--init', '@spec.md',
'--project-dir', '/tmp/proj',
'--model', 'claude-sonnet-4-6',
'--max-budget', '25',
]);
expect(result.command).toBe('auto');
expect(result.init).toBe('@spec.md');
expect(result.projectDir).toBe('/tmp/proj');
expect(result.model).toBe('claude-sonnet-4-6');
expect(result.maxBudget).toBe(25);
});
it('init is undefined when --init not provided', () => {
const result = parseCliArgs(['auto']);
expect(result.init).toBeUndefined();
});
it('init is undefined for non-auto commands', () => {
const result = parseCliArgs(['run', 'build auth']);
expect(result.init).toBeUndefined();
});
});
// ─── resolveInitInput tests ──────────────────────────────────────────────────
@@ -219,6 +264,7 @@ describe('resolveInitInput', () => {
command: 'init',
prompt: undefined,
initInput: undefined,
init: undefined,
projectDir: tmpDir,
wsPort: undefined,
model: undefined,
@@ -307,4 +353,9 @@ describe('USAGE', () => {
it('describes auto as autonomous lifecycle', () => {
expect(USAGE).toMatch(/auto\s+.*autonomous/i);
});
it('documents --init option', () => {
expect(USAGE).toContain('--init');
expect(USAGE).toContain('Bootstrap from a PRD');
});
});