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.
- package/README.md +4 -2
- package/dist/commands/add-specs.d.ts.map +1 -1
- package/dist/commands/add-specs.js +1 -3
- package/dist/commands/add-specs.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +32 -95
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/refine.d.ts.map +1 -1
- package/dist/commands/refine.js +1 -3
- package/dist/commands/refine.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/core/agentConfig.d.ts +9 -0
- package/dist/core/agentConfig.d.ts.map +1 -0
- package/dist/{utils/agentConfigGenerator.js → core/agentConfig.js} +29 -44
- package/dist/core/agentConfig.js.map +1 -0
- package/dist/core/ideConfig.d.ts +35 -0
- package/dist/core/ideConfig.d.ts.map +1 -0
- package/dist/core/ideConfig.js +287 -0
- package/dist/core/ideConfig.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +22 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/render.d.ts +73 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/render.js +99 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/slashCommands.d.ts +23 -0
- package/dist/core/slashCommands.d.ts.map +1 -0
- package/dist/core/slashCommands.js +524 -0
- package/dist/core/slashCommands.js.map +1 -0
- package/dist/core/specFiles.d.ts +18 -0
- package/dist/core/specFiles.d.ts.map +1 -0
- package/dist/{utils/specFileGenerator.js → core/specFiles.js} +223 -127
- package/dist/core/specFiles.js.map +1 -0
- package/dist/core/templateEngine.d.ts +69 -0
- package/dist/core/templateEngine.d.ts.map +1 -0
- package/dist/{utils → core}/templateEngine.js +108 -6
- package/dist/core/templateEngine.js.map +1 -0
- 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/ideConfigGenerator.d.ts +5 -29
- package/dist/utils/ideConfigGenerator.d.ts.map +1 -1
- package/dist/utils/ideConfigGenerator.js +9 -282
- package/dist/utils/ideConfigGenerator.js.map +1 -1
- 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/slashCommandGenerator.d.ts +3 -17
- package/dist/utils/slashCommandGenerator.d.ts.map +1 -1
- package/dist/utils/slashCommandGenerator.js +8 -514
- package/dist/utils/slashCommandGenerator.js.map +1 -1
- package/dist/utils/specGenerator.d.ts +16 -46
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +36 -62
- 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 +228 -21
- 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
- package/dist/utils/agentConfigGenerator.d.ts +0 -17
- package/dist/utils/agentConfigGenerator.d.ts.map +0 -1
- package/dist/utils/agentConfigGenerator.js.map +0 -1
- package/dist/utils/specFileGenerator.d.ts +0 -29
- package/dist/utils/specFileGenerator.d.ts.map +0 -1
- package/dist/utils/specFileGenerator.js.map +0 -1
- package/dist/utils/templateEngine.d.ts +0 -35
- package/dist/utils/templateEngine.d.ts.map +0 -1
- package/dist/utils/templateEngine.js.map +0 -1
|
@@ -33,8 +33,48 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.TemplateEngine = void 0;
|
|
36
|
+
exports.TemplateEngine = exports.OPTIONAL_FIELDS = void 0;
|
|
37
|
+
exports.present = present;
|
|
38
|
+
exports.yamlScalar = yamlScalar;
|
|
37
39
|
const Handlebars = __importStar(require("handlebars"));
|
|
40
|
+
/** The keys of `OptionalFields`, for `render()`'s present-or-absent rule. */
|
|
41
|
+
exports.OPTIONAL_FIELDS = [
|
|
42
|
+
'platforms', 'accessControl', 'specialConsiderations', 'accessibilityNotes', 'systemPattern', 'activeUsers', 'teamSize',
|
|
43
|
+
'deploymentTargets', 'localDatabases', 'dataSyncStrategy', 'integrations', 'otherApis', 'apiResponseTime', 'availability',
|
|
44
|
+
'databases', 'authStrategy', 'realtimeTypes', 'compliance', 'cicd', 'securityConcerns', 'buildTimeline', 'constraintDescription',
|
|
45
|
+
'testingStrategy',
|
|
46
|
+
];
|
|
47
|
+
/** Present means: a string that is not blank, a list with an item, a map with a key (REQ-002.I.4). */
|
|
48
|
+
function present(value) {
|
|
49
|
+
if (value === undefined || value === null)
|
|
50
|
+
return false;
|
|
51
|
+
if (typeof value === 'string')
|
|
52
|
+
return value.trim() !== '';
|
|
53
|
+
if (Array.isArray(value))
|
|
54
|
+
return value.length > 0;
|
|
55
|
+
if (typeof value === 'object')
|
|
56
|
+
return Object.keys(value).length > 0;
|
|
57
|
+
return Boolean(value);
|
|
58
|
+
}
|
|
59
|
+
// A value YAML 1.2, or js-yaml (the reader `specpilot validate` uses), would not read back as the
|
|
60
|
+
// same string when written plain (REQ-002.I.5): the words, every number spelling, and timestamps.
|
|
61
|
+
const YAML_WORDS = /^(true|false|null|~|yes|no|on|off)$/i;
|
|
62
|
+
const YAML_NUMBER = /^([-+]?(\.[0-9]+|[0-9][0-9_]*(\.[0-9_]*)?)([eE][-+]?[0-9]+)?|[-+]?0[box][0-9a-fA-F_]+|[-+]?\.(inf|Inf|INF)|\.(nan|NaN|NAN))$/;
|
|
63
|
+
const YAML_TIMESTAMP = /^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}([Tt]|[ \t]+)?([0-9]{1,2}:[0-9]{2}:[0-9]{2}(\.[0-9]*)?([ \t]*(Z|[-+][0-9]{1,2}(:[0-9]{2})?))?)?$/;
|
|
64
|
+
/** `value` as a YAML scalar: plain when YAML reads it back unchanged, else double-quoted and escaped. */
|
|
65
|
+
function yamlScalar(value) {
|
|
66
|
+
const plain = value !== '' &&
|
|
67
|
+
!/^[\s\-?:,[\]{}#&*!|>'"%@`]/.test(value) &&
|
|
68
|
+
!/[\n\r\t]/.test(value) &&
|
|
69
|
+
!/: | #/.test(value) &&
|
|
70
|
+
!/[:\s]$/.test(value) &&
|
|
71
|
+
!YAML_WORDS.test(value) &&
|
|
72
|
+
!YAML_NUMBER.test(value) &&
|
|
73
|
+
!YAML_TIMESTAMP.test(value);
|
|
74
|
+
if (plain)
|
|
75
|
+
return value;
|
|
76
|
+
return '"' + value.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\t/g, '\\t').replace(/\r/g, '\\r').replace(/\n/g, '\\n') + '"';
|
|
77
|
+
}
|
|
38
78
|
class TemplateEngine {
|
|
39
79
|
constructor() {
|
|
40
80
|
this.registerHelpers();
|
|
@@ -44,9 +84,15 @@ class TemplateEngine {
|
|
|
44
84
|
Handlebars.registerHelper('uppercase', (str) => str.toUpperCase());
|
|
45
85
|
Handlebars.registerHelper('lowercase', (str) => str.toLowerCase());
|
|
46
86
|
Handlebars.registerHelper('capitalize', (str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
47
|
-
|
|
48
|
-
|
|
87
|
+
// One date per render (BL-032): the context's `lastUpdated`, else today, for a bare renderFromString().
|
|
88
|
+
const dateOf = (options) => options.data?.root?.lastUpdated ?? new Date().toISOString().split('T')[0];
|
|
89
|
+
Handlebars.registerHelper('currentDate', (options) => dateOf(options));
|
|
90
|
+
Handlebars.registerHelper('currentYear', (options) => Number(dateOf(options).slice(0, 4)));
|
|
49
91
|
Handlebars.registerHelper('join', (array, separator) => Array.isArray(array) ? array.join(separator) : '');
|
|
92
|
+
// BL-032 phase 2: `any` for a section that several optional fields share; `yaml`/`yamlList` for YAML values (REQ-002.I.5).
|
|
93
|
+
Handlebars.registerHelper('any', (...args) => args.slice(0, -1).some(present));
|
|
94
|
+
Handlebars.registerHelper('yaml', (value) => new Handlebars.SafeString(yamlScalar(String(value ?? ''))));
|
|
95
|
+
Handlebars.registerHelper('yamlList', (items) => new Handlebars.SafeString(Array.isArray(items) ? items.map(item => ` - ${yamlScalar(String(item))}`).join('\n') : ' []'));
|
|
50
96
|
}
|
|
51
97
|
renderFromString(templateString, context) {
|
|
52
98
|
const template = Handlebars.compile(templateString);
|
|
@@ -101,11 +147,11 @@ class TemplateEngine {
|
|
|
101
147
|
}
|
|
102
148
|
getProjectYamlTemplate(language, framework) {
|
|
103
149
|
return `# {{projectName}} - SDD Project Configuration
|
|
104
|
-
name: {{projectName}}
|
|
150
|
+
name: {{yaml projectName}}
|
|
105
151
|
version: "1.0.0"
|
|
106
152
|
language: ${language}
|
|
107
153
|
${framework ? `framework: ${framework}` : ''}
|
|
108
|
-
description: {{description}}
|
|
154
|
+
description: {{yaml description}}
|
|
109
155
|
|
|
110
156
|
# Rules and mandates: see your AI agent configuration file (single source of truth)
|
|
111
157
|
|
|
@@ -116,6 +162,12 @@ team:
|
|
|
116
162
|
testing_required: true
|
|
117
163
|
documentation_required: true
|
|
118
164
|
|
|
165
|
+
{{#if platforms}}
|
|
166
|
+
# Platforms
|
|
167
|
+
platforms:
|
|
168
|
+
{{yamlList platforms}}
|
|
169
|
+
|
|
170
|
+
{{/if}}
|
|
119
171
|
# Build and Deployment
|
|
120
172
|
build:
|
|
121
173
|
${language === 'typescript' ? 'command: "npm run build"' : ''}
|
|
@@ -242,7 +294,7 @@ This document outlines the architecture and design decisions for {{projectName}}
|
|
|
242
294
|
|
|
243
295
|
## Architecture Patterns
|
|
244
296
|
- **Language**: ${language}
|
|
245
|
-
- **Architecture Style**: [Specify: MVC, Microservices, Layered, etc.]
|
|
297
|
+
- **Architecture Style**: {{#if systemPattern}}{{systemPattern}}{{else}}[Specify: MVC, Microservices, Layered, etc.]{{/if}}
|
|
246
298
|
- **Data Flow**: [Specify: Unidirectional, Event-driven, etc.]
|
|
247
299
|
|
|
248
300
|
## Core Components
|
|
@@ -283,6 +335,47 @@ Based on analysis of the project structure:
|
|
|
283
335
|
*Replace the placeholder with the directories and files that represent your real application structure. Include annotations for responsibilities when helpful.*
|
|
284
336
|
{{/if}}
|
|
285
337
|
|
|
338
|
+
{{#if (any activeUsers teamSize)}}
|
|
339
|
+
## Scale
|
|
340
|
+
{{#if activeUsers}}
|
|
341
|
+
- Active users: {{activeUsers}}
|
|
342
|
+
{{/if}}
|
|
343
|
+
{{#if teamSize}}
|
|
344
|
+
- Team size: {{teamSize}}
|
|
345
|
+
{{/if}}
|
|
346
|
+
|
|
347
|
+
{{/if}}
|
|
348
|
+
{{#if deploymentTargets}}
|
|
349
|
+
## Deployment targets
|
|
350
|
+
{{#each deploymentTargets}}
|
|
351
|
+
- {{this}}
|
|
352
|
+
{{/each}}
|
|
353
|
+
|
|
354
|
+
{{/if}}
|
|
355
|
+
{{#if (any localDatabases dataSyncStrategy)}}
|
|
356
|
+
## Data layer
|
|
357
|
+
- **Offline support**: Yes
|
|
358
|
+
{{#if localDatabases}}
|
|
359
|
+
- **Local database(s)**: {{join localDatabases ", "}}
|
|
360
|
+
{{/if}}
|
|
361
|
+
{{#if dataSyncStrategy}}
|
|
362
|
+
- **Data sync strategy**: {{dataSyncStrategy}}
|
|
363
|
+
{{/if}}
|
|
364
|
+
|
|
365
|
+
{{/if}}
|
|
366
|
+
{{#if (any integrations otherApis)}}
|
|
367
|
+
## Integrations
|
|
368
|
+
{{#each integrations}}
|
|
369
|
+
- **{{@key}}**: {{join this ", "}}
|
|
370
|
+
{{/each}}
|
|
371
|
+
{{#if otherApis}}
|
|
372
|
+
{{#if integrations}}
|
|
373
|
+
|
|
374
|
+
{{/if}}
|
|
375
|
+
Other: {{otherApis}}
|
|
376
|
+
{{/if}}
|
|
377
|
+
|
|
378
|
+
{{/if}}
|
|
286
379
|
## Design Decisions
|
|
287
380
|
|
|
288
381
|
### Decision 1: [Decision Title]
|
|
@@ -298,7 +391,16 @@ Based on analysis of the project structure:
|
|
|
298
391
|
[List security measures and considerations]
|
|
299
392
|
|
|
300
393
|
## Performance Considerations
|
|
394
|
+
{{#if (any apiResponseTime availability)}}
|
|
395
|
+
{{#if apiResponseTime}}
|
|
396
|
+
- **API response-time target**: {{apiResponseTime}}
|
|
397
|
+
{{/if}}
|
|
398
|
+
{{#if availability}}
|
|
399
|
+
- **Availability target**: {{availability}}
|
|
400
|
+
{{/if}}
|
|
401
|
+
{{else}}
|
|
301
402
|
[Describe performance requirements and optimization strategies]
|
|
403
|
+
{{/if}}
|
|
302
404
|
|
|
303
405
|
## Monitoring and Observability
|
|
304
406
|
[Describe logging, metrics, and monitoring strategy]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateEngine.js","sourceRoot":"","sources":["../../src/core/templateEngine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,0BAMC;AASD,gCAYC;AA7FD,uDAAyC;AAoCzC,6EAA6E;AAChE,QAAA,eAAe,GAA6B;IACvD,WAAW,EAAE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AS,EAAE,CAAC;YACrD,OAAO;;;;;;;gCAOmB,CAAC;QAC7B,CAAC;QAED,IAAI,QAAQ,KAAK,QAAQ,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YACpD,OAAO;;;;;;0DAM6C,CAAC;QACvD,CAAC;QAED,IAAI,QAAQ,KAAK,QAAQ,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;YAClD,OAAO;;;;;;;+CAOkC,CAAC;QAC5C,CAAC;QAED,IAAI,QAAQ,KAAK,QAAQ,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YACrD,OAAO;;;;;;2CAM8B,CAAC;QACxC,CAAC;QAED,IAAI,QAAQ,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;YAClD,OAAO;;;;;kBAKK,CAAC;QACf,CAAC;QAED,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO;;kBAEK,CAAC;QACf,CAAC;QAED,OAAO;;kBAEO,CAAC;IACjB,CAAC;IAEO,uBAAuB,CAAC,QAAgB;QAC9C,OAAO;;;;YAIC,QAAQ;;;;;;;;;sFASkE,QAAQ;;;kBAG5E,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAyHM,CAAC;IAC/B,CAAC;CACF;AAjXD,wCAiXC"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { ProjectInfo } from './projectDetector';
|
|
2
2
|
import { SpecGeneratorOptions } from './specGenerator';
|
|
3
|
+
/** The steps `specpilot serve` asks the questions in, named as init.specpilot.dev names them (BL-PM-004). */
|
|
4
|
+
export declare const SETUP_STEPS: string[];
|
|
5
|
+
/**
|
|
6
|
+
* The chat's friendly line for each question, a short recap label and, for a typed answer, the field's
|
|
7
|
+
* example (REQ-002.H.27). `{language}` is filled by the page with the language choice's text. The CLI's own
|
|
8
|
+
* message is shown under the line, verbatim; none of this reaches the terminal.
|
|
9
|
+
*/
|
|
10
|
+
export declare const QUESTION_CHAT: Record<string, {
|
|
11
|
+
chat: string;
|
|
12
|
+
label: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
}>;
|
|
15
|
+
/** The questions in the order the chat asks them, each with its step (the page's parent-folder question comes first). */
|
|
16
|
+
export declare const CHAT_ORDER: [string, string][];
|
|
17
|
+
/** Question key → its step. */
|
|
18
|
+
export declare const QUESTION_STEPS: Record<string, string>;
|
|
3
19
|
export declare const SUPPORTED_LANGUAGES: string[];
|
|
4
20
|
export declare const PROJECT_TYPE_MESSAGE = "Is this a greenfield or brownfield project?";
|
|
5
21
|
export declare const PROJECT_TYPE_CHOICES: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addSpecsQuestions.d.ts","sourceRoot":"","sources":["../../src/utils/addSpecsQuestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAKvD,eAAO,MAAM,mBAAmB,UAA4D,CAAC;AAE7F,eAAO,MAAM,oBAAoB,gDAAgD,CAAC;AAClF,eAAO,MAAM,oBAAoB;;;GAGhC,CAAC;AAEF,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,6CAA6C,CAAC;AAC/E,eAAO,MAAM,oBAAoB;;;GAKhC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,MAAM,WAC2O,CAAC;AAE5R,eAAO,MAAM,WAAW,oDAAoD,CAAC;AAC7E,eAAO,MAAM,WAAW;;;GAOvB,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,YAAY,GAAI,MAAM,WAAW,WAAuF,CAAC;AAEtI,MAAM,WAAW,eAAe;I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,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,6CAA6C,CAAC;AAC/E,eAAO,MAAM,oBAAoB;;;GAKhC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,MAAM,WAC2O,CAAC;AAE5R,eAAO,MAAM,WAAW,oDAAoD,CAAC;AAC7E,eAAO,MAAM,WAAW;;;GAOvB,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,YAAY,GAAI,MAAM,WAAW,WAAuF,CAAC;AAEtI,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,YAAY,GAAG,YAAY,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wGAAwG;AACxG,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,WAAW,GAAG,IAAI,EAC/B,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,GAChD,oBAAoB,CAgBtB"}
|
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectedLine = exports.IDE_CHOICES = exports.IDE_MESSAGE = exports.handleMessage = exports.API_PARADIGM_CHOICES = exports.API_PARADIGM_MESSAGE = exports.FRAMEWORK_MESSAGE = exports.LANGUAGE_MESSAGE = exports.PROJECT_TYPE_CHOICES = exports.PROJECT_TYPE_MESSAGE = exports.SUPPORTED_LANGUAGES = void 0;
|
|
3
|
+
exports.detectedLine = exports.IDE_CHOICES = exports.IDE_MESSAGE = exports.handleMessage = exports.API_PARADIGM_CHOICES = exports.API_PARADIGM_MESSAGE = exports.FRAMEWORK_MESSAGE = exports.LANGUAGE_MESSAGE = exports.PROJECT_TYPE_CHOICES = exports.PROJECT_TYPE_MESSAGE = exports.SUPPORTED_LANGUAGES = exports.QUESTION_STEPS = exports.CHAT_ORDER = exports.QUESTION_CHAT = exports.SETUP_STEPS = void 0;
|
|
4
4
|
exports.addSpecsOptions = addSpecsOptions;
|
|
5
5
|
// What `specpilot add-specs` asks, and how its answers become generator options: one copy, used by
|
|
6
6
|
// the command's inquirer prompts and by `specpilot serve`'s guided setup (BL-055, ARCH-003.19).
|
|
7
|
+
/** The steps `specpilot serve` asks the questions in, named as init.specpilot.dev names them (BL-PM-004). */
|
|
8
|
+
exports.SETUP_STEPS = ['Project identity', 'Platform & IDE', 'Target users', 'Scale & deploy', 'Architecture & data', 'Constraints & non-goals'];
|
|
9
|
+
/**
|
|
10
|
+
* The chat's friendly line for each question, a short recap label and, for a typed answer, the field's
|
|
11
|
+
* example (REQ-002.H.27). `{language}` is filled by the page with the language choice's text. The CLI's own
|
|
12
|
+
* message is shown under the line, verbatim; none of this reaches the terminal.
|
|
13
|
+
*/
|
|
14
|
+
exports.QUESTION_CHAT = {
|
|
15
|
+
projectType: { chat: 'Got it. Is this a new build, or are we adding specs to an existing codebase?', label: 'Type' },
|
|
16
|
+
whatItDoes: { chat: 'Describe it in plain words. As short or as detailed as you like.', label: 'What it does', placeholder: 'A tracker for courier parcels with live status for customers' },
|
|
17
|
+
handle: { chat: "Last thing for this part: your short handle? Optional. It prefixes task IDs, like CD-jsmith-001. Skip and I'll use your OS username.", label: 'Handle', placeholder: 'e.g. jsmith' },
|
|
18
|
+
language: { chat: 'Which language is it in?', label: 'Language' },
|
|
19
|
+
framework: { chat: 'Any framework on top of {language}?', label: 'Framework' },
|
|
20
|
+
ide: { chat: 'Which AI IDE do you use, so I can write its context files?', label: 'AI IDE' },
|
|
21
|
+
targetUsers: { chat: "Who's going to use it? Optional.", label: 'Users', placeholder: 'Couriers and the customers waiting for parcels' },
|
|
22
|
+
expectedScale: { chat: "What's the expected scale? Optional.", label: 'Scale', placeholder: 'About 5,000 parcels a day in one city' },
|
|
23
|
+
apiParadigm: { chat: 'What kind of API does it expose? This decides whether api.yaml is written.', label: 'API' },
|
|
24
|
+
constraints: { chat: 'Any key constraints or requirements? Optional.', label: 'Constraints', placeholder: 'Must work offline on cheap Android phones' },
|
|
25
|
+
};
|
|
26
|
+
/** The questions in the order the chat asks them, each with its step (the page's parent-folder question comes first). */
|
|
27
|
+
exports.CHAT_ORDER = [
|
|
28
|
+
['projectType', exports.SETUP_STEPS[0]], ['whatItDoes', exports.SETUP_STEPS[0]], ['handle', exports.SETUP_STEPS[0]],
|
|
29
|
+
['language', exports.SETUP_STEPS[1]], ['framework', exports.SETUP_STEPS[1]], ['ide', exports.SETUP_STEPS[1]],
|
|
30
|
+
['targetUsers', exports.SETUP_STEPS[2]], ['expectedScale', exports.SETUP_STEPS[3]], ['apiParadigm', exports.SETUP_STEPS[4]], ['constraints', exports.SETUP_STEPS[5]],
|
|
31
|
+
];
|
|
32
|
+
/** Question key → its step. */
|
|
33
|
+
exports.QUESTION_STEPS = Object.fromEntries(exports.CHAT_ORDER);
|
|
7
34
|
exports.SUPPORTED_LANGUAGES = ['typescript', 'javascript', 'python', 'kotlin', 'swift'];
|
|
8
35
|
exports.PROJECT_TYPE_MESSAGE = 'Is this a greenfield or brownfield project?';
|
|
9
36
|
exports.PROJECT_TYPE_CHOICES = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addSpecsQuestions.js","sourceRoot":"","sources":["../../src/utils/addSpecsQuestions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"addSpecsQuestions.js","sourceRoot":"","sources":["../../src/utils/addSpecsQuestions.ts"],"names":[],"mappings":";;;AA+EA,0CAqBC;AAjGD,mGAAmG;AACnG,gGAAgG;AAEhG,6GAA6G;AAChG,QAAA,WAAW,GAAG,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,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Q,EAAE,QAAQ,IAAI,SAAS;QAC/B,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const MAX_URL_LENGTH = 2048;
|
|
2
|
+
/** A clone that runs longer is killed, with its helpers. */
|
|
3
|
+
export declare const CLONE_TIMEOUT_MS: number;
|
|
4
|
+
/** Longest git message returned to the page. */
|
|
5
|
+
export declare const MAX_GIT_LINE = 300;
|
|
6
|
+
/** What is wrong with a repository URL, or null. Pure string checks: the URL is never parsed or rewritten. */
|
|
7
|
+
export declare function cloneUrlError(url: string): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* The folder `git clone` would make for a URL: its last path segment without `.git`. The rule lives in
|
|
10
|
+
* the page's `ui/route.js`, which fills the Folder name field with it, so there is one copy.
|
|
11
|
+
*/
|
|
12
|
+
export declare const repoNameFromUrl: (url: string) => string;
|
|
13
|
+
/** Shape of a clone body, checked before anything runs. Null when fine. */
|
|
14
|
+
export declare function cloneShapeError(body: unknown): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Is git there? And, on Windows only, where the child has a console ssh could ask in: has the user an
|
|
17
|
+
* ssh command of their own (`GIT_SSH_COMMAND`, `GIT_SSH`, `core.sshCommand`)? `batchSsh` says ssh may
|
|
18
|
+
* be put in batch mode without replacing one. On POSIX it is always false: the child has no terminal
|
|
19
|
+
* and no askpass, so ssh cannot ask, and the user's ssh setup is never touched. Run at the file-system
|
|
20
|
+
* root, so no repository's local configuration answers.
|
|
21
|
+
*/
|
|
22
|
+
export declare function probeGit(home: string, platform?: NodeJS.Platform): Promise<{
|
|
23
|
+
batchSsh: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
error: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* What the page shows of git's stderr, as one line: its last `fatal:` line with the line just before
|
|
29
|
+
* it, which over ssh is the one that says why (`Host key verification failed.`). `remote:` lines, text
|
|
30
|
+
* the remote host chooses, and git's own `Cloning into` line are never shown. Without a `fatal:` line,
|
|
31
|
+
* the last line left.
|
|
32
|
+
*/
|
|
33
|
+
export declare function gitErrorLine(stderr: string): string | null;
|
|
34
|
+
export interface CloneOptions {
|
|
35
|
+
/** Put ssh in batch mode (Windows only; `probeGit()` says when that replaces nothing of the user's). */
|
|
36
|
+
batchSsh?: boolean;
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
/** Aborting kills the clone: the page went away, or the server is closing. */
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
/** Tests only (a local bare repository needs `file`). The server never passes it and no request field maps to it. */
|
|
41
|
+
allowProtocols?: string;
|
|
42
|
+
}
|
|
43
|
+
export type CloneResult = {
|
|
44
|
+
ok: true;
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
aborted: boolean;
|
|
48
|
+
error: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* `git clone --no-recurse-submodules -- <url> <target>` in the target's parent, without a shell, with
|
|
52
|
+
* stdin closed and, on POSIX, in its own session (no controlling terminal; one process group to kill).
|
|
53
|
+
* `spawn` and not `execFile`, which cannot start a detached child; both take an argument array.
|
|
54
|
+
*/
|
|
55
|
+
export declare function cloneRepository(url: string, target: string, opts?: CloneOptions): Promise<CloneResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Remove what a clone put into `target`: only while it is still a real folder, every entry in it (links
|
|
58
|
+
* are removed, never followed), and the folder itself only when this request `created` it. The folder
|
|
59
|
+
* was empty when the clone started, so everything in it is the clone's. Resolves to an error code, or null.
|
|
60
|
+
*/
|
|
61
|
+
export declare function emptyTarget(target: string, created: boolean): Promise<string | null>;
|
|
62
|
+
//# sourceMappingURL=gitClone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitClone.d.ts","sourceRoot":"","sources":["../../src/utils/gitClone.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,CAAC,CA8C1G;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAW1F"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.repoNameFromUrl = exports.MAX_GIT_LINE = exports.CLONE_TIMEOUT_MS = exports.MAX_URL_LENGTH = void 0;
|
|
4
|
+
exports.cloneUrlError = cloneUrlError;
|
|
5
|
+
exports.cloneShapeError = cloneShapeError;
|
|
6
|
+
exports.probeGit = probeGit;
|
|
7
|
+
exports.gitErrorLine = gitErrorLine;
|
|
8
|
+
exports.cloneRepository = cloneRepository;
|
|
9
|
+
exports.emptyTarget = emptyTarget;
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const initQuestions_1 = require("./initQuestions");
|
|
14
|
+
const projectRegistry_1 = require("./projectRegistry");
|
|
15
|
+
// Clone a repository for `specpilot serve` (BL-PM-002, ARCH-003.23, SEC-004.15): the one module that
|
|
16
|
+
// starts a process for a request. git is the user's own, started without a shell; only the URL (after
|
|
17
|
+
// `--`) and the target folder reach its command line, and nothing it does can wait on a prompt.
|
|
18
|
+
exports.MAX_URL_LENGTH = 2048;
|
|
19
|
+
/** A clone that runs longer is killed, with its helpers. */
|
|
20
|
+
exports.CLONE_TIMEOUT_MS = 10 * 60 * 1000;
|
|
21
|
+
/** Longest git message returned to the page. */
|
|
22
|
+
exports.MAX_GIT_LINE = 300;
|
|
23
|
+
const HOST = '[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?';
|
|
24
|
+
const USER = '[A-Za-z0-9_][A-Za-z0-9._-]*';
|
|
25
|
+
const PORT = '(?::[0-9]{1,5})?';
|
|
26
|
+
const REPO_PATH = '(?!-)[A-Za-z0-9._~/+%-]+';
|
|
27
|
+
/** The only URLs cloned: https, ssh:// and user@host:path, each matched from the first character to the last. */
|
|
28
|
+
const URL_FORMS = [
|
|
29
|
+
new RegExp(`^https://${HOST}${PORT}/${REPO_PATH}$`),
|
|
30
|
+
new RegExp(`^ssh://(?:${USER}@)?${HOST}${PORT}/${REPO_PATH}$`),
|
|
31
|
+
new RegExp(`^${USER}@${HOST}:${REPO_PATH}$`),
|
|
32
|
+
];
|
|
33
|
+
// eslint-disable-next-line no-control-regex
|
|
34
|
+
const SPACE_OR_CONTROL = /[\s\u0000-\u0020\u007f-\u00a0\u2028\u2029]/;
|
|
35
|
+
// eslint-disable-next-line no-control-regex
|
|
36
|
+
const ANSI_AND_CONTROL = /\u001b\[[0-9;?]*[ -/]*[@-~]|[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g;
|
|
37
|
+
/** What is wrong with a repository URL, or null. Pure string checks: the URL is never parsed or rewritten. */
|
|
38
|
+
function cloneUrlError(url) {
|
|
39
|
+
if (!url.length || url.length > exports.MAX_URL_LENGTH)
|
|
40
|
+
return `url must be a string of 1 to ${exports.MAX_URL_LENGTH} characters.`;
|
|
41
|
+
if (SPACE_OR_CONTROL.test(url))
|
|
42
|
+
return 'The repository URL must not contain spaces or control characters.';
|
|
43
|
+
if (URL_FORMS.some(form => form.test(url)))
|
|
44
|
+
return null;
|
|
45
|
+
if (/^https:\/\/[^/]*@/.test(url))
|
|
46
|
+
return 'Remove the user name and password from the URL. git reads them from your credential helper.';
|
|
47
|
+
return 'Only https://host/path, git@host:path and ssh://host/path repository URLs can be cloned.';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The folder `git clone` would make for a URL: its last path segment without `.git`. The rule lives in
|
|
51
|
+
* the page's `ui/route.js`, which fills the Folder name field with it, so there is one copy.
|
|
52
|
+
*/
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
54
|
+
exports.repoNameFromUrl = require('../../ui/route.js').repoNameFromUrl;
|
|
55
|
+
const CLONE_KEYS = ['url', 'parent', 'name'];
|
|
56
|
+
/** Shape of a clone body, checked before anything runs. Null when fine. */
|
|
57
|
+
function cloneShapeError(body) {
|
|
58
|
+
const b = body;
|
|
59
|
+
if (!b || typeof b !== 'object' || Array.isArray(b))
|
|
60
|
+
return 'The request must be a JSON object with url, parent and name.';
|
|
61
|
+
for (const key of Object.keys(b))
|
|
62
|
+
if (!CLONE_KEYS.includes(key))
|
|
63
|
+
return `Unexpected field "${key}".`;
|
|
64
|
+
for (const key of CLONE_KEYS) {
|
|
65
|
+
if (!(key in b))
|
|
66
|
+
return `"${key}" is missing.`;
|
|
67
|
+
if (typeof b[key] !== 'string')
|
|
68
|
+
return `"${key}" must be a string.`;
|
|
69
|
+
}
|
|
70
|
+
const s = b;
|
|
71
|
+
const parentProblem = (0, projectRegistry_1.pathShapeError)({ path: s.parent });
|
|
72
|
+
if (parentProblem)
|
|
73
|
+
return parentProblem.replace('"path"', '"parent"');
|
|
74
|
+
const urlProblem = cloneUrlError(s.url);
|
|
75
|
+
if (urlProblem)
|
|
76
|
+
return urlProblem;
|
|
77
|
+
if (s.name) {
|
|
78
|
+
const nameProblem = (0, initQuestions_1.projectNameError)(s.name);
|
|
79
|
+
if (nameProblem)
|
|
80
|
+
return `${nameProblem.message}.`;
|
|
81
|
+
}
|
|
82
|
+
else if ((0, initQuestions_1.projectNameError)((0, exports.repoNameFromUrl)(s.url)))
|
|
83
|
+
return 'Type a folder name. One could not be taken from this URL.';
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
/** The server's environment plus what keeps git to https and ssh and stops it asking anything. */
|
|
87
|
+
function gitEnv(allowProtocols) {
|
|
88
|
+
const env = { ...process.env, GIT_ALLOW_PROTOCOL: allowProtocols, GIT_TERMINAL_PROMPT: '0', GIT_ASKPASS: '', SSH_ASKPASS_REQUIRE: 'never', GCM_INTERACTIVE: 'never' };
|
|
89
|
+
// These two would point git at another repository or work tree than the target.
|
|
90
|
+
delete env.GIT_DIR;
|
|
91
|
+
delete env.GIT_WORK_TREE;
|
|
92
|
+
// English messages, because `fatal:` and `Cloning into` are matched (gitErrorLine()). Only the message
|
|
93
|
+
// language changes: an LC_ALL, which would override LC_MESSAGES, is kept as LC_CTYPE, so file names
|
|
94
|
+
// are handled as before.
|
|
95
|
+
if (env.LC_ALL) {
|
|
96
|
+
env.LC_CTYPE = env.LC_ALL;
|
|
97
|
+
delete env.LC_ALL;
|
|
98
|
+
}
|
|
99
|
+
delete env.LANGUAGE;
|
|
100
|
+
env.LC_MESSAGES = 'C';
|
|
101
|
+
return env;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Is git there? And, on Windows only, where the child has a console ssh could ask in: has the user an
|
|
105
|
+
* ssh command of their own (`GIT_SSH_COMMAND`, `GIT_SSH`, `core.sshCommand`)? `batchSsh` says ssh may
|
|
106
|
+
* be put in batch mode without replacing one. On POSIX it is always false: the child has no terminal
|
|
107
|
+
* and no askpass, so ssh cannot ask, and the user's ssh setup is never touched. Run at the file-system
|
|
108
|
+
* root, so no repository's local configuration answers.
|
|
109
|
+
*/
|
|
110
|
+
function probeGit(home, platform = process.platform) {
|
|
111
|
+
return new Promise(done => {
|
|
112
|
+
const child = (0, child_process_1.execFile)('git', ['config', '--get', 'core.sshCommand'], { cwd: (0, path_1.parse)(home).root, env: gitEnv('https:ssh'), windowsHide: true }, (err, stdout) => {
|
|
113
|
+
const code = err ? err.code : 0;
|
|
114
|
+
if (code === 'ENOENT')
|
|
115
|
+
return done({ error: 'git is not installed.' });
|
|
116
|
+
if (code !== 0 && code !== 1)
|
|
117
|
+
return done({ error: `git could not be run (${code}).` }); // 1 = not set
|
|
118
|
+
done({ batchSsh: platform === 'win32' && !stdout.trim() && !process.env.GIT_SSH_COMMAND && !process.env.GIT_SSH });
|
|
119
|
+
});
|
|
120
|
+
child.stdin?.end();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* What the page shows of git's stderr, as one line: its last `fatal:` line with the line just before
|
|
125
|
+
* it, which over ssh is the one that says why (`Host key verification failed.`). `remote:` lines, text
|
|
126
|
+
* the remote host chooses, and git's own `Cloning into` line are never shown. Without a `fatal:` line,
|
|
127
|
+
* the last line left.
|
|
128
|
+
*/
|
|
129
|
+
function gitErrorLine(stderr) {
|
|
130
|
+
const lines = stderr.split(/\r?\n|\r/).map(line => line.replace(ANSI_AND_CONTROL, '').trim()).filter(l => l && !l.startsWith('remote:') && !l.startsWith('Cloning into '));
|
|
131
|
+
if (!lines.length)
|
|
132
|
+
return null;
|
|
133
|
+
const fatal = lines.map(l => l.startsWith('fatal:')).lastIndexOf(true);
|
|
134
|
+
if (fatal <= 0)
|
|
135
|
+
return lines[fatal < 0 ? lines.length - 1 : 0].slice(0, exports.MAX_GIT_LINE);
|
|
136
|
+
const last = lines[fatal].slice(0, exports.MAX_GIT_LINE);
|
|
137
|
+
const room = exports.MAX_GIT_LINE - last.length - 1; // the fatal: line is never pushed out by a long line before it
|
|
138
|
+
return room > 0 ? `${lines[fatal - 1].slice(0, room)} ${last}` : last;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* `git clone --no-recurse-submodules -- <url> <target>` in the target's parent, without a shell, with
|
|
142
|
+
* stdin closed and, on POSIX, in its own session (no controlling terminal; one process group to kill).
|
|
143
|
+
* `spawn` and not `execFile`, which cannot start a detached child; both take an argument array.
|
|
144
|
+
*/
|
|
145
|
+
function cloneRepository(url, target, opts = {}) {
|
|
146
|
+
return new Promise(done => {
|
|
147
|
+
if (opts.signal?.aborted)
|
|
148
|
+
return done({ ok: false, aborted: true, error: '' });
|
|
149
|
+
const posix = process.platform !== 'win32';
|
|
150
|
+
const env = gitEnv(opts.allowProtocols ?? 'https:ssh');
|
|
151
|
+
if (opts.batchSsh)
|
|
152
|
+
env.GIT_SSH_COMMAND = 'ssh -oBatchMode=yes';
|
|
153
|
+
const child = (0, child_process_1.spawn)('git', ['clone', '--no-recurse-submodules', '--', url, target], {
|
|
154
|
+
cwd: (0, path_1.dirname)(target), env, stdio: ['ignore', 'ignore', 'pipe'], detached: posix, windowsHide: true,
|
|
155
|
+
});
|
|
156
|
+
let stderr = '';
|
|
157
|
+
let stopped = null;
|
|
158
|
+
const kill = (why) => {
|
|
159
|
+
stopped = stopped ?? why;
|
|
160
|
+
try {
|
|
161
|
+
if (posix && child.pid)
|
|
162
|
+
process.kill(-child.pid, 'SIGKILL'); // the group: git-remote-https and ssh go too
|
|
163
|
+
else
|
|
164
|
+
child.kill('SIGKILL');
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
/* already gone */
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const onAbort = () => kill('aborted');
|
|
171
|
+
const timer = setTimeout(() => kill('limit'), opts.timeoutMs ?? exports.CLONE_TIMEOUT_MS);
|
|
172
|
+
opts.signal?.addEventListener('abort', onAbort);
|
|
173
|
+
let finished = false;
|
|
174
|
+
const finish = (result) => {
|
|
175
|
+
if (finished)
|
|
176
|
+
return;
|
|
177
|
+
finished = true;
|
|
178
|
+
clearTimeout(timer);
|
|
179
|
+
opts.signal?.removeEventListener('abort', onAbort);
|
|
180
|
+
done(result);
|
|
181
|
+
};
|
|
182
|
+
child.stderr.on('data', (chunk) => {
|
|
183
|
+
stderr = (stderr + chunk.toString('utf-8')).slice(-65536);
|
|
184
|
+
});
|
|
185
|
+
child.on('error', err => {
|
|
186
|
+
const code = err.code;
|
|
187
|
+
finish({ ok: false, aborted: false, error: code === 'ENOENT' ? 'git is not installed.' : `git could not be run (${code}).` });
|
|
188
|
+
});
|
|
189
|
+
child.on('close', (code, signal) => {
|
|
190
|
+
if (stopped === 'aborted')
|
|
191
|
+
return finish({ ok: false, aborted: true, error: '' });
|
|
192
|
+
if (stopped === 'limit')
|
|
193
|
+
return finish({ ok: false, aborted: false, error: `The clone was stopped after ${exports.CLONE_TIMEOUT_MS / 60000} minutes. What it had downloaded was removed.` });
|
|
194
|
+
if (code === 0)
|
|
195
|
+
return finish({ ok: true });
|
|
196
|
+
const line = gitErrorLine(stderr);
|
|
197
|
+
finish({ ok: false, aborted: false, error: line ? `git clone failed: ${line}` : `git clone failed (exit code ${code ?? signal}).` });
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Remove what a clone put into `target`: only while it is still a real folder, every entry in it (links
|
|
203
|
+
* are removed, never followed), and the folder itself only when this request `created` it. The folder
|
|
204
|
+
* was empty when the clone started, so everything in it is the clone's. Resolves to an error code, or null.
|
|
205
|
+
*/
|
|
206
|
+
async function emptyTarget(target, created) {
|
|
207
|
+
try {
|
|
208
|
+
if (!(await fs_1.promises.lstat(target)).isDirectory())
|
|
209
|
+
return null;
|
|
210
|
+
// Asynchronous, so a stop signal's time limit can end the wait for a large tree (serve.ts).
|
|
211
|
+
for (const entry of await fs_1.promises.readdir(target))
|
|
212
|
+
await fs_1.promises.rm((0, path_1.join)(target, entry), { recursive: true, force: true });
|
|
213
|
+
if (created)
|
|
214
|
+
await fs_1.promises.rmdir(target);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
const code = err.code;
|
|
219
|
+
return code === 'ENOENT' ? null : (code ?? 'error');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=gitClone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitClone.js","sourceRoot":"","sources":["../../src/utils/gitClone.ts"],"names":[],"mappings":";;;AAgCA,sCAMC;AAYD,0CAkBC;AA2BD,4BAUC;AAQD,oCAQC;AAmBD,0CA8CC;AAOD,kCAWC;AA5MD,iDAAgD;AAChD,2BAAoC;AACpC,+BAA4C;AAC5C,mDAAmD;AACnD,uDAAmD;AAEnD,qGAAqG;AACrG,sGAAsG;AACtG,gGAAgG;AAEnF,QAAA,cAAc,GAAG,IAAI,CAAC;AACnC,4DAA4D;AA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,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,OAAgB;IAChE,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,MAAM,aAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE;YAAE,OAAO,IAAI,CAAC;QACzD,4FAA4F;QAC5F,KAAK,MAAM,KAAK,IAAI,MAAM,aAAE,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,aAAE,CAAC,EAAE,CAAC,IAAA,WAAI,EAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjH,IAAI,OAAO;YAAE,MAAM,aAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;QACjD,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -1,45 +1,21 @@
|
|
|
1
|
-
import { TemplateContext } from '
|
|
2
|
-
|
|
1
|
+
import { TemplateContext } from '../core/templateEngine';
|
|
2
|
+
import { GITATTRIBUTES_FILE } from '../core/ideConfig';
|
|
3
|
+
export { GITATTRIBUTES_FILE };
|
|
3
4
|
/**
|
|
4
5
|
* Create `path` with `content` only if nothing is there (BL-073): an existing file, or a link at the
|
|
5
6
|
* path itself, is never written or written through. Returns false when it was kept (EEXIST).
|
|
6
7
|
*/
|
|
7
8
|
export declare function writeNew(path: string, content: string): boolean;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* plus per-IDE overlay keys.
|
|
10
|
+
* The Node side of the IDE files (BL-032): what `specpilot backfill` creates and what the writer
|
|
11
|
+
* merges. The content of every IDE file is in `src/core/ideConfig.ts`.
|
|
12
12
|
*/
|
|
13
13
|
export declare class IdeConfigGenerator {
|
|
14
|
-
/** Entry point — routes to the correct IDE settings generator. Returns the kept (existing) files. */
|
|
15
|
-
generate(projectDir: string, context: TemplateContext, ide: string): Promise<string[]>;
|
|
16
|
-
/** The files `generate()` writes, project-relative (BL-055); read from the same table as the writes. */
|
|
17
|
-
settingsTargets(ide: string): string[];
|
|
18
|
-
/** The file `generateAiContextFile()` writes, project-relative (BL-055). */
|
|
19
|
-
aiContextTarget(ide: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Routes to the correct IDE-native AI context file based on the selected IDE.
|
|
22
|
-
* - vscode / codex → .github/copilot-instructions.md
|
|
23
|
-
* - cursor → .cursor/rules/specpilot.mdc
|
|
24
|
-
* - windsurf → .windsurfrules
|
|
25
|
-
* - antigravity → .antigravity/rules.md
|
|
26
|
-
* - claude-code → CLAUDE.md
|
|
27
|
-
* An existing file is kept (BL-073); returns it as kept, else [].
|
|
28
|
-
*/
|
|
29
|
-
generateAiContextFile(projectDir: string, context: TemplateContext, ide: string): string[];
|
|
30
|
-
private buildClaudeMd;
|
|
31
14
|
/**
|
|
32
15
|
* Generates .github/copilot-instructions.md with critical mandates (`specpilot backfill`, when it is
|
|
33
16
|
* missing). Read automatically by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
34
17
|
*/
|
|
35
18
|
generateCopilotInstructions(projectDir: string, context: TemplateContext): void;
|
|
36
|
-
private buildCopilotInstructions;
|
|
37
|
-
private buildCriticalMandatesMarkdown;
|
|
38
|
-
private buildContextRoutingTable;
|
|
39
|
-
private buildProcessMandatesMarkdown;
|
|
40
|
-
private buildCodePhilosophyMarkdown;
|
|
41
|
-
private generateIDESettings;
|
|
42
|
-
private buildSettingsJson;
|
|
43
19
|
/**
|
|
44
20
|
* Generates (or updates) .gitattributes at project root with merge=union rules
|
|
45
21
|
* for append-heavy spec files, preventing git merge conflicts on shared branches.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ideConfigGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/ideConfigGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ideConfigGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/ideConfigGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAuD,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAEjI,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAK9B;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B;;;OAGG;IACH,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAM/E;;;;OAIG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAgBlD"}
|