codeix 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/README.md +178 -0
  2. package/package.json +4 -3
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # codeix
2
+
3
+ Portable, composable code index. Build once with tree-sitter, query anywhere via MCP.
4
+
5
+ ```
6
+ codeix # start MCP server, watch for changes
7
+ codeix build # parse source files, write .codeindex/
8
+ codeix serve --no-watch # serve without file watching
9
+ ```
10
+
11
+ ## Why
12
+
13
+ AI coding agents spend most of their token budget *finding* code before they can *work on* it. They grep, read files, grep again, backtrack. On a large codebase the agent might burn thousands of tokens just locating the right function — or worse, miss it entirely and hallucinate.
14
+
15
+ **Codeix gives the agent a pre-built map of your codebase.** One structured query returns the symbol name, file, line range, signature, and parent — no scanning, no guessing.
16
+
17
+ ### What existing tools get wrong
18
+
19
+ | Problem | What happens today |
20
+ |---|---|
21
+ | **No structure** | `grep` finds text matches, not symbols. The agent can't distinguish a function definition from a comment mentioning it. |
22
+ | **Slow re-parsing** | Python-based indexers re-parse everything on startup. On large codebases, you wait. |
23
+ | **Not shareable** | Indexes are local caches — ephemeral, per-machine. A new developer or CI runner starts from scratch. |
24
+ | **No composition** | Monorepo with 10 packages? Dependencies with useful APIs? No way to query across boundaries. |
25
+ | **Prose is invisible** | TODOs, docstrings, error messages — searchable by grep but not *selectively*. You can't search only comments without also matching code. |
26
+
27
+ ### What codeix does differently
28
+
29
+ - **Committed to git** — the index is a `.codeindex/` directory you commit with your code. Clone the repo, the index is already there. No re-indexing.
30
+ - **Shareable** — library authors can ship `.codeindex/` in their npm/PyPI/crates.io package. Consumers get instant navigation of dependencies.
31
+ - **Composable** — the MCP server auto-discovers dependency indexes and mounts them. Query your code and your dependencies in one place.
32
+ - **Structured for LLMs** — symbols have kinds, signatures, parent relationships, and line ranges. The agent gets exactly what it needs in one tool call instead of piecing it together from raw text.
33
+ - **Prose search** — `search_texts` targets comments, docstrings, and string literals specifically. Find TODOs, find the error message a user reported, find what a function's docstring says — without noise from code.
34
+ - **Fast** — Rust + tree-sitter + in-memory SQLite FTS5. Builds in seconds, queries in milliseconds.
35
+
36
+ ## What it does
37
+
38
+ Codeix scans your source code with [tree-sitter](https://tree-sitter.github.io/), extracts symbols, imports, comments, and docstrings, then writes a `.codeindex/` directory you commit alongside your code.
39
+
40
+ AI agents query it through [MCP](https://modelcontextprotocol.io/) (Model Context Protocol) to navigate codebases without re-parsing anything.
41
+
42
+ ## The index format
43
+
44
+ ```
45
+ .codeindex/
46
+ index.json # manifest: version, name, languages
47
+ files.jsonl # one line per source file (path, lang, hash, line count)
48
+ symbols.jsonl # one line per symbol (functions, classes, imports, with signatures)
49
+ texts.jsonl # one line per comment, docstring, string literal
50
+ ```
51
+
52
+ Plain JSONL. Git-friendly diffs. Human-readable with `grep` and `jq`. No binary blobs.
53
+
54
+ **Example** — `symbols.jsonl`:
55
+ ```jsonl
56
+ {"file":"src/main.py","name":"os","kind":"import","line":[1,1]}
57
+ {"file":"src/main.py","name":"Config","kind":"class","line":[22,45]}
58
+ {"file":"src/main.py","name":"Config.__init__","kind":"method","line":[23,30],"parent":"Config","sig":"def __init__(self, path: str, debug: bool = False)"}
59
+ {"file":"src/main.py","name":"main","kind":"function","line":[48,60],"sig":"def main(args: list[str]) -> int"}
60
+ ```
61
+
62
+ ## MCP tools
63
+
64
+ Six tools, zero setup. The agent queries immediately — no init, no config, no refresh.
65
+
66
+ | Tool | What it does |
67
+ |---|---|
68
+ | `search_symbols` | Fuzzy search across all symbols (FTS5, BM25-ranked) |
69
+ | `search_files` | Find files by name, path, or language |
70
+ | `search_texts` | Full-text search on comments, docstrings, strings |
71
+ | `get_file_symbols` | List all symbols in a file |
72
+ | `get_symbol_children` | Get children of a class/module |
73
+ | `get_imports` | List imports for a file |
74
+
75
+ ## Project discovery
76
+
77
+ Launch `codeix` from any directory. It walks downward and treats every directory containing `.git/` as a separate project — each gets its own `.codeindex/`.
78
+
79
+ Works uniformly for single repos, monorepos, sibling repos, and git submodules. No config needed.
80
+
81
+ ## Languages
82
+
83
+ Tree-sitter grammars, feature-gated at compile time:
84
+
85
+ | Language | Feature flag | Default | Extensions |
86
+ |---|---|---|---|
87
+ | Python | `lang-python` | yes | `.py` `.pyi` `.pyw` |
88
+ | Rust | `lang-rust` | yes | `.rs` |
89
+ | JavaScript | `lang-javascript` | yes | `.js` `.mjs` `.cjs` `.jsx` |
90
+ | TypeScript | `lang-typescript` | yes | `.ts` `.mts` `.cts` `.tsx` |
91
+ | Go | `lang-go` | yes | `.go` |
92
+ | Java | `lang-java` | yes | `.java` |
93
+ | C | `lang-c` | yes | `.c` `.h` |
94
+ | C++ | `lang-cpp` | yes | `.cpp` `.cc` `.cxx` `.hpp` `.hxx` |
95
+ | Ruby | `lang-ruby` | yes | `.rb` `.rake` `.gemspec` |
96
+ | C# | `lang-csharp` | yes | `.cs` |
97
+
98
+ ### Embedded scripts
99
+
100
+ HTML, Vue, Svelte, and Astro files are preprocessed to extract embedded `<script>` blocks, which are then parsed with the JavaScript or TypeScript grammar:
101
+
102
+ | Format | Extensions | Script detection |
103
+ |---|---|---|
104
+ | HTML | `.html` `.htm` | `<script>` tags, with optional `lang="ts"` |
105
+ | Vue | `.vue` | `<script>` and `<script setup>`, with optional `lang="ts"` |
106
+ | Svelte | `.svelte` | `<script>`, with optional `lang="ts"` |
107
+ | Astro | `.astro` | `---` frontmatter (always TypeScript) + optional `<script>` tags |
108
+
109
+ Line numbers in the index point to the original file, not the extracted script block.
110
+
111
+ ## Install
112
+
113
+ ```sh
114
+ # npm / npx — run without installing
115
+ npx codeix
116
+
117
+ # pip / uvx — run without installing
118
+ uvx codeix
119
+
120
+ # Rust
121
+ cargo install codeix
122
+
123
+ # Homebrew
124
+ brew install codeix
125
+
126
+ # Or build from source
127
+ git clone https://github.com/montanetech/codeix.git
128
+ cd codeix
129
+ cargo build --release
130
+ ```
131
+
132
+ All channels install the same single binary. No runtime dependencies.
133
+
134
+ ## Usage
135
+
136
+ ```sh
137
+ # Build the index for the current project
138
+ codeix build
139
+
140
+ # Build from a specific directory (discovers all git repos below)
141
+ codeix build ~/projects
142
+
143
+ # Start MCP server (default command, watches for changes)
144
+ codeix
145
+
146
+ # Or explicitly
147
+ codeix serve
148
+ codeix serve --no-watch
149
+ ```
150
+
151
+ ### MCP client configuration
152
+
153
+ Add to your MCP client config (e.g. Claude Desktop, Cursor):
154
+
155
+ ```json
156
+ {
157
+ "mcpServers": {
158
+ "codeix": {
159
+ "command": "codeix"
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ ## Design principles
166
+
167
+ - **Local only** — no network, no API keys, works offline and air-gapped
168
+ - **Deterministic** — same source always produces the same index (clean diffs)
169
+ - **Composable** — dependency indexes are auto-discovered and mounted at query time
170
+ - **Minimal surface** — 6 query tools, zero management plumbing
171
+
172
+ ## Architecture
173
+
174
+ See [`docs/architecture.md`](docs/architecture.md) for the full set of architecture decision records.
175
+
176
+ ## License
177
+
178
+ MIT OR Apache-2.0
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "codeix",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Portable, composable code index — build with tree-sitter, query via MCP",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/montanetech/codeix"
8
+ "url": "git+https://github.com/montanetech/codeix.git"
9
9
  },
10
10
  "homepage": "https://github.com/montanetech/codeix",
11
11
  "bin": {
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "install.js",
31
31
  "run.js",
32
- "bin/"
32
+ "bin/",
33
+ "README.md"
33
34
  ]
34
35
  }