xindex 1.0.10 → 1.0.11
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 +68 -59
- package/apps/mcpApp.ts +12 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**grep matches text. xindex matches meaning.**
|
|
4
4
|
|
|
5
|
-
Local semantic code search for your codebase
|
|
5
|
+
Ask *"where is auth handled?"* — get the right files, even when they don't contain the word *auth*. Local semantic code search for your codebase, plus an MCP server so Claude Code (and any MCP client) can search your repo directly. Fully local, no cloud, no API keys.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -26,7 +26,16 @@ Index lives in `./.xindex/` — add it to `.gitignore`.
|
|
|
26
26
|
|
|
27
27
|
## Use with Claude Code (MCP)
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### Zero-install, all projects
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
claude mcp add --scope user xindex -- npx xindex
|
|
33
|
+
# remove later: claude mcp remove xindex --scope user
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Per-project
|
|
37
|
+
|
|
38
|
+
Drop this into `.mcp.json` at the repo root — `npx` fetches on demand:
|
|
30
39
|
|
|
31
40
|
```json
|
|
32
41
|
{
|
|
@@ -39,10 +48,10 @@ Drop this into `.mcp.json` at your project root — **no install required**, `np
|
|
|
39
48
|
}
|
|
40
49
|
```
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
### With a global install
|
|
43
52
|
|
|
44
|
-
1.
|
|
45
|
-
2.
|
|
53
|
+
1. `npm i -g xindex`
|
|
54
|
+
2. In `.mcp.json`, set `"command": "xindex-mcp"` with `"args": []`.
|
|
46
55
|
|
|
47
56
|
Open the project in Claude Code — it picks up the xindex MCP server and can call `xindex_search`, `xindex_index`, and `xindex_reset` directly. Fewer hallucinations, fewer round-trips.
|
|
48
57
|
|
|
@@ -54,7 +63,7 @@ Open the project in Claude Code — it picks up the xindex MCP server and can ca
|
|
|
54
63
|
- **Watch mode** — keeps the index warm while you code
|
|
55
64
|
- **Gitignore-aware** — respects `.gitignore` + custom ignore rules
|
|
56
65
|
- **Zero config** — works with defaults; `.xindex.json` is optional
|
|
57
|
-
- **Tolerant** —
|
|
66
|
+
- **Tolerant** — unreadable, oversize, empty, binary files and symlinks are skipped with a log line; runs always finish
|
|
58
67
|
|
|
59
68
|
## Claude Code skills (`@xi`)
|
|
60
69
|
|
|
@@ -67,21 +76,23 @@ Keeping them separate keeps `@xi` safe to fire casually while destructive ops st
|
|
|
67
76
|
|
|
68
77
|
### Install
|
|
69
78
|
|
|
70
|
-
Pick
|
|
79
|
+
Pick a scope — project (checked in, shared with the repo) or user-global (available in every project):
|
|
71
80
|
|
|
72
81
|
```bash
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
# project-scoped
|
|
83
|
+
SKILLS=.claude/skills
|
|
84
|
+
```
|
|
85
|
+
```bash
|
|
86
|
+
# OR user-global
|
|
87
|
+
SKILLS=~/.claude/skills
|
|
78
88
|
```
|
|
79
89
|
|
|
80
|
-
Then
|
|
90
|
+
Then copy-paste the block below to create both skills:
|
|
81
91
|
|
|
82
|
-
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p "$SKILLS/ask-xi" "$SKILLS/xindex"
|
|
83
94
|
|
|
84
|
-
|
|
95
|
+
cat > "$SKILLS/ask-xi/SKILL.md" <<'EOF'
|
|
85
96
|
---
|
|
86
97
|
name: ask-xi
|
|
87
98
|
description: Discovers relevant files via xindex semantic search — preps queries, auto-indexes on empty, returns file links with keywords. Triggered by @xi.
|
|
@@ -96,11 +107,9 @@ Surface-level codebase discovery via xindex. Tool: `xindex_search` (natural-lang
|
|
|
96
107
|
4. Return file paths + brief keywords showing why each matched.
|
|
97
108
|
|
|
98
109
|
Output = file links + keywords, not analysis. **Escalate to `/ask-cursor` by default** (cheap codebase reasoning); only go to `/ask-claude` for multi-file/pattern analysis or `/ask-claude-opus` for trade-offs. For reset or full re-index, delegate to `/xindex` (owns safety rules).
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
`xindex/SKILL.md`:
|
|
110
|
+
EOF
|
|
102
111
|
|
|
103
|
-
|
|
112
|
+
cat > "$SKILLS/xindex/SKILL.md" <<'EOF'
|
|
104
113
|
---
|
|
105
114
|
name: xindex
|
|
106
115
|
description: Manages xindex semantic search — index, search, reset via MCP tools. For research questions, use /ask-xi.
|
|
@@ -118,9 +127,10 @@ Full xindex tool management. For research, use `/ask-xi`. Install: `npm i -g xin
|
|
|
118
127
|
**Scoped indexing (preferred):** index only task-relevant content-heavy folders, sequentially. Full-repo `xindex_index(["."])` only for cross-cutting discovery.
|
|
119
128
|
|
|
120
129
|
$ARGUMENTS
|
|
121
|
-
|
|
130
|
+
EOF
|
|
131
|
+
```
|
|
122
132
|
|
|
123
|
-
Both skills assume the `xindex` MCP server is registered (see the section above). Restart Claude Code after adding
|
|
133
|
+
Both skills assume the `xindex` MCP server is registered (see the section above). Restart Claude Code after adding.
|
|
124
134
|
|
|
125
135
|
---
|
|
126
136
|
|
|
@@ -129,46 +139,48 @@ Both skills assume the `xindex` MCP server is registered (see the section above)
|
|
|
129
139
|
All five binaries run from any directory; they index/search the current working directory.
|
|
130
140
|
|
|
131
141
|
### `xindex-index [paths...]`
|
|
132
|
-
|
|
142
|
+
|
|
143
|
+
Build or update the index. Defaults to `.`.
|
|
144
|
+
|
|
133
145
|
```bash
|
|
134
146
|
xindex-index .
|
|
135
147
|
xindex-index apps features
|
|
136
148
|
```
|
|
137
149
|
|
|
138
150
|
### `xindex-search <query...>`
|
|
139
|
-
|
|
151
|
+
|
|
152
|
+
Search the index. Args are joined into one query. Default limit: 7.
|
|
153
|
+
|
|
140
154
|
```bash
|
|
141
155
|
xindex-search "database migration logic"
|
|
142
156
|
xindex-search file watcher debounce
|
|
143
157
|
```
|
|
144
158
|
|
|
145
159
|
### `xindex-watch [paths...]`
|
|
146
|
-
|
|
160
|
+
|
|
161
|
+
Initial index + filesystem watch for incremental updates. Lockfile coordinates concurrent watchers; Ctrl+C releases cleanly.
|
|
162
|
+
|
|
147
163
|
```bash
|
|
148
164
|
xindex-watch .
|
|
149
165
|
```
|
|
150
166
|
|
|
151
167
|
### `xindex-reset`
|
|
168
|
+
|
|
152
169
|
Wipe and recreate the index. Destructive.
|
|
170
|
+
|
|
153
171
|
```bash
|
|
154
172
|
xindex-reset
|
|
155
173
|
```
|
|
156
174
|
|
|
157
175
|
### `xindex-mcp`
|
|
158
|
-
Run as an MCP stdio server. Starts a background watcher by default.
|
|
159
|
-
```bash
|
|
160
|
-
xindex-mcp # with watch
|
|
161
|
-
xindex-mcp --watch-disabled # no watch
|
|
162
|
-
xindex-mcp --watch-dir=./src # watch a specific dir
|
|
163
|
-
```
|
|
164
176
|
|
|
165
|
-
|
|
177
|
+
MCP stdio server; background watcher by default. Flags: `--watch-disabled`, `--watch-dir=./src`.
|
|
166
178
|
|
|
167
|
-
|
|
168
|
-
- **`xindex_index`** — index paths. `inputs: string[]` (at least one)
|
|
169
|
-
- **`xindex_reset`** — wipe index (destructive). No input
|
|
179
|
+
## MCP tools
|
|
170
180
|
|
|
171
|
-
|
|
181
|
+
- **`xindex_search`** — semantic search. `query: string`, `limit?: number` (default 7, max 50).
|
|
182
|
+
- **`xindex_index`** — index paths. `inputs: string[]` (at least one).
|
|
183
|
+
- **`xindex_reset`** — wipe index (destructive). No input.
|
|
172
184
|
|
|
173
185
|
## Configuration
|
|
174
186
|
|
|
@@ -177,29 +189,33 @@ Note: both CLI `xindex-search` and MCP `xindex_search` default to 7 results; MCP
|
|
|
177
189
|
Project-root file. All fields optional; unknown keys ignored; missing/empty → defaults.
|
|
178
190
|
|
|
179
191
|
- **`ignoreKeywords`** — `string[]`, default `[]`. Tokens stripped before embedding — add project slang/boilerplate polluting results. Entries ≤1 char warn.
|
|
180
|
-
- **`ignoreFiles`** — `string[]`, default `[]`. Extra globs excluded during walk/watch, on top of `.gitignore
|
|
192
|
+
- **`ignoreFiles`** — `string[]`, default `['.xindex', 'node_modules']`. Extra globs excluded during walk/watch, on top of `.gitignore`. Setting this **replaces** the default — re-include `.xindex` and `node_modules` if you still want them skipped.
|
|
181
193
|
- **`maxLines`** — `number`, default `30`. Lines per chunk — tune if chunks feel over/under-sized.
|
|
182
194
|
- **`maxFileBytes`** — `number`, default `50000`. Skip files over this (50 KB) — raise to index larger generated files.
|
|
183
|
-
- **`followSymlinks`** — `boolean`, default `false`. When `false`,
|
|
195
|
+
- **`followSymlinks`** — `boolean`, default `false`. When `false`, symlinks are skipped with a log line. `true` follows them (cycles broken via `realpath` dedup).
|
|
196
|
+
|
|
197
|
+
Full example with every option (copy-paste and trim what you don't need):
|
|
184
198
|
|
|
185
199
|
```json
|
|
186
200
|
{
|
|
187
201
|
"ignoreKeywords": ["import", "export", "function", "const"],
|
|
188
|
-
"ignoreFiles": ["
|
|
202
|
+
"ignoreFiles": [".xindex", "node_modules", "dist/**"],
|
|
203
|
+
"maxLines": 30,
|
|
204
|
+
"maxFileBytes": 50000,
|
|
205
|
+
"followSymlinks": false
|
|
189
206
|
}
|
|
190
207
|
```
|
|
191
208
|
|
|
192
|
-
Override only what you need; re-run `xindex-index .` (or let the watcher pick it up). Invalid JSON throws; wrong-typed fields fall back silently.
|
|
209
|
+
Override only what you need; re-run `xindex-index .` (or let the watcher pick it up on restart). Invalid JSON throws; wrong-typed fields fall back silently.
|
|
193
210
|
|
|
194
211
|
### `.xindex/` folder
|
|
195
212
|
|
|
196
|
-
|
|
197
|
-
- `semantic/` — the vectra index (vectors + metadata)
|
|
198
|
-
- `lock.json` — watcher lock (coordinates watch/MCP processes)
|
|
213
|
+
Auto-created. Contains:
|
|
199
214
|
|
|
200
|
-
|
|
215
|
+
- `semantic/` — the semantic index (vectors + metadata)
|
|
216
|
+
- `lock.json` — watcher lock (coordinates watch/MCP processes)
|
|
201
217
|
|
|
202
|
-
|
|
218
|
+
**Always gitignore it** — it's already excluded from the walk by default, this is just for git:
|
|
203
219
|
|
|
204
220
|
```
|
|
205
221
|
.xindex
|
|
@@ -211,10 +227,10 @@ node_modules/
|
|
|
211
227
|
```
|
|
212
228
|
your repo xindex
|
|
213
229
|
───────── ──────
|
|
214
|
-
*.ts / *.md ──► walk ──►
|
|
215
|
-
.gitignore
|
|
216
|
-
|
|
217
|
-
CLI / MCP ◄── search ◄── embed
|
|
230
|
+
*.ts / *.md ──► walk ──► embed ──► .xindex/
|
|
231
|
+
.gitignore (semantic index)
|
|
232
|
+
▲
|
|
233
|
+
CLI / MCP ◄── search ◄── embed ◄── "question" ┘
|
|
218
234
|
```
|
|
219
235
|
|
|
220
236
|
## Project layout
|
|
@@ -222,7 +238,7 @@ node_modules/
|
|
|
222
238
|
```
|
|
223
239
|
apps/ entry points (run.*.ts) + app composers (IndexApp, SearchApp, McpApp, ...)
|
|
224
240
|
bin/ shebang wrappers invoked by npm and .mcp.json
|
|
225
|
-
componets/ shared building blocks: config, walk, watch, embed,
|
|
241
|
+
componets/ shared building blocks: config, walk, watch, embed, index adapter, logger
|
|
226
242
|
features/ domain operations: indexContent, searchIndex, removeContent, resetIndex
|
|
227
243
|
packages/ small internal libs (streamx, fun)
|
|
228
244
|
.xindex/ runtime data (gitignored)
|
|
@@ -234,18 +250,11 @@ See [CLAUDE.md](CLAUDE.md) for contributor conventions (HOF pattern, logger rule
|
|
|
234
250
|
|
|
235
251
|
## Development
|
|
236
252
|
|
|
237
|
-
Working on xindex itself?
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
git clone <repo-url> xindex
|
|
241
|
-
cd xindex
|
|
242
|
-
yarn install # or npm install
|
|
243
|
-
npm link # exposes xindex-* binaries from your working copy
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
Check TypeScript compilation:
|
|
253
|
+
Working on xindex itself? From your working copy:
|
|
247
254
|
|
|
248
255
|
```bash
|
|
256
|
+
yarn install # or npm install
|
|
257
|
+
npm link # exposes xindex-* binaries from this checkout
|
|
249
258
|
yarn test.compilation
|
|
250
259
|
```
|
|
251
260
|
|
package/apps/mcpApp.ts
CHANGED
|
@@ -39,8 +39,11 @@ export function McpApp({
|
|
|
39
39
|
// --- search ---
|
|
40
40
|
|
|
41
41
|
server.registerTool("xindex_search", {
|
|
42
|
-
title: "Search codebase",
|
|
43
|
-
description: "Semantic search
|
|
42
|
+
title: "Search codebase (semantic)",
|
|
43
|
+
description: "Semantic codebase search — finds files by meaning, not substring. " +
|
|
44
|
+
"For discovery, run 3–7 parallel queries then narrower follow-ups. " +
|
|
45
|
+
"Returns ranked file paths + matched keywords (links, not analysis). " +
|
|
46
|
+
"If sparse, run `xindex_index` on relevant roots first (scoped, one path per call).",
|
|
44
47
|
inputSchema: z.object({
|
|
45
48
|
query: z.string()
|
|
46
49
|
.describe("Natural language search query"),
|
|
@@ -65,11 +68,12 @@ export function McpApp({
|
|
|
65
68
|
|
|
66
69
|
server.registerTool("xindex_index", {
|
|
67
70
|
title: "Index files or directories",
|
|
68
|
-
description: "Index files
|
|
69
|
-
"
|
|
71
|
+
description: "Index files/directories for semantic search; recursive, respects .gitignore. " +
|
|
72
|
+
"Prefer scoped paths (one per call, e.g. `src`, `apps`) over full-repo `['.']` — " +
|
|
73
|
+
"reserve the latter for first-time setup or cross-cutting discovery.",
|
|
70
74
|
inputSchema: z.object({
|
|
71
75
|
inputs: z.array(z.string()).min(1)
|
|
72
|
-
.describe("File or directory paths to index"),
|
|
76
|
+
.describe("File or directory paths to index (one path per call preferred; scoped over full-repo)"),
|
|
73
77
|
}),
|
|
74
78
|
}, async ({inputs}) => {
|
|
75
79
|
try {
|
|
@@ -89,9 +93,9 @@ export function McpApp({
|
|
|
89
93
|
// --- reset ---
|
|
90
94
|
|
|
91
95
|
server.registerTool("xindex_reset", {
|
|
92
|
-
title: "Reset index",
|
|
93
|
-
description: "
|
|
94
|
-
"
|
|
96
|
+
title: "Reset index (destructive)",
|
|
97
|
+
description: "Wipe and recreate the semantic index. **Destructive** — MUST get explicit user confirmation; " +
|
|
98
|
+
"if ambiguous, don't run. Recovery / reindex flow: confirm → `xindex_reset` → `xindex_index(['.'])` → `xindex_search`.",
|
|
95
99
|
inputSchema: z.object({}),
|
|
96
100
|
annotations: {destructiveHint: true},
|
|
97
101
|
}, async () => {
|