@thiagodiogo/pscode 2.3.0 → 2.4.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.
Files changed (31) hide show
  1. package/dist/core/init.d.ts +0 -2
  2. package/dist/core/init.js +7 -77
  3. package/dist/core/profile-sync-drift.js +1 -15
  4. package/dist/core/profiles.d.ts +1 -1
  5. package/dist/core/profiles.js +0 -13
  6. package/dist/core/shared/index.d.ts +1 -0
  7. package/dist/core/shared/index.js +1 -0
  8. package/dist/core/shared/prune-orphans.d.ts +39 -0
  9. package/dist/core/shared/prune-orphans.js +149 -0
  10. package/dist/core/shared/skill-generation.js +2 -14
  11. package/dist/core/shared/tool-detection.d.ts +2 -2
  12. package/dist/core/shared/tool-detection.js +1 -13
  13. package/dist/core/templates/skill-templates.d.ts +1 -7
  14. package/dist/core/templates/skill-templates.js +1 -7
  15. package/dist/core/templates/workflows/{archive-change.d.ts → complete-change.d.ts} +1 -1
  16. package/dist/core/templates/workflows/{archive-change.js → complete-change.js} +2 -2
  17. package/dist/core/update.d.ts +0 -20
  18. package/dist/core/update.js +29 -115
  19. package/package.json +1 -1
  20. package/dist/core/templates/workflows/bulk-archive-change.d.ts +0 -10
  21. package/dist/core/templates/workflows/bulk-archive-change.js +0 -491
  22. package/dist/core/templates/workflows/continue-change.d.ts +0 -10
  23. package/dist/core/templates/workflows/continue-change.js +0 -233
  24. package/dist/core/templates/workflows/ff-change.d.ts +0 -10
  25. package/dist/core/templates/workflows/ff-change.js +0 -199
  26. package/dist/core/templates/workflows/new-change.d.ts +0 -10
  27. package/dist/core/templates/workflows/new-change.js +0 -142
  28. package/dist/core/templates/workflows/onboard.d.ts +0 -10
  29. package/dist/core/templates/workflows/onboard.js +0 -606
  30. package/dist/core/templates/workflows/verify-change.d.ts +0 -10
  31. package/dist/core/templates/workflows/verify-change.js +0 -337
@@ -1,491 +0,0 @@
1
- export function getBulkArchiveChangeSkillTemplate() {
2
- return {
3
- name: 'pscode-bulk-archive-change',
4
- description: 'Archive multiple completed changes at once. Use when archiving several parallel changes.',
5
- instructions: `Archive multiple completed changes in a single operation.
6
-
7
- This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
8
-
9
- **Input**: None required (prompts for selection)
10
-
11
- **Steps**
12
-
13
- 1. **Get active changes**
14
-
15
- Run \`pscode list --json\` to get all active changes.
16
-
17
- If no active changes exist, inform user and stop.
18
-
19
- 2. **Prompt for change selection**
20
-
21
- Use **AskUserQuestion tool** with multi-select to let user choose changes:
22
- - Show each change with its schema
23
- - Include an option for "All changes"
24
- - Allow any number of selections (1+ works, 2+ is the typical use case)
25
-
26
- **IMPORTANT**: Do NOT auto-select. Always let the user choose.
27
-
28
- 3. **Batch validation - gather status for all selected changes**
29
-
30
- For each selected change, collect:
31
-
32
- a. **Artifact status** - Run \`pscode status --change "<name>" --json\`
33
- - Parse \`schemaName\`, \`artifacts\`, \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`
34
- - Note which artifacts are \`done\` vs other states
35
-
36
- If any selected change reports \`actionContext.mode: "workspace-planning"\`, explain that workspace bulk archive is not supported in this slice and STOP before syncing specs or moving changes. Do not fall back to repo-local paths or edit linked repos.
37
-
38
- b. **Task completion** - Read \`artifactPaths.tasks.existingOutputPaths\` from status JSON
39
- - Count \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
40
- - If no tasks file exists, note as "No tasks"
41
-
42
- c. **Delta specs** - Check \`artifactPaths.specs.existingOutputPaths\` from status JSON
43
- - List which capability specs exist
44
- - For each, extract requirement names (lines matching \`### Requirement: <name>\`)
45
-
46
- 4. **Detect spec conflicts**
47
-
48
- Build a map of \`capability -> [changes that touch it]\`:
49
-
50
- \`\`\`
51
- auth -> [change-a, change-b] <- CONFLICT (2+ changes)
52
- api -> [change-c] <- OK (only 1 change)
53
- \`\`\`
54
-
55
- A conflict exists when 2+ selected changes have delta specs for the same capability.
56
-
57
- 5. **Resolve conflicts agentically**
58
-
59
- **For each conflict**, investigate the codebase:
60
-
61
- a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
62
-
63
- b. **Search the codebase** for implementation evidence:
64
- - Look for code implementing requirements from each delta spec
65
- - Check for related files, functions, or tests
66
-
67
- c. **Determine resolution**:
68
- - If only one change is actually implemented -> sync that one's specs
69
- - If both implemented -> apply in chronological order (older first, newer overwrites)
70
- - If neither implemented -> skip spec sync, warn user
71
-
72
- d. **Record resolution** for each conflict:
73
- - Which change's specs to apply
74
- - In what order (if both)
75
- - Rationale (what was found in codebase)
76
-
77
- 6. **Show consolidated status table**
78
-
79
- Display a table summarizing all changes:
80
-
81
- \`\`\`
82
- | Change | Artifacts | Tasks | Specs | Conflicts | Status |
83
- |---------------------|-----------|-------|---------|-----------|--------|
84
- | schema-management | Done | 5/5 | 2 delta | None | Ready |
85
- | project-config | Done | 3/3 | 1 delta | None | Ready |
86
- | add-oauth | Done | 4/4 | 1 delta | auth (!) | Ready* |
87
- | add-verify-skill | 1 left | 2/5 | None | None | Warn |
88
- \`\`\`
89
-
90
- For conflicts, show the resolution:
91
- \`\`\`
92
- * Conflict resolution:
93
- - auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
94
- \`\`\`
95
-
96
- For incomplete changes, show warnings:
97
- \`\`\`
98
- Warnings:
99
- - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
100
- \`\`\`
101
-
102
- 7. **Confirm batch operation**
103
-
104
- Use **AskUserQuestion tool** with a single confirmation:
105
-
106
- - "Archive N changes?" with options based on status
107
- - Options might include:
108
- - "Archive all N changes"
109
- - "Archive only N ready changes (skip incomplete)"
110
- - "Cancel"
111
-
112
- If there are incomplete changes, make clear they'll be archived with warnings.
113
-
114
- 8. **Execute archive for each confirmed change**
115
-
116
- Process changes in the determined order (respecting conflict resolution):
117
-
118
- a. **Sync specs** if delta specs exist:
119
- - Use the pscode-sync-specs approach (agent-driven intelligent merge)
120
- - For conflicts, apply in resolved order
121
- - Track if sync was done
122
-
123
- b. **Perform the archive**:
124
- \`\`\`bash
125
- mkdir -p "<planningHome.changesDir>/archive"
126
- mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
127
- \`\`\`
128
-
129
- c. **Track outcome** for each change:
130
- - Success: archived successfully
131
- - Failed: error during archive (record error)
132
- - Skipped: user chose not to archive (if applicable)
133
-
134
- 9. **Display summary**
135
-
136
- Show final results:
137
-
138
- \`\`\`
139
- ## Bulk Archive Complete
140
-
141
- Archived 3 changes:
142
- - schema-management-cli -> archive/2026-01-19-schema-management-cli/
143
- - project-config -> archive/2026-01-19-project-config/
144
- - add-oauth -> archive/2026-01-19-add-oauth/
145
-
146
- Skipped 1 change:
147
- - add-verify-skill (user chose not to archive incomplete)
148
-
149
- Spec sync summary:
150
- - 4 delta specs synced to main specs
151
- - 1 conflict resolved (auth: applied both in chronological order)
152
- \`\`\`
153
-
154
- If any failures:
155
- \`\`\`
156
- Failed 1 change:
157
- - some-change: Archive directory already exists
158
- \`\`\`
159
-
160
- **Conflict Resolution Examples**
161
-
162
- Example 1: Only one implemented
163
- \`\`\`
164
- Conflict: specs/auth/spec.md touched by [add-oauth, add-jwt]
165
-
166
- Checking add-oauth:
167
- - Delta adds "OAuth Provider Integration" requirement
168
- - Searching codebase... found src/auth/oauth.ts implementing OAuth flow
169
-
170
- Checking add-jwt:
171
- - Delta adds "JWT Token Handling" requirement
172
- - Searching codebase... no JWT implementation found
173
-
174
- Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
175
- \`\`\`
176
-
177
- Example 2: Both implemented
178
- \`\`\`
179
- Conflict: specs/api/spec.md touched by [add-rest-api, add-graphql]
180
-
181
- Checking add-rest-api (created 2026-01-10):
182
- - Delta adds "REST Endpoints" requirement
183
- - Searching codebase... found src/api/rest.ts
184
-
185
- Checking add-graphql (created 2026-01-15):
186
- - Delta adds "GraphQL Schema" requirement
187
- - Searching codebase... found src/api/graphql.ts
188
-
189
- Resolution: Both implemented. Will apply add-rest-api specs first,
190
- then add-graphql specs (chronological order, newer takes precedence).
191
- \`\`\`
192
-
193
- **Output On Success**
194
-
195
- \`\`\`
196
- ## Bulk Archive Complete
197
-
198
- Archived N changes:
199
- - <change-1> -> archive/YYYY-MM-DD-<change-1>/
200
- - <change-2> -> archive/YYYY-MM-DD-<change-2>/
201
-
202
- Spec sync summary:
203
- - N delta specs synced to main specs
204
- - No conflicts (or: M conflicts resolved)
205
- \`\`\`
206
-
207
- **Output On Partial Success**
208
-
209
- \`\`\`
210
- ## Bulk Archive Complete (partial)
211
-
212
- Archived N changes:
213
- - <change-1> -> archive/YYYY-MM-DD-<change-1>/
214
-
215
- Skipped M changes:
216
- - <change-2> (user chose not to archive incomplete)
217
-
218
- Failed K changes:
219
- - <change-3>: Archive directory already exists
220
- \`\`\`
221
-
222
- **Output When No Changes**
223
-
224
- \`\`\`
225
- ## No Changes to Archive
226
-
227
- No active changes found. Create a new change to get started.
228
- \`\`\`
229
-
230
- **Guardrails**
231
- - Allow any number of changes (1+ is fine, 2+ is the typical use case)
232
- - Always prompt for selection, never auto-select
233
- - Detect spec conflicts early and resolve by checking codebase
234
- - When both changes are implemented, apply specs in chronological order
235
- - Skip spec sync only when implementation is missing (warn user)
236
- - Show clear per-change status before confirming
237
- - Use single confirmation for entire batch
238
- - Track and report all outcomes (success/skip/fail)
239
- - Preserve .pscode.yaml when moving to archive
240
- - Archive directory target uses current date: YYYY-MM-DD-<name>
241
- - If archive target exists, fail that change but continue with others`,
242
- compatibility: 'Requires pscode CLI.',
243
- metadata: { author: 'pscode', version: '1.0' },
244
- };
245
- }
246
- export function getPsBulkArchiveCommandTemplate() {
247
- return {
248
- name: 'PS: Bulk Archive',
249
- description: 'Archive multiple completed changes at once',
250
- category: 'Workflow',
251
- tags: ['workflow', 'archive', 'experimental', 'bulk'],
252
- content: `Archive multiple completed changes in a single operation.
253
-
254
- This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
255
-
256
- **Input**: None required (prompts for selection)
257
-
258
- **Steps**
259
-
260
- 1. **Get active changes**
261
-
262
- Run \`pscode list --json\` to get all active changes.
263
-
264
- If no active changes exist, inform user and stop.
265
-
266
- 2. **Prompt for change selection**
267
-
268
- Use **AskUserQuestion tool** with multi-select to let user choose changes:
269
- - Show each change with its schema
270
- - Include an option for "All changes"
271
- - Allow any number of selections (1+ works, 2+ is the typical use case)
272
-
273
- **IMPORTANT**: Do NOT auto-select. Always let the user choose.
274
-
275
- 3. **Batch validation - gather status for all selected changes**
276
-
277
- For each selected change, collect:
278
-
279
- a. **Artifact status** - Run \`pscode status --change "<name>" --json\`
280
- - Parse \`schemaName\`, \`artifacts\`, \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`
281
- - Note which artifacts are \`done\` vs other states
282
-
283
- If any selected change reports \`actionContext.mode: "workspace-planning"\`, explain that workspace bulk archive is not supported in this slice and STOP before syncing specs or moving changes. Do not fall back to repo-local paths or edit linked repos.
284
-
285
- b. **Task completion** - Read \`artifactPaths.tasks.existingOutputPaths\` from status JSON
286
- - Count \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
287
- - If no tasks file exists, note as "No tasks"
288
-
289
- c. **Delta specs** - Check \`artifactPaths.specs.existingOutputPaths\` from status JSON
290
- - List which capability specs exist
291
- - For each, extract requirement names (lines matching \`### Requirement: <name>\`)
292
-
293
- 4. **Detect spec conflicts**
294
-
295
- Build a map of \`capability -> [changes that touch it]\`:
296
-
297
- \`\`\`
298
- auth -> [change-a, change-b] <- CONFLICT (2+ changes)
299
- api -> [change-c] <- OK (only 1 change)
300
- \`\`\`
301
-
302
- A conflict exists when 2+ selected changes have delta specs for the same capability.
303
-
304
- 5. **Resolve conflicts agentically**
305
-
306
- **For each conflict**, investigate the codebase:
307
-
308
- a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
309
-
310
- b. **Search the codebase** for implementation evidence:
311
- - Look for code implementing requirements from each delta spec
312
- - Check for related files, functions, or tests
313
-
314
- c. **Determine resolution**:
315
- - If only one change is actually implemented -> sync that one's specs
316
- - If both implemented -> apply in chronological order (older first, newer overwrites)
317
- - If neither implemented -> skip spec sync, warn user
318
-
319
- d. **Record resolution** for each conflict:
320
- - Which change's specs to apply
321
- - In what order (if both)
322
- - Rationale (what was found in codebase)
323
-
324
- 6. **Show consolidated status table**
325
-
326
- Display a table summarizing all changes:
327
-
328
- \`\`\`
329
- | Change | Artifacts | Tasks | Specs | Conflicts | Status |
330
- |---------------------|-----------|-------|---------|-----------|--------|
331
- | schema-management | Done | 5/5 | 2 delta | None | Ready |
332
- | project-config | Done | 3/3 | 1 delta | None | Ready |
333
- | add-oauth | Done | 4/4 | 1 delta | auth (!) | Ready* |
334
- | add-verify-skill | 1 left | 2/5 | None | None | Warn |
335
- \`\`\`
336
-
337
- For conflicts, show the resolution:
338
- \`\`\`
339
- * Conflict resolution:
340
- - auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
341
- \`\`\`
342
-
343
- For incomplete changes, show warnings:
344
- \`\`\`
345
- Warnings:
346
- - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
347
- \`\`\`
348
-
349
- 7. **Confirm batch operation**
350
-
351
- Use **AskUserQuestion tool** with a single confirmation:
352
-
353
- - "Archive N changes?" with options based on status
354
- - Options might include:
355
- - "Archive all N changes"
356
- - "Archive only N ready changes (skip incomplete)"
357
- - "Cancel"
358
-
359
- If there are incomplete changes, make clear they'll be archived with warnings.
360
-
361
- 8. **Execute archive for each confirmed change**
362
-
363
- Process changes in the determined order (respecting conflict resolution):
364
-
365
- a. **Sync specs** if delta specs exist:
366
- - Use the pscode-sync-specs approach (agent-driven intelligent merge)
367
- - For conflicts, apply in resolved order
368
- - Track if sync was done
369
-
370
- b. **Perform the archive**:
371
- \`\`\`bash
372
- mkdir -p "<planningHome.changesDir>/archive"
373
- mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
374
- \`\`\`
375
-
376
- c. **Track outcome** for each change:
377
- - Success: archived successfully
378
- - Failed: error during archive (record error)
379
- - Skipped: user chose not to archive (if applicable)
380
-
381
- 9. **Display summary**
382
-
383
- Show final results:
384
-
385
- \`\`\`
386
- ## Bulk Archive Complete
387
-
388
- Archived 3 changes:
389
- - schema-management-cli -> archive/2026-01-19-schema-management-cli/
390
- - project-config -> archive/2026-01-19-project-config/
391
- - add-oauth -> archive/2026-01-19-add-oauth/
392
-
393
- Skipped 1 change:
394
- - add-verify-skill (user chose not to archive incomplete)
395
-
396
- Spec sync summary:
397
- - 4 delta specs synced to main specs
398
- - 1 conflict resolved (auth: applied both in chronological order)
399
- \`\`\`
400
-
401
- If any failures:
402
- \`\`\`
403
- Failed 1 change:
404
- - some-change: Archive directory already exists
405
- \`\`\`
406
-
407
- **Conflict Resolution Examples**
408
-
409
- Example 1: Only one implemented
410
- \`\`\`
411
- Conflict: specs/auth/spec.md touched by [add-oauth, add-jwt]
412
-
413
- Checking add-oauth:
414
- - Delta adds "OAuth Provider Integration" requirement
415
- - Searching codebase... found src/auth/oauth.ts implementing OAuth flow
416
-
417
- Checking add-jwt:
418
- - Delta adds "JWT Token Handling" requirement
419
- - Searching codebase... no JWT implementation found
420
-
421
- Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
422
- \`\`\`
423
-
424
- Example 2: Both implemented
425
- \`\`\`
426
- Conflict: specs/api/spec.md touched by [add-rest-api, add-graphql]
427
-
428
- Checking add-rest-api (created 2026-01-10):
429
- - Delta adds "REST Endpoints" requirement
430
- - Searching codebase... found src/api/rest.ts
431
-
432
- Checking add-graphql (created 2026-01-15):
433
- - Delta adds "GraphQL Schema" requirement
434
- - Searching codebase... found src/api/graphql.ts
435
-
436
- Resolution: Both implemented. Will apply add-rest-api specs first,
437
- then add-graphql specs (chronological order, newer takes precedence).
438
- \`\`\`
439
-
440
- **Output On Success**
441
-
442
- \`\`\`
443
- ## Bulk Archive Complete
444
-
445
- Archived N changes:
446
- - <change-1> -> archive/YYYY-MM-DD-<change-1>/
447
- - <change-2> -> archive/YYYY-MM-DD-<change-2>/
448
-
449
- Spec sync summary:
450
- - N delta specs synced to main specs
451
- - No conflicts (or: M conflicts resolved)
452
- \`\`\`
453
-
454
- **Output On Partial Success**
455
-
456
- \`\`\`
457
- ## Bulk Archive Complete (partial)
458
-
459
- Archived N changes:
460
- - <change-1> -> archive/YYYY-MM-DD-<change-1>/
461
-
462
- Skipped M changes:
463
- - <change-2> (user chose not to archive incomplete)
464
-
465
- Failed K changes:
466
- - <change-3>: Archive directory already exists
467
- \`\`\`
468
-
469
- **Output When No Changes**
470
-
471
- \`\`\`
472
- ## No Changes to Archive
473
-
474
- No active changes found. Create a new change to get started.
475
- \`\`\`
476
-
477
- **Guardrails**
478
- - Allow any number of changes (1+ is fine, 2+ is the typical use case)
479
- - Always prompt for selection, never auto-select
480
- - Detect spec conflicts early and resolve by checking codebase
481
- - When both changes are implemented, apply specs in chronological order
482
- - Skip spec sync only when implementation is missing (warn user)
483
- - Show clear per-change status before confirming
484
- - Use single confirmation for entire batch
485
- - Track and report all outcomes (success/skip/fail)
486
- - Preserve .pscode.yaml when moving to archive
487
- - Archive directory target uses current date: YYYY-MM-DD-<name>
488
- - If archive target exists, fail that change but continue with others`
489
- };
490
- }
491
- //# sourceMappingURL=bulk-archive-change.js.map
@@ -1,10 +0,0 @@
1
- /**
2
- * Skill Template Workflow Modules
3
- *
4
- * This file is generated by splitting the legacy monolithic
5
- * templates file into workflow-focused modules.
6
- */
7
- import type { SkillTemplate, CommandTemplate } from '../types.js';
8
- export declare function getContinueChangeSkillTemplate(): SkillTemplate;
9
- export declare function getPsContinueCommandTemplate(): CommandTemplate;
10
- //# sourceMappingURL=continue-change.d.ts.map