@javierkaiser/opencode-indexing 0.3.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,61 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.1] - 2026-10-16
9
+
10
+ ### Documentation
11
+ - The README's code-graph section is no longer a roadmap. It said the plugin
12
+ "deliberately stays on the semantic side" and offered `indexing_graph_*` tools
13
+ as a future major version — both untrue once codegraph became a companion.
14
+ Rewritten around the two indexes: what each costs to keep fresh, what the
15
+ benchmark does and does not measure, how to move from one to the other, and an
16
+ explicit note that the graph tools are withdrawn rather than pending. The
17
+ install-time detail moved to *Install*, where `--with-codegraph` already
18
+ lives, instead of being restated here.
19
+
20
+ ### Fixed
21
+ - **The installer named the wrong package.** `install.mjs` and the skip message
22
+ in `src/codegraph.ts` both said `codegraph`, which on npm is an unrelated 2024
23
+ library by a different author with no binary at all. `npm install -g codegraph`
24
+ exits 0, puts nothing on `PATH`, and the step then reports success — the worst
25
+ shape of failure for an installer. The real package is
26
+ `@colbymchenry/codegraph`, which is what the CLI already on this machine came
27
+ from. Both call sites now use the scoped name, and a test reads `install.mjs`
28
+ and asserts the unscoped install never appears.
29
+ - **The PowerShell wrapper could not pass `--with-codegraph`.** `install.mjs`
30
+ implemented the flag and `install.sh` forwards every argument, but
31
+ `install.ps1` declared only five switches, so on Windows the recommended
32
+ install was impossible through the wrapper. The switch exists now, and both
33
+ wrappers record the preferred `npx` form.
34
+ - The prompt-footer skill now tells the model that codegraph exists. It listed
35
+ `Grep` as the answer for exact symbols and never mentioned the graph tools at
36
+ all, so an assistant had no way to know the structural half was available —
37
+ the same class of problem as an indicator that renders nothing: the capability
38
+ was there and invisible. The guidance is conditional on the MCP server being
39
+ present, because it is optional.
40
+ - `THIRD_PARTY_NOTICES.md` was missing four packages it distributes:
41
+ `solid-js`, `@opentui/core`, `@opentui/solid` (shipped since 0.2.4) and
42
+ `apache-arrow`, which had never been listed. Licenses read from the installed
43
+ manifests, not from memory. CodeGraph gets its own section: not bundled, MIT
44
+ per its manifest, and the license text is linked rather than reproduced
45
+ because the package ships no `LICENSE` file and declares no author, so there
46
+ is no copyright line this project can verify.
47
+ - *How it works* and *Where each index lives* now show codegraph. The diagram
48
+ had one index and the table had two; there are three.
49
+ - `indexing_search` and `indexing_status` descriptions mention the companion.
50
+
51
+ ### CI
52
+ - The release workflow now creates the GitHub Release itself, attaching the
53
+ tarball that was actually published and taking its notes from this file. It
54
+ also stopped hiding its own failures: the download ran under `--silent`
55
+ inside a `pipefail` pipeline, so a registry hiccup failed the step with no
56
+ output at all to explain it — which is how three versions shipped without a
57
+ release page.
58
+ - Dependabot groups only what can move together. The old type-based groups
59
+ paired dependencies that contradict each other (`apache-arrow` against
60
+ `@lancedb/lancedb`'s peer ceiling, `@opencode/plugin` against the pinned
61
+ `@opentui` packages), and `npm ci` failed with ERESOLVE before any test ran.
62
+
8
63
  ## [0.3.0] - 2026-10-16
9
64
 
10
65
  ### Added
@@ -282,7 +337,12 @@ First public release.
282
337
  - Cross-platform installer (`install.mjs`, plus `install.sh` / `install.ps1`
283
338
  wrappers).
284
339
 
285
- [Unreleased]: https://github.com/Javierkaiser/opencode-indexing/compare/v0.2.0...HEAD
340
+ [Unreleased]: https://github.com/Javierkaiser/opencode-indexing/compare/v0.3.1...HEAD
341
+ [0.3.1]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.3.1
342
+ [0.3.0]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.3.0
343
+ [0.2.4]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.2.4
344
+ [0.2.3]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.2.3
345
+ [0.2.1]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.2.1
286
346
  [0.2.0]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.2.0
287
347
  [0.1.1]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.1.1
288
348
  [0.1.0]: https://github.com/Javierkaiser/opencode-indexing/releases/tag/v0.1.0
package/README.md CHANGED
@@ -55,6 +55,36 @@ npx @javierkaiser/opencode-indexing --with-codegraph
55
55
  | `--no-restart` | Do not restart the service |
56
56
  | `--with-codegraph` | Install and register codegraph as a companion MCP (opt-in, `--package` only) |
57
57
 
58
+ ### The codegraph companion
59
+
60
+ [CodeGraph](https://github.com/colbymchenry/codegraph) is a separate tool — a
61
+ local code-graph indexer exposed as an MCP server — and this plugin drives it
62
+ rather than reimplementing it. If it is not installed yet:
63
+
64
+ ```bash
65
+ npm install -g @colbymchenry/codegraph
66
+ ```
67
+
68
+ The package is scoped, and that matters: `codegraph` unscoped on npm is an
69
+ unrelated 2024 library with no CLI, so installing that name exits 0 and leaves
70
+ nothing on `PATH`.
71
+
72
+ Installing it is only half of it. `indexing_build` and `indexing_import` also
73
+ start the CLI for the workspace, so both indexes are built by the same action:
74
+ `codegraph init --yes` the first time a folder is seen, `codegraph sync`
75
+ afterwards. codegraph is a **companion, not a dependency** — with the CLI absent
76
+ nothing is spawned, no build fails, and no line is added to the output. Turn it
77
+ off with `/indexing-config set codegraph=false`, and see
78
+ [Semantic search and code graphs](#semantic-search-and-code-graphs) for why the
79
+ two belong together.
80
+
81
+ The launch is detached and reported as started, never as finished: on a large
82
+ monorepo `init` runs for minutes, and a tool call that blocked that long would
83
+ be worse than one that returns. Anything that fails afterwards lands in
84
+ `.codegraph/daemon.log`. A home directory or a drive root is refused rather than
85
+ indexed, and launches are limited to one per 15 seconds per workspace because
86
+ codegraph's own daemon already watches files.
87
+
58
88
  ### With the OpenCode CLI
59
89
 
60
90
  ```bash
@@ -82,7 +112,7 @@ The other six tools only read. OpenCode's base policy already allows everything
82
112
  write them out only if you want to tighten the set.
83
113
 
84
114
  `install.sh` and `install.ps1` are thin wrappers over it; PowerShell also accepts
85
- `-Local`, `-Package`, `-Spec`, `-SkipDeps` and `-NoRestart`.
115
+ `-Local`, `-Package`, `-Spec`, `-SkipDeps`, `-NoRestart` and `-WithCodegraph`.
86
116
 
87
117
  `--package` deletes any copied plugin it finds: both sources define the same
88
118
  plugin id and the config directory is scanned automatically, so leaving both
@@ -108,12 +138,17 @@ resolve from the config file containing the entry:
108
138
  ```
109
139
  OpenCode ──► indexing_search ──┬──► Kilo's index (read-only) Qdrant ws-* · Kilo LanceDB
110
140
  └──► own index (read/write) own LanceDB (default) · Qdrant oc-*
141
+
142
+ OpenCode ──► codegraph_* ───────► codegraph's graph (its own) .codegraph/codegraph.db
143
+ ▲
144
+ └── indexing_build / indexing_import keep it in step
111
145
  ```
112
146
 
113
147
  - **Read-only reuse**: the plugin computes the same collection name Kilo uses (`ws-` + sha256 of the workspace path, first 16 hex chars), validates the embedding profile stored in the metadata point, and queries with an embedding from the *same* model (e.g. Mistral `codestral-embed-2505`, 1536d).
114
148
  - **Import without re-embedding**: `indexing_build` (or `indexing_import`) can copy vectors + chunks from an existing Kilo index — both its Qdrant collections and its local LanceDB database — at **zero embedding cost**, then incrementally index only the delta.
115
149
  - **Own index**: manifest-based incremental indexer (per-file sha256) writing to `oc-*` collections or an embedded LanceDB database, using the same chunk payload shape as Kilo (`filePath`, `fileHash`, `codeChunk`, `startLine`, `endLine`, `segmentHash`, `pathSegments`).
116
150
  - **Merge**: results from Kilo + own are merged; own (fresher) hits win on overlap; ghost hits (deleted files) are filtered out.
151
+ - **Companion graph**: the same build starts codegraph for the workspace, which keeps its own index in `.codegraph/` and serves it over its own MCP server. This plugin never reads or writes that database — see [Semantic search and code graphs](#semantic-search-and-code-graphs).
117
152
 
118
153
  ## Tools (namespace `indexing`)
119
154
 
@@ -401,12 +436,13 @@ Word about data safety: Kilo's indexes (`ws-*` collections and its LanceDB direc
401
436
  ### Where each index lives
402
437
 
403
438
  The own index and Kilo's index are independent, and each one is chosen on its
404
- own:
439
+ own. codegraph keeps a third, and it is the one this plugin never writes to:
405
440
 
406
441
  | Index | Default | Configured by |
407
442
  | --- | --- | --- |
408
443
  | Own index | embedded LanceDB, under `~/.local/state/opencode-indexing/lancedb` | `vectorStore` |
409
444
  | Kilo index (read-only) | whatever `kilo.jsonc` says | Kilo itself |
445
+ | codegraph's graph | `.codegraph/` inside the workspace | codegraph itself |
410
446
 
411
447
  Kilo's `vectorStore` used to decide where this plugin's own index was written,
412
448
  because both were read from the same setting chain. That is no longer the case:
@@ -440,20 +476,31 @@ that. Set vectorStore=qdrant explicitly in
440
476
  Set `vectorStore=qdrant` in `~/.config/opencode/indexing.json` (or run
441
477
  `/indexing-config set vectorstore=qdrant`) to use a Qdrant server instead.
442
478
 
443
- ## Semantic search vs. code graphs (roadmap)
479
+ ## Semantic search and code graphs
480
+
481
+ Two indexes, not two options. This plugin builds and searches the semantic one;
482
+ it also keeps codegraph's code graph in step for the same folder, so a single
483
+ `indexing_build` leaves both current. Neither replaces the other, and this is not
484
+ a fork of codegraph — see [The codegraph companion](#the-codegraph-companion)
485
+ for the install side.
444
486
 
445
- `opencode-indexing` implements **semantic (vector) search**. It is worth being
446
- explicit about how it compares to **code-graph** tooling (call graphs, symbol
447
- graphs, SCIP-style indexes), because they answer different questions and are
448
- complementary:
487
+ ### The two indexes
449
488
 
450
- | | Semantic index (this plugin) | Code graph |
489
+ | | Semantic index (this plugin) | Code graph (codegraph) |
451
490
  | --- | --- | --- |
452
491
  | Question it answers | "Where is the code that does something like X?" | "Who calls X? What breaks if I change it? Path from A to B?" |
453
492
  | Signal | Meaning (embeddings over chunks) | Structure (symbols, `CALLS`, `DEFINES`, `IMPORTS` edges) |
454
493
  | Strengths | Natural language, concepts without known identifiers, cross-language | Exact structural facts, multi-hop traversals, no similarity false positives |
455
494
  | Weaknesses | "Similar" is not "relevant"; no notion of connections | Cannot find a concept with no known symbol; fragile on dynamic code |
456
- | Cost profile | Embedding API + vector DB | Local parsing + small graph store |
495
+ | What it costs to stay fresh | **Paid**: the embedding API, re-run when the model changes | **Free**: local parsing and a small graph store, re-run on every edit |
496
+
497
+ That last row is what shapes the setup. A semantic index is re-embedded only when
498
+ the model changes, and that is money; a graph is synced whenever a file is
499
+ touched, and that is CPU. Two cadences for two economies — which is the reason
500
+ to keep both pointed at one folder rather than at two projects that quietly
501
+ drift apart.
502
+
503
+ ### Measuring the difference
457
504
 
458
505
  We measured this rather than assuming it. [`bench/`](./bench) runs the same
459
506
  real questions about code through four methods — word matching, symbol-name
@@ -472,37 +519,43 @@ What it found:
472
519
  better on both: more files found on one codebase, a better position on the
473
520
  other.
474
521
 
475
- One caveat that matters for reading that: the benchmark measures `codegraph
476
- query`, the one subcommand that matches names. It does **not** measure what a
477
- graph is actually good for — who calls what, what breaks if you change it,
478
- paths between two places. Those are the graph's real strength and they are not
479
- in the numbers above.
480
-
481
- The broader consensus points the same way: use embeddings to find the entry node
482
- by intent, then walk the graph for exact relationships. Cursor reported ~12.5%
483
- retrieval-accuracy improvement combining semantic search with grep; Sourcegraph
484
- layers semantic search over a SCIP graph; Aider uses tree-sitter + PageRank with
485
- no embeddings at all for repo maps.
486
-
487
- This plugin deliberately stays on the semantic side and coexists with grep/read
488
- (see the tool descriptions and the bundled skill). A code-graph mode (tree-sitter
489
- symbol/edge extraction into SQLite, exposed as `indexing_graph_*` tools that
490
- chain after `indexing_search`) is a candidate for a future major version; the
491
- tree-sitter infrastructure is already in place. Independently, the installer can itself install and register codegraph as a companion MCP (`--with-codegraph`, opt-in, published-package mode only).
492
-
493
- **Indexing both at once.** `indexing_build` and `indexing_import` also start
494
- codegraph for the workspace, so the two indexes are built by the same action:
495
- `codegraph init --yes` the first time a folder is seen, `codegraph sync`
496
- afterwards. codegraph is a **companion, not a dependency** — with the CLI absent
497
- nothing is spawned, no build fails and no line is added to the output. Turn it
498
- off with `/indexing-config set codegraph=false`.
522
+ One caveat, and it is larger than it looks. The benchmark measures
523
+ `codegraph query`, the one subcommand that matches **names**. It does **not**
524
+ measure what a graph is actually good for — who calls what, what breaks if you
525
+ change it, paths between two places. So the fusion above is *semantic + name
526
+ matching*, **not** *semantic + graph traversal*. What would actually justify
527
+ reaching for the graph is not in those numbers, and this section does not claim
528
+ it is.
499
529
 
500
- The launch is detached and reported as started, never as finished: on a large
501
- monorepo `init` runs for minutes, and a tool call that blocked that long would
502
- be worse than one that returns. Anything that fails afterwards lands in
503
- `.codegraph/daemon.log`. A home directory or a drive root is refused rather than
504
- indexed, and launches are limited to one per 15 seconds per workspace because
505
- codegraph's own daemon already watches files.
530
+ ### Using them together
531
+
532
+ The division of labour is the one the wider field converges on: use embeddings
533
+ to find the entry node **by intent**, then walk the graph for **exact
534
+ relationships**.
535
+
536
+ 1. `indexing_search` — "where is the retry logic for failed webhooks". Finds the
537
+ neighbourhood from meaning alone, with no identifier to know in advance.
538
+ 2. `codegraph_explore` — the same area, returning the verbatim source of the
539
+ relevant symbols, the call paths between them, and what depends on them.
540
+ 3. `codegraph_impact` / `codegraph_callers` — once the question becomes "what
541
+ breaks if I change this", the graph answers exactly, and a similarity search
542
+ cannot.
543
+
544
+ Both are live in the same session, so an assistant moves between them without
545
+ being asked to.
546
+
547
+ ### Why there are no graph tools in this plugin
548
+
549
+ There are no `indexing_graph_*` tools here, and that is a decision rather than a
550
+ gap. An earlier version of this section proposed adding tree-sitter symbol and
551
+ edge extraction into SQLite as a candidate for a future major version. Once
552
+ codegraph was available as a companion, that plan would have reimplemented
553
+ something another tool already does better — in a second store, behind a second
554
+ indexer that has to be kept alive and fresh.
555
+
556
+ The plugin stays on the semantic side and coexists with grep/read (see the tool
557
+ descriptions and the bundled skill). What it adds for the structural half is to
558
+ keep it current, not to duplicate it.
506
559
 
507
560
  ## Development
508
561
 
@@ -520,7 +573,9 @@ node test/cli.ts build --vector-store lancedb --root .
520
573
 
521
574
  ## Acknowledgements
522
575
 
523
- This plugin interoperates with the open-source [Kilo Code](https://github.com/Kilo-Org/kilocode) indexing format (MIT License, Copyright (c) 2026 Kilo Code). The line-based chunker and the tree-sitter queries are ports of Kilo Code's implementation. It also builds on [opencode](https://github.com/anomalyco/opencode) (MIT), [LanceDB](https://github.com/lancedb/lancedb) (Apache-2.0), [web-tree-sitter](https://github.com/tree-sitter/tree-sitter) (MIT), [tree-sitter-wasms](https://github.com/Gregoor/tree-sitter-wasms) (Unlicense) and [ignore](https://github.com/kaelzhang/node-ignore) (MIT).
576
+ This plugin interoperates with the open-source [Kilo Code](https://github.com/Kilo-Org/kilocode) indexing format (MIT License, Copyright (c) 2026 Kilo Code). The line-based chunker and the tree-sitter queries are ports of Kilo Code's implementation. It also builds on [opencode](https://github.com/anomalyco/opencode) (MIT), [LanceDB](https://github.com/lancedb/lancedb) (Apache-2.0), [Apache Arrow](https://github.com/apache/arrow) (Apache-2.0), [web-tree-sitter](https://github.com/tree-sitter/tree-sitter) (MIT), [tree-sitter-wasms](https://github.com/Gregoor/tree-sitter-wasms) (Unlicense), [ignore](https://github.com/kaelzhang/node-ignore) (MIT), and — for the terminal UI — [SolidJS](https://github.com/solidjs/solid) (MIT) and [OpenTUI](https://github.com/sst/opentui) (MIT).
577
+
578
+ The companion code graph is [CodeGraph](https://github.com/colbymchenry/codegraph) (MIT), a separate project this one installs and drives rather than bundles. Its npm package is `@colbymchenry/codegraph`; the unscoped `codegraph` on npm is a different, unrelated project.
524
579
 
525
580
  Kilo Code is a trademark of its owners; this project is **unofficial and not affiliated** with Kilo Code or the OpenCode project.
526
581
 
@@ -56,10 +56,35 @@ SOFTWARE.
56
56
  | Package | License | Copyright |
57
57
  | --- | --- | --- |
58
58
  | [`@lancedb/lancedb`](https://github.com/lancedb/lancedb) | Apache-2.0 | LanceDB, Inc. |
59
+ | [`apache-arrow`](https://github.com/apache/arrow) | Apache-2.0 | The Apache Software Foundation |
59
60
  | [`web-tree-sitter`](https://github.com/tree-sitter/tree-sitter) | MIT | Tree-sitter contributors |
60
61
  | [`tree-sitter-wasms`](https://github.com/Gregoor/tree-sitter-wasms) | Unlicense | Gregor (packaging); grammars by their respective authors |
61
62
  | [`ignore`](https://github.com/kaelzhang/node-ignore) | MIT | Kael Zhang and contributors |
63
+ | [`solid-js`](https://github.com/solidjs/solid) | MIT | Ryan Carniato and contributors |
64
+ | [`@opentui/core`](https://github.com/sst/opentui) | MIT | SST and OpenTUI contributors |
65
+ | [`@opentui/solid`](https://github.com/sst/opentui) | MIT | SST and OpenTUI contributors |
66
+
67
+ `solid-js`, `@opentui/core` and `@opentui/solid` are what the terminal UI is
68
+ rendered with. They are optional dependencies: without them the prompt-footer
69
+ indicator and the settings page are absent, and everything else works.
62
70
 
63
71
  Tree-sitter grammar `.wasm` files bundled by `tree-sitter-wasms` are distributed
64
72
  under their upstream licenses (mostly MIT or Apache-2.0); see the
65
73
  `tree-sitter-wasms` package for details.
74
+
75
+ ## CodeGraph (github.com/colbymchenry/codegraph)
76
+
77
+ Not bundled and not required. CodeGraph is a separate program that this plugin
78
+ can install, register as an MCP server and keep in step; it is listed here
79
+ because the plugin drives it and points at it by name.
80
+
81
+ License: **MIT**, as declared in the package manifest
82
+ (`@colbymchenry/codegraph@1.6.2`).
83
+
84
+ The published package carries no `LICENSE` file of its own and declares no
85
+ author, so the authoritative license text is the one in the upstream repository:
86
+ <https://github.com/colbymchenry/codegraph>. It is not reproduced here rather
87
+ than reproduced with a copyright holder this project cannot verify.
88
+
89
+ The npm package is `@colbymchenry/codegraph`. The unscoped `codegraph` on npm is
90
+ an unrelated project and is not what this plugin installs.
package/index.ts CHANGED
@@ -79,6 +79,24 @@ plugin's own incremental index (Qdrant or LanceDB backend).
79
79
  - Verifying whether code exists that must be fresh: the index may lag behind
80
80
  recent edits; check \`indexing_status\` (freshness) or use Grep for certainty.
81
81
 
82
+ ## If codegraph is also installed
83
+
84
+ When the codegraph MCP server is present, its tools are available alongside this
85
+ one, and together they answer more than either can alone:
86
+
87
+ - \`codegraph_explore\` — the area around a finding, with the verbatim source of
88
+ the relevant symbols, the call paths between them, and what depends on them.
89
+ - \`codegraph_callers\` / \`codegraph_impact\` — "who calls this" and "what breaks
90
+ if I change it". Exact, structural answers that a similarity search cannot
91
+ give.
92
+ - \`indexing_search\` still goes first when the intent is known and the
93
+ identifier is not: it finds the entry node by meaning, and the graph then
94
+ explains it.
95
+
96
+ The two indexes are kept current together, so neither is stale relative to the
97
+ other. If those tools are not available, everything above still applies and
98
+ Grep remains the right fallback.
99
+
82
100
  ## Configuration
83
101
 
84
102
  \`indexing_config\` reports the effective settings (backend, model, credentials —
package/install.mjs CHANGED
@@ -330,6 +330,15 @@ function hasCodegraphBin() {
330
330
  }
331
331
  }
332
332
 
333
+ /**
334
+ * The npm package that provides the `codegraph` CLI.
335
+ *
336
+ * Scoped, and it has to be. The unscoped `codegraph` on npm is an unrelated
337
+ * 2024 library with no binary, so installing that name succeeds and leaves
338
+ * nothing on PATH — a silent no-op that looks like a working install.
339
+ */
340
+ const CODEGRAPH_PACKAGE = "@colbymchenry/codegraph"
341
+
333
342
  /**
334
343
  * Install codegraph and register its MCP with OpenCode.
335
344
  *
@@ -342,16 +351,17 @@ function installCodegraph() {
342
351
  log(" installing codegraph as a companion MCP server...")
343
352
 
344
353
  if (!hasCodegraphBin()) {
345
- log(" codegraph CLI missing; running npm install -g codegraph...")
354
+ log(` codegraph CLI missing; running npm install -g ${CODEGRAPH_PACKAGE}...`)
346
355
  const npm = isWindows ? "npm.cmd" : "npm"
347
- // --omit=... is not needed here: codegraph stands on its own, and a global
348
- // install is what its own documentation assumes.
349
- const installed = spawnSync(npm, ["install", "-g", "codegraph"], {
356
+ // Scoped on purpose. `codegraph` on the unscoped registry is an unrelated
357
+ // 2024 library with no CLI at all, and installing it would look successful
358
+ // while leaving nothing on PATH to register.
359
+ const installed = spawnSync(npm, ["install", "-g", CODEGRAPH_PACKAGE], {
350
360
  stdio: "inherit",
351
361
  shell: isWindows,
352
362
  })
353
363
  if (installed.error || installed.status !== 0) {
354
- warn(" could not install codegraph (npm install -g codegraph failed); skipping MCP registration")
364
+ warn(` could not install codegraph (npm install -g ${CODEGRAPH_PACKAGE} failed); skipping MCP registration`)
355
365
  return
356
366
  }
357
367
  }
package/install.ps1 CHANGED
@@ -2,14 +2,19 @@
2
2
  # Thin wrapper: the cross-platform logic lives in install.mjs, so Windows, Linux
3
3
  # and macOS all run the same code instead of drifting copies.
4
4
  #
5
+ # The preferred form from npm is:
6
+ # npx @javierkaiser/opencode-indexing --with-codegraph
7
+ # This wrapper forwards to the same install.mjs, so it accepts the same flags.
8
+ #
5
9
  # Usage:
6
- # powershell -ExecutionPolicy Bypass -File install.ps1 [-Local|-Package] [-Spec <spec>] [-SkipDeps] [-NoRestart]
10
+ # powershell -ExecutionPolicy Bypass -File install.ps1 [-Local|-Package] [-Spec <spec>] [-SkipDeps] [-NoRestart] [-WithCodegraph]
7
11
  param(
8
12
  [switch]$Local,
9
13
  [switch]$Package,
10
14
  [string]$Spec,
11
15
  [switch]$SkipDeps,
12
- [switch]$NoRestart
16
+ [switch]$NoRestart,
17
+ [switch]$WithCodegraph
13
18
  )
14
19
 
15
20
  $ErrorActionPreference = "Stop"
@@ -20,6 +25,7 @@ if ($Package) { $forward += "--package" }
20
25
  if ($Spec) { $forward += $Spec }
21
26
  if ($SkipDeps) { $forward += "--skip-deps" }
22
27
  if ($NoRestart) { $forward += "--no-restart" }
28
+ if ($WithCodegraph) { $forward += "--with-codegraph" }
23
29
 
24
30
  if (Get-Command node -ErrorAction SilentlyContinue) {
25
31
  & node $script @forward
package/install.sh CHANGED
@@ -2,8 +2,12 @@
2
2
  # Installs opencode-indexing into the global OpenCode config directory.
3
3
  # Thin wrapper: the cross-platform logic lives in install.mjs.
4
4
  #
5
+ # The preferred form from npm is:
6
+ # npx @javierkaiser/opencode-indexing --with-codegraph
7
+ # This wrapper forwards to the same install.mjs, so it accepts the same flags.
8
+ #
5
9
  # Usage:
6
- # sh install.sh [--local|--package] [spec] [--skip-deps] [--no-restart]
10
+ # sh install.sh [--local|--package] [spec] [--skip-deps] [--no-restart] [--with-codegraph]
7
11
  set -eu
8
12
 
9
13
  dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@javierkaiser/opencode-indexing",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "OpenCode plugin: semantic code search that reuses Kilo Code indexes (Qdrant/LanceDB) and maintains its own independent index",
5
5
  "license": "MIT",
6
6
  "author": "Carlos Javier Lust <javierkaiser@gmail.com>",
package/src/codegraph.ts CHANGED
@@ -19,6 +19,16 @@ import { assessScope } from "./scope.ts"
19
19
  /** Directory codegraph writes its index into. Its presence is the "is it indexed" answer. */
20
20
  const CODEGRAPH_DIR = ".codegraph"
21
21
 
22
+ /**
23
+ * The npm package that provides the `codegraph` CLI.
24
+ *
25
+ * Scoped, and it has to be: the unscoped `codegraph` on npm is an unrelated
26
+ * 2024 library with no binary. Installing that name exits 0 and leaves nothing
27
+ * on PATH, which is the worst shape of failure for an installer step — it looks
28
+ * like it worked.
29
+ */
30
+ const CODEGRAPH_PACKAGE = "@colbymchenry/codegraph"
31
+
22
32
  /**
23
33
  * Minimum seconds between launches for one workspace.
24
34
  *
@@ -197,7 +207,7 @@ export async function indexWithCodegraph(options: CodegraphOptions): Promise<Cod
197
207
  available = false
198
208
  }
199
209
  if (!available) {
200
- return { kind: "skipped", reason: "the codegraph CLI is not installed (npm i -g codegraph)" }
210
+ return { kind: "skipped", reason: `the codegraph CLI is not installed (npm i -g ${CODEGRAPH_PACKAGE})` }
201
211
  }
202
212
 
203
213
  const initialized = isCodegraphInitialized(root)
package/src/tools.ts CHANGED
@@ -73,7 +73,8 @@ Use this tool early for open-ended exploration when you know the intent but not
73
73
  Notes:
74
74
  - The index combines Kilo Code's index (when present and profile-compatible) with the plugin's own index, which can be backed by Qdrant or LanceDB.
75
75
  - If the index reports stale/incomplete, results may be incomplete — indexed files might not include recent edits.
76
- - Pass \`path\` to limit results to a subdirectory, relative to the workspace root.`
76
+ - Pass \`path\` to limit results to a subdirectory, relative to the workspace root.
77
+ - This finds code by meaning. For structure — who calls a symbol, what depends on it, what breaks if it changes — use the codegraph tools when that MCP server is available; a similarity search cannot answer those.`
77
78
 
78
79
  const STATUS_DESCRIPTION = `Report the state of the project's semantic code index.
79
80
 
@@ -82,6 +83,7 @@ Shows:
82
83
  - Kilo Code index sources available for import (Qdrant collection and/or local LanceDB database), with embedding profile and compatibility.
83
84
  - The plugin's own index (points, completion, embedding profile, last run).
84
85
  - Freshness: number of workspace files that were never indexed, possibly changed, or deleted since the last run.
86
+ - The codegraph companion's state for this folder, when that setting is on: whether it is indexed, and that the next build will sync it.
85
87
  - A recommended next action (import/build/refresh).`
86
88
 
87
89
  const REFRESH_DESCRIPTION = `Incrementally update the plugin's own code index for this workspace.