specweave 1.0.49 → 1.0.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specweave",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -47,18 +47,36 @@ if [ -z "$INCREMENT_ID" ]; then
47
47
  fi
48
48
  ```
49
49
 
50
- **Validate increment exists**:
50
+ **Validate increment exists** (check active AND archive directories):
51
51
 
52
52
  ```bash
53
53
  INCREMENT_DIR=".specweave/increments/$INCREMENT_ID"
54
+ INCREMENT_STATUS="active"
55
+
54
56
  if [ ! -d "$INCREMENT_DIR" ]; then
55
- echo "❌ Increment $INCREMENT_ID not found at $INCREMENT_DIR"
56
- exit 1
57
+ # Check archive directory for completed increments
58
+ ARCHIVE_DIR=".specweave/increments/_archive/$INCREMENT_ID"
59
+ if [ -d "$ARCHIVE_DIR" ]; then
60
+ INCREMENT_DIR="$ARCHIVE_DIR"
61
+ INCREMENT_STATUS="completed"
62
+ echo "📦 Found ARCHIVED increment: $INCREMENT_ID (status: completed)"
63
+ else
64
+ echo "❌ Increment $INCREMENT_ID not found in active or archive"
65
+ exit 1
66
+ fi
67
+ else
68
+ echo "✅ Found increment: $INCREMENT_ID"
57
69
  fi
58
-
59
- echo "✅ Found increment: $INCREMENT_ID"
60
70
  ```
61
71
 
72
+ ### ⚠️ IMPORTANT: DO NOT SKIP SYNC FOR COMPLETED/ARCHIVED INCREMENTS
73
+
74
+ **Even if INCREMENT_STATUS="completed", you MUST proceed with ALL sync steps:**
75
+ - ✅ Still create missing GitHub issues (critical for historical tracking)
76
+ - ✅ Still sync to living docs
77
+ - ✅ Still close issues if they were just created
78
+ - ❌ DO NOT print "no sync needed" for completed increments
79
+
62
80
  **Output**:
63
81
  ```
64
82
  🔍 Auto-detected active increment: 0053-safe-feature-deletion
@@ -67,6 +85,12 @@ echo "✅ Found increment: $INCREMENT_ID"
67
85
  📊 Starting comprehensive progress sync...
68
86
  ```
69
87
 
88
+ **OR for archived/completed**:
89
+ ```
90
+ 📦 Found ARCHIVED increment: 0001-content-repurposer-mvp (status: completed)
91
+ 📊 Syncing COMPLETED increment (will create/close GitHub issues)...
92
+ ```
93
+
70
94
  ---
71
95
 
72
96
  ## STEP 2: Sync Tasks → Living Docs (ACs and User Stories)
@@ -96,29 +120,42 @@ fi
96
120
  - Updates spec.md to mark ACs as complete: `- [ ]` → `- [x]`
97
121
  - Updates metadata.json with AC completion count
98
122
 
99
- ### 2.2: Sync to Living Docs (User Stories)
123
+ ### 2.2: Sync to Living Docs (User Stories) - MANDATORY BEFORE EXTERNAL SYNC
124
+
125
+ ### ⚠️ CRITICAL: THIS STEP IS MANDATORY AND MUST COMPLETE BEFORE ANY EXTERNAL TOOL OPERATIONS
100
126
 
101
- Call the existing `/sw:sync-specs` command:
127
+ **Why?** External tools (GitHub, JIRA, ADO) sync FROM living docs. If you skip this step:
128
+ - External issues will have stale/outdated content
129
+ - User stories won't reflect completed status
130
+ - AC checkboxes in GitHub issues won't be checked
131
+
132
+ **You MUST invoke the `/sw:sync-specs` command:**
102
133
 
103
134
  ```bash
104
135
  echo "📚 Step 2/5: Syncing increment to living docs..."
136
+ echo " ⚠️ THIS MUST COMPLETE BEFORE EXTERNAL TOOL SYNC"
105
137
 
106
- # Sync increment specs to living docs structure
138
+ # MANDATORY: Sync increment specs to living docs structure
139
+ # This populates .specweave/docs/internal/specs/{project}/FS-XXX/
107
140
  npx specweave sync-specs "$INCREMENT_ID"
108
141
 
109
142
  if [ $? -eq 0 ]; then
110
143
  echo " ✅ Living docs sync complete"
144
+ echo " 📁 Updated: .specweave/docs/internal/specs/{project}/FS-XXX/"
111
145
  else
112
- echo " ❌ Living docs sync failed"
146
+ echo " ❌ Living docs sync failed - BLOCKING external sync"
113
147
  exit 1
114
148
  fi
115
149
  ```
116
150
 
117
151
  **What this does**:
118
- - Syncs spec.md → living docs user stories
152
+ - Syncs spec.md → living docs user stories in `.specweave/docs/internal/specs/`
119
153
  - Updates user story completion status
120
154
  - Generates/updates feature ID if needed
121
155
  - Updates README.md in feature folder
156
+ - **Creates the content that external tools will sync FROM**
157
+
158
+ ### ⛔ DO NOT PROCEED TO STEP 3 UNTIL THIS COMPLETES SUCCESSFULLY
122
159
 
123
160
  ---
124
161
 
@@ -188,22 +225,43 @@ fi
188
225
 
189
226
  ---
190
227
 
191
- ## STEP 4: AUTO-CREATE Missing External Issues (ALWAYS - Unless --no-create)
228
+ ## STEP 4: External Issues - ALWAYS Create If Missing, Then Sync/Close
229
+
230
+ **CRITICAL BEHAVIOR (v1.0.50+)**: ALWAYS create missing issues, regardless of status:
231
+
232
+ | INCREMENT_STATUS | Issue EXISTS | Action |
233
+ |------------------|--------------|--------|
234
+ | `active` | No | ✅ AUTO-CREATE new issue |
235
+ | `active` | Yes | ✅ SYNC (update progress) |
236
+ | `completed` | No | ✅ AUTO-CREATE + IMMEDIATELY CLOSE (historical tracking) |
237
+ | `completed` | Yes | ✅ CLOSE the existing issue |
192
238
 
193
- **CRITICAL BEHAVIOR CHANGE (v1.0.48+)**: This command **ALWAYS auto-creates missing external issues** unless `--no-create` flag is passed. No config flag required!
239
+ ### CRITICAL RULE: ALWAYS CREATE IF MISSING
194
240
 
195
- **Philosophy**: `/sw:sync-progress` is the "single button" - it should JUST WORK. If GitHub is configured and no issue exists, CREATE IT.
241
+ **For ALL increments (active OR completed):**
242
+ - ✅ If NO issue exists → AUTO-CREATE the issue
243
+ - ✅ If completed → CREATE then immediately CLOSE (for historical tracking)
196
244
 
197
- **Check and auto-create**:
245
+ **Why?** Historical tracking is important. Completed work should have GitHub issues for:
246
+ - Team visibility
247
+ - Sprint retrospectives
248
+ - Release notes generation
249
+ - Audit trails
250
+
251
+ **For completed increments:**
252
+ - ✅ AUTO-CREATE if no issue exists (historical tracking)
253
+ - ✅ Then IMMEDIATELY CLOSE the created issue (since work is done)
254
+
255
+ **Check and handle based on status**:
198
256
 
199
257
  ```bash
200
- echo "🔗 Step 4/5: Ensuring external issues exist (auto-create if missing)..."
258
+ echo "🔗 Step 4/5: Handling external issues based on increment status..."
201
259
 
202
260
  METADATA="$INCREMENT_DIR/metadata.json"
203
261
  NO_CREATE_FLAG="${NO_CREATE:-false}" # --no-create flag disables auto-create
204
262
 
205
263
  # ══════════════════════════════════════════════════════════════════
206
- # GITHUB: Check and auto-create missing issues
264
+ # GITHUB: Check and handle based on INCREMENT_STATUS
207
265
  # ══════════════════════════════════════════════════════════════════
208
266
  if [[ " ${EXTERNAL_TOOLS[@]} " =~ " github " ]] && [ "$NO_GITHUB" != "true" ]; then
209
267
  echo ""
@@ -223,44 +281,45 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " github " ]] && [ "$NO_GITHUB" != "true" ]; t
223
281
  ' "$METADATA" 2>/dev/null)
224
282
 
225
283
  if [ -z "$GITHUB_ISSUE" ] || [ "$GITHUB_ISSUE" = "null" ]; then
284
+ # NO ISSUE EXISTS - ALWAYS create (v1.0.50+)
226
285
  if [ "$NO_CREATE_FLAG" = "true" ]; then
227
286
  echo " ⚠️ No GitHub issue linked (--no-create flag set, skipping auto-create)"
228
287
  echo " 💡 To create manually: /sw-github:create $INCREMENT_ID"
229
288
  else
230
- echo " 📝 No GitHub issue linked - AUTO-CREATING..."
231
-
232
- # Use the github-manager agent to create the issue
233
- # This handles multi-project configs properly
289
+ # ALWAYS AUTO-CREATE issue (active OR completed)
290
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
291
+ echo " 📝 No GitHub issue linked - AUTO-CREATING for historical tracking..."
292
+ echo " 📋 (Completed increment - will create AND close immediately)"
293
+ else
294
+ echo " 📝 No GitHub issue linked - AUTO-CREATING..."
295
+ fi
234
296
  echo " ⏳ Creating GitHub issue via /sw-github:create..."
235
297
 
236
298
  # INVOKE: /sw-github:create $INCREMENT_ID
237
- # The skill invocation will:
238
- # 1. Read spec.md to generate issue body
239
- # 2. Detect profile from increment's Project field or use active profile
240
- # 3. Create issue with proper format: [FS-XXX][US-YYY] Title
241
- # 4. Update metadata.json with issue number
242
- # 5. Apply labels (specweave, increment)
243
-
244
- # Execute the create command
245
299
  /sw-github:create "$INCREMENT_ID"
246
300
 
247
301
  if [ $? -eq 0 ]; then
248
302
  # Re-read metadata to get created issue number
249
303
  GITHUB_ISSUE=$(jq -r '.github.issue // .github.issues[0].number // .external_sync.github.issueNumber // ""' "$METADATA" 2>/dev/null)
250
304
  echo " ✅ GitHub issue auto-created: #$GITHUB_ISSUE"
305
+ GITHUB_CREATED="true" # Mark as newly created
251
306
  else
252
307
  echo " ⚠️ GitHub issue creation failed (will continue with sync)"
253
308
  echo " 💡 Debug: Check GITHUB_TOKEN in .env or run 'gh auth status'"
254
309
  fi
255
310
  fi
256
311
  else
312
+ # ISSUE EXISTS - will sync/close in STEP 5
257
313
  echo " ✅ GitHub issue exists: #$GITHUB_ISSUE"
314
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
315
+ echo " 📋 Will close issue in STEP 5 (increment is archived)"
316
+ fi
258
317
  fi
259
318
  fi
260
319
  fi
261
320
 
262
321
  # ══════════════════════════════════════════════════════════════════
263
- # JIRA: Check and auto-create missing issues
322
+ # JIRA: Check and handle based on INCREMENT_STATUS
264
323
  # ══════════════════════════════════════════════════════════════════
265
324
  if [[ " ${EXTERNAL_TOOLS[@]} " =~ " jira " ]] && [ "$NO_JIRA" != "true" ]; then
266
325
  echo ""
@@ -278,11 +337,18 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " jira " ]] && [ "$NO_JIRA" != "true" ]; then
278
337
  ' "$METADATA" 2>/dev/null)
279
338
 
280
339
  if [ -z "$JIRA_ISSUE" ] || [ "$JIRA_ISSUE" = "null" ]; then
340
+ # NO ISSUE EXISTS - ALWAYS create (v1.0.50+)
281
341
  if [ "$NO_CREATE_FLAG" = "true" ]; then
282
342
  echo " ⚠️ No JIRA issue linked (--no-create flag set, skipping auto-create)"
283
343
  echo " 💡 To create manually: /sw-jira:create $INCREMENT_ID"
284
344
  else
285
- echo " 📝 No JIRA issue linked - AUTO-CREATING..."
345
+ # ALWAYS AUTO-CREATE issue (active OR completed)
346
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
347
+ echo " 📝 No JIRA issue linked - AUTO-CREATING for historical tracking..."
348
+ echo " 📋 (Completed increment - will create AND transition to Done)"
349
+ else
350
+ echo " 📝 No JIRA issue linked - AUTO-CREATING..."
351
+ fi
286
352
  echo " ⏳ Creating JIRA issue via /sw-jira:create..."
287
353
 
288
354
  # INVOKE: /sw-jira:create $INCREMENT_ID
@@ -291,19 +357,24 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " jira " ]] && [ "$NO_JIRA" != "true" ]; then
291
357
  if [ $? -eq 0 ]; then
292
358
  JIRA_ISSUE=$(jq -r '.jira.issue // .jira.issues[0].key // .external_sync.jira.issueKey // ""' "$METADATA" 2>/dev/null)
293
359
  echo " ✅ JIRA issue auto-created: $JIRA_ISSUE"
360
+ JIRA_CREATED="true" # Mark as newly created
294
361
  else
295
362
  echo " ⚠️ JIRA issue creation failed (will continue with sync)"
296
363
  echo " 💡 Debug: Check JIRA credentials in .env"
297
364
  fi
298
365
  fi
299
366
  else
367
+ # ISSUE EXISTS - will sync/close in STEP 5
300
368
  echo " ✅ JIRA issue exists: $JIRA_ISSUE"
369
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
370
+ echo " 📋 Will transition to 'Done' in STEP 5 (increment is archived)"
371
+ fi
301
372
  fi
302
373
  fi
303
374
  fi
304
375
 
305
376
  # ══════════════════════════════════════════════════════════════════
306
- # ADO: Check and auto-create missing work items
377
+ # ADO: Check and handle based on INCREMENT_STATUS
307
378
  # ══════════════════════════════════════════════════════════════════
308
379
  if [[ " ${EXTERNAL_TOOLS[@]} " =~ " ado " ]] && [ "$NO_ADO" != "true" ]; then
309
380
  echo ""
@@ -321,11 +392,18 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " ado " ]] && [ "$NO_ADO" != "true" ]; then
321
392
  ' "$METADATA" 2>/dev/null)
322
393
 
323
394
  if [ -z "$ADO_ITEM" ] || [ "$ADO_ITEM" = "null" ]; then
395
+ # NO WORK ITEM EXISTS - ALWAYS create (v1.0.50+)
324
396
  if [ "$NO_CREATE_FLAG" = "true" ]; then
325
397
  echo " ⚠️ No ADO work item linked (--no-create flag set, skipping auto-create)"
326
398
  echo " 💡 To create manually: /sw-ado:create $INCREMENT_ID"
327
399
  else
328
- echo " 📝 No ADO work item linked - AUTO-CREATING..."
400
+ # ALWAYS AUTO-CREATE work item (active OR completed)
401
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
402
+ echo " 📝 No ADO work item linked - AUTO-CREATING for historical tracking..."
403
+ echo " 📋 (Completed increment - will create AND transition to Closed)"
404
+ else
405
+ echo " 📝 No ADO work item linked - AUTO-CREATING..."
406
+ fi
329
407
  echo " ⏳ Creating ADO work item via /sw-ado:create..."
330
408
 
331
409
  # INVOKE: /sw-ado:create $INCREMENT_ID
@@ -334,13 +412,18 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " ado " ]] && [ "$NO_ADO" != "true" ]; then
334
412
  if [ $? -eq 0 ]; then
335
413
  ADO_ITEM=$(jq -r '.ado.workItem // .ado.workItems[0].id // .external_sync.ado.workItemId // ""' "$METADATA" 2>/dev/null)
336
414
  echo " ✅ ADO work item auto-created: #$ADO_ITEM"
415
+ ADO_CREATED="true" # Mark as newly created
337
416
  else
338
417
  echo " ⚠️ ADO work item creation failed (will continue with sync)"
339
418
  echo " 💡 Debug: Check AZURE_DEVOPS_PAT in .env"
340
419
  fi
341
420
  fi
342
421
  else
422
+ # WORK ITEM EXISTS - will sync/close in STEP 5
343
423
  echo " ✅ ADO work item exists: #$ADO_ITEM"
424
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
425
+ echo " 📋 Will transition to 'Closed' in STEP 5 (increment is archived)"
426
+ fi
344
427
  fi
345
428
  fi
346
429
  fi
@@ -389,6 +472,13 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " github " ]] && [ "$NO_GITHUB" != "true" ]; t
389
472
  else
390
473
  echo " ⚠️ GitHub sync had warnings (check logs)"
391
474
  fi
475
+
476
+ # SPECIAL CASE: For completed/archived increments, also CLOSE the issue
477
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
478
+ echo " 🔒 Closing GitHub issue (increment is completed)..."
479
+ /sw-github:close "$INCREMENT_ID"
480
+ echo " ✅ GitHub issue closed"
481
+ fi
392
482
  fi
393
483
  fi
394
484
  fi
@@ -401,6 +491,11 @@ fi
401
491
  - Updates labels based on status
402
492
  - Pulls external changes (comments, status changes from team)
403
493
 
494
+ **SPECIAL CASE: Completed/Archived Increments**:
495
+ - If `INCREMENT_STATUS="completed"` and issue was just created → ALSO close the issue
496
+ - Use `/sw-github:close $INCREMENT_ID` to close with completion comment
497
+ - This provides complete historical tracking
498
+
404
499
  ### 5.2: Sync to JIRA (if configured)
405
500
 
406
501
  ```bash
@@ -412,7 +507,9 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " jira " ]] && [ "$NO_JIRA" != "true" ]; then
412
507
 
413
508
  if [ -z "$JIRA_ISSUE" ] || [ "$JIRA_ISSUE" = "null" ]; then
414
509
  echo " ⚠️ No JIRA issue linked - skipping sync"
415
- echo " 💡 Create issue first: /sw-jira:create $INCREMENT_ID"
510
+ if [ "$INCREMENT_STATUS" != "completed" ]; then
511
+ echo " 💡 Create issue first: /sw-jira:create $INCREMENT_ID"
512
+ fi
416
513
  else
417
514
  if [ "$DRY_RUN" = "true" ]; then
418
515
  echo " [DRY-RUN] Would sync to JIRA issue $JIRA_ISSUE"
@@ -427,6 +524,13 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " jira " ]] && [ "$NO_JIRA" != "true" ]; then
427
524
  else
428
525
  echo " ⚠️ JIRA sync had warnings"
429
526
  fi
527
+
528
+ # SPECIAL CASE: For completed/archived increments, transition to 'Done'
529
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
530
+ echo " 🔒 Transitioning JIRA issue to 'Done' (increment is completed)..."
531
+ /sw-jira:close "$INCREMENT_ID"
532
+ echo " ✅ JIRA issue transitioned to Done"
533
+ fi
430
534
  fi
431
535
  fi
432
536
  fi
@@ -443,7 +547,9 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " ado " ]] && [ "$NO_ADO" != "true" ]; then
443
547
 
444
548
  if [ -z "$ADO_ITEM" ] || [ "$ADO_ITEM" = "null" ]; then
445
549
  echo " ⚠️ No ADO work item linked - skipping sync"
446
- echo " 💡 Create work item first: /sw-ado:create $INCREMENT_ID"
550
+ if [ "$INCREMENT_STATUS" != "completed" ]; then
551
+ echo " 💡 Create work item first: /sw-ado:create $INCREMENT_ID"
552
+ fi
447
553
  else
448
554
  if [ "$DRY_RUN" = "true" ]; then
449
555
  echo " [DRY-RUN] Would sync to ADO work item #$ADO_ITEM"
@@ -458,6 +564,13 @@ if [[ " ${EXTERNAL_TOOLS[@]} " =~ " ado " ]] && [ "$NO_ADO" != "true" ]; then
458
564
  else
459
565
  echo " ⚠️ ADO sync had warnings"
460
566
  fi
567
+
568
+ # SPECIAL CASE: For completed/archived increments, transition to 'Closed'
569
+ if [ "$INCREMENT_STATUS" = "completed" ]; then
570
+ echo " 🔒 Transitioning ADO work item to 'Closed' (increment is completed)..."
571
+ /sw-ado:close "$INCREMENT_ID"
572
+ echo " ✅ ADO work item transitioned to Closed"
573
+ fi
461
574
  fi
462
575
  fi
463
576
  fi
@@ -540,7 +653,7 @@ echo " • Run /sw:done $INCREMENT_ID when ready to close"
540
653
  echo ""
541
654
  ```
542
655
 
543
- **Example Output**:
656
+ **Example Output (Active Increment)**:
544
657
 
545
658
  ```
546
659
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -565,6 +678,62 @@ Next steps:
565
678
  • Run /sw:done 0053 when ready to close
566
679
  ```
567
680
 
681
+ **Example Output (COMPLETED/Archived Increment - WITH linked issue)**:
682
+
683
+ ```
684
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
685
+ ✅ PROGRESS SYNC COMPLETE (ARCHIVED INCREMENT)
686
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
687
+
688
+ 📦 Increment: 0001-content-repurposer-mvp
689
+ 📊 Status: completed (archived)
690
+
691
+ ✅ Synced:
692
+ • Tasks → ACs (spec.md) 54/54 ACs ✓
693
+ • Spec → Living docs 10/10 user stories ✓
694
+ • Status line cache 100% complete ✓
695
+
696
+ 🔗 External Tools:
697
+ • GitHub issue #123 SYNCED (final state)
698
+ • GitHub issue #123 CLOSED (increment complete)
699
+
700
+ 📊 Completion:
701
+ • Tasks: 35/35 (100%)
702
+ • ACs: 54/54 (100%)
703
+ • User Stories: 10/10 (100%)
704
+
705
+ ℹ️ Archived increment synced successfully!
706
+ Existing linked issues updated and closed.
707
+ ```
708
+
709
+ **Example Output (COMPLETED/Archived Increment - NO linked issue - NOW CREATES!)**:
710
+
711
+ ```
712
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
713
+ ✅ PROGRESS SYNC COMPLETE (ARCHIVED INCREMENT)
714
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
715
+
716
+ 📦 Increment: 0001-content-repurposer-mvp
717
+ 📊 Status: completed (archived)
718
+
719
+ ✅ Synced:
720
+ • Tasks → ACs (spec.md) 54/54 ACs ✓
721
+ • Spec → Living docs 10/10 user stories ✓
722
+ • Status line cache 100% complete ✓
723
+
724
+ 🔗 External Tools:
725
+ 📝 GitHub issue AUTO-CREATED: #456 (historical tracking)
726
+ 🔒 GitHub issue #456 CLOSED (increment already complete)
727
+
728
+ 📊 Completion:
729
+ • Tasks: 35/35 (100%)
730
+ • ACs: 54/54 (100%)
731
+ • User Stories: 10/10 (100%)
732
+
733
+ ✅ Archived increment synced with historical tracking!
734
+ External issues created and closed for audit trail.
735
+ ```
736
+
568
737
  ---
569
738
 
570
739
  ## STEP 7: Dry-Run Mode (If --dry-run flag)
@@ -24,6 +24,23 @@ tasks.md → spec.md ACs → living docs → AUTO-CREATE external issues → syn
24
24
 
25
25
  **No more "No GitHub issue linked" errors!** The command auto-creates missing issues.
26
26
 
27
+ ### ✅ Archived Increment Behavior (v1.0.50+)
28
+
29
+ **For archived/completed increments, this command ALWAYS creates issues for historical tracking:**
30
+
31
+ | Situation | Action |
32
+ |-----------|--------|
33
+ | Issue EXISTS | ✅ Sync final state + Close/Transition |
34
+ | NO issue linked | ✅ AUTO-CREATE + IMMEDIATELY CLOSE (historical tracking) |
35
+
36
+ **Why?** Historical tracking is important! Completed work should have external issues for:
37
+ - Team visibility
38
+ - Sprint retrospectives
39
+ - Release notes generation
40
+ - Audit trails
41
+
42
+ **For all increments (active or completed)**: Auto-creates issues if missing (the "single button" philosophy)
43
+
27
44
  ---
28
45
 
29
46
  ## When to Use This Command
@@ -7,6 +7,29 @@ description: Close GitHub issue for completed SpecWeave increment. Posts complet
7
7
 
8
8
  Close the GitHub issue associated with a completed SpecWeave increment.
9
9
 
10
+ ## ⛔ MANDATORY: Sync Living Docs BEFORE Closing
11
+
12
+ **GitHub issue content is generated FROM living docs.** If living docs are stale, the closing summary will have outdated information.
13
+
14
+ **You MUST run `/sw:sync-specs` BEFORE closing (unless using /sw:sync-progress):**
15
+
16
+ ```bash
17
+ # STEP 1: Ensure living docs reflect final state
18
+ /sw:sync-specs <increment-id>
19
+
20
+ # STEP 2: Then close GitHub issue
21
+ /sw-github:close <increment-id>
22
+ ```
23
+
24
+ **Why?**
25
+ - Closing comment includes final stats from living docs
26
+ - User story completion status read from living docs
27
+ - AC checkboxes reflect living docs state
28
+
29
+ **Note:** `/sw:done` and `/sw:sync-progress` call sync-specs automatically.
30
+
31
+ ---
32
+
10
33
  **Usage**: `/sw-github:close <increment-id>`
11
34
 
12
35
  ```bash
@@ -7,6 +7,30 @@ description: Create a GitHub issue for a SpecWeave increment. Generates issue fr
7
7
 
8
8
  Create a GitHub issue for the specified SpecWeave increment.
9
9
 
10
+ ## ⛔ MANDATORY: Sync Living Docs BEFORE Creating Issue
11
+
12
+ **GitHub issue content is generated FROM living docs.** If living docs don't exist or are stale, the issue will be incomplete.
13
+
14
+ **You MUST run `/sw:sync-specs` BEFORE creating (unless using /sw:sync-progress):**
15
+
16
+ ```bash
17
+ # STEP 1: Ensure living docs exist and are current
18
+ /sw:sync-specs <increment-id>
19
+
20
+ # STEP 2: Then create GitHub issue
21
+ /sw-github:create <increment-id>
22
+ ```
23
+
24
+ **Why?**
25
+ - Issue body is generated from `.specweave/docs/internal/specs/FS-XXX/`
26
+ - User stories and ACs come from living docs
27
+ - Task checklist reflects living docs structure
28
+ - Without sync-specs, issue will be created from raw increment spec.md (less structured)
29
+
30
+ **Note:** `/sw:sync-progress` calls sync-specs automatically before creating issues.
31
+
32
+ ---
33
+
10
34
  **Usage**: `/sw-github:create <increment-id>`
11
35
 
12
36
  ```bash
@@ -5,9 +5,30 @@ description: Synchronize SpecWeave increment with GitHub issue (Multi-Project Su
5
5
 
6
6
  # Sync Increment with GitHub Issue (Multi-Project)
7
7
 
8
- ## ⚠️ CRITICAL: Sync Routing (Read First!)
8
+ ## ⚠️ CRITICAL: Pre-Sync Requirements (Read First!)
9
9
 
10
- **Before executing ANY sync, you MUST determine the correct sync path:**
10
+ ### MANDATORY: Sync Living Docs BEFORE GitHub Sync
11
+
12
+ **GitHub sync reads FROM living docs.** If living docs are stale, GitHub issues will have outdated content.
13
+
14
+ **You MUST run `/sw:sync-specs` (or ensure it ran) BEFORE this command:**
15
+
16
+ ```bash
17
+ # STEP 1: Ensure living docs are current (MANDATORY)
18
+ /sw:sync-specs <increment-id>
19
+
20
+ # STEP 2: Then sync to GitHub
21
+ /sw-github:sync <increment-id>
22
+ ```
23
+
24
+ **Why?**
25
+ - GitHub issues are generated FROM `.specweave/docs/internal/specs/FS-XXX/`
26
+ - If you skip sync-specs, GitHub will show stale user stories/ACs
27
+ - `/sw:sync-progress` calls sync-specs automatically, but `/sw-github:sync` does NOT
28
+
29
+ **If you're calling this directly (not via /sw:sync-progress), run sync-specs first!**
30
+
31
+ ---
11
32
 
12
33
  ### Step 0: Detect Project Structure
13
34