Skip to content

feat: octocode-cli research commands + skill#336

Open
unsafe9 wants to merge 5 commits into
bgauryy:mainfrom
unsafe9:feat/octocode-tools-cli
Open

feat: octocode-cli research commands + skill#336
unsafe9 wants to merge 5 commits into
bgauryy:mainfrom
unsafe9:feat/octocode-tools-cli

Conversation

@unsafe9
Copy link
Copy Markdown

@unsafe9 unsafe9 commented Mar 13, 2026

Summary

Adds 13 research commands and an octocode-cli skill to enable code research via CLI.

CLI

  • 13 research commands: search-code, get-file, tree, search-repos, search-prs, search-packages, local-search, local-file, local-find, local-tree, lsp-definition, lsp-references, lsp-call-hierarchy
  • schema-bridge: createToolCommand() factory that auto-generates CLI options from Zod schemas — eliminates duplication between MCP tool definitions and CLI commands
  • help.ts: Auto-generates command listings from the commands array using category field (GitHub / Local / LSP grouping)
  • parser.ts: Lazily derives OPTIONS_WITH_VALUES from command definitions instead of hardcoding

Skills

  • octocode-cli skill: Command table, Funnel Method, usage patterns per category, --help guidance
  • CLI fallback in 5 existing skills: documentation-writer, plan, PR reviewer, RFC generator, roast — suggests octocode-cli as alternative when MCP is not installed

P.S.

This PR follows the shift toward CLI + Skill-centric AI agent ecosystems. While sufficiently tested, this was largely vibe-coded — treat it more as a feature proposal than production-ready code.

unsafe9 added 5 commits March 12, 2026 20:58
Add a standalone CLI package (packages/octocode-tools/) that exposes
all 13 octocode-mcp tools as CLI commands, reusing the existing
execution functions directly. Usable via `npx octocode-tools`.

- 6 GitHub commands: search-code, get-file, tree, search-repos,
  search-prs, search-packages
- 4 Local commands: local-search, local-file, local-find, local-tree
- 3 LSP commands: lsp-definition, lsp-references, lsp-call-hierarchy
- Auth auto-resolves from gh CLI, env vars, or stored credentials
- JSON output by default, --pretty for human-readable

Add octocode-cli skill (skills/octocode-cli/) with CLI usage guide,
funnel research methodology, command reference, workflow patterns,
and adapted reference skills (documentation-writer, plan, PR reviewer,
RFC generator, prompt optimizer, roast).
Consolidate the separate octocode-tools package (13 research CLI
commands) into octocode-cli, creating a single unified CLI. Port all
commands from Commander.js to the custom parser, reorganize into
src/cli/commands/ directory (setup.ts, github.ts, local.ts, lsp.ts),
and update all skill references from octocode-tools to octocode-cli.

Delete packages/octocode-tools/ entirely.
Eliminate three sources of duplication:
- CLI command options now derived from MCP Zod schemas via createToolCommand()
- help.ts generates command listings from the commands array using category field
- parser.ts derives OPTIONS_WITH_VALUES lazily from command definitions

Add schema-bridge.ts with zodToCliOptions(), cliArgsToQuery(), and
createToolCommand() factory. Update all 13 research commands and skill
reference files for the new schema-derived kebab-case option names.
…kills

- Delete skills/octocode-cli/references/ (duplicated copies of other skills)
- Rewrite octocode-cli SKILL.md as self-contained with MCP→CLI mapping,
  usage patterns, and --help guidance
- Add octocode-cli as alternative in each skill's MCP discovery section
  (documentation-writer, plan, PR reviewer, RFC generator, roast)
The CLI skill should stand on its own — describe commands directly
without framing them as MCP alternatives.
@unsafe9 unsafe9 marked this pull request as ready for review March 13, 2026 07:34
Copy link
Copy Markdown

@JiwaniZakir JiwaniZakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In github.ts, the searchPackagesCommand handler has two input validation gaps worth addressing. First, the ecosystem parameter is checked for presence via requireOption but its value is never validated against the allowed set ('npm' | 'python') — passing --ecosystem pip or --ecosystem pypi would silently forward an invalid value to searchPackages. Second, the parseInt call on line ~109 for search-limit doesn't guard against NaN: parseInt('abc', 10) returns NaN, which would be passed as searchLimit: NaN to the query without error.

In init.ts, the module-level initialized boolean works fine for a CLI process but will cause the singleton to stay "initialized" across test suites that import this module without resetting state between runs — worth either exporting a resetForTesting() helper or using a class-based approach if tests are planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants