@ulpi/cli 0.1.1 → 0.1.3

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.
Files changed (30) hide show
  1. package/dist/auth-KQCJ43U2.js +118 -0
  2. package/dist/{chunk-Q4HIY43N.js → chunk-2VYFVYJL.js} +67 -24
  3. package/dist/{chunk-DBMUNBNB.js → chunk-5J6NLQUN.js} +149 -19
  4. package/dist/{chunk-4KRVDKGB.js → chunk-F7OXF7Z3.js} +1 -1
  5. package/dist/chunk-G6SVZ4Q5.js +122 -0
  6. package/dist/{chunk-NNUWU6CV.js → chunk-JGBXM5NC.js} +42 -0
  7. package/dist/{chunk-6JCMYYBT.js → chunk-PDR55ZNW.js} +247 -112
  8. package/dist/{chunk-247GVVKK.js → chunk-ZLYRPD7I.js} +18 -16
  9. package/dist/ci-QM57ZCBW.js +367 -0
  10. package/dist/{codemap-RRJIDBQ5.js → codemap-RKSD4MIE.js} +49 -17
  11. package/dist/{dist-LZKZFPVX.js → dist-CB5D5LMO.js} +6 -3
  12. package/dist/{dist-7LHZ65GC.js → dist-CS2VKNYS.js} +5 -4
  13. package/dist/{dist-R5F4MX3I.js → dist-GJYT2OQV.js} +11 -4
  14. package/dist/{dist-RJGCUS3L.js → dist-QAU3LGJN.js} +3 -1
  15. package/dist/{dist-W7K4WPAF.js → dist-UKMCJBB2.js} +42 -14
  16. package/dist/{dist-R5ZJ4LX5.js → dist-YA2BWZB2.js} +1 -1
  17. package/dist/{history-Q2LDADFW.js → history-NFNA4HE5.js} +13 -7
  18. package/dist/index.js +50 -21
  19. package/dist/{init-AY5C2ZAS.js → init-6CH4HV5T.js} +2 -2
  20. package/dist/{memory-J3G24QHS.js → memory-Y6OZTXJ2.js} +231 -22
  21. package/dist/{server-MOYPE4SM-N7SE2AN7.js → server-USLHY6GH-AEOJC5ST.js} +2 -2
  22. package/dist/skills/ulpi-generate-guardian/SKILL.md +246 -7
  23. package/dist/skills/ulpi-generate-guardian/references/framework-rules.md +161 -4
  24. package/dist/skills/ulpi-generate-guardian/references/language-rules.md +13 -18
  25. package/dist/{ui-L7UAWXDY.js → ui-OWXZ3YSR.js} +3 -3
  26. package/dist/ui.html +112 -112
  27. package/dist/{update-DJ227LL3.js → update-WUITQX4Z.js} +1 -1
  28. package/dist/{version-checker-M37KI7DY.js → version-checker-SMAYSN7Y.js} +1 -1
  29. package/package.json +31 -28
  30. package/LICENSE +0 -21
@@ -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>
@@ -37,15 +39,18 @@ Subcommands:
37
39
  export Push memories to git branch
38
40
  import Pull memories from git branch
39
41
  serve Start MCP server (stdio)
40
- classify [session-id] Run classifier on a captured session
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-R5F4MX3I.js");
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-R5F4MX3I.js");
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-R5F4MX3I.js");
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-R5F4MX3I.js");
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-R5F4MX3I.js");
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,17 +257,18 @@ 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-R5F4MX3I.js");
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;
259
264
  }
260
265
  try {
261
- const result = exportMemories(projectDir);
266
+ const result = await exportMemories(projectDir);
262
267
  console.log(chalk.green("\u2713 Export complete"));
263
268
  console.log(chalk.dim(` Branch: ${result.branchName}`));
264
269
  console.log(chalk.dim(` Commit: ${result.commitSha.slice(0, 8)}`));
265
270
  console.log(chalk.dim(` Memories: ${result.memoriesExported}`));
271
+ console.log(chalk.dim(` Files: ${result.filesExported}`));
266
272
  console.log("");
267
273
  } catch (err) {
268
274
  const message = err instanceof Error ? err.message : String(err);
@@ -271,15 +277,16 @@ async function exportSubcommand(projectDir) {
271
277
  }
272
278
  async function importSubcommand(projectDir) {
273
279
  console.log(chalk.bold("\nAgent Memory -- Import\n"));
274
- const { importMemories } = await import("./dist-R5F4MX3I.js");
280
+ const { importMemories } = await import("./dist-GJYT2OQV.js");
275
281
  try {
276
- const result = importMemories(projectDir);
282
+ const result = await importMemories(projectDir);
277
283
  if (!result.success) {
278
284
  console.log(chalk.yellow(`Import skipped: ${result.message}`));
279
285
  return;
280
286
  }
281
287
  console.log(chalk.green("\u2713 Import complete"));
282
288
  console.log(chalk.dim(` Imported: ${result.memoriesImported}`));
289
+ console.log(chalk.dim(` Files: ${result.filesImported}`));
283
290
  console.log(chalk.dim(` ${result.message}`));
284
291
  console.log("");
285
292
  } catch (err) {
@@ -288,34 +295,213 @@ async function importSubcommand(projectDir) {
288
295
  }
289
296
  }
290
297
  async function serveSubcommand(projectDir) {
291
- const { isMemoryInitialized } = await import("./dist-R5F4MX3I.js");
298
+ const { isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
292
299
  if (!isMemoryInitialized(projectDir)) {
293
300
  console.error(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
294
301
  process.exit(1);
295
302
  }
296
303
  console.error(chalk.dim("[memory-mcp] Starting MCP server..."));
297
304
  console.error(chalk.dim(`[memory-mcp] Project: ${projectDir}`));
298
- const { startMemoryMcpServer } = await import("./dist-7LHZ65GC.js");
305
+ const { startMemoryMcpServer } = await import("./dist-CS2VKNYS.js");
299
306
  await startMemoryMcpServer({ projectDir });
300
307
  }
301
308
  async function classifySubcommand(args, projectDir) {
302
- const { isMemoryInitialized, listCapturedSessions, classifySession } = await import("./dist-R5F4MX3I.js");
309
+ const { isMemoryInitialized, listCapturedSessions, classifySession, loadWatermark, writeClassifyBatchProgress, clearClassifyBatchProgress } = await import("./dist-GJYT2OQV.js");
303
310
  if (!isMemoryInitialized(projectDir)) {
304
311
  console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
305
312
  return;
306
313
  }
307
- let sessionId = args.filter((a) => !a.startsWith("--"))[0];
308
- if (!sessionId) {
309
- const sessions = listCapturedSessions(projectDir);
310
- if (sessions.length === 0) {
314
+ const ora = (await import("ora")).default;
315
+ const doExport = args.includes("--export");
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
+ }
322
+ let sessionId;
323
+ const sessionFlagIdx = args.indexOf("--session");
324
+ if (sessionFlagIdx !== -1 && args[sessionFlagIdx + 1]) {
325
+ sessionId = args[sessionFlagIdx + 1];
326
+ } else {
327
+ const skipNext = /* @__PURE__ */ new Set();
328
+ if (sessionFlagIdx !== -1) skipNext.add(sessionFlagIdx + 1);
329
+ if (branchFlagIdx !== -1) skipNext.add(branchFlagIdx + 1);
330
+ for (let i = 0; i < args.length; i++) {
331
+ if (skipNext.has(i) || args[i].startsWith("--")) continue;
332
+ sessionId = args[i];
333
+ break;
334
+ }
335
+ }
336
+ if (sessionId) {
337
+ if (isBg) {
338
+ try {
339
+ await classifySession(projectDir, sessionId);
340
+ } catch {
341
+ }
342
+ if (doExport) {
343
+ try {
344
+ const { exportMemories } = await import("./dist-GJYT2OQV.js");
345
+ await exportMemories(projectDir);
346
+ } catch {
347
+ }
348
+ }
349
+ return;
350
+ }
351
+ await classifySingleSession(projectDir, sessionId, classifySession);
352
+ if (doExport) {
353
+ try {
354
+ const { exportMemories } = await import("./dist-GJYT2OQV.js");
355
+ const result = await exportMemories(projectDir);
356
+ console.log(chalk.green(`\u2713 Exported ${result.memoriesExported} memories to ${result.branchName}`));
357
+ } catch (err) {
358
+ const msg = err instanceof Error ? err.message : String(err);
359
+ console.log(chalk.yellow(` Export skipped: ${msg}`));
360
+ }
361
+ }
362
+ return;
363
+ }
364
+ const now = (/* @__PURE__ */ new Date()).toISOString();
365
+ let sessions = listCapturedSessions(projectDir);
366
+ if (sessions.length === 0) {
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) {
311
378
  console.log(chalk.yellow("No captured sessions found."));
312
379
  console.log(chalk.dim("Sessions are captured automatically at session end when memory is enabled."));
380
+ }
381
+ return;
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
+ }
313
399
  return;
314
400
  }
315
- const latest = sessions[sessions.length - 1];
316
- sessionId = latest.sessionId;
317
- console.log(chalk.dim(`Using latest session: ${sessionId}`));
318
401
  }
402
+ const unclassified = sessions.filter((s) => {
403
+ const wm = loadWatermark(projectDir, s.sessionId);
404
+ return !wm;
405
+ });
406
+ if (unclassified.length === 0) {
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
+ }
422
+ return;
423
+ }
424
+ if (!isBg) {
425
+ console.log(chalk.bold(`
426
+ Agent Memory -- Classify Sessions
427
+ `));
428
+ console.log(chalk.dim(` Found ${unclassified.length} unclassified session(s)${branchFilter ? ` on branch "${branchFilter}"` : ""}
429
+ `));
430
+ }
431
+ let totalExtracted = 0;
432
+ let totalStored = 0;
433
+ let succeeded = 0;
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
+ });
446
+ for (let i = 0; i < unclassified.length; i++) {
447
+ const session = unclassified[i];
448
+ const label = `[${i + 1}/${unclassified.length}] ${session.sessionId.slice(0, 8)}... (${session.filesWritten} writes, ${session.commandsRun} cmds)`;
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
+ });
461
+ try {
462
+ const result = await classifySession(projectDir, session.sessionId, (progress) => {
463
+ if (!spinner) return;
464
+ const pct = progress.total > 0 ? ` (${Math.round(progress.current / progress.total * 100)}%)` : "";
465
+ spinner.text = `${label} \u2014 ${progress.message}${pct}`;
466
+ });
467
+ totalExtracted += result.memoriesExtracted;
468
+ totalStored += result.memoriesStored;
469
+ succeeded++;
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
+ }
476
+ }
477
+ } catch (err) {
478
+ failed++;
479
+ const message = err instanceof Error ? err.message : String(err);
480
+ if (spinner) spinner.fail(`${label} \u2014 ${message}`);
481
+ }
482
+ }
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
+ }
503
+ }
504
+ async function classifySingleSession(projectDir, sessionId, classifySession) {
319
505
  console.log(chalk.bold(`
320
506
  Agent Memory -- Classify Session
321
507
  `));
@@ -340,7 +526,7 @@ Agent Memory -- Classify Session
340
526
  }
341
527
  }
342
528
  async function enableSubcommand(projectDir) {
343
- const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-R5F4MX3I.js");
529
+ const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
344
530
  if (!isMemoryInitialized(projectDir)) {
345
531
  console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
346
532
  return;
@@ -351,7 +537,7 @@ async function enableSubcommand(projectDir) {
351
537
  console.log(chalk.green("\u2713 Memory capture enabled"));
352
538
  }
353
539
  async function disableSubcommand(projectDir) {
354
- const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-R5F4MX3I.js");
540
+ const { loadMemoryConfig, saveMemoryConfig, isMemoryInitialized } = await import("./dist-GJYT2OQV.js");
355
541
  if (!isMemoryInitialized(projectDir)) {
356
542
  console.log(chalk.red("Error: Memory not initialized. Run 'ulpi memory init' first."));
357
543
  return;
@@ -361,6 +547,29 @@ async function disableSubcommand(projectDir) {
361
547
  saveMemoryConfig(projectDir, config);
362
548
  console.log(chalk.yellow("\u2713 Memory capture disabled"));
363
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
+ }
364
573
  function truncate(str, maxLen) {
365
574
  if (str.length <= maxLen) return str;
366
575
  return str.slice(0, maxLen - 3) + "...";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiServer
3
- } from "./chunk-Q4HIY43N.js";
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-NNUWU6CV.js";
11
+ import "./chunk-JGBXM5NC.js";
12
12
  import "./chunk-YM2HV4IA.js";
13
13
  import "./chunk-KIKPIH6N.js";
14
14
  import "./chunk-7LXY5UVC.js";