specpilot 2.8.0 → 2.10.0

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 (92) hide show
  1. package/README.md +4 -2
  2. package/dist/commands/add-specs.d.ts.map +1 -1
  3. package/dist/commands/add-specs.js +1 -3
  4. package/dist/commands/add-specs.js.map +1 -1
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +32 -95
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/refine.d.ts.map +1 -1
  9. package/dist/commands/refine.js +1 -3
  10. package/dist/commands/refine.js.map +1 -1
  11. package/dist/commands/serve.d.ts +2 -0
  12. package/dist/commands/serve.d.ts.map +1 -1
  13. package/dist/commands/serve.js +29 -3
  14. package/dist/commands/serve.js.map +1 -1
  15. package/dist/core/agentConfig.d.ts +9 -0
  16. package/dist/core/agentConfig.d.ts.map +1 -0
  17. package/dist/{utils/agentConfigGenerator.js → core/agentConfig.js} +29 -44
  18. package/dist/core/agentConfig.js.map +1 -0
  19. package/dist/core/ideConfig.d.ts +35 -0
  20. package/dist/core/ideConfig.d.ts.map +1 -0
  21. package/dist/core/ideConfig.js +287 -0
  22. package/dist/core/ideConfig.js.map +1 -0
  23. package/dist/core/index.d.ts +8 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +22 -0
  26. package/dist/core/index.js.map +1 -0
  27. package/dist/core/render.d.ts +73 -0
  28. package/dist/core/render.d.ts.map +1 -0
  29. package/dist/core/render.js +99 -0
  30. package/dist/core/render.js.map +1 -0
  31. package/dist/core/slashCommands.d.ts +23 -0
  32. package/dist/core/slashCommands.d.ts.map +1 -0
  33. package/dist/core/slashCommands.js +524 -0
  34. package/dist/core/slashCommands.js.map +1 -0
  35. package/dist/core/specFiles.d.ts +18 -0
  36. package/dist/core/specFiles.d.ts.map +1 -0
  37. package/dist/{utils/specFileGenerator.js → core/specFiles.js} +223 -127
  38. package/dist/core/specFiles.js.map +1 -0
  39. package/dist/core/templateEngine.d.ts +69 -0
  40. package/dist/core/templateEngine.d.ts.map +1 -0
  41. package/dist/{utils → core}/templateEngine.js +108 -6
  42. package/dist/core/templateEngine.js.map +1 -0
  43. package/dist/utils/addSpecsQuestions.d.ts +16 -0
  44. package/dist/utils/addSpecsQuestions.d.ts.map +1 -1
  45. package/dist/utils/addSpecsQuestions.js +28 -1
  46. package/dist/utils/addSpecsQuestions.js.map +1 -1
  47. package/dist/utils/gitClone.d.ts +62 -0
  48. package/dist/utils/gitClone.d.ts.map +1 -0
  49. package/dist/utils/gitClone.js +222 -0
  50. package/dist/utils/gitClone.js.map +1 -0
  51. package/dist/utils/ideConfigGenerator.d.ts +5 -29
  52. package/dist/utils/ideConfigGenerator.d.ts.map +1 -1
  53. package/dist/utils/ideConfigGenerator.js +9 -282
  54. package/dist/utils/ideConfigGenerator.js.map +1 -1
  55. package/dist/utils/initQuestions.d.ts +57 -0
  56. package/dist/utils/initQuestions.d.ts.map +1 -0
  57. package/dist/utils/initQuestions.js +49 -0
  58. package/dist/utils/initQuestions.js.map +1 -0
  59. package/dist/utils/projectRegistry.d.ts +2 -0
  60. package/dist/utils/projectRegistry.d.ts.map +1 -1
  61. package/dist/utils/projectRegistry.js +4 -2
  62. package/dist/utils/projectRegistry.js.map +1 -1
  63. package/dist/utils/slashCommandGenerator.d.ts +3 -17
  64. package/dist/utils/slashCommandGenerator.d.ts.map +1 -1
  65. package/dist/utils/slashCommandGenerator.js +8 -514
  66. package/dist/utils/slashCommandGenerator.js.map +1 -1
  67. package/dist/utils/specGenerator.d.ts +16 -46
  68. package/dist/utils/specGenerator.d.ts.map +1 -1
  69. package/dist/utils/specGenerator.js +36 -62
  70. package/dist/utils/specGenerator.js.map +1 -1
  71. package/dist/utils/specServer.d.ts +5 -1
  72. package/dist/utils/specServer.d.ts.map +1 -1
  73. package/dist/utils/specServer.js +179 -27
  74. package/dist/utils/specServer.js.map +1 -1
  75. package/dist/utils/specSetup.d.ts +69 -4
  76. package/dist/utils/specSetup.d.ts.map +1 -1
  77. package/dist/utils/specSetup.js +228 -21
  78. package/dist/utils/specSetup.js.map +1 -1
  79. package/package.json +1 -1
  80. package/ui/app.css +94 -11
  81. package/ui/app.js +232 -74
  82. package/ui/index.html +39 -12
  83. package/ui/route.js +144 -11
  84. package/dist/utils/agentConfigGenerator.d.ts +0 -17
  85. package/dist/utils/agentConfigGenerator.d.ts.map +0 -1
  86. package/dist/utils/agentConfigGenerator.js.map +0 -1
  87. package/dist/utils/specFileGenerator.d.ts +0 -29
  88. package/dist/utils/specFileGenerator.d.ts.map +0 -1
  89. package/dist/utils/specFileGenerator.js.map +0 -1
  90. package/dist/utils/templateEngine.d.ts +0 -35
  91. package/dist/utils/templateEngine.d.ts.map +0 -1
  92. package/dist/utils/templateEngine.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slashCommands.js","sourceRoot":"","sources":["../../src/core/slashCommands.ts"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,mGAAmG;;;AAyenG,oCAMC;AAED,sCAgBG;AAvfH;;;GAGG;AACU,QAAA,cAAc,GAAmB;IAC5C;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE;;;;;;;;8FAQoF;KAC3F;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,0DAA0D;QACvE,IAAI,EAAE;;;;;;wIAM8H;KACrI;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,6GAA6G;QAC1H,IAAI,EAAE;;;;;;;;;sOAS4N;KACnO;IACD;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,0EAA0E;QACvF,IAAI,EAAE;;;;;;;;+HAQqH;KAC5H;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,oGAAoG;QACjH,YAAY,EAAE,eAAe;QAC7B,IAAI,EAAE;;;;;;;;;;4IAUkI;KACzI;IACD;QACE,IAAI,EAAE,UAA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AAC,IAAI,EAAE,CAAC;IAC5I,CAAC;AACH,CAAC;AAEH,SAAS,iBAAiB,CAAC,OAAqB;IAC5C,MAAM,KAAK,GAAG,CAAC,gBAAgB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,IAAI,OAAO,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAC/E,IAAI,OAAO,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1F,OAAO,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;AAC7C,CAAC;AAEH,SAAS,iBAAiB,CAAC,OAAqB;IAC5C,OAAO,qBAAqB,OAAO,CAAC,WAAW,WAAW,CAAC;AAC7D,CAAC;AAEH,SAAS,kBAAkB,CAAC,OAAqB;IAC7C,OAAO,kCAAkC,OAAO,CAAC,WAAW,WAAW,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { TemplateEngine, TemplateContext } from './templateEngine';
2
+ /**
3
+ * The files `generateAll()` wrote until BL-032, in that order, now returned as `{ path, content }`
4
+ * (paths relative to the project, `specsName` first) with the onboarding prompt kept aside.
5
+ */
6
+ export declare function renderSpecFiles(engine: TemplateEngine, context: TemplateContext, specsName: string): {
7
+ files: {
8
+ path: string;
9
+ content: string;
10
+ }[];
11
+ onboardingPrompt: string;
12
+ };
13
+ /**
14
+ * The files `renderSpecFiles()` returns for an API paradigm, relative to the specs folder, in order
15
+ * (BL-PM-004): read from the table the renders use, and pinned to the output by a test.
16
+ */
17
+ export declare function specTargets(apiParadigm: string): string[];
18
+ //# sourceMappingURL=specFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specFiles.d.ts","sourceRoot":"","sources":["../../src/core/specFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA0FnE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAkB7K;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAIzD"}
@@ -1,17 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpecFileGenerator = void 0;
4
- const path_1 = require("path");
5
- const fs_1 = require("fs");
6
- /**
7
- * Generates all `.specs/` markdown and YAML files.
8
- * Responsible only for content inside the specs directory.
9
- */
10
- class SpecFileGenerator {
11
- constructor(templateEngine) {
12
- this.templateEngine = templateEngine;
13
- // ── README templates ────────────────────────────────────────────
14
- this.NEW_PROJECT_README = `# SpecPilot Specifications
3
+ exports.renderSpecFiles = renderSpecFiles;
4
+ exports.specTargets = specTargets;
5
+ // The `.specs/` files: their names, write order and content (BL-032, phase 1: moved from
6
+ // src/utils/specFileGenerator.ts as functions that return content; the writer is SpecGenerator).
7
+ /** Every file the generator writes: its subfolder of the specs folder and its name, in write order (BL-PM-004). */
8
+ const SPEC_FILES = {
9
+ ReadmeMd: ['', 'README.md'],
10
+ ProjectYaml: ['project', 'project.yaml'],
11
+ RequirementsMd: ['project', 'requirements.md'],
12
+ ArchitectureMd: ['architecture', 'architecture.md'],
13
+ ApiYaml: ['architecture', 'api.yaml'],
14
+ TasksMd: ['planning', 'tasks.md'],
15
+ RoadmapMd: ['planning', 'roadmap.md'],
16
+ ContextMd: ['development', 'context.md'],
17
+ PromptsMd: ['development', 'prompts.md'],
18
+ OnboardingMd: ['development', 'onboarding.md'],
19
+ TestsMd: ['quality', 'tests.md'],
20
+ ThreatModelMd: ['security', 'threat-model.md'],
21
+ SecurityDecisionsMd: ['security', 'security-decisions.md'],
22
+ };
23
+ // ── README templates ────────────────────────────────────────────
24
+ const NEW_PROJECT_README = `# SpecPilot Specifications
15
25
 
16
26
  This folder contains structured documentation for your project.
17
27
 
@@ -43,7 +53,7 @@ specpilot add-specs
43
53
  \\\`\\\`\\\`
44
54
 
45
55
  For AI guidelines and prompt history, see [\`development/prompts.md\`](development/prompts.md).`;
46
- this.EXISTING_PROJECT_README = `# SpecPilot Specifications
56
+ const EXISTING_PROJECT_README = `# SpecPilot Specifications
47
57
 
48
58
  This folder contains structured documentation for your codebase.
49
59
 
@@ -75,43 +85,56 @@ specpilot add-specs
75
85
  \\\`\\\`\\\`
76
86
 
77
87
  For AI guidelines and prompt history, see [\`development/prompts.md\`](development/prompts.md).`;
78
- }
79
- /** Generate all spec files into the pre-created specs directory. */
80
- async generateAll(specsDir, context) {
81
- await this.generateReadmeMd(specsDir, context);
82
- await this.generateProjectYaml((0, path_1.join)(specsDir, 'project'), context);
83
- await this.generateRequirementsMd((0, path_1.join)(specsDir, 'project'), context);
84
- await this.generateArchitectureMd((0, path_1.join)(specsDir, 'architecture'), context);
85
- await this.generateApiYaml((0, path_1.join)(specsDir, 'architecture'), context);
86
- await this.generateTasksMd((0, path_1.join)(specsDir, 'planning'), context);
87
- await this.generateRoadmapMd((0, path_1.join)(specsDir, 'planning'), context);
88
- await this.generateContextMd((0, path_1.join)(specsDir, 'development'), context);
89
- await this.generatePromptsMd((0, path_1.join)(specsDir, 'development'), context);
90
- const onboardingPrompt = await this.generateOnboardingMd((0, path_1.join)(specsDir, 'development'), context);
91
- await this.generateTestsMd((0, path_1.join)(specsDir, 'quality'), context);
92
- const securityDir = (0, path_1.join)(specsDir, 'security');
93
- (0, fs_1.mkdirSync)(securityDir, { recursive: true });
94
- await this.generateThreatModelMd(securityDir, context);
95
- await this.generateSecurityDecisionsMd(securityDir, context);
96
- return { onboardingPrompt };
97
- }
98
- async generateReadmeMd(specsDir, context) {
99
- const template = context.mode === 'existing' ? this.EXISTING_PROJECT_README : this.NEW_PROJECT_README;
100
- const rendered = this.templateEngine.renderFromString(template, context);
101
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'README.md'), rendered);
102
- }
103
- async generateProjectYaml(specsDir, context) {
104
- const template = this.templateEngine.getBuiltinTemplate(context.language, context.framework, 'project.yaml');
105
- const content = this.templateEngine.renderFromString(template, context);
106
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'project.yaml'), content);
107
- }
108
- async generateArchitectureMd(specsDir, context) {
109
- const template = this.templateEngine.getBuiltinTemplate(context.language, context.framework, 'architecture.md');
110
- const content = this.templateEngine.renderFromString(template, context);
111
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'architecture.md'), content);
112
- }
113
- async generateRequirementsMd(specsDir, context) {
114
- const content = `---
88
+ /**
89
+ * The files `generateAll()` wrote until BL-032, in that order, now returned as `{ path, content }`
90
+ * (paths relative to the project, `specsName` first) with the onboarding prompt kept aside.
91
+ */
92
+ function renderSpecFiles(engine, context, specsName) {
93
+ const files = [];
94
+ const add = (key, content) => files.push({ path: `${specsName}/${SPEC_FILES[key].filter(Boolean).join('/')}`, content });
95
+ add('ReadmeMd', readmeMd(engine, context));
96
+ add('ProjectYaml', projectYaml(engine, context));
97
+ add('RequirementsMd', requirementsMd(engine, context));
98
+ add('ArchitectureMd', architectureMd(engine, context));
99
+ if ((context.apiParadigm ?? 'rest') !== 'none')
100
+ add('ApiYaml', apiYaml(engine, context));
101
+ add('TasksMd', tasksMd(engine, context));
102
+ add('RoadmapMd', roadmapMd(engine, context));
103
+ add('ContextMd', contextMd(engine, context));
104
+ add('PromptsMd', promptsMd(engine, context));
105
+ const onboarding = onboardingMd(context);
106
+ add('OnboardingMd', onboarding.content);
107
+ add('TestsMd', testsMd(engine, context));
108
+ add('ThreatModelMd', threatModelMd(engine, context));
109
+ add('SecurityDecisionsMd', securityDecisionsMd(engine, context));
110
+ return { files, onboardingPrompt: onboarding.prompt };
111
+ }
112
+ /**
113
+ * The files `renderSpecFiles()` returns for an API paradigm, relative to the specs folder, in order
114
+ * (BL-PM-004): read from the table the renders use, and pinned to the output by a test.
115
+ */
116
+ function specTargets(apiParadigm) {
117
+ return Object.keys(SPEC_FILES)
118
+ .filter(key => key !== 'ApiYaml' || apiParadigm !== 'none')
119
+ .map(key => SPEC_FILES[key].filter(Boolean).join('/'));
120
+ }
121
+ function readmeMd(engine, context) {
122
+ const template = context.mode === 'existing' ? EXISTING_PROJECT_README : NEW_PROJECT_README;
123
+ const rendered = engine.renderFromString(template, context);
124
+ return rendered;
125
+ }
126
+ function projectYaml(engine, context) {
127
+ const template = engine.getBuiltinTemplate(context.language, context.framework, 'project.yaml');
128
+ const content = engine.renderFromString(template, context);
129
+ return content;
130
+ }
131
+ function architectureMd(engine, context) {
132
+ const template = engine.getBuiltinTemplate(context.language, context.framework, 'architecture.md');
133
+ const content = engine.renderFromString(template, context);
134
+ return content;
135
+ }
136
+ function requirementsMd(engine, context) {
137
+ const content = `---
115
138
  title: Requirements
116
139
  description: Functional and non-functional requirements for the project
117
140
  project: {{projectName}}
@@ -128,25 +151,45 @@ sourceOfTruth: project/project.yaml
128
151
 
129
152
  ## Functional Requirements
130
153
  [TODO]
154
+ {{#if accessControl}}
155
+
156
+ ### Access control
157
+ {{accessControl}}
158
+ {{/if}}
159
+ {{#if specialConsiderations}}
160
+
161
+ ### Special considerations
162
+ {{#each specialConsiderations}}
163
+ - {{this}}
164
+ {{/each}}
165
+ {{/if}}
166
+ {{#if accessibilityNotes}}
167
+ {{#unless specialConsiderations}}
168
+
169
+ ### Special considerations
170
+ {{/unless}}
171
+
172
+ {{accessibilityNotes}}
173
+ {{/if}}
131
174
 
132
175
  ## Assumptions
133
176
  [TODO]`;
134
- const rendered = this.templateEngine.renderFromString(content, context);
135
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'requirements.md'), rendered);
136
- }
137
- async generateApiYaml(specsDir, context) {
138
- const paradigm = context.apiParadigm ?? 'rest';
139
- if (paradigm === 'none')
140
- return;
141
- const header = `# .specs/architecture/api.yaml
177
+ const rendered = engine.renderFromString(content, context);
178
+ return rendered;
179
+ }
180
+ function apiYaml(engine, context) {
181
+ const paradigm = context.apiParadigm ?? 'rest';
182
+ if (paradigm === 'none')
183
+ return '';
184
+ const header = `# .specs/architecture/api.yaml
142
185
  # meta: project={{projectName}} language={{language}} framework={{framework}} updated={{currentDate}}
143
186
 
144
187
  project: "{{projectName}}"
145
188
  version: "1.0.0"
146
189
  lastUpdated: "{{currentDate}}"
147
190
  `;
148
- const sections = {
149
- rest: `
191
+ const sections = {
192
+ rest: `
150
193
  openapi: "3.0.0"
151
194
  info:
152
195
  title: "{{projectName}} API"
@@ -165,7 +208,7 @@ paths:
165
208
  "200":
166
209
  description: "Success"
167
210
  `,
168
- cli: `
211
+ cli: `
169
212
  cli:
170
213
  name: "{{projectName}}"
171
214
  version: "1.0.0"
@@ -180,7 +223,7 @@ cli:
180
223
  - flag: "--example <value>"
181
224
  description: "[TODO: option description]"
182
225
  `,
183
- graphql: `
226
+ graphql: `
184
227
  graphql:
185
228
  endpoint: "/graphql"
186
229
  queries:
@@ -190,13 +233,30 @@ graphql:
190
233
  - name: "[TODO: firstMutation]"
191
234
  description: "[TODO: What does this mutation do?]"
192
235
  `,
193
- };
194
- const content = header + sections[paradigm];
195
- const rendered = this.templateEngine.renderFromString(content, context);
196
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'api.yaml'), rendered);
197
- }
198
- async generateTasksMd(specsDir, context) {
199
- const content = `---
236
+ };
237
+ // The optional data-layer keys (REQ-002.I.4): after a rest or graphql section, never after cli.
238
+ const extras = `{{#if (any databases authStrategy realtimeTypes)}}
239
+
240
+ {{#if databases}}
241
+ databases:
242
+ {{yamlList databases}}
243
+ {{/if}}
244
+ {{#if authStrategy}}
245
+ auth_strategy: {{yaml authStrategy}}
246
+ {{/if}}
247
+ {{#if realtimeTypes}}
248
+ realtime:
249
+ enabled: true
250
+ transports:
251
+ {{yamlList realtimeTypes}}
252
+ {{/if}}
253
+ {{/if}}`;
254
+ const content = header + sections[paradigm] + (paradigm === 'cli' ? '' : extras);
255
+ const rendered = engine.renderFromString(content, context);
256
+ return rendered;
257
+ }
258
+ function tasksMd(engine, context) {
259
+ const content = `---
200
260
  fileID: TASKS-001
201
261
  description: Sprint tracker with backlog, current sprint, and completed work
202
262
  lastUpdated: {{currentDate}}
@@ -225,11 +285,11 @@ Task ID conventions
225
285
  ## Completed
226
286
 
227
287
  1. [CD-001] Initialise .specs directory ({{currentDate}})`;
228
- const rendered = this.templateEngine.renderFromString(content, context);
229
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'tasks.md'), rendered);
230
- }
231
- async generateRoadmapMd(specsDir, context) {
232
- const content = `---
288
+ const rendered = engine.renderFromString(content, context);
289
+ return rendered;
290
+ }
291
+ function roadmapMd(engine, context) {
292
+ const content = `---
233
293
  title: Roadmap
234
294
  description: Release milestones, objectives, and delivery timeline
235
295
  project: {{projectName}}
@@ -242,6 +302,10 @@ sourceOfTruth: project/project.yaml
242
302
  # {{projectName}} — Development Roadmap
243
303
 
244
304
  ## Milestones
305
+ {{#if buildTimeline}}
306
+ Build timeline: {{buildTimeline}}
307
+
308
+ {{/if}}
245
309
  [TODO]
246
310
 
247
311
  ## Objectives
@@ -252,11 +316,11 @@ sourceOfTruth: project/project.yaml
252
316
 
253
317
  ## Risks and Mitigations
254
318
  [TODO]`;
255
- const rendered = this.templateEngine.renderFromString(content, context);
256
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'roadmap.md'), rendered);
257
- }
258
- async generateContextMd(specsDir, context) {
259
- const content = `---
319
+ const rendered = engine.renderFromString(content, context);
320
+ return rendered;
321
+ }
322
+ function contextMd(engine, context) {
323
+ const content = `---
260
324
  title: Development Context
261
325
  description: Project memory, decisions, and implementation notes
262
326
  project: {{projectName}}
@@ -269,12 +333,16 @@ sourceOfTruth: project/project.yaml
269
333
  # {{projectName}} Development Context
270
334
 
271
335
  ## Project Memory
272
- [TODO]`;
273
- const rendered = this.templateEngine.renderFromString(content, context);
274
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'context.md'), rendered);
275
- }
276
- async generatePromptsMd(specsDir, context) {
277
- const content = `---
336
+ {{#if constraintDescription}}
337
+ ### Constraints
338
+ {{constraintDescription}}
339
+ {{else}}
340
+ [TODO]{{/if}}`;
341
+ const rendered = engine.renderFromString(content, context);
342
+ return rendered;
343
+ }
344
+ function promptsMd(engine, context) {
345
+ const content = `---
278
346
  title: Prompts Log
279
347
  description: AI interaction log for {{projectName}}
280
348
  project: {{projectName}}
@@ -327,13 +395,13 @@ For full project context, read .specs/project/project.yaml.
327
395
  | Date | User | Prompt Summary | Context |
328
396
  |------|------|----------------|---------|
329
397
  | YYYY-MM-DD | @username | Example prompt | Brief context or outcome |`;
330
- const rendered = this.templateEngine.renderFromString(content, context);
331
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'prompts.md'), rendered);
332
- }
333
- async generateOnboardingMd(specsDir, context) {
334
- const isGreenfield = context.projectType !== 'brownfield';
335
- const pc = context.projectContext;
336
- const conventions = `**Conventions & Rules:**
398
+ const rendered = engine.renderFromString(content, context);
399
+ return rendered;
400
+ }
401
+ function onboardingMd(context) {
402
+ const isGreenfield = context.projectType !== 'brownfield';
403
+ const pc = context.projectContext;
404
+ const conventions = `**Conventions & Rules:**
337
405
  1. **IDs**: Use semantic prefixes with zero-padded numbers (e.g., REQ-001, CD-${context.author || '{{author}}'}-001)
338
406
  2. **Status values**: Must be one of: not-started, in-progress, completed, blocked, deprecated
339
407
  3. **Priority values**: Must be: critical, high, medium, low
@@ -352,20 +420,20 @@ For full project context, read .specs/project/project.yaml.
352
420
  - \`planning/roadmap.md\`: ## Milestones with versions, dates, features, status
353
421
  - \`quality/tests.md\`: ## Test Strategy, Test Cases (TEST-XXX), Coverage Goals
354
422
  - \`development/context.md\`: ## Project Context, Key Decisions, Known Issues`;
355
- let prompt;
356
- if (isGreenfield) {
357
- const projectContextBlock = pc
358
- ? `**Project context (provided by the developer):**
423
+ let prompt;
424
+ if (isGreenfield) {
425
+ const projectContextBlock = pc
426
+ ? `**Project context (provided by the developer):**
359
427
  - **What it does:** ${pc.whatItDoes}
360
428
  - **Target users:** ${pc.targetUsers}
361
429
  - **Expected scale:** ${pc.expectedScale}
362
430
  - **Key constraints:** ${pc.constraints}`
363
- : `**Project context:**
431
+ : `**Project context:**
364
432
  - **What it does:** [DESCRIBE YOUR PROJECT HERE]
365
433
  - **Target users:** Not specified — use your judgment and mark as [ASSUMPTION]
366
434
  - **Expected scale:** Not specified — use your judgment and mark as [ASSUMPTION]
367
435
  - **Key constraints:** Not specified — use your judgment and mark as [ASSUMPTION]`;
368
- prompt = `You are the specification co-pilot for a new project called "${context.projectName}".
436
+ prompt = `You are the specification co-pilot for a new project called "${context.projectName}".
369
437
  Tech stack: ${context.language}${context.framework ? ` / ${context.framework}` : ''}
370
438
 
371
439
  ${projectContextBlock}
@@ -404,9 +472,9 @@ After populating all files, provide a summary of: what you understood, assumptio
404
472
  **Final step: delete \`.specs/development/onboarding.md\` — it is a one-time bootstrap file.**
405
473
 
406
474
  Begin drafting now.`;
407
- }
408
- else {
409
- prompt = `You are onboarding as the specification co-pilot for this repository. We just initialized the .specs directory using SpecPilot SDD. Your task is to inspect the codebase and populate all .specs files following these strict conventions:
475
+ }
476
+ else {
477
+ prompt = `You are onboarding as the specification co-pilot for this repository. We just initialized the .specs directory using SpecPilot SDD. Your task is to inspect the codebase and populate all .specs files following these strict conventions:
410
478
 
411
479
  ${conventions}
412
480
 
@@ -439,13 +507,13 @@ After populating all files, provide a summary of: what was discovered, what's do
439
507
  **Final step: delete \`.specs/development/onboarding.md\` — it is a one-time bootstrap file.**
440
508
 
441
509
  Begin your analysis now.`;
442
- }
443
- const label = isGreenfield ? 'Greenfield' : 'Brownfield';
444
- const content = `---
510
+ }
511
+ const label = isGreenfield ? 'Greenfield' : 'Brownfield';
512
+ const content = `---
445
513
  title: Onboarding Prompt (${label})
446
514
  description: One-time AI prompt to bootstrap .specs/ files — delete after use
447
515
  project: ${context.projectName}
448
- lastUpdated: ${new Date().toISOString().split('T')[0]}
516
+ lastUpdated: ${context.lastUpdated}
449
517
  ---
450
518
 
451
519
  > **One-time file — delete after use.**
@@ -454,11 +522,10 @@ lastUpdated: ${new Date().toISOString().split('T')[0]}
454
522
  ---
455
523
 
456
524
  ${prompt}`;
457
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'onboarding.md'), content);
458
- return prompt;
459
- }
460
- async generateTestsMd(specsDir, context) {
461
- const content = `---
525
+ return { content, prompt };
526
+ }
527
+ function testsMd(engine, context) {
528
+ const content = `---
462
529
  title: Test Strategy
463
530
  description: Test strategy, coverage goals, and quality approach
464
531
  project: {{projectName}}
@@ -471,12 +538,15 @@ sourceOfTruth: project/project.yaml
471
538
  # {{projectName}} Test Strategy
472
539
 
473
540
  ## Overview
474
- [TODO]`;
475
- const rendered = this.templateEngine.renderFromString(content, context);
476
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'tests.md'), rendered);
477
- }
478
- async generateThreatModelMd(specsDir, context) {
479
- const content = `---
541
+ {{#if testingStrategy}}
542
+ Strategy: {{join testingStrategy ", "}}
543
+ {{else}}
544
+ [TODO]{{/if}}`;
545
+ const rendered = engine.renderFromString(content, context);
546
+ return rendered;
547
+ }
548
+ function threatModelMd(engine, context) {
549
+ const content = `---
480
550
  fileID: SEC-001
481
551
  description: Threat model and attack surface analysis
482
552
  lastUpdated: {{currentDate}}
@@ -491,18 +561,35 @@ relatedFiles: [security/security-decisions.md, architecture/architecture.md, pro
491
561
  [TODO]
492
562
 
493
563
  ## Threat Model [SEC-002]
564
+ {{#if (any securityConcerns integrations)}}
565
+ {{#if securityConcerns}}
566
+
567
+ ### Security concerns
568
+ {{#each securityConcerns}}
569
+ - {{this}}
570
+ {{/each}}
571
+ {{/if}}
572
+ {{#if integrations}}
573
+
574
+ ### Integration-derived threat entries
575
+ {{#each integrations}}
576
+ - {{@key}}: {{join this ", "}} — review vendor data-handling and auth scopes
577
+ {{/each}}
578
+ {{/if}}
579
+ {{else}}
494
580
  [TODO]
581
+ {{/if}}
495
582
 
496
583
  ## Attack Surface Summary [SEC-003]
497
584
  [TODO]
498
585
 
499
586
  ## Out of Scope [SEC-004]
500
587
  [TODO]`;
501
- const rendered = this.templateEngine.renderFromString(content, context);
502
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'threat-model.md'), rendered);
503
- }
504
- async generateSecurityDecisionsMd(specsDir, context) {
505
- const content = `---
588
+ const rendered = engine.renderFromString(content, context);
589
+ return rendered;
590
+ }
591
+ function securityDecisionsMd(engine, context) {
592
+ const content = `---
506
593
  fileID: SEC-002
507
594
  description: Security ADR log with decisions, rationale, and trade-offs
508
595
  lastUpdated: {{currentDate}}
@@ -514,10 +601,19 @@ relatedFiles: [security/threat-model.md, architecture/architecture.md]
514
601
  # Security Decisions
515
602
 
516
603
  ## Decisions [SEC-002.1]
517
- [TODO]`;
518
- const rendered = this.templateEngine.renderFromString(content, context);
519
- (0, fs_1.writeFileSync)((0, path_1.join)(specsDir, 'security-decisions.md'), rendered);
520
- }
604
+ {{#if (any authStrategy compliance cicd)}}
605
+ {{#if authStrategy}}
606
+ Auth strategy: {{authStrategy}}
607
+ {{/if}}
608
+ {{#if compliance}}
609
+ Compliance: {{join compliance ", "}}
610
+ {{/if}}
611
+ {{#if cicd}}
612
+ CI/CD: {{join cicd ", "}}
613
+ {{/if}}
614
+ {{else}}
615
+ [TODO]{{/if}}`;
616
+ const rendered = engine.renderFromString(content, context);
617
+ return rendered;
521
618
  }
522
- exports.SpecFileGenerator = SpecFileGenerator;
523
- //# sourceMappingURL=specFileGenerator.js.map
619
+ //# sourceMappingURL=specFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,69 @@
1
+ export interface ProjectContext {
2
+ whatItDoes: string;
3
+ targetUsers: string;
4
+ expectedScale: string;
5
+ constraints: string;
6
+ }
7
+ /** The optional answers of REQ-002.I.4 (BL-032, phase 2); each is rendered only when present. */
8
+ export interface OptionalFields {
9
+ platforms?: string[];
10
+ accessControl?: string;
11
+ specialConsiderations?: string[];
12
+ accessibilityNotes?: string;
13
+ systemPattern?: string;
14
+ activeUsers?: string;
15
+ teamSize?: string;
16
+ deploymentTargets?: string[];
17
+ localDatabases?: string[];
18
+ dataSyncStrategy?: string;
19
+ integrations?: Record<string, string[]>;
20
+ otherApis?: string;
21
+ apiResponseTime?: string;
22
+ availability?: string;
23
+ databases?: string[];
24
+ authStrategy?: string;
25
+ realtimeTypes?: string[];
26
+ compliance?: string[];
27
+ cicd?: string[];
28
+ securityConcerns?: string[];
29
+ buildTimeline?: string;
30
+ constraintDescription?: string;
31
+ testingStrategy?: string[];
32
+ }
33
+ /** The keys of `OptionalFields`, for `render()`'s present-or-absent rule. */
34
+ export declare const OPTIONAL_FIELDS: (keyof OptionalFields)[];
35
+ export interface TemplateContext extends OptionalFields {
36
+ projectName: string;
37
+ language: string;
38
+ framework?: string;
39
+ author?: string;
40
+ description?: string;
41
+ ide?: string;
42
+ mode?: 'new' | 'existing';
43
+ projectType?: 'greenfield' | 'brownfield';
44
+ apiParadigm?: 'rest' | 'cli' | 'graphql' | 'none';
45
+ projectContext?: ProjectContext;
46
+ /** The date every generated file carries (`YYYY-MM-DD`); set by `render()` (BL-032). */
47
+ lastUpdated?: string;
48
+ architecture?: {
49
+ components: string[];
50
+ directories: string;
51
+ fileTypes: Record<string, number>;
52
+ };
53
+ [key: string]: any;
54
+ }
55
+ /** Present means: a string that is not blank, a list with an item, a map with a key (REQ-002.I.4). */
56
+ export declare function present(value: unknown): boolean;
57
+ /** `value` as a YAML scalar: plain when YAML reads it back unchanged, else double-quoted and escaped. */
58
+ export declare function yamlScalar(value: string): string;
59
+ export declare class TemplateEngine {
60
+ constructor();
61
+ private registerHelpers;
62
+ renderFromString(templateString: string, context: TemplateContext): string;
63
+ getBuiltinTemplate(language: string, framework: string | undefined, fileName: string): string;
64
+ private getBuiltinTemplateContent;
65
+ private getProjectYamlTemplate;
66
+ private getDependencySection;
67
+ private getArchitectureTemplate;
68
+ }
69
+ //# sourceMappingURL=templateEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateEngine.d.ts","sourceRoot":"","sources":["../../src/core/templateEngine.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,iGAAiG;AACjG,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EA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