claude-raid 0.1.1 → 0.1.3
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 +298 -196
- package/bin/cli.js +45 -18
- package/package.json +1 -1
- package/src/descriptions.js +57 -0
- package/src/detect-browser.js +164 -0
- package/src/detect-package-manager.js +107 -0
- package/src/detect-project.js +44 -6
- package/src/doctor.js +12 -188
- package/src/init.js +192 -17
- package/src/merge-settings.js +63 -7
- package/src/remove.js +28 -4
- package/src/setup.js +405 -0
- package/src/ui.js +168 -0
- package/src/update.js +62 -5
- package/src/version-check.js +130 -0
- package/template/.claude/agents/archer.md +46 -51
- package/template/.claude/agents/rogue.md +43 -49
- package/template/.claude/agents/warrior.md +48 -53
- package/template/.claude/agents/wizard.md +65 -67
- package/template/.claude/hooks/raid-lib.sh +182 -0
- package/template/.claude/hooks/raid-pre-compact.sh +41 -0
- package/template/.claude/hooks/raid-session-end.sh +116 -0
- package/template/.claude/hooks/raid-session-start.sh +52 -0
- package/template/.claude/hooks/raid-stop.sh +68 -0
- package/template/.claude/hooks/raid-task-completed.sh +37 -0
- package/template/.claude/hooks/raid-task-created.sh +40 -0
- package/template/.claude/hooks/raid-teammate-idle.sh +28 -0
- package/template/.claude/hooks/validate-browser-cleanup.sh +36 -0
- package/template/.claude/hooks/validate-browser-tests-exist.sh +52 -0
- package/template/.claude/hooks/validate-commit.sh +130 -0
- package/template/.claude/hooks/validate-dungeon.sh +114 -0
- package/template/.claude/hooks/validate-file-naming.sh +13 -27
- package/template/.claude/hooks/validate-no-placeholders.sh +11 -21
- package/template/.claude/hooks/validate-write-gate.sh +60 -0
- package/template/.claude/raid-rules.md +27 -18
- package/template/.claude/skills/raid-browser/SKILL.md +186 -0
- package/template/.claude/skills/raid-browser-chrome/SKILL.md +189 -0
- package/template/.claude/skills/raid-browser-playwright/SKILL.md +163 -0
- package/template/.claude/skills/raid-debugging/SKILL.md +6 -6
- package/template/.claude/skills/raid-design/SKILL.md +10 -10
- package/template/.claude/skills/raid-finishing/SKILL.md +11 -3
- package/template/.claude/skills/raid-implementation/SKILL.md +26 -11
- package/template/.claude/skills/raid-implementation-plan/SKILL.md +15 -4
- package/template/.claude/skills/raid-protocol/SKILL.md +57 -32
- package/template/.claude/skills/raid-review/SKILL.md +42 -13
- package/template/.claude/skills/raid-tdd/SKILL.md +45 -3
- package/template/.claude/skills/raid-verification/SKILL.md +12 -1
- package/template/.claude/hooks/validate-commit-message.sh +0 -78
- package/template/.claude/hooks/validate-phase-gate.sh +0 -60
- package/template/.claude/hooks/validate-tests-pass.sh +0 -43
- package/template/.claude/hooks/validate-verification.sh +0 -70
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Raid quality gate: validates commit messages follow conventional format
|
|
3
|
-
# PreToolUse hook for Bash commands containing 'git commit'
|
|
4
|
-
# Cross-platform: uses grep -E (not grep -P)
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
INPUT=$(cat)
|
|
8
|
-
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
9
|
-
|
|
10
|
-
# Only check git commit commands
|
|
11
|
-
if ! echo "$COMMAND" | grep -qE 'git commit'; then
|
|
12
|
-
exit 0
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Extract commit message — handle both -m "msg" and heredoc patterns
|
|
16
|
-
# Try -m flag first (handles both single and double quotes)
|
|
17
|
-
MSG=""
|
|
18
|
-
if echo "$COMMAND" | grep -qE -- '-m '; then
|
|
19
|
-
# Extract message after -m, handling quotes
|
|
20
|
-
# First try double-quoted: -m "..."
|
|
21
|
-
MSG=$(echo "$COMMAND" | sed -n 's/.*-m "\([^"]*\)".*/\1/p' | head -1)
|
|
22
|
-
# If empty, try single-quoted: -m '...'
|
|
23
|
-
if [ -z "$MSG" ]; then
|
|
24
|
-
MSG=$(echo "$COMMAND" | sed -n "s/.*-m '\\([^']*\\)'.*/\\1/p" | head -1)
|
|
25
|
-
fi
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
# Try heredoc pattern: -m "$(cat <<'EOF' ... EOF )"
|
|
29
|
-
if [ -z "$MSG" ]; then
|
|
30
|
-
MSG=$(echo "$COMMAND" | sed -n 's/.*cat <<.*//;n;s/^ *//;p' | head -1)
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# If still no message found, might be using editor — allow it
|
|
34
|
-
if [ -z "$MSG" ]; then
|
|
35
|
-
exit 0
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# For heredoc/multiline, only check the first line
|
|
39
|
-
MSG=$(echo "$MSG" | head -1)
|
|
40
|
-
|
|
41
|
-
RAID_CONFIG=".claude/raid.json"
|
|
42
|
-
ISSUES=""
|
|
43
|
-
|
|
44
|
-
# Check 1: Conventional commit format
|
|
45
|
-
if ! echo "$MSG" | grep -qE '^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .+'; then
|
|
46
|
-
ISSUES="${ISSUES}COMMIT: Message must follow 'type(scope): description' format.\n"
|
|
47
|
-
ISSUES="${ISSUES} Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert\n"
|
|
48
|
-
ISSUES="${ISSUES} Got: '$MSG'\n"
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# Check 2: Minimum length (default 15, configurable)
|
|
52
|
-
MIN_LENGTH=15
|
|
53
|
-
if [ -f "$RAID_CONFIG" ]; then
|
|
54
|
-
CONFIGURED_MIN=$(jq -r '.conventions.commitMinLength // empty' "$RAID_CONFIG")
|
|
55
|
-
if [ -n "$CONFIGURED_MIN" ]; then
|
|
56
|
-
MIN_LENGTH="$CONFIGURED_MIN"
|
|
57
|
-
fi
|
|
58
|
-
fi
|
|
59
|
-
|
|
60
|
-
MSG_LENGTH=${#MSG}
|
|
61
|
-
if [ "$MSG_LENGTH" -lt "$MIN_LENGTH" ]; then
|
|
62
|
-
ISSUES="${ISSUES}COMMIT: Message too short (${MSG_LENGTH} chars, minimum ${MIN_LENGTH}).\n"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Check 3: No generic messages
|
|
66
|
-
LOWER_MSG=$(echo "$MSG" | tr '[:upper:]' '[:lower:]')
|
|
67
|
-
case "$LOWER_MSG" in
|
|
68
|
-
update|fix|change|modify|edit|wip|temp|test|stuff|things|misc)
|
|
69
|
-
ISSUES="${ISSUES}COMMIT: Message is too generic. Describe WHAT changed and WHY.\n"
|
|
70
|
-
;;
|
|
71
|
-
esac
|
|
72
|
-
|
|
73
|
-
if [ -n "$ISSUES" ]; then
|
|
74
|
-
printf "Raid Commit Quality Check:\n%b" "$ISSUES" >&2
|
|
75
|
-
exit 2
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
exit 0
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Raid quality gate: blocks implementation without a design doc
|
|
3
|
-
# PreToolUse hook for Write operations
|
|
4
|
-
# Reads mode and paths from .claude/raid.json
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
INPUT=$(cat)
|
|
8
|
-
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty')
|
|
9
|
-
|
|
10
|
-
if [ -z "$FILE_PATH" ]; then
|
|
11
|
-
exit 0
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
RAID_CONFIG=".claude/raid.json"
|
|
15
|
-
|
|
16
|
-
# Skip if no config (Raid not initialized)
|
|
17
|
-
if [ ! -f "$RAID_CONFIG" ]; then
|
|
18
|
-
exit 0
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
# Skip if no active Raid session — don't block normal work
|
|
22
|
-
# The Wizard creates .claude/raid-session when a Raid starts
|
|
23
|
-
if [ ! -f ".claude/raid-session" ]; then
|
|
24
|
-
exit 0
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# Read mode and specs path
|
|
28
|
-
MODE=$(jq -r '.raid.defaultMode // "full"' "$RAID_CONFIG")
|
|
29
|
-
SPECS_PATH=$(jq -r '.paths.specs // "docs/raid/specs"' "$RAID_CONFIG")
|
|
30
|
-
|
|
31
|
-
# Scout mode: no phase gate
|
|
32
|
-
if [ "$MODE" = "scout" ]; then
|
|
33
|
-
exit 0
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Skip checks for non-implementation files
|
|
37
|
-
# Allow: docs, tests, config files, raid files, markdown
|
|
38
|
-
case "$FILE_PATH" in
|
|
39
|
-
docs/*|test/*|tests/*|*.test.*|*.spec.*|*_test.*|*_spec.*) exit 0 ;;
|
|
40
|
-
.claude/*|*.json|*.yml|*.yaml|*.toml|*.md|*.lock) exit 0 ;;
|
|
41
|
-
*.config.*|*.rc|.gitignore|Makefile|Dockerfile) exit 0 ;;
|
|
42
|
-
esac
|
|
43
|
-
|
|
44
|
-
# Check if any design doc exists in specs path
|
|
45
|
-
if [ -d "$SPECS_PATH" ]; then
|
|
46
|
-
DOC_COUNT=$(find "$SPECS_PATH" -name "*.md" -type f 2>/dev/null | head -1)
|
|
47
|
-
if [ -n "$DOC_COUNT" ]; then
|
|
48
|
-
exit 0
|
|
49
|
-
fi
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# No design doc found
|
|
53
|
-
if [ "$MODE" = "full" ]; then
|
|
54
|
-
printf "Raid Phase Gate:\nBLOCKED: No design doc found in %s.\nCreate a design doc before writing implementation code.\nUse 'raid-design' skill or set mode to 'scout' in .claude/raid.json.\n" "$SPECS_PATH" >&2
|
|
55
|
-
exit 2
|
|
56
|
-
fi
|
|
57
|
-
|
|
58
|
-
# Skirmish mode: warn only
|
|
59
|
-
printf "Raid Phase Gate:\nWARNING: No design doc found in %s. Consider creating one.\n" "$SPECS_PATH" >&2
|
|
60
|
-
exit 0
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Raid quality gate: runs tests before allowing commits
|
|
3
|
-
# PreToolUse hook for Bash commands containing 'git commit'
|
|
4
|
-
# Reads test command from .claude/raid.json
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
INPUT=$(cat)
|
|
8
|
-
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
9
|
-
|
|
10
|
-
# Only check git commit commands
|
|
11
|
-
if ! echo "$COMMAND" | grep -qE 'git commit'; then
|
|
12
|
-
exit 0
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
RAID_CONFIG=".claude/raid.json"
|
|
16
|
-
|
|
17
|
-
# Skip if no active Raid session
|
|
18
|
-
if [ ! -f ".claude/raid-session" ]; then
|
|
19
|
-
exit 0
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
# Read test command from config
|
|
23
|
-
TEST_CMD=""
|
|
24
|
-
if [ -f "$RAID_CONFIG" ]; then
|
|
25
|
-
TEST_CMD=$(jq -r '.project.testCommand // empty' "$RAID_CONFIG")
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
# No test command configured — warn but allow
|
|
29
|
-
if [ -z "$TEST_CMD" ]; then
|
|
30
|
-
exit 0
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Run tests
|
|
34
|
-
if ! eval "$TEST_CMD" > /dev/null 2>&1; then
|
|
35
|
-
printf "Raid Quality Check:\nTESTS: Tests failed. Fix before committing.\nCommand: %s\n" "$TEST_CMD" >&2
|
|
36
|
-
exit 2
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
# Write timestamp for verification hook
|
|
40
|
-
mkdir -p .claude
|
|
41
|
-
date +%s > .claude/raid-last-test-run
|
|
42
|
-
|
|
43
|
-
exit 0
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Raid quality gate: blocks completion claims without recent test evidence
|
|
3
|
-
# PreToolUse hook for Bash commands containing 'git commit'
|
|
4
|
-
# Checks for .claude/raid-last-test-run timestamp (written by validate-tests-pass.sh)
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
INPUT=$(cat)
|
|
8
|
-
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
9
|
-
|
|
10
|
-
# Only check git commit commands
|
|
11
|
-
if ! echo "$COMMAND" | grep -qE 'git commit'; then
|
|
12
|
-
exit 0
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Skip if no active Raid session
|
|
16
|
-
if [ ! -f ".claude/raid-session" ]; then
|
|
17
|
-
exit 0
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
# Extract commit message
|
|
21
|
-
MSG=""
|
|
22
|
-
if echo "$COMMAND" | grep -qE -- '-m '; then
|
|
23
|
-
MSG=$(echo "$COMMAND" | sed -n 's/.*-m "\([^"]*\)".*/\1/p' | head -1)
|
|
24
|
-
if [ -z "$MSG" ]; then
|
|
25
|
-
MSG=$(echo "$COMMAND" | sed -n "s/.*-m '\\([^']*\\)'.*/\\1/p" | head -1)
|
|
26
|
-
fi
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
# Try heredoc
|
|
30
|
-
if [ -z "$MSG" ]; then
|
|
31
|
-
MSG=$(echo "$COMMAND" | sed -n 's/.*cat <<.*//;n;s/^ *//;p' | head -1)
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
if [ -z "$MSG" ]; then
|
|
35
|
-
exit 0
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Check if message claims completion
|
|
39
|
-
LOWER_MSG=$(echo "$MSG" | tr '[:upper:]' '[:lower:]')
|
|
40
|
-
HAS_COMPLETION=false
|
|
41
|
-
for WORD in "complete" "done" "finish" "final"; do
|
|
42
|
-
if echo "$LOWER_MSG" | grep -qiw "$WORD"; then
|
|
43
|
-
HAS_COMPLETION=true
|
|
44
|
-
break
|
|
45
|
-
fi
|
|
46
|
-
done
|
|
47
|
-
|
|
48
|
-
if [ "$HAS_COMPLETION" = false ]; then
|
|
49
|
-
exit 0
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Check for recent test run
|
|
53
|
-
TIMESTAMP_FILE=".claude/raid-last-test-run"
|
|
54
|
-
MAX_AGE=600 # 10 minutes in seconds
|
|
55
|
-
|
|
56
|
-
if [ ! -f "$TIMESTAMP_FILE" ]; then
|
|
57
|
-
printf "Raid Verification Check:\nBLOCKED: Commit claims completion but no test run evidence found.\nRun tests before claiming work is complete.\n" >&2
|
|
58
|
-
exit 2
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
LAST_RUN=$(cat "$TIMESTAMP_FILE")
|
|
62
|
-
NOW=$(date +%s)
|
|
63
|
-
AGE=$((NOW - LAST_RUN))
|
|
64
|
-
|
|
65
|
-
if [ "$AGE" -gt "$MAX_AGE" ]; then
|
|
66
|
-
printf "Raid Verification Check:\nBLOCKED: Last test run was %d minutes ago. Run tests again before claiming completion.\n" "$((AGE / 60))" >&2
|
|
67
|
-
exit 2
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
exit 0
|