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
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITATTRIBUTES_LINES = exports.GITATTRIBUTES_FILE = exports.COPILOT_INSTRUCTIONS_FILE = void 0;
|
|
4
|
+
exports.settingsTargets = settingsTargets;
|
|
5
|
+
exports.aiContextTarget = aiContextTarget;
|
|
6
|
+
exports.aiContextFile = aiContextFile;
|
|
7
|
+
exports.settingsFiles = settingsFiles;
|
|
8
|
+
exports.gitAttributesContent = gitAttributesContent;
|
|
9
|
+
exports.buildClaudeMd = buildClaudeMd;
|
|
10
|
+
exports.buildCopilotInstructions = buildCopilotInstructions;
|
|
11
|
+
exports.buildCriticalMandatesMarkdown = buildCriticalMandatesMarkdown;
|
|
12
|
+
exports.buildContextRoutingTable = buildContextRoutingTable;
|
|
13
|
+
exports.buildProcessMandatesMarkdown = buildProcessMandatesMarkdown;
|
|
14
|
+
exports.buildCodePhilosophyMarkdown = buildCodePhilosophyMarkdown;
|
|
15
|
+
exports.buildSettingsJson = buildSettingsJson;
|
|
16
|
+
// The files outside `.specs/` that depend on the IDE choice: settings, extensions, the AI context
|
|
17
|
+
// file, the mandate text and `.gitattributes` (BL-032, phase 1: the content half of
|
|
18
|
+
// src/utils/ideConfigGenerator.ts; `writeNew()` and the `.gitattributes` merge stay there).
|
|
19
|
+
/** IDE-specific overlay keys appended on top of the shared base settings.
|
|
20
|
+
* NOTE: These keys are aspirational — they are NOT confirmed in each IDE's
|
|
21
|
+
* official documentation. Unknown keys are silently ignored, but they are
|
|
22
|
+
* included here as hints for IDEs that may adopt spec-aware settings in future.
|
|
23
|
+
* Remove any keys that cause warnings in your specific IDE version.
|
|
24
|
+
*/
|
|
25
|
+
const IDE_OVERRIDES = {
|
|
26
|
+
cursor: {
|
|
27
|
+
// ASPIRATIONAL — not in official Cursor docs
|
|
28
|
+
'cursor.aiAccess': true,
|
|
29
|
+
'cursor.enableAIContext': true,
|
|
30
|
+
},
|
|
31
|
+
windsurf: {
|
|
32
|
+
// ASPIRATIONAL — not in official Windsurf docs
|
|
33
|
+
'windsurf.aiContext.enabled': true,
|
|
34
|
+
'windsurf.specs.integration': true,
|
|
35
|
+
'windsurf.codeCompletion.contextAware': true,
|
|
36
|
+
},
|
|
37
|
+
antigravity: {
|
|
38
|
+
// ASPIRATIONAL — not in official Antigravity docs
|
|
39
|
+
'antigravity.ai.enabled': true,
|
|
40
|
+
'antigravity.contextual': true,
|
|
41
|
+
'antigravity.specs.integration': true,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
/** IDE directory names used for settings files. */
|
|
45
|
+
const IDE_DIRS = {
|
|
46
|
+
vscode: '.vscode',
|
|
47
|
+
cursor: '.cursor',
|
|
48
|
+
windsurf: '.windsurf',
|
|
49
|
+
antigravity: '.antigravity',
|
|
50
|
+
};
|
|
51
|
+
/** The IDE-native AI context file per IDE; anything else gets copilot-instructions.md (ARCH-004.11). */
|
|
52
|
+
const AI_CONTEXT_FILES = {
|
|
53
|
+
cursor: '.cursor/rules/specpilot.mdc',
|
|
54
|
+
windsurf: '.windsurfrules',
|
|
55
|
+
antigravity: '.antigravity/rules.md',
|
|
56
|
+
'claude-code': 'CLAUDE.md',
|
|
57
|
+
};
|
|
58
|
+
const COPILOT_INSTRUCTIONS = '.github/copilot-instructions.md';
|
|
59
|
+
exports.COPILOT_INSTRUCTIONS_FILE = COPILOT_INSTRUCTIONS;
|
|
60
|
+
exports.GITATTRIBUTES_FILE = '.gitattributes';
|
|
61
|
+
exports.GITATTRIBUTES_LINES = [
|
|
62
|
+
'.specs/development/prompts*.md merge=union',
|
|
63
|
+
'.specs/planning/tasks.md merge=union',
|
|
64
|
+
'CHANGELOG.md merge=union',
|
|
65
|
+
];
|
|
66
|
+
/** The settings pair for an IDE, project-relative (BL-055); the content comes from `settingsFiles()`. */
|
|
67
|
+
function settingsTargets(ide) {
|
|
68
|
+
const dir = IDE_DIRS[ide.toLowerCase()] ?? '.vscode';
|
|
69
|
+
return [`${dir}/settings.json`, `${dir}/extensions.json`];
|
|
70
|
+
}
|
|
71
|
+
/** The IDE-native AI context file, project-relative (BL-055). */
|
|
72
|
+
function aiContextTarget(ide) {
|
|
73
|
+
return AI_CONTEXT_FILES[ide.toLowerCase()] ?? COPILOT_INSTRUCTIONS;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The AI context file for the selected IDE:
|
|
77
|
+
* - vscode / codex → .github/copilot-instructions.md
|
|
78
|
+
* - cursor → .cursor/rules/specpilot.mdc
|
|
79
|
+
* - windsurf → .windsurfrules
|
|
80
|
+
* - antigravity → .antigravity/rules.md
|
|
81
|
+
* - claude-code → CLAUDE.md
|
|
82
|
+
*/
|
|
83
|
+
function aiContextFile(context, ide) {
|
|
84
|
+
const key = ide.toLowerCase();
|
|
85
|
+
const content = key === 'claude-code'
|
|
86
|
+
? buildClaudeMd(context)
|
|
87
|
+
: key === 'cursor'
|
|
88
|
+
? `---\ndescription: Project mandates and AI coding rules\nglobs:\nalwaysApply: true\n---\n\n` + buildCopilotInstructions(context)
|
|
89
|
+
: buildCopilotInstructions(context);
|
|
90
|
+
return { path: aiContextTarget(key), content };
|
|
91
|
+
}
|
|
92
|
+
/** The settings.json and extensions.json pair for an IDE (shared base plus per-IDE overlay keys). */
|
|
93
|
+
function settingsFiles(context, ide) {
|
|
94
|
+
const key = ide.toLowerCase();
|
|
95
|
+
const overrides = IDE_OVERRIDES[key] ?? {};
|
|
96
|
+
const [settingsRel, extensionsRel] = settingsTargets(key);
|
|
97
|
+
const extensions = {
|
|
98
|
+
recommendations: [
|
|
99
|
+
'esbenp.prettier-vscode',
|
|
100
|
+
'redhat.vscode-yaml',
|
|
101
|
+
'github.copilot',
|
|
102
|
+
'ms-vscode.vscode-typescript-next',
|
|
103
|
+
],
|
|
104
|
+
unwantedRecommendations: [],
|
|
105
|
+
};
|
|
106
|
+
return [
|
|
107
|
+
{ path: settingsRel, content: buildSettingsJson(ide, context, overrides) },
|
|
108
|
+
{ path: extensionsRel, content: JSON.stringify(extensions, null, 2) },
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
/** `.gitattributes` as created in a project that has none (REQ-002.B.8). */
|
|
112
|
+
function gitAttributesContent() {
|
|
113
|
+
return exports.GITATTRIBUTES_LINES.join('\n') + '\n';
|
|
114
|
+
}
|
|
115
|
+
function buildClaudeMd(context) {
|
|
116
|
+
const stack = context.framework
|
|
117
|
+
? `${context.language} / ${context.framework}`
|
|
118
|
+
: context.language;
|
|
119
|
+
return `# CLAUDE.md \u2014 ${context.projectName}
|
|
120
|
+
|
|
121
|
+
> This file is the primary instructions file for Claude Code.
|
|
122
|
+
> Keep it lean \u2014 use it as a router to your \`.specs/\` files, not a dumping ground.
|
|
123
|
+
> Full project context is in \`.specs/project/project.yaml\`.
|
|
124
|
+
|
|
125
|
+
## Project
|
|
126
|
+
|
|
127
|
+
- **Name:** ${context.projectName}
|
|
128
|
+
- **Stack:** ${stack}
|
|
129
|
+
- **Specs location:** \`.specs/\`
|
|
130
|
+
|
|
131
|
+
## \ud83d\udd34 Critical Mandates \u2014 Never violate, no exceptions
|
|
132
|
+
|
|
133
|
+
${buildCriticalMandatesMarkdown()}
|
|
134
|
+
|
|
135
|
+
## \ud83d\udfe1 Process Mandates
|
|
136
|
+
|
|
137
|
+
${buildProcessMandatesMarkdown()}
|
|
138
|
+
|
|
139
|
+
${buildContextRoutingTable()}
|
|
140
|
+
|
|
141
|
+
${buildCodePhilosophyMarkdown()}
|
|
142
|
+
|
|
143
|
+
## Re-Anchor
|
|
144
|
+
|
|
145
|
+
If you lose context mid-session, read \`.specs/project/project.yaml\` to restore full project context.
|
|
146
|
+
For a ready-made re-anchor prompt, see \`.specs/development/prompts.md \u2192 ## Re-Anchor Prompt\`.
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
function buildCopilotInstructions(context) {
|
|
150
|
+
const stack = context.framework
|
|
151
|
+
? `${context.language} / ${context.framework}`
|
|
152
|
+
: context.language;
|
|
153
|
+
return `# AI Coding Instructions — ${context.projectName}
|
|
154
|
+
|
|
155
|
+
> This file is automatically read by GitHub Copilot, Cursor, and other AI tools on every request.
|
|
156
|
+
> Keep this file short — only critical mandates. Full context is in \`.specs/project/project.yaml\`.
|
|
157
|
+
|
|
158
|
+
## Project
|
|
159
|
+
|
|
160
|
+
- **Name:** ${context.projectName}
|
|
161
|
+
- **Stack:** ${stack}
|
|
162
|
+
- **Specs location:** \`.specs/\`
|
|
163
|
+
|
|
164
|
+
## 🔴 Critical Mandates — Never violate, no exceptions
|
|
165
|
+
|
|
166
|
+
${buildCriticalMandatesMarkdown()}
|
|
167
|
+
|
|
168
|
+
## 🟡 Process Mandates
|
|
169
|
+
|
|
170
|
+
${buildProcessMandatesMarkdown()}
|
|
171
|
+
|
|
172
|
+
${buildContextRoutingTable()}
|
|
173
|
+
|
|
174
|
+
${buildCodePhilosophyMarkdown()}
|
|
175
|
+
|
|
176
|
+
## Re-Anchor
|
|
177
|
+
|
|
178
|
+
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\`.
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
function buildCriticalMandatesMarkdown() {
|
|
182
|
+
return `1. No commit unless asked.
|
|
183
|
+
2. No push unless asked.
|
|
184
|
+
3. No deploy/publish/release unless asked.
|
|
185
|
+
4. No \`.specs/\` structure changes — content only.
|
|
186
|
+
5. Update specs after change:
|
|
187
|
+
- Trivial → \`planning/tasks.md\`
|
|
188
|
+
- Feature → \`project/requirements.md\` + \`planning/tasks.md\`
|
|
189
|
+
- Architectural → all affected files + \`CHANGELOG.md\`
|
|
190
|
+
6. Never reference file contents without reading first. If unread, say so.
|
|
191
|
+
7. Never write code or change files unless asked. Ask first.
|
|
192
|
+
8. Spec-first gate (scale to task size):
|
|
193
|
+
- Trivial → no gate
|
|
194
|
+
- Feature → read 1–2 relevant \`.specs/\` files before coding
|
|
195
|
+
- Architectural → update all affected specs, present Spec Report, wait for \`yes, proceed\``;
|
|
196
|
+
}
|
|
197
|
+
function buildContextRoutingTable() {
|
|
198
|
+
return `## Context — read on demand by task type
|
|
199
|
+
|
|
200
|
+
| Task type | Read |
|
|
201
|
+
|---|---|
|
|
202
|
+
| Session start | \`.specs/project/project.yaml\` |
|
|
203
|
+
| Feature / bug | + \`project/requirements.md\`, \`planning/tasks.md\` |
|
|
204
|
+
| Architecture | + \`architecture/architecture.md\` |
|
|
205
|
+
| Tests | + \`quality/tests.md\` |
|
|
206
|
+
| Security | + \`security/threat-model.md\`, \`security/security-decisions.md\` |
|
|
207
|
+
| Planning | + \`planning/tasks.md\`, \`planning/roadmap.md\` |`;
|
|
208
|
+
}
|
|
209
|
+
function buildProcessMandatesMarkdown() {
|
|
210
|
+
return `- **Spec-First:** Update \`.specs/\` before writing code.
|
|
211
|
+
- **Log all AI interactions** in \`.specs/development/prompts.md\` with timestamps.
|
|
212
|
+
- **Document decisions** in \`.specs/development/context.md\`.`;
|
|
213
|
+
}
|
|
214
|
+
function buildCodePhilosophyMarkdown() {
|
|
215
|
+
return `## Code Philosophy — Write Only What Needed
|
|
216
|
+
|
|
217
|
+
1. Need exist? No → skip. Say why.
|
|
218
|
+
2. Already in codebase? → reuse. Not rewrite.
|
|
219
|
+
3. Stdlib do it? → use it.
|
|
220
|
+
4. Native or installed dep cover it? → use. No new deps.
|
|
221
|
+
5. One line do it? → write that.
|
|
222
|
+
6. Only then: minimum code that work.
|
|
223
|
+
7. Never cut: validation, error handling, security, explicit requirement.
|
|
224
|
+
|
|
225
|
+
## Code Rules
|
|
226
|
+
|
|
227
|
+
1. No abstraction, interface, factory, or pattern unless asked.
|
|
228
|
+
2. No scaffold "for later". Later scaffold itself.
|
|
229
|
+
3. Delete before add.
|
|
230
|
+
4. Shortest correct diff win.
|
|
231
|
+
5. Fix cause, not symptom. One guard in shared function beat guard in every caller.
|
|
232
|
+
6. Boring over clever. Clever = 3am bug.
|
|
233
|
+
7. Read before write. Never reference code you haven't read.`;
|
|
234
|
+
}
|
|
235
|
+
function buildSettingsJson(ide, context, overrides) {
|
|
236
|
+
const displayName = ide === 'vscode' ? 'VS Code' : ide.charAt(0).toUpperCase() + ide.slice(1);
|
|
237
|
+
const noteComment = ide === 'vscode'
|
|
238
|
+
? '// Copy the "First-Use Onboarding Prompt" and paste into your AI agent to populate specs'
|
|
239
|
+
: `// Copy the "First-Use Onboarding Prompt" and paste into ${displayName}'s AI chat to populate specs`;
|
|
240
|
+
// Build override lines
|
|
241
|
+
const overrideLines = Object.entries(overrides)
|
|
242
|
+
.map(([k, v]) => ` "${k}": ${JSON.stringify(v)},`)
|
|
243
|
+
.join('\n');
|
|
244
|
+
const overrideBlock = overrideLines
|
|
245
|
+
? `\n // ${displayName}-specific AI settings (ASPIRATIONAL — not confirmed in official docs; unknown keys are silently ignored)\n${overrideLines}\n`
|
|
246
|
+
: '';
|
|
247
|
+
return `{
|
|
248
|
+
// SpecPilot AI IDE Configuration${ide !== 'vscode' ? ` for ${displayName}` : ''}
|
|
249
|
+
// This file configures ${displayName} to work effectively with SpecPilot specs
|
|
250
|
+
|
|
251
|
+
// AI CONTEXT: The recommended way to give AI agents access to your .specs files
|
|
252
|
+
// is via .github/copilot-instructions.md (VS Code Copilot) or your IDE's equivalent
|
|
253
|
+
// custom instructions file. See .specs/development/prompts.md for guidelines.
|
|
254
|
+
${noteComment}
|
|
255
|
+
|
|
256
|
+
// Ensure .specs folder is included in workspace search (not excluded)
|
|
257
|
+
"search.exclude": {
|
|
258
|
+
"**/.specs/*": false
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
// Markdown formatting for spec files
|
|
262
|
+
"[markdown]": {
|
|
263
|
+
"editor.wordWrap": "on",
|
|
264
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
// YAML formatting for spec files (project.yaml, api.yaml)
|
|
268
|
+
"[yaml]": {
|
|
269
|
+
"editor.insertSpaces": true,
|
|
270
|
+
"editor.tabSize": 2
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
// YAML validation (requires redhat.vscode-yaml extension)
|
|
274
|
+
"yaml.validate": true,
|
|
275
|
+
"yaml.schemas": {
|
|
276
|
+
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.{yml,yaml}"
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
// General file exclusions
|
|
280
|
+
"files.exclude": {
|
|
281
|
+
"**/.git": true,
|
|
282
|
+
"**/node_modules": true,
|
|
283
|
+
"**/__pycache__": true
|
|
284
|
+
}${overrideBlock}
|
|
285
|
+
}`;
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=ideConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideConfig.js","sour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B,4BAA4B;IACxC,OAAO;;+DAEoD,CAAC;AAC9D,CAAC;AAEH,SAAgB,2BAA2B;IACvC,OAAO;;;;;;;;;;;;;;;;;;6DAkBkD,CAAC;AAC5D,CAAC;AAEH,SAAgB,iBAAiB,CAC7B,GAAW,EACX,OAAwB,EACxB,SAAkC;IAElC,MAAM,WAAW,GAAG,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9F,MAAM,WAAW,GACf,GAAG,KAAK,QAAQ;QACd,CAAC,CAAC,0FAA0F;QAC5F,CAAC,CAAC,4DAA4D,WAAW,8BAA8B,CAAC;IAE5G,uBAAuB;IACvB,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;SAClD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,aAAa,GAAG,aAAa;QACjC,CAAC,CAAC,UAAU,WAAW,6GAA6G,aAAa,IAAI;QACrJ,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;qCAC0B,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;4BACtD,WAAW;;;;;IAKnC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BV,aAAa;EAChB,CAAC;AACD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { render, toContext, inferApiParadigm, targetsInSpecs, targetsOutsideSpecs, AGENT_IDES } from './render';
|
|
2
|
+
export type { RenderOptions, RenderedFile, RenderResult } from './render';
|
|
3
|
+
export { TemplateEngine } from './templateEngine';
|
|
4
|
+
export type { TemplateContext, ProjectContext } from './templateEngine';
|
|
5
|
+
export { SLASH_COMMANDS, commandFiles, resolveTarget } from './slashCommands';
|
|
6
|
+
export type { SlashCommand } from './slashCommands';
|
|
7
|
+
export { GITATTRIBUTES_FILE, GITATTRIBUTES_LINES, buildCopilotInstructions } from './ideConfig';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChH,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9E,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildCopilotInstructions = exports.GITATTRIBUTES_LINES = exports.GITATTRIBUTES_FILE = exports.resolveTarget = exports.commandFiles = exports.SLASH_COMMANDS = exports.TemplateEngine = exports.AGENT_IDES = exports.targetsOutsideSpecs = exports.targetsInSpecs = exports.inferApiParadigm = exports.toContext = exports.render = void 0;
|
|
4
|
+
// The pure spec core (BL-032): nothing in this folder imports a Node API (REQ-002.I.2).
|
|
5
|
+
var render_1 = require("./render");
|
|
6
|
+
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return render_1.render; } });
|
|
7
|
+
Object.defineProperty(exports, "toContext", { enumerable: true, get: function () { return render_1.toContext; } });
|
|
8
|
+
Object.defineProperty(exports, "inferApiParadigm", { enumerable: true, get: function () { return render_1.inferApiParadigm; } });
|
|
9
|
+
Object.defineProperty(exports, "targetsInSpecs", { enumerable: true, get: function () { return render_1.targetsInSpecs; } });
|
|
10
|
+
Object.defineProperty(exports, "targetsOutsideSpecs", { enumerable: true, get: function () { return render_1.targetsOutsideSpecs; } });
|
|
11
|
+
Object.defineProperty(exports, "AGENT_IDES", { enumerable: true, get: function () { return render_1.AGENT_IDES; } });
|
|
12
|
+
var templateEngine_1 = require("./templateEngine");
|
|
13
|
+
Object.defineProperty(exports, "TemplateEngine", { enumerable: true, get: function () { return templateEngine_1.TemplateEngine; } });
|
|
14
|
+
var slashCommands_1 = require("./slashCommands");
|
|
15
|
+
Object.defineProperty(exports, "SLASH_COMMANDS", { enumerable: true, get: function () { return slashCommands_1.SLASH_COMMANDS; } });
|
|
16
|
+
Object.defineProperty(exports, "commandFiles", { enumerable: true, get: function () { return slashCommands_1.commandFiles; } });
|
|
17
|
+
Object.defineProperty(exports, "resolveTarget", { enumerable: true, get: function () { return slashCommands_1.resolveTarget; } });
|
|
18
|
+
var ideConfig_1 = require("./ideConfig");
|
|
19
|
+
Object.defineProperty(exports, "GITATTRIBUTES_FILE", { enumerable: true, get: function () { return ideConfig_1.GITATTRIBUTES_FILE; } });
|
|
20
|
+
Object.defineProperty(exports, "GITATTRIBUTES_LINES", { enumerable: true, get: function () { return ideConfig_1.GITATTRIBUTES_LINES; } });
|
|
21
|
+
Object.defineProperty(exports, "buildCopilotInstructions", { enumerable: true, get: function () { return ideConfig_1.buildCopilotInstructions; } });
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,wFAAwF;AACxF,mCAAgH;AAAvG,gGAAA,MAAM,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,oGAAA,UAAU,OAAA;AAE7F,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,iDAA8E;AAArE,+GAAA,cAAc,OAAA;AAAE,6GAAA,YAAY,OAAA;AAAE,8GAAA,aAAa,OAAA;AAEpD,yCAAgG;AAAvF,+GAAA,kBAAkB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAAE,qHAAA,wBAAwB,OAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { OptionalFields, TemplateContext } from './templateEngine';
|
|
2
|
+
/** What the generator needs to know, minus where to write (`targetDir` is the writer's). */
|
|
3
|
+
export interface RenderOptions extends OptionalFields {
|
|
4
|
+
projectName: string;
|
|
5
|
+
language: string;
|
|
6
|
+
framework?: string;
|
|
7
|
+
/** The specs folder's name; `.specs` when absent. */
|
|
8
|
+
specsName?: string;
|
|
9
|
+
author?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
ide?: string;
|
|
12
|
+
mode?: 'new' | 'existing';
|
|
13
|
+
projectType?: 'greenfield' | 'brownfield';
|
|
14
|
+
apiParadigm?: 'rest' | 'cli' | 'graphql' | 'none';
|
|
15
|
+
projectContext?: {
|
|
16
|
+
whatItDoes: string;
|
|
17
|
+
targetUsers: string;
|
|
18
|
+
expectedScale: string;
|
|
19
|
+
constraints: string;
|
|
20
|
+
};
|
|
21
|
+
analysis?: {
|
|
22
|
+
todos: Array<{
|
|
23
|
+
file: string;
|
|
24
|
+
line: number;
|
|
25
|
+
text: string;
|
|
26
|
+
type: string;
|
|
27
|
+
}>;
|
|
28
|
+
tests: {
|
|
29
|
+
framework?: string;
|
|
30
|
+
testFiles: string[];
|
|
31
|
+
testCount: number;
|
|
32
|
+
hasE2E: boolean;
|
|
33
|
+
hasUnit: boolean;
|
|
34
|
+
hasIntegration: boolean;
|
|
35
|
+
};
|
|
36
|
+
architecture: {
|
|
37
|
+
components: string[];
|
|
38
|
+
directories: string;
|
|
39
|
+
fileTypes: Record<string, number>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** The date every generated file carries (`YYYY-MM-DD`); today when absent. */
|
|
43
|
+
date?: string;
|
|
44
|
+
}
|
|
45
|
+
/** One generated file: its project-relative, `/`-joined path and its content. */
|
|
46
|
+
export interface RenderedFile {
|
|
47
|
+
path: string;
|
|
48
|
+
content: string;
|
|
49
|
+
}
|
|
50
|
+
export interface RenderResult {
|
|
51
|
+
/** Every file the generator writes, in write order: the `.specs/` files, then the files outside. */
|
|
52
|
+
files: RenderedFile[];
|
|
53
|
+
/** The onboarding prompt `init` and `add-specs` print (the body of `development/onboarding.md`). */
|
|
54
|
+
onboardingPrompt: string;
|
|
55
|
+
}
|
|
56
|
+
/** The IDE choices that get an agent file instead of the settings pair. */
|
|
57
|
+
export declare const AGENT_IDES: Set<string>;
|
|
58
|
+
export declare function inferApiParadigm(framework?: string): 'rest' | 'cli' | 'graphql' | 'none';
|
|
59
|
+
/**
|
|
60
|
+
* The optional fields of `options` that are present (REQ-002.I.4): a blank string, an empty list, a
|
|
61
|
+
* list of blanks, an empty map or a map whose lists are all empty is absent, so a template `{{#if}}`
|
|
62
|
+
* on the field is the one rule.
|
|
63
|
+
*/
|
|
64
|
+
export declare function presentFields(options: OptionalFields): OptionalFields;
|
|
65
|
+
/** The template context `generateSpecs()` built until BL-032, with the date passed in and the present optional fields. */
|
|
66
|
+
export declare function toContext(options: RenderOptions): TemplateContext;
|
|
67
|
+
/** The project-relative files under the specs folder for an API paradigm, in write order (BL-PM-004). */
|
|
68
|
+
export declare function targetsInSpecs(apiParadigm: string, specsName?: string): string[];
|
|
69
|
+
/** The project-relative files outside the specs folder for an IDE choice, in write order (BL-055). */
|
|
70
|
+
export declare function targetsOutsideSpecs(ide?: string): string[];
|
|
71
|
+
/** Renders every file for `options` without writing anything. */
|
|
72
|
+
export declare function render(options: RenderOptions): RenderResult;
|
|
73
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/core/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAA2B,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAU7G,4FAA4F;AAC5F,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;IAClD,cAAc,CAAC,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACzE,KAAK,EAAE;YACL,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,SAAS,EAAE,MAAM,EAAE,CAAC;Y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, "__esModule", { value: true });
|
|
3
|
+
exports.AGENT_IDES = void 0;
|
|
4
|
+
exports.inferApiParadigm = inferApiParadigm;
|
|
5
|
+
exports.presentFields = presentFields;
|
|
6
|
+
exports.toContext = toContext;
|
|
7
|
+
exports.targetsInSpecs = targetsInSpecs;
|
|
8
|
+
exports.targetsOutsideSpecs = targetsOutsideSpecs;
|
|
9
|
+
exports.render = render;
|
|
10
|
+
const templateEngine_1 = require("./templateEngine");
|
|
11
|
+
const specFiles_1 = require("./specFiles");
|
|
12
|
+
const ideConfig_1 = require("./ideConfig");
|
|
13
|
+
const agentConfig_1 = require("./agentConfig");
|
|
14
|
+
const slashCommands_1 = require("./slashCommands");
|
|
15
|
+
/** The IDE choices that get an agent file instead of the settings pair. */
|
|
16
|
+
exports.AGENT_IDES = new Set(['claude-code', 'codex']);
|
|
17
|
+
const REST_FRAMEWORKS = new Set(['express', 'fastapi', 'django', 'flask', 'next', 'nest', 'spring', 'ktor', 'vapor']);
|
|
18
|
+
const NO_API_FRAMEWORKS = new Set(['react', 'vue', 'angular', 'android', 'ios', 'swiftui', 'compose', 'streamlit']);
|
|
19
|
+
function inferApiParadigm(framework) {
|
|
20
|
+
if (!framework)
|
|
21
|
+
return 'rest';
|
|
22
|
+
const f = framework.toLowerCase();
|
|
23
|
+
if (REST_FRAMEWORKS.has(f))
|
|
24
|
+
return 'rest';
|
|
25
|
+
if (NO_API_FRAMEWORKS.has(f))
|
|
26
|
+
return 'none';
|
|
27
|
+
return 'rest';
|
|
28
|
+
}
|
|
29
|
+
const today = () => new Date().toISOString().split('T')[0];
|
|
30
|
+
/**
|
|
31
|
+
* The optional fields of `options` that are present (REQ-002.I.4): a blank string, an empty list, a
|
|
32
|
+
* list of blanks, an empty map or a map whose lists are all empty is absent, so a template `{{#if}}`
|
|
33
|
+
* on the field is the one rule.
|
|
34
|
+
*/
|
|
35
|
+
function presentFields(options) {
|
|
36
|
+
const out = {};
|
|
37
|
+
for (const key of templateEngine_1.OPTIONAL_FIELDS) {
|
|
38
|
+
let value = options[key];
|
|
39
|
+
if (Array.isArray(value))
|
|
40
|
+
value = value.filter(item => typeof item === 'string' && item.trim() !== '');
|
|
41
|
+
else if (value && typeof value === 'object') {
|
|
42
|
+
value = Object.fromEntries(Object.entries(value)
|
|
43
|
+
.map(([k, v]) => [k, Array.isArray(v) ? v.filter(item => typeof item === 'string' && item.trim() !== '') : []])
|
|
44
|
+
.filter(([, v]) => v.length > 0));
|
|
45
|
+
}
|
|
46
|
+
if ((0, templateEngine_1.present)(value))
|
|
47
|
+
out[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
/** The template context `generateSpecs()` built until BL-032, with the date passed in and the present optional fields. */
|
|
52
|
+
function toContext(options) {
|
|
53
|
+
return {
|
|
54
|
+
...presentFields(options),
|
|
55
|
+
projectName: options.projectName,
|
|
56
|
+
language: options.language,
|
|
57
|
+
framework: options.framework,
|
|
58
|
+
author: options.author || 'Your Name',
|
|
59
|
+
description: options.description || ('A ' + options.language + ' project' + (options.framework ? ' using ' + options.framework : '')),
|
|
60
|
+
lastUpdated: options.date ?? today(),
|
|
61
|
+
contributors: [options.author || 'Your Name'],
|
|
62
|
+
architecture: options.analysis && options.analysis.architecture,
|
|
63
|
+
ide: options.ide || 'vscode',
|
|
64
|
+
mode: options.mode || 'new',
|
|
65
|
+
projectType: options.projectType ?? (options.mode === 'existing' ? 'brownfield' : 'greenfield'),
|
|
66
|
+
apiParadigm: options.apiParadigm ?? inferApiParadigm(options.framework),
|
|
67
|
+
projectContext: options.projectContext,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** The project-relative files under the specs folder for an API paradigm, in write order (BL-PM-004). */
|
|
71
|
+
function targetsInSpecs(apiParadigm, specsName = '.specs') {
|
|
72
|
+
return (0, specFiles_1.specTargets)(apiParadigm).map(rel => `${specsName}/${rel}`);
|
|
73
|
+
}
|
|
74
|
+
/** The project-relative files outside the specs folder for an IDE choice, in write order (BL-055). */
|
|
75
|
+
function targetsOutsideSpecs(ide = 'vscode') {
|
|
76
|
+
const key = ide.toLowerCase();
|
|
77
|
+
return [...(exports.AGENT_IDES.has(key) ? (0, agentConfig_1.agentTargets)(key) : (0, ideConfig_1.settingsTargets)(key)), (0, ideConfig_1.aiContextTarget)(key), ...(0, slashCommands_1.commandFiles)(key).map(f => f.path), ideConfig_1.GITATTRIBUTES_FILE];
|
|
78
|
+
}
|
|
79
|
+
/** Renders every file for `options` without writing anything. */
|
|
80
|
+
function render(options) {
|
|
81
|
+
const engine = new templateEngine_1.TemplateEngine();
|
|
82
|
+
const context = toContext(options);
|
|
83
|
+
const ide = options.ide || 'vscode';
|
|
84
|
+
const key = ide.toLowerCase();
|
|
85
|
+
const { files, onboardingPrompt } = (0, specFiles_1.renderSpecFiles)(engine, context, options.specsName ?? '.specs');
|
|
86
|
+
if (exports.AGENT_IDES.has(key)) {
|
|
87
|
+
const agent = (0, agentConfig_1.agentFile)(engine, context, key);
|
|
88
|
+
if (agent)
|
|
89
|
+
files.push(agent);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
files.push(...(0, ideConfig_1.settingsFiles)(context, ide));
|
|
93
|
+
}
|
|
94
|
+
files.push((0, ideConfig_1.aiContextFile)(context, key));
|
|
95
|
+
files.push(...(0, slashCommands_1.commandFiles)(key));
|
|
96
|
+
files.push({ path: ideConfig_1.GITATTRIBUTES_FILE, content: (0, ideConfig_1.gitAttributesContent)() });
|
|
97
|
+
return { files, onboardingPrompt };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/core/render.ts"],"names":[],"mappings":";;;AAoEA,4CAMC;AASD,sCAeC;AAGD,8BAiBC;AAGD,wCAEC;AAGD,kDAGC;AAGD,wBAgBC;AApJD,qDAA6G;AAC7G,2CAA2D;AAC3D,2CAAuI;AACvI,+CAAwD;AAC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|
|
6
|
+
allowedTools?: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Commands to generate. Populated one command at a time by CS-080 through
|
|
10
|
+
* CS-087.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SLASH_COMMANDS: SlashCommand[];
|
|
13
|
+
/** The command files for an IDE, project-relative, in command order (BL-055). */
|
|
14
|
+
export declare function commandFiles(ide: string, commands?: SlashCommand[]): {
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
}[];
|
|
18
|
+
export declare function resolveTarget(ide: string, command: SlashCommand): {
|
|
19
|
+
dir: string;
|
|
20
|
+
fileName: string;
|
|
21
|
+
content: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=slashCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slashCommands.d.ts","sourceRoot":"","sources":["../../src/core/slashCommands.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,EAwdxC,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,YAAY,EAAmB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAMxH;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgBlH"}
|