@codeledger/cli 0.6.9 → 0.7.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/activate.d.ts.map +1 -1
- package/dist/commands/activate.js +79 -26
- package/dist/commands/activate.js.map +1 -1
- package/dist/commands/ci.d.ts +16 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +323 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/compare.d.ts.map +1 -1
- package/dist/commands/compare.js +8 -0
- package/dist/commands/compare.js.map +1 -1
- package/dist/commands/context.d.ts +17 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +687 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +65 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/enable.d.ts +7 -0
- package/dist/commands/enable.d.ts.map +1 -0
- package/dist/commands/enable.js +75 -0
- package/dist/commands/enable.js.map +1 -0
- package/dist/commands/features.d.ts +2 -0
- package/dist/commands/features.d.ts.map +1 -0
- package/dist/commands/features.js +182 -0
- package/dist/commands/features.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +8 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/intent.d.ts +4 -4
- package/dist/commands/intent.d.ts.map +1 -1
- package/dist/commands/intent.js +70 -5
- package/dist/commands/intent.js.map +1 -1
- package/dist/commands/ledger.d.ts +14 -0
- package/dist/commands/ledger.d.ts.map +1 -0
- package/dist/commands/ledger.js +128 -0
- package/dist/commands/ledger.js.map +1 -0
- package/dist/commands/license.d.ts +45 -0
- package/dist/commands/license.d.ts.map +1 -0
- package/dist/commands/license.js +240 -0
- package/dist/commands/license.js.map +1 -0
- package/dist/commands/orchestrate.d.ts +12 -0
- package/dist/commands/orchestrate.d.ts.map +1 -0
- package/dist/commands/orchestrate.js +119 -0
- package/dist/commands/orchestrate.js.map +1 -0
- package/dist/commands/policy-simulate.d.ts +9 -0
- package/dist/commands/policy-simulate.d.ts.map +1 -0
- package/dist/commands/policy-simulate.js +46 -0
- package/dist/commands/policy-simulate.js.map +1 -0
- package/dist/commands/provenance.d.ts +10 -0
- package/dist/commands/provenance.d.ts.map +1 -0
- package/dist/commands/provenance.js +87 -0
- package/dist/commands/provenance.js.map +1 -0
- package/dist/commands/replay.d.ts +2 -0
- package/dist/commands/replay.d.ts.map +1 -0
- package/dist/commands/replay.js +181 -0
- package/dist/commands/replay.js.map +1 -0
- package/dist/commands/serve.d.ts +3 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +73 -1
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/session-summary.d.ts.map +1 -1
- package/dist/commands/session-summary.js +47 -2
- package/dist/commands/session-summary.js.map +1 -1
- package/dist/commands/setup-ci.d.ts +17 -1
- package/dist/commands/setup-ci.d.ts.map +1 -1
- package/dist/commands/setup-ci.js +190 -51
- package/dist/commands/setup-ci.js.map +1 -1
- package/dist/commands/share.js +1 -1
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/stats.d.ts +8 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +164 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/team-ledger.d.ts +11 -0
- package/dist/commands/team-ledger.d.ts.map +1 -0
- package/dist/commands/team-ledger.js +74 -0
- package/dist/commands/team-ledger.js.map +1 -0
- package/dist/commands/team-metrics.d.ts +8 -0
- package/dist/commands/team-metrics.d.ts.map +1 -0
- package/dist/commands/team-metrics.js +57 -0
- package/dist/commands/team-metrics.js.map +1 -0
- package/dist/commands/upgrade.d.ts +6 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +39 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -65
- package/dist/index.js.map +1 -1
- package/dist/templates/claude-md.d.ts.map +1 -1
- package/dist/templates/claude-md.js +14 -4
- package/dist/templates/claude-md.js.map +1 -1
- package/dist/templates/config.js +4 -4
- package/dist/templates/config.js.map +1 -1
- package/dist/templates/hooks.d.ts +3 -1
- package/dist/templates/hooks.d.ts.map +1 -1
- package/dist/templates/hooks.js +62 -2
- package/dist/templates/hooks.js.map +1 -1
- package/package.json +11 -10
- package/LICENSE +0 -27
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { buildBundleViaEngine } from '@codeledger/core-engine';
|
|
4
|
+
import { buildRepoIndex } from '@codeledger/repo';
|
|
5
|
+
export async function runReplay(cwd, flags) {
|
|
6
|
+
const task = flags['task'];
|
|
7
|
+
if (!task || task.trim() === '') {
|
|
8
|
+
console.error('Usage: codeledger replay --task "describe the task"');
|
|
9
|
+
console.error('Reconstructs the context bundle for a task and compares to the original run.');
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
const configPath = join(cwd, '.codeledger', 'config.json');
|
|
13
|
+
if (!existsSync(configPath)) {
|
|
14
|
+
console.error('No .codeledger/config.json found. Run "codeledger init" first.');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
let config;
|
|
18
|
+
try {
|
|
19
|
+
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
console.error('Failed to parse .codeledger/config.json.');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const json = flags['json'] === 'true';
|
|
26
|
+
// Step 1: Rebuild the repo index (always fresh for deterministic replay)
|
|
27
|
+
if (!json)
|
|
28
|
+
console.log('Replaying context selection...\n');
|
|
29
|
+
const indexPath = join(cwd, '.codeledger', 'cache', 'repo-index.json');
|
|
30
|
+
const repoIndex = buildRepoIndex({
|
|
31
|
+
root: cwd,
|
|
32
|
+
repoConfig: config.repo,
|
|
33
|
+
outputPath: indexPath,
|
|
34
|
+
});
|
|
35
|
+
// Step 2: Build bundle with same algorithm
|
|
36
|
+
const budget = {
|
|
37
|
+
tokens: config.selector.default_budget?.tokens ?? 8000,
|
|
38
|
+
max_files: config.selector.default_budget?.max_files ?? 25,
|
|
39
|
+
};
|
|
40
|
+
const replayBundle = await buildBundleViaEngine({
|
|
41
|
+
taskText: task,
|
|
42
|
+
repoIndex,
|
|
43
|
+
selectorConfig: config.selector,
|
|
44
|
+
budget,
|
|
45
|
+
explain: true,
|
|
46
|
+
indexPath,
|
|
47
|
+
});
|
|
48
|
+
// Step 3: Find original bundle for comparison
|
|
49
|
+
const originalBundle = findOriginalBundle(cwd, task);
|
|
50
|
+
if (json) {
|
|
51
|
+
const result = {
|
|
52
|
+
task,
|
|
53
|
+
replay: {
|
|
54
|
+
files: replayBundle.files.map((f) => ({
|
|
55
|
+
path: f.path,
|
|
56
|
+
score: f.score,
|
|
57
|
+
reasons: f.reasons,
|
|
58
|
+
})),
|
|
59
|
+
total_tokens: replayBundle.total_tokens,
|
|
60
|
+
confidence: replayBundle.confidence,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
if (originalBundle) {
|
|
64
|
+
result['original'] = {
|
|
65
|
+
bundle_id: originalBundle.bundle_id,
|
|
66
|
+
files: originalBundle.files.map((f) => ({
|
|
67
|
+
path: f.path,
|
|
68
|
+
score: f.score,
|
|
69
|
+
reasons: f.reasons,
|
|
70
|
+
})),
|
|
71
|
+
total_tokens: originalBundle.total_tokens,
|
|
72
|
+
};
|
|
73
|
+
result['diff'] = computeDiff(originalBundle, replayBundle);
|
|
74
|
+
}
|
|
75
|
+
console.log(JSON.stringify(result, null, 2));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Human-readable output
|
|
79
|
+
console.log(` Task: "${task}"\n`);
|
|
80
|
+
console.log(' Replayed Bundle:');
|
|
81
|
+
console.log(` Files: ${replayBundle.files.length} | Tokens: ~${replayBundle.total_tokens}`);
|
|
82
|
+
if (replayBundle.confidence) {
|
|
83
|
+
console.log(` Confidence: ${replayBundle.confidence.level.toUpperCase()} (${replayBundle.confidence.score.toFixed(3)})`);
|
|
84
|
+
}
|
|
85
|
+
console.log('');
|
|
86
|
+
// Show file ranking
|
|
87
|
+
console.log(' File Ranking:');
|
|
88
|
+
for (const f of replayBundle.files.filter((f) => !f.is_stub)) {
|
|
89
|
+
console.log(` ${f.score.toFixed(3)} ${f.path}`);
|
|
90
|
+
if (f.reasons.length > 0) {
|
|
91
|
+
console.log(` [${f.reasons.join(', ')}]`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Show ISC / CCS if available
|
|
95
|
+
if (replayBundle.confidence) {
|
|
96
|
+
console.log('\n Context Confidence Score (CCS):');
|
|
97
|
+
console.log(` Overall: ${replayBundle.confidence.score.toFixed(3)} (${replayBundle.confidence.level})`);
|
|
98
|
+
if (replayBundle.confidence.reasons.length > 0) {
|
|
99
|
+
for (const r of replayBundle.confidence.reasons) {
|
|
100
|
+
console.log(` - ${r}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Compare to original if found
|
|
105
|
+
if (originalBundle) {
|
|
106
|
+
console.log('\n Comparison to Original Run:');
|
|
107
|
+
console.log(` Original bundle: ${originalBundle.bundle_id}`);
|
|
108
|
+
const diff = computeDiff(originalBundle, replayBundle);
|
|
109
|
+
if (diff.added.length === 0 && diff.removed.length === 0 && diff.scoreChanged.length === 0) {
|
|
110
|
+
console.log(' Result: IDENTICAL — deterministic selection confirmed');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
if (diff.added.length > 0) {
|
|
114
|
+
console.log(` Added (${diff.added.length}):`);
|
|
115
|
+
for (const f of diff.added)
|
|
116
|
+
console.log(` + ${f}`);
|
|
117
|
+
}
|
|
118
|
+
if (diff.removed.length > 0) {
|
|
119
|
+
console.log(` Removed (${diff.removed.length}):`);
|
|
120
|
+
for (const f of diff.removed)
|
|
121
|
+
console.log(` - ${f}`);
|
|
122
|
+
}
|
|
123
|
+
if (diff.scoreChanged.length > 0) {
|
|
124
|
+
console.log(` Score changed (${diff.scoreChanged.length}):`);
|
|
125
|
+
for (const sc of diff.scoreChanged) {
|
|
126
|
+
console.log(` ~ ${sc.path}: ${sc.oldScore.toFixed(3)} -> ${sc.newScore.toFixed(3)} (${sc.delta > 0 ? '+' : ''}${sc.delta.toFixed(3)})`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
console.log(`\n Overlap: ${diff.overlapCount}/${originalBundle.files.length} files match`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
console.log('\n No original bundle found for comparison.');
|
|
134
|
+
console.log(' Run "codeledger activate --task ..." first, then replay to compare.');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function findOriginalBundle(cwd, task) {
|
|
138
|
+
const bundleDir = join(cwd, '.codeledger', 'artifacts', 'bundles');
|
|
139
|
+
if (!existsSync(bundleDir))
|
|
140
|
+
return null;
|
|
141
|
+
try {
|
|
142
|
+
const files = readdirSync(bundleDir).filter((f) => f.endsWith('.json')).sort().reverse();
|
|
143
|
+
for (const file of files) {
|
|
144
|
+
const content = readFileSync(join(bundleDir, file), 'utf-8');
|
|
145
|
+
const bundle = JSON.parse(content);
|
|
146
|
+
if (bundle.task && bundle.task.toLowerCase().includes(task.toLowerCase().slice(0, 40))) {
|
|
147
|
+
return bundle;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch { /* ignore */ }
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
function computeDiff(original, replay) {
|
|
155
|
+
const origPaths = new Map(original.files.map((f) => [f.path, f.score]));
|
|
156
|
+
const replayPaths = new Map(replay.files.map((f) => [f.path, f.score]));
|
|
157
|
+
const added = [];
|
|
158
|
+
const removed = [];
|
|
159
|
+
const scoreChanged = [];
|
|
160
|
+
let overlapCount = 0;
|
|
161
|
+
for (const [path, score] of replayPaths) {
|
|
162
|
+
if (!origPaths.has(path)) {
|
|
163
|
+
added.push(path);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
overlapCount++;
|
|
167
|
+
const origScore = origPaths.get(path);
|
|
168
|
+
const delta = score - origScore;
|
|
169
|
+
if (Math.abs(delta) > 0.005) {
|
|
170
|
+
scoreChanged.push({ path, oldScore: origScore, newScore: score, delta });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const path of origPaths.keys()) {
|
|
175
|
+
if (!replayPaths.has(path)) {
|
|
176
|
+
removed.push(path);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return { added, removed, scoreChanged, overlapCount };
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/commands/replay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,KAA6B;IACxE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACrE,OAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,UA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I,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,YAAY,EAAE,CAAC;YACf,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;YACvC,MAAM,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;YAChC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC;gBAC5B,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AACxD,CAAC"}
|
package/dist/commands/serve.d.ts
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* GET /health → { status: "ok", version: "..." }
|
|
9
9
|
* POST /verify → JSON verify result (body: { task, flags? })
|
|
10
10
|
* POST /bundle → JSON bundle result (body: { task, flags? })
|
|
11
|
+
* GET /metrics → team-metrics JSON (if team-ledger exists)
|
|
12
|
+
* GET /provenance → provenance graph JSON
|
|
13
|
+
* GET /policy → policy evaluation results
|
|
11
14
|
*/
|
|
12
15
|
export declare function runServe(cwd: string, flags: Record<string, string>): Promise<void>;
|
|
13
16
|
//# sourceMappingURL=serve.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Df"}
|
package/dist/commands/serve.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createServer } from 'node:http';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
2
4
|
import { runBundle } from './bundle.js';
|
|
3
5
|
import { runVerify } from './verify.js';
|
|
4
6
|
/**
|
|
@@ -11,6 +13,9 @@ import { runVerify } from './verify.js';
|
|
|
11
13
|
* GET /health → { status: "ok", version: "..." }
|
|
12
14
|
* POST /verify → JSON verify result (body: { task, flags? })
|
|
13
15
|
* POST /bundle → JSON bundle result (body: { task, flags? })
|
|
16
|
+
* GET /metrics → team-metrics JSON (if team-ledger exists)
|
|
17
|
+
* GET /provenance → provenance graph JSON
|
|
18
|
+
* GET /policy → policy evaluation results
|
|
14
19
|
*/
|
|
15
20
|
export async function runServe(cwd, flags) {
|
|
16
21
|
const port = parseInt(flags['port'] ?? '7400', 10);
|
|
@@ -39,8 +44,20 @@ export async function runServe(cwd, flags) {
|
|
|
39
44
|
else if (url === '/bundle' && req.method === 'POST') {
|
|
40
45
|
await handleBundle(req, res, cwd);
|
|
41
46
|
}
|
|
47
|
+
else if (url === '/metrics' && req.method === 'GET') {
|
|
48
|
+
await handleMetrics(res, cwd);
|
|
49
|
+
}
|
|
50
|
+
else if (url === '/provenance' && req.method === 'GET') {
|
|
51
|
+
await handleProvenance(res, cwd);
|
|
52
|
+
}
|
|
53
|
+
else if (url === '/policy' && req.method === 'GET') {
|
|
54
|
+
await handlePolicy(res, cwd);
|
|
55
|
+
}
|
|
42
56
|
else {
|
|
43
|
-
sendJson(res, 404, {
|
|
57
|
+
sendJson(res, 404, {
|
|
58
|
+
error: 'Not found',
|
|
59
|
+
endpoints: ['/health', '/verify', '/bundle', '/metrics', '/provenance', '/policy'],
|
|
60
|
+
});
|
|
44
61
|
}
|
|
45
62
|
}
|
|
46
63
|
catch (err) {
|
|
@@ -55,6 +72,9 @@ export async function runServe(cwd, flags) {
|
|
|
55
72
|
console.log(` GET http://localhost:${port}/health`);
|
|
56
73
|
console.log(` POST http://localhost:${port}/verify { "task": "..." }`);
|
|
57
74
|
console.log(` POST http://localhost:${port}/bundle { "task": "..." }`);
|
|
75
|
+
console.log(` GET http://localhost:${port}/metrics`);
|
|
76
|
+
console.log(` GET http://localhost:${port}/provenance`);
|
|
77
|
+
console.log(` GET http://localhost:${port}/policy`);
|
|
58
78
|
console.log('');
|
|
59
79
|
console.log('Press Ctrl+C to stop.');
|
|
60
80
|
});
|
|
@@ -104,6 +124,58 @@ async function handleBundle(req, res, cwd) {
|
|
|
104
124
|
const result = await captureOutput(() => runBundle(cwd, bundleFlags));
|
|
105
125
|
sendJsonRaw(res, 200, result.stdout);
|
|
106
126
|
}
|
|
127
|
+
async function handleMetrics(res, cwd) {
|
|
128
|
+
try {
|
|
129
|
+
const { computeTeamMetrics } = await import('@codeledger/engine');
|
|
130
|
+
// computeTeamMetrics requires (repoRoot, snapshots[]) — pass empty for API summary
|
|
131
|
+
const metrics = computeTeamMetrics(cwd, []);
|
|
132
|
+
sendJson(res, 200, metrics);
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
const metricsPath = join(cwd, '.codeledger', 'team-ledger', 'entries.jsonl');
|
|
136
|
+
if (!existsSync(metricsPath)) {
|
|
137
|
+
sendJson(res, 200, { score: 0, sessionCount: 0, message: 'No team-ledger data yet. Run: codeledger team-ledger sync' });
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
141
|
+
sendJson(res, 500, { error: 'Failed to compute metrics', message });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function handleProvenance(res, cwd) {
|
|
146
|
+
try {
|
|
147
|
+
const { loadGraph } = await import('@codeledger/engine');
|
|
148
|
+
const graph = loadGraph(cwd);
|
|
149
|
+
sendJson(res, 200, graph);
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
const provPath = join(cwd, '.codeledger', 'provenance');
|
|
153
|
+
if (!existsSync(provPath)) {
|
|
154
|
+
sendJson(res, 200, { nodes: [], edges: [], message: 'No provenance data yet.' });
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
158
|
+
sendJson(res, 500, { error: 'Failed to load provenance graph', message });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function handlePolicy(res, cwd) {
|
|
163
|
+
try {
|
|
164
|
+
const { loadTeamPolicy } = await import('@codeledger/engine');
|
|
165
|
+
const policy = loadTeamPolicy(cwd);
|
|
166
|
+
sendJson(res, 200, { policy, rules: policy.rules.length });
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
const policyPath = join(cwd, '.codeledger', 'team-policy.json');
|
|
170
|
+
if (!existsSync(policyPath)) {
|
|
171
|
+
sendJson(res, 200, { policy: null, message: 'No team policy configured. Run: codeledger policy' });
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
175
|
+
sendJson(res, 500, { error: 'Failed to load policy', message });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
107
179
|
// ─── Utilities ────────────────────────────────────────────────────────────────
|
|
108
180
|
function sendJson(res, status, data) {
|
|
109
181
|
res.writeHead(status, { 'Content-Type': 'application/json' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,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{"version":3,"file":"session-summary.d.ts","sourceRoot":"","sources":["../../src/commands/session-summary.ts"],"names":[],"mappings":"AA8BA;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CA4Jf"}
|
|
@@ -50,6 +50,7 @@ export async function runSessionSummary(cwd, flags) {
|
|
|
50
50
|
// ── Compute overlap metrics ─────────────────────────────────────────────
|
|
51
51
|
const bundleFiles = bundle.files.map((f) => f.path);
|
|
52
52
|
const overlap = filesChanged.filter((f) => bundleFiles.includes(f));
|
|
53
|
+
const regretFiles = filesChanged.filter((f) => !bundleFiles.includes(f));
|
|
53
54
|
const recall = filesChanged.length > 0
|
|
54
55
|
? overlap.length / filesChanged.length
|
|
55
56
|
: 0;
|
|
@@ -130,6 +131,8 @@ export async function runSessionSummary(cwd, flags) {
|
|
|
130
131
|
checkpoint_count: checkpointCount > 0 ? checkpointCount : undefined,
|
|
131
132
|
bundle_invalidation: bundleInvalidation ?? undefined,
|
|
132
133
|
review_coverage: reviewCoverage,
|
|
134
|
+
regret_files: regretFiles.length > 0 ? regretFiles : undefined,
|
|
135
|
+
regret_ratio: filesChanged.length > 0 ? regretFiles.length / filesChanged.length : undefined,
|
|
133
136
|
};
|
|
134
137
|
// ── Intent drift evaluation ───────────────────────────────────────────
|
|
135
138
|
const intentDrift = evaluateDrift(cwd, sessionId);
|
|
@@ -264,7 +267,7 @@ function printRecap(s, intentDrift, scopeDriftFiles, prefillTask, shadowFiles, t
|
|
|
264
267
|
// Classify the session pattern to give actionable advice
|
|
265
268
|
const sessionPattern = classifySessionPattern(s.files_changed);
|
|
266
269
|
if (sessionPattern.isInfrastructure) {
|
|
267
|
-
lines.push(` Pattern: infrastructure/ops session — ${sessionPattern.infraFileCount} of ${s.files_changed.length} files are infra (migrations, docker, scripts).`);
|
|
270
|
+
lines.push(` Pattern: infrastructure/ops session — ${sessionPattern.infraFileCount} of ${s.files_changed.length} files are infra (migrations, docker, scripts, k8s, terraform).`);
|
|
268
271
|
lines.push(` Assessment: Bundle recall is not meaningful for infrastructure tasks. Bundles target source code edits.`);
|
|
269
272
|
}
|
|
270
273
|
else if (sessionPattern.newFileRatio > 0.5) {
|
|
@@ -275,6 +278,12 @@ function printRecap(s, intentDrift, scopeDriftFiles, prefillTask, shadowFiles, t
|
|
|
275
278
|
lines.push(` Pattern: broad session (${s.files_changed.length} files touched). Bundle targets focused tasks.`);
|
|
276
279
|
lines.push(` Tip: For multi-phase work, refresh the bundle between phases: "codeledger activate --task \\"...\\"".`);
|
|
277
280
|
}
|
|
281
|
+
else if (s.recall === 0 && s.precision > 0) {
|
|
282
|
+
// Zero recall but bundle had files — work diverged from task
|
|
283
|
+
lines.push(` Pattern: work diverged from task — none of the ${s.files_changed.length} files you touched were in the bundle.`);
|
|
284
|
+
lines.push(` This often means the task changed mid-session. The bundle may have been correct for the original intent.`);
|
|
285
|
+
lines.push(` Tip: Refresh with "codeledger activate --task \\"your current goal\\"" when changing direction.`);
|
|
286
|
+
}
|
|
278
287
|
else {
|
|
279
288
|
lines.push(` The bundle was not useful for this task.`);
|
|
280
289
|
lines.push(` Tip: Re-run "codeledger activate --task ${prefillTask ? `"${s.task}"` : '...'}" with a more specific task description.`);
|
|
@@ -285,6 +294,13 @@ function printRecap(s, intentDrift, scopeDriftFiles, prefillTask, shadowFiles, t
|
|
|
285
294
|
lines.push(` Bundle predicted ${s.files_overlapping.length}/${s.files_changed.length} files you changed (${recallPct}% recall)`);
|
|
286
295
|
lines.push(` Bundle accuracy: ${s.files_overlapping.length}/${s.bundle_files.length} bundled files were relevant (${precisionPct}% precision)`);
|
|
287
296
|
lines.push(` Context: ~${fmtTokens(s.bundle_tokens)} tokens vs ~${fmtTokens(s.repo_total_tokens)} full repo (${reductionPct}% reduction)`);
|
|
297
|
+
const tokensSavedPartial = s.repo_total_tokens - s.bundle_tokens;
|
|
298
|
+
if (tokensSavedPartial > 0) {
|
|
299
|
+
const dollarsSavedPartial = (tokensSavedPartial / 1_000_000) * 3;
|
|
300
|
+
if (dollarsSavedPartial >= 0.01) {
|
|
301
|
+
lines.push(` Est. savings: ~$${dollarsSavedPartial.toFixed(2)} per task (at $3/M input tokens)`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
288
304
|
lines.push(` Tip: A more specific task description may improve recall.`);
|
|
289
305
|
}
|
|
290
306
|
else {
|
|
@@ -292,14 +308,30 @@ function printRecap(s, intentDrift, scopeDriftFiles, prefillTask, shadowFiles, t
|
|
|
292
308
|
lines.push(` Bundle predicted ${s.files_overlapping.length}/${s.files_changed.length} files you changed (${recallPct}% recall)`);
|
|
293
309
|
lines.push(` Bundle accuracy: ${s.files_overlapping.length}/${s.bundle_files.length} bundled files were relevant (${precisionPct}% precision)`);
|
|
294
310
|
lines.push(` Context: ~${fmtTokens(s.bundle_tokens)} tokens vs ~${fmtTokens(s.repo_total_tokens)} full repo (${reductionPct}% reduction)`);
|
|
311
|
+
const tokensSaved = s.repo_total_tokens - s.bundle_tokens;
|
|
312
|
+
if (tokensSaved > 0) {
|
|
313
|
+
const dollarsSaved = (tokensSaved / 1_000_000) * 3;
|
|
314
|
+
if (dollarsSaved >= 0.01) {
|
|
315
|
+
lines.push(` Est. savings: ~$${dollarsSaved.toFixed(2)} per task (at $3/M input tokens)`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
295
318
|
}
|
|
296
319
|
// ── Split recall annotation ─────────────────────────────────────────
|
|
297
320
|
// When files were created during the session, show edit-recall separately
|
|
298
321
|
// since bundle recall for new files is inherently 0%.
|
|
322
|
+
// Lead with edit-recall when new files significantly impact raw recall.
|
|
299
323
|
if (s.created_file_count !== undefined && s.created_file_count > 0 && !isRepoScan) {
|
|
300
324
|
const editRecallPct = s.edit_recall !== undefined ? Math.round(s.edit_recall * 100) : recallPct;
|
|
301
325
|
const editedCount = s.files_changed.length - s.created_file_count;
|
|
302
|
-
|
|
326
|
+
const creationRatio = s.created_file_count / s.files_changed.length;
|
|
327
|
+
if (creationRatio >= 0.3) {
|
|
328
|
+
// New files significantly drag down raw recall — highlight edit-recall as primary metric
|
|
329
|
+
lines.push(` >> Edit-recall: ${editRecallPct}% (${editedCount} existing files) — this is the meaningful metric`);
|
|
330
|
+
lines.push(` ${s.created_file_count} new file${s.created_file_count === 1 ? ' was' : 's were'} created (bundles cannot predict files that don't exist yet)`);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
lines.push(` Edit-recall: ${editRecallPct}% (${editedCount} existing files) | ${s.created_file_count} new file${s.created_file_count === 1 ? '' : 's'} created (not predictable)`);
|
|
334
|
+
}
|
|
303
335
|
}
|
|
304
336
|
// ── Debt injection section ───────────────────────────────────────────
|
|
305
337
|
if (s.debt && s.debt.total_suppressions > 0) {
|
|
@@ -343,6 +375,16 @@ function printRecap(s, intentDrift, scopeDriftFiles, prefillTask, shadowFiles, t
|
|
|
343
375
|
}
|
|
344
376
|
}
|
|
345
377
|
}
|
|
378
|
+
// ── Regret metric (missed files) ────────────────────────────────
|
|
379
|
+
if (s.regret_files && s.regret_files.length > 0 && !isRepoScan && s.recall < 0.9) {
|
|
380
|
+
lines.push(` Missed files: ${s.regret_files.length} file${s.regret_files.length === 1 ? '' : 's'} changed but not in bundle`);
|
|
381
|
+
for (const f of s.regret_files.slice(0, 5)) {
|
|
382
|
+
lines.push(` - ${f}`);
|
|
383
|
+
}
|
|
384
|
+
if (s.regret_files.length > 5) {
|
|
385
|
+
lines.push(` ... and ${s.regret_files.length - 5} more`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
346
388
|
// ── Conflict zone touches section ─────────────────────────────────
|
|
347
389
|
if (s.conflict_zone_touches !== undefined && s.conflict_zone_touches > 0) {
|
|
348
390
|
lines.push(` Conflict zones: ${s.conflict_zone_touches} contested file${s.conflict_zone_touches === 1 ? '' : 's'} were modified`);
|
|
@@ -432,6 +474,9 @@ function classifySessionPattern(filesChanged) {
|
|
|
432
474
|
/migrations?\//i, /\.sql$/i, /\.env(\.|$)/i,
|
|
433
475
|
/(?:^|\/)dockerfile/i, /(?:^|\/)docker-compose/i,
|
|
434
476
|
/(?:^|\/)makefile$/i, /\.sh$/i,
|
|
477
|
+
/(?:^|\/)k8s\//i, /(?:^|\/)kubernetes\//i, /(?:^|\/)helm\//i,
|
|
478
|
+
/(?:^|\/)terraform\//i, /\.tf$/i, /\.tfvars$/i,
|
|
479
|
+
/(?:^|\/)deploy\//i, /(?:^|\/)infra\//i, /(?:^|\/)infrastructure\//i,
|
|
435
480
|
/(?:^|\/)scripts?\//i, /\.github\//i, /ci\.ya?ml$/i,
|
|
436
481
|
];
|
|
437
482
|
const infraFileCount = filesChanged.filter((f) => infraPatterns.some((pat) => pat.test(f))).length;
|