@boshu2/vibe-check 1.4.0 → 1.6.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.
- package/.agents/bundles/insight-mining-dashboard-research-2025-11-30.md +400 -0
- package/.agents/bundles/storage-enhancement-research-2025-11-30.md +292 -0
- package/.agents/bundles/timeline-feature-research-complete-2025-11-30.md +301 -0
- package/.agents/plans/insight-dashboard-plan-2025-11-30.md +1130 -0
- package/.agents/plans/json-storage-enhancement-plan.md +717 -0
- package/.agents/plans/storage-hardening-and-cache-plan.md +592 -0
- package/.agents/plans/test-coverage-gaps-plan.md +1117 -0
- package/.agents/plans/timeline-feature-plan.md +193 -0
- package/.agents/plans/vibe_timeline_research_findings.md +553 -0
- package/.claude/settings.local.json +1 -0
- package/.vibe-check/.gitignore +6 -0
- package/CHANGELOG.md +46 -0
- package/CLAUDE.md +24 -0
- package/CONTRIBUTING.md +227 -0
- package/README.md +200 -143
- package/claude-progress.json +200 -12
- package/claude-progress.txt +310 -0
- package/dashboard/app.js +75 -2
- package/dashboard/dashboard-data.json +653 -0
- package/dashboard/index.html +13 -0
- package/dashboard/styles.css +61 -0
- package/dist/analysis/cross-session-analysis.d.ts +68 -0
- package/dist/analysis/cross-session-analysis.d.ts.map +1 -0
- package/dist/analysis/cross-session-analysis.js +174 -0
- package/dist/analysis/cross-session-analysis.js.map +1 -0
- package/dist/analysis/index.d.ts +2 -0
- package/dist/analysis/index.d.ts.map +1 -0
- package/dist/analysis/index.js +12 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/analyze.d.ts +2 -0
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +105 -2
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/cache.d.ts +6 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +168 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/dashboard.d.ts +8 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +109 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +8 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +140 -31
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/timeline.d.ts +14 -0
- package/dist/commands/timeline.d.ts.map +1 -0
- package/dist/commands/timeline.js +462 -0
- package/dist/commands/timeline.js.map +1 -0
- package/dist/gamification/badges.d.ts +29 -0
- package/dist/gamification/badges.d.ts.map +1 -0
- package/dist/gamification/badges.js +114 -0
- package/dist/gamification/badges.js.map +1 -0
- package/dist/gamification/challenges.d.ts +42 -0
- package/dist/gamification/challenges.d.ts.map +1 -0
- package/dist/gamification/challenges.js +184 -0
- package/dist/gamification/challenges.js.map +1 -0
- package/dist/gamification/hall-of-fame.d.ts +17 -0
- package/dist/gamification/hall-of-fame.d.ts.map +1 -0
- package/dist/gamification/hall-of-fame.js +64 -0
- package/dist/gamification/hall-of-fame.js.map +1 -0
- package/dist/gamification/leaderboards.d.ts +49 -0
- package/dist/gamification/leaderboards.d.ts.map +1 -0
- package/dist/gamification/leaderboards.js +179 -0
- package/dist/gamification/leaderboards.js.map +1 -0
- package/dist/gamification/share.d.ts +29 -0
- package/dist/gamification/share.d.ts.map +1 -0
- package/dist/gamification/share.js +57 -0
- package/dist/gamification/share.js.map +1 -0
- package/dist/gamification/stats.d.ts +34 -0
- package/dist/gamification/stats.d.ts.map +1 -0
- package/dist/gamification/stats.js +91 -0
- package/dist/gamification/stats.js.map +1 -0
- package/dist/gamification/streaks.d.ts +9 -1
- package/dist/gamification/streaks.d.ts.map +1 -1
- package/dist/gamification/streaks.js +37 -4
- package/dist/gamification/streaks.js.map +1 -1
- package/dist/gamification/types.d.ts +35 -0
- package/dist/gamification/types.d.ts.map +1 -1
- package/dist/gamification/types.js +11 -3
- package/dist/gamification/types.js.map +1 -1
- package/dist/gamification/xp.d.ts +6 -2
- package/dist/gamification/xp.d.ts.map +1 -1
- package/dist/gamification/xp.js +27 -5
- package/dist/gamification/xp.js.map +1 -1
- package/dist/git.d.ts +24 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +94 -0
- package/dist/git.js.map +1 -1
- package/dist/insights/generators.d.ts +44 -0
- package/dist/insights/generators.d.ts.map +1 -0
- package/dist/insights/generators.js +289 -0
- package/dist/insights/generators.js.map +1 -0
- package/dist/insights/index.d.ts +16 -0
- package/dist/insights/index.d.ts.map +1 -0
- package/dist/insights/index.js +171 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/insights/types.d.ts +93 -0
- package/dist/insights/types.d.ts.map +1 -0
- package/dist/insights/types.js +6 -0
- package/dist/insights/types.js.map +1 -0
- package/dist/output/terminal.d.ts.map +1 -1
- package/dist/output/terminal.js +39 -0
- package/dist/output/terminal.js.map +1 -1
- package/dist/output/timeline-html.d.ts +6 -0
- package/dist/output/timeline-html.d.ts.map +1 -0
- package/dist/output/timeline-html.js +389 -0
- package/dist/output/timeline-html.js.map +1 -0
- package/dist/output/timeline-markdown.d.ts +6 -0
- package/dist/output/timeline-markdown.d.ts.map +1 -0
- package/dist/output/timeline-markdown.js +167 -0
- package/dist/output/timeline-markdown.js.map +1 -0
- package/dist/output/timeline.d.ts +9 -0
- package/dist/output/timeline.d.ts.map +1 -0
- package/dist/output/timeline.js +318 -0
- package/dist/output/timeline.js.map +1 -0
- package/dist/patterns/detour.d.ts +32 -0
- package/dist/patterns/detour.d.ts.map +1 -0
- package/dist/patterns/detour.js +137 -0
- package/dist/patterns/detour.js.map +1 -0
- package/dist/patterns/flow-state.d.ts +16 -0
- package/dist/patterns/flow-state.d.ts.map +1 -0
- package/dist/patterns/flow-state.js +40 -0
- package/dist/patterns/flow-state.js.map +1 -0
- package/dist/patterns/index.d.ts +8 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +22 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/intervention-effectiveness.d.ts +42 -0
- package/dist/patterns/intervention-effectiveness.d.ts.map +1 -0
- package/dist/patterns/intervention-effectiveness.js +196 -0
- package/dist/patterns/intervention-effectiveness.js.map +1 -0
- package/dist/patterns/late-night.d.ts +30 -0
- package/dist/patterns/late-night.d.ts.map +1 -0
- package/dist/patterns/late-night.js +141 -0
- package/dist/patterns/late-night.js.map +1 -0
- package/dist/patterns/post-delete-sprint.d.ts +28 -0
- package/dist/patterns/post-delete-sprint.d.ts.map +1 -0
- package/dist/patterns/post-delete-sprint.js +85 -0
- package/dist/patterns/post-delete-sprint.js.map +1 -0
- package/dist/patterns/spiral-regression.d.ts +49 -0
- package/dist/patterns/spiral-regression.d.ts.map +1 -0
- package/dist/patterns/spiral-regression.js +219 -0
- package/dist/patterns/spiral-regression.js.map +1 -0
- package/dist/patterns/thrashing.d.ts +25 -0
- package/dist/patterns/thrashing.d.ts.map +1 -0
- package/dist/patterns/thrashing.js +111 -0
- package/dist/patterns/thrashing.js.map +1 -0
- package/dist/storage/atomic.d.ts +40 -0
- package/dist/storage/atomic.d.ts.map +1 -0
- package/dist/storage/atomic.js +155 -0
- package/dist/storage/atomic.js.map +1 -0
- package/dist/storage/commit-log.d.ts +35 -0
- package/dist/storage/commit-log.d.ts.map +1 -0
- package/dist/storage/commit-log.js +128 -0
- package/dist/storage/commit-log.js.map +1 -0
- package/dist/storage/index.d.ts +5 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +33 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/schema.d.ts +32 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +37 -0
- package/dist/storage/schema.js.map +1 -0
- package/dist/storage/timeline-store.d.ts +117 -0
- package/dist/storage/timeline-store.d.ts.map +1 -0
- package/dist/storage/timeline-store.js +438 -0
- package/dist/storage/timeline-store.js.map +1 -0
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/ARCHITECTURE.md +458 -0
- package/docs/DATA-ARCHITECTURE.md +565 -0
- package/docs/GAMIFICATION.md +564 -0
- package/docs/JSON-STORAGE-PATTERNS.md +512 -0
- package/docs/METRICS-EXPLAINED.md +394 -0
- package/docs/UNIFIED-ECOSYSTEM.md +560 -0
- package/docs/VIBE-ECOSYSTEM.md +406 -0
- package/feature-list.json +103 -1
- package/package.json +2 -1
- package/vitest.config.ts +1 -5
- package/.vibe-check/calibration.json +0 -38
- package/.vibe-check/latest.json +0 -114
- package/.vibe-check/sessions.json +0 -34
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
# vibe-check Architecture
|
|
2
|
+
|
|
3
|
+
**Technical guide to the vibe-check codebase**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
vibe-check is a TypeScript CLI tool that analyzes git history to measure AI-assisted development effectiveness. It uses semantic-free signals from commit patterns to compute metrics without reading code content.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
13
|
+
│ CLI Layer │
|
|
14
|
+
│ cli.ts → Commander.js commands → User interface │
|
|
15
|
+
├─────────────────────────────────────────────────────────────┤
|
|
16
|
+
│ Commands Layer │
|
|
17
|
+
│ analyze │ watch │ profile │ start │ intervene │ init-hook │
|
|
18
|
+
├─────────────────────────────────────────────────────────────┤
|
|
19
|
+
│ Core Layer │
|
|
20
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
21
|
+
│ │ Metrics │ │ Scoring │ │ Sessions │ │
|
|
22
|
+
│ │ Engine │ │ Engine │ │ Manager │ │
|
|
23
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
24
|
+
├─────────────────────────────────────────────────────────────┤
|
|
25
|
+
│ Gamification Layer │
|
|
26
|
+
│ XP │ Streaks │ Achievements │ Challenges │ Leaderboards │
|
|
27
|
+
├─────────────────────────────────────────────────────────────┤
|
|
28
|
+
│ Output Layer │
|
|
29
|
+
│ Terminal (chalk) │ JSON │ Markdown │
|
|
30
|
+
├─────────────────────────────────────────────────────────────┤
|
|
31
|
+
│ Data Layer │
|
|
32
|
+
│ Git (simple-git) │ Profile (.vibe-check/) │ Leaderboards │
|
|
33
|
+
└─────────────────────────────────────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Directory Structure
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
src/
|
|
42
|
+
├── cli.ts # Entry point, Commander.js setup
|
|
43
|
+
├── git.ts # Git operations (simple-git wrapper)
|
|
44
|
+
├── types.ts # Core TypeScript interfaces
|
|
45
|
+
│
|
|
46
|
+
├── commands/ # CLI command implementations
|
|
47
|
+
│ ├── index.ts # Command exports
|
|
48
|
+
│ ├── analyze.ts # Main analysis command
|
|
49
|
+
│ ├── watch.ts # Real-time monitoring
|
|
50
|
+
│ ├── profile.ts # Gamification profile
|
|
51
|
+
│ ├── start.ts # Session workflow
|
|
52
|
+
│ ├── intervene.ts # Intervention tracking
|
|
53
|
+
│ └── init-hook.ts # Git hook installation
|
|
54
|
+
│
|
|
55
|
+
├── metrics/ # Metric calculations
|
|
56
|
+
│ ├── index.ts # Orchestrates all metrics
|
|
57
|
+
│ ├── velocity.ts # Iteration velocity
|
|
58
|
+
│ ├── rework.ts # Rework ratio
|
|
59
|
+
│ ├── trust.ts # Trust pass rate
|
|
60
|
+
│ ├── spirals.ts # Debug spiral detection
|
|
61
|
+
│ ├── flow.ts # Flow efficiency
|
|
62
|
+
│ ├── file-churn.ts # File churn patterns
|
|
63
|
+
│ ├── time-spiral.ts # Time-based spirals
|
|
64
|
+
│ ├── velocity-anomaly.ts # Velocity deviation
|
|
65
|
+
│ └── code-stability.ts # Code survival rate
|
|
66
|
+
│
|
|
67
|
+
├── score/ # VibeScore computation
|
|
68
|
+
│ ├── index.ts # Score orchestration
|
|
69
|
+
│ └── weights.ts # Metric weights
|
|
70
|
+
│
|
|
71
|
+
├── sessions/ # Session management
|
|
72
|
+
│ └── index.ts # Session detection, baseline
|
|
73
|
+
│
|
|
74
|
+
├── gamification/ # Gamification system
|
|
75
|
+
│ ├── index.ts # Exports
|
|
76
|
+
│ ├── types.ts # Gamification interfaces
|
|
77
|
+
│ ├── xp.ts # XP calculation, levels
|
|
78
|
+
│ ├── streaks.ts # Streak tracking
|
|
79
|
+
│ ├── achievements.ts # Achievement definitions
|
|
80
|
+
│ ├── challenges.ts # Weekly challenges
|
|
81
|
+
│ ├── leaderboards.ts # Personal high scores
|
|
82
|
+
│ ├── hall-of-fame.ts # Personal records
|
|
83
|
+
│ ├── stats.ts # Weekly stats, sparklines
|
|
84
|
+
│ ├── badges.ts # Rank badges
|
|
85
|
+
│ ├── share.ts # Shareable profiles
|
|
86
|
+
│ ├── profile.ts # Profile persistence
|
|
87
|
+
│ ├── pattern-memory.ts # Spiral trigger tracking
|
|
88
|
+
│ └── intervention-memory.ts # What breaks spirals
|
|
89
|
+
│
|
|
90
|
+
└── output/ # Output formatters
|
|
91
|
+
├── index.ts # Format router
|
|
92
|
+
├── terminal.ts # Colored terminal output
|
|
93
|
+
├── json.ts # JSON output
|
|
94
|
+
└── markdown.ts # Markdown output
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Core Data Flow
|
|
100
|
+
|
|
101
|
+
### Analysis Pipeline
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Git History → Parse Commits → Calculate Metrics → Compute Score → Format Output
|
|
105
|
+
│ │ │ │ │
|
|
106
|
+
simple-git git.ts metrics/* score/* output/*
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Detailed Flow
|
|
110
|
+
|
|
111
|
+
1. **Git Extraction** (`git.ts`)
|
|
112
|
+
- Uses `simple-git` to query commit history
|
|
113
|
+
- Parses commit messages for type (feat/fix/docs/etc.) and scope
|
|
114
|
+
- Returns array of `Commit` objects
|
|
115
|
+
|
|
116
|
+
2. **Metric Calculation** (`metrics/index.ts`)
|
|
117
|
+
- Each metric module receives commits array
|
|
118
|
+
- Calculates value, assigns rating (elite/high/medium/low)
|
|
119
|
+
- Returns `MetricResult` with value, unit, rating, description
|
|
120
|
+
|
|
121
|
+
3. **Score Computation** (`score/index.ts`)
|
|
122
|
+
- Combines semantic-free metrics with weights
|
|
123
|
+
- Produces 0-100 VibeScore
|
|
124
|
+
|
|
125
|
+
4. **Gamification Update** (`gamification/`)
|
|
126
|
+
- Records session to profile
|
|
127
|
+
- Updates XP, streaks, achievements
|
|
128
|
+
- Checks challenge progress
|
|
129
|
+
|
|
130
|
+
5. **Output Formatting** (`output/`)
|
|
131
|
+
- Routes to terminal/JSON/markdown formatter
|
|
132
|
+
- Applies colors, tables, structure
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Key Interfaces
|
|
137
|
+
|
|
138
|
+
### Core Types (`types.ts`)
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// Commit from git history
|
|
142
|
+
interface Commit {
|
|
143
|
+
hash: string;
|
|
144
|
+
date: Date;
|
|
145
|
+
message: string;
|
|
146
|
+
type: 'feat' | 'fix' | 'docs' | 'chore' | 'refactor' | 'test' | 'style' | 'other';
|
|
147
|
+
scope: string | null;
|
|
148
|
+
author: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Result from a metric calculation
|
|
152
|
+
interface MetricResult {
|
|
153
|
+
value: number;
|
|
154
|
+
unit: string;
|
|
155
|
+
rating: Rating; // 'elite' | 'high' | 'medium' | 'low'
|
|
156
|
+
description: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Debug spiral (fix chain)
|
|
160
|
+
interface FixChain {
|
|
161
|
+
component: string;
|
|
162
|
+
commits: number;
|
|
163
|
+
duration: number; // minutes
|
|
164
|
+
isSpiral: boolean;
|
|
165
|
+
pattern: string | null; // SECRETS_AUTH, VOLUME_CONFIG, etc.
|
|
166
|
+
firstCommit: Date;
|
|
167
|
+
lastCommit: Date;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Complete analysis result
|
|
171
|
+
interface VibeCheckResult {
|
|
172
|
+
period: { from: Date; to: Date; activeHours: number };
|
|
173
|
+
commits: { total: number; feat: number; fix: number; docs: number; other: number };
|
|
174
|
+
metrics: {
|
|
175
|
+
iterationVelocity: MetricResult;
|
|
176
|
+
reworkRatio: MetricResult;
|
|
177
|
+
trustPassRate: MetricResult;
|
|
178
|
+
debugSpiralDuration: MetricResult;
|
|
179
|
+
flowEfficiency: MetricResult;
|
|
180
|
+
};
|
|
181
|
+
fixChains: FixChain[];
|
|
182
|
+
patterns: PatternSummary;
|
|
183
|
+
overall: OverallRating; // 'ELITE' | 'HIGH' | 'MEDIUM' | 'LOW'
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Gamification Types (`gamification/types.ts`)
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
// User profile stored in .vibe-check/profile.json
|
|
191
|
+
interface UserProfile {
|
|
192
|
+
version: string;
|
|
193
|
+
createdAt: string;
|
|
194
|
+
updatedAt: string;
|
|
195
|
+
streak: StreakState;
|
|
196
|
+
xp: XPState;
|
|
197
|
+
achievements: Achievement[];
|
|
198
|
+
sessions: SessionRecord[];
|
|
199
|
+
patternMemory?: PatternMemory;
|
|
200
|
+
interventionMemory?: InterventionMemory;
|
|
201
|
+
challenges?: Challenge[];
|
|
202
|
+
preferences: { weeklyGoal: number; showNotifications: boolean; publicProfile: boolean };
|
|
203
|
+
stats: { totalSessions: number; totalCommitsAnalyzed: number; avgVibeScore: number; ... };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// XP and level state
|
|
207
|
+
interface XPState {
|
|
208
|
+
total: number;
|
|
209
|
+
level: number; // 1-6
|
|
210
|
+
levelName: string; // "Novice" to "Grandmaster"
|
|
211
|
+
currentLevelXP: number;
|
|
212
|
+
nextLevelXP: number;
|
|
213
|
+
lastSessionXP: number;
|
|
214
|
+
prestigeTier?: number; // 1-5 for prestige levels
|
|
215
|
+
prestigeName?: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Streak tracking
|
|
219
|
+
interface StreakState {
|
|
220
|
+
current: number;
|
|
221
|
+
longest: number;
|
|
222
|
+
lastActiveDate: string;
|
|
223
|
+
weeklyGoal: number;
|
|
224
|
+
weeklyProgress: number;
|
|
225
|
+
freezesRemaining: number;
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Metric Calculations
|
|
232
|
+
|
|
233
|
+
### The 5 Core Metrics
|
|
234
|
+
|
|
235
|
+
| Metric | File | Formula | Elite Threshold |
|
|
236
|
+
|--------|------|---------|-----------------|
|
|
237
|
+
| Iteration Velocity | `velocity.ts` | `commits / activeHours` | >5/hr |
|
|
238
|
+
| Rework Ratio | `rework.ts` | `fixCommits / totalCommits` | <30% |
|
|
239
|
+
| Trust Pass Rate | `trust.ts` | `(1 - immediateFixRate)` | >95% |
|
|
240
|
+
| Debug Spiral Duration | `spirals.ts` | `avgSpiralMinutes` | <15m |
|
|
241
|
+
| Flow Efficiency | `flow.ts` | `buildTime / totalTime` | >90% |
|
|
242
|
+
|
|
243
|
+
### Semantic-Free Metrics (Advanced)
|
|
244
|
+
|
|
245
|
+
| Metric | File | What It Measures |
|
|
246
|
+
|--------|------|------------------|
|
|
247
|
+
| File Churn | `file-churn.ts` | % files touched multiple times |
|
|
248
|
+
| Time Spiral | `time-spiral.ts` | Rapid-fire commits on same files |
|
|
249
|
+
| Velocity Anomaly | `velocity-anomaly.ts` | Z-score vs personal baseline |
|
|
250
|
+
| Code Stability | `code-stability.ts` | % of added lines that survive |
|
|
251
|
+
|
|
252
|
+
### VibeScore Computation
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// score/weights.ts
|
|
256
|
+
const DEFAULT_WEIGHTS = {
|
|
257
|
+
fileChurn: 0.30, // Strongest signal
|
|
258
|
+
timeSpiral: 0.25, // Frustrated iteration
|
|
259
|
+
velocityAnomaly: 0.20, // Unusual patterns
|
|
260
|
+
codeStability: 0.25, // Long-term quality
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// VibeScore = weighted sum of normalized metrics
|
|
264
|
+
vibeScore = (fileChurn * 0.30) + (timeSpiral * 0.25) +
|
|
265
|
+
(velocityAnomaly * 0.20) + (codeStability * 0.25)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Debug Spiral Detection
|
|
271
|
+
|
|
272
|
+
### Algorithm (`spirals.ts`)
|
|
273
|
+
|
|
274
|
+
1. Group commits by scope/component
|
|
275
|
+
2. Find consecutive fix commits (type='fix')
|
|
276
|
+
3. If 3+ fixes within 30 minutes → spiral detected
|
|
277
|
+
4. Classify pattern based on keywords:
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
const SPIRAL_PATTERNS = {
|
|
281
|
+
SECRETS_AUTH: ['oauth', 'token', 'secret', 'credential', 'auth'],
|
|
282
|
+
API_MISMATCH: ['api', 'version', 'schema', 'endpoint'],
|
|
283
|
+
VOLUME_CONFIG: ['volume', 'mount', 'pvc', 'permission'],
|
|
284
|
+
SSL_TLS: ['ssl', 'tls', 'cert', 'https'],
|
|
285
|
+
IMAGE_REGISTRY: ['image', 'pull', 'registry', 'container'],
|
|
286
|
+
GITOPS_DRIFT: ['sync', 'reconcile', 'drift', 'argocd'],
|
|
287
|
+
};
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Gamification System
|
|
293
|
+
|
|
294
|
+
### XP Rewards
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// gamification/types.ts
|
|
298
|
+
const XP_REWARDS = {
|
|
299
|
+
dailyCheckIn: 10,
|
|
300
|
+
eliteSession: 50,
|
|
301
|
+
highSession: 25,
|
|
302
|
+
mediumSession: 10,
|
|
303
|
+
lowSession: 5,
|
|
304
|
+
streakBonus: 5, // Per day of streak
|
|
305
|
+
achievementBase: 25,
|
|
306
|
+
noSpirals: 15,
|
|
307
|
+
perfectTrust: 20,
|
|
308
|
+
};
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Level Progression
|
|
312
|
+
|
|
313
|
+
| Level | Name | XP Required | Icon |
|
|
314
|
+
|-------|------|-------------|------|
|
|
315
|
+
| 1 | Novice | 0-100 | 🌱 |
|
|
316
|
+
| 2 | Apprentice | 100-300 | 🌿 |
|
|
317
|
+
| 3 | Practitioner | 300-600 | 🌳 |
|
|
318
|
+
| 4 | Expert | 600-1000 | 🌲 |
|
|
319
|
+
| 5 | Master | 1000-2000 | 🎋 |
|
|
320
|
+
| 6 | Grandmaster | 2000-5000 | 🏔️ |
|
|
321
|
+
|
|
322
|
+
### Prestige Tiers (After Grandmaster)
|
|
323
|
+
|
|
324
|
+
| Tier | Name | XP Required | Icon |
|
|
325
|
+
|------|------|-------------|------|
|
|
326
|
+
| 1 | Archmage | 5000-10000 | 🔮 |
|
|
327
|
+
| 2 | Sage | 10000-20000 | 📿 |
|
|
328
|
+
| 3 | Zenmester | 20000-40000 | ☯️ |
|
|
329
|
+
| 4 | Transcendent | 40000-80000 | 🌟 |
|
|
330
|
+
| 5 | Legendary | 80000+ | 💫 |
|
|
331
|
+
|
|
332
|
+
### Achievements (`achievements.ts`)
|
|
333
|
+
|
|
334
|
+
19 achievements across categories:
|
|
335
|
+
- **Streak**: First Blood, Week Warrior, Streak Master, etc.
|
|
336
|
+
- **Score**: Elite Vibes, Trust Builder, Zen Master, etc.
|
|
337
|
+
- **Sessions**: Getting Started, Centurion, Marathon Coder
|
|
338
|
+
- **Special**: Night Owl, Early Bird, Weekend Warrior, Comeback Kid
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Data Persistence
|
|
343
|
+
|
|
344
|
+
### Profile Storage
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
~/.vibe-check/ # Global (cross-repo)
|
|
348
|
+
├── profile.json # User profile
|
|
349
|
+
└── leaderboards.json # Personal high scores
|
|
350
|
+
|
|
351
|
+
.vibe-check/ # Per-repo (optional)
|
|
352
|
+
└── profile.json # Repo-specific profile
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Profile Migration
|
|
356
|
+
|
|
357
|
+
Profiles auto-migrate when schema changes:
|
|
358
|
+
- Version stored in `profile.version`
|
|
359
|
+
- New fields added with defaults
|
|
360
|
+
- Old data preserved
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Dependencies
|
|
365
|
+
|
|
366
|
+
| Package | Purpose | Version |
|
|
367
|
+
|---------|---------|---------|
|
|
368
|
+
| `commander` | CLI framework | ^14.0.0 |
|
|
369
|
+
| `simple-git` | Git operations | ^3.30.0 |
|
|
370
|
+
| `chalk` | Terminal colors | ^4.1.2 |
|
|
371
|
+
| `date-fns` | Date manipulation | ^4.1.0 |
|
|
372
|
+
| `enquirer` | Interactive prompts | ^2.4.1 |
|
|
373
|
+
|
|
374
|
+
### Dev Dependencies
|
|
375
|
+
|
|
376
|
+
| Package | Purpose |
|
|
377
|
+
|---------|---------|
|
|
378
|
+
| `typescript` | Type checking |
|
|
379
|
+
| `vitest` | Testing |
|
|
380
|
+
| `ts-node` | Dev execution |
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Testing
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
npm test # Run all tests
|
|
388
|
+
npm run test:coverage # With coverage
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Test Structure
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
tests/
|
|
395
|
+
├── metrics/ # Metric calculation tests
|
|
396
|
+
├── gamification/ # XP, streaks, achievements tests
|
|
397
|
+
├── score/ # VibeScore tests
|
|
398
|
+
└── integration/ # End-to-end tests
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Build & Publish
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
npm run build # Compile TypeScript
|
|
407
|
+
npm run dev # Run with ts-node
|
|
408
|
+
npm test # Run tests
|
|
409
|
+
npm publish # Publish to npm (runs prepublishOnly)
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### prepublishOnly Hook
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
"prepublishOnly": "npm run build && npm test"
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Ensures code compiles and tests pass before every publish.
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## Extension Points
|
|
423
|
+
|
|
424
|
+
### Adding a New Metric
|
|
425
|
+
|
|
426
|
+
1. Create `src/metrics/new-metric.ts`
|
|
427
|
+
2. Implement function returning `MetricResult`
|
|
428
|
+
3. Export from `src/metrics/index.ts`
|
|
429
|
+
4. Add to `VibeCheckResult` type
|
|
430
|
+
5. Update `output/terminal.ts` to display
|
|
431
|
+
|
|
432
|
+
### Adding an Achievement
|
|
433
|
+
|
|
434
|
+
1. Add to `ACHIEVEMENTS` array in `achievements.ts`
|
|
435
|
+
2. Define condition function
|
|
436
|
+
3. Add test case
|
|
437
|
+
|
|
438
|
+
### Adding a Command
|
|
439
|
+
|
|
440
|
+
1. Create `src/commands/new-command.ts`
|
|
441
|
+
2. Export from `src/commands/index.ts`
|
|
442
|
+
3. Register in `src/cli.ts`
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Design Principles
|
|
447
|
+
|
|
448
|
+
1. **Semantic-Free** - Analyze patterns, not code content
|
|
449
|
+
2. **Privacy-First** - Never read actual source code
|
|
450
|
+
3. **Git-Native** - All data from git history
|
|
451
|
+
4. **Zero Dependencies Runtime** - No external services
|
|
452
|
+
5. **Offline-First** - Works without network
|
|
453
|
+
6. **Gamification for Engagement** - Make improvement fun
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
**Version:** 1.5.0
|
|
458
|
+
**Last Updated:** 2025-11-29
|