octocode-cli 1.5.1 → 1.5.3
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 +28 -9
- package/out/chunks/chunk-375ZNU3A.js +317 -0
- package/out/chunks/{chunk-V64AXUWB.js → chunk-AYILFPX4.js} +1 -1
- package/out/chunks/chunk-BRHVQB64.js +10 -0
- package/out/chunks/{command-help-specs-JZXVSLZ5.js → chunk-KWJUBVXJ.js} +1 -1
- package/out/chunks/chunk-OMXWZJBJ.js +100 -0
- package/out/chunks/command-help-specs-RVJK6V6M.js +8 -0
- package/out/chunks/commands-JFDCC4Q7.js +8 -0
- package/out/chunks/{help-P7TCOYAJ.js → help-H3WGUJO7.js} +1 -1
- package/out/chunks/main-help-BUTDD4IR.js +10 -0
- package/out/chunks/{spinner-URV2OX6O.js → spinner-DXD4JQIU.js} +1 -1
- package/out/chunks/tool-command-L6PVHUNS.js +8 -0
- package/out/octocode-cli.js +1 -1
- package/package.json +2 -2
- package/skills/octocode-brainstorming/scripts/tavily-search.mjs +1 -10
- package/skills/octocode-chrome-devtools/scripts/cdp-runner.mjs +0 -2
- package/skills/octocode-chrome-devtools/scripts/cdp-sandbox.mjs +1 -5
- package/skills/octocode-chrome-devtools/scripts/cdp-template.mjs +1 -10
- package/skills/octocode-chrome-devtools/scripts/open-browser.mjs +0 -3
- package/skills/octocode-chrome-devtools/scripts/sourcemap-resolver.mjs +1 -4
- package/skills/octocode-chrome-devtools/scripts/undercover.mjs +0 -2
- package/skills/octocode-engineer/SKILL.md +7 -33
- package/skills/octocode-engineer/references/cli-reference.md +5 -11
- package/skills/octocode-engineer/references/externals.md +0 -4
- package/skills/octocode-engineer/references/quality-indicators.md +10 -50
- package/skills/octocode-engineer/references/tool-workflows.md +10 -13
- package/skills/octocode-engineer/src/analysis/dependency-summary.test.ts +2 -2
- package/skills/octocode-engineer/src/ast/metrics.test.ts +2 -2
- package/skills/octocode-engineer/src/ast/search-main.ts +2 -15
- package/skills/octocode-engineer/src/ast/search.ts +1 -7
- package/skills/octocode-engineer/src/ast/tree-sitter.test.ts +4 -4
- package/skills/octocode-engineer/src/ast/tree-sitter.ts +2 -2
- package/skills/octocode-engineer/src/collectors/chains.ts +3 -10
- package/skills/octocode-engineer/src/collectors/prototype-pollution.ts +3 -3
- package/skills/octocode-engineer/src/collectors/security.ts +3 -3
- package/skills/octocode-engineer/src/common/ensure-deps.ts +3 -20
- package/skills/octocode-engineer/src/detectors/code-quality.ts +0 -1
- package/skills/octocode-engineer/src/index.test.ts +1 -1
- package/skills/octocode-engineer/src/index.ts +1 -11
- package/skills/octocode-engineer/src/pipeline/affected.ts +2 -7
- package/skills/octocode-engineer/src/pipeline/baseline.ts +2 -8
- package/skills/octocode-engineer/src/pipeline/cache.ts +2 -2
- package/skills/octocode-engineer/src/pipeline/config-loader.test.ts +1 -2
- package/skills/octocode-engineer/src/pipeline/config-loader.ts +0 -9
- package/skills/octocode-engineer/src/pipeline/create-options.ts +2 -15
- package/skills/octocode-engineer/src/pipeline/reporters.ts +2 -12
- package/skills/octocode-engineer/src/reporting/summary-md.test.ts +2 -2
- package/skills/octocode-engineer/src/run.ts +1 -7
- package/skills/octocode-engineer/src/types/constants.ts +0 -5
- package/skills/octocode-engineer/src/types/core.ts +0 -5
- package/skills/octocode-news/eslint.config.mjs +1 -6
- package/skills/octocode-news/src/rss-core.ts +2 -4
- package/skills/octocode-research/ecosystem.config.cjs +0 -31
- package/skills/octocode-research/package.json +1 -1
- package/skills/octocode-research/scripts/server.js +272 -230
- package/skills/octocode-research/src/__tests__/integration/circuitBreaker.test.ts +0 -24
- package/skills/octocode-research/src/__tests__/integration/routes.test.ts +0 -10
- package/skills/octocode-research/src/__tests__/integration/serverLifecycle.test.ts +5 -22
- package/skills/octocode-research/src/__tests__/integration/toolsRoutes.test.ts +0 -27
- package/skills/octocode-research/src/__tests__/unit/circuitBreaker.test.ts +0 -29
- package/skills/octocode-research/src/__tests__/unit/errorHandler.test.ts +1 -12
- package/skills/octocode-research/src/__tests__/unit/httpPreprocess.test.ts +1 -9
- package/skills/octocode-research/src/__tests__/unit/logger.test.ts +0 -7
- package/skills/octocode-research/src/__tests__/unit/queryParser.test.ts +1 -7
- package/skills/octocode-research/src/__tests__/unit/responseBuilder.test.ts +0 -11
- package/skills/octocode-research/src/__tests__/unit/retry.test.ts +1 -18
- package/skills/octocode-research/src/__tests__/unit/schemas.test.ts +2 -25
- package/skills/octocode-research/src/index.ts +0 -27
- package/skills/octocode-research/src/mcpCache.ts +3 -18
- package/skills/octocode-research/src/middleware/errorHandler.ts +1 -4
- package/skills/octocode-research/src/middleware/logger.ts +1 -6
- package/skills/octocode-research/src/middleware/queryParser.ts +3 -22
- package/skills/octocode-research/src/routes/github.ts +0 -11
- package/skills/octocode-research/src/routes/local.ts +0 -12
- package/skills/octocode-research/src/routes/lsp.ts +1 -10
- package/skills/octocode-research/src/routes/package.ts +0 -2
- package/skills/octocode-research/src/routes/prompts.ts +2 -32
- package/skills/octocode-research/src/routes/tools.ts +12 -177
- package/skills/octocode-research/src/server-init.ts +0 -32
- package/skills/octocode-research/src/server.ts +8 -37
- package/skills/octocode-research/src/types/errorGuards.ts +0 -15
- package/skills/octocode-research/src/types/guards.ts +6 -27
- package/skills/octocode-research/src/types/mcp.ts +1 -8
- package/skills/octocode-research/src/types/responses.ts +0 -15
- package/skills/octocode-research/src/utils/asyncTimeout.ts +1 -63
- package/skills/octocode-research/src/utils/circuitBreaker.ts +43 -166
- package/skills/octocode-research/src/utils/colors.ts +3 -17
- package/skills/octocode-research/src/utils/errorQueue.ts +6 -28
- package/skills/octocode-research/src/utils/logger.ts +11 -93
- package/skills/octocode-research/src/utils/resilience.ts +22 -77
- package/skills/octocode-research/src/utils/responseBuilder.ts +26 -78
- package/skills/octocode-research/src/utils/responseFactory.ts +0 -7
- package/skills/octocode-research/src/utils/responseParser.ts +11 -59
- package/skills/octocode-research/src/utils/retry.ts +12 -75
- package/skills/octocode-research/src/utils/routeFactory.ts +10 -61
- package/skills/octocode-research/src/utils/url.ts +0 -5
- package/skills/octocode-research/src/validation/httpPreprocess.ts +15 -61
- package/skills/octocode-research/src/validation/schemas.ts +14 -101
- package/skills/octocode-research/src/validation/toolCallSchema.ts +5 -65
- package/skills/octocode-research/tsdown.config.ts +2 -7
- package/skills/octocode-search-skill/SKILL.md +9 -2
- package/skills/octocode-search-skill/references/discovery-surfaces.md +2 -1
- package/skills/octocode-slides/scripts/navbridge.js +1 -14
- package/skills/octocode-slides/scripts/presenter.js +2 -61
- package/skills/octocode-stats/scripts/build_dashboard.mjs +1 -19
- package/out/chunks/chunk-7476PETK.js +0 -309
- package/out/chunks/chunk-OQBJTZWK.js +0 -60
- package/out/chunks/chunk-UCZCF3BQ.js +0 -9
- package/out/chunks/commands-XBFPLHSQ.js +0 -8
- package/out/chunks/main-help-ULF5PAQY.js +0 -10
- package/out/chunks/tool-command-M6VA7P2F.js +0 -8
- package/skills/octocode-research/AGENTS.md +0 -349
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __dirname_fn } from 'path';
|
|
5
|
-
const require = __createRequire(import.meta.url);
|
|
6
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{a as r}from"./chunk-V64AXUWB.js";var i=new Set;function e(){process.stdout.write("\x1B[?25h")}var o=!1;function l(){o||(o=!0,process.on("exit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("uncaughtException",n=>{e(),console.error("Uncaught exception:",n),process.exit(1)}))}var h=class{text;frames;i;timer;constructor(t=""){this.text=t,this.frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],this.i=0,this.timer=null}start(t,s=0){t&&(this.text=t),this.timer&&(clearInterval(this.timer),this.timer=null),l(),i.add(this),process.stdout.write("\x1B[?25l");let u=" ".repeat(s);return this.timer=setInterval(()=>{let c=this.frames[this.i++%this.frames.length];process.stdout.write(`\r${u}${r("cyan",c)} ${this.text}`)},80),this}clear(){return this.timer&&(clearInterval(this.timer),this.timer=null),i.delete(this),process.stdout.write("\r\x1B[2K"),process.stdout.write("\x1B[?25h"),this}stop(t="\u2713",s="green"){return this.timer&&(clearInterval(this.timer),this.timer=null),i.delete(this),process.stdout.write(`\r\x1B[2K${r(s,t)} ${this.text}
|
|
9
|
-
`),process.stdout.write("\x1B[?25h"),this}succeed(t){return t&&(this.text=t),this.stop("\u2713","green")}fail(t){return t&&(this.text=t),this.stop("\u2717","red")}info(t){return t&&(this.text=t),this.stop("\u2139","blue")}warn(t){return t&&(this.text=t),this.stop("\u26A0","yellow")}update(t){return this.text=t,this}};export{h as a};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __dirname_fn } from 'path';
|
|
5
|
-
const require = __createRequire(import.meta.url);
|
|
6
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-OQBJTZWK.js";import"./chunk-UCZCF3BQ.js";import"./chunk-CVNNNSMQ.js";import"./chunk-7476PETK.js";import"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";export{e as authCommand,h as cacheCommand,k as findCommand,a as installCommand,c as loginCommand,d as logoutCommand,g as mcpCommand,f as skillsCommand,i as statusCommand,j as syncCommand,b as tokenCommand};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __dirname_fn } from 'path';
|
|
5
|
-
const require = __createRequire(import.meta.url);
|
|
6
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{a as i,b as l,d as r}from"./chunk-7476PETK.js";import{a as o,b as e,c as t}from"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";function $(){let n=[];for(let c of i){let a=l.filter(s=>r(s.name)===c);if(a.length!==0){n.push(` ${t(c)}`);for(let s of a)n.push(` ${o("cyan",s.name)}`)}}return n}function d(){let n=$(),c=l.length,a=["",` ${o("magenta",e("\u{1F50D}\u{1F419} Octocode CLI"))}`,"",` ${e("USAGE")}`,` ${o("magenta","octocode")} <command> [options] ${t("manage Octocode")}`,` ${o("magenta","octocode")} tools ${t("list all tools")}`,` ${o("magenta","octocode")} tools <name> ${t("show input schema")}`,` ${o("magenta","octocode")} tools <n1> <n2> ... ${t("batch input schemas")}`,` ${o("magenta","octocode")} tools <name> --queries '<json>' ${t("run a tool")}`,` ${o("magenta","octocode")} instructions ${t("MCP instructions + all schemas")}`,"",` ${e("COMMANDS")} ${t("(manage Octocode configuration)")}`,` ${o("magenta","install")} Configure octocode-mcp for an IDE`,` ${o("magenta","auth")} Manage GitHub authentication`,` ${o("magenta","login / logout")} Sign in or out of GitHub`,` ${o("magenta","status / token")} Show auth status or print token`,` ${o("magenta","skills")} Install/remove bundled Octocode skills`,` ${o("magenta","mcp")} Manage MCP marketplace`,` ${o("magenta","sync")} Sync MCP configs across IDEs`,` ${o("magenta","cache")} Inspect and clean Octocode cache`,"",` ${e("TOOLS")} ${t(`(${c} tools \u2014 run directly from terminal)`)}`,...n,"",` ${e("OPTIONS")}`,` ${o("cyan","--json")} Raw JSON output`,` ${o("cyan","-h, --help")} Show this help`,` ${o("cyan","-v, --version")} Show version`,"",` ${e("EXAMPLES")}`,` ${o("yellow","octocode tools")} ${t("# list")}`,` ${o("yellow","octocode tools localSearchCode")} ${t("# schema")}`,` ${o("yellow","octocode tools localSearchCode githubSearchCode")} ${t("# batch schemas")}`,` ${o("yellow",`octocode tools localSearchCode --queries '{"path":".","pattern":"fn"}'`)} ${t("# run")}`,` ${o("yellow","octocode instructions")} ${t("# full context")}`,"",` ${o("yellow","octocode install --ide cursor")}`,` ${o("yellow","octocode skills install --targets claude-code,cursor")}`,"",o("magenta",` \u2500\u2500\u2500 \u{1F50D}\u{1F419} ${e("https://octocode.ai")} \u2500\u2500\u2500`),""];process.stdout.write(`${a.join(`
|
|
9
|
-
`)}
|
|
10
|
-
`)}export{d as showHelp};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __dirname_fn } from 'path';
|
|
5
|
-
const require = __createRequire(import.meta.url);
|
|
6
|
-
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-7476PETK.js";import"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";export{a as TOOL_CATEGORIES,b as TOOL_DEFINITIONS,k as executeToolCommand,c as findToolDefinition,e as getDisplayFields,d as getToolCategory,i as getToolsContextString,j as printToolsContext,f as showAvailableTools,h as showMultipleToolSchemas,g as showToolHelp,l as toolCommand};
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
# Octocode Research Skill - Agent Development Guide
|
|
2
|
-
|
|
3
|
-
> HTTP API server wrapping `octocode-mcp` tools for code research at `localhost:1987` by default (configurable via `OCTOCODE_RESEARCH_HOST` / `OCTOCODE_RESEARCH_PORT`)
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
| Attribute | Value |
|
|
8
|
-
|-----------|-------|
|
|
9
|
-
| **Type** | Express.js HTTP Server |
|
|
10
|
-
| **Host** | localhost (default) |
|
|
11
|
-
| **Port** | 1987 (default) |
|
|
12
|
-
| **Package** | `octocode-research` |
|
|
13
|
-
| **Version** | 2.0.0 |
|
|
14
|
-
| **Main Dependency** | `octocode-mcp` |
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Quick Commands
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# Development
|
|
22
|
-
npm run build # Bundle with tsdown
|
|
23
|
-
npm start # Run bundled server
|
|
24
|
-
npm run dev # Run with tsx watch mode
|
|
25
|
-
npm test # Run tests with Vitest
|
|
26
|
-
npm run test:watch # Watch mode testing
|
|
27
|
-
npm run lint # ESLint check
|
|
28
|
-
npm run lint:fix # Auto-fix lint issues
|
|
29
|
-
|
|
30
|
-
# Server Health Check
|
|
31
|
-
curl http://localhost:1987/health
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Project Structure
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
octocode-research/
|
|
40
|
-
├── src/
|
|
41
|
-
│ ├── server.ts # Express server entry point
|
|
42
|
-
│ ├── index.ts # Re-exports from octocode-mcp
|
|
43
|
-
│ ├── mcpCache.ts # MCP client caching
|
|
44
|
-
│ ├── routes/
|
|
45
|
-
│ │ ├── local.ts # Local tool handlers (used in tests)
|
|
46
|
-
│ │ ├── lsp.ts # LSP tool handlers (used in tests)
|
|
47
|
-
│ │ ├── github.ts # GitHub tool handlers (used in tests)
|
|
48
|
-
│ │ ├── package.ts # Package tool handlers (used in tests)
|
|
49
|
-
│ │ ├── tools.ts # /tools/* - MAIN tool API (mounted)
|
|
50
|
-
│ │ └── prompts.ts # /prompts/* - prompt discovery (mounted)
|
|
51
|
-
│ ├── middleware/
|
|
52
|
-
│ │ ├── errorHandler.ts # Error response formatting
|
|
53
|
-
│ │ ├── logger.ts # Request/response logging
|
|
54
|
-
│ │ ├── queryParser.ts # Zod validation
|
|
55
|
-
│ │ └── readiness.ts # Server readiness check
|
|
56
|
-
│ ├── validation/
|
|
57
|
-
│ │ ├── index.ts # Schema exports
|
|
58
|
-
│ │ ├── schemas.ts # HTTP schemas (import from octocode-mcp)
|
|
59
|
-
│ │ └── httpPreprocess.ts # HTTP query string preprocessing
|
|
60
|
-
│ ├── utils/
|
|
61
|
-
│ │ ├── colors.ts # Console color functions
|
|
62
|
-
│ │ ├── logger.ts # File-based logging
|
|
63
|
-
│ │ ├── responseBuilder.ts # Role-based response formatting
|
|
64
|
-
│ │ ├── responseFactory.ts # Response creation helpers
|
|
65
|
-
│ │ ├── responseParser.ts # MCP response parsing
|
|
66
|
-
│ │ ├── resilience.ts # Resilience utilities
|
|
67
|
-
│ │ ├── retry.ts # Retry with backoff
|
|
68
|
-
│ │ ├── circuitBreaker.ts # Circuit breaker pattern
|
|
69
|
-
│ │ └── routeFactory.ts # Route handler factory
|
|
70
|
-
│ ├── types/
|
|
71
|
-
│ │ ├── express.d.ts # Express type extensions
|
|
72
|
-
│ │ ├── guards.ts # Type guard functions
|
|
73
|
-
│ │ ├── mcp.ts # MCP protocol types
|
|
74
|
-
│ │ ├── responses.ts # Response types
|
|
75
|
-
│ │ └── toolTypes.ts # Tool parameter types
|
|
76
|
-
│ └── __tests__/
|
|
77
|
-
│ ├── integration/ # Integration tests
|
|
78
|
-
│ │ ├── circuitBreaker.test.ts
|
|
79
|
-
│ │ └── routes.test.ts
|
|
80
|
-
│ └── unit/ # Unit tests
|
|
81
|
-
│ ├── circuitBreaker.test.ts
|
|
82
|
-
│ ├── logger.test.ts
|
|
83
|
-
│ ├── responseBuilder.test.ts
|
|
84
|
-
│ └── retry.test.ts
|
|
85
|
-
├── docs/
|
|
86
|
-
│ ├── API_REFERENCE.md # Complete HTTP API reference
|
|
87
|
-
│ ├── ARCHITECTURE.md # Architecture documentation
|
|
88
|
-
│ └── FLOWS.md # Main flows & connections
|
|
89
|
-
├── references/
|
|
90
|
-
│ └── GUARDRAILS.md # Safety guardrails
|
|
91
|
-
├── scripts/ # Bundled output
|
|
92
|
-
│ ├── server.js # Bundled server
|
|
93
|
-
│ └── server.d.ts # Type declarations
|
|
94
|
-
├── SKILL.md # Skill definition for AI agents
|
|
95
|
-
├── AGENTS.md # This file
|
|
96
|
-
├── tsdown.config.ts # tsdown bundler configuration
|
|
97
|
-
├── package.json
|
|
98
|
-
├── tsconfig.json
|
|
99
|
-
├── eslint.config.mjs
|
|
100
|
-
└── vitest.config.ts # Test configuration
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## API Endpoints
|
|
106
|
-
|
|
107
|
-
### Available Routes
|
|
108
|
-
|
|
109
|
-
| Endpoint | Description |
|
|
110
|
-
|----------|-------------|
|
|
111
|
-
| `GET /health` | Server health check |
|
|
112
|
-
| `GET /tools/list` | List all tools (concise) |
|
|
113
|
-
| `GET /tools/info` | List all tools with details |
|
|
114
|
-
| `GET /tools/info/:toolName` | Get specific tool schema (call BEFORE using!) |
|
|
115
|
-
| `GET /tools/system` | Get system prompt (load FIRST) |
|
|
116
|
-
| `GET /tools/initContext` | Combined system prompt + all tool schemas (recommended for init) |
|
|
117
|
-
| `POST /tools/call/:toolName` | **Execute any tool** |
|
|
118
|
-
| `GET /prompts/list` | List all prompts |
|
|
119
|
-
| `GET /prompts/info/:promptName` | Get specific prompt content |
|
|
120
|
-
|
|
121
|
-
### Tool Execution (Unified API)
|
|
122
|
-
|
|
123
|
-
**All tools are called via `POST /tools/call/:toolName`** with JSON body:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
curl -X POST http://localhost:1987/tools/call/localSearchCode \
|
|
127
|
-
-H "Content-Type: application/json" \
|
|
128
|
-
-d '{"queries":[{
|
|
129
|
-
"pattern":"useState",
|
|
130
|
-
"path":"/project",
|
|
131
|
-
"mainResearchGoal":"Find React hooks",
|
|
132
|
-
"researchGoal":"Locate useState",
|
|
133
|
-
"reasoning":"Need source location"
|
|
134
|
-
}]}'
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Available Tools (via `/tools/call/:toolName`)
|
|
138
|
-
|
|
139
|
-
| Tool Name | Category | Description |
|
|
140
|
-
|-----------|----------|-------------|
|
|
141
|
-
| `localSearchCode` | Local | Code search via ripgrep |
|
|
142
|
-
| `localGetFileContent` | Local | Read file content |
|
|
143
|
-
| `localFindFiles` | Local | Find files by pattern/metadata |
|
|
144
|
-
| `localViewStructure` | Local | View directory tree |
|
|
145
|
-
| `lspGotoDefinition` | LSP | Go to symbol definition |
|
|
146
|
-
| `lspFindReferences` | LSP | Find all references |
|
|
147
|
-
| `lspCallHierarchy` | LSP | Call hierarchy (incoming/outgoing) |
|
|
148
|
-
| `githubSearchCode` | GitHub | Search GitHub code |
|
|
149
|
-
| `githubGetFileContent` | GitHub | Read GitHub files |
|
|
150
|
-
| `githubSearchRepositories` | GitHub | Search repositories |
|
|
151
|
-
| `githubViewRepoStructure` | GitHub | View repo structure |
|
|
152
|
-
| `githubSearchPullRequests` | GitHub | Search pull requests |
|
|
153
|
-
| `packageSearch` | Package | Search npm/PyPI packages |
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## Key Files & Responsibilities
|
|
158
|
-
|
|
159
|
-
### Entry Points
|
|
160
|
-
|
|
161
|
-
| File | Purpose |
|
|
162
|
-
|------|---------|
|
|
163
|
-
| `src/server.ts` | Express app creation, route mounting, graceful shutdown |
|
|
164
|
-
| `src/index.ts` | Re-exports octocode-mcp functions with cleaner names |
|
|
165
|
-
| `src/mcpCache.ts` | MCP client instance caching and management |
|
|
166
|
-
|
|
167
|
-
### Routes
|
|
168
|
-
|
|
169
|
-
Each route file follows the pattern:
|
|
170
|
-
1. Import tool function from `../index.js`
|
|
171
|
-
2. Define Express Router
|
|
172
|
-
3. Apply validation middleware
|
|
173
|
-
4. Execute tool and format response
|
|
174
|
-
|
|
175
|
-
### Middleware
|
|
176
|
-
|
|
177
|
-
| File | Purpose |
|
|
178
|
-
|------|---------|
|
|
179
|
-
| `queryParser.ts` | Validates query params against Zod schemas |
|
|
180
|
-
| `errorHandler.ts` | Catches errors, formats consistent responses |
|
|
181
|
-
| `logger.ts` | Logs requests to console and file |
|
|
182
|
-
| `readiness.ts` | Server readiness check middleware |
|
|
183
|
-
|
|
184
|
-
### Validation
|
|
185
|
-
|
|
186
|
-
Schemas are imported from `octocode-mcp/public` (source of truth) and wrapped with HTTP preprocessing.
|
|
187
|
-
|
|
188
|
-
| File | Purpose |
|
|
189
|
-
|------|---------|
|
|
190
|
-
| `schemas.ts` | HTTP-wrapped schemas importing from `octocode-mcp/public` |
|
|
191
|
-
| `httpPreprocess.ts` | Query string conversion (string→number/boolean/array) |
|
|
192
|
-
|
|
193
|
-
When adding/modifying endpoints:
|
|
194
|
-
1. Check if schema exists in `octocode-mcp/public`
|
|
195
|
-
2. Create HTTP wrapper in `validation/schemas.ts` with preprocessing
|
|
196
|
-
3. Apply schema validation in route handler
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Development Guidelines
|
|
201
|
-
|
|
202
|
-
### Adding a New Endpoint
|
|
203
|
-
|
|
204
|
-
1. **Add schema** in `src/validation/schemas.ts`
|
|
205
|
-
2. **Create route handler** in appropriate `src/routes/*.ts`
|
|
206
|
-
3. **Add route to server.ts** if new route group
|
|
207
|
-
4. **Update types** if needed
|
|
208
|
-
5. **Add tests** in `src/__tests__/`
|
|
209
|
-
6. **Document** in docs/ARCHITECTURE.md
|
|
210
|
-
|
|
211
|
-
### Code Style
|
|
212
|
-
|
|
213
|
-
- **TypeScript strict mode** enabled
|
|
214
|
-
- **Zod** for runtime validation
|
|
215
|
-
- **Express async handlers** - wrap with try/catch or error middleware
|
|
216
|
-
- **Consistent logging** - use `agentLog`, `successLog`, `errorLog` from colors.ts
|
|
217
|
-
|
|
218
|
-
### Testing
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
yarn test # Run all tests
|
|
222
|
-
yarn test:watch # Watch mode
|
|
223
|
-
yarn test -- --coverage # With coverage report
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
## Response Format
|
|
229
|
-
|
|
230
|
-
### Single Query Response (`POST /tools/call/:toolName`)
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
{
|
|
234
|
-
tool: "localSearchCode",
|
|
235
|
-
success: true,
|
|
236
|
-
data: { files: [...], totalMatches: 10 },
|
|
237
|
-
hints: ["Use lineHint for LSP tools", ...],
|
|
238
|
-
research: {
|
|
239
|
-
mainResearchGoal: "...",
|
|
240
|
-
researchGoal: "...",
|
|
241
|
-
reasoning: "..."
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Bulk Query Response (2-3 queries)
|
|
247
|
-
|
|
248
|
-
```typescript
|
|
249
|
-
{
|
|
250
|
-
tool: "localSearchCode",
|
|
251
|
-
bulk: true,
|
|
252
|
-
success: true,
|
|
253
|
-
instructions: "...",
|
|
254
|
-
results: [
|
|
255
|
-
{ id: 1, status: "hasResults", data: {...}, research: {...} },
|
|
256
|
-
{ id: 2, status: "empty", data: {...}, research: {...} }
|
|
257
|
-
],
|
|
258
|
-
hints: { hasResults: [...], empty: [...], error: [...] },
|
|
259
|
-
counts: { total: 2, hasResults: 1, empty: 1, error: 0 }
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
### Error Response
|
|
264
|
-
|
|
265
|
-
```typescript
|
|
266
|
-
{
|
|
267
|
-
tool: "localSearchCode",
|
|
268
|
-
success: false,
|
|
269
|
-
data: {},
|
|
270
|
-
hints: ["Error recovery hint..."],
|
|
271
|
-
research: {...}
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Key Dependencies
|
|
278
|
-
|
|
279
|
-
| Package | Purpose |
|
|
280
|
-
|---------|---------|
|
|
281
|
-
| `octocode-mcp` | Core tool implementations |
|
|
282
|
-
| `express` | HTTP server framework |
|
|
283
|
-
| `zod` | Schema validation |
|
|
284
|
-
| `@modelcontextprotocol/sdk` | MCP format types |
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Documentation References
|
|
289
|
-
|
|
290
|
-
| Doc | Purpose |
|
|
291
|
-
|-----|---------|
|
|
292
|
-
| [SKILL.md](./SKILL.md) | How AI agents should USE this skill |
|
|
293
|
-
| [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) | Detailed architecture |
|
|
294
|
-
| [docs/FLOWS.md](./docs/FLOWS.md) | Main flows & component connections |
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
## Console Output Colors
|
|
299
|
-
|
|
300
|
-
| Category | Color | Function |
|
|
301
|
-
|----------|-------|----------|
|
|
302
|
-
| Agent messages | 🟣 Purple | `agentLog()` |
|
|
303
|
-
| Tool results | 🔵 Blue | `resultLog()` |
|
|
304
|
-
| Success | 🟢 Green | `successLog()` |
|
|
305
|
-
| Errors | 🔴 Red | `errorLog()` |
|
|
306
|
-
| Warnings | 🟡 Yellow | `warnLog()` |
|
|
307
|
-
| Secondary info | Gray | `dimLog()` |
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## Troubleshooting
|
|
312
|
-
|
|
313
|
-
### Server won't start
|
|
314
|
-
```bash
|
|
315
|
-
# Check if port 1987 is in use
|
|
316
|
-
lsof -i :1987
|
|
317
|
-
|
|
318
|
-
# Kill existing process
|
|
319
|
-
kill -9 $(lsof -ti :1987)
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### Build errors
|
|
323
|
-
```bash
|
|
324
|
-
# Clean and rebuild
|
|
325
|
-
rm -rf scripts/
|
|
326
|
-
npm run build
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### Missing dependencies
|
|
330
|
-
```bash
|
|
331
|
-
# Reinstall
|
|
332
|
-
rm -rf node_modules/
|
|
333
|
-
yarn install
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
## Access Control
|
|
339
|
-
|
|
340
|
-
| Path | Access |
|
|
341
|
-
|------|--------|
|
|
342
|
-
| `src/`, `src/__tests__/` | ✅ Auto |
|
|
343
|
-
| `docs/`, `references/` | ✅ Auto |
|
|
344
|
-
| `*.json`, `*.config.*` | ⚠️ Ask first |
|
|
345
|
-
| `.env*`, `node_modules/`, `scripts/` | ❌ Never modify |
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
*This skill wraps `octocode-mcp` tools as HTTP endpoints. For tool-specific documentation, see the [octocode-mcp package](https://github.com/bgauryy/octocode-mcp/blob/main/AGENTS.md).*
|