sdd-cli 0.1.11 → 0.1.13

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.
package/README.md CHANGED
@@ -119,6 +119,7 @@ Project names must use letters, numbers, spaces, `-` or `_`, and cannot include
119
119
 
120
120
  The `hello` command is the entry point: it connects to AI, lists active projects, and offers to create a new one or continue.
121
121
  Default behavior is now a guided autopilot from discovery to completion with minimal prompts.
122
+ When you pass direct intent text (`sdd-cli hello "..."`), hello uses auto-guided defaults and minimizes confirmations.
122
123
  Use `--questions` when you want the manual question-by-question flow.
123
124
 
124
125
  ## The happy path (end-to-end flow)
@@ -203,6 +204,15 @@ sdd-cli hello "I want a simple booking system for appointments"
203
204
  5) Check output in:
204
205
  `<workspace>/<project>/requirements/done/<REQ-ID>/`
205
206
 
207
+ ## Recovery quick commands
208
+
209
+ - Continue an existing project:
210
+ `sdd-cli --project <project-name> hello "continue"`
211
+ - Resume from a specific stage:
212
+ `sdd-cli --project <project-name> --from-step test hello "resume"`
213
+ - Script-safe full default run:
214
+ `sdd-cli --non-interactive hello "<your intent>"`
215
+
206
216
  ## Where files are stored (clean repos)
207
217
 
208
218
  By default, the tool writes to a dedicated workspace, not into your repo:
package/dist/cli.js CHANGED
@@ -66,6 +66,7 @@ program
66
66
  .option("--improve", "Trigger self-audit and regenerate")
67
67
  .option("--parallel", "Generate in parallel when supported")
68
68
  .option("--non-interactive", "Run with defaults and without prompt confirmations")
69
+ .option("--from-step <step>", "Resume or start autopilot from step: create|plan|start|test|finish")
69
70
  .option("--project <name>", "Select or name the project")
70
71
  .option("--output <path>", "Override workspace output root");
71
72
  program.hook("preAction", (thisCommand, actionCommand) => {
@@ -75,6 +76,7 @@ program.hook("preAction", (thisCommand, actionCommand) => {
75
76
  improve: Boolean(opts.improve),
76
77
  parallel: Boolean(opts.parallel),
77
78
  nonInteractive: Boolean(opts.nonInteractive),
79
+ fromStep: typeof opts.fromStep === "string" ? opts.fromStep : undefined,
78
80
  project: typeof opts.project === "string" ? opts.project : undefined,
79
81
  output: typeof opts.output === "string" ? opts.output : undefined
80
82
  });
@@ -0,0 +1,16 @@
1
+ export declare const AUTOPILOT_STEPS: readonly ["create", "plan", "start", "test", "finish"];
2
+ export type AutopilotStep = (typeof AUTOPILOT_STEPS)[number];
3
+ export type AutopilotCheckpoint = {
4
+ project: string;
5
+ reqId: string;
6
+ seedText: string;
7
+ flow: string;
8
+ domain: string;
9
+ lastCompleted: AutopilotStep;
10
+ updatedAt: string;
11
+ };
12
+ export declare function normalizeStep(step?: string): AutopilotStep | null;
13
+ export declare function loadCheckpoint(projectName: string): AutopilotCheckpoint | null;
14
+ export declare function saveCheckpoint(projectName: string, checkpoint: AutopilotCheckpoint): void;
15
+ export declare function clearCheckpoint(projectName: string): void;
16
+ export declare function nextStep(step: AutopilotStep): AutopilotStep | null;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AUTOPILOT_STEPS = void 0;
7
+ exports.normalizeStep = normalizeStep;
8
+ exports.loadCheckpoint = loadCheckpoint;
9
+ exports.saveCheckpoint = saveCheckpoint;
10
+ exports.clearCheckpoint = clearCheckpoint;
11
+ exports.nextStep = nextStep;
12
+ const fs_1 = __importDefault(require("fs"));
13
+ const path_1 = __importDefault(require("path"));
14
+ const index_1 = require("../workspace/index");
15
+ exports.AUTOPILOT_STEPS = ["create", "plan", "start", "test", "finish"];
16
+ function checkpointPath(projectName) {
17
+ const workspace = (0, index_1.getWorkspaceInfo)();
18
+ const project = (0, index_1.getProjectInfo)(workspace, projectName);
19
+ return path_1.default.join(project.root, ".autopilot-checkpoint.json");
20
+ }
21
+ function normalizeStep(step) {
22
+ if (!step)
23
+ return null;
24
+ const raw = step.trim().toLowerCase();
25
+ const map = {
26
+ create: "create",
27
+ plan: "plan",
28
+ start: "start",
29
+ test: "test",
30
+ "test-plan": "test",
31
+ finish: "finish"
32
+ };
33
+ return map[raw] ?? null;
34
+ }
35
+ function loadCheckpoint(projectName) {
36
+ const file = checkpointPath(projectName);
37
+ if (!fs_1.default.existsSync(file)) {
38
+ return null;
39
+ }
40
+ try {
41
+ return JSON.parse(fs_1.default.readFileSync(file, "utf-8"));
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ function saveCheckpoint(projectName, checkpoint) {
48
+ const file = checkpointPath(projectName);
49
+ fs_1.default.mkdirSync(path_1.default.dirname(file), { recursive: true });
50
+ fs_1.default.writeFileSync(file, JSON.stringify(checkpoint, null, 2), "utf-8");
51
+ }
52
+ function clearCheckpoint(projectName) {
53
+ const file = checkpointPath(projectName);
54
+ if (fs_1.default.existsSync(file)) {
55
+ fs_1.default.rmSync(file, { force: true });
56
+ }
57
+ }
58
+ function nextStep(step) {
59
+ const idx = exports.AUTOPILOT_STEPS.indexOf(step);
60
+ if (idx < 0 || idx + 1 >= exports.AUTOPILOT_STEPS.length) {
61
+ return null;
62
+ }
63
+ return exports.AUTOPILOT_STEPS[idx + 1];
64
+ }
@@ -13,12 +13,16 @@ const req_start_1 = require("./req-start");
13
13
  const req_finish_1 = require("./req-finish");
14
14
  const route_1 = require("./route");
15
15
  const test_plan_1 = require("./test-plan");
16
+ const autopilot_checkpoint_1 = require("./autopilot-checkpoint");
16
17
  function printStep(step, description) {
17
18
  console.log(`${step}: ${description}`);
18
19
  }
19
20
  function printWhy(message) {
20
21
  console.log(` -> ${message}`);
21
22
  }
23
+ function printRecoveryNext(project, step, hint) {
24
+ console.log(`Next command: sdd-cli --project "${project}" --from-step ${step} hello "${hint}"`);
25
+ }
22
26
  function deriveProjectName(input, flow) {
23
27
  const seed = input
24
28
  .trim()
@@ -98,35 +102,38 @@ async function runHello(input, runQuestions) {
98
102
  return { workspace, projects };
99
103
  }
100
104
  let { workspace, projects } = loadWorkspace();
105
+ const runtimeFlags = (0, flags_1.getFlags)();
106
+ const hasDirectIntent = input.trim().length > 0;
107
+ const shouldRunQuestions = runQuestions === true;
108
+ const autoGuidedMode = !shouldRunQuestions && (runtimeFlags.nonInteractive || hasDirectIntent);
101
109
  console.log("Hello from sdd-cli.");
102
110
  console.log(`Workspace: ${workspace.root}`);
103
- const useWorkspace = await (0, prompt_1.confirm)("Use this workspace path? (y/n) ");
104
- if (!useWorkspace) {
105
- const nextPath = await (0, prompt_1.ask)("Workspace path to use (blank to exit): ");
106
- if (!nextPath) {
107
- console.log("Run again from the desired folder or pass --output <path>.");
108
- return;
111
+ if (autoGuidedMode) {
112
+ printWhy("Auto-guided mode active: using current workspace defaults.");
113
+ }
114
+ else {
115
+ const useWorkspace = await (0, prompt_1.confirm)("Use this workspace path? (y/n) ");
116
+ if (!useWorkspace) {
117
+ const nextPath = await (0, prompt_1.ask)("Workspace path to use (blank to exit): ");
118
+ if (!nextPath) {
119
+ console.log("Run again from the desired folder or pass --output <path>.");
120
+ return;
121
+ }
122
+ (0, flags_1.setFlags)({ output: nextPath });
123
+ const reloaded = loadWorkspace();
124
+ workspace = reloaded.workspace;
125
+ projects = reloaded.projects;
126
+ console.log(`Workspace updated: ${workspace.root}`);
109
127
  }
110
- (0, flags_1.setFlags)({ output: nextPath });
111
- const reloaded = loadWorkspace();
112
- workspace = reloaded.workspace;
113
- projects = reloaded.projects;
114
- console.log(`Workspace updated: ${workspace.root}`);
115
128
  }
116
- const flags = (0, flags_1.getFlags)();
117
129
  if (projects.length > 0) {
118
130
  console.log("Active projects:");
119
131
  projects.forEach((project) => {
120
132
  console.log(`- ${project.name} (${project.status})`);
121
133
  });
122
- const choice = await (0, prompt_1.ask)("Start new or continue? (new/continue) ");
123
- const normalized = choice.trim().toLowerCase();
124
- if (normalized === "continue") {
125
- const selected = flags.project || (await (0, prompt_1.ask)("Project to continue: "));
126
- if (!selected) {
127
- console.log("No project selected. Continuing with new flow.");
128
- }
129
- else if (!projects.find((project) => project.name === selected)) {
134
+ if (runtimeFlags.project) {
135
+ const selected = runtimeFlags.project.trim();
136
+ if (!projects.find((project) => project.name === selected)) {
130
137
  console.log(`Project not found: ${selected}. Continuing with new flow.`);
131
138
  }
132
139
  else {
@@ -134,14 +141,49 @@ async function runHello(input, runQuestions) {
134
141
  console.log(`Continuing: ${selected}`);
135
142
  }
136
143
  }
144
+ else if (!autoGuidedMode) {
145
+ const choice = await (0, prompt_1.ask)("Start new or continue? (new/continue) ");
146
+ const normalized = choice.trim().toLowerCase();
147
+ if (normalized === "continue") {
148
+ const selected = await (0, prompt_1.ask)("Project to continue: ");
149
+ if (!selected) {
150
+ console.log("No project selected. Continuing with new flow.");
151
+ }
152
+ else if (!projects.find((project) => project.name === selected)) {
153
+ console.log(`Project not found: ${selected}. Continuing with new flow.`);
154
+ }
155
+ else {
156
+ (0, flags_1.setFlags)({ project: selected });
157
+ console.log(`Continuing: ${selected}`);
158
+ }
159
+ }
160
+ else {
161
+ console.log(`Selected: ${choice || "new"}`);
162
+ }
163
+ }
137
164
  else {
138
- console.log(`Selected: ${choice || "new"}`);
165
+ console.log("Auto-selected: new flow.");
139
166
  }
140
167
  }
141
168
  else {
142
169
  console.log("No active projects found.");
143
170
  }
144
- const text = input || (await (0, prompt_1.ask)("Describe what you want to do: "));
171
+ let text = input || (await (0, prompt_1.ask)("Describe what you want to do: "));
172
+ let checkpoint = null;
173
+ let fromStep = (0, autopilot_checkpoint_1.normalizeStep)(runtimeFlags.fromStep);
174
+ let activeProjectForCheckpoint = runtimeFlags.project;
175
+ if (!shouldRunQuestions && activeProjectForCheckpoint) {
176
+ checkpoint = (0, autopilot_checkpoint_1.loadCheckpoint)(activeProjectForCheckpoint);
177
+ if (!text && checkpoint?.seedText) {
178
+ text = checkpoint.seedText;
179
+ }
180
+ if (!fromStep && checkpoint?.lastCompleted) {
181
+ const candidate = (0, autopilot_checkpoint_1.nextStep)(checkpoint.lastCompleted);
182
+ if (candidate) {
183
+ fromStep = candidate;
184
+ }
185
+ }
186
+ }
145
187
  if (!text) {
146
188
  console.log("No input provided. Try again with a short description.");
147
189
  return;
@@ -157,7 +199,6 @@ async function runHello(input, runQuestions) {
157
199
  else {
158
200
  console.log("Next: run `sdd-cli route <your input>` to view details.");
159
201
  }
160
- const shouldRunQuestions = runQuestions === true;
161
202
  printStep("Step 2/7", "Requirement setup");
162
203
  printWhy("I will gather enough context to generate a valid first draft.");
163
204
  if (shouldRunQuestions) {
@@ -195,8 +236,13 @@ async function runHello(input, runQuestions) {
195
236
  else {
196
237
  let activeProject = (0, flags_1.getFlags)().project;
197
238
  if (!activeProject) {
198
- const quickProject = await (0, prompt_1.ask)("Project name (optional, press Enter to auto-generate): ");
199
- activeProject = quickProject || deriveProjectName(text, intent.flow);
239
+ if (autoGuidedMode) {
240
+ activeProject = deriveProjectName(text, intent.flow);
241
+ }
242
+ else {
243
+ const quickProject = await (0, prompt_1.ask)("Project name (optional, press Enter to auto-generate): ");
244
+ activeProject = quickProject || deriveProjectName(text, intent.flow);
245
+ }
200
246
  }
201
247
  if (!activeProject) {
202
248
  console.log("Project name is required to run autopilot.");
@@ -204,64 +250,116 @@ async function runHello(input, runQuestions) {
204
250
  }
205
251
  printWhy(`Using project: ${activeProject}`);
206
252
  (0, flags_1.setFlags)({ project: activeProject });
207
- const draft = buildAutopilotDraft(text, intent.flow, intent.domain);
208
- draft.project_name = activeProject;
209
- printStep("Step 3/7", "Creating requirement draft automatically");
210
- printWhy("This creates your baseline scope, acceptance criteria, and NFRs.");
211
- const created = await (0, req_create_1.runReqCreate)(draft, { autofill: true });
212
- if (!created) {
213
- console.log("Autopilot stopped at requirement creation.");
214
- return;
253
+ checkpoint = (0, autopilot_checkpoint_1.loadCheckpoint)(activeProject);
254
+ if (checkpoint && !fromStep) {
255
+ const candidate = (0, autopilot_checkpoint_1.nextStep)(checkpoint.lastCompleted);
256
+ if (candidate) {
257
+ fromStep = candidate;
258
+ }
215
259
  }
216
- printStep("Step 4/7", `Planning requirement ${created.reqId}`);
217
- printWhy("I am generating functional, technical, architecture, and test artifacts.");
218
- const planned = await (0, req_plan_1.runReqPlan)({
219
- projectName: activeProject,
220
- reqId: created.reqId,
221
- autofill: true,
222
- seedText: text
223
- });
224
- if (!planned) {
225
- console.log("Autopilot stopped at planning.");
260
+ if (fromStep && !autopilot_checkpoint_1.AUTOPILOT_STEPS.includes(fromStep)) {
261
+ console.log(`Invalid --from-step value. Use one of: ${autopilot_checkpoint_1.AUTOPILOT_STEPS.join(", ")}`);
226
262
  return;
227
263
  }
228
- printStep("Step 5/7", `Preparing implementation plan for ${created.reqId}`);
229
- printWhy("This stage defines milestones, tasks, quality thresholds, and decisions.");
230
- const started = await (0, req_start_1.runReqStart)({
231
- projectName: activeProject,
232
- reqId: created.reqId,
233
- autofill: true,
234
- seedText: text
235
- });
236
- if (!started) {
237
- console.log("Autopilot stopped at start phase.");
264
+ const draft = buildAutopilotDraft(text, intent.flow, intent.domain);
265
+ draft.project_name = activeProject;
266
+ let reqId = checkpoint?.reqId ?? "";
267
+ const startStep = fromStep ?? "create";
268
+ if (startStep !== "create" && !reqId) {
269
+ console.log("No checkpoint found for resume. Run full autopilot first or use --from-step create.");
270
+ printRecoveryNext(activeProject, "create", text);
238
271
  return;
239
272
  }
240
- printStep("Step 6/7", `Updating test plan for ${created.reqId}`);
241
- printWhy("I am ensuring critical paths, edge cases, and regression tests are documented.");
242
- const tested = await (0, test_plan_1.runTestPlan)({
243
- projectName: activeProject,
244
- reqId: created.reqId,
245
- autofill: true,
246
- seedText: text
247
- });
248
- if (!tested) {
249
- console.log("Autopilot stopped at test planning.");
250
- return;
273
+ if (fromStep) {
274
+ printWhy(`Resuming autopilot from step: ${fromStep}`);
251
275
  }
252
- printStep("Step 7/7", `Finalizing requirement ${created.reqId}`);
253
- printWhy("I will move artifacts to done state and generate project-level summary files.");
254
- const finished = await (0, req_finish_1.runReqFinish)({
255
- projectName: activeProject,
256
- reqId: created.reqId,
257
- autofill: true,
258
- seedText: text
259
- });
260
- if (!finished) {
261
- console.log("Autopilot stopped at finish phase.");
262
- return;
276
+ const stepIndex = autopilot_checkpoint_1.AUTOPILOT_STEPS.indexOf(startStep);
277
+ for (let i = stepIndex; i < autopilot_checkpoint_1.AUTOPILOT_STEPS.length; i += 1) {
278
+ const step = autopilot_checkpoint_1.AUTOPILOT_STEPS[i];
279
+ if (step === "create") {
280
+ printStep("Step 3/7", "Creating requirement draft automatically");
281
+ printWhy("This creates your baseline scope, acceptance criteria, and NFRs.");
282
+ const created = await (0, req_create_1.runReqCreate)(draft, { autofill: true });
283
+ if (!created) {
284
+ console.log("Autopilot stopped at requirement creation.");
285
+ printRecoveryNext(activeProject, "create", text);
286
+ return;
287
+ }
288
+ reqId = created.reqId;
289
+ }
290
+ if (step === "plan") {
291
+ printStep("Step 4/7", `Planning requirement ${reqId}`);
292
+ printWhy("I am generating functional, technical, architecture, and test artifacts.");
293
+ const planned = await (0, req_plan_1.runReqPlan)({
294
+ projectName: activeProject,
295
+ reqId,
296
+ autofill: true,
297
+ seedText: text
298
+ });
299
+ if (!planned) {
300
+ console.log("Autopilot stopped at planning.");
301
+ printRecoveryNext(activeProject, "plan", text);
302
+ return;
303
+ }
304
+ }
305
+ if (step === "start") {
306
+ printStep("Step 5/7", `Preparing implementation plan for ${reqId}`);
307
+ printWhy("This stage defines milestones, tasks, quality thresholds, and decisions.");
308
+ const started = await (0, req_start_1.runReqStart)({
309
+ projectName: activeProject,
310
+ reqId,
311
+ autofill: true,
312
+ seedText: text
313
+ });
314
+ if (!started) {
315
+ console.log("Autopilot stopped at start phase.");
316
+ printRecoveryNext(activeProject, "start", text);
317
+ return;
318
+ }
319
+ }
320
+ if (step === "test") {
321
+ printStep("Step 6/7", `Updating test plan for ${reqId}`);
322
+ printWhy("I am ensuring critical paths, edge cases, and regression tests are documented.");
323
+ const tested = await (0, test_plan_1.runTestPlan)({
324
+ projectName: activeProject,
325
+ reqId,
326
+ autofill: true,
327
+ seedText: text
328
+ });
329
+ if (!tested) {
330
+ console.log("Autopilot stopped at test planning.");
331
+ printRecoveryNext(activeProject, "test", text);
332
+ return;
333
+ }
334
+ }
335
+ if (step === "finish") {
336
+ printStep("Step 7/7", `Finalizing requirement ${reqId}`);
337
+ printWhy("I will move artifacts to done state and generate project-level summary files.");
338
+ const finished = await (0, req_finish_1.runReqFinish)({
339
+ projectName: activeProject,
340
+ reqId,
341
+ autofill: true,
342
+ seedText: text
343
+ });
344
+ if (!finished) {
345
+ console.log("Autopilot stopped at finish phase.");
346
+ printRecoveryNext(activeProject, "finish", text);
347
+ return;
348
+ }
349
+ (0, autopilot_checkpoint_1.clearCheckpoint)(activeProject);
350
+ console.log(`Autopilot completed successfully for ${reqId}.`);
351
+ console.log(`Artifacts finalized at: ${finished.doneDir}`);
352
+ return;
353
+ }
354
+ (0, autopilot_checkpoint_1.saveCheckpoint)(activeProject, {
355
+ project: activeProject,
356
+ reqId,
357
+ seedText: text,
358
+ flow: intent.flow,
359
+ domain: intent.domain,
360
+ lastCompleted: step,
361
+ updatedAt: new Date().toISOString()
362
+ });
263
363
  }
264
- console.log(`Autopilot completed successfully for ${created.reqId}.`);
265
- console.log(`Artifacts finalized at: ${finished.doneDir}`);
266
364
  }
267
365
  }
@@ -3,6 +3,7 @@ export type RuntimeFlags = {
3
3
  improve: boolean;
4
4
  parallel: boolean;
5
5
  nonInteractive: boolean;
6
+ fromStep?: string;
6
7
  project?: string;
7
8
  output?: string;
8
9
  };
@@ -7,6 +7,7 @@ const flags = {
7
7
  improve: false,
8
8
  parallel: false,
9
9
  nonInteractive: false,
10
+ fromStep: undefined,
10
11
  project: undefined,
11
12
  output: undefined
12
13
  };
@@ -23,6 +24,9 @@ function setFlags(next) {
23
24
  if ("nonInteractive" in next) {
24
25
  flags.nonInteractive = Boolean(next.nonInteractive);
25
26
  }
27
+ if ("fromStep" in next) {
28
+ flags.fromStep = typeof next.fromStep === "string" ? next.fromStep : undefined;
29
+ }
26
30
  if ("project" in next) {
27
31
  flags.project = typeof next.project === "string" ? next.project : undefined;
28
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdd-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "SDD-first, AI-native CLI for end-to-end delivery.",
5
5
  "homepage": "https://github.com/jdsalasca/sdd-tool#readme",
6
6
  "repository": {