@octocodeai/octocode-tools-core 16.3.0 → 16.5.1
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 +546 -0
- package/dist/config.d.ts +7 -0
- package/dist/direct.js +34 -41
- package/dist/errors/pathUtils.d.ts +1 -1
- package/dist/github/directoryFetch.d.ts +2 -1
- package/dist/github/githubAPI.d.ts +10 -1
- package/dist/github/repoStructureRecursive.d.ts +6 -0
- package/dist/index.d.ts +15 -27
- package/dist/index.js +41 -48
- package/dist/providers/providerQueries.d.ts +9 -0
- package/dist/providers/providerResults.d.ts +2 -0
- package/dist/scheme/coreSchemas.d.ts +5 -5
- package/dist/scheme/fields.d.ts +6 -6
- package/dist/serverConfig.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/shared/config/defaults.d.ts +15 -0
- package/dist/shared/config/index.d.ts +10 -0
- package/dist/shared/config/index.js +10 -0
- package/dist/shared/config/loader.d.ts +7 -0
- package/dist/shared/config/resolver.d.ts +2 -0
- package/dist/shared/config/resolverCache.d.ts +12 -0
- package/dist/shared/config/resolverSections.d.ts +12 -0
- package/dist/shared/config/runtimeSurface.d.ts +21 -0
- package/dist/shared/config/schemas.d.ts +12 -0
- package/dist/shared/config/types.d.ts +100 -0
- package/dist/shared/config/validator.d.ts +2 -0
- package/dist/shared/credentials/constants.d.ts +2 -0
- package/dist/shared/credentials/credentialCache.d.ts +13 -0
- package/dist/shared/credentials/credentialEncryption.d.ts +10 -0
- package/dist/shared/credentials/credentialUtils.d.ts +4 -0
- package/dist/shared/credentials/envTokens.d.ts +9 -0
- package/dist/shared/credentials/ghCli.d.ts +1 -0
- package/dist/shared/credentials/index.d.ts +3 -0
- package/dist/shared/credentials/index.js +9 -0
- package/dist/shared/credentials/schemas.d.ts +22 -0
- package/dist/shared/credentials/storage.d.ts +30 -0
- package/dist/shared/credentials/testing.d.ts +2 -0
- package/dist/shared/credentials/testing.js +8 -0
- package/dist/shared/credentials/tokenRefresh.d.ts +24 -0
- package/dist/shared/credentials/tokenResolution.d.ts +30 -0
- package/dist/shared/credentials/types.d.ts +28 -0
- package/dist/shared/fs-utils.d.ts +2 -0
- package/dist/shared/fs-utils.js +8 -0
- package/dist/shared/index.d.ts +7 -0
- package/dist/shared/logger/index.d.ts +2 -0
- package/dist/shared/logger/logger.d.ts +17 -0
- package/dist/shared/paths.d.ts +33 -0
- package/dist/shared/paths.js +8 -0
- package/dist/shared/platform/index.d.ts +1 -0
- package/dist/shared/platform/index.js +8 -0
- package/dist/shared/platform/platform.d.ts +8 -0
- package/dist/shared/session/index.d.ts +5 -0
- package/dist/shared/session/index.js +9 -0
- package/dist/shared/session/schemas.d.ts +103 -0
- package/dist/shared/session/sessionCache.d.ts +9 -0
- package/dist/shared/session/sessionDiskIO.d.ts +6 -0
- package/dist/shared/session/statsDefaults.d.ts +4 -0
- package/dist/shared/session/storage.d.ts +20 -0
- package/dist/shared/session/types.d.ts +53 -0
- package/dist/tools/github_clone_repo/cache.d.ts +4 -0
- package/dist/tools/github_clone_repo/scheme.d.ts +56 -9
- package/dist/tools/github_clone_repo/types.d.ts +1 -1
- package/dist/tools/github_fetch_content/scheme.d.ts +8 -4
- package/dist/tools/github_fetch_content/types.d.ts +12 -0
- package/dist/tools/github_search_code/scheme.d.ts +6 -6
- package/dist/tools/github_search_pull_requests/contentResponse.d.ts +0 -1
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -11
- package/dist/tools/github_search_pull_requests/scheme.d.ts +6 -2
- package/dist/tools/github_search_repos/scheme.d.ts +7 -6
- package/dist/tools/github_view_repo_structure/execution.d.ts +0 -9
- package/dist/tools/github_view_repo_structure/scheme.d.ts +10 -6
- package/dist/tools/local_binary_inspect/archiveOps.d.ts +2 -0
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +48 -7
- package/dist/tools/local_binary_inspect/binaryOps.d.ts +16 -7
- package/dist/tools/local_binary_inspect/scheme.d.ts +10 -7
- package/dist/tools/local_fetch_content/scheme.d.ts +2 -2
- package/dist/tools/local_find_files/scheme.d.ts +2 -2
- package/dist/tools/local_ripgrep/lspBoost.d.ts +54 -0
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +113 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +10 -1
- package/dist/tools/local_ripgrep/scheme.d.ts +29 -4
- package/dist/tools/local_ripgrep/structuralSearch.d.ts +3 -4
- package/dist/tools/local_view_structure/scheme.d.ts +2 -2
- package/dist/tools/local_view_structure/structureFilters.d.ts +1 -3
- package/dist/tools/local_view_structure/structureResponse.d.ts +1 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -8
- package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +2 -2
- package/dist/tools/lsp/shared/semanticTypes.d.ts +2 -1
- package/dist/tools/package_search/scheme.d.ts +9 -7
- package/dist/tools/providerMappers.d.ts +19 -0
- package/dist/tools/toolMetadata/proxies.d.ts +0 -6
- package/dist/tools/utils.d.ts +3 -7
- package/dist/types/bulk.d.ts +0 -2
- package/dist/types/execution.d.ts +1 -2
- package/dist/types/toolResults.d.ts +2 -3
- package/dist/utils/contextUtils.d.ts +35 -2
- package/dist/utils/core/lines.d.ts +16 -0
- package/dist/utils/core/types.d.ts +10 -0
- package/dist/utils/file/filters.d.ts +2 -11
- package/dist/utils/parsers/diff.d.ts +18 -0
- package/dist/utils/ranking/evidenceRanker.d.ts +86 -0
- package/dist/utils/response/error.d.ts +38 -4
- package/dist/utils/response/groupedFinalizer.d.ts +0 -2
- package/package.json +43 -14
- package/dist/commands/RipgrepCommandBuilder.d.ts +0 -27
- package/dist/hints/dynamic.d.ts +0 -6
- package/dist/hints/index.d.ts +0 -2
- package/dist/hints/types.d.ts +0 -1
- package/dist/tools/github_clone_repo/hints.d.ts +0 -2
- package/dist/tools/github_fetch_content/hints.d.ts +0 -2
- package/dist/tools/github_search_code/hints.d.ts +0 -2
- package/dist/tools/github_search_pull_requests/hints.d.ts +0 -2
- package/dist/tools/github_search_repos/hints.d.ts +0 -2
- package/dist/tools/github_view_repo_structure/hints.d.ts +0 -2
- package/dist/tools/local_fetch_content/hints.d.ts +0 -2
- package/dist/tools/local_find_files/hints.d.ts +0 -2
- package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +0 -3
- package/dist/tools/local_ripgrep/hints.d.ts +0 -2
- package/dist/tools/local_ripgrep/ripgrepParser.d.ts +0 -9
- package/dist/tools/local_view_structure/hints.d.ts +0 -2
- package/dist/tools/local_view_structure/structureParser.d.ts +0 -3
- package/dist/tools/local_view_structure/structureWalker.d.ts +0 -24
- package/dist/tools/lsp/semantic_content/hints.d.ts +0 -4
- package/dist/tools/package_search/hints.d.ts +0 -2
- package/dist/types/metadata.d.ts +0 -69
- package/dist/utils/exec/commandAvailability.d.ts +0 -19
- package/dist/utils/exec/ripgrepBinary.d.ts +0 -3
package/README.md
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
# 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
|
+
[](https://octocode.ai)
|
|
9
|
+
[](https://www.youtube.com/@Octocode-ai)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
**Evidence-first code research for AI agents and developers.**
|
|
14
|
+
|
|
15
|
+
Octocode gives an agent the full context it needs to change, review, or explain code: real evidence from your **local workspace** and from **external** sources (GitHub repositories, pull requests, and npm packages). One toolset covers all of it: ripgrep and AST structural search, repository tree browsing, precise content fetching, LSP semantic navigation, and binary inspection.
|
|
16
|
+
|
|
17
|
+
Run it as a **CLI** or an **MCP server**. A **Rust engine** keeps every call fast and token-efficient, minifying and skeletonizing code so an agent reads the shape of a file instead of every byte, from a single file to a mega-repo. It is also the best tool for **cross-repository research and exploration across millions of repositories**.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Table of Contents
|
|
22
|
+
|
|
23
|
+
- [Why Octocode](#why-octocode)
|
|
24
|
+
- [Tools](#tools)
|
|
25
|
+
- [MCP](#mcp)
|
|
26
|
+
- [CLI](#cli)
|
|
27
|
+
- [Configuration](#configuration)
|
|
28
|
+
- [Authentication Methods](#authentication-methods)
|
|
29
|
+
- [Security](#security)
|
|
30
|
+
- [Language Support](#language-support)
|
|
31
|
+
- [Skills](#skills)
|
|
32
|
+
- [Architecture](#architecture)
|
|
33
|
+
- [Documentation](#documentation)
|
|
34
|
+
- [Contributing](#contributing)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Why Octocode
|
|
39
|
+
|
|
40
|
+
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.*
|
|
41
|
+
|
|
42
|
+
Most tools cover one slice: searching the web, or grepping your repo. Octocode covers the **whole research flow, end to end**:
|
|
43
|
+
|
|
44
|
+
- **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.
|
|
45
|
+
- **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.
|
|
46
|
+
- **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.
|
|
47
|
+
- **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.
|
|
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
|
+
- **Safe by default.** Every byte returned to the model is scanned and secrets redacted first (see [Security](#security)).
|
|
50
|
+
|
|
51
|
+
### Get Started
|
|
52
|
+
|
|
53
|
+
Add Octocode to an AI assistant with MCP, or run the same tools directly from
|
|
54
|
+
your terminal with the CLI.
|
|
55
|
+
|
|
56
|
+
**MCP fast install:**
|
|
57
|
+
|
|
58
|
+
[<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)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Interactive installer for Cursor, Claude Code, Codex, VS Code, and more
|
|
62
|
+
npx octocode install
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**CLI fast install:**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Run without installing globally
|
|
69
|
+
npx octocode
|
|
70
|
+
|
|
71
|
+
# Or install once on macOS/Linux
|
|
72
|
+
brew install bgauryy/octocode/octocode
|
|
73
|
+
octocode
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Authenticate GitHub when you want private repositories or higher API limits:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx octocode auth login
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Benchmarks
|
|
83
|
+
|
|
84
|
+
Latest benchmark output:
|
|
85
|
+
[packages/octocode-benchmark/output](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/output/).
|
|
86
|
+
|
|
87
|
+
#### ast-grep Structural Comparison
|
|
88
|
+
|
|
89
|
+
Bars show relative throughput. Higher is better; lower `ms` is better.
|
|
90
|
+
|
|
91
|
+
What we tested: ast-grep CLI and Octocode structural grep on the same real
|
|
92
|
+
repository files, using the same broad AST node-kind searches
|
|
93
|
+
(`call_expression`, `call`, `method_invocation`). The goal was to check
|
|
94
|
+
structural AST grep compatibility by match count, then measure where time is
|
|
95
|
+
spent across Octocode's raw matcher, agent tool path, and public CLI.
|
|
96
|
+
|
|
97
|
+
This benchmark does not test text grep, LSP navigation, rewriting, or the full
|
|
98
|
+
ast-grep rule language. Those are separate capabilities.
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
Octocode raw native ████████████████████ 5.0 ms median │ 3.0x faster │ 6/6 matched
|
|
102
|
+
ast-grep CLI ███████░░░░░░░░░░░░░ 15.1 ms median │ baseline │ 6/6 matched
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`Octocode raw native` means the direct Rust/NAPI `structuralSearchFiles`
|
|
106
|
+
matcher: parse and match only, with no tool validation, sanitizer, pagination,
|
|
107
|
+
JSON shaping, or Node CLI startup. The agent-facing `localSearchCode` and public
|
|
108
|
+
`octocode grep` paths are intentionally slower because they include those safety
|
|
109
|
+
and DX layers.
|
|
110
|
+
|
|
111
|
+
What was checked: we took ast-grep's benchmark scenario repo list, picked one
|
|
112
|
+
deterministic file from each supported repo, asked both tools to find the same
|
|
113
|
+
AST node kind in that file, verified identical match counts, then timed the
|
|
114
|
+
median run.
|
|
115
|
+
|
|
116
|
+
Benchmark files:
|
|
117
|
+
[runner](https://github.com/bgauryy/octocode/blob/main/packages/octocode-benchmark/benchmark/ast-grep/compare-upstream-scenarios.mjs) ·
|
|
118
|
+
[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)
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Tools
|
|
124
|
+
|
|
125
|
+
Octocode ships **13 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
|
+
|
|
127
|
+
**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
|
+
|
|
129
|
+
### GitHub Tools
|
|
130
|
+
|
|
131
|
+
| Tool | What it does | Knob |
|
|
132
|
+
|------|--------------|------|
|
|
133
|
+
| `ghSearchCode` | Code and path search across GitHub by owner, repo, path, filename, extension, and match filters. Accepts 1 to 5 parallel queries. | `concise` |
|
|
134
|
+
| `ghGetFileContent` | Read a GitHub file or region: full file, line range, match slice, or paginated chars. | `minify` |
|
|
135
|
+
| `ghViewRepoStructure` | Browse a GitHub repository's directory tree before reading files. | |
|
|
136
|
+
| `ghSearchRepos` | Discover repositories by keywords, owner, topic, language, stars, forks, size, dates, license, visibility. | `concise` |
|
|
137
|
+
| `ghHistoryResearch` | Search PR history, or deep-read one PR: files, patches, comments, reviews, commits. | `concise` |
|
|
138
|
+
| `ghCloneRepo` | Clone a repo or sparse subtree into the local cache for local/LSP analysis. **Opt-in** (`ENABLE_CLONE=true`). | `sparsePath` |
|
|
139
|
+
|
|
140
|
+
### Local Tools
|
|
141
|
+
|
|
142
|
+
| Tool | What it does | Knob |
|
|
143
|
+
|------|--------------|------|
|
|
144
|
+
| `localSearchCode` | Local code/text search returning file and line anchors. `mode:"structural"` runs Octocode AST shape queries (`pattern` or `rule`). | `mode` |
|
|
145
|
+
| `localViewStructure` | Browse a local directory tree: depth, filters, pagination, metadata. | `concise` |
|
|
146
|
+
| `localFindFiles` | Find local files and directories by name, path, regex, extension, size, time, permissions, type. | |
|
|
147
|
+
| `localGetFileContent` | Read a local file or region: exact slice, match string, line range, or paginated chars. | `minify` |
|
|
148
|
+
| `localBinaryInspect` | Inspect archives, compressed streams, and native binaries: inspect (format/symbols/imports/deps), list, extract, decompress, strings. | |
|
|
149
|
+
|
|
150
|
+
### Package Search
|
|
151
|
+
|
|
152
|
+
| Tool | What it does | Knob |
|
|
153
|
+
|------|--------------|------|
|
|
154
|
+
| `npmSearch` | npm package lookup and keyword search; returns metadata and the source repository for GitHub handoff. | `concise` |
|
|
155
|
+
|
|
156
|
+
### LSP
|
|
157
|
+
|
|
158
|
+
| Tool | What it does |
|
|
159
|
+
|------|--------------|
|
|
160
|
+
| `lspGetSemantics` | Typed semantic navigation. Raw tools support `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `documentSymbols`, `typeDefinition`, and `implementation`. The CLI `lsp` shortcut is for symbol-anchored queries only; use `ls --symbols` for `documentSymbols`. Navigation runs through installed language servers (see the [LSP Tools Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LSP_TOOLS.md)). |
|
|
161
|
+
|
|
162
|
+
**Per-tool references** (full schemas, fields, and examples) live in **[`docs/mcp`](https://github.com/bgauryy/octocode/tree/main/docs/mcp)**:
|
|
163
|
+
- [GitHub Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/GITHUB_TOOLS.md)
|
|
164
|
+
- [Local Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LOCAL_TOOLS.md)
|
|
165
|
+
- [Binary Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/BINARY_TOOLS.md)
|
|
166
|
+
- [LSP Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LSP_TOOLS.md)
|
|
167
|
+
- [Tool Behavior Guide](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/TOOL_BEHAVIOR.md)
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## MCP
|
|
172
|
+
|
|
173
|
+
The MCP server exposes all 13 tools directly to your AI assistant over stdio. Install once; the assistant calls tools automatically.
|
|
174
|
+
|
|
175
|
+
### Install
|
|
176
|
+
|
|
177
|
+
**Fast install:**
|
|
178
|
+
|
|
179
|
+
[<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)
|
|
180
|
+
|
|
181
|
+
**Or use the installer (detects your installed clients):**
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Interactive: detects your installed clients
|
|
185
|
+
npx octocode install
|
|
186
|
+
|
|
187
|
+
# Non-interactive
|
|
188
|
+
octocode install --ide cursor
|
|
189
|
+
octocode install --ide claude-code
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
https://github.com/user-attachments/assets/de8d14c0-2ead-46ed-895e-09144c9b5071
|
|
193
|
+
|
|
194
|
+
### Manual Configuration
|
|
195
|
+
|
|
196
|
+
Add to your MCP client config file:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"mcpServers": {
|
|
201
|
+
"octocode": {
|
|
202
|
+
"command": "npx",
|
|
203
|
+
"args": ["octocode-mcp@latest"]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
For GitHub auth, add a token under `env` (see [Authentication Methods](#authentication-methods)).
|
|
210
|
+
|
|
211
|
+
### Configuration
|
|
212
|
+
|
|
213
|
+
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.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## CLI
|
|
218
|
+
|
|
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.
|
|
220
|
+
|
|
221
|
+
### Install
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
brew install bgauryy/octocode/octocode
|
|
225
|
+
# or
|
|
226
|
+
npm install -g octocode
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
octocode login
|
|
231
|
+
octocode status
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### All Commands
|
|
235
|
+
|
|
236
|
+
Local paths route to local tools; `owner/repo[/path]` targets route to GitHub tools.
|
|
237
|
+
|
|
238
|
+
| Command | Use it for |
|
|
239
|
+
|---------|------------|
|
|
240
|
+
| `octocode ls <path\|owner/repo>` | Browse local or GitHub structure; a file or `--symbols` shows a symbol outline |
|
|
241
|
+
| `octocode cat <path\|owner/repo/path>` | Read a file, symbol skeleton (`--mode symbols`), line range, or matched slice |
|
|
242
|
+
| `octocode grep <term> <path\|owner/repo>` | Text/regex search, or AST structural search with `--pattern` / `--rule` (local). `--type` accepts extensions and language aliases such as `ts`, `rust`, `typescript`, and `*.rs`. |
|
|
243
|
+
| `octocode find <query> [path\|owner/repo]` | Find files by name, path, metadata, or content |
|
|
244
|
+
| `octocode lsp <file> --type <type> --symbol <name> --line <n>` | Trace `definition`, `references`, `callers`, `callees`, `callHierarchy`, `hover`, `typeDefinition`, and `implementation`; use `ls --symbols` for file outlines |
|
|
245
|
+
| `octocode pr <owner/repo[#N]\|PR-URL>` | Search or deep-read pull requests |
|
|
246
|
+
| `octocode history <owner/repo[/path]>` | Inspect commit history for a repo, directory, or file |
|
|
247
|
+
| `octocode repo <keywords...>` | Discover GitHub repositories |
|
|
248
|
+
| `octocode pkg <package\|keywords>` | Search npm and hand off to source repositories |
|
|
249
|
+
| `octocode binary <file>` | Inspect archives, compressed files, and native binaries |
|
|
250
|
+
| `octocode unzip <archive>` | Unpack an archive to `<octocode-home>/tmp/unzip/<name>-<timestamp>/`, then use local `ls`, `grep`, `cat`, and `lsp` |
|
|
251
|
+
| `octocode clone <owner/repo[/path][@branch]>` | Clone a repo or subtree to `<octocode-home>/tmp/clone/` for local/LSP analysis (`ENABLE_CLONE=true`) |
|
|
252
|
+
| `octocode tools` | List tools, read schemas, or run any MCP tool directly from the terminal |
|
|
253
|
+
| `octocode context` | Print agent-facing protocol, system prompt, tool descriptions, and schemas |
|
|
254
|
+
| `octocode install` | Configure Octocode in MCP clients |
|
|
255
|
+
| `octocode auth` | Manage GitHub authentication with `login`, `logout`, or `refresh` |
|
|
256
|
+
| `octocode login` / `octocode logout` | Sign in or clear stored GitHub credentials |
|
|
257
|
+
| `octocode status` | Check token presence, auth identity, MCP installs, sync state, and cache paths |
|
|
258
|
+
|
|
259
|
+
Full command syntax, flags, examples, and exit codes live in the [CLI Reference](https://github.com/bgauryy/octocode/blob/main/docs/cli/REFERENCE.md).
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Configuration
|
|
264
|
+
|
|
265
|
+
Everything is optional; Octocode runs on sensible defaults. Settings resolve from three sources, in priority order:
|
|
266
|
+
|
|
267
|
+
```text
|
|
268
|
+
environment variables > <octocode-home>/.octocoderc > built-in defaults
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
1. **MCP / environment variables** (highest): per client or per project, set in your MCP config `env` or your shell.
|
|
272
|
+
2. **Global config**: `<octocode-home>/.octocoderc`, machine-wide defaults read by **both the CLI and the MCP server**.
|
|
273
|
+
3. **Built-in defaults**: used when neither is set.
|
|
274
|
+
|
|
275
|
+
**Octocode home** (`<octocode-home>`) holds the global config, encrypted credentials, sessions, stats, logs, and tmp materialization caches. Its location is fixed per platform (there is no override):
|
|
276
|
+
|
|
277
|
+
| Platform | Location |
|
|
278
|
+
|----------|----------|
|
|
279
|
+
| macOS | `~/.octocode` |
|
|
280
|
+
| Linux | `${XDG_CONFIG_HOME:-~/.config}/.octocode` |
|
|
281
|
+
| Windows | `%APPDATA%\.octocode` |
|
|
282
|
+
|
|
283
|
+
**Set in MCP** (env entries; these win over `.octocoderc`):
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"mcpServers": {
|
|
288
|
+
"octocode": {
|
|
289
|
+
"command": "npx",
|
|
290
|
+
"args": ["octocode-mcp@latest"],
|
|
291
|
+
"env": {
|
|
292
|
+
"GITHUB_TOKEN": "ghp_xxxxxxxx",
|
|
293
|
+
"ENABLE_LOCAL": "true",
|
|
294
|
+
"ENABLE_CLONE": "false"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**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).
|
|
302
|
+
|
|
303
|
+
### Common settings
|
|
304
|
+
|
|
305
|
+
The **Scope** column shows where a setting applies: `Both`, or `MCP` (the CLI ignores it).
|
|
306
|
+
|
|
307
|
+
| Env var | `.octocoderc` key | Default | Scope | What it does |
|
|
308
|
+
|---------|-------------------|---------|-------|--------------|
|
|
309
|
+
| `OCTOCODE_TOKEN` / `GH_TOKEN` / `GITHUB_TOKEN` | env only | unset | Both | GitHub token, in priority order. Tokens stay in env, never in `.octocoderc`. |
|
|
310
|
+
| `GITHUB_API_URL` | `github.apiUrl` | `https://api.github.com` | Both | API endpoint; use `/api/v3` for GitHub Enterprise. |
|
|
311
|
+
| `ENABLE_LOCAL` | `local.enabled` | CLI `true`, MCP `false` | Both | Turns local filesystem + LSP tools on/off. |
|
|
312
|
+
| `ENABLE_CLONE` | `local.enableClone` | CLI `true`, MCP `false` | Both | `ghCloneRepo` and directory fetch. Default differs by surface; set `false` to disable in either. |
|
|
313
|
+
| `WORKSPACE_ROOT` | `local.workspaceRoot` | `cwd` | Both | Absolute root for resolving relative local paths. |
|
|
314
|
+
| `ALLOWED_PATHS` | `local.allowedPaths` | `[]` | Both | Extra path allowlist for local access; empty means home directory only after validation. |
|
|
315
|
+
| `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. |
|
|
316
|
+
| `REQUEST_TIMEOUT` | `network.timeout` | `30000` | Both | Request timeout in ms (clamped `5000..300000`). |
|
|
317
|
+
| `MAX_RETRIES` | `network.maxRetries` | `3` | Both | Retry attempts (clamped `0..10`). |
|
|
318
|
+
| `OCTOCODE_OUTPUT_FORMAT` | `output.format` | `yaml` | Both | Response format: `yaml` or `json`. |
|
|
319
|
+
|
|
320
|
+
> **Local and clone defaults differ by surface.** The **CLI** honors `ENABLE_LOCAL` and defaults local tools on; clone is enabled by default. The **MCP server** honors `ENABLE_LOCAL` and defaults local tools and clone off, so a deployment can control what an assistant may touch. Explicit env or `.octocoderc` values override those defaults.
|
|
321
|
+
|
|
322
|
+
### Example `.octocoderc`
|
|
323
|
+
|
|
324
|
+
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`).
|
|
325
|
+
|
|
326
|
+
```jsonc
|
|
327
|
+
{
|
|
328
|
+
// GitHub Enterprise users: point at your API endpoint.
|
|
329
|
+
"github": { "apiUrl": "https://api.github.com" },
|
|
330
|
+
|
|
331
|
+
"local": {
|
|
332
|
+
"enabled": true, // overrides the surface default for CLI and MCP
|
|
333
|
+
"enableClone": false, // false disables ghCloneRepo for CLI and MCP
|
|
334
|
+
"workspaceRoot": "~/code", // base for relative local paths (absolute or ~)
|
|
335
|
+
"allowedPaths": [] // extra dirs the local tools may read
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
"network": { "timeout": 30000, "maxRetries": 3 },
|
|
339
|
+
|
|
340
|
+
"output": { "format": "yaml" } // "yaml" or "json"
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
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).
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Authentication Methods
|
|
349
|
+
|
|
350
|
+
GitHub-backed tools require authentication. Pick whichever method fits your setup; any one is enough. Full details: [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/mcp/AUTHENTICATION.md).
|
|
351
|
+
|
|
352
|
+
### Option 1: Octocode CLI (Recommended)
|
|
353
|
+
|
|
354
|
+
The simplest setup. Octocode stores OAuth credentials encrypted on disk.
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
npx octocode auth login # or: octocode login
|
|
358
|
+
npx octocode status # verify the active token source
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Option 2: GitHub CLI
|
|
362
|
+
|
|
363
|
+
Use your existing `gh` credentials: automatic token management, works with 2FA and SSO.
|
|
364
|
+
|
|
365
|
+
```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
|
+
gh auth login
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
No `GITHUB_TOKEN` is needed; Octocode reads the `gh` token automatically.
|
|
375
|
+
|
|
376
|
+
### Option 3: Personal Access Token
|
|
377
|
+
|
|
378
|
+
Best for CI/CD, automation, MCP client configs, or GitHub Enterprise.
|
|
379
|
+
|
|
380
|
+
1. Create a token at [github.com/settings/tokens](https://github.com/settings/tokens)
|
|
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
|
+
```
|
|
397
|
+
|
|
398
|
+
> **Security tip**: Never commit tokens to version control. Use environment variables or secure secret management.
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Security
|
|
403
|
+
|
|
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 or logs. The same enforcement runs identically under MCP and the CLI.
|
|
405
|
+
|
|
406
|
+
- **Secret redaction, in and out.** 270+ 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 `Secrets detected and redacted` warning so the agent knows.
|
|
407
|
+
- **Content sanitized at the source.** Local reads (`localGetFileContent`, ripgrep, structural search, binary, find, structure) and external fetches (GitHub code/files, npm) are scanned as they are read, not only at the boundary.
|
|
408
|
+
- **Path safety.** Local reads are bounded to `WORKSPACE_ROOT` and `ALLOWED_PATHS` (default: your home directory). Symlinks are resolved and the real target is **re-validated** against the same rules, so a link cannot escape into a blocked location. Every local tool runs this check before touching the filesystem.
|
|
409
|
+
- **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
|
+
- **Keys and certs:** `*.pem`, `*.key`, `*.crt`/`*.cer`/`*.csr`, `*.p12`/`*.pfx`/`*.jks`/`*.keystore`, and SSH keys (`id_rsa`, `*_ed25519`, `authorized_keys`, `known_hosts`, `.ssh/`).
|
|
411
|
+
- **Credentials and tokens:** `.env` / `.env.*`, `.netrc`, `.npmrc`, `.pgpass`, `.git-credentials`, `*_token` / `.token`, `client_secret*.json`, `*service-account*.json`, `auth.json`, `.htpasswd`.
|
|
412
|
+
- **Cloud and infra:** `.aws/`, `.azure/`, `.config/gcloud/`, `.kube/` / `kubeconfig`, `.docker/`, `.terraform/` and `*.tfstate`.
|
|
413
|
+
- **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.** Local execution is whitelisted to `rg`, `find`, and `ls` via `spawn` with argument arrays: no shell strings, no injection.
|
|
415
|
+
- **Schema validation** runs before any tool executes; untrusted input size and shape are bounded.
|
|
416
|
+
- **Credentials.** GitHub auth via env tokens, AES-256-GCM-encrypted on-disk OAuth, or the `gh` CLI; tokens are never logged.
|
|
417
|
+
|
|
418
|
+
**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/mcp/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)
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## Language Support
|
|
423
|
+
|
|
424
|
+
Four code-intelligence axes; three are native to the Rust engine and need no external tooling:
|
|
425
|
+
|
|
426
|
+
| Axis | What it does | How to use it |
|
|
427
|
+
|------|--------------|---------------|
|
|
428
|
+
| **Structural AST** | Tree-sitter shape queries (`pattern` or YAML `rule`) across 33 grammars. | `localSearchCode mode:"structural"` · CLI `grep --pattern`/`--rule` |
|
|
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 `cat --mode symbols` |
|
|
430
|
+
| **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 `lsp` / `ls --symbols` |
|
|
432
|
+
|
|
433
|
+
📋 **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
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Skills
|
|
438
|
+
|
|
439
|
+
> [Agent Skills](https://agentskills.io/what-are-skills) are a lightweight, open format for extending AI agent capabilities.
|
|
440
|
+
> 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
|
+
|
|
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.
|
|
443
|
+
|
|
444
|
+
| Skill | What it does |
|
|
445
|
+
|-------|--------------|
|
|
446
|
+
| ⭐ [**Engineer**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-engineer) | Codebase understanding, implementation, bug investigation, refactors, PR review, and RFC validation with AST + LSP evidence |
|
|
447
|
+
| [**Research**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-research) | Deep code exploration with HTTP-based tool orchestration: trace flow, find usages, understand a codebase |
|
|
448
|
+
| [**Brainstorming**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-brainstorming) | Validate ideas against GitHub, npm, and web evidence; produces a decision-ready brief |
|
|
449
|
+
| [**RFC Generator**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-rfc-generator) | Evidence-backed RFCs, design docs, migration and implementation plans before coding |
|
|
450
|
+
| [**Install**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-install) | Interactive step-by-step Octocode installer for macOS and Windows |
|
|
451
|
+
| [**Search Skill**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-search-skill) | Find, evaluate, install, rate, and refactor Agent Skills (SKILL.md format) |
|
|
452
|
+
| [**Stats**](https://www.skills.sh/bgauryy/octocode-mcp/octocode-stats) | Render an Octocode MCP usage dashboard from stats.json (tokens saved, cache hits, errors) |
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## Architecture
|
|
457
|
+
|
|
458
|
+
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.
|
|
459
|
+
|
|
460
|
+
```mermaid
|
|
461
|
+
graph LR
|
|
462
|
+
CLI["octocode<br/>CLI"]
|
|
463
|
+
MCP["octocode-mcp<br/>MCP server, stdio"]
|
|
464
|
+
VSC["VS Code extension<br/>OAuth + install"]
|
|
465
|
+
CORE["octocode-tools-core<br/>tools, GitHub client, auth, pagination, security bridge"]
|
|
466
|
+
ENGINE["octocode-engine (Rust)<br/>secrets, minify, AST, signatures, ripgrep/diff/YAML, LSP"]
|
|
467
|
+
EXT["GitHub API, local FS + ripgrep, language servers"]
|
|
468
|
+
|
|
469
|
+
CLI --> CORE
|
|
470
|
+
MCP --> CORE
|
|
471
|
+
VSC -. starts .-> MCP
|
|
472
|
+
CORE --> ENGINE
|
|
473
|
+
CORE --> EXT
|
|
474
|
+
ENGINE --> EXT
|
|
475
|
+
|
|
476
|
+
style ENGINE fill:#1a1a2e,stroke:#e75d2a,color:#fff
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Request flow** is identical whether a call arrives over MCP or the CLI:
|
|
480
|
+
|
|
481
|
+
```text
|
|
482
|
+
client → sanitize inputs (Rust) → run tool (GitHub / FS / LSP) → sanitize + YAML-serialize + paginate (Rust) → result + next-step hints
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
**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.
|
|
486
|
+
|
|
487
|
+
### Packages
|
|
488
|
+
|
|
489
|
+
| Directory | npm package | Role |
|
|
490
|
+
|-----------|-------------|------|
|
|
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. |
|
|
492
|
+
| [`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
|
+
| [`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
|
+
| [`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. |
|
|
495
|
+
| [`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. |
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Documentation
|
|
500
|
+
|
|
501
|
+
Website: **[octocode.ai](https://octocode.ai)** · Full 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)**. All monorepo documentation lives in [`docs/`](https://github.com/bgauryy/octocode/tree/main/docs) (no per-package `docs/`).
|
|
502
|
+
|
|
503
|
+
**Docs map**
|
|
504
|
+
- [`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, benchmarks
|
|
506
|
+
- [`docs/`](https://github.com/bgauryy/octocode/tree/main/docs): guides for development, security, skills, Pi setup
|
|
507
|
+
|
|
508
|
+
**Setup**
|
|
509
|
+
- [Authentication Setup](https://github.com/bgauryy/octocode/blob/main/docs/mcp/AUTHENTICATION.md)
|
|
510
|
+
- [Configuration Reference](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CONFIGURATION.md)
|
|
511
|
+
- [Using octocode-mcp with Pi](https://github.com/bgauryy/octocode/blob/main/docs/PI/PI_SETUP_GUIDE.md)
|
|
512
|
+
|
|
513
|
+
**Tool References**
|
|
514
|
+
- [GitHub Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/GITHUB_TOOLS.md)
|
|
515
|
+
- [Local Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LOCAL_TOOLS.md)
|
|
516
|
+
- [LSP Tools](https://github.com/bgauryy/octocode/blob/main/docs/mcp/tools/LSP_TOOLS.md)
|
|
517
|
+
- [Clone & Local Workflow](https://github.com/bgauryy/octocode/blob/main/docs/mcp/CLONE_WORKFLOW.md)
|
|
518
|
+
|
|
519
|
+
**Security, CLI & Skills**
|
|
520
|
+
- [Security Model](https://github.com/bgauryy/octocode/blob/main/docs/SECURITY.md)
|
|
521
|
+
- [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) · [Skills Index](https://github.com/bgauryy/octocode/blob/main/skills/README.md)
|
|
523
|
+
|
|
524
|
+
**Shared Internals**
|
|
525
|
+
- [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
|
+
|
|
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
|
+
### Recommended dev mode: Pi + Octocode
|
|
531
|
+
|
|
532
|
+
[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:
|
|
533
|
+
|
|
534
|
+
- **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
|
+
|
|
536
|
+
```bash
|
|
537
|
+
npx -y degit bgauryy/octocode/skills/octocode-engineer ~/.pi/agent/skills/octocode-engineer
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
- **Adapter route — full tool surface.** Install [`pi-mcp-adapter`](https://github.com/nicobailon/pi-mcp-adapter) to expose all 13 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
|
+
|
|
542
|
+
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
|
+
|
|
544
|
+
### The Manifest
|
|
545
|
+
|
|
546
|
+
**"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/config.d.ts
CHANGED
|
@@ -14,3 +14,10 @@ export declare const MAX_CONTEXT_LINES = 100;
|
|
|
14
14
|
export declare const MAX_CHAR_LENGTH = 50000;
|
|
15
15
|
export declare const GITHUB_FILE_CONTENT_DEFAULT_CHAR_LENGTH = 8000;
|
|
16
16
|
export declare const MAX_MATCH_CONTENT_LENGTH = 100000;
|
|
17
|
+
/**
|
|
18
|
+
* Default per-match snippet length (Unicode scalars). Mirrors the Rust engine's
|
|
19
|
+
* `DEFAULT_MAX_SNIPPET_CHARS` so GitHub code-search fragments are bounded by the
|
|
20
|
+
* same rule that bounds local ripgrep snippets — char-safe truncation with `...`.
|
|
21
|
+
* The render layer must not re-truncate; this is the single data-layer bound.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_MATCH_SNIPPET_CHARS = 500;
|