teamlens 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/commands/add.d.ts +2 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +34 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +20 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/distribute.d.ts +2 -0
- package/dist/commands/distribute.d.ts.map +1 -0
- package/dist/commands/distribute.js +35 -0
- package/dist/commands/distribute.js.map +1 -0
- package/dist/commands/feed.d.ts +2 -0
- package/dist/commands/feed.d.ts.map +1 -0
- package/dist/commands/feed.js +40 -0
- package/dist/commands/feed.js.map +1 -0
- package/dist/commands/forget.d.ts +2 -0
- package/dist/commands/forget.d.ts.map +1 -0
- package/dist/commands/forget.js +18 -0
- package/dist/commands/forget.js.map +1 -0
- package/dist/commands/hook-log.d.ts +9 -0
- package/dist/commands/hook-log.d.ts.map +1 -0
- package/dist/commands/hook-log.js +89 -0
- package/dist/commands/hook-log.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +27 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/rule.d.ts +14 -0
- package/dist/commands/rule.d.ts.map +1 -0
- package/dist/commands/rule.js +112 -0
- package/dist/commands/rule.js.map +1 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +22 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +179 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/share.d.ts +2 -0
- package/dist/commands/share.d.ts.map +1 -0
- package/dist/commands/share.js +19 -0
- package/dist/commands/share.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +32 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/team.d.ts +2 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +33 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/watch.d.ts +2 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +40 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAcA,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,GAAE,MAAmB,GACxB,OAAO,CAAC,IAAI,CAAC,CAsBf"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
const VALID_CATEGORIES = [
|
|
3
|
+
'architecture',
|
|
4
|
+
'convention',
|
|
5
|
+
'decision',
|
|
6
|
+
'correction',
|
|
7
|
+
'active_context',
|
|
8
|
+
'discovery',
|
|
9
|
+
'gotcha',
|
|
10
|
+
'dependency',
|
|
11
|
+
];
|
|
12
|
+
export async function addCommand(repoPath, content, category, files, tier = 'personal') {
|
|
13
|
+
if (!VALID_CATEGORIES.includes(category)) {
|
|
14
|
+
console.error(`Invalid category: ${category}`);
|
|
15
|
+
console.error(`Valid categories: ${VALID_CATEGORIES.join(', ')}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const memoryTier = tier === 'team' ? 'team' : 'personal';
|
|
19
|
+
const tl = await TeamLens.create(repoPath);
|
|
20
|
+
try {
|
|
21
|
+
const id = await tl.remember(content, category, files, [], memoryTier);
|
|
22
|
+
console.log(`Memory stored: ${id}`);
|
|
23
|
+
console.log(` Category: ${category}`);
|
|
24
|
+
console.log(` Tier: ${memoryTier}`);
|
|
25
|
+
console.log(` Content: ${content}`);
|
|
26
|
+
if (files.length > 0) {
|
|
27
|
+
console.log(` Files: ${files.join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
tl.close();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,gBAAgB,GAAqB;IACzC,cAAc;IACd,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,YAAY;CACb,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAgB,EAChB,OAAe,EACf,QAAgB,EAChB,KAAe,EACf,OAAe,UAAU;IAEzB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAA0B,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,qBAAqB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC;IACzD,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,QAA0B,EAAE,KAAK,EAAE,EAAE,EAAE,UAAwB,CAAC,CAAC;QACvG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,eAAe,UAAU,EAAE,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;QACtC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export async function dashboardCommand(repoPath, port) {
|
|
2
|
+
const { startDashboard } = await import('@teamlens/web');
|
|
3
|
+
const dashboardPort = port ?? 3847;
|
|
4
|
+
console.log('Starting TeamLens Dashboard...\n');
|
|
5
|
+
await startDashboard(repoPath, dashboardPort);
|
|
6
|
+
// Open browser
|
|
7
|
+
const { exec } = await import('node:child_process');
|
|
8
|
+
const url = `http://localhost:${dashboardPort}`;
|
|
9
|
+
const platform = process.platform;
|
|
10
|
+
if (platform === 'darwin') {
|
|
11
|
+
exec(`open ${url}`);
|
|
12
|
+
}
|
|
13
|
+
else if (platform === 'linux') {
|
|
14
|
+
exec(`xdg-open ${url}`);
|
|
15
|
+
}
|
|
16
|
+
else if (platform === 'win32') {
|
|
17
|
+
exec(`start ${url}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAgB,EAAE,IAAa;IACpE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IAEzD,MAAM,aAAa,GAAG,IAAI,IAAI,IAAI,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAEhD,MAAM,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAE9C,eAAe;IACf,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,oBAAoB,aAAa,EAAE,CAAC;IAEhD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;IACtB,CAAC;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;IAC1B,CAAC;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distribute.d.ts","sourceRoot":"","sources":["../../src/commands/distribute.ts"],"names":[],"mappings":"AAKA,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
const VALID_TARGETS = ['claude', 'cursor', 'copilot', 'agents_md'];
|
|
3
|
+
export async function distributeCommand(repoPath, targets) {
|
|
4
|
+
if (targets) {
|
|
5
|
+
for (const t of targets) {
|
|
6
|
+
if (!VALID_TARGETS.includes(t)) {
|
|
7
|
+
console.error(`Invalid target: ${t}`);
|
|
8
|
+
console.error(`Valid targets: ${VALID_TARGETS.join(', ')}`);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const tl = await TeamLens.create(repoPath);
|
|
14
|
+
try {
|
|
15
|
+
const { generated, warnings } = tl.distribute(targets);
|
|
16
|
+
for (const warning of warnings) {
|
|
17
|
+
console.log(` Warning: ${warning}`);
|
|
18
|
+
}
|
|
19
|
+
const rules = tl.db.getRules(false);
|
|
20
|
+
if (rules.length === 0) {
|
|
21
|
+
console.log('Generated config files (no rules yet — add with `teamlens rule add`):\n');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log(`Distributed ${rules.length} rule(s) to:\n`);
|
|
25
|
+
}
|
|
26
|
+
for (const file of generated) {
|
|
27
|
+
console.log(` ${file}`);
|
|
28
|
+
}
|
|
29
|
+
console.log('');
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
tl.close();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=distribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distribute.js","sourceRoot":"","sources":["../../src/commands/distribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,aAAa,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C;QAC3B,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../src/commands/feed.ts"],"names":[],"mappings":"AAEA,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B7E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function feedCommand(repoPath, limit = 20) {
|
|
3
|
+
const tl = await TeamLens.create(repoPath);
|
|
4
|
+
try {
|
|
5
|
+
const insights = tl.db.getRecentInsights(limit);
|
|
6
|
+
if (insights.length === 0) {
|
|
7
|
+
console.log('No team insights yet. Share insights during AI sessions to build the feed.\n');
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
console.log(`Team Insights Feed (${insights.length} most recent)\n`);
|
|
11
|
+
for (const insight of insights) {
|
|
12
|
+
const date = new Date(insight.createdAt);
|
|
13
|
+
const timeAgo = getTimeAgo(date);
|
|
14
|
+
const files = insight.relatedFiles.length > 0 ? ` | ${insight.relatedFiles.join(', ')}` : '';
|
|
15
|
+
console.log(` [${insight.category}] ${insight.content}`);
|
|
16
|
+
console.log(` by ${insight.author} · ${timeAgo}${files}`);
|
|
17
|
+
if (insight.reuseCount > 0) {
|
|
18
|
+
console.log(` reused ${insight.reuseCount} time(s)`);
|
|
19
|
+
}
|
|
20
|
+
console.log('');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
tl.close();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function getTimeAgo(date) {
|
|
28
|
+
const seconds = Math.floor((Date.now() - date.getTime()) / 1000);
|
|
29
|
+
if (seconds < 60)
|
|
30
|
+
return 'just now';
|
|
31
|
+
const minutes = Math.floor(seconds / 60);
|
|
32
|
+
if (minutes < 60)
|
|
33
|
+
return `${minutes}m ago`;
|
|
34
|
+
const hours = Math.floor(minutes / 60);
|
|
35
|
+
if (hours < 24)
|
|
36
|
+
return `${hours}h ago`;
|
|
37
|
+
const days = Math.floor(hours / 24);
|
|
38
|
+
return `${days}d ago`;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.js","sourceRoot":"","sources":["../../src/commands/feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB,EAAE,KAAK,GAAG,EAAE;IAC5D,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,8EAA8E,CAAC,CAAC;YAC5F,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,QAAQ,CAAC,MAAM,iBAAiB,CAAC,CAAC;QAErE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACzC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE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forget.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBrF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function forgetCommand(repoPath, memoryId) {
|
|
3
|
+
const tl = await TeamLens.create(repoPath);
|
|
4
|
+
try {
|
|
5
|
+
const existing = tl.db.getMemory(memoryId);
|
|
6
|
+
if (!existing) {
|
|
7
|
+
console.error(`Memory not found: ${memoryId}`);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
tl.forget(memoryId);
|
|
11
|
+
console.log(`Deleted memory: ${memoryId}`);
|
|
12
|
+
console.log(` Was: ${existing.content}`);
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
tl.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=forget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forget.js","sourceRoot":"","sources":["../../src/commands/forget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,EAAE,QAAgB;IACpE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,UAAU,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook log command — called by Claude Code PostToolUse hooks.
|
|
3
|
+
*
|
|
4
|
+
* Reads tool use data from stdin, appends activity to .teamlens/hooks.jsonl.
|
|
5
|
+
* Designed to be fast and lightweight — no sql.js, no async, just file append.
|
|
6
|
+
* The MCP server ingests this file into the DB on each tool call.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hookLogCommand(repoPath: string): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=hook-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-log.d.ts","sourceRoot":"","sources":["../../src/commands/hook-log.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEpE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
/**
|
|
5
|
+
* Hook log command — called by Claude Code PostToolUse hooks.
|
|
6
|
+
*
|
|
7
|
+
* Reads tool use data from stdin, appends activity to .teamlens/hooks.jsonl.
|
|
8
|
+
* Designed to be fast and lightweight — no sql.js, no async, just file append.
|
|
9
|
+
* The MCP server ingests this file into the DB on each tool call.
|
|
10
|
+
*/
|
|
11
|
+
export async function hookLogCommand(repoPath) {
|
|
12
|
+
const chunks = [];
|
|
13
|
+
for await (const chunk of process.stdin) {
|
|
14
|
+
chunks.push(chunk);
|
|
15
|
+
}
|
|
16
|
+
const input = Buffer.concat(chunks).toString('utf-8').trim();
|
|
17
|
+
if (!input)
|
|
18
|
+
return;
|
|
19
|
+
try {
|
|
20
|
+
const data = JSON.parse(input);
|
|
21
|
+
const toolName = data.tool_name ?? 'unknown';
|
|
22
|
+
const toolInput = data.tool_input ?? {};
|
|
23
|
+
// Skip tools that don't represent meaningful activity
|
|
24
|
+
const skipTools = ['Read', 'Glob', 'Grep', 'WebSearch', 'WebFetch', 'AskUserQuestion', 'TaskList', 'TaskGet'];
|
|
25
|
+
if (skipTools.includes(toolName))
|
|
26
|
+
return;
|
|
27
|
+
// Extract files from tool input
|
|
28
|
+
const files = [];
|
|
29
|
+
if (typeof toolInput.file_path === 'string') {
|
|
30
|
+
files.push(relativePath(repoPath, toolInput.file_path));
|
|
31
|
+
}
|
|
32
|
+
if (typeof toolInput.notebook_path === 'string') {
|
|
33
|
+
files.push(relativePath(repoPath, toolInput.notebook_path));
|
|
34
|
+
}
|
|
35
|
+
// Map tool to activity type
|
|
36
|
+
let type = 'other';
|
|
37
|
+
if (toolName === 'Edit' || toolName === 'Write' || toolName === 'NotebookEdit')
|
|
38
|
+
type = 'file_edit';
|
|
39
|
+
else if (toolName === 'Bash')
|
|
40
|
+
type = 'implementation';
|
|
41
|
+
else if (toolName === 'Task' || toolName === 'TaskCreate' || toolName === 'TaskUpdate')
|
|
42
|
+
type = 'implementation';
|
|
43
|
+
// Build description
|
|
44
|
+
let description = toolName;
|
|
45
|
+
if (files.length > 0) {
|
|
46
|
+
description = `${toolName}: ${files.join(', ')}`;
|
|
47
|
+
}
|
|
48
|
+
else if (typeof toolInput.command === 'string') {
|
|
49
|
+
const cmd = toolInput.command.substring(0, 120);
|
|
50
|
+
description = `${toolName}: ${cmd}`;
|
|
51
|
+
}
|
|
52
|
+
const event = {
|
|
53
|
+
type,
|
|
54
|
+
tool: toolName,
|
|
55
|
+
description,
|
|
56
|
+
files,
|
|
57
|
+
timestamp: new Date().toISOString(),
|
|
58
|
+
};
|
|
59
|
+
// Find .teamlens directory — check provided path, then try git root
|
|
60
|
+
let teamlensDir = path.join(repoPath, '.teamlens');
|
|
61
|
+
if (!fs.existsSync(teamlensDir)) {
|
|
62
|
+
try {
|
|
63
|
+
const gitRoot = execSync('git rev-parse --show-toplevel', {
|
|
64
|
+
cwd: repoPath,
|
|
65
|
+
encoding: 'utf-8',
|
|
66
|
+
timeout: 2000,
|
|
67
|
+
}).trim();
|
|
68
|
+
teamlensDir = path.join(gitRoot, '.teamlens');
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Not a git repo — skip
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!fs.existsSync(teamlensDir))
|
|
75
|
+
return;
|
|
76
|
+
const hooksFile = path.join(teamlensDir, 'hooks.jsonl');
|
|
77
|
+
fs.appendFileSync(hooksFile, JSON.stringify(event) + '\n');
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Silent failure — hooks should never break the agent
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function relativePath(base, filePath) {
|
|
84
|
+
if (path.isAbsolute(filePath)) {
|
|
85
|
+
return path.relative(base, filePath);
|
|
86
|
+
}
|
|
87
|
+
return filePath;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=hook-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-log.js","sourceRoot":"","sources":["../../src/commands/hook-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,IA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AExC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QACxD,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,sDAAsD;IACxD,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,QAAgB;IAClD,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAEA,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function initCommand(repoPath) {
|
|
3
|
+
console.log('Initializing TeamLens...\n');
|
|
4
|
+
const tl = await TeamLens.create(repoPath);
|
|
5
|
+
try {
|
|
6
|
+
const { memoriesCreated, filesTracked, teamImported } = await tl.init();
|
|
7
|
+
console.log(` Files tracked: ${filesTracked}`);
|
|
8
|
+
console.log(` Memories created: ${memoriesCreated}`);
|
|
9
|
+
if (teamImported > 0) {
|
|
10
|
+
console.log(` Team imported: ${teamImported} (from team.jsonl)`);
|
|
11
|
+
}
|
|
12
|
+
console.log(` Author: ${tl.config.author}`);
|
|
13
|
+
console.log(` Storage: ${repoPath}/.teamlens/`);
|
|
14
|
+
const embeddingsAvailable = await tl.embeddings.isAvailable();
|
|
15
|
+
if (embeddingsAvailable) {
|
|
16
|
+
console.log(' Embeddings: enabled (Ollama)');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.log(' Embeddings: disabled (install Ollama + nomic-embed-text for semantic search)');
|
|
20
|
+
}
|
|
21
|
+
console.log('\nTeamLens initialized. Run `teamlens watch` to start the daemon.');
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
tl.close();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB;IAChD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAE1C,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;QAExE,OAAO,CAAC,GAAG,CAAC,uBAAuB,YAAY,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,uBAAuB,eAAe,EAAE,CAAC,CAAC;QACtD,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,uBAAuB,YAAY,oBAAoB,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,uBAAuB,QAAQ,aAAa,CAAC,CAAC;QAE1D,MAAM,mBAAmB,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QAC9D,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,sFAAsF,CAAC,CAAC;QACtG,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;IACnF,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function ruleAddCommand(repoPath: string, content: string, options: {
|
|
2
|
+
category: string;
|
|
3
|
+
scope?: string;
|
|
4
|
+
priority: string;
|
|
5
|
+
good?: string;
|
|
6
|
+
bad?: string;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare function ruleListCommand(repoPath: string, options: {
|
|
9
|
+
category?: string;
|
|
10
|
+
all: boolean;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
export declare function ruleEnableCommand(repoPath: string, id: string): Promise<void>;
|
|
13
|
+
export declare function ruleDisableCommand(repoPath: string, id: string): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/commands/rule.ts"],"names":[],"mappings":"AAgBA,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3F,OAAO,CAAC,IAAI,CAAC,CAuCf;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,GAC3C,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAcnF;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAcpF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
const VALID_CATEGORIES = [
|
|
3
|
+
'architecture',
|
|
4
|
+
'convention',
|
|
5
|
+
'decision',
|
|
6
|
+
'correction',
|
|
7
|
+
'active_context',
|
|
8
|
+
'discovery',
|
|
9
|
+
'gotcha',
|
|
10
|
+
'dependency',
|
|
11
|
+
];
|
|
12
|
+
const VALID_PRIORITIES = ['critical', 'high', 'normal', 'low'];
|
|
13
|
+
export async function ruleAddCommand(repoPath, content, options) {
|
|
14
|
+
if (!VALID_CATEGORIES.includes(options.category)) {
|
|
15
|
+
console.error(`Invalid category: ${options.category}`);
|
|
16
|
+
console.error(`Valid categories: ${VALID_CATEGORIES.join(', ')}`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (!VALID_PRIORITIES.includes(options.priority)) {
|
|
20
|
+
console.error(`Invalid priority: ${options.priority}`);
|
|
21
|
+
console.error(`Valid priorities: ${VALID_PRIORITIES.join(', ')}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
const tl = await TeamLens.create(repoPath);
|
|
25
|
+
try {
|
|
26
|
+
const id = await tl.addRule(content, options.category, {
|
|
27
|
+
scope: options.scope ? options.scope.split(',').map((s) => s.trim()) : undefined,
|
|
28
|
+
priority: options.priority,
|
|
29
|
+
good: options.good,
|
|
30
|
+
bad: options.bad,
|
|
31
|
+
});
|
|
32
|
+
console.log(`Rule stored: ${id}`);
|
|
33
|
+
console.log(` Category: ${options.category}`);
|
|
34
|
+
console.log(` Priority: ${options.priority}`);
|
|
35
|
+
console.log(` Content: ${content}`);
|
|
36
|
+
if (options.scope) {
|
|
37
|
+
console.log(` Scope: ${options.scope}`);
|
|
38
|
+
}
|
|
39
|
+
if (options.good) {
|
|
40
|
+
console.log(` Good: ${options.good}`);
|
|
41
|
+
}
|
|
42
|
+
if (options.bad) {
|
|
43
|
+
console.log(` Bad: ${options.bad}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
tl.close();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export async function ruleListCommand(repoPath, options) {
|
|
51
|
+
const tl = await TeamLens.create(repoPath);
|
|
52
|
+
try {
|
|
53
|
+
const rules = tl.db.getRules(options.all);
|
|
54
|
+
const filtered = options.category
|
|
55
|
+
? rules.filter((r) => r.category === options.category)
|
|
56
|
+
: rules;
|
|
57
|
+
if (filtered.length === 0) {
|
|
58
|
+
console.log('No rules found.\n');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
console.log(`Found ${filtered.length} rule(s):\n`);
|
|
62
|
+
for (const rule of filtered) {
|
|
63
|
+
const activeTag = rule.active ? '' : ' [DISABLED]';
|
|
64
|
+
const priorityTag = rule.priority && rule.priority !== 'normal' ? ` [${rule.priority}]` : '';
|
|
65
|
+
console.log(` [${rule.category}]${priorityTag} ${rule.content}${activeTag}`);
|
|
66
|
+
if (rule.scope && rule.scope.length > 0) {
|
|
67
|
+
console.log(` Scope: ${rule.scope.join(', ')}`);
|
|
68
|
+
}
|
|
69
|
+
if (rule.examples) {
|
|
70
|
+
if (rule.examples.good)
|
|
71
|
+
console.log(` Good: ${rule.examples.good}`);
|
|
72
|
+
if (rule.examples.bad)
|
|
73
|
+
console.log(` Bad: ${rule.examples.bad}`);
|
|
74
|
+
}
|
|
75
|
+
console.log(` ID: ${rule.id}\n`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
tl.close();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export async function ruleEnableCommand(repoPath, id) {
|
|
83
|
+
const tl = await TeamLens.create(repoPath);
|
|
84
|
+
try {
|
|
85
|
+
const memory = tl.db.getMemory(id);
|
|
86
|
+
if (!memory) {
|
|
87
|
+
console.error(`Rule not found: ${id}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
tl.db.setRuleActive(id, true);
|
|
91
|
+
console.log(`Rule enabled: ${id}`);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
tl.close();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export async function ruleDisableCommand(repoPath, id) {
|
|
98
|
+
const tl = await TeamLens.create(repoPath);
|
|
99
|
+
try {
|
|
100
|
+
const memory = tl.db.getMemory(id);
|
|
101
|
+
if (!memory) {
|
|
102
|
+
console.error(`Rule not found: ${id}`);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
tl.db.setRuleActive(id, false);
|
|
106
|
+
console.log(`Rule disabled: ${id}`);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
tl.close();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/commands/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,gBAAgB,GAAqB;IACzC,cAAc;IACd,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,WAAW;IACX,QAAQ;IACR,YAAY;CACb,CAAC;AAEF,MAAM,gBAAgB,GAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAE/E,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,OAAe,EACf,OAA4F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","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBlG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function searchCommand(repoPath, query, scope) {
|
|
3
|
+
const tl = await TeamLens.create(repoPath);
|
|
4
|
+
try {
|
|
5
|
+
const results = await tl.query(query, scope, 10);
|
|
6
|
+
if (results.length === 0) {
|
|
7
|
+
console.log('No memories found.\n');
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
console.log(`Found ${results.length} memories:\n`);
|
|
11
|
+
for (const { memory, score, breakdown } of results) {
|
|
12
|
+
const staleTag = memory.staleness >= 0.6 ? ' [STALE]' : '';
|
|
13
|
+
console.log(` [${memory.category}] ${memory.content}${staleTag}`);
|
|
14
|
+
console.log(` Score: ${score.toFixed(2)} | Files: ${memory.relatedFiles.join(', ') || 'none'}`);
|
|
15
|
+
console.log(` ID: ${memory.id}\n`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
tl.close();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,EAAE,KAAa,EAAE,KAAc;IACjF,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YACpC,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,SAAS,OAAO,CAAC,MAAM,cAAc,CAAC,CAAC;QAEnD,KAAK,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,OAAO,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;YACnG,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AA+GA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8HlE"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
/** Resolve the absolute path to the CLI entry point (works for global + local installs). */
|
|
5
|
+
function getCliPath() {
|
|
6
|
+
return path.resolve(new URL('.', import.meta.url).pathname, '..', // dist/
|
|
7
|
+
'..', // cli/
|
|
8
|
+
'dist', 'index.js');
|
|
9
|
+
}
|
|
10
|
+
function getAgents(repoPath) {
|
|
11
|
+
return [
|
|
12
|
+
// Claude Code — global ~/.claude/settings.json
|
|
13
|
+
{
|
|
14
|
+
name: 'Claude Code',
|
|
15
|
+
scope: 'global',
|
|
16
|
+
supportsHooks: true,
|
|
17
|
+
detect: () => {
|
|
18
|
+
const configPath = path.join(os.homedir(), '.claude', 'settings.json');
|
|
19
|
+
return fs.existsSync(path.join(os.homedir(), '.claude')) ? configPath : null;
|
|
20
|
+
},
|
|
21
|
+
read: (configPath) => {
|
|
22
|
+
if (!fs.existsSync(configPath))
|
|
23
|
+
return {};
|
|
24
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
25
|
+
},
|
|
26
|
+
write: (configPath, config) => {
|
|
27
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
// Cursor — project-level .cursor/mcp.json
|
|
31
|
+
{
|
|
32
|
+
name: 'Cursor',
|
|
33
|
+
scope: 'project',
|
|
34
|
+
supportsHooks: false,
|
|
35
|
+
detect: () => {
|
|
36
|
+
const cursorDir = path.join(repoPath, '.cursor');
|
|
37
|
+
if (fs.existsSync(cursorDir)) {
|
|
38
|
+
return path.join(cursorDir, 'mcp.json');
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
},
|
|
42
|
+
read: (configPath) => {
|
|
43
|
+
if (!fs.existsSync(configPath))
|
|
44
|
+
return {};
|
|
45
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
46
|
+
},
|
|
47
|
+
write: (configPath, config) => {
|
|
48
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
49
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
// Windsurf — global ~/.codeium/windsurf/mcp_config.json
|
|
53
|
+
{
|
|
54
|
+
name: 'Windsurf',
|
|
55
|
+
scope: 'global',
|
|
56
|
+
supportsHooks: false,
|
|
57
|
+
detect: () => {
|
|
58
|
+
const configPath = path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json');
|
|
59
|
+
return fs.existsSync(path.join(os.homedir(), '.codeium', 'windsurf')) ? configPath : null;
|
|
60
|
+
},
|
|
61
|
+
read: (configPath) => {
|
|
62
|
+
if (!fs.existsSync(configPath))
|
|
63
|
+
return {};
|
|
64
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
65
|
+
},
|
|
66
|
+
write: (configPath, config) => {
|
|
67
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
export async function setupCommand(repoPath) {
|
|
73
|
+
const cliPath = getCliPath();
|
|
74
|
+
console.log('\n TeamLens Setup\n');
|
|
75
|
+
// Verify the serve entry point exists
|
|
76
|
+
if (!fs.existsSync(cliPath)) {
|
|
77
|
+
console.error(` Error: CLI not built. Run \`pnpm build\` first.`);
|
|
78
|
+
console.error(` Expected: ${cliPath}`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
// ── MCP Server Config ──
|
|
82
|
+
// No --path: the serve command auto-detects from CWD.
|
|
83
|
+
// Claude Code sets CWD to the project directory, so it just works.
|
|
84
|
+
const mcpEntry = {
|
|
85
|
+
command: 'node',
|
|
86
|
+
args: [cliPath, 'serve'],
|
|
87
|
+
};
|
|
88
|
+
// For project-scoped agents (Cursor), include --path for the specific repo
|
|
89
|
+
const projectMcpEntry = {
|
|
90
|
+
command: 'node',
|
|
91
|
+
args: [cliPath, 'serve', '--path', repoPath],
|
|
92
|
+
};
|
|
93
|
+
// ── Hook Config ──
|
|
94
|
+
// PostToolUse hook logs activity automatically.
|
|
95
|
+
// No --path: hook-log auto-detects from CWD, skips if no .teamlens/ exists.
|
|
96
|
+
const hookCommand = `node ${cliPath} hook-log`;
|
|
97
|
+
const agents = getAgents(repoPath);
|
|
98
|
+
let configured = 0;
|
|
99
|
+
for (const agent of agents) {
|
|
100
|
+
const configPath = agent.detect();
|
|
101
|
+
if (!configPath)
|
|
102
|
+
continue;
|
|
103
|
+
const entry = agent.scope === 'global' ? mcpEntry : projectMcpEntry;
|
|
104
|
+
try {
|
|
105
|
+
const config = agent.read(configPath);
|
|
106
|
+
// Register MCP server
|
|
107
|
+
config.mcpServers = config.mcpServers ?? {};
|
|
108
|
+
const action = config.mcpServers['teamlens'] ? 'updated' : 'configured';
|
|
109
|
+
config.mcpServers['teamlens'] = entry;
|
|
110
|
+
// Register hooks (Claude Code only)
|
|
111
|
+
if (agent.supportsHooks) {
|
|
112
|
+
config.hooks = config.hooks ?? {};
|
|
113
|
+
const existingPostHooks = config.hooks['PostToolUse'] ?? [];
|
|
114
|
+
// Remove any existing teamlens hook entries (idempotent)
|
|
115
|
+
const filteredHooks = existingPostHooks.filter(rule => !rule.hooks?.some(h => h.command.includes('hook-log')));
|
|
116
|
+
// Add our hook
|
|
117
|
+
filteredHooks.push({
|
|
118
|
+
hooks: [{ command: hookCommand, type: 'command' }],
|
|
119
|
+
matcher: '',
|
|
120
|
+
});
|
|
121
|
+
config.hooks['PostToolUse'] = filteredHooks;
|
|
122
|
+
}
|
|
123
|
+
agent.write(configPath, config);
|
|
124
|
+
const scopeLabel = agent.scope === 'global' ? '(global — works in any project)' : '(project-level)';
|
|
125
|
+
console.log(` ${agent.name}: ${action} ${scopeLabel}`);
|
|
126
|
+
console.log(` ${configPath}`);
|
|
127
|
+
configured++;
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
131
|
+
console.error(` ${agent.name}: failed — ${message}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (configured === 0) {
|
|
135
|
+
console.log(' No supported AI agents detected.\n');
|
|
136
|
+
console.log(' Supported: Claude Code, Cursor, Windsurf');
|
|
137
|
+
console.log(' Install one, then run `teamlens setup` again.\n');
|
|
138
|
+
console.log(' Or manually add to your agent\'s MCP config:\n');
|
|
139
|
+
console.log(JSON.stringify({ mcpServers: { teamlens: mcpEntry } }, null, 2));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
console.log(`\n ${configured} agent(s) configured.\n`);
|
|
143
|
+
// ── Init project ──
|
|
144
|
+
const storageDir = path.join(repoPath, '.teamlens');
|
|
145
|
+
const { TeamLens } = await import('@teamlens/core');
|
|
146
|
+
const tl = await TeamLens.create(repoPath);
|
|
147
|
+
try {
|
|
148
|
+
if (!fs.existsSync(storageDir)) {
|
|
149
|
+
console.log(' Initializing memory store...\n');
|
|
150
|
+
const { memoriesCreated, filesTracked } = await tl.init();
|
|
151
|
+
console.log(` Files tracked: ${filesTracked}`);
|
|
152
|
+
console.log(` Memories created: ${memoriesCreated}`);
|
|
153
|
+
console.log(` Storage: ${storageDir}/`);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
console.log(' Memory store already exists.');
|
|
157
|
+
}
|
|
158
|
+
// Generate CLAUDE.md + other agent config files
|
|
159
|
+
console.log('\n Generating agent instruction files...');
|
|
160
|
+
const { generated, warnings } = tl.distribute();
|
|
161
|
+
for (const file of generated) {
|
|
162
|
+
console.log(` ${file}`);
|
|
163
|
+
}
|
|
164
|
+
for (const warning of warnings) {
|
|
165
|
+
console.log(` Warning: ${warning}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
tl.close();
|
|
170
|
+
}
|
|
171
|
+
console.log('\n Done. Restart your AI agent to activate TeamLens.\n');
|
|
172
|
+
console.log(' What happens next:');
|
|
173
|
+
console.log(' 1. Open your AI agent (Claude Code, Cursor, etc.) in this project');
|
|
174
|
+
console.log(' 2. TeamLens auto-starts and tracks your session');
|
|
175
|
+
console.log(' 3. Activity is logged automatically via hooks');
|
|
176
|
+
console.log(' 4. AI shares insights when it learns something (per CLAUDE.md instructions)');
|
|
177
|
+
console.log(' 5. Run `teamlens dashboard` to see everything\n');
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAuBzB,4FAA4F;AAC5F,SAAS,UAAU;IACjB,OAAO,IAAI,CAAC,OAAO,CACjB,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EACtC,IAAI,EAAK,QAAQ;IACjB,IAAI,EAAK,OAAO;IAChB,MAAM,EACN,UAAU,CACX,CAAC;AACJ,CAAC;AAeD,SAAS,SAAS,CAAC,QAAgB;IACjC,OAAO;QACL,+CAA+C;QAC/C;YACE,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,QAAuB;YAC9B,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,GAAG,EAAE;gBACX,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;gBACvE,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;YAC/E,CAAC;YACD,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE;gBACnB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;oBAAE,OAAO,EAAE,CAAC;gBAC1C,OAAO,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AAG,CAAC,2CAA2C,CAAC,CAAC;QACzD,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;QAChD,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,iFAAiF,CAAC,CAAC;IAC/F,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/commands/share.ts"],"names":[],"mappings":"AAEA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBpF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function shareCommand(repoPath, memoryId) {
|
|
3
|
+
const tl = await TeamLens.create(repoPath);
|
|
4
|
+
try {
|
|
5
|
+
const result = tl.share(memoryId);
|
|
6
|
+
if (result.success) {
|
|
7
|
+
console.log(`Memory ${memoryId} shared with team.`);
|
|
8
|
+
console.log(' It will be available to teammates after they git pull.');
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
console.error(`Failed: ${result.error}`);
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
tl.close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=share.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.js","sourceRoot":"","sources":["../../src/commands/share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,QAAgB;IACnE,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,UAAU,QAAQ,oBAAoB,CAAC,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACzC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCnE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function statusCommand(repoPath) {
|
|
3
|
+
const tl = await TeamLens.create(repoPath);
|
|
4
|
+
try {
|
|
5
|
+
const stats = tl.stats();
|
|
6
|
+
const conventions = await tl.getConventions();
|
|
7
|
+
const decisions = await tl.getDecisions();
|
|
8
|
+
const embeddingsAvailable = await tl.embeddings.isAvailable();
|
|
9
|
+
const authors = tl.getTeamAuthors();
|
|
10
|
+
console.log('TeamLens Status\n');
|
|
11
|
+
console.log(` Total memories: ${stats.total}`);
|
|
12
|
+
console.log(` Personal: ${stats.personal}`);
|
|
13
|
+
console.log(` Team: ${stats.team}`);
|
|
14
|
+
console.log(` Fresh: ${stats.fresh}`);
|
|
15
|
+
console.log(` Stale: ${stats.stale}`);
|
|
16
|
+
console.log(` Conventions: ${conventions.length}`);
|
|
17
|
+
console.log(` Decisions: ${decisions.length}`);
|
|
18
|
+
console.log(` Embeddings: ${embeddingsAvailable ? 'enabled' : 'disabled'}`);
|
|
19
|
+
console.log(` Author: ${tl.config.author}`);
|
|
20
|
+
console.log(` Storage: ${repoPath}/.teamlens/`);
|
|
21
|
+
if (authors.length > 0) {
|
|
22
|
+
console.log('\n Team Authors:');
|
|
23
|
+
for (const a of authors) {
|
|
24
|
+
console.log(` ${a.author}: ${a.count} memories`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
tl.close();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC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,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YACjC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../src/commands/team.ts"],"names":[],"mappings":"AAEA,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TeamLens } from '@teamlens/core';
|
|
2
|
+
export async function teamCommand(repoPath) {
|
|
3
|
+
const tl = await TeamLens.create(repoPath);
|
|
4
|
+
try {
|
|
5
|
+
const stats = tl.stats();
|
|
6
|
+
const authors = tl.getTeamAuthors();
|
|
7
|
+
const sharedCount = tl.team.sharedCount();
|
|
8
|
+
console.log('Team Memory Status\n');
|
|
9
|
+
console.log(` Team memories: ${stats.team}`);
|
|
10
|
+
console.log(` Personal memories: ${stats.personal}`);
|
|
11
|
+
console.log(` Shared file: ${sharedCount} entries in team.jsonl`);
|
|
12
|
+
console.log(` Your author name: ${tl.config.author}`);
|
|
13
|
+
if (authors.length > 0) {
|
|
14
|
+
console.log('\n Contributors:');
|
|
15
|
+
for (const a of authors) {
|
|
16
|
+
const marker = a.author === tl.config.author ? ' (you)' : '';
|
|
17
|
+
console.log(` ${a.author}: ${a.count} memories${marker}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.log('\n No team memories yet. Use `teamlens add -t team` or share a personal memory.');
|
|
22
|
+
}
|
|
23
|
+
// Sync check
|
|
24
|
+
const imported = tl.syncTeam();
|
|
25
|
+
if (imported > 0) {
|
|
26
|
+
console.log(`\n Synced ${imported} new team memories from team.jsonl.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
tl.close();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=team.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.js","sourceRoot":"","sources":["../../src/commands/team.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB;IAChD,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC;QACpC,MAAM,WAAW,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1C,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,wBAAwB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,wBAAwB,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,wBAAwB,WAAW,wBAAwB,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAExD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YACjC,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;gBACxB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,YAAY,MAAM,EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;QAClG,CAAC;QAED,aAAa;QACb,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,cAAc,QAAQ,qCAAqC,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ClE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { watch } from 'chokidar';
|
|
2
|
+
import { TeamLens } from '@teamlens/core';
|
|
3
|
+
import { startMcpServer } from '@teamlens/mcp-server';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
export async function watchCommand(repoPath) {
|
|
6
|
+
console.log('Starting TeamLens daemon...\n');
|
|
7
|
+
const tl = await TeamLens.create(repoPath);
|
|
8
|
+
// Process any commits that happened while daemon was off
|
|
9
|
+
const { newMemories, stalenessUpdates, teamImported } = await tl.processNewCommits();
|
|
10
|
+
if (newMemories > 0 || stalenessUpdates > 0 || teamImported > 0) {
|
|
11
|
+
console.log(` Catch-up: ${newMemories} new memories, ${stalenessUpdates} staleness updates, ${teamImported} team imported`);
|
|
12
|
+
}
|
|
13
|
+
// Watch for file changes in the repo
|
|
14
|
+
const gitDir = path.join(repoPath, '.git');
|
|
15
|
+
const watcher = watch([
|
|
16
|
+
path.join(gitDir, 'refs', 'heads'), // branch updates (commits)
|
|
17
|
+
path.join(gitDir, 'HEAD'), // HEAD changes
|
|
18
|
+
], { ignoreInitial: true });
|
|
19
|
+
watcher.on('change', async () => {
|
|
20
|
+
try {
|
|
21
|
+
const result = await tl.processNewCommits();
|
|
22
|
+
if (result.newMemories > 0 || result.stalenessUpdates > 0 || result.teamImported > 0) {
|
|
23
|
+
console.log(`[${new Date().toLocaleTimeString()}] +${result.newMemories} memories, ${result.stalenessUpdates} staleness updates, ${result.teamImported} team imported`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.error('Error processing commits:', err);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const stats = tl.stats();
|
|
31
|
+
console.log(` Memories: ${stats.total} (${stats.fresh} fresh, ${stats.stale} stale)`);
|
|
32
|
+
console.log(' Watching for git changes...');
|
|
33
|
+
console.log(' MCP server starting on stdio...\n');
|
|
34
|
+
// Start MCP server (blocks until shutdown)
|
|
35
|
+
await startMcpServer(repoPath);
|
|
36
|
+
// Cleanup
|
|
37
|
+
await watcher.close();
|
|
38
|
+
tl.close();
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,OAAO,C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OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;IACzB,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,WAAW,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAEnD,2CAA2C;IAC3C,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;IAE/B,UAAU;IACV,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACtB,EAAE,CAAC,KAAK,EAAE,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { initCommand } from './commands/init.js';
|
|
5
|
+
import { watchCommand } from './commands/watch.js';
|
|
6
|
+
import { statusCommand } from './commands/status.js';
|
|
7
|
+
import { searchCommand } from './commands/search.js';
|
|
8
|
+
import { addCommand } from './commands/add.js';
|
|
9
|
+
import { forgetCommand } from './commands/forget.js';
|
|
10
|
+
import { setupCommand } from './commands/setup.js';
|
|
11
|
+
import { shareCommand } from './commands/share.js';
|
|
12
|
+
import { teamCommand } from './commands/team.js';
|
|
13
|
+
import { ruleAddCommand, ruleListCommand, ruleEnableCommand, ruleDisableCommand } from './commands/rule.js';
|
|
14
|
+
import { distributeCommand } from './commands/distribute.js';
|
|
15
|
+
import { dashboardCommand } from './commands/dashboard.js';
|
|
16
|
+
import { feedCommand } from './commands/feed.js';
|
|
17
|
+
import { hookLogCommand } from './commands/hook-log.js';
|
|
18
|
+
const program = new Command();
|
|
19
|
+
program
|
|
20
|
+
.name('teamlens')
|
|
21
|
+
.description('TeamLens — AI Team Intelligence platform')
|
|
22
|
+
.version('0.1.0');
|
|
23
|
+
program
|
|
24
|
+
.command('setup')
|
|
25
|
+
.description('Auto-configure TeamLens with your AI agents (Claude Code, Cursor, Windsurf)')
|
|
26
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
await setupCommand(resolve(opts.path));
|
|
29
|
+
});
|
|
30
|
+
program
|
|
31
|
+
.command('init')
|
|
32
|
+
.description('Scan repo and build initial memory store')
|
|
33
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
34
|
+
.action(async (opts) => {
|
|
35
|
+
await initCommand(resolve(opts.path));
|
|
36
|
+
});
|
|
37
|
+
program
|
|
38
|
+
.command('watch')
|
|
39
|
+
.description('Start daemon — watches git changes + runs MCP server')
|
|
40
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
41
|
+
.action(async (opts) => {
|
|
42
|
+
await watchCommand(resolve(opts.path));
|
|
43
|
+
});
|
|
44
|
+
program
|
|
45
|
+
.command('serve')
|
|
46
|
+
.description('Start MCP server only (no git watching)')
|
|
47
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
48
|
+
.action(async (opts) => {
|
|
49
|
+
const { startMcpServer } = await import('@teamlens/mcp-server');
|
|
50
|
+
await startMcpServer(resolve(opts.path));
|
|
51
|
+
});
|
|
52
|
+
program
|
|
53
|
+
.command('status')
|
|
54
|
+
.description('Show memory stats')
|
|
55
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
56
|
+
.action(async (opts) => {
|
|
57
|
+
await statusCommand(resolve(opts.path));
|
|
58
|
+
});
|
|
59
|
+
program
|
|
60
|
+
.command('search <query>')
|
|
61
|
+
.description('Search memories')
|
|
62
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
63
|
+
.option('-s, --scope <scope>', 'Narrow to directory scope')
|
|
64
|
+
.action(async (query, opts) => {
|
|
65
|
+
await searchCommand(resolve(opts.path), query, opts.scope);
|
|
66
|
+
});
|
|
67
|
+
program
|
|
68
|
+
.command('add <content>')
|
|
69
|
+
.description('Manually add a memory')
|
|
70
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
71
|
+
.option('-c, --category <category>', 'Memory category', 'convention')
|
|
72
|
+
.option('-f, --files <files...>', 'Related file paths')
|
|
73
|
+
.option('-t, --tier <tier>', 'Memory tier: personal (default) or team', 'personal')
|
|
74
|
+
.action(async (content, opts) => {
|
|
75
|
+
await addCommand(resolve(opts.path), content, opts.category, opts.files ?? [], opts.tier);
|
|
76
|
+
});
|
|
77
|
+
program
|
|
78
|
+
.command('forget <memoryId>')
|
|
79
|
+
.description('Delete a memory')
|
|
80
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
81
|
+
.action(async (memoryId, opts) => {
|
|
82
|
+
await forgetCommand(resolve(opts.path), memoryId);
|
|
83
|
+
});
|
|
84
|
+
program
|
|
85
|
+
.command('share <memoryId>')
|
|
86
|
+
.description('Share a personal memory with the team')
|
|
87
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
88
|
+
.action(async (memoryId, opts) => {
|
|
89
|
+
await shareCommand(resolve(opts.path), memoryId);
|
|
90
|
+
});
|
|
91
|
+
program
|
|
92
|
+
.command('team')
|
|
93
|
+
.description('Show team memory status — authors, counts, sync state')
|
|
94
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
95
|
+
.action(async (opts) => {
|
|
96
|
+
await teamCommand(resolve(opts.path));
|
|
97
|
+
});
|
|
98
|
+
program
|
|
99
|
+
.command('dashboard')
|
|
100
|
+
.description('Open the TeamLens web dashboard')
|
|
101
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
102
|
+
.option('--port <port>', 'Dashboard port', '3847')
|
|
103
|
+
.action(async (opts) => {
|
|
104
|
+
await dashboardCommand(resolve(opts.path), opts.port ? parseInt(opts.port, 10) : undefined);
|
|
105
|
+
});
|
|
106
|
+
program
|
|
107
|
+
.command('feed')
|
|
108
|
+
.description('Show the team insights feed')
|
|
109
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
110
|
+
.option('-l, --limit <limit>', 'Number of insights to show', '20')
|
|
111
|
+
.action(async (opts) => {
|
|
112
|
+
await feedCommand(resolve(opts.path), opts.limit ? parseInt(opts.limit, 10) : 20);
|
|
113
|
+
});
|
|
114
|
+
// ── Hook Integration (internal) ──
|
|
115
|
+
program
|
|
116
|
+
.command('hook-log')
|
|
117
|
+
.description('Internal: log tool use from Claude Code hooks')
|
|
118
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
119
|
+
.action(async (opts) => {
|
|
120
|
+
await hookLogCommand(resolve(opts.path));
|
|
121
|
+
});
|
|
122
|
+
// ── Rule Management ──
|
|
123
|
+
const rule = program
|
|
124
|
+
.command('rule')
|
|
125
|
+
.description('Manage team AI rules');
|
|
126
|
+
rule
|
|
127
|
+
.command('add <content>')
|
|
128
|
+
.description('Add a new team rule')
|
|
129
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
130
|
+
.option('-c, --category <category>', 'Rule category', 'convention')
|
|
131
|
+
.option('-s, --scope <scope>', 'Comma-separated glob patterns (e.g., "src/**/*.ts,lib/**")')
|
|
132
|
+
.option('--priority <priority>', 'Rule priority: critical, high, normal, low', 'normal')
|
|
133
|
+
.option('--good <example>', 'Good code example')
|
|
134
|
+
.option('--bad <example>', 'Bad code example')
|
|
135
|
+
.action(async (content, opts) => {
|
|
136
|
+
await ruleAddCommand(resolve(opts.path), content, {
|
|
137
|
+
category: opts.category,
|
|
138
|
+
scope: opts.scope,
|
|
139
|
+
priority: opts.priority,
|
|
140
|
+
good: opts.good,
|
|
141
|
+
bad: opts.bad,
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
rule
|
|
145
|
+
.command('list')
|
|
146
|
+
.description('List all rules')
|
|
147
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
148
|
+
.option('-c, --category <category>', 'Filter by category')
|
|
149
|
+
.option('-a, --all', 'Include disabled rules', false)
|
|
150
|
+
.action(async (opts) => {
|
|
151
|
+
await ruleListCommand(resolve(opts.path), { category: opts.category, all: opts.all });
|
|
152
|
+
});
|
|
153
|
+
rule
|
|
154
|
+
.command('enable <id>')
|
|
155
|
+
.description('Enable a disabled rule')
|
|
156
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
157
|
+
.action(async (id, opts) => {
|
|
158
|
+
await ruleEnableCommand(resolve(opts.path), id);
|
|
159
|
+
});
|
|
160
|
+
rule
|
|
161
|
+
.command('disable <id>')
|
|
162
|
+
.description('Disable a rule without deleting it')
|
|
163
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
164
|
+
.action(async (id, opts) => {
|
|
165
|
+
await ruleDisableCommand(resolve(opts.path), id);
|
|
166
|
+
});
|
|
167
|
+
// ── Distribution ──
|
|
168
|
+
program
|
|
169
|
+
.command('distribute')
|
|
170
|
+
.description('Generate agent config files (CLAUDE.md, .cursor/rules/, AGENTS.md, copilot-instructions.md)')
|
|
171
|
+
.option('-p, --path <path>', 'Repository path', '.')
|
|
172
|
+
.option('-t, --targets <targets...>', 'Specific targets: claude, cursor, copilot, agents_md')
|
|
173
|
+
.action(async (opts) => {
|
|
174
|
+
await distributeCommand(resolve(opts.path), opts.targets);
|
|
175
|
+
});
|
|
176
|
+
program.parse();
|
|
177
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,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ACrB,WAAW,CAAC,6FAA6F,CAAC;KAC1G,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,CAAC;KACnD,MAAM,CAAC,4BAA4B,EAAE,sDAAsD,CAAC;KAC5F,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "teamlens",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI Team Intelligence — see what your team's AI is doing, share knowledge automatically",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/sanketbabar/teamlens"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ai",
|
|
13
|
+
"mcp",
|
|
14
|
+
"claude",
|
|
15
|
+
"cursor",
|
|
16
|
+
"copilot",
|
|
17
|
+
"team",
|
|
18
|
+
"intelligence",
|
|
19
|
+
"developer-tools",
|
|
20
|
+
"ai-coding"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"teamlens": "dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20.0.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"commander": "^13.0.0",
|
|
33
|
+
"chalk": "^5.4.0",
|
|
34
|
+
"chokidar": "^4.0.0",
|
|
35
|
+
"ora": "^8.1.0",
|
|
36
|
+
"@teamlens/core": "0.1.0",
|
|
37
|
+
"@teamlens/web": "0.1.0",
|
|
38
|
+
"@teamlens/mcp-server": "0.1.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^5.7.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc",
|
|
45
|
+
"dev": "tsc --watch",
|
|
46
|
+
"clean": "rm -rf dist .tsbuildinfo"
|
|
47
|
+
}
|
|
48
|
+
}
|