specweave 1.0.235 → 1.0.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -193
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts +37 -0
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js +176 -0
- package/dist/plugins/specweave-github/lib/github-ac-comment-poster.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts +36 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.js +115 -0
- package/dist/plugins/specweave-github/lib/github-batch-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts +37 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js +56 -0
- package/dist/plugins/specweave-github/lib/github-board-resolver-v2.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts +68 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.js +102 -0
- package/dist/plugins/specweave-github/lib/github-conflict-resolver.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts +64 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js +162 -0
- package/dist/plugins/specweave-github/lib/github-cross-repo-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.d.ts +50 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.js +107 -0
- package/dist/plugins/specweave-github/lib/github-field-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts +53 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.js +138 -0
- package/dist/plugins/specweave-github/lib/github-graphql-client.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts +40 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.js +50 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-generator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts +30 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.js +75 -0
- package/dist/plugins/specweave-github/lib/github-issue-body-parser.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts +94 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.js +232 -0
- package/dist/plugins/specweave-github/lib/github-pull-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.d.ts +50 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.js +114 -0
- package/dist/plugins/specweave-github/lib/github-push-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts +53 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.js +109 -0
- package/dist/plugins/specweave-github/lib/github-rate-limiter.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts +21 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +161 -0
- package/dist/plugins/specweave-github/lib/github-spec-frontmatter-updater.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts +46 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js +99 -0
- package/dist/plugins/specweave-github/lib/github-sync-orchestrator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts +43 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.js +153 -0
- package/dist/plugins/specweave-github/lib/github-us-auto-closer.js.map +1 -0
- package/dist/plugins/specweave-github/lib/index.d.ts +1 -4
- package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/index.js +1 -4
- package/dist/plugins/specweave-github/lib/index.js.map +1 -1
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +7 -0
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js +15 -0
- package/dist/plugins/specweave-testing/lib/playwright-ci-defaults.js.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts +10 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js +36 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-detector.js.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts +25 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js +57 -0
- package/dist/plugins/specweave-testing/lib/playwright-cli-runner.js.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts +7 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.d.ts.map +1 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.js +17 -0
- package/dist/plugins/specweave-testing/lib/playwright-routing.js.map +1 -0
- package/dist/src/cli/commands/auto.d.ts.map +1 -1
- package/dist/src/cli/commands/auto.js +1 -2
- package/dist/src/cli/commands/auto.js.map +1 -1
- package/dist/src/cli/commands/cancel-auto.js +1 -2
- package/dist/src/cli/commands/cancel-auto.js.map +1 -1
- package/dist/src/cli/commands/living-docs.js +2 -2
- package/dist/src/cli/commands/living-docs.js.map +1 -1
- package/dist/src/cli/commands/update.d.ts.map +1 -1
- package/dist/src/cli/commands/update.js +1 -2
- package/dist/src/cli/commands/update.js.map +1 -1
- package/dist/src/core/config/types.d.ts +8 -0
- package/dist/src/core/config/types.d.ts.map +1 -1
- package/dist/src/core/config/types.js +3 -0
- package/dist/src/core/config/types.js.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +72 -0
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js +6 -0
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/package.json +2 -2
- package/plugins/specweave/hooks/hooks.json +2 -2
- package/plugins/specweave/hooks/startup-health-check.sh +1 -1
- package/plugins/specweave/hooks/stop-auto-v5.sh +166 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +10 -0
- package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +21 -1
- package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +1 -1
- package/plugins/specweave/skills/auto/SKILL.md +71 -251
- package/plugins/specweave/skills/team-build/SKILL.md +370 -0
- package/plugins/specweave/skills/team-merge/SKILL.md +123 -0
- package/plugins/specweave/skills/team-orchestrate/SKILL.md +800 -0
- package/plugins/specweave/skills/team-status/SKILL.md +89 -0
- package/plugins/specweave-github/MULTI-PROJECT-SYNC-ARCHITECTURE.md +94 -8
- package/plugins/specweave-github/commands/sync.md +17 -3
- package/plugins/specweave-github/hooks/github-ac-sync-handler.sh +255 -0
- package/plugins/specweave-github/hooks/github-auto-create-handler.sh +455 -0
- package/plugins/specweave-github/lib/github-ac-comment-poster.js +150 -0
- package/plugins/specweave-github/lib/github-ac-comment-poster.ts +245 -0
- package/plugins/specweave-github/lib/github-batch-sync.js +93 -0
- package/plugins/specweave-github/lib/github-batch-sync.ts +152 -0
- package/plugins/specweave-github/lib/github-board-resolver-v2.js +47 -0
- package/plugins/specweave-github/lib/github-board-resolver-v2.ts +73 -0
- package/plugins/specweave-github/lib/github-conflict-resolver.js +90 -0
- package/plugins/specweave-github/lib/github-conflict-resolver.ts +154 -0
- package/plugins/specweave-github/lib/github-cross-repo-sync.js +168 -0
- package/plugins/specweave-github/lib/github-cross-repo-sync.ts +252 -0
- package/plugins/specweave-github/lib/github-field-sync.js +116 -0
- package/plugins/specweave-github/lib/github-field-sync.ts +165 -0
- package/plugins/specweave-github/lib/github-graphql-client.js +129 -0
- package/plugins/specweave-github/lib/github-graphql-client.ts +181 -0
- package/plugins/specweave-github/lib/github-issue-body-generator.js +30 -0
- package/plugins/specweave-github/lib/github-issue-body-generator.ts +76 -0
- package/plugins/specweave-github/lib/github-issue-body-parser.js +55 -0
- package/plugins/specweave-github/lib/github-issue-body-parser.ts +92 -0
- package/plugins/specweave-github/lib/github-pull-sync.js +185 -0
- package/plugins/specweave-github/lib/github-pull-sync.ts +343 -0
- package/plugins/specweave-github/lib/github-push-sync.js +119 -0
- package/plugins/specweave-github/lib/github-push-sync.ts +174 -0
- package/plugins/specweave-github/lib/github-rate-limiter.js +96 -0
- package/plugins/specweave-github/lib/github-rate-limiter.ts +143 -0
- package/plugins/specweave-github/lib/github-spec-frontmatter-updater.js +117 -0
- package/plugins/specweave-github/lib/github-spec-frontmatter-updater.ts +180 -0
- package/plugins/specweave-github/lib/github-sync-orchestrator.js +84 -0
- package/plugins/specweave-github/lib/github-sync-orchestrator.ts +156 -0
- package/plugins/specweave-github/lib/github-us-auto-closer.js +134 -0
- package/plugins/specweave-github/lib/github-us-auto-closer.ts +226 -0
- package/plugins/specweave-github/lib/index.js +1 -7
- package/plugins/specweave-github/lib/index.ts +1 -4
- package/plugins/specweave-github/skills/github-sync/SKILL.md +76 -4
- package/plugins/specweave-testing/commands/e2e-setup.md +18 -0
- package/plugins/specweave-testing/commands/ui-automate.md +2 -0
- package/plugins/specweave-testing/commands/ui-inspect.md +8 -0
- package/plugins/specweave-testing/lib/playwright-ci-defaults.d.ts +6 -0
- package/plugins/specweave-testing/lib/playwright-ci-defaults.js +14 -0
- package/plugins/specweave-testing/lib/playwright-ci-defaults.ts +24 -0
- package/plugins/specweave-testing/lib/playwright-cli-detector.js +33 -0
- package/plugins/specweave-testing/lib/playwright-cli-detector.ts +48 -0
- package/plugins/specweave-testing/lib/playwright-cli-runner.js +58 -0
- package/plugins/specweave-testing/lib/playwright-cli-runner.ts +80 -0
- package/plugins/specweave-testing/lib/playwright-routing.js +16 -0
- package/plugins/specweave-testing/lib/playwright-routing.ts +38 -0
- package/plugins/specweave-testing/skills/e2e-testing/SKILL.md +38 -0
- package/src/templates/CLAUDE.md.template +7 -0
- package/src/templates/config.json.template +9 -1
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
- package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/subtask-sync.js +0 -147
- package/dist/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
- package/dist/plugins/specweave-github/lib/task-parser.d.ts +0 -37
- package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/task-parser.js +0 -211
- package/dist/plugins/specweave-github/lib/task-parser.js.map +0 -1
- package/dist/plugins/specweave-github/lib/task-sync.d.ts +0 -56
- package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/task-sync.js +0 -375
- package/dist/plugins/specweave-github/lib/task-sync.js.map +0 -1
- package/plugins/specweave/hooks/validate-completion-conditions.sh +0 -474
- package/plugins/specweave-github/lib/subtask-sync.d.ts +0 -51
- package/plugins/specweave-github/lib/subtask-sync.d.ts.map +0 -1
- package/plugins/specweave-github/lib/subtask-sync.js +0 -154
- package/plugins/specweave-github/lib/subtask-sync.js.map +0 -1
- package/plugins/specweave-github/lib/subtask-sync.ts +0 -225
- package/plugins/specweave-github/lib/task-parser.d.js +0 -0
- package/plugins/specweave-github/lib/task-parser.d.ts +0 -37
- package/plugins/specweave-github/lib/task-parser.d.ts.map +0 -1
- package/plugins/specweave-github/lib/task-parser.js +0 -195
- package/plugins/specweave-github/lib/task-parser.js.map +0 -1
- package/plugins/specweave-github/lib/task-parser.ts +0 -246
- package/plugins/specweave-github/lib/task-sync.d.js +0 -0
- package/plugins/specweave-github/lib/task-sync.d.ts +0 -51
- package/plugins/specweave-github/lib/task-sync.d.ts.map +0 -1
- package/plugins/specweave-github/lib/task-sync.js +0 -415
- package/plugins/specweave-github/lib/task-sync.js.map +0 -1
- package/plugins/specweave-github/lib/task-sync.ts +0 -451
- package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +0 -496
- /package/plugins/specweave/hooks/{stop-auto.sh → _archive/stop-auto-v4-legacy.sh} +0 -0
- /package/plugins/{specweave-github/lib/subtask-sync.d.js → specweave-testing/lib/playwright-ci-defaults.d.js} +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# stop-auto-v5.sh - Auto Mode Stop Hook (v5.0 - Gate Only)
|
|
3
|
+
# ADR-0225: "Increments ARE the state. Hooks ARE the sync."
|
|
4
|
+
# Hook = simple gate. Quality gates (tests, build, coverage) belong in /sw:done.
|
|
5
|
+
# Sourceable: set __STOP_AUTO_V5_SOURCED=1 to load functions only.
|
|
6
|
+
set +e
|
|
7
|
+
|
|
8
|
+
# ── Timing ───────────────────────────────────────────────────────────────
|
|
9
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then _START_MS=$(($(date +%s) * 1000))
|
|
10
|
+
else _START_MS=$(($(date +%s) * 1000 + $(date +%N 2>/dev/null | cut -c1-3 || echo "0"))); fi
|
|
11
|
+
_get_duration_ms() {
|
|
12
|
+
local n; if [[ "$OSTYPE" == "darwin"* ]]; then n=$(($(date +%s) * 1000))
|
|
13
|
+
else n=$(($(date +%s) * 1000 + $(date +%N 2>/dev/null | cut -c1-3 || echo "0"))); fi
|
|
14
|
+
echo $((n - _START_MS))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
# ── Stdin & paths ────────────────────────────────────────────────────────
|
|
18
|
+
[ -z "${__STOP_AUTO_V5_SOURCED:-}" ] && cat > /dev/null
|
|
19
|
+
PROJECT_ROOT="${PROJECT_ROOT:-$(pwd)}"
|
|
20
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
+
[ -f "$SCRIPT_DIR/log-decision.sh" ] && source "$SCRIPT_DIR/log-decision.sh"
|
|
22
|
+
|
|
23
|
+
SW="$PROJECT_ROOT/.specweave"
|
|
24
|
+
STATE_DIR="$SW/state"
|
|
25
|
+
LOGS_DIR="$SW/logs"
|
|
26
|
+
LOG_FILE="$LOGS_DIR/stop-auto.log"
|
|
27
|
+
|
|
28
|
+
log() {
|
|
29
|
+
mkdir -p "$LOGS_DIR" 2>/dev/null
|
|
30
|
+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $1" >> "$LOG_FILE" 2>/dev/null
|
|
31
|
+
[ "${SPECWEAVE_DEBUG_HOOKS:-0}" = "1" ] && echo -e "\033[36m[stop-auto-v5]\033[0m $1" >&2
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# ── Helpers ──────────────────────────────────────────────────────────────
|
|
35
|
+
count_pending_tasks() {
|
|
36
|
+
local f="$1"; [ ! -f "$f" ] && echo "0" && return
|
|
37
|
+
local c; c=$(grep -c '\[ \]' "$f" 2>/dev/null) || true; echo "${c:-0}"
|
|
38
|
+
}
|
|
39
|
+
count_open_acs() {
|
|
40
|
+
local f="$1"; [ ! -f "$f" ] && echo "0" && return
|
|
41
|
+
local c; c=$(grep -c '\[ \]' "$f" 2>/dev/null) || true; echo "${c:-0}"
|
|
42
|
+
}
|
|
43
|
+
silent_approve() {
|
|
44
|
+
local reason="$1" rc="${2:-session_inactive}" ctx="${3:-"{}"}"
|
|
45
|
+
log "APPROVE: $reason"
|
|
46
|
+
type log_decision &>/dev/null && log_decision "stop-auto" "approve" "$rc" "$reason" "$ctx" "$(_get_duration_ms)"
|
|
47
|
+
echo '{"decision":"approve"}'; exit 0
|
|
48
|
+
}
|
|
49
|
+
loud_approve() {
|
|
50
|
+
local reason="$1" rc="${2:-session_complete}" ctx="${3:-"{}"}" msg="$4"
|
|
51
|
+
log "APPROVE (loud): $reason"
|
|
52
|
+
type log_decision &>/dev/null && log_decision "stop-auto" "approve" "$rc" "$reason" "$ctx" "$(_get_duration_ms)"
|
|
53
|
+
jq -n --arg d "approve" --arg r "$reason" --arg m "$msg" '{decision:$d,reason:$r,systemMessage:$m}'; exit 0
|
|
54
|
+
}
|
|
55
|
+
block() {
|
|
56
|
+
local reason="$1" rc="${2:-work_remaining}" ctx="${3:-"{}"}" msg="$4"
|
|
57
|
+
log "BLOCK: $reason"
|
|
58
|
+
type log_decision &>/dev/null && log_decision "stop-auto" "block" "$rc" "$reason" "$ctx" "$(_get_duration_ms)"
|
|
59
|
+
jq -n --arg d "block" --arg r "$reason" --arg m "$msg" '{decision:$d,reason:$r,systemMessage:$m}'; exit 0
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# ── Source-only guard ────────────────────────────────────────────────────
|
|
63
|
+
[ "${__STOP_AUTO_V5_SOURCED:-}" = "1" ] && return 0 2>/dev/null || true
|
|
64
|
+
[ "${__STOP_AUTO_V5_SOURCED:-}" = "1" ] && exit 0
|
|
65
|
+
|
|
66
|
+
# ═════════════════════════════════════════════════════════════════════════
|
|
67
|
+
# MAIN
|
|
68
|
+
# ═════════════════════════════════════════════════════════════════════════
|
|
69
|
+
INC_DIR="$SW/increments"
|
|
70
|
+
CFG="$SW/config.json"
|
|
71
|
+
SESSION="$STATE_DIR/auto-mode.json"
|
|
72
|
+
TURN_FILE="$STATE_DIR/.stop-auto-turns"
|
|
73
|
+
DEDUP_PREV="$STATE_DIR/.stop-auto-dedup-prev"
|
|
74
|
+
|
|
75
|
+
# 1. Quick exits
|
|
76
|
+
[ ! -d "$SW" ] && silent_approve "Not a SpecWeave project" "not_specweave_project"
|
|
77
|
+
[ ! -d "$INC_DIR" ] && silent_approve "No increments directory" "no_increments_dir"
|
|
78
|
+
|
|
79
|
+
# 2. Config
|
|
80
|
+
MAX_TURNS=20; MAX_AGE=7200; AUTO_ON="true"; DEDUP_WIN="${SPECWEAVE_STOP_HOOK_DEDUP:-30}"
|
|
81
|
+
if [ -f "$CFG" ]; then
|
|
82
|
+
AUTO_ON=$(jq -r '.auto.enabled // true' "$CFG" 2>/dev/null || echo "true")
|
|
83
|
+
MAX_TURNS=$(jq -r '.auto.maxTurns // 20' "$CFG" 2>/dev/null || echo "20")
|
|
84
|
+
MAX_AGE=$(jq -r '.auto.maxSessionAge // 7200' "$CFG" 2>/dev/null || echo "7200")
|
|
85
|
+
fi
|
|
86
|
+
[ "$AUTO_ON" != "true" ] && silent_approve "Auto mode disabled" "auto_disabled"
|
|
87
|
+
|
|
88
|
+
# 3. Session marker
|
|
89
|
+
[ ! -f "$SESSION" ] && silent_approve "No auto session" "session_inactive" '{"sessionActive":false}'
|
|
90
|
+
ACTIVE=$(jq -r '.active // false' "$SESSION" 2>/dev/null || echo "false")
|
|
91
|
+
[ "$ACTIVE" != "true" ] && silent_approve "Session not active" "session_inactive" '{"sessionActive":false}'
|
|
92
|
+
|
|
93
|
+
# 4. Staleness
|
|
94
|
+
MTIME=$(stat -f%m "$SESSION" 2>/dev/null || stat -c%Y "$SESSION" 2>/dev/null || echo "0")
|
|
95
|
+
NOW=$(date +%s); AGE=$((NOW - MTIME))
|
|
96
|
+
if [ "$AGE" -gt "$MAX_AGE" ]; then
|
|
97
|
+
rm -f "$SESSION" "$DEDUP_PREV" "$TURN_FILE" 2>/dev/null
|
|
98
|
+
silent_approve "Stale session (${AGE}s)" "session_stale" \
|
|
99
|
+
"$(jq -n --argjson a "$AGE" --argjson m "$MAX_AGE" '{sessionAge:$a,maxSessionAge:$m}')"
|
|
100
|
+
fi
|
|
101
|
+
touch "$SESSION" 2>/dev/null
|
|
102
|
+
|
|
103
|
+
# 5. Turn counter (never resets during session)
|
|
104
|
+
TURN=1
|
|
105
|
+
if [ -f "$TURN_FILE" ]; then
|
|
106
|
+
S=$(cat "$TURN_FILE" 2>/dev/null || echo "0")
|
|
107
|
+
[[ "$S" =~ ^[0-9]+$ ]] && TURN=$((S + 1))
|
|
108
|
+
fi
|
|
109
|
+
mkdir -p "$STATE_DIR" 2>/dev/null
|
|
110
|
+
echo "$TURN" > "$TURN_FILE.tmp" && mv "$TURN_FILE.tmp" "$TURN_FILE" 2>/dev/null
|
|
111
|
+
|
|
112
|
+
if [ "$TURN" -ge "$MAX_TURNS" ]; then
|
|
113
|
+
rm -f "$SESSION" "$DEDUP_PREV" "$TURN_FILE" 2>/dev/null
|
|
114
|
+
loud_approve "Turn limit ($TURN/$MAX_TURNS)" "turn_limit" \
|
|
115
|
+
"$(jq -n --argjson c "$TURN" --argjson m "$MAX_TURNS" '{turn:{current:$c,max:$m}}')" \
|
|
116
|
+
"Turn limit reached ($TURN/$MAX_TURNS). Run /sw:auto to start a new session."
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# 6. Dedup (write-first prevents race)
|
|
120
|
+
if [ -f "$DEDUP_PREV" ]; then
|
|
121
|
+
LAST=$(cat "$DEDUP_PREV" 2>/dev/null || echo "0")
|
|
122
|
+
EL=$((NOW - LAST))
|
|
123
|
+
if [ "$EL" -lt "$DEDUP_WIN" ]; then
|
|
124
|
+
silent_approve "Deduplicated (${EL}s)" "deduplicated" \
|
|
125
|
+
"$(jq -n --argjson e "$EL" --argjson w "$DEDUP_WIN" '{elapsed:$e,dedupWindow:$w}')"
|
|
126
|
+
fi
|
|
127
|
+
fi
|
|
128
|
+
echo "$NOW" > "$DEDUP_PREV" 2>/dev/null
|
|
129
|
+
|
|
130
|
+
# 7. Scan active increments
|
|
131
|
+
TP=0; TAC=0; IC=0; ILIST=""
|
|
132
|
+
for meta in $(find "$INC_DIR" -maxdepth 2 -name "metadata.json" 2>/dev/null); do
|
|
133
|
+
st=$(jq -r '.status // "unknown"' "$meta" 2>/dev/null || echo "unknown")
|
|
134
|
+
[ "$st" != "active" ] && [ "$st" != "in-progress" ] && continue
|
|
135
|
+
d=$(dirname "$meta"); id=$(basename "$d")
|
|
136
|
+
p=$(count_pending_tasks "$d/tasks.md"); a=$(count_open_acs "$d/spec.md")
|
|
137
|
+
if [ "$p" -gt 0 ] || [ "$a" -gt 0 ]; then
|
|
138
|
+
TP=$((TP + p)); TAC=$((TAC + a)); IC=$((IC + 1))
|
|
139
|
+
[ -z "$ILIST" ] && ILIST="$id|$p|$a" || ILIST="$ILIST,$id|$p|$a"
|
|
140
|
+
fi
|
|
141
|
+
done
|
|
142
|
+
|
|
143
|
+
# 8. All complete → approve
|
|
144
|
+
if [ "$IC" -eq 0 ]; then
|
|
145
|
+
rm -f "$SESSION" "$DEDUP_PREV" "$TURN_FILE" 2>/dev/null
|
|
146
|
+
loud_approve "All work complete" "all_complete" \
|
|
147
|
+
"$(jq -n --argjson t "$TURN" '{turn:$t}')" \
|
|
148
|
+
"All tasks and ACs complete. Run /sw:done to close the increment."
|
|
149
|
+
fi
|
|
150
|
+
|
|
151
|
+
# 9. Work remains → block with concise message
|
|
152
|
+
DETAILS=""
|
|
153
|
+
IFS=',' read -ra ENTRIES <<< "$ILIST"
|
|
154
|
+
for entry in "${ENTRIES[@]}"; do
|
|
155
|
+
IFS='|' read -r eid ep ea <<< "$entry"
|
|
156
|
+
DETAILS="${DETAILS}\n - ${eid}: ${ep} tasks pending, ${ea} ACs open"
|
|
157
|
+
done
|
|
158
|
+
|
|
159
|
+
BMSG="Auto Mode: ${IC} increment(s) need work${DETAILS}\nTurn $TURN/$MAX_TURNS | Continue: /sw:do | Complete: /sw:done"
|
|
160
|
+
BMSG=$(echo -e "$BMSG")
|
|
161
|
+
|
|
162
|
+
block "Work remaining: $TP tasks, $TAC ACs" "work_remaining" \
|
|
163
|
+
"$(jq -n --argjson p "$TP" --argjson a "$TAC" --argjson i "$IC" \
|
|
164
|
+
--argjson t "$TURN" --argjson mt "$MAX_TURNS" --arg il "$ILIST" \
|
|
165
|
+
'{pendingTasks:$p,openAcs:$a,incompleteIncrements:$i,increments:$il,turn:{current:$t,max:$mt}}')" \
|
|
166
|
+
"$BMSG"
|
|
@@ -1119,6 +1119,16 @@ if [[ "${SPECWEAVE_DISABLE_AUTO_LOAD:-0}" != "1" ]] && [[ "${SPECWEAVE_DISABLE_H
|
|
|
1119
1119
|
fi
|
|
1120
1120
|
|
|
1121
1121
|
echo "[$(date -Iseconds)] plugins | installed=${PLUGINS_INSTALLED:-none} | already=${PLUGINS_ALREADY:-none}" >> "$LAZY_LOAD_LOG"
|
|
1122
|
+
|
|
1123
|
+
# v0195: Suggest @playwright/cli alongside MCP plugin for token efficiency
|
|
1124
|
+
if echo " $DETECTED_PLUGINS " | grep -q " playwright "; then
|
|
1125
|
+
if ! command -v playwright-cli >/dev/null 2>&1; then
|
|
1126
|
+
CLI_SUGGEST_MSG="\\n💡 **Tip**: Install \`@playwright/cli\` for token-efficient browser automation (~98% savings vs MCP):\\n"
|
|
1127
|
+
CLI_SUGGEST_MSG="${CLI_SUGGEST_MSG} \`npm install -g @playwright/cli@latest\`\\n"
|
|
1128
|
+
AUTOLOAD_PLUGINS_MSG="${AUTOLOAD_PLUGINS_MSG:-}${CLI_SUGGEST_MSG}"
|
|
1129
|
+
echo "[$(date -Iseconds)] playwright-cli | suggested=true | reason=not-installed" >> "$LAZY_LOAD_LOG"
|
|
1130
|
+
fi
|
|
1131
|
+
fi
|
|
1122
1132
|
fi
|
|
1123
1133
|
fi
|
|
1124
1134
|
fi
|
|
@@ -165,7 +165,7 @@ safe_run_sync() {
|
|
|
165
165
|
play_task_completion_sound() {
|
|
166
166
|
local tasks_file="$1"
|
|
167
167
|
local state_file="$STATE_DIR/.last-task-completion"
|
|
168
|
-
local session_file="$STATE_DIR/auto-
|
|
168
|
+
local session_file="$STATE_DIR/auto-mode.json"
|
|
169
169
|
|
|
170
170
|
# DISABLED: Sound notifications are disabled by default
|
|
171
171
|
# To re-enable, set SPECWEAVE_SOUND_ENABLED=1 in environment
|
|
@@ -311,6 +311,14 @@ case "$FILE_PATH" in
|
|
|
311
311
|
safe_run_sync "$SYNC_SCRIPT" "task-ac-sync" "$INPUT"
|
|
312
312
|
fi
|
|
313
313
|
|
|
314
|
+
# ========================================================================
|
|
315
|
+
# GITHUB AC SYNC (v1.0.236+): Post progress to GitHub after AC sync
|
|
316
|
+
# ========================================================================
|
|
317
|
+
GITHUB_AC_HANDLER="${HOOK_DIR}/../../../specweave-github/hooks/github-ac-sync-handler.sh"
|
|
318
|
+
if [[ -f "$GITHUB_AC_HANDLER" ]]; then
|
|
319
|
+
safe_run_background "$GITHUB_AC_HANDLER" "github-ac-sync" "$INC_ID"
|
|
320
|
+
fi
|
|
321
|
+
|
|
314
322
|
# ========================================================================
|
|
315
323
|
# TDD ENFORCEMENT (v1.0.160+): Enforce TDD discipline
|
|
316
324
|
# ========================================================================
|
|
@@ -349,6 +357,18 @@ case "$FILE_PATH" in
|
|
|
349
357
|
play_task_completion_sound "$FILE_PATH"
|
|
350
358
|
fi
|
|
351
359
|
|
|
360
|
+
# ========================================================================
|
|
361
|
+
# GITHUB AUTO-CREATE (v1.0.237+): Create issues when spec.md is written
|
|
362
|
+
# ========================================================================
|
|
363
|
+
# When spec.md is created/updated AND has user stories, auto-create
|
|
364
|
+
# GitHub issues if autoSync or auto_create_github_issue is enabled.
|
|
365
|
+
if [[ "$FILE_PATH" == *spec.md ]]; then
|
|
366
|
+
GITHUB_AUTO_CREATE="${HOOK_DIR}/../../../specweave-github/hooks/github-auto-create-handler.sh"
|
|
367
|
+
if [[ -f "$GITHUB_AUTO_CREATE" ]]; then
|
|
368
|
+
safe_run_background "$GITHUB_AUTO_CREATE" "github-auto-create" "$INC_ID"
|
|
369
|
+
fi
|
|
370
|
+
fi
|
|
371
|
+
|
|
352
372
|
# Tasks or spec changed -> check for US completion (background)
|
|
353
373
|
safe_run_background "$DETECTOR_DIR/us-completion-detector.sh" "us-completion-detector" "$INC_ID"
|
|
354
374
|
|
|
@@ -32,7 +32,7 @@ AUTO_MODE_FILE="$STATE_DIR/auto-mode.json"
|
|
|
32
32
|
if [[ -f "$AUTO_MODE_FILE" ]]; then
|
|
33
33
|
rm -f "$AUTO_MODE_FILE" 2>/dev/null
|
|
34
34
|
rm -f "$STATE_DIR/.stop-auto-dedup" 2>/dev/null
|
|
35
|
-
rm -f "$STATE_DIR/.stop-auto-
|
|
35
|
+
rm -f "$STATE_DIR/.stop-auto-dedup-prev" 2>/dev/null
|
|
36
36
|
rm -f "$STATE_DIR/.stop-auto-turns" 2>/dev/null
|
|
37
37
|
# Log cleanup (non-blocking, fire-and-forget)
|
|
38
38
|
mkdir -p "$PROJECT_ROOT/.specweave/logs" 2>/dev/null
|