@teamlens/core 0.1.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/analytics/analytics-engine.d.ts +45 -0
- package/dist/analytics/analytics-engine.d.ts.map +1 -0
- package/dist/analytics/analytics-engine.js +176 -0
- package/dist/analytics/analytics-engine.js.map +1 -0
- package/dist/distribution/distributor.d.ts +19 -0
- package/dist/distribution/distributor.d.ts.map +1 -0
- package/dist/distribution/distributor.js +220 -0
- package/dist/distribution/distributor.js.map +1 -0
- package/dist/extractor/git-extractor.d.ts +36 -0
- package/dist/extractor/git-extractor.d.ts.map +1 -0
- package/dist/extractor/git-extractor.js +198 -0
- package/dist/extractor/git-extractor.js.map +1 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +313 -0
- package/dist/index.js.map +1 -0
- package/dist/retrieval/retriever.d.ts +33 -0
- package/dist/retrieval/retriever.d.ts.map +1 -0
- package/dist/retrieval/retriever.js +126 -0
- package/dist/retrieval/retriever.js.map +1 -0
- package/dist/session/insight-detector.d.ts +10 -0
- package/dist/session/insight-detector.d.ts.map +1 -0
- package/dist/session/insight-detector.js +87 -0
- package/dist/session/insight-detector.js.map +1 -0
- package/dist/session/session-manager.d.ts +49 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +228 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/staleness/staleness-engine.d.ts +36 -0
- package/dist/staleness/staleness-engine.d.ts.map +1 -0
- package/dist/staleness/staleness-engine.js +141 -0
- package/dist/staleness/staleness-engine.js.map +1 -0
- package/dist/store/database.d.ts +121 -0
- package/dist/store/database.d.ts.map +1 -0
- package/dist/store/database.js +677 -0
- package/dist/store/database.js.map +1 -0
- package/dist/store/embeddings.d.ts +21 -0
- package/dist/store/embeddings.d.ts.map +1 -0
- package/dist/store/embeddings.js +70 -0
- package/dist/store/embeddings.js.map +1 -0
- package/dist/sync/team-sync.d.ts +77 -0
- package/dist/sync/team-sync.d.ts.map +1 -0
- package/dist/sync/team-sync.js +230 -0
- package/dist/sync/team-sync.js.map +1 -0
- package/dist/types.d.ts +223 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +24 -0
- package/dist/types.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { MemoryDatabase } from '../store/database.js';
|
|
2
|
+
import type { TeamAnalytics, DeveloperStats, ContributorEntry, UsageTrend, ROIMetrics, HotFile } from '../types.js';
|
|
3
|
+
export declare class AnalyticsEngine {
|
|
4
|
+
private db;
|
|
5
|
+
constructor(db: MemoryDatabase);
|
|
6
|
+
/** Full analytics report for the dashboard. */
|
|
7
|
+
getTeamAnalytics(days?: number): TeamAnalytics;
|
|
8
|
+
/** Dashboard overview stats with time ranges. */
|
|
9
|
+
getOverview(): {
|
|
10
|
+
today: {
|
|
11
|
+
sessions: number;
|
|
12
|
+
insights: number;
|
|
13
|
+
};
|
|
14
|
+
week: {
|
|
15
|
+
sessions: number;
|
|
16
|
+
insights: number;
|
|
17
|
+
};
|
|
18
|
+
month: {
|
|
19
|
+
sessions: number;
|
|
20
|
+
insights: number;
|
|
21
|
+
};
|
|
22
|
+
total: {
|
|
23
|
+
sessions: number;
|
|
24
|
+
insights: number;
|
|
25
|
+
developers: number;
|
|
26
|
+
};
|
|
27
|
+
topContributors: {
|
|
28
|
+
developer: string;
|
|
29
|
+
count: number;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
/** Per-developer statistics. */
|
|
33
|
+
getDeveloperStats(developer: string): DeveloperStats;
|
|
34
|
+
/** Contributor leaderboard ranked by impact score. */
|
|
35
|
+
getContributorLeaderboard(limit?: number): ContributorEntry[];
|
|
36
|
+
/** Daily usage trends over the given time range. */
|
|
37
|
+
getUsageTrends(days?: number): UsageTrend[];
|
|
38
|
+
/** ROI metrics for the team. */
|
|
39
|
+
getRoiMetrics(): ROIMetrics;
|
|
40
|
+
/** Insight breakdown by category. */
|
|
41
|
+
getInsightsByType(): Record<string, number>;
|
|
42
|
+
/** Files with most insights. */
|
|
43
|
+
getHotFiles(limit?: number): HotFile[];
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=analytics-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-engine.d.ts","sourceRoot":"","sources":["../../src/analytics/analytics-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,OAAO,EACR,MAAM,aAAa,CAAC;AAKrB,qBAAa,eAAe;IACd,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,cAAc;IAEtC,+CAA+C;IAC/C,gBAAgB,CAAC,IAAI,SAAK,GAAG,aAAa;IAsB1C,iDAAiD;IACjD,WAAW,IAAI;QACb,KAAK,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC9C,IAAI,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7C,KAAK,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC9C,KAAK,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;QAClE,eAAe,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KACzD;IA6BD,gCAAgC;IAChC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc;IAwBpD,sDAAsD;IACtD,yBAAyB,CAAC,KAAK,SAAK,GAAG,gBAAgB,EAAE;IAiCzD,oDAAoD;IACpD,cAAc,CAAC,IAAI,SAAK,GAAG,UAAU,EAAE;IAsCvC,gCAAgC;IAChC,aAAa,IAAI,UAAU;IA4B3B,qCAAqC;IACrC,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3C,gCAAgC;IAChC,WAAW,CAAC,KAAK,SAAK,GAAG,OAAO,EAAE;CAQnC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/** Minutes saved per insight reused — each reuse saves ~15 minutes of re-discovery time. */
|
|
2
|
+
const MINUTES_PER_REUSE = 15;
|
|
3
|
+
export class AnalyticsEngine {
|
|
4
|
+
db;
|
|
5
|
+
constructor(db) {
|
|
6
|
+
this.db = db;
|
|
7
|
+
}
|
|
8
|
+
/** Full analytics report for the dashboard. */
|
|
9
|
+
getTeamAnalytics(days = 30) {
|
|
10
|
+
const totalSessions = this.db.getTotalSessionCount();
|
|
11
|
+
const stats = this.db.getMemoryCount();
|
|
12
|
+
const developers = this.db.getDistinctDevelopers();
|
|
13
|
+
const avgInsightsPerSession = totalSessions > 0 ? stats.team / totalSessions : 0;
|
|
14
|
+
return {
|
|
15
|
+
overview: {
|
|
16
|
+
totalSessions,
|
|
17
|
+
totalInsights: stats.team,
|
|
18
|
+
activeDevelopers: developers.length,
|
|
19
|
+
avgInsightsPerSession: Math.round(avgInsightsPerSession * 100) / 100,
|
|
20
|
+
},
|
|
21
|
+
roi: this.getRoiMetrics(),
|
|
22
|
+
trends: this.getUsageTrends(days),
|
|
23
|
+
contributors: this.getContributorLeaderboard(),
|
|
24
|
+
hotFiles: this.getHotFiles(),
|
|
25
|
+
insightsByType: this.getInsightsByType(),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Dashboard overview stats with time ranges. */
|
|
29
|
+
getOverview() {
|
|
30
|
+
const now = new Date();
|
|
31
|
+
const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()).toISOString();
|
|
32
|
+
const weekStart = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString();
|
|
33
|
+
const monthStart = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000).toISOString();
|
|
34
|
+
const farFuture = new Date(now.getTime() + 24 * 60 * 60 * 1000).toISOString();
|
|
35
|
+
return {
|
|
36
|
+
today: {
|
|
37
|
+
sessions: this.db.getSessionsInRange(todayStart, farFuture).length,
|
|
38
|
+
insights: this.db.getTeamInsightCountSince(todayStart),
|
|
39
|
+
},
|
|
40
|
+
week: {
|
|
41
|
+
sessions: this.db.getSessionsInRange(weekStart, farFuture).length,
|
|
42
|
+
insights: this.db.getTeamInsightCountSince(weekStart),
|
|
43
|
+
},
|
|
44
|
+
month: {
|
|
45
|
+
sessions: this.db.getSessionsInRange(monthStart, farFuture).length,
|
|
46
|
+
insights: this.db.getTeamInsightCountSince(monthStart),
|
|
47
|
+
},
|
|
48
|
+
total: {
|
|
49
|
+
sessions: this.db.getTotalSessionCount(),
|
|
50
|
+
insights: this.db.getTeamInsightCount(),
|
|
51
|
+
developers: this.db.getDistinctDevelopers().length,
|
|
52
|
+
},
|
|
53
|
+
topContributors: this.db.getInsightCountsByDeveloper().slice(0, 3),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Per-developer statistics. */
|
|
57
|
+
getDeveloperStats(developer) {
|
|
58
|
+
const sessions = this.db.getSessionsByDeveloper(developer);
|
|
59
|
+
const insights = this.db.getMemoriesByAuthor(developer).filter(m => m.tier === 'team');
|
|
60
|
+
const totalDuration = sessions.reduce((sum, s) => sum + (s.durationSeconds ?? 0), 0);
|
|
61
|
+
const avgDuration = sessions.length > 0 ? totalDuration / sessions.length : 0;
|
|
62
|
+
const reuseCount = insights.reduce((sum, m) => sum + m.reuseCount, 0);
|
|
63
|
+
const lastSession = sessions[0];
|
|
64
|
+
return {
|
|
65
|
+
developer,
|
|
66
|
+
totalSessions: sessions.length,
|
|
67
|
+
totalInsights: insights.length,
|
|
68
|
+
avgSessionDuration: Math.round(avgDuration),
|
|
69
|
+
insightsPerSession: sessions.length > 0
|
|
70
|
+
? Math.round((insights.length / sessions.length) * 100) / 100
|
|
71
|
+
: 0,
|
|
72
|
+
knowledgeReused: reuseCount,
|
|
73
|
+
lastActive: lastSession?.startedAt ?? null,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Contributor leaderboard ranked by impact score. */
|
|
77
|
+
getContributorLeaderboard(limit = 20) {
|
|
78
|
+
const insightsByDeveloper = this.db.getInsightCountsByDeveloper();
|
|
79
|
+
const allTeamMemories = this.db.getMemoriesByTier('team', false);
|
|
80
|
+
// Calculate reuse counts per developer
|
|
81
|
+
const reuseByDeveloper = new Map();
|
|
82
|
+
for (const memory of allTeamMemories) {
|
|
83
|
+
if (memory.reuseCount > 0) {
|
|
84
|
+
const current = reuseByDeveloper.get(memory.author) ?? 0;
|
|
85
|
+
reuseByDeveloper.set(memory.author, current + memory.reuseCount);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const entries = insightsByDeveloper.map((entry, index) => {
|
|
89
|
+
const reused = reuseByDeveloper.get(entry.developer) ?? 0;
|
|
90
|
+
return {
|
|
91
|
+
rank: index + 1,
|
|
92
|
+
developer: entry.developer,
|
|
93
|
+
insightsShared: entry.count,
|
|
94
|
+
knowledgeReused: reused,
|
|
95
|
+
impactScore: entry.count * 2 + reused * 3,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
// Re-sort by impact score
|
|
99
|
+
entries.sort((a, b) => b.impactScore - a.impactScore);
|
|
100
|
+
// Re-rank after sorting
|
|
101
|
+
entries.forEach((e, i) => { e.rank = i + 1; });
|
|
102
|
+
return entries.slice(0, limit);
|
|
103
|
+
}
|
|
104
|
+
/** Daily usage trends over the given time range. */
|
|
105
|
+
getUsageTrends(days = 30) {
|
|
106
|
+
const sessionsByDate = this.db.getSessionCountsByDate(days);
|
|
107
|
+
const insightsByDate = this.db.getInsightCountsByDate(days);
|
|
108
|
+
const devsByDate = this.db.getActiveDevelopersByDate(days);
|
|
109
|
+
// Merge into date-keyed map
|
|
110
|
+
const dateMap = new Map();
|
|
111
|
+
// Fill in all dates in the range
|
|
112
|
+
for (let i = 0; i < days; i++) {
|
|
113
|
+
const date = new Date(Date.now() - (days - 1 - i) * 24 * 60 * 60 * 1000);
|
|
114
|
+
const dateStr = date.toISOString().split('T')[0];
|
|
115
|
+
dateMap.set(dateStr, {
|
|
116
|
+
date: dateStr,
|
|
117
|
+
sessions: 0,
|
|
118
|
+
insights: 0,
|
|
119
|
+
activeDevelopers: 0,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
for (const entry of sessionsByDate) {
|
|
123
|
+
const existing = dateMap.get(entry.date);
|
|
124
|
+
if (existing)
|
|
125
|
+
existing.sessions = entry.count;
|
|
126
|
+
}
|
|
127
|
+
for (const entry of insightsByDate) {
|
|
128
|
+
const existing = dateMap.get(entry.date);
|
|
129
|
+
if (existing)
|
|
130
|
+
existing.insights = entry.count;
|
|
131
|
+
}
|
|
132
|
+
for (const entry of devsByDate) {
|
|
133
|
+
const existing = dateMap.get(entry.date);
|
|
134
|
+
if (existing)
|
|
135
|
+
existing.activeDevelopers = entry.count;
|
|
136
|
+
}
|
|
137
|
+
return Array.from(dateMap.values());
|
|
138
|
+
}
|
|
139
|
+
/** ROI metrics for the team. */
|
|
140
|
+
getRoiMetrics() {
|
|
141
|
+
const knowledgeReuseCount = this.db.getTotalReuseCount();
|
|
142
|
+
const estimatedHoursSaved = Math.round((knowledgeReuseCount * MINUTES_PER_REUSE / 60) * 10) / 10;
|
|
143
|
+
const totalSessions = this.db.getTotalSessionCount();
|
|
144
|
+
const totalInsights = this.db.getMemoryCount().team;
|
|
145
|
+
const totalDurationHours = this.db.getTotalSessionDuration() / 3600;
|
|
146
|
+
const insightsPerAIHour = totalDurationHours > 0
|
|
147
|
+
? Math.round((totalInsights / totalDurationHours) * 100) / 100
|
|
148
|
+
: 0;
|
|
149
|
+
const hotFiles = this.db.getHotFiles(999);
|
|
150
|
+
const allFilesWithInsights = new Set(this.db.getMemoriesByTier('team', false).flatMap(m => m.relatedFiles));
|
|
151
|
+
const teamKnowledgeCoverage = allFilesWithInsights.size > 0
|
|
152
|
+
? Math.min(allFilesWithInsights.size / Math.max(hotFiles.length, allFilesWithInsights.size), 1.0)
|
|
153
|
+
: 0;
|
|
154
|
+
return {
|
|
155
|
+
duplicatesPrevented: 0, // Not yet implemented
|
|
156
|
+
knowledgeReuseCount,
|
|
157
|
+
estimatedHoursSaved,
|
|
158
|
+
insightsPerAIHour,
|
|
159
|
+
teamKnowledgeCoverage: Math.round(teamKnowledgeCoverage * 100) / 100,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** Insight breakdown by category. */
|
|
163
|
+
getInsightsByType() {
|
|
164
|
+
return this.db.getInsightsByCategory();
|
|
165
|
+
}
|
|
166
|
+
/** Files with most insights. */
|
|
167
|
+
getHotFiles(limit = 10) {
|
|
168
|
+
const raw = this.db.getHotFiles(limit);
|
|
169
|
+
return raw.map(r => ({
|
|
170
|
+
filePath: r.filePath,
|
|
171
|
+
insightCount: r.count,
|
|
172
|
+
lastInsight: r.lastInsight,
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=analytics-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-engine.js","sourceRoot":"","sources":["../../src/analytics/analytics-engine.ts"],"names":[],"mappings":"AAUA,4FAA4F;AAC5F,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,OAAO,eAAe;IACN;IAApB,YAAoB,EAAkB;QAAlB,OAAE,GAAF,EAAE,CAAgB;IAAG,CAAC;IAE1C,+CAA+C;IAC/C,gBAAgB,CAAC,IAAI,GAAG,EAAE;QACxB,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC;QACrD,MAAM,KAA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AAG,CAClC,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CACtE,CAAC;QACF,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,IAAI,GAAG,CAAC;YACzD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC;YACjG,CAAC,CAAC,CAAC,CAAC;QAEN,OAAO;YACL,mBAAmB,EAAE,CAAC,EAAE,sBAAsB;YAC9C,mBAAmB;YACnB,mBAAmB;YACnB,iBAAiB;YACjB,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB,GAAG,GAAG,CAAC,GAAG,GAAG;SACrE,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,iBAAiB;QACf,OAAO,IAAI,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC;IACzC,CAAC;IAED,gCAAgC;IAChC,WAAW,CAAC,KAAK,GAAG,EAAE;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACnB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,YAAY,EAAE,CAAC,CAAC,KAAK;YACrB,WAAW,EAAE,CAAC,CAAC,WAAW;SAC3B,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DistributionTarget } from '../types.js';
|
|
2
|
+
import type { MemoryDatabase } from '../store/database.js';
|
|
3
|
+
export declare class Distributor {
|
|
4
|
+
private db;
|
|
5
|
+
private repoPath;
|
|
6
|
+
constructor(db: MemoryDatabase, repoPath: string);
|
|
7
|
+
/** Auto-detect which targets are available. Always includes claude + agents_md. */
|
|
8
|
+
detectTargets(): DistributionTarget[];
|
|
9
|
+
/** Generate config files for the given targets (auto-detect if not specified). */
|
|
10
|
+
distribute(targets?: DistributionTarget[]): {
|
|
11
|
+
generated: string[];
|
|
12
|
+
warnings: string[];
|
|
13
|
+
};
|
|
14
|
+
private generateClaudeMd;
|
|
15
|
+
private generateCursorRules;
|
|
16
|
+
private generateAgentsMd;
|
|
17
|
+
private generateCopilotInstructions;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=distributor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributor.d.ts","sourceRoot":"","sources":["../../src/distribution/distributor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,kBAAkB,EAAgB,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqB3D,qBAAa,WAAW;IAEpB,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ;gBADR,EAAE,EAAE,cAAc,EAClB,QAAQ,EAAE,MAAM;IAG1B,mFAAmF;IACnF,aAAa,IAAI,kBAAkB,EAAE;IAarC,kFAAkF;IAClF,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,EAAE,GAAG;QAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IAiCvF,OAAO,CAAC,gBAAgB;IAoFxB,OAAO,CAAC,mBAAmB;IAoD3B,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,2BAA2B;CAapC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
const HEADER = '# Generated by TeamLens — do not edit manually.\n';
|
|
4
|
+
const PRIORITY_ORDER = ['critical', 'high', 'normal', 'low'];
|
|
5
|
+
function priorityLabel(p) {
|
|
6
|
+
return p ?? 'normal';
|
|
7
|
+
}
|
|
8
|
+
function groupBy(items, key) {
|
|
9
|
+
const map = new Map();
|
|
10
|
+
for (const item of items) {
|
|
11
|
+
const k = key(item);
|
|
12
|
+
const group = map.get(k) ?? [];
|
|
13
|
+
group.push(item);
|
|
14
|
+
map.set(k, group);
|
|
15
|
+
}
|
|
16
|
+
return map;
|
|
17
|
+
}
|
|
18
|
+
export class Distributor {
|
|
19
|
+
db;
|
|
20
|
+
repoPath;
|
|
21
|
+
constructor(db, repoPath) {
|
|
22
|
+
this.db = db;
|
|
23
|
+
this.repoPath = repoPath;
|
|
24
|
+
}
|
|
25
|
+
/** Auto-detect which targets are available. Always includes claude + agents_md. */
|
|
26
|
+
detectTargets() {
|
|
27
|
+
const targets = ['claude', 'agents_md'];
|
|
28
|
+
if (fs.existsSync(path.join(this.repoPath, '.cursor'))) {
|
|
29
|
+
targets.push('cursor');
|
|
30
|
+
}
|
|
31
|
+
if (fs.existsSync(path.join(this.repoPath, '.github'))) {
|
|
32
|
+
targets.push('copilot');
|
|
33
|
+
}
|
|
34
|
+
return targets;
|
|
35
|
+
}
|
|
36
|
+
/** Generate config files for the given targets (auto-detect if not specified). */
|
|
37
|
+
distribute(targets) {
|
|
38
|
+
const activeTargets = targets ?? this.detectTargets();
|
|
39
|
+
const rules = this.db.getRules(false);
|
|
40
|
+
const recentInsights = this.db.getRecentInsights(10);
|
|
41
|
+
const generated = [];
|
|
42
|
+
const warnings = [];
|
|
43
|
+
for (const target of activeTargets) {
|
|
44
|
+
switch (target) {
|
|
45
|
+
case 'claude':
|
|
46
|
+
this.generateClaudeMd(rules, recentInsights, warnings);
|
|
47
|
+
generated.push('CLAUDE.md');
|
|
48
|
+
break;
|
|
49
|
+
case 'cursor':
|
|
50
|
+
this.generateCursorRules(rules);
|
|
51
|
+
generated.push('.cursor/rules/');
|
|
52
|
+
break;
|
|
53
|
+
case 'agents_md':
|
|
54
|
+
this.generateAgentsMd(rules);
|
|
55
|
+
generated.push('AGENTS.md');
|
|
56
|
+
break;
|
|
57
|
+
case 'copilot':
|
|
58
|
+
this.generateCopilotInstructions(rules);
|
|
59
|
+
generated.push('.github/copilot-instructions.md');
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { generated, warnings };
|
|
64
|
+
}
|
|
65
|
+
// ── CLAUDE.md ──
|
|
66
|
+
generateClaudeMd(rules, recentInsights, warnings) {
|
|
67
|
+
const filePath = path.join(this.repoPath, 'CLAUDE.md');
|
|
68
|
+
// Backup existing CLAUDE.md if it wasn't generated by us
|
|
69
|
+
if (fs.existsSync(filePath)) {
|
|
70
|
+
const existing = fs.readFileSync(filePath, 'utf-8');
|
|
71
|
+
if (!existing.startsWith('# Generated by TeamLens') && !existing.startsWith('# Generated by CodeMemory')) {
|
|
72
|
+
const backupPath = path.join(this.repoPath, 'CLAUDE.md.backup');
|
|
73
|
+
fs.writeFileSync(backupPath, existing);
|
|
74
|
+
warnings.push(`Existing CLAUDE.md backed up to CLAUDE.md.backup`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let content = HEADER + '\n';
|
|
78
|
+
// Session protocol instructions — strong directives
|
|
79
|
+
content += '## TeamLens — REQUIRED Protocol\n\n';
|
|
80
|
+
content += 'This project uses TeamLens for team AI intelligence. You MUST follow this protocol:\n\n';
|
|
81
|
+
content += '### Sharing Insights (MANDATORY)\n\n';
|
|
82
|
+
content += 'After completing any significant task, you MUST call `share_insight` to share what you learned.\n';
|
|
83
|
+
content += 'Examples of when to share:\n';
|
|
84
|
+
content += '- You discovered a bug or gotcha ("The auth middleware silently swallows 401 errors")\n';
|
|
85
|
+
content += '- You figured out how something works ("Payment webhooks retry 3x with exponential backoff")\n';
|
|
86
|
+
content += '- You made an architecture decision ("Used JSONL instead of JSON for append-friendly sync")\n';
|
|
87
|
+
content += '- You found a convention ("All API routes return { data, error } shape")\n';
|
|
88
|
+
content += '- You fixed a tricky issue ("ESM imports need .js extension even for .ts files")\n\n';
|
|
89
|
+
content += '**Call `share_insight` at least once per task.** If you learned nothing worth sharing, that is rare.\n\n';
|
|
90
|
+
content += '### Querying Team Knowledge\n\n';
|
|
91
|
+
content += 'Before starting work, call `ask` to check if teammates already solved a similar problem.\n';
|
|
92
|
+
content += 'This prevents duplicate work and surfaces existing conventions.\n\n';
|
|
93
|
+
content += '### Sessions\n\n';
|
|
94
|
+
content += 'Sessions are tracked automatically — no need to start/end manually.\n\n';
|
|
95
|
+
// Recent team insights
|
|
96
|
+
if (recentInsights.length > 0) {
|
|
97
|
+
content += '## Recent Team Insights\n\n';
|
|
98
|
+
for (const insight of recentInsights.slice(0, 5)) {
|
|
99
|
+
content += `- **[${insight.category}]** ${insight.content}`;
|
|
100
|
+
if (insight.author !== 'unknown') {
|
|
101
|
+
content += ` _(${insight.author})_`;
|
|
102
|
+
}
|
|
103
|
+
content += '\n';
|
|
104
|
+
}
|
|
105
|
+
content += '\n';
|
|
106
|
+
}
|
|
107
|
+
// Rules grouped by priority, then by category
|
|
108
|
+
if (rules.length > 0) {
|
|
109
|
+
for (const priority of PRIORITY_ORDER) {
|
|
110
|
+
const priorityRules = rules.filter((r) => priorityLabel(r.priority) === priority);
|
|
111
|
+
if (priorityRules.length === 0)
|
|
112
|
+
continue;
|
|
113
|
+
content += `## ${priority.charAt(0).toUpperCase() + priority.slice(1)} Rules\n\n`;
|
|
114
|
+
const byCategory = groupBy(priorityRules, (r) => r.category);
|
|
115
|
+
for (const [category, categoryRules] of byCategory) {
|
|
116
|
+
content += `### ${category.charAt(0).toUpperCase() + category.slice(1)}\n\n`;
|
|
117
|
+
for (const rule of categoryRules) {
|
|
118
|
+
content += `- ${rule.content}`;
|
|
119
|
+
if (rule.scope && rule.scope.length > 0) {
|
|
120
|
+
content += ` _(applies to: ${rule.scope.join(', ')})_`;
|
|
121
|
+
}
|
|
122
|
+
content += '\n';
|
|
123
|
+
if (rule.examples) {
|
|
124
|
+
if (rule.examples.good) {
|
|
125
|
+
content += ` - Good: \`${rule.examples.good}\`\n`;
|
|
126
|
+
}
|
|
127
|
+
if (rule.examples.bad) {
|
|
128
|
+
content += ` - Bad: \`${rule.examples.bad}\`\n`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
content += '\n';
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
fs.writeFileSync(filePath, content);
|
|
137
|
+
}
|
|
138
|
+
// ── .cursor/rules/ ──
|
|
139
|
+
generateCursorRules(rules) {
|
|
140
|
+
const rulesDir = path.join(this.repoPath, '.cursor', 'rules');
|
|
141
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
142
|
+
// Separate scoped vs global rules
|
|
143
|
+
const globalRules = rules.filter((r) => !r.scope || r.scope.length === 0);
|
|
144
|
+
const scopedRules = rules.filter((r) => r.scope && r.scope.length > 0);
|
|
145
|
+
// Global rules → _global.mdc
|
|
146
|
+
if (globalRules.length > 0) {
|
|
147
|
+
let content = '---\n';
|
|
148
|
+
content += 'description: Global project rules from TeamLens\n';
|
|
149
|
+
content += 'alwaysApply: true\n';
|
|
150
|
+
content += '---\n\n';
|
|
151
|
+
content += HEADER + '\n';
|
|
152
|
+
for (const rule of globalRules) {
|
|
153
|
+
content += `- ${rule.content}\n`;
|
|
154
|
+
if (rule.examples) {
|
|
155
|
+
if (rule.examples.good)
|
|
156
|
+
content += ` - Good: \`${rule.examples.good}\`\n`;
|
|
157
|
+
if (rule.examples.bad)
|
|
158
|
+
content += ` - Bad: \`${rule.examples.bad}\`\n`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
fs.writeFileSync(path.join(rulesDir, '_global.mdc'), content);
|
|
162
|
+
}
|
|
163
|
+
// Scoped rules → one .mdc per rule
|
|
164
|
+
for (const rule of scopedRules) {
|
|
165
|
+
const slug = rule.id.slice(0, 8);
|
|
166
|
+
const globs = JSON.stringify(rule.scope);
|
|
167
|
+
const summary = rule.content.slice(0, 60).replace(/[^a-zA-Z0-9 ]/g, '').trim();
|
|
168
|
+
let content = '---\n';
|
|
169
|
+
content += `description: ${summary}\n`;
|
|
170
|
+
content += `globs: ${globs}\n`;
|
|
171
|
+
content += 'alwaysApply: false\n';
|
|
172
|
+
content += '---\n\n';
|
|
173
|
+
content += rule.content + '\n';
|
|
174
|
+
if (rule.examples) {
|
|
175
|
+
content += '\n';
|
|
176
|
+
if (rule.examples.good)
|
|
177
|
+
content += `Good: \`${rule.examples.good}\`\n`;
|
|
178
|
+
if (rule.examples.bad)
|
|
179
|
+
content += `Bad: \`${rule.examples.bad}\`\n`;
|
|
180
|
+
}
|
|
181
|
+
fs.writeFileSync(path.join(rulesDir, `teamlens-${slug}.mdc`), content);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// ── AGENTS.md ──
|
|
185
|
+
generateAgentsMd(rules) {
|
|
186
|
+
const filePath = path.join(this.repoPath, 'AGENTS.md');
|
|
187
|
+
let content = HEADER + '\n';
|
|
188
|
+
const byCategory = groupBy(rules, (r) => r.category);
|
|
189
|
+
for (const [category, categoryRules] of byCategory) {
|
|
190
|
+
content += `## ${category.charAt(0).toUpperCase() + category.slice(1)}\n\n`;
|
|
191
|
+
for (const rule of categoryRules) {
|
|
192
|
+
const priorityTag = rule.priority && rule.priority !== 'normal' ? ` [${rule.priority}]` : '';
|
|
193
|
+
content += `- ${rule.content}${priorityTag}\n`;
|
|
194
|
+
if (rule.scope && rule.scope.length > 0) {
|
|
195
|
+
content += ` - Scope: ${rule.scope.join(', ')}\n`;
|
|
196
|
+
}
|
|
197
|
+
if (rule.examples) {
|
|
198
|
+
if (rule.examples.good)
|
|
199
|
+
content += ` - Good: \`${rule.examples.good}\`\n`;
|
|
200
|
+
if (rule.examples.bad)
|
|
201
|
+
content += ` - Bad: \`${rule.examples.bad}\`\n`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
content += '\n';
|
|
205
|
+
}
|
|
206
|
+
fs.writeFileSync(filePath, content);
|
|
207
|
+
}
|
|
208
|
+
// ── .github/copilot-instructions.md ──
|
|
209
|
+
generateCopilotInstructions(rules) {
|
|
210
|
+
const dir = path.join(this.repoPath, '.github');
|
|
211
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
212
|
+
const filePath = path.join(dir, 'copilot-instructions.md');
|
|
213
|
+
let content = HEADER + '\n';
|
|
214
|
+
for (const rule of rules) {
|
|
215
|
+
content += `- ${rule.content}\n`;
|
|
216
|
+
}
|
|
217
|
+
fs.writeFileSync(filePath, content);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=distributor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributor.js","sourceRoot":"","sources":["../../src/distribution/distributor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,MAAM,GAAG,mDAAmD,CAAC;AAEnE,MAAM,cAAc,GAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAE7E,SAAS,aAAa,CAAC,CAAsB;IAC3C,OAAO,CAAC,IAAI,QAAQ,CAAC;AACvB,CAAC;AAED,SAAS,OAAO,CAAI,KAAU,EAAE,GAAwB;IACtD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAe,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,OA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AQ,CAAC,GAAG,MAAM,CAAC;gBAC1E,CAAC;YACH,CAAC;YACD,OAAO,IAAI,IAAI,CAAC;QAClB,CAAC;QAED,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,wCAAwC;IAEhC,2BAA2B,CAAC,KAAe;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAChD,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,yBAAyB,CAAC,CAAC;QAC3D,IAAI,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;QAE5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,OAAO,IAAI,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC;QACnC,CAAC;QAED,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type DiffResult } from 'simple-git';
|
|
2
|
+
import type { ExtractedMemory, TrackedCommit } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Extracts memories from git history — commits, diffs, and file changes.
|
|
5
|
+
*
|
|
6
|
+
* Uses heuristic pattern matching (no LLM required).
|
|
7
|
+
* Detects architectural decisions, migrations, refactors, and conventions
|
|
8
|
+
* from commit messages and diff patterns.
|
|
9
|
+
*/
|
|
10
|
+
export declare class GitExtractor {
|
|
11
|
+
private git;
|
|
12
|
+
constructor(repoPath: string);
|
|
13
|
+
/** Get recent commits not yet tracked. */
|
|
14
|
+
getRecentCommits(since?: string): Promise<TrackedCommit[]>;
|
|
15
|
+
/** Get files changed in a specific commit. */
|
|
16
|
+
getCommitFiles(sha: string): Promise<string[]>;
|
|
17
|
+
/** Get the diff stat for a specific file in a commit. */
|
|
18
|
+
getFileDiffStat(sha: string, filePath: string): Promise<{
|
|
19
|
+
insertions: number;
|
|
20
|
+
deletions: number;
|
|
21
|
+
} | null>;
|
|
22
|
+
/** Extract memories from a single commit. */
|
|
23
|
+
extractFromCommit(commit: TrackedCommit): Promise<ExtractedMemory[]>;
|
|
24
|
+
/** Get current file hash for staleness tracking. */
|
|
25
|
+
getFileHash(filePath: string): Promise<string | null>;
|
|
26
|
+
/** Get all tracked files in the repo. */
|
|
27
|
+
getTrackedFiles(): Promise<string[]>;
|
|
28
|
+
/** Get diff summary between HEAD and a previous state. */
|
|
29
|
+
getDiffSummary(fromRef: string, toRef?: string): Promise<DiffResult>;
|
|
30
|
+
private isArchitecturalCommit;
|
|
31
|
+
private isMigrationCommit;
|
|
32
|
+
private isConventionCommit;
|
|
33
|
+
private extractDecision;
|
|
34
|
+
private extractTags;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=git-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-extractor.d.ts","sourceRoot":"","sources":["../../src/extractor/git-extractor.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAkB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAElF;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,GAAG,CAAY;gBAEX,QAAQ,EAAE,MAAM;IAI5B,0CAA0C;IACpC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAgBhE,8CAA8C;IACxC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASpD,yDAAyD;IACnD,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,C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