@takara-ai/miru-code 0.3.0 → 0.4.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/README.md CHANGED
@@ -2,301 +2,270 @@
2
2
 
3
3
  Hybrid code search for AI agents — **TypeScript**, **Bun**, and **Takara embeddings**.
4
4
 
5
- ## What is Miru?
5
+ Miru helps coding agents **find code by meaning**. Ask “where is auth middleware configured?” and get back the most relevant **chunks** (file path, line range, snippet) instead of grepping the whole tree.
6
6
 
7
- *Miru* (見る) means “to see” or “to look” in Japanese. Miru helps coding agents **find code by meaning** instead of guessing file paths or running exhaustive greps.
7
+ ## Quick start
8
8
 
9
- When an agent asks “where is auth middleware configured?” or “how do we batch embeddings?”, Miru returns the most relevant **chunks** of your codebase — file path, line range, and snippet — so the agent can read only what matters.
10
-
11
- ### Why hybrid search?
12
-
13
- Pure semantic search misses exact symbol matches. Pure keyword search misses paraphrased intent. Miru combines both:
14
-
15
- 1. **Dense (semantic)** — Takara code embeddings (`ds1-potion-code-16m`) over structurally chunked source files.
16
- 2. **Sparse (BM25)** — keyword scoring with an inverted index; parallelized in Bun workers on large repos.
17
- 3. **RRF fusion** — reciprocal rank fusion merges the two ranked lists.
18
- 4. **Reranking** — code-tuned penalties and boosts (e.g. multi-chunk files, query-term overlap).
19
-
20
- Indexes are built on demand, cached on disk, and invalidated when files change. You can search **code**, **docs**, **config**, or **all** content types.
21
-
22
- ### How agents use Miru
23
-
24
- | Mode | Best for | What the agent gets |
25
- |------|----------|---------------------|
26
- | **MCP server** | Cursor, Claude Code, VS Code Copilot, Gemini CLI, Kiro, OpenCode | Native `search` and `find_related` tools over the workspace |
27
- | **CLI sub-agent** | Any agent with shell access | `miru init --agent <id>` writes a specialist agent that runs `miru search` / `miru find-related` via Bash |
28
-
29
- Both modes share the same index and cache. Pick MCP when your IDE supports it; use the sub-agent when you want a dedicated exploration agent without MCP wiring.
30
-
31
- ## Install
32
-
33
- Requires [Bun](https://bun.sh) 1.1+ on your PATH (`curl -fsSL https://bun.sh/install | bash`).
9
+ **Requirements:** [Bun](https://bun.sh) 1.1+ and a [Takara API key](https://takara.ai) for embeddings.
34
10
 
35
11
  ```bash
36
- # Run once without installing
37
- bunx @takara-ai/miru-code search "auth middleware" ./src
38
-
39
- # Global CLI
12
+ # 1. Install the CLI
40
13
  bun add -g @takara-ai/miru-code
41
- miru search "auth middleware" ./src
42
14
 
43
- # Library
44
- bun add @takara-ai/miru-code
45
- ```
15
+ # 2. Store your API key (validates against Takara)
16
+ miru setup
46
17
 
47
- ```ts
48
- import { MiruIndex } from "@takara-ai/miru-code";
18
+ # 3. Wire into your agents (MCP + instructions + sub-agent)
19
+ miru install
49
20
 
50
- const index = await MiruIndex.fromPath("./src");
21
+ # 4. Restart your IDE / agent session, then search
22
+ miru search "auth middleware" ./src
51
23
  ```
52
24
 
53
- ## Setup
25
+ That’s the full path for most users. `miru install` is interactive — it detects Cursor, Claude Code, Gemini CLI, Kiro, OpenCode, GitHub Copilot, Codex, and VS Code, and lets you pick what to configure.
26
+
27
+ **One-off without installing:**
54
28
 
55
29
  ```bash
56
- bun install
30
+ bunx @takara-ai/miru-code search "auth middleware" ./src
57
31
  ```
58
32
 
59
- Add credentials to `.env.local` (loaded automatically when you run from this repo), or pass them in your MCP config `env` block (recommended — MCP does not inherit IDE env vars reliably).
60
-
61
- | Variable | Default |
62
- |----------|---------|
63
- | `TAKARA_API_KEY` | (required) Takara bearer token for embeddings |
64
- | `MIRU_OPENAI_BASE_URL` | `https://infer.dev.takara.ai/v1` |
65
- | `MIRU_OPENAI_EMBEDDING_MODEL` | `ds1-potion-code-16m` |
66
- | `MIRU_EMBEDDING_DIMENSIONS` | `256` (auto for potion) |
67
- | `MIRU_FLOAT_VECTORS` | unset (default **int8** quantized vectors); set `1` for float32 |
68
- | `MIRU_EMBEDDING_BATCH_SIZE` | `32` (max for this model) |
69
- | `MIRU_CONCURRENCY` | logical CPUs **minus 2** (min 1) |
33
+ **Undo agent setup:** `miru uninstall`
70
34
 
71
- Parallelism: file reads/chunking, embedding batches (up to concurrency in flight), query embed overlapping BM25, and **BM25 scoring in Bun workers** (shards by doc range when index has 256+ chunks). BM25 uses an inverted postings list for fast single-threaded search on small indexes. Override with `MIRU_CONCURRENCY`.
35
+ ---
72
36
 
73
- ## IDE integration
37
+ ## How to read this doc
74
38
 
75
- Miru supports six agent platforms. For each, you can wire the **MCP server** (recommended) and/or install a **CLI sub-agent** with `miru init`.
39
+ | Goal | Section |
40
+ |------|---------|
41
+ | Get running in an IDE | [Quick start](#quick-start) → [IDE integration](#ide-integration) |
42
+ | Search from terminal or scripts | [CLI](#cli) |
43
+ | Use as a library | [Library](#library) |
44
+ | Contribute to this repo | [Developing Miru](#developing-miru) |
76
45
 
77
- ### Quick reference
46
+ ## Install options
78
47
 
79
- | IDE | MCP config file | Sub-agent command | Sub-agent output |
80
- |-----|-----------------|-------------------|------------------|
81
- | [Cursor](#cursor) | `~/.cursor/mcp.json` or `.cursor/mcp.json` | `miru init --agent cursor` | `.cursor/agents/miru-code.md` |
82
- | [Claude Code](#claude-code) | `.mcp.json` (project root) or `~/.claude.json` | `miru init --agent claude` | `.claude/agents/miru-code.md` |
83
- | [VS Code / Copilot](#vs-code--github-copilot) | `.vscode/mcp.json` or user profile `mcp.json` | `miru init --agent copilot` | `.github/agents/miru-code.md` |
84
- | [Gemini CLI](#gemini-cli) | `~/.gemini/settings.json` or `.gemini/settings.json` | `miru init --agent gemini` | `.gemini/agents/miru-code.md` |
85
- | [Kiro](#kiro) | `~/.kiro/settings/mcp.json` or `.kiro/settings/mcp.json` | `miru init --agent kiro` | `.kiro/agents/miru-code.md` |
86
- | [OpenCode](#opencode) | `~/.config/opencode/opencode.json` or `opencode.json` | `miru init --agent opencode` | `.opencode/agents/miru-code.md` |
48
+ | Method | Command | When to use |
49
+ |--------|---------|-------------|
50
+ | Global CLI | `bun add -g @takara-ai/miru-code` | Daily use, `miru install`, terminal search |
51
+ | One-off | `bunx @takara-ai/miru-code …` | Try before installing |
52
+ | Library | `bun add @takara-ai/miru-code` | Embed search in your own tool |
53
+ | From source | [Developing Miru](#developing-miru) | Contributors |
87
54
 
88
- Run `miru init --agent <id> --force` to overwrite an existing sub-agent file.
55
+ After install, `miru` is on your PATH. Run `miru` with no args for help.
89
56
 
90
- ### MCP server
57
+ ## Credentials
91
58
 
92
- Run with **no arguments** to start the stdio MCP server. Indexing begins on the first `search` or `find_related` call, using the `repo` path you pass. Optional `--ref` sets the default git ref for remote repos.
59
+ Miru needs `TAKARA_API_KEY` — a Takara bearer token for code embeddings.
93
60
 
94
61
  ```bash
95
- bunx @takara-ai/miru-code
96
- # or after bun add -g @takara-ai/miru-code: miru
62
+ miru setup # interactive; validates and stores locally
63
+ miru setup --key TOKEN # non-interactive
64
+ miru setup --clear # remove stored key
97
65
  ```
98
66
 
99
- **Tools:** `search`, `find_related` — `repo` is required (project root or https:// git URL).
67
+ Stored credentials live at:
100
68
 
101
- For MCP configs, use `bunx` as the command (`bun` with `x` in `args` works too — they're equivalent).
69
+ - macOS: `~/Library/Application Support/miru/credentials.json`
70
+ - Linux: `~/.config/miru/credentials.json`
71
+ - Windows: `%APPDATA%\miru\credentials.json`
102
72
 
103
- Put the bearer token in `env`; MCP will not read `.env.local` unless those vars are unset.
73
+ Override with `MIRU_CREDENTIALS_DIR`.
104
74
 
105
- #### Shared env block
75
+ **For MCP in an IDE:** also set `TAKARA_API_KEY` in the MCP server `env` block. MCP subprocesses do not reliably inherit your shell or `.env.local`. `miru install` writes `"TAKARA_API_KEY": "${TAKARA_API_KEY}"` where your IDE supports variable expansion — export the var or paste your token.
106
76
 
107
- Use this in every MCP config below (adjust the key name if your IDE uses `environment` instead of `env`):
77
+ ## IDE integration
108
78
 
109
- ```json
110
- {
111
- "TAKARA_API_KEY": "your-takara-bearer-token",
112
- "MIRU_OPENAI_BASE_URL": "https://infer.dev.takara.ai/v1",
113
- "MIRU_OPENAI_EMBEDDING_MODEL": "ds1-potion-code-16m",
114
- "MIRU_EMBEDDING_DIMENSIONS": "256"
115
- }
116
- ```
79
+ ### Recommended: `miru install`
117
80
 
118
- ### Cursor
81
+ Configures up to three integrations per agent:
119
82
 
120
- **MCP** — `~/.cursor/mcp.json` or project `.cursor/mcp.json`:
83
+ | Integration | What it does |
84
+ |-------------|----------------|
85
+ | **MCP server** | Native `search` and `find_related` tools |
86
+ | **Instructions** | Marked usage block in `CLAUDE.md`, `GEMINI.md`, `AGENTS.md`, etc. |
87
+ | **Sub-agent** | Global `miru-code` agent file (Bash-backed search for sub-agents without MCP) |
121
88
 
122
- ```json
123
- {
124
- "mcpServers": {
125
- "miru": {
126
- "command": "bunx",
127
- "args": ["@takara-ai/miru-code"],
128
- "env": {
129
- "TAKARA_API_KEY": "your-takara-bearer-token"
130
- }
131
- }
132
- }
133
- }
89
+ ```bash
90
+ miru install # pick agents + integrations
91
+ miru uninstall # remove miru entries
134
92
  ```
135
93
 
136
- After `bun add -g @takara-ai/miru-code`, you can use `"command": "miru"` instead.
94
+ Restart your IDE or agent session after install.
95
+
96
+ ### Where files go (global user config)
137
97
 
138
- **Sub-agent:**
98
+ | Agent | MCP config | Sub-agent |
99
+ |-------|------------|-----------|
100
+ | Claude Code | `~/.claude.json` | `~/.claude/agents/miru-code.md` |
101
+ | Cursor | `~/.cursor/mcp.json` | `~/.cursor/agents/miru-code.md` |
102
+ | Gemini CLI | `~/.gemini/settings.json` | `~/.gemini/agents/miru-code.md` |
103
+ | Kiro | `~/.kiro/settings/mcp.json` | `~/.kiro/agents/miru-code.md` |
104
+ | OpenCode | `~/.config/opencode/opencode.json(c)` | `~/.config/opencode/agents/miru-code.md` |
105
+ | GitHub Copilot | `~/.copilot/mcp-config.json` | `~/.copilot/agents/miru-code.agent.md` |
106
+ | Codex | `~/.codex/config.toml` | — |
107
+ | VS Code | user profile `Code/User/mcp.json` | — |
108
+
109
+ ### Per-project sub-agent (`miru init`)
110
+
111
+ To commit a sub-agent into a repo for your team (project-local, not global):
139
112
 
140
113
  ```bash
141
- miru init --agent cursor
114
+ miru init --agent claude --force # → .claude/agents/miru-code.md
142
115
  ```
143
116
 
144
- Commit `.cursor/agents/miru-code.md` to share the exploration agent with your team.
117
+ Agents: `cursor`, `claude`, `copilot`, `gemini`, `kiro`, `opencode`.
145
118
 
146
- ### Claude Code
119
+ ### Manual MCP setup
147
120
 
148
- **MCP** — project `.mcp.json` (check into git) or user scope in `~/.claude.json`:
121
+ Skip `miru install` and add this to your IDE’s MCP config (`mcpServers`, `servers`, or `mcp` depending on the tool):
149
122
 
150
123
  ```json
151
124
  {
152
- "mcpServers": {
153
- "miru": {
154
- "type": "stdio",
155
- "command": "bunx",
156
- "args": ["@takara-ai/miru-code"],
157
- "env": {
158
- "TAKARA_API_KEY": "${TAKARA_API_KEY}"
159
- }
125
+ "miru": {
126
+ "command": "bunx",
127
+ "args": ["@takara-ai/miru-code"],
128
+ "env": {
129
+ "TAKARA_API_KEY": "your-takara-bearer-token"
160
130
  }
161
131
  }
162
132
  }
163
133
  ```
164
134
 
165
- Claude Code supports `${VAR}` expansion in config files. Restart the session and run `/mcp` to verify the connection.
135
+ After `bun add -g @takara-ai/miru-code`, you can use `"command": "miru"` instead of `bunx`.
166
136
 
167
- Or via CLI:
137
+ **MCP tools**
168
138
 
169
- ```bash
170
- claude mcp add miru -s project -- bunx @takara-ai/miru-code
171
- ```
139
+ | Tool | Purpose |
140
+ |------|---------|
141
+ | `search` | Natural-language or code query; requires `repo` (project root or `https://` git URL); optional `top_k` (default 5) |
142
+ | `find_related` | Similar chunks to `file_path` + `line` from a prior hit; requires `repo` |
172
143
 
173
- **Sub-agent:**
144
+ Indexing runs on the first tool call per `repo`. Pass the **project root** for local workspaces. Remote repos need an explicit `https://` or `http://` URL (not `git@` SSH).
174
145
 
175
- ```bash
176
- miru init --agent claude
177
- ```
146
+ **IDE-specific notes**
178
147
 
179
- Writes `.claude/agents/miru-code.md` — invoke the `miru-code` agent for semantic exploration tasks.
148
+ - **Claude Code:** supports `${TAKARA_API_KEY}` in config; verify with `/mcp`. Or: `claude mcp add miru -s user -- bunx @takara-ai/miru-code`
149
+ - **VS Code:** uses `"servers"` not `mcpServers`; restart via **MCP: List Servers**
150
+ - **OpenCode:** uses `mcp`, `"type": "local"`, and `environment` instead of `env`
151
+ - **Kiro:** include `PATH` in `env` if Bun is not on the default path
180
152
 
181
- ### VS Code / GitHub Copilot
153
+ Optional MCP startup flags: `--ref BRANCH`, `--content code docs …`
182
154
 
183
- **MCP** — workspace `.vscode/mcp.json` or user profile (Command Palette: **MCP: Open User Configuration**):
155
+ ## How Miru works
184
156
 
185
- ```json
186
- {
187
- "servers": {
188
- "miru": {
189
- "type": "stdio",
190
- "command": "bunx",
191
- "args": ["@takara-ai/miru-code"],
192
- "env": {
193
- "TAKARA_API_KEY": "your-takara-bearer-token"
194
- }
195
- }
196
- }
197
- }
198
- ```
157
+ ### Hybrid search
199
158
 
200
- VS Code uses `"servers"` (not `mcpServers`). Use **MCP: List Servers** to start or restart the server after editing the config.
159
+ 1. **Dense (semantic)** — Takara code embeddings (`ds1-potion-code-16m`) over structurally chunked files
160
+ 2. **Sparse (BM25)** — keyword index; parallelized in Bun workers when the index has 256+ chunks
161
+ 3. **RRF fusion** — merges semantic and keyword rankings
162
+ 4. **Reranking** — code-tuned boosts and penalties
201
163
 
202
- **Sub-agent:**
164
+ Index **code**, **docs**, **config**, or **all** via `--content` (CLI/MCP) or when building a library index.
203
165
 
204
- ```bash
205
- miru init --agent copilot
206
- ```
166
+ ### Agent workflow
207
167
 
208
- Writes `.github/agents/miru-code.md` for Copilot’s agent system.
168
+ 1. `search` with a natural-language or code query
169
+ 2. Read returned chunks
170
+ 3. `find_related` on a promising `file_path` + line (optional)
171
+ 4. Open full files only when the chunk is not enough
172
+ 5. Use grep for exhaustive literal matches
209
173
 
210
- ### Gemini CLI
174
+ ### Caching
211
175
 
212
- **MCP** — `~/.gemini/settings.json` or project `.gemini/settings.json`:
213
-
214
- ```json
215
- {
216
- "mcpServers": {
217
- "miru": {
218
- "command": "bunx",
219
- "args": ["@takara-ai/miru-code"],
220
- "env": {
221
- "TAKARA_API_KEY": "your-takara-bearer-token"
222
- }
223
- }
224
- }
225
- }
226
- ```
176
+ | Layer | Behavior |
177
+ |-------|----------|
178
+ | **First search** | Builds index, writes disk cache |
179
+ | **MCP (local repo, same session)** | Watches files and incrementally re-indexes; disable with `MIRU_MCP_WATCH=0` |
180
+ | **CLI / new MCP session** | Reuses disk cache; run `miru clear <path>` after large refactors |
181
+ | **Remote repos** | Cloned per session; use `--ref` for branch/tag |
227
182
 
228
- Or add interactively: `gemini mcp add`. Run `/mcp` inside a session to confirm tools are available.
183
+ Cache: `~/Library/Caches/miru` (macOS), `~/.cache/miru` (Linux), `%LOCALAPPDATA%\miru\Cache` (Windows).
229
184
 
230
- **Sub-agent:**
185
+ ## CLI
231
186
 
232
187
  ```bash
233
- miru init --agent gemini
188
+ miru setup
189
+ miru install
190
+ miru search "where are embeddings created" ./src -k 10 --content code
191
+ miru find-related src/embeddings/openai.ts 120 ./src
192
+ miru clear ./src
193
+ miru uninstall
194
+ miru help search
234
195
  ```
235
196
 
236
- Writes `.gemini/agents/miru-code.md`.
197
+ | Command | Summary |
198
+ |---------|---------|
199
+ | `search <query> [path]` | Hybrid search; path defaults to cwd; local path or `https://` git URL |
200
+ | `find-related <file> <line> [path]` | Semantic neighbors at that line |
201
+ | `setup` | Store and validate `TAKARA_API_KEY` |
202
+ | `install` | Interactive global agent setup |
203
+ | `uninstall` | Remove miru agent configuration |
204
+ | `init --agent <id>` | Project-local sub-agent markdown |
205
+ | `clear [path]` | Delete disk cache |
206
+ | *(no command)* | Start stdio MCP server |
237
207
 
238
- ### Kiro
208
+ **Options:** `-k` / `--top-k N` (default 5), `--content code|docs|config|all`, `--json` (force JSON output).
239
209
 
240
- **MCP** — `~/.kiro/settings/mcp.json` or workspace `.kiro/settings/mcp.json`:
210
+ **Output:** In a terminal, search results are formatted for reading (path, score, snippet preview). Piped output and `--json` emit JSON (`query` + `results` with `chunk`, `score`, `location`). Progress spinners go to stderr.
241
211
 
242
- ```json
243
- {
244
- "mcpServers": {
245
- "miru": {
246
- "command": "bunx",
247
- "args": ["@takara-ai/miru-code"],
248
- "env": {
249
- "TAKARA_API_KEY": "your-takara-bearer-token",
250
- "PATH": "/usr/local/bin:/usr/bin:/bin"
251
- }
252
- }
253
- }
254
- }
255
- ```
212
+ From **this repo**, prefix commands with `bun run miru`.
256
213
 
257
- Kiro runs with a minimal environment — include `PATH` if Bun is not on the default path. Approve env vars when prompted in the IDE.
214
+ ## Library
258
215
 
259
- **Sub-agent:**
216
+ ```ts
217
+ import { MiruIndex } from "@takara-ai/miru-code";
260
218
 
261
- ```bash
262
- miru init --agent kiro
219
+ const index = await MiruIndex.fromPath("./src", ["code"]);
220
+ const fromUrl = await MiruIndex.fromSource(
221
+ "https://github.com/org/repo",
222
+ ["code"],
223
+ undefined,
224
+ "main",
225
+ );
226
+
227
+ const results = await index.search({
228
+ query: "BM25 tokenize",
229
+ topK: 10,
230
+ filterPaths: ["src/index/bm25.ts"],
231
+ });
232
+
233
+ const related = await index.findRelated(results[0], 5);
234
+ await index.saveToDefaultCache("./src");
263
235
  ```
264
236
 
265
- Writes `.kiro/agents/miru-code.md`.
266
-
267
- ### OpenCode
237
+ Exports: `MiruIndex`, `clearCache`, `findIndexCachePath`, `resolveCacheFolder`, and chunk/result types.
268
238
 
269
- **MCP** — `~/.config/opencode/opencode.json` or project `opencode.json`:
239
+ ## Environment variables
270
240
 
271
- ```json
272
- {
273
- "$schema": "https://opencode.ai/config.json",
274
- "mcp": {
275
- "miru": {
276
- "type": "local",
277
- "command": ["bunx", "@takara-ai/miru-code"],
278
- "enabled": true,
279
- "environment": {
280
- "TAKARA_API_KEY": "your-takara-bearer-token"
281
- }
282
- }
283
- }
284
- }
285
- ```
241
+ | Variable | Default / notes |
242
+ |----------|-----------------|
243
+ | `TAKARA_API_KEY` | **Required** — Takara bearer token |
244
+ | `MIRU_OPENAI_BASE_URL` | `https://infer.dev.takara.ai/v1` |
245
+ | `MIRU_OPENAI_EMBEDDING_MODEL` | `ds1-potion-code-16m` |
246
+ | `MIRU_EMBEDDING_DIMENSIONS` | `256` for potion (auto when unset) |
247
+ | `MIRU_FLOAT_VECTORS` | unset = int8; `1` = float32 |
248
+ | `MIRU_EMBEDDING_BATCH_SIZE` | `32` |
249
+ | `MIRU_CONCURRENCY` | logical CPUs minus 2 (min 1) |
250
+ | `MIRU_MCP_WATCH` | on; `0` or `false` disables MCP file watch |
251
+ | `MIRU_CREDENTIALS_DIR` | Override credentials directory |
252
+ | `NO_COLOR` | Disable CLI colors |
286
253
 
287
- OpenCode uses the `mcp` key (not `mcpServers`), requires `"type": "local"`, and uses `environment` instead of `env`. Verify with `opencode mcp list`.
254
+ See `.env.example` for optional pipeline tuning (`MIRU_PIPELINE_*`).
288
255
 
289
- **Sub-agent:**
256
+ ## Developing Miru
290
257
 
291
258
  ```bash
292
- miru init --agent opencode
259
+ git clone https://github.com/takara-ai/miru-code.git
260
+ cd miru-code
261
+ bun install
262
+ cp .env.example .env.local # add TAKARA_API_KEY
263
+ bun test
264
+ bun run typecheck
265
+ bun run lint
293
266
  ```
294
267
 
295
- Writes `.opencode/agents/miru-code.md` (subagent mode with bash/read permissions).
296
-
297
- ### Local development (any IDE)
298
-
299
- Point MCP at this repo instead of the published package:
268
+ **Local MCP** — point at your clone:
300
269
 
301
270
  ```json
302
271
  {
@@ -308,63 +277,15 @@ Point MCP at this repo instead of the published package:
308
277
  }
309
278
  ```
310
279
 
311
- Merge into the appropriate wrapper key (`mcpServers`, `servers`, or `mcp`) for your IDE.
312
-
313
- ## CLI
314
-
315
- ```bash
316
- # Hybrid search (positional, Python-compatible)
317
- bun run miru search "where are embeddings created" ./src -k 5
318
-
319
- # Find semantically related chunks
320
- bun run miru find-related src/embeddings/openai.ts 120 ./src
321
-
322
- # Write a miru-code sub-agent for your IDE
323
- bun run miru init --agent cursor
324
-
325
- # Clear disk cache
326
- bun run miru clear ./src
327
- ```
328
-
329
- Indexes are cached under `~/Library/Caches/miru` (macOS) or `~/.cache/miru` (Linux).
330
-
331
- ## Library
332
-
333
- ```ts
334
- import { MiruIndex } from "@takara-ai/miru-code";
335
-
336
- const index = await MiruIndex.fromPath("./src");
337
- const results = await index.search({ query: "BM25 tokenize", topK: 10 });
338
- ```
339
-
340
- ## Tests
341
-
342
- ```bash
343
- bun test
344
- bun run typecheck
345
- ```
346
-
347
280
  ## Publishing
348
281
 
349
- Releases use **Bun** for install, test, and `bun pm pack`. The registry upload uses **`npm publish`** on that tarball because [Bun does not yet support npm OIDC trusted publishing](https://github.com/oven-sh/bun/issues/22423) — no long-lived npm tokens in GitHub secrets.
350
-
351
- **Local publish** (logged in to npm; `publishConfig.access` is already `public`):
352
-
353
- ```bash
354
- bun publish
355
- ```
356
-
357
- Runs `prepublishOnly` (typecheck + tests), then a single registry upload. Do not add a `publish` script that calls `npm publish` — Bun runs lifecycle scripts after its own upload and would publish twice.
358
-
359
- **CI** (after Trusted Publisher is configured on npm):
282
+ Releases use **Bun** for install, test, and `bun pm pack`. Registry upload uses **`npm publish`** on that tarball because [Bun does not yet support npm OIDC trusted publishing](https://github.com/oven-sh/bun/issues/22423).
360
283
 
361
284
  ```bash
362
- npm version patch
363
- git push && git push --tags
364
- gh release create v0.1.1 --generate-notes
285
+ bun publish # local, logged in to npm
365
286
  ```
366
287
 
367
- The `release.yml` workflow runs when the GitHub Release is published.
288
+ **CI:** tag a GitHub Release; `release.yml` publishes to npm via Trusted Publisher.
368
289
 
369
290
  ## License
370
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takara-ai/miru-code",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Miru (見る) — hybrid code search for agents. Bun, TypeScript, Takara embeddings.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@ miru search "save_pretrained" ./my-project
12
12
  miru search "save model to disk" ./my-project --top-k 10
13
13
  ```
14
14
 
15
- Results are cached automatically on first run and invalidated when files change.
15
+ First run builds a disk cache. The MCP server incrementally updates local indexes while it runs; after CLI-only use or large refactors, run `miru clear <path>` to rebuild.
16
16
 
17
17
  Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
18
18
 
@@ -12,7 +12,7 @@ miru search "save_pretrained" ./my-project
12
12
  miru search "save model to disk" ./my-project --top-k 10
13
13
  ```
14
14
 
15
- Results are cached automatically on first run and invalidated when files change.
15
+ First run builds a disk cache. The MCP server incrementally updates local indexes while it runs; after CLI-only use or large refactors, run `miru clear <path>` to rebuild.
16
16
 
17
17
  Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
18
18
 
@@ -11,7 +11,7 @@ miru search "save_pretrained" ./my-project
11
11
  miru search "save model to disk" ./my-project --top-k 10
12
12
  ```
13
13
 
14
- Results are cached automatically on first run and invalidated when files change.
14
+ First run builds a disk cache. The MCP server incrementally updates local indexes while it runs; after CLI-only use or large refactors, run `miru clear <path>` to rebuild.
15
15
 
16
16
  Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
17
17
 
@@ -14,7 +14,7 @@ miru search "save_pretrained" ./my-project
14
14
  miru search "save model to disk" ./my-project --top-k 10
15
15
  ```
16
16
 
17
- Results are cached automatically on first run and invalidated when files change.
17
+ First run builds a disk cache. The MCP server incrementally updates local indexes while it runs; after CLI-only use or large refactors, run `miru clear <path>` to rebuild.
18
18
 
19
19
  Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
20
20
 
@@ -14,7 +14,7 @@ miru search "save_pretrained" ./my-project
14
14
  miru search "save model to disk" ./my-project --top-k 10
15
15
  ```
16
16
 
17
- Results are cached automatically on first run and invalidated when files change.
17
+ First run builds a disk cache. The MCP server incrementally updates local indexes while it runs; after CLI-only use or large refactors, run `miru clear <path>` to rebuild.
18
18
 
19
19
  Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
20
20
 
@@ -15,7 +15,7 @@ miru search "save_pretrained" ./my-project
15
15
  miru search "save model to disk" ./my-project --top-k 10
16
16
  ```
17
17
 
18
- Results are cached automatically on first run and invalidated when files change.
18
+ First run builds a disk cache. The MCP server incrementally updates local indexes while it runs; after CLI-only use or large refactors, run `miru clear <path>` to rebuild.
19
19
 
20
20
  Use `--content docs` to search documentation and prose, `--content config` for config files (yaml, toml, etc.), or `--content all` to search code, docs, and config:
21
21