@ulpi/cli 0.1.2 → 0.1.4
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/auth-ECQ3IB4E.js +118 -0
- package/dist/{chunk-UA6EFK64.js → chunk-2VYFVYJL.js} +63 -16
- package/dist/{chunk-VGZLMUNO.js → chunk-5J6NLQUN.js} +1 -1
- package/dist/chunk-B55DDP24.js +136 -0
- package/dist/{chunk-S253WCQJ.js → chunk-BZL5H4YQ.js} +1 -1
- package/dist/{chunk-NNUWU6CV.js → chunk-JGBXM5NC.js} +42 -0
- package/dist/{chunk-FNPD3V2X.js → chunk-PDR55ZNW.js} +57 -6
- package/dist/ci-STSL2LSP.js +370 -0
- package/dist/{codemap-3BVYMMVM.js → codemap-RKSD4MIE.js} +13 -13
- package/dist/{dist-MFFX7TZW.js → dist-CB5D5LMO.js} +2 -2
- package/dist/{dist-3SNTTNM3.js → dist-CS2VKNYS.js} +3 -3
- package/dist/{dist-57UMTPGR.js → dist-GJYT2OQV.js} +9 -3
- package/dist/{dist-RJGCUS3L.js → dist-QAU3LGJN.js} +3 -1
- package/dist/{dist-QYFQYSXP.js → dist-UKMCJBB2.js} +2 -2
- package/dist/{history-UG65BCO6.js → history-3MOBX4MA.js} +9 -6
- package/dist/index.js +34 -17
- package/dist/{init-22PO3EQB.js → init-6CH4HV5T.js} +2 -2
- package/dist/{memory-IT4H3WRD.js → memory-Y6OZTXJ2.js} +153 -34
- package/dist/{server-KYER5KX3-43RQQ4MY.js → server-USLHY6GH-AEOJC5ST.js} +2 -2
- package/dist/{ui-3EFREFSY.js → ui-OWXZ3YSR.js} +3 -3
- package/dist/ui.html +87 -87
- package/dist/{update-364RHTAO.js → update-M6IBJNYP.js} +1 -1
- package/dist/{version-checker-DTAS4ZYK.js → version-checker-Q6YTYAGP.js} +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
readTranscript,
|
|
47
47
|
updateEntryTranscript,
|
|
48
48
|
writeHistoryEntry
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-JGBXM5NC.js";
|
|
50
50
|
import {
|
|
51
51
|
JsonSessionStore,
|
|
52
52
|
appendEvent,
|
|
@@ -138,10 +138,10 @@ async function handleSessionStart(ctx) {
|
|
|
138
138
|
if (shouldPromptForGeneration(projectDir2)) {
|
|
139
139
|
outputGenerationPrompt();
|
|
140
140
|
}
|
|
141
|
-
import("./version-checker-
|
|
141
|
+
import("./version-checker-Q6YTYAGP.js").then((m) => m.checkForUpdates()).catch(() => {
|
|
142
142
|
});
|
|
143
143
|
try {
|
|
144
|
-
const { isMemoryEnabled, loadMemoryConfig, getTopMemories, formatMemoriesForAgent } = await import("./dist-
|
|
144
|
+
const { isMemoryEnabled, loadMemoryConfig, getTopMemories, formatMemoriesForAgent } = await import("./dist-GJYT2OQV.js");
|
|
145
145
|
if (isMemoryEnabled(projectDir2)) {
|
|
146
146
|
const config = loadMemoryConfig(projectDir2);
|
|
147
147
|
if (config.surfaceOnStart) {
|
|
@@ -155,15 +155,15 @@ async function handleSessionStart(ctx) {
|
|
|
155
155
|
} catch {
|
|
156
156
|
}
|
|
157
157
|
try {
|
|
158
|
-
const { loadCodemapConfig } = await import("./dist-
|
|
158
|
+
const { loadCodemapConfig } = await import("./dist-CB5D5LMO.js");
|
|
159
159
|
const { getCodemapBranch, getCurrentBranch } = await import("./dist-RKOGLK7R.js");
|
|
160
|
-
const { historyBranchExists: historyBranchExists2 } = await import("./dist-
|
|
160
|
+
const { historyBranchExists: historyBranchExists2 } = await import("./dist-QAU3LGJN.js");
|
|
161
161
|
const codemapConfig = loadCodemapConfig(projectDir2);
|
|
162
162
|
if (codemapConfig.autoImport) {
|
|
163
163
|
const branch = state.branch ?? getCurrentBranch(projectDir2);
|
|
164
164
|
const shadowBranch = getCodemapBranch(branch);
|
|
165
165
|
if (historyBranchExists2(projectDir2, shadowBranch)) {
|
|
166
|
-
const { importIndex } = await import("./dist-
|
|
166
|
+
const { importIndex } = await import("./dist-CB5D5LMO.js");
|
|
167
167
|
await importIndex(projectDir2, branch);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -1473,7 +1473,7 @@ ${failureFeedback.join("\n\n")}`
|
|
|
1473
1473
|
}
|
|
1474
1474
|
}
|
|
1475
1475
|
try {
|
|
1476
|
-
const { isMemoryEnabled, loadMemoryConfig, appendMemoryEvent, toClassificationEvent } = await import("./dist-
|
|
1476
|
+
const { isMemoryEnabled, loadMemoryConfig, appendMemoryEvent, toClassificationEvent } = await import("./dist-GJYT2OQV.js");
|
|
1477
1477
|
if (isMemoryEnabled(projectDir2)) {
|
|
1478
1478
|
const memConfig = loadMemoryConfig(projectDir2);
|
|
1479
1479
|
if (memConfig.captureMode === "continuous") {
|
|
@@ -1493,7 +1493,7 @@ ${failureFeedback.join("\n\n")}`
|
|
|
1493
1493
|
}
|
|
1494
1494
|
if (input.tool_name === "Bash" && /\bgit\s+push\b/.test(String(input.tool_input?.command ?? ""))) {
|
|
1495
1495
|
try {
|
|
1496
|
-
const { loadCodemapConfig, getCodemapStatus, exportIndex } = await import("./dist-
|
|
1496
|
+
const { loadCodemapConfig, getCodemapStatus, exportIndex } = await import("./dist-CB5D5LMO.js");
|
|
1497
1497
|
const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
|
|
1498
1498
|
const codemapConfig = loadCodemapConfig(projectDir2);
|
|
1499
1499
|
if (codemapConfig.autoExport) {
|
|
@@ -1835,7 +1835,7 @@ async function handleSessionEnd(ctx) {
|
|
|
1835
1835
|
} catch {
|
|
1836
1836
|
}
|
|
1837
1837
|
try {
|
|
1838
|
-
const memEngine = await import("./dist-
|
|
1838
|
+
const memEngine = await import("./dist-GJYT2OQV.js");
|
|
1839
1839
|
if (memEngine.isMemoryEnabled(projectDir2)) {
|
|
1840
1840
|
const config = memEngine.loadMemoryConfig(projectDir2);
|
|
1841
1841
|
memEngine.finalizeCapture(input.session_id, state, projectDir2);
|
|
@@ -1863,7 +1863,18 @@ async function handleSessionEnd(ctx) {
|
|
|
1863
1863
|
console.error(`[ulpi] Memory capture failed: ${msg}`);
|
|
1864
1864
|
}
|
|
1865
1865
|
try {
|
|
1866
|
-
|
|
1866
|
+
if (historyBranchExists(projectDir2)) {
|
|
1867
|
+
const args2 = ["history", "backfill", "-p", projectDir2, "--limit", "50", "--branch-only"];
|
|
1868
|
+
const child = spawn(process.execPath, [process.argv[1], ...args2], {
|
|
1869
|
+
detached: true,
|
|
1870
|
+
stdio: "ignore"
|
|
1871
|
+
});
|
|
1872
|
+
child.unref();
|
|
1873
|
+
}
|
|
1874
|
+
} catch {
|
|
1875
|
+
}
|
|
1876
|
+
try {
|
|
1877
|
+
const { loadCodemapConfig, getCodemapStatus, exportIndex } = await import("./dist-CB5D5LMO.js");
|
|
1867
1878
|
const { getCurrentBranch } = await import("./dist-RKOGLK7R.js");
|
|
1868
1879
|
const codemapConfig = loadCodemapConfig(projectDir2);
|
|
1869
1880
|
if (codemapConfig.autoExport) {
|
|
@@ -2034,7 +2045,7 @@ async function main() {
|
|
|
2034
2045
|
switch (command) {
|
|
2035
2046
|
case "init": {
|
|
2036
2047
|
const initDir = rawArgs.some((a) => a === "--project" || a === "-p") ? projectDir : process.cwd();
|
|
2037
|
-
return (await import("./init-
|
|
2048
|
+
return (await import("./init-6CH4HV5T.js")).runInit([initDir, ...args.slice(1)]);
|
|
2038
2049
|
}
|
|
2039
2050
|
case "rules":
|
|
2040
2051
|
return (await import("./rules-E427DKYJ.js")).runRules(args.slice(1), projectDir);
|
|
@@ -2053,24 +2064,28 @@ async function main() {
|
|
|
2053
2064
|
case "uninstall":
|
|
2054
2065
|
return (await import("./uninstall-6SW35IK4.js")).runUninstall(args.slice(1), projectDir);
|
|
2055
2066
|
case "ui":
|
|
2056
|
-
return (await import("./ui-
|
|
2067
|
+
return (await import("./ui-OWXZ3YSR.js")).runUI(args.slice(1), projectDir);
|
|
2057
2068
|
case "update":
|
|
2058
|
-
return (await import("./update-
|
|
2069
|
+
return (await import("./update-M6IBJNYP.js")).runUpdate(args.slice(1));
|
|
2059
2070
|
case "history":
|
|
2060
|
-
return (await import("./history-
|
|
2071
|
+
return (await import("./history-3MOBX4MA.js")).runHistory(args.slice(1), projectDir);
|
|
2061
2072
|
case "review":
|
|
2062
2073
|
return (await import("./review-ADUPV3PN.js")).runReview(args.slice(1), projectDir);
|
|
2063
2074
|
case "config":
|
|
2064
2075
|
return (await import("./config-EGAXXCGL.js")).runConfig(args.slice(1));
|
|
2065
2076
|
case "codemap":
|
|
2066
|
-
return (await import("./codemap-
|
|
2077
|
+
return (await import("./codemap-RKSD4MIE.js")).runCodemap(args.slice(1), projectDir);
|
|
2067
2078
|
case "memory":
|
|
2068
|
-
return (await import("./memory-
|
|
2079
|
+
return (await import("./memory-Y6OZTXJ2.js")).runMemory(args.slice(1), projectDir);
|
|
2069
2080
|
case "projects":
|
|
2070
2081
|
return (await import("./projects-ATHDD3D6.js")).runProjects(args.slice(1));
|
|
2082
|
+
case "ci":
|
|
2083
|
+
return (await import("./ci-STSL2LSP.js")).runCi(args.slice(1), projectDir);
|
|
2084
|
+
case "auth":
|
|
2085
|
+
return (await import("./auth-ECQ3IB4E.js")).runAuth(args.slice(1));
|
|
2071
2086
|
case "--version":
|
|
2072
2087
|
case "-v":
|
|
2073
|
-
console.log("0.1.
|
|
2088
|
+
console.log("0.1.4");
|
|
2074
2089
|
return;
|
|
2075
2090
|
case "--help":
|
|
2076
2091
|
case "-h":
|
|
@@ -2114,6 +2129,8 @@ CLI Commands:
|
|
|
2114
2129
|
config Manage settings and API keys
|
|
2115
2130
|
codemap Semantic code indexing (init/search/status/reindex/watch)
|
|
2116
2131
|
memory Agent memory (init/search/remember/status/export/import/serve)
|
|
2132
|
+
ci Run in CI/PR worker mode (used inside worker containers)
|
|
2133
|
+
auth Manage Claude Code credentials for CI workers
|
|
2117
2134
|
update Check for and install updates
|
|
2118
2135
|
|
|
2119
2136
|
Global Options:
|
|
@@ -121,8 +121,8 @@ async function runInit(args) {
|
|
|
121
121
|
} catch {
|
|
122
122
|
}
|
|
123
123
|
try {
|
|
124
|
-
const { runInitPipeline } = await import("./dist-
|
|
125
|
-
const { initMemoryBranch } = await import("./dist-
|
|
124
|
+
const { runInitPipeline } = await import("./dist-CB5D5LMO.js");
|
|
125
|
+
const { initMemoryBranch } = await import("./dist-GJYT2OQV.js");
|
|
126
126
|
console.log(chalk.cyan("\nInitializing code index..."));
|
|
127
127
|
try {
|
|
128
128
|
await runInitPipeline(projectDir, (progress) => {
|
|
@@ -25,6 +25,8 @@ async function runMemory(args, projectDir) {
|
|
|
25
25
|
return await enableSubcommand(projectDir);
|
|
26
26
|
case "disable":
|
|
27
27
|
return await disableSubcommand(projectDir);
|
|
28
|
+
case "reindex":
|
|
29
|
+
return await reindexSubcommand(projectDir);
|
|
28
30
|
default:
|
|
29
31
|
console.log(`
|
|
30
32
|
Usage: ulpi memory <subcommand>
|
|
@@ -38,14 +40,17 @@ Subcommands:
|
|
|
38
40
|
import Pull memories from git branch
|
|
39
41
|
serve Start MCP server (stdio)
|
|
40
42
|
classify [session-id] Classify session(s) \u2014 all unclassified if no ID given
|
|
43
|
+
--branch <name> Only classify sessions from this branch
|
|
44
|
+
--export Export memories to git branch after classification
|
|
41
45
|
enable Enable memory capture
|
|
42
46
|
disable Disable memory capture
|
|
47
|
+
reindex Rebuild vector index (fixes dimension mismatches)
|
|
43
48
|
`.trim());
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
async function initSubcommand(projectDir) {
|
|
47
52
|
console.log(chalk.bold("\nAgent Memory -- Initialize\n"));
|
|
48
|
-
const { isMemoryInitialized, saveMemoryConfig, DEFAULT_MEMORY_CONFIG } = await import("./dist-
|
|
53
|
+
const { isMemoryInitialized, saveMemoryConfig, DEFAULT_MEMORY_CONFIG } = await import("./dist-GJYT2OQV.js");
|
|
49
54
|
const { projectMemoryDir } = await import("./dist-RKOGLK7R.js");
|
|
50
55
|
const fs = await import("fs");
|
|
51
56
|
if (isMemoryInitialized(projectDir)) {
|
|
@@ -99,7 +104,7 @@ async function searchSubcommand(args, projectDir) {
|
|
|
99
104
|
const ora = (await import("ora")).default;
|
|
100
105
|
const spinner = ora("Searching memories...").start();
|
|
101
106
|
try {
|
|
102
|
-
const { searchMemory, isMemoryInitialized } = await import("./dist-
|
|
107
|
+
const { searchMemory, isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
|
|
103
108
|
if (!isMemoryInitialized(projectDir)) {
|
|
104
109
|
spinner.fail("Memory not initialized");
|
|
105
110
|
console.log(chalk.dim("Run 'ulpi memory init' first."));
|
|
@@ -165,7 +170,7 @@ async function rememberSubcommand(args, projectDir) {
|
|
|
165
170
|
console.log(chalk.dim('\nExample: ulpi memory remember "Always run tests before committing" --type PREFERENCE --importance high'));
|
|
166
171
|
return;
|
|
167
172
|
}
|
|
168
|
-
const { isMemoryInitialized } = await import("./dist-
|
|
173
|
+
const { isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
|
|
169
174
|
if (!isMemoryInitialized(projectDir)) {
|
|
170
175
|
console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
171
176
|
return;
|
|
@@ -185,7 +190,7 @@ async function rememberSubcommand(args, projectDir) {
|
|
|
185
190
|
const ora = (await import("ora")).default;
|
|
186
191
|
const spinner = ora("Storing memory...").start();
|
|
187
192
|
try {
|
|
188
|
-
const { generateMemoryId, rememberMemory } = await import("./dist-
|
|
193
|
+
const { generateMemoryId, rememberMemory } = await import("./dist-GJYT2OQV.js");
|
|
189
194
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
190
195
|
const entry = {
|
|
191
196
|
id: generateMemoryId(memType, text),
|
|
@@ -211,7 +216,7 @@ async function rememberSubcommand(args, projectDir) {
|
|
|
211
216
|
}
|
|
212
217
|
}
|
|
213
218
|
async function statusSubcommand(projectDir) {
|
|
214
|
-
const { isMemoryInitialized, getMemoryStats, isMemoryEnabled, loadMemoryConfig } = await import("./dist-
|
|
219
|
+
const { isMemoryInitialized, getMemoryStats, isMemoryEnabled, loadMemoryConfig } = await import("./dist-GJYT2OQV.js");
|
|
215
220
|
console.log(chalk.bold("\nAgent Memory Status\n"));
|
|
216
221
|
if (!isMemoryInitialized(projectDir)) {
|
|
217
222
|
console.log(chalk.yellow(" Not initialized"));
|
|
@@ -252,7 +257,7 @@ async function statusSubcommand(projectDir) {
|
|
|
252
257
|
}
|
|
253
258
|
async function exportSubcommand(projectDir) {
|
|
254
259
|
console.log(chalk.bold("\nAgent Memory -- Export\n"));
|
|
255
|
-
const { isMemoryInitialized, exportMemories } = await import("./dist-
|
|
260
|
+
const { isMemoryInitialized, exportMemories } = await import("./dist-GJYT2OQV.js");
|
|
256
261
|
if (!isMemoryInitialized(projectDir)) {
|
|
257
262
|
console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
258
263
|
return;
|
|
@@ -272,7 +277,7 @@ async function exportSubcommand(projectDir) {
|
|
|
272
277
|
}
|
|
273
278
|
async function importSubcommand(projectDir) {
|
|
274
279
|
console.log(chalk.bold("\nAgent Memory -- Import\n"));
|
|
275
|
-
const { importMemories } = await import("./dist-
|
|
280
|
+
const { importMemories } = await import("./dist-GJYT2OQV.js");
|
|
276
281
|
try {
|
|
277
282
|
const result = await importMemories(projectDir);
|
|
278
283
|
if (!result.success) {
|
|
@@ -290,18 +295,18 @@ async function importSubcommand(projectDir) {
|
|
|
290
295
|
}
|
|
291
296
|
}
|
|
292
297
|
async function serveSubcommand(projectDir) {
|
|
293
|
-
const { isMemoryInitialized } = await import("./dist-
|
|
298
|
+
const { isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
|
|
294
299
|
if (!isMemoryInitialized(projectDir)) {
|
|
295
300
|
console.error(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
296
301
|
process.exit(1);
|
|
297
302
|
}
|
|
298
303
|
console.error(chalk.dim("[memory-mcp] Starting MCP server..."));
|
|
299
304
|
console.error(chalk.dim(`[memory-mcp] Project: ${projectDir}`));
|
|
300
|
-
const { startMemoryMcpServer } = await import("./dist-
|
|
305
|
+
const { startMemoryMcpServer } = await import("./dist-CS2VKNYS.js");
|
|
301
306
|
await startMemoryMcpServer({ projectDir });
|
|
302
307
|
}
|
|
303
308
|
async function classifySubcommand(args, projectDir) {
|
|
304
|
-
const { isMemoryInitialized, listCapturedSessions, classifySession, loadWatermark } = await import("./dist-
|
|
309
|
+
const { isMemoryInitialized, listCapturedSessions, classifySession, loadWatermark, writeClassifyBatchProgress, clearClassifyBatchProgress } = await import("./dist-GJYT2OQV.js");
|
|
305
310
|
if (!isMemoryInitialized(projectDir)) {
|
|
306
311
|
console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
307
312
|
return;
|
|
@@ -309,6 +314,11 @@ async function classifySubcommand(args, projectDir) {
|
|
|
309
314
|
const ora = (await import("ora")).default;
|
|
310
315
|
const doExport = args.includes("--export");
|
|
311
316
|
const isBg = !!process.env.ULPI_BG_CLASSIFY;
|
|
317
|
+
let branchFilter;
|
|
318
|
+
const branchFlagIdx = args.indexOf("--branch");
|
|
319
|
+
if (branchFlagIdx !== -1 && args[branchFlagIdx + 1]) {
|
|
320
|
+
branchFilter = args[branchFlagIdx + 1];
|
|
321
|
+
}
|
|
312
322
|
let sessionId;
|
|
313
323
|
const sessionFlagIdx = args.indexOf("--session");
|
|
314
324
|
if (sessionFlagIdx !== -1 && args[sessionFlagIdx + 1]) {
|
|
@@ -316,6 +326,7 @@ async function classifySubcommand(args, projectDir) {
|
|
|
316
326
|
} else {
|
|
317
327
|
const skipNext = /* @__PURE__ */ new Set();
|
|
318
328
|
if (sessionFlagIdx !== -1) skipNext.add(sessionFlagIdx + 1);
|
|
329
|
+
if (branchFlagIdx !== -1) skipNext.add(branchFlagIdx + 1);
|
|
319
330
|
for (let i = 0; i < args.length; i++) {
|
|
320
331
|
if (skipNext.has(i) || args[i].startsWith("--")) continue;
|
|
321
332
|
sessionId = args[i];
|
|
@@ -330,7 +341,7 @@ async function classifySubcommand(args, projectDir) {
|
|
|
330
341
|
}
|
|
331
342
|
if (doExport) {
|
|
332
343
|
try {
|
|
333
|
-
const { exportMemories } = await import("./dist-
|
|
344
|
+
const { exportMemories } = await import("./dist-GJYT2OQV.js");
|
|
334
345
|
await exportMemories(projectDir);
|
|
335
346
|
} catch {
|
|
336
347
|
}
|
|
@@ -340,7 +351,7 @@ async function classifySubcommand(args, projectDir) {
|
|
|
340
351
|
await classifySingleSession(projectDir, sessionId, classifySession);
|
|
341
352
|
if (doExport) {
|
|
342
353
|
try {
|
|
343
|
-
const { exportMemories } = await import("./dist-
|
|
354
|
+
const { exportMemories } = await import("./dist-GJYT2OQV.js");
|
|
344
355
|
const result = await exportMemories(projectDir);
|
|
345
356
|
console.log(chalk.green(`\u2713 Exported ${result.memoriesExported} memories to ${result.branchName}`));
|
|
346
357
|
} catch (err) {
|
|
@@ -350,60 +361,145 @@ async function classifySubcommand(args, projectDir) {
|
|
|
350
361
|
}
|
|
351
362
|
return;
|
|
352
363
|
}
|
|
353
|
-
const
|
|
364
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
365
|
+
let sessions = listCapturedSessions(projectDir);
|
|
354
366
|
if (sessions.length === 0) {
|
|
355
|
-
|
|
356
|
-
|
|
367
|
+
writeClassifyBatchProgress(projectDir, {
|
|
368
|
+
status: "done",
|
|
369
|
+
total: 0,
|
|
370
|
+
completed: 0,
|
|
371
|
+
failed: 0,
|
|
372
|
+
memoriesFound: 0,
|
|
373
|
+
branch: branchFilter,
|
|
374
|
+
startedAt: now,
|
|
375
|
+
updatedAt: now
|
|
376
|
+
});
|
|
377
|
+
if (!isBg) {
|
|
378
|
+
console.log(chalk.yellow("No captured sessions found."));
|
|
379
|
+
console.log(chalk.dim("Sessions are captured automatically at session end when memory is enabled."));
|
|
380
|
+
}
|
|
357
381
|
return;
|
|
358
382
|
}
|
|
383
|
+
if (branchFilter) {
|
|
384
|
+
sessions = sessions.filter((s) => s.branch === branchFilter);
|
|
385
|
+
if (sessions.length === 0) {
|
|
386
|
+
writeClassifyBatchProgress(projectDir, {
|
|
387
|
+
status: "done",
|
|
388
|
+
total: 0,
|
|
389
|
+
completed: 0,
|
|
390
|
+
failed: 0,
|
|
391
|
+
memoriesFound: 0,
|
|
392
|
+
branch: branchFilter,
|
|
393
|
+
startedAt: now,
|
|
394
|
+
updatedAt: now
|
|
395
|
+
});
|
|
396
|
+
if (!isBg) {
|
|
397
|
+
console.log(chalk.yellow(`No captured sessions found for branch "${branchFilter}".`));
|
|
398
|
+
}
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
359
402
|
const unclassified = sessions.filter((s) => {
|
|
360
403
|
const wm = loadWatermark(projectDir, s.sessionId);
|
|
361
404
|
return !wm;
|
|
362
405
|
});
|
|
363
406
|
if (unclassified.length === 0) {
|
|
364
|
-
|
|
365
|
-
|
|
407
|
+
writeClassifyBatchProgress(projectDir, {
|
|
408
|
+
status: "done",
|
|
409
|
+
total: 0,
|
|
410
|
+
completed: 0,
|
|
411
|
+
failed: 0,
|
|
412
|
+
memoriesFound: 0,
|
|
413
|
+
branch: branchFilter,
|
|
414
|
+
startedAt: now,
|
|
415
|
+
updatedAt: now
|
|
416
|
+
});
|
|
417
|
+
if (!isBg) {
|
|
418
|
+
console.log(chalk.yellow("All captured sessions have been classified."));
|
|
419
|
+
console.log(chalk.dim(` Total sessions: ${sessions.length}`));
|
|
420
|
+
if (branchFilter) console.log(chalk.dim(` Branch filter: ${branchFilter}`));
|
|
421
|
+
}
|
|
366
422
|
return;
|
|
367
423
|
}
|
|
368
|
-
|
|
424
|
+
if (!isBg) {
|
|
425
|
+
console.log(chalk.bold(`
|
|
369
426
|
Agent Memory -- Classify Sessions
|
|
370
427
|
`));
|
|
371
|
-
|
|
428
|
+
console.log(chalk.dim(` Found ${unclassified.length} unclassified session(s)${branchFilter ? ` on branch "${branchFilter}"` : ""}
|
|
372
429
|
`));
|
|
430
|
+
}
|
|
373
431
|
let totalExtracted = 0;
|
|
374
432
|
let totalStored = 0;
|
|
375
433
|
let succeeded = 0;
|
|
376
434
|
let failed = 0;
|
|
435
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
436
|
+
writeClassifyBatchProgress(projectDir, {
|
|
437
|
+
status: "classifying",
|
|
438
|
+
total: unclassified.length,
|
|
439
|
+
completed: 0,
|
|
440
|
+
failed: 0,
|
|
441
|
+
memoriesFound: 0,
|
|
442
|
+
branch: branchFilter,
|
|
443
|
+
startedAt,
|
|
444
|
+
updatedAt: startedAt
|
|
445
|
+
});
|
|
377
446
|
for (let i = 0; i < unclassified.length; i++) {
|
|
378
447
|
const session = unclassified[i];
|
|
379
448
|
const label = `[${i + 1}/${unclassified.length}] ${session.sessionId.slice(0, 8)}... (${session.filesWritten} writes, ${session.commandsRun} cmds)`;
|
|
380
|
-
const spinner = ora(label).start();
|
|
449
|
+
const spinner = isBg ? null : ora(label).start();
|
|
450
|
+
writeClassifyBatchProgress(projectDir, {
|
|
451
|
+
status: "classifying",
|
|
452
|
+
total: unclassified.length,
|
|
453
|
+
completed: i,
|
|
454
|
+
failed,
|
|
455
|
+
memoriesFound: totalStored,
|
|
456
|
+
current: session.sessionId,
|
|
457
|
+
branch: branchFilter,
|
|
458
|
+
startedAt,
|
|
459
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
460
|
+
});
|
|
381
461
|
try {
|
|
382
462
|
const result = await classifySession(projectDir, session.sessionId, (progress) => {
|
|
463
|
+
if (!spinner) return;
|
|
383
464
|
const pct = progress.total > 0 ? ` (${Math.round(progress.current / progress.total * 100)}%)` : "";
|
|
384
465
|
spinner.text = `${label} \u2014 ${progress.message}${pct}`;
|
|
385
466
|
});
|
|
386
467
|
totalExtracted += result.memoriesExtracted;
|
|
387
468
|
totalStored += result.memoriesStored;
|
|
388
469
|
succeeded++;
|
|
389
|
-
if (
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
470
|
+
if (spinner) {
|
|
471
|
+
if (result.memoriesStored > 0) {
|
|
472
|
+
spinner.succeed(`${label} \u2014 ${result.memoriesStored} memories stored`);
|
|
473
|
+
} else {
|
|
474
|
+
spinner.info(`${label} \u2014 no new memories`);
|
|
475
|
+
}
|
|
393
476
|
}
|
|
394
477
|
} catch (err) {
|
|
395
478
|
failed++;
|
|
396
479
|
const message = err instanceof Error ? err.message : String(err);
|
|
397
|
-
spinner.fail(`${label} \u2014 ${message}`);
|
|
480
|
+
if (spinner) spinner.fail(`${label} \u2014 ${message}`);
|
|
398
481
|
}
|
|
399
482
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
483
|
+
writeClassifyBatchProgress(projectDir, {
|
|
484
|
+
status: failed === unclassified.length ? "error" : "done",
|
|
485
|
+
total: unclassified.length,
|
|
486
|
+
completed: succeeded,
|
|
487
|
+
failed,
|
|
488
|
+
memoriesFound: totalStored,
|
|
489
|
+
branch: branchFilter,
|
|
490
|
+
startedAt,
|
|
491
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
492
|
+
error: failed === unclassified.length ? "All sessions failed classification" : void 0
|
|
493
|
+
});
|
|
494
|
+
if (!isBg) {
|
|
495
|
+
console.log("");
|
|
496
|
+
console.log(chalk.bold(" Summary"));
|
|
497
|
+
console.log(chalk.dim(` Sessions processed: ${succeeded}/${unclassified.length}`));
|
|
498
|
+
if (failed > 0) console.log(chalk.red(` Failed: ${failed}`));
|
|
499
|
+
console.log(chalk.dim(` Memories extracted: ${totalExtracted}`));
|
|
500
|
+
console.log(chalk.dim(` Memories stored: ${totalStored}`));
|
|
501
|
+
console.log("");
|
|
502
|
+
}
|
|
407
503
|
}
|
|
408
504
|
async function classifySingleSession(projectDir, sessionId, classifySession) {
|
|
409
505
|
console.log(chalk.bold(`
|
|
@@ -430,7 +526,7 @@ Agent Memory -- Classify Session
|
|
|
430
526
|
}
|
|
431
527
|
}
|
|
432
528
|
async function enableSubcommand(projectDir) {
|
|
433
|
-
const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-
|
|
529
|
+
const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
|
|
434
530
|
if (!isMemoryInitialized(projectDir)) {
|
|
435
531
|
console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
436
532
|
return;
|
|
@@ -441,7 +537,7 @@ async function enableSubcommand(projectDir) {
|
|
|
441
537
|
console.log(chalk.green("\u2713 Memory capture enabled"));
|
|
442
538
|
}
|
|
443
539
|
async function disableSubcommand(projectDir) {
|
|
444
|
-
const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-
|
|
540
|
+
const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
|
|
445
541
|
if (!isMemoryInitialized(projectDir)) {
|
|
446
542
|
console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
447
543
|
return;
|
|
@@ -451,6 +547,29 @@ async function disableSubcommand(projectDir) {
|
|
|
451
547
|
saveMemoryConfig(projectDir, config);
|
|
452
548
|
console.log(chalk.yellow("\u2713 Memory capture disabled"));
|
|
453
549
|
}
|
|
550
|
+
async function reindexSubcommand(projectDir) {
|
|
551
|
+
const { isMemoryInitialized, reindexMemories } = await import("./dist-GJYT2OQV.js");
|
|
552
|
+
if (!isMemoryInitialized(projectDir)) {
|
|
553
|
+
console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
console.log(chalk.bold("\nAgent Memory -- Reindex\n"));
|
|
557
|
+
const ora = (await import("ora")).default;
|
|
558
|
+
const spinner = ora("Rebuilding vector index...").start();
|
|
559
|
+
try {
|
|
560
|
+
const result = await reindexMemories(projectDir, (progress) => {
|
|
561
|
+
const pct = progress.total > 0 ? ` (${Math.round(progress.current / progress.total * 100)}%)` : "";
|
|
562
|
+
spinner.text = `${progress.message}${pct}`;
|
|
563
|
+
});
|
|
564
|
+
spinner.succeed("Reindex complete");
|
|
565
|
+
console.log(chalk.dim(` Entries reindexed: ${result.reindexed}`));
|
|
566
|
+
console.log(chalk.dim(` Duration: ${(result.durationMs / 1e3).toFixed(1)}s`));
|
|
567
|
+
console.log("");
|
|
568
|
+
} catch (err) {
|
|
569
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
570
|
+
spinner.fail(`Reindex failed: ${message}`);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
454
573
|
function truncate(str, maxLen) {
|
|
455
574
|
if (str.length <= maxLen) return str;
|
|
456
575
|
return str.slice(0, maxLen - 3) + "...";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VYFVYJL.js";
|
|
4
4
|
import "./chunk-MIAQVCFW.js";
|
|
5
5
|
import "./chunk-2MZER6ND.js";
|
|
6
6
|
import "./chunk-3SBPZRB5.js";
|
|
@@ -8,7 +8,7 @@ import "./chunk-2CLNOKPA.js";
|
|
|
8
8
|
import "./chunk-SPOI23SB.js";
|
|
9
9
|
import "./chunk-6OCEY7JY.js";
|
|
10
10
|
import "./chunk-SIAQVRKG.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-JGBXM5NC.js";
|
|
12
12
|
import "./chunk-YM2HV4IA.js";
|
|
13
13
|
import "./chunk-KIKPIH6N.js";
|
|
14
14
|
import "./chunk-7LXY5UVC.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiServer,
|
|
3
3
|
setUiServerPort
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2VYFVYJL.js";
|
|
5
5
|
import {
|
|
6
6
|
attachWebSocket
|
|
7
7
|
} from "./chunk-7AL4DOEJ.js";
|
|
@@ -15,7 +15,7 @@ import "./chunk-2CLNOKPA.js";
|
|
|
15
15
|
import "./chunk-SPOI23SB.js";
|
|
16
16
|
import "./chunk-6OCEY7JY.js";
|
|
17
17
|
import "./chunk-SIAQVRKG.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-JGBXM5NC.js";
|
|
19
19
|
import "./chunk-YM2HV4IA.js";
|
|
20
20
|
import "./chunk-KIKPIH6N.js";
|
|
21
21
|
import {
|
|
@@ -55,7 +55,7 @@ async function main() {
|
|
|
55
55
|
const projectDir = process.argv[2] || process.cwd();
|
|
56
56
|
const secret = generateApiSecret2();
|
|
57
57
|
setApiSecret2(secret);
|
|
58
|
-
const { createApiServer: createApiServer2 } = await import("./server-
|
|
58
|
+
const { createApiServer: createApiServer2 } = await import("./server-USLHY6GH-AEOJC5ST.js");
|
|
59
59
|
const { attachWebSocket: attachWebSocket2 } = await import("./server-X5P6WH2M-7K2RY34N.js");
|
|
60
60
|
const server = createApiServer2(projectDir);
|
|
61
61
|
const wss = attachWebSocket2(server, projectDir);
|