@boshu2/vibe-check 2.3.0 → 2.4.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 (37) hide show
  1. package/.agents/plans/2025-12-29-complexity-driver-plan.md +225 -0
  2. package/.agents/plans/2025-12-29-complexity-drivers-plan.md +253 -0
  3. package/.agents/research/2025-12-29-complexity-driver-architecture.md +392 -0
  4. package/.agents/research/2025-12-29-complexity-drivers.md +227 -0
  5. package/.beads/issues.jsonl +12 -0
  6. package/CHANGELOG.md +27 -0
  7. package/README.md +71 -0
  8. package/dist/analyzers/complexity.d.ts +92 -0
  9. package/dist/analyzers/complexity.d.ts.map +1 -0
  10. package/dist/analyzers/complexity.js +79 -0
  11. package/dist/analyzers/complexity.js.map +1 -0
  12. package/dist/analyzers/modularity.d.ts +3 -1
  13. package/dist/analyzers/modularity.d.ts.map +1 -1
  14. package/dist/analyzers/modularity.js +32 -6
  15. package/dist/analyzers/modularity.js.map +1 -1
  16. package/dist/cli.js +2 -1
  17. package/dist/cli.js.map +1 -1
  18. package/dist/commands/driver.d.ts +18 -0
  19. package/dist/commands/driver.d.ts.map +1 -0
  20. package/dist/commands/driver.js +58 -0
  21. package/dist/commands/driver.js.map +1 -0
  22. package/dist/commands/index.d.ts +1 -0
  23. package/dist/commands/index.d.ts.map +1 -1
  24. package/dist/commands/index.js +1 -0
  25. package/dist/commands/index.js.map +1 -1
  26. package/dist/commands/modularity.d.ts +2 -0
  27. package/dist/commands/modularity.d.ts.map +1 -1
  28. package/dist/commands/modularity.js +86 -7
  29. package/dist/commands/modularity.js.map +1 -1
  30. package/drivers/README.md +327 -0
  31. package/drivers/go.sh +131 -0
  32. package/drivers/java.sh +137 -0
  33. package/drivers/javascript.sh +134 -0
  34. package/drivers/php.sh +132 -0
  35. package/drivers/python.sh +90 -0
  36. package/drivers/rust.sh +132 -0
  37. package/package.json +1 -1
@@ -0,0 +1,132 @@
1
+ #!/bin/bash
2
+ # drivers/rust.sh
3
+ # Wraps rust-code-analysis-cli to produce standard complexity JSON
4
+ #
5
+ # Usage: ./drivers/rust.sh [directory]
6
+ # directory: Path to Rust code to analyze (default: current directory)
7
+ #
8
+ # Output: JSON conforming to ComplexityReport schema
9
+ # Exit codes: 0 = success, 1 = error (rust-code-analysis-cli not installed or other failure)
10
+
11
+ set -euo pipefail
12
+
13
+ TARGET_DIR="${1:-.}"
14
+
15
+ # Check rust-code-analysis-cli is installed
16
+ if ! command -v rust-code-analysis-cli &> /dev/null; then
17
+ echo '{"error": "rust-code-analysis-cli not installed. Run: cargo install rust-code-analysis-cli"}' >&2
18
+ exit 1
19
+ fi
20
+
21
+ # Check if target directory exists
22
+ if [ ! -d "$TARGET_DIR" ]; then
23
+ echo "{\"error\": \"Directory not found: $TARGET_DIR\"}" >&2
24
+ exit 1
25
+ fi
26
+
27
+ # Check if there are any Rust files
28
+ if ! find "$TARGET_DIR" -name "*.rs" ! -path "*/target/*" -print -quit 2>/dev/null | grep -q .; then
29
+ # No Rust files found, output empty result
30
+ echo '{"tool":"rust-code-analysis","language":"rust","generatedAt":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'","files":{},"summary":{"totalFiles":0,"totalFunctions":0,"avgComplexity":0,"gradeDistribution":{"A":0,"B":0,"C":0,"D":0,"E":0,"F":0}}}'
31
+ exit 0
32
+ fi
33
+
34
+ # Run rust-code-analysis-cli and transform output
35
+ # The tool outputs JSON with metrics for each file analyzed
36
+ # We need to transform this to match our ComplexityReport schema
37
+
38
+ # Create temp directory for JSON outputs
39
+ TEMP_DIR=$(mktemp -d)
40
+ trap "rm -rf $TEMP_DIR" EXIT
41
+
42
+ # Run rust-code-analysis-cli on the directory
43
+ # -m: enable metrics computation
44
+ # -O json: output format JSON
45
+ # -p: path to analyze
46
+ # Output goes to current directory with .json extension added to original filename
47
+ (cd "$TEMP_DIR" && rust-code-analysis-cli -m -p "$TARGET_DIR" -O json 2>/dev/null) || {
48
+ echo '{"error": "rust-code-analysis-cli failed to analyze code"}' >&2
49
+ exit 1
50
+ }
51
+
52
+ # Find all generated JSON files and merge them
53
+ # rust-code-analysis creates one JSON per source file
54
+ find "$TEMP_DIR" -name "*.json" -type f 2>/dev/null | jq -s -c '
55
+ # Helper function for complexity to grade conversion
56
+ def complexity_to_grade:
57
+ if . <= 5 then "A"
58
+ elif . <= 10 then "B"
59
+ elif . <= 20 then "C"
60
+ elif . <= 30 then "D"
61
+ elif . <= 40 then "E"
62
+ else "F"
63
+ end;
64
+
65
+ # Process each file'\''s metrics
66
+ map(
67
+ # Extract the original file path from name field
68
+ .name as $filepath |
69
+
70
+ # Get cyclomatic complexity for functions
71
+ (.spaces // []) |
72
+
73
+ # Find all functions and their complexity
74
+ [.. | select(.kind? == "function" or .kind? == "method") | {
75
+ name: .name.name,
76
+ complexity: (.metrics.cyclomatic.sum // 0),
77
+ line: .start_line,
78
+ endLine: .end_line
79
+ }] as $functions |
80
+
81
+ # Calculate file-level metrics
82
+ {
83
+ key: $filepath,
84
+ value: {
85
+ functions: ($functions | map(
86
+ . + {grade: (.complexity | complexity_to_grade)}
87
+ )),
88
+ avgComplexity: (
89
+ if ($functions | length) > 0 then
90
+ (($functions | map(.complexity) | add) / ($functions | length))
91
+ else 0 end
92
+ ),
93
+ maxComplexity: (
94
+ if ($functions | length) > 0 then
95
+ ($functions | map(.complexity) | max)
96
+ else 0 end
97
+ ),
98
+ grade: (
99
+ if ($functions | length) > 0 then
100
+ ((($functions | map(.complexity) | add) / ($functions | length)) | complexity_to_grade)
101
+ else "A" end
102
+ )
103
+ }
104
+ }
105
+ ) |
106
+
107
+ # Convert to object with file paths as keys
108
+ from_entries as $files |
109
+
110
+ # Build final output
111
+ {
112
+ tool: "rust-code-analysis",
113
+ language: "rust",
114
+ generatedAt: (now | todate),
115
+ files: $files,
116
+ summary: {
117
+ totalFiles: ($files | to_entries | length),
118
+ totalFunctions: ([$files | to_entries[].value.functions | length] | add // 0),
119
+ avgComplexity: (
120
+ [$files | to_entries[].value.avgComplexity] |
121
+ if length > 0 then (add / length) else 0 end
122
+ ),
123
+ gradeDistribution: (
124
+ [$files | to_entries[].value.grade] |
125
+ reduce .[] as $grade (
126
+ {A: 0, B: 0, C: 0, D: 0, E: 0, F: 0};
127
+ .[$grade] += 1
128
+ )
129
+ )
130
+ }
131
+ }
132
+ '
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@boshu2/vibe-check",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "description": "Track git commit patterns during AI-assisted coding (experimental)",
6
6
  "main": "dist/cli.js",
7
7
  "bin": {