@openez-graph/cli 1.0.3 → 1.2.0

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/README.md CHANGED
@@ -15,15 +15,15 @@ OpenEZ Graph indexes your codebase into a local SQLite database, builds a code g
15
15
 
16
16
  - **Bun-powered** — native `bun:sqlite` driver, no native compilation, near-instant startup
17
17
  - **Rust-native parsing** — [oxc-parser](https://oxc.rs) for TS/JS (~13x faster than Babel), tree-sitter for Python/Go/Rust in rayon-parallel batches
18
- - **Zero-config** — auto-registers workspace, auto-indexes, auto-syncs on file changes
18
+ - **Zero-config** — auto-registers workspace, auto-indexes; opt-in auto-sync via `OPENEZ_MCP_WATCH=1`
19
19
  - **SQLite-first** — all data stored locally in `.openez/` per workspace, no Postgres/Redis
20
20
  - **FTS5 full-text search** — SQLite FTS5 with BM25 ranking and porter tokenizer
21
- - **Vector search** — optional OpenAI/Ollama embeddings with cosine similarity
21
+ - **Vector search** — optional OpenAI/Ollama/local embeddings with cosine similarity
22
22
  - **MCP-first** — exposes `code_query`, `code_context`, `graph_neighbors`, `memory_recall`, `memory_write`, `index_workspace`, `list_workspaces` tools
23
23
  - **Multi-workspace** — register and query across multiple codebases
24
24
  - **Code graph** — symbols, files, chunks, and edges (calls, imports, contains)
25
25
  - **Web dashboard** — built-in graph explorer and workspace management UI
26
- - **Auto-sync** — file watcher re-indexes on changes (250ms debounce)
26
+ - **Auto-sync** — file watcher re-indexes on changes (2s debounce)
27
27
 
28
28
  ## Install
29
29
 
@@ -53,7 +53,7 @@ openez setup opencode # OpenCode
53
53
  openez setup windsurf # Windsurf / Devin Desktop
54
54
  openez setup devin # Devin CLI
55
55
 
56
- # 3. Restart your agent — it will auto-index and auto-sync
56
+ # 3. Restart your agent — it will auto-index (auto-sync opt-in via OPENEZ_MCP_WATCH=1)
57
57
  ```
58
58
 
59
59
  ## Commands
@@ -61,9 +61,10 @@ openez setup devin # Devin CLI
61
61
  ```bash
62
62
  openez init [path] # register + index a workspace
63
63
  openez index [path] # incremental index
64
- openez reindex [path] # full rebuild
64
+ openez embed [path] # create configured provider vectors
65
+ openez reindex [path] # full rebuild (removes vectors; run embed after)
65
66
  openez watch [path] # watch + auto-reindex on changes
66
- openez serve --mcp # start MCP server (auto-index + auto-sync)
67
+ openez serve --mcp # start MCP server (auto-index; auto-sync opt-in via OPENEZ_MCP_WATCH=1)
67
68
  openez serve --web # start web dashboard (default port 17881)
68
69
  openez serve --web --port 8080 # start web dashboard on custom port
69
70
  openez status [path] # show workspace status
@@ -78,29 +79,29 @@ openez config set <key> <value> # set embedding config value
78
79
  openez config list # list all DB-stored config overrides
79
80
  ```
80
81
 
81
- Valid config keys: `embedding.provider`, `embedding.openai_api_key`, `embedding.openai_base_url`, `embedding.openai_model`, `embedding.ollama_base_url`, `embedding.ollama_model`. API keys are encrypted at rest with AES-256-GCM.
82
+ Valid config keys: `embedding.provider`, `embedding.openai_api_key`, `embedding.openai_base_url`, `embedding.openai_model`, `embedding.ollama_base_url`, `embedding.ollama_model`, `embedding.local_model`. API keys are encrypted at rest with AES-256-GCM.
82
83
 
83
84
  ## MCP Tools
84
85
 
85
- | Tool | Description |
86
- | ----------------- | --------------------------------------------------------------------- |
87
- | `list_workspaces` | List all registered workspaces |
88
- | `code_query` | Hybrid FTS/vector search + graph expansion over indexed code and docs |
89
- | `code_context` | Get budgeted symbol context with callers, callees, and related files |
90
- | `graph_neighbors` | Traverse graph edges from a node or label |
91
- | `memory_recall` | Recall active memory entries and technical decisions |
92
- | `memory_write` | Write a memory entry (notes, decisions, patterns) |
93
- | `index_workspace` | Trigger indexing for a workspace |
86
+ | Tool | Description |
87
+ | ----------------- | --------------------------------------------------------------------------------------------------- |
88
+ | `list_workspaces` | List all registered workspaces |
89
+ | `code_query` | Hybrid FTS/vector search + graph expansion over indexed code and docs |
90
+ | `code_context` | Get budgeted symbol context with callers, callees, and related files (limit: 50/workspace, max 200) |
91
+ | `graph_neighbors` | Traverse graph edges from a node or label |
92
+ | `memory_recall` | Recall active memory entries and technical decisions |
93
+ | `memory_write` | Write a memory entry (notes, decisions, patterns) |
94
+ | `index_workspace` | Trigger indexing for a workspace |
94
95
 
95
96
  `memory_query` is accepted as a deprecated compatibility alias for `code_query`, but is not advertised to new clients.
96
97
 
97
98
  ## How it works
98
99
 
99
- 1. **`openez setup <agent>`** writes MCP server config to the agent's config file (e.g. `~/.claude/settings.json`, `~/.codeium/windsurf/mcp_config.json`, `~/.config/devin/config.json`)
100
+ 1. **`openez setup <agent>`** writes MCP server config to the agent's config file (e.g. `~/.claude/settings.json`, `~/.codeium/windsurf/mcp_config.json`, `~/.config/devin/config.json`) and installs agent instructions (`AGENTS.md` or `CLAUDE.md`) in the project root. These instruction files tell the agent to prefer OpenEZ MCP tools over grep/ripgrep. They are safe to commit or gitignore — `openez setup` will update them idempotently if already present.
100
101
  2. When Claude Code starts, it launches the MCP server via `openez serve --mcp`
101
102
  3. The MCP server auto-registers the current project as a workspace
102
103
  4. It auto-indexes if the workspace has no documents yet
103
- 5. It watches for file changes and re-indexes automatically (250ms debounce)
104
+ 5. Live file watching is opt-in via `OPENEZ_MCP_WATCH=1` (2s debounce); without it, read tools run throttled incremental catch-up before querying
104
105
  6. All data is stored in `<project>/.openez/index.sqlite` — local, portable, gitignored
105
106
 
106
107
  ## Supported languages
@@ -116,22 +117,28 @@ Valid config keys: `embedding.provider`, `embedding.openai_api_key`, `embedding.
116
117
 
117
118
  ## Retrieval quality
118
119
 
119
- Benchmarked on 23 queries (17 keyword + 6 semantic) against the openez codebase (128 files, 810 chunks):
120
+ Measured on 2026-08-10 against the openez codebase (180 files, 979 chunks, 17 fixture-backed
121
+ queries):
120
122
 
121
- | Metric | FTS only | FTS + Embedding (bge-m3) |
122
- | ---------------- | -------: | -----------------------: |
123
- | Recall@5 | 91.30% | 95.65% |
124
- | Keyword queries | 100.00% | 100.00% |
125
- | Semantic queries | 66.67% | 83.33% |
126
- | Avg latency | 5 ms | 249 ms |
123
+ | Metric | FTS only |
124
+ | ----------- | -------: |
125
+ | Recall@5 | 76.47% |
126
+ | MRR | 0.6564 |
127
+ | Avg latency | 12.1 ms |
127
128
 
128
- **FTS-only is the default** — 100% recall on keyword queries, 50x faster. **Embedding adds semantic search with +16.67% semantic recall and no keyword regression** via full RRF fusion (FTS weight 2x, vector weight 1x).
129
+ FTS-only remains the default. Embedding comparison is opt-in and is not claimed by this baseline.
129
130
 
130
131
  ```bash
131
132
  # Enable Ollama embeddings (bge-m3 recommended for code search)
132
133
  openez config set embedding.provider ollama
133
134
  openez config set embedding.ollama_model bge-m3
134
- openez reindex .
135
+ openez embed .
136
+ pnpm benchmark:retrieval:embeddings
137
+
138
+ # Or use the public pinned local code model
139
+ openez config set embedding.provider local
140
+ openez config set embedding.local_model jina-code-static-256
141
+ openez embed .
135
142
  ```
136
143
 
137
144
  See [BENCHMARK.md](https://github.com/asta-nguyen/openez-graph/blob/main/BENCHMARK.md) for full analysis.
package/dist/CHANGELOG.md CHANGED
@@ -5,6 +5,57 @@ All notable changes to OpenEZ Graph 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
+ ## [1.2.0] - 2026-08-11
9
+
10
+ ### Added
11
+
12
+ - **Lease-based indexing ownership** — indexing claims a 60-second lease with 15-second heartbeat. If the lease expires (e.g. process crash), another process can take over. Completion and failure writes are fenced by owner token — a stale owner cannot overwrite the status set by a newer owner.
13
+ - **Graph build warnings in MCP** — `code_query` response includes a `warnings` array when graph expansion fails, so callers see FTS-only results instead of silently missing graph expansion.
14
+
15
+ ### Fixed
16
+
17
+ - **MCP `code_context` validation** — removed misplaced `nodeId`/`label` guard that threw on every `code_context` call (schema requires `symbolOrPath`).
18
+ - **MCP truncation pairing** — `fitToTokenBudget` now drops whole result entries instead of emptying inner source arrays (`callers`, `callees`, `relatedChunks`, `sources`, `files`), keeping context and structured sources paired under token truncation.
19
+ - **Retrieval preflight** — `vectorSearch` checks `hasLegacyEmbeddings()` and active-model vector existence before calling `provider.embed`, avoiding wasted API calls for workspaces with legacy TEXT or no embeddings.
20
+ - **Optional tokenizer dependency** — `@huggingface/tokenizers` is now a dynamic import in `local-embedding.ts`, making embeddings truly optional. The static import forced the dependency on all core package consumers.
21
+ - **Lease-fenced index completion/failure** — `completeIndexing` and `failIndexing` check `index_build_owner` in the WHERE clause, mirroring graph build fencing. A stale lease holder can no longer overwrite the status set by a newer owner.
22
+ - **Authoritative schema initialization** — web server delegates registry and workspace schema creation to `@openez-graph/db` (`getRegistryDdl`, `getFullWorkspaceDdl`, `migrateRegistrySchema`), eliminating duplicated DDL and missing migrations (registry_meta, graph invalidation backfill).
23
+ - **Browser tokenizer boundary** — local embedding model catalog exposed via settings API (`localModels: string[]`) instead of direct `@openez-graph/core` import, preventing `@huggingface/tokenizers` from entering the Vite client bundle.
24
+ - **Strict TypeScript gates** — explicit type parameters on all `queryOptions` calls; test fetch mocks use `as unknown as typeof fetch` double cast.
25
+ - **Docs reconciliation** — corrected stale reindex docs (full reindex replaces chunks and removes vectors), documented `code_context` limit contract (50/workspace, max 200, token-budgeted), corrected watcher debounce from 250ms to 2s, documented MCP auto-sync as opt-in via `OPENEZ_MCP_WATCH=1`, documented `openez setup` AGENTS.md/CLAUDE.md instruction file mutation.
26
+
27
+ ## [1.1.0] - 2026-08-10
28
+
29
+ ### Added
30
+
31
+ - **`openez embed` command** — standalone embedding step separated from indexing. Run `openez embed [path]` after `openez index` to create vectors. Supports `--force` to rebuild vectors for the active provider/model.
32
+ - **Local embedding provider (`local`)** — zero-config in-process embedding using `jina-code-static-256` (256d static token embeddings). Downloads model files from HuggingFace on first use with SHA256 checksum verification and atomic writes. No Ollama or OpenAI required.
33
+ - **`embedding.local_model` config key** — configurable local model preset via `openez config set embedding.local_model jina-code-static-256`.
34
+ - **Lazy graph build lifecycle** — graph construction deferred to the first query or another approved CLI command, with invalidation tracking on reindex.
35
+ - **Nested TypeScript symbol discovery** — `oxc-parser` now registers named nested functions and arrow functions assigned to variables as first-class graph symbols.
36
+ - **Graph invalidation generations** — persisted invalidation markers ensure stale graph edges are rebuilt after incremental reindex.
37
+
38
+ ### Changed
39
+
40
+ - **Indexing no longer creates embeddings** — `openez index` writes chunks, FTS, and graph only. Use `openez embed` for vectors. Retrieval falls back to FTS + graph when embeddings are absent.
41
+ - **BLOB cosine search is the supported vector path** — legacy TEXT embeddings detected and skipped; run `openez reindex` then `openez embed --force` to rebuild as BLOB vectors (reindex alone does not write vectors).
42
+ - **FTS metadata normalization** — Unicode-aware text composition for FTS indexing preserves complete chunk content.
43
+ - **Token strategy scoped** — `fastTokenCounter` (chars/4) for indexing, `exactTokenCounter` (GPT BPE) for retrieval budgeting, with concurrency-safe lazy loading.
44
+ - **Parser cache** — parsed document results cached per-file to avoid redundant AST walks during incremental reindex.
45
+
46
+ ### Fixed
47
+
48
+ - **FTS Unicode normalization** — chunk content with multi-byte characters no longer truncated in FTS index.
49
+ - **FTS metadata JSON parsing** — guarded against malformed metadata causing indexing failures.
50
+ - **Stale FTS version rebuild ordering** — FTS triggers correctly restored after bulk write phase.
51
+ - **Graph build produced 0 symbol nodes** — `oxc-parser` native binding resolution fixed in bundled CLI.
52
+ - **Registry `graph_status` not updated** — registry now reflects actual node/edge counts after graph build.
53
+ - **RAG flow correctness** — second-round review blockers resolved in retrieval pipeline.
54
+
55
+ ### Contributors
56
+
57
+ - **Asta Nguyen** — [@asta-nguyen](https://github.com/asta-nguyen)
58
+
8
59
  ## [1.0.3] - 2026-08-08
9
60
 
10
61
  ### Fixed
@@ -234,6 +285,8 @@ Remediation release — index/graph correctness, data protection, and web flow f
234
285
  - Error handling and validation for import path extraction
235
286
  - CLI npm packaging
236
287
 
288
+ [1.2.0]: https://github.com/asta-nguyen/openez-graph/compare/v1.1.0...v1.2.0
289
+ [1.1.0]: https://github.com/asta-nguyen/openez-graph/compare/v1.0.3...v1.1.0
237
290
  [1.0.3]: https://github.com/asta-nguyen/openez-graph/compare/v1.0.2...v1.0.3
238
291
  [1.0.2]: https://github.com/asta-nguyen/openez-graph/compare/v1.0.1...v1.0.2
239
292
  [1.0.1]: https://github.com/asta-nguyen/openez-graph/compare/v1.0.0...v1.0.1