Skip to content

Commit 090f0c2

Browse files
authored
feat: update git collector for RepoIntelData schema (#5)
Add recentChanges to hotspot output and confidence to aiAttribution.
1 parent d79ccde commit 090f0c2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/collectors/git.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Git History Collector
33
*
44
* Collects git history analysis data using the agent-analyzer binary.
5-
* Runs a full git-map init and extracts key metrics for downstream consumers.
5+
* Runs a full repo-intel init and extracts key metrics for downstream consumers.
66
*
77
* @module lib/collectors/git
88
*/
@@ -20,7 +20,7 @@ const DEFAULT_OPTIONS = {
2020
/**
2121
* Collect git history data for the given repository.
2222
*
23-
* Runs agent-analyzer git-map init to produce a full map, then extracts
23+
* Runs agent-analyzer repo-intel init to produce a full map, then extracts
2424
* key metrics (hotspots, bus factor, AI ratio, etc.) from the result.
2525
*
2626
* @param {Object} [options={}] - Collection options
@@ -44,7 +44,7 @@ function collectGitData(options = {}) {
4444

4545
let map;
4646
try {
47-
const json = binary.runAnalyzer(['git-map', 'init', cwd]);
47+
const json = binary.runAnalyzer(['repo-intel', 'init', cwd]);
4848
map = JSON.parse(json);
4949
} catch (err) {
5050
return {
@@ -57,7 +57,6 @@ function collectGitData(options = {}) {
5757
const fileActivity = map.fileActivity || {};
5858
const contributors = map.contributors || {};
5959
const aiAttribution = map.aiAttribution || {};
60-
const commitShape = map.commitShape || {};
6160
const conventions = map.conventions || {};
6261
const releases = map.releases || {};
6362

@@ -66,6 +65,7 @@ function collectGitData(options = {}) {
6665
.map(([path, activity]) => ({
6766
path,
6867
changes: activity.totalChanges || 0,
68+
recentChanges: activity.recentChanges || 0,
6969
authors: activity.authors ? Object.keys(activity.authors).length : 0,
7070
lastChanged: activity.lastChanged || null
7171
}))
@@ -114,25 +114,21 @@ function collectGitData(options = {}) {
114114
attributed: aiAttribution.attributed || 0,
115115
heuristic: aiAttribution.heuristic || 0,
116116
none: aiAttribution.none || 0,
117+
confidence: aiAttribution.confidence || 'low',
117118
tools: aiAttribution.tools || {}
118119
},
119120
busFactor,
120121
conventions: {
121122
style: conventions.style || null,
122123
prefixes: conventions.prefixes || {},
123-
scopes: conventions.scopes || {}
124+
usesScopes: conventions.usesScopes || false
124125
},
125126
releaseInfo: {
126127
tagCount: releases.tags ? releases.tags.length : 0,
127128
lastRelease: releases.tags && releases.tags.length > 0
128129
? releases.tags[releases.tags.length - 1]
129130
: null,
130131
cadence: releases.cadence || null
131-
},
132-
commitShape: {
133-
typicalSize: commitShape.typicalSize || null,
134-
filesPerCommit: commitShape.filesPerCommit || null,
135-
mergeCount: commitShape.mergeCount || 0
136132
}
137133
};
138134
}

0 commit comments

Comments
 (0)