@octocodeai/octocode-engine 16.6.0 β 16.6.2
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 +95 -195
- package/dist/lsp/client.d.ts +1 -0
- package/dist/lsp/client.js +10 -0
- package/dist/lsp/config.d.ts +29 -1
- package/dist/lsp/config.js +156 -1
- package/dist/lsp/ideContext.d.ts +18 -0
- package/dist/lsp/ideContext.js +29 -0
- package/dist/lsp/index.d.ts +8 -3
- package/dist/lsp/index.js +7 -2
- package/dist/lsp/manager.d.ts +11 -0
- package/dist/lsp/manager.js +47 -22
- package/dist/lsp/platform.d.ts +20 -0
- package/dist/lsp/platform.js +64 -0
- package/dist/lsp/serverDiscovery.d.ts +63 -0
- package/dist/lsp/serverDiscovery.js +226 -0
- package/dist/lsp/serverManifest.d.ts +70 -0
- package/dist/lsp/serverManifest.js +78 -0
- package/dist/lsp/serverManifestData.d.ts +2 -0
- package/dist/lsp/serverManifestData.js +33 -0
- package/dist/lsp/serverProvisioner.d.ts +19 -0
- package/dist/lsp/serverProvisioner.js +253 -0
- package/dist/lsp/types.d.ts +7 -0
- package/dist/security/commandValidator.js +10 -10
- package/dist/security/discoveryFilter.js +7 -0
- package/dist/security/filePatterns.js +6 -0
- package/dist/security/ignoredPathFilter.js +5 -0
- package/dist/security/mask.js +5 -22
- package/dist/security/maskUtils.d.ts +6 -0
- package/dist/security/maskUtils.js +22 -0
- package/dist/security/native.js +5 -22
- package/dist/security/pathPatterns.js +5 -0
- package/dist/security/pathValidator.js +21 -18
- package/dist/security/withSecurityValidation.js +3 -0
- package/package.json +49 -8
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ Run it as a **CLI** or an **MCP server**. A **Rust engine** keeps every call fas
|
|
|
20
20
|
|
|
21
21
|
## Table of Contents
|
|
22
22
|
|
|
23
|
+
- [Quick Start](#quick-start)
|
|
23
24
|
- [Why Octocode](#why-octocode)
|
|
24
25
|
- [What You Can Do](#what-you-can-do)
|
|
25
26
|
- [Tools](#tools)
|
|
@@ -35,6 +36,50 @@ Run it as a **CLI** or an **MCP server**. A **Rust engine** keeps every call fas
|
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
**1. Install the Octocode CLI**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g octocode
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**2. Authenticate with GitHub** β optional, but unlocks private repositories and higher API rate limits:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
octocode auth login
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**3. Choose your interface.** The same engine and 14 tools run identically either way.
|
|
54
|
+
|
|
55
|
+
**π₯οΈ CLI** β research straight from your terminal:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
octocode
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**π€ MCP** β add Octocode to your AI assistant:
|
|
62
|
+
|
|
63
|
+
- **Cursor / VS Code** β one-click install:
|
|
64
|
+
|
|
65
|
+
[<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAb2N0b2NvZGVhaS9tY3BAbGF0ZXN0Il19) [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522octocode%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540octocodeai%252Fmcp%2540latest%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522octocode%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540octocodeai%252Fmcp%2540latest%255D%257D)
|
|
66
|
+
|
|
67
|
+
- **Claude Code:**
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
claude mcp add-json octocode --scope user '{"command":"npx","args":["@octocodeai/mcp@latest"]}'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- **Any other client** β interactive installer:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
octocode install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
β‘οΈ Learn more at **[octocode.ai](https://octocode.ai)**.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
38
83
|
## Why Octocode
|
|
39
84
|
|
|
40
85
|
Agents write better code from evidence than from assumptions. Octocode turns *guess-driven* work into **research-driven** work. Before an agent changes, reviews, or explains code, it gathers real evidence from your local workspace **and** from GitHub repositories, pull requests, and npm packages, then hands it back as compact, citable context. *Code is truth; context is the map.*
|
|
@@ -62,78 +107,13 @@ Octocode is useful whenever the next coding step depends on finding and proving
|
|
|
62
107
|
| **Binary or archive inspection** | Inspect archives, compressed streams, native binaries, and strings without leaving the research flow. |
|
|
63
108
|
| **Agent workflows** | Expose the same engine through MCP, CLI, OQL, and Agent Skills so assistants and humans use one evidence model. |
|
|
64
109
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Add Octocode to an AI assistant with MCP, or run the same tools directly from
|
|
68
|
-
your terminal with the CLI.
|
|
69
|
-
|
|
70
|
-
**MCP fast install:**
|
|
71
|
-
|
|
72
|
-
[<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJvY3RvY29kZS1tY3BAbGF0ZXN0Il19) [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522octocode%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522octocode-mcp%2540latest%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522octocode%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522octocode-mcp%2540latest%255D%257D)
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# Interactive installer for Cursor, Claude Code, Codex, VS Code, and more
|
|
76
|
-
npx octocode install
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**CLI fast install:**
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npx octocode
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Authenticate GitHub when you want private repositories or higher API limits:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npx octocode login
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Benchmarks
|
|
92
|
-
|
|
93
|
-
Latest benchmark output:
|
|
94
|
-
[packages/octocode-benchmark/output](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/output/).
|
|
95
|
-
|
|
96
|
-
#### ast-grep Structural Comparison
|
|
97
|
-
|
|
98
|
-
Bars show relative throughput. Higher is better; lower `ms` is better.
|
|
99
|
-
|
|
100
|
-
What we tested: ast-grep CLI and Octocode structural grep on the same real
|
|
101
|
-
repository files, using the same broad AST node-kind searches
|
|
102
|
-
(`call_expression`, `call`, `method_invocation`). The goal was to check
|
|
103
|
-
structural AST grep compatibility by match count, then measure where time is
|
|
104
|
-
spent across Octocode's raw matcher, agent tool path, and public CLI.
|
|
105
|
-
|
|
106
|
-
This benchmark does not test text grep, LSP navigation, rewriting, or the full
|
|
107
|
-
ast-grep rule language. Those are separate capabilities.
|
|
108
|
-
|
|
109
|
-
```text
|
|
110
|
-
Octocode raw native ββββββββββββββββββββ 17.1 ms median β 2.0x faster β 6/6 matched
|
|
111
|
-
ast-grep CLI ββββββββββββββββββββ 34.6 ms median β baseline β 6/6 matched
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
`Octocode raw native` means the direct Rust/NAPI `structuralSearchFiles`
|
|
115
|
-
matcher: parse and match only, with no tool validation, sanitizer, pagination,
|
|
116
|
-
JSON shaping, or Node CLI startup. The agent-facing `localSearchCode` and public
|
|
117
|
-
`octocode search --pattern/--rule` paths are intentionally slower because they include those safety
|
|
118
|
-
and DX layers.
|
|
119
|
-
|
|
120
|
-
What was checked: we took ast-grep's benchmark scenario repo list, picked one
|
|
121
|
-
deterministic file from each supported repo, asked both tools to find the same
|
|
122
|
-
AST node kind in that file, verified identical match counts, then timed the
|
|
123
|
-
median run.
|
|
124
|
-
|
|
125
|
-
Benchmark files:
|
|
126
|
-
[runner](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/ast-grep/compare-upstream-scenarios.mjs) Β·
|
|
127
|
-
[scenario manifest](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/ast-grep/upstream-outline-scenarios.json) Β·
|
|
128
|
-
[latest output](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/output/comparison.md) Β·
|
|
129
|
-
[unified CLI/tool/OQL eval](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/octocode/README.md) Β·
|
|
130
|
-
[agent runbook](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/recipes/agent-benchmark-runbook.md)
|
|
110
|
+
See [Quick Start](#quick-start) to install in your terminal or AI assistant.
|
|
131
111
|
|
|
132
112
|
---
|
|
133
113
|
|
|
134
114
|
## Tools
|
|
135
115
|
|
|
136
|
-
Octocode ships **14 research tools**; the same implementations run identically over [MCP](#mcp) and the [CLI](#cli). `ghCloneRepo` is opt-in for MCP (`ENABLE_CLONE=true`) and enabled by default for CLI
|
|
116
|
+
Octocode ships **14 research tools**; the same implementations run identically over [MCP](#mcp) and the [CLI](#cli). Local tools are enabled by default; `ENABLE_LOCAL=false` disables them. `ghCloneRepo` is opt-in for MCP (`ENABLE_CLONE=true`) and enabled by default for CLI. All flags: [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md).
|
|
137
117
|
|
|
138
118
|
**Token knobs.** `concise:true` returns path/title-only lists. `minify` controls file read density: `symbols` = skeleton with line numbers, `standard` = comments/blanks stripped (default), `none` = exact bytes.
|
|
139
119
|
|
|
@@ -176,12 +156,7 @@ Octocode ships **14 research tools**; the same implementations run identically o
|
|
|
176
156
|
|------|--------------|
|
|
177
157
|
| `oqlSearch` | Runs typed OQL queries across code, content, structure, files, semantics, repositories, packages, pull requests, commits, artifacts, diff, research, graph, and materialization targets. |
|
|
178
158
|
|
|
179
|
-
|
|
180
|
-
- [GitHub Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/GITHUB_TOOLS.md)
|
|
181
|
-
- [Local Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LOCAL_TOOLS.md)
|
|
182
|
-
- [Binary Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/BINARY_TOOLS.md)
|
|
183
|
-
- [LSP Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LSP_TOOLS.md)
|
|
184
|
-
- [Tool Behavior Guide](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/TOOL_BEHAVIOR.md)
|
|
159
|
+
Full schemas, fields, and examples for every tool live in [`docs/mcp/tools`](https://github.com/bgauryy/octocode/tree/main/docs/mcp/tools) (linked under [Documentation](#documentation)).
|
|
185
160
|
|
|
186
161
|
---
|
|
187
162
|
|
|
@@ -189,22 +164,7 @@ Octocode ships **14 research tools**; the same implementations run identically o
|
|
|
189
164
|
|
|
190
165
|
The MCP server exposes the Octocode tool catalog directly to your AI assistant over stdio. Install once; the assistant calls tools automatically.
|
|
191
166
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
**Fast install:**
|
|
195
|
-
|
|
196
|
-
[<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJvY3RvY29kZS1tY3BAbGF0ZXN0Il19) [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522octocode%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522octocode-mcp%2540latest%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522octocode%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522octocode-mcp%2540latest%255D%257D)
|
|
197
|
-
|
|
198
|
-
**Or use the installer (detects your installed clients):**
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# Interactive: detects your installed clients
|
|
202
|
-
npx octocode install
|
|
203
|
-
|
|
204
|
-
# Non-interactive
|
|
205
|
-
octocode install --ide cursor
|
|
206
|
-
octocode install --ide claude-code
|
|
207
|
-
```
|
|
167
|
+
**Install:** see [Quick Start](#quick-start) for one-click badges, the `claude mcp add-json` command, or the interactive `octocode install` (non-interactive: `octocode install --ide cursor|claude-code|β¦`).
|
|
208
168
|
|
|
209
169
|
https://github.com/user-attachments/assets/de8d14c0-2ead-46ed-895e-09144c9b5071
|
|
210
170
|
|
|
@@ -217,66 +177,48 @@ Add to your MCP client config file:
|
|
|
217
177
|
"mcpServers": {
|
|
218
178
|
"octocode": {
|
|
219
179
|
"command": "npx",
|
|
220
|
-
"args": ["
|
|
180
|
+
"args": ["@octocodeai/mcp@latest"]
|
|
221
181
|
}
|
|
222
182
|
}
|
|
223
183
|
}
|
|
224
184
|
```
|
|
225
185
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
### Configuration
|
|
229
|
-
|
|
230
|
-
Set tokens and options as `env` entries here, or machine-wide in `.octocoderc`. See [Configuration](#configuration) for every setting, the home-folder layout, and precedence.
|
|
186
|
+
Add a GitHub token and options under `env` β see [Authentication](#authentication-methods) and [Configuration](#configuration).
|
|
231
187
|
|
|
232
188
|
---
|
|
233
189
|
|
|
234
190
|
## CLI
|
|
235
191
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
### Install
|
|
192
|
+
Same research engine, no MCP client needed. Local paths route to local tools; `owner/repo[/path]` routes to GitHub.
|
|
239
193
|
|
|
240
194
|
```bash
|
|
241
|
-
|
|
195
|
+
octocode auth login # authenticate once
|
|
196
|
+
octocode status # verify setup
|
|
197
|
+
octocode --help # full usage
|
|
242
198
|
```
|
|
243
199
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
200
|
+
### Commands
|
|
201
|
+
|
|
202
|
+
#### Search
|
|
203
|
+
|
|
204
|
+
| Command | What it does |
|
|
205
|
+
|---------|--------------|
|
|
206
|
+
| `octocode search <term> <path\|owner/repo>` | Text, regex, AST structural (`--pattern`), or full OQL (`--query`) |
|
|
207
|
+
| `octocode search <path\|owner/repo> --tree` | Browse directory or repository structure |
|
|
208
|
+
| `octocode search <file>` | Read file content; `--content-view exact\|compact\|symbols` or `--raw` |
|
|
209
|
+
| `octocode search <file> --symbols` | Symbol outline for a file or source tree |
|
|
210
|
+
| `octocode search --query <oql-json>` | Full OQL across all target types (code, commits, PRs, packages, artifacts β¦) |
|
|
248
211
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
| `octocode search <owner/repo[#N]\|PR-URL> --target pullRequests` | Search or deep-read pull requests |
|
|
260
|
-
| `octocode search <owner/repo[/path]> --target commits` | Inspect commit history for a repo, directory, or file |
|
|
261
|
-
| `octocode search <keywords...> --target repositories` | Discover GitHub repositories |
|
|
262
|
-
| `octocode search <package\|keywords> --target packages` | Search npm and hand off to source repositories |
|
|
263
|
-
| `octocode search <file> --op <type> [--symbol <name>] [--line <n>]` | Trace `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `typeDefinition`, `implementation`, `workspaceSymbol`, `supertypes`, `subtypes`, and `diagnostic`; `documentSymbols` outlines a file directly |
|
|
264
|
-
| `octocode search <file> --target artifacts` | Inspect archives, compressed files, and native binaries with `--inspect`, `--list`, `--extract`, `--decompress`, or `--strings` |
|
|
265
|
-
| `octocode unzip <archive>` | Unpack an archive to `<octocode-home>/tmp/unzip/<name>-<timestamp>/`, then use local `search --tree`, `search`, and `search <file>` |
|
|
266
|
-
| `octocode clone <owner/repo[/path][@branch]>` | Clone a repo or subtree to `<octocode-home>/tmp/clone/` for local/LSP analysis (`ENABLE_CLONE=true`) |
|
|
267
|
-
| `octocode cache fetch <owner/repo[@ref]> [path] [--depth file\|tree\|clone]` | Materialize remote content locally and return the absolute `localPath`; reuses the cache or force-refreshes with `--force-refresh` |
|
|
268
|
-
| `octocode cache status` | Show size and entry count of clone/tree/binary/unzip cache buckets |
|
|
269
|
-
| `octocode cache clear [--clone\|--repos\|--tree\|--binary\|--unzip\|--all]` | Remove cached materialization data |
|
|
270
|
-
| `octocode search --query <oql-json>` | Route typed OQL across code, content, structure, files, semantics, repositories, packages, pull requests, commits, artifacts, diff, research, graph, and materialization targets |
|
|
271
|
-
| `octocode tools` | List tools, read schemas, or run any MCP tool directly from the terminal |
|
|
272
|
-
| `octocode context` | Print agent-facing protocol, system prompt, tool descriptions, and schemas |
|
|
273
|
-
| `octocode skill --add <github-folder> --platform <common\|cursor\|claude\|codex\|all>` | Install one GitHub Agent Skill folder into deterministic agent destinations; full flags, no prompt |
|
|
274
|
-
| `octocode install` | Configure Octocode in MCP clients |
|
|
275
|
-
| `octocode auth` | Manage GitHub authentication with `login`, `logout`, `refresh`, or read-only `status` |
|
|
276
|
-
| `octocode login` / `octocode logout` | Open the interactive auth picker or clear stored GitHub credentials |
|
|
277
|
-
| `octocode status` | Check token presence, auth identity, MCP installs, sync state, and cache paths |
|
|
278
|
-
|
|
279
|
-
Full command syntax, flags, examples, and exit codes live in the [CLI Reference](https://github.com/bgauryy/octocode/blob/main/docs/cli/REFERENCE.md).
|
|
212
|
+
#### More commands
|
|
213
|
+
|
|
214
|
+
- **GitHub & npm** β `search <β¦> --target repositories|packages|pullRequests|commits|artifacts`
|
|
215
|
+
- **LSP** β `search <file> --op definition|references|callers|callees|hover|diagnostic|callHierarchy` (`--symbol`, `--line` to narrow)
|
|
216
|
+
- **Cache & clone** β `clone`, `unzip`, `cache fetch|status|clear`
|
|
217
|
+
- **Skills** β `skill --list | --name <skill> | --add <github-folder>`
|
|
218
|
+
- **Language servers** β `lsp-server list|install|status|uninstall`
|
|
219
|
+
- **Setup & introspection** β `install`, `auth`, `status`, `tools`, `context`
|
|
220
|
+
|
|
221
|
+
Full syntax, flags, and exit codes: [CLI Reference](https://github.com/bgauryy/octocode/blob/main/docs/cli/REFERENCE.md)
|
|
280
222
|
|
|
281
223
|
---
|
|
282
224
|
|
|
@@ -300,25 +242,7 @@ environment variables > <octocode-home>/.octocoderc > built-in defaults
|
|
|
300
242
|
| Linux | `${XDG_CONFIG_HOME:-~/.config}/.octocode` |
|
|
301
243
|
| Windows | `%APPDATA%\.octocode` |
|
|
302
244
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
```json
|
|
306
|
-
{
|
|
307
|
-
"mcpServers": {
|
|
308
|
-
"octocode": {
|
|
309
|
-
"command": "npx",
|
|
310
|
-
"args": ["octocode-mcp@latest"],
|
|
311
|
-
"env": {
|
|
312
|
-
"GITHUB_TOKEN": "ghp_xxxxxxxx",
|
|
313
|
-
"ENABLE_LOCAL": "true",
|
|
314
|
-
"ENABLE_CLONE": "false"
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
**Set globally** for both the CLI and MCP in `<octocode-home>/.octocoderc` (JSON, comments and trailing commas tolerated; never put tokens here). See the ready-to-copy [example below](#example-octocoderc).
|
|
245
|
+
Set values as MCP `env` entries (per client; these win over `.octocoderc`) or globally in `<octocode-home>/.octocoderc` (JSON with comments). **Tokens never go in `.octocoderc`** β use `env` or `octocode auth login`.
|
|
322
246
|
|
|
323
247
|
### Common settings
|
|
324
248
|
|
|
@@ -328,7 +252,7 @@ The **Scope** column shows where a setting applies: `Both`, or `MCP` (the CLI ig
|
|
|
328
252
|
|---------|-------------------|---------|-------|--------------|
|
|
329
253
|
| `OCTOCODE_TOKEN` / `GH_TOKEN` / `GITHUB_TOKEN` | env only | unset | Both | GitHub token, in priority order. Tokens stay in env, never in `.octocoderc`. |
|
|
330
254
|
| `GITHUB_API_URL` | `github.apiUrl` | `https://api.github.com` | Both | API endpoint; use `/api/v3` for GitHub Enterprise. |
|
|
331
|
-
| `ENABLE_LOCAL` | `local.enabled` |
|
|
255
|
+
| `ENABLE_LOCAL` | `local.enabled` | `true` | Both | Turns local filesystem + LSP tools on/off; set `false` to disable. |
|
|
332
256
|
| `ENABLE_CLONE` | `local.enableClone` | CLI `true`, MCP `false` | Both | `ghCloneRepo` and directory fetch. Default differs by surface; set `false` to disable in either. |
|
|
333
257
|
| `WORKSPACE_ROOT` | `local.workspaceRoot` | `cwd` | Both | Absolute root for resolving relative local paths. |
|
|
334
258
|
| `ALLOWED_PATHS` | `local.allowedPaths` | `[]` | Both | Extra path allowlist for local access; empty means home directory only after validation. |
|
|
@@ -337,43 +261,21 @@ The **Scope** column shows where a setting applies: `Both`, or `MCP` (the CLI ig
|
|
|
337
261
|
| `MAX_RETRIES` | `network.maxRetries` | `3` | Both | Retry attempts (clamped `0..10`). |
|
|
338
262
|
| `OCTOCODE_OUTPUT_FORMAT` | `output.format` | `yaml` | Both | Response format: `yaml` or `json`. |
|
|
339
263
|
|
|
340
|
-
> **Local
|
|
341
|
-
|
|
342
|
-
### Example `.octocoderc`
|
|
343
|
-
|
|
344
|
-
Drop this at `<octocode-home>/.octocoderc` for machine-wide defaults shared by the CLI and the MCP server. Every field is optional; keep only what you want to change. **Tokens never go here** (use env or `octocode login`).
|
|
345
|
-
|
|
346
|
-
```jsonc
|
|
347
|
-
{
|
|
348
|
-
// GitHub Enterprise users: point at your API endpoint.
|
|
349
|
-
"github": { "apiUrl": "https://api.github.com" },
|
|
350
|
-
|
|
351
|
-
"local": {
|
|
352
|
-
"enabled": true, // overrides the surface default for CLI and MCP
|
|
353
|
-
"enableClone": false, // false disables ghCloneRepo for CLI and MCP
|
|
354
|
-
"workspaceRoot": "~/code", // base for relative local paths (absolute or ~)
|
|
355
|
-
"allowedPaths": [] // extra dirs the local tools may read
|
|
356
|
-
},
|
|
264
|
+
> **Local defaults on; clone differs by surface.** Both CLI and MCP default local tools on; set `ENABLE_LOCAL=false` to disable them. The **CLI** defaults clone on, while the **MCP server** requires `ENABLE_CLONE=true`.
|
|
357
265
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
"output": { "format": "yaml" } // "yaml" or "json"
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Per-project overrides and custom LSP servers live in a workspace `.octocode/` folder (for example `.octocode/lsp-servers.json`). For every variable, the full `.octocoderc` schema, clone-cache tuning, GitHub Enterprise setup, local-state paths, and precedence details, see the [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md).
|
|
266
|
+
Per-project overrides and custom LSP servers live in a workspace `.octocode/` folder. For the full `.octocoderc` schema, a ready-to-copy example, clone-cache tuning, GitHub Enterprise setup, and precedence details, see the [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md).
|
|
365
267
|
|
|
366
268
|
---
|
|
367
269
|
|
|
368
270
|
## Authentication Methods
|
|
369
271
|
|
|
370
|
-
GitHub-backed tools require authentication. Any one method is enough. Full details: [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/
|
|
272
|
+
GitHub-backed tools require authentication. Any one method is enough. Full details: [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/AUTHENTICATION.md).
|
|
371
273
|
|
|
372
274
|
### Option 1: Octocode CLI (Recommended)
|
|
373
275
|
|
|
374
276
|
```bash
|
|
375
|
-
|
|
376
|
-
|
|
277
|
+
octocode auth login
|
|
278
|
+
octocode status # verify the active token source
|
|
377
279
|
```
|
|
378
280
|
|
|
379
281
|
Interactive login lets you choose Octocode browser OAuth or `gh auth login`. Octocode OAuth credentials are stored encrypted on disk.
|
|
@@ -412,7 +314,7 @@ Create a token at [github.com/settings/tokens](https://github.com/settings/token
|
|
|
412
314
|
- **Schema validation** runs before any tool executes; untrusted input size and shape are bounded.
|
|
413
315
|
- **Credentials.** GitHub auth via env tokens, AES-256-GCM-encrypted on-disk OAuth, or the `gh` CLI; tokens are never logged.
|
|
414
316
|
|
|
415
|
-
**Full security model, pipeline, and threat coverage: [SECURITY.md](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md).** Related: [Authentication](https://github.com/bgauryy/octocode/blob/main/docs/
|
|
317
|
+
**Full security model, pipeline, and threat coverage: [SECURITY.md](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md).** Related: [Authentication](https://github.com/bgauryy/octocode/blob/main/docs/AUTHENTICATION.md) Β· [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md) Β· [Credentials](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CREDENTIALS.md)
|
|
416
318
|
|
|
417
319
|
---
|
|
418
320
|
|
|
@@ -422,12 +324,12 @@ Four code-intelligence axes; three are native to the Rust engine and need no ext
|
|
|
422
324
|
|
|
423
325
|
| Axis | What it does | How to use it |
|
|
424
326
|
|------|--------------|---------------|
|
|
425
|
-
| **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across
|
|
327
|
+
| **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 60+ extensions. | `localSearchCode mode:"structural"` Β· CLI `search --pattern`/`--rule` |
|
|
426
328
|
| **Signature outline** | Body-free skeleton with line numbers from real tree-sitter parsing, no heuristics. An anti-growth guard returns the real file when a skeleton wouldn't be smaller. | `minify:"symbols"` Β· CLI `search <file> --content-view symbols` |
|
|
427
329
|
| **Content minification** | Comment/whitespace stripping for 70+ languages and config formats; HTML/Vue/Svelte also minify embedded `<style>`/`<script>`. | `minify:"standard"` (default) |
|
|
428
330
|
| **LSP navigation** | definition, references, callers/callees, callHierarchy, hover, typeDefinition, implementation, documentSymbols, via an installed language server; JS/TS also have a native, no-server path. | `lspGetSemantics` Β· CLI `search --op` / `search --symbols` |
|
|
429
331
|
|
|
430
|
-
π **Full support matrix:** every extension with its exact AST, signature, LSP, and minify capability, machine-generated from the shipped binary, lives in **[
|
|
332
|
+
π **Full support matrix:** every extension with its exact AST, signature, LSP, and minify capability, machine-generated from the shipped binary, lives in the **[Full format support matrix](https://github.com/bgauryy/octocode/blob/main/docs/LSP_SERVER_LIFECYCLE.md#full-format-support-matrix)** (151 extensions: 61 AST, 47 signature, 32 LSP, 90 minify-only). Regenerate or verify with `yarn workspace @octocodeai/octocode-benchmark matrix:check`.
|
|
431
333
|
|
|
432
334
|
---
|
|
433
335
|
|
|
@@ -438,17 +340,15 @@ Four code-intelligence axes; three are native to the Rust engine and need no ext
|
|
|
438
340
|
|
|
439
341
|
These are the skills the Octocode team itself uses to build Octocode. **9 skills** live under [`skills/`](https://github.com/bgauryy/octocode/tree/main/skills); the table mirrors the [Skills Index](https://github.com/bgauryy/octocode/blob/main/skills/README.md). β **[Engineer](https://www.skills.sh/bgauryy/octocode-mcp/octocode-engineer)** is the recommended starting skill.
|
|
440
342
|
|
|
441
|
-
Install any GitHub skill folder directly from the Octocode CLI:
|
|
442
|
-
|
|
443
343
|
```bash
|
|
444
|
-
#
|
|
445
|
-
npx octocode skill --
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
npx octocode skill --add
|
|
344
|
+
npx octocode skill --list # browse available skills
|
|
345
|
+
npx octocode skill --name octocode-engineer # install to ~/.agents/skills (default)
|
|
346
|
+
npx octocode skill --name octocode-engineer --platform claude # Claude Code + Claude Desktop
|
|
347
|
+
npx octocode skill --name octocode-engineer --all --dry-run # preview before installing everywhere
|
|
348
|
+
npx octocode skill --add owner/repo/skills/my-skill # any GitHub folder
|
|
449
349
|
```
|
|
450
350
|
|
|
451
|
-
Platforms: `common` (`~/.agents/skills`), `cursor`, `claude
|
|
351
|
+
Platforms: `common` (default, `~/.agents/skills`), `cursor`, `claude`, `codex`, `opencode`, `all` Β· Modes: `copy` (default), `symlink`, `hybrid` Β· [Skills Guide](https://github.com/bgauryy/octocode/blob/main/docs/SKILLS_GUIDE.md)
|
|
452
352
|
|
|
453
353
|
| Skill | Directory | Use it when |
|
|
454
354
|
|-------|-----------|-------------|
|
|
@@ -518,7 +418,7 @@ Website: **[octocode.ai](https://octocode.ai)** Β· Product docs: **[github.com/b
|
|
|
518
418
|
- [`packages/octocode-benchmark/`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark): benchmark methodology, support matrix, unified eval, recipes, output schema, and run artifacts
|
|
519
419
|
|
|
520
420
|
**Setup**
|
|
521
|
-
- [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/
|
|
421
|
+
- [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/AUTHENTICATION.md)
|
|
522
422
|
- [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md)
|
|
523
423
|
- [Using octocode-mcp with Pi](https://github.com/bgauryy/octocode/blob/main/docs/PI/PI_SETUP_GUIDE.md)
|
|
524
424
|
|
|
@@ -534,7 +434,7 @@ Website: **[octocode.ai](https://octocode.ai)** Β· Product docs: **[github.com/b
|
|
|
534
434
|
- [Benchmark Summary](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/BENCHMARK.md)
|
|
535
435
|
- [Unified CLI/Tool/OQL Eval](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/octocode/README.md)
|
|
536
436
|
- [Benchmark Runbook](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/recipes/agent-benchmark-runbook.md)
|
|
537
|
-
- [Support Matrix](https://github.com/bgauryy/octocode/blob/main/
|
|
437
|
+
- [Support Matrix](https://github.com/bgauryy/octocode/blob/main/docs/LSP_SERVER_LIFECYCLE.md#full-format-support-matrix)
|
|
538
438
|
|
|
539
439
|
**Security, CLI & Skills**
|
|
540
440
|
- [Security Model](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md)
|
|
@@ -552,7 +452,7 @@ Website: **[octocode.ai](https://octocode.ai)** Β· Product docs: **[github.com/b
|
|
|
552
452
|
- **Skill route β recommended, leanest.** Drop the [`octocode-engineer`](https://www.skills.sh/bgauryy/octocode-mcp/octocode-engineer) skill into Pi's global skills dir. It drives the Octocode **CLI** directly β no MCP transport, minimal token overhead β and Pi auto-discovers it:
|
|
553
453
|
|
|
554
454
|
```bash
|
|
555
|
-
npx octocode skill --
|
|
455
|
+
npx octocode skill --name octocode-engineer
|
|
556
456
|
```
|
|
557
457
|
|
|
558
458
|
- **Adapter route β full tool surface.** Install [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) to expose all 14 Octocode MCP tools behind a single ~200-token proxy tool, so servers stay disconnected until a tool is actually called. Enable clone tools with `ENABLE_CLONE=true`.
|
package/dist/lsp/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CallHierarchyItem, CodeSnippet, ExactPosition, IncomingCall, LanguageServerConfig, OutgoingCall } from './types.js';
|
|
2
2
|
export declare class LSPClient {
|
|
3
3
|
private readonly nativeClient;
|
|
4
|
+
private readonly command;
|
|
4
5
|
private initialized;
|
|
5
6
|
constructor(config: LanguageServerConfig);
|
|
6
7
|
start(): Promise<void>;
|
package/dist/lsp/client.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
2
|
import { nativeBinding } from './native.js';
|
|
3
|
+
import { validateLSPServerPath } from './validation.js';
|
|
3
4
|
export class LSPClient {
|
|
4
5
|
nativeClient;
|
|
6
|
+
command;
|
|
5
7
|
initialized = false;
|
|
6
8
|
constructor(config) {
|
|
9
|
+
this.command = config.command;
|
|
7
10
|
this.nativeClient = new nativeBinding.NativeLspClient({
|
|
8
11
|
command: config.command,
|
|
9
12
|
args: config.args,
|
|
@@ -14,6 +17,13 @@ export class LSPClient {
|
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
async start() {
|
|
20
|
+
// Security gate: never spawn a command that isn't a real, executable,
|
|
21
|
+
// non-shell server binary β even one resolved from the managed download
|
|
22
|
+
// cache. This is the single chokepoint before the native process spawn.
|
|
23
|
+
const validation = validateLSPServerPath(this.command);
|
|
24
|
+
if (!validation.isValid) {
|
|
25
|
+
throw new Error(`Refusing to start language server: ${validation.error ?? `invalid server path '${this.command}'`}`);
|
|
26
|
+
}
|
|
17
27
|
await this.nativeClient.start();
|
|
18
28
|
this.initialized = true;
|
|
19
29
|
}
|
package/dist/lsp/config.d.ts
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
import type { LanguageServerConfig } from './types.js';
|
|
1
|
+
import type { LanguageServerConfig, LspServerSource } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Names of the servers octocode bundles (offline-ready, zero install). Single
|
|
4
|
+
* source for any "what's bundled" listing (e.g. the `lsp-server` CLI), derived
|
|
5
|
+
* from the maps above so it never drifts. pyright is the bundled Python server
|
|
6
|
+
* even though the native default command is `pylsp`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BUNDLED_SERVER_NAMES: readonly string[];
|
|
2
9
|
export declare function detectLanguageId(filePath: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the language-server config for a file, walking the resolution ladder
|
|
12
|
+
* behind a stable signature. The public contract is unchanged β callers still
|
|
13
|
+
* get a `LanguageServerConfig | null`; only the resolution behind it is richer.
|
|
14
|
+
*/
|
|
3
15
|
export declare function getLanguageServerForFile(filePath: string, workspaceRoot?: string): Promise<LanguageServerConfig | null>;
|
|
16
|
+
export interface ServerResolution {
|
|
17
|
+
config: LanguageServerConfig;
|
|
18
|
+
source: LspServerSource;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Full resolution including provenance, for status reporting. Order:
|
|
22
|
+
* L0/L1 explicit override + PATH (already applied natively in config.rs)
|
|
23
|
+
* L2 bundled JS server (npm dep, launched via current Node)
|
|
24
|
+
* L3 project-local / ecosystem (cargo/go/python/npm-global/mason/brewβ¦)
|
|
25
|
+
* L4 managed download cache (~/.octocode/lsp, if pre-provisioned)
|
|
26
|
+
* Returns `source: 'unavailable'` (config still populated) when nothing on the
|
|
27
|
+
* machine provides the server, so the caller can report honest guidance.
|
|
28
|
+
*/
|
|
29
|
+
/** Check whether a bare command name is available on the current process PATH. */
|
|
30
|
+
export declare function isCommandOnPath(command: string): boolean;
|
|
31
|
+
export declare function resolveServerForFile(filePath: string, workspaceRoot?: string): Promise<ServerResolution | null>;
|