@boshu2/vibe-check 1.0.0 → 1.0.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/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/package.json +7 -4
- package/vitest.config.ts +14 -0
- package/src/cli.ts +0 -96
- package/src/git.ts +0 -72
- package/src/metrics/flow.ts +0 -53
- package/src/metrics/index.ts +0 -169
- package/src/metrics/rework.ts +0 -45
- package/src/metrics/spirals.ts +0 -173
- package/src/metrics/trust.ts +0 -80
- package/src/metrics/velocity.ts +0 -86
- package/src/output/index.ts +0 -20
- package/src/output/json.ts +0 -51
- package/src/output/markdown.ts +0 -111
- package/src/output/terminal.ts +0 -109
- package/src/types.ts +0 -68
- package/tsconfig.json +0 -19
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.1] - 2025-11-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- LICENSE file (MIT)
|
|
12
|
+
- CHANGELOG.md
|
|
13
|
+
- .npmignore for cleaner package
|
|
14
|
+
- Jest test suite
|
|
15
|
+
- GitHub Actions CI
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Version now imported from package.json (was hardcoded)
|
|
19
|
+
|
|
20
|
+
## [1.0.0] - 2025-11-28
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- Initial release
|
|
24
|
+
- 5 FAAFO metrics: Iteration Velocity, Rework Ratio, Trust Pass Rate, Debug Spiral Duration, Flow Efficiency
|
|
25
|
+
- Terminal, JSON, and Markdown output formats
|
|
26
|
+
- Debug spiral detection with pattern categorization
|
|
27
|
+
- Conventional commit parsing
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 bodefuller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ Vibe coding is AI-assisted development where you collaborate with an AI coding a
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install -g vibe-check
|
|
12
|
+
npm install -g @boshu2/vibe-check
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Or run directly with npx:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npx vibe-check
|
|
18
|
+
npx @boshu2/vibe-check
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Usage
|
package/dist/cli.js
CHANGED
|
@@ -9,11 +9,13 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const git_1 = require("./git");
|
|
10
10
|
const metrics_1 = require("./metrics");
|
|
11
11
|
const output_1 = require("./output");
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
+
const { version } = require('../package.json');
|
|
12
14
|
const program = new commander_1.Command();
|
|
13
15
|
program
|
|
14
16
|
.name('vibe-check')
|
|
15
17
|
.description('Measure vibe coding effectiveness with git commit analysis')
|
|
16
|
-
.version(
|
|
18
|
+
.version(version)
|
|
17
19
|
.option('--since <date>', 'Start date for analysis (e.g., "1 week ago", "2025-11-01")')
|
|
18
20
|
.option('--until <date>', 'End date for analysis (default: now)')
|
|
19
21
|
.option('-f, --format <type>', 'Output format: terminal, json, markdown', 'terminal')
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,+BAA8C;AAC9C,uCAA2C;AAC3C,qCAAwC;AAGxC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,4DAA4D,CAAC;KACzE,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,gBAAgB,EAAE,4DAA4D,CAAC;KACtF,MAAM,CAAC,gBAAgB,EAAE,sCAAsC,CAAC;KAChE,MAAM,CACL,qBAAqB,EACrB,yCAAyC,EACzC,UAAU,CACX;KACA,MAAM,CAAC,mBAAmB,EAAE,8CAA8C,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KAC1F,MAAM,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AM,GAAG,IAAA,wBAAc,EAAC,OAAO,CAAC,CAAC;QAEvC,gBAAgB;QAChB,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,MAAM,EAAE,MAAsB,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEpB,qDAAqD;QACrD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACpD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boshu2/vibe-check",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Measure vibe coding effectiveness with git commit analysis",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"vibe-check": "
|
|
7
|
+
"vibe-check": "bin/vibe-check.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc",
|
|
11
11
|
"dev": "ts-node src/cli.ts",
|
|
12
12
|
"start": "node dist/cli.js",
|
|
13
|
-
"
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:coverage": "vitest run --coverage",
|
|
15
|
+
"prepublishOnly": "npm run build && npm test"
|
|
14
16
|
},
|
|
15
17
|
"keywords": [
|
|
16
18
|
"vibe-coding",
|
|
@@ -33,8 +35,9 @@
|
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
35
37
|
"@types/node": "^20.17.6",
|
|
38
|
+
"ts-node": "^10.9.2",
|
|
36
39
|
"typescript": "^5.6.3",
|
|
37
|
-
"
|
|
40
|
+
"vitest": "^4.0.14"
|
|
38
41
|
},
|
|
39
42
|
"engines": {
|
|
40
43
|
"node": ">=18.0.0"
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true,
|
|
6
|
+
environment: 'node',
|
|
7
|
+
include: ['tests/**/*.test.ts'],
|
|
8
|
+
coverage: {
|
|
9
|
+
provider: 'v8',
|
|
10
|
+
include: ['src/**/*.ts'],
|
|
11
|
+
exclude: ['src/cli.ts'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
package/src/cli.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { getCommits, isGitRepo } from './git';
|
|
6
|
-
import { analyzeCommits } from './metrics';
|
|
7
|
-
import { formatOutput } from './output';
|
|
8
|
-
import { OutputFormat } from './types';
|
|
9
|
-
|
|
10
|
-
const program = new Command();
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.name('vibe-check')
|
|
14
|
-
.description('Measure vibe coding effectiveness with git commit analysis')
|
|
15
|
-
.version('1.0.0')
|
|
16
|
-
.option('--since <date>', 'Start date for analysis (e.g., "1 week ago", "2025-11-01")')
|
|
17
|
-
.option('--until <date>', 'End date for analysis (default: now)')
|
|
18
|
-
.option(
|
|
19
|
-
'-f, --format <type>',
|
|
20
|
-
'Output format: terminal, json, markdown',
|
|
21
|
-
'terminal'
|
|
22
|
-
)
|
|
23
|
-
.option('-r, --repo <path>', 'Repository path (default: current directory)', process.cwd())
|
|
24
|
-
.option('-v, --verbose', 'Show verbose output', false)
|
|
25
|
-
.action(async (options) => {
|
|
26
|
-
try {
|
|
27
|
-
const { since, until, format, repo, verbose } = options;
|
|
28
|
-
|
|
29
|
-
// Validate format
|
|
30
|
-
const validFormats: OutputFormat[] = ['terminal', 'json', 'markdown'];
|
|
31
|
-
if (!validFormats.includes(format)) {
|
|
32
|
-
console.error(chalk.red(`Invalid format: ${format}`));
|
|
33
|
-
console.error(chalk.gray(`Valid formats: ${validFormats.join(', ')}`));
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Check if repo is valid
|
|
38
|
-
if (!(await isGitRepo(repo))) {
|
|
39
|
-
console.error(chalk.red(`Not a git repository: ${repo}`));
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (verbose) {
|
|
44
|
-
console.error(chalk.gray(`Analyzing repository: ${repo}`));
|
|
45
|
-
if (since) console.error(chalk.gray(`Since: ${since}`));
|
|
46
|
-
if (until) console.error(chalk.gray(`Until: ${until}`));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Get commits
|
|
50
|
-
const commits = await getCommits(repo, since, until);
|
|
51
|
-
|
|
52
|
-
if (commits.length === 0) {
|
|
53
|
-
if (format === 'terminal') {
|
|
54
|
-
console.log(chalk.yellow('\nNo commits found in the specified range.\n'));
|
|
55
|
-
if (!since) {
|
|
56
|
-
console.log(chalk.gray('Try specifying a date range:'));
|
|
57
|
-
console.log(chalk.gray(' vibe-check --since "1 week ago"'));
|
|
58
|
-
console.log(chalk.gray(' vibe-check --since "2025-11-01"'));
|
|
59
|
-
}
|
|
60
|
-
} else if (format === 'json') {
|
|
61
|
-
console.log(JSON.stringify({ error: 'No commits found', commits: 0 }));
|
|
62
|
-
} else {
|
|
63
|
-
console.log('# Vibe-Check Report\n\nNo commits found in the specified range.');
|
|
64
|
-
}
|
|
65
|
-
process.exit(0);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (verbose) {
|
|
69
|
-
console.error(chalk.gray(`Found ${commits.length} commits`));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Analyze commits
|
|
73
|
-
const result = analyzeCommits(commits);
|
|
74
|
-
|
|
75
|
-
// Output result
|
|
76
|
-
const output = formatOutput(result, format as OutputFormat);
|
|
77
|
-
console.log(output);
|
|
78
|
-
|
|
79
|
-
// Exit with appropriate code based on overall rating
|
|
80
|
-
if (result.overall === 'LOW') {
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
if (error instanceof Error) {
|
|
85
|
-
console.error(chalk.red(`Error: ${error.message}`));
|
|
86
|
-
if (options.verbose) {
|
|
87
|
-
console.error(chalk.gray(error.stack));
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
console.error(chalk.red('An unexpected error occurred'));
|
|
91
|
-
}
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
program.parse();
|
package/src/git.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import simpleGit, { SimpleGit, LogResult, DefaultLogFields } from 'simple-git';
|
|
2
|
-
import { Commit } from './types';
|
|
3
|
-
|
|
4
|
-
const COMMIT_TYPES = ['feat', 'fix', 'docs', 'chore', 'refactor', 'test', 'style'] as const;
|
|
5
|
-
|
|
6
|
-
export async function getCommits(
|
|
7
|
-
repoPath: string,
|
|
8
|
-
since?: string,
|
|
9
|
-
until?: string
|
|
10
|
-
): Promise<Commit[]> {
|
|
11
|
-
const git: SimpleGit = simpleGit(repoPath);
|
|
12
|
-
|
|
13
|
-
// Build options for git log
|
|
14
|
-
const options: Record<string, string | number | boolean> = {};
|
|
15
|
-
|
|
16
|
-
if (since) {
|
|
17
|
-
options['--since'] = since;
|
|
18
|
-
}
|
|
19
|
-
if (until) {
|
|
20
|
-
options['--until'] = until;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const log: LogResult<DefaultLogFields> = await git.log(options);
|
|
25
|
-
|
|
26
|
-
return log.all.map((entry) => parseCommit(entry));
|
|
27
|
-
} catch (error) {
|
|
28
|
-
if (error instanceof Error) {
|
|
29
|
-
throw new Error(`Failed to read git log: ${error.message}`);
|
|
30
|
-
}
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function parseCommit(entry: DefaultLogFields): Commit {
|
|
36
|
-
const { hash, date, message, author_name } = entry;
|
|
37
|
-
|
|
38
|
-
// Parse conventional commit format: type(scope): description
|
|
39
|
-
const conventionalMatch = message.match(/^(\w+)(?:\(([^)]+)\))?:\s*(.+)/);
|
|
40
|
-
|
|
41
|
-
let type: Commit['type'] = 'other';
|
|
42
|
-
let scope: string | null = null;
|
|
43
|
-
|
|
44
|
-
if (conventionalMatch) {
|
|
45
|
-
const [, rawType, rawScope] = conventionalMatch;
|
|
46
|
-
const normalizedType = rawType.toLowerCase();
|
|
47
|
-
|
|
48
|
-
if (COMMIT_TYPES.includes(normalizedType as typeof COMMIT_TYPES[number])) {
|
|
49
|
-
type = normalizedType as Commit['type'];
|
|
50
|
-
}
|
|
51
|
-
scope = rawScope || null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
hash: hash.substring(0, 7),
|
|
56
|
-
date: new Date(date),
|
|
57
|
-
message: message.split('\n')[0], // First line only
|
|
58
|
-
type,
|
|
59
|
-
scope,
|
|
60
|
-
author: author_name,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export async function isGitRepo(repoPath: string): Promise<boolean> {
|
|
65
|
-
const git: SimpleGit = simpleGit(repoPath);
|
|
66
|
-
try {
|
|
67
|
-
await git.status();
|
|
68
|
-
return true;
|
|
69
|
-
} catch {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
}
|
package/src/metrics/flow.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { FixChain, MetricResult, Rating } from '../types';
|
|
2
|
-
|
|
3
|
-
export function calculateFlowEfficiency(
|
|
4
|
-
activeMinutes: number,
|
|
5
|
-
spirals: FixChain[]
|
|
6
|
-
): MetricResult {
|
|
7
|
-
if (activeMinutes === 0) {
|
|
8
|
-
return {
|
|
9
|
-
value: 100,
|
|
10
|
-
unit: '%',
|
|
11
|
-
rating: 'elite',
|
|
12
|
-
description: 'No active time recorded',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const spiralMinutes = spirals
|
|
17
|
-
.filter((s) => s.isSpiral)
|
|
18
|
-
.reduce((sum, s) => sum + s.duration, 0);
|
|
19
|
-
|
|
20
|
-
const efficiency = ((activeMinutes - spiralMinutes) / activeMinutes) * 100;
|
|
21
|
-
const clampedEfficiency = Math.max(0, Math.min(100, efficiency));
|
|
22
|
-
const rating = getRating(clampedEfficiency);
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
value: Math.round(clampedEfficiency),
|
|
26
|
-
unit: '%',
|
|
27
|
-
rating,
|
|
28
|
-
description: getDescription(rating, spiralMinutes),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function getRating(efficiency: number): Rating {
|
|
33
|
-
if (efficiency > 90) return 'elite';
|
|
34
|
-
if (efficiency >= 75) return 'high';
|
|
35
|
-
if (efficiency >= 50) return 'medium';
|
|
36
|
-
return 'low';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getDescription(rating: Rating, spiralMinutes: number): string {
|
|
40
|
-
const spiralText =
|
|
41
|
-
spiralMinutes > 0 ? `${spiralMinutes}m spent in debug spirals` : 'No debug spirals';
|
|
42
|
-
|
|
43
|
-
switch (rating) {
|
|
44
|
-
case 'elite':
|
|
45
|
-
return `${spiralText}. Excellent productive flow`;
|
|
46
|
-
case 'high':
|
|
47
|
-
return `${spiralText}. Good balance`;
|
|
48
|
-
case 'medium':
|
|
49
|
-
return `${spiralText}. Significant debugging overhead`;
|
|
50
|
-
case 'low':
|
|
51
|
-
return `${spiralText}. More debugging than building`;
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/metrics/index.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Commit, VibeCheckResult, OverallRating, Rating } from '../types';
|
|
2
|
-
import { calculateIterationVelocity, calculateActiveHours } from './velocity';
|
|
3
|
-
import { calculateReworkRatio } from './rework';
|
|
4
|
-
import { calculateTrustPassRate } from './trust';
|
|
5
|
-
import {
|
|
6
|
-
detectFixChains,
|
|
7
|
-
calculateDebugSpiralDuration,
|
|
8
|
-
calculatePatternSummary,
|
|
9
|
-
} from './spirals';
|
|
10
|
-
import { calculateFlowEfficiency } from './flow';
|
|
11
|
-
|
|
12
|
-
export function analyzeCommits(commits: Commit[]): VibeCheckResult {
|
|
13
|
-
if (commits.length === 0) {
|
|
14
|
-
return emptyResult();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Sort commits by date
|
|
18
|
-
const sorted = [...commits].sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
19
|
-
const from = sorted[0].date;
|
|
20
|
-
const to = sorted[sorted.length - 1].date;
|
|
21
|
-
const activeHours = calculateActiveHours(sorted);
|
|
22
|
-
|
|
23
|
-
// Count commit types
|
|
24
|
-
const commitCounts = countCommitTypes(sorted);
|
|
25
|
-
|
|
26
|
-
// Detect fix chains
|
|
27
|
-
const fixChains = detectFixChains(sorted);
|
|
28
|
-
|
|
29
|
-
// Calculate all metrics
|
|
30
|
-
const iterationVelocity = calculateIterationVelocity(sorted);
|
|
31
|
-
const reworkRatio = calculateReworkRatio(sorted);
|
|
32
|
-
const trustPassRate = calculateTrustPassRate(sorted);
|
|
33
|
-
const debugSpiralDuration = calculateDebugSpiralDuration(fixChains);
|
|
34
|
-
const flowEfficiency = calculateFlowEfficiency(activeHours * 60, fixChains);
|
|
35
|
-
|
|
36
|
-
// Calculate pattern summary
|
|
37
|
-
const patterns = calculatePatternSummary(fixChains);
|
|
38
|
-
|
|
39
|
-
// Determine overall rating
|
|
40
|
-
const overall = calculateOverallRating([
|
|
41
|
-
iterationVelocity.rating,
|
|
42
|
-
reworkRatio.rating,
|
|
43
|
-
trustPassRate.rating,
|
|
44
|
-
debugSpiralDuration.rating,
|
|
45
|
-
flowEfficiency.rating,
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
period: {
|
|
50
|
-
from,
|
|
51
|
-
to,
|
|
52
|
-
activeHours: Math.round(activeHours * 10) / 10,
|
|
53
|
-
},
|
|
54
|
-
commits: commitCounts,
|
|
55
|
-
metrics: {
|
|
56
|
-
iterationVelocity,
|
|
57
|
-
reworkRatio,
|
|
58
|
-
trustPassRate,
|
|
59
|
-
debugSpiralDuration,
|
|
60
|
-
flowEfficiency,
|
|
61
|
-
},
|
|
62
|
-
fixChains,
|
|
63
|
-
patterns,
|
|
64
|
-
overall,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function countCommitTypes(commits: Commit[]): VibeCheckResult['commits'] {
|
|
69
|
-
const counts = {
|
|
70
|
-
total: commits.length,
|
|
71
|
-
feat: 0,
|
|
72
|
-
fix: 0,
|
|
73
|
-
docs: 0,
|
|
74
|
-
other: 0,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
for (const commit of commits) {
|
|
78
|
-
switch (commit.type) {
|
|
79
|
-
case 'feat':
|
|
80
|
-
counts.feat++;
|
|
81
|
-
break;
|
|
82
|
-
case 'fix':
|
|
83
|
-
counts.fix++;
|
|
84
|
-
break;
|
|
85
|
-
case 'docs':
|
|
86
|
-
counts.docs++;
|
|
87
|
-
break;
|
|
88
|
-
default:
|
|
89
|
-
counts.other++;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return counts;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function calculateOverallRating(ratings: Rating[]): OverallRating {
|
|
97
|
-
const scores: Record<Rating, number> = {
|
|
98
|
-
elite: 4,
|
|
99
|
-
high: 3,
|
|
100
|
-
medium: 2,
|
|
101
|
-
low: 1,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const avgScore =
|
|
105
|
-
ratings.reduce((sum, r) => sum + scores[r], 0) / ratings.length;
|
|
106
|
-
|
|
107
|
-
if (avgScore >= 3.5) return 'ELITE';
|
|
108
|
-
if (avgScore >= 2.5) return 'HIGH';
|
|
109
|
-
if (avgScore >= 1.5) return 'MEDIUM';
|
|
110
|
-
return 'LOW';
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function emptyResult(): VibeCheckResult {
|
|
114
|
-
return {
|
|
115
|
-
period: {
|
|
116
|
-
from: new Date(),
|
|
117
|
-
to: new Date(),
|
|
118
|
-
activeHours: 0,
|
|
119
|
-
},
|
|
120
|
-
commits: {
|
|
121
|
-
total: 0,
|
|
122
|
-
feat: 0,
|
|
123
|
-
fix: 0,
|
|
124
|
-
docs: 0,
|
|
125
|
-
other: 0,
|
|
126
|
-
},
|
|
127
|
-
metrics: {
|
|
128
|
-
iterationVelocity: {
|
|
129
|
-
value: 0,
|
|
130
|
-
unit: 'commits/hour',
|
|
131
|
-
rating: 'low',
|
|
132
|
-
description: 'No commits found',
|
|
133
|
-
},
|
|
134
|
-
reworkRatio: {
|
|
135
|
-
value: 0,
|
|
136
|
-
unit: '%',
|
|
137
|
-
rating: 'elite',
|
|
138
|
-
description: 'No commits found',
|
|
139
|
-
},
|
|
140
|
-
trustPassRate: {
|
|
141
|
-
value: 100,
|
|
142
|
-
unit: '%',
|
|
143
|
-
rating: 'elite',
|
|
144
|
-
description: 'No commits found',
|
|
145
|
-
},
|
|
146
|
-
debugSpiralDuration: {
|
|
147
|
-
value: 0,
|
|
148
|
-
unit: 'min',
|
|
149
|
-
rating: 'elite',
|
|
150
|
-
description: 'No debug spirals detected',
|
|
151
|
-
},
|
|
152
|
-
flowEfficiency: {
|
|
153
|
-
value: 100,
|
|
154
|
-
unit: '%',
|
|
155
|
-
rating: 'elite',
|
|
156
|
-
description: 'No active time recorded',
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
fixChains: [],
|
|
160
|
-
patterns: {
|
|
161
|
-
categories: {},
|
|
162
|
-
total: 0,
|
|
163
|
-
tracerAvailable: 0,
|
|
164
|
-
},
|
|
165
|
-
overall: 'HIGH',
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export { calculateActiveHours } from './velocity';
|
package/src/metrics/rework.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Commit, MetricResult, Rating } from '../types';
|
|
2
|
-
|
|
3
|
-
export function calculateReworkRatio(commits: Commit[]): MetricResult {
|
|
4
|
-
if (commits.length === 0) {
|
|
5
|
-
return {
|
|
6
|
-
value: 0,
|
|
7
|
-
unit: '%',
|
|
8
|
-
rating: 'elite',
|
|
9
|
-
description: 'No commits found',
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const fixCommits = commits.filter((c) => c.type === 'fix').length;
|
|
14
|
-
const ratio = (fixCommits / commits.length) * 100;
|
|
15
|
-
const rating = getRating(ratio);
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
value: Math.round(ratio),
|
|
19
|
-
unit: '%',
|
|
20
|
-
rating,
|
|
21
|
-
description: getDescription(rating, fixCommits, commits.length),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getRating(ratio: number): Rating {
|
|
26
|
-
if (ratio < 30) return 'elite';
|
|
27
|
-
if (ratio < 50) return 'high';
|
|
28
|
-
if (ratio < 70) return 'medium';
|
|
29
|
-
return 'low';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function getDescription(rating: Rating, fixes: number, total: number): string {
|
|
33
|
-
const fixText = `${fixes}/${total} commits are fixes`;
|
|
34
|
-
|
|
35
|
-
switch (rating) {
|
|
36
|
-
case 'elite':
|
|
37
|
-
return `${fixText}. Mostly forward progress`;
|
|
38
|
-
case 'high':
|
|
39
|
-
return `${fixText}. Normal for complex work`;
|
|
40
|
-
case 'medium':
|
|
41
|
-
return `${fixText}. Consider validating assumptions before coding`;
|
|
42
|
-
case 'low':
|
|
43
|
-
return `${fixText}. High rework, stop and reassess approach`;
|
|
44
|
-
}
|
|
45
|
-
}
|
package/src/metrics/spirals.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { differenceInMinutes } from 'date-fns';
|
|
2
|
-
import { Commit, FixChain, MetricResult, Rating } from '../types';
|
|
3
|
-
|
|
4
|
-
const SPIRAL_THRESHOLD = 3; // 3+ consecutive fixes = spiral
|
|
5
|
-
|
|
6
|
-
// Pattern detection regexes
|
|
7
|
-
const PATTERNS: Record<string, RegExp> = {
|
|
8
|
-
VOLUME_CONFIG: /volume|mount|path|permission|readonly|pvc|storage/i,
|
|
9
|
-
SECRETS_AUTH: /secret|auth|oauth|token|credential|password|key/i,
|
|
10
|
-
API_MISMATCH: /api|version|field|spec|schema|crd|resource/i,
|
|
11
|
-
SSL_TLS: /ssl|tls|cert|fips|handshake|https/i,
|
|
12
|
-
IMAGE_REGISTRY: /image|pull|registry|docker|tag/i,
|
|
13
|
-
GITOPS_DRIFT: /drift|sync|argocd|reconcil|outof/i,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export function detectFixChains(commits: Commit[]): FixChain[] {
|
|
17
|
-
if (commits.length === 0) return [];
|
|
18
|
-
|
|
19
|
-
// Sort by date ascending
|
|
20
|
-
const sorted = [...commits].sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
21
|
-
|
|
22
|
-
const chains: FixChain[] = [];
|
|
23
|
-
let currentChain: Commit[] = [];
|
|
24
|
-
let currentComponent: string | null = null;
|
|
25
|
-
|
|
26
|
-
for (const commit of sorted) {
|
|
27
|
-
if (commit.type === 'fix') {
|
|
28
|
-
const component = getComponent(commit);
|
|
29
|
-
|
|
30
|
-
if (component === currentComponent || currentComponent === null) {
|
|
31
|
-
currentChain.push(commit);
|
|
32
|
-
currentComponent = component;
|
|
33
|
-
} else {
|
|
34
|
-
// Different component, save current chain if valid
|
|
35
|
-
if (currentChain.length >= SPIRAL_THRESHOLD) {
|
|
36
|
-
chains.push(createFixChain(currentChain, currentComponent));
|
|
37
|
-
}
|
|
38
|
-
currentChain = [commit];
|
|
39
|
-
currentComponent = component;
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
// Non-fix commit breaks the chain
|
|
43
|
-
if (currentChain.length >= SPIRAL_THRESHOLD && currentComponent) {
|
|
44
|
-
chains.push(createFixChain(currentChain, currentComponent));
|
|
45
|
-
}
|
|
46
|
-
currentChain = [];
|
|
47
|
-
currentComponent = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Handle final chain
|
|
52
|
-
if (currentChain.length >= SPIRAL_THRESHOLD && currentComponent) {
|
|
53
|
-
chains.push(createFixChain(currentChain, currentComponent));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return chains;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function getComponent(commit: Commit): string {
|
|
60
|
-
// Use scope if available
|
|
61
|
-
if (commit.scope) {
|
|
62
|
-
return commit.scope.toLowerCase();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Extract first meaningful word from message
|
|
66
|
-
const words = commit.message
|
|
67
|
-
.replace(/^fix\s*:?\s*/i, '')
|
|
68
|
-
.split(/\s+/)
|
|
69
|
-
.filter((w) => w.length > 2);
|
|
70
|
-
|
|
71
|
-
return words[0]?.toLowerCase() || 'unknown';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function createFixChain(commits: Commit[], component: string): FixChain {
|
|
75
|
-
const firstCommit = commits[0].date;
|
|
76
|
-
const lastCommit = commits[commits.length - 1].date;
|
|
77
|
-
const duration = differenceInMinutes(lastCommit, firstCommit);
|
|
78
|
-
|
|
79
|
-
// Detect pattern from commit messages
|
|
80
|
-
const allMessages = commits.map((c) => c.message).join(' ');
|
|
81
|
-
const pattern = detectPattern(allMessages);
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
component,
|
|
85
|
-
commits: commits.length,
|
|
86
|
-
duration,
|
|
87
|
-
isSpiral: commits.length >= SPIRAL_THRESHOLD,
|
|
88
|
-
pattern,
|
|
89
|
-
firstCommit,
|
|
90
|
-
lastCommit,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function detectPattern(text: string): string | null {
|
|
95
|
-
for (const [pattern, regex] of Object.entries(PATTERNS)) {
|
|
96
|
-
if (regex.test(text)) {
|
|
97
|
-
return pattern;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function calculateDebugSpiralDuration(chains: FixChain[]): MetricResult {
|
|
104
|
-
const spirals = chains.filter((c) => c.isSpiral);
|
|
105
|
-
|
|
106
|
-
if (spirals.length === 0) {
|
|
107
|
-
return {
|
|
108
|
-
value: 0,
|
|
109
|
-
unit: 'min',
|
|
110
|
-
rating: 'elite',
|
|
111
|
-
description: 'No debug spirals detected',
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const totalDuration = spirals.reduce((sum, s) => sum + s.duration, 0);
|
|
116
|
-
const avgDuration = totalDuration / spirals.length;
|
|
117
|
-
const rating = getRating(avgDuration);
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
value: Math.round(avgDuration),
|
|
121
|
-
unit: 'min',
|
|
122
|
-
rating,
|
|
123
|
-
description: getDescription(rating, spirals.length),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function getRating(duration: number): Rating {
|
|
128
|
-
if (duration < 15) return 'elite';
|
|
129
|
-
if (duration < 30) return 'high';
|
|
130
|
-
if (duration < 60) return 'medium';
|
|
131
|
-
return 'low';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function getDescription(rating: Rating, spiralCount: number): string {
|
|
135
|
-
const spiralText = spiralCount === 1 ? '1 spiral' : `${spiralCount} spirals`;
|
|
136
|
-
|
|
137
|
-
switch (rating) {
|
|
138
|
-
case 'elite':
|
|
139
|
-
return `${spiralText} resolved quickly`;
|
|
140
|
-
case 'high':
|
|
141
|
-
return `${spiralText}, normal debugging time`;
|
|
142
|
-
case 'medium':
|
|
143
|
-
return `${spiralText}, consider using tracer tests`;
|
|
144
|
-
case 'low':
|
|
145
|
-
return `${spiralText}, extended debugging. Use tracer tests before implementation`;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export function calculatePatternSummary(chains: FixChain[]): {
|
|
150
|
-
categories: Record<string, number>;
|
|
151
|
-
total: number;
|
|
152
|
-
tracerAvailable: number;
|
|
153
|
-
} {
|
|
154
|
-
const categories: Record<string, number> = {};
|
|
155
|
-
let total = 0;
|
|
156
|
-
let withTracer = 0;
|
|
157
|
-
|
|
158
|
-
for (const chain of chains) {
|
|
159
|
-
const pattern = chain.pattern || 'OTHER';
|
|
160
|
-
categories[pattern] = (categories[pattern] || 0) + chain.commits;
|
|
161
|
-
total += chain.commits;
|
|
162
|
-
|
|
163
|
-
if (chain.pattern) {
|
|
164
|
-
withTracer += chain.commits;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
categories,
|
|
170
|
-
total,
|
|
171
|
-
tracerAvailable: total > 0 ? Math.round((withTracer / total) * 100) : 0,
|
|
172
|
-
};
|
|
173
|
-
}
|
package/src/metrics/trust.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { differenceInMinutes } from 'date-fns';
|
|
2
|
-
import { Commit, MetricResult, Rating } from '../types';
|
|
3
|
-
|
|
4
|
-
const FOLLOWUP_WINDOW_MINUTES = 30;
|
|
5
|
-
|
|
6
|
-
export function calculateTrustPassRate(commits: Commit[]): MetricResult {
|
|
7
|
-
if (commits.length === 0) {
|
|
8
|
-
return {
|
|
9
|
-
value: 100,
|
|
10
|
-
unit: '%',
|
|
11
|
-
rating: 'elite',
|
|
12
|
-
description: 'No commits found',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Sort by date ascending
|
|
17
|
-
const sorted = [...commits].sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
18
|
-
|
|
19
|
-
let trustedCommits = 0;
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
22
|
-
const commit = sorted[i];
|
|
23
|
-
const nextCommit = sorted[i + 1];
|
|
24
|
-
|
|
25
|
-
// Check if next commit is a fix to same component within 30 min
|
|
26
|
-
const needsFollowup =
|
|
27
|
-
nextCommit &&
|
|
28
|
-
nextCommit.type === 'fix' &&
|
|
29
|
-
sameComponent(commit, nextCommit) &&
|
|
30
|
-
differenceInMinutes(nextCommit.date, commit.date) < FOLLOWUP_WINDOW_MINUTES;
|
|
31
|
-
|
|
32
|
-
if (!needsFollowup) {
|
|
33
|
-
trustedCommits++;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const rate = (trustedCommits / commits.length) * 100;
|
|
38
|
-
const rating = getRating(rate);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
value: Math.round(rate),
|
|
42
|
-
unit: '%',
|
|
43
|
-
rating,
|
|
44
|
-
description: getDescription(rating),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function sameComponent(a: Commit, b: Commit): boolean {
|
|
49
|
-
// If both have scopes, compare them
|
|
50
|
-
if (a.scope && b.scope) {
|
|
51
|
-
return a.scope.toLowerCase() === b.scope.toLowerCase();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// If neither has scope, check if messages reference same area
|
|
55
|
-
// This is a simple heuristic - first word after type
|
|
56
|
-
const aWords = a.message.split(/\s+/).slice(0, 3);
|
|
57
|
-
const bWords = b.message.split(/\s+/).slice(0, 3);
|
|
58
|
-
|
|
59
|
-
return aWords.some((word) => bWords.includes(word) && word.length > 3);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function getRating(rate: number): Rating {
|
|
63
|
-
if (rate > 95) return 'elite';
|
|
64
|
-
if (rate >= 80) return 'high';
|
|
65
|
-
if (rate >= 60) return 'medium';
|
|
66
|
-
return 'low';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getDescription(rating: Rating): string {
|
|
70
|
-
switch (rating) {
|
|
71
|
-
case 'elite':
|
|
72
|
-
return 'Code sticks on first try, high AI trust';
|
|
73
|
-
case 'high':
|
|
74
|
-
return 'Occasional fixes needed, mostly autonomous';
|
|
75
|
-
case 'medium':
|
|
76
|
-
return 'Regular intervention required';
|
|
77
|
-
case 'low':
|
|
78
|
-
return 'Heavy oversight needed, run tracer tests before implementation';
|
|
79
|
-
}
|
|
80
|
-
}
|
package/src/metrics/velocity.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { differenceInMinutes } from 'date-fns';
|
|
2
|
-
import { Commit, MetricResult, Rating } from '../types';
|
|
3
|
-
|
|
4
|
-
const SESSION_GAP_MINUTES = 120; // 2 hours = new session
|
|
5
|
-
|
|
6
|
-
export function calculateIterationVelocity(commits: Commit[]): MetricResult {
|
|
7
|
-
if (commits.length === 0) {
|
|
8
|
-
return {
|
|
9
|
-
value: 0,
|
|
10
|
-
unit: 'commits/hour',
|
|
11
|
-
rating: 'low',
|
|
12
|
-
description: 'No commits found',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const activeHours = calculateActiveHours(commits);
|
|
17
|
-
|
|
18
|
-
if (activeHours === 0) {
|
|
19
|
-
return {
|
|
20
|
-
value: commits.length,
|
|
21
|
-
unit: 'commits/hour',
|
|
22
|
-
rating: 'high',
|
|
23
|
-
description: 'All commits in rapid succession',
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const velocity = commits.length / activeHours;
|
|
28
|
-
const rating = getRating(velocity);
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
value: Math.round(velocity * 10) / 10,
|
|
32
|
-
unit: 'commits/hour',
|
|
33
|
-
rating,
|
|
34
|
-
description: getDescription(rating),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function calculateActiveHours(commits: Commit[]): number {
|
|
39
|
-
if (commits.length < 2) {
|
|
40
|
-
return 0.1; // Minimum to avoid division by zero
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Sort by date ascending
|
|
44
|
-
const sorted = [...commits].sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
45
|
-
|
|
46
|
-
let totalMinutes = 0;
|
|
47
|
-
let sessionStart = sorted[0].date;
|
|
48
|
-
|
|
49
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
50
|
-
const gap = differenceInMinutes(sorted[i].date, sorted[i - 1].date);
|
|
51
|
-
|
|
52
|
-
if (gap > SESSION_GAP_MINUTES) {
|
|
53
|
-
// End current session, start new one
|
|
54
|
-
totalMinutes += differenceInMinutes(sorted[i - 1].date, sessionStart);
|
|
55
|
-
sessionStart = sorted[i].date;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Add final session
|
|
60
|
-
totalMinutes += differenceInMinutes(sorted[sorted.length - 1].date, sessionStart);
|
|
61
|
-
|
|
62
|
-
// Minimum of 10 minutes per session to account for work between commits
|
|
63
|
-
const minMinutes = Math.max(totalMinutes, commits.length * 10);
|
|
64
|
-
|
|
65
|
-
return minMinutes / 60;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function getRating(velocity: number): Rating {
|
|
69
|
-
if (velocity > 5) return 'elite';
|
|
70
|
-
if (velocity >= 3) return 'high';
|
|
71
|
-
if (velocity >= 1) return 'medium';
|
|
72
|
-
return 'low';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getDescription(rating: Rating): string {
|
|
76
|
-
switch (rating) {
|
|
77
|
-
case 'elite':
|
|
78
|
-
return 'Excellent iteration speed, tight feedback loops';
|
|
79
|
-
case 'high':
|
|
80
|
-
return 'Good iteration speed';
|
|
81
|
-
case 'medium':
|
|
82
|
-
return 'Normal pace';
|
|
83
|
-
case 'low':
|
|
84
|
-
return 'Slow iteration, consider smaller commits';
|
|
85
|
-
}
|
|
86
|
-
}
|
package/src/output/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { VibeCheckResult, OutputFormat } from '../types';
|
|
2
|
-
import { formatTerminal } from './terminal';
|
|
3
|
-
import { formatJson } from './json';
|
|
4
|
-
import { formatMarkdown } from './markdown';
|
|
5
|
-
|
|
6
|
-
export function formatOutput(result: VibeCheckResult, format: OutputFormat): string {
|
|
7
|
-
switch (format) {
|
|
8
|
-
case 'json':
|
|
9
|
-
return formatJson(result);
|
|
10
|
-
case 'markdown':
|
|
11
|
-
return formatMarkdown(result);
|
|
12
|
-
case 'terminal':
|
|
13
|
-
default:
|
|
14
|
-
return formatTerminal(result);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { formatTerminal } from './terminal';
|
|
19
|
-
export { formatJson } from './json';
|
|
20
|
-
export { formatMarkdown } from './markdown';
|
package/src/output/json.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { VibeCheckResult } from '../types';
|
|
2
|
-
|
|
3
|
-
export function formatJson(result: VibeCheckResult): string {
|
|
4
|
-
// Create a JSON-friendly version with ISO date strings
|
|
5
|
-
const output = {
|
|
6
|
-
period: {
|
|
7
|
-
from: result.period.from.toISOString(),
|
|
8
|
-
to: result.period.to.toISOString(),
|
|
9
|
-
activeHours: result.period.activeHours,
|
|
10
|
-
},
|
|
11
|
-
commits: result.commits,
|
|
12
|
-
metrics: {
|
|
13
|
-
iterationVelocity: {
|
|
14
|
-
value: result.metrics.iterationVelocity.value,
|
|
15
|
-
unit: result.metrics.iterationVelocity.unit,
|
|
16
|
-
rating: result.metrics.iterationVelocity.rating,
|
|
17
|
-
},
|
|
18
|
-
reworkRatio: {
|
|
19
|
-
value: result.metrics.reworkRatio.value,
|
|
20
|
-
unit: result.metrics.reworkRatio.unit,
|
|
21
|
-
rating: result.metrics.reworkRatio.rating,
|
|
22
|
-
},
|
|
23
|
-
trustPassRate: {
|
|
24
|
-
value: result.metrics.trustPassRate.value,
|
|
25
|
-
unit: result.metrics.trustPassRate.unit,
|
|
26
|
-
rating: result.metrics.trustPassRate.rating,
|
|
27
|
-
},
|
|
28
|
-
debugSpiralDuration: {
|
|
29
|
-
value: result.metrics.debugSpiralDuration.value,
|
|
30
|
-
unit: result.metrics.debugSpiralDuration.unit,
|
|
31
|
-
rating: result.metrics.debugSpiralDuration.rating,
|
|
32
|
-
},
|
|
33
|
-
flowEfficiency: {
|
|
34
|
-
value: result.metrics.flowEfficiency.value,
|
|
35
|
-
unit: result.metrics.flowEfficiency.unit,
|
|
36
|
-
rating: result.metrics.flowEfficiency.rating,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
fixChains: result.fixChains.map((chain) => ({
|
|
40
|
-
component: chain.component,
|
|
41
|
-
commits: chain.commits,
|
|
42
|
-
duration: chain.duration,
|
|
43
|
-
isSpiral: chain.isSpiral,
|
|
44
|
-
pattern: chain.pattern,
|
|
45
|
-
})),
|
|
46
|
-
patterns: result.patterns,
|
|
47
|
-
overall: result.overall,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return JSON.stringify(output, null, 2);
|
|
51
|
-
}
|
package/src/output/markdown.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { VibeCheckResult } from '../types';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
|
-
|
|
4
|
-
export function formatMarkdown(result: VibeCheckResult): string {
|
|
5
|
-
const lines: string[] = [];
|
|
6
|
-
|
|
7
|
-
// Header
|
|
8
|
-
lines.push('# Vibe-Check Report');
|
|
9
|
-
lines.push('');
|
|
10
|
-
|
|
11
|
-
// Period
|
|
12
|
-
const fromStr = format(result.period.from, 'MMM d, yyyy');
|
|
13
|
-
const toStr = format(result.period.to, 'MMM d, yyyy');
|
|
14
|
-
lines.push(`**Period:** ${fromStr} - ${toStr} (${result.period.activeHours}h active)`);
|
|
15
|
-
lines.push(
|
|
16
|
-
`**Commits:** ${result.commits.total} total (${result.commits.feat} feat, ${result.commits.fix} fix, ${result.commits.docs} docs, ${result.commits.other} other)`
|
|
17
|
-
);
|
|
18
|
-
lines.push('');
|
|
19
|
-
|
|
20
|
-
// Overall
|
|
21
|
-
lines.push(`**Overall Rating:** ${result.overall}`);
|
|
22
|
-
lines.push('');
|
|
23
|
-
|
|
24
|
-
// Metrics table
|
|
25
|
-
lines.push('## Metrics');
|
|
26
|
-
lines.push('');
|
|
27
|
-
lines.push('| Metric | Value | Rating | Description |');
|
|
28
|
-
lines.push('|--------|-------|--------|-------------|');
|
|
29
|
-
|
|
30
|
-
const metrics = [
|
|
31
|
-
{ name: 'Iteration Velocity', metric: result.metrics.iterationVelocity },
|
|
32
|
-
{ name: 'Rework Ratio', metric: result.metrics.reworkRatio },
|
|
33
|
-
{ name: 'Trust Pass Rate', metric: result.metrics.trustPassRate },
|
|
34
|
-
{ name: 'Debug Spiral Duration', metric: result.metrics.debugSpiralDuration },
|
|
35
|
-
{ name: 'Flow Efficiency', metric: result.metrics.flowEfficiency },
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
for (const { name, metric } of metrics) {
|
|
39
|
-
const rating = metric.rating.toUpperCase();
|
|
40
|
-
lines.push(
|
|
41
|
-
`| ${name} | ${metric.value}${metric.unit} | ${rating} | ${metric.description} |`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
lines.push('');
|
|
45
|
-
|
|
46
|
-
// Debug spirals
|
|
47
|
-
if (result.fixChains.length > 0) {
|
|
48
|
-
lines.push('## Debug Spirals');
|
|
49
|
-
lines.push('');
|
|
50
|
-
lines.push('| Component | Commits | Duration | Pattern |');
|
|
51
|
-
lines.push('|-----------|---------|----------|---------|');
|
|
52
|
-
|
|
53
|
-
for (const chain of result.fixChains) {
|
|
54
|
-
const pattern = chain.pattern || '-';
|
|
55
|
-
lines.push(
|
|
56
|
-
`| ${chain.component} | ${chain.commits} | ${chain.duration}m | ${pattern} |`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
lines.push('');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Patterns
|
|
63
|
-
if (result.patterns.total > 0) {
|
|
64
|
-
lines.push('## Pattern Analysis');
|
|
65
|
-
lines.push('');
|
|
66
|
-
lines.push('| Pattern | Fix Count | Tracer Available |');
|
|
67
|
-
lines.push('|---------|-----------|------------------|');
|
|
68
|
-
|
|
69
|
-
for (const [pattern, count] of Object.entries(result.patterns.categories)) {
|
|
70
|
-
const tracer = pattern !== 'OTHER' ? 'Yes' : 'No';
|
|
71
|
-
lines.push(`| ${pattern} | ${count} | ${tracer} |`);
|
|
72
|
-
}
|
|
73
|
-
lines.push('');
|
|
74
|
-
lines.push(
|
|
75
|
-
`**${result.patterns.tracerAvailable}%** of fix patterns have tracer tests available.`
|
|
76
|
-
);
|
|
77
|
-
lines.push('');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Recommendations
|
|
81
|
-
lines.push('## Recommendations');
|
|
82
|
-
lines.push('');
|
|
83
|
-
|
|
84
|
-
if (result.metrics.reworkRatio.rating === 'low') {
|
|
85
|
-
lines.push('- High rework ratio detected. Consider running tracer tests before implementation.');
|
|
86
|
-
}
|
|
87
|
-
if (result.metrics.trustPassRate.rating === 'low' || result.metrics.trustPassRate.rating === 'medium') {
|
|
88
|
-
lines.push('- Trust pass rate below target. Validate assumptions before coding.');
|
|
89
|
-
}
|
|
90
|
-
if (result.metrics.debugSpiralDuration.rating === 'low') {
|
|
91
|
-
lines.push('- Long debug spirals detected. Break work into smaller, verifiable steps.');
|
|
92
|
-
}
|
|
93
|
-
if (result.fixChains.length > 0) {
|
|
94
|
-
const patterns = result.fixChains
|
|
95
|
-
.filter((c) => c.pattern)
|
|
96
|
-
.map((c) => c.pattern);
|
|
97
|
-
if (patterns.length > 0) {
|
|
98
|
-
lines.push(`- Consider adding tracer tests for: ${[...new Set(patterns)].join(', ')}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (lines[lines.length - 1] === '') {
|
|
103
|
-
lines.push('- All metrics healthy. Maintain current practices.');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
lines.push('');
|
|
107
|
-
lines.push('---');
|
|
108
|
-
lines.push(`*Generated by vibe-check on ${format(new Date(), 'yyyy-MM-dd HH:mm')}*`);
|
|
109
|
-
|
|
110
|
-
return lines.join('\n');
|
|
111
|
-
}
|
package/src/output/terminal.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { VibeCheckResult, Rating, OverallRating } from '../types';
|
|
3
|
-
import { format } from 'date-fns';
|
|
4
|
-
|
|
5
|
-
export function formatTerminal(result: VibeCheckResult): string {
|
|
6
|
-
const lines: string[] = [];
|
|
7
|
-
|
|
8
|
-
// Header
|
|
9
|
-
lines.push('');
|
|
10
|
-
lines.push(chalk.bold.cyan('=' .repeat(64)));
|
|
11
|
-
lines.push(chalk.bold.cyan(' VIBE-CHECK RESULTS'));
|
|
12
|
-
lines.push(chalk.bold.cyan('=' .repeat(64)));
|
|
13
|
-
|
|
14
|
-
// Period info
|
|
15
|
-
const fromStr = format(result.period.from, 'MMM d, yyyy');
|
|
16
|
-
const toStr = format(result.period.to, 'MMM d, yyyy');
|
|
17
|
-
lines.push('');
|
|
18
|
-
lines.push(
|
|
19
|
-
chalk.gray(` Period: ${fromStr} - ${toStr} (${result.period.activeHours}h active)`)
|
|
20
|
-
);
|
|
21
|
-
lines.push(
|
|
22
|
-
chalk.gray(
|
|
23
|
-
` Commits: ${result.commits.total} total (${result.commits.feat} feat, ${result.commits.fix} fix, ${result.commits.docs} docs, ${result.commits.other} other)`
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
// Metrics table
|
|
28
|
-
lines.push('');
|
|
29
|
-
lines.push(chalk.bold.white(' METRIC VALUE RATING'));
|
|
30
|
-
lines.push(chalk.gray(' ' + '-'.repeat(50)));
|
|
31
|
-
|
|
32
|
-
const metrics = [
|
|
33
|
-
{ name: 'Iteration Velocity', metric: result.metrics.iterationVelocity },
|
|
34
|
-
{ name: 'Rework Ratio', metric: result.metrics.reworkRatio },
|
|
35
|
-
{ name: 'Trust Pass Rate', metric: result.metrics.trustPassRate },
|
|
36
|
-
{ name: 'Debug Spiral Duration', metric: result.metrics.debugSpiralDuration },
|
|
37
|
-
{ name: 'Flow Efficiency', metric: result.metrics.flowEfficiency },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
for (const { name, metric } of metrics) {
|
|
41
|
-
const valueStr = `${metric.value}${metric.unit}`.padEnd(10);
|
|
42
|
-
const ratingStr = formatRating(metric.rating);
|
|
43
|
-
lines.push(` ${name.padEnd(26)} ${valueStr} ${ratingStr}`);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Overall rating
|
|
47
|
-
lines.push('');
|
|
48
|
-
lines.push(chalk.bold.cyan('-'.repeat(64)));
|
|
49
|
-
lines.push(` ${chalk.bold('OVERALL:')} ${formatOverallRating(result.overall)}`);
|
|
50
|
-
lines.push(chalk.bold.cyan('-'.repeat(64)));
|
|
51
|
-
|
|
52
|
-
// Debug spirals
|
|
53
|
-
if (result.fixChains.length > 0) {
|
|
54
|
-
lines.push('');
|
|
55
|
-
lines.push(
|
|
56
|
-
chalk.bold.yellow(` DEBUG SPIRALS (${result.fixChains.length} detected):`)
|
|
57
|
-
);
|
|
58
|
-
for (const chain of result.fixChains) {
|
|
59
|
-
const patternStr = chain.pattern ? ` (${chain.pattern})` : '';
|
|
60
|
-
lines.push(
|
|
61
|
-
chalk.yellow(
|
|
62
|
-
` - ${chain.component}: ${chain.commits} commits, ${chain.duration}m${patternStr}`
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Patterns
|
|
69
|
-
if (result.patterns.total > 0) {
|
|
70
|
-
lines.push('');
|
|
71
|
-
lines.push(chalk.bold.magenta(' PATTERNS:'));
|
|
72
|
-
for (const [pattern, count] of Object.entries(result.patterns.categories)) {
|
|
73
|
-
const tracerNote = pattern !== 'OTHER' ? ' (tracer available)' : '';
|
|
74
|
-
lines.push(chalk.magenta(` - ${pattern}: ${count} fixes${tracerNote}`));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
lines.push('');
|
|
79
|
-
lines.push(chalk.bold.cyan('=' .repeat(64)));
|
|
80
|
-
lines.push('');
|
|
81
|
-
|
|
82
|
-
return lines.join('\n');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function formatRating(rating: Rating): string {
|
|
86
|
-
switch (rating) {
|
|
87
|
-
case 'elite':
|
|
88
|
-
return chalk.green.bold('ELITE');
|
|
89
|
-
case 'high':
|
|
90
|
-
return chalk.blue.bold('HIGH');
|
|
91
|
-
case 'medium':
|
|
92
|
-
return chalk.yellow.bold('MEDIUM');
|
|
93
|
-
case 'low':
|
|
94
|
-
return chalk.red.bold('LOW');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function formatOverallRating(rating: OverallRating): string {
|
|
99
|
-
switch (rating) {
|
|
100
|
-
case 'ELITE':
|
|
101
|
-
return chalk.green.bold('ELITE');
|
|
102
|
-
case 'HIGH':
|
|
103
|
-
return chalk.blue.bold('HIGH');
|
|
104
|
-
case 'MEDIUM':
|
|
105
|
-
return chalk.yellow.bold('MEDIUM');
|
|
106
|
-
case 'LOW':
|
|
107
|
-
return chalk.red.bold('LOW');
|
|
108
|
-
}
|
|
109
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export type Rating = 'elite' | 'high' | 'medium' | 'low';
|
|
2
|
-
export type OutputFormat = 'terminal' | 'json' | 'markdown';
|
|
3
|
-
export type OverallRating = 'ELITE' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
4
|
-
|
|
5
|
-
export interface Commit {
|
|
6
|
-
hash: string;
|
|
7
|
-
date: Date;
|
|
8
|
-
message: string;
|
|
9
|
-
type: 'feat' | 'fix' | 'docs' | 'chore' | 'refactor' | 'test' | 'style' | 'other';
|
|
10
|
-
scope: string | null;
|
|
11
|
-
author: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface MetricResult {
|
|
15
|
-
value: number;
|
|
16
|
-
unit: string;
|
|
17
|
-
rating: Rating;
|
|
18
|
-
description: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface FixChain {
|
|
22
|
-
component: string;
|
|
23
|
-
commits: number;
|
|
24
|
-
duration: number; // minutes
|
|
25
|
-
isSpiral: boolean;
|
|
26
|
-
pattern: string | null;
|
|
27
|
-
firstCommit: Date;
|
|
28
|
-
lastCommit: Date;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface PatternSummary {
|
|
32
|
-
categories: Record<string, number>;
|
|
33
|
-
total: number;
|
|
34
|
-
tracerAvailable: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface VibeCheckResult {
|
|
38
|
-
period: {
|
|
39
|
-
from: Date;
|
|
40
|
-
to: Date;
|
|
41
|
-
activeHours: number;
|
|
42
|
-
};
|
|
43
|
-
commits: {
|
|
44
|
-
total: number;
|
|
45
|
-
feat: number;
|
|
46
|
-
fix: number;
|
|
47
|
-
docs: number;
|
|
48
|
-
other: number;
|
|
49
|
-
};
|
|
50
|
-
metrics: {
|
|
51
|
-
iterationVelocity: MetricResult;
|
|
52
|
-
reworkRatio: MetricResult;
|
|
53
|
-
trustPassRate: MetricResult;
|
|
54
|
-
debugSpiralDuration: MetricResult;
|
|
55
|
-
flowEfficiency: MetricResult;
|
|
56
|
-
};
|
|
57
|
-
fixChains: FixChain[];
|
|
58
|
-
patterns: PatternSummary;
|
|
59
|
-
overall: OverallRating;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface CliOptions {
|
|
63
|
-
since?: string;
|
|
64
|
-
until?: string;
|
|
65
|
-
format: OutputFormat;
|
|
66
|
-
repo: string;
|
|
67
|
-
verbose: boolean;
|
|
68
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2020"],
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"sourceMap": true
|
|
16
|
-
},
|
|
17
|
-
"include": ["src/**/*"],
|
|
18
|
-
"exclude": ["node_modules", "dist"]
|
|
19
|
-
}
|