specweave 0.28.24 → 0.28.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/specweave-ado/lib/ado-multi-project-sync.js +0 -1
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave-release/commands/specweave-release-npm.md +94 -4
- 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/.specweave/logs/hooks-debug.log +0 -1238
- 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/.specweave/logs/dora-tracking.log +0 -1218
- package/plugins/specweave-release/hooks/post-task-completion.sh.backup +0 -110
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specweave",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.25",
|
|
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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EnhancedContentBuilder } from "../../../
|
|
2
|
-
import { SpecIncrementMapper } from "../../../
|
|
3
|
-
import { parseSpecContent } from "../../../
|
|
1
|
+
import { EnhancedContentBuilder } from "../../../src/core/sync/enhanced-content-builder.js";
|
|
2
|
+
import { SpecIncrementMapper } from "../../../src/core/sync/spec-increment-mapper.js";
|
|
3
|
+
import { parseSpecContent } from "../../../src/core/spec-content-sync.js";
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import * as fs from "fs/promises";
|
|
6
6
|
async function syncSpecToJiraWithEnhancedContent(options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specweave-release:npm
|
|
3
|
-
description: Bump patch version, create git tag, and trigger npm publish via GitHub Actions. Automates the complete release workflow with pre-flight checks, version bumping, tag creation, and GitHub Actions triggering. Use --only flag for quick local release (bumps version, builds, publishes to npm directly - NO git push, NO pipeline). Add --push to --only for complete local release with git sync.
|
|
3
|
+
description: Bump patch version, create git tag, and trigger npm publish via GitHub Actions. Automates the complete release workflow with pre-flight checks, version bumping, tag creation, and GitHub Actions triggering. Use --only flag for quick local release (bumps version, builds, publishes to npm directly - NO git push, NO pipeline). Add --push to --only for complete local release with git sync. Use --only --local for FASTEST local-only version bump (no npm publish, no git, just version increment for local testing).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /specweave-release:npm - NPM Release Automation
|
|
@@ -14,22 +14,27 @@ You are the NPM Release Assistant. Your job is to automate the patch version rel
|
|
|
14
14
|
| `/specweave-release:npm` | Bump → Push → **CI publishes** | Standard release (CI handles npm) |
|
|
15
15
|
| `/specweave-release:npm --only` | Bump → Build → **Publish locally** → NO push | Quick local release, push later |
|
|
16
16
|
| `/specweave-release:npm --only --push` | Bump → Build → **Publish locally** → Push | Complete local release + git sync |
|
|
17
|
+
| `/specweave-release:npm --only --local` | **Bump ONLY** → NO build, NO publish, NO git | FASTEST: Local testing only |
|
|
17
18
|
|
|
18
19
|
## Detecting Mode
|
|
19
20
|
|
|
20
21
|
Check flags in the command invocation:
|
|
21
22
|
|
|
22
23
|
```
|
|
23
|
-
--only
|
|
24
|
+
--only --local → Version bump ONLY (no build, no publish, no git) - FASTEST
|
|
24
25
|
--only --push → Direct publish + push to git after
|
|
26
|
+
--only → Direct publish to npm (bypass CI)
|
|
25
27
|
(no flags) → Default: push to git, CI publishes
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
**Flag Detection Order:**
|
|
29
31
|
1. Check for `--only` flag
|
|
30
|
-
2. If `--only` present, check for `--
|
|
31
|
-
3.
|
|
32
|
+
2. If `--only` present, check for `--local` flag → LOCAL MODE (fastest)
|
|
33
|
+
3. If `--only` present, check for `--push` flag → DIRECT MODE + PUSH
|
|
34
|
+
4. If `--only` only → DIRECT MODE
|
|
35
|
+
5. No flags → DEFAULT MODE
|
|
32
36
|
|
|
37
|
+
**If `--only --local`**: Use LOCAL MODE (section "Local Mode Workflow") - FASTEST!
|
|
33
38
|
**If `--only --push`**: Use DIRECT MODE WITH PUSH (section "Direct Mode + Push Workflow")
|
|
34
39
|
**If `--only` only**: Use DIRECT MODE (section "Direct Mode Workflow")
|
|
35
40
|
**If no flags**: Use DEFAULT MODE (continue with steps below)
|
|
@@ -400,6 +405,9 @@ Show the user:
|
|
|
400
405
|
|
|
401
406
|
# Complete local release (publish + push)
|
|
402
407
|
/specweave-release:npm --only --push
|
|
408
|
+
|
|
409
|
+
# FASTEST: Version bump only (no publish, no git, no build)
|
|
410
|
+
/specweave-release:npm --only --local
|
|
403
411
|
```
|
|
404
412
|
|
|
405
413
|
| Scenario | Command | NPM Published By | Git Pushed |
|
|
@@ -407,3 +415,85 @@ Show the user:
|
|
|
407
415
|
| Normal release | (no flags) | GitHub Actions | ✅ Yes |
|
|
408
416
|
| Quick local, push later | `--only` | You (local) | ❌ No |
|
|
409
417
|
| Complete local release | `--only --push` | You (local) | ✅ Yes |
|
|
418
|
+
| **FASTEST local test** | `--only --local` | ❌ None | ❌ No |
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## LOCAL MODE WORKFLOW (--only --local flags) - FASTEST!
|
|
423
|
+
|
|
424
|
+
Use this workflow when BOTH `--only` AND `--local` flags are detected. This is the **fastest possible** version bump - NO npm publish, NO git operations, NO build. Just increment the version number for local testing.
|
|
425
|
+
|
|
426
|
+
**Use case**: You need to quickly test a new version locally without publishing anywhere. Perfect for:
|
|
427
|
+
- Testing version-dependent features
|
|
428
|
+
- Local development iterations
|
|
429
|
+
- Quick version bumps before a real release
|
|
430
|
+
|
|
431
|
+
### 1. Minimal Pre-flight Check
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
# Just verify current version (no git checks needed!)
|
|
435
|
+
node -p "require('./package.json').version"
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**NO git checks** - we're not committing or pushing anything!
|
|
439
|
+
|
|
440
|
+
### 2. Bump Version (NO git commit, NO tag)
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Bump version WITHOUT creating git commit or tag
|
|
444
|
+
npm version patch --no-git-tag-version
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
**What this does**:
|
|
448
|
+
- Updates `package.json` version ONLY
|
|
449
|
+
- Updates `package-lock.json` version ONLY
|
|
450
|
+
- NO git commit created
|
|
451
|
+
- NO git tag created
|
|
452
|
+
- INSTANT (< 1 second)
|
|
453
|
+
|
|
454
|
+
### 3. Report Results (Local Mode)
|
|
455
|
+
|
|
456
|
+
Show the user:
|
|
457
|
+
```markdown
|
|
458
|
+
⚡ **FAST local version bump!**
|
|
459
|
+
|
|
460
|
+
📦 **Version**: X.Y.Z → X.Y.(Z+1)
|
|
461
|
+
|
|
462
|
+
**What happened**:
|
|
463
|
+
- ✅ package.json version bumped
|
|
464
|
+
- ✅ package-lock.json updated
|
|
465
|
+
- ⏭️ NO git commit (use `git add . && git commit` later)
|
|
466
|
+
- ⏭️ NO git tag (use `git tag vX.Y.Z` later)
|
|
467
|
+
- ⏭️ NO npm publish (use `npm publish` later)
|
|
468
|
+
- ⏭️ NO build (use `npm run rebuild` later)
|
|
469
|
+
|
|
470
|
+
**Next steps when ready to release**:
|
|
471
|
+
1. Build: `npm run rebuild`
|
|
472
|
+
2. Test: `npm test`
|
|
473
|
+
3. Commit: `git add . && git commit -m "chore: bump version to X.Y.Z"`
|
|
474
|
+
4. Tag: `git tag vX.Y.Z`
|
|
475
|
+
5. Publish: `npm publish`
|
|
476
|
+
6. Push: `git push origin develop --follow-tags`
|
|
477
|
+
|
|
478
|
+
**Or use**: `/specweave-release:npm --only --push` for full release
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
## Local Mode Safety Rules
|
|
482
|
+
|
|
483
|
+
- ✅ FASTEST possible - single npm command
|
|
484
|
+
- ✅ NO network operations (no npm publish, no git push)
|
|
485
|
+
- ✅ NO disk-heavy operations (no build)
|
|
486
|
+
- ✅ Safe to run multiple times (just increments version)
|
|
487
|
+
- ⚠️ Remember: version is NOT published or committed!
|
|
488
|
+
- ⚠️ Run `npm run rebuild` before testing locally
|
|
489
|
+
|
|
490
|
+
## Success Criteria (Local Mode)
|
|
491
|
+
|
|
492
|
+
✅ Version bumped in package.json
|
|
493
|
+
✅ Version bumped in package-lock.json
|
|
494
|
+
⏭️ NO git commit
|
|
495
|
+
⏭️ NO git tag
|
|
496
|
+
⏭️ NO npm publish
|
|
497
|
+
⏭️ NO build
|
|
498
|
+
|
|
499
|
+
**Time**: < 1 second
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
|
@@ -1,75 +0,0 @@
|
|
|
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"
|
|
@@ -1,61 +0,0 @@
|
|
|
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
|
|
@@ -1,98 +0,0 @@
|
|
|
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
|