specweave 0.28.1 → 0.28.5

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 (57) hide show
  1. package/README.md +34 -95
  2. package/dist/src/core/living-docs/feature-consistency-validator.d.ts +129 -0
  3. package/dist/src/core/living-docs/feature-consistency-validator.d.ts.map +1 -0
  4. package/dist/src/core/living-docs/feature-consistency-validator.js +445 -0
  5. package/dist/src/core/living-docs/feature-consistency-validator.js.map +1 -0
  6. package/dist/src/core/living-docs/index.d.ts +1 -0
  7. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  8. package/dist/src/core/living-docs/index.js +1 -0
  9. package/dist/src/core/living-docs/index.js.map +1 -1
  10. package/dist/src/core/living-docs/living-docs-sync.d.ts +13 -0
  11. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  12. package/dist/src/core/living-docs/living-docs-sync.js +50 -0
  13. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  14. package/dist/src/core/repo-structure/platform-registry.d.ts.map +1 -1
  15. package/dist/src/core/repo-structure/platform-registry.js +3 -2
  16. package/dist/src/core/repo-structure/platform-registry.js.map +1 -1
  17. package/dist/src/core/repo-structure/prompt-consolidator.d.ts.map +1 -1
  18. package/dist/src/core/repo-structure/prompt-consolidator.js +4 -2
  19. package/dist/src/core/repo-structure/prompt-consolidator.js.map +1 -1
  20. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  21. package/dist/src/core/repo-structure/repo-structure-manager.js +18 -32
  22. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  23. package/dist/src/utils/auth-helpers.d.ts.map +1 -1
  24. package/dist/src/utils/auth-helpers.js +13 -1
  25. package/dist/src/utils/auth-helpers.js.map +1 -1
  26. package/package.json +1 -1
  27. package/plugins/specweave/commands/specweave-validate-features.md +203 -0
  28. package/plugins/specweave/hooks/docs-changed.sh.backup +79 -0
  29. package/plugins/specweave/hooks/hooks.json +10 -0
  30. package/plugins/specweave/hooks/human-input-required.sh.backup +75 -0
  31. package/plugins/specweave/hooks/post-first-increment.sh.backup +61 -0
  32. package/plugins/specweave/hooks/post-increment-change.sh.backup +98 -0
  33. package/plugins/specweave/hooks/post-increment-completion.sh.backup +231 -0
  34. package/plugins/specweave/hooks/post-increment-planning.sh.backup +1048 -0
  35. package/plugins/specweave/hooks/post-increment-status-change.sh.backup +147 -0
  36. package/plugins/specweave/hooks/post-metadata-change.sh +18 -0
  37. package/plugins/specweave/hooks/post-spec-update.sh.backup +158 -0
  38. package/plugins/specweave/hooks/post-user-story-complete.sh.backup +179 -0
  39. package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +83 -0
  40. package/plugins/specweave/hooks/pre-implementation.sh.backup +67 -0
  41. package/plugins/specweave/hooks/pre-task-completion.sh.backup +194 -0
  42. package/plugins/specweave/hooks/pre-tool-use.sh.backup +133 -0
  43. package/plugins/specweave/hooks/user-prompt-submit.sh.backup +386 -0
  44. package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +353 -0
  45. package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +172 -0
  46. package/plugins/specweave-ado/lib/ado-multi-project-sync.js +1 -0
  47. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  48. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +1104 -0
  49. package/plugins/specweave-github/hooks/post-task-completion.sh.backup +258 -0
  50. package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +172 -0
  51. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
  52. package/plugins/specweave-kafka/skills/kafka-mcp-integration/SKILL.md +17 -0
  53. package/plugins/specweave-plugin-dev/skills/claude-sdk/SKILL.md +3 -1
  54. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +1017 -0
  55. package/plugins/specweave-release/hooks/post-task-completion.sh.backup +110 -0
  56. package/plugins/specweave-ui/commands/ui-automate.md +5 -28
  57. package/src/templates/AGENTS.md.template +92 -9
@@ -10,6 +10,7 @@ import * as fs from 'fs';
10
10
  import * as path from 'path';
11
11
  import * as os from 'os';
12
12
  import * as yaml from 'js-yaml';
13
+ import { execSync } from 'child_process';
13
14
  /**
14
15
  * Get GitHub authentication token
15
16
  * Priority: GITHUB_TOKEN (CI) > GH_TOKEN (custom) > gh CLI config (local)
@@ -23,7 +24,18 @@ export function getGitHubAuth() {
23
24
  if (process.env.GH_TOKEN) {
24
25
  return { token: process.env.GH_TOKEN, source: 'GH_TOKEN' };
25
26
  }
26
- // 3. Try to parse gh CLI config (~/.config/gh/hosts.yml)
27
+ // 3. Try to get token via gh CLI command (works with Keychain, plain-text, etc.)
28
+ try {
29
+ const token = execSync('gh auth token', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
30
+ if (token && token.length > 0) {
31
+ return { token, source: 'gh-cli' };
32
+ }
33
+ }
34
+ catch (error) {
35
+ // gh CLI not installed or not authenticated - silently fail
36
+ }
37
+ // 4. Fallback: Try to parse gh CLI config directly (~/.config/gh/hosts.yml)
38
+ // This covers edge cases where gh CLI isn't available but config file exists
27
39
  try {
28
40
  const ghConfigPath = path.join(os.homedir(), '.config', 'gh', 'hosts.yml');
29
41
  if (fs.existsSync(ghConfigPath)) {
@@ -1 +1 @@
1
- {"version":3,"file":"auth-helpers.js","sourceRoot":"","sources":["../../../src/utils/auth-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAmBhC;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,0DAA0D;IAC1D,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QAC7B,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY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MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAEvC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB;IACvC,qBAAqB;IACrB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qCAAqC;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,OAAO,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,kBAAkB,EAAE,KAAK,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,WAAW,EAAE,KAAK,IAAI,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAMjC,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,GAAG,EAAE,yBAAyB,EAAE;QAChC,IAAI,EAAE,kBAAkB,EAAE;QAC1B,uBAAuB,EAAE,yBAAyB,EAAE;KACrD,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specweave",
3
- "version": "0.28.1",
3
+ "version": "0.28.5",
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",
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: specweave:validate-features
3
+ description: Validate feature folder consistency between _features/ and project folders. Detects orphaned features and auto-repairs discrepancies. Use when features appear in _features but not in project folders.
4
+ ---
5
+
6
+ # Validate Feature Folder Consistency
7
+
8
+ Validates that features in `_features/` have corresponding project folders (e.g., `specweave/FS-XXX/`).
9
+
10
+ ---
11
+
12
+ ## STEP 1: Parse Arguments
13
+
14
+ ```
15
+ Arguments: [user's arguments]
16
+ ```
17
+
18
+ **Options**:
19
+ - `--repair`: Auto-repair discrepancies (create missing project folders)
20
+ - `--dry-run`: Show what would be repaired without making changes
21
+
22
+ ---
23
+
24
+ ## STEP 2: Run Consistency Validation
25
+
26
+ **Execute**:
27
+
28
+ ```typescript
29
+ import { FeatureConsistencyValidator } from './dist/src/core/living-docs/feature-consistency-validator.js';
30
+
31
+ const validator = new FeatureConsistencyValidator(process.cwd(), {
32
+ defaultProject: 'specweave'
33
+ });
34
+
35
+ // Parse repair flag
36
+ const autoRepair = process.argv.includes('--repair');
37
+ const dryRun = process.argv.includes('--dry-run');
38
+
39
+ if (dryRun) {
40
+ console.log('🔍 DRY RUN MODE - No files will be modified\n');
41
+ }
42
+
43
+ // Run validation
44
+ const result = await validator.validate(autoRepair && !dryRun);
45
+ ```
46
+
47
+ ---
48
+
49
+ ## STEP 3: Report Results
50
+
51
+ **Output format**:
52
+
53
+ ```
54
+ ═══════════════════════════════════════════════════════
55
+ 📊 FEATURE CONSISTENCY VALIDATION REPORT
56
+ ═══════════════════════════════════════════════════════
57
+
58
+ Total features scanned: {total}
59
+ Consistent: {consistent}
60
+ Discrepancies found: {discrepancies}
61
+
62
+ ───────────────────────────────────────────────────────
63
+ {if discrepancies > 0}
64
+ ⚠️ DISCREPANCIES FOUND
65
+
66
+ {for each discrepancy}
67
+ Feature: {featureId}
68
+ Type: {type}
69
+ Description: {description}
70
+ Auto-repairable: {yes/no}
71
+ {if linkedIncrement}
72
+ Linked increment: {incrementId} ({exists/not found})
73
+ {/if}
74
+
75
+ {/for}
76
+ ───────────────────────────────────────────────────────
77
+ {/if}
78
+
79
+ {if repairs}
80
+ 🔧 REPAIR RESULTS
81
+
82
+ {for each repair}
83
+ {✅/❌} {featureId}: {action}
84
+ {if error} Error: {error}{/if}
85
+ {/for}
86
+ {/if}
87
+
88
+ ═══════════════════════════════════════════════════════
89
+ ```
90
+
91
+ ---
92
+
93
+ ## STEP 4: Provide Next Steps
94
+
95
+ ```
96
+ 🎯 NEXT STEPS
97
+ ───────────────────────────────────────────────────────
98
+
99
+ {if discrepancies > 0 && !repair}
100
+ To auto-repair these discrepancies:
101
+ /specweave:validate-features --repair
102
+
103
+ This will:
104
+ • Create missing project folders
105
+ • Generate README.md files
106
+ • Link to existing FEATURE.md
107
+ {/if}
108
+
109
+ {if all repaired}
110
+ ✅ All discrepancies have been repaired!
111
+
112
+ Verify the repairs:
113
+ ls -la .specweave/docs/internal/specs/specweave/
114
+ {/if}
115
+
116
+ {if orphaned features}
117
+ ⚠️ Some features could not be auto-repaired.
118
+
119
+ Manual intervention required for:
120
+ {list orphaned features}
121
+
122
+ Options:
123
+ 1. Delete orphaned _features folder if no longer needed
124
+ 2. Re-sync from increment if increment still exists
125
+ 3. Create project folder manually
126
+ {/if}
127
+ ```
128
+
129
+ ---
130
+
131
+ ## EXAMPLES
132
+
133
+ ### Example 1: Check for discrepancies
134
+ ```
135
+ User: /specweave:validate-features
136
+
137
+ Output:
138
+ ═══════════════════════════════════════════════════════
139
+ 📊 FEATURE CONSISTENCY VALIDATION REPORT
140
+ ═══════════════════════════════════════════════════════
141
+
142
+ Total features scanned: 7
143
+ Consistent: 6
144
+ Discrepancies found: 1
145
+
146
+ ───────────────────────────────────────────────────────
147
+ ⚠️ DISCREPANCIES FOUND
148
+
149
+ Feature: FS-062
150
+ Type: missing_project_folder
151
+ Description: Feature FS-062 exists in _features/ but not in any project folder
152
+ Auto-repairable: Yes
153
+ Linked increment: 0062-test-living-docs-auto-sync (not found)
154
+
155
+ ───────────────────────────────────────────────────────
156
+
157
+ 🎯 To repair: /specweave:validate-features --repair
158
+ ═══════════════════════════════════════════════════════
159
+ ```
160
+
161
+ ### Example 2: Auto-repair discrepancies
162
+ ```
163
+ User: /specweave:validate-features --repair
164
+
165
+ Output:
166
+ ═══════════════════════════════════════════════════════
167
+ 📊 FEATURE CONSISTENCY VALIDATION REPORT
168
+ ═══════════════════════════════════════════════════════
169
+
170
+ Total features scanned: 7
171
+ Consistent: 7
172
+ Discrepancies found: 1
173
+
174
+ ───────────────────────────────────────────────────────
175
+ 🔧 REPAIR RESULTS
176
+
177
+ ✅ FS-062: Created .specweave/docs/internal/specs/specweave/FS-062/README.md
178
+
179
+ ═══════════════════════════════════════════════════════
180
+ ```
181
+
182
+ ---
183
+
184
+ ## WHEN TO USE
185
+
186
+ **Use this command when**:
187
+ - Features appear in `_features/` but not in project folders
188
+ - After interrupted/failed sync operations
189
+ - After manual cleanup of increments
190
+ - Periodic health check of living docs structure
191
+
192
+ **Root cause of discrepancies**:
193
+ 1. Sync interrupted between creating _features and project folders
194
+ 2. Increment deleted without cleaning up living docs
195
+ 3. Manual editing of living docs structure
196
+
197
+ ---
198
+
199
+ ## RELATED COMMANDS
200
+
201
+ - `/specweave:sync-specs` - Sync increment to living docs (includes consistency check)
202
+ - `/specweave:validate` - Validate increment structure
203
+ - `/specweave:archive` - Archive completed increments
@@ -0,0 +1,79 @@
1
+ #!/bin/bash
2
+
3
+ # SpecWeave Docs-Changed Hook
4
+ # Runs after file changes are detected
5
+ # Detects if documentation was changed during implementation
6
+ # Triggers review workflow if needed
7
+
8
+ set -e
9
+
10
+ # Find project root by searching upward for .specweave/ directory
11
+ # Works regardless of where hook is installed (source or .claude/hooks/)
12
+ find_project_root() {
13
+ local dir="$1"
14
+ while [ "$dir" != "/" ]; do
15
+ if [ -d "$dir/.specweave" ]; then
16
+ echo "$dir"
17
+ return 0
18
+ fi
19
+ dir="$(dirname "$dir")"
20
+ done
21
+ # Fallback: try current directory
22
+ if [ -d "$(pwd)/.specweave" ]; then
23
+ pwd
24
+ else
25
+ echo "$(pwd)"
26
+ fi
27
+ }
28
+
29
+ PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
30
+ cd "$PROJECT_ROOT"
31
+
32
+ # Colors
33
+ RED='\033[0;31m'
34
+ YELLOW='\033[1;33m'
35
+ NC='\033[0m'
36
+
37
+ # Get changed files (git)
38
+ if ! git rev-parse --git-dir > /dev/null 2>&1; then
39
+ # Not a git repository, skip
40
+ exit 0
41
+ fi
42
+
43
+ CHANGED_FILES=$(git diff --name-only HEAD 2>/dev/null || echo "")
44
+
45
+ if [ -z "$CHANGED_FILES" ]; then
46
+ # No changes
47
+ exit 0
48
+ fi
49
+
50
+ # Check if any documentation files changed
51
+ DOC_CHANGES=$(echo "$CHANGED_FILES" | grep -E '\.specweave/(docs|increments/.*/.*\.md)' || true)
52
+
53
+ if [ -n "$DOC_CHANGES" ]; then
54
+ echo -e "${RED}⚠️ Documentation changed during implementation${NC}"
55
+ echo ""
56
+ echo "📋 Files changed:"
57
+ echo "$DOC_CHANGES" | sed 's/^/ /'
58
+ echo ""
59
+ echo -e "${YELLOW}🔔 Recommended actions:${NC}"
60
+ echo " 1. Review documentation changes"
61
+ echo " 2. Update tasks.md if architecture changed"
62
+ echo " 3. Type /review-docs to see full impact"
63
+ echo ""
64
+
65
+ # Play notification sound
66
+ case "$(uname -s)" in
67
+ Darwin)
68
+ afplay /System/Library/Sounds/Ping.aiff 2>/dev/null &
69
+ ;;
70
+ Linux)
71
+ paplay /usr/share/sounds/freedesktop/stereo/dialog-warning.oga 2>/dev/null || true
72
+ ;;
73
+ esac
74
+
75
+ # Log to hooks log
76
+ LOGS_DIR=".specweave/logs"
77
+ mkdir -p "$LOGS_DIR"
78
+ echo "[$(date)] Documentation changed: $DOC_CHANGES" >> "$LOGS_DIR/hooks.log"
79
+ fi
@@ -34,6 +34,16 @@
34
34
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-task-edit.sh"
35
35
  }
36
36
  ]
37
+ },
38
+ {
39
+ "matcher": "Edit|Write",
40
+ "matcher_content": "\\.specweave/increments/[0-9]{4}-.+/metadata\\.json",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-metadata-change.sh"
45
+ }
46
+ ]
37
47
  }
38
48
  ]
39
49
  }
@@ -0,0 +1,75 @@
1
+ #!/bin/bash
2
+
3
+ # SpecWeave Human-Input-Required Hook
4
+ # Runs when Claude needs clarification or approval
5
+ #
6
+ # Actions:
7
+ # 1. Play notification sound (Ping.aiff)
8
+ # 2. Log the question/requirement
9
+ # 3. Record in current increment's work log (if applicable)
10
+
11
+ set -e
12
+
13
+ # Find project root by searching upward for .specweave/ directory
14
+ # Works regardless of where hook is installed (source or .claude/hooks/)
15
+ find_project_root() {
16
+ local dir="$1"
17
+ while [ "$dir" != "/" ]; do
18
+ if [ -d "$dir/.specweave" ]; then
19
+ echo "$dir"
20
+ return 0
21
+ fi
22
+ dir="$(dirname "$dir")"
23
+ done
24
+ # Fallback: try current directory
25
+ if [ -d "$(pwd)/.specweave" ]; then
26
+ pwd
27
+ else
28
+ echo "$(pwd)"
29
+ fi
30
+ }
31
+
32
+ PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
33
+ cd "$PROJECT_ROOT"
34
+
35
+ # Get question/requirement (passed as argument or default)
36
+ QUESTION="${1:-User input required}"
37
+
38
+ echo "❓ Human input required"
39
+
40
+ # 1. Play notification sound (cross-platform)
41
+ play_sound() {
42
+ case "$(uname -s)" in
43
+ Darwin)
44
+ afplay /System/Library/Sounds/Ping.aiff 2>/dev/null &
45
+ ;;
46
+ Linux)
47
+ paplay /usr/share/sounds/freedesktop/stereo/dialog-question.oga 2>/dev/null || \
48
+ aplay /usr/share/sounds/alsa/Side_Left.wav 2>/dev/null || true
49
+ ;;
50
+ MINGW*|MSYS*|CYGWIN*)
51
+ powershell -c "(New-Object Media.SoundPlayer 'C:\Windows\Media\notify.wav').PlaySync();" 2>/dev/null || true
52
+ ;;
53
+ esac
54
+ }
55
+
56
+ play_sound &
57
+
58
+ # 2. Log to main hooks log
59
+ LOGS_DIR=".specweave/logs"
60
+ mkdir -p "$LOGS_DIR"
61
+ echo "[$(date)] Human input required: $QUESTION" >> "$LOGS_DIR/hooks.log"
62
+
63
+ # 3. Log to current work context (if exists)
64
+ CURRENT_WORK=$(find .specweave/work -maxdepth 1 -type d -name "current-*" | head -1 || true)
65
+
66
+ if [ -n "$CURRENT_WORK" ] && [ -d "$CURRENT_WORK" ]; then
67
+ echo "" >> "$CURRENT_WORK/notes.md"
68
+ echo "## Input Required ($(date +%Y-%m-%d\ %H:%M))" >> "$CURRENT_WORK/notes.md"
69
+ echo "" >> "$CURRENT_WORK/notes.md"
70
+ echo "$QUESTION" >> "$CURRENT_WORK/notes.md"
71
+ echo "" >> "$CURRENT_WORK/notes.md"
72
+ echo "📝 Logged to $CURRENT_WORK/notes.md"
73
+ fi
74
+
75
+ echo "✅ Hook complete"
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env bash
2
+ # SpecWeave Post-First-Increment Hook
3
+ #
4
+ # Triggers after the first increment is completed
5
+ # Congratulates the user on completing their first increment
6
+ #
7
+ # NON-INTERACTIVE: Just shows a message (hooks run in background)
8
+
9
+ set -euo pipefail
10
+
11
+ # Get project root (where .specweave/ lives)
12
+ PROJECT_ROOT="$(pwd)"
13
+
14
+ # Check if .specweave directory exists
15
+ if [ ! -d ".specweave" ]; then
16
+ # Not in SpecWeave project, skip
17
+ exit 0
18
+ fi
19
+
20
+ # Check if this is the first increment completion
21
+ # Count completed increments in .specweave/increments/
22
+ COMPLETED_COUNT=0
23
+ if [ -d ".specweave/increments" ]; then
24
+ # Count directories that have COMPLETION-REPORT.md or completion metadata
25
+ for inc_dir in .specweave/increments/[0-9][0-9][0-9][0-9]-*/; do
26
+ if [ -d "$inc_dir" ]; then
27
+ if [ -f "${inc_dir}reports/COMPLETION-REPORT.md" ] || \
28
+ [ -f "${inc_dir}COMPLETION-SUMMARY.md" ] || \
29
+ ([ -f "${inc_dir}metadata.json" ] && grep -q '"status".*"completed"' "${inc_dir}metadata.json" 2>/dev/null); then
30
+ COMPLETED_COUNT=$((COMPLETED_COUNT + 1))
31
+ fi
32
+ fi
33
+ done
34
+ fi
35
+
36
+ # Only trigger on first completion
37
+ if [ "$COMPLETED_COUNT" -ne 1 ]; then
38
+ exit 0
39
+ fi
40
+
41
+ # Show congratulations message (non-interactive)
42
+ echo ""
43
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
44
+ echo "🎉 Congratulations! You completed your first increment!"
45
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
46
+ echo ""
47
+ echo "✅ Your increment has been documented in:"
48
+ echo " .specweave/increments/[increment-id]/"
49
+ echo ""
50
+ echo "📚 View your documentation:"
51
+ echo " - Specs: .specweave/docs/internal/specs/"
52
+ echo " - Architecture: .specweave/docs/internal/architecture/"
53
+ echo ""
54
+ echo "🚀 Next steps:"
55
+ echo " - Review your increment: /specweave:status"
56
+ echo " - Start next increment: /specweave:increment \"feature name\""
57
+ echo ""
58
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
59
+ echo ""
60
+
61
+ exit 0
@@ -0,0 +1,98 @@
1
+ #!/bin/bash
2
+
3
+ # SpecWeave Post-Increment-Change Hook
4
+ # Runs automatically after increment files (spec.md, plan.md, tasks.md) are modified
5
+ #
6
+ # Trigger: File watcher or git hook (pre-commit/post-commit)
7
+ # Purpose: Sync increment file changes to GitHub issues
8
+ #
9
+ # What it does:
10
+ # 1. Detects which file changed (spec.md, plan.md, tasks.md)
11
+ # 2. Invokes GitHub sync for increment changes
12
+ # 3. Updates GitHub issue with scope/plan/task changes
13
+ #
14
+ # Usage:
15
+ # ./post-increment-change.sh <incrementId> <changedFile>
16
+ #
17
+ # Example:
18
+ # ./post-increment-change.sh 0015-hierarchical-sync spec.md
19
+
20
+ set -e
21
+
22
+ # Find project root
23
+ find_project_root() {
24
+ local dir="$1"
25
+ while [ "$dir" != "/" ]; do
26
+ if [ -d "$dir/.specweave" ]; then
27
+ echo "$dir"
28
+ return 0
29
+ fi
30
+ dir="$(dirname "$dir")"
31
+ done
32
+ pwd
33
+ }
34
+
35
+ PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
36
+ cd "$PROJECT_ROOT" 2>/dev/null || true
37
+
38
+ # Configuration
39
+ LOGS_DIR=".specweave/logs"
40
+ DEBUG_LOG="$LOGS_DIR/hooks-debug.log"
41
+
42
+ mkdir -p "$LOGS_DIR" 2>/dev/null || true
43
+
44
+ # Arguments
45
+ INCREMENT_ID="$1"
46
+ CHANGED_FILE="$2"
47
+
48
+ if [ -z "$INCREMENT_ID" ] || [ -z "$CHANGED_FILE" ]; then
49
+ echo "Usage: $0 <incrementId> <changedFile>" >&2
50
+ echo "Example: $0 0015-hierarchical-sync spec.md" >&2
51
+ exit 1
52
+ fi
53
+
54
+ echo "[$(date)] 📝 Increment file changed: $CHANGED_FILE" >> "$DEBUG_LOG" 2>/dev/null || true
55
+
56
+ # Validate changed file
57
+ case "$CHANGED_FILE" in
58
+ spec.md|plan.md|tasks.md)
59
+ ;;
60
+ *)
61
+ echo "[$(date)] ⚠️ Unknown file type: $CHANGED_FILE (skipping sync)" >> "$DEBUG_LOG" 2>/dev/null || true
62
+ exit 0
63
+ ;;
64
+ esac
65
+
66
+ # Check if Node.js available
67
+ if ! command -v node &> /dev/null; then
68
+ echo "[$(date)] ⚠️ Node.js not found, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
69
+ exit 0
70
+ fi
71
+
72
+ # Check if GitHub CLI available
73
+ if ! command -v gh &> /dev/null; then
74
+ echo "[$(date)] ℹ️ GitHub CLI not found, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
75
+ exit 0
76
+ fi
77
+
78
+ # Check if authenticated
79
+ if ! gh auth status &> /dev/null; then
80
+ echo "[$(date)] ℹ️ GitHub CLI not authenticated, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
81
+ exit 0
82
+ fi
83
+
84
+ # Sync to GitHub
85
+ echo "[$(date)] 🔄 Syncing $CHANGED_FILE changes to GitHub..." >> "$DEBUG_LOG" 2>/dev/null || true
86
+
87
+ node dist/plugins/specweave-github/lib/github-sync-increment-changes.js "$INCREMENT_ID" "$CHANGED_FILE" 2>&1 | tee -a "$DEBUG_LOG" >/dev/null || {
88
+ echo "[$(date)] ⚠️ Failed to sync increment changes (non-blocking)" >> "$DEBUG_LOG" 2>/dev/null || true
89
+ }
90
+
91
+ echo "[$(date)] ✅ Post-increment-change hook complete" >> "$DEBUG_LOG" 2>/dev/null || true
92
+
93
+ # Update status line cache (increment changed)
94
+ HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
95
+ bash "$HOOK_DIR/lib/update-status-line.sh" 2>/dev/null || true
96
+
97
+ # Return success (non-blocking)
98
+ exit 0