nano-brain 2026.7.7 → 2026.7.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,EAAuB,MAAM,YAAY,CAAC;AA8G7F,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CA4BhE;AAGD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAM3E;AACD,wBAAgB,QAAQ,IAAI,IAAI,CAoJ/B;AAED,wBAAgB,WAAW,IAAI,IAAI,CAQlC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAmBrG;AAukFD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAC/B,KAAK,EAAE,KAAK,GACX;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAoDvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,EAAuB,MAAM,YAAY,CAAC;AA+G7F,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CA4BhE;AAGD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAM3E;AACD,wBAAgB,QAAQ,IAAI,IAAI,CAuJ/B;AAED,wBAAgB,WAAW,IAAI,IAAI,CAQlC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAmBrG;AAsoFD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAC/B,KAAK,EAAE,KAAK,GACX;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAoDvD"}
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ import { SymbolGraph } from './symbol-graph.js';
13
13
  import { isTreeSitterAvailable } from './treesitter.js';
14
14
  import { QdrantVecStore } from './providers/qdrant.js';
15
15
  import { createVectorStore } from './vector-store.js';
16
+ import { generateBriefing } from './wake-up.js';
16
17
  import { createLLMProvider } from './llm-provider.js';
17
18
  import { ConsolidationAgent } from './consolidation.js';
18
19
  import { ResultCache } from './cache.js';
@@ -254,6 +255,9 @@ nano-brain - Memory system with hybrid search
254
255
  -n <lines> Show last N lines (default: 50)
255
256
  --date=<date> Show log for specific date (YYYY-MM-DD, default: today)
256
257
  --clear Delete all log files
258
+ wake-up Generate a compact context briefing for session start
259
+ --json Output as JSON
260
+ --workspace=<path> Generate briefing for specific workspace
257
261
  bench Run performance benchmarks
258
262
  --suite=<name> Run specific suite (search, embed, cache, store)
259
263
  --iterations=<n> Override iteration count
@@ -1423,6 +1427,65 @@ async function handleTags(globalOpts) {
1423
1427
  }
1424
1428
  store.close();
1425
1429
  }
1430
+ async function handleWakeUp(globalOpts, commandArgs) {
1431
+ log('cli', 'wake-up command invoked');
1432
+ let format = 'text';
1433
+ let workspaceRoot = process.cwd();
1434
+ for (const arg of commandArgs) {
1435
+ if (arg === '--json') {
1436
+ format = 'json';
1437
+ }
1438
+ else if (arg.startsWith('--workspace=')) {
1439
+ workspaceRoot = arg.substring(12);
1440
+ }
1441
+ }
1442
+ const inContainer = isRunningInContainer();
1443
+ const serverRunning = inContainer
1444
+ ? await detectRunningServerContainer(DEFAULT_HTTP_PORT)
1445
+ : await detectRunningServer(DEFAULT_HTTP_PORT);
1446
+ if (inContainer && !serverRunning) {
1447
+ cliError(`Error: nano-brain server not reachable at ${getHttpHost()}:${getHttpPort()}. Ensure the Docker container is running:`);
1448
+ cliError(' docker start nano-brain');
1449
+ process.exit(1);
1450
+ }
1451
+ if (serverRunning) {
1452
+ try {
1453
+ const body = {};
1454
+ if (format === 'json')
1455
+ body.json = true;
1456
+ body.workspace = workspaceRoot;
1457
+ const proxyFn = inContainer ? proxyPostContainer : proxyPost;
1458
+ const data = await proxyFn(DEFAULT_HTTP_PORT, '/api/wake-up', body);
1459
+ if (format === 'json') {
1460
+ cliOutput(JSON.stringify(data, null, 2));
1461
+ }
1462
+ else {
1463
+ cliOutput(data.formatted || data.briefing || JSON.stringify(data));
1464
+ }
1465
+ return;
1466
+ }
1467
+ catch (err) {
1468
+ if (inContainer) {
1469
+ cliError('Error: Failed to communicate with daemon:', err instanceof Error ? err.message : String(err));
1470
+ process.exit(1);
1471
+ }
1472
+ log('cli', 'HTTP proxy failed for wake-up, falling back to local: ' + (err instanceof Error ? err.message : String(err)));
1473
+ }
1474
+ }
1475
+ const projectHash = crypto.createHash('sha256').update(workspaceRoot).digest('hex').substring(0, 12);
1476
+ const resolvedDbPath = resolveDbPath(globalOpts.dbPath, workspaceRoot);
1477
+ const store = await createStore(resolvedDbPath);
1478
+ const result = generateBriefing(store, globalOpts.configPath, projectHash, {
1479
+ json: format === 'json',
1480
+ });
1481
+ if (format === 'json') {
1482
+ cliOutput(JSON.stringify(result, null, 2));
1483
+ }
1484
+ else {
1485
+ cliOutput(result.formatted);
1486
+ }
1487
+ store.close();
1488
+ }
1426
1489
  async function handleFocus(globalOpts, commandArgs) {
1427
1490
  const filePath = commandArgs[0];
1428
1491
  if (!filePath) {
@@ -3524,6 +3587,8 @@ async function main() {
3524
3587
  return handleBench(globalOpts, commandArgs);
3525
3588
  case 'tags':
3526
3589
  return handleTags(globalOpts);
3590
+ case 'wake-up':
3591
+ return handleWakeUp(globalOpts, commandArgs);
3527
3592
  case 'focus':
3528
3593
  return handleFocus(globalOpts, commandArgs);
3529
3594
  case 'graph-stats':