specweave 1.0.235 → 1.0.239

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 (196) hide show
  1. package/README.md +89 -193
  2. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts +37 -0
  3. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts.map +1 -0
  4. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js +176 -0
  5. package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js.map +1 -0
  6. package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts +36 -0
  7. package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts.map +1 -0
  8. package/dist/plugins/specweave-github/lib/github-batch-sync.js +115 -0
  9. package/dist/plugins/specweave-github/lib/github-batch-sync.js.map +1 -0
  10. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts +37 -0
  11. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js +56 -0
  13. package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js.map +1 -0
  14. package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts +68 -0
  15. package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/github-conflict-resolver.js +102 -0
  17. package/dist/plugins/specweave-github/lib/github-conflict-resolver.js.map +1 -0
  18. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts +64 -0
  19. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts.map +1 -0
  20. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js +162 -0
  21. package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js.map +1 -0
  22. package/dist/plugins/specweave-github/lib/github-field-sync.d.ts +50 -0
  23. package/dist/plugins/specweave-github/lib/github-field-sync.d.ts.map +1 -0
  24. package/dist/plugins/specweave-github/lib/github-field-sync.js +107 -0
  25. package/dist/plugins/specweave-github/lib/github-field-sync.js.map +1 -0
  26. package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts +53 -0
  27. package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts.map +1 -0
  28. package/dist/plugins/specweave-github/lib/github-graphql-client.js +138 -0
  29. package/dist/plugins/specweave-github/lib/github-graphql-client.js.map +1 -0
  30. package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts +40 -0
  31. package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts.map +1 -0
  32. package/dist/plugins/specweave-github/lib/github-issue-body-generator.js +50 -0
  33. package/dist/plugins/specweave-github/lib/github-issue-body-generator.js.map +1 -0
  34. package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts +30 -0
  35. package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts.map +1 -0
  36. package/dist/plugins/specweave-github/lib/github-issue-body-parser.js +75 -0
  37. package/dist/plugins/specweave-github/lib/github-issue-body-parser.js.map +1 -0
  38. package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts +94 -0
  39. package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts.map +1 -0
  40. package/dist/plugins/specweave-github/lib/github-pull-sync.js +232 -0
  41. package/dist/plugins/specweave-github/lib/github-pull-sync.js.map +1 -0
  42. package/dist/plugins/specweave-github/lib/github-push-sync.d.ts +50 -0
  43. package/dist/plugins/specweave-github/lib/github-push-sync.d.ts.map +1 -0
  44. package/dist/plugins/specweave-github/lib/github-push-sync.js +114 -0
  45. package/dist/plugins/specweave-github/lib/github-push-sync.js.map +1 -0
  46. package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts +53 -0
  47. package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts.map +1 -0
  48. package/dist/plugins/specweave-github/lib/github-rate-limiter.js +109 -0
  49. package/dist/plugins/specweave-github/lib/github-rate-limiter.js.map +1 -0
  50. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts +21 -0
  51. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts.map +1 -0
  52. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +161 -0
  53. package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js.map +1 -0
  54. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts +46 -0
  55. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts.map +1 -0
  56. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js +99 -0
  57. package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js.map +1 -0
  58. package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts +43 -0
  59. package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts.map +1 -0
  60. package/dist/plugins/specweave-github/lib/github-us-auto-closer.js +153 -0
  61. package/dist/plugins/specweave-github/lib/github-us-auto-closer.js.map +1 -0
  62. package/dist/plugins/specweave-github/lib/index.d.ts +1 -4
  63. package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -1
  64. package/dist/plugins/specweave-github/lib/index.js +1 -4
  65. package/dist/plugins/specweave-github/lib/index.js.map +1 -1
  66. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +7 -0
  67. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts.map +1 -0
  68. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js +15 -0
  69. package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js.map +1 -0
  70. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts +10 -0
  71. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts.map +1 -0
  72. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js +36 -0
  73. package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js.map +1 -0
  74. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts +25 -0
  75. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts.map +1 -0
  76. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js +57 -0
  77. package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js.map +1 -0
  78. package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts +7 -0
  79. package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts.map +1 -0
  80. package/dist/plugins/specweave-testing/lib/playwright-routing.js +17 -0
  81. package/dist/plugins/specweave-testing/lib/playwright-routing.js.map +1 -0
  82. package/dist/src/cli/commands/auto.d.ts.map +1 -1
  83. package/dist/src/cli/commands/auto.js +1 -2
  84. package/dist/src/cli/commands/auto.js.map +1 -1
  85. package/dist/src/cli/commands/cancel-auto.js +1 -2
  86. package/dist/src/cli/commands/cancel-auto.js.map +1 -1
  87. package/dist/src/cli/commands/living-docs.js +2 -2
  88. package/dist/src/cli/commands/living-docs.js.map +1 -1
  89. package/dist/src/cli/commands/update.d.ts.map +1 -1
  90. package/dist/src/cli/commands/update.js +1 -2
  91. package/dist/src/cli/commands/update.js.map +1 -1
  92. package/dist/src/core/config/types.d.ts +8 -0
  93. package/dist/src/core/config/types.d.ts.map +1 -1
  94. package/dist/src/core/config/types.js +3 -0
  95. package/dist/src/core/config/types.js.map +1 -1
  96. package/dist/src/core/types/sync-profile.d.ts +72 -0
  97. package/dist/src/core/types/sync-profile.d.ts.map +1 -1
  98. package/dist/src/core/types/sync-profile.js +6 -0
  99. package/dist/src/core/types/sync-profile.js.map +1 -1
  100. package/package.json +2 -2
  101. package/plugins/specweave/hooks/hooks.json +2 -2
  102. package/plugins/specweave/hooks/startup-health-check.sh +1 -1
  103. package/plugins/specweave/hooks/stop-auto-v5.sh +166 -0
  104. package/plugins/specweave/hooks/user-prompt-submit.sh +10 -0
  105. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +21 -1
  106. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +1 -1
  107. package/plugins/specweave/skills/auto/SKILL.md +71 -251
  108. package/plugins/specweave/skills/team-build/SKILL.md +370 -0
  109. package/plugins/specweave/skills/team-merge/SKILL.md +123 -0
  110. package/plugins/specweave/skills/team-orchestrate/SKILL.md +800 -0
  111. package/plugins/specweave/skills/team-status/SKILL.md +89 -0
  112. package/plugins/specweave-github/MULTI-PROJECT-SYNC-ARCHITECTURE.md +94 -8
  113. package/plugins/specweave-github/commands/sync.md +17 -3
  114. package/plugins/specweave-github/hooks/github-ac-sync-handler.sh +255 -0
  115. package/plugins/specweave-github/hooks/github-auto-create-handler.sh +455 -0
  116. package/plugins/specweave-github/lib/github-ac-comment-poster.js +150 -0
  117. package/plugins/specweave-github/lib/github-ac-comment-poster.ts +245 -0
  118. package/plugins/specweave-github/lib/github-batch-sync.js +93 -0
  119. package/plugins/specweave-github/lib/github-batch-sync.ts +152 -0
  120. package/plugins/specweave-github/lib/github-board-resolver-v2.js +47 -0
  121. package/plugins/specweave-github/lib/github-board-resolver-v2.ts +73 -0
  122. package/plugins/specweave-github/lib/github-conflict-resolver.js +90 -0
  123. package/plugins/specweave-github/lib/github-conflict-resolver.ts +154 -0
  124. package/plugins/specweave-github/lib/github-cross-repo-sync.js +168 -0
  125. package/plugins/specweave-github/lib/github-cross-repo-sync.ts +252 -0
  126. package/plugins/specweave-github/lib/github-field-sync.js +116 -0
  127. package/plugins/specweave-github/lib/github-field-sync.ts +165 -0
  128. package/plugins/specweave-github/lib/github-graphql-client.js +129 -0
  129. package/plugins/specweave-github/lib/github-graphql-client.ts +181 -0
  130. package/plugins/specweave-github/lib/github-issue-body-generator.js +30 -0
  131. package/plugins/specweave-github/lib/github-issue-body-generator.ts +76 -0
  132. package/plugins/specweave-github/lib/github-issue-body-parser.js +55 -0
  133. package/plugins/specweave-github/lib/github-issue-body-parser.ts +92 -0
  134. package/plugins/specweave-github/lib/github-pull-sync.js +185 -0
  135. package/plugins/specweave-github/lib/github-pull-sync.ts +343 -0
  136. package/plugins/specweave-github/lib/github-push-sync.js +119 -0
  137. package/plugins/specweave-github/lib/github-push-sync.ts +174 -0
  138. package/plugins/specweave-github/lib/github-rate-limiter.js +96 -0
  139. package/plugins/specweave-github/lib/github-rate-limiter.ts +143 -0
  140. package/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +117 -0
  141. package/plugins/specweave-github/lib/github-spec-frontmatter-updater.ts +180 -0
  142. package/plugins/specweave-github/lib/github-sync-orchestrator.js +84 -0
  143. package/plugins/specweave-github/lib/github-sync-orchestrator.ts +156 -0
  144. package/plugins/specweave-github/lib/github-us-auto-closer.js +134 -0
  145. package/plugins/specweave-github/lib/github-us-auto-closer.ts +226 -0
  146. package/plugins/specweave-github/lib/index.js +1 -7
  147. package/plugins/specweave-github/lib/index.ts +1 -4
  148. package/plugins/specweave-github/skills/github-sync/SKILL.md +76 -4
  149. package/plugins/specweave-testing/commands/e2e-setup.md +18 -0
  150. package/plugins/specweave-testing/commands/ui-automate.md +2 -0
  151. package/plugins/specweave-testing/commands/ui-inspect.md +8 -0
  152. package/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +6 -0
  153. package/plugins/specweave-testing/lib/playwright-ci-defaults.js +14 -0
  154. package/plugins/specweave-testing/lib/playwright-ci-defaults.ts +24 -0
  155. package/plugins/specweave-testing/lib/playwright-cli-detector.js +33 -0
  156. package/plugins/specweave-testing/lib/playwright-cli-detector.ts +48 -0
  157. package/plugins/specweave-testing/lib/playwright-cli-runner.js +58 -0
  158. package/plugins/specweave-testing/lib/playwright-cli-runner.ts +80 -0
  159. package/plugins/specweave-testing/lib/playwright-routing.js +16 -0
  160. package/plugins/specweave-testing/lib/playwright-routing.ts +38 -0
  161. package/plugins/specweave-testing/skills/e2e-testing/SKILL.md +38 -0
  162. package/src/templates/CLAUDE.md.template +7 -0
  163. package/src/templates/config.json.template +9 -1
  164. package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
  165. package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
  166. package/dist/plugins/specweave-github/lib/subtask-sync.js +0 -147
  167. package/dist/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
  168. package/dist/plugins/specweave-github/lib/task-parser.d.ts +0 -37
  169. package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
  170. package/dist/plugins/specweave-github/lib/task-parser.js +0 -211
  171. package/dist/plugins/specweave-github/lib/task-parser.js.map +0 -1
  172. package/dist/plugins/specweave-github/lib/task-sync.d.ts +0 -56
  173. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
  174. package/dist/plugins/specweave-github/lib/task-sync.js +0 -375
  175. package/dist/plugins/specweave-github/lib/task-sync.js.map +0 -1
  176. package/plugins/specweave/hooks/validate-completion-conditions.sh +0 -474
  177. package/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
  178. package/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
  179. package/plugins/specweave-github/lib/subtask-sync.js +0 -154
  180. package/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
  181. package/plugins/specweave-github/lib/subtask-sync.ts +0 -225
  182. package/plugins/specweave-github/lib/task-parser.d.js +0 -0
  183. package/plugins/specweave-github/lib/task-parser.d.ts +0 -37
  184. package/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
  185. package/plugins/specweave-github/lib/task-parser.js +0 -195
  186. package/plugins/specweave-github/lib/task-parser.js.map +0 -1
  187. package/plugins/specweave-github/lib/task-parser.ts +0 -246
  188. package/plugins/specweave-github/lib/task-sync.d.js +0 -0
  189. package/plugins/specweave-github/lib/task-sync.d.ts +0 -51
  190. package/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
  191. package/plugins/specweave-github/lib/task-sync.js +0 -415
  192. package/plugins/specweave-github/lib/task-sync.js.map +0 -1
  193. package/plugins/specweave-github/lib/task-sync.ts +0 -451
  194. package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +0 -496
  195. /package/plugins/specweave/hooks/{stop-auto.sh → _archive/stop-auto-v4-legacy.sh} +0 -0
  196. /package/plugins/{specweave-github/lib/subtask-sync.d.js → specweave-testing/lib/playwright-ci-defaults.d.js} +0 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ description: Show status of parallel development agents launched by team-orchestrate. Activates for: team status, agent status, parallel status, check agents.
3
+ ---
4
+
5
+ # Team Status
6
+
7
+ **Show progress of parallel development agents.**
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ /sw:team-status
13
+ /sw:team-status --watch # Auto-refresh every 2s
14
+ /sw:team-status --json # Machine-readable output
15
+ ```
16
+
17
+ ## What This Skill Does
18
+
19
+ Reads the parallel session state and each agent's increment to produce a status table. Supports both native Agent Teams mode and subagent fallback mode.
20
+
21
+ ## Mode Detection
22
+
23
+ Check which mode is active:
24
+
25
+ 1. **Native Agent Teams mode** — if `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` is set and a team session is active, query teammates directly for status
26
+ 2. **Subagent mode** — read `.specweave/state/parallel/session.json` and check each agent's TaskOutput
27
+
28
+ ## Implementation Steps
29
+
30
+ ### Native Agent Teams Mode
31
+
32
+ 1. List active teammates in the current team
33
+ 2. For each teammate, check their assigned increment's `tasks.md`
34
+ 3. Query teammate status (idle, working, completed)
35
+ 4. Display terminal pane info (tmux pane index or in-process index)
36
+
37
+ ### Subagent Mode (Fallback)
38
+
39
+ 1. **Read session state** from `.specweave/state/parallel/session.json`
40
+ 2. **For each agent**, read its increment's `tasks.md` to compute completion percentage
41
+ 3. **Check agent task status** via TaskOutput (if still running)
42
+ 4. **Check heartbeat** — if last heartbeat > 5 minutes, mark as potentially stale
43
+
44
+ ### Display Summary
45
+
46
+ 4. **Display summary table**
47
+
48
+ ## Output Format
49
+
50
+ ```
51
+ Team Status: session-uuid (started 2h ago)
52
+ Mode: Native Agent Teams (tmux split panes)
53
+
54
+ | Agent | Domain | Increment | Tasks | Progress | Status |
55
+ |----------|----------|-------------------------|--------|----------|---------|
56
+ | Agent 1 | frontend | 0193-checkout-frontend | 5/8 | 62% | running |
57
+ | Agent 2 | backend | 0194-checkout-backend | 3/6 | 50% | running |
58
+ | Agent 3 | shared | 0195-checkout-shared | 4/4 | 100% | done |
59
+
60
+ Overall: 12/18 tasks (67%)
61
+ Active Skills: sw-frontend:frontend-architect, sw:architect, sw:architect
62
+ ```
63
+
64
+ ## Agent State Icons
65
+
66
+ | Icon | Status |
67
+ |------|--------|
68
+ | `⏳` | pending — agent not yet spawned |
69
+ | `🔄` | running — agent actively working |
70
+ | `✅` | done — all tasks completed, quality gate passed |
71
+ | `❌` | failed — agent encountered unrecoverable error |
72
+ | `🚫` | cancelled — agent was stopped by user |
73
+ | `💀` | stale — no heartbeat in >5 minutes (subagent mode) |
74
+
75
+ ## Error Handling
76
+
77
+ - If no session file exists, report "No active team session"
78
+ - If native Agent Teams mode but no team found, report "No active agent team — try /sw:team-orchestrate first"
79
+ - If an agent's increment is missing, report "increment not found"
80
+ - If a task file can't be parsed, show "?" for progress
81
+ - If agent heartbeat is stale, warn user and suggest checking agent
82
+
83
+ ## Options
84
+
85
+ | Option | Description |
86
+ |--------|-------------|
87
+ | `--watch` | Auto-refresh every 2 seconds |
88
+ | `--json` | Output as JSON for programmatic use |
89
+ | `--verbose` | Show per-task detail for each agent |
@@ -1,7 +1,7 @@
1
1
  # Multi-Project GitHub Sync Architecture
2
2
 
3
- **Version**: v0.18.0+
4
- **Date**: 2025-11-11
3
+ **Version**: v1.0.235+ (V2 Integration)
4
+ **Date**: 2026-02-06
5
5
  **Status**: Implemented and Tested
6
6
 
7
7
  ---
@@ -643,16 +643,102 @@ spec-003.md
643
643
 
644
644
  ---
645
645
 
646
+ ## Projects V2 Integration (v1.0.235+)
647
+
648
+ ### Overview
649
+
650
+ The sync system now supports GitHub Projects V2 for visual project management:
651
+ - Issues are added to Projects V2 boards after creation
652
+ - Status and Priority custom fields are synced via configurable mappings
653
+ - Cross-repo issues can be added to the same org-level project
654
+
655
+ ### Architecture
656
+
657
+ ```
658
+ Spec → Push Sync → GitHub Issues → Board Resolver V2 → Projects V2
659
+ Field Sync → Status/Priority fields
660
+ Frontmatter Updater → spec.md metadata
661
+ ```
662
+
663
+ ### Key Components
664
+
665
+ | Module | Purpose |
666
+ |--------|---------|
667
+ | `github-sync-orchestrator.ts` | Composes push + V2 + frontmatter into single flow |
668
+ | `github-board-resolver-v2.ts` | Find/create Projects V2 boards |
669
+ | `github-field-sync.ts` | Sync Status/Priority custom fields |
670
+ | `github-graphql-client.ts` | GraphQL mutations via `gh api graphql` |
671
+ | `github-spec-frontmatter-updater.ts` | Write sync results to spec.md |
672
+
673
+ ### Configuration
674
+
675
+ ```json
676
+ {
677
+ "sync": {
678
+ "profiles": {
679
+ "myproject": {
680
+ "provider": "github",
681
+ "config": {
682
+ "owner": "myorg",
683
+ "repo": "myrepo",
684
+ "projectV2Enabled": true,
685
+ "projectV2Number": 5,
686
+ "statusFieldMapping": {
687
+ "planned": "Todo",
688
+ "in-progress": "In Progress",
689
+ "completed": "Done"
690
+ }
691
+ }
692
+ }
693
+ }
694
+ }
695
+ }
696
+ ```
697
+
698
+ ### Pull Sync (GitHub to Spec)
699
+
700
+ The pull sync fetches GitHub issue state and compares with spec ACs:
701
+ - `github-pull-sync.ts` — fetches issues, compares AC states
702
+ - `github-conflict-resolver.ts` — field-level conflict detection
703
+ - Modes: `github-wins` (default for status/AC), `spec-wins`, `prompt` (for content)
704
+
705
+ ### Cross-Repo Sync
706
+
707
+ - `github-cross-repo-sync.ts` — creates issues in multiple repos per user story
708
+ - Cross-references added: "Also tracked in: org/other-repo#XX"
709
+ - All cross-repo issues can be added to a shared org-level Projects V2 board
710
+
711
+ ### Batch Sync
712
+
713
+ - `github-batch-sync.ts` — discovers all specs and syncs sequentially
714
+ - Usage: `batchSyncAllSpecs({ owner, repo, workspaceRoot })`
715
+ - Returns aggregated summary: specs processed, issues created/updated, errors
716
+
717
+ ### Agent Teams Orchestration
718
+
719
+ Skills for parallel multi-domain development:
720
+ - `/sw:team-orchestrate` — analyze feature, create per-domain increments, spawn agents
721
+ - `/sw:team-status` — show agent progress table
722
+ - `/sw:team-merge` — merge in dependency order, trigger sync per increment
723
+
646
724
  ## References
647
725
 
648
- - **Implementation**: `plugins/specweave-github/lib/github-spec-sync.ts`
649
- - **Types**: `src/core/types/sync-profile.ts`, `src/core/types/spec-metadata.ts`
650
- - **Tests**: `tests/e2e/github-sync-multi-project.spec.ts`
651
- - **Project Management**: `src/core/sync/project-context.ts`
726
+ - **Orchestrator**: `plugins/specweave-github/lib/github-sync-orchestrator.ts`
727
+ - **Push Sync**: `plugins/specweave-github/lib/github-push-sync.ts`
728
+ - **Pull Sync**: `plugins/specweave-github/lib/github-pull-sync.ts`
729
+ - **Board Resolver V2**: `plugins/specweave-github/lib/github-board-resolver-v2.ts`
730
+ - **Field Sync**: `plugins/specweave-github/lib/github-field-sync.ts`
731
+ - **Conflict Resolver**: `plugins/specweave-github/lib/github-conflict-resolver.ts`
732
+ - **Cross-Repo**: `plugins/specweave-github/lib/github-cross-repo-sync.ts`
733
+ - **Batch Sync**: `plugins/specweave-github/lib/github-batch-sync.ts`
734
+ - **GraphQL Client**: `plugins/specweave-github/lib/github-graphql-client.ts`
735
+ - **Types**: `src/core/types/sync-profile.ts`
736
+ - **Tests**: `tests/unit/plugins/github/`
737
+ - **Legacy**: `plugins/specweave-github/lib/github-spec-sync.ts`
652
738
  - **Original Architecture Fix**: `plugins/specweave-github/SYNC-ARCHITECTURE-FIX-SUMMARY.md`
653
739
 
654
740
  ---
655
741
 
656
- **Version**: v0.18.0
657
- **Last Updated**: 2025-11-11
742
+ **Version**: v1.0.235
743
+ **Last Updated**: 2026-02-06
658
744
  **Status**: Complete and Tested
@@ -1,10 +1,24 @@
1
1
  ---
2
- description: Synchronize SpecWeave increment with GitHub issue (Multi-Project Support). Select profile, configure time range, and sync with rate limit protection.
2
+ description: "[DEPRECATED] Use /sw-github:sync-spec instead. Legacy increment-based GitHub sync."
3
3
  ---
4
4
 
5
- # Sync Increment with GitHub Issue (Multi-Project)
5
+ # DEPRECATED: Use `/sw-github:sync-spec` Instead
6
6
 
7
- ## ⚠️ CRITICAL: Pre-Sync Requirements (Read First!)
7
+ > **This command is deprecated as of v1.0.235.** The increment-based sync has been replaced by spec-based sync.
8
+ >
9
+ > **Migration:**
10
+ > - For spec-to-GitHub Issue sync: `/sw-github:sync-spec <spec-id>`
11
+ > - For batch sync: `/sw-github:sync-spec --all`
12
+ > - For pull direction: `/sw-github:sync-spec <spec-id> --direction from-github`
13
+ >
14
+ > The old increment-based sync created issues per-task. The new spec-based sync creates issues per-User-Story,
15
+ > which is the correct granularity for GitHub project management.
16
+
17
+ ---
18
+
19
+ # Legacy: Sync Increment with GitHub Issue (Multi-Project)
20
+
21
+ ## Pre-Sync Requirements (Read First!)
8
22
 
9
23
  ### ⛔ MANDATORY: Sync Living Docs BEFORE GitHub Sync
10
24
 
@@ -0,0 +1,255 @@
1
+ #!/bin/bash
2
+
3
+ # SpecWeave GitHub AC Sync Handler (v1.0.236+)
4
+ # Background handler: posts progress comments to GitHub after AC sync.
5
+ #
6
+ # Triggered by post-tool-use.sh after task-ac-sync-guard updates spec.md ACs.
7
+ # Runs in BACKGROUND via safe_run_background — never blocks the main chain.
8
+ #
9
+ # Features:
10
+ # - 5s debounce (batches rapid AC changes)
11
+ # - Circuit breaker (3 consecutive failures → auto-disable)
12
+ # - File locking (prevents concurrent handler executions)
13
+ # - Non-blocking (all errors → exit 0 with logging)
14
+ #
15
+ # Usage: github-ac-sync-handler.sh <INCREMENT_ID>
16
+ # Called by: safe_run_background in post-tool-use.sh
17
+
18
+ set +e # Never crash Claude Code
19
+
20
+ # EMERGENCY KILL SWITCH
21
+ if [[ "${SPECWEAVE_DISABLE_HOOKS:-0}" == "1" ]]; then
22
+ exit 0
23
+ fi
24
+
25
+ # ============================================================================
26
+ # PROJECT ROOT DETECTION
27
+ # ============================================================================
28
+
29
+ find_project_root() {
30
+ local dir="$1"
31
+ while [ "$dir" != "/" ]; do
32
+ if [ -d "$dir/.specweave" ]; then
33
+ echo "$dir"
34
+ return 0
35
+ fi
36
+ dir="$(dirname "$dir")"
37
+ done
38
+ return 1
39
+ }
40
+
41
+ PROJECT_ROOT="$(find_project_root "$(pwd)")"
42
+ if [[ -z "$PROJECT_ROOT" ]]; then
43
+ exit 0
44
+ fi
45
+ cd "$PROJECT_ROOT" 2>/dev/null || exit 0
46
+
47
+ # ============================================================================
48
+ # ARGUMENTS
49
+ # ============================================================================
50
+
51
+ INC_ID="$1"
52
+ if [[ -z "$INC_ID" ]]; then
53
+ exit 0
54
+ fi
55
+
56
+ SPEC_PATH="$PROJECT_ROOT/.specweave/increments/$INC_ID/spec.md"
57
+ if [[ ! -f "$SPEC_PATH" ]]; then
58
+ exit 0
59
+ fi
60
+
61
+ # ============================================================================
62
+ # LOGGING
63
+ # ============================================================================
64
+
65
+ LOGS_DIR="$PROJECT_ROOT/.specweave/logs"
66
+ LOG_FILE="$LOGS_DIR/github-ac-sync.log"
67
+ mkdir -p "$LOGS_DIR" 2>/dev/null || true
68
+
69
+ log() {
70
+ echo "[$(date '+%Y-%m-%d %H:%M:%S')] [github-ac-sync] $1" >> "$LOG_FILE" 2>/dev/null || true
71
+ }
72
+
73
+ # ============================================================================
74
+ # CIRCUIT BREAKER
75
+ # ============================================================================
76
+
77
+ STATE_DIR="$PROJECT_ROOT/.specweave/state"
78
+ CIRCUIT_BREAKER_FILE="$STATE_DIR/.hook-circuit-breaker-github-ac"
79
+ CIRCUIT_BREAKER_THRESHOLD=3
80
+
81
+ mkdir -p "$STATE_DIR" 2>/dev/null || true
82
+
83
+ if [[ -f "$CIRCUIT_BREAKER_FILE" ]]; then
84
+ FAILURE_COUNT=$(cat "$CIRCUIT_BREAKER_FILE" 2>/dev/null || echo 0)
85
+ if (( FAILURE_COUNT >= CIRCUIT_BREAKER_THRESHOLD )); then
86
+ log "Circuit breaker OPEN ($FAILURE_COUNT failures). Skipping."
87
+ exit 0
88
+ fi
89
+ fi
90
+
91
+ # ============================================================================
92
+ # FILE LOCKING
93
+ # ============================================================================
94
+
95
+ LOCK_FILE="$STATE_DIR/.hook-github-ac-sync.lock"
96
+ LOCK_TIMEOUT=15
97
+
98
+ LOCK_ACQUIRED=false
99
+ for i in {1..10}; do
100
+ if mkdir "$LOCK_FILE" 2>/dev/null; then
101
+ LOCK_ACQUIRED=true
102
+ trap 'rmdir "$LOCK_FILE" 2>/dev/null || true' EXIT
103
+ break
104
+ fi
105
+
106
+ # Check for stale lock
107
+ if [[ -d "$LOCK_FILE" ]]; then
108
+ LOCK_AGE=$(($(date +%s) - $(stat -f "%m" "$LOCK_FILE" 2>/dev/null || echo 0)))
109
+ if (( LOCK_AGE > LOCK_TIMEOUT )); then
110
+ rmdir "$LOCK_FILE" 2>/dev/null || true
111
+ continue
112
+ fi
113
+ fi
114
+
115
+ sleep 0.3
116
+ done
117
+
118
+ if [[ "$LOCK_ACQUIRED" == "false" ]]; then
119
+ log "Lock not acquired. Another instance running. Skipping."
120
+ exit 0
121
+ fi
122
+
123
+ # ============================================================================
124
+ # DEBOUNCE (5s window)
125
+ # ============================================================================
126
+
127
+ SIGNAL_FILE="$STATE_DIR/.github-ac-pending-$INC_ID"
128
+
129
+ if [[ -f "$SIGNAL_FILE" ]]; then
130
+ SIGNAL_AGE=$(($(date +%s) - $(stat -f "%m" "$SIGNAL_FILE" 2>/dev/null || echo 0)))
131
+ if (( SIGNAL_AGE < 5 )); then
132
+ # Another invocation was recent — let a later one handle it
133
+ log "Debounce: signal file age ${SIGNAL_AGE}s < 5s. Deferring."
134
+ exit 0
135
+ fi
136
+ fi
137
+
138
+ # Create/update signal file and wait for debounce window
139
+ echo "$(date +%s)" > "$SIGNAL_FILE" 2>/dev/null || true
140
+ sleep 5
141
+
142
+ # After sleeping, check if a NEWER invocation took over
143
+ if [[ -f "$SIGNAL_FILE" ]]; then
144
+ CURRENT_SIGNAL=$(cat "$SIGNAL_FILE" 2>/dev/null || echo 0)
145
+ NOW=$(date +%s)
146
+ SIGNAL_AGE=$((NOW - CURRENT_SIGNAL))
147
+ if (( SIGNAL_AGE > 6 )); then
148
+ # Another invocation wrote a newer timestamp — it will handle this
149
+ log "Debounce: newer invocation detected. Exiting."
150
+ exit 0
151
+ fi
152
+ fi
153
+
154
+ # Clean up signal file — we're the one handling it
155
+ rm -f "$SIGNAL_FILE" 2>/dev/null || true
156
+
157
+ # ============================================================================
158
+ # PRECONDITIONS
159
+ # ============================================================================
160
+
161
+ if ! command -v node &>/dev/null; then
162
+ log "Node.js not found. Skipping."
163
+ exit 0
164
+ fi
165
+
166
+ if ! command -v gh &>/dev/null; then
167
+ log "GitHub CLI (gh) not found. Skipping."
168
+ exit 0
169
+ fi
170
+
171
+ # Check GitHub sync is enabled in config
172
+ CONFIG_FILE="$PROJECT_ROOT/.specweave/config.json"
173
+ if [[ -f "$CONFIG_FILE" ]] && command -v jq >/dev/null 2>&1; then
174
+ GH_ENABLED=$(jq -r '.sync.github.enabled // false' "$CONFIG_FILE" 2>/dev/null)
175
+ if [[ "$GH_ENABLED" != "true" ]]; then
176
+ log "GitHub sync not enabled in config. Skipping."
177
+ exit 0
178
+ fi
179
+ fi
180
+
181
+ # ============================================================================
182
+ # POST PROGRESS COMMENT
183
+ # ============================================================================
184
+
185
+ log "Posting progress comment for increment $INC_ID..."
186
+
187
+ # Find the comment poster module
188
+ POSTER_MODULE="$PROJECT_ROOT/plugins/specweave-github/lib/github-ac-comment-poster.js"
189
+ if [[ ! -f "$POSTER_MODULE" ]]; then
190
+ # Try dist/ fallback
191
+ POSTER_MODULE="$PROJECT_ROOT/dist/plugins/specweave-github/lib/github-ac-comment-poster.js"
192
+ fi
193
+
194
+ if [[ ! -f "$POSTER_MODULE" ]]; then
195
+ log "Comment poster module not found. Skipping."
196
+ exit 0
197
+ fi
198
+
199
+ # Run comment poster via node
200
+ OUTPUT=$(node -e "
201
+ import { postACProgressComments } from '${POSTER_MODULE}';
202
+ const specPath = '${SPEC_PATH}';
203
+ const incrementId = '${INC_ID}';
204
+ // Post for all user stories (the module filters by available issue links)
205
+ const result = await postACProgressComments(incrementId, [], specPath, {
206
+ owner: process.env.GITHUB_OWNER || '',
207
+ repo: process.env.GITHUB_REPO || '',
208
+ });
209
+ console.log(JSON.stringify(result));
210
+ " 2>&1) || true
211
+
212
+ EXIT_CODE=$?
213
+
214
+ if [[ $EXIT_CODE -ne 0 ]]; then
215
+ log "Comment poster failed (exit $EXIT_CODE): $OUTPUT"
216
+
217
+ # Update circuit breaker
218
+ FAILURE_COUNT=$(cat "$CIRCUIT_BREAKER_FILE" 2>/dev/null || echo 0)
219
+ echo "$((FAILURE_COUNT + 1))" > "$CIRCUIT_BREAKER_FILE" 2>/dev/null || true
220
+
221
+ exit 0
222
+ fi
223
+
224
+ log "Comment poster completed: $OUTPUT"
225
+
226
+ # Reset circuit breaker on success
227
+ echo "0" > "$CIRCUIT_BREAKER_FILE" 2>/dev/null || true
228
+
229
+ # ============================================================================
230
+ # AUTO-CLOSE COMPLETED USER STORIES (v1.0.236+)
231
+ # ============================================================================
232
+
233
+ CLOSER_MODULE="$PROJECT_ROOT/plugins/specweave-github/lib/github-us-auto-closer.js"
234
+ if [[ ! -f "$CLOSER_MODULE" ]]; then
235
+ CLOSER_MODULE="$PROJECT_ROOT/dist/plugins/specweave-github/lib/github-us-auto-closer.js"
236
+ fi
237
+
238
+ if [[ -f "$CLOSER_MODULE" ]]; then
239
+ log "Running auto-closer for increment $INC_ID..."
240
+
241
+ CLOSE_OUTPUT=$(node -e "
242
+ import { autoCloseCompletedUserStories } from '${CLOSER_MODULE}';
243
+ const specPath = '${SPEC_PATH}';
244
+ const incrementId = '${INC_ID}';
245
+ const result = await autoCloseCompletedUserStories(incrementId, [], specPath, {
246
+ owner: process.env.GITHUB_OWNER || '',
247
+ repo: process.env.GITHUB_REPO || '',
248
+ });
249
+ console.log(JSON.stringify(result));
250
+ " 2>&1) || true
251
+
252
+ log "Auto-closer completed: $CLOSE_OUTPUT"
253
+ fi
254
+
255
+ exit 0