sdd-cli 0.1.20 → 0.1.21

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.
@@ -226,7 +226,14 @@ async function runHello(input, runQuestions) {
226
226
  printWhy("I will gather enough context to generate a valid first draft.");
227
227
  printBeginnerTip(beginnerMode, "A requirement draft defines scope, acceptance criteria, and constraints.");
228
228
  if (shouldRunQuestions) {
229
- const packs = (0, prompt_packs_1.loadPromptPacks)();
229
+ let packs;
230
+ try {
231
+ packs = (0, prompt_packs_1.loadPromptPacks)();
232
+ }
233
+ catch (error) {
234
+ (0, errors_1.printError)("SDD-1012", `Unable to load prompt packs: ${error.message}`);
235
+ return;
236
+ }
230
237
  const packIds = intent_1.FLOW_PROMPT_PACKS[intent.flow] ?? [];
231
238
  const answers = {};
232
239
  for (const packId of packIds) {
@@ -9,6 +9,7 @@ const path_1 = __importDefault(require("path"));
9
9
  const paths_1 = require("../paths");
10
10
  const prompt_packs_1 = require("../router/prompt-packs");
11
11
  const index_1 = require("../workspace/index");
12
+ const errors_1 = require("../errors");
12
13
  function listDirectoryNames(dir, ext) {
13
14
  if (!fs_1.default.existsSync(dir)) {
14
15
  return [];
@@ -48,7 +49,14 @@ function runList() {
48
49
  else {
49
50
  templates.forEach((template) => console.log(`- ${template}`));
50
51
  }
51
- const packs = (0, prompt_packs_1.loadPromptPacks)();
52
+ let packs;
53
+ try {
54
+ packs = (0, prompt_packs_1.loadPromptPacks)();
55
+ }
56
+ catch (error) {
57
+ (0, errors_1.printError)("SDD-1421", `Unable to load prompt packs: ${error.message}`);
58
+ return;
59
+ }
52
60
  console.log("Prompt packs:");
53
61
  if (packs.length === 0) {
54
62
  console.log("- none");
@@ -56,9 +64,16 @@ function runList() {
56
64
  else {
57
65
  packs.forEach((pack) => console.log(`- ${pack.id}`));
58
66
  }
59
- const workspace = (0, index_1.getWorkspaceInfo)();
60
- (0, index_1.ensureWorkspace)(workspace);
61
- const projects = (0, index_1.listProjects)(workspace);
67
+ let projects;
68
+ try {
69
+ const workspace = (0, index_1.getWorkspaceInfo)();
70
+ (0, index_1.ensureWorkspace)(workspace);
71
+ projects = (0, index_1.listProjects)(workspace);
72
+ }
73
+ catch (error) {
74
+ (0, errors_1.printError)("SDD-1422", error.message);
75
+ return;
76
+ }
62
77
  console.log("Projects:");
63
78
  if (projects.length === 0) {
64
79
  console.log("- none");
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runQuickstart = runQuickstart;
4
4
  const flags_1 = require("../context/flags");
5
5
  const hello_1 = require("./hello");
6
+ const errors_1 = require("../errors");
6
7
  const QUICKSTART_EXAMPLES = {
7
8
  saas: "Build a SaaS onboarding workflow for first-time users",
8
9
  bugfix: "Fix a high-priority login failure with reproducible steps and tests",
@@ -12,7 +13,10 @@ const QUICKSTART_EXAMPLES = {
12
13
  };
13
14
  function normalizeExample(example) {
14
15
  const value = (example || "saas").trim().toLowerCase();
15
- return QUICKSTART_EXAMPLES[value] ? value : "saas";
16
+ if (!example) {
17
+ return "saas";
18
+ }
19
+ return QUICKSTART_EXAMPLES[value] ? value : null;
16
20
  }
17
21
  async function runQuickstart(example, listExamples) {
18
22
  if (listExamples) {
@@ -23,6 +27,11 @@ async function runQuickstart(example, listExamples) {
23
27
  return;
24
28
  }
25
29
  const selected = normalizeExample(example);
30
+ if (!selected) {
31
+ (0, errors_1.printError)("SDD-1011", `Invalid quickstart example: ${example}`);
32
+ (0, errors_1.printError)("SDD-1011", `Available examples: ${Object.keys(QUICKSTART_EXAMPLES).join(", ")}`);
33
+ return;
34
+ }
26
35
  const seed = QUICKSTART_EXAMPLES[selected];
27
36
  console.log(`Running quickstart example: ${selected}`);
28
37
  (0, flags_1.setFlags)({ nonInteractive: true });
@@ -4,10 +4,25 @@ exports.runRoute = runRoute;
4
4
  const intent_1 = require("../router/intent");
5
5
  const flow_1 = require("../router/flow");
6
6
  const prompt_packs_1 = require("../router/prompt-packs");
7
+ const errors_1 = require("../errors");
7
8
  function runRoute(input) {
8
- const intent = (0, intent_1.classifyIntent)(input);
9
- const flow = (0, flow_1.loadFlow)(intent.flow);
10
- const packs = (0, prompt_packs_1.loadPromptPacks)();
9
+ const text = input.trim();
10
+ if (!text) {
11
+ (0, errors_1.printError)("SDD-1423", "Route input is required.");
12
+ return;
13
+ }
14
+ let intent;
15
+ let flow;
16
+ let packs;
17
+ try {
18
+ intent = (0, intent_1.classifyIntent)(text);
19
+ flow = (0, flow_1.loadFlow)(intent.flow);
20
+ packs = (0, prompt_packs_1.loadPromptPacks)();
21
+ }
22
+ catch (error) {
23
+ (0, errors_1.printError)("SDD-1424", `Unable to load route context: ${error.message}`);
24
+ return;
25
+ }
11
26
  const packIds = intent_1.FLOW_PROMPT_PACKS[intent.flow] ?? [];
12
27
  console.log(JSON.stringify(intent, null, 2));
13
28
  if (flow) {
@@ -15,7 +30,7 @@ function runRoute(input) {
15
30
  console.log(flow);
16
31
  }
17
32
  else {
18
- console.log("\nNo flow script found.");
33
+ (0, errors_1.printError)("SDD-1425", `No flow script found for ${intent.flow}.`);
19
34
  }
20
35
  if (packIds.length > 0) {
21
36
  console.log("\n--- Prompt packs ---\n");
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runScopeList = runScopeList;
4
4
  const index_1 = require("../workspace/index");
5
+ const errors_1 = require("../errors");
5
6
  function runScopeList() {
6
7
  const baseRoot = (0, index_1.getWorkspaceBaseRoot)();
7
8
  const scopes = (0, index_1.listScopes)(baseRoot);
8
9
  if (scopes.length === 0) {
9
- console.log("No scopes found.");
10
+ (0, errors_1.printError)("SDD-1412", "No scopes available in workspace.");
10
11
  return;
11
12
  }
12
13
  console.log(`Workspace base: ${baseRoot}`);
@@ -72,7 +72,7 @@ function runStatus(showNext) {
72
72
  return;
73
73
  }
74
74
  if (!fs_1.default.existsSync(project.root)) {
75
- console.log("No projects found.");
75
+ (0, errors_1.printError)("SDD-1402", `Selected project not found in workspace: ${project.name}`);
76
76
  if (showNext) {
77
77
  console.log('Next command: sdd-cli quickstart --example saas');
78
78
  }
package/dist/paths.js CHANGED
@@ -6,5 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRepoRoot = getRepoRoot;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  function getRepoRoot() {
9
+ const override = process.env.SDD_REPO_ROOT?.trim();
10
+ if (override) {
11
+ return path_1.default.resolve(override);
12
+ }
9
13
  return path_1.default.resolve(__dirname, "..");
10
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdd-cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Use sdd-cli to turn ideas, GitHub/Jira work items, and PR feedback into actionable requirements, specs, plans, and done-ready delivery records with guided workflows.",
5
5
  "keywords": [
6
6
  "cli",