@applica-software-guru/sdd 1.0.0 → 1.0.1

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.
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerApply(program: Command): void;
3
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0CpD"}
@@ -0,0 +1,46 @@
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.registerApply = registerApply;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const sdd_core_1 = require("@applica-software-guru/sdd-core");
9
+ const format_js_1 = require("../ui/format.js");
10
+ const markdown_js_1 = require("../ui/markdown.js");
11
+ function registerApply(program) {
12
+ program
13
+ .command('apply')
14
+ .description('Run the full SDD workflow automatically using an external AI agent')
15
+ .option('--agent <name>', 'Agent to use (default: from config or "claude")')
16
+ .action(async (options) => {
17
+ const sdd = new sdd_core_1.SDD({ root: process.cwd() });
18
+ console.log((0, format_js_1.heading)('SDD Apply'));
19
+ const prompt = await sdd.applyPrompt();
20
+ if (!prompt) {
21
+ console.log((0, format_js_1.info)('Nothing to apply — no open bugs, pending CRs, or pending files.'));
22
+ return;
23
+ }
24
+ // Show the prompt being sent
25
+ console.log(chalk_1.default.dim(' ─'.repeat(30)));
26
+ console.log((0, format_js_1.heading)('Agent Prompt'));
27
+ console.log((0, markdown_js_1.renderMarkdown)(prompt));
28
+ console.log(chalk_1.default.dim(' ─'.repeat(30)));
29
+ const config = await sdd.config();
30
+ const agent = options.agent ?? config.agent ?? 'claude';
31
+ console.log((0, format_js_1.info)(`Using agent: ${chalk_1.default.cyan(agent)}`));
32
+ console.log((0, format_js_1.info)('Starting agent...\n'));
33
+ const exitCode = await (0, sdd_core_1.runAgent)({
34
+ root: process.cwd(),
35
+ prompt,
36
+ agent,
37
+ agents: config.agents,
38
+ });
39
+ if (exitCode !== 0) {
40
+ console.log(chalk_1.default.red(`\n Agent exited with code ${exitCode}`));
41
+ process.exit(exitCode);
42
+ }
43
+ console.log(chalk_1.default.green('\n Agent completed successfully.'));
44
+ });
45
+ }
46
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":";;;;;AAMA,sCA0CC;AA/CD,kDAA0B;AAC1B,8DAAgE;AAChE,+CAAgD;AAChD,mDAAmD;AAEnD,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,oEAAoE,CAAC;SACjF,MAAM,CAAC,gBAAgB,EAAE,iDAAiD,CAAC;SAC3E,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,GAAG,GAAG,IAAI,cAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAE7C,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAO,EAAC,WAAW,CAAC,CAAC,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,IAAA,gBAAI,EAAC,iEAAiE,CAAC,CAAC,CAAC;YACrF,OAAO;QACT,CAAC;QAED,6BAA6B;QAC7B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAA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BAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwFnD"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkDpC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsKnD"}
@@ -13,8 +13,26 @@ const ora_1 = __importDefault(require("ora"));
13
13
  const sdd_core_1 = require("@applica-software-guru/sdd-core");
14
14
  const banner_js_1 = require("../ui/banner.js");
15
15
  const format_js_1 = require("../ui/format.js");
16
+ const markdown_js_1 = require("../ui/markdown.js");
16
17
  const START_PROMPT = `Read INSTRUCTIONS.md and the documentation in product/ and system/, then run \`sdd sync\` to start working.`;
17
- function buildBootstrapPrompt(description) {
18
+ function buildBootstrapPrompt(description, auto) {
19
+ if (auto) {
20
+ return `Read INSTRUCTIONS.md first. This is a new SDD project.
21
+
22
+ Project goal: "${description}"
23
+
24
+ Your task: generate the initial documentation for this project based on the description above. Do NOT ask questions — infer reasonable defaults and create all documentation files directly:
25
+
26
+ - product/vision.md — Product vision and goals
27
+ - product/users.md — User personas
28
+ - product/features/*.md — One file per main feature
29
+ - system/entities.md — Data models (use ### headings per entity)
30
+ - system/architecture.md — Architecture decisions
31
+ - system/tech-stack.md — Technologies and frameworks
32
+ - system/interfaces.md — API contracts
33
+
34
+ Follow the file format described in INSTRUCTIONS.md for the YAML frontmatter. Do NOT write any code, only documentation. Commit all created files when done.`;
35
+ }
18
36
  return `Read INSTRUCTIONS.md first. This is a new SDD project.
19
37
 
20
38
  Project goal: "${description}"
@@ -35,25 +53,56 @@ function registerInit(program) {
35
53
  program
36
54
  .command('init <project-name>')
37
55
  .description('Initialize a new SDD project')
38
- .option('--bootstrap', 'Generate a prompt to create initial documentation with an agent')
39
- .action(async (projectName, options) => {
56
+ .action(async (projectName) => {
40
57
  (0, banner_js_1.printBanner)();
41
58
  const projectDir = (0, node_path_1.resolve)(process.cwd(), projectName);
42
59
  if ((0, node_fs_1.existsSync)((0, node_path_1.resolve)(projectDir, '.sdd'))) {
43
60
  console.log(chalk_1.default.yellow(`\n SDD project already initialized at ${projectName}/\n`));
44
61
  return;
45
62
  }
63
+ const promptTheme = {
64
+ prefix: chalk_1.default.cyan('?'),
65
+ style: { message: (text) => chalk_1.default.cyan.bold(text) },
66
+ };
46
67
  const description = await (0, prompts_1.input)({
47
68
  message: 'What should your project do?',
48
- theme: {
49
- prefix: chalk_1.default.cyan('?'),
50
- style: { message: (text) => chalk_1.default.cyan.bold(text) },
51
- },
69
+ theme: promptTheme,
52
70
  });
53
71
  if (!description.trim()) {
54
72
  console.log(chalk_1.default.yellow('\n No description provided. Aborting.\n'));
55
73
  return;
56
74
  }
75
+ const agentChoice = await (0, prompts_1.select)({
76
+ message: 'Which agent do you use?',
77
+ choices: [
78
+ { value: 'claude', name: 'Claude Code' },
79
+ { value: 'codex', name: 'Codex' },
80
+ { value: 'opencode', name: 'OpenCode' },
81
+ { value: 'other', name: 'Other' },
82
+ ],
83
+ theme: promptTheme,
84
+ });
85
+ let agentName = agentChoice;
86
+ let customCommand;
87
+ if (agentChoice === 'other') {
88
+ agentName = await (0, prompts_1.input)({
89
+ message: 'Agent name:',
90
+ theme: promptTheme,
91
+ });
92
+ customCommand = await (0, prompts_1.input)({
93
+ message: 'Agent command (use $PROMPT_FILE for the prompt file path):',
94
+ theme: promptTheme,
95
+ });
96
+ }
97
+ const bootstrapMode = await (0, prompts_1.select)({
98
+ message: 'How do you want to start?',
99
+ choices: [
100
+ { value: 'skip', name: 'Write docs manually' },
101
+ { value: 'prompt', name: 'Generate bootstrap prompt (copy to clipboard)' },
102
+ { value: 'auto', name: 'Generate and apply bootstrap automatically' },
103
+ ],
104
+ theme: promptTheme,
105
+ });
57
106
  if (!(0, node_fs_1.existsSync)(projectDir)) {
58
107
  (0, node_fs_1.mkdirSync)(projectDir, { recursive: true });
59
108
  }
@@ -63,6 +112,13 @@ function registerInit(program) {
63
112
  }).start();
64
113
  const sdd = new sdd_core_1.SDD({ root: projectDir });
65
114
  const files = await sdd.init({ description: description.trim() });
115
+ // Save agent config
116
+ const config = await sdd.config();
117
+ config.agent = agentName;
118
+ if (customCommand) {
119
+ config.agents = { [agentName]: customCommand };
120
+ }
121
+ await (0, sdd_core_1.writeConfig)(projectDir, config);
66
122
  spinner.stop();
67
123
  // Project created
68
124
  console.log(chalk_1.default.cyan.bold(`\n ${chalk_1.default.white(projectName)} is ready!\n`));
@@ -75,27 +131,55 @@ function registerInit(program) {
75
131
  console.log((0, format_js_1.success)('product/features/'));
76
132
  console.log((0, format_js_1.success)('system/'));
77
133
  console.log((0, format_js_1.success)('code/'));
78
- // Next steps
79
- console.log(chalk_1.default.cyan.bold('\n Next steps:\n'));
80
- console.log(` ${chalk_1.default.white('1.')} Enter the project folder:\n`);
81
- console.log(` ${chalk_1.default.green(`cd ${projectName}`)}\n`);
82
- if (options.bootstrap) {
134
+ if (bootstrapMode === 'auto') {
135
+ const prompt = buildBootstrapPrompt(description.trim(), true);
136
+ console.log(chalk_1.default.dim(' ─'.repeat(30)));
137
+ console.log((0, format_js_1.heading)('Agent Prompt'));
138
+ console.log((0, markdown_js_1.renderMarkdown)(prompt));
139
+ console.log(chalk_1.default.dim(' ─'.repeat(30)));
140
+ console.log((0, format_js_1.info)(`Using agent: ${chalk_1.default.cyan(agentName)}`));
141
+ console.log((0, format_js_1.info)('Starting agent...\n'));
142
+ const exitCode = await (0, sdd_core_1.runAgent)({
143
+ root: projectDir,
144
+ prompt,
145
+ agent: agentName,
146
+ agents: customCommand ? { [agentName]: customCommand } : undefined,
147
+ });
148
+ if (exitCode !== 0) {
149
+ console.log(chalk_1.default.red(`\n Agent exited with code ${exitCode}`));
150
+ process.exit(exitCode);
151
+ }
152
+ console.log(chalk_1.default.green('\n Agent completed successfully.'));
153
+ return;
154
+ }
155
+ if (bootstrapMode === 'prompt') {
156
+ const prompt = buildBootstrapPrompt(description.trim(), false);
157
+ console.log(chalk_1.default.cyan.bold('\n Next steps:\n'));
158
+ console.log(` ${chalk_1.default.white('1.')} Enter the project folder:\n`);
159
+ console.log(` ${chalk_1.default.green(`cd ${projectName}`)}\n`);
83
160
  console.log(` ${chalk_1.default.white('2.')} Open your AI agent and paste the prompt below.`);
84
161
  console.log(` It will ask you a few questions and generate the initial docs.\n`);
162
+ console.log(chalk_1.default.dim(' ─'.repeat(30)));
163
+ console.log((0, format_js_1.heading)('Agent Prompt'));
164
+ console.log((0, markdown_js_1.renderMarkdown)(prompt));
165
+ try {
166
+ await clipboardy_1.default.write(prompt);
167
+ console.log((0, format_js_1.success)('Copied to clipboard — paste it into your agent.\n'));
168
+ }
169
+ catch {
170
+ console.log((0, format_js_1.info)('Copy the prompt above into your agent.\n'));
171
+ }
172
+ return;
85
173
  }
86
- else {
87
- console.log(` ${chalk_1.default.white('2.')} Start writing your documentation in ${chalk_1.default.cyan('product/')} and ${chalk_1.default.cyan('system/')}.`);
88
- console.log(` Check ${chalk_1.default.cyan('INSTRUCTIONS.md')} for the file format.\n`);
89
- console.log(` ${chalk_1.default.white('3.')} When ready, let your AI agent run:\n`);
90
- console.log(` ${chalk_1.default.green('sdd sync')}\n`);
91
- }
92
- // Prompt
93
- const prompt = options.bootstrap
94
- ? buildBootstrapPrompt(description.trim())
95
- : START_PROMPT;
96
- console.log(chalk_1.default.dim(' ─'.repeat(30)));
97
- console.log(chalk_1.default.cyan.bold('\n Agent prompt:\n'));
98
- console.log(chalk_1.default.white(` ${prompt.split('\n').join('\n ')}\n`));
174
+ // skip — manual mode
175
+ console.log(chalk_1.default.cyan.bold('\n Next steps:\n'));
176
+ console.log(` ${chalk_1.default.white('1.')} Enter the project folder:\n`);
177
+ console.log(` ${chalk_1.default.green(`cd ${projectName}`)}\n`);
178
+ console.log(` ${chalk_1.default.white('2.')} Start writing your documentation in ${chalk_1.default.cyan('product/')} and ${chalk_1.default.cyan('system/')}.`);
179
+ console.log(` Check ${chalk_1.default.cyan('INSTRUCTIONS.md')} for the file format.\n`);
180
+ console.log(` ${chalk_1.default.white('3.')} When ready, let your AI agent run:\n`);
181
+ console.log(` ${chalk_1.default.green('sdd sync')}\n`);
182
+ const prompt = START_PROMPT;
99
183
  try {
100
184
  await clipboardy_1.default.write(prompt);
101
185
  console.log((0, format_js_1.success)('Copied to clipboard — paste it into your agent.\n'));
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;AA+BA,oCAwFC;AAtHD,kDAA0B;AAC1B,+CAA0C;AAC1C,4DAAoC;AACpC,qCAAgD;AAChD,yCAAoC;AACpC,8CAAsB;AACtB,8DAAsD;AACtD,+CAA8C;AAC9C,+CAAgD;AAEhD,MAAM,YAAY,GAAG,6GAA6G,CAAC;AAEnI,SAAS,oBAAoB,CAAC,WAAmB;IAC/C,OAAO;;iBAEQ,WAAW;;;;;;;;;;;;yHAY6F,CAAC;AAC1H,CAAC;AAED,SAAgB,YAAY,CAAC,OAAgB;IAC3C,OAAO;SACJ,OAAO,CAAC,qBAAqB,CAAC;SAC9B,WAAW,CAAC,8BAA8B,CAAC;SAC3C,MAAM,CAAC,aAAa,EAAE,iEAAiE,CAAC;SACxF,MAAM,CAAC,KAAK,EAAE,WAAmB,EAAE,OAAO,EAAE,EAAE;QAC7C,IAAA,uBAAW,GAAE,CAAC;QAEd,MAAM,UAAU,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;QAEvD,IAAI,IAAA,oBAAU,EAAC,IAAA,mBAAO,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,0CAA0C,WAAW,KAAK,CAAC,CAAC,CAAC;YACtF,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,IAAA,eAAK,EAAC;YAC9B,OAAO,EA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,CAAC,KAAK,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,QAAQ,eAAK,CAAC,KAAK,CAAC,MAAM,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,KAAK,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,wCAAwC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAClI,OAAO,CAAC,GAAG,CAAC,cAAc,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,KAAK,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,QAAQ,eAAK,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,YAAY,CAAC;QAE5B,IAAI,CAAC;YACH,MAAM,oBAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAO,EAAC,mDAAmD,CAAC,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,GAAG,CAAC,IAAA,gBAAI,EAAC,0CAA0C,CAAC,CAAC,CAAC;QAChE,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
package/dist/index.js CHANGED
@@ -10,11 +10,12 @@ const validate_js_1 = require("./commands/validate.js");
10
10
  const mark_synced_js_1 = require("./commands/mark-synced.js");
11
11
  const cr_js_1 = require("./commands/cr.js");
12
12
  const bug_js_1 = require("./commands/bug.js");
13
+ const apply_js_1 = require("./commands/apply.js");
13
14
  const program = new commander_1.Command();
14
15
  program
15
16
  .name('sdd')
16
17
  .description('Story Driven Development — manage apps through structured documentation')
17
- .version('1.0.0');
18
+ .version('1.0.1');
18
19
  (0, init_js_1.registerInit)(program);
19
20
  (0, status_js_1.registerStatus)(program);
20
21
  (0, diff_js_1.registerDiff)(program);
@@ -23,6 +24,7 @@ program
23
24
  (0, mark_synced_js_1.registerMarkSynced)(program);
24
25
  (0, cr_js_1.registerCR)(program);
25
26
  (0, bug_js_1.registerBug)(program);
27
+ (0, apply_js_1.registerApply)(program);
26
28
  program.parseAsync().catch((err) => {
27
29
  console.error(err.message);
28
30
  process.exit(1);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,gDAAkD;AAClD,oDAAsD;AACtD,gDAAkD;AAClD,gDAAkD;AAClD,wDAA0D;AAC1D,8DAA+D;AAC/D,4CAA8C;AAC9C,8CAAgD;AAEhD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,yEAAyE,CAAC;KACtF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,IAAA,sBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,0BAAc,EAAC,OAAO,CAAC,CAAC;AACxB,IAAA,sBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,sBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,8BAAgB,EAAC,OAAO,CAAC,CAAC;AAC1B,IAAA,mCAAkB,EAAC,OAAO,CAAC,CAAC;AAC5B,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;AACpB,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAC;AAErB,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,gDAAkD;AAClD,oDAAsD;AACtD,gDAAkD;AAClD,gDAAkD;AAClD,wDAA0D;AAC1D,8DAA+D;AAC/D,4CAA8C;AAC9C,8CAAgD;AAChD,kDAAoD;AAEpD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,yEAAyE,CAAC;KACtF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,IAAA,sBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,0BAAc,EAAC,OAAO,CAAC,CAAC;AACxB,IAAA,sBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,sBAAY,EAAC,OAAO,CAAC,CAAC;AACtB,IAAA,8BAAgB,EAAC,OAAO,CAAC,CAAC;AAC1B,IAAA,mCAAkB,EAAC,OAAO,CAAC,CAAC;AAC5B,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;AACpB,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAC;AACrB,IAAA,wBAAa,EAAC,OAAO,CAAC,CAAC;AAEvB,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function renderMarkdown(md: string): string;
2
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/ui/markdown.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEjD"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderMarkdown = renderMarkdown;
4
+ const marked_1 = require("marked");
5
+ const marked_terminal_1 = require("marked-terminal");
6
+ const marked = new marked_1.Marked((0, marked_terminal_1.markedTerminal)());
7
+ function renderMarkdown(md) {
8
+ return marked.parse(md);
9
+ }
10
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/ui/markdown.ts"],"names":[],"mappings":";;AAKA,wCAEC;AAPD,mCAAgC;AAChC,qDAAiD;AAEjD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAA,gCAAc,GAAE,CAAC,CAAC;AAE5C,SAAgB,cAAc,CAAC,EAAU;IACvC,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAW,CAAC;AACpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/sdd",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI for Story Driven Development",
5
5
  "author": "Bruno Fortunato <bruno.fortunato@applica.guru>",
6
6
  "main": "dist/index.js",
@@ -11,12 +11,14 @@
11
11
  "build": "tsc"
12
12
  },
13
13
  "dependencies": {
14
- "@inquirer/prompts": "^7.0.0",
15
14
  "@applica-software-guru/sdd-core": "^1.0.0",
15
+ "@inquirer/prompts": "^7.0.0",
16
16
  "chalk": "^4.1.2",
17
17
  "cli-table3": "^0.6.5",
18
18
  "clipboardy": "^2.3.0",
19
19
  "commander": "^13.0.0",
20
+ "marked": "^15.0.12",
21
+ "marked-terminal": "^7.3.0",
20
22
  "ora": "^5.4.1"
21
23
  }
22
24
  }
@@ -0,0 +1,49 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { SDD, runAgent } from '@applica-software-guru/sdd-core';
4
+ import { heading, info } from '../ui/format.js';
5
+ import { renderMarkdown } from '../ui/markdown.js';
6
+
7
+ export function registerApply(program: Command): void {
8
+ program
9
+ .command('apply')
10
+ .description('Run the full SDD workflow automatically using an external AI agent')
11
+ .option('--agent <name>', 'Agent to use (default: from config or "claude")')
12
+ .action(async (options) => {
13
+ const sdd = new SDD({ root: process.cwd() });
14
+
15
+ console.log(heading('SDD Apply'));
16
+
17
+ const prompt = await sdd.applyPrompt();
18
+ if (!prompt) {
19
+ console.log(info('Nothing to apply — no open bugs, pending CRs, or pending files.'));
20
+ return;
21
+ }
22
+
23
+ // Show the prompt being sent
24
+ console.log(chalk.dim(' ─'.repeat(30)));
25
+ console.log(heading('Agent Prompt'));
26
+ console.log(renderMarkdown(prompt));
27
+ console.log(chalk.dim(' ─'.repeat(30)));
28
+
29
+ const config = await sdd.config();
30
+ const agent = options.agent ?? config.agent ?? 'claude';
31
+
32
+ console.log(info(`Using agent: ${chalk.cyan(agent)}`));
33
+ console.log(info('Starting agent...\n'));
34
+
35
+ const exitCode = await runAgent({
36
+ root: process.cwd(),
37
+ prompt,
38
+ agent,
39
+ agents: config.agents,
40
+ });
41
+
42
+ if (exitCode !== 0) {
43
+ console.log(chalk.red(`\n Agent exited with code ${exitCode}`));
44
+ process.exit(exitCode);
45
+ }
46
+
47
+ console.log(chalk.green('\n Agent completed successfully.'));
48
+ });
49
+ }
@@ -1,17 +1,36 @@
1
1
  import { Command } from 'commander';
2
2
  import chalk from 'chalk';
3
- import { input } from '@inquirer/prompts';
3
+ import { input, select } from '@inquirer/prompts';
4
4
  import clipboardy from 'clipboardy';
5
5
  import { existsSync, mkdirSync } from 'node:fs';
6
6
  import { resolve } from 'node:path';
7
7
  import ora from 'ora';
8
- import { SDD } from '@applica-software-guru/sdd-core';
8
+ import { SDD, writeConfig, runAgent } from '@applica-software-guru/sdd-core';
9
9
  import { printBanner } from '../ui/banner.js';
10
- import { success, info } from '../ui/format.js';
10
+ import { success, info, heading } from '../ui/format.js';
11
+ import { renderMarkdown } from '../ui/markdown.js';
11
12
 
12
13
  const START_PROMPT = `Read INSTRUCTIONS.md and the documentation in product/ and system/, then run \`sdd sync\` to start working.`;
13
14
 
14
- function buildBootstrapPrompt(description: string): string {
15
+ function buildBootstrapPrompt(description: string, auto: boolean): string {
16
+ if (auto) {
17
+ return `Read INSTRUCTIONS.md first. This is a new SDD project.
18
+
19
+ Project goal: "${description}"
20
+
21
+ Your task: generate the initial documentation for this project based on the description above. Do NOT ask questions — infer reasonable defaults and create all documentation files directly:
22
+
23
+ - product/vision.md — Product vision and goals
24
+ - product/users.md — User personas
25
+ - product/features/*.md — One file per main feature
26
+ - system/entities.md — Data models (use ### headings per entity)
27
+ - system/architecture.md — Architecture decisions
28
+ - system/tech-stack.md — Technologies and frameworks
29
+ - system/interfaces.md — API contracts
30
+
31
+ Follow the file format described in INSTRUCTIONS.md for the YAML frontmatter. Do NOT write any code, only documentation. Commit all created files when done.`;
32
+ }
33
+
15
34
  return `Read INSTRUCTIONS.md first. This is a new SDD project.
16
35
 
17
36
  Project goal: "${description}"
@@ -33,8 +52,7 @@ export function registerInit(program: Command): void {
33
52
  program
34
53
  .command('init <project-name>')
35
54
  .description('Initialize a new SDD project')
36
- .option('--bootstrap', 'Generate a prompt to create initial documentation with an agent')
37
- .action(async (projectName: string, options) => {
55
+ .action(async (projectName: string) => {
38
56
  printBanner();
39
57
 
40
58
  const projectDir = resolve(process.cwd(), projectName);
@@ -44,12 +62,14 @@ export function registerInit(program: Command): void {
44
62
  return;
45
63
  }
46
64
 
65
+ const promptTheme = {
66
+ prefix: chalk.cyan('?'),
67
+ style: { message: (text: string) => chalk.cyan.bold(text) },
68
+ };
69
+
47
70
  const description = await input({
48
71
  message: 'What should your project do?',
49
- theme: {
50
- prefix: chalk.cyan('?'),
51
- style: { message: (text: string) => chalk.cyan.bold(text) },
52
- },
72
+ theme: promptTheme,
53
73
  });
54
74
 
55
75
  if (!description.trim()) {
@@ -57,6 +77,41 @@ export function registerInit(program: Command): void {
57
77
  return;
58
78
  }
59
79
 
80
+ const agentChoice = await select({
81
+ message: 'Which agent do you use?',
82
+ choices: [
83
+ { value: 'claude', name: 'Claude Code' },
84
+ { value: 'codex', name: 'Codex' },
85
+ { value: 'opencode', name: 'OpenCode' },
86
+ { value: 'other', name: 'Other' },
87
+ ],
88
+ theme: promptTheme,
89
+ });
90
+
91
+ let agentName = agentChoice;
92
+ let customCommand: string | undefined;
93
+
94
+ if (agentChoice === 'other') {
95
+ agentName = await input({
96
+ message: 'Agent name:',
97
+ theme: promptTheme,
98
+ });
99
+ customCommand = await input({
100
+ message: 'Agent command (use $PROMPT_FILE for the prompt file path):',
101
+ theme: promptTheme,
102
+ });
103
+ }
104
+
105
+ const bootstrapMode = await select({
106
+ message: 'How do you want to start?',
107
+ choices: [
108
+ { value: 'skip', name: 'Write docs manually' },
109
+ { value: 'prompt', name: 'Generate bootstrap prompt (copy to clipboard)' },
110
+ { value: 'auto', name: 'Generate and apply bootstrap automatically' },
111
+ ],
112
+ theme: promptTheme,
113
+ });
114
+
60
115
  if (!existsSync(projectDir)) {
61
116
  mkdirSync(projectDir, { recursive: true });
62
117
  }
@@ -69,6 +124,14 @@ export function registerInit(program: Command): void {
69
124
  const sdd = new SDD({ root: projectDir });
70
125
  const files = await sdd.init({ description: description.trim() });
71
126
 
127
+ // Save agent config
128
+ const config = await sdd.config();
129
+ config.agent = agentName;
130
+ if (customCommand) {
131
+ config.agents = { [agentName]: customCommand };
132
+ }
133
+ await writeConfig(projectDir, config);
134
+
72
135
  spinner.stop();
73
136
 
74
137
  // Project created
@@ -84,31 +147,65 @@ export function registerInit(program: Command): void {
84
147
  console.log(success('system/'));
85
148
  console.log(success('code/'));
86
149
 
87
- // Next steps
88
- console.log(chalk.cyan.bold('\n Next steps:\n'));
150
+ if (bootstrapMode === 'auto') {
151
+ const prompt = buildBootstrapPrompt(description.trim(), true);
89
152
 
90
- console.log(` ${chalk.white('1.')} Enter the project folder:\n`);
91
- console.log(` ${chalk.green(`cd ${projectName}`)}\n`);
153
+ console.log(chalk.dim(' ─'.repeat(30)));
154
+ console.log(heading('Agent Prompt'));
155
+ console.log(renderMarkdown(prompt));
156
+ console.log(chalk.dim(' ─'.repeat(30)));
157
+
158
+ console.log(info(`Using agent: ${chalk.cyan(agentName)}`));
159
+ console.log(info('Starting agent...\n'));
160
+
161
+ const exitCode = await runAgent({
162
+ root: projectDir,
163
+ prompt,
164
+ agent: agentName,
165
+ agents: customCommand ? { [agentName]: customCommand } : undefined,
166
+ });
167
+
168
+ if (exitCode !== 0) {
169
+ console.log(chalk.red(`\n Agent exited with code ${exitCode}`));
170
+ process.exit(exitCode);
171
+ }
92
172
 
93
- if (options.bootstrap) {
173
+ console.log(chalk.green('\n Agent completed successfully.'));
174
+ return;
175
+ }
176
+
177
+ if (bootstrapMode === 'prompt') {
178
+ const prompt = buildBootstrapPrompt(description.trim(), false);
179
+
180
+ console.log(chalk.cyan.bold('\n Next steps:\n'));
181
+ console.log(` ${chalk.white('1.')} Enter the project folder:\n`);
182
+ console.log(` ${chalk.green(`cd ${projectName}`)}\n`);
94
183
  console.log(` ${chalk.white('2.')} Open your AI agent and paste the prompt below.`);
95
184
  console.log(` It will ask you a few questions and generate the initial docs.\n`);
96
- } else {
97
- console.log(` ${chalk.white('2.')} Start writing your documentation in ${chalk.cyan('product/')} and ${chalk.cyan('system/')}.`);
98
- console.log(` Check ${chalk.cyan('INSTRUCTIONS.md')} for the file format.\n`);
99
185
 
100
- console.log(` ${chalk.white('3.')} When ready, let your AI agent run:\n`);
101
- console.log(` ${chalk.green('sdd sync')}\n`);
186
+ console.log(chalk.dim(' ─'.repeat(30)));
187
+ console.log(heading('Agent Prompt'));
188
+ console.log(renderMarkdown(prompt));
189
+
190
+ try {
191
+ await clipboardy.write(prompt);
192
+ console.log(success('Copied to clipboard — paste it into your agent.\n'));
193
+ } catch {
194
+ console.log(info('Copy the prompt above into your agent.\n'));
195
+ }
196
+ return;
102
197
  }
103
198
 
104
- // Prompt
105
- const prompt = options.bootstrap
106
- ? buildBootstrapPrompt(description.trim())
107
- : START_PROMPT;
199
+ // skip — manual mode
200
+ console.log(chalk.cyan.bold('\n Next steps:\n'));
201
+ console.log(` ${chalk.white('1.')} Enter the project folder:\n`);
202
+ console.log(` ${chalk.green(`cd ${projectName}`)}\n`);
203
+ console.log(` ${chalk.white('2.')} Start writing your documentation in ${chalk.cyan('product/')} and ${chalk.cyan('system/')}.`);
204
+ console.log(` Check ${chalk.cyan('INSTRUCTIONS.md')} for the file format.\n`);
205
+ console.log(` ${chalk.white('3.')} When ready, let your AI agent run:\n`);
206
+ console.log(` ${chalk.green('sdd sync')}\n`);
108
207
 
109
- console.log(chalk.dim(' ─'.repeat(30)));
110
- console.log(chalk.cyan.bold('\n Agent prompt:\n'));
111
- console.log(chalk.white(` ${prompt.split('\n').join('\n ')}\n`));
208
+ const prompt = START_PROMPT;
112
209
 
113
210
  try {
114
211
  await clipboardy.write(prompt);
package/src/index.ts CHANGED
@@ -8,13 +8,14 @@ import { registerValidate } from './commands/validate.js';
8
8
  import { registerMarkSynced } from './commands/mark-synced.js';
9
9
  import { registerCR } from './commands/cr.js';
10
10
  import { registerBug } from './commands/bug.js';
11
+ import { registerApply } from './commands/apply.js';
11
12
 
12
13
  const program = new Command();
13
14
 
14
15
  program
15
16
  .name('sdd')
16
17
  .description('Story Driven Development — manage apps through structured documentation')
17
- .version('1.0.0');
18
+ .version('1.0.1');
18
19
 
19
20
  registerInit(program);
20
21
  registerStatus(program);
@@ -24,6 +25,7 @@ registerValidate(program);
24
25
  registerMarkSynced(program);
25
26
  registerCR(program);
26
27
  registerBug(program);
28
+ registerApply(program);
27
29
 
28
30
  program.parseAsync().catch((err) => {
29
31
  console.error(err.message);
@@ -0,0 +1,5 @@
1
+ declare module 'marked-terminal' {
2
+ import type { MarkedExtension } from 'marked';
3
+ export default class TerminalRenderer {}
4
+ export function markedTerminal(options?: object, highlightOptions?: object): MarkedExtension;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { Marked } from 'marked';
2
+ import { markedTerminal } from 'marked-terminal';
3
+
4
+ const marked = new Marked(markedTerminal());
5
+
6
+ export function renderMarkdown(md: string): string {
7
+ return marked.parse(md) as string;
8
+ }