sverklo 0.29.0 → 0.29.2

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 (39) hide show
  1. package/README.md +23 -16
  2. package/dist/bin/sverklo.js +59 -12
  3. package/dist/bin/sverklo.js.map +1 -1
  4. package/dist/src/doctor.d.ts +4 -1
  5. package/dist/src/doctor.js +120 -1
  6. package/dist/src/doctor.js.map +1 -1
  7. package/dist/src/indexer/embedder.js +12 -8
  8. package/dist/src/indexer/embedder.js.map +1 -1
  9. package/dist/src/indexer/graph-builder.js +35 -3
  10. package/dist/src/indexer/graph-builder.js.map +1 -1
  11. package/dist/src/indexer/parsers/java.js +12 -2
  12. package/dist/src/indexer/parsers/java.js.map +1 -1
  13. package/dist/src/indexer/setup.js +4 -1
  14. package/dist/src/indexer/setup.js.map +1 -1
  15. package/dist/src/indexer/symbol-extractor.d.ts +3 -2
  16. package/dist/src/indexer/symbol-extractor.js +43 -2
  17. package/dist/src/indexer/symbol-extractor.js.map +1 -1
  18. package/dist/src/init.d.ts +5 -0
  19. package/dist/src/init.js +141 -2
  20. package/dist/src/init.js.map +1 -1
  21. package/dist/src/marketing/campaign-cycle.js +2 -2
  22. package/dist/src/marketing/campaign-cycle.js.map +1 -1
  23. package/dist/src/prove.d.ts +2 -0
  24. package/dist/src/prove.js +75 -8
  25. package/dist/src/prove.js.map +1 -1
  26. package/dist/src/search/enoughness.d.ts +14 -0
  27. package/dist/src/search/enoughness.js +107 -0
  28. package/dist/src/search/enoughness.js.map +1 -0
  29. package/dist/src/search/hybrid-search.d.ts +6 -0
  30. package/dist/src/search/hybrid-search.js +15 -0
  31. package/dist/src/search/hybrid-search.js.map +1 -1
  32. package/dist/src/search/token-budget.d.ts +3 -1
  33. package/dist/src/search/token-budget.js +26 -1
  34. package/dist/src/search/token-budget.js.map +1 -1
  35. package/dist/src/server/tools/lookup.js +1 -1
  36. package/dist/src/server/tools/lookup.js.map +1 -1
  37. package/dist/src/server/tools/search.js +8 -1
  38. package/dist/src/server/tools/search.js.map +1 -1
  39. package/package.json +2 -2
package/README.md CHANGED
@@ -12,17 +12,22 @@ Sverklo gives coding agents repo memory: symbols, callers, diffs, blast radius,
12
12
 
13
13
  **Local-first** ◦ MIT ◦ no API keys ◦ no code upload ◦ first run downloads a local ONNX model
14
14
 
15
- Use grep when you know the exact string. Use Sverklo when the agent needs relationships: who calls this, what depends on it, what changed, and which project decisions still apply. The public bench covers 180 hand-verified tasks across 6 OSS codebases; the methodology and ground truth live in [sverklo/sverklo-bench](https://github.com/sverklo/sverklo-bench). [Bench](https://sverklo.com/bench/) · [paper](https://doi.org/10.5281/zenodo.19802051) · [90-second demo](https://www.youtube.com/watch?v=OX7aEgdlqhQ)
15
+ **Use Sverklo when** your agent needs relationships before editing: callers, dependencies, tests, diff risk, or prior repo decisions.
16
+
17
+ **Use grep/ripgrep when** you know the exact string, the repo is tiny, or the change is one file.
18
+
19
+ Start with the no-write proof command before installing MCP config. The public bench covers 180 hand-verified tasks across 6 OSS codebases; the methodology and ground truth live in [sverklo/sverklo-bench](https://github.com/sverklo/sverklo-bench). [Bench](https://sverklo.com/bench/) · [paper](https://doi.org/10.5281/zenodo.19802051) · [90-second demo](https://www.youtube.com/watch?v=OX7aEgdlqhQ)
16
20
 
17
21
  ```bash
18
- npm install -g sverklo
19
- cd your-project && sverklo init
20
- sverklo prove
22
+ cd your-project
23
+ npm exec --yes --package=sverklo@latest -- sverklo prove --no-write --guided --markdown
24
+ sverklo init --dry-run
25
+ npm install -g sverklo && sverklo init
21
26
  ```
22
27
 
23
- `sverklo init` writes the MCP config for your agent, appends local instructions to `AGENTS.md` or `CLAUDE.md`, and runs `sverklo doctor` to verify the handshake. `sverklo prove` then shows central files, a real symbol with callers, and the exact prompt to paste into your agent. Your code stays on your machine.
28
+ `sverklo prove --no-write --guided --markdown` shows central files, a real symbol with callers, why that proof was selected, the exact prompt to paste into your agent, and a small feedback template before any MCP config or instruction files are written. It may cache the local model/index under `~/.sverklo`, but it does not mutate your project. `sverklo init --dry-run` then previews the files `init` would touch; `sverklo init` writes the MCP config for your agent, appends local instructions to `AGENTS.md` or `CLAUDE.md`, and runs `sverklo doctor` to verify the handshake. Your code stays on your machine.
24
29
 
25
- Need something shareable? Run `sverklo prove --markdown` to print a GitHub/Discord-ready proof receipt from your repo, then [post it in the proof thread](https://github.com/sverklo/sverklo/discussions/79).
30
+ Need something shareable? Run `sverklo prove --no-write --guided --markdown` to print a GitHub/Discord-ready proof receipt from your repo, then [post it in the proof thread](https://github.com/sverklo/sverklo/discussions/79).
26
31
 
27
32
  Need local launch planning for the Sverklo account? `sverklo marketing` runs a local-first Twitter/X agent-team workflow from operator-provided snapshots. It ranks opportunities, drafts seed-content queues, checks profile health, and records human decisions without posting, scraping, replying, liking, reposting, following, or changing the profile.
28
33
 
@@ -41,7 +46,7 @@ Need local launch planning for the Sverklo account? `sverklo marketing` runs a l
41
46
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19802051.svg)](https://doi.org/10.5281/zenodo.19802051)
42
47
  [![GitHub stars](https://img.shields.io/github/stars/sverklo/sverklo?style=social)](https://github.com/sverklo/sverklo/stargazers)
43
48
 
44
- > If `sverklo prove` surfaces useful repo context, please star the repo. It is the fastest way to help other agent-heavy teams find it.
49
+ > If `sverklo prove` surfaces useful repo context, please post a receipt, correction, grep-better case, or setup-friction report in [the proof thread](https://github.com/sverklo/sverklo/discussions/79). If it helped, starring the repo also helps other agent-heavy teams find it.
45
50
 
46
51
  ![Sverklo bench:primitives token comparison](./docs/hero-token-comparison.png)
47
52
 
@@ -77,12 +82,13 @@ Sverklo drills into your repo before the agent does — symbol graph, blast radi
77
82
  </table>
78
83
 
79
84
  ```bash
80
- npm install -g sverklo
81
- cd your-project && sverklo init
82
- sverklo prove
85
+ cd your-project
86
+ npm exec --yes --package=sverklo@latest -- sverklo prove --no-write --guided
87
+ sverklo init --dry-run
88
+ npm install -g sverklo && sverklo init
83
89
  ```
84
90
 
85
- That's it. `sverklo init` auto-detects your installed AI coding agent (Claude Code, Cursor, Windsurf, Zed), writes the right MCP config, appends instructions to `AGENTS.md` if present (otherwise `CLAUDE.md`), and runs `sverklo doctor` to verify the setup. `sverklo prove` shows the first useful repo-memory proof from your own codebase; `sverklo prove --markdown` makes that proof shareable in [the public proof thread](https://github.com/sverklo/sverklo/discussions/79). Works on macOS, Linux, and Windows. **No API keys. No cloud. Telemetry off by default.**
91
+ That's it. `sverklo prove --no-write --guided` gives you the first useful repo-memory proof from your own codebase before project config changes; `sverklo init --dry-run` previews every setup target; `sverklo init` auto-detects your installed AI coding agent (Claude Code, Cursor, Windsurf, Zed), writes the right MCP config, appends instructions to `AGENTS.md` if present (otherwise `CLAUDE.md`), and runs `sverklo doctor` to verify the setup. `sverklo prove --markdown` makes that proof shareable in [the public proof thread](https://github.com/sverklo/sverklo/discussions/79). Works on macOS, Linux, and Windows. **No API keys. No cloud. Telemetry off by default.**
86
92
 
87
93
  > The embedding model (`all-MiniLM-L6-v2` ONNX, ~86 MB) is downloaded from HuggingFace on first use into `~/.sverklo/models/` and cached forever — every subsequent run is fully offline.
88
94
 
@@ -175,7 +181,7 @@ If the answer to your question is "exact string X exists somewhere," grep wins.
175
181
  | Tool | What it does |
176
182
  |------|-------------|
177
183
  | `search` | Hybrid BM25 + vector + PageRank search. Find code without knowing the literal string. |
178
- | `refs` | All references to a symbol, with caller context. Proves dead code with certainty. |
184
+ | `refs` | All references to a symbol, with caller context. Flags likely dead-code candidates from the current reference graph. |
179
185
  | `impact` | Walk the symbol graph, return ranked transitive callers — the real blast radius. |
180
186
  | `review_diff` | Risk-scored review of `git diff`: touched-symbol importance x coverage x churn. |
181
187
 
@@ -451,12 +457,13 @@ Click the badge for your editor. Cursor / VS Code prompt to confirm, then sverkl
451
457
  <br/>
452
458
 
453
459
  ```bash
454
- npm install -g sverklo
455
- cd your-project && sverklo init
456
- sverklo prove
460
+ cd your-project
461
+ npm exec --yes --package=sverklo@latest -- sverklo prove --no-write --guided
462
+ sverklo init --dry-run
463
+ npm install -g sverklo && sverklo init
457
464
  ```
458
465
 
459
- `sverklo init` auto-detects which AI coding agents you have (Claude Code, Cursor, Windsurf, Zed, Antigravity) and writes the right MCP config files. `sverklo prove` prints central files, a real caller graph, and a prompt to paste into your agent. Add `--markdown` or `--receipt` for a shareable proof artifact, then post it in [the proof thread](https://github.com/sverklo/sverklo/discussions/79). Idempotent — safe to re-run. If sverklo doesn't appear in your agent after restart, run `sverklo doctor`.
466
+ Start with proof, then wire the agent. `sverklo prove --no-write --guided` prints central files, a real caller graph, why that symbol was selected, and a prompt to paste into your agent without writing MCP config or instruction files. `sverklo init --dry-run` previews setup targets. `sverklo init` auto-detects which AI coding agents you have (Claude Code, Cursor, Windsurf, Zed, Antigravity) and writes the right MCP config files. Add `--markdown` or `--receipt` for a shareable proof artifact, then post it in [the proof thread](https://github.com/sverklo/sverklo/discussions/79). Idempotent — safe to re-run. If sverklo doesn't appear in your agent after restart, run `sverklo doctor --agent claude` or the matching agent name.
460
467
 
461
468
  **Per-agent config locations** (`sverklo init` writes these for you):
462
469
  - Claude Code: `.mcp.json` at project root + appends to `CLAUDE.md` (or `AGENTS.md` if present)
@@ -39,6 +39,8 @@ async function resolveProjectPath(flags) {
39
39
  }
40
40
  function parseProveArgs(rawArgs) {
41
41
  let format = "text";
42
+ let guided = false;
43
+ let noWrite = false;
42
44
  const pathArgs = [];
43
45
  for (let i = 0; i < rawArgs.length; i++) {
44
46
  const arg = rawArgs[i];
@@ -65,9 +67,17 @@ function parseProveArgs(rawArgs) {
65
67
  format = value === "markdown" ? "markdown" : "text";
66
68
  continue;
67
69
  }
70
+ if (arg === "--guided") {
71
+ guided = true;
72
+ continue;
73
+ }
74
+ if (arg === "--no-write" || arg === "--no-config-write") {
75
+ noWrite = true;
76
+ continue;
77
+ }
68
78
  pathArgs.push(arg);
69
79
  }
70
- return { format, pathArgs };
80
+ return { format, guided, noWrite, pathArgs };
71
81
  }
72
82
  // Global --help / -h interceptor.
73
83
  //
@@ -84,7 +94,7 @@ if (command && command !== "--help" && command !== "-h") {
84
94
  const HELP_BLURBS = {
85
95
  init: "Set up sverklo in your project (.mcp.json + CLAUDE.md, auto-detects Claude Code/Cursor/Windsurf/Antigravity). With --global: one-time-per-machine setup — write SVERKLO_SNIPPET to ~/.claude/CLAUDE.md and ~/.codex/AGENTS.md, register the project, gitignore .sverklo/, import memories. Skips per-project boilerplate.",
86
96
  doctor: "Diagnose MCP setup issues. Run after `init` to verify the agent can reach sverklo.",
87
- prove: "Show a first-run repo-memory proof: central files, a real symbol with callers, and a paste-ready agent prompt. Flags: --markdown, --receipt, --format text|markdown.",
97
+ prove: "Show a first-run repo-memory proof: central files, a real symbol with callers, and a paste-ready agent prompt. Flags: --no-write, --guided, --markdown, --receipt, --format text|markdown.",
88
98
  audit: "Run codebase audit and emit a graded report. Flags: --format markdown|html|json|graph|arch|obsidian, --output PATH, --open, --badge, --publish.",
89
99
  "audit-diff": "Incremental architectural quality gate. Audits `git diff` for new cycles + fan-in spikes. Flags: --against REF, --fan-in-threshold N, --format human|json, --show-existing, --verbose. Exits 1 on regression.",
90
100
  review: "Risk-scored diff review (CI-friendly). Flags: --ref REF, --ci, --format markdown|json, --max-files N, --fail-on low|medium|high.",
@@ -217,6 +227,10 @@ if (command === "marketing") {
217
227
  if (!trends && !profile && !recentPosts && !evidence && !existing) {
218
228
  throw new Error("no local marketing inputs found; provide --trends, --profile, --recent-posts, or --evidence");
219
229
  }
230
+ const cycleNow = trends?.captured_at ??
231
+ profile?.captured_at ??
232
+ recentPosts?.captured_at ??
233
+ existing?.updated_at;
220
234
  const cycle = runCampaignCycle({
221
235
  workspace,
222
236
  existingCycle: existing,
@@ -225,6 +239,7 @@ if (command === "marketing") {
225
239
  recentPosts,
226
240
  evidence,
227
241
  cycleId: flagVal("--cycle"),
242
+ now: cycleNow,
228
243
  });
229
244
  saveMarketingWorkspace(workspacePath, workspace);
230
245
  saveCampaignCycle(workspacePath, cycle);
@@ -283,7 +298,18 @@ if (command === "init") {
283
298
  const autoCapture = flags.includes("--auto-capture");
284
299
  const mineChats = flags.includes("--mine-chats");
285
300
  const isGlobal = flags.includes("--global");
301
+ const dryRun = flags.includes("--dry-run");
286
302
  const projectPath = resolve(positional[1] || process.cwd());
303
+ if (dryRun) {
304
+ if (isGlobal) {
305
+ console.error("✗ sverklo init --dry-run does not support --global yet");
306
+ console.error(" Run `sverklo init --global` only after reviewing global instruction targets manually.");
307
+ process.exit(2);
308
+ }
309
+ const { renderInitDryRun } = await import("../src/init.js");
310
+ process.stdout.write(renderInitDryRun(projectPath, { autoCapture, mineChats }));
311
+ process.exit(0);
312
+ }
287
313
  if (isGlobal) {
288
314
  // Issue #72 — one-time-per-machine setup. Writes SVERKLO_SNIPPET to
289
315
  // global agent-instruction locations (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md),
@@ -322,10 +348,10 @@ if (command === "register") {
322
348
  process.exit(0);
323
349
  }
324
350
  if (command === "prove") {
325
- const { format, pathArgs } = parseProveArgs(args.slice(1));
351
+ const { format, guided, noWrite, pathArgs } = parseProveArgs(args.slice(1));
326
352
  const projectPath = await resolveProjectPath(pathArgs);
327
353
  const { runProve } = await import("../src/prove.js");
328
- const report = await runProve(projectPath, { format });
354
+ const report = await runProve(projectPath, { format, guided, noWrite });
329
355
  process.stdout.write(report);
330
356
  process.exit(0);
331
357
  }
@@ -650,9 +676,24 @@ if (command === "audit-prompt" || command === "review-prompt") {
650
676
  process.exit(0);
651
677
  }
652
678
  if (command === "doctor" || command === "diagnose" || command === "check") {
653
- const projectPath = resolve(args[1] || process.cwd());
679
+ let agent;
680
+ const pathArgs = [];
681
+ for (let i = 1; i < args.length; i++) {
682
+ const arg = args[i];
683
+ if (arg === "--agent") {
684
+ agent = args[i + 1];
685
+ i++;
686
+ continue;
687
+ }
688
+ if (arg.startsWith("--agent=")) {
689
+ agent = arg.slice("--agent=".length);
690
+ continue;
691
+ }
692
+ pathArgs.push(arg);
693
+ }
694
+ const projectPath = resolve(pathArgs[0] || process.cwd());
654
695
  const { runDoctor } = await import("../src/doctor.js");
655
- runDoctor(projectPath);
696
+ runDoctor(projectPath, { agent });
656
697
  process.exit(0);
657
698
  }
658
699
  if (command === "workspace") {
@@ -2739,16 +2780,21 @@ if (command === "--help" || command === "-h") {
2739
2780
  sverklo — code intelligence for AI agents
2740
2781
 
2741
2782
  Just installed? Run these two:
2742
- sverklo init Set up sverklo in your project (.mcp.json + CLAUDE.md)
2743
- sverklo prove Show a real repo-memory proof from your codebase
2783
+ sverklo prove --no-write --guided
2784
+ Show proof before writing project or agent config files
2785
+ sverklo init --dry-run Preview the config files init would touch
2744
2786
 
2745
2787
  Then restart your AI agent (Claude Code, Cursor, Windsurf, etc.) — sverklo tools become available automatically.
2746
2788
 
2747
2789
  Usage:
2748
2790
  sverklo init Set up sverklo in your project (.mcp.json + CLAUDE.md)
2791
+ sverklo init --dry-run Preview planned writes without changing files
2749
2792
  sverklo doctor Diagnose MCP setup issues
2793
+ sverklo doctor --agent codex
2794
+ Show agent-specific setup/check prompt guidance
2750
2795
  sverklo prove [path] Show central files, a real caller graph, and an agent prompt
2751
- Use --markdown or --receipt for a shareable artifact.
2796
+ Use --guided for selection notes, --no-write for trial mode,
2797
+ and --markdown or --receipt for a shareable artifact.
2752
2798
  sverklo reindex [path] Incremental rebuild of the index (changed files only)
2753
2799
  Use --force to clear and rebuild from scratch.
2754
2800
  Use --timing to see per-phase elapsed ms.
@@ -2790,9 +2836,10 @@ Setup / runtime:
2790
2836
  sverklo --help Show this help
2791
2837
 
2792
2838
  Quick start (single project):
2793
- npm install -g sverklo
2794
- cd your-project && sverklo init
2795
- sverklo prove
2839
+ cd your-project
2840
+ npm exec --yes --package=sverklo@latest -- sverklo prove --no-write --guided
2841
+ sverklo init --dry-run
2842
+ npm install -g sverklo && sverklo init
2796
2843
  sverklo prove --markdown # shareable proof for GitHub, Discord, Reddit, etc.
2797
2844
  claude # start coding — sverklo tools are preferred automatically
2798
2845