sdd-cli 0.1.9 → 0.1.10
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/dist/commands/hello.js +44 -11
- package/package.json +1 -1
package/dist/commands/hello.js
CHANGED
|
@@ -13,6 +13,27 @@ 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
|
+
function printStep(step, description) {
|
|
17
|
+
console.log(`${step}: ${description}`);
|
|
18
|
+
}
|
|
19
|
+
function printWhy(message) {
|
|
20
|
+
console.log(` -> ${message}`);
|
|
21
|
+
}
|
|
22
|
+
function deriveProjectName(input, flow) {
|
|
23
|
+
const seed = input
|
|
24
|
+
.trim()
|
|
25
|
+
.toLowerCase()
|
|
26
|
+
.replace(/[^a-z0-9 _-]+/g, " ")
|
|
27
|
+
.replace(/\s+/g, " ")
|
|
28
|
+
.trim()
|
|
29
|
+
.split(" ")
|
|
30
|
+
.filter((token) => token.length > 0)
|
|
31
|
+
.slice(0, 4)
|
|
32
|
+
.join("-");
|
|
33
|
+
const date = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
34
|
+
const base = seed.length > 0 ? seed : flow.toLowerCase();
|
|
35
|
+
return `autopilot-${base}-${date}`;
|
|
36
|
+
}
|
|
16
37
|
function buildAutopilotDraft(input, flow, domain) {
|
|
17
38
|
const cleanInput = input.trim();
|
|
18
39
|
const objective = cleanInput.length > 0 ? cleanInput : "Deliver a clear first requirement draft.";
|
|
@@ -127,16 +148,18 @@ async function runHello(input, runQuestions) {
|
|
|
127
148
|
}
|
|
128
149
|
const intent = (0, intent_1.classifyIntent)(text);
|
|
129
150
|
console.log(`Detected intent: ${intent.intent} -> ${intent.flow}`);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
printStep("Step 1/7", "Intent detected");
|
|
152
|
+
printWhy("I classified your goal and selected the best starting flow.");
|
|
153
|
+
const showRoute = runQuestions === true ? await (0, prompt_1.confirm)("View route details now? (y/n) ") : false;
|
|
154
|
+
if (showRoute && runQuestions === true) {
|
|
133
155
|
(0, route_1.runRoute)(text);
|
|
134
156
|
}
|
|
135
157
|
else {
|
|
136
158
|
console.log("Next: run `sdd-cli route <your input>` to view details.");
|
|
137
159
|
}
|
|
138
160
|
const shouldRunQuestions = runQuestions === true;
|
|
139
|
-
|
|
161
|
+
printStep("Step 2/7", "Requirement setup");
|
|
162
|
+
printWhy("I will gather enough context to generate a valid first draft.");
|
|
140
163
|
if (shouldRunQuestions) {
|
|
141
164
|
const packs = (0, prompt_packs_1.loadPromptPacks)();
|
|
142
165
|
const packIds = intent_1.FLOW_PROMPT_PACKS[intent.flow] ?? [];
|
|
@@ -163,28 +186,35 @@ async function runHello(input, runQuestions) {
|
|
|
163
186
|
if (ok) {
|
|
164
187
|
const created = await (0, req_create_1.runReqCreate)(mapped, { autofill: true });
|
|
165
188
|
if (created) {
|
|
166
|
-
|
|
189
|
+
printStep("Step 3/7", `Draft created (${created.reqId})`);
|
|
167
190
|
console.log("Next suggested command: sdd-cli req refine");
|
|
168
191
|
}
|
|
169
192
|
}
|
|
170
193
|
}
|
|
171
194
|
}
|
|
172
195
|
else {
|
|
173
|
-
|
|
196
|
+
let activeProject = (0, flags_1.getFlags)().project;
|
|
197
|
+
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);
|
|
200
|
+
}
|
|
174
201
|
if (!activeProject) {
|
|
175
202
|
console.log("Project name is required to run autopilot.");
|
|
176
203
|
return;
|
|
177
204
|
}
|
|
205
|
+
printWhy(`Using project: ${activeProject}`);
|
|
178
206
|
(0, flags_1.setFlags)({ project: activeProject });
|
|
179
207
|
const draft = buildAutopilotDraft(text, intent.flow, intent.domain);
|
|
180
208
|
draft.project_name = activeProject;
|
|
181
|
-
|
|
209
|
+
printStep("Step 3/7", "Creating requirement draft automatically");
|
|
210
|
+
printWhy("This creates your baseline scope, acceptance criteria, and NFRs.");
|
|
182
211
|
const created = await (0, req_create_1.runReqCreate)(draft, { autofill: true });
|
|
183
212
|
if (!created) {
|
|
184
213
|
console.log("Autopilot stopped at requirement creation.");
|
|
185
214
|
return;
|
|
186
215
|
}
|
|
187
|
-
|
|
216
|
+
printStep("Step 4/7", `Planning requirement ${created.reqId}`);
|
|
217
|
+
printWhy("I am generating functional, technical, architecture, and test artifacts.");
|
|
188
218
|
const planned = await (0, req_plan_1.runReqPlan)({
|
|
189
219
|
projectName: activeProject,
|
|
190
220
|
reqId: created.reqId,
|
|
@@ -195,7 +225,8 @@ async function runHello(input, runQuestions) {
|
|
|
195
225
|
console.log("Autopilot stopped at planning.");
|
|
196
226
|
return;
|
|
197
227
|
}
|
|
198
|
-
|
|
228
|
+
printStep("Step 5/7", `Preparing implementation plan for ${created.reqId}`);
|
|
229
|
+
printWhy("This stage defines milestones, tasks, quality thresholds, and decisions.");
|
|
199
230
|
const started = await (0, req_start_1.runReqStart)({
|
|
200
231
|
projectName: activeProject,
|
|
201
232
|
reqId: created.reqId,
|
|
@@ -206,7 +237,8 @@ async function runHello(input, runQuestions) {
|
|
|
206
237
|
console.log("Autopilot stopped at start phase.");
|
|
207
238
|
return;
|
|
208
239
|
}
|
|
209
|
-
|
|
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.");
|
|
210
242
|
const tested = await (0, test_plan_1.runTestPlan)({
|
|
211
243
|
projectName: activeProject,
|
|
212
244
|
reqId: created.reqId,
|
|
@@ -217,7 +249,8 @@ async function runHello(input, runQuestions) {
|
|
|
217
249
|
console.log("Autopilot stopped at test planning.");
|
|
218
250
|
return;
|
|
219
251
|
}
|
|
220
|
-
|
|
252
|
+
printStep("Step 7/7", `Finalizing requirement ${created.reqId}`);
|
|
253
|
+
printWhy("I will move artifacts to done state and generate project-level summary files.");
|
|
221
254
|
const finished = await (0, req_finish_1.runReqFinish)({
|
|
222
255
|
projectName: activeProject,
|
|
223
256
|
reqId: created.reqId,
|