specweave 0.23.14 → 0.23.18

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 (119) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/CLAUDE.md +77 -7
  3. package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
  4. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +57 -0
  5. package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
  6. package/dist/src/cli/commands/sync-spec-content.js +3 -0
  7. package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
  8. package/dist/src/core/progress/progress-tracker.d.ts +4 -1
  9. package/dist/src/core/progress/progress-tracker.d.ts.map +1 -1
  10. package/dist/src/core/progress/progress-tracker.js +33 -4
  11. package/dist/src/core/progress/progress-tracker.js.map +1 -1
  12. package/dist/src/core/spec-content-sync.d.ts +1 -1
  13. package/dist/src/core/spec-content-sync.d.ts.map +1 -1
  14. package/dist/src/core/spec-detector.d.ts +5 -0
  15. package/dist/src/core/spec-detector.d.ts.map +1 -1
  16. package/dist/src/core/spec-detector.js +91 -33
  17. package/dist/src/core/spec-detector.js.map +1 -1
  18. package/dist/src/integrations/ado/ado-dependency-loader.d.ts +1 -1
  19. package/dist/src/integrations/ado/ado-dependency-loader.d.ts.map +1 -1
  20. package/dist/src/integrations/ado/ado-dependency-loader.js +39 -7
  21. package/dist/src/integrations/ado/ado-dependency-loader.js.map +1 -1
  22. package/package.json +1 -1
  23. package/plugins/specweave/hooks/lib/migrate-increment-work.sh +1 -1
  24. package/plugins/specweave/hooks/lib/migrate-increment-work.sh.bak +245 -0
  25. package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
  26. package/plugins/specweave/hooks/lib/sync-spec-content.sh.bak +149 -0
  27. package/plugins/specweave/hooks/lib/update-status-line.sh +34 -4
  28. package/plugins/specweave/hooks/lib/validate-spec-status.sh +1 -1
  29. package/plugins/specweave/hooks/lib/validate-spec-status.sh.bak +163 -0
  30. package/plugins/specweave/hooks/post-first-increment.sh +1 -1
  31. package/plugins/specweave/hooks/post-first-increment.sh.bak +61 -0
  32. package/plugins/specweave/hooks/post-spec-update.sh +1 -1
  33. package/plugins/specweave/hooks/post-spec-update.sh.bak +158 -0
  34. package/plugins/specweave/hooks/post-user-story-complete.sh +1 -1
  35. package/plugins/specweave/hooks/post-user-story-complete.sh.bak +179 -0
  36. package/plugins/specweave/hooks/pre-command-deduplication.sh +1 -1
  37. package/plugins/specweave/hooks/pre-command-deduplication.sh.bak +83 -0
  38. package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
  39. package/plugins/specweave/hooks/user-prompt-submit.sh.bak +386 -0
  40. package/plugins/specweave/skills/specweave-framework/SKILL.md +1 -1
  41. package/plugins/specweave-ado/agents/ado-manager/AGENT.md +23 -0
  42. package/plugins/specweave-ado/agents/ado-multi-project-mapper/AGENT.md +23 -0
  43. package/plugins/specweave-ado/agents/ado-sync-judge/AGENT.md +23 -0
  44. package/plugins/specweave-backend/agents/database-optimizer/AGENT.md +23 -0
  45. package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +23 -0
  46. package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +23 -0
  47. package/plugins/specweave-github/.claude-plugin/plugin.json +15 -1
  48. package/plugins/specweave-github/agents/github-manager/AGENT.md +23 -0
  49. package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +25 -0
  50. package/plugins/specweave-github/agents/user-story-updater/AGENT.md +25 -0
  51. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +16 -0
  52. package/plugins/specweave-github/hooks/post-task-completion.sh +53 -0
  53. package/plugins/specweave-github/lib/github-spec-content-sync.js +49 -0
  54. package/plugins/specweave-github/lib/github-spec-content-sync.ts +67 -0
  55. package/plugins/specweave-infrastructure/agents/devops/AGENT.md +26 -0
  56. package/plugins/specweave-infrastructure/agents/network-engineer/AGENT.md +26 -0
  57. package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +26 -0
  58. package/plugins/specweave-infrastructure/agents/performance-engineer/AGENT.md +26 -0
  59. package/plugins/specweave-infrastructure/agents/sre/AGENT.md +26 -0
  60. package/plugins/specweave-jira/agents/jira-manager/AGENT.md +26 -0
  61. package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +26 -0
  62. package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +26 -0
  63. package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +26 -0
  64. package/plugins/specweave-kubernetes/agents/kubernetes-architect/AGENT.md +26 -0
  65. package/plugins/specweave-ml/.claude-plugin/plugin.json +2 -2
  66. package/plugins/specweave-ml/agents/data-scientist/AGENT.md +26 -0
  67. package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +26 -0
  68. package/plugins/specweave-ml/agents/mlops-engineer/AGENT.md +26 -0
  69. package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +26 -0
  70. package/plugins/specweave-payments/agents/payment-integration/AGENT.md +26 -0
  71. package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +19 -0
  72. package/plugins/specweave-plugin-dev/skills/plugin-expert/SKILL.md +1231 -0
  73. package/plugins/specweave-release/agents/release-manager/AGENT.md +27 -0
  74. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +24 -0
  75. package/plugins/specweave/skills/plugin-expert/SKILL.md +0 -340
  76. package/plugins/specweave-alternatives/.claude-plugin/plugin.json +0 -21
  77. package/plugins/specweave-alternatives/skills/bmad-method-expert/SKILL.md +0 -626
  78. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/analyze-project.js +0 -318
  79. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/check-setup.js +0 -208
  80. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/generate-template.js +0 -1149
  81. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/validate-documents.js +0 -340
  82. package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +0 -1010
  83. package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +0 -20
  84. package/plugins/specweave-cost-optimizer/skills/cost-optimizer/SKILL.md +0 -190
  85. package/plugins/specweave-docs/.claude-plugin/plugin.json +0 -19
  86. package/plugins/specweave-docs/skills/docusaurus/SKILL.md +0 -613
  87. package/plugins/specweave-docs/skills/spec-driven-brainstorming/README.md +0 -264
  88. package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +0 -439
  89. package/plugins/specweave-docs/skills/spec-driven-debugging/README.md +0 -479
  90. package/plugins/specweave-docs/skills/spec-driven-debugging/SKILL.md +0 -652
  91. package/plugins/specweave-figma/.claude-plugin/.mcp.json +0 -12
  92. package/plugins/specweave-figma/.claude-plugin/plugin.json +0 -20
  93. package/plugins/specweave-figma/ARCHITECTURE.md +0 -453
  94. package/plugins/specweave-figma/README.md +0 -728
  95. package/plugins/specweave-figma/skills/figma-to-code/SKILL.md +0 -632
  96. package/plugins/specweave-figma/skills/figma-to-code/test-1-token-generation.yaml +0 -29
  97. package/plugins/specweave-figma/skills/figma-to-code/test-2-component-generation.yaml +0 -27
  98. package/plugins/specweave-figma/skills/figma-to-code/test-3-typescript-generation.yaml +0 -28
  99. package/plugins/specweave-frontend/.claude-plugin/plugin.json +0 -21
  100. package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +0 -107
  101. package/plugins/specweave-frontend/skills/frontend/SKILL.md +0 -177
  102. package/plugins/specweave-frontend/skills/nextjs/SKILL.md +0 -176
  103. package/plugins/specweave-testing/.claude-plugin/plugin.json +0 -20
  104. package/plugins/specweave-testing/skills/e2e-playwright/README.md +0 -506
  105. package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +0 -457
  106. package/plugins/specweave-testing/skills/e2e-playwright/execute.js +0 -373
  107. package/plugins/specweave-testing/skills/e2e-playwright/lib/utils.js +0 -514
  108. package/plugins/specweave-testing/skills/e2e-playwright/package.json +0 -33
  109. package/plugins/specweave-tooling/.claude-plugin/plugin.json +0 -19
  110. package/plugins/specweave-tooling/skills/skill-creator/LICENSE.txt +0 -202
  111. package/plugins/specweave-tooling/skills/skill-creator/SKILL.md +0 -209
  112. package/plugins/specweave-tooling/skills/skill-creator/scripts/init_skill.py +0 -303
  113. package/plugins/specweave-tooling/skills/skill-creator/scripts/package_skill.py +0 -110
  114. package/plugins/specweave-tooling/skills/skill-creator/scripts/quick_validate.py +0 -65
  115. package/plugins/specweave-tooling/skills/skill-router/SKILL.md +0 -479
  116. package/plugins/specweave-ui/.claude-plugin/plugin.json +0 -26
  117. package/plugins/specweave-ui/.mcp.json +0 -10
  118. package/plugins/specweave-ui/README.md +0 -492
  119. package/plugins/specweave-ui/skills/browser-automation/SKILL.md +0 -676
@@ -16,7 +16,7 @@
16
16
  #
17
17
  # Requires: bash 4.0+ (for associative arrays)
18
18
 
19
- set -euo pipefail
19
+ set +e # EMERGENCY FIX: Changed from set -euo pipefail to prevent Claude Code crashes
20
20
 
21
21
  # Find project root
22
22
  find_project_root() {
@@ -0,0 +1,163 @@
1
+ #!/bin/bash
2
+ #
3
+ # validate-spec-status.sh
4
+ #
5
+ # Validates that spec.md status values match IncrementStatus enum.
6
+ # Prevents vocabulary drift and ensures status line hook compatibility.
7
+ #
8
+ # Usage:
9
+ # bash validate-spec-status.sh <increment-id>
10
+ # bash validate-spec-status.sh --all # Validate all increments
11
+ #
12
+ # Exit codes:
13
+ # 0 = Valid
14
+ # 1 = Invalid status found
15
+ # 2 = Error (file not found, etc.)
16
+ #
17
+ # Requires: bash 4.0+ (for associative arrays)
18
+
19
+ set -euo pipefail
20
+
21
+ # Find project root
22
+ find_project_root() {
23
+ local dir="$PWD"
24
+ while [[ "$dir" != "/" ]]; do
25
+ if [[ -d "$dir/.specweave" ]]; then
26
+ echo "$dir"
27
+ return 0
28
+ fi
29
+ dir=$(dirname "$dir")
30
+ done
31
+ echo "$PWD"
32
+ }
33
+
34
+ PROJECT_ROOT=$(find_project_root)
35
+ INCREMENTS_DIR="$PROJECT_ROOT/.specweave/increments"
36
+
37
+ # Valid IncrementStatus enum values (from src/core/types/increment-metadata.ts)
38
+ VALID_STATUSES=("planning" "active" "backlog" "paused" "completed" "abandoned")
39
+
40
+ # Get suggested correction for invalid status
41
+ get_correction() {
42
+ local status="$1"
43
+ case "$status" in
44
+ "planned") echo "planning" ;;
45
+ "in-progress"|"in_progress") echo "active" ;;
46
+ "done") echo "completed" ;;
47
+ "cancelled"|"canceled") echo "abandoned" ;;
48
+ *) echo "" ;;
49
+ esac
50
+ }
51
+
52
+ # Validate a single spec file
53
+ validate_spec() {
54
+ local spec_file="$1"
55
+ local increment_id=$(basename "$(dirname "$spec_file")")
56
+
57
+ if [[ ! -f "$spec_file" ]]; then
58
+ echo "āŒ Error: spec.md not found for increment $increment_id"
59
+ return 2
60
+ fi
61
+
62
+ # Extract status from YAML frontmatter
63
+ local status=$(grep -m1 "^status:" "$spec_file" 2>/dev/null | cut -d: -f2 | tr -d ' "' || echo "")
64
+
65
+ if [[ -z "$status" ]]; then
66
+ echo "āš ļø Warning: No status field in $increment_id/spec.md"
67
+ return 0 # Not an error, just a warning
68
+ fi
69
+
70
+ # Check if status is valid
71
+ local is_valid=0
72
+ for valid_status in "${VALID_STATUSES[@]}"; do
73
+ if [[ "$status" == "$valid_status" ]]; then
74
+ is_valid=1
75
+ break
76
+ fi
77
+ done
78
+
79
+ if [[ $is_valid -eq 1 ]]; then
80
+ echo "āœ… $increment_id: status '$status' is valid"
81
+ return 0
82
+ else
83
+ # Invalid status found - suggest correction
84
+ echo ""
85
+ echo "āŒ Invalid status in $increment_id/spec.md"
86
+ echo " Found: '$status'"
87
+ echo ""
88
+
89
+ # Check if we have a suggested correction
90
+ local correction=$(get_correction "$status")
91
+ if [[ -n "$correction" ]]; then
92
+ echo " šŸ’” Did you mean: '$correction'?"
93
+ echo ""
94
+ echo " Fix:"
95
+ echo " sed -i '' 's/^status: $status/status: $correction/' $spec_file"
96
+ else
97
+ echo " Valid statuses: ${VALID_STATUSES[*]}"
98
+ fi
99
+ echo ""
100
+
101
+ return 1
102
+ fi
103
+ }
104
+
105
+ # Validate all increments
106
+ validate_all() {
107
+ local exit_code=0
108
+ local total=0
109
+ local valid=0
110
+ local invalid=0
111
+
112
+ echo "Validating all increments in $INCREMENTS_DIR"
113
+ echo ""
114
+
115
+ for spec_file in "$INCREMENTS_DIR"/*/spec.md; do
116
+ if [[ -f "$spec_file" ]]; then
117
+ total=$((total + 1))
118
+ if validate_spec "$spec_file"; then
119
+ valid=$((valid + 1))
120
+ else
121
+ invalid=$((invalid + 1))
122
+ exit_code=1
123
+ fi
124
+ fi
125
+ done
126
+
127
+ echo ""
128
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
129
+ echo "Summary: $total increments checked"
130
+ echo " āœ… Valid: $valid"
131
+ echo " āŒ Invalid: $invalid"
132
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
133
+
134
+ if [[ $invalid -gt 0 ]]; then
135
+ echo ""
136
+ echo "āš ļø Please fix invalid status values to use official IncrementStatus enum."
137
+ echo ""
138
+ echo "Valid statuses:"
139
+ for status in "${VALID_STATUSES[@]}"; do
140
+ echo " - $status"
141
+ done
142
+ fi
143
+
144
+ return $exit_code
145
+ }
146
+
147
+ # Main logic
148
+ if [[ $# -eq 0 ]]; then
149
+ echo "Usage: $0 <increment-id> | --all"
150
+ echo ""
151
+ echo "Examples:"
152
+ echo " $0 0042-test-infrastructure-cleanup"
153
+ echo " $0 --all"
154
+ exit 2
155
+ fi
156
+
157
+ if [[ "$1" == "--all" ]]; then
158
+ validate_all
159
+ else
160
+ INCREMENT_ID="$1"
161
+ SPEC_FILE="$INCREMENTS_DIR/$INCREMENT_ID/spec.md"
162
+ validate_spec "$SPEC_FILE"
163
+ fi
@@ -6,7 +6,7 @@
6
6
  #
7
7
  # NON-INTERACTIVE: Just shows a message (hooks run in background)
8
8
 
9
- set -euo pipefail
9
+ set +e # EMERGENCY FIX: Changed from set -euo pipefail to prevent Claude Code crashes
10
10
 
11
11
  # Get project root (where .specweave/ lives)
12
12
  PROJECT_ROOT="$(pwd)"
@@ -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
@@ -27,7 +27,7 @@
27
27
  #
28
28
  ###############################################################################
29
29
 
30
- set -euo pipefail
30
+ set +e # EMERGENCY FIX: Changed from set -euo pipefail to prevent Claude Code crashes
31
31
 
32
32
  # Arguments
33
33
  SPEC_FILE_PATH="${1:-}"
@@ -0,0 +1,158 @@
1
+ #!/bin/bash
2
+
3
+ ###############################################################################
4
+ # SpecWeave Post-Spec-Update Hook
5
+ #
6
+ # CRITICAL ARCHITECTURE:
7
+ # - Fires when .specweave/docs/internal/specs/spec-*.md is updated
8
+ # - Auto-syncs to linked external tool (GitHub Project/Jira Epic/ADO Feature)
9
+ # - Replaces increment-based sync (which was wrong!)
10
+ #
11
+ # Trigger Points:
12
+ # 1. After /specweave:sync-docs update (spec updated from increment)
13
+ # 2. After manual spec.md edits (user updates living docs directly)
14
+ # 3. After bidirectional sync from external tool
15
+ #
16
+ # What It Does:
17
+ # - Detects which spec was updated
18
+ # - Checks if spec is linked to external tool (frontmatter: externalLinks)
19
+ # - Syncs changes to GitHub Project / Jira Epic / ADO Feature
20
+ # - Updates user stories, acceptance criteria, progress
21
+ #
22
+ # Usage:
23
+ # post-spec-update.sh <spec-file-path>
24
+ #
25
+ # Example:
26
+ # post-spec-update.sh .specweave/docs/internal/specs/spec-001-core-framework.md
27
+ #
28
+ ###############################################################################
29
+
30
+ set -euo pipefail
31
+
32
+ # Arguments
33
+ SPEC_FILE_PATH="${1:-}"
34
+
35
+ # Validate arguments
36
+ if [[ -z "$SPEC_FILE_PATH" ]]; then
37
+ echo "āŒ Error: Spec file path required"
38
+ echo "Usage: post-spec-update.sh <spec-file-path>"
39
+ exit 1
40
+ fi
41
+
42
+ # Check if spec file exists
43
+ if [[ ! -f "$SPEC_FILE_PATH" ]]; then
44
+ echo "āŒ Error: Spec file not found: $SPEC_FILE_PATH"
45
+ exit 1
46
+ fi
47
+
48
+ # Extract spec ID from file path
49
+ # Example: .specweave/docs/internal/specs/spec-001-core-framework.md → spec-001
50
+ SPEC_ID=$(basename "$SPEC_FILE_PATH" .md)
51
+
52
+ echo ""
53
+ echo "šŸ”— Post-Spec-Update Hook"
54
+ echo " Spec: $SPEC_ID"
55
+ echo " File: $SPEC_FILE_PATH"
56
+
57
+ # Load config to check if auto-sync is enabled
58
+ CONFIG_FILE=".specweave/config.json"
59
+ if [[ ! -f "$CONFIG_FILE" ]]; then
60
+ echo " ā„¹ļø No config file found, skipping auto-sync"
61
+ exit 0
62
+ fi
63
+
64
+ # Check if auto-sync is enabled
65
+ AUTO_SYNC=$(jq -r '.hooks.post_spec_update.auto_sync // true' "$CONFIG_FILE")
66
+
67
+ if [[ "$AUTO_SYNC" != "true" ]]; then
68
+ echo " ā„¹ļø Auto-sync disabled in config, skipping"
69
+ exit 0
70
+ fi
71
+
72
+ # Parse spec frontmatter to detect external links
73
+ # Use gray-matter or similar to extract YAML frontmatter
74
+ # For now, use simple grep/sed approach
75
+
76
+ # Check if GitHub link exists
77
+ GITHUB_LINK=$(grep -A 10 "^externalLinks:" "$SPEC_FILE_PATH" | grep -A 5 "github:" | grep "projectId:" | sed 's/.*projectId: *//; s/ *$//' || echo "")
78
+
79
+ # Check if Jira link exists
80
+ JIRA_LINK=$(grep -A 10 "^externalLinks:" "$SPEC_FILE_PATH" | grep -A 5 "jira:" | grep "epicKey:" | sed 's/.*epicKey: *//; s/ *$//' || echo "")
81
+
82
+ # Check if ADO link exists
83
+ ADO_LINK=$(grep -A 10 "^externalLinks:" "$SPEC_FILE_PATH" | grep -A 5 "ado:" | grep "featureId:" | sed 's/.*featureId: *//; s/ *$//' || echo "")
84
+
85
+ # Determine which provider to sync
86
+ PROVIDER=""
87
+ if [[ -n "$GITHUB_LINK" ]]; then
88
+ PROVIDER="github"
89
+ EXTERNAL_ID="$GITHUB_LINK"
90
+ elif [[ -n "$JIRA_LINK" ]]; then
91
+ PROVIDER="jira"
92
+ EXTERNAL_ID="$JIRA_LINK"
93
+ elif [[ -n "$ADO_LINK" ]]; then
94
+ PROVIDER="ado"
95
+ EXTERNAL_ID="$ADO_LINK"
96
+ fi
97
+
98
+ # No external link found - skip sync
99
+ if [[ -z "$PROVIDER" ]]; then
100
+ echo " ā„¹ļø Spec not linked to external tool, skipping sync"
101
+ echo " Hint: Use /specweave-github:sync-spec or /specweave-jira:sync-spec to link"
102
+ exit 0
103
+ fi
104
+
105
+ echo " šŸ”— Detected external link: $PROVIDER (ID: $EXTERNAL_ID)"
106
+
107
+ # Sync to external tool based on provider
108
+ case "$PROVIDER" in
109
+ github)
110
+ echo " šŸ”„ Syncing to GitHub Project..."
111
+
112
+ # Check if GitHub CLI is available
113
+ if ! command -v gh &> /dev/null; then
114
+ echo " āš ļø GitHub CLI (gh) not found, skipping sync"
115
+ exit 0
116
+ fi
117
+
118
+ # TODO: Call GitHub spec sync
119
+ # For now, just log the action
120
+ echo " āœ… GitHub sync queued (implementation pending)"
121
+ ;;
122
+
123
+ jira)
124
+ echo " šŸ”„ Syncing to Jira Epic..."
125
+
126
+ # Check if Jira config exists
127
+ if [[ -z "${JIRA_DOMAIN:-}" ]]; then
128
+ echo " āš ļø Jira not configured (.env), skipping sync"
129
+ exit 0
130
+ fi
131
+
132
+ # TODO: Call Jira spec sync
133
+ echo " āœ… Jira sync queued (implementation pending)"
134
+ ;;
135
+
136
+ ado)
137
+ echo " šŸ”„ Syncing to Azure DevOps Feature..."
138
+
139
+ # Check if ADO config exists
140
+ if [[ -z "${ADO_ORGANIZATION:-}" ]]; then
141
+ echo " āš ļø ADO not configured (.env), skipping sync"
142
+ exit 0
143
+ fi
144
+
145
+ # TODO: Call ADO spec sync
146
+ echo " āœ… ADO sync queued (implementation pending)"
147
+ ;;
148
+
149
+ *)
150
+ echo " āš ļø Unknown provider: $PROVIDER"
151
+ exit 0
152
+ ;;
153
+ esac
154
+
155
+ echo " āœ… Post-spec-update hook complete"
156
+ echo ""
157
+
158
+ exit 0
@@ -27,7 +27,7 @@
27
27
  #
28
28
  ###############################################################################
29
29
 
30
- set -euo pipefail
30
+ set +e # EMERGENCY FIX: Changed from set -euo pipefail to prevent Claude Code crashes
31
31
 
32
32
  # Arguments
33
33
  SPEC_ID="${1:-}"
@@ -0,0 +1,179 @@
1
+ #!/bin/bash
2
+
3
+ ###############################################################################
4
+ # SpecWeave Post-User-Story-Complete Hook
5
+ #
6
+ # CRITICAL ARCHITECTURE:
7
+ # - Fires when user story marked complete in spec.md (AC checkbox checked)
8
+ # - Updates external PM tool (GitHub Issue/Jira Story/ADO User Story)
9
+ # - Moves GitHub card to "Done" / Closes Jira story / Completes ADO story
10
+ #
11
+ # Trigger Points:
12
+ # 1. After user manually checks AC checkbox in spec.md
13
+ # 2. After bidirectional sync updates AC status
14
+ # 3. After increment completion syncs to spec
15
+ #
16
+ # What It Does:
17
+ # - Detects which user story was completed (all AC checkboxes checked)
18
+ # - Finds corresponding external item (GitHub Issue/Jira Story/ADO User Story)
19
+ # - Updates item status to "Done" / "Closed"
20
+ # - Adds completion comment with timestamp
21
+ #
22
+ # Usage:
23
+ # post-user-story-complete.sh <spec-id> <user-story-id>
24
+ #
25
+ # Example:
26
+ # post-user-story-complete.sh spec-001 US-001
27
+ #
28
+ ###############################################################################
29
+
30
+ set -euo pipefail
31
+
32
+ # Arguments
33
+ SPEC_ID="${1:-}"
34
+ USER_STORY_ID="${2:-}"
35
+
36
+ # Validate arguments
37
+ if [[ -z "$SPEC_ID" || -z "$USER_STORY_ID" ]]; then
38
+ echo "āŒ Error: Spec ID and User Story ID required"
39
+ echo "Usage: post-user-story-complete.sh <spec-id> <user-story-id>"
40
+ exit 1
41
+ fi
42
+
43
+ echo ""
44
+ echo "šŸŽ‰ Post-User-Story-Complete Hook"
45
+ echo " Spec: $SPEC_ID"
46
+ echo " User Story: $USER_STORY_ID"
47
+
48
+ # Find spec file
49
+ SPEC_FILE=""
50
+ if [[ -f ".specweave/docs/internal/specs/$SPEC_ID.md" ]]; then
51
+ SPEC_FILE=".specweave/docs/internal/specs/$SPEC_ID.md"
52
+ elif [[ -f ".specweave/docs/internal/projects/default/specs/$SPEC_ID.md" ]]; then
53
+ SPEC_FILE=".specweave/docs/internal/projects/default/specs/$SPEC_ID.md"
54
+ else
55
+ echo "āŒ Error: Spec file not found for $SPEC_ID"
56
+ exit 1
57
+ fi
58
+
59
+ # Load config to check if auto-sync is enabled
60
+ CONFIG_FILE=".specweave/config.json"
61
+ if [[ ! -f "$CONFIG_FILE" ]]; then
62
+ echo " ā„¹ļø No config file found, skipping auto-sync"
63
+ exit 0
64
+ fi
65
+
66
+ # Check if auto-sync is enabled
67
+ AUTO_SYNC=$(jq -r '.hooks.post_user_story_complete.auto_sync // true' "$CONFIG_FILE")
68
+
69
+ if [[ "$AUTO_SYNC" != "true" ]]; then
70
+ echo " ā„¹ļø Auto-sync disabled in config, skipping"
71
+ exit 0
72
+ fi
73
+
74
+ # Parse spec frontmatter to detect external links
75
+ # Check if GitHub link exists
76
+ GITHUB_LINK=$(grep -A 10 "^externalLinks:" "$SPEC_FILE" | grep -A 5 "github:" | grep "projectId:" | sed 's/.*projectId: *//; s/ *$//' || echo "")
77
+
78
+ # Check if Jira link exists
79
+ JIRA_LINK=$(grep -A 10 "^externalLinks:" "$SPEC_FILE" | grep -A 5 "jira:" | grep "epicKey:" | sed 's/.*epicKey: *//; s/ *$//' || echo "")
80
+
81
+ # Check if ADO link exists
82
+ ADO_LINK=$(grep -A 10 "^externalLinks:" "$SPEC_FILE" | grep -A 5 "ado:" | grep "featureId:" | sed 's/.*featureId: *//; s/ *$//' || echo "")
83
+
84
+ # Determine which provider to sync
85
+ PROVIDER=""
86
+ if [[ -n "$GITHUB_LINK" ]]; then
87
+ PROVIDER="github"
88
+ EXTERNAL_ID="$GITHUB_LINK"
89
+ elif [[ -n "$JIRA_LINK" ]]; then
90
+ PROVIDER="jira"
91
+ EXTERNAL_ID="$JIRA_LINK"
92
+ elif [[ -n "$ADO_LINK" ]]; then
93
+ PROVIDER="ado"
94
+ EXTERNAL_ID="$ADO_LINK"
95
+ fi
96
+
97
+ # No external link found - skip sync
98
+ if [[ -z "$PROVIDER" ]]; then
99
+ echo " ā„¹ļø Spec not linked to external tool, skipping sync"
100
+ exit 0
101
+ fi
102
+
103
+ echo " šŸ”— Detected external link: $PROVIDER"
104
+
105
+ # Update external tool based on provider
106
+ case "$PROVIDER" in
107
+ github)
108
+ echo " šŸ”„ Updating GitHub Issue for $USER_STORY_ID..."
109
+
110
+ # Check if GitHub CLI is available
111
+ if ! command -v gh &> /dev/null; then
112
+ echo " āš ļø GitHub CLI (gh) not found, skipping sync"
113
+ exit 0
114
+ fi
115
+
116
+ # Find GitHub Issue for this user story
117
+ # Search for issue with title pattern "[USER_STORY_ID]"
118
+ REPO=$(git remote get-url origin | sed -E 's/.*github\.com[:/]([^/]+\/[^/]+)(\.git)?$/\1/')
119
+
120
+ # Search for issue
121
+ ISSUE_NUMBER=$(gh issue list --repo "$REPO" --search "\"[$USER_STORY_ID]\" in:title" --json number --jq '.[0].number' 2>/dev/null || echo "")
122
+
123
+ if [[ -z "$ISSUE_NUMBER" ]]; then
124
+ echo " āš ļø GitHub Issue not found for $USER_STORY_ID"
125
+ exit 0
126
+ fi
127
+
128
+ echo " šŸ“ Found GitHub Issue #$ISSUE_NUMBER"
129
+
130
+ # Close issue
131
+ gh issue close "$ISSUE_NUMBER" --repo "$REPO" --comment "āœ… User story completed
132
+
133
+ šŸ¤– Auto-closed by SpecWeave hook
134
+ Completed at: $(date -u +%Y-%m-%dT%H:%M:%SZ)" 2>/dev/null || {
135
+ echo " āš ļø Failed to close issue"
136
+ exit 0
137
+ }
138
+
139
+ echo " āœ… GitHub Issue #$ISSUE_NUMBER closed"
140
+ ;;
141
+
142
+ jira)
143
+ echo " šŸ”„ Updating Jira Story for $USER_STORY_ID..."
144
+
145
+ # Check if Jira config exists
146
+ if [[ -z "${JIRA_DOMAIN:-}" ]]; then
147
+ echo " āš ļø Jira not configured (.env), skipping sync"
148
+ exit 0
149
+ fi
150
+
151
+ # TODO: Find Jira Story by title pattern
152
+ # TODO: Transition story to "Done" status
153
+ echo " āœ… Jira story transition queued (implementation pending)"
154
+ ;;
155
+
156
+ ado)
157
+ echo " šŸ”„ Updating ADO User Story for $USER_STORY_ID..."
158
+
159
+ # Check if ADO config exists
160
+ if [[ -z "${ADO_ORGANIZATION:-}" ]]; then
161
+ echo " āš ļø ADO not configured (.env), skipping sync"
162
+ exit 0
163
+ fi
164
+
165
+ # TODO: Find ADO User Story by title pattern
166
+ # TODO: Update state to "Closed"
167
+ echo " āœ… ADO user story update queued (implementation pending)"
168
+ ;;
169
+
170
+ *)
171
+ echo " āš ļø Unknown provider: $PROVIDER"
172
+ exit 0
173
+ ;;
174
+ esac
175
+
176
+ echo " āœ… Post-user-story-complete hook complete"
177
+ echo ""
178
+
179
+ exit 0
@@ -4,7 +4,7 @@
4
4
  # Fires BEFORE any command executes (UserPromptSubmit hook)
5
5
  # Purpose: Prevent duplicate command invocations within configurable time window
6
6
 
7
- set -euo pipefail
7
+ set +e # EMERGENCY FIX: Changed from set -euo pipefail to prevent Claude Code crashes
8
8
 
9
9
  # ==============================================================================
10
10
  # PROJECT ROOT DETECTION
@@ -0,0 +1,83 @@
1
+ #!/bin/bash
2
+
3
+ # SpecWeave Pre-Command Deduplication Hook
4
+ # Fires BEFORE any command executes (UserPromptSubmit hook)
5
+ # Purpose: Prevent duplicate command invocations within configurable time window
6
+
7
+ set -euo pipefail
8
+
9
+ # ==============================================================================
10
+ # PROJECT ROOT DETECTION
11
+ # ==============================================================================
12
+
13
+ # Find project root by searching upward for .specweave/ directory
14
+ find_project_root() {
15
+ local dir="$1"
16
+ while [ "$dir" != "/" ]; do
17
+ if [ -d "$dir/.specweave" ]; then
18
+ echo "$dir"
19
+ return 0
20
+ fi
21
+ dir="$(dirname "$dir")"
22
+ done
23
+ # Fallback: try current directory
24
+ if [ -d "$(pwd)/.specweave" ]; then
25
+ pwd
26
+ else
27
+ echo "$(pwd)"
28
+ fi
29
+ }
30
+
31
+ PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
32
+ cd "$PROJECT_ROOT" 2>/dev/null || true
33
+
34
+ # Read input JSON from stdin
35
+ INPUT=$(cat)
36
+
37
+ # ==============================================================================
38
+ # DEDUPLICATION CHECK: Block duplicate commands within 1 second
39
+ # ==============================================================================
40
+
41
+ # Check if deduplication module is available
42
+ if command -v node >/dev/null 2>&1 && [[ -f "dist/src/core/deduplication/command-deduplicator.js" ]]; then
43
+ # Use dedicated wrapper script for ES module compatibility
44
+ DEDUP_RESULT=$(echo "$INPUT" | node scripts/check-deduplication.js 2>/dev/null || echo "OK")
45
+
46
+ # Parse result
47
+ STATUS=$(echo "$DEDUP_RESULT" | head -1)
48
+
49
+ if [[ "$STATUS" == "DUPLICATE" ]]; then
50
+ # Get stats
51
+ STATS=$(echo "$DEDUP_RESULT" | tail -1)
52
+
53
+ # Extract command and stats for readable message
54
+ COMMAND=$(echo "$STATS" | grep -o '"lastCommand":"[^"]*"' | cut -d'"' -f4 || echo "unknown")
55
+ TOTAL_BLOCKED=$(echo "$STATS" | grep -o '"totalDuplicatesBlocked":[0-9]*' | cut -d':' -f2 || echo "1")
56
+ CACHE_SIZE=$(echo "$STATS" | grep -o '"currentCacheSize":[0-9]*' | cut -d':' -f2 || echo "1")
57
+
58
+ # Build error message WITHOUT embedding JSON (avoid escaping issues)
59
+ MESSAGE=$(cat <<'EOF'
60
+ {
61
+ "decision": "block",
62
+ "reason": "🚫 DUPLICATE COMMAND DETECTED\n\nCommand: `COMMAND_PLACEHOLDER`\nTime window: 1 second\n\nThis command was just executed! To prevent unintended duplicates, this invocation has been blocked.\n\nšŸ’” If you meant to run this command again:\n 1. Wait 1 second\n 2. Run the command again\n\nDeduplication Stats:\n- Total duplicates blocked: BLOCKED_PLACEHOLDER\n- Commands in cache: CACHE_PLACEHOLDER"
63
+ }
64
+ EOF
65
+ )
66
+ # Replace placeholders (avoids JSON escaping issues)
67
+ # Use | as sed delimiter to avoid conflicts with / in command names
68
+ echo "$MESSAGE" | sed "s|COMMAND_PLACEHOLDER|$COMMAND|g" | sed "s|BLOCKED_PLACEHOLDER|$TOTAL_BLOCKED|g" | sed "s|CACHE_PLACEHOLDER|$CACHE_SIZE|g"
69
+ exit 0
70
+ fi
71
+ fi
72
+
73
+ # ==============================================================================
74
+ # PASS THROUGH: No duplicate detected, proceed with command
75
+ # ==============================================================================
76
+
77
+ cat <<EOF
78
+ {
79
+ "decision": "approve"
80
+ }
81
+ EOF
82
+
83
+ exit 0