specpilot 2.8.0 → 2.9.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.
- package/README.md +4 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +31 -92
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +29 -3
- package/dist/commands/serve.js.map +1 -1
- package/dist/utils/addSpecsQuestions.d.ts +16 -0
- package/dist/utils/addSpecsQuestions.d.ts.map +1 -1
- package/dist/utils/addSpecsQuestions.js +28 -1
- package/dist/utils/addSpecsQuestions.js.map +1 -1
- package/dist/utils/gitClone.d.ts +62 -0
- package/dist/utils/gitClone.d.ts.map +1 -0
- package/dist/utils/gitClone.js +222 -0
- package/dist/utils/gitClone.js.map +1 -0
- package/dist/utils/initQuestions.d.ts +57 -0
- package/dist/utils/initQuestions.d.ts.map +1 -0
- package/dist/utils/initQuestions.js +49 -0
- package/dist/utils/initQuestions.js.map +1 -0
- package/dist/utils/projectRegistry.d.ts +2 -0
- package/dist/utils/projectRegistry.d.ts.map +1 -1
- package/dist/utils/projectRegistry.js +4 -2
- package/dist/utils/projectRegistry.js.map +1 -1
- package/dist/utils/specFileGenerator.d.ts +5 -4
- package/dist/utils/specFileGenerator.d.ts.map +1 -1
- package/dist/utils/specFileGenerator.js +53 -28
- package/dist/utils/specFileGenerator.js.map +1 -1
- package/dist/utils/specGenerator.d.ts +5 -0
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +7 -0
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/specServer.d.ts +5 -1
- package/dist/utils/specServer.d.ts.map +1 -1
- package/dist/utils/specServer.js +179 -27
- package/dist/utils/specServer.js.map +1 -1
- package/dist/utils/specSetup.d.ts +69 -4
- package/dist/utils/specSetup.d.ts.map +1 -1
- package/dist/utils/specSetup.js +226 -18
- package/dist/utils/specSetup.js.map +1 -1
- package/package.json +1 -1
- package/ui/app.css +94 -11
- package/ui/app.js +232 -74
- package/ui/index.html +39 -12
- package/ui/route.js +144 -11
|
@@ -7,6 +7,22 @@ const fs_1 = require("fs");
|
|
|
7
7
|
* Generates all `.specs/` markdown and YAML files.
|
|
8
8
|
* Responsible only for content inside the specs directory.
|
|
9
9
|
*/
|
|
10
|
+
/** Every file the generator writes: its subfolder of the specs folder and its name, in write order (BL-PM-004). */
|
|
11
|
+
const SPEC_FILES = {
|
|
12
|
+
ReadmeMd: ['', 'README.md'],
|
|
13
|
+
ProjectYaml: ['project', 'project.yaml'],
|
|
14
|
+
RequirementsMd: ['project', 'requirements.md'],
|
|
15
|
+
ArchitectureMd: ['architecture', 'architecture.md'],
|
|
16
|
+
ApiYaml: ['architecture', 'api.yaml'],
|
|
17
|
+
TasksMd: ['planning', 'tasks.md'],
|
|
18
|
+
RoadmapMd: ['planning', 'roadmap.md'],
|
|
19
|
+
ContextMd: ['development', 'context.md'],
|
|
20
|
+
PromptsMd: ['development', 'prompts.md'],
|
|
21
|
+
OnboardingMd: ['development', 'onboarding.md'],
|
|
22
|
+
TestsMd: ['quality', 'tests.md'],
|
|
23
|
+
ThreatModelMd: ['security', 'threat-model.md'],
|
|
24
|
+
SecurityDecisionsMd: ['security', 'security-decisions.md'],
|
|
25
|
+
};
|
|
10
26
|
class SpecFileGenerator {
|
|
11
27
|
constructor(templateEngine) {
|
|
12
28
|
this.templateEngine = templateEngine;
|
|
@@ -78,37 +94,46 @@ For AI guidelines and prompt history, see [\`development/prompts.md\`](developme
|
|
|
78
94
|
}
|
|
79
95
|
/** Generate all spec files into the pre-created specs directory. */
|
|
80
96
|
async generateAll(specsDir, context) {
|
|
81
|
-
|
|
82
|
-
await this.
|
|
83
|
-
await this.
|
|
84
|
-
await this.
|
|
85
|
-
await this.
|
|
86
|
-
await this.
|
|
87
|
-
await this.
|
|
88
|
-
await this.
|
|
89
|
-
await this.
|
|
90
|
-
|
|
91
|
-
await this.
|
|
92
|
-
|
|
93
|
-
(0, fs_1.mkdirSync)(
|
|
94
|
-
await this.generateThreatModelMd(
|
|
95
|
-
await this.generateSecurityDecisionsMd(
|
|
97
|
+
const dir = (key) => (0, path_1.join)(specsDir, SPEC_FILES[key][0]);
|
|
98
|
+
await this.generateReadmeMd(dir('ReadmeMd'), context);
|
|
99
|
+
await this.generateProjectYaml(dir('ProjectYaml'), context);
|
|
100
|
+
await this.generateRequirementsMd(dir('RequirementsMd'), context);
|
|
101
|
+
await this.generateArchitectureMd(dir('ArchitectureMd'), context);
|
|
102
|
+
await this.generateApiYaml(dir('ApiYaml'), context);
|
|
103
|
+
await this.generateTasksMd(dir('TasksMd'), context);
|
|
104
|
+
await this.generateRoadmapMd(dir('RoadmapMd'), context);
|
|
105
|
+
await this.generateContextMd(dir('ContextMd'), context);
|
|
106
|
+
await this.generatePromptsMd(dir('PromptsMd'), context);
|
|
107
|
+
const onboardingPrompt = await this.generateOnboardingMd(dir('OnboardingMd'), context);
|
|
108
|
+
await this.generateTestsMd(dir('TestsMd'), context);
|
|
109
|
+
(0, fs_1.mkdirSync)(dir('ThreatModelMd'), { recursive: true });
|
|
110
|
+
await this.generateThreatModelMd(dir('ThreatModelMd'), context);
|
|
111
|
+
await this.generateSecurityDecisionsMd(dir('SecurityDecisionsMd'), context);
|
|
96
112
|
return { onboardingPrompt };
|
|
97
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* The files `generateAll()` writes for an API paradigm, relative to the specs folder, in the order
|
|
116
|
+
* it writes them (BL-PM-004): read from the table the writes use, and pinned to the output by a test.
|
|
117
|
+
*/
|
|
118
|
+
targets(apiParadigm) {
|
|
119
|
+
return Object.keys(SPEC_FILES)
|
|
120
|
+
.filter(key => key !== 'ApiYaml' || apiParadigm !== 'none')
|
|
121
|
+
.map(key => SPEC_FILES[key].filter(Boolean).join('/'));
|
|
122
|
+
}
|
|
98
123
|
async generateReadmeMd(specsDir, context) {
|
|
99
124
|
const template = context.mode === 'existing' ? this.EXISTING_PROJECT_README : this.NEW_PROJECT_README;
|
|
100
125
|
const rendered = this.templateEngine.renderFromString(template, context);
|
|
101
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
126
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.ReadmeMd[1]), rendered);
|
|
102
127
|
}
|
|
103
128
|
async generateProjectYaml(specsDir, context) {
|
|
104
129
|
const template = this.templateEngine.getBuiltinTemplate(context.language, context.framework, 'project.yaml');
|
|
105
130
|
const content = this.templateEngine.renderFromString(template, context);
|
|
106
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
131
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.ProjectYaml[1]), content);
|
|
107
132
|
}
|
|
108
133
|
async generateArchitectureMd(specsDir, context) {
|
|
109
134
|
const template = this.templateEngine.getBuiltinTemplate(context.language, context.framework, 'architecture.md');
|
|
110
135
|
const content = this.templateEngine.renderFromString(template, context);
|
|
111
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
136
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.ArchitectureMd[1]), content);
|
|
112
137
|
}
|
|
113
138
|
async generateRequirementsMd(specsDir, context) {
|
|
114
139
|
const content = `---
|
|
@@ -132,7 +157,7 @@ sourceOfTruth: project/project.yaml
|
|
|
132
157
|
## Assumptions
|
|
133
158
|
[TODO]`;
|
|
134
159
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
135
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
160
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.RequirementsMd[1]), rendered);
|
|
136
161
|
}
|
|
137
162
|
async generateApiYaml(specsDir, context) {
|
|
138
163
|
const paradigm = context.apiParadigm ?? 'rest';
|
|
@@ -193,7 +218,7 @@ graphql:
|
|
|
193
218
|
};
|
|
194
219
|
const content = header + sections[paradigm];
|
|
195
220
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
196
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
221
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.ApiYaml[1]), rendered);
|
|
197
222
|
}
|
|
198
223
|
async generateTasksMd(specsDir, context) {
|
|
199
224
|
const content = `---
|
|
@@ -226,7 +251,7 @@ Task ID conventions
|
|
|
226
251
|
|
|
227
252
|
1. [CD-001] Initialise .specs directory ({{currentDate}})`;
|
|
228
253
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
229
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
254
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.TasksMd[1]), rendered);
|
|
230
255
|
}
|
|
231
256
|
async generateRoadmapMd(specsDir, context) {
|
|
232
257
|
const content = `---
|
|
@@ -253,7 +278,7 @@ sourceOfTruth: project/project.yaml
|
|
|
253
278
|
## Risks and Mitigations
|
|
254
279
|
[TODO]`;
|
|
255
280
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
256
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
281
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.RoadmapMd[1]), rendered);
|
|
257
282
|
}
|
|
258
283
|
async generateContextMd(specsDir, context) {
|
|
259
284
|
const content = `---
|
|
@@ -271,7 +296,7 @@ sourceOfTruth: project/project.yaml
|
|
|
271
296
|
## Project Memory
|
|
272
297
|
[TODO]`;
|
|
273
298
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
274
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
299
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.ContextMd[1]), rendered);
|
|
275
300
|
}
|
|
276
301
|
async generatePromptsMd(specsDir, context) {
|
|
277
302
|
const content = `---
|
|
@@ -328,7 +353,7 @@ For full project context, read .specs/project/project.yaml.
|
|
|
328
353
|
|------|------|----------------|---------|
|
|
329
354
|
| YYYY-MM-DD | @username | Example prompt | Brief context or outcome |`;
|
|
330
355
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
331
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
356
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.PromptsMd[1]), rendered);
|
|
332
357
|
}
|
|
333
358
|
async generateOnboardingMd(specsDir, context) {
|
|
334
359
|
const isGreenfield = context.projectType !== 'brownfield';
|
|
@@ -454,7 +479,7 @@ lastUpdated: ${new Date().toISOString().split('T')[0]}
|
|
|
454
479
|
---
|
|
455
480
|
|
|
456
481
|
${prompt}`;
|
|
457
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
482
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.OnboardingMd[1]), content);
|
|
458
483
|
return prompt;
|
|
459
484
|
}
|
|
460
485
|
async generateTestsMd(specsDir, context) {
|
|
@@ -473,7 +498,7 @@ sourceOfTruth: project/project.yaml
|
|
|
473
498
|
## Overview
|
|
474
499
|
[TODO]`;
|
|
475
500
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
476
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
501
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.TestsMd[1]), rendered);
|
|
477
502
|
}
|
|
478
503
|
async generateThreatModelMd(specsDir, context) {
|
|
479
504
|
const content = `---
|
|
@@ -499,7 +524,7 @@ relatedFiles: [security/security-decisions.md, architecture/architecture.md, pro
|
|
|
499
524
|
## Out of Scope [SEC-004]
|
|
500
525
|
[TODO]`;
|
|
501
526
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
502
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
527
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.ThreatModelMd[1]), rendered);
|
|
503
528
|
}
|
|
504
529
|
async generateSecurityDecisionsMd(specsDir, context) {
|
|
505
530
|
const content = `---
|
|
@@ -516,7 +541,7 @@ relatedFiles: [security/threat-model.md, architecture/architecture.md]
|
|
|
516
541
|
## Decisions [SEC-002.1]
|
|
517
542
|
[TODO]`;
|
|
518
543
|
const rendered = this.templateEngine.renderFromString(content, context);
|
|
519
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir,
|
|
544
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(specsDir, SPEC_FILES.SecurityDecisionsMd[1]), rendered);
|
|
520
545
|
}
|
|
521
546
|
}
|
|
522
547
|
exports.SpecFileGenerator = SpecFileGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specFileGenerator.js","sourceRoot":"","sources":["../../src/utils/specFileGenerator.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,2BAA8C;AAG9C;;;GAGG;AACH,MAAa,iBAAiB;IAC5B,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAElD,mEAAmE;QAE3D,uBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gGA+BiE,CAAC;QAEvF,4BAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gGA+B4D,CAAC;IApE1C,CAAC;IAsEtD,oEAAoE;IACpE,KAAK,CAAC,WAAW,CAAC,QAAgB,EAAE,OAAwB;QAC1D,MAAM,
|
|
1
|
+
{"version":3,"file":"specFileGenerator.js","sourceRoot":"","sources":["../../src/utils/specFileGenerator.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,2BAA8C;AAG9C;;;GAGG;AACH,mHAAmH;AACnH,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC;IAC3B,WAAW,EAAE,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AAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;CAEF;AAhjBD,8CAgjBC"}
|
|
@@ -55,6 +55,11 @@ export declare class SpecGenerator {
|
|
|
55
55
|
kept: string[];
|
|
56
56
|
appended: number;
|
|
57
57
|
}>;
|
|
58
|
+
/**
|
|
59
|
+
* The project-relative files `generateSpecs()` writes under `.specs/` for an API paradigm, in the
|
|
60
|
+
* order it writes them (BL-PM-004); `api.yaml` is absent for `none`.
|
|
61
|
+
*/
|
|
62
|
+
targetsInSpecs(apiParadigm: string, specsName?: string): string[];
|
|
58
63
|
/**
|
|
59
64
|
* The project-relative files `generateSpecs()` writes outside `.specs/` for an IDE choice, in the
|
|
60
65
|
* order it writes them (BL-055): read from the same tables the writes use, and pinned to the real
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/specGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAmB,MAAM,kBAAkB,CAAC;AAMnE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;IAClD,cAAc,CAAC,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC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YACrB,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACnC,CAAC;KACH,CAAC;CACH;AAeD,qBAAa,aAAa;IAMZ,OAAO,CAAC,cAAc;IALlC,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAAwB;gBAEjC,cAAc,EAAE,cAAc;IAOlD;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAkC3H;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,MAAM,EAAE;IAInE;;;;OAIG;IACH,mBAAmB,CAAC,GAAG,SAAW,GAAG,MAAM,EAAE;CAS9C;AAED,4GAA4G;AAC5G,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAK7F"}
|
|
@@ -66,6 +66,13 @@ class SpecGenerator {
|
|
|
66
66
|
const appended = this.ideConfigGenerator.generateGitAttributes(options.targetDir);
|
|
67
67
|
return { onboardingPrompt, kept, appended };
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* The project-relative files `generateSpecs()` writes under `.specs/` for an API paradigm, in the
|
|
71
|
+
* order it writes them (BL-PM-004); `api.yaml` is absent for `none`.
|
|
72
|
+
*/
|
|
73
|
+
targetsInSpecs(apiParadigm, specsName = '.specs') {
|
|
74
|
+
return this.specFileGenerator.targets(apiParadigm).map(rel => `${specsName}/${rel}`);
|
|
75
|
+
}
|
|
69
76
|
/**
|
|
70
77
|
* The project-relative files `generateSpecs()` writes outside `.specs/` for an IDE choice, in the
|
|
71
78
|
* order it writes them (BL-055): read from the same tables the writes use, and pinned to the real
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specGenerator.js","sourceRoot":"","sources":["../../src/utils/specGenerator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"specGenerator.js","sourceRoot":"","sources":["../../src/utils/specGenerator.ts"],"names":[],"mappings":";;;AAqIA,gCAKC;AA1ID,+BAA4B;AAC5B,2BAA+B;AAE/B,2DAAwD;AACxD,6DAA8E;AAC9E,iEAA8D;AAC9D,mEAAgE;AAsChE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAErD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACtH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAEpH,SAAS,gBAAgB,CAAC,SAAkB;IAC1C,IAAI,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC;IAC9B,MAAM,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC;IAC5C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAa,aAAa;IAMxB,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,c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C,kGAAkG,CAAC,CAAC;IACrK,IAAI,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,QAAQ,QAAQ,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,uCAAkB,EAAE,CAAC,CAAC;IAC3G,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -58,12 +58,16 @@ export interface SpecServerOptions {
|
|
|
58
58
|
named?: boolean[];
|
|
59
59
|
/** The registry file (`~/.specpilot/projects.json`); the registry routes exist only when set and not read-only (BL-067). */
|
|
60
60
|
registry?: string;
|
|
61
|
+
/** Time limit of a clone in ms (tests shorten it; default `CLONE_TIMEOUT_MS`). */
|
|
62
|
+
cloneTimeoutMs?: number;
|
|
61
63
|
}
|
|
62
64
|
export interface SpecServer {
|
|
63
65
|
server: Server;
|
|
64
66
|
/** Open event streams right now. */
|
|
65
67
|
streams(): number;
|
|
66
|
-
/**
|
|
68
|
+
/** Kill a running clone and remove what it downloaded (BL-PM-002); resolves when that is done. */
|
|
69
|
+
stopClone(): Promise<void>;
|
|
70
|
+
/** Stop a running clone, end every event stream, clear every timer, then close the listener. */
|
|
67
71
|
close(): Promise<void>;
|
|
68
72
|
}
|
|
69
73
|
export declare function createSpecServer(initialRoots: string[], specpilotVersion: string, opts?: SpecServerOptions): SpecServer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specServer.d.ts","sourceRoot":"","sources":["../../src/utils/specServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAkB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"specServer.d.ts","sourceRoot":"","sources":["../../src/utils/specServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,MAAM,EAAkB,MAAM,MAAM,CAAC;AAgC7E,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG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AK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,UAAU,CA6a3H;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,CAS1I"}
|
package/dist/utils/specServer.js
CHANGED
|
@@ -51,10 +51,12 @@ const taskMover_1 = require("./taskMover");
|
|
|
51
51
|
const specPaths_1 = require("./specPaths");
|
|
52
52
|
const specPoller_1 = require("./specPoller");
|
|
53
53
|
const specSetup_1 = require("./specSetup");
|
|
54
|
+
const gitClone_1 = require("./gitClone");
|
|
54
55
|
const projectRegistry_1 = require("./projectRegistry");
|
|
55
56
|
// Local server behind `specpilot serve` (BL-051, ARCH-004.33, SEC-004.8). Every request re-reads disk;
|
|
56
57
|
// nothing is cached. The server writes nothing itself: task moves go through taskMover.ts (BL-053),
|
|
57
|
-
// guided setup through specSetup.ts (BL-055)
|
|
58
|
+
// guided setup and new projects through specSetup.ts (BL-055, BL-PM-003), the project registry through
|
|
59
|
+
// projectRegistry.ts (BL-067) and a clone through gitClone.ts, which runs the user's git (BL-PM-002).
|
|
58
60
|
/** Resolved from this module's own location, never from cwd: dist/utils → <package>/ui. */
|
|
59
61
|
const UI_DIR = (0, path_1.join)(__dirname, '..', '..', 'ui');
|
|
60
62
|
const UI_ROUTES = {
|
|
@@ -268,6 +270,7 @@ function createSpecServer(initialRoots, specpilotVersion, opts = {}) {
|
|
|
268
270
|
if (!res.headersSent)
|
|
269
271
|
sendJson(res, 500, { error: 'The server could not finish this request.' });
|
|
270
272
|
});
|
|
273
|
+
return writeLock;
|
|
271
274
|
};
|
|
272
275
|
/** The checks every write shares (SEC-004.10): Origin, token, content type, size. False = already answered. */
|
|
273
276
|
const writeAllowed = (req, res) => {
|
|
@@ -425,6 +428,28 @@ function createSpecServer(initialRoots, specpilotVersion, opts = {}) {
|
|
|
425
428
|
}
|
|
426
429
|
return null;
|
|
427
430
|
};
|
|
431
|
+
const TOO_MANY_PROJECTS = `This server already serves ${projectRegistry_1.MAX_PROJECTS} projects. Start another specpilot serve for more.`;
|
|
432
|
+
/**
|
|
433
|
+
* Serve `root` as the next index and record it in the registry: the success body of an open, or null
|
|
434
|
+
* after answering 422 because the folder's allowlisted files cannot be read (it is then not half-opened).
|
|
435
|
+
*/
|
|
436
|
+
const serveRoot = (res, root) => {
|
|
437
|
+
let specs;
|
|
438
|
+
try {
|
|
439
|
+
specs = buildSpecsPayload(root, specpilotVersion);
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
sendJson(res, 422, { error: `This folder could not be read: ${err.message}` });
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
const project = projectFor(root); // built before anything is pushed, so the three lists never disagree
|
|
446
|
+
const n = roots.length;
|
|
447
|
+
roots.push(root);
|
|
448
|
+
namedFlags.push(true);
|
|
449
|
+
projects.push(project);
|
|
450
|
+
const error = changeRegistry(entries => (0, projectRegistry_1.upsertEntry)(entries, root, new Date()));
|
|
451
|
+
return { project: n, specs: { ...specs, projects: projectList(roots) }, registry: { ...registryBody(), ...(error ? { error } : {}) } };
|
|
452
|
+
};
|
|
428
453
|
const handleProjectAdd = (req, res) => {
|
|
429
454
|
if (!writeAllowed(req, res))
|
|
430
455
|
return;
|
|
@@ -436,23 +461,127 @@ function createSpecServer(initialRoots, specpilotVersion, opts = {}) {
|
|
|
436
461
|
const check = (0, projectRegistry_1.checkOpenPath)(body.path, roots, home);
|
|
437
462
|
if ('status' in check)
|
|
438
463
|
return sendJson(res, check.status, check.project === undefined ? { error: check.error } : { error: check.error, project: check.project });
|
|
439
|
-
if (
|
|
440
|
-
return sendJson(res, 409, { error:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
464
|
+
if (cloningTarget && (check.root === cloningTarget || check.root.startsWith(cloningTarget + path_1.sep)))
|
|
465
|
+
return sendJson(res, 409, { error: `${cloningTarget} is being cloned. Wait for it to finish.` });
|
|
466
|
+
if (roots.length + (cloningTarget ? 1 : 0) >= projectRegistry_1.MAX_PROJECTS)
|
|
467
|
+
return sendJson(res, 409, { error: TOO_MANY_PROJECTS });
|
|
468
|
+
const body200 = serveRoot(res, check.root);
|
|
469
|
+
if (body200)
|
|
470
|
+
sendJson(res, 200, body200);
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
// ---- a new project (BL-PM-003): what `init` does in <parent>/<name>, then served like an opened folder
|
|
475
|
+
const handleProjectNewGet = (res) => {
|
|
476
|
+
try {
|
|
477
|
+
sendJson(res, 200, (0, specSetup_1.newProjectQuestions)());
|
|
478
|
+
}
|
|
479
|
+
catch (err) {
|
|
480
|
+
sendJson(res, 422, { error: `The OS username could not be read: ${err.message}` });
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
const handleProjectNew = (req, res) => {
|
|
484
|
+
if (!writeAllowed(req, res))
|
|
485
|
+
return;
|
|
486
|
+
readJson(req, res, body => {
|
|
487
|
+
const problem = (0, specSetup_1.newProjectShapeError)(body);
|
|
488
|
+
if (problem)
|
|
489
|
+
return sendJson(res, 422, { error: problem });
|
|
490
|
+
const { parent, name, ...answers } = body;
|
|
491
|
+
underLock(res, async () => {
|
|
492
|
+
if (roots.length + (cloningTarget ? 1 : 0) >= projectRegistry_1.MAX_PROJECTS)
|
|
493
|
+
return sendJson(res, 409, { error: TOO_MANY_PROJECTS }); // before anything is created
|
|
494
|
+
const out = await (0, specSetup_1.createProject)(parent, name, answers, roots, home, cloningTarget);
|
|
495
|
+
if (out.status !== 200)
|
|
496
|
+
return sendJson(res, out.status, out.project === undefined ? { error: out.error } : { error: out.error, project: out.project });
|
|
497
|
+
const body200 = serveRoot(res, out.root);
|
|
498
|
+
if (body200)
|
|
499
|
+
sendJson(res, 200, { ...body200, kept: out.kept, notice: out.notice });
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
// ---- clone a repository (BL-PM-002): the user's git fills <parent>/<name>, then served like an opened folder.
|
|
504
|
+
// One at a time, outside the write lock: the lock covers the checks and the mkdir, and serving the folder.
|
|
505
|
+
let cloneBusy = false;
|
|
506
|
+
let closing = false; // set by stopClone(): no clone starts once the server is being stopped
|
|
507
|
+
let cloningTarget = null; // reserved: counted in the cap, refused by the open and new routes
|
|
508
|
+
let cloneAbort = null;
|
|
509
|
+
let cloneDone = Promise.resolve();
|
|
510
|
+
const runClone = async (res, url, parent, name, signal) => {
|
|
511
|
+
const probe = await (0, gitClone_1.probeGit)(home); // before anything is created
|
|
512
|
+
if ('error' in probe)
|
|
513
|
+
return sendJson(res, 422, { error: probe.error });
|
|
514
|
+
let reserved;
|
|
515
|
+
await underLock(res, () => {
|
|
516
|
+
if (signal.aborted)
|
|
517
|
+
return;
|
|
518
|
+
if (roots.length >= projectRegistry_1.MAX_PROJECTS)
|
|
519
|
+
return sendJson(res, 409, { error: TOO_MANY_PROJECTS });
|
|
520
|
+
const r = (0, specSetup_1.reserveTarget)(parent, name, roots, home);
|
|
521
|
+
if (!('status' in r)) {
|
|
522
|
+
reserved = r;
|
|
523
|
+
cloningTarget = r.target;
|
|
524
|
+
}
|
|
525
|
+
else if (r.notEmpty)
|
|
526
|
+
sendJson(res, 409, { error: `${r.notEmpty} already exists and is not empty, so nothing was cloned.` });
|
|
527
|
+
else
|
|
528
|
+
sendJson(res, r.status, r.project === undefined ? { error: r.error } : { error: r.error, project: r.project });
|
|
529
|
+
});
|
|
530
|
+
if (!reserved)
|
|
531
|
+
return;
|
|
532
|
+
const { target, created } = reserved;
|
|
533
|
+
const cleanUp = async () => {
|
|
534
|
+
const code = await (0, gitClone_1.emptyTarget)(target, created);
|
|
535
|
+
return code ? ` ${target} could not be cleaned up (${code}).` : '';
|
|
536
|
+
};
|
|
537
|
+
const out = await (0, gitClone_1.cloneRepository)(url, target, { batchSsh: probe.batchSsh, timeoutMs: opts.cloneTimeoutMs, signal });
|
|
538
|
+
if (!out.ok) {
|
|
539
|
+
const note = await cleanUp();
|
|
540
|
+
if (!out.aborted)
|
|
541
|
+
sendJson(res, 422, { error: out.error + note });
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
await underLock(res, async () => {
|
|
545
|
+
if (signal.aborted)
|
|
546
|
+
return void (await cleanUp()); // cancelled just after git finished: nothing happened
|
|
547
|
+
const body200 = serveRoot(res, target);
|
|
548
|
+
if (body200)
|
|
549
|
+
sendJson(res, 200, body200);
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
const handleProjectClone = (req, res) => {
|
|
553
|
+
if (!writeAllowed(req, res))
|
|
554
|
+
return;
|
|
555
|
+
readJson(req, res, body => {
|
|
556
|
+
const problem = (0, gitClone_1.cloneShapeError)(body);
|
|
557
|
+
if (problem)
|
|
558
|
+
return sendJson(res, 422, { error: problem });
|
|
559
|
+
if (closing)
|
|
560
|
+
return sendJson(res, 503, { error: 'The server is stopping.' });
|
|
561
|
+
if (cloneBusy)
|
|
562
|
+
return sendJson(res, 409, { error: 'Another clone is running. Wait for it to finish.' });
|
|
563
|
+
cloneBusy = true;
|
|
564
|
+
const { url, parent, name } = body;
|
|
565
|
+
const abort = new AbortController();
|
|
566
|
+
cloneAbort = abort;
|
|
567
|
+
// The page went away before the answer (Cancel, a closed tab): the response closes unfinished.
|
|
568
|
+
const gone = () => {
|
|
569
|
+
if (!res.writableEnded)
|
|
570
|
+
abort.abort();
|
|
571
|
+
};
|
|
572
|
+
res.on('close', gone);
|
|
573
|
+
cloneDone = runClone(res, url, parent, name || (0, gitClone_1.repoNameFromUrl)(url), abort.signal)
|
|
574
|
+
.catch(() => {
|
|
575
|
+
if (!res.headersSent)
|
|
576
|
+
sendJson(res, 500, { error: 'The server could not finish this request.' });
|
|
577
|
+
})
|
|
578
|
+
.then(() => {
|
|
579
|
+
res.off('close', gone);
|
|
580
|
+
if (!res.writableEnded)
|
|
581
|
+
res.destroy(); // aborted: nothing was sent, and close() must not wait for this connection
|
|
582
|
+
cloneBusy = false;
|
|
583
|
+
cloningTarget = null;
|
|
584
|
+
cloneAbort = null;
|
|
456
585
|
});
|
|
457
586
|
});
|
|
458
587
|
};
|
|
@@ -485,6 +614,20 @@ function createSpecServer(initialRoots, specpilotVersion, opts = {}) {
|
|
|
485
614
|
res.setHeader('Allow', registry ? 'GET, POST' : '');
|
|
486
615
|
return send(res, 405, TEXT, 'Method Not Allowed\n');
|
|
487
616
|
}
|
|
617
|
+
if (url.pathname === '/api/projects/new') {
|
|
618
|
+
if (registry && req.method === 'GET')
|
|
619
|
+
return handleProjectNewGet(res);
|
|
620
|
+
if (registry && req.method === 'POST')
|
|
621
|
+
return handleProjectNew(req, res);
|
|
622
|
+
res.setHeader('Allow', registry ? 'GET, POST' : '');
|
|
623
|
+
return send(res, 405, TEXT, 'Method Not Allowed\n');
|
|
624
|
+
}
|
|
625
|
+
if (url.pathname === '/api/projects/clone') {
|
|
626
|
+
if (registry && req.method === 'POST')
|
|
627
|
+
return handleProjectClone(req, res);
|
|
628
|
+
res.setHeader('Allow', registry ? 'POST' : '');
|
|
629
|
+
return send(res, 405, TEXT, 'Method Not Allowed\n');
|
|
630
|
+
}
|
|
488
631
|
if (url.pathname === '/api/projects/remove') {
|
|
489
632
|
if (registry && req.method === 'POST')
|
|
490
633
|
return handleProjectRemove(req, res);
|
|
@@ -534,18 +677,27 @@ function createSpecServer(initialRoots, specpilotVersion, opts = {}) {
|
|
|
534
677
|
send(res, 500, TEXT, 'Internal Server Error\n');
|
|
535
678
|
}
|
|
536
679
|
});
|
|
680
|
+
const stopClone = () => {
|
|
681
|
+
closing = true;
|
|
682
|
+
cloneAbort?.abort();
|
|
683
|
+
return cloneDone;
|
|
684
|
+
};
|
|
537
685
|
return {
|
|
538
686
|
server,
|
|
539
687
|
streams: () => allStreams().length,
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
688
|
+
stopClone,
|
|
689
|
+
close: async () => {
|
|
690
|
+
await stopClone();
|
|
691
|
+
await new Promise(resolveClose => {
|
|
692
|
+
projects.forEach((p, i) => [...p.streams].forEach(res => {
|
|
693
|
+
res.end();
|
|
694
|
+
drop(i, res);
|
|
695
|
+
}));
|
|
696
|
+
projects.forEach(p => p.poller.stop());
|
|
697
|
+
server.close(() => resolveClose());
|
|
698
|
+
server.closeIdleConnections?.();
|
|
699
|
+
});
|
|
700
|
+
},
|
|
549
701
|
};
|
|
550
702
|
}
|
|
551
703
|
/** Listen on 127.0.0.1 only. Rejects with the listen error (e.g. EADDRINUSE). */
|