specweave 0.28.34 → 0.28.42
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/CLAUDE.md +21 -0
- package/README.md +47 -33
- package/bin/specweave.js +2 -1
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +6 -6
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -1
- package/dist/src/cli/commands/archive.d.ts.map +1 -1
- package/dist/src/cli/commands/archive.js +2 -1
- package/dist/src/cli/commands/archive.js.map +1 -1
- package/dist/src/cli/commands/delete-feature.d.ts.map +1 -1
- package/dist/src/cli/commands/delete-feature.js +5 -4
- package/dist/src/cli/commands/delete-feature.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +33 -0
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/helpers/ado-area-selector.d.ts +49 -0
- package/dist/src/cli/helpers/ado-area-selector.d.ts.map +1 -0
- package/dist/src/cli/helpers/ado-area-selector.js +161 -0
- package/dist/src/cli/helpers/ado-area-selector.js.map +1 -0
- package/dist/src/cli/helpers/init/config-detection.d.ts +5 -1
- package/dist/src/cli/helpers/init/config-detection.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/config-detection.js +50 -17
- package/dist/src/cli/helpers/init/config-detection.js.map +1 -1
- package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/external-import.js +32 -3
- package/dist/src/cli/helpers/init/external-import.js.map +1 -1
- package/dist/src/cli/helpers/init/repository-setup.d.ts +2 -0
- package/dist/src/cli/helpers/init/repository-setup.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/repository-setup.js +34 -2
- package/dist/src/cli/helpers/init/repository-setup.js.map +1 -1
- package/dist/src/cli/helpers/init/types.d.ts +3 -0
- package/dist/src/cli/helpers/init/types.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts +10 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +107 -22
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +30 -10
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.d.ts +1 -0
- package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.js.map +1 -1
- package/dist/src/core/feature-deleter/github-service.js +2 -2
- package/dist/src/core/feature-deleter/github-service.js.map +1 -1
- package/dist/src/core/increment/discipline-checker.js +1 -1
- package/dist/src/core/increment/increment-archiver.d.ts +56 -6
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +228 -77
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.js +75 -37
- package/dist/src/core/living-docs/feature-archiver.js.map +1 -1
- package/dist/src/core/living-docs/feature-id-manager.d.ts +6 -0
- package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -1
- package/dist/src/core/living-docs/feature-id-manager.js +54 -8
- package/dist/src/core/living-docs/feature-id-manager.js.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.js +28 -17
- package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts +2 -111
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +31 -389
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/core/living-docs/sync-helpers/file-utils.d.ts +30 -0
- package/dist/src/core/living-docs/sync-helpers/file-utils.d.ts.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/file-utils.js +107 -0
- package/dist/src/core/living-docs/sync-helpers/file-utils.js.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/generators.d.ts +19 -0
- package/dist/src/core/living-docs/sync-helpers/generators.d.ts.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/generators.js +146 -0
- package/dist/src/core/living-docs/sync-helpers/generators.js.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/index.d.ts +8 -0
- package/dist/src/core/living-docs/sync-helpers/index.d.ts.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/index.js +11 -0
- package/dist/src/core/living-docs/sync-helpers/index.js.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/parsers.d.ts +19 -0
- package/dist/src/core/living-docs/sync-helpers/parsers.d.ts.map +1 -0
- package/dist/src/core/living-docs/sync-helpers/parsers.js +94 -0
- package/dist/src/core/living-docs/sync-helpers/parsers.js.map +1 -0
- package/dist/src/core/living-docs/types.d.ts +45 -0
- package/dist/src/core/living-docs/types.d.ts.map +1 -1
- package/dist/src/core/types/config.d.ts +1 -1
- package/dist/src/core/types/config.js +2 -2
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/core/validation/three-file-validator.js +8 -8
- package/dist/src/core/validation/three-file-validator.js.map +1 -1
- package/dist/src/generators/spec/spec-parser.d.ts.map +1 -1
- package/dist/src/generators/spec/spec-parser.js +4 -3
- package/dist/src/generators/spec/spec-parser.js.map +1 -1
- package/dist/src/generators/spec/task-parser.d.ts.map +1 -1
- package/dist/src/generators/spec/task-parser.js +11 -10
- package/dist/src/generators/spec/task-parser.js.map +1 -1
- package/dist/src/importers/ado-importer.d.ts.map +1 -1
- package/dist/src/importers/ado-importer.js +2 -0
- package/dist/src/importers/ado-importer.js.map +1 -1
- package/dist/src/importers/duplicate-detector.d.ts +5 -2
- package/dist/src/importers/duplicate-detector.d.ts.map +1 -1
- package/dist/src/importers/duplicate-detector.js +8 -2
- package/dist/src/importers/duplicate-detector.js.map +1 -1
- package/dist/src/importers/github-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.js +24 -1
- package/dist/src/importers/github-importer.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +27 -3
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.d.ts +5 -0
- package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.js +35 -6
- package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
- package/dist/src/utils/external-resource-validator.d.ts +5 -192
- package/dist/src/utils/external-resource-validator.d.ts.map +1 -1
- package/dist/src/utils/external-resource-validator.js +10 -1162
- package/dist/src/utils/external-resource-validator.js.map +1 -1
- package/dist/src/utils/feature-id-collision.d.ts +70 -0
- package/dist/src/utils/feature-id-collision.d.ts.map +1 -0
- package/dist/src/utils/feature-id-collision.js +142 -0
- package/dist/src/utils/feature-id-collision.js.map +1 -0
- package/dist/src/utils/validators/ado-validator.d.ts +86 -0
- package/dist/src/utils/validators/ado-validator.d.ts.map +1 -0
- package/dist/src/utils/validators/ado-validator.js +528 -0
- package/dist/src/utils/validators/ado-validator.js.map +1 -0
- package/dist/src/utils/validators/index.d.ts +11 -0
- package/dist/src/utils/validators/index.d.ts.map +1 -0
- package/dist/src/utils/validators/index.js +12 -0
- package/dist/src/utils/validators/index.js.map +1 -0
- package/dist/src/utils/validators/jira-validator.d.ts +70 -0
- package/dist/src/utils/validators/jira-validator.d.ts.map +1 -0
- package/dist/src/utils/validators/jira-validator.js +606 -0
- package/dist/src/utils/validators/jira-validator.js.map +1 -0
- package/dist/src/utils/validators/types.d.ts +82 -0
- package/dist/src/utils/validators/types.d.ts.map +1 -0
- package/dist/src/utils/validators/types.js +6 -0
- package/dist/src/utils/validators/types.js.map +1 -0
- package/package.json +3 -3
- package/plugins/specweave/.claude-plugin/plugin.json +7 -62
- package/plugins/specweave/commands/specweave-archive.md +3 -3
- package/plugins/specweave/commands/specweave-increment.md +18 -19
- package/plugins/specweave/hooks/hooks.json +3 -49
- package/plugins/specweave/hooks/hooks.json.bak +72 -0
- package/plugins/specweave/hooks/hooks.json.v1-backup +16 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +39 -15
- package/plugins/specweave/hooks/post-task-edit.sh +10 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +27 -8
- package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +44 -0
- package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +24 -0
- package/plugins/specweave/hooks/v2/handlers/ac-validation-handler.sh +46 -0
- package/plugins/specweave/hooks/v2/handlers/github-sync-handler.sh +54 -0
- package/plugins/specweave/hooks/v2/handlers/living-docs-handler.sh +46 -0
- package/plugins/specweave/hooks/v2/handlers/status-update.sh +50 -0
- package/plugins/specweave/hooks/v2/hooks.json +16 -0
- package/plugins/specweave/hooks/v2/queue/dequeue.sh +30 -0
- package/plugins/specweave/hooks/v2/queue/enqueue.sh +41 -0
- package/plugins/specweave/hooks/v2/queue/processor.sh +72 -0
- package/plugins/specweave/lib/vendor/generators/spec/task-parser.js +11 -10
- package/plugins/specweave/lib/vendor/generators/spec/task-parser.js.map +1 -1
- package/plugins/specweave-ado/lib/ado-multi-project-sync.js +0 -1
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +20 -1262
- package/plugins/specweave-github/lib/user-story-issue-builder.js +4 -4
- package/plugins/specweave-github/lib/user-story-issue-builder.ts +6 -6
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +30 -1254
- package/src/templates/tasks.md.template +2 -0
- package/plugins/specweave/hooks/docs-changed.sh.backup +0 -79
- package/plugins/specweave/hooks/human-input-required.sh.backup +0 -75
- package/plugins/specweave/hooks/post-first-increment.sh.backup +0 -61
- package/plugins/specweave/hooks/post-increment-change.sh.backup +0 -98
- package/plugins/specweave/hooks/post-increment-completion.sh.backup +0 -231
- package/plugins/specweave/hooks/post-increment-planning.sh.backup +0 -1048
- package/plugins/specweave/hooks/post-increment-status-change.sh.backup +0 -147
- package/plugins/specweave/hooks/post-spec-update.sh.backup +0 -158
- package/plugins/specweave/hooks/post-user-story-complete.sh.backup +0 -179
- package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +0 -83
- package/plugins/specweave/hooks/pre-implementation.sh.backup +0 -67
- package/plugins/specweave/hooks/pre-task-completion.sh.backup +0 -194
- package/plugins/specweave/hooks/pre-tool-use.sh.backup +0 -133
- package/plugins/specweave/hooks/user-prompt-submit.sh.backup +0 -386
- package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +0 -353
- package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +0 -172
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -170
- package/plugins/specweave-github/hooks/post-task-completion.sh.backup +0 -258
- package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +0 -172
- package/plugins/specweave-release/hooks/post-task-completion.sh.backup +0 -110
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# SpecWeave GitHub Sync Hook
|
|
4
|
-
# Runs after task completion to sync progress to GitHub Projects
|
|
5
|
-
#
|
|
6
|
-
# ARCHITECTURE (v0.19.0+): IMMUTABLE DESCRIPTIONS + PROGRESS COMMENTS
|
|
7
|
-
# - User Story files (.specweave/docs/internal/specs/) ↔ GitHub Issues
|
|
8
|
-
# - Issue descriptions created once (IMMUTABLE snapshot)
|
|
9
|
-
# - All updates via progress comments (audit trail)
|
|
10
|
-
#
|
|
11
|
-
# This hook is part of the specweave-github plugin and handles:
|
|
12
|
-
# - Finding which spec user stories the current work belongs to
|
|
13
|
-
# - Syncing progress via GitHub comments (NOT editing issue body)
|
|
14
|
-
# - Creating audit trail of all changes over time
|
|
15
|
-
# - Notifying stakeholders via GitHub notifications
|
|
16
|
-
#
|
|
17
|
-
# Dependencies:
|
|
18
|
-
# - Node.js and TypeScript CLI (dist/cli/commands/sync-spec-content.js)
|
|
19
|
-
# - GitHub CLI (gh) must be installed and authenticated
|
|
20
|
-
# - ProgressCommentBuilder (lib/progress-comment-builder.ts)
|
|
21
|
-
|
|
22
|
-
set -e
|
|
23
|
-
|
|
24
|
-
# ============================================================================
|
|
25
|
-
# PROJECT ROOT DETECTION
|
|
26
|
-
# ============================================================================
|
|
27
|
-
|
|
28
|
-
# Find project root by searching upward for .specweave/ directory
|
|
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
|
-
# Fallback: try current directory
|
|
39
|
-
if [ -d "$(pwd)/.specweave" ]; then
|
|
40
|
-
pwd
|
|
41
|
-
else
|
|
42
|
-
echo "$(pwd)"
|
|
43
|
-
fi
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
47
|
-
cd "$PROJECT_ROOT" 2>/dev/null || true
|
|
48
|
-
|
|
49
|
-
# ============================================================================
|
|
50
|
-
# CONFIGURATION
|
|
51
|
-
# ============================================================================
|
|
52
|
-
|
|
53
|
-
LOGS_DIR=".specweave/logs"
|
|
54
|
-
DEBUG_LOG="$LOGS_DIR/hooks-debug.log"
|
|
55
|
-
|
|
56
|
-
mkdir -p "$LOGS_DIR" 2>/dev/null || true
|
|
57
|
-
|
|
58
|
-
# ============================================================================
|
|
59
|
-
# PRECONDITIONS CHECK
|
|
60
|
-
# ============================================================================
|
|
61
|
-
|
|
62
|
-
echo "[$(date)] [GitHub] 🔗 GitHub sync hook fired" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
63
|
-
|
|
64
|
-
# Check if Node.js is available
|
|
65
|
-
if ! command -v node &> /dev/null; then
|
|
66
|
-
echo "[$(date)] [GitHub] ⚠️ Node.js not found, skipping GitHub sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
67
|
-
cat <<EOF
|
|
68
|
-
{
|
|
69
|
-
"continue": true
|
|
70
|
-
}
|
|
71
|
-
EOF
|
|
72
|
-
exit 0
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
# Check if github-spec-content-sync CLI exists
|
|
76
|
-
SYNC_CLI="$PROJECT_ROOT/dist/src/cli/commands/sync-spec-content.js"
|
|
77
|
-
if [ ! -f "$SYNC_CLI" ]; then
|
|
78
|
-
echo "[$(date)] [GitHub] ⚠️ sync-spec-content CLI not found at $SYNC_CLI, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
79
|
-
cat <<EOF
|
|
80
|
-
{
|
|
81
|
-
"continue": true
|
|
82
|
-
}
|
|
83
|
-
EOF
|
|
84
|
-
exit 0
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
# Check for gh CLI
|
|
88
|
-
if ! command -v gh &> /dev/null; then
|
|
89
|
-
echo "[$(date)] [GitHub] ⚠️ GitHub CLI (gh) not found, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
90
|
-
cat <<EOF
|
|
91
|
-
{
|
|
92
|
-
"continue": true
|
|
93
|
-
}
|
|
94
|
-
EOF
|
|
95
|
-
exit 0
|
|
96
|
-
fi
|
|
97
|
-
|
|
98
|
-
# ============================================================================
|
|
99
|
-
# DETECT ALL SPECS (Multi-Spec Support)
|
|
100
|
-
# ============================================================================
|
|
101
|
-
|
|
102
|
-
# Strategy: Use multi-spec detector to find ALL specs referenced in current increment
|
|
103
|
-
|
|
104
|
-
# 1. Detect current increment (temporary context)
|
|
105
|
-
CURRENT_INCREMENT=$(ls -td .specweave/increments/*/ 2>/dev/null | xargs -n1 basename | grep -v "_backlog" | grep -v "_archive" | grep -v "_working" | head -1)
|
|
106
|
-
|
|
107
|
-
if [ -z "$CURRENT_INCREMENT" ]; then
|
|
108
|
-
echo "[$(date)] [GitHub] ℹ️ No active increment, checking for spec changes..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
109
|
-
# Fall through to sync all changed specs
|
|
110
|
-
fi
|
|
111
|
-
|
|
112
|
-
# 2. Use TypeScript CLI to detect all specs
|
|
113
|
-
DETECT_CLI="$PROJECT_ROOT/dist/src/cli/commands/detect-specs.js"
|
|
114
|
-
|
|
115
|
-
if [ -f "$DETECT_CLI" ]; then
|
|
116
|
-
echo "[$(date)] [GitHub] 🔍 Detecting all specs in increment $CURRENT_INCREMENT..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
117
|
-
|
|
118
|
-
# Call detect-specs CLI and capture JSON output
|
|
119
|
-
DETECTION_RESULT=$(node "$DETECT_CLI" 2>> "$DEBUG_LOG" || echo "{}")
|
|
120
|
-
|
|
121
|
-
# Extract spec count
|
|
122
|
-
SPEC_COUNT=$(echo "$DETECTION_RESULT" | node -e "const fs=require('fs'); const data=JSON.parse(fs.readFileSync(0,'utf-8')); console.log(data.specs?.length || 0)")
|
|
123
|
-
|
|
124
|
-
echo "[$(date)] [GitHub] 📋 Detected $SPEC_COUNT spec(s)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
125
|
-
|
|
126
|
-
# Store detection result for later use
|
|
127
|
-
echo "$DETECTION_RESULT" > /tmp/specweave-detected-specs.json
|
|
128
|
-
else
|
|
129
|
-
echo "[$(date)] [GitHub] ⚠️ detect-specs CLI not found at $DETECT_CLI, falling back to git diff" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
130
|
-
SPEC_COUNT=0
|
|
131
|
-
fi
|
|
132
|
-
|
|
133
|
-
# ============================================================================
|
|
134
|
-
# SYNC ALL DETECTED SPECS TO GITHUB (Multi-Spec Support)
|
|
135
|
-
# ============================================================================
|
|
136
|
-
|
|
137
|
-
if [ -f /tmp/specweave-detected-specs.json ] && [ "$SPEC_COUNT" -gt 0 ]; then
|
|
138
|
-
# Multi-spec sync: Loop through all detected specs
|
|
139
|
-
echo "[$(date)] [GitHub] 🔄 Syncing $SPEC_COUNT spec(s) to GitHub..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
140
|
-
|
|
141
|
-
# Extract spec paths using Node.js
|
|
142
|
-
SPEC_PATHS=$(node -e "
|
|
143
|
-
const fs = require('fs');
|
|
144
|
-
const data = JSON.parse(fs.readFileSync('/tmp/specweave-detected-specs.json', 'utf-8'));
|
|
145
|
-
const syncable = data.specs.filter(s => s.syncEnabled && s.project !== '_parent');
|
|
146
|
-
syncable.forEach(s => console.log(s.path));
|
|
147
|
-
" 2>> "$DEBUG_LOG")
|
|
148
|
-
|
|
149
|
-
# Count syncable specs
|
|
150
|
-
SYNCABLE_COUNT=$(echo "$SPEC_PATHS" | grep -v '^$' | wc -l | tr -d ' ')
|
|
151
|
-
|
|
152
|
-
if [ "$SYNCABLE_COUNT" -gt 0 ]; then
|
|
153
|
-
echo "[$(date)] [GitHub] 📋 Syncing $SYNCABLE_COUNT syncable spec(s) (excluding _parent)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
154
|
-
|
|
155
|
-
# Sync each spec
|
|
156
|
-
echo "$SPEC_PATHS" | while read -r SPEC_FILE; do
|
|
157
|
-
if [ -n "$SPEC_FILE" ] && [ -f "$SPEC_FILE" ]; then
|
|
158
|
-
# Extract project and spec ID from path
|
|
159
|
-
SPEC_NAME=$(basename "$SPEC_FILE" .md)
|
|
160
|
-
PROJECT=$(basename "$(dirname "$SPEC_FILE")")
|
|
161
|
-
|
|
162
|
-
echo "[$(date)] [GitHub] 🔄 Syncing $PROJECT/$SPEC_NAME..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
163
|
-
|
|
164
|
-
(cd "$PROJECT_ROOT" && node "$SYNC_CLI" --spec "$SPEC_FILE" --provider github) 2>&1 | tee -a "$DEBUG_LOG" >/dev/null || {
|
|
165
|
-
echo "[$(date)] [GitHub] ⚠️ Spec sync failed for $PROJECT/$SPEC_NAME (non-blocking)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
echo "[$(date)] [GitHub] ✅ Synced $PROJECT/$SPEC_NAME" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
169
|
-
fi
|
|
170
|
-
done
|
|
171
|
-
|
|
172
|
-
echo "[$(date)] [GitHub] ✅ Multi-spec sync complete ($SYNCABLE_COUNT synced)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
173
|
-
else
|
|
174
|
-
echo "[$(date)] [GitHub] ℹ️ No syncable specs (all specs are _parent or syncEnabled=false)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
175
|
-
fi
|
|
176
|
-
|
|
177
|
-
# Cleanup temp file
|
|
178
|
-
rm -f /tmp/specweave-detected-specs.json 2>/dev/null || true
|
|
179
|
-
else
|
|
180
|
-
# Fallback: Sync all modified specs (check git diff)
|
|
181
|
-
echo "[$(date)] [GitHub] 🔄 Checking for modified specs..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
182
|
-
|
|
183
|
-
MODIFIED_SPECS=$(git diff --name-only HEAD .specweave/docs/internal/specs/**/*.md 2>/dev/null || echo "")
|
|
184
|
-
|
|
185
|
-
if [ -n "$MODIFIED_SPECS" ]; then
|
|
186
|
-
echo "[$(date)] [GitHub] 📝 Found modified specs:" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
187
|
-
echo "$MODIFIED_SPECS" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
188
|
-
|
|
189
|
-
# Sync each modified spec
|
|
190
|
-
echo "$MODIFIED_SPECS" | while read -r SPEC_FILE; do
|
|
191
|
-
if [ -n "$SPEC_FILE" ] && [ -f "$SPEC_FILE" ]; then
|
|
192
|
-
echo "[$(date)] [GitHub] 🔄 Syncing $SPEC_FILE..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
193
|
-
(cd "$PROJECT_ROOT" && node "$SYNC_CLI" --spec "$SPEC_FILE" --provider github) 2>&1 | tee -a "$DEBUG_LOG" >/dev/null || true
|
|
194
|
-
fi
|
|
195
|
-
done
|
|
196
|
-
|
|
197
|
-
echo "[$(date)] [GitHub] ✅ Batch spec sync complete" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
198
|
-
else
|
|
199
|
-
echo "[$(date)] [GitHub] ℹ️ No modified specs found, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
200
|
-
fi
|
|
201
|
-
fi
|
|
202
|
-
|
|
203
|
-
# ============================================================================
|
|
204
|
-
# EPIC GITHUB ISSUE SYNC (DEPRECATED v0.24.0+)
|
|
205
|
-
# ============================================================================
|
|
206
|
-
#
|
|
207
|
-
# ⚠️ DEPRECATED: SpecWeave now syncs ONLY at User Story level.
|
|
208
|
-
#
|
|
209
|
-
# Feature/Epic-level issues are no longer updated.
|
|
210
|
-
# Use /specweave-github:sync instead to sync User Story issues.
|
|
211
|
-
#
|
|
212
|
-
# To re-enable (NOT recommended):
|
|
213
|
-
# export SPECWEAVE_ENABLE_EPIC_SYNC=true
|
|
214
|
-
#
|
|
215
|
-
# @see .specweave/increments/0047-us-task-linkage/reports/GITHUB-TITLE-FORMAT-FIX-PLAN.md
|
|
216
|
-
# ============================================================================
|
|
217
|
-
|
|
218
|
-
if [ "$SPECWEAVE_ENABLE_EPIC_SYNC" = "true" ]; then
|
|
219
|
-
echo "[$(date)] [GitHub] 🔄 Checking for Epic GitHub issue update (DEPRECATED)..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
220
|
-
|
|
221
|
-
# Find active increment ID
|
|
222
|
-
ACTIVE_INCREMENT=$(ls -t .specweave/increments/ | grep -v '^\.' | while read inc; do
|
|
223
|
-
if [ -f ".specweave/increments/$inc/metadata.json" ]; then
|
|
224
|
-
STATUS=$(grep -o '"status"[[:space:]]*:[[:space:]]*"[^"]*"' ".specweave/increments/$inc/metadata.json" 2>/dev/null | sed 's/.*"\([^"]*\)".*/\1/' || true)
|
|
225
|
-
if [ "$STATUS" = "active" ]; then
|
|
226
|
-
echo "$inc"
|
|
227
|
-
break
|
|
228
|
-
fi
|
|
229
|
-
fi
|
|
230
|
-
done | head -1)
|
|
231
|
-
|
|
232
|
-
if [ -n "$ACTIVE_INCREMENT" ]; then
|
|
233
|
-
echo "[$(date)] [GitHub] 🎯 Active increment: $ACTIVE_INCREMENT" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
234
|
-
|
|
235
|
-
# Run Epic sync script (silently, errors logged to debug log)
|
|
236
|
-
if [ -f "$PROJECT_ROOT/scripts/update-epic-github-issue.sh" ]; then
|
|
237
|
-
echo "[$(date)] [GitHub] 🚀 Updating Epic GitHub issue (DEPRECATED)..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
238
|
-
"$PROJECT_ROOT/scripts/update-epic-github-issue.sh" "$ACTIVE_INCREMENT" >> "$DEBUG_LOG" 2>&1 || true
|
|
239
|
-
echo "[$(date)] [GitHub] ⚠️ Epic sync is deprecated. Use /specweave-github:sync instead." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
240
|
-
else
|
|
241
|
-
echo "[$(date)] [GitHub] ⚠️ Epic sync script not found, skipping" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
242
|
-
fi
|
|
243
|
-
else
|
|
244
|
-
echo "[$(date)] [GitHub] ℹ️ No active increment found, skipping Epic sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
245
|
-
fi
|
|
246
|
-
else
|
|
247
|
-
echo "[$(date)] [GitHub] ℹ️ Epic sync disabled (sync at User Story level only)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
248
|
-
fi
|
|
249
|
-
|
|
250
|
-
# ============================================================================
|
|
251
|
-
# OUTPUT TO CLAUDE
|
|
252
|
-
# ============================================================================
|
|
253
|
-
|
|
254
|
-
cat <<EOF
|
|
255
|
-
{
|
|
256
|
-
"continue": true
|
|
257
|
-
}
|
|
258
|
-
EOF
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# SpecWeave JIRA Sync Hook
|
|
4
|
-
# Runs after task completion to sync progress to JIRA Issues
|
|
5
|
-
#
|
|
6
|
-
# This hook is part of the specweave-jira plugin and handles:
|
|
7
|
-
# - Syncing task completion state to JIRA issues
|
|
8
|
-
# - Updating JIRA issue status based on increment progress
|
|
9
|
-
#
|
|
10
|
-
# Dependencies:
|
|
11
|
-
# - Node.js for running sync scripts
|
|
12
|
-
# - jq for JSON parsing
|
|
13
|
-
# - metadata.json must have .jira.issue field
|
|
14
|
-
# - JIRA API credentials in .env
|
|
15
|
-
|
|
16
|
-
set -e
|
|
17
|
-
|
|
18
|
-
# ============================================================================
|
|
19
|
-
# PROJECT ROOT DETECTION
|
|
20
|
-
# ============================================================================
|
|
21
|
-
|
|
22
|
-
# Find project root by searching upward for .specweave/ directory
|
|
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
|
-
# Fallback: try current directory
|
|
33
|
-
if [ -d "$(pwd)/.specweave" ]; then
|
|
34
|
-
pwd
|
|
35
|
-
else
|
|
36
|
-
echo "$(pwd)"
|
|
37
|
-
fi
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
41
|
-
cd "$PROJECT_ROOT" 2>/dev/null || true
|
|
42
|
-
|
|
43
|
-
# ============================================================================
|
|
44
|
-
# CONFIGURATION
|
|
45
|
-
# ============================================================================
|
|
46
|
-
|
|
47
|
-
LOGS_DIR=".specweave/logs"
|
|
48
|
-
DEBUG_LOG="$LOGS_DIR/hooks-debug.log"
|
|
49
|
-
|
|
50
|
-
mkdir -p "$LOGS_DIR" 2>/dev/null || true
|
|
51
|
-
|
|
52
|
-
# ============================================================================
|
|
53
|
-
# PRECONDITIONS CHECK
|
|
54
|
-
# ============================================================================
|
|
55
|
-
|
|
56
|
-
echo "[$(date)] [JIRA] 🔗 JIRA sync hook fired" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
57
|
-
|
|
58
|
-
# Detect current increment
|
|
59
|
-
CURRENT_INCREMENT=$(ls -td .specweave/increments/*/ 2>/dev/null | xargs -n1 basename | grep -v "_backlog" | grep -v "_archive" | grep -v "_working" | head -1)
|
|
60
|
-
|
|
61
|
-
if [ -z "$CURRENT_INCREMENT" ]; then
|
|
62
|
-
echo "[$(date)] [JIRA] ℹ️ No active increment, skipping JIRA sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
63
|
-
cat <<EOF
|
|
64
|
-
{
|
|
65
|
-
"continue": true
|
|
66
|
-
}
|
|
67
|
-
EOF
|
|
68
|
-
exit 0
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
# Check for metadata.json
|
|
72
|
-
METADATA_FILE=".specweave/increments/$CURRENT_INCREMENT/metadata.json"
|
|
73
|
-
|
|
74
|
-
if [ ! -f "$METADATA_FILE" ]; then
|
|
75
|
-
echo "[$(date)] [JIRA] ℹ️ No metadata.json for $CURRENT_INCREMENT, skipping JIRA sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
76
|
-
cat <<EOF
|
|
77
|
-
{
|
|
78
|
-
"continue": true
|
|
79
|
-
}
|
|
80
|
-
EOF
|
|
81
|
-
exit 0
|
|
82
|
-
fi
|
|
83
|
-
|
|
84
|
-
# Check for JIRA issue link
|
|
85
|
-
if ! command -v jq &> /dev/null; then
|
|
86
|
-
echo "[$(date)] [JIRA] ⚠️ jq not found, skipping JIRA sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
87
|
-
cat <<EOF
|
|
88
|
-
{
|
|
89
|
-
"continue": true
|
|
90
|
-
}
|
|
91
|
-
EOF
|
|
92
|
-
exit 0
|
|
93
|
-
fi
|
|
94
|
-
|
|
95
|
-
JIRA_ISSUE=$(jq -r '.jira.issue // empty' "$METADATA_FILE" 2>/dev/null)
|
|
96
|
-
|
|
97
|
-
if [ -z "$JIRA_ISSUE" ]; then
|
|
98
|
-
echo "[$(date)] [JIRA] ℹ️ No JIRA issue linked to $CURRENT_INCREMENT, skipping sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
99
|
-
cat <<EOF
|
|
100
|
-
{
|
|
101
|
-
"continue": true
|
|
102
|
-
}
|
|
103
|
-
EOF
|
|
104
|
-
exit 0
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
# Check for Node.js
|
|
108
|
-
if ! command -v node &> /dev/null; then
|
|
109
|
-
echo "[$(date)] [JIRA] ⚠️ Node.js not found, skipping JIRA sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
110
|
-
cat <<EOF
|
|
111
|
-
{
|
|
112
|
-
"continue": true
|
|
113
|
-
}
|
|
114
|
-
EOF
|
|
115
|
-
exit 0
|
|
116
|
-
fi
|
|
117
|
-
|
|
118
|
-
# Check for JIRA sync script
|
|
119
|
-
if [ ! -f "dist/commands/jira-sync.js" ]; then
|
|
120
|
-
echo "[$(date)] [JIRA] ⚠️ jira-sync.js not found, skipping JIRA sync" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
121
|
-
cat <<EOF
|
|
122
|
-
{
|
|
123
|
-
"continue": true
|
|
124
|
-
}
|
|
125
|
-
EOF
|
|
126
|
-
exit 0
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
# ============================================================================
|
|
130
|
-
# JIRA SYNC LOGIC
|
|
131
|
-
# ============================================================================
|
|
132
|
-
|
|
133
|
-
echo "[$(date)] [JIRA] 🔄 Syncing to JIRA issue $JIRA_ISSUE" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
134
|
-
|
|
135
|
-
# Run JIRA sync command (non-blocking)
|
|
136
|
-
node dist/commands/jira-sync.js "$CURRENT_INCREMENT" 2>&1 | tee -a "$DEBUG_LOG" >/dev/null || {
|
|
137
|
-
echo "[$(date)] [JIRA] ⚠️ Failed to sync to JIRA (non-blocking)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
echo "[$(date)] [JIRA] ✅ JIRA sync complete" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
141
|
-
|
|
142
|
-
# ============================================================================
|
|
143
|
-
# SPEC COMMIT SYNC (NEW!)
|
|
144
|
-
# ============================================================================
|
|
145
|
-
|
|
146
|
-
echo "[$(date)] [JIRA] 🔗 Checking for spec commit sync..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
147
|
-
|
|
148
|
-
# Call TypeScript CLI to sync commits
|
|
149
|
-
if command -v node &> /dev/null && [ -f "$PROJECT_ROOT/dist/cli/commands/sync-spec-commits.js" ]; then
|
|
150
|
-
echo "[$(date)] [JIRA] 🚀 Running spec commit sync..." >> "$DEBUG_LOG" 2>/dev/null || true
|
|
151
|
-
|
|
152
|
-
node "$PROJECT_ROOT/dist/cli/commands/sync-spec-commits.js" \
|
|
153
|
-
--increment "$PROJECT_ROOT/.specweave/increments/$CURRENT_INCREMENT" \
|
|
154
|
-
--provider jira \
|
|
155
|
-
2>&1 | tee -a "$DEBUG_LOG" >/dev/null || {
|
|
156
|
-
echo "[$(date)] [JIRA] ⚠️ Spec commit sync failed (non-blocking)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
echo "[$(date)] [JIRA] ✅ Spec commit sync complete" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
160
|
-
else
|
|
161
|
-
echo "[$(date)] [JIRA] ℹ️ Spec commit sync not available (node or script not found)" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
162
|
-
fi
|
|
163
|
-
|
|
164
|
-
# ============================================================================
|
|
165
|
-
# OUTPUT TO CLAUDE
|
|
166
|
-
# ============================================================================
|
|
167
|
-
|
|
168
|
-
cat <<EOF
|
|
169
|
-
{
|
|
170
|
-
"continue": true
|
|
171
|
-
}
|
|
172
|
-
EOF
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Post-Increment-Completion Hook - DORA Metrics Tracking
|
|
3
|
-
#
|
|
4
|
-
# Fires after: /specweave:done completes
|
|
5
|
-
# Purpose: Automatically track DORA metrics and update living docs dashboard
|
|
6
|
-
#
|
|
7
|
-
# Integration: plugins/specweave-release/hooks/hooks.json
|
|
8
|
-
|
|
9
|
-
set -euo pipefail
|
|
10
|
-
|
|
11
|
-
# Constants
|
|
12
|
-
SPECWEAVE_ROOT="${SPECWEAVE_ROOT:-$(pwd)}"
|
|
13
|
-
METRICS_DIR="${SPECWEAVE_ROOT}/.specweave/metrics"
|
|
14
|
-
HISTORY_FILE="${METRICS_DIR}/dora-history.jsonl"
|
|
15
|
-
DASHBOARD_FILE="${SPECWEAVE_ROOT}/.specweave/docs/internal/delivery/dora-dashboard.md"
|
|
16
|
-
DORA_CALCULATOR="${SPECWEAVE_ROOT}/dist/src/metrics/dora-calculator.js"
|
|
17
|
-
LATEST_FILE="${METRICS_DIR}/dora-latest.json"
|
|
18
|
-
|
|
19
|
-
# Logging
|
|
20
|
-
LOG_FILE="${SPECWEAVE_ROOT}/.specweave/logs/dora-tracking.log"
|
|
21
|
-
mkdir -p "$(dirname "$LOG_FILE")"
|
|
22
|
-
|
|
23
|
-
log() {
|
|
24
|
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOG_FILE"
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
log "🎯 Post-Increment-Completion Hook Triggered"
|
|
28
|
-
|
|
29
|
-
# Check if DORA calculator exists
|
|
30
|
-
if [[ ! -f "$DORA_CALCULATOR" ]]; then
|
|
31
|
-
log "⚠️ DORA calculator not found at $DORA_CALCULATOR"
|
|
32
|
-
log " Run: npm run build"
|
|
33
|
-
exit 0 # Non-blocking
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Check if GitHub token is available
|
|
37
|
-
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
|
|
38
|
-
log "⚠️ GITHUB_TOKEN not set. DORA metrics require GitHub API access."
|
|
39
|
-
log " Set GITHUB_TOKEN in environment or .env file"
|
|
40
|
-
exit 0 # Non-blocking
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Step 1: Calculate DORA metrics
|
|
44
|
-
log "📊 Calculating DORA metrics..."
|
|
45
|
-
if ! node "$DORA_CALCULATOR"; then
|
|
46
|
-
log "❌ Failed to calculate DORA metrics"
|
|
47
|
-
exit 0 # Non-blocking
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
|
-
# Step 2: Append to history (JSONL format)
|
|
51
|
-
log "💾 Appending metrics to history..."
|
|
52
|
-
mkdir -p "$METRICS_DIR"
|
|
53
|
-
|
|
54
|
-
if [[ -f "$LATEST_FILE" ]]; then
|
|
55
|
-
cat "$LATEST_FILE" >> "$HISTORY_FILE"
|
|
56
|
-
log " ✓ Appended to $HISTORY_FILE"
|
|
57
|
-
else
|
|
58
|
-
log "⚠️ Latest metrics file not found: $LATEST_FILE"
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Step 3: Update living docs dashboard
|
|
62
|
-
log "📝 Updating DORA dashboard..."
|
|
63
|
-
DASHBOARD_GENERATOR="${SPECWEAVE_ROOT}/dist/plugins/specweave-release/lib/dashboard-generator.js"
|
|
64
|
-
|
|
65
|
-
if [[ -f "$DASHBOARD_GENERATOR" ]]; then
|
|
66
|
-
if node "$DASHBOARD_GENERATOR"; then
|
|
67
|
-
log " ✓ Dashboard updated: $DASHBOARD_FILE"
|
|
68
|
-
else
|
|
69
|
-
log "⚠️ Failed to update dashboard"
|
|
70
|
-
fi
|
|
71
|
-
else
|
|
72
|
-
log "⚠️ Dashboard generator not found: $DASHBOARD_GENERATOR"
|
|
73
|
-
log " Manual dashboard update required"
|
|
74
|
-
fi
|
|
75
|
-
|
|
76
|
-
# Step 4: Check for degradation (optional)
|
|
77
|
-
log "🔍 Checking for metric degradation..."
|
|
78
|
-
|
|
79
|
-
# Calculate 30-day average and compare with current
|
|
80
|
-
# (This would be implemented in a TypeScript utility)
|
|
81
|
-
# For now, we'll just log a reminder
|
|
82
|
-
log " ℹ️ Degradation detection: Manual review recommended"
|
|
83
|
-
log " See: $DASHBOARD_FILE for trends"
|
|
84
|
-
|
|
85
|
-
# Step 5: Update main DORA metrics doc
|
|
86
|
-
DORA_METRICS_DOC="${SPECWEAVE_ROOT}/.specweave/docs/internal/delivery/dora-metrics.md"
|
|
87
|
-
if [[ -f "$DORA_METRICS_DOC" && -f "$LATEST_FILE" ]]; then
|
|
88
|
-
log "📄 Updating dora-metrics.md with latest values..."
|
|
89
|
-
|
|
90
|
-
# Extract current values from latest metrics
|
|
91
|
-
# (This is a simplified version - production would use jq for proper parsing)
|
|
92
|
-
TIMESTAMP=$(date '+%Y-%m-%d %H:%M UTC')
|
|
93
|
-
|
|
94
|
-
# Update "Last Calculated" timestamp
|
|
95
|
-
if command -v sed &> /dev/null; then
|
|
96
|
-
sed -i.bak "s/Last Calculated: .*/Last Calculated: $TIMESTAMP/" "$DORA_METRICS_DOC" 2>/dev/null || true
|
|
97
|
-
rm -f "${DORA_METRICS_DOC}.bak" 2>/dev/null || true
|
|
98
|
-
log " ✓ Updated timestamp in dora-metrics.md"
|
|
99
|
-
fi
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
log "✅ DORA metrics tracking complete!"
|
|
103
|
-
log ""
|
|
104
|
-
log "📊 Next steps:"
|
|
105
|
-
log " 1. Review dashboard: $DASHBOARD_FILE"
|
|
106
|
-
log " 2. Check trends: Are metrics improving?"
|
|
107
|
-
log " 3. Take action: Address any degradation"
|
|
108
|
-
log ""
|
|
109
|
-
|
|
110
|
-
exit 0
|