specweave 0.4.0 → 0.4.1
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 +501 -28
- package/README.md +99 -57
- package/bin/specweave.js +16 -0
- package/dist/adapters/adapter-base.d.ts +21 -0
- package/dist/adapters/adapter-base.d.ts.map +1 -1
- package/dist/adapters/adapter-base.js +28 -0
- package/dist/adapters/adapter-base.js.map +1 -1
- package/dist/adapters/adapter-interface.d.ts +41 -0
- package/dist/adapters/adapter-interface.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.d.ts +36 -0
- package/dist/adapters/claude/adapter.d.ts.map +1 -1
- package/dist/adapters/claude/adapter.js +135 -0
- package/dist/adapters/claude/adapter.js.map +1 -1
- package/dist/adapters/copilot/adapter.d.ts +25 -0
- package/dist/adapters/copilot/adapter.d.ts.map +1 -1
- package/dist/adapters/copilot/adapter.js +112 -0
- package/dist/adapters/copilot/adapter.js.map +1 -1
- package/dist/adapters/cursor/adapter.d.ts +36 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -1
- package/dist/adapters/cursor/adapter.js +140 -0
- package/dist/adapters/cursor/adapter.js.map +1 -1
- package/dist/adapters/generic/adapter.d.ts +25 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -1
- package/dist/adapters/generic/adapter.js +111 -0
- package/dist/adapters/generic/adapter.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +48 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/plugin.d.ts +37 -0
- package/dist/cli/commands/plugin.d.ts.map +1 -0
- package/dist/cli/commands/plugin.js +296 -0
- package/dist/cli/commands/plugin.js.map +1 -0
- package/dist/core/plugin-detector.d.ts +96 -0
- package/dist/core/plugin-detector.d.ts.map +1 -0
- package/dist/core/plugin-detector.js +349 -0
- package/dist/core/plugin-detector.js.map +1 -0
- package/dist/core/plugin-loader.d.ts +111 -0
- package/dist/core/plugin-loader.d.ts.map +1 -0
- package/dist/core/plugin-loader.js +319 -0
- package/dist/core/plugin-loader.js.map +1 -0
- package/dist/core/plugin-manager.d.ts +144 -0
- package/dist/core/plugin-manager.d.ts.map +1 -0
- package/dist/core/plugin-manager.js +393 -0
- package/dist/core/plugin-manager.js.map +1 -0
- package/dist/core/schemas/plugin-manifest.schema.json +253 -0
- package/dist/core/types/plugin.d.ts +252 -0
- package/dist/core/types/plugin.d.ts.map +1 -0
- package/dist/core/types/plugin.js +48 -0
- package/dist/core/types/plugin.js.map +1 -0
- package/dist/integrations/jira/jira-mapper.d.ts +2 -2
- package/dist/integrations/jira/jira-mapper.js +2 -2
- package/package.json +13 -9
- package/src/adapters/adapter-base.ts +33 -0
- package/src/adapters/adapter-interface.ts +46 -0
- package/src/adapters/claude/adapter.ts +164 -0
- package/src/adapters/copilot/adapter.ts +138 -0
- package/src/adapters/cursor/adapter.ts +170 -0
- package/src/adapters/generic/adapter.ts +137 -0
- package/src/commands/specweave.increment.md +48 -4
- package/src/hooks/post-increment-plugin-detect.sh +142 -0
- package/src/hooks/post-task-completion.sh +53 -11
- package/src/hooks/pre-task-plugin-detect.sh +96 -0
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
# Runs automatically after ANY task is marked complete via TodoWrite
|
|
5
5
|
#
|
|
6
6
|
# Actions:
|
|
7
|
-
# 1.
|
|
8
|
-
# 2.
|
|
9
|
-
# 3.
|
|
7
|
+
# 1. Check if ALL tasks are completed (parse stdin JSON)
|
|
8
|
+
# 2. Play completion sound ONLY if all tasks done
|
|
9
|
+
# 3. Output JSON systemMessage reminding to update docs
|
|
10
|
+
# 4. Log completion
|
|
10
11
|
#
|
|
11
12
|
# DEBOUNCING: Prevents rapid duplicate fires (Claude Code calls hooks twice)
|
|
12
13
|
|
|
@@ -42,16 +43,43 @@ fi
|
|
|
42
43
|
# Save current timestamp
|
|
43
44
|
echo "$CURRENT_TIME" > "$LAST_FIRE_FILE"
|
|
44
45
|
|
|
46
|
+
# Read stdin to temporary file
|
|
47
|
+
STDIN_DATA=$(mktemp)
|
|
48
|
+
cat > "$STDIN_DATA"
|
|
49
|
+
|
|
45
50
|
# DEBUG: Log hook invocation
|
|
46
51
|
echo "[$(date)] Hook invoked! PWD=$PWD Args=$*" >> .specweave/logs/hooks-debug.log 2>/dev/null || true
|
|
47
52
|
echo "[$(date)] Hook stdin:" >> .specweave/logs/hooks-debug.log 2>/dev/null || true
|
|
48
|
-
cat >> .specweave/logs/hooks-debug.log 2>/dev/null || true
|
|
53
|
+
cat "$STDIN_DATA" >> .specweave/logs/hooks-debug.log 2>/dev/null || true
|
|
54
|
+
|
|
55
|
+
# Parse JSON to check if ALL tasks are completed
|
|
56
|
+
# Extract todos array and check for any non-completed tasks
|
|
57
|
+
ALL_COMPLETED=false
|
|
58
|
+
|
|
59
|
+
if command -v jq >/dev/null 2>&1; then
|
|
60
|
+
# Use jq if available (more reliable)
|
|
61
|
+
PENDING_COUNT=$(jq -r '.tool_input.todos // [] | map(select(.status != "completed")) | length' "$STDIN_DATA" 2>/dev/null || echo "1")
|
|
62
|
+
|
|
63
|
+
if [ "$PENDING_COUNT" = "0" ]; then
|
|
64
|
+
ALL_COMPLETED=true
|
|
65
|
+
fi
|
|
66
|
+
else
|
|
67
|
+
# Fallback: Simple grep check (less reliable but works without jq)
|
|
68
|
+
if grep -q '"status":"pending"\|"status":"in_progress"' "$STDIN_DATA" 2>/dev/null; then
|
|
69
|
+
ALL_COMPLETED=false
|
|
70
|
+
else
|
|
71
|
+
# No pending/in_progress found - likely all completed
|
|
72
|
+
ALL_COMPLETED=true
|
|
73
|
+
fi
|
|
74
|
+
fi
|
|
49
75
|
|
|
50
|
-
#
|
|
76
|
+
# Clean up temp file
|
|
77
|
+
rm -f "$STDIN_DATA"
|
|
78
|
+
|
|
79
|
+
# 1. Play notification sound ONLY if ALL tasks are completed
|
|
51
80
|
play_sound() {
|
|
52
81
|
case "$(uname -s)" in
|
|
53
82
|
Darwin)
|
|
54
|
-
# Play synchronously (remove &)
|
|
55
83
|
afplay /System/Library/Sounds/Glass.aiff 2>/dev/null || true
|
|
56
84
|
;;
|
|
57
85
|
Linux)
|
|
@@ -64,16 +92,30 @@ play_sound() {
|
|
|
64
92
|
esac
|
|
65
93
|
}
|
|
66
94
|
|
|
67
|
-
# Play sound
|
|
68
|
-
|
|
95
|
+
# Play sound ONLY if all tasks completed
|
|
96
|
+
if [ "$ALL_COMPLETED" = "true" ]; then
|
|
97
|
+
echo "[$(date)] 🎉 ALL TASKS COMPLETED - Playing sound!" >> .specweave/logs/hooks-debug.log 2>/dev/null || true
|
|
98
|
+
play_sound
|
|
99
|
+
else
|
|
100
|
+
echo "[$(date)] Task completed, but more tasks remain (no sound)" >> .specweave/logs/hooks-debug.log 2>/dev/null || true
|
|
101
|
+
fi
|
|
69
102
|
|
|
70
103
|
# 2. Log completion
|
|
71
|
-
echo "[$(date)] Task completed" >> .specweave/logs/tasks.log 2>/dev/null || true
|
|
104
|
+
echo "[$(date)] Task completed (All done: $ALL_COMPLETED)" >> .specweave/logs/tasks.log 2>/dev/null || true
|
|
72
105
|
|
|
73
106
|
# 3. Output JSON to instruct Claude (systemMessage is shown to user)
|
|
74
|
-
|
|
107
|
+
if [ "$ALL_COMPLETED" = "true" ]; then
|
|
108
|
+
cat <<EOF
|
|
75
109
|
{
|
|
76
110
|
"continue": true,
|
|
77
|
-
"systemMessage": "
|
|
111
|
+
"systemMessage": "🎉 ALL TASKS COMPLETED! Remember to update documentation with inline edits to CLAUDE.md and README.md as needed."
|
|
78
112
|
}
|
|
79
113
|
EOF
|
|
114
|
+
else
|
|
115
|
+
cat <<EOF
|
|
116
|
+
{
|
|
117
|
+
"continue": true,
|
|
118
|
+
"systemMessage": "✅ Task completed. More tasks remaining - keep going!"
|
|
119
|
+
}
|
|
120
|
+
EOF
|
|
121
|
+
fi
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Pre-Task Plugin Detection Hook (T-020)
|
|
5
|
+
#
|
|
6
|
+
# Runs BEFORE task execution to suggest plugins based on task description
|
|
7
|
+
# This is Phase 3 of the 4-phase plugin detection system
|
|
8
|
+
#
|
|
9
|
+
# Trigger: Before executing any task via `/specweave.do`
|
|
10
|
+
# Output: Non-blocking plugin suggestions
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
# Exit on error
|
|
14
|
+
set -e
|
|
15
|
+
|
|
16
|
+
# Get project root (assumes hook runs from project directory)
|
|
17
|
+
PROJECT_ROOT=$(pwd)
|
|
18
|
+
|
|
19
|
+
# Colors for output
|
|
20
|
+
GREEN='\033[0;32m'
|
|
21
|
+
YELLOW='\033[1;33m'
|
|
22
|
+
CYAN='\033[0;36m'
|
|
23
|
+
GRAY='\033[0;37m'
|
|
24
|
+
NC='\033[0m' # No Color
|
|
25
|
+
|
|
26
|
+
# Check if SpecWeave is installed
|
|
27
|
+
if ! command -v specweave &> /dev/null; then
|
|
28
|
+
# Silent exit if SpecWeave not installed (development mode)
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Get current task being executed (passed as argument)
|
|
33
|
+
TASK_FILE="$1"
|
|
34
|
+
|
|
35
|
+
if [ -z "$TASK_FILE" ] || [ ! -f "$TASK_FILE" ]; then
|
|
36
|
+
# No task file provided, skip detection
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Extract task description
|
|
41
|
+
TASK_DESCRIPTION=$(grep -A 5 "^### T-[0-9]" "$TASK_FILE" | head -1 || echo "")
|
|
42
|
+
|
|
43
|
+
if [ -z "$TASK_DESCRIPTION" ]; then
|
|
44
|
+
# No description found, skip
|
|
45
|
+
exit 0
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Keyword-based plugin detection
|
|
49
|
+
declare -A PLUGIN_KEYWORDS=(
|
|
50
|
+
["specweave-github"]="github|gh|issue|pull request|pr"
|
|
51
|
+
["specweave-kubernetes"]="kubernetes|k8s|kubectl|helm|pod|deployment"
|
|
52
|
+
["specweave-frontend-stack"]="react|vue|angular|nextjs|frontend|ui|component"
|
|
53
|
+
["specweave-backend-stack"]="express|fastapi|django|flask|nestjs|backend|api|server"
|
|
54
|
+
["specweave-ml-ops"]="tensorflow|pytorch|sklearn|ml|machine learning|model|training"
|
|
55
|
+
["specweave-payment-processing"]="stripe|paypal|payment|billing|subscription"
|
|
56
|
+
["specweave-figma"]="figma|design|mockup|prototype"
|
|
57
|
+
["specweave-jira"]="jira|atlassian|ticket"
|
|
58
|
+
["specweave-observability"]="prometheus|grafana|datadog|monitoring|metrics|tracing"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Detect plugins based on keywords
|
|
62
|
+
SUGGESTED_PLUGINS=()
|
|
63
|
+
|
|
64
|
+
for plugin in "${!PLUGIN_KEYWORDS[@]}"; do
|
|
65
|
+
keywords="${PLUGIN_KEYWORDS[$plugin]}"
|
|
66
|
+
|
|
67
|
+
# Check if any keyword matches (case-insensitive)
|
|
68
|
+
if echo "$TASK_DESCRIPTION" | grep -qi -E "$keywords"; then
|
|
69
|
+
# Check if plugin is already enabled
|
|
70
|
+
if ! specweave plugin list --enabled 2>/dev/null | grep -q "$plugin"; then
|
|
71
|
+
SUGGESTED_PLUGINS+=("$plugin")
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
# Output suggestions if any found
|
|
77
|
+
if [ ${#SUGGESTED_PLUGINS[@]} -gt 0 ]; then
|
|
78
|
+
echo ""
|
|
79
|
+
echo -e "${CYAN}💡 Plugin Detection${NC}"
|
|
80
|
+
echo ""
|
|
81
|
+
echo -e "${GRAY}Task mentions: ${TASK_DESCRIPTION}${NC}"
|
|
82
|
+
echo ""
|
|
83
|
+
echo -e "${YELLOW}Suggested plugins:${NC}"
|
|
84
|
+
|
|
85
|
+
for plugin in "${SUGGESTED_PLUGINS[@]}"; do
|
|
86
|
+
echo -e " • ${GREEN}${plugin}${NC}"
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
echo ""
|
|
90
|
+
echo -e "${GRAY}This task might benefit from these plugins.${NC}"
|
|
91
|
+
echo -e "${GRAY}Run: ${CYAN}specweave plugin enable <name>${GRAY} to install${NC}"
|
|
92
|
+
echo ""
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
# Always exit successfully (non-blocking)
|
|
96
|
+
exit 0
|