@ushiradineth/veil 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ushira Dineth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,306 @@
1
+ # veil
2
+
3
+ > High-performance MCP server and CLI for repository indexing and code search
4
+
5
+ Veil is a blazingly fast code indexing and search engine designed for AI agents and developer tools. It indexes code repositories and exposes retrieval tools over the Model Context Protocol (MCP), enabling sub-millisecond queries with minimal memory overhead.
6
+
7
+ ## Features
8
+
9
+ - **Ultra-fast queries** - Sub-millisecond warm query latency (0.03-0.07ms p95)
10
+ - **Smart indexing** - Extracts files, symbols, and semantic code chunks
11
+ - **Flexible search** - File paths, symbol names, and full-text code search
12
+ - **Memory efficient** - <100MB for typical workloads with intelligent caching
13
+ - **Incremental updates** - Fast refresh with git-aware change detection
14
+ - **Battle-tested** - Comprehensive correctness and performance test coverage
15
+ - **Observable** - Built-in diagnostics and performance profiling
16
+ - **MCP native** - First-class Model Context Protocol support
17
+
18
+ ## Performance
19
+
20
+ Veil includes a reproducible benchmark suite for public comparisons across:
21
+
22
+ - Veil MCP index tools
23
+ - Shell tool workflows commonly used by non-indexed agent loops
24
+ - Serena via `uvx` (from `https://github.com/oraios/serena`) plus optional custom adapter configs
25
+
26
+ See [BENCHMARKS.md](BENCHMARKS.md) for methodology, fairness rules, and commands to generate fresh benchmark artifacts.
27
+
28
+ **Memory usage:** <100MB for typical workloads
29
+ **Test coverage:** Run `bun test ./src/test.ts` for current suite status
30
+
31
+ ## Installation
32
+
33
+ **Requirements:**
34
+ - Bun runtime (or Node.js 18+)
35
+ - Git (optional, for git-aware indexing)
36
+
37
+ **Clone and install:**
38
+
39
+ ```bash
40
+ git clone https://github.com/ushiradineth/veil.git
41
+ cd veil
42
+ bun install
43
+ ```
44
+
45
+ ## MCP Setup
46
+
47
+ No-clone setup (recommended): run Veil directly from npm package.
48
+
49
+ Add Veil to your MCP client configuration:
50
+
51
+ ### Claude Desktop
52
+
53
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "veil": {
59
+ "command": "npx",
60
+ "args": ["-y", "@ushiradineth/veil", "server"],
61
+ "env": {}
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### Codex
68
+
69
+ Edit `~/.config/codex/mcp.json`:
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "veil": {
75
+ "command": "npx",
76
+ "args": ["-y", "@ushiradineth/veil", "server"]
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ ### OpenCode
83
+
84
+ Edit `~/.config/opencode/mcp.json`:
85
+
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "veil": {
90
+ "command": "npx",
91
+ "args": ["-y", "@ushiradineth/veil", "server"]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ Alternative package launch with Bun:
98
+
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "veil": {
103
+ "command": "bunx",
104
+ "args": ["@ushiradineth/veil", "server"]
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ Local clone setup (contributors):
111
+
112
+ ```json
113
+ {
114
+ "mcpServers": {
115
+ "veil": {
116
+ "command": "bun",
117
+ "args": ["run", "/path/to/veil/src/server.ts"]
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ **Example with workspace:**
124
+
125
+ To index a specific repository (e.g., `~/nix-config`), first build the index:
126
+
127
+ ```bash
128
+ bun run src/cli.ts build --workspace ~/nix-config
129
+ ```
130
+
131
+ Then use the MCP tools with `workspace: "~/nix-config"` parameter, or omit it to use the current working directory.
132
+
133
+ ## Agent Adoption
134
+
135
+ To improve real-world tool usage (selection and correctness), use:
136
+
137
+ - `AGENTS.md` for default routing policy and anti-pattern constraints
138
+ - `docs/SKILL.md` as a reusable skill prompt for research and investigation tasks
139
+
140
+ Install the skill using the `skills` CLI from `vercel-labs/skills`:
141
+
142
+ ```bash
143
+ # install from local repo path
144
+ npx skills add ./docs --skill veil-research-workflow
145
+
146
+ # install from GitHub
147
+ npx skills add https://github.com/ushiradineth/veil/tree/main/docs --skill veil-research-workflow
148
+
149
+ # optional: target specific agents yourself
150
+ npx skills add https://github.com/ushiradineth/veil/tree/main/docs --skill veil-research-workflow -a opencode
151
+ ```
152
+
153
+ ## CLI Usage
154
+
155
+ All CLI and MCP text outputs are emitted in TOON format (not JSON text).
156
+
157
+ Package-style CLI (no clone after install):
158
+
159
+ ```bash
160
+ npx -y @ushiradineth/veil cli status
161
+ npx -y @ushiradineth/veil cli discover --query "homebrew pnpm"
162
+ ```
163
+
164
+ ```bash
165
+ # Build index
166
+ bun run src/cli.ts build --workspace <path>
167
+
168
+ # Check status
169
+ bun run src/cli.ts status --workspace <path>
170
+
171
+ # Refresh index (incremental)
172
+ bun run src/cli.ts refresh --workspace <path> --mode changed
173
+
174
+ # Search and discover
175
+ bun run src/cli.ts discover --workspace <path> --query "homebrew pnpm"
176
+
177
+ # Intent-aware lookup with explainability
178
+ bun run src/cli.ts lookup --workspace <path> --query "where is buildIndex defined"
179
+
180
+ # Fast web search without API keys (google, duckduckgo, wikipedia, github, reddit, deepwiki)
181
+ bun run src/cli.ts web-search --query "typescript language server"
182
+
183
+ # Optional debug diagnostics for web search (provider trace, ranking details)
184
+ bun run src/cli.ts web-search --query "typescript language server" --debug 1
185
+
186
+ # Fetch URL content with markdown-first negotiation
187
+ bun run src/cli.ts fetch-url --url "https://example.com" --format markdown
188
+
189
+ # Git repository lookups
190
+ bun run src/cli.ts git-status --workspace <path>
191
+ bun run src/cli.ts git-log --workspace <path> --limit 20
192
+ bun run src/cli.ts git-diff --workspace <path> --staged 0 --path src/indexer.ts
193
+ bun run src/cli.ts git-show --workspace <path> --rev HEAD
194
+
195
+ # Optional GitHub lookup via gh CLI
196
+ bun run src/cli.ts gh-lookup --workspace <path> --repo owner/name --kind prs --limit 10
197
+
198
+ # Run diagnostics
199
+ bun run src/cli.ts diagnostics
200
+
201
+ # Run tests
202
+ bun test ./src/test.ts
203
+
204
+ # Benchmark (internal performance)
205
+ bun run src/bench-harness.ts --workspace <path> --warm 50
206
+
207
+ # Benchmark (vs traditional tools)
208
+ bun run src/bench-comparison.ts --workspace <path>
209
+
210
+ # Benchmark suite (public, multi-competitor)
211
+ bun run src/bench-suite.ts --workspace <path> --cold 1 --warm 50 --out benchmarks/results/latest
212
+
213
+ # Benchmark suite with custom Serena command overrides (optional)
214
+ bun run src/bench-suite.ts --workspace <path> --serena-config benchmarks/serena.config.example.json --out benchmarks/results/latest
215
+ ```
216
+
217
+ ## Release Pipeline
218
+
219
+ Manual release workflow: `.github/workflows/release.yml`.
220
+
221
+ - Trigger via GitHub Actions `Release` workflow (`workflow_dispatch`)
222
+ - Supports `patch|minor|major` bump
223
+ - Supports `dry_run=true` for full validation without push/publish
224
+ - Auto-updates `package.json` and `CHANGELOG.md`
225
+ - Tags release as `v<version>`, publishes npm package, and creates GitHub release
226
+
227
+ Required GitHub secrets:
228
+
229
+ - `NPM_TOKEN`: npm automation token with publish access to `@ushiradineth/veil`
230
+
231
+ No additional GitHub environment variables are required by default.
232
+
233
+ ## MCP Tools
234
+
235
+ The server exposes the following MCP tools:
236
+
237
+ - **status** - Get index status and staleness reasons
238
+ - **refresh** - Build or refresh the index
239
+ - **files** - Find files by substring path query
240
+ - **symbols** - Find symbols by name
241
+ - **search** - Search indexed code chunks by keyword
242
+ - **lookup** - Intent-aware contextual lookup with confidence and fallback metadata
243
+ - **web_search** - Fast web search without API keys (google, duckduckgo, wikipedia, github, reddit, deepwiki), minimal results by default with optional debug diagnostics
244
+ - **fetch_url** - Fetch URL content with markdown-first output negotiation and fallback conversion
245
+ - returns `markdown_tokens`, `content_signal`, and `vary` when present in response headers
246
+ - **discover** - Combined status + files + symbols + search in one call
247
+ - **git_status** - Inspect branch state and dirty workspace changes
248
+ - **git_log** - Query commit history with limit and filters
249
+ - **git_diff** - Inspect uncommitted or revision-range diff output
250
+ - **git_show** - Show commit details and optional patch output
251
+ - **gh_lookup** - Optional GitHub issues/PRs/checks lookup via `gh`
252
+ - **diagnostics** - Get performance diagnostics and cache stats
253
+
254
+ ## Index Storage
255
+
256
+ Index artifacts are written to `<workspace>/.agents/index/`:
257
+ - `files.ndjson` - File records with metadata
258
+ - `symbols.ndjson` - Extracted symbols (functions, classes, types)
259
+ - `chunks.ndjson` - Code chunks for semantic search
260
+ - `manifest.json` - Index metadata and staleness tracking
261
+
262
+ ## Architecture
263
+
264
+ **Hot path optimizations:**
265
+ - Heap-based top-K scoring (O(n log k) vs O(n²))
266
+ - Single-pass NDJSON parsing
267
+ - Parallel file processing with batching
268
+ - Normalized string caching for memory efficiency
269
+
270
+ **Caching strategy:**
271
+ - In-memory index cache with mtime validation
272
+ - Query result caching per workspace
273
+ - Status cache with TTL
274
+
275
+ ## Development
276
+
277
+ **Run tests:**
278
+ ```bash
279
+ bun test ./src/test.ts
280
+ ```
281
+
282
+ **Run benchmarks:**
283
+ ```bash
284
+ bun run src/bench-harness.ts --workspace /path/to/repo --warm 100
285
+ ```
286
+
287
+ **Start MCP server:**
288
+ ```bash
289
+ bun run src/server.ts
290
+ ```
291
+
292
+ ## License
293
+
294
+ MIT License - see [LICENSE](LICENSE) for details.
295
+
296
+ ## Contributing
297
+
298
+ Contributions are welcome! Please feel free to submit issues or pull requests.
299
+
300
+ ## Acknowledgments
301
+
302
+ Built with performance in mind, leveraging:
303
+ - Heap-based top-K algorithms for efficient ranking
304
+ - Single-pass parsing to minimize allocations
305
+ - Parallel file processing for multi-core systems
306
+ - Intelligent caching strategies for memory efficiency
package/bin/veil.mjs ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import { fileURLToPath } from "node:url";
5
+ import { dirname, resolve } from "node:path";
6
+
7
+ const args = process.argv.slice(2);
8
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
9
+ const entry = resolve(root, "dist", "bin.js");
10
+
11
+ const run = spawnSync(process.execPath, [entry, ...args], {
12
+ stdio: "inherit",
13
+ env: process.env,
14
+ });
15
+
16
+ if (run.error) {
17
+ process.stderr.write(`Failed to launch veil entrypoint: ${String(run.error.message ?? run.error)}\n`);
18
+ process.exit(1);
19
+ }
20
+
21
+ process.exit(run.status ?? 1);