specpilot 2.6.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/add-specs.d.ts.map +1 -1
- package/dist/commands/add-specs.js +19 -46
- package/dist/commands/add-specs.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +6 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/refine.d.ts.map +1 -1
- package/dist/commands/refine.js +2 -1
- package/dist/commands/refine.js.map +1 -1
- package/dist/commands/serve.d.ts +5 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +21 -8
- package/dist/commands/serve.js.map +1 -1
- package/dist/utils/addSpecsQuestions.d.ts +34 -0
- package/dist/utils/addSpecsQuestions.d.ts.map +1 -0
- package/dist/utils/addSpecsQuestions.js +54 -0
- package/dist/utils/addSpecsQuestions.js.map +1 -0
- package/dist/utils/agentConfigGenerator.d.ts +4 -2
- package/dist/utils/agentConfigGenerator.d.ts.map +1 -1
- package/dist/utils/agentConfigGenerator.js +23 -15
- package/dist/utils/agentConfigGenerator.js.map +1 -1
- package/dist/utils/ideConfigGenerator.d.ts +20 -23
- package/dist/utils/ideConfigGenerator.d.ts.map +1 -1
- package/dist/utils/ideConfigGenerator.js +69 -186
- package/dist/utils/ideConfigGenerator.js.map +1 -1
- package/dist/utils/slashCommandGenerator.d.ts +9 -1
- package/dist/utils/slashCommandGenerator.d.ts.map +1 -1
- package/dist/utils/slashCommandGenerator.js +23 -10
- package/dist/utils/slashCommandGenerator.js.map +1 -1
- package/dist/utils/specBackfiller.js +1 -1
- package/dist/utils/specBackfiller.js.map +1 -1
- package/dist/utils/specGenerator.d.ts +17 -1
- package/dist/utils/specGenerator.d.ts.map +1 -1
- package/dist/utils/specGenerator.js +35 -10
- package/dist/utils/specGenerator.js.map +1 -1
- package/dist/utils/specServer.d.ts +5 -2
- package/dist/utils/specServer.d.ts.map +1 -1
- package/dist/utils/specServer.js +78 -13
- package/dist/utils/specServer.js.map +1 -1
- package/dist/utils/specSetup.d.ts +59 -0
- package/dist/utils/specSetup.d.ts.map +1 -0
- package/dist/utils/specSetup.js +288 -0
- package/dist/utils/specSetup.js.map +1 -0
- package/package.json +1 -1
- package/ui/app.css +10 -0
- package/ui/app.js +70 -3
- package/ui/index.html +9 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
4
|
+
exports.addSpecsOptions = addSpecsOptions;
|
|
5
|
+
// What `specpilot add-specs` asks, and how its answers become generator options: one copy, used by
|
|
6
|
+
// the command's inquirer prompts and by `specpilot serve`'s guided setup (BL-055, ARCH-003.19).
|
|
7
|
+
exports.SUPPORTED_LANGUAGES = ['typescript', 'javascript', 'python', 'kotlin', 'swift'];
|
|
8
|
+
exports.PROJECT_TYPE_MESSAGE = 'Is this a greenfield or brownfield project?';
|
|
9
|
+
exports.PROJECT_TYPE_CHOICES = [
|
|
10
|
+
{ name: 'Brownfield — existing codebase, initializing specs retroactively', value: 'brownfield' },
|
|
11
|
+
{ name: 'Greenfield — new project, writing code from scratch', value: 'greenfield' },
|
|
12
|
+
];
|
|
13
|
+
exports.LANGUAGE_MESSAGE = 'Choose a language:';
|
|
14
|
+
exports.FRAMEWORK_MESSAGE = 'Choose a framework:';
|
|
15
|
+
exports.API_PARADIGM_MESSAGE = 'What API paradigm does this project use?';
|
|
16
|
+
exports.API_PARADIGM_CHOICES = [
|
|
17
|
+
{ name: 'REST / OpenAPI — HTTP endpoints, JSON responses', value: 'rest' },
|
|
18
|
+
{ name: 'CLI — command-line tool with commands and flags', value: 'cli' },
|
|
19
|
+
{ name: 'GraphQL — schema-first query/mutation API', value: 'graphql' },
|
|
20
|
+
{ name: 'None — skip api.yaml (UI library, mobile app, etc.)', value: 'none' },
|
|
21
|
+
];
|
|
22
|
+
const handleMessage = (osUsername) => `Your short handle is used as a prefix in task IDs (e.g. CD-jsmith-001) and prompt IDs\n (e.g. PROMPT-jsmith-001) to avoid collisions when multiple devs share the same spec files.\n Use your GitHub, GitLab, or Bitbucket username, or any short tag of your choice [${osUsername}]:`;
|
|
23
|
+
exports.handleMessage = handleMessage;
|
|
24
|
+
exports.IDE_MESSAGE = 'Select your AI IDE/Agent for SpecPilot context:';
|
|
25
|
+
exports.IDE_CHOICES = [
|
|
26
|
+
{ name: 'GitHub Copilot', value: 'vscode' },
|
|
27
|
+
{ name: 'Cursor', value: 'Cursor' },
|
|
28
|
+
{ name: 'Windsurf', value: 'Windsurf' },
|
|
29
|
+
{ name: 'Antigravity', value: 'Antigravity' },
|
|
30
|
+
{ name: 'Claude Code', value: 'claude-code' },
|
|
31
|
+
{ name: 'Codex', value: 'Codex' },
|
|
32
|
+
];
|
|
33
|
+
/** The line `add-specs` prints for a detected project. */
|
|
34
|
+
const detectedLine = (info) => `✅ Detected ${info.language}${info.framework ? `/${info.framework}` : ''} project`;
|
|
35
|
+
exports.detectedLine = detectedLine;
|
|
36
|
+
/** The `generateSpecs()` options `add-specs` builds from the detector, the analysis and the answers. */
|
|
37
|
+
function addSpecsOptions(projectDir, projectInfo, answers, analysis) {
|
|
38
|
+
const { language, framework } = answers;
|
|
39
|
+
return {
|
|
40
|
+
projectName: projectInfo?.name || 'my-project',
|
|
41
|
+
language,
|
|
42
|
+
framework,
|
|
43
|
+
targetDir: projectDir,
|
|
44
|
+
specsName: '.specs',
|
|
45
|
+
author: answers.handle,
|
|
46
|
+
description: projectInfo?.description || `A ${language} project${framework ? ` using ${framework}` : ''}`,
|
|
47
|
+
ide: answers.ide,
|
|
48
|
+
analysis: analysis || undefined,
|
|
49
|
+
mode: 'existing',
|
|
50
|
+
projectType: answers.projectType,
|
|
51
|
+
apiParadigm: answers.apiParadigm,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=addSpecsQuestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addSpecsQuestions.js","sourceRoot":"","sources":["../../src/utils/addSpecsQuestions.ts"],"names":[],"mappings":";;;AAmDA,0CAqBC;AArED,mGAAmG;AACnG,gGAAgG;AAEnF,QAAA,mBAAmB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEhF,QAAA,oBAAoB,GAAG,6CAA6C,CAAC;AACrE,QAAA,oBAAoB,GAAG;IAClC,EAAE,IAAI,EAAE,kEAAkE,EAAE,KAAK,EAAE,YAAY,EAAE;IACjG,EAAE,IAAI,EAAE,qDAAqD,EAAE,KAAK,EAAE,YAAY,EAAE;CACrF,CAAC;AAEW,QAAA,gBAAgB,GAAG,oBAAoB,CAAC;AACxC,QAAA,iBAAiB,GAAG,qBAAqB,CAAC;AAE1C,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,oBAAoB,GAAG;IAClC,EAAE,IAAI,EAAE,iDAAiD,EAAE,KAAK,EAAE,MAAM,EAAE;IAC1E,EAAE,IAAI,EAAE,iDAAiD,EAAE,KAAK,EAAE,KAAK,EAAE;IACzE,EAAE,IAAI,EAAE,2CAA2C,EAAE,KAAK,EAAE,SAAS,EAAE;IACvE,EAAE,IAAI,EAAE,qDAAqD,EAAE,KAAK,EAAE,MAAM,EAAE;CAC/E,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,UAAkB,EAAE,EAAE,CAClD,2QAA2Q,UAAU,IAAI,CAAC;AAD/Q,QAAA,aAAa,i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E,UAAU;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -7,8 +7,10 @@ import { TemplateEngine, TemplateContext } from './templateEngine';
|
|
|
7
7
|
export declare class AgentConfigGenerator {
|
|
8
8
|
private templateEngine;
|
|
9
9
|
constructor(templateEngine: TemplateEngine);
|
|
10
|
-
/** Entry point — routes to the correct agent config generator. */
|
|
11
|
-
generate(projectDir: string, context: TemplateContext, agent: string): Promise<
|
|
10
|
+
/** Entry point — routes to the correct agent config generator. Returns the kept (existing) file, else []. */
|
|
11
|
+
generate(projectDir: string, context: TemplateContext, agent: string): Promise<string[]>;
|
|
12
|
+
/** The files `generate()` writes for this agent, project-relative (BL-055). */
|
|
13
|
+
targets(agent: string): string[];
|
|
12
14
|
private generateClaudeCodeSkills;
|
|
13
15
|
private generateCodexInstructions;
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentConfigGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/agentConfigGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"agentConfigGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/agentConfigGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnE;;;;GAIG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAElD,6GAA6G;IACvG,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAS9F,+EAA+E;IAC/E,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;YAKlB,wBAAwB;YAoGxB,yBAAyB;CAuJxC"}
|
|
@@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AgentConfigGenerator = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
+
const ideConfigGenerator_1 = require("./ideConfigGenerator");
|
|
7
|
+
/** The one file each agent gets, project-relative; `generate()` and `targets()` both read it (BL-055). */
|
|
8
|
+
const AGENT_FILES = {
|
|
9
|
+
'claude-code': '.claude/skills/specpilot-project/SKILL.md',
|
|
10
|
+
codex: 'CODEX_INSTRUCTIONS.md',
|
|
11
|
+
};
|
|
6
12
|
/**
|
|
7
13
|
* Generates AI agent configuration files:
|
|
8
14
|
* - Claude Code Skills (.claude/skills/specpilot-project/SKILL.md)
|
|
@@ -12,20 +18,22 @@ class AgentConfigGenerator {
|
|
|
12
18
|
constructor(templateEngine) {
|
|
13
19
|
this.templateEngine = templateEngine;
|
|
14
20
|
}
|
|
15
|
-
/** Entry point — routes to the correct agent config generator. */
|
|
21
|
+
/** Entry point — routes to the correct agent config generator. Returns the kept (existing) file, else []. */
|
|
16
22
|
async generate(projectDir, context, agent) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
23
|
+
const key = agent.toLowerCase();
|
|
24
|
+
if (!AGENT_FILES[key])
|
|
25
|
+
return [];
|
|
26
|
+
const filePath = (0, path_1.join)(projectDir, ...AGENT_FILES[key].split('/'));
|
|
27
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
|
|
28
|
+
const created = key === 'claude-code' ? await this.generateClaudeCodeSkills(filePath, context) : await this.generateCodexInstructions(filePath, context);
|
|
29
|
+
return created ? [] : [AGENT_FILES[key]];
|
|
25
30
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
/** The files `generate()` writes for this agent, project-relative (BL-055). */
|
|
32
|
+
targets(agent) {
|
|
33
|
+
const file = AGENT_FILES[agent.toLowerCase()];
|
|
34
|
+
return file ? [file] : [];
|
|
35
|
+
}
|
|
36
|
+
async generateClaudeCodeSkills(filePath, context) {
|
|
29
37
|
const skillContent = `---
|
|
30
38
|
name: specpilot-project
|
|
31
39
|
description: SpecPilot project context, specifications, and development guidelines. Use to understand project architecture, requirements, and AI interaction history.
|
|
@@ -113,13 +121,13 @@ All spec files link to each other for easy navigation. Follow the links in relat
|
|
|
113
121
|
- ../architecture/architecture.md
|
|
114
122
|
- ../planning/tasks.md
|
|
115
123
|
`;
|
|
116
|
-
|
|
124
|
+
return (0, ideConfigGenerator_1.writeNew)(filePath, skillContent
|
|
117
125
|
.replace(/\{\{projectName\}\}/g, context.projectName)
|
|
118
126
|
.replace(/\{\{language\}\}/g, context.language)
|
|
119
127
|
.replace(/{{#if framework}}/g, context.framework ? '' : '<!-- ')
|
|
120
128
|
.replace(/{{\/if}}/g, context.framework ? '' : ' -->'));
|
|
121
129
|
}
|
|
122
|
-
async generateCodexInstructions(
|
|
130
|
+
async generateCodexInstructions(filePath, context) {
|
|
123
131
|
const codexInstructions = `# OpenAI Codex Instructions for {{projectName}}
|
|
124
132
|
|
|
125
133
|
This file provides context and guidelines for OpenAI Codex when working on {{projectName}}.
|
|
@@ -267,7 +275,7 @@ Run \`specpilot validate\` to check:
|
|
|
267
275
|
*For more details, see .specs/development/prompts.md*
|
|
268
276
|
`;
|
|
269
277
|
const rendered = this.templateEngine.renderFromString(codexInstructions, context);
|
|
270
|
-
|
|
278
|
+
return (0, ideConfigGenerator_1.writeNew)(filePath, rendered);
|
|
271
279
|
}
|
|
272
280
|
}
|
|
273
281
|
exports.AgentConfigGenerator = AgentConfigGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentConfigGenerator.js","sourceRoot":"","sources":["../../src/utils/agentConfigGenerator.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1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
|
|
3
|
+
/**
|
|
4
|
+
* Create `path` with `content` only if nothing is there (BL-073): an existing file, or a link at the
|
|
5
|
+
* path itself, is never written or written through. Returns false when it was kept (EEXIST).
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeNew(path: string, content: string): boolean;
|
|
2
8
|
/**
|
|
3
9
|
* Generates IDE workspace settings (.vscode, .cursor, .windsurf, .antigravity).
|
|
4
10
|
* Each IDE gets a settings.json and extensions.json with a shared base config
|
|
5
11
|
* plus per-IDE overlay keys.
|
|
6
12
|
*/
|
|
7
13
|
export declare class IdeConfigGenerator {
|
|
8
|
-
/** Entry point — routes to the correct IDE settings generator. */
|
|
9
|
-
generate(projectDir: string, context: TemplateContext, ide: string): Promise<
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* If the file already exists:
|
|
16
|
-
* - noPrompts=false → asks user: overwrite / append / skip
|
|
17
|
-
* - noPrompts=true → auto-skips and prints a warning
|
|
18
|
-
*/
|
|
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;
|
|
19
20
|
/**
|
|
20
21
|
* Routes to the correct IDE-native AI context file based on the selected IDE.
|
|
21
22
|
* - vscode / codex → .github/copilot-instructions.md
|
|
22
23
|
* - cursor → .cursor/rules/specpilot.mdc
|
|
23
24
|
* - windsurf → .windsurfrules
|
|
24
25
|
* - antigravity → .antigravity/rules.md
|
|
26
|
+
* - claude-code → CLAUDE.md
|
|
27
|
+
* An existing file is kept (BL-073); returns it as kept, else [].
|
|
25
28
|
*/
|
|
26
|
-
generateAiContextFile(projectDir: string, context: TemplateContext, ide: string
|
|
27
|
-
private generateCursorRules;
|
|
28
|
-
private generateWindsurfRules;
|
|
29
|
-
private generateAntigravityRules;
|
|
30
|
-
private generateClaudeMd;
|
|
29
|
+
generateAiContextFile(projectDir: string, context: TemplateContext, ide: string): string[];
|
|
31
30
|
private buildClaudeMd;
|
|
32
|
-
private buildClaudeMdSection;
|
|
33
|
-
generateCopilotInstructions(projectDir: string, context: TemplateContext, noPrompts?: boolean): Promise<void>;
|
|
34
31
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
* Generates .github/copilot-instructions.md with critical mandates (`specpilot backfill`, when it is
|
|
33
|
+
* missing). Read automatically by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
37
34
|
*/
|
|
38
|
-
|
|
35
|
+
generateCopilotInstructions(projectDir: string, context: TemplateContext): void;
|
|
39
36
|
private buildCopilotInstructions;
|
|
40
37
|
private buildCriticalMandatesMarkdown;
|
|
41
38
|
private buildContextRoutingTable;
|
|
@@ -46,8 +43,8 @@ export declare class IdeConfigGenerator {
|
|
|
46
43
|
/**
|
|
47
44
|
* Generates (or updates) .gitattributes at project root with merge=union rules
|
|
48
45
|
* for append-heavy spec files, preventing git merge conflicts on shared branches.
|
|
49
|
-
* If the file already exists, only missing lines are appended.
|
|
46
|
+
* If the file already exists, only missing lines are appended. Returns how many were appended.
|
|
50
47
|
*/
|
|
51
|
-
generateGitAttributes(projectDir: string):
|
|
48
|
+
generateGitAttributes(projectDir: string): number;
|
|
52
49
|
}
|
|
53
50
|
//# sourceMappingURL=ideConfigGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ideConfigGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/ideConfigGenerator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ideConfigGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/ideConfigGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA6CnD,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAKnD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B,qGAAqG;IAC/F,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI5F,wGAAwG;IACxG,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAKtC,4EAA4E;IAC5E,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIpC;;;;;;;;OAQG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAc1F,OAAO,CAAC,aAAa;IAmCrB;;;OAGG;IACH,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAM/E,OAAO,CAAC,wBAAwB;IAiChC,OAAO,CAAC,6BAA6B;IAiBrC,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,2BAA2B;YAsBrB,mBAAmB;IAuBjC,OAAO,CAAC,iBAAiB;IA4DzB;;;;OAIG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAsBlD"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IdeConfigGenerator = void 0;
|
|
3
|
+
exports.IdeConfigGenerator = exports.GITATTRIBUTES_FILE = void 0;
|
|
4
|
+
exports.writeNew = writeNew;
|
|
7
5
|
const path_1 = require("path");
|
|
8
6
|
const fs_1 = require("fs");
|
|
9
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
7
|
/** IDE-specific overlay keys appended on top of the shared base settings.
|
|
11
8
|
* NOTE: These keys are aspirational — they are NOT confirmed in each IDE's
|
|
12
9
|
* official documentation. Unknown keys are silently ignored, but they are
|
|
@@ -39,100 +36,71 @@ const IDE_DIRS = {
|
|
|
39
36
|
windsurf: '.windsurf',
|
|
40
37
|
antigravity: '.antigravity',
|
|
41
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';
|
|
48
|
+
/** Project-relative path of a project file, joined for this platform. */
|
|
49
|
+
const at = (projectDir, rel) => (0, path_1.join)(projectDir, ...rel.split('/'));
|
|
50
|
+
/**
|
|
51
|
+
* Create `path` with `content` only if nothing is there (BL-073): an existing file, or a link at the
|
|
52
|
+
* path itself, is never written or written through. Returns false when it was kept (EEXIST).
|
|
53
|
+
*/
|
|
54
|
+
function writeNew(path, content) {
|
|
55
|
+
try {
|
|
56
|
+
(0, fs_1.writeFileSync)(path, content, { flag: 'wx' });
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
if (err.code === 'EEXIST')
|
|
61
|
+
return false;
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
42
65
|
/**
|
|
43
66
|
* Generates IDE workspace settings (.vscode, .cursor, .windsurf, .antigravity).
|
|
44
67
|
* Each IDE gets a settings.json and extensions.json with a shared base config
|
|
45
68
|
* plus per-IDE overlay keys.
|
|
46
69
|
*/
|
|
47
70
|
class IdeConfigGenerator {
|
|
48
|
-
/** Entry point — routes to the correct IDE settings generator. */
|
|
71
|
+
/** Entry point — routes to the correct IDE settings generator. Returns the kept (existing) files. */
|
|
49
72
|
async generate(projectDir, context, ide) {
|
|
50
|
-
|
|
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;
|
|
51
83
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Generates .github/copilot-instructions.md with critical mandates.
|
|
54
|
-
* Read automatically by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
55
|
-
* Always generated regardless of IDE choice.
|
|
56
|
-
*
|
|
57
|
-
* If the file already exists:
|
|
58
|
-
* - noPrompts=false → asks user: overwrite / append / skip
|
|
59
|
-
* - noPrompts=true → auto-skips and prints a warning
|
|
60
|
-
*/
|
|
61
84
|
/**
|
|
62
85
|
* Routes to the correct IDE-native AI context file based on the selected IDE.
|
|
63
86
|
* - vscode / codex → .github/copilot-instructions.md
|
|
64
87
|
* - cursor → .cursor/rules/specpilot.mdc
|
|
65
88
|
* - windsurf → .windsurfrules
|
|
66
89
|
* - antigravity → .antigravity/rules.md
|
|
90
|
+
* - claude-code → CLAUDE.md
|
|
91
|
+
* An existing file is kept (BL-073); returns it as kept, else [].
|
|
67
92
|
*/
|
|
68
|
-
|
|
93
|
+
generateAiContextFile(projectDir, context, ide) {
|
|
69
94
|
const key = ide.toLowerCase();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
else if (key === 'claude-code') {
|
|
80
|
-
await this.generateClaudeMd(projectDir, context, noPrompts);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// vscode, codex, and unknown IDEs → copilot-instructions.md
|
|
84
|
-
await this.generateCopilotInstructions(projectDir, context, noPrompts);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
generateCursorRules(projectDir, context) {
|
|
88
|
-
const rulesDir = (0, path_1.join)(projectDir, '.cursor', 'rules');
|
|
89
|
-
(0, fs_1.mkdirSync)(rulesDir, { recursive: true });
|
|
90
|
-
const filePath = (0, path_1.join)(rulesDir, 'specpilot.mdc');
|
|
91
|
-
const content = `---\ndescription: Project mandates and AI coding rules\nglobs:\nalwaysApply: true\n---\n\n` +
|
|
92
|
-
this.buildCopilotInstructions(context);
|
|
93
|
-
(0, fs_1.writeFileSync)(filePath, content);
|
|
94
|
-
}
|
|
95
|
-
generateWindsurfRules(projectDir, context) {
|
|
96
|
-
const filePath = (0, path_1.join)(projectDir, '.windsurfrules');
|
|
97
|
-
(0, fs_1.writeFileSync)(filePath, this.buildCopilotInstructions(context));
|
|
98
|
-
}
|
|
99
|
-
generateAntigravityRules(projectDir, context) {
|
|
100
|
-
const rulesDir = (0, path_1.join)(projectDir, '.antigravity');
|
|
101
|
-
(0, fs_1.mkdirSync)(rulesDir, { recursive: true });
|
|
102
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(rulesDir, 'rules.md'), this.buildCopilotInstructions(context));
|
|
103
|
-
}
|
|
104
|
-
async generateClaudeMd(projectDir, context, noPrompts = false) {
|
|
105
|
-
const filePath = (0, path_1.join)(projectDir, 'CLAUDE.md');
|
|
106
|
-
if (!(0, fs_1.existsSync)(filePath)) {
|
|
107
|
-
(0, fs_1.writeFileSync)(filePath, this.buildClaudeMd(context));
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
// File already exists
|
|
111
|
-
if (noPrompts) {
|
|
112
|
-
console.log('\u26a0\ufe0f CLAUDE.md already exists \u2014 skipping (--no-prompts).\n' +
|
|
113
|
-
' Manually merge the SpecPilot mandates shown below into that file:\n\n' +
|
|
114
|
-
this.buildClaudeMdSection(context));
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const { action } = await inquirer_1.default.prompt([
|
|
118
|
-
{
|
|
119
|
-
type: 'list',
|
|
120
|
-
name: 'action',
|
|
121
|
-
message: '\u26a0\ufe0f CLAUDE.md already exists. What would you like to do?',
|
|
122
|
-
choices: [
|
|
123
|
-
{ name: 'Overwrite with SpecPilot template', value: 'o' },
|
|
124
|
-
{ name: 'Append SpecPilot section to existing file', value: 'a' },
|
|
125
|
-
{ name: 'Skip (keep existing file unchanged)', value: 's' },
|
|
126
|
-
],
|
|
127
|
-
},
|
|
128
|
-
]);
|
|
129
|
-
if (action === 'o') {
|
|
130
|
-
(0, fs_1.writeFileSync)(filePath, this.buildClaudeMd(context));
|
|
131
|
-
}
|
|
132
|
-
else if (action === 'a') {
|
|
133
|
-
(0, fs_1.appendFileSync)(filePath, '\n\n' + this.buildClaudeMdSection(context));
|
|
134
|
-
}
|
|
135
|
-
// action === 's' → leave file unchanged
|
|
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];
|
|
136
104
|
}
|
|
137
105
|
buildClaudeMd(context) {
|
|
138
106
|
const stack = context.framework
|
|
@@ -168,103 +136,14 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
168
136
|
For a ready-made re-anchor prompt, see \`.specs/development/prompts.md \u2192 ## Re-Anchor Prompt\`.
|
|
169
137
|
`;
|
|
170
138
|
}
|
|
171
|
-
buildClaudeMdSection(context) {
|
|
172
|
-
const stack = context.framework
|
|
173
|
-
? `${context.language} / ${context.framework}`
|
|
174
|
-
: context.language;
|
|
175
|
-
return `## SpecPilot Mandates \u2014 ${context.projectName}
|
|
176
|
-
|
|
177
|
-
> Added by \`specpilot add-specs\`. These mandates apply alongside your existing instructions.
|
|
178
|
-
> Full context is in \`.specs/project/project.yaml\`.
|
|
179
|
-
|
|
180
|
-
### Project
|
|
181
|
-
|
|
182
|
-
- **Name:** ${context.projectName}
|
|
183
|
-
- **Stack:** ${stack}
|
|
184
|
-
- **Specs location:** \`.specs/\`
|
|
185
|
-
|
|
186
|
-
### \ud83d\udd34 Critical Mandates \u2014 Never violate, no exceptions
|
|
187
|
-
|
|
188
|
-
${this.buildCriticalMandatesMarkdown()}
|
|
189
|
-
|
|
190
|
-
### \ud83d\udfe1 Process Mandates
|
|
191
|
-
|
|
192
|
-
${this.buildProcessMandatesMarkdown()}
|
|
193
|
-
|
|
194
|
-
${this.buildContextRoutingTable()}
|
|
195
|
-
|
|
196
|
-
${this.buildCodePhilosophyMarkdown()}
|
|
197
|
-
`;
|
|
198
|
-
}
|
|
199
|
-
async generateCopilotInstructions(projectDir, context, noPrompts = false) {
|
|
200
|
-
const githubDir = (0, path_1.join)(projectDir, '.github');
|
|
201
|
-
(0, fs_1.mkdirSync)(githubDir, { recursive: true });
|
|
202
|
-
const filePath = (0, path_1.join)(githubDir, 'copilot-instructions.md');
|
|
203
|
-
if (!(0, fs_1.existsSync)(filePath)) {
|
|
204
|
-
(0, fs_1.writeFileSync)(filePath, this.buildCopilotInstructions(context));
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
// File already exists
|
|
208
|
-
if (noPrompts) {
|
|
209
|
-
console.log('\u26a0\ufe0f .github/copilot-instructions.md already exists \u2014 skipping (--no-prompts).\n' +
|
|
210
|
-
' Manually merge the SpecPilot mandates shown below into that file:\n\n' +
|
|
211
|
-
this.buildCopilotSection(context));
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const { action } = await inquirer_1.default.prompt([
|
|
215
|
-
{
|
|
216
|
-
type: 'list',
|
|
217
|
-
name: 'action',
|
|
218
|
-
message: '⚠️ .github/copilot-instructions.md already exists. What would you like to do?',
|
|
219
|
-
choices: [
|
|
220
|
-
{ name: 'Overwrite with SpecPilot template', value: 'o' },
|
|
221
|
-
{ name: 'Append SpecPilot section to existing file', value: 'a' },
|
|
222
|
-
{ name: 'Skip (keep existing file unchanged)', value: 's' },
|
|
223
|
-
],
|
|
224
|
-
},
|
|
225
|
-
]);
|
|
226
|
-
if (action === 'o') {
|
|
227
|
-
(0, fs_1.writeFileSync)(filePath, this.buildCopilotInstructions(context));
|
|
228
|
-
}
|
|
229
|
-
else if (action === 'a') {
|
|
230
|
-
(0, fs_1.appendFileSync)(filePath, '\n\n' + this.buildCopilotSection(context));
|
|
231
|
-
}
|
|
232
|
-
// action === 's' → leave file unchanged
|
|
233
|
-
}
|
|
234
139
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
140
|
+
* Generates .github/copilot-instructions.md with critical mandates (`specpilot backfill`, when it is
|
|
141
|
+
* missing). Read automatically by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
237
142
|
*/
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return `## SpecPilot Mandates — ${context.projectName}
|
|
243
|
-
|
|
244
|
-
> Added by \`specpilot add-specs\`. These mandates apply alongside your existing instructions.
|
|
245
|
-
> Full context is in \`.specs/project/project.yaml\`.
|
|
246
|
-
|
|
247
|
-
### Project
|
|
248
|
-
|
|
249
|
-
- **Name:** ${context.projectName}
|
|
250
|
-
- **Stack:** ${stack}
|
|
251
|
-
- **Specs location:** \`.specs/\`
|
|
252
|
-
|
|
253
|
-
### 🔴 Critical Mandates — Never violate, no exceptions
|
|
254
|
-
|
|
255
|
-
${this.buildCriticalMandatesMarkdown()}
|
|
256
|
-
|
|
257
|
-
### 🟡 Process Mandates
|
|
258
|
-
|
|
259
|
-
${this.buildProcessMandatesMarkdown()}
|
|
260
|
-
|
|
261
|
-
${this.buildContextRoutingTable()}
|
|
262
|
-
|
|
263
|
-
### Re-Anchor
|
|
264
|
-
|
|
265
|
-
If you lose context mid-session, read \`.specs/project/project.yaml\` to restore full project context.
|
|
266
|
-
For a ready-made re-anchor prompt, see \`.specs/development/prompts.md → ## Re-Anchor Prompt\`.
|
|
267
|
-
`;
|
|
143
|
+
generateCopilotInstructions(projectDir, context) {
|
|
144
|
+
const filePath = at(projectDir, COPILOT_INSTRUCTIONS);
|
|
145
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(filePath), { recursive: true });
|
|
146
|
+
writeNew(filePath, this.buildCopilotInstructions(context));
|
|
268
147
|
}
|
|
269
148
|
buildCopilotInstructions(context) {
|
|
270
149
|
const stack = context.framework
|
|
@@ -354,12 +233,13 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
354
233
|
}
|
|
355
234
|
async generateIDESettings(projectDir, context, ide) {
|
|
356
235
|
const key = ide.toLowerCase();
|
|
357
|
-
const ideDir = IDE_DIRS[key] ?? '.vscode';
|
|
358
236
|
const overrides = IDE_OVERRIDES[key] ?? {};
|
|
359
|
-
const
|
|
360
|
-
(0, fs_1.mkdirSync)(
|
|
237
|
+
const [settingsRel, extensionsRel] = this.settingsTargets(key);
|
|
238
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(at(projectDir, settingsRel)), { recursive: true });
|
|
239
|
+
const kept = [];
|
|
361
240
|
const settingsWithComment = this.buildSettingsJson(ide, context, overrides);
|
|
362
|
-
|
|
241
|
+
if (!writeNew(at(projectDir, settingsRel), settingsWithComment))
|
|
242
|
+
kept.push(settingsRel);
|
|
363
243
|
const extensions = {
|
|
364
244
|
recommendations: [
|
|
365
245
|
'esbenp.prettier-vscode',
|
|
@@ -369,7 +249,9 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
369
249
|
],
|
|
370
250
|
unwantedRecommendations: [],
|
|
371
251
|
};
|
|
372
|
-
|
|
252
|
+
if (!writeNew(at(projectDir, extensionsRel), JSON.stringify(extensions, null, 2)))
|
|
253
|
+
kept.push(extensionsRel);
|
|
254
|
+
return kept;
|
|
373
255
|
}
|
|
374
256
|
buildSettingsJson(ide, context, overrides) {
|
|
375
257
|
const displayName = ide === 'vscode' ? 'VS Code' : ide.charAt(0).toUpperCase() + ide.slice(1);
|
|
@@ -426,7 +308,7 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
426
308
|
/**
|
|
427
309
|
* Generates (or updates) .gitattributes at project root with merge=union rules
|
|
428
310
|
* for append-heavy spec files, preventing git merge conflicts on shared branches.
|
|
429
|
-
* If the file already exists, only missing lines are appended.
|
|
311
|
+
* If the file already exists, only missing lines are appended. Returns how many were appended.
|
|
430
312
|
*/
|
|
431
313
|
generateGitAttributes(projectDir) {
|
|
432
314
|
const GITATTRIBUTES_LINES = [
|
|
@@ -434,10 +316,10 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
434
316
|
'.specs/planning/tasks.md merge=union',
|
|
435
317
|
'CHANGELOG.md merge=union',
|
|
436
318
|
];
|
|
437
|
-
const filePath = (0, path_1.join)(projectDir,
|
|
319
|
+
const filePath = (0, path_1.join)(projectDir, exports.GITATTRIBUTES_FILE);
|
|
438
320
|
if (!(0, fs_1.existsSync)(filePath)) {
|
|
439
321
|
(0, fs_1.writeFileSync)(filePath, GITATTRIBUTES_LINES.join('\n') + '\n');
|
|
440
|
-
return;
|
|
322
|
+
return 0;
|
|
441
323
|
}
|
|
442
324
|
const existing = (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
443
325
|
const missing = GITATTRIBUTES_LINES.filter(line => !existing.includes(line));
|
|
@@ -445,6 +327,7 @@ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore
|
|
|
445
327
|
const suffix = existing.endsWith('\n') ? '' : '\n';
|
|
446
328
|
(0, fs_1.appendFileSync)(filePath, suffix + missing.join('\n') + '\n');
|
|
447
329
|
}
|
|
330
|
+
return missing.length;
|
|
448
331
|
}
|
|
449
332
|
}
|
|
450
333
|
exports.IdeConfigGenerator = IdeConfigGenerator;
|
|
@@ -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":";;;AAwDA,4BAQC;AAhED,+BAAqC;AACrC,2BAAwF;AAGxF;;;;;GAKG;AACH,MAAM,aAAa,GAA4C;IAC7D,MAAM,EAAE;QACN,6CAA6C;QAC7C,iBAAiB,EAAE,IAAI;QACvB,wBAAwB,EAAE,IAAI;KAC/B;IACD,QAAQ,EAAE;QACR,+CAA+C;QAC/C,4BAA4B,EAAE,IAAI;QAClC,4BAA4B,EAAE,IAAI;QAClC,sCAAsC,EAAE,IAAI;KAC7C;IACD,WAAW,EAAE;QACX,kDAAkD;QAClD,wBAAwB,EAAE,IAAI;QAC9B,wBAAwB,EAAE,IAAI;QAC9B,+BAA+B,EAAE,IAAI;KACtC;CACF,CAAC;AAEF,mDAAmD;AACnD,MAAM,QAAQ,GAA2B;IACvC,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,cAAc;CAC5B,CAAC;A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