spets 0.1.39 → 0.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +90 -65
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1360,7 +1360,7 @@ function buildConsolidatePrompt(params) {
1360
1360
  outputPath: group.outputPath
1361
1361
  };
1362
1362
  }
1363
- function buildDraftPrompt(params) {
1363
+ function buildExecutePrompt(params) {
1364
1364
  const cwd = params.cwd || process.cwd();
1365
1365
  const config = loadConfig(cwd);
1366
1366
  const stepsDir = getStepsDir(cwd);
@@ -1386,9 +1386,9 @@ function buildDraftPrompt(params) {
1386
1386
  }
1387
1387
  }
1388
1388
  const parts = [];
1389
- parts.push("# Draft Phase - Document Generation");
1389
+ parts.push("# Execute Phase - Document/Code Generation");
1390
1390
  parts.push("");
1391
- parts.push("Generate the document based on the explored context and user answers.");
1391
+ parts.push("Generate the document/code based on the explored context and user answers.");
1392
1392
  parts.push("");
1393
1393
  parts.push("## Step Instruction");
1394
1394
  parts.push("");
@@ -1775,7 +1775,7 @@ var Orchestrator = class {
1775
1775
  }
1776
1776
  /**
1777
1777
  * Phase 3: Document generation
1778
- * @deprecated Use responsePhaseDraft instead
1778
+ * @deprecated Use responsePhaseExecute instead
1779
1779
  */
1780
1780
  responsePhaseGenerate(state) {
1781
1781
  const steps = this.getSteps();
@@ -1811,9 +1811,9 @@ var Orchestrator = class {
1811
1811
  };
1812
1812
  }
1813
1813
  /**
1814
- * Phase 3 (New): Document generation with explore output
1814
+ * Phase 3 (New): Document/code generation with explore output
1815
1815
  */
1816
- responsePhaseDraft(state) {
1816
+ responsePhaseExecute(state) {
1817
1817
  const steps = this.getSteps();
1818
1818
  const outputPath = this.getOutputPath();
1819
1819
  let previousOutput;
@@ -1839,7 +1839,7 @@ ${issues}`;
1839
1839
  constraints: [],
1840
1840
  dependencies: []
1841
1841
  };
1842
- const { prompt } = buildDraftPrompt({
1842
+ const { prompt } = buildExecutePrompt({
1843
1843
  taskId: state.taskId,
1844
1844
  step: state.currentStep,
1845
1845
  description: state.description,
@@ -1853,7 +1853,7 @@ ${issues}`;
1853
1853
  });
1854
1854
  return {
1855
1855
  type: "phase",
1856
- phase: "draft",
1856
+ phase: "execute",
1857
1857
  step: state.currentStep,
1858
1858
  stepIndex: state.stepIndex,
1859
1859
  totalSteps: state.totalSteps,
@@ -1870,7 +1870,7 @@ ${issues}`;
1870
1870
  revisionFeedback: state.revisionFeedback,
1871
1871
  verifyFeedback
1872
1872
  },
1873
- onComplete: `draft-done ${state.taskId}`
1873
+ onComplete: `execute-done ${state.taskId}`
1874
1874
  };
1875
1875
  }
1876
1876
  /**
@@ -2180,11 +2180,11 @@ ${issues}`;
2180
2180
  this.saveState(state);
2181
2181
  return this.responsePhaseGenerateSections(state);
2182
2182
  }
2183
- state.status = "phase_draft";
2183
+ state.status = "phase_execute";
2184
2184
  state.phase = "draft";
2185
2185
  state.verifyAttempts = 0;
2186
2186
  this.saveState(state);
2187
- return this.responsePhaseDraft(state);
2187
+ return this.responsePhaseExecute(state);
2188
2188
  }
2189
2189
  /**
2190
2190
  * Human answered questions, loop back to clarify phase
@@ -2209,7 +2209,7 @@ ${issues}`;
2209
2209
  }
2210
2210
  /**
2211
2211
  * Phase 3 complete: Document generated, move to approve checkpoint
2212
- * @deprecated Use cmdDraftDone instead for new workflow
2212
+ * @deprecated Use cmdExecuteDone instead for new workflow
2213
2213
  */
2214
2214
  cmdGenerateDone(taskId) {
2215
2215
  const state = this.loadState(taskId);
@@ -2226,9 +2226,9 @@ ${issues}`;
2226
2226
  return this.responseCheckpointApprove(state);
2227
2227
  }
2228
2228
  /**
2229
- * Phase 3 complete (New): Draft generated, move to verify phase
2229
+ * Phase 3 complete (New): Execution complete, move to verify phase
2230
2230
  */
2231
- cmdDraftDone(taskId) {
2231
+ cmdExecuteDone(taskId) {
2232
2232
  const state = this.loadState(taskId);
2233
2233
  if (!state) {
2234
2234
  return this.responseError(`No workflow found: ${taskId}`, taskId);
@@ -2243,10 +2243,16 @@ ${issues}`;
2243
2243
  this.saveState(state);
2244
2244
  return this.responsePhaseVerify(state);
2245
2245
  }
2246
+ /**
2247
+ * @deprecated Use cmdExecuteDone instead
2248
+ */
2249
+ cmdDraftDone(taskId) {
2250
+ return this.cmdExecuteDone(taskId);
2251
+ }
2246
2252
  /**
2247
2253
  * Phase 4 complete (New): Verification done
2248
2254
  * If passed → approve_pending
2249
- * If failed → phase_draft (auto-fix, max 3 attempts)
2255
+ * If failed → phase_execute (auto-fix, max 3 attempts)
2250
2256
  * If max attempts reached → approve_pending with warning
2251
2257
  */
2252
2258
  cmdVerifyDone(taskId, verifyOutput) {
@@ -2269,13 +2275,13 @@ ${issues}`;
2269
2275
  const response = this.responseCheckpointApprove(state);
2270
2276
  return response;
2271
2277
  }
2272
- state.status = "phase_draft";
2278
+ state.status = "phase_execute";
2273
2279
  state.phase = "draft";
2274
2280
  this.saveState(state);
2275
- return this.responsePhaseDraft(state);
2281
+ return this.responsePhaseExecute(state);
2276
2282
  }
2277
2283
  /**
2278
- * @deprecated Use cmdExploreDone, cmdClarifyDone, cmdDraftDone, cmdVerifyDone instead
2284
+ * @deprecated Use cmdExploreDone, cmdClarifyDone, cmdExecuteDone, cmdVerifyDone instead
2279
2285
  */
2280
2286
  cmdDone(taskId) {
2281
2287
  const state = this.loadState(taskId);
@@ -2345,13 +2351,13 @@ ${issues}`;
2345
2351
  if (!state) {
2346
2352
  return this.responseError(`No workflow found: ${taskId}`, taskId);
2347
2353
  }
2348
- state.status = "phase_draft";
2354
+ state.status = "phase_execute";
2349
2355
  state.phase = "draft";
2350
2356
  state.revisionFeedback = feedback;
2351
2357
  state.verifyOutput = void 0;
2352
2358
  state.verifyAttempts = 0;
2353
2359
  this.saveState(state);
2354
- return this.responsePhaseDraft(state);
2360
+ return this.responsePhaseExecute(state);
2355
2361
  }
2356
2362
  /**
2357
2363
  * Reject and stop workflow
@@ -2508,6 +2514,8 @@ ${issues}`;
2508
2514
  return this.responsePhaseContext(state);
2509
2515
  case "phase_generate":
2510
2516
  return this.responsePhaseGenerate(state);
2517
+ case "phase_draft":
2518
+ return this.responsePhaseExecute(state);
2511
2519
  // New 5-phase workflow
2512
2520
  case "phase_explore":
2513
2521
  return this.responsePhaseExplore(state);
@@ -2515,8 +2523,8 @@ ${issues}`;
2515
2523
  return this.responsePhaseClarify(state);
2516
2524
  case "clarify_pending":
2517
2525
  return this.responseCheckpointClarify(state);
2518
- case "phase_draft":
2519
- return this.responsePhaseDraft(state);
2526
+ case "phase_execute":
2527
+ return this.responsePhaseExecute(state);
2520
2528
  case "phase_verify":
2521
2529
  return this.responsePhaseVerify(state);
2522
2530
  // Section-based workflow
@@ -2706,14 +2714,14 @@ var StepExecutor = class {
2706
2714
  return { phase: "generate" };
2707
2715
  }
2708
2716
  // ==========================================================================
2709
- // Phase 3 (New): Draft - Document Generation with Explore Output
2717
+ // Phase 3 (New): Execute - Document/Code Generation with Explore Output
2710
2718
  // ==========================================================================
2711
2719
  /**
2712
- * Execute draft phase - AI creates document using explore output
2720
+ * Execute the execute phase - AI creates document/code using explore output
2713
2721
  */
2714
- async executeDraftPhase(step, context) {
2722
+ async executeExecutePhase(step, context) {
2715
2723
  const attemptInfo = context.verifyAttempts && context.verifyAttempts > 1 ? ` (attempt ${context.verifyAttempts}/3)` : "";
2716
- this.adapter.io.notify(`Phase 3/5: Drafting document for ${step}${attemptInfo}`, "info");
2724
+ this.adapter.io.notify(`Phase 3/5: Executing for ${step}${attemptInfo}`, "info");
2717
2725
  if (!context.exploreOutput && !context.gatheredContext) {
2718
2726
  throw new Error("Explore phase must be completed before draft phase");
2719
2727
  }
@@ -2736,13 +2744,19 @@ var StepExecutor = class {
2736
2744
  verifyFeedback: context.verifyFeedback,
2737
2745
  cwd: this.cwd
2738
2746
  };
2739
- const { prompt, outputPath } = buildDraftPrompt(params);
2747
+ const { prompt, outputPath } = buildExecutePrompt(params);
2740
2748
  await this.adapter.ai.execute({ prompt, outputPath });
2741
2749
  if (!existsSync6(outputPath)) {
2742
2750
  throw new Error(`AI did not create document at ${outputPath}`);
2743
2751
  }
2744
- this.adapter.io.notify(`Document drafted: ${outputPath}`, "success");
2745
- return { phase: "draft" };
2752
+ this.adapter.io.notify(`Document created: ${outputPath}`, "success");
2753
+ return { phase: "execute" };
2754
+ }
2755
+ /**
2756
+ * @deprecated Use executeExecutePhase instead
2757
+ */
2758
+ async executeDraftPhase(step, context) {
2759
+ return this.executeExecutePhase(step, context);
2746
2760
  }
2747
2761
  // ==========================================================================
2748
2762
  // Phase 4 (New): Verify - Self-Validation
@@ -3791,23 +3805,23 @@ async function startCommand(query, options) {
3791
3805
  };
3792
3806
  const result = await stepExecutor.executeClarifyPhase(clarifyResp.step, stepContext);
3793
3807
  response = orchestrator.cmdClarifyDone(taskId, result.questions || []);
3794
- } else if (phaseResponse.phase === "draft") {
3795
- const draftResp = phaseResponse;
3796
- const attemptInfo = draftResp.context.verifyFeedback ? " (auto-fix)" : "";
3797
- console.log(`Phase 3/5: Drafting document${attemptInfo}...
3808
+ } else if (phaseResponse.phase === "execute" || phaseResponse.phase === "draft") {
3809
+ const executeResp = phaseResponse;
3810
+ const attemptInfo = executeResp.context.verifyFeedback ? " (auto-fix)" : "";
3811
+ console.log(`Phase 3/5: Executing${attemptInfo}...
3798
3812
  `);
3799
3813
  const stepContext = {
3800
- taskId: draftResp.taskId,
3801
- description: draftResp.description,
3802
- stepIndex: draftResp.stepIndex,
3803
- totalSteps: draftResp.totalSteps,
3804
- exploreOutput: draftResp.exploreOutput,
3805
- answers: draftResp.answers,
3806
- revisionFeedback: draftResp.context.revisionFeedback,
3807
- verifyFeedback: draftResp.context.verifyFeedback
3814
+ taskId: executeResp.taskId,
3815
+ description: executeResp.description,
3816
+ stepIndex: executeResp.stepIndex,
3817
+ totalSteps: executeResp.totalSteps,
3818
+ exploreOutput: executeResp.exploreOutput,
3819
+ answers: executeResp.answers,
3820
+ revisionFeedback: executeResp.context.revisionFeedback,
3821
+ verifyFeedback: executeResp.context.verifyFeedback
3808
3822
  };
3809
- await stepExecutor.executeDraftPhase(draftResp.step, stepContext);
3810
- response = orchestrator.cmdDraftDone(taskId);
3823
+ await stepExecutor.executeExecutePhase(executeResp.step, stepContext);
3824
+ response = orchestrator.cmdExecuteDone(taskId);
3811
3825
  } else if (phaseResponse.phase === "verify") {
3812
3826
  const verifyResp = phaseResponse;
3813
3827
  console.log(`Phase 4/5: Verifying document (attempt ${verifyResp.verifyAttempts}/${verifyResp.maxAttempts})...
@@ -4113,23 +4127,23 @@ async function resumeCommand(options) {
4113
4127
  };
4114
4128
  const result = await stepExecutor.executeClarifyPhase(clarifyResp.step, stepContext);
4115
4129
  response = orchestrator.cmdClarifyDone(taskId, result.questions || []);
4116
- } else if (phaseResponse.phase === "draft") {
4117
- const draftResp = phaseResponse;
4118
- const attemptInfo = draftResp.context.verifyFeedback ? " (auto-fix)" : "";
4119
- console.log(`Phase 3/5: Drafting document${attemptInfo}...
4130
+ } else if (phaseResponse.phase === "execute" || phaseResponse.phase === "draft") {
4131
+ const executeResp = phaseResponse;
4132
+ const attemptInfo = executeResp.context.verifyFeedback ? " (auto-fix)" : "";
4133
+ console.log(`Phase 3/5: Executing${attemptInfo}...
4120
4134
  `);
4121
4135
  const stepContext = {
4122
- taskId: draftResp.taskId,
4123
- description: draftResp.description,
4124
- stepIndex: draftResp.stepIndex,
4125
- totalSteps: draftResp.totalSteps,
4126
- exploreOutput: draftResp.exploreOutput,
4127
- answers: draftResp.answers,
4128
- revisionFeedback: draftResp.context.revisionFeedback,
4129
- verifyFeedback: draftResp.context.verifyFeedback
4136
+ taskId: executeResp.taskId,
4137
+ description: executeResp.description,
4138
+ stepIndex: executeResp.stepIndex,
4139
+ totalSteps: executeResp.totalSteps,
4140
+ exploreOutput: executeResp.exploreOutput,
4141
+ answers: executeResp.answers,
4142
+ revisionFeedback: executeResp.context.revisionFeedback,
4143
+ verifyFeedback: executeResp.context.verifyFeedback
4130
4144
  };
4131
- await stepExecutor.executeDraftPhase(draftResp.step, stepContext);
4132
- response = orchestrator.cmdDraftDone(taskId);
4145
+ await stepExecutor.executeExecutePhase(executeResp.step, stepContext);
4146
+ response = orchestrator.cmdExecuteDone(taskId);
4133
4147
  } else if (phaseResponse.phase === "verify") {
4134
4148
  const verifyResp = phaseResponse;
4135
4149
  console.log(`Phase 4/5: Verifying document (attempt ${verifyResp.verifyAttempts}/${verifyResp.maxAttempts})...
@@ -4390,7 +4404,7 @@ Parse JSON response \u2192 execute action from table below \u2192 loop until \`t
4390
4404
  |---------|--------|
4391
4405
  | \`explore\` | [ACTION_EXPLORE](#action_explore) |
4392
4406
  | \`clarify\` | [ACTION_CLARIFY](#action_clarify) |
4393
- | \`draft\` | [ACTION_DRAFT](#action_draft) |
4407
+ | \`execute\` | [ACTION_EXECUTE](#action_execute) |
4394
4408
  | \`verify\` | [ACTION_VERIFY](#action_verify) |
4395
4409
  | \`generate-sections\` | [ACTION_PARALLEL_SECTIONS](#action_parallel_sections) |
4396
4410
  | \`consolidate\` | [ACTION_PARALLEL_CONSOLIDATE](#action_parallel_consolidate) |
@@ -4449,17 +4463,17 @@ This ensures identical behavior across CLI, Claude Code, and GitHub modes.
4449
4463
  4. Parse response \u2192 next action
4450
4464
  \`\`\`
4451
4465
 
4452
- ### ACTION_DRAFT
4466
+ ### ACTION_EXECUTE
4453
4467
 
4454
4468
  \`\`\`
4455
4469
  1. Follow the instructions in response.prompt EXACTLY
4456
4470
  2. The prompt tells you:
4457
4471
  - The instruction and template to follow
4458
4472
  - The explore output and answers to use
4459
- - Where to save the document (context.output)
4473
+ - Where to save the document/code (context.output)
4460
4474
  - Any revision/verify feedback to address
4461
- 3. Write the document to context.output
4462
- 4. Bash: npx spets orchestrate draft-done {taskId}
4475
+ 3. Write the document/code to context.output
4476
+ 4. Bash: npx spets orchestrate execute-done {taskId}
4463
4477
  5. Parse response \u2192 next action
4464
4478
  \`\`\`
4465
4479
 
@@ -4624,7 +4638,7 @@ npx spets orchestrate init "<description>"
4624
4638
  npx spets orchestrate explore-done <taskId> '<json>'
4625
4639
  npx spets orchestrate clarify-done <taskId> '<json>'
4626
4640
  npx spets orchestrate clarified <taskId> '<json>'
4627
- npx spets orchestrate draft-done <taskId>
4641
+ npx spets orchestrate execute-done <taskId>
4628
4642
  npx spets orchestrate verify-done <taskId> '<json>'
4629
4643
  npx spets orchestrate approve <taskId>
4630
4644
  npx spets orchestrate revise <taskId> "<feedback>"
@@ -5244,13 +5258,24 @@ async function orchestrateCommand(action, args) {
5244
5258
  outputJSON(result);
5245
5259
  break;
5246
5260
  }
5261
+ case "execute-done": {
5262
+ const taskId = args[0];
5263
+ if (!taskId) {
5264
+ outputError("Task ID is required for execute-done");
5265
+ return;
5266
+ }
5267
+ const result = orchestrator.cmdExecuteDone(taskId);
5268
+ outputJSON(result);
5269
+ break;
5270
+ }
5271
+ // Legacy alias for execute-done
5247
5272
  case "draft-done": {
5248
5273
  const taskId = args[0];
5249
5274
  if (!taskId) {
5250
5275
  outputError("Task ID is required for draft-done");
5251
5276
  return;
5252
5277
  }
5253
- const result = orchestrator.cmdDraftDone(taskId);
5278
+ const result = orchestrator.cmdExecuteDone(taskId);
5254
5279
  outputJSON(result);
5255
5280
  break;
5256
5281
  }
@@ -5391,7 +5416,7 @@ async function orchestrateCommand(action, args) {
5391
5416
  break;
5392
5417
  }
5393
5418
  default:
5394
- outputError(`Unknown action: ${action}. Valid actions: init, explore-done, clarify-done, draft-done, verify-done, clarified, approve, revise, reject, stop, status, sections-done, consolidate-level-done (legacy: context-done, generate-done, done)`);
5419
+ outputError(`Unknown action: ${action}. Valid actions: init, explore-done, clarify-done, execute-done, verify-done, clarified, approve, revise, reject, stop, status, sections-done, consolidate-level-done (legacy: context-done, generate-done, draft-done, done)`);
5395
5420
  }
5396
5421
  } catch (e) {
5397
5422
  outputError(e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spets",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "Spec Driven Development Execution Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",