@davesheffer/hunch 0.33.0 → 0.33.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/cli/index.js +22 -1
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -409,6 +409,7 @@ program
409
409
  .description("Create a git worktree already wired into Hunch — it shares this repo's memory (the private overlay), with zero per-worktree setup.")
410
410
  .option("-b, --branch <name>", "create the worktree on a NEW branch")
411
411
  .option("--no-share", "don't register the overlay at the git common dir (the worktree won't see private memory)")
412
+ .option("--no-index", "don't build the new worktree's code graph (skip if you'll index later)")
412
413
  .action((path, opts) => {
413
414
  const root = findRoot();
414
415
  if (!isGitRepo(root))
@@ -439,8 +440,28 @@ program
439
440
  else {
440
441
  shareNote = ` · no private overlay configured — run \`hunch private\` to share memory across worktrees`;
441
442
  }
443
+ // 3) build the new worktree's CODE GRAPH (symbols/edges → blast-radius / dependents).
444
+ // Indexed IN-PROCESS (uses THIS install's tree-sitter, so the worktree needs no
445
+ // node_modules) and ONLY when the graph isn't already committed in the checkout —
446
+ // re-parsing a normal repo would just dirty its tracked .hunch/*.json. Writes the
447
+ // derived (gitignored) index, never the working tree.
448
+ let indexNote = "";
449
+ if (opts.index !== false) {
450
+ const wstore = new HunchStore(hunchPaths(dest));
451
+ wstore.json.ensureDirs();
452
+ if (wstore.json.loadAll("symbols").length === 0) {
453
+ const res = indexRepo(wstore, dest);
454
+ wstore.reindex();
455
+ indexNote = `\n ✓ indexed ${res.files} file(s) → ${res.symbols} symbols — blast-radius ready (code graph isn't committed here)`;
456
+ }
457
+ else {
458
+ wstore.reindex(); // committed graph already in the checkout → just build the derived SQLite
459
+ indexNote = `\n ✓ code graph present in the checkout — blast-radius ready`;
460
+ }
461
+ wstore.close();
462
+ }
442
463
  console.log(`✓ worktree created → ${dest}${opts.branch ? ` (new branch ${opts.branch})` : ""}\n` +
443
- `${shareNote}\n` +
464
+ `${shareNote}${indexNote}\n` +
444
465
  ` hooks + MCP server are shared (worktree-aware) — open your assistant in the new worktree to start.\n` +
445
466
  ` (needs \`hunch\` installed globally; a worktree has no node_modules of its own)`);
446
467
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davesheffer/hunch",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Dave Sheffer <dave.sheffer1@gmail.com>",
6
6
  "description": "Hunch — an Engineering Memory OS: a persistent, git-native reasoning graph over a codebase, exposed to Claude Code via MCP.",