@javierkaiser/opencode-indexing 0.2.1 → 0.2.3
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 +13 -0
- package/README.md +34 -35
- package/install.mjs +68 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ 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.2.3] - 2026-10-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `install.mjs` accepts `--with-codegraph`. It is **off by default** and only
|
|
12
|
+
has effect in `--package` mode, as consent comes from passing the flag. When
|
|
13
|
+
active it detects an existing `codegraph` CLI, installs it globally (`npm install
|
|
14
|
+
-g codegraph`) if it is missing, and registers its MCP with OpenCode via
|
|
15
|
+
`codegraph install --target opencode`. A failure in either step is reported and
|
|
16
|
+
does not cancel this plugin's own install.
|
|
17
|
+
- The README now names `npx` (not `opencode plugin add`) as the recommended
|
|
18
|
+
install method, and shows the companion install in the recommended command:
|
|
19
|
+
`npx @javierkaiser/opencode-indexing --with-codegraph`.
|
|
20
|
+
|
|
8
21
|
## [0.2.1] - 2026-10-15
|
|
9
22
|
|
|
10
23
|
### Added
|
package/README.md
CHANGED
|
@@ -26,28 +26,48 @@ index is still installed.
|
|
|
26
26
|
|
|
27
27
|
## Install
|
|
28
28
|
|
|
29
|
-
### With
|
|
29
|
+
### With npx (recommended)
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
|
|
32
|
+
npx @javierkaiser/opencode-indexing
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This is the whole install: the installer runs `opencode plugin add`, writes the
|
|
36
|
+
permission rules, restarts the service, and, when you ask for it, also installs
|
|
37
|
+
and registers the companion `codegraph`
|
|
38
|
+
MCP. It picks its strategy from where it runs — from an npx cache or an
|
|
39
|
+
unpacked tarball it installs the published package, from a checkout it
|
|
40
|
+
installs your working tree instead — so edits take effect on restart with no
|
|
41
|
+
publish in between. It prints which one it chose.
|
|
42
|
+
|
|
43
|
+
Add `--with-codegraph` to install and register codegraph as part of the same run
|
|
44
|
+
(the flag is opt-in and only has effect in the published-package mode):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx @javierkaiser/opencode-indexing --with-codegraph
|
|
33
48
|
```
|
|
34
49
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
| Flag | Effect |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `--package [spec]` | Install the published package (default spec `@latest`) |
|
|
53
|
+
| `--local` | Copy this directory into the config dir (development) |
|
|
54
|
+
| `--skip-deps` | `--local` only: copy the files, install no dependencies |
|
|
55
|
+
| `--no-restart` | Do not restart the service |
|
|
56
|
+
| `--with-codegraph` | Install and register codegraph as a companion MCP (opt-in, `--package` only) |
|
|
39
57
|
|
|
40
|
-
|
|
58
|
+
### With the OpenCode CLI
|
|
41
59
|
|
|
42
60
|
```bash
|
|
43
|
-
opencode plugin
|
|
44
|
-
opencode plugin update # install it
|
|
45
|
-
opencode plugin remove @javierkaiser/opencode-indexing
|
|
61
|
+
opencode plugin add @javierkaiser/opencode-indexing
|
|
46
62
|
```
|
|
47
63
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
OpenCode downloads the package into its own cache and records it in the global
|
|
65
|
+
`plugins` array, and it loads both halves of the plugin: the server side
|
|
66
|
+
(`index.ts`, which registers the tools) and the terminal UI (`tui.ts`, which
|
|
67
|
+
adds the prompt-footer indicator and the `/indexing` page). It brings `plugin
|
|
68
|
+
check`, `plugin update` and `plugin remove` with it, but it cannot write
|
|
69
|
+
permission rules — add this one to `opencode.json` to keep the host asking
|
|
70
|
+
before the only tool that writes your settings file:
|
|
51
71
|
|
|
52
72
|
```jsonc
|
|
53
73
|
{
|
|
@@ -61,27 +81,6 @@ The other six tools only read. OpenCode's base policy already allows everything
|
|
|
61
81
|
(`{ "action": "*", "resource": "*", "effect": "allow" }`), so they need no rule;
|
|
62
82
|
write them out only if you want to tighten the set.
|
|
63
83
|
|
|
64
|
-
### One command, permissions included
|
|
65
|
-
|
|
66
|
-
To skip the manual rule:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npx @javierkaiser/opencode-indexing
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The installer runs `opencode plugin add`, writes the permission rules, and
|
|
73
|
-
restarts the service. It picks its strategy from where it runs: from an installed
|
|
74
|
-
copy — an npx cache, an unpacked tarball — it installs the published package;
|
|
75
|
-
from a checkout it installs your working tree instead, so edits take effect on
|
|
76
|
-
restart with no publish in between. It prints which one it chose.
|
|
77
|
-
|
|
78
|
-
| Flag | Effect |
|
|
79
|
-
| --- | --- |
|
|
80
|
-
| `--package [spec]` | Install the published package (default spec `@latest`) |
|
|
81
|
-
| `--local` | Copy this directory into the config dir (development) |
|
|
82
|
-
| `--skip-deps` | `--local` only: copy the files, install no dependencies |
|
|
83
|
-
| `--no-restart` | Do not restart the service |
|
|
84
|
-
|
|
85
84
|
`install.sh` and `install.ps1` are thin wrappers over it; PowerShell also accepts
|
|
86
85
|
`-Local`, `-Package`, `-Spec`, `-SkipDeps` and `-NoRestart`.
|
|
87
86
|
|
|
@@ -482,7 +481,7 @@ This plugin deliberately stays on the semantic side and coexists with grep/read
|
|
|
482
481
|
(see the tool descriptions and the bundled skill). A code-graph mode (tree-sitter
|
|
483
482
|
symbol/edge extraction into SQLite, exposed as `indexing_graph_*` tools that
|
|
484
483
|
chain after `indexing_search`) is a candidate for a future major version; the
|
|
485
|
-
tree-sitter infrastructure is already in place.
|
|
484
|
+
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).
|
|
486
485
|
|
|
487
486
|
## Development
|
|
488
487
|
|
package/install.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Works on Windows, Linux and macOS (Node >= 22.6; Node 26 recommended).
|
|
6
6
|
*
|
|
7
|
-
* node install.mjs [--local|--package] [spec] [--skip-deps] [--no-restart]
|
|
7
|
+
* node install.mjs [--local|--package] [spec] [--skip-deps] [--no-restart] [--with-codegraph]
|
|
8
8
|
* npx @javierkaiser/opencode-indexing
|
|
9
9
|
*
|
|
10
10
|
* There are two ways to install, because there are two audiences.
|
|
@@ -38,6 +38,7 @@ const argv = process.argv.slice(2)
|
|
|
38
38
|
const has = (name) => argv.some((arg) => arg.toLowerCase() === name)
|
|
39
39
|
const skipDeps = has("--skip-deps")
|
|
40
40
|
const noRestart = has("--no-restart")
|
|
41
|
+
const withCodegraph = has("--with-codegraph")
|
|
41
42
|
|
|
42
43
|
const source = dirname(fileURLToPath(import.meta.url))
|
|
43
44
|
const sourcePkg = JSON.parse(readFileSync(join(source, "package.json"), "utf8"))
|
|
@@ -75,6 +76,7 @@ const spec = positional[0] ?? `${sourcePkg.name}@latest`
|
|
|
75
76
|
log(`Installing ${sourcePkg.name} ${sourcePkg.version}`)
|
|
76
77
|
log(` from: ${source}`)
|
|
77
78
|
log(` mode: ${mode} (${reason})`)
|
|
79
|
+
if (withCodegraph) log(" + codegraph (via --with-codegraph, package mode)")
|
|
78
80
|
|
|
79
81
|
// ---------------------------------------------------------------------------
|
|
80
82
|
// Tool permissions (both modes)
|
|
@@ -308,14 +310,78 @@ function installPackage() {
|
|
|
308
310
|
return true
|
|
309
311
|
}
|
|
310
312
|
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// Codegraph as a companion MCP (opt-in, --with-codegraph)
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
/**
|
|
317
|
+
* Whether a `codegraph` CLI is available on PATH.
|
|
318
|
+
*
|
|
319
|
+
* A plain spawn is the cheapest, shell-independent probe and matches what
|
|
320
|
+
* the bench harness `resolveBinary()` does. It is treated as read-only here.
|
|
321
|
+
*/
|
|
322
|
+
function hasCodegraphBin() {
|
|
323
|
+
try {
|
|
324
|
+
const probe = spawnSync("codegraph", ["--version"], { stdio: "ignore", shell: isWindows })
|
|
325
|
+
if (probe.error) return false
|
|
326
|
+
// status is either 0 or, on some wrappers, undefined-but-no-error; treat both as present
|
|
327
|
+
return probe.status === 0 || probe.status === null
|
|
328
|
+
} catch {
|
|
329
|
+
return false
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Install codegraph and register its MCP with OpenCode.
|
|
335
|
+
*
|
|
336
|
+
* The only consent gate is the flag itself, as the user requested: this is
|
|
337
|
+
* an install step, not a recommendation. A failure in either half is reported
|
|
338
|
+
* and tolerated — the plugin is already installed and still works with
|
|
339
|
+
* semantic search only.
|
|
340
|
+
*/
|
|
341
|
+
function installCodegraph() {
|
|
342
|
+
log(" installing codegraph as a companion MCP server...")
|
|
343
|
+
|
|
344
|
+
if (!hasCodegraphBin()) {
|
|
345
|
+
log(" codegraph CLI missing; running npm install -g codegraph...")
|
|
346
|
+
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"], {
|
|
350
|
+
stdio: "inherit",
|
|
351
|
+
shell: isWindows,
|
|
352
|
+
})
|
|
353
|
+
if (installed.error || installed.status !== 0) {
|
|
354
|
+
warn(" could not install codegraph (npm install -g codegraph failed); skipping MCP registration")
|
|
355
|
+
return
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const register = spawnSync("codegraph", ["install", "--target", "opencode"], {
|
|
360
|
+
stdio: "inherit",
|
|
361
|
+
shell: isWindows,
|
|
362
|
+
})
|
|
363
|
+
if (register.error || register.status !== 0) {
|
|
364
|
+
warn(" codegraph is present but `codegraph install --target opencode` failed")
|
|
365
|
+
warn(" run it manually once to finish MCP registration: codegraph install --target opencode")
|
|
366
|
+
return
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
log(" codegraph installed and registered with OpenCode")
|
|
370
|
+
}
|
|
371
|
+
|
|
311
372
|
// ---------------------------------------------------------------------------
|
|
312
373
|
// Run
|
|
313
374
|
// ---------------------------------------------------------------------------
|
|
314
375
|
if (mode === "local") {
|
|
315
376
|
installLocal()
|
|
316
|
-
|
|
377
|
+
if (withCodegraph) warn(" --with-codegraph is ignored in --local mode; codegraph is not installed there")
|
|
378
|
+
} else {
|
|
379
|
+
if (!installPackage()) {
|
|
317
380
|
warn(" not writing permissions or restarting: the install did not complete")
|
|
318
381
|
process.exit(1)
|
|
382
|
+
}
|
|
383
|
+
if (withCodegraph) installCodegraph()
|
|
384
|
+
|
|
319
385
|
}
|
|
320
386
|
|
|
321
387
|
writePermissions()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@javierkaiser/opencode-indexing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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>",
|