@tonycasey/lisa 2.25.4 → 2.26.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/dist/lib/application/handlers/SessionStartHandler.d.ts +15 -0
- package/dist/lib/application/handlers/SessionStartHandler.d.ts.map +1 -1
- package/dist/lib/application/handlers/SessionStartHandler.js +116 -5
- package/dist/lib/application/handlers/SessionStartHandler.js.map +1 -1
- package/dist/lib/application/services/GitTriageService.d.ts +45 -0
- package/dist/lib/application/services/GitTriageService.d.ts.map +1 -0
- package/dist/lib/application/services/GitTriageService.js +360 -0
- package/dist/lib/application/services/GitTriageService.js.map +1 -0
- package/dist/lib/application/services/SessionContextFormatter.d.ts +11 -1
- package/dist/lib/application/services/SessionContextFormatter.d.ts.map +1 -1
- package/dist/lib/application/services/SessionContextFormatter.js +59 -3
- package/dist/lib/application/services/SessionContextFormatter.js.map +1 -1
- package/dist/lib/application/services/index.d.ts +1 -0
- package/dist/lib/application/services/index.d.ts.map +1 -1
- package/dist/lib/application/services/index.js +3 -1
- package/dist/lib/application/services/index.js.map +1 -1
- package/dist/lib/domain/interfaces/ICommitEnricher.d.ts +81 -0
- package/dist/lib/domain/interfaces/ICommitEnricher.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/ICommitEnricher.js +33 -0
- package/dist/lib/domain/interfaces/ICommitEnricher.js.map +1 -0
- package/dist/lib/domain/interfaces/IGitClient.d.ts +86 -0
- package/dist/lib/domain/interfaces/IGitClient.d.ts.map +1 -1
- package/dist/lib/domain/interfaces/IGitTriageService.d.ts +180 -0
- package/dist/lib/domain/interfaces/IGitTriageService.d.ts.map +1 -0
- package/dist/lib/domain/interfaces/IGitTriageService.js +12 -0
- package/dist/lib/domain/interfaces/IGitTriageService.js.map +1 -0
- package/dist/lib/domain/interfaces/ILisaServices.d.ts +6 -0
- package/dist/lib/domain/interfaces/ILisaServices.d.ts.map +1 -1
- package/dist/lib/domain/interfaces/index.d.ts +3 -1
- package/dist/lib/domain/interfaces/index.d.ts.map +1 -1
- package/dist/lib/domain/interfaces/index.js +4 -1
- package/dist/lib/domain/interfaces/index.js.map +1 -1
- package/dist/lib/infrastructure/adapters/claude/session-start.d.ts +1 -0
- package/dist/lib/infrastructure/adapters/claude/session-start.d.ts.map +1 -1
- package/dist/lib/infrastructure/adapters/claude/session-start.js +18 -4
- package/dist/lib/infrastructure/adapters/claude/session-start.js.map +1 -1
- package/dist/lib/infrastructure/di/ServiceFactory.d.ts +2 -0
- package/dist/lib/infrastructure/di/ServiceFactory.d.ts.map +1 -1
- package/dist/lib/infrastructure/di/bootstrap.d.ts.map +1 -1
- package/dist/lib/infrastructure/di/bootstrap.js +11 -1
- package/dist/lib/infrastructure/di/bootstrap.js.map +1 -1
- package/dist/lib/infrastructure/di/tokens.d.ts +2 -0
- package/dist/lib/infrastructure/di/tokens.d.ts.map +1 -1
- package/dist/lib/infrastructure/di/tokens.js +1 -0
- package/dist/lib/infrastructure/di/tokens.js.map +1 -1
- package/dist/lib/infrastructure/git/GitClient.d.ts +11 -1
- package/dist/lib/infrastructure/git/GitClient.d.ts.map +1 -1
- package/dist/lib/infrastructure/git/GitClient.js +137 -0
- package/dist/lib/infrastructure/git/GitClient.js.map +1 -1
- package/dist/lib/infrastructure/logging/Logger.d.ts +13 -1
- package/dist/lib/infrastructure/logging/Logger.d.ts.map +1 -1
- package/dist/lib/infrastructure/logging/Logger.js +25 -7
- package/dist/lib/infrastructure/logging/Logger.js.map +1 -1
- package/dist/lib/infrastructure/logging/factory.d.ts +5 -1
- package/dist/lib/infrastructure/logging/factory.d.ts.map +1 -1
- package/dist/lib/infrastructure/logging/factory.js +3 -0
- package/dist/lib/infrastructure/logging/factory.js.map +1 -1
- package/dist/lib/infrastructure/logging/index.d.ts +1 -1
- package/dist/lib/infrastructure/logging/index.d.ts.map +1 -1
- package/dist/lib/infrastructure/logging/index.js.map +1 -1
- package/dist/lib/infrastructure/services/CommitEnricher.d.ts +26 -0
- package/dist/lib/infrastructure/services/CommitEnricher.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/CommitEnricher.js +214 -0
- package/dist/lib/infrastructure/services/CommitEnricher.js.map +1 -0
- package/dist/lib/infrastructure/services/prompts/commit-extraction.d.ts +26 -0
- package/dist/lib/infrastructure/services/prompts/commit-extraction.d.ts.map +1 -0
- package/dist/lib/infrastructure/services/prompts/commit-extraction.js +151 -0
- package/dist/lib/infrastructure/services/prompts/commit-extraction.js.map +1 -0
- package/dist/opencode/lisa.js +907 -18
- package/dist/package.json +1 -1
- package/dist/project/.lisa/rules/shared/git-rules.md +12 -3
- package/package.json +1 -1
|
@@ -20,9 +20,11 @@ export declare class SessionStartHandler implements IRequestHandler<SessionStart
|
|
|
20
20
|
private readonly router?;
|
|
21
21
|
private readonly logger?;
|
|
22
22
|
private readonly githubSync?;
|
|
23
|
+
private readonly commitEnricher?;
|
|
23
24
|
private readonly formatter;
|
|
24
25
|
private readonly gitService;
|
|
25
26
|
private readonly memoryLoader;
|
|
27
|
+
private readonly triageService;
|
|
26
28
|
/**
|
|
27
29
|
* Create a new SessionStartHandler.
|
|
28
30
|
*
|
|
@@ -51,6 +53,19 @@ export declare class SessionStartHandler implements IRequestHandler<SessionStart
|
|
|
51
53
|
* Sync GitHub issues on startup (fire-and-forget).
|
|
52
54
|
*/
|
|
53
55
|
private syncGitHubOnStartup;
|
|
56
|
+
/**
|
|
57
|
+
* Run git triage to analyze commit history.
|
|
58
|
+
* Returns null if triage fails (non-blocking).
|
|
59
|
+
*/
|
|
60
|
+
private runGitTriage;
|
|
61
|
+
/**
|
|
62
|
+
* Enrich high-interest commits and save facts to memory (fire-and-forget).
|
|
63
|
+
*/
|
|
64
|
+
private enrichAndSaveCommits;
|
|
65
|
+
/**
|
|
66
|
+
* Check which commits have already been enriched (by short SHA tag in memory).
|
|
67
|
+
*/
|
|
68
|
+
private checkEnrichedCommits;
|
|
54
69
|
/**
|
|
55
70
|
* Compute date options based on trigger type.
|
|
56
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStartHandler.d.ts","sourceRoot":"","sources":["../../../../src/lib/application/handlers/SessionStartHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EAIV,OAAO,EAEP,UAAU,
|
|
1
|
+
{"version":3,"file":"SessionStartHandler.d.ts","sourceRoot":"","sources":["../../../../src/lib/application/handlers/SessionStartHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EAIV,OAAO,EAEP,UAAU,EAKX,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAW3D;;;;;;;GAOG;AACH,qBAAa,mBAAoB,YAAW,eAAe,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IACnG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAkB;IAGlD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0B;IACrD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsB;IACnD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAElD;;;;;OAKG;gBACS,QAAQ,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,UAAU;IAE3D;;;;;;;;;;;OAWG;gBAED,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,UAAU,EACf,MAAM,CAAC,EAAE,iBAAiB,EAC1B,MAAM,CAAC,EAAE,OAAO,EAChB,UAAU,CAAC,EAAE,kBAAkB,EAC/B,SAAS,CAAC,EAAE,UAAU;IA2DxB;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA4DxE;;OAEG;YACW,mBAAmB;IAgCjC;;;OAGG;YACW,YAAY;IAmB1B;;OAEG;YACW,oBAAoB;IA8DlC;;OAEG;YACW,oBAAoB;IAyBlC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAgCpB;;OAEG;IACH,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,UAAU;CAKnB"}
|
|
@@ -5,6 +5,7 @@ const domain_1 = require("../../domain");
|
|
|
5
5
|
const SessionContextFormatter_1 = require("../services/SessionContextFormatter");
|
|
6
6
|
const GitIntrospectionService_1 = require("../services/GitIntrospectionService");
|
|
7
7
|
const MemoryContextLoader_1 = require("../services/MemoryContextLoader");
|
|
8
|
+
const GitTriageService_1 = require("../services/GitTriageService");
|
|
8
9
|
/**
|
|
9
10
|
* Configuration for recent memories display.
|
|
10
11
|
*/
|
|
@@ -30,6 +31,7 @@ class SessionStartHandler {
|
|
|
30
31
|
this.router = services.router;
|
|
31
32
|
this.logger = services.logger;
|
|
32
33
|
this.githubSync = services.githubSync;
|
|
34
|
+
this.commitEnricher = services.commitEnricher;
|
|
33
35
|
resolvedGitClient = memoryOrGitClient;
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
@@ -53,6 +55,7 @@ class SessionStartHandler {
|
|
|
53
55
|
this.formatter = new SessionContextFormatter_1.SessionContextFormatter();
|
|
54
56
|
this.gitService = new GitIntrospectionService_1.GitIntrospectionService(resolvedGitClient);
|
|
55
57
|
this.memoryLoader = new MemoryContextLoader_1.MemoryContextLoader(this.memory, this.tasks, this.mcp, this.router, this.logger);
|
|
58
|
+
this.triageService = new GitTriageService_1.GitTriageService(resolvedGitClient);
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Handle a session start request.
|
|
@@ -63,15 +66,25 @@ class SessionStartHandler {
|
|
|
63
66
|
await this.syncGitHubOnStartup(request.trigger, hierarchicalGroupIds, projectName);
|
|
64
67
|
// Determine date options based on trigger
|
|
65
68
|
const dateOptions = this.computeDateOptions(request.trigger);
|
|
66
|
-
// Load memory
|
|
67
|
-
const memories = await
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
// Load memory and run git triage in parallel
|
|
70
|
+
const [memories, gitTriage] = await Promise.all([
|
|
71
|
+
this.memoryLoader.loadMemory(hierarchicalGroupIds, projectAliases, branch, dateOptions),
|
|
72
|
+
this.runGitTriage(dateOptions.since, projectRoot),
|
|
73
|
+
]);
|
|
74
|
+
// Load recent git commits as fallback (only if triage didn't run)
|
|
75
|
+
const gitCommits = gitTriage
|
|
76
|
+
? []
|
|
77
|
+
: await this.gitService.loadGitCommits(dateOptions.since, projectRoot);
|
|
78
|
+
// Enrich high-interest commits (fire-and-forget, non-blocking)
|
|
79
|
+
if (gitTriage && request.trigger === 'startup') {
|
|
80
|
+
this.enrichAndSaveCommits(gitTriage.highInterest, hierarchicalGroupIds[0])
|
|
81
|
+
.catch(err => this.logger?.warn('Commit enrichment failed', { error: err.message }));
|
|
82
|
+
}
|
|
70
83
|
// Process tasks from memory
|
|
71
84
|
const tasks = this.processTasks(memories.tasks);
|
|
72
85
|
const taskCounts = this.countTasks(tasks);
|
|
73
86
|
// Build context content
|
|
74
|
-
const contextContent = this.formatter.formatContextContent(request.trigger, memories, tasks, taskCounts, { projectName, userName, folderType, projectRoot, branch }, gitCommits, dateOptions.since);
|
|
87
|
+
const contextContent = this.formatter.formatContextContent(request.trigger, memories, tasks, taskCounts, { projectName, userName, folderType, projectRoot, branch }, gitCommits, dateOptions.since, gitTriage);
|
|
75
88
|
// Build message
|
|
76
89
|
const message = this.formatter.getTriggerMessage(request.trigger, memories.timedOut);
|
|
77
90
|
return {
|
|
@@ -112,6 +125,104 @@ class SessionStartHandler {
|
|
|
112
125
|
this.logger?.warn('GitHub sync failed', { error: error.message });
|
|
113
126
|
}
|
|
114
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Run git triage to analyze commit history.
|
|
130
|
+
* Returns null if triage fails (non-blocking).
|
|
131
|
+
*/
|
|
132
|
+
async runGitTriage(since, projectRoot) {
|
|
133
|
+
try {
|
|
134
|
+
const result = await this.triageService.triage({
|
|
135
|
+
since,
|
|
136
|
+
cwd: projectRoot,
|
|
137
|
+
});
|
|
138
|
+
this.logger?.debug('Git triage completed', {
|
|
139
|
+
total: result.totalCommits,
|
|
140
|
+
highInterest: result.highInterest.length,
|
|
141
|
+
durationMs: result.durationMs,
|
|
142
|
+
});
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
// Don't fail session start if triage fails
|
|
147
|
+
this.logger?.warn('Git triage failed', { error: error.message });
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Enrich high-interest commits and save facts to memory (fire-and-forget).
|
|
153
|
+
*/
|
|
154
|
+
async enrichAndSaveCommits(commits, groupId) {
|
|
155
|
+
if (!this.commitEnricher || commits.length === 0)
|
|
156
|
+
return;
|
|
157
|
+
try {
|
|
158
|
+
// Check which commits are already enriched (by short SHA tag)
|
|
159
|
+
const existingShas = await this.checkEnrichedCommits(groupId);
|
|
160
|
+
const toEnrich = commits.filter(c => !existingShas.has(c.commit.shortSha));
|
|
161
|
+
if (toEnrich.length === 0) {
|
|
162
|
+
this.logger?.debug('All commits already enriched, skipping');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this.logger?.debug('Enriching commits', { count: toEnrich.length });
|
|
166
|
+
const result = await this.commitEnricher.enrich(toEnrich, { maxCommits: 5 });
|
|
167
|
+
if (result.facts.length === 0) {
|
|
168
|
+
this.logger?.debug('No facts extracted from commits');
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// Build a canonical short SHA map for consistent tagging (dedup uses shortSha)
|
|
172
|
+
const shaToShort = new Map();
|
|
173
|
+
for (const commit of toEnrich) {
|
|
174
|
+
if (commit.commit.sha && commit.commit.shortSha) {
|
|
175
|
+
shaToShort.set(commit.commit.sha, commit.commit.shortSha);
|
|
176
|
+
shaToShort.set(commit.commit.shortSha, commit.commit.shortSha);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Save facts to memory with proper metadata
|
|
180
|
+
for (const fact of result.facts) {
|
|
181
|
+
// Normalize SHA to short form for consistent dedup
|
|
182
|
+
const commitSha = shaToShort.get(fact.commitSha) ?? fact.commitSha;
|
|
183
|
+
const tags = [
|
|
184
|
+
'type:commit-enrichment',
|
|
185
|
+
`commit:${commitSha}`,
|
|
186
|
+
`factType:${fact.type}`,
|
|
187
|
+
`confidence:${fact.confidence}`,
|
|
188
|
+
'source:git-enrichment',
|
|
189
|
+
...fact.tags.map(t => `tag:${t}`),
|
|
190
|
+
];
|
|
191
|
+
await this.memory.addFact(groupId, fact.text, tags);
|
|
192
|
+
}
|
|
193
|
+
this.logger?.info('Commit enrichment complete', {
|
|
194
|
+
processed: result.commitsProcessed,
|
|
195
|
+
facts: result.facts.length,
|
|
196
|
+
inputTokens: result.usage.inputTokens,
|
|
197
|
+
outputTokens: result.usage.outputTokens,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
// Non-blocking - log and continue
|
|
202
|
+
this.logger?.warn('Commit enrichment error', { error: error.message });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Check which commits have already been enriched (by short SHA tag in memory).
|
|
207
|
+
*/
|
|
208
|
+
async checkEnrichedCommits(groupId) {
|
|
209
|
+
const enrichedShas = new Set();
|
|
210
|
+
try {
|
|
211
|
+
// Search for existing commit enrichment facts
|
|
212
|
+
const existingFacts = await this.memory.searchFacts([groupId], 'type:commit-enrichment', 100);
|
|
213
|
+
for (const fact of existingFacts) {
|
|
214
|
+
const shaTag = fact.tags?.find(t => t.startsWith('commit:'));
|
|
215
|
+
if (shaTag) {
|
|
216
|
+
enrichedShas.add(shaTag.replace('commit:', ''));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
// If search fails, return empty set (will re-enrich)
|
|
222
|
+
this.logger?.debug('Could not check existing enrichments', { error: error.message });
|
|
223
|
+
}
|
|
224
|
+
return enrichedShas;
|
|
225
|
+
}
|
|
115
226
|
/**
|
|
116
227
|
* Compute date options based on trigger type.
|
|
117
228
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStartHandler.js","sourceRoot":"","sources":["../../../../src/lib/application/handlers/SessionStartHandler.ts"],"names":[],"mappings":";;;AAgBA,yCAA+C;AAI/C,iFAA8E;AAC9E,iFAA8E;AAC9E,yEAAsE;AAEtE;;GAEG;AACH,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB;;;;;;;GAOG;AACH,MAAa,mBAAmB;IA6C9B,YACE,iBAA+C,EAC/C,iBAA+C,EAC/C,KAAoB,EACpB,GAAgB,EAChB,MAA0B,EAC1B,MAAgB,EAChB,UAA+B,EAC/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C,CAAC;IACzB,CAAC;CACF;AApZD,kDAoZC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitTriageService
|
|
3
|
+
*
|
|
4
|
+
* Application service that scans git history and scores commits
|
|
5
|
+
* for "interestingness" to identify which commits warrant API enrichment.
|
|
6
|
+
*
|
|
7
|
+
* Part of the Git-Powered Memory feature (LISA-7).
|
|
8
|
+
*/
|
|
9
|
+
import type { IGitClient } from '../../domain/interfaces/IGitClient';
|
|
10
|
+
import type { IGitTriageService, IGitCommitData, IGitCommitStats, IScoredCommit, ITriageResult, ITriageOptions } from '../../domain/interfaces/IGitTriageService';
|
|
11
|
+
export declare class GitTriageService implements IGitTriageService {
|
|
12
|
+
private readonly git;
|
|
13
|
+
constructor(git: IGitClient);
|
|
14
|
+
triage(options?: ITriageOptions): Promise<ITriageResult>;
|
|
15
|
+
scoreCommit(commit: IGitCommitData, stats: IGitCommitStats | null, tagShas: ReadonlySet<string>, isTagAdjacent?: boolean): IScoredCommit;
|
|
16
|
+
/**
|
|
17
|
+
* Parse raw git log commit into domain type.
|
|
18
|
+
*/
|
|
19
|
+
private parseCommit;
|
|
20
|
+
/**
|
|
21
|
+
* Parse raw stat entries into domain type.
|
|
22
|
+
*/
|
|
23
|
+
private parseStats;
|
|
24
|
+
/**
|
|
25
|
+
* Detect interest signals for a commit.
|
|
26
|
+
*/
|
|
27
|
+
private detectSignals;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate interest score from signals.
|
|
30
|
+
*/
|
|
31
|
+
private calculateScore;
|
|
32
|
+
/**
|
|
33
|
+
* Get default "since" date (3 months ago).
|
|
34
|
+
*/
|
|
35
|
+
private getDefaultSince;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a tag name looks like a version tag.
|
|
38
|
+
*/
|
|
39
|
+
private isVersionTag;
|
|
40
|
+
/**
|
|
41
|
+
* Create an empty result (for repos with no commits in range).
|
|
42
|
+
*/
|
|
43
|
+
private emptyResult;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=GitTriageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitTriageService.d.ts","sourceRoot":"","sources":["../../../../src/lib/application/services/GitTriageService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAsC,MAAM,oCAAoC,CAAC;AACzG,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EAEf,aAAa,EACb,aAAa,EACb,cAAc,EAGf,MAAM,2CAA2C,CAAC;AAiFnD,qBAAa,gBAAiB,YAAW,iBAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,UAAU;IAEtC,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAyI9D,WAAW,CACT,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,eAAe,GAAG,IAAI,EAC7B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5B,aAAa,CAAC,EAAE,OAAO,GACtB,aAAa;IAehB;;OAEG;IACH,OAAO,CAAC,WAAW;IAoBnB;;OAEG;IACH,OAAO,CAAC,UAAU;IAmClB;;OAEG;IACH,OAAO,CAAC,aAAa;IA8CrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAetB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,WAAW;CAapB"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GitTriageService
|
|
4
|
+
*
|
|
5
|
+
* Application service that scans git history and scores commits
|
|
6
|
+
* for "interestingness" to identify which commits warrant API enrichment.
|
|
7
|
+
*
|
|
8
|
+
* Part of the Git-Powered Memory feature (LISA-7).
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.GitTriageService = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Default triage threshold score.
|
|
14
|
+
* Commits scoring >= this value are considered high-interest.
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_THRESHOLD = 3;
|
|
17
|
+
/**
|
|
18
|
+
* Default lookback period in days.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_DAYS = 90; // 3 months
|
|
21
|
+
/**
|
|
22
|
+
* Conventional commit prefixes to detect.
|
|
23
|
+
*/
|
|
24
|
+
const CONVENTIONAL_PREFIXES = [
|
|
25
|
+
'feat',
|
|
26
|
+
'fix',
|
|
27
|
+
'refactor',
|
|
28
|
+
'docs',
|
|
29
|
+
'test',
|
|
30
|
+
'chore',
|
|
31
|
+
'style',
|
|
32
|
+
'perf',
|
|
33
|
+
'ci',
|
|
34
|
+
'build',
|
|
35
|
+
'revert',
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Regex pattern for detecting conventional commit prefixes.
|
|
39
|
+
* Built from the CONVENTIONAL_PREFIXES array for consistency.
|
|
40
|
+
*/
|
|
41
|
+
const CONVENTIONAL_COMMIT_REGEX = new RegExp(`^(${CONVENTIONAL_PREFIXES.join('|')})(\\(.+\\))?[!]?:`, 'i');
|
|
42
|
+
/**
|
|
43
|
+
* Decision keywords that indicate architectural/design decisions.
|
|
44
|
+
*/
|
|
45
|
+
const DECISION_KEYWORDS = [
|
|
46
|
+
'migrate',
|
|
47
|
+
'replace',
|
|
48
|
+
'rewrite',
|
|
49
|
+
'deprecate',
|
|
50
|
+
'breaking',
|
|
51
|
+
'workaround',
|
|
52
|
+
'decision',
|
|
53
|
+
'architecture',
|
|
54
|
+
'redesign',
|
|
55
|
+
'overhaul',
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Scoring weights for interest signals.
|
|
59
|
+
*/
|
|
60
|
+
const SCORES = {
|
|
61
|
+
largeDiffFiles: 3, // 10+ files changed
|
|
62
|
+
largeDiffLines: 2, // 500+ lines changed
|
|
63
|
+
mergeCommitWithPR: 3, // merge commit with PR reference
|
|
64
|
+
conventionalPrefix: 1, // has conventional commit prefix
|
|
65
|
+
decisionKeywords: 2, // contains decision keywords
|
|
66
|
+
createsNewDirectory: 2, // creates new top-level dir
|
|
67
|
+
tagAdjacent: 2, // within N commits of a tag
|
|
68
|
+
longMessageBody: 1, // multi-line body
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* How close a commit must be to a tag to be "tag-adjacent".
|
|
72
|
+
*/
|
|
73
|
+
const TAG_ADJACENT_DISTANCE = 3;
|
|
74
|
+
/**
|
|
75
|
+
* Margin below threshold to fetch detailed stats.
|
|
76
|
+
* Commits scoring (threshold - STAT_FETCH_MARGIN) or higher get stats fetched,
|
|
77
|
+
* since stats-based signals could push them over the threshold.
|
|
78
|
+
*/
|
|
79
|
+
const STAT_FETCH_MARGIN = 2;
|
|
80
|
+
class GitTriageService {
|
|
81
|
+
constructor(git) {
|
|
82
|
+
this.git = git;
|
|
83
|
+
}
|
|
84
|
+
async triage(options) {
|
|
85
|
+
const startTime = Date.now();
|
|
86
|
+
const threshold = options?.threshold ?? DEFAULT_THRESHOLD;
|
|
87
|
+
const cwd = options?.cwd;
|
|
88
|
+
// Calculate date range
|
|
89
|
+
const since = options?.since ?? this.getDefaultSince();
|
|
90
|
+
const until = options?.until ?? new Date();
|
|
91
|
+
// Fetch all tags first (for tag-adjacency scoring)
|
|
92
|
+
const tags = this.git.listTags(cwd);
|
|
93
|
+
const tagShas = new Set(tags.map(t => t.sha));
|
|
94
|
+
const tagInfo = tags.map(t => ({
|
|
95
|
+
name: t.name,
|
|
96
|
+
sha: t.sha,
|
|
97
|
+
isVersionTag: this.isVersionTag(t.name),
|
|
98
|
+
}));
|
|
99
|
+
// Fetch commits in the date range
|
|
100
|
+
const rawCommits = this.git.logDetailed({
|
|
101
|
+
since: since.toISOString(),
|
|
102
|
+
until: until.toISOString(),
|
|
103
|
+
maxCount: options?.maxCommits,
|
|
104
|
+
cwd,
|
|
105
|
+
});
|
|
106
|
+
if (rawCommits.length === 0) {
|
|
107
|
+
return this.emptyResult(startTime, tagInfo);
|
|
108
|
+
}
|
|
109
|
+
// Build a map of SHA -> position for tag adjacency
|
|
110
|
+
const shaToPosition = new Map();
|
|
111
|
+
for (let i = 0; i < rawCommits.length; i++) {
|
|
112
|
+
shaToPosition.set(rawCommits[i].sha, i);
|
|
113
|
+
}
|
|
114
|
+
// Find positions of tagged commits for adjacency check
|
|
115
|
+
const tagPositions = new Set();
|
|
116
|
+
for (const tag of tags) {
|
|
117
|
+
const pos = shaToPosition.get(tag.sha);
|
|
118
|
+
if (pos !== undefined) {
|
|
119
|
+
// Mark positions within TAG_ADJACENT_DISTANCE
|
|
120
|
+
for (let i = Math.max(0, pos - TAG_ADJACENT_DISTANCE); i <= pos + TAG_ADJACENT_DISTANCE; i++) {
|
|
121
|
+
tagPositions.add(i);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Track file hotspots
|
|
126
|
+
const fileStats = new Map();
|
|
127
|
+
// Score each commit
|
|
128
|
+
const scoredCommits = [];
|
|
129
|
+
const belowThreshold = [];
|
|
130
|
+
const minorInterest = [];
|
|
131
|
+
for (let i = 0; i < rawCommits.length; i++) {
|
|
132
|
+
const raw = rawCommits[i];
|
|
133
|
+
const commit = this.parseCommit(raw);
|
|
134
|
+
// Check if tag-adjacent based on position
|
|
135
|
+
const isTagAdjacent = tagPositions.has(i);
|
|
136
|
+
// Quick scoring without stats first
|
|
137
|
+
const quickSignals = this.detectSignals(commit, null, tagShas, isTagAdjacent);
|
|
138
|
+
const quickScore = this.calculateScore(quickSignals);
|
|
139
|
+
// If score is already high enough or we want all stats, fetch detailed stats
|
|
140
|
+
let stats = null;
|
|
141
|
+
let finalSignals = quickSignals;
|
|
142
|
+
let finalScore = quickScore;
|
|
143
|
+
if (quickScore >= threshold - STAT_FETCH_MARGIN || options?.fetchAllStats) {
|
|
144
|
+
// Fetch stats for borderline or high-interest commits
|
|
145
|
+
const rawStats = this.git.getCommitStats(commit.sha, cwd);
|
|
146
|
+
stats = this.parseStats(rawStats);
|
|
147
|
+
// Re-score with stats
|
|
148
|
+
finalSignals = this.detectSignals(commit, stats, tagShas, isTagAdjacent);
|
|
149
|
+
finalScore = this.calculateScore(finalSignals);
|
|
150
|
+
// Update hotspots
|
|
151
|
+
for (const entry of rawStats) {
|
|
152
|
+
const existing = fileStats.get(entry.path) ?? { commits: 0, lines: 0 };
|
|
153
|
+
existing.commits++;
|
|
154
|
+
existing.lines += (entry.added ?? 0) + (entry.deleted ?? 0);
|
|
155
|
+
fileStats.set(entry.path, existing);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const scored = {
|
|
159
|
+
commit,
|
|
160
|
+
stats,
|
|
161
|
+
signals: finalSignals,
|
|
162
|
+
score: finalScore,
|
|
163
|
+
passedTriage: finalScore >= threshold,
|
|
164
|
+
};
|
|
165
|
+
if (finalScore >= threshold) {
|
|
166
|
+
scoredCommits.push(scored);
|
|
167
|
+
}
|
|
168
|
+
else if (finalScore > 0) {
|
|
169
|
+
minorInterest.push(scored);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
belowThreshold.push(scored);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Sort high-interest by score descending
|
|
176
|
+
scoredCommits.sort((a, b) => b.score - a.score);
|
|
177
|
+
// Build hotspots list (top 20)
|
|
178
|
+
const hotspots = Array.from(fileStats.entries())
|
|
179
|
+
.map(([path, data]) => ({
|
|
180
|
+
path,
|
|
181
|
+
commitCount: data.commits,
|
|
182
|
+
totalLinesChanged: data.lines,
|
|
183
|
+
}))
|
|
184
|
+
.sort((a, b) => b.commitCount - a.commitCount || b.totalLinesChanged - a.totalLinesChanged)
|
|
185
|
+
.slice(0, 20);
|
|
186
|
+
// Count PR links and tag links
|
|
187
|
+
const linkedToPRs = scoredCommits.filter(s => s.signals.prNumber !== null).length;
|
|
188
|
+
const linkedToTags = scoredCommits.filter(s => s.signals.isTagAdjacent).length;
|
|
189
|
+
return {
|
|
190
|
+
totalCommits: rawCommits.length,
|
|
191
|
+
belowThreshold: belowThreshold.length,
|
|
192
|
+
minorInterest: minorInterest.length,
|
|
193
|
+
highInterest: scoredCommits,
|
|
194
|
+
linkedToPRs,
|
|
195
|
+
linkedToTags,
|
|
196
|
+
hotspots,
|
|
197
|
+
tags: tagInfo,
|
|
198
|
+
durationMs: Date.now() - startTime,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
scoreCommit(commit, stats, tagShas, isTagAdjacent) {
|
|
202
|
+
// Use provided adjacency or fall back to checking if commit is itself tagged
|
|
203
|
+
const tagAdjacent = isTagAdjacent ?? tagShas.has(commit.sha);
|
|
204
|
+
const signals = this.detectSignals(commit, stats, tagShas, tagAdjacent);
|
|
205
|
+
const score = this.calculateScore(signals);
|
|
206
|
+
return {
|
|
207
|
+
commit,
|
|
208
|
+
stats,
|
|
209
|
+
signals,
|
|
210
|
+
score,
|
|
211
|
+
passedTriage: score >= DEFAULT_THRESHOLD,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Parse raw git log commit into domain type.
|
|
216
|
+
*/
|
|
217
|
+
parseCommit(raw) {
|
|
218
|
+
// Extract refs (tags, branches) from ref names string
|
|
219
|
+
const refs = raw.refNames
|
|
220
|
+
.split(',')
|
|
221
|
+
.map(r => r.trim())
|
|
222
|
+
.filter(r => r && r !== 'HEAD');
|
|
223
|
+
return {
|
|
224
|
+
sha: raw.sha,
|
|
225
|
+
shortSha: raw.shortSha,
|
|
226
|
+
subject: raw.subject,
|
|
227
|
+
body: raw.body,
|
|
228
|
+
parentCount: raw.parentShas.length,
|
|
229
|
+
author: raw.authorName,
|
|
230
|
+
authorEmail: raw.authorEmail,
|
|
231
|
+
timestamp: new Date(raw.authorTimestamp * 1000),
|
|
232
|
+
refs,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Parse raw stat entries into domain type.
|
|
237
|
+
*/
|
|
238
|
+
parseStats(entries) {
|
|
239
|
+
let insertions = 0;
|
|
240
|
+
let deletions = 0;
|
|
241
|
+
const filesAdded = [];
|
|
242
|
+
const filesDeleted = [];
|
|
243
|
+
const directories = new Set();
|
|
244
|
+
for (const entry of entries) {
|
|
245
|
+
insertions += entry.added ?? 0;
|
|
246
|
+
deletions += entry.deleted ?? 0;
|
|
247
|
+
if (entry.isNew) {
|
|
248
|
+
filesAdded.push(entry.path);
|
|
249
|
+
// Track directories for new files
|
|
250
|
+
const dir = entry.path.split('/')[0];
|
|
251
|
+
if (dir && dir !== entry.path) {
|
|
252
|
+
directories.add(dir);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (entry.isDeleted) {
|
|
256
|
+
filesDeleted.push(entry.path);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
filesChanged: entries.length,
|
|
261
|
+
insertions,
|
|
262
|
+
deletions,
|
|
263
|
+
filesAdded,
|
|
264
|
+
filesDeleted,
|
|
265
|
+
directoriesCreated: Array.from(directories),
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Detect interest signals for a commit.
|
|
270
|
+
*/
|
|
271
|
+
detectSignals(commit, stats, _tagShas, isTagAdjacent) {
|
|
272
|
+
// Large diff detection
|
|
273
|
+
const largeDiffFiles = stats !== null && stats.filesChanged >= 10;
|
|
274
|
+
const largeDiffLines = stats !== null && (stats.insertions + stats.deletions) >= 500;
|
|
275
|
+
// Merge commit with PR
|
|
276
|
+
const prMatch = commit.subject.match(/Merge pull request #(\d+)/i)
|
|
277
|
+
?? commit.subject.match(/\(#(\d+)\)/)
|
|
278
|
+
?? commit.body.match(/PR[:\s#]+(\d+)/i);
|
|
279
|
+
const prNumber = prMatch ? parseInt(prMatch[1], 10) : null;
|
|
280
|
+
const mergeCommitWithPR = commit.parentCount >= 2 && prNumber !== null;
|
|
281
|
+
// Conventional commit (using centralized regex built from CONVENTIONAL_PREFIXES)
|
|
282
|
+
const conventionalMatch = commit.subject.match(CONVENTIONAL_COMMIT_REGEX);
|
|
283
|
+
const hasConventionalPrefix = conventionalMatch !== null;
|
|
284
|
+
const conventionalType = conventionalMatch ? conventionalMatch[1].toLowerCase() : null;
|
|
285
|
+
// Decision keywords
|
|
286
|
+
const messageText = `${commit.subject} ${commit.body}`.toLowerCase();
|
|
287
|
+
const hasDecisionKeywords = DECISION_KEYWORDS.some(kw => messageText.includes(kw));
|
|
288
|
+
// New directory detection
|
|
289
|
+
const createsNewDirectory = stats !== null && stats.directoriesCreated.length > 0;
|
|
290
|
+
// Long message body
|
|
291
|
+
const hasLongMessageBody = commit.body.split('\n').filter(l => l.trim()).length >= 2;
|
|
292
|
+
return {
|
|
293
|
+
largeDiffFiles,
|
|
294
|
+
largeDiffLines,
|
|
295
|
+
mergeCommitWithPR,
|
|
296
|
+
hasConventionalPrefix,
|
|
297
|
+
conventionalType,
|
|
298
|
+
hasDecisionKeywords,
|
|
299
|
+
createsNewDirectory,
|
|
300
|
+
isTagAdjacent,
|
|
301
|
+
hasLongMessageBody,
|
|
302
|
+
prNumber,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Calculate interest score from signals.
|
|
307
|
+
*/
|
|
308
|
+
calculateScore(signals) {
|
|
309
|
+
let score = 0;
|
|
310
|
+
if (signals.largeDiffFiles)
|
|
311
|
+
score += SCORES.largeDiffFiles;
|
|
312
|
+
if (signals.largeDiffLines)
|
|
313
|
+
score += SCORES.largeDiffLines;
|
|
314
|
+
if (signals.mergeCommitWithPR)
|
|
315
|
+
score += SCORES.mergeCommitWithPR;
|
|
316
|
+
if (signals.hasConventionalPrefix)
|
|
317
|
+
score += SCORES.conventionalPrefix;
|
|
318
|
+
if (signals.hasDecisionKeywords)
|
|
319
|
+
score += SCORES.decisionKeywords;
|
|
320
|
+
if (signals.createsNewDirectory)
|
|
321
|
+
score += SCORES.createsNewDirectory;
|
|
322
|
+
if (signals.isTagAdjacent)
|
|
323
|
+
score += SCORES.tagAdjacent;
|
|
324
|
+
if (signals.hasLongMessageBody)
|
|
325
|
+
score += SCORES.longMessageBody;
|
|
326
|
+
return score;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Get default "since" date (3 months ago).
|
|
330
|
+
*/
|
|
331
|
+
getDefaultSince() {
|
|
332
|
+
const date = new Date();
|
|
333
|
+
date.setDate(date.getDate() - DEFAULT_DAYS);
|
|
334
|
+
return date;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Check if a tag name looks like a version tag.
|
|
338
|
+
*/
|
|
339
|
+
isVersionTag(name) {
|
|
340
|
+
return /^v?\d+\.\d+(\.\d+)?/.test(name);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Create an empty result (for repos with no commits in range).
|
|
344
|
+
*/
|
|
345
|
+
emptyResult(startTime, tags) {
|
|
346
|
+
return {
|
|
347
|
+
totalCommits: 0,
|
|
348
|
+
belowThreshold: 0,
|
|
349
|
+
minorInterest: 0,
|
|
350
|
+
highInterest: [],
|
|
351
|
+
linkedToPRs: 0,
|
|
352
|
+
linkedToTags: 0,
|
|
353
|
+
hotspots: [],
|
|
354
|
+
tags,
|
|
355
|
+
durationMs: Date.now() - startTime,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
exports.GitTriageService = GitTriageService;
|
|
360
|
+
//# sourceMappingURL=GitTriageService.js.map
|