specpilot 2.0.1 → 2.2.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.
@@ -0,0 +1,443 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlashCommandGenerator = exports.SLASH_COMMANDS = void 0;
4
+ const path_1 = require("path");
5
+ const fs_1 = require("fs");
6
+ /**
7
+ * Commands to generate. Populated one command at a time by CS-080 through
8
+ * CS-087.
9
+ */
10
+ exports.SLASH_COMMANDS = [
11
+ {
12
+ name: 'status',
13
+ description: 'Show current sprint status and next milestone at a glance',
14
+ body: `Give a one-screen status summary of the current sprint.
15
+
16
+ 1. Read \`.specs/planning/tasks.md\` and extract the \`## Current Sprint\` section — list each item's ID and a short (<15 word) restatement.
17
+ 2. Read \`.specs/planning/roadmap.md\` and find the \`## Milestones\` section — identify the next incomplete milestone.
18
+ 3. Present a compact summary with two headings:
19
+ - **Current Sprint**: bullet list of \`[CS-###] [BL-###]\` items with their short restatement.
20
+ - **Next Milestone**: the next unchecked milestone from roadmap.md.
21
+
22
+ Keep it to one screen — do not re-print full task descriptions, just IDs and short summaries.`,
23
+ },
24
+ {
25
+ name: 'reanchor',
26
+ description: 'Restore full project context after losing it mid-session',
27
+ body: `Restore operating context for this project.
28
+
29
+ 1. Read \`.specs/project/project.yaml\` in full.
30
+ 2. Read the \`## Re-Anchor Prompt\` section of \`.specs/development/prompts.md\` verbatim.
31
+ 3. Restate both as your current operating context for the rest of this session — project identity, stack, rules, and the Re-Anchor Prompt's guidance.
32
+
33
+ Do not summarize or paraphrase away detail; this command exists specifically to recover full context, not an abbreviated version of it.`,
34
+ },
35
+ {
36
+ name: 'report',
37
+ description: 'Run the Spec-First review gate: classify the change, update specs, then wait for confirmation before coding',
38
+ body: `Formalize the Spec-First review gate (mandate 8) for the pending change.
39
+
40
+ 1. Classify the pending change as trivial, feature, or architectural:
41
+ - Trivial: no spec update required.
42
+ - Feature: touches \`project/requirements.md\` and \`planning/tasks.md\`.
43
+ - Architectural: touches all affected spec files plus \`CHANGELOG.md\`.
44
+ 2. Read the relevant \`.specs/\` files per the Context routing table (session start → \`project/project.yaml\`; feature/bug → + \`project/requirements.md\`, \`planning/tasks.md\`; architecture → + \`architecture/architecture.md\`; tests → + \`quality/tests.md\`; security → + \`security/threat-model.md\`, \`security/security-decisions.md\`; planning → + \`planning/tasks.md\`, \`planning/roadmap.md\`).
45
+ 3. Update the affected spec files first — before writing any code.
46
+ 4. Present a Spec Report: classification, files touched, what changed in each, and what the specs now say.
47
+ 5. Wait for the user's literal \`yes, proceed\` before writing or editing any code or non-spec file. An ambiguous "ok" or "sure" is not sufficient for an architectural-tier change — ask for the explicit phrase if it wasn't given.`,
48
+ },
49
+ {
50
+ name: 'sync',
51
+ description: 'Compare .specs/ against actual project state and propose fixes for drift',
52
+ body: `Find and fix drift between \`.specs/\` and the real project.
53
+
54
+ 1. Read \`.specs/architecture/architecture.md\`, \`.specs/project/requirements.md\`, and \`.specs/quality/tests.md\`.
55
+ 2. Compare their claims against the actual \`src/\` structure and \`package.json\` (versions, dependencies, scripts).
56
+ 3. List concrete discrepancies: stale version numbers, renamed or removed files/modules still referenced, undocumented modules that exist in \`src/\` but aren't mentioned in the specs, stale command or test-suite lists.
57
+ 4. Propose specific per-file edits to close each discrepancy — do not just describe the problem, show the fix.
58
+ 5. Wait for the user's confirmation before writing any of the proposed edits.
59
+
60
+ This is a judgment/comparison task, not a mechanical one — do not attempt to script the diff; read and reason about each file.`,
61
+ },
62
+ {
63
+ name: 'refine',
64
+ description: 'Refine .specs/ requirements from a new requirement description, with a diff preview before writing',
65
+ argumentHint: '<description>',
66
+ body: `Refine the project's spec files with a new requirement.
67
+
68
+ Requirement description: $ARGUMENTS
69
+
70
+ 1. Read the current \`.specs/project/requirements.md\`, \`.specs/development/context.md\`, and \`.specs/development/prompts.md\`.
71
+ 2. Propose specific additions or edits to those files that incorporate the requirement description above, following the existing stable-ID conventions (e.g. \`REQ-###.#\`).
72
+ 3. Show a line-level diff preview of every proposed change — do not just describe it.
73
+ 4. Wait for the user's confirmation before writing anything.
74
+ 5. Once confirmed, write the changes.
75
+
76
+ This mirrors the CLI's \`specpilot refine\` (REQ-002.A.6) as a standalone agent workflow — it has no dependency on the CLI being installed.`,
77
+ },
78
+ {
79
+ name: 'validate',
80
+ description: 'Validate .specs/ structure, front-matter, and cross-references; suggest fixes without auto-applying',
81
+ allowedTools: ['Bash', 'Read'],
82
+ body: `Validate the project's \`.specs/\` files. Run the script below, then summarize the results in plain language.
83
+
84
+ \`\`\`bash
85
+ cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
86
+
87
+ REQUIRED_FILES=(
88
+ ".specs/project/project.yaml"
89
+ ".specs/architecture/architecture.md"
90
+ ".specs/project/requirements.md"
91
+ ".specs/architecture/api.yaml"
92
+ ".specs/quality/tests.md"
93
+ ".specs/planning/tasks.md"
94
+ ".specs/development/context.md"
95
+ ".specs/development/prompts.md"
96
+ ".specs/security/threat-model.md"
97
+ ".specs/security/security-decisions.md"
98
+ )
99
+
100
+ echo "== Missing required files =="
101
+ missing=0
102
+ for f in "\${REQUIRED_FILES[@]}"; do
103
+ if [ ! -f "$f" ]; then echo "MISSING: $f"; missing=1; fi
104
+ done
105
+ [ "$missing" -eq 0 ] && echo "none"
106
+
107
+ echo
108
+ echo "== Front-matter field checks (fileID, lastUpdated, version, contributors, relatedFiles) =="
109
+ clean=1
110
+ for f in "\${REQUIRED_FILES[@]}"; do
111
+ [[ "$f" == *.md ]] || continue
112
+ [ -f "$f" ] || continue
113
+ fm=$(sed -n '2,/^---$/p' "$f")
114
+ for field in fileID lastUpdated version contributors relatedFiles; do
115
+ if ! echo "$fm" | grep -q "^\${field}:"; then
116
+ echo "MISSING $field in $f"
117
+ clean=0
118
+ fi
119
+ done
120
+ done
121
+ [ "$clean" -eq 1 ] && echo "all fields present"
122
+
123
+ echo
124
+ echo "== relatedFiles cross-reference check =="
125
+ clean=1
126
+ for f in "\${REQUIRED_FILES[@]}"; do
127
+ [[ "$f" == *.md ]] || continue
128
+ [ -f "$f" ] || continue
129
+ refs=$(sed -n '2,/^---$/p' "$f" | sed -n '/^relatedFiles:/,/^[a-zA-Z]/p' | grep -oE '[A-Za-z0-9_.-]+\\.(md|yaml)')
130
+ for ref in $refs; do
131
+ if ! find .specs -name "$ref" | grep -q .; then
132
+ echo "BROKEN REF in $f -> $ref (not found anywhere under .specs/)"
133
+ clean=0
134
+ fi
135
+ done
136
+ done
137
+ [ "$clean" -eq 1 ] && echo "all cross-references resolve"
138
+ \`\`\`
139
+
140
+ Never eyeball line counts or fingerprints by hand where this script already computes them exactly.
141
+
142
+ After running it:
143
+ 1. Summarize each of the three sections in plain language (what's missing, what's wrong, what's broken).
144
+ 2. For every issue found, suggest a specific fix — but never apply it automatically. Wait for the user to ask before editing any file.
145
+ 3. If everything passes, say so plainly; do not manufacture issues.
146
+
147
+ **Known platform limitation**: GitHub Copilot only executes terminal commands in "agent mode." Outside agent mode, this command degrades to prose-only — read the files yourself and reason about the same three checks without the script, which carries a higher error rate than the scripted version.`,
148
+ },
149
+ {
150
+ name: 'archive',
151
+ description: 'Archive oversized .specs/ files (tasks.md Completed section, prompts.md) with a branch safety guard',
152
+ allowedTools: ['Bash', 'Read', 'Edit'],
153
+ body: `Archive oversized \`.specs/\` files: \`.specs/planning/tasks.md\`'s \`## Completed\` section beyond 25 lines, and \`.specs/development/prompts.md\` beyond 100 total lines.
154
+
155
+ Run the script below — it computes thresholds and moves lines deterministically. Do not hand-count lines or decide what to move yourself; the script's arithmetic is the source of truth.
156
+
157
+ \`\`\`bash
158
+ cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
159
+
160
+ PROMPTS_LINE_LIMIT=100
161
+ PROMPTS_KEEP_LINES=80
162
+ COMPLETED_LINE_LIMIT=25
163
+ COMPLETED_KEEP_ENTRIES=20
164
+
165
+ branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
166
+ if [ -n "$branch" ] && [ "$branch" != "main" ] && [ "$branch" != "master" ]; then
167
+ echo "WARNING: on branch '$branch'. Archive is recommended only on the default branch after merging."
168
+ read -p "Continue? [y/N] " confirm
169
+ if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
170
+ echo "Archive cancelled."
171
+ exit 0
172
+ fi
173
+ fi
174
+
175
+ timestamp() { date -u +"%Y-%m-%d %H:%M:%S"; }
176
+
177
+ archive_prompts() {
178
+ local file=".specs/development/prompts.md"
179
+ local archive=".specs/development/prompts-archive.md"
180
+ [ -f "$file" ] || return 0
181
+ local total
182
+ total=$(wc -l < "$file")
183
+ if [ "$total" -le "$PROMPTS_LINE_LIMIT" ]; then return 0; fi
184
+
185
+ local preamble_end=0
186
+ if [ "$(sed -n '1p' "$file")" = "---" ]; then
187
+ preamble_end=$(awk 'NR>1 && $0=="---" {print NR; exit}' "$file")
188
+ fi
189
+ local body_start=$((preamble_end + 1))
190
+ local body_lines=$((total - preamble_end))
191
+ local keep=$((PROMPTS_KEEP_LINES - preamble_end))
192
+ if [ "$keep" -lt 50 ]; then keep=50; fi
193
+ if [ "$body_lines" -le "$keep" ]; then return 0; fi
194
+
195
+ local archive_count=$((body_lines - keep))
196
+ local archive_end=$((body_start + archive_count - 1))
197
+
198
+ { echo "## Archived on $(timestamp)"; echo; sed -n "\${body_start},\${archive_end}p" "$file"; echo; echo "---"; echo; } >> "$archive"
199
+ { sed -n "1,\${preamble_end}p" "$file"; sed -n "$((archive_end + 1)),\\$p" "$file"; } > "$file.tmp"
200
+ mv "$file.tmp" "$file"
201
+ echo "Moved $archive_count lines from $file -> $archive"
202
+ }
203
+
204
+ archive_tasks() {
205
+ local file=".specs/planning/tasks.md"
206
+ local archive=".specs/planning/tasks-archive.md"
207
+ [ -f "$file" ] || return 0
208
+ local total
209
+ total=$(wc -l < "$file")
210
+ local completed_line
211
+ completed_line=$(grep -n '^## Completed$' "$file" | head -1 | cut -d: -f1)
212
+ [ -n "$completed_line" ] || return 0
213
+
214
+ local section_size=$((total - completed_line + 1))
215
+ if [ "$section_size" -le "$COMPLETED_LINE_LIMIT" ]; then return 0; fi
216
+
217
+ local entry_start=$((completed_line + 1))
218
+ while [ "$entry_start" -le "$total" ] && ! sed -n "\${entry_start}p" "$file" | grep -qE '^[0-9]+\\.'; do
219
+ entry_start=$((entry_start + 1))
220
+ done
221
+ if [ "$entry_start" -gt "$total" ]; then return 0; fi
222
+
223
+ local entry_count=$((total - entry_start + 1))
224
+ if [ "$entry_count" -le "$COMPLETED_KEEP_ENTRIES" ]; then return 0; fi
225
+
226
+ local archive_count=$((entry_count - COMPLETED_KEEP_ENTRIES))
227
+ local archive_end=$((entry_start + archive_count - 1))
228
+
229
+ { echo "## Archived on $(timestamp)"; echo; sed -n "\${entry_start},\${archive_end}p" "$file"; echo; echo "---"; echo; } >> "$archive"
230
+ { sed -n "1,$((entry_start - 1))p" "$file"; sed -n "$((archive_end + 1)),\\$p" "$file"; } > "$file.tmp"
231
+ mv "$file.tmp" "$file"
232
+ echo "Moved $archive_count entries from $file -> $archive"
233
+ }
234
+
235
+ archive_prompts
236
+ archive_tasks
237
+ \`\`\`
238
+
239
+ After running it:
240
+ 1. Report what the script moved (file, line/entry count, archive destination) using its own output — do not recompute or second-guess the numbers.
241
+ 2. If nothing exceeded the threshold, say so plainly: "Nothing to archive."
242
+ 3. IDs are preserved automatically since content is moved verbatim into the archive file, never rewritten or renumbered.
243
+
244
+ This mirrors CLI \`specpilot archive --dry-run --force\` (REQ-002.A.8); the branch guard mirrors ARCH-004.19 (warns and requires \`y\` confirmation when not on \`main\`/\`master\`).`,
245
+ },
246
+ {
247
+ name: 'backfill',
248
+ description: 'Append missing mandate sections (Critical Mandates, Code Philosophy, Code Rules, Re-Anchor) to existing IDE files',
249
+ allowedTools: ['Bash', 'Read', 'Edit'],
250
+ body: `Backfill missing SpecPilot mandate sections into whichever IDE files already exist in this project. Run the script below — it checks four fingerprints per file and appends whichever are missing, append-only, never overwriting existing content.
251
+
252
+ \`\`\`bash
253
+ cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
254
+
255
+ CANDIDATE_FILES=(
256
+ ".github/copilot-instructions.md"
257
+ "CLAUDE.md"
258
+ ".cursor/rules/specpilot.mdc"
259
+ ".windsurfrules"
260
+ ".antigravity/rules.md"
261
+ )
262
+
263
+ has_critical() { grep -qF "Critical Mandates" "$1"; }
264
+ has_philosophy() { grep -qF "## Code Philosophy — Write Only What Needed" "$1"; }
265
+ has_rules() { grep -qF "## Code Rules" "$1"; }
266
+ has_reanchor() { grep -qF "## Re-Anchor" "$1"; }
267
+
268
+ append_critical() {
269
+ cat <<'BLOCK' >> "$1"
270
+
271
+ ## 🔴 Critical Mandates — Never violate, no exceptions
272
+
273
+ 1. No commit unless asked.
274
+ 2. No push unless asked.
275
+ 3. No deploy/publish/release unless asked.
276
+ 4. No \`.specs/\` structure changes — content only.
277
+ 5. Update specs after change:
278
+ - Trivial → \`planning/tasks.md\`
279
+ - Feature → \`project/requirements.md\` + \`planning/tasks.md\`
280
+ - Architectural → all affected files + \`CHANGELOG.md\`
281
+ 6. Never reference file contents without reading first. If unread, say so.
282
+ 7. Never write code or change files unless asked. Ask first.
283
+ 8. Spec-first gate (scale to task size):
284
+ - Trivial → no gate
285
+ - Feature → read 1–2 relevant \`.specs/\` files before coding
286
+ - Architectural → update all affected specs, present Spec Report, wait for \`yes, proceed\`
287
+ BLOCK
288
+ }
289
+
290
+ append_philosophy() {
291
+ cat <<'BLOCK' >> "$1"
292
+
293
+ ## Code Philosophy — Write Only What Needed
294
+
295
+ 1. Need exist? No → skip. Say why.
296
+ 2. Already in codebase? → reuse. Not rewrite.
297
+ 3. Stdlib do it? → use it.
298
+ 4. Native or installed dep cover it? → use. No new deps.
299
+ 5. One line do it? → write that.
300
+ 6. Only then: minimum code that work.
301
+ 7. Never cut: validation, error handling, security, explicit requirement.
302
+ BLOCK
303
+ }
304
+
305
+ append_rules() {
306
+ cat <<'BLOCK' >> "$1"
307
+
308
+ ## Code Rules
309
+
310
+ 1. No abstraction, interface, factory, or pattern unless asked.
311
+ 2. No scaffold "for later". Later scaffold itself.
312
+ 3. Delete before add.
313
+ 4. Shortest correct diff win.
314
+ 5. Fix cause, not symptom. One guard in shared function beat guard in every caller.
315
+ 6. Boring over clever. Clever = 3am bug.
316
+ 7. Read before write. Never reference code you haven't read.
317
+ BLOCK
318
+ }
319
+
320
+ append_reanchor() {
321
+ cat <<'BLOCK' >> "$1"
322
+
323
+ ## Re-Anchor
324
+
325
+ If you lose context mid-session, read \`.specs/project/project.yaml\` to restore full project context.
326
+ For a ready-made re-anchor prompt, see \`.specs/development/prompts.md → ## Re-Anchor Prompt\`.
327
+ BLOCK
328
+ }
329
+
330
+ for f in "\${CANDIDATE_FILES[@]}"; do
331
+ if [ ! -f "$f" ]; then
332
+ echo "SKIPPED (not found): $f"
333
+ continue
334
+ fi
335
+
336
+ added=()
337
+ has_critical "$f" || { append_critical "$f"; added+=("Critical Mandates"); }
338
+ has_philosophy "$f" || { append_philosophy "$f"; added+=("Code Philosophy"); }
339
+ has_rules "$f" || { append_rules "$f"; added+=("Code Rules"); }
340
+ has_reanchor "$f" || { append_reanchor "$f"; added+=("Re-Anchor"); }
341
+
342
+ if [ \${#added[@]} -eq 0 ]; then
343
+ echo "ALREADY CURRENT: $f"
344
+ else
345
+ echo "UPDATED: $f (added: \${added[*]})"
346
+ fi
347
+ done
348
+
349
+ echo
350
+ echo "== team.devPrefix check =="
351
+ YAML=".specs/project/project.yaml"
352
+ if [ -f "$YAML" ] && ! grep -q "devPrefix:" "$YAML"; then
353
+ echo "MISSING: team.devPrefix in $YAML — ask the user for a short handle (e.g. GitHub username) and add it under a team: section."
354
+ fi
355
+ \`\`\`
356
+
357
+ After running it:
358
+ 1. Report per file: updated (with which sections were added), already-current, or skipped (file not found).
359
+ 2. If the devPrefix check printed a missing-handle line, ask the user for a short handle (their GitHub/GitLab/Bitbucket username or any short tag) and add it under a \`team:\` section in \`project.yaml\` yourself — the script only detects the gap, it does not prompt interactively.
360
+ 3. Never overwrite existing content in any file; every append goes to the end of the file.
361
+
362
+ **Maintenance cost**: unlike the CLI's \`specBackfiller.ts\`, this command has no shared source-of-truth constant to import — its four fingerprint blocks above are a literal copy and must be manually kept in sync whenever \`CLAUDE.md\`/\`copilot-instructions.md\` generation changes (\`buildCriticalMandatesMarkdown()\`, \`buildCodePhilosophyMarkdown()\` in \`ideConfigGenerator.ts\`). If this command's output ever looks stale, check those functions first.`,
363
+ },
364
+ ];
365
+ /**
366
+ * Generates per-IDE slash/workflow command files from SLASH_COMMANDS.
367
+ * Parallel to IdeConfigGenerator — each IDE gets its own directory, file
368
+ * naming, and frontmatter format for the same shared command definitions.
369
+ */
370
+ class SlashCommandGenerator {
371
+ generate(projectDir, ide, commands = exports.SLASH_COMMANDS) {
372
+ if (commands.length === 0)
373
+ return;
374
+ const key = ide.toLowerCase();
375
+ for (const command of commands) {
376
+ const target = this.resolveTarget(key, command);
377
+ this.write(projectDir, target.dir, target.fileName, target.content);
378
+ }
379
+ if (key === 'codex') {
380
+ console.log('⚠️ SpecPilot slash commands were written to .codex/prompts/ for reference.\n' +
381
+ ' Codex only auto-discovers prompts from ~/.codex/prompts/ — copy them there manually:\n' +
382
+ ' cp .codex/prompts/specpilot-*.md ~/.codex/prompts/');
383
+ }
384
+ }
385
+ /**
386
+ * Writes only the command files missing on disk for the given IDE —
387
+ * used by `specpilot backfill` for existing projects. Never overwrites.
388
+ * Returns the names of the commands that were (or, in dry-run, would be) added.
389
+ */
390
+ backfillMissing(projectDir, ide, dryRun, commands = exports.SLASH_COMMANDS) {
391
+ const key = ide.toLowerCase();
392
+ const added = [];
393
+ for (const command of commands) {
394
+ const target = this.resolveTarget(key, command);
395
+ const filePath = (0, path_1.join)(projectDir, ...target.dir.split('/'), target.fileName);
396
+ if ((0, fs_1.existsSync)(filePath))
397
+ continue;
398
+ added.push(command.name);
399
+ if (!dryRun) {
400
+ this.write(projectDir, target.dir, target.fileName, target.content);
401
+ }
402
+ }
403
+ return added;
404
+ }
405
+ resolveTarget(ide, command) {
406
+ switch (ide) {
407
+ case 'claude-code':
408
+ return { dir: '.claude/commands', fileName: `specpilot-${command.name}.md`, content: this.claudeFrontmatter(command) + command.body };
409
+ case 'cursor':
410
+ return { dir: '.cursor/commands', fileName: `specpilot-${command.name}.md`, content: this.simpleFrontmatter(command) + command.body };
411
+ case 'windsurf':
412
+ return { dir: '.windsurf/workflows', fileName: `specpilot-${command.name}.md`, content: this.simpleFrontmatter(command) + command.body };
413
+ case 'antigravity':
414
+ return { dir: '.agent/workflows', fileName: `specpilot-${command.name}.md`, content: this.simpleFrontmatter(command) + command.body };
415
+ case 'codex':
416
+ return { dir: '.codex/prompts', fileName: `specpilot-${command.name}.md`, content: this.simpleFrontmatter(command) + command.body };
417
+ default:
418
+ // vscode and unknown IDEs → GitHub Copilot prompt files
419
+ return { dir: '.github/prompts', fileName: `specpilot-${command.name}.prompt.md`, content: this.copilotFrontmatter(command) + command.body };
420
+ }
421
+ }
422
+ write(projectDir, dir, fileName, content) {
423
+ const fullDir = (0, path_1.join)(projectDir, ...dir.split('/'));
424
+ (0, fs_1.mkdirSync)(fullDir, { recursive: true });
425
+ (0, fs_1.writeFileSync)((0, path_1.join)(fullDir, fileName), content);
426
+ }
427
+ claudeFrontmatter(command) {
428
+ const lines = [`description: ${command.description}`];
429
+ if (command.argumentHint)
430
+ lines.push(`argument-hint: ${command.argumentHint}`);
431
+ if (command.allowedTools)
432
+ lines.push(`allowed-tools: ${command.allowedTools.join(', ')}`);
433
+ return `---\n${lines.join('\n')}\n---\n\n`;
434
+ }
435
+ simpleFrontmatter(command) {
436
+ return `---\ndescription: ${command.description}\n---\n\n`;
437
+ }
438
+ copilotFrontmatter(command) {
439
+ return `---\nmode: agent\ndescription: ${command.description}\n---\n\n`;
440
+ }
441
+ }
442
+ exports.SlashCommandGenerator = SlashCommandGenerator;
443
+ //# sourceMappingURL=slashCommandGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slashCommandGenerator.js","sourceRoot":"","sources":["../../src/utils/slashCommandGenerator.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,2BAA0D;AAW1D;;;GAGG;AACU,QAAA,cAAc,GAAmB;IAC5C;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE;;;;;;;;8FAQoF;KAC3F;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,0DAA0D;QACvE,IAAI,EAAE;;;;;;wIAM8H;KACrI;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,6GAA6G;QAC1H,IAAI,EAAE;;;;;;;;;sOAS4N;KACnO;IACD;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,0EAA0E;QACvF,IAAI,EAAE;;;;;;;;+HAQqH;KAC5H;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,oGAAoG;QACjH,YAAY,EAAE,eAAe;QAC7B,IAAI,EAAE;;;;;;;;;;4IAUkI;KACzI;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,qGAAqG;QAClH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QAC9B,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ySAiE+R;KACtS;IACD;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,qGAAqG;QAClH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACtC,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sLA2F4K;KACnL;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,mHAAmH;QAChI,YAAY,EAAE,CAAC,MAAM,EAAE,MAA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AC7C,OAAO,qBAAqB,OAAO,CAAC,WAAW,WAAW,CAAC;IAC7D,CAAC;IAEO,kBAAkB,CAAC,OAAqB;QAC9C,OAAO,kCAAkC,OAAO,CAAC,WAAW,WAAW,CAAC;IAC1E,CAAC;CACF;AAlFD,sDAkFC"}
@@ -7,20 +7,33 @@ export interface BackfillFileResult {
7
7
  }
8
8
  export interface IdeFileBackfillResult {
9
9
  path: string;
10
- action: 'updated' | 'created' | 'skipped' | 'missing' | 'stale';
10
+ action: 'updated' | 'created' | 'skipped' | 'missing' | 'stale' | 'warn';
11
11
  found: number;
12
12
  total: number;
13
13
  added: string[];
14
14
  reason?: string;
15
15
  }
16
+ export interface SlashCommandBackfillResult {
17
+ ide: string;
18
+ signalFile: string;
19
+ added: string[];
20
+ }
16
21
  export interface BackfillResult {
17
22
  projectYaml: BackfillFileResult;
18
23
  copilotInstructions: BackfillFileResult;
19
24
  tasksMd: BackfillFileResult;
20
25
  ideFiles: IdeFileBackfillResult[];
26
+ slashCommands: SlashCommandBackfillResult[];
21
27
  }
22
28
  export declare class SpecBackfiller {
23
29
  backfill(projectDir: string, specsName: string, dryRun: boolean, noPrompts?: boolean): Promise<BackfillResult>;
30
+ /**
31
+ * Backfills missing `specpilot-*` slash command files for IDEs already in use —
32
+ * detected by the same signal file `backfillIdeFiles` checks for each IDE.
33
+ * Reuses `SlashCommandGenerator`'s per-IDE routing so CLI-side backfill and
34
+ * web-app-side generation (`slashCommandGenerator.ts`) never drift apart.
35
+ */
36
+ private backfillSlashCommands;
24
37
  private backfillProjectYaml;
25
38
  /**
26
39
  * Text-based (not yaml.dump) insertion — preserves comments, emoji, and formatting.
@@ -1 +1 @@
1
- {"version":3,"file":"specBackfiller.d.ts","sourceRoot":"","sources":["../../src/utils/specBackfiller.ts"],"names":[],"mappings":"AA4GA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACtD,KAAK,EAAE,MAA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