@boshu2/vibe-check 1.0.1 → 1.1.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 (128) hide show
  1. package/.agents/bundles/ml-learning-loop-complete-plan-2025-11-28.md +908 -0
  2. package/.agents/bundles/unified-vibe-system-plan-phase1-2025-11-28.md +962 -0
  3. package/.agents/bundles/unified-vibe-system-research-2025-11-28.md +1003 -0
  4. package/.agents/bundles/vibe-check-ecosystem-plan-2025-11-29.md +635 -0
  5. package/.agents/bundles/vibe-check-gamification-complete-2025-11-29.md +132 -0
  6. package/.agents/bundles/vibe-score-scientific-framework-2025-11-28.md +602 -0
  7. package/.vibe-check/calibration.json +38 -0
  8. package/.vibe-check/latest.json +114 -0
  9. package/CHANGELOG.md +46 -0
  10. package/CLAUDE.md +178 -0
  11. package/README.md +265 -63
  12. package/action.yml +270 -0
  13. package/dashboard/app.js +494 -0
  14. package/dashboard/index.html +235 -0
  15. package/dashboard/styles.css +647 -0
  16. package/dist/calibration/ece.d.ts +26 -0
  17. package/dist/calibration/ece.d.ts.map +1 -0
  18. package/dist/calibration/ece.js +93 -0
  19. package/dist/calibration/ece.js.map +1 -0
  20. package/dist/calibration/index.d.ts +3 -0
  21. package/dist/calibration/index.d.ts.map +1 -0
  22. package/dist/calibration/index.js +15 -0
  23. package/dist/calibration/index.js.map +1 -0
  24. package/dist/calibration/storage.d.ts +34 -0
  25. package/dist/calibration/storage.d.ts.map +1 -0
  26. package/dist/calibration/storage.js +188 -0
  27. package/dist/calibration/storage.js.map +1 -0
  28. package/dist/cli.js +30 -76
  29. package/dist/cli.js.map +1 -1
  30. package/dist/commands/analyze.d.ts +16 -0
  31. package/dist/commands/analyze.d.ts.map +1 -0
  32. package/dist/commands/analyze.js +256 -0
  33. package/dist/commands/analyze.js.map +1 -0
  34. package/dist/commands/index.d.ts +4 -0
  35. package/dist/commands/index.d.ts.map +1 -0
  36. package/dist/commands/index.js +11 -0
  37. package/dist/commands/index.js.map +1 -0
  38. package/dist/commands/level.d.ts +3 -0
  39. package/dist/commands/level.d.ts.map +1 -0
  40. package/dist/commands/level.js +277 -0
  41. package/dist/commands/level.js.map +1 -0
  42. package/dist/commands/profile.d.ts +4 -0
  43. package/dist/commands/profile.d.ts.map +1 -0
  44. package/dist/commands/profile.js +143 -0
  45. package/dist/commands/profile.js.map +1 -0
  46. package/dist/gamification/achievements.d.ts +15 -0
  47. package/dist/gamification/achievements.d.ts.map +1 -0
  48. package/dist/gamification/achievements.js +273 -0
  49. package/dist/gamification/achievements.js.map +1 -0
  50. package/dist/gamification/index.d.ts +8 -0
  51. package/dist/gamification/index.d.ts.map +1 -0
  52. package/dist/gamification/index.js +30 -0
  53. package/dist/gamification/index.js.map +1 -0
  54. package/dist/gamification/profile.d.ts +46 -0
  55. package/dist/gamification/profile.d.ts.map +1 -0
  56. package/dist/gamification/profile.js +272 -0
  57. package/dist/gamification/profile.js.map +1 -0
  58. package/dist/gamification/streaks.d.ts +26 -0
  59. package/dist/gamification/streaks.d.ts.map +1 -0
  60. package/dist/gamification/streaks.js +132 -0
  61. package/dist/gamification/streaks.js.map +1 -0
  62. package/dist/gamification/types.d.ts +111 -0
  63. package/dist/gamification/types.d.ts.map +1 -0
  64. package/dist/gamification/types.js +26 -0
  65. package/dist/gamification/types.js.map +1 -0
  66. package/dist/gamification/xp.d.ts +37 -0
  67. package/dist/gamification/xp.d.ts.map +1 -0
  68. package/dist/gamification/xp.js +115 -0
  69. package/dist/gamification/xp.js.map +1 -0
  70. package/dist/git.d.ts +11 -0
  71. package/dist/git.d.ts.map +1 -1
  72. package/dist/git.js +52 -0
  73. package/dist/git.js.map +1 -1
  74. package/dist/metrics/code-stability.d.ts +13 -0
  75. package/dist/metrics/code-stability.d.ts.map +1 -0
  76. package/dist/metrics/code-stability.js +74 -0
  77. package/dist/metrics/code-stability.js.map +1 -0
  78. package/dist/metrics/file-churn.d.ts +8 -0
  79. package/dist/metrics/file-churn.d.ts.map +1 -0
  80. package/dist/metrics/file-churn.js +75 -0
  81. package/dist/metrics/file-churn.js.map +1 -0
  82. package/dist/metrics/time-spiral.d.ts +8 -0
  83. package/dist/metrics/time-spiral.d.ts.map +1 -0
  84. package/dist/metrics/time-spiral.js +69 -0
  85. package/dist/metrics/time-spiral.js.map +1 -0
  86. package/dist/metrics/velocity-anomaly.d.ts +13 -0
  87. package/dist/metrics/velocity-anomaly.d.ts.map +1 -0
  88. package/dist/metrics/velocity-anomaly.js +67 -0
  89. package/dist/metrics/velocity-anomaly.js.map +1 -0
  90. package/dist/output/index.d.ts +6 -3
  91. package/dist/output/index.d.ts.map +1 -1
  92. package/dist/output/index.js +4 -3
  93. package/dist/output/index.js.map +1 -1
  94. package/dist/output/json.d.ts +2 -2
  95. package/dist/output/json.d.ts.map +1 -1
  96. package/dist/output/json.js +54 -0
  97. package/dist/output/json.js.map +1 -1
  98. package/dist/output/markdown.d.ts +2 -2
  99. package/dist/output/markdown.d.ts.map +1 -1
  100. package/dist/output/markdown.js +34 -1
  101. package/dist/output/markdown.js.map +1 -1
  102. package/dist/output/terminal.d.ts +6 -2
  103. package/dist/output/terminal.d.ts.map +1 -1
  104. package/dist/output/terminal.js +131 -3
  105. package/dist/output/terminal.js.map +1 -1
  106. package/dist/recommend/index.d.ts +3 -0
  107. package/dist/recommend/index.d.ts.map +1 -0
  108. package/dist/recommend/index.js +14 -0
  109. package/dist/recommend/index.js.map +1 -0
  110. package/dist/recommend/ordered-logistic.d.ts +49 -0
  111. package/dist/recommend/ordered-logistic.d.ts.map +1 -0
  112. package/dist/recommend/ordered-logistic.js +153 -0
  113. package/dist/recommend/ordered-logistic.js.map +1 -0
  114. package/dist/recommend/questions.d.ts +19 -0
  115. package/dist/recommend/questions.d.ts.map +1 -0
  116. package/dist/recommend/questions.js +73 -0
  117. package/dist/recommend/questions.js.map +1 -0
  118. package/dist/score/index.d.ts +21 -0
  119. package/dist/score/index.d.ts.map +1 -0
  120. package/dist/score/index.js +48 -0
  121. package/dist/score/index.js.map +1 -0
  122. package/dist/score/weights.d.ts +16 -0
  123. package/dist/score/weights.d.ts.map +1 -0
  124. package/dist/score/weights.js +28 -0
  125. package/dist/score/weights.js.map +1 -0
  126. package/dist/types.d.ts +83 -0
  127. package/dist/types.d.ts.map +1 -1
  128. package/package.json +10 -9
package/README.md CHANGED
@@ -1,10 +1,56 @@
1
1
  # vibe-check
2
2
 
3
- Measure vibe coding effectiveness with git commit analysis.
3
+ > ⚠️ **Experimental** - Metrics correlations with actual productivity outcomes have not been independently validated. Use as a directional signal, not ground truth.
4
4
 
5
- ## What is Vibe Coding?
5
+ **Track patterns in your AI-assisted coding workflow.**
6
6
 
7
- Vibe coding is AI-assisted development where you collaborate with an AI coding assistant. This tool measures how effectively that collaboration is working by analyzing your git commit patterns.
7
+ ## The Problem
8
+
9
+ You're using AI to write code, but how do you know if it's actually helping?
10
+
11
+ Are you shipping features faster, or just generating more commits? Building new features, or debugging AI mistakes? Moving forward, or stuck in fix-fix-fix loops?
12
+
13
+ Without data, you're guessing.
14
+
15
+ ## The Insight
16
+
17
+ vibe-check analyzes your git history and tells you:
18
+
19
+ | What You'll Learn | Why It Matters |
20
+ |-------------------|----------------|
21
+ | **Trust Pass Rate** | Are you accepting AI code that works, or code that breaks immediately? |
22
+ | **Debug Spirals** | Are you stuck in fix loops on the same component? |
23
+ | **Rework Ratio** | What percentage of your work is building vs. cleaning up? |
24
+ | **Pattern Detection** | What types of problems keep recurring? (auth, config, APIs...) |
25
+
26
+ ## Quick Demo
27
+
28
+ ```bash
29
+ $ npx @boshu2/vibe-check --since "1 week ago"
30
+
31
+ ================================================================
32
+ VIBE-CHECK RESULTS
33
+ ================================================================
34
+ Period: Nov 21 - Nov 28, 2025 (12.5h active)
35
+ Commits: 47 total (28 feat, 15 fix, 4 docs)
36
+
37
+ METRIC VALUE RATING
38
+ --------------------------------------------------
39
+ Iteration Velocity 4.2/hr HIGH
40
+ Rework Ratio 35% MEDIUM
41
+ Trust Pass Rate 92% HIGH
42
+ Debug Spiral Duration 18min HIGH
43
+ Flow Efficiency 85% HIGH
44
+
45
+ DEBUG SPIRALS (2 detected):
46
+ - auth: 4 commits, 25m (SECRETS_AUTH)
47
+ - api: 3 commits, 12m (API_MISMATCH)
48
+
49
+ OVERALL: HIGH
50
+ ================================================================
51
+ ```
52
+
53
+ **What this tells you:** You're productive (4.2 commits/hour, 92% trust pass rate), but 35% of your work is fixing things—room to improve. OAuth caused a 25-minute spiral. Next time: validate auth flows with a tracer test before full implementation.
8
54
 
9
55
  ## Installation
10
56
 
@@ -12,7 +58,7 @@ Vibe coding is AI-assisted development where you collaborate with an AI coding a
12
58
  npm install -g @boshu2/vibe-check
13
59
  ```
14
60
 
15
- Or run directly with npx:
61
+ Or run directly:
16
62
 
17
63
  ```bash
18
64
  npx @boshu2/vibe-check
@@ -21,94 +67,250 @@ npx @boshu2/vibe-check
21
67
  ## Usage
22
68
 
23
69
  ```bash
24
- # Analyze current repository
70
+ # Analyze current repository (all history)
25
71
  vibe-check
26
72
 
27
- # Analyze last week
73
+ # Analyze specific time period
28
74
  vibe-check --since "1 week ago"
75
+ vibe-check --since "2025-11-01"
29
76
 
30
- # JSON output for CI/automation
31
- vibe-check --format json
32
-
33
- # Markdown report
34
- vibe-check --format markdown
77
+ # Different output formats
78
+ vibe-check --format json # For CI/automation
79
+ vibe-check --format markdown # For reports
35
80
 
36
- # Analyze specific repo
81
+ # Analyze a different repo
37
82
  vibe-check --repo /path/to/repo
38
83
  ```
39
84
 
40
- ## The 5 Core Metrics (FAAFO)
85
+ ## The 5 Metrics
41
86
 
42
- | Metric | What It Measures | Target |
43
- |--------|------------------|--------|
44
- | **Iteration Velocity** | Commits per hour | >5/hr = Elite |
45
- | **Rework Ratio** | % commits that are fixes | <30% = Elite |
46
- | **Trust Pass Rate** | % commits that stick (no immediate fix) | >95% = Elite |
47
- | **Debug Spiral Duration** | Time spent in fix chains | <15m = Elite |
48
- | **Flow Efficiency** | % time in productive work vs debugging | >90% = Elite |
87
+ | Metric | What It Measures | Elite | Good | Needs Work |
88
+ |--------|------------------|-------|------|------------|
89
+ | **Iteration Velocity** | Commits per hour | >5/hr | 3-5/hr | <3/hr |
90
+ | **Rework Ratio** | % of commits that are fixes | <30% | 30-50% | >50% |
91
+ | **Trust Pass Rate** | % of commits without immediate fix | >95% | 80-95% | <80% |
92
+ | **Debug Spiral Duration** | Avg time stuck in fix chains | <15m | 15-30m | >30m |
93
+ | **Flow Efficiency** | % time building vs debugging | >90% | 75-90% | <75% |
49
94
 
50
- ## Output Ratings
95
+ ### What the ratings suggest
51
96
 
52
- | Rating | Meaning |
53
- |--------|---------|
54
- | **ELITE** | Vibe coding working excellently |
55
- | **HIGH** | Good effectiveness, minor improvements possible |
56
- | **MEDIUM** | Room for improvement |
57
- | **LOW** | Process issues, reassess approach |
97
+ - **ELITE**: Commit patterns suggest smooth workflow
98
+ - **HIGH**: Generally healthy patterns, some areas to watch
99
+ - **MEDIUM**: Mixed signals—review individual metrics
100
+ - **LOW**: Commit patterns suggest friction—investigate causes
58
101
 
59
- ## Example Output
60
-
61
- ```
62
- ╔════════════════════════════════════════════════════════════╗
63
- ║ VIBE CHECK RESULTS ║
64
- ╠════════════════════════════════════════════════════════════╣
65
- ║ Period: Nov 21 - Nov 28, 2025 ║
66
- ║ Commits Analyzed: 47 ║
67
- ╠════════════════════════════════════════════════════════════╣
68
- ║ ║
69
- ║ Iteration Velocity ████████████░░░░ 4.2/hr HIGH ║
70
- ║ Rework Ratio ██████░░░░░░░░░░ 35% MEDIUM ║
71
- ║ Trust Pass Rate ████████████████ 92% HIGH ║
72
- ║ Debug Spiral Duration ██████████████░░ 18min HIGH ║
73
- ║ Flow Efficiency ██████████████░░ 85% HIGH ║
74
- ║ ║
75
- ╠════════════════════════════════════════════════════════════╣
76
- ║ Overall Rating: HIGH ║
77
- ╚════════════════════════════════════════════════════════════╝
78
- ```
102
+ *Note: These ratings reflect commit patterns, not actual code quality or productivity.*
79
103
 
80
104
  ## Debug Spiral Detection
81
105
 
82
- When the tool detects fix chains (multiple fix commits in a row), it identifies:
83
- - Which component had issues
84
- - Pattern category (e.g., `API_MISMATCH`, `SSL_TLS`, `VOLUME_CONFIG`)
85
- - Duration of the spiral
86
- - Suggested tracer test to prevent recurrence
106
+ When vibe-check detects 3+ consecutive fix commits on the same component, it flags a "debug spiral" and categorizes the pattern:
87
107
 
88
- ## Integration with Claude Code
108
+ | Pattern | What It Means | Prevention |
109
+ |---------|---------------|------------|
110
+ | `SECRETS_AUTH` | Auth/OAuth/credentials issues | Validate auth flow before implementation |
111
+ | `API_MISMATCH` | API version or schema problems | Check API docs, deploy minimal test first |
112
+ | `VOLUME_CONFIG` | Mount/path/permission issues | Test volume config in isolation |
113
+ | `SSL_TLS` | Certificate/HTTPS problems | Verify certs before deploying |
114
+ | `IMAGE_REGISTRY` | Container pull/tag issues | Test image pull separately |
89
115
 
90
- This tool is designed to work with the RPI (Research-Plan-Implement) workflow:
116
+ ## When to Run
91
117
 
92
- 1. **Before implementation**: Run `vibe-check` to establish baseline
93
- 2. **After implementation**: Run `vibe-check --since "<start-time>"` to measure session
94
- 3. **Weekly review**: Run `vibe-check --since "1 week ago" --format markdown`
118
+ - **Before starting work**: Establish your baseline
119
+ - **After a session**: Measure what just happened
120
+ - **Weekly**: Track trends over time
121
+ - **After frustrating sessions**: Identify what went wrong
95
122
 
96
- ## Options
123
+ ## CLI Options
97
124
 
98
125
  ```
99
126
  -V, --version Output version number
100
- --since <date> Start date for analysis (e.g., "1 week ago", "2025-11-01")
101
- --until <date> End date for analysis (default: now)
102
- -f, --format <type> Output format: terminal, json, markdown (default: terminal)
127
+ --since <date> Start date (e.g., "1 week ago", "2025-11-01")
128
+ --until <date> End date (default: now)
129
+ -f, --format <type> Output: terminal, json, markdown
103
130
  -r, --repo <path> Repository path (default: current directory)
104
- -v, --verbose Show verbose output
131
+ -o, --output <file> Write JSON results to file
132
+ -v, --verbose Show detailed output
133
+ --score Include VibeScore (semantic-free metrics)
134
+ --recommend Include level recommendation
135
+ --simple Show simplified output (less verbose)
105
136
  -h, --help Display help
106
137
  ```
107
138
 
139
+ ## Gamification
140
+
141
+ vibe-check tracks your progress over time with XP, levels, streaks, and achievements.
142
+
143
+ ### Levels
144
+
145
+ | Level | Name | XP Required |
146
+ |-------|------|-------------|
147
+ | 1 | Newbie | 0 |
148
+ | 2 | Regular | 100 |
149
+ | 3 | Committed | 300 |
150
+ | 4 | Dedicated | 600 |
151
+ | 5 | Expert | 1000 |
152
+ | 6 | Master | 1500 |
153
+ | 7 | Grandmaster | 2100 |
154
+ | 8 | Guru | 2800 |
155
+ | 9 | Sage | 3600 |
156
+ | 10 | Legend | 4500 |
157
+
158
+ ### Achievements
159
+
160
+ Unlock achievements by hitting milestones:
161
+
162
+ - 🩸 **First Blood** - Run your first vibe-check
163
+ - ⚔️ **Week Warrior** - Maintain a 7-day streak
164
+ - 👑 **Monthly Master** - Maintain a 30-day streak
165
+ - ✨ **Elite Vibes** - Achieve ELITE rating
166
+ - 🏅 **Ninety Club** - Vibe Score of 90%+
167
+ - 🧘 **Zen Master** - 50+ commits, 0 debug spirals
168
+ - ...and 12 more, including 2 hidden achievements!
169
+
170
+ ### Profile Command
171
+
172
+ View your stats, achievements, and progress:
173
+
174
+ ```bash
175
+ # View your profile
176
+ vibe-check profile
177
+
178
+ # See all achievements
179
+ vibe-check profile --achievements
180
+
181
+ # Detailed statistics
182
+ vibe-check profile --stats
183
+
184
+ # JSON output
185
+ vibe-check profile --json
186
+ ```
187
+
188
+ ### Save Results to JSON
189
+
190
+ ```bash
191
+ # Write JSON to file while showing terminal output
192
+ vibe-check --since "1 week ago" --score -o results.json
193
+
194
+ # Combine with other formats
195
+ vibe-check --format markdown -o results.json # Terminal gets markdown, file gets JSON
196
+ ```
197
+
198
+ ## GitHub Action
199
+
200
+ Add automated vibe-check to your PRs:
201
+
202
+ ```yaml
203
+ # .github/workflows/vibe-check.yml
204
+ name: Vibe Check
205
+
206
+ on:
207
+ pull_request:
208
+ branches: [main]
209
+
210
+ jobs:
211
+ vibe-check:
212
+ runs-on: ubuntu-latest
213
+ permissions:
214
+ contents: read
215
+ pull-requests: write
216
+
217
+ steps:
218
+ - uses: actions/checkout@v4
219
+ with:
220
+ fetch-depth: 0
221
+
222
+ - name: Run Vibe Check
223
+ uses: boshu2/vibe-check@v1
224
+ with:
225
+ github-token: ${{ secrets.GITHUB_TOKEN }}
226
+ ```
227
+
228
+ ### Action Inputs
229
+
230
+ | Input | Description | Default |
231
+ |-------|-------------|---------|
232
+ | `github-token` | GitHub token for PR comments | `${{ github.token }}` |
233
+ | `since` | Start date for analysis | PR base commit |
234
+ | `threshold` | Minimum rating to pass (elite, solid, needs-work) | none |
235
+ | `include-score` | Include VibeScore | `true` |
236
+ | `include-recommendation` | Include level recommendation | `true` |
237
+ | `output-file` | Path to write JSON results | none |
238
+ | `comment-on-pr` | Post results as PR comment | `true` |
239
+
240
+ ### Action Outputs
241
+
242
+ | Output | Description |
243
+ |--------|-------------|
244
+ | `overall` | Overall rating (elite, solid, needs-work, struggling) |
245
+ | `vibe-score` | Numeric score (0-100) |
246
+ | `json` | Full JSON results |
247
+
248
+ ### Example: Fail PR if Below Threshold
249
+
250
+ ```yaml
251
+ - uses: boshu2/vibe-check@v1
252
+ with:
253
+ github-token: ${{ secrets.GITHUB_TOKEN }}
254
+ threshold: 'solid' # Fails if below solid
255
+ ```
256
+
257
+ ### Example: Save Results to File
258
+
259
+ ```yaml
260
+ - uses: boshu2/vibe-check@v1
261
+ with:
262
+ github-token: ${{ secrets.GITHUB_TOKEN }}
263
+ output-file: 'vibe-check-results.json'
264
+
265
+ - name: Upload results
266
+ uses: actions/upload-artifact@v4
267
+ with:
268
+ name: vibe-check-results
269
+ path: vibe-check-results.json
270
+ ```
271
+
108
272
  ## Requirements
109
273
 
110
- - Node.js >= 18.0.0
274
+ - Node.js >= 20.0.0
111
275
  - Git repository with commit history
276
+ - Conventional commits recommended (but not required)
277
+
278
+ ## Limitations & Caveats
279
+
280
+ ### What This Tool Does NOT Measure
281
+
282
+ | Claim | Reality |
283
+ |-------|---------|
284
+ | Code quality | Measures commit patterns, not code correctness |
285
+ | Actual productivity | Measures velocity signals, not shipped value |
286
+ | AI effectiveness | Measures workflow patterns, not AI contribution |
287
+
288
+ ### Known Limitations
289
+
290
+ 1. **No ground truth validation**: The correlation between these metrics and actual productivity outcomes has not been independently validated.
291
+
292
+ 2. **Threshold sensitivity**: Magic numbers (5 min spiral threshold, 3-file churn) are based on practitioner intuition, not empirical studies.
293
+
294
+ 3. **Goodhart's Law risk**: Once you know the metrics, you may unconsciously optimize for them rather than actual outcomes.
295
+
296
+ 4. **Cold start**: New repositories have no calibration data. Default model weights are educated guesses.
297
+
298
+ 5. **Sample size**: The ML model requires 20+ calibration samples for meaningful learning. Results with fewer samples are unreliable.
299
+
300
+ ### When NOT to Use
301
+
302
+ - As a performance review metric (easily gamed)
303
+ - To compare across teams or developers (different baselines)
304
+ - As the sole indicator of AI tool effectiveness
305
+ - Without understanding what each metric actually measures
306
+
307
+ ### Recommended Use
308
+
309
+ Use vibe-check as **one signal among many**:
310
+ - Combine with code review feedback
311
+ - Track alongside deployment success rates
312
+ - Use for self-reflection, not external judgment
313
+ - Treat as directional, not precise
112
314
 
113
315
  ## License
114
316
 
package/action.yml ADDED
@@ -0,0 +1,270 @@
1
+ name: 'Vibe Check'
2
+ description: 'Analyze git commit patterns and post vibe coding metrics to PR comments'
3
+ author: 'boshu2'
4
+ branding:
5
+ icon: 'activity'
6
+ color: 'purple'
7
+
8
+ inputs:
9
+ github-token:
10
+ description: 'GitHub token for posting PR comments'
11
+ required: true
12
+ default: ${{ github.token }}
13
+ since:
14
+ description: 'Start date for analysis (e.g., "1 week ago", or leave empty for PR commits only)'
15
+ required: false
16
+ default: ''
17
+ threshold:
18
+ description: 'Minimum overall rating to pass (elite, solid, needs-work, struggling)'
19
+ required: false
20
+ default: ''
21
+ include-score:
22
+ description: 'Include VibeScore in output'
23
+ required: false
24
+ default: 'true'
25
+ include-recommendation:
26
+ description: 'Include level recommendation in output'
27
+ required: false
28
+ default: 'true'
29
+ output-file:
30
+ description: 'Path to write JSON results (optional)'
31
+ required: false
32
+ default: ''
33
+ comment-on-pr:
34
+ description: 'Post results as PR comment'
35
+ required: false
36
+ default: 'true'
37
+
38
+ outputs:
39
+ overall:
40
+ description: 'Overall rating (elite, solid, needs-work, struggling)'
41
+ value: ${{ steps.vibe-check.outputs.overall }}
42
+ vibe-score:
43
+ description: 'Numeric vibe score (0-100)'
44
+ value: ${{ steps.vibe-check.outputs.vibe-score }}
45
+ json:
46
+ description: 'Full JSON results'
47
+ value: ${{ steps.vibe-check.outputs.json }}
48
+
49
+ runs:
50
+ using: 'composite'
51
+ steps:
52
+ - name: Setup Node.js
53
+ uses: actions/setup-node@v4
54
+ with:
55
+ node-version: '20'
56
+
57
+ - name: Install vibe-check
58
+ shell: bash
59
+ run: npm install -g @boshu2/vibe-check
60
+
61
+ - name: Fetch full git history
62
+ shell: bash
63
+ run: |
64
+ git fetch --unshallow 2>/dev/null || true
65
+ git fetch origin ${{ github.base_ref }} 2>/dev/null || true
66
+
67
+ - name: Run vibe-check
68
+ id: vibe-check
69
+ shell: bash
70
+ env:
71
+ GITHUB_TOKEN: ${{ inputs.github-token }}
72
+ run: |
73
+ # Determine the date range
74
+ if [ -n "${{ inputs.since }}" ]; then
75
+ SINCE_ARG="--since \"${{ inputs.since }}\""
76
+ elif [ "${{ github.event_name }}" = "pull_request" ]; then
77
+ # For PRs, analyze commits since the base branch
78
+ BASE_SHA=$(git merge-base origin/${{ github.base_ref }} HEAD 2>/dev/null || echo "")
79
+ if [ -n "$BASE_SHA" ]; then
80
+ BASE_DATE=$(git show -s --format=%ci $BASE_SHA)
81
+ SINCE_ARG="--since \"$BASE_DATE\""
82
+ else
83
+ SINCE_ARG="--since \"1 week ago\""
84
+ fi
85
+ else
86
+ SINCE_ARG="--since \"1 week ago\""
87
+ fi
88
+
89
+ # Build command
90
+ CMD="vibe-check"
91
+ [ "${{ inputs.include-score }}" = "true" ] && CMD="$CMD --score"
92
+ [ "${{ inputs.include-recommendation }}" = "true" ] && CMD="$CMD --recommend"
93
+
94
+ # Run with JSON output
95
+ echo "Running: $CMD $SINCE_ARG --format json"
96
+ RESULT=$(eval "$CMD $SINCE_ARG --format json" 2>&1) || true
97
+
98
+ # Parse results
99
+ if echo "$RESULT" | jq . > /dev/null 2>&1; then
100
+ OVERALL=$(echo "$RESULT" | jq -r '.overall')
101
+ VIBE_SCORE=$(echo "$RESULT" | jq -r '.vibeScore // "N/A"')
102
+
103
+ echo "overall=$OVERALL" >> $GITHUB_OUTPUT
104
+ echo "vibe-score=$VIBE_SCORE" >> $GITHUB_OUTPUT
105
+
106
+ # Save JSON (escape for multiline)
107
+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
108
+ echo "json<<$EOF" >> $GITHUB_OUTPUT
109
+ echo "$RESULT" >> $GITHUB_OUTPUT
110
+ echo "$EOF" >> $GITHUB_OUTPUT
111
+
112
+ # Write to file if requested
113
+ if [ -n "${{ inputs.output-file }}" ]; then
114
+ echo "$RESULT" > "${{ inputs.output-file }}"
115
+ echo "Results written to ${{ inputs.output-file }}"
116
+ fi
117
+ else
118
+ echo "overall=error" >> $GITHUB_OUTPUT
119
+ echo "vibe-score=0" >> $GITHUB_OUTPUT
120
+ echo "json={\"error\": \"Failed to parse vibe-check output\"}" >> $GITHUB_OUTPUT
121
+ echo "::warning::vibe-check output was not valid JSON: $RESULT"
122
+ fi
123
+
124
+ - name: Generate markdown comment
125
+ id: markdown
126
+ if: inputs.comment-on-pr == 'true' && github.event_name == 'pull_request'
127
+ shell: bash
128
+ run: |
129
+ JSON='${{ steps.vibe-check.outputs.json }}'
130
+
131
+ # Parse metrics
132
+ OVERALL=$(echo "$JSON" | jq -r '.overall')
133
+ COMMITS=$(echo "$JSON" | jq -r '.commits')
134
+ VIBE_SCORE=$(echo "$JSON" | jq -r '.vibeScore // "N/A"')
135
+
136
+ # Get individual metrics
137
+ VELOCITY=$(echo "$JSON" | jq -r '.metrics.iterationVelocity.value')
138
+ VELOCITY_RATING=$(echo "$JSON" | jq -r '.metrics.iterationVelocity.rating')
139
+ REWORK=$(echo "$JSON" | jq -r '.metrics.reworkRatio.value')
140
+ REWORK_RATING=$(echo "$JSON" | jq -r '.metrics.reworkRatio.rating')
141
+ TRUST=$(echo "$JSON" | jq -r '.metrics.trustPassRate.value')
142
+ TRUST_RATING=$(echo "$JSON" | jq -r '.metrics.trustPassRate.rating')
143
+ SPIRAL=$(echo "$JSON" | jq -r '.metrics.debugSpiralDuration.value')
144
+ SPIRAL_RATING=$(echo "$JSON" | jq -r '.metrics.debugSpiralDuration.rating')
145
+ FLOW=$(echo "$JSON" | jq -r '.metrics.flowEfficiency.value')
146
+ FLOW_RATING=$(echo "$JSON" | jq -r '.metrics.flowEfficiency.rating')
147
+
148
+ # Map ratings to emoji
149
+ rating_emoji() {
150
+ case "$1" in
151
+ elite) echo "🟢" ;;
152
+ solid) echo "🔵" ;;
153
+ needs-work) echo "🟡" ;;
154
+ struggling) echo "🔴" ;;
155
+ *) echo "⚪" ;;
156
+ esac
157
+ }
158
+
159
+ # Overall emoji
160
+ case "$OVERALL" in
161
+ elite) OVERALL_EMOJI="🚀" ;;
162
+ solid) OVERALL_EMOJI="✅" ;;
163
+ needs-work) OVERALL_EMOJI="⚠️" ;;
164
+ struggling) OVERALL_EMOJI="🔴" ;;
165
+ *) OVERALL_EMOJI="❓" ;;
166
+ esac
167
+
168
+ # Build comment
169
+ COMMENT="## $OVERALL_EMOJI Vibe Check: **${OVERALL^^}**
170
+
171
+ **Commits analyzed:** $COMMITS"
172
+
173
+ [ "$VIBE_SCORE" != "N/A" ] && [ "$VIBE_SCORE" != "null" ] && COMMENT="$COMMENT | **VibeScore:** $VIBE_SCORE/100"
174
+
175
+ COMMENT="$COMMENT
176
+
177
+ | Metric | Value | Rating |
178
+ |--------|-------|--------|
179
+ | Iteration Velocity | ${VELOCITY}/hr | $(rating_emoji $VELOCITY_RATING) $VELOCITY_RATING |
180
+ | Rework Ratio | ${REWORK}% | $(rating_emoji $REWORK_RATING) $REWORK_RATING |
181
+ | Trust Pass Rate | ${TRUST}% | $(rating_emoji $TRUST_RATING) $TRUST_RATING |
182
+ | Debug Spiral Duration | ${SPIRAL}m | $(rating_emoji $SPIRAL_RATING) $SPIRAL_RATING |
183
+ | Flow Efficiency | ${FLOW}% | $(rating_emoji $FLOW_RATING) $FLOW_RATING |
184
+
185
+ <details>
186
+ <summary>What do these metrics mean?</summary>
187
+
188
+ - **Iteration Velocity**: Commits per active hour (higher = faster iteration)
189
+ - **Rework Ratio**: Percentage of commits that are fixes (lower = cleaner first attempts)
190
+ - **Trust Pass Rate**: Commits without immediate follow-up fixes (higher = more reliable)
191
+ - **Debug Spiral Duration**: Average time stuck in fix chains (lower = faster recovery)
192
+ - **Flow Efficiency**: Time building vs debugging (higher = more productive)
193
+
194
+ </details>
195
+
196
+ ---
197
+ *Generated by [vibe-check](https://github.com/boshu2/vibe-check)*"
198
+
199
+ # Save comment for next step
200
+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
201
+ echo "comment<<$EOF" >> $GITHUB_OUTPUT
202
+ echo "$COMMENT" >> $GITHUB_OUTPUT
203
+ echo "$EOF" >> $GITHUB_OUTPUT
204
+
205
+ - name: Post PR comment
206
+ if: inputs.comment-on-pr == 'true' && github.event_name == 'pull_request'
207
+ uses: actions/github-script@v7
208
+ with:
209
+ github-token: ${{ inputs.github-token }}
210
+ script: |
211
+ const comment = `${{ steps.markdown.outputs.comment }}`;
212
+
213
+ // Find existing vibe-check comment
214
+ const { data: comments } = await github.rest.issues.listComments({
215
+ owner: context.repo.owner,
216
+ repo: context.repo.repo,
217
+ issue_number: context.issue.number,
218
+ });
219
+
220
+ const existingComment = comments.find(c =>
221
+ c.body.includes('Generated by [vibe-check]')
222
+ );
223
+
224
+ if (existingComment) {
225
+ // Update existing comment
226
+ await github.rest.issues.updateComment({
227
+ owner: context.repo.owner,
228
+ repo: context.repo.repo,
229
+ comment_id: existingComment.id,
230
+ body: comment
231
+ });
232
+ console.log('Updated existing vibe-check comment');
233
+ } else {
234
+ // Create new comment
235
+ await github.rest.issues.createComment({
236
+ owner: context.repo.owner,
237
+ repo: context.repo.repo,
238
+ issue_number: context.issue.number,
239
+ body: comment
240
+ });
241
+ console.log('Created new vibe-check comment');
242
+ }
243
+
244
+ - name: Check threshold
245
+ if: inputs.threshold != ''
246
+ shell: bash
247
+ run: |
248
+ OVERALL="${{ steps.vibe-check.outputs.overall }}"
249
+ THRESHOLD="${{ inputs.threshold }}"
250
+
251
+ # Rating order (higher = better)
252
+ rating_to_num() {
253
+ case "$1" in
254
+ elite) echo 4 ;;
255
+ solid) echo 3 ;;
256
+ needs-work) echo 2 ;;
257
+ struggling) echo 1 ;;
258
+ *) echo 0 ;;
259
+ esac
260
+ }
261
+
262
+ ACTUAL=$(rating_to_num "$OVERALL")
263
+ REQUIRED=$(rating_to_num "$THRESHOLD")
264
+
265
+ if [ "$ACTUAL" -lt "$REQUIRED" ]; then
266
+ echo "::error::Vibe check failed: $OVERALL is below threshold $THRESHOLD"
267
+ exit 1
268
+ else
269
+ echo "Vibe check passed: $OVERALL meets threshold $THRESHOLD"
270
+ fi