@membank/cli 0.10.2 → 0.11.1

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 (2) hide show
  1. package/dist/index.mjs +34 -5
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { cancel, confirm, intro, isCancel, multiselect, note, outro } from "@clack/prompts";
3
3
  import { DatabaseManager, EmbeddingService, MIGRATIONS, MemoryRepository, MemoryTypeSchema, MemoryTypeSchema as MemoryTypeSchema$1, PIN_BUDGET_THRESHOLD, ProjectRepository, QueryEngine, SessionContextBuilder, SynthesisRepository, TagsJsonSchema as TagsRowSchema, resolveProject, runScopeToProjectsMigration } from "@membank/core";
4
- import { startServer } from "@membank/mcp";
4
+ import { runSynthesis, startServer } from "@membank/mcp";
5
5
  import chalk from "chalk";
6
6
  import { Command } from "commander";
7
7
  import ora from "ora";
@@ -438,6 +438,16 @@ async function statsCommand(formatter) {
438
438
  function hasSynthesesTable(db) {
439
439
  return db.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='syntheses'").get() !== void 0;
440
440
  }
441
+ async function synthesizeRunCommand(opts, formatter) {
442
+ const scope = opts.scope ?? "global";
443
+ if (!formatter.isJson) process.stdout.write(`Running synthesis for scope: ${scope}\n`);
444
+ const content = await runSynthesis(scope);
445
+ if (formatter.isJson) process.stdout.write(`${JSON.stringify({
446
+ scope,
447
+ content
448
+ })}\n`);
449
+ else process.stdout.write(`\nSynthesis complete for scope: ${scope}\n\n${content}\n\n`);
450
+ }
441
451
  function synthesizeShowCommand(opts, formatter) {
442
452
  const db = DatabaseManager.open();
443
453
  try {
@@ -447,7 +457,12 @@ function synthesizeShowCommand(opts, formatter) {
447
457
  return;
448
458
  }
449
459
  const scope = opts.scope ?? "global";
450
- const row = db.db.prepare("SELECT * FROM syntheses WHERE scope = ? ORDER BY synthesized_at DESC LIMIT 1").get(scope);
460
+ let resolvedScope = scope;
461
+ if (scope !== "global" && !/^[0-9a-f]{16}$/.test(scope)) {
462
+ const project = new ProjectRepository(db).getByName(scope);
463
+ if (project !== void 0) resolvedScope = project.scopeHash;
464
+ }
465
+ const row = db.db.prepare("SELECT * FROM syntheses WHERE scope = ? ORDER BY synthesized_at DESC LIMIT 1").get(resolvedScope);
451
466
  if (row === void 0) {
452
467
  if (formatter.isJson) process.stdout.write(`${JSON.stringify(null)}\n`);
453
468
  else process.stdout.write(`No synthesis found for scope: ${scope}\n`);
@@ -473,7 +488,10 @@ function synthesizeStatusCommand(formatter) {
473
488
  else process.stdout.write("No synthesis data available.\n");
474
489
  return;
475
490
  }
476
- const rows = db.db.prepare("SELECT * FROM syntheses ORDER BY scope").all();
491
+ const rows = db.db.prepare(`SELECT s.*, p.name AS project_name
492
+ FROM syntheses s
493
+ LEFT JOIN projects p ON p.scope_hash = s.scope
494
+ ORDER BY COALESCE(p.name, s.scope)`).all();
477
495
  if (formatter.isJson) {
478
496
  process.stdout.write(`${JSON.stringify(rows)}\n`);
479
497
  return;
@@ -484,10 +502,11 @@ function synthesizeStatusCommand(formatter) {
484
502
  }
485
503
  process.stdout.write("\n");
486
504
  for (const row of rows) {
505
+ const displayScope = row.project_name ?? row.scope;
487
506
  const inFlight = row.in_flight_since !== null ? " [in-flight]" : "";
488
507
  const synthesized = row.synthesized_at !== null ? new Date(row.synthesized_at).toLocaleString() : "(never)";
489
508
  const expires = row.expires_at !== null ? new Date(row.expires_at).toLocaleString() : "(none)";
490
- process.stdout.write(` ${row.scope}${inFlight}\n`);
509
+ process.stdout.write(` ${displayScope}${inFlight}\n`);
491
510
  process.stdout.write(` synthesized_at: ${synthesized}\n`);
492
511
  process.stdout.write(` expires_at: ${expires}\n`);
493
512
  }
@@ -1794,7 +1813,17 @@ configCmd.command("show").description("print the entire config as formatted JSON
1794
1813
  const globalOpts = program.opts();
1795
1814
  configShowCommand(Formatter.create(globalOpts.json === true));
1796
1815
  });
1797
- const synthesizeCmd = program.command("synthesize").description("view synthesis state");
1816
+ const synthesizeCmd = program.command("synthesize").description("view and manage synthesis");
1817
+ synthesizeCmd.command("run").description("trigger a synthesis run for a scope").option("--scope <scope>", "scope to synthesize (default: global)").action(async (cmdOptions) => {
1818
+ const globalOpts = program.opts();
1819
+ const formatter = Formatter.create(globalOpts.json === true);
1820
+ try {
1821
+ await synthesizeRunCommand(cmdOptions, formatter);
1822
+ } catch (err) {
1823
+ formatter.error(err instanceof Error ? err.message : String(err));
1824
+ process.exit(2);
1825
+ }
1826
+ });
1798
1827
  synthesizeCmd.command("show").description("display current synthesis for a scope").option("--scope <scope>", "scope to show (default: global)").action((cmdOptions) => {
1799
1828
  const globalOpts = program.opts();
1800
1829
  const formatter = Formatter.create(globalOpts.json === true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@membank/cli",
3
- "version": "0.10.2",
3
+ "version": "0.11.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,9 +21,9 @@
21
21
  "commander": "^14.0.3",
22
22
  "ora": "^9.4.0",
23
23
  "zod": "^4.4.3",
24
- "@membank/core": "0.9.1",
25
- "@membank/dashboard": "0.5.2",
26
- "@membank/mcp": "0.11.2"
24
+ "@membank/core": "0.9.3",
25
+ "@membank/dashboard": "0.5.4",
26
+ "@membank/mcp": "0.12.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^25.6.0",