@octocodeai/octocode-tools-core 16.5.1 → 16.6.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/README.md +113 -95
- package/dist/direct.js +38 -33
- package/dist/github/githubAPI.d.ts +22 -0
- package/dist/github/history.d.ts +3 -0
- package/dist/github/prTransformation.d.ts +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.js +45 -40
- package/dist/oql/adapters/compile.d.ts +25 -0
- package/dist/oql/adapters/github.d.ts +3 -0
- package/dist/oql/adapters/local.d.ts +7 -0
- package/dist/oql/adapters/materialize.d.ts +11 -0
- package/dist/oql/adapters/pagination.d.ts +21 -0
- package/dist/oql/adapters/researchTargets.d.ts +50 -0
- package/dist/oql/adapters/resultMap.d.ts +20 -0
- package/dist/oql/adapters/ruleYaml.d.ts +11 -0
- package/dist/oql/adapters/runner.d.ts +14 -0
- package/dist/oql/adapters/v2.d.ts +32 -0
- package/dist/oql/capabilities.d.ts +31 -0
- package/dist/oql/defaults.d.ts +26 -0
- package/dist/oql/diagnostics.d.ts +25 -0
- package/dist/oql/diffLanes.d.ts +29 -0
- package/dist/oql/envelope.d.ts +19 -0
- package/dist/oql/features.d.ts +7 -0
- package/dist/oql/index.d.ts +26 -0
- package/dist/oql/index.js +49 -0
- package/dist/oql/normalize.d.ts +5 -0
- package/dist/oql/planner.d.ts +7 -0
- package/dist/oql/research/analyze.d.ts +134 -0
- package/dist/oql/research/packets.d.ts +80 -0
- package/dist/oql/run.d.ts +32 -0
- package/dist/oql/schema.d.ts +1018 -0
- package/dist/oql/schemeText.d.ts +138 -0
- package/dist/oql/shorthand.d.ts +177 -0
- package/dist/oql/targetParams.d.ts +20 -0
- package/dist/oql/transformers/contract.d.ts +19 -0
- package/dist/oql/transformers/github/code.d.ts +17 -0
- package/dist/oql/transformers/github/common.d.ts +8 -0
- package/dist/oql/transformers/language.d.ts +1 -0
- package/dist/oql/transformers/registry.d.ts +16 -0
- package/dist/oql/transformers/types.d.ts +11 -0
- package/dist/oql/types.d.ts +633 -0
- package/dist/oql/v2params.d.ts +22 -0
- package/dist/providers/types.d.ts +1 -1
- package/dist/schema.d.ts +13 -0
- package/dist/schema.js +8 -0
- package/dist/serverConfig.d.ts +0 -1
- package/dist/session.d.ts +2 -24
- package/dist/shared/config/defaults.d.ts +1 -2
- package/dist/shared/config/index.d.ts +2 -3
- package/dist/shared/config/index.js +2 -3
- package/dist/shared/config/resolverSections.d.ts +1 -3
- package/dist/shared/config/runtimeSurface.d.ts +2 -2
- package/dist/shared/config/schemas.d.ts +0 -1
- package/dist/shared/config/types.d.ts +0 -8
- package/dist/shared/credentials/index.js +1 -2
- package/dist/shared/index.d.ts +0 -1
- package/dist/shared/languageSelectors.d.ts +23 -0
- package/dist/shared/paths.d.ts +0 -2
- package/dist/shared/paths.js +1 -1
- package/dist/shared/session/index.js +1 -2
- package/dist/tools/directToolCatalog.d.ts +15 -56
- package/dist/tools/directToolCatalog.exec.d.ts +11 -0
- package/dist/tools/directToolCatalog.meta.d.ts +82 -0
- package/dist/tools/github_clone_repo/cache.d.ts +1 -1
- package/dist/tools/github_clone_repo/types.d.ts +2 -0
- package/dist/tools/github_fetch_content/scheme.d.ts +104 -0
- package/dist/tools/github_fetch_content/types.d.ts +27 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +170 -2
- package/dist/tools/lsp/shared/resolveSymbolAnchor.d.ts +2 -2
- package/dist/tools/lsp/shared/semanticTypes.d.ts +34 -5
- package/dist/tools/oql_search/execution.d.ts +7 -0
- package/dist/tools/package_search/execution.d.ts +10 -0
- package/dist/tools/providerMappers.d.ts +7 -7
- package/dist/tools/toolConfig.d.ts +1 -0
- package/dist/tools/toolNames.d.ts +2 -0
- package/dist/types/server.d.ts +0 -1
- package/dist/types/session.d.ts +0 -19
- package/dist/utils/contextUtils.d.ts +15 -1
- package/dist/utils/core/types.d.ts +2 -1
- package/dist/utils/markdownOutline.d.ts +10 -0
- package/dist/utils/response/groupedFinalizer.d.ts +0 -23
- package/package.json +11 -3
- package/dist/commands/BaseCommandBuilder.d.ts +0 -14
- package/dist/commands/FindCommandBuilder.d.ts +0 -23
- package/dist/commands/LsCommandBuilder.d.ts +0 -15
- package/dist/shared/logger/index.d.ts +0 -2
- package/dist/shared/logger/logger.d.ts +0 -17
- package/dist/utils/pagination/outputSizeLimit.d.ts +0 -16
- package/dist/utils/ranking/evidenceRanker.d.ts +0 -86
- package/dist/utils/response/structuredPagination.d.ts +0 -9
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Agentic Research Platform
|
|
1
|
+
# Octocode - Agentic Research Platform
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<img src="https://github.com/bgauryy/octocode/raw/main/packages/octocode-mcp/assets/logo_white.png" width="400px" alt="Octocode Logo">
|
|
@@ -21,6 +21,7 @@ Run it as a **CLI** or an **MCP server**. A **Rust engine** keeps every call fas
|
|
|
21
21
|
## Table of Contents
|
|
22
22
|
|
|
23
23
|
- [Why Octocode](#why-octocode)
|
|
24
|
+
- [What You Can Do](#what-you-can-do)
|
|
24
25
|
- [Tools](#tools)
|
|
25
26
|
- [MCP](#mcp)
|
|
26
27
|
- [CLI](#cli)
|
|
@@ -31,7 +32,6 @@ Run it as a **CLI** or an **MCP server**. A **Rust engine** keeps every call fas
|
|
|
31
32
|
- [Skills](#skills)
|
|
32
33
|
- [Architecture](#architecture)
|
|
33
34
|
- [Documentation](#documentation)
|
|
34
|
-
- [Contributing](#contributing)
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
@@ -48,6 +48,20 @@ Most tools cover one slice: searching the web, or grepping your repo. Octocode c
|
|
|
48
48
|
- **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.
|
|
49
49
|
- **Safe by default.** Every byte returned to the model is scanned and secrets redacted first (see [Security](#security)).
|
|
50
50
|
|
|
51
|
+
## What You Can Do
|
|
52
|
+
|
|
53
|
+
Octocode is useful whenever the next coding step depends on finding and proving context, not guessing it.
|
|
54
|
+
|
|
55
|
+
| Need | Use Octocode to |
|
|
56
|
+
|------|-----------------|
|
|
57
|
+
| **Codebase questions** | Search local or GitHub code, read exact regions, browse trees, and carry file/line anchors into the answer. |
|
|
58
|
+
| **Implementation research** | Compare patterns across repositories, npm packages, pull requests, commits, and local files before changing code. |
|
|
59
|
+
| **Semantic navigation** | Resolve definitions, references, callers/callees, call hierarchy, hovers, symbols, diagnostics, and type relationships through LSP. |
|
|
60
|
+
| **Structural matching** | Run AST-shaped searches with patterns or YAML rules so comments and strings do not become false positives. |
|
|
61
|
+
| **Large-file context** | Minify, skeletonize, or paginate code so agents spend tokens on relevant structure instead of boilerplate. |
|
|
62
|
+
| **Binary or archive inspection** | Inspect archives, compressed streams, native binaries, and strings without leaving the research flow. |
|
|
63
|
+
| **Agent workflows** | Expose the same engine through MCP, CLI, OQL, and Agent Skills so assistants and humans use one evidence model. |
|
|
64
|
+
|
|
51
65
|
### Get Started
|
|
52
66
|
|
|
53
67
|
Add Octocode to an AI assistant with MCP, or run the same tools directly from
|
|
@@ -65,24 +79,19 @@ npx octocode install
|
|
|
65
79
|
**CLI fast install:**
|
|
66
80
|
|
|
67
81
|
```bash
|
|
68
|
-
# Run without installing globally
|
|
69
82
|
npx octocode
|
|
70
|
-
|
|
71
|
-
# Or install once on macOS/Linux
|
|
72
|
-
brew install bgauryy/octocode/octocode
|
|
73
|
-
octocode
|
|
74
83
|
```
|
|
75
84
|
|
|
76
85
|
Authenticate GitHub when you want private repositories or higher API limits:
|
|
77
86
|
|
|
78
87
|
```bash
|
|
79
|
-
npx octocode
|
|
88
|
+
npx octocode login
|
|
80
89
|
```
|
|
81
90
|
|
|
82
91
|
### Benchmarks
|
|
83
92
|
|
|
84
93
|
Latest benchmark output:
|
|
85
|
-
[packages/octocode-benchmark/output](https://github.com/bgauryy/octocode/
|
|
94
|
+
[packages/octocode-benchmark/output](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark/output/).
|
|
86
95
|
|
|
87
96
|
#### ast-grep Structural Comparison
|
|
88
97
|
|
|
@@ -98,14 +107,14 @@ This benchmark does not test text grep, LSP navigation, rewriting, or the full
|
|
|
98
107
|
ast-grep rule language. Those are separate capabilities.
|
|
99
108
|
|
|
100
109
|
```text
|
|
101
|
-
Octocode raw native ████████████████████
|
|
102
|
-
ast-grep CLI
|
|
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
|
|
103
112
|
```
|
|
104
113
|
|
|
105
114
|
`Octocode raw native` means the direct Rust/NAPI `structuralSearchFiles`
|
|
106
115
|
matcher: parse and match only, with no tool validation, sanitizer, pagination,
|
|
107
116
|
JSON shaping, or Node CLI startup. The agent-facing `localSearchCode` and public
|
|
108
|
-
`octocode
|
|
117
|
+
`octocode search --pattern/--rule` paths are intentionally slower because they include those safety
|
|
109
118
|
and DX layers.
|
|
110
119
|
|
|
111
120
|
What was checked: we took ast-grep's benchmark scenario repo list, picked one
|
|
@@ -116,13 +125,15 @@ median run.
|
|
|
116
125
|
Benchmark files:
|
|
117
126
|
[runner](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/ast-grep/compare-upstream-scenarios.mjs) ·
|
|
118
127
|
[scenario manifest](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/ast-grep/upstream-outline-scenarios.json) ·
|
|
119
|
-
[latest output](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/output/comparison.md)
|
|
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)
|
|
120
131
|
|
|
121
132
|
---
|
|
122
133
|
|
|
123
134
|
## Tools
|
|
124
135
|
|
|
125
|
-
Octocode ships **
|
|
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; local tools require `ENABLE_LOCAL` (CLI default: on, MCP default: off). All flags: [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md).
|
|
126
137
|
|
|
127
138
|
**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.
|
|
128
139
|
|
|
@@ -157,7 +168,13 @@ Octocode ships **13 research tools**; the same implementations run identically o
|
|
|
157
168
|
|
|
158
169
|
| Tool | What it does |
|
|
159
170
|
|------|--------------|
|
|
160
|
-
| `lspGetSemantics` | Typed semantic navigation. Raw tools support `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `documentSymbols`, `typeDefinition`, and `
|
|
171
|
+
| `lspGetSemantics` | Typed semantic navigation. Raw tools support `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `documentSymbols`, `typeDefinition`, `implementation`, `workspaceSymbol`, `supertypes`, `subtypes`, and `diagnostic`. The CLI uses `octocode search <file> --op <type>` for semantics and `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/mcp/tools/LSP_TOOLS.md)). |
|
|
172
|
+
|
|
173
|
+
### OQL Search
|
|
174
|
+
|
|
175
|
+
| Tool | What it does |
|
|
176
|
+
|------|--------------|
|
|
177
|
+
| `oqlSearch` | Runs typed OQL queries across code, content, structure, files, semantics, repositories, packages, pull requests, commits, artifacts, diff, research, graph, and materialization targets. |
|
|
161
178
|
|
|
162
179
|
**Per-tool references** (full schemas, fields, and examples) live in **[`docs/mcp`](https://github.com/bgauryy/octocode/tree/main/docs/mcp)**:
|
|
163
180
|
- [GitHub Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/GITHUB_TOOLS.md)
|
|
@@ -170,7 +187,7 @@ Octocode ships **13 research tools**; the same implementations run identically o
|
|
|
170
187
|
|
|
171
188
|
## MCP
|
|
172
189
|
|
|
173
|
-
The MCP server exposes
|
|
190
|
+
The MCP server exposes the Octocode tool catalog directly to your AI assistant over stdio. Install once; the assistant calls tools automatically.
|
|
174
191
|
|
|
175
192
|
### Install
|
|
176
193
|
|
|
@@ -216,19 +233,17 @@ Set tokens and options as `env` entries here, or machine-wide in `.octocoderc`.
|
|
|
216
233
|
|
|
217
234
|
## CLI
|
|
218
235
|
|
|
219
|
-
The CLI exposes the same research engine without an MCP client. Use quick commands for humans, or call raw tools from scripts and CI.
|
|
236
|
+
The CLI exposes the same research engine without an MCP client. Use quick commands for humans, or call raw tools from scripts and CI. It is agent-friendly by design: `npx octocode --help`, `npx octocode context`, and `npx octocode tools <name> --scheme` publish the research protocol, tool descriptions, and exact schemas, while command output returns compact anchors, pagination, and follow-up hints that guide agents through evidence-first research.
|
|
220
237
|
|
|
221
238
|
### Install
|
|
222
239
|
|
|
223
240
|
```bash
|
|
224
|
-
|
|
225
|
-
# or
|
|
226
|
-
npm install -g octocode
|
|
241
|
+
npx octocode
|
|
227
242
|
```
|
|
228
243
|
|
|
229
244
|
```bash
|
|
230
|
-
octocode login
|
|
231
|
-
octocode status
|
|
245
|
+
npx octocode login
|
|
246
|
+
npx octocode status
|
|
232
247
|
```
|
|
233
248
|
|
|
234
249
|
### All Commands
|
|
@@ -237,23 +252,28 @@ Local paths route to local tools; `owner/repo[/path]` targets route to GitHub to
|
|
|
237
252
|
|
|
238
253
|
| Command | Use it for |
|
|
239
254
|
|---------|------------|
|
|
240
|
-
| `octocode
|
|
241
|
-
| `octocode
|
|
242
|
-
| `octocode
|
|
243
|
-
| `octocode
|
|
244
|
-
| `octocode
|
|
245
|
-
| `octocode
|
|
246
|
-
| `octocode
|
|
247
|
-
| `octocode
|
|
248
|
-
| `octocode
|
|
249
|
-
| `octocode
|
|
250
|
-
| `octocode unzip <archive>` | Unpack an archive to `<octocode-home>/tmp/unzip/<name>-<timestamp>/`, then use local `
|
|
255
|
+
| `octocode search <term> <path\|owner/repo>` | Text/regex search, file discovery with `--search path` / `--target files`, AST structural search with `--pattern` / `--rule`, and full OQL with `--query`. Use `--lang` for language/extension scope. |
|
|
256
|
+
| `octocode search <path\|owner/repo> --tree` | Browse local or GitHub structure |
|
|
257
|
+
| `octocode search <file>` | Read content, line ranges, and matched slices; add `--content-view exact|compact|symbols` or `--raw` |
|
|
258
|
+
| `octocode search <file> --symbols` | Show a symbol outline for a file or source tree |
|
|
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>` |
|
|
251
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 |
|
|
252
271
|
| `octocode tools` | List tools, read schemas, or run any MCP tool directly from the terminal |
|
|
253
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 |
|
|
254
274
|
| `octocode install` | Configure Octocode in MCP clients |
|
|
255
|
-
| `octocode auth` | Manage GitHub authentication with `login`, `logout`, or `
|
|
256
|
-
| `octocode login` / `octocode logout` |
|
|
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 |
|
|
257
277
|
| `octocode status` | Check token presence, auth identity, MCP installs, sync state, and cache paths |
|
|
258
278
|
|
|
259
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).
|
|
@@ -272,7 +292,7 @@ environment variables > <octocode-home>/.octocoderc > built-in defaults
|
|
|
272
292
|
2. **Global config**: `<octocode-home>/.octocoderc`, machine-wide defaults read by **both the CLI and the MCP server**.
|
|
273
293
|
3. **Built-in defaults**: used when neither is set.
|
|
274
294
|
|
|
275
|
-
**Octocode home** (`<octocode-home>`) holds the global config, encrypted credentials, sessions, stats,
|
|
295
|
+
**Octocode home** (`<octocode-home>`) holds the global config, encrypted credentials, sessions, stats, and tmp materialization caches. Its location is fixed per platform (there is no override):
|
|
276
296
|
|
|
277
297
|
| Platform | Location |
|
|
278
298
|
|----------|----------|
|
|
@@ -347,53 +367,30 @@ Per-project overrides and custom LSP servers live in a workspace `.octocode/` fo
|
|
|
347
367
|
|
|
348
368
|
## Authentication Methods
|
|
349
369
|
|
|
350
|
-
GitHub-backed tools require authentication.
|
|
370
|
+
GitHub-backed tools require authentication. Any one method is enough. Full details: [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/mcp/AUTHENTICATION.md).
|
|
351
371
|
|
|
352
372
|
### Option 1: Octocode CLI (Recommended)
|
|
353
373
|
|
|
354
|
-
The simplest setup. Octocode stores OAuth credentials encrypted on disk.
|
|
355
|
-
|
|
356
374
|
```bash
|
|
357
|
-
npx octocode
|
|
375
|
+
npx octocode login
|
|
358
376
|
npx octocode status # verify the active token source
|
|
359
377
|
```
|
|
360
378
|
|
|
361
|
-
|
|
379
|
+
Interactive login lets you choose Octocode browser OAuth or `gh auth login`. Octocode OAuth credentials are stored encrypted on disk.
|
|
362
380
|
|
|
363
|
-
|
|
381
|
+
### Option 2: GitHub CLI (also supported)
|
|
364
382
|
|
|
365
383
|
```bash
|
|
366
|
-
# Install GitHub CLI
|
|
367
|
-
brew install gh # macOS
|
|
368
|
-
winget install --id GitHub.cli # Windows
|
|
369
|
-
# Linux: https://github.com/cli/cli/blob/trunk/docs/install_linux.md
|
|
370
|
-
|
|
371
384
|
gh auth login
|
|
372
385
|
```
|
|
373
386
|
|
|
374
|
-
|
|
387
|
+
Octocode reads the `gh` token automatically — no further config needed.
|
|
375
388
|
|
|
376
|
-
### Option 3: Personal Access Token
|
|
389
|
+
### Option 3: Personal Access Token (also supported)
|
|
377
390
|
|
|
378
|
-
|
|
391
|
+
Set `OCTOCODE_TOKEN`, `GH_TOKEN`, or `GITHUB_TOKEN` in your shell. Required scopes: `repo`, `read:user`, `read:org`.
|
|
379
392
|
|
|
380
|
-
|
|
381
|
-
2. Select scopes: `repo`, `read:user`, `read:org`
|
|
382
|
-
3. Provide it via `OCTOCODE_TOKEN`, `GH_TOKEN`, or `GITHUB_TOKEN` (in your shell or MCP client `env`):
|
|
383
|
-
|
|
384
|
-
```json
|
|
385
|
-
{
|
|
386
|
-
"mcpServers": {
|
|
387
|
-
"octocode": {
|
|
388
|
-
"command": "npx",
|
|
389
|
-
"args": ["octocode-mcp@latest"],
|
|
390
|
-
"env": {
|
|
391
|
-
"GITHUB_TOKEN": "<your-token>"
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
```
|
|
393
|
+
Create a token at [github.com/settings/tokens](https://github.com/settings/tokens).
|
|
397
394
|
|
|
398
395
|
> **Security tip**: Never commit tokens to version control. Use environment variables or secure secret management.
|
|
399
396
|
|
|
@@ -401,17 +398,17 @@ Best for CI/CD, automation, MCP client configs, or GitHub Enterprise.
|
|
|
401
398
|
|
|
402
399
|
## Security
|
|
403
400
|
|
|
404
|
-
**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
|
|
401
|
+
**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.
|
|
405
402
|
|
|
406
|
-
- **Secret redaction, in and out.**
|
|
407
|
-
- **Content sanitized at the source.** Local reads (`localGetFileContent`, ripgrep, structural search, binary,
|
|
408
|
-
- **Path safety.**
|
|
403
|
+
- **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.
|
|
404
|
+
- **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.
|
|
405
|
+
- **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.
|
|
409
406
|
- **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:
|
|
410
407
|
- **Keys and certs:** `*.pem`, `*.key`, `*.crt`/`*.cer`/`*.csr`, `*.p12`/`*.pfx`/`*.jks`/`*.keystore`, and SSH keys (`id_rsa`, `*_ed25519`, `authorized_keys`, `known_hosts`, `.ssh/`).
|
|
411
408
|
- **Credentials and tokens:** `.env` / `.env.*`, `.netrc`, `.npmrc`, `.pgpass`, `.git-credentials`, `*_token` / `.token`, `client_secret*.json`, `*service-account*.json`, `auth.json`, `.htpasswd`.
|
|
412
409
|
- **Cloud and infra:** `.aws/`, `.azure/`, `.config/gcloud/`, `.kube/` / `kubeconfig`, `.docker/`, `.terraform/` and `*.tfstate`.
|
|
413
410
|
- **OS and app secret stores:** `.git/`, `secrets/`, `private/`, browser login data (Chrome/Firefox), OS keychains, password managers (`*.kdbx`), shell history files, and crypto wallets.
|
|
414
|
-
- **Command safety.**
|
|
411
|
+
- **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.
|
|
415
412
|
- **Schema validation** runs before any tool executes; untrusted input size and shape are bounded.
|
|
416
413
|
- **Credentials.** GitHub auth via env tokens, AES-256-GCM-encrypted on-disk OAuth, or the `gh` CLI; tokens are never logged.
|
|
417
414
|
|
|
@@ -425,10 +422,10 @@ Four code-intelligence axes; three are native to the Rust engine and need no ext
|
|
|
425
422
|
|
|
426
423
|
| Axis | What it does | How to use it |
|
|
427
424
|
|------|--------------|---------------|
|
|
428
|
-
| **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 33 grammars. | `localSearchCode mode:"structural"` · CLI `
|
|
429
|
-
| **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 `
|
|
425
|
+
| **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 33 grammars. | `localSearchCode mode:"structural"` · CLI `search --pattern`/`--rule` |
|
|
426
|
+
| **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` |
|
|
430
427
|
| **Content minification** | Comment/whitespace stripping for 70+ languages and config formats; HTML/Vue/Svelte also minify embedded `<style>`/`<script>`. | `minify:"standard"` (default) |
|
|
431
|
-
| **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 `
|
|
428
|
+
| **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` |
|
|
432
429
|
|
|
433
430
|
📋 **Full support matrix:** every extension with its exact AST, signature, LSP, and minify capability, machine-generated from the shipped binary, lives in **[`benchmark/SUPPORT.md`](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/SUPPORT.md)** (150 extensions: 61 AST, 47 signature, 56 LSP, 89 minify-only). Regenerate or verify with `yarn workspace @octocodeai/octocode-benchmark matrix:check`.
|
|
434
431
|
|
|
@@ -439,17 +436,31 @@ Four code-intelligence axes; three are native to the Rust engine and need no ext
|
|
|
439
436
|
> [Agent Skills](https://agentskills.io/what-are-skills) are a lightweight, open format for extending AI agent capabilities.
|
|
440
437
|
> Browse and install on [**skills.sh/bgauryy/octocode-mcp**](https://www.skills.sh/bgauryy/octocode-mcp) · Skills index: [skills/README.md](https://github.com/bgauryy/octocode/blob/main/skills/README.md)
|
|
441
438
|
|
|
442
|
-
These are the skills the Octocode team itself uses to build Octocode. ⭐ **[Engineer](https://www.skills.sh/bgauryy/octocode-mcp/octocode-engineer)** is the recommended starting skill.
|
|
439
|
+
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.
|
|
443
440
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
441
|
+
Install any GitHub skill folder directly from the Octocode CLI:
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
# Shared cross-agent location: ~/.agents/skills
|
|
445
|
+
npx octocode skill --add bgauryy/octocode-mcp/skills/octocode-engineer --platform common
|
|
446
|
+
|
|
447
|
+
# Agent-safe install for multiple clients; never prompts
|
|
448
|
+
npx octocode skill --add https://github.com/bgauryy/octocode-mcp/tree/main/skills/octocode-engineer --platform cursor,codex --mode copy --json
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Platforms: `common` (`~/.agents/skills`), `cursor`, `claude` (Claude Code + Claude Desktop), `codex`, or `all`. Use `--mode symlink` to keep each agent pointed at the Octocode-managed source cache. Full guide: [Skills Guide](https://github.com/bgauryy/octocode/blob/main/docs/SKILLS_GUIDE.md).
|
|
452
|
+
|
|
453
|
+
| Skill | Directory | Use it when |
|
|
454
|
+
|-------|-----------|-------------|
|
|
455
|
+
| [**CLI**](https://www.skills.sh/bgauryy/octocode-mcp/octocode) | `octocode/` | You want to research code from the terminal without MCP: local, GitHub, npm, file, repo, PR, or package lookup. |
|
|
456
|
+
| ⭐ [**Engineer**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-engineer) | `octocode-engineer/` | You need to understand, implement, review, refactor, or audit code. The default for "work on this code." |
|
|
457
|
+
| [**Loop**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-loop) | `octocode-loop/` | The goal and research path are clear and the work needs grounded Act -> Observe -> Learn -> Repeat loops until evidence converges. |
|
|
458
|
+
| [**Brainstorming**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-brainstorming) | `octocode-brainstorming/` | The idea is fuzzy: validate prior art, check whether something is worth building, or produce a decision brief. |
|
|
459
|
+
| [**RFC Generator**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-rfc-generator) | `octocode-rfc-generator/` | You need a design doc, RFC, architecture proposal, migration plan, or rollout plan before coding. |
|
|
460
|
+
| [**Roast**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-roast) | `octocode-roast/` | You want brutal but actionable code critique with severity-ranked findings and fixes. |
|
|
461
|
+
| [**Skills**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-skills) | `octocode-skills/` | You are working on Agent Skills themselves: find, evaluate, install, lint, create, or update `SKILL.md` folders. |
|
|
462
|
+
| [**Awareness**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-awareness) | `octocode-awareness/` | You need memory, file locks, or verify-before-conclude across runs or concurrent agents in a shared/dirty repo. |
|
|
463
|
+
| [**Stats**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-stats) | `octocode-stats/` | You want to visualize Octocode usage: tokens/chars saved, cache hits, errors, and rate limits from `stats.json`. |
|
|
453
464
|
|
|
454
465
|
---
|
|
455
466
|
|
|
@@ -488,7 +499,7 @@ client → sanitize inputs (Rust) → run tool (GitHub / FS / LSP) → sanitize
|
|
|
488
499
|
|
|
489
500
|
| Directory | npm package | Role |
|
|
490
501
|
|-----------|-------------|------|
|
|
491
|
-
| [`packages/octocode`](https://github.com/bgauryy/octocode/tree/main/packages/octocode) | `octocode` | CLI: quick commands, raw tool runner, auth/login/logout, install, status, context. |
|
|
502
|
+
| [`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. |
|
|
492
503
|
| [`packages/octocode-mcp`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-mcp) | `octocode-mcp` | MCP server (stdio) that registers the tool catalog for AI assistants. |
|
|
493
504
|
| [`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. |
|
|
494
505
|
| [`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. |
|
|
@@ -498,12 +509,13 @@ client → sanitize inputs (Rust) → run tool (GitHub / FS / LSP) → sanitize
|
|
|
498
509
|
|
|
499
510
|
## Documentation
|
|
500
511
|
|
|
501
|
-
Website: **[octocode.ai](https://octocode.ai)** ·
|
|
512
|
+
Website: **[octocode.ai](https://octocode.ai)** · Product docs: **[github.com/bgauryy/octocode/tree/main/docs](https://github.com/bgauryy/octocode/tree/main/docs)** · Index: **[docs/README.md](https://github.com/bgauryy/octocode/blob/main/docs/README.md)**. Product documentation lives in [`docs/`](https://github.com/bgauryy/octocode/tree/main/docs); benchmark methodology, evals, and run artifacts live in [`packages/octocode-benchmark`](https://github.com/bgauryy/octocode/tree/main/packages/octocode-benchmark).
|
|
502
513
|
|
|
503
514
|
**Docs map**
|
|
504
515
|
- [`docs/mcp/`](https://github.com/bgauryy/octocode/tree/main/docs/mcp): MCP server configuration, authentication, tools, workflows, architecture
|
|
505
|
-
- [`docs/cli/`](https://github.com/bgauryy/octocode/tree/main/docs/cli): CLI commands, flags,
|
|
506
|
-
- [`docs/`](https://github.com/bgauryy/octocode/tree/main/docs): guides for development, security,
|
|
516
|
+
- [`docs/cli/`](https://github.com/bgauryy/octocode/tree/main/docs/cli): CLI commands, flags, and reference material
|
|
517
|
+
- [`docs/`](https://github.com/bgauryy/octocode/tree/main/docs): guides for development, security, and Pi setup
|
|
518
|
+
- [`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
|
|
507
519
|
|
|
508
520
|
**Setup**
|
|
509
521
|
- [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/mcp/AUTHENTICATION.md)
|
|
@@ -513,20 +525,26 @@ Website: **[octocode.ai](https://octocode.ai)** · Full docs: **[github.com/bgau
|
|
|
513
525
|
**Tool References**
|
|
514
526
|
- [GitHub Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/GITHUB_TOOLS.md)
|
|
515
527
|
- [Local Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LOCAL_TOOLS.md)
|
|
528
|
+
- [Binary Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/BINARY_TOOLS.md)
|
|
516
529
|
- [LSP Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LSP_TOOLS.md)
|
|
517
530
|
- [Clone & Local Workflow](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CLONE_WORKFLOW.md)
|
|
531
|
+
- [Tool Behavior Guide](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/TOOL_BEHAVIOR.md)
|
|
532
|
+
|
|
533
|
+
**Benchmarks & Evals**
|
|
534
|
+
- [Benchmark Summary](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/BENCHMARK.md)
|
|
535
|
+
- [Unified CLI/Tool/OQL Eval](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/octocode/README.md)
|
|
536
|
+
- [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/packages/octocode-benchmark/benchmark/SUPPORT.md)
|
|
518
538
|
|
|
519
539
|
**Security, CLI & Skills**
|
|
520
540
|
- [Security Model](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md)
|
|
521
541
|
- [CLI Reference](https://github.com/bgauryy/octocode/blob/main/docs/cli/REFERENCE.md)
|
|
522
|
-
- [Skills Guide](https://github.com/bgauryy/octocode/blob/main/docs/SKILLS_GUIDE.md)
|
|
542
|
+
- [Skills Guide](https://github.com/bgauryy/octocode/blob/main/docs/SKILLS_GUIDE.md)
|
|
543
|
+
- [Skills Index](https://github.com/bgauryy/octocode/blob/main/skills/README.md)
|
|
523
544
|
|
|
524
545
|
**Shared Internals**
|
|
525
546
|
- [Credentials Architecture](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CREDENTIALS.md) · [Session Persistence](https://github.com/bgauryy/octocode/blob/main/docs/mcp/SESSION.md)
|
|
526
547
|
|
|
527
|
-
**Operations**
|
|
528
|
-
- [Development Guide](https://github.com/bgauryy/octocode/blob/main/docs/DEVELOPMENT_GUIDE.md) · [Agent Guidance (AGENTS.md)](https://github.com/bgauryy/octocode/blob/main/AGENTS.md)
|
|
529
|
-
|
|
530
548
|
### Recommended dev mode: Pi + Octocode
|
|
531
549
|
|
|
532
550
|
[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:
|
|
@@ -534,10 +552,10 @@ Website: **[octocode.ai](https://octocode.ai)** · Full docs: **[github.com/bgau
|
|
|
534
552
|
- **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:
|
|
535
553
|
|
|
536
554
|
```bash
|
|
537
|
-
npx
|
|
555
|
+
npx octocode skill --add bgauryy/octocode-mcp/skills/octocode-engineer --platform common
|
|
538
556
|
```
|
|
539
557
|
|
|
540
|
-
- **Adapter route — full tool surface.** Install [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) to expose all
|
|
558
|
+
- **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`.
|
|
541
559
|
|
|
542
560
|
Tune Pi's behavior with an `APPEND_SYSTEM.md` (a compact starter lives at [`docs/PI/APPEND_SYSTEM.md`](https://github.com/bgauryy/octocode/blob/main/docs/PI/APPEND_SYSTEM.md)). The full walkthrough — adapter install, MCP config scopes, skills, system-prompt tuning, and custom models — is in the [**Pi Setup Guide**](https://github.com/bgauryy/octocode/blob/main/docs/PI/PI_SETUP_GUIDE.md).
|
|
543
561
|
|