@octocodeai/config 17.0.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 +21 -0
- package/README.md +466 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +263 -0
- package/dist/cli.js.map +7 -0
- package/dist/config/defaults.d.ts +16 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/resolver.d.ts +3 -0
- package/dist/config/resolver.d.ts.map +1 -0
- package/dist/config/resolverCache.d.ts +13 -0
- package/dist/config/resolverCache.d.ts.map +1 -0
- package/dist/config/resolverSections.d.ts +16 -0
- package/dist/config/resolverSections.d.ts.map +1 -0
- package/dist/config/runtimeSurface.d.ts +23 -0
- package/dist/config/runtimeSurface.d.ts.map +1 -0
- package/dist/config/types.d.ts +103 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/validator.d.ts +3 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/home.d.ts +2 -0
- package/dist/home.d.ts.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +814 -0
- package/dist/index.js.map +7 -0
- package/dist/tokens/envTokens.d.ts +24 -0
- package/dist/tokens/envTokens.d.ts.map +1 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/types.d.ts +6 -0
- package/dist/tokens/types.d.ts.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Guy Bary
|
|
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,466 @@
|
|
|
1
|
+
# Octocode - Agentic Research Platform
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://github.com/bgauryy/octocode/raw/main/packages/octocode-mcp/assets/logo_white.png" width="400px" alt="Octocode Logo">
|
|
5
|
+
|
|
6
|
+
[](https://github.com/modelcontextprotocol/servers)
|
|
7
|
+
[](https://deepwiki.com/bgauryy/octocode)
|
|
8
|
+
|
|
9
|
+
[](https://octocode.ai)
|
|
10
|
+
[](https://www.youtube.com/@Octocode-ai)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
**Evidence-first code research for AI agents and developers.**
|
|
15
|
+
|
|
16
|
+
Evidence from your **local workspace** and **external** sources (GitHub repos, PRs, npm). One toolset: ripgrep + AST search, trees, precise reads, and LSP — as a **CLI** or **MCP server**, backed by a **Rust engine** for fast, token-efficient results across single files or mega-repos.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Table of Contents
|
|
21
|
+
|
|
22
|
+
- [Quick Start](#quick-start)
|
|
23
|
+
- [Why Octocode](#why-octocode)
|
|
24
|
+
- [What You Can Do](#what-you-can-do)
|
|
25
|
+
- [Tools](#tools)
|
|
26
|
+
- [MCP](#mcp)
|
|
27
|
+
- [CLI](#cli)
|
|
28
|
+
- [Configuration](#configuration)
|
|
29
|
+
- [Authentication Methods](#authentication-methods)
|
|
30
|
+
- [Security](#security)
|
|
31
|
+
- [Language Support](#language-support)
|
|
32
|
+
- [Skills](#skills)
|
|
33
|
+
- [Architecture](#architecture)
|
|
34
|
+
- [Documentation](#documentation)
|
|
35
|
+
- [Troubleshooting](#troubleshooting)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
**1. Run the Octocode CLI with `npx`**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx octocode --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**2. Authenticate with GitHub** — optional, but unlocks private repositories and higher API rate limits:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx octocode auth login
|
|
51
|
+
npx octocode status # verify the active token source
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**3. Choose your interface.** The same engine and 12 tools run identically either way.
|
|
55
|
+
|
|
56
|
+
**🖥️ CLI** — research straight from your terminal:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx octocode
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**🤖 MCP** — one-click install:
|
|
63
|
+
|
|
64
|
+
- [<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwidHlwZSI6InN0ZGlvIiwiYXJncyI6WyJAb2N0b2NvZGVhaS9tY3BAbGF0ZXN0Il19)
|
|
65
|
+
- [<img src="https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white" alt="Install in VS Code">](https://insiders.vscode.dev/redirect/mcp/install?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22%40octocodeai%2Fmcp%40latest%22%5D%7D)
|
|
66
|
+
- [<img src="https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white" alt="Install in VS Code Insiders">](https://insiders.vscode.dev/redirect/mcp/install?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22%40octocodeai%2Fmcp%40latest%22%5D%7D&quality=insiders)
|
|
67
|
+
- [<img src="https://img.shields.io/badge/Windsurf-Install_Server-1a1a1a?style=flat-square&logoColor=white" alt="Install in Windsurf">](windsurf://mcp/install?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22%40octocodeai%2Fmcp%40latest%22%5D%7D)
|
|
68
|
+
- [<img src="https://kiro.dev/images/add-to-kiro.svg" alt="Install in Kiro">](https://kiro.dev/launch/mcp/add?name=octocode&config=%7B%22command%22%3A%22npx%22%2C%22type%22%3A%22stdio%22%2C%22args%22%3A%5B%22%40octocodeai%2Fmcp%40latest%22%5D%7D)
|
|
69
|
+
- [<img src="https://goose-docs.ai/img/extension-install-dark.svg" alt="Install in Goose">](https://goose-docs.ai/extension?cmd=npx&arg=%40octocodeai%2Fmcp%40latest&id=octocode&name=octocode&description=Evidence-first%20code%20research%20for%20AI%20agents)
|
|
70
|
+
- [<img src="https://files.lmstudio.ai/deeplink/mcp-install-light.svg" alt="Install in LM Studio">](https://lmstudio.ai/install-mcp?name=octocode&config=eyJjb21tYW5kIjoibnB4IiwidHlwZSI6InN0ZGlvIiwiYXJncyI6WyJAb2N0b2NvZGVhaS9tY3BAbGF0ZXN0Il19)
|
|
71
|
+
|
|
72
|
+
**Claude Code:**
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
claude mcp add-json octocode --scope user '{"command":"npx","type":"stdio","args":["@octocodeai/mcp@latest"]}'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Any other client:** `npx octocode install`
|
|
79
|
+
|
|
80
|
+
➡️ Learn more at **[octocode.ai](https://octocode.ai)**.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Why Octocode
|
|
85
|
+
|
|
86
|
+
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.*
|
|
87
|
+
|
|
88
|
+
Most tools cover one slice: searching the web, or grepping your repo. Octocode covers the **whole research flow, end to end**:
|
|
89
|
+
|
|
90
|
+
- **Built for scale.** In organizations with thousands of repositories and endless code, Octocode is the solution: spot a pattern in one repo, follow it through the pull request that introduced it, then trace the same shape across other repos and your own files without leaving the conversation. Clone any repo and study it locally, on any machine.
|
|
91
|
+
- **Smart GitHub workflows.** Parallel bulk queries and built-in **next-step hints** keep the agent on the cheapest path: search broadly, read narrowly, trace semantically. Each result points to the natural follow-up.
|
|
92
|
+
- **No GitHub required.** Even without GitHub, clone any repository locally and point Octocode's local tools (search, structural AST, LSP, content) at it for the same evidence-first research.
|
|
93
|
+
- **Reads the shape, not the noise.** Code is minified and skeletonized on the fly across 70+ languages, so an agent grasps a 100 KB file in a few hundred tokens instead of spending its context on boilerplate.
|
|
94
|
+
- **Fast and self-contained.** Search, parsing, semantic navigation, and redaction run in one prebuilt **Rust engine**: quick on a laptop or a mega-repo, with no extra toolchain to install.
|
|
95
|
+
- **Safe by default.** Every byte returned to the model is scanned and secrets redacted first (see [Security](#security)).
|
|
96
|
+
|
|
97
|
+
## What You Can Do
|
|
98
|
+
|
|
99
|
+
Octocode is useful whenever the next coding step depends on finding and proving context, not guessing it.
|
|
100
|
+
|
|
101
|
+
| Need | Use Octocode to |
|
|
102
|
+
|------|-----------------|
|
|
103
|
+
| **Codebase questions** | Search local or GitHub code, read exact regions, browse trees, and carry file/line anchors into the answer. |
|
|
104
|
+
| **Implementation research** | Compare patterns across repositories, npm packages, pull requests, commits, and local files before changing code. |
|
|
105
|
+
| **Semantic navigation** | Resolve definitions, references, callers/callees, call hierarchy, hovers, symbols, diagnostics, and type relationships through LSP. |
|
|
106
|
+
| **Structural matching** | Run AST-shaped searches with patterns or YAML rules so comments and strings do not become false positives. |
|
|
107
|
+
| **Large-file context** | Minify, skeletonize, or paginate code so agents spend tokens on relevant structure instead of boilerplate. |
|
|
108
|
+
| **Agent workflows** | Same engine via MCP, CLI, OQL, and Agent Skills. |
|
|
109
|
+
|
|
110
|
+
See [Quick Start](#quick-start) to install in your terminal or AI assistant.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Tools
|
|
115
|
+
|
|
116
|
+
**12 always-on tools** (same on [MCP](#mcp) and [CLI](#cli)). Local tools on by default (`ENABLE_LOCAL=false` to disable). `ghCloneRepo` is MCP opt-in (`ENABLE_CLONE=true`), CLI on by default. Flags: [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
|
|
117
|
+
|
|
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.
|
|
119
|
+
|
|
120
|
+
### GitHub Tools
|
|
121
|
+
|
|
122
|
+
| Tool | What it does | Knob |
|
|
123
|
+
|------|--------------|------|
|
|
124
|
+
| `ghSearchCode` | Code and path search across GitHub by owner, repo, path, filename, extension, and match filters. Accepts 1 to 5 parallel queries. | `concise` |
|
|
125
|
+
| `ghGetFileContent` | Read a GitHub file or region: full file, line range, match slice, or paginated chars. | `minify` |
|
|
126
|
+
| `ghViewRepoStructure` | Browse a GitHub repository's directory tree before reading files. | |
|
|
127
|
+
| `ghSearchRepos` | Discover repositories by keywords, owner, topic, language, stars, forks, size, dates, license, visibility. | `concise` |
|
|
128
|
+
| `ghHistoryResearch` | Search PR history, or deep-read one PR: files, patches, comments, reviews, commits. | `concise` |
|
|
129
|
+
| `ghCloneRepo` | Clone a repo or sparse subtree into the local cache for local/LSP analysis. **Opt-in** (`ENABLE_CLONE=true`). | `sparsePath` |
|
|
130
|
+
|
|
131
|
+
### Local Tools
|
|
132
|
+
|
|
133
|
+
| Tool | What it does | Knob |
|
|
134
|
+
|------|--------------|------|
|
|
135
|
+
| `localSearchCode` | Local code/text search returning file and line anchors. `mode:"structural"` runs Octocode AST shape queries (`pattern` or `rule`). | `mode` |
|
|
136
|
+
| `localViewStructure` | Browse a local directory tree: depth, filters, pagination, metadata. | `concise` |
|
|
137
|
+
| `localFindFiles` | Find local files and directories by name, path, regex, extension, size, time, permissions, type. | |
|
|
138
|
+
| `localGetFileContent` | Read a local file or region: exact slice, match string, line range, or paginated chars. | `minify` |
|
|
139
|
+
|
|
140
|
+
### Package Search
|
|
141
|
+
|
|
142
|
+
| Tool | What it does | Knob |
|
|
143
|
+
|------|--------------|------|
|
|
144
|
+
| `npmSearch` | npm package lookup and keyword search; returns metadata and the source repository for GitHub handoff. | `concise` |
|
|
145
|
+
|
|
146
|
+
### LSP
|
|
147
|
+
|
|
148
|
+
| Tool | What it does |
|
|
149
|
+
|------|--------------|
|
|
150
|
+
| `lspGetSemantics` | Typed semantic navigation. Raw tools support `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `documentSymbols`, `typeDefinition`, `implementation`, `workspaceSymbol`, `supertypes`, `subtypes`, and `diagnostic`. The CLI uses `npx octocode search <file> --op <type>` for semantics and `npx octocode search <file> --symbols` for file or directory symbol outlines. Navigation runs through installed language servers (see the [LSP Tools Reference](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md#lsp-tools-reference)). |
|
|
151
|
+
|
|
152
|
+
### OQL Search
|
|
153
|
+
|
|
154
|
+
| Tool | What it does |
|
|
155
|
+
|------|--------------|
|
|
156
|
+
| `oqlSearch` | Runs typed OQL queries across code, content, structure, files, semantics, repositories, packages, pull requests, commits, diff, research, graph, and materialization targets. |
|
|
157
|
+
|
|
158
|
+
Full schemas, fields, and examples for every tool live in [`docs/OCTOCODE_TOOLS.md`](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md) (linked under [Documentation](#documentation)).
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## MCP
|
|
163
|
+
|
|
164
|
+
The MCP server exposes the Octocode tool catalog directly to your AI assistant over stdio.
|
|
165
|
+
|
|
166
|
+
https://github.com/user-attachments/assets/de8d14c0-2ead-46ed-895e-09144c9b5071
|
|
167
|
+
|
|
168
|
+
### Manual Configuration
|
|
169
|
+
|
|
170
|
+
Add to your MCP client config. Pick the package that matches the version you want:
|
|
171
|
+
|
|
172
|
+
**New Octocode (Rust-powered engine)** — use `@octocodeai/mcp`:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"octocode": {
|
|
177
|
+
"command": "npx",
|
|
178
|
+
"type": "stdio",
|
|
179
|
+
"args": [
|
|
180
|
+
"@octocodeai/mcp@latest"
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Classic octocode-mcp** — use `octocode-mcp`:
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"octocode": {
|
|
191
|
+
"command": "npx",
|
|
192
|
+
"type": "stdio",
|
|
193
|
+
"args": [
|
|
194
|
+
"octocode-mcp@latest"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Add a GitHub token and options under `env` — see [Authentication](#authentication-methods) and [Configuration](#configuration).
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## CLI
|
|
205
|
+
|
|
206
|
+
Same research engine, no MCP client needed. Local paths route to local tools; `owner/repo[/path]` routes to GitHub.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npx octocode auth login # authenticate once
|
|
210
|
+
npx octocode status # verify setup
|
|
211
|
+
npx octocode --help # full usage
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Commands
|
|
215
|
+
|
|
216
|
+
#### Search
|
|
217
|
+
|
|
218
|
+
| Command | What it does |
|
|
219
|
+
|---------|--------------|
|
|
220
|
+
| `npx octocode search <term> <path\|owner/repo>` | Text, regex, AST structural (`--pattern`), or full OQL (`--query`) |
|
|
221
|
+
| `npx octocode search <path\|owner/repo> --tree` | Browse directory or repository structure |
|
|
222
|
+
| `npx octocode search <file>` | Read file content; `--content-view exact\|compact\|symbols` or `--raw` |
|
|
223
|
+
| `npx octocode search <file> --symbols` | Symbol outline for a file or source tree |
|
|
224
|
+
| `npx octocode search --query <oql-json>` | Full OQL across all target types (code, commits, PRs, packages, …) |
|
|
225
|
+
|
|
226
|
+
#### More commands
|
|
227
|
+
|
|
228
|
+
- **GitHub & npm** — `npx octocode search <…> --target repositories|packages|pullRequests|commits|diff`
|
|
229
|
+
- **LSP** — `npx octocode search <file> --op definition|references|callers|callees|hover|diagnostic|callHierarchy` (`--symbol`, `--line` to narrow)
|
|
230
|
+
- **Cache & clone** — `npx octocode clone`, `npx octocode cache fetch|status|clear`
|
|
231
|
+
- **Skills** — `npx octocode skill --list | --name <skill> | --add <github-path> | --install-all`
|
|
232
|
+
- **Language servers** — `npx octocode lsp-server list|install|status|uninstall|clean`
|
|
233
|
+
- **Setup & introspection** — `npx octocode install`, `npx octocode auth`, `npx octocode status`, `npx octocode tools`, `npx octocode context`
|
|
234
|
+
|
|
235
|
+
Full syntax, flags, and exit codes: [Octocode CLI Guide](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_CLI.md)
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Configuration
|
|
240
|
+
|
|
241
|
+
Everything is optional; Octocode runs on sensible defaults. Settings resolve from three sources, in priority order:
|
|
242
|
+
|
|
243
|
+
```text
|
|
244
|
+
environment variables > <octocode-home>/.octocoderc > built-in defaults
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
1. **MCP / environment variables** (highest): per client or per project, set in your MCP config `env` or your shell.
|
|
248
|
+
2. **Global config**: `<octocode-home>/.octocoderc`, machine-wide defaults read by **both the CLI and the MCP server**.
|
|
249
|
+
3. **Built-in defaults**: used when neither is set.
|
|
250
|
+
|
|
251
|
+
**Octocode home** (`<octocode-home>`) holds the global config, encrypted credentials, sessions, stats, and tmp materialization caches. It defaults by platform and can be overridden with `OCTOCODE_HOME`:
|
|
252
|
+
|
|
253
|
+
| Platform | Location |
|
|
254
|
+
|----------|----------|
|
|
255
|
+
| macOS | `~/.octocode` |
|
|
256
|
+
| Linux | `${XDG_CONFIG_HOME:-~/.config}/.octocode` |
|
|
257
|
+
| Windows | `%APPDATA%\.octocode` |
|
|
258
|
+
|
|
259
|
+
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 `npx octocode auth login`.
|
|
260
|
+
|
|
261
|
+
### Common settings
|
|
262
|
+
|
|
263
|
+
The **Scope** column shows where a setting applies: `Both`, or `MCP` (the CLI ignores it).
|
|
264
|
+
|
|
265
|
+
| Env var | `.octocoderc` key | Default | Scope | What it does |
|
|
266
|
+
|---------|-------------------|---------|-------|--------------|
|
|
267
|
+
| `OCTOCODE_HOME` | env only | platform default | Both | Overrides the Octocode data directory for config, credentials, sessions, stats, and caches. |
|
|
268
|
+
| `OCTOCODE_TOKEN` / `GH_TOKEN` / `GITHUB_TOKEN` | env only | unset | Both | GitHub token, in priority order. Tokens stay in env, never in `.octocoderc`. |
|
|
269
|
+
| `GITHUB_API_URL` | `github.apiUrl` | `https://api.github.com` | Both | API endpoint; use `/api/v3` for GitHub Enterprise. |
|
|
270
|
+
| `ENABLE_LOCAL` | `local.enabled` | `true` | Both | Turns local filesystem + LSP tools on/off; set `false` to disable. |
|
|
271
|
+
| `ENABLE_CLONE` | `local.enableClone` | CLI `true`, MCP `false` | Both | `ghCloneRepo` and directory fetch. Default differs by surface; set `false` to disable in either. |
|
|
272
|
+
| `WORKSPACE_ROOT` | `local.workspaceRoot` | `cwd` | Both | Absolute root for resolving relative local paths. |
|
|
273
|
+
| `ALLOWED_PATHS` | `local.allowedPaths` | `[]` | Both | Extra path allowlist for local access; empty means home directory only after validation. |
|
|
274
|
+
| `TOOLS_TO_RUN` / `ENABLE_TOOLS` / `DISABLE_TOOLS` | `tools.*` | unset | **MCP** | Whitelist, add to, or remove from the registered tool set. The CLI exposes every tool. |
|
|
275
|
+
| `REQUEST_TIMEOUT` | `network.timeout` | `30000` | Both | Request timeout in ms (clamped `5000..300000`). |
|
|
276
|
+
| `MAX_RETRIES` | `network.maxRetries` | `3` | Both | Retry attempts (clamped `0..10`). |
|
|
277
|
+
| `OCTOCODE_OUTPUT_FORMAT` | `output.format` | `yaml` | Both | Response format: `yaml` or `json`. |
|
|
278
|
+
|
|
279
|
+
> **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`.
|
|
280
|
+
|
|
281
|
+
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/CONFIGURATION.md).
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Authentication Methods
|
|
286
|
+
|
|
287
|
+
GitHub-backed tools require authentication. Any one method is enough. Full details: [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md).
|
|
288
|
+
|
|
289
|
+
### Option 1: Octocode CLI (Recommended)
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
npx octocode auth login
|
|
293
|
+
npx octocode status # verify the active token source
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Interactive login lets you choose Octocode browser OAuth or `gh auth login`. Octocode OAuth credentials are stored encrypted on disk.
|
|
297
|
+
|
|
298
|
+
### Option 2: GitHub CLI (also supported)
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
gh auth login
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Octocode reads the `gh` token automatically — no further config needed.
|
|
305
|
+
|
|
306
|
+
### Option 3: Personal Access Token (also supported)
|
|
307
|
+
|
|
308
|
+
Set `OCTOCODE_TOKEN`, `GH_TOKEN`, or `GITHUB_TOKEN` in your shell. Required scopes: `repo`, `read:user`, `read:org`.
|
|
309
|
+
|
|
310
|
+
Create a token at [github.com/settings/tokens](https://github.com/settings/tokens).
|
|
311
|
+
|
|
312
|
+
> **Security tip**: Never commit tokens to version control. Use environment variables or secure secret management.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Security
|
|
317
|
+
|
|
318
|
+
**Every byte that reaches the model is scanned and redacted first.** All content (local files, GitHub and npm responses, error messages, and tool outputs) passes through the Rust engine's secret scanner on the way *in* (tool inputs) and on the way *out* (results), so secrets never reach the LLM. The same enforcement runs identically under MCP and the CLI.
|
|
319
|
+
|
|
320
|
+
- **Secret redaction, in and out.** 300+ provider credential patterns (AWS, Azure, GCP, GitHub, OpenAI, Anthropic, Stripe, Slack, 1Password, and more) plus generic JWTs, PEM/private keys, bearer tokens, database connection strings, and high-entropy strings. Masked values surface a redaction warning so the agent knows.
|
|
321
|
+
- **Content sanitized at the source.** Local reads (`localGetFileContent`, ripgrep, structural search, binary, file discovery, structure) and external fetches (GitHub code/files, npm) are scanned as they are read, not only at the boundary.
|
|
322
|
+
- **Path safety.** Relative inputs resolve from `WORKSPACE_ROOT` / config / `cwd`, then local reads are bounded to the engine's allowed roots (home by default, plus `ALLOWED_PATHS` and Octocode-registered roots). Symlinks are resolved and the real target is **re-validated**, so a link cannot escape into a blocked location.
|
|
323
|
+
- **Sensitive files and directories are blocked by default.** Octocode refuses to read known secret-bearing files and folders wherever they live, returning a redacted error instead of contents. Blocked patterns include:
|
|
324
|
+
- **Keys and certs:** `*.pem`, `*.key`, `*.crt`/`*.cer`/`*.csr`, `*.p12`/`*.pfx`/`*.jks`/`*.keystore`, and SSH keys (`id_rsa`, `*_ed25519`, `authorized_keys`, `known_hosts`, `.ssh/`).
|
|
325
|
+
- **Credentials and tokens:** `.env` / `.env.*`, `.netrc`, `.npmrc`, `.pgpass`, `.git-credentials`, `*_token` / `.token`, `client_secret*.json`, `*service-account*.json`, `auth.json`, `.htpasswd`.
|
|
326
|
+
- **Cloud and infra:** `.aws/`, `.azure/`, `.config/gcloud/`, `.kube/` / `kubeconfig`, `.docker/`, `.terraform/` and `*.tfstate`.
|
|
327
|
+
- **OS and app secret stores:** `.git/`, `secrets/`, `private/`, browser login data (Chrome/Firefox), OS keychains, password managers (`*.kdbx`), shell history files, and crypto wallets.
|
|
328
|
+
- **Command safety.** Normal local search runs in-process inside `octocode-engine`. External helpers are fixed per lane, command/argument allowlisted, and run via `spawn` with argument arrays: no shell strings, no injection.
|
|
329
|
+
- **Schema validation** runs before any tool executes; untrusted input size and shape are bounded.
|
|
330
|
+
- **Credentials.** GitHub auth via env tokens, AES-256-GCM-encrypted on-disk OAuth, or the `gh` CLI; tokens are never logged.
|
|
331
|
+
|
|
332
|
+
**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/CONFIGURATION.md) · [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) · [Credentials](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#github-token)
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Language Support
|
|
337
|
+
|
|
338
|
+
Four code-intelligence axes; three are native to the Rust engine and need no external tooling:
|
|
339
|
+
|
|
340
|
+
| Axis | What it does | How to use it |
|
|
341
|
+
|------|--------------|---------------|
|
|
342
|
+
| **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 60+ extensions. | `localSearchCode mode:"structural"` · CLI `search --pattern`/`--rule` |
|
|
343
|
+
| **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` |
|
|
344
|
+
| **Content minification** | Comment/whitespace stripping for 70+ languages and config formats; HTML/Vue/Svelte also minify embedded `<style>`/`<script>`. | `minify:"standard"` (default) |
|
|
345
|
+
| **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` |
|
|
346
|
+
|
|
347
|
+
📋 **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`.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Skills
|
|
352
|
+
|
|
353
|
+
> [Agent Skills](https://agentskills.io/what-are-skills) are a lightweight, open format for extending AI agent capabilities.
|
|
354
|
+
> Browse and install on [**skills.sh/bgauryy/octocode-mcp**](https://www.skills.sh/bgauryy/octocode-mcp)
|
|
355
|
+
|
|
356
|
+
**1 skill** under [`skills/`](https://github.com/bgauryy/octocode/tree/main/skills), bundled in the `octocode` package. Start with ⭐ [Research](https://www.skills.sh/bgauryy/octocode-mcp/octocode-research) for evidence-first code work.
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
npx octocode skill --list
|
|
360
|
+
npx octocode skill --name octocode-research
|
|
361
|
+
npx octocode skill --help
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
| Skill | Install | Use when |
|
|
365
|
+
|-------|---------|----------|
|
|
366
|
+
| ⭐ [**Research**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-research) | `npx octocode skill --name octocode-research` | Evidence-first research, review, refactor, architecture. |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Architecture
|
|
371
|
+
|
|
372
|
+
A yarn-workspaces monorepo. The **MCP server** and the **CLI** are thin front-ends over one shared TypeScript tool core, which delegates every CPU-heavy path to a single **Rust engine** (compiled via [napi-rs](https://napi.rs) to prebuilt `.node` binaries). One tool catalog, one security layer, one response shaper, reached two ways.
|
|
373
|
+
|
|
374
|
+
```mermaid
|
|
375
|
+
graph LR
|
|
376
|
+
CLI["octocode<br/>CLI"]
|
|
377
|
+
MCP["octocode-mcp<br/>MCP server, stdio"]
|
|
378
|
+
VSC["VS Code extension<br/>OAuth + install"]
|
|
379
|
+
CORE["octocode-tools-core<br/>tools, GitHub client, auth, pagination, security bridge"]
|
|
380
|
+
ENGINE["octocode-engine (Rust)<br/>secrets, minify, AST, signatures, ripgrep/diff/YAML, LSP"]
|
|
381
|
+
EXT["GitHub API, local FS + ripgrep, language servers"]
|
|
382
|
+
|
|
383
|
+
CLI --> CORE
|
|
384
|
+
MCP --> CORE
|
|
385
|
+
VSC -. starts .-> MCP
|
|
386
|
+
CORE --> ENGINE
|
|
387
|
+
CORE --> EXT
|
|
388
|
+
ENGINE --> EXT
|
|
389
|
+
|
|
390
|
+
style ENGINE fill:#1a1a2e,stroke:#e75d2a,color:#fff
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Request flow** is identical whether a call arrives over MCP or the CLI:
|
|
394
|
+
|
|
395
|
+
```text
|
|
396
|
+
client → sanitize inputs (Rust) → run tool (GitHub / FS / LSP) → sanitize + YAML-serialize + paginate (Rust) → result + next-step hints
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**One Rust engine** owns secret detection, sanitization, path/command validation, minification (70+ languages), signature extraction, structural AST search, ripgrep parsing, diff filtering, YAML serialization, and LSP, so the Node event loop stays unblocked and there is no duplicate native loader. It ships prebuilt for darwin (arm64/x64), linux (arm64/x64, gnu + musl), and win32-x64; no Rust toolchain is needed at runtime.
|
|
400
|
+
|
|
401
|
+
### Packages
|
|
402
|
+
|
|
403
|
+
| Directory | npm package | Role |
|
|
404
|
+
|-----------|-------------|------|
|
|
405
|
+
| [`packages/octocode`](https://github.com/bgauryy/octocode/tree/main/packages/octocode) | `octocode` | CLI: quick commands, raw tool runner, skill installs, auth/login/logout, install, status, context. |
|
|
406
|
+
| [`packages/octocode-mcp`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-mcp) | `@octocodeai/mcp` | MCP server (stdio) that registers the tool catalog for AI assistants. |
|
|
407
|
+
| [`packages/octocode-tools-core`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-tools-core) | `@octocodeai/octocode-tools-core` | Shared tool core: implementations, GitHub client, credentials and token resolution, session, pagination, security bridge. |
|
|
408
|
+
| [`packages/octocode-engine`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-engine) | `@octocodeai/octocode-engine` | Rust/napi native engine: security scanning, minification, signatures, structural AST, ripgrep/diff/YAML, LSP. |
|
|
409
|
+
| [`packages/octocode-config`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-config) | `@octocodeai/config` | Zero-dep env + config loader: `getOctocodeHome`, `.env` parsing, `.octocoderc` reading. Single source used by every package and skill. |
|
|
410
|
+
| [`packages/octocode-vscode`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-vscode) | `octocode-mcp-vscode` | VS Code extension: GitHub OAuth + multi-editor MCP install. |
|
|
411
|
+
|
|
412
|
+
`packages/octocode-benchmark` (private, not published) holds benchmark methodology, evals, and run artifacts — see [Documentation](#documentation).
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Documentation
|
|
417
|
+
|
|
418
|
+
Website: **[octocode.ai](https://octocode.ai)** · Product docs: **[github.com/bgauryy/octocode/tree/main/docs](https://github.com/bgauryy/octocode/tree/main/docs)**. This section is the canonical documentation index; benchmark methodology, evals, and run artifacts live in [`packages/octocode-benchmark`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark).
|
|
419
|
+
|
|
420
|
+
| Area | Docs |
|
|
421
|
+
|---|---|
|
|
422
|
+
| MCP server | [Octocode MCP Server](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_MCP.md) · [Configuration](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) · [Authentication](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md) |
|
|
423
|
+
| Tools and workflows | [Octocode Tools Reference](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_TOOLS.md) · [Octocode Research Skill](https://github.com/bgauryy/octocode/tree/main/skills/octocode-research) · [Search Guide](https://github.com/bgauryy/octocode/blob/main/docs/context/SEARCH_GUIDE.md) |
|
|
424
|
+
| CLI and query language | [Octocode CLI Guide](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_CLI.md) · [Octocode Query Language](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_QUERY_LANGUAGE.md) · [OQL Research Graph Flow](https://github.com/bgauryy/octocode/blob/main/docs/context/OQL_RESEARCH_GRAPH_FLOW.md) |
|
|
425
|
+
| Skills | [Skills](https://github.com/bgauryy/octocode/tree/main/skills) |
|
|
426
|
+
| Development and security | [Security Model](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md) · [LSP Server Lifecycle](https://github.com/bgauryy/octocode/blob/main/docs/LSP_SERVER_LIFECYCLE.md) |
|
|
427
|
+
| Benchmarks and evals | [Benchmark Summary](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/BENCHMARK.md) · [Unified CLI/Tool/OQL Eval](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/octocode/README.md) · [Benchmark Runbook](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/recipes/agent-benchmark-runbook.md) · [Support Matrix](https://github.com/bgauryy/octocode/blob/main/docs/LSP_SERVER_LIFECYCLE.md#full-format-support-matrix) |
|
|
428
|
+
| Shared internals | [Credentials Architecture](https://github.com/bgauryy/octocode/blob/main/docs/CONFIGURATION.md#github-token) · [Session Persistence](https://github.com/bgauryy/octocode/blob/main/docs/OCTOCODE_MCP.md#session-persistence) |
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Troubleshooting
|
|
433
|
+
|
|
434
|
+
Having Node.js issues? Run:
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
npx node-doctor check --json
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Read the output and fix accordingly.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Agent Workflows
|
|
445
|
+
|
|
446
|
+
### Recommended dev mode: Pi + Octocode
|
|
447
|
+
|
|
448
|
+
[Pi](https://github.com/earendil-works/pi) is a fast, local-first coding agent whose stated philosophy is *"CLI tools with READMEs (Skills) over MCP."* Pairing it with Octocode gives a lean, evidence-driven dev loop — **Pi edits, Octocode researches**. Two routes, pick by how much surface you need:
|
|
449
|
+
|
|
450
|
+
- **Skill route — recommended, leanest.** Drop the [`octocode-research`](https://www.skills.sh/bgauryy/octocode-mcp/octocode-research) skill into Pi's global skills dir. It drives the Octocode **CLI** directly — no MCP transport, minimal token overhead — and Pi auto-discovers it:
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
npx octocode skill --name octocode-research --platform pi
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
- **Adapter route — full tool surface.** Install [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) to expose 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`.
|
|
457
|
+
|
|
458
|
+
### Research-driven loop
|
|
459
|
+
|
|
460
|
+
Most agent failures start before implementation: the agent guesses the owner of a behavior, trusts a snippet without reading the exact source, or edits before proving blast radius. Prefer a cheaper loop first: orient with trees and discovery output, search with Octocode, read exact evidence, use AST/LSP when identity matters, then patch and verify.
|
|
461
|
+
|
|
462
|
+
That shape keeps the editing surface small while preserving context for what matters: file anchors, symbols, call paths, PR/history evidence, package sources, and the verification command that proves the change. In short, the host edits, Octocode is the map, and skills encode the habit.
|
|
463
|
+
|
|
464
|
+
### The Manifest
|
|
465
|
+
|
|
466
|
+
**"Code is Truth, but Context is the Map."** Read the [Manifest of Octocode for Research Driven Development](https://github.com/bgauryy/octocode/blob/main/MANIFEST.md) to understand the philosophy behind Octocode.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|