@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 +180 -259
- package/package.json +1 -1
- package/src/agents/claude.md +1 -1
- package/src/agents/copilot.md +1 -1
- package/src/agents/cursor.md +1 -1
- package/src/agents/gemini.md +1 -1
- package/src/agents/kiro.md +1 -1
- package/src/agents/opencode.md +1 -1
- package/src/cli-ui.ts +189 -0
- package/src/cli.ts +110 -33
- package/src/help.ts +115 -130
- package/src/installer/agents.ts +246 -0
- package/src/installer/config.ts +273 -0
- package/src/installer/installer.ts +256 -0
- package/src/installer/prompt.ts +77 -0
- package/src/setup.ts +17 -20
- package/src/spinner.ts +10 -4
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
|
-
|
|
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
|
-
|
|
7
|
+
## Quick start
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
44
|
-
|
|
45
|
-
```
|
|
15
|
+
# 2. Store your API key (validates against Takara)
|
|
16
|
+
miru setup
|
|
46
17
|
|
|
47
|
-
|
|
48
|
-
|
|
18
|
+
# 3. Wire into your agents (MCP + instructions + sub-agent)
|
|
19
|
+
miru install
|
|
49
20
|
|
|
50
|
-
|
|
21
|
+
# 4. Restart your IDE / agent session, then search
|
|
22
|
+
miru search "auth middleware" ./src
|
|
51
23
|
```
|
|
52
24
|
|
|
53
|
-
|
|
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
|
-
|
|
30
|
+
bunx @takara-ai/miru-code search "auth middleware" ./src
|
|
57
31
|
```
|
|
58
32
|
|
|
59
|
-
|
|
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
|
-
|
|
35
|
+
---
|
|
72
36
|
|
|
73
|
-
##
|
|
37
|
+
## How to read this doc
|
|
74
38
|
|
|
75
|
-
|
|
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
|
-
|
|
46
|
+
## Install options
|
|
78
47
|
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
| [
|
|
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
|
-
|
|
55
|
+
After install, `miru` is on your PATH. Run `miru` with no args for help.
|
|
89
56
|
|
|
90
|
-
|
|
57
|
+
## Credentials
|
|
91
58
|
|
|
92
|
-
|
|
59
|
+
Miru needs `TAKARA_API_KEY` — a Takara bearer token for code embeddings.
|
|
93
60
|
|
|
94
61
|
```bash
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
67
|
+
Stored credentials live at:
|
|
100
68
|
|
|
101
|
-
|
|
69
|
+
- macOS: `~/Library/Application Support/miru/credentials.json`
|
|
70
|
+
- Linux: `~/.config/miru/credentials.json`
|
|
71
|
+
- Windows: `%APPDATA%\miru\credentials.json`
|
|
102
72
|
|
|
103
|
-
|
|
73
|
+
Override with `MIRU_CREDENTIALS_DIR`.
|
|
104
74
|
|
|
105
|
-
|
|
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
|
-
|
|
77
|
+
## IDE integration
|
|
108
78
|
|
|
109
|
-
|
|
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
|
-
|
|
81
|
+
Configures up to three integrations per agent:
|
|
119
82
|
|
|
120
|
-
|
|
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
|
-
```
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
94
|
+
Restart your IDE or agent session after install.
|
|
95
|
+
|
|
96
|
+
### Where files go (global user config)
|
|
137
97
|
|
|
138
|
-
|
|
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
|
|
114
|
+
miru init --agent claude --force # → .claude/agents/miru-code.md
|
|
142
115
|
```
|
|
143
116
|
|
|
144
|
-
|
|
117
|
+
Agents: `cursor`, `claude`, `copilot`, `gemini`, `kiro`, `opencode`.
|
|
145
118
|
|
|
146
|
-
###
|
|
119
|
+
### Manual MCP setup
|
|
147
120
|
|
|
148
|
-
|
|
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
|
-
"
|
|
153
|
-
"
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"
|
|
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
|
-
|
|
135
|
+
After `bun add -g @takara-ai/miru-code`, you can use `"command": "miru"` instead of `bunx`.
|
|
166
136
|
|
|
167
|
-
|
|
137
|
+
**MCP tools**
|
|
168
138
|
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
**
|
|
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
|
-
|
|
176
|
-
miru init --agent claude
|
|
177
|
-
```
|
|
146
|
+
**IDE-specific notes**
|
|
178
147
|
|
|
179
|
-
|
|
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
|
-
|
|
153
|
+
Optional MCP startup flags: `--ref BRANCH`, `--content code docs …`
|
|
182
154
|
|
|
183
|
-
|
|
155
|
+
## How Miru works
|
|
184
156
|
|
|
185
|
-
|
|
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
|
-
|
|
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
|
-
**
|
|
164
|
+
Index **code**, **docs**, **config**, or **all** via `--content` (CLI/MCP) or when building a library index.
|
|
203
165
|
|
|
204
|
-
|
|
205
|
-
miru init --agent copilot
|
|
206
|
-
```
|
|
166
|
+
### Agent workflow
|
|
207
167
|
|
|
208
|
-
|
|
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
|
-
###
|
|
174
|
+
### Caching
|
|
211
175
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
183
|
+
Cache: `~/Library/Caches/miru` (macOS), `~/.cache/miru` (Linux), `%LOCALAPPDATA%\miru\Cache` (Windows).
|
|
229
184
|
|
|
230
|
-
|
|
185
|
+
## CLI
|
|
231
186
|
|
|
232
187
|
```bash
|
|
233
|
-
miru
|
|
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
|
-
|
|
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
|
-
|
|
208
|
+
**Options:** `-k` / `--top-k N` (default 5), `--content code|docs|config|all`, `--json` (force JSON output).
|
|
239
209
|
|
|
240
|
-
**
|
|
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
|
-
|
|
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
|
-
|
|
214
|
+
## Library
|
|
258
215
|
|
|
259
|
-
|
|
216
|
+
```ts
|
|
217
|
+
import { MiruIndex } from "@takara-ai/miru-code";
|
|
260
218
|
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
266
|
-
|
|
267
|
-
### OpenCode
|
|
237
|
+
Exports: `MiruIndex`, `clearCache`, `findIndexCachePath`, `resolveCacheFolder`, and chunk/result types.
|
|
268
238
|
|
|
269
|
-
|
|
239
|
+
## Environment variables
|
|
270
240
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
-
|
|
254
|
+
See `.env.example` for optional pipeline tuning (`MIRU_PIPELINE_*`).
|
|
288
255
|
|
|
289
|
-
|
|
256
|
+
## Developing Miru
|
|
290
257
|
|
|
291
258
|
```bash
|
|
292
|
-
|
|
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
|
-
|
|
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`.
|
|
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
|
-
|
|
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
|
-
|
|
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
package/src/agents/claude.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/agents/copilot.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/agents/cursor.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/agents/gemini.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/agents/kiro.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/agents/opencode.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|