Skip to content

[wip] feat(code-tools): add code navigation endpoints#2671

Open
wlff123 wants to merge 1 commit into
volcengine:mainfrom
wlff123:code_enhance
Open

[wip] feat(code-tools): add code navigation endpoints#2671
wlff123 wants to merge 1 commit into
volcengine:mainfrom
wlff123:code_enhance

Conversation

@wlff123

@wlff123 wlff123 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Add HTTP APIs for code outline, search, and expansion backed by the existing AST tooling.

Expose the same capabilities through the opencode plugin and cover the new routes, parser behavior, and plugin wiring with tests.

Description

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🏅 Score: 85
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: AST extraction and markdown layout changes for Viking code resources

Relevant files:

  • openviking/parse/parsers/code/ast/code_tools.py
  • openviking/parse/parsers/code/ast/extractor.py
  • openviking/parse/parsers/markdown.py
  • tests/parse/test_ast_extractor.py
  • tests/parse/test_code_tools.py
  • tests/parse/test_markdown_filename_collision.py

Sub-PR theme: Add code navigation HTTP endpoints and MCP tooling

Relevant files:

  • openviking/server/app.py
  • openviking/server/mcp_endpoint.py
  • openviking/server/routers/init.py
  • openviking/server/routers/code.py
  • tests/server/test_api_code.py

Sub-PR theme: Add code tools to OpenCode plugin

Relevant files:

  • examples/opencode-plugin/index.mjs
  • examples/opencode-plugin/lib/code-tools.mjs
  • examples/opencode-plugin/lib/memory-session.mjs
  • examples/opencode-plugin/package.json
  • examples/opencode-plugin/tests/code-tools-request-options.test.mjs

⚡ Recommended focus areas for review

Off-by-one in file cap trigger

filter_code_uris checks len(uris) > CODE_SEARCH_FILE_CAP after appending, so it returns 200 files when the 201st is found. This is correct behavior, but note that the cap is enforced strictly at 200, even if more files are present.

if len(uris) > CODE_SEARCH_FILE_CAP:
    return uris[:CODE_SEARCH_FILE_CAP], True
No license header

New JavaScript file does not include the project's standard license header. While examples may not require it, consistency with other files is recommended.

import { tool } from "@opencode-ai/plugin"

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Add HTTP APIs for code outline, search, and expansion backed by the existing AST tooling.

Expose the same capabilities through the opencode plugin and cover the new routes, parser behavior, and plugin wiring with tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant