ai-credit 1.0.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/LICENSE +21 -0
- package/README.md +330 -0
- package/dist/analyzer.d.ts +37 -0
- package/dist/analyzer.js +357 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +383 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/reporter.d.ts +60 -0
- package/dist/reporter.js +372 -0
- package/dist/scanners/aider.d.ts +35 -0
- package/dist/scanners/aider.js +194 -0
- package/dist/scanners/base.d.ts +56 -0
- package/dist/scanners/base.js +88 -0
- package/dist/scanners/claude.d.ts +30 -0
- package/dist/scanners/claude.js +203 -0
- package/dist/scanners/codex.d.ts +54 -0
- package/dist/scanners/codex.js +311 -0
- package/dist/scanners/gemini.d.ts +35 -0
- package/dist/scanners/gemini.js +318 -0
- package/dist/scanners/index.d.ts +6 -0
- package/dist/scanners/index.js +6 -0
- package/dist/scanners/opencode.d.ts +40 -0
- package/dist/scanners/opencode.js +210 -0
- package/dist/types.d.ts +103 -0
- package/dist/types.js +11 -0
- package/package.json +46 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported AI coding tools
|
|
3
|
+
*/
|
|
4
|
+
export declare enum AITool {
|
|
5
|
+
CLAUDE_CODE = "claude",
|
|
6
|
+
CODEX = "codex",
|
|
7
|
+
GEMINI = "gemini",
|
|
8
|
+
AIDER = "aider",
|
|
9
|
+
OPENCODE = "opencode"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents a single file change made by an AI tool
|
|
13
|
+
*/
|
|
14
|
+
export interface FileChange {
|
|
15
|
+
filePath: string;
|
|
16
|
+
linesAdded: number;
|
|
17
|
+
linesRemoved: number;
|
|
18
|
+
changeType: 'create' | 'modify' | 'delete';
|
|
19
|
+
timestamp: Date;
|
|
20
|
+
tool: AITool;
|
|
21
|
+
content?: string;
|
|
22
|
+
model?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents an AI session containing multiple file changes
|
|
26
|
+
*/
|
|
27
|
+
export interface AISession {
|
|
28
|
+
id: string;
|
|
29
|
+
tool: AITool;
|
|
30
|
+
timestamp: Date;
|
|
31
|
+
projectPath: string;
|
|
32
|
+
changes: FileChange[];
|
|
33
|
+
totalFilesChanged: number;
|
|
34
|
+
totalLinesAdded: number;
|
|
35
|
+
totalLinesRemoved: number;
|
|
36
|
+
model?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Statistics for a single AI model
|
|
40
|
+
*/
|
|
41
|
+
export interface ModelStats {
|
|
42
|
+
model: string;
|
|
43
|
+
sessionsCount: number;
|
|
44
|
+
filesCreated: number;
|
|
45
|
+
filesModified: number;
|
|
46
|
+
totalFiles: number;
|
|
47
|
+
linesAdded: number;
|
|
48
|
+
linesRemoved: number;
|
|
49
|
+
netLines: number;
|
|
50
|
+
verifiedLines: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Statistics for a single AI tool
|
|
54
|
+
*/
|
|
55
|
+
export interface ToolStats {
|
|
56
|
+
tool: AITool;
|
|
57
|
+
sessionsCount: number;
|
|
58
|
+
filesCreated: number;
|
|
59
|
+
filesModified: number;
|
|
60
|
+
totalFiles: number;
|
|
61
|
+
linesAdded: number;
|
|
62
|
+
linesRemoved: number;
|
|
63
|
+
netLines: number;
|
|
64
|
+
verifiedLines: number;
|
|
65
|
+
byModel: Map<string, ModelStats>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Statistics for a single file
|
|
69
|
+
*/
|
|
70
|
+
export interface FileStats {
|
|
71
|
+
filePath: string;
|
|
72
|
+
totalLines: number;
|
|
73
|
+
aiContributedLines: number;
|
|
74
|
+
aiContributionRatio: number;
|
|
75
|
+
contributions: Map<AITool, number>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Overall contribution statistics
|
|
79
|
+
*/
|
|
80
|
+
export interface ContributionStats {
|
|
81
|
+
repoPath: string;
|
|
82
|
+
scanTime: Date;
|
|
83
|
+
totalFiles: number;
|
|
84
|
+
totalLines: number;
|
|
85
|
+
aiTouchedFiles: number;
|
|
86
|
+
aiContributedLines: number;
|
|
87
|
+
sessions: AISession[];
|
|
88
|
+
byTool: Map<AITool, ToolStats>;
|
|
89
|
+
byFile: Map<string, FileStats>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Output format options
|
|
93
|
+
*/
|
|
94
|
+
export type OutputFormat = 'console' | 'json' | 'markdown';
|
|
95
|
+
/**
|
|
96
|
+
* CLI options
|
|
97
|
+
*/
|
|
98
|
+
export interface CLIOptions {
|
|
99
|
+
format: OutputFormat;
|
|
100
|
+
output?: string;
|
|
101
|
+
tools?: AITool[];
|
|
102
|
+
verbose: boolean;
|
|
103
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported AI coding tools
|
|
3
|
+
*/
|
|
4
|
+
export var AITool;
|
|
5
|
+
(function (AITool) {
|
|
6
|
+
AITool["CLAUDE_CODE"] = "claude";
|
|
7
|
+
AITool["CODEX"] = "codex";
|
|
8
|
+
AITool["GEMINI"] = "gemini";
|
|
9
|
+
AITool["AIDER"] = "aider";
|
|
10
|
+
AITool["OPENCODE"] = "opencode";
|
|
11
|
+
})(AITool || (AITool = {}));
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-credit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tool to track and analyze AI coding assistants' contributions in your codebase",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ai-credit": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"start": "node dist/cli.js",
|
|
13
|
+
"dev": "tsc && node dist/cli.js",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ai",
|
|
18
|
+
"contribution",
|
|
19
|
+
"claude",
|
|
20
|
+
"codex",
|
|
21
|
+
"gemini",
|
|
22
|
+
"aider",
|
|
23
|
+
"code-analysis",
|
|
24
|
+
"cli"
|
|
25
|
+
],
|
|
26
|
+
"author": "",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"chalk": "^5.3.0",
|
|
37
|
+
"cli-table3": "^0.6.5",
|
|
38
|
+
"commander": "^12.1.0",
|
|
39
|
+
"glob": "^10.4.5"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.14.0",
|
|
43
|
+
"tsx": "^4.15.0",
|
|
44
|
+
"typescript": "^5.4.5"
|
|
45
|
+
}
|
|
46
|
+
}
|