specweave 0.9.1 → 0.10.0

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.
Files changed (70) hide show
  1. package/CLAUDE.md +100 -13
  2. package/README.md +97 -251
  3. package/bin/install-agents.sh +1 -1
  4. package/bin/install-commands.sh +1 -1
  5. package/bin/install-hooks.sh +1 -1
  6. package/bin/install-skills.sh +1 -1
  7. package/bin/specweave.js +32 -0
  8. package/dist/cli/commands/validate-jira.d.ts +35 -0
  9. package/dist/cli/commands/validate-jira.d.ts.map +1 -0
  10. package/dist/cli/commands/validate-jira.js +112 -0
  11. package/dist/cli/commands/validate-jira.js.map +1 -0
  12. package/dist/cli/commands/validate-plugins.d.ts +41 -0
  13. package/dist/cli/commands/validate-plugins.d.ts.map +1 -0
  14. package/dist/cli/commands/validate-plugins.js +171 -0
  15. package/dist/cli/commands/validate-plugins.js.map +1 -0
  16. package/dist/core/types/sync-profile.d.ts +177 -29
  17. package/dist/core/types/sync-profile.d.ts.map +1 -1
  18. package/dist/core/types/sync-profile.js +48 -1
  19. package/dist/core/types/sync-profile.js.map +1 -1
  20. package/dist/hooks/lib/translate-living-docs.d.ts.map +1 -1
  21. package/dist/hooks/lib/translate-living-docs.js +16 -7
  22. package/dist/hooks/lib/translate-living-docs.js.map +1 -1
  23. package/dist/metrics/dora-calculator.d.ts +7 -3
  24. package/dist/metrics/dora-calculator.d.ts.map +1 -1
  25. package/dist/metrics/dora-calculator.js +19 -6
  26. package/dist/metrics/dora-calculator.js.map +1 -1
  27. package/dist/metrics/report-generator.d.ts +17 -0
  28. package/dist/metrics/report-generator.d.ts.map +1 -0
  29. package/dist/metrics/report-generator.js +403 -0
  30. package/dist/metrics/report-generator.js.map +1 -0
  31. package/dist/utils/external-resource-validator.d.ts +102 -0
  32. package/dist/utils/external-resource-validator.d.ts.map +1 -0
  33. package/dist/utils/external-resource-validator.js +381 -0
  34. package/dist/utils/external-resource-validator.js.map +1 -0
  35. package/dist/utils/plugin-validator.d.ts +161 -0
  36. package/dist/utils/plugin-validator.d.ts.map +1 -0
  37. package/dist/utils/plugin-validator.js +565 -0
  38. package/dist/utils/plugin-validator.js.map +1 -0
  39. package/package.json +2 -1
  40. package/plugins/specweave/commands/specweave-do.md +47 -0
  41. package/plugins/specweave/commands/specweave-increment.md +82 -0
  42. package/plugins/specweave/commands/specweave-next.md +47 -0
  43. package/plugins/specweave/hooks/post-increment-planning.sh +117 -38
  44. package/plugins/specweave/hooks/pre-tool-use.sh +133 -0
  45. package/plugins/specweave/plugin.json +22 -0
  46. package/plugins/specweave/skills/plugin-validator/SKILL.md +427 -0
  47. package/plugins/specweave-ado/.claude-plugin/plugin.json +2 -4
  48. package/plugins/specweave-ado/lib/ado-board-resolver.ts +328 -0
  49. package/plugins/specweave-ado/lib/ado-hierarchical-sync.ts +484 -0
  50. package/plugins/specweave-ado/plugin.json +20 -0
  51. package/plugins/specweave-alternatives/.claude-plugin/plugin.json +15 -2
  52. package/plugins/specweave-backend/.claude-plugin/plugin.json +15 -2
  53. package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +14 -2
  54. package/plugins/specweave-diagrams/.claude-plugin/plugin.json +14 -2
  55. package/plugins/specweave-docs/.claude-plugin/plugin.json +13 -2
  56. package/plugins/specweave-figma/.claude-plugin/plugin.json +14 -2
  57. package/plugins/specweave-frontend/.claude-plugin/plugin.json +15 -2
  58. package/plugins/specweave-github/lib/github-board-resolver.ts +164 -0
  59. package/plugins/specweave-github/lib/github-hierarchical-sync.ts +344 -0
  60. package/plugins/specweave-github/plugin.json +19 -0
  61. package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +15 -2
  62. package/plugins/specweave-jira/.claude-plugin/plugin.json +14 -2
  63. package/plugins/specweave-jira/lib/jira-board-resolver.ts +127 -0
  64. package/plugins/specweave-jira/lib/jira-hierarchical-sync.ts +283 -0
  65. package/plugins/specweave-jira/plugin.json +20 -0
  66. package/plugins/specweave-jira/skills/jira-resource-validator/SKILL.md +584 -0
  67. package/plugins/specweave-kubernetes/.claude-plugin/plugin.json +14 -2
  68. package/plugins/specweave-payments/.claude-plugin/plugin.json +14 -2
  69. package/plugins/specweave-testing/.claude-plugin/plugin.json +14 -2
  70. package/plugins/specweave-tooling/.claude-plugin/plugin.json +13 -2
@@ -11,6 +11,88 @@ You are helping the user create a new SpecWeave increment with automatic closure
11
11
 
12
12
  ## Steps:
13
13
 
14
+ ### Step 0: Plugin Validation (MANDATORY - ALWAYS FIRST! v0.9.4+)
15
+
16
+ 🚨 **CRITICAL**: Before ANY planning or execution, validate SpecWeave plugin installation.
17
+
18
+ **Why This Matters**:
19
+ - Ensures SpecWeave marketplace is registered in Claude Code
20
+ - Ensures core `specweave` plugin is installed
21
+ - Detects and suggests context-specific plugins based on your increment description
22
+ - Prevents cryptic "command not found" errors
23
+ - Enables seamless environment migration (local → VM → Cloud IDE)
24
+
25
+ **Implementation**:
26
+
27
+ Use the Bash tool to run:
28
+ ```bash
29
+ npx specweave validate-plugins --auto-install --context="$(cat <<'EOF'
30
+ $USER_INCREMENT_DESCRIPTION
31
+ EOF
32
+ )"
33
+ ```
34
+
35
+ **Replace `$USER_INCREMENT_DESCRIPTION`** with the actual increment description provided by the user.
36
+
37
+ **Expected Output (Success)**:
38
+ ```
39
+ ✅ All plugins validated!
40
+ • Core plugin: installed (v0.9.4)
41
+ • Context plugins: specweave-github (detected from "GitHub sync")
42
+ ```
43
+
44
+ **Expected Output (Missing Components)**:
45
+ ```
46
+ ❌ Missing components detected:
47
+ • SpecWeave marketplace not registered
48
+ • Core plugin (specweave) not installed
49
+ • Context plugin (specweave-github) not installed
50
+
51
+ 📦 Installing missing components...
52
+ ✅ Marketplace registered (.claude/settings.json)
53
+ ✅ Core plugin installed (specweave)
54
+ ✅ Context plugin installed (specweave-github)
55
+
56
+ 🎉 Environment ready! Proceeding with increment planning...
57
+ ```
58
+
59
+ **What to Do After Validation**:
60
+
61
+ 1. ✅ **If validation passes**: Proceed to Step 0A
62
+ 2. ⚠️ **If validation fails with errors**: Show error messages and STOP (do NOT proceed)
63
+ 3. 🔄 **If auto-install succeeded**: Proceed to Step 0A
64
+ 4. ⚠️ **If auto-install failed**: Show manual instructions (see below) and STOP
65
+
66
+ **Manual Installation Instructions** (if auto-install fails):
67
+ ```
68
+ ❌ Auto-install failed. Please install manually:
69
+
70
+ 1. Register SpecWeave marketplace:
71
+ Edit ~/.claude/settings.json and add:
72
+ {
73
+ "extraKnownMarketplaces": {
74
+ "specweave": {
75
+ "source": {
76
+ "source": "github",
77
+ "repo": "anton-abyzov/specweave",
78
+ "path": ".claude-plugin"
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ 2. Install core plugin:
85
+ Run: /plugin install specweave
86
+
87
+ 3. Restart Claude Code
88
+
89
+ 4. Re-run this command
90
+ ```
91
+
92
+ **DO NOT PROCEED** to Step 0A until plugin validation passes!
93
+
94
+ ---
95
+
14
96
  ### Step 0A: STRICT Pre-Flight Check (MANDATORY - v0.6.0+)
15
97
 
16
98
  **⛔ THE IRON RULE: Cannot start increment N+1 until increment N is DONE**
@@ -32,6 +32,53 @@ The `/specweave:next` command is your **workflow continuation** command. It:
32
32
 
33
33
  ## Workflow
34
34
 
35
+ ### Step 0: Plugin Validation (MANDATORY - ALWAYS FIRST! v0.9.4+)
36
+
37
+ 🚨 **CRITICAL**: Before ANY workflow transition, validate SpecWeave plugin installation.
38
+
39
+ **Why This Matters**:
40
+ - Ensures SpecWeave marketplace is registered in Claude Code
41
+ - Ensures core `specweave` plugin is installed
42
+ - Prevents workflow interruptions from missing dependencies
43
+ - Enables seamless environment migration (local → VM → Cloud IDE)
44
+
45
+ **Implementation**:
46
+
47
+ Use the Bash tool to run:
48
+ ```bash
49
+ npx specweave validate-plugins --auto-install
50
+ ```
51
+
52
+ **Expected Output (Success)**:
53
+ ```
54
+ ✅ All plugins validated!
55
+ • Core plugin: installed (v0.9.4)
56
+ ```
57
+
58
+ **Expected Output (Missing Components)**:
59
+ ```
60
+ ❌ Missing components detected:
61
+ • SpecWeave marketplace not registered
62
+ • Core plugin (specweave) not installed
63
+
64
+ 📦 Installing missing components...
65
+ ✅ Marketplace registered (.claude/settings.json)
66
+ ✅ Core plugin installed (specweave)
67
+
68
+ 🎉 Environment ready! Proceeding with workflow transition...
69
+ ```
70
+
71
+ **What to Do After Validation**:
72
+
73
+ 1. ✅ **If validation passes**: Proceed to Step 1
74
+ 2. ⚠️ **If validation fails with errors**: Show error messages and STOP (do NOT proceed)
75
+ 3. 🔄 **If auto-install succeeded**: Proceed to Step 1
76
+ 4. ⚠️ **If auto-install failed**: Show manual instructions and STOP
77
+
78
+ **DO NOT PROCEED** to Step 1 until plugin validation passes!
79
+
80
+ ---
81
+
35
82
  ### Step 1: Find Active Increment
36
83
 
37
84
  ```bash
@@ -191,6 +191,83 @@ translate_file() {
191
191
  fi
192
192
  }
193
193
 
194
+ # ============================================================================
195
+ # LIVING DOCS TRANSLATION
196
+ # ============================================================================
197
+
198
+ translate_living_docs_specs() {
199
+ local increment_id="$1"
200
+
201
+ log_debug "Checking for newly created living docs specs for increment $increment_id..."
202
+
203
+ # Directories to check for living docs
204
+ local specs_dir="$SPECWEAVE_DIR/docs/internal/specs"
205
+ local strategy_dir="$SPECWEAVE_DIR/docs/internal/strategy"
206
+ local architecture_dir="$SPECWEAVE_DIR/docs/internal/architecture"
207
+
208
+ local translated_count=0
209
+ local total_checked=0
210
+
211
+ # Find living docs files created in last 5 minutes (recently created by PM agent)
212
+ # macOS and Linux compatible find command
213
+ for dir in "$specs_dir" "$strategy_dir" "$architecture_dir"; do
214
+ if [ ! -d "$dir" ]; then
215
+ log_debug "Directory does not exist: $dir"
216
+ continue
217
+ fi
218
+
219
+ # Find markdown files modified in last 5 minutes
220
+ # Using -mmin -5 (last 5 minutes) to catch files created during increment planning
221
+ local files=$(find "$dir" -type f -name "*.md" -mmin -5 2>/dev/null)
222
+
223
+ if [ -z "$files" ]; then
224
+ log_debug "No recently modified files in $dir"
225
+ continue
226
+ fi
227
+
228
+ while IFS= read -r file; do
229
+ # Skip empty lines
230
+ [ -z "$file" ] && continue
231
+
232
+ ((total_checked++))
233
+
234
+ # Skip legacy folder
235
+ if [[ "$file" == *"/legacy/"* ]]; then
236
+ log_debug "Skipping legacy file: $file"
237
+ continue
238
+ fi
239
+
240
+ # Detect language
241
+ local file_lang=$(detect_file_language "$file")
242
+
243
+ if [ "$file_lang" = "non-en" ]; then
244
+ local basename_file=$(basename "$file")
245
+ log_info " 📄 Living docs detected: $basename_file"
246
+
247
+ if translate_file "$file"; then
248
+ ((translated_count++))
249
+ log_debug "Successfully translated living docs: $file"
250
+ else
251
+ log_debug "Failed to translate living docs: $file"
252
+ fi
253
+ else
254
+ log_debug "File already in English: $file"
255
+ fi
256
+ done <<< "$files"
257
+ done
258
+
259
+ log_debug "Living docs check complete: $translated_count/$total_checked files translated"
260
+
261
+ if [ "$translated_count" -gt 0 ]; then
262
+ log_info ""
263
+ log_info " ✅ Translated $translated_count living docs file(s) to English"
264
+ else
265
+ log_debug "No living docs files needed translation"
266
+ fi
267
+
268
+ return 0
269
+ }
270
+
194
271
  # ============================================================================
195
272
  # MAIN LOGIC
196
273
  # ============================================================================
@@ -273,57 +350,59 @@ EOF
273
350
  fi
274
351
  fi
275
352
 
276
- # 4. If no translation needed, exit early
277
- if [ "$needs_translation" = "false" ] || [ ${#files_to_translate[@]} -eq 0 ]; then
278
- log_info "✅ All increment files already in English, skipping translation"
279
- cat <<EOF
280
- {
281
- "continue": true,
282
- "message": "All files already in English"
283
- }
284
- EOF
285
- exit 0
286
- fi
353
+ # 4. Translate increment files (if needed)
354
+ local increment_success_count=0
355
+ local increment_total_count=${#files_to_translate[@]}
287
356
 
288
- # 5. Perform translation
289
- log_info ""
290
- log_info "🌐 Detected non-English content in increment $increment_id"
291
- log_info " Translating to English for maintainability..."
292
- log_info ""
357
+ if [ "$needs_translation" = "true" ] && [ ${#files_to_translate[@]} -gt 0 ]; then
358
+ # 5. Perform translation of increment files
359
+ log_info ""
360
+ log_info "🌐 Detected non-English content in increment $increment_id"
361
+ log_info " Translating increment files to English..."
362
+ log_info ""
293
363
 
294
- local success_count=0
295
- local total_count=${#files_to_translate[@]}
364
+ for file in "${files_to_translate[@]}"; do
365
+ if translate_file "$file"; then
366
+ ((increment_success_count++))
367
+ fi
368
+ done
296
369
 
297
- for file in "${files_to_translate[@]}"; do
298
- if translate_file "$file"; then
299
- ((success_count++))
370
+ log_info ""
371
+ if [ "$increment_success_count" -eq "$increment_total_count" ]; then
372
+ log_info "✅ Increment files translation complete! All $increment_total_count file(s) now in English"
373
+ else
374
+ log_error "Increment files translation completed with errors: $increment_success_count/$increment_total_count files translated"
300
375
  fi
301
- done
376
+ else
377
+ log_info "✅ All increment files already in English"
378
+ fi
379
+
380
+ # 6. Translate living docs specs (if any were created)
381
+ log_info ""
382
+ log_info "🌐 Checking living docs for translation..."
383
+
384
+ translate_living_docs_specs "$increment_id"
302
385
 
303
- # 6. Summary
386
+ # 7. Final summary
304
387
  log_info ""
305
- if [ "$success_count" -eq "$total_count" ]; then
306
- log_info "✅ Translation complete! All $total_count file(s) now in English"
307
- log_info " Cost: ~\$0.01 (using Haiku)"
388
+ local total_translated=$((increment_success_count))
389
+
390
+ if [ "$increment_total_count" -gt 0 ] || [ "$total_translated" -gt 0 ]; then
391
+ log_info "✅ Translation complete!"
392
+ log_info " Increment files: $increment_success_count/$increment_total_count"
393
+ log_info " Living docs: See above"
394
+ log_info " Estimated cost: ~\$0.01-0.02 (using Haiku)"
308
395
  log_info ""
396
+ fi
309
397
 
310
- cat <<EOF
398
+ # Return success JSON
399
+ cat <<EOF
311
400
  {
312
401
  "continue": true,
313
- "message": "Translated $total_count file(s) to English",
402
+ "message": "Translation complete (increment: $increment_success_count/$increment_total_count files)",
314
403
  "files": $(printf '%s\n' "${files_to_translate[@]}" | jq -R . | jq -s .)
315
404
  }
316
405
  EOF
317
- else
318
- log_error "Translation completed with errors: $success_count/$total_count files translated"
319
- cat <<EOF
320
- {
321
- "continue": true,
322
- "warning": "Translation partially failed: $success_count/$total_count files",
323
- "files": $(printf '%s\n' "${files_to_translate[@]}" | jq -R . | jq -s .)
324
- }
325
- EOF
326
- fi
327
406
 
328
407
  log_debug "=== POST-INCREMENT-PLANNING HOOK END ==="
329
408
  }
@@ -0,0 +1,133 @@
1
+ #!/bin/bash
2
+
3
+ # SpecWeave Pre-Tool-Use Hook
4
+ # Runs BEFORE Claude calls any tool (PreToolUse event)
5
+ #
6
+ # PURPOSE: Detect when Claude asks questions via AskUserQuestion
7
+ # - Plays sound IMMEDIATELY when question is about to be asked
8
+ # - Complements post-task-completion hook (which only fires after TodoWrite)
9
+ # - Ensures user is always notified when Claude needs input
10
+ #
11
+ # SCOPE:
12
+ # - This hook fires for ALL tool calls (Read, Edit, Write, AskUserQuestion, etc.)
13
+ # - We filter for AskUserQuestion specifically to play sound
14
+ # - Non-blocking and fast (<10ms overhead)
15
+
16
+ set -e
17
+
18
+ # ============================================================================
19
+ # CONFIGURATION
20
+ # ============================================================================
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
+ # Fallback
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
+ LOGS_DIR=".specweave/logs"
44
+ DEBUG_LOG="$LOGS_DIR/hooks-debug.log"
45
+
46
+ mkdir -p "$LOGS_DIR" 2>/dev/null || true
47
+
48
+ # ============================================================================
49
+ # CAPTURE INPUT (Tool Call Details)
50
+ # ============================================================================
51
+
52
+ STDIN_DATA=$(mktemp)
53
+ cat > "$STDIN_DATA"
54
+
55
+ # Log the tool call for debugging
56
+ echo "[$(date)] 🔧 PreToolUse hook fired" >> "$DEBUG_LOG" 2>/dev/null || true
57
+ echo "[$(date)] Tool call JSON:" >> "$DEBUG_LOG" 2>/dev/null || true
58
+ cat "$STDIN_DATA" >> "$DEBUG_LOG" 2>/dev/null || true
59
+ echo "" >> "$DEBUG_LOG" 2>/dev/null || true
60
+
61
+ # ============================================================================
62
+ # DETECT AskUserQuestion TOOL
63
+ # ============================================================================
64
+
65
+ TOOL_NAME=""
66
+
67
+ if command -v jq >/dev/null 2>&1; then
68
+ # Use jq if available (most reliable)
69
+ TOOL_NAME=$(jq -r '.tool_name // empty' "$STDIN_DATA" 2>/dev/null)
70
+ else
71
+ # Fallback: grep-based detection
72
+ if grep -q '"tool_name"' "$STDIN_DATA" 2>/dev/null; then
73
+ TOOL_NAME=$(grep -o '"tool_name":"[^"]*"' "$STDIN_DATA" | cut -d'"' -f4)
74
+ fi
75
+ fi
76
+
77
+ echo "[$(date)] Tool name: $TOOL_NAME" >> "$DEBUG_LOG" 2>/dev/null || true
78
+
79
+ # ============================================================================
80
+ # PLAY SOUND IF AskUserQuestion
81
+ # ============================================================================
82
+
83
+ play_sound() {
84
+ case "$(uname -s)" in
85
+ Darwin)
86
+ # macOS: Use afplay with a distinctive sound for questions
87
+ afplay /System/Library/Sounds/Tink.aiff 2>/dev/null || true
88
+ ;;
89
+ Linux)
90
+ # Linux: Use paplay or aplay
91
+ paplay /usr/share/sounds/freedesktop/stereo/dialog-question.oga 2>/dev/null || \
92
+ paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga 2>/dev/null || \
93
+ aplay /usr/share/sounds/alsa/Front_Center.wav 2>/dev/null || true
94
+ ;;
95
+ MINGW*|MSYS*|CYGWIN*)
96
+ # Windows: Use PowerShell
97
+ powershell -c "(New-Object Media.SoundPlayer 'C:\Windows\Media\Windows Notify.wav').PlaySync();" 2>/dev/null || true
98
+ ;;
99
+ esac
100
+ }
101
+
102
+ if [ "$TOOL_NAME" = "AskUserQuestion" ]; then
103
+ echo "[$(date)] 🔔 QUESTION DETECTED! Playing notification sound" >> "$DEBUG_LOG" 2>/dev/null || true
104
+ play_sound
105
+
106
+ # Log this event
107
+ echo "[$(date)] Claude is asking for user input via AskUserQuestion" >> "$DEBUG_LOG" 2>/dev/null || true
108
+ fi
109
+
110
+ # ============================================================================
111
+ # CLEANUP
112
+ # ============================================================================
113
+
114
+ rm -f "$STDIN_DATA"
115
+
116
+ # ============================================================================
117
+ # OUTPUT TO CLAUDE (Always continue)
118
+ # ============================================================================
119
+
120
+ if [ "$TOOL_NAME" = "AskUserQuestion" ]; then
121
+ cat <<EOF
122
+ {
123
+ "continue": true,
124
+ "systemMessage": "🔔 Sound played - user notified of question request"
125
+ }
126
+ EOF
127
+ else
128
+ cat <<EOF
129
+ {
130
+ "continue": true
131
+ }
132
+ EOF
133
+ fi
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "specweave",
3
+ "description": "SpecWeave framework. Provides increment planning (PM, Architect, Tech Lead agents), specification generation, TDD workflow, living docs sync, and brownfield support. Essential for all SpecWeave projects.",
4
+ "version": "0.8.0",
5
+ "author": {
6
+ "name": "SpecWeave Team",
7
+ "url": "https://spec-weave.com"
8
+ },
9
+ "homepage": "https://spec-weave.com",
10
+ "repository": "https://github.com/anton-abyzov/specweave",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "specweave",
14
+ "core",
15
+ "increment-planning",
16
+ "specifications",
17
+ "tdd",
18
+ "pm",
19
+ "architect",
20
+ "living-docs"
21
+ ]
22
+ }