specpilot 2.9.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/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 +1 -3
- 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/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} +207 -136
- 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/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/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 +11 -46
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +30 -63
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/specSetup.d.ts.map +1 -1
- package/dist/utils/specSetup.js +3 -4
- package/dist/utils/specSetup.js.map +1 -1
- package/package.json +1 -1
- 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 -30
- 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,eAAe,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU;IACvH,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc;IACzH,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,eAAe,EAAE,uBAAuB;IAChI,iBAAiB;CAClB,CAAC;AAuBF,sGAAsG;AACtG,SAAgB,OAAO,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9E,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED,kGAAkG;AAClG,kGAAkG;AAClG,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAyHM,CAAC;IAC/B,CAAC;CACF;AAjXD,wCAiXC"}
|
|
@@ -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"}
|
|
@@ -4,47 +4,8 @@ exports.IdeConfigGenerator = exports.GITATTRIBUTES_FILE = void 0;
|
|
|
4
4
|
exports.writeNew = writeNew;
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* official documentation. Unknown keys are silently ignored, but they are
|
|
10
|
-
* included here as hints for IDEs that may adopt spec-aware settings in future.
|
|
11
|
-
* Remove any keys that cause warnings in your specific IDE version.
|
|
12
|
-
*/
|
|
13
|
-
const IDE_OVERRIDES = {
|
|
14
|
-
cursor: {
|
|
15
|
-
// ASPIRATIONAL — not in official Cursor docs
|
|
16
|
-
'cursor.aiAccess': true,
|
|
17
|
-
'cursor.enableAIContext': true,
|
|
18
|
-
},
|
|
19
|
-
windsurf: {
|
|
20
|
-
// ASPIRATIONAL — not in official Windsurf docs
|
|
21
|
-
'windsurf.aiContext.enabled': true,
|
|
22
|
-
'windsurf.specs.integration': true,
|
|
23
|
-
'windsurf.codeCompletion.contextAware': true,
|
|
24
|
-
},
|
|
25
|
-
antigravity: {
|
|
26
|
-
// ASPIRATIONAL — not in official Antigravity docs
|
|
27
|
-
'antigravity.ai.enabled': true,
|
|
28
|
-
'antigravity.contextual': true,
|
|
29
|
-
'antigravity.specs.integration': true,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
/** IDE directory names used for settings files. */
|
|
33
|
-
const IDE_DIRS = {
|
|
34
|
-
vscode: '.vscode',
|
|
35
|
-
cursor: '.cursor',
|
|
36
|
-
windsurf: '.windsurf',
|
|
37
|
-
antigravity: '.antigravity',
|
|
38
|
-
};
|
|
39
|
-
/** The IDE-native AI context file per IDE; anything else gets copilot-instructions.md (ARCH-004.11). */
|
|
40
|
-
const AI_CONTEXT_FILES = {
|
|
41
|
-
cursor: '.cursor/rules/specpilot.mdc',
|
|
42
|
-
windsurf: '.windsurfrules',
|
|
43
|
-
antigravity: '.antigravity/rules.md',
|
|
44
|
-
'claude-code': 'CLAUDE.md',
|
|
45
|
-
};
|
|
46
|
-
const COPILOT_INSTRUCTIONS = '.github/copilot-instructions.md';
|
|
47
|
-
exports.GITATTRIBUTES_FILE = '.gitattributes';
|
|
7
|
+
const ideConfig_1 = require("../core/ideConfig");
|
|
8
|
+
Object.defineProperty(exports, "GITATTRIBUTES_FILE", { enumerable: true, get: function () { return ideConfig_1.GITATTRIBUTES_FILE; } });
|
|
48
9
|
/** Project-relative path of a project file, joined for this platform. */
|
|
49
10
|
const at = (projectDir, rel) => (0, path_1.join)(projectDir, ...rel.split('/'));
|
|
50
11
|
/**
|
|
@@ -63,247 +24,18 @@ function writeNew(path, content) {
|
|
|
63
24
|
}
|
|
64
25
|
}
|
|
65
26
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* plus per-IDE overlay keys.
|
|
27
|
+
* The Node side of the IDE files (BL-032): what `specpilot backfill` creates and what the writer
|
|
28
|
+
* merges. The content of every IDE file is in `src/core/ideConfig.ts`.
|
|
69
29
|
*/
|
|
70
30
|
class IdeConfigGenerator {
|
|
71
|
-
/** Entry point — routes to the correct IDE settings generator. Returns the kept (existing) files. */
|
|
72
|
-
async generate(projectDir, context, ide) {
|
|
73
|
-
return this.generateIDESettings(projectDir, context, ide);
|
|
74
|
-
}
|
|
75
|
-
/** The files `generate()` writes, project-relative (BL-055); read from the same table as the writes. */
|
|
76
|
-
settingsTargets(ide) {
|
|
77
|
-
const dir = IDE_DIRS[ide.toLowerCase()] ?? '.vscode';
|
|
78
|
-
return [`${dir}/settings.json`, `${dir}/extensions.json`];
|
|
79
|
-
}
|
|
80
|
-
/** The file `generateAiContextFile()` writes, project-relative (BL-055). */
|
|
81
|
-
aiContextTarget(ide) {
|
|
82
|
-
return AI_CONTEXT_FILES[ide.toLowerCase()] ?? COPILOT_INSTRUCTIONS;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Routes to the correct IDE-native AI context file based on the selected IDE.
|
|
86
|
-
* - vscode / codex → .github/copilot-instructions.md
|
|
87
|
-
* - cursor → .cursor/rules/specpilot.mdc
|
|
88
|
-
* - windsurf → .windsurfrules
|
|
89
|
-
* - antigravity → .antigravity/rules.md
|
|
90
|
-
* - claude-code → CLAUDE.md
|
|
91
|
-
* An existing file is kept (BL-073); returns it as kept, else [].
|
|
92
|
-
*/
|
|
93
|
-
generateAiContextFile(projectDir, context, ide) {
|
|
94
|
-
const key = ide.toLowerCase();
|
|
95
|
-
const rel = this.aiContextTarget(key);
|
|
96
|
-
const filePath = at(projectDir, rel);
|
|
97
|
-
(0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
|
|
98
|
-
const content = key === 'claude-code'
|
|
99
|
-
? this.buildClaudeMd(context)
|
|
100
|
-
: key === 'cursor'
|
|
101
|
-
? `---\ndescription: Project mandates and AI coding rules\nglobs:\nalwaysApply: true\n---\n\n` + this.buildCopilotInstructions(context)
|
|
102
|
-
: this.buildCopilotInstructions(context);
|
|
103
|
-
return writeNew(filePath, content) ? [] : [rel];
|
|
104
|
-
}
|
|
105
|
-
buildClaudeMd(context) {
|
|
106
|
-
const stack = context.framework
|
|
107
|
-
? `${context.language} / ${context.framework}`
|
|
108
|
-
: context.language;
|
|
109
|
-
return `# CLAUDE.md \u2014 ${context.projectName}
|
|
110
|
-
|
|
111
|
-
> This file is the primary instructions file for Claude Code.
|
|
112
|
-
> Keep it lean \u2014 use it as a router to your \`.specs/\` files, not a dumping ground.
|
|
113
|
-
> Full project context is in \`.specs/project/project.yaml\`.
|
|
114
|
-
|
|
115
|
-
## Project
|
|
116
|
-
|
|
117
|
-
- **Name:** ${context.projectName}
|
|
118
|
-
- **Stack:** ${stack}
|
|
119
|
-
- **Specs location:** \`.specs/\`
|
|
120
|
-
|
|
121
|
-
## \ud83d\udd34 Critical Mandates \u2014 Never violate, no exceptions
|
|
122
|
-
|
|
123
|
-
${this.buildCriticalMandatesMarkdown()}
|
|
124
|
-
|
|
125
|
-
## \ud83d\udfe1 Process Mandates
|
|
126
|
-
|
|
127
|
-
${this.buildProcessMandatesMarkdown()}
|
|
128
|
-
|
|
129
|
-
${this.buildContextRoutingTable()}
|
|
130
|
-
|
|
131
|
-
${this.buildCodePhilosophyMarkdown()}
|
|
132
|
-
|
|
133
|
-
## Re-Anchor
|
|
134
|
-
|
|
135
|
-
If you lose context mid-session, read \`.specs/project/project.yaml\` to restore full project context.
|
|
136
|
-
For a ready-made re-anchor prompt, see \`.specs/development/prompts.md \u2192 ## Re-Anchor Prompt\`.
|
|
137
|
-
`;
|
|
138
|
-
}
|
|
139
31
|
/**
|
|
140
32
|
* Generates .github/copilot-instructions.md with critical mandates (`specpilot backfill`, when it is
|
|
141
33
|
* missing). Read automatically by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
142
34
|
*/
|
|
143
35
|
generateCopilotInstructions(projectDir, context) {
|
|
144
|
-
const filePath = at(projectDir,
|
|
36
|
+
const filePath = at(projectDir, ideConfig_1.COPILOT_INSTRUCTIONS_FILE);
|
|
145
37
|
(0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
|
|
146
|
-
writeNew(filePath,
|
|
147
|
-
}
|
|
148
|
-
buildCopilotInstructions(context) {
|
|
149
|
-
const stack = context.framework
|
|
150
|
-
? `${context.language} / ${context.framework}`
|
|
151
|
-
: context.language;
|
|
152
|
-
return `# AI Coding Instructions — ${context.projectName}
|
|
153
|
-
|
|
154
|
-
> This file is automatically read by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
155
|
-
> Keep this file short — only critical mandates. Full context is in \`.specs/project/project.yaml\`.
|
|
156
|
-
|
|
157
|
-
## Project
|
|
158
|
-
|
|
159
|
-
- **Name:** ${context.projectName}
|
|
160
|
-
- **Stack:** ${stack}
|
|
161
|
-
- **Specs location:** \`.specs/\`
|
|
162
|
-
|
|
163
|
-
## 🔴 Critical Mandates — Never violate, no exceptions
|
|
164
|
-
|
|
165
|
-
${this.buildCriticalMandatesMarkdown()}
|
|
166
|
-
|
|
167
|
-
## 🟡 Process Mandates
|
|
168
|
-
|
|
169
|
-
${this.buildProcessMandatesMarkdown()}
|
|
170
|
-
|
|
171
|
-
${this.buildContextRoutingTable()}
|
|
172
|
-
|
|
173
|
-
${this.buildCodePhilosophyMarkdown()}
|
|
174
|
-
|
|
175
|
-
## Re-Anchor
|
|
176
|
-
|
|
177
|
-
If you lose context mid-session, read \`.specs/project/project.yaml\` to restore full project context.\nFor a ready-made re-anchor prompt, see \`.specs/development/prompts.md → ## Re-Anchor Prompt\`.
|
|
178
|
-
`;
|
|
179
|
-
}
|
|
180
|
-
buildCriticalMandatesMarkdown() {
|
|
181
|
-
return `1. No commit unless asked.
|
|
182
|
-
2. No push unless asked.
|
|
183
|
-
3. No deploy/publish/release unless asked.
|
|
184
|
-
4. No \`.specs/\` structure changes — content only.
|
|
185
|
-
5. Update specs after change:
|
|
186
|
-
- Trivial → \`planning/tasks.md\`
|
|
187
|
-
- Feature → \`project/requirements.md\` + \`planning/tasks.md\`
|
|
188
|
-
- Architectural → all affected files + \`CHANGELOG.md\`
|
|
189
|
-
6. Never reference file contents without reading first. If unread, say so.
|
|
190
|
-
7. Never write code or change files unless asked. Ask first.
|
|
191
|
-
8. Spec-first gate (scale to task size):
|
|
192
|
-
- Trivial → no gate
|
|
193
|
-
- Feature → read 1–2 relevant \`.specs/\` files before coding
|
|
194
|
-
- Architectural → update all affected specs, present Spec Report, wait for \`yes, proceed\``;
|
|
195
|
-
}
|
|
196
|
-
buildContextRoutingTable() {
|
|
197
|
-
return `## Context — read on demand by task type
|
|
198
|
-
|
|
199
|
-
| Task type | Read |
|
|
200
|
-
|---|---|
|
|
201
|
-
| Session start | \`.specs/project/project.yaml\` |
|
|
202
|
-
| Feature / bug | + \`project/requirements.md\`, \`planning/tasks.md\` |
|
|
203
|
-
| Architecture | + \`architecture/architecture.md\` |
|
|
204
|
-
| Tests | + \`quality/tests.md\` |
|
|
205
|
-
| Security | + \`security/threat-model.md\`, \`security/security-decisions.md\` |
|
|
206
|
-
| Planning | + \`planning/tasks.md\`, \`planning/roadmap.md\` |`;
|
|
207
|
-
}
|
|
208
|
-
buildProcessMandatesMarkdown() {
|
|
209
|
-
return `- **Spec-First:** Update \`.specs/\` before writing code.
|
|
210
|
-
- **Log all AI interactions** in \`.specs/development/prompts.md\` with timestamps.
|
|
211
|
-
- **Document decisions** in \`.specs/development/context.md\`.`;
|
|
212
|
-
}
|
|
213
|
-
buildCodePhilosophyMarkdown() {
|
|
214
|
-
return `## Code Philosophy — Write Only What Needed
|
|
215
|
-
|
|
216
|
-
1. Need exist? No → skip. Say why.
|
|
217
|
-
2. Already in codebase? → reuse. Not rewrite.
|
|
218
|
-
3. Stdlib do it? → use it.
|
|
219
|
-
4. Native or installed dep cover it? → use. No new deps.
|
|
220
|
-
5. One line do it? → write that.
|
|
221
|
-
6. Only then: minimum code that work.
|
|
222
|
-
7. Never cut: validation, error handling, security, explicit requirement.
|
|
223
|
-
|
|
224
|
-
## Code Rules
|
|
225
|
-
|
|
226
|
-
1. No abstraction, interface, factory, or pattern unless asked.
|
|
227
|
-
2. No scaffold "for later". Later scaffold itself.
|
|
228
|
-
3. Delete before add.
|
|
229
|
-
4. Shortest correct diff win.
|
|
230
|
-
5. Fix cause, not symptom. One guard in shared function beat guard in every caller.
|
|
231
|
-
6. Boring over clever. Clever = 3am bug.
|
|
232
|
-
7. Read before write. Never reference code you haven't read.`;
|
|
233
|
-
}
|
|
234
|
-
async generateIDESettings(projectDir, context, ide) {
|
|
235
|
-
const key = ide.toLowerCase();
|
|
236
|
-
const overrides = IDE_OVERRIDES[key] ?? {};
|
|
237
|
-
const [settingsRel, extensionsRel] = this.settingsTargets(key);
|
|
238
|
-
(0, fs_1.mkdirSync)((0, path_1.dirname)(at(projectDir, settingsRel)), { recursive: true });
|
|
239
|
-
const kept = [];
|
|
240
|
-
const settingsWithComment = this.buildSettingsJson(ide, context, overrides);
|
|
241
|
-
if (!writeNew(at(projectDir, settingsRel), settingsWithComment))
|
|
242
|
-
kept.push(settingsRel);
|
|
243
|
-
const extensions = {
|
|
244
|
-
recommendations: [
|
|
245
|
-
'esbenp.prettier-vscode',
|
|
246
|
-
'redhat.vscode-yaml',
|
|
247
|
-
'github.copilot',
|
|
248
|
-
'ms-vscode.vscode-typescript-next',
|
|
249
|
-
],
|
|
250
|
-
unwantedRecommendations: [],
|
|
251
|
-
};
|
|
252
|
-
if (!writeNew(at(projectDir, extensionsRel), JSON.stringify(extensions, null, 2)))
|
|
253
|
-
kept.push(extensionsRel);
|
|
254
|
-
return kept;
|
|
255
|
-
}
|
|
256
|
-
buildSettingsJson(ide, context, overrides) {
|
|
257
|
-
const displayName = ide === 'vscode' ? 'VS Code' : ide.charAt(0).toUpperCase() + ide.slice(1);
|
|
258
|
-
const noteComment = ide === 'vscode'
|
|
259
|
-
? '// Copy the "First-Use Onboarding Prompt" and paste into your AI agent to populate specs'
|
|
260
|
-
: `// Copy the "First-Use Onboarding Prompt" and paste into ${displayName}'s AI chat to populate specs`;
|
|
261
|
-
// Build override lines
|
|
262
|
-
const overrideLines = Object.entries(overrides)
|
|
263
|
-
.map(([k, v]) => ` "${k}": ${JSON.stringify(v)},`)
|
|
264
|
-
.join('\n');
|
|
265
|
-
const overrideBlock = overrideLines
|
|
266
|
-
? `\n // ${displayName}-specific AI settings (ASPIRATIONAL — not confirmed in official docs; unknown keys are silently ignored)\n${overrideLines}\n`
|
|
267
|
-
: '';
|
|
268
|
-
return `{
|
|
269
|
-
// SpecPilot AI IDE Configuration${ide !== 'vscode' ? ` for ${displayName}` : ''}
|
|
270
|
-
// This file configures ${displayName} to work effectively with SpecPilot specs
|
|
271
|
-
|
|
272
|
-
// AI CONTEXT: The recommended way to give AI agents access to your .specs files
|
|
273
|
-
// is via .github/copilot-instructions.md (VS Code Copilot) or your IDE's equivalent
|
|
274
|
-
// custom instructions file. See .specs/development/prompts.md for guidelines.
|
|
275
|
-
${noteComment}
|
|
276
|
-
|
|
277
|
-
// Ensure .specs folder is included in workspace search (not excluded)
|
|
278
|
-
"search.exclude": {
|
|
279
|
-
"**/.specs/*": false
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
// Markdown formatting for spec files
|
|
283
|
-
"[markdown]": {
|
|
284
|
-
"editor.wordWrap": "on",
|
|
285
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
286
|
-
},
|
|
287
|
-
|
|
288
|
-
// YAML formatting for spec files (project.yaml, api.yaml)
|
|
289
|
-
"[yaml]": {
|
|
290
|
-
"editor.insertSpaces": true,
|
|
291
|
-
"editor.tabSize": 2
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
// YAML validation (requires redhat.vscode-yaml extension)
|
|
295
|
-
"yaml.validate": true,
|
|
296
|
-
"yaml.schemas": {
|
|
297
|
-
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.{yml,yaml}"
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
// General file exclusions
|
|
301
|
-
"files.exclude": {
|
|
302
|
-
"**/.git": true,
|
|
303
|
-
"**/node_modules": true,
|
|
304
|
-
"**/__pycache__": true
|
|
305
|
-
}${overrideBlock}
|
|
306
|
-
}`;
|
|
38
|
+
writeNew(filePath, (0, ideConfig_1.buildCopilotInstructions)(context));
|
|
307
39
|
}
|
|
308
40
|
/**
|
|
309
41
|
* Generates (or updates) .gitattributes at project root with merge=union rules
|
|
@@ -311,18 +43,13 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
311
43
|
* If the file already exists, only missing lines are appended. Returns how many were appended.
|
|
312
44
|
*/
|
|
313
45
|
generateGitAttributes(projectDir) {
|
|
314
|
-
const
|
|
315
|
-
'.specs/development/prompts*.md merge=union',
|
|
316
|
-
'.specs/planning/tasks.md merge=union',
|
|
317
|
-
'CHANGELOG.md merge=union',
|
|
318
|
-
];
|
|
319
|
-
const filePath = (0, path_1.join)(projectDir, exports.GITATTRIBUTES_FILE);
|
|
46
|
+
const filePath = (0, path_1.join)(projectDir, ideConfig_1.GITATTRIBUTES_FILE);
|
|
320
47
|
if (!(0, fs_1.existsSync)(filePath)) {
|
|
321
|
-
(0, fs_1.writeFileSync)(filePath, GITATTRIBUTES_LINES.join('\n') + '\n');
|
|
48
|
+
(0, fs_1.writeFileSync)(filePath, ideConfig_1.GITATTRIBUTES_LINES.join('\n') + '\n');
|
|
322
49
|
return 0;
|
|
323
50
|
}
|
|
324
51
|
const existing = (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
325
|
-
const missing = GITATTRIBUTES_LINES.filter(line => !existing.includes(line));
|
|
52
|
+
const missing = ideConfig_1.GITATTRIBUTES_LINES.filter(line => !existing.includes(line));
|
|
326
53
|
if (missing.length > 0) {
|
|
327
54
|
const suffix = existing.endsWith('\n') ? '' : '\n';
|
|
328
55
|
(0, fs_1.appendFileSync)(filePath, suffix + missing.join('\n') + '\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ideConfigGenerator.js","sourceRoot":"","sources":["../../src/utils/ideConfigGenerator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ideConfigGenerator.js","sourceRoot":"","sources":["../../src/utils/ideConfigGenerator.ts"],"names":[],"mappings":";;;AAcA,4BAQC;AAtBD,+BAAqC;AACrC,2BAAwF;AAExF,iDAAiI;AAExH,mGAFqD,8BAAkB,OAErD;AAE3B,yEAAyE;AACzE,MAAM,EAAE,GAAG,CAAC,UAAkB,EAAE,GAAW,EAAE,EAAE,CAAC,IAAA,WAAI,EAAC,UAAU,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpF;;;GAGG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAe;IACpD,IAAI,CAAC;QACH,IAAA,kBAAa,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;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,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;CACF;AAhCD,gDAgCC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
description: string;
|
|
5
|
-
body: string;
|
|
6
|
-
argumentHint?: string;
|
|
7
|
-
allowedTools?: string[];
|
|
8
|
-
}
|
|
1
|
+
import { SlashCommand, SLASH_COMMANDS } from '../core/slashCommands';
|
|
2
|
+
export { SLASH_COMMANDS };
|
|
3
|
+
export type { SlashCommand };
|
|
9
4
|
/** A command file `refreshCommands()` left as it was, and why. */
|
|
10
5
|
export interface KeptCommand {
|
|
11
6
|
name: string;
|
|
@@ -18,11 +13,6 @@ export interface CommandRefresh {
|
|
|
18
13
|
updated: string[];
|
|
19
14
|
kept: KeptCommand[];
|
|
20
15
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Commands to generate. Populated one command at a time by CS-080 through
|
|
23
|
-
* CS-087.
|
|
24
|
-
*/
|
|
25
|
-
export declare const SLASH_COMMANDS: SlashCommand[];
|
|
26
16
|
/**
|
|
27
17
|
* SHA-256 of every command file a released SpecPilot generated, per target path, oldest first.
|
|
28
18
|
* v2.2.0 was the first release to write command files. `refreshCommands()` replaces a file only when
|
|
@@ -56,10 +46,6 @@ export declare class SlashCommandGenerator {
|
|
|
56
46
|
* Returns false, writing nothing, if the file no longer holds `before` (an editor saved meanwhile).
|
|
57
47
|
*/
|
|
58
48
|
private replace;
|
|
59
|
-
private resolveTarget;
|
|
60
49
|
private write;
|
|
61
|
-
private claudeFrontmatter;
|
|
62
|
-
private simpleFrontmatter;
|
|
63
|
-
private copilotFrontmatter;
|
|
64
50
|
}
|
|
65
51
|
//# sourceMappingURL=slashCommandGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slashCommandGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/slashCommandGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slashCommandGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/slashCommandGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAiB,MAAM,uBAAuB,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,YAAY,EAAE,CAAC;AAG7B,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,GAAG,mBAAmB,GAAG,eAAe,GAAG,oBAAoB,CAAC;CACnF;AAED,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AAGD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAyKzD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAGwB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,qBAAqB;IAChC,0GAA0G;IAC1G,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,YAAY,EAAmB,GAAG,MAAM,EAAE;IAU9F,uFAAuF;IACvF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,YAAY,EAAmB,GAAG,MAAM,EAAE;IAQzE;;;;OAIG;IACH,eAAe,CACb,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,OAAO,EACf,QAAQ,GAAE,YAAY,EAAmB,EACzC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,M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