Skip to content

refactor: ♻️ Refactor the cli tool type to align with core - #8555

Closed
chezsmithy wants to merge 2 commits into
continuedev:mainfrom
chezsmithy:refactor-cli-tool-type
Closed

chezsmithy wants to merge 2 commits into
continuedev:mainfrom
chezsmithy:refactor-cli-tool-type

Conversation

@chezsmithy

@chezsmithy chezsmithy commented Nov 2, 2025 •

Copy link
Copy Markdown
Contributor

Description

Refactor the cli tool type to have the function wrapper to align it with the core tool type.
Avoid type issues in OpenAPI adapters due to misalignment.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

Tests were refactored as needed.


Summary by cubic

Refactored the CLI Tool type to the core-aligned, function-based shape and migrated all built-in tools. This removes type mismatches and stabilizes OpenAPI adapter behavior.

  • Refactors

    • Switched Tool to { type: "function", function: { name, description, parameters } } with displayTitle, group, and readonly.
    • Migrated Edit, MultiEdit, Read, Write, Bash, Search, List, Diff, Status, Checklist, Fetch, Exit to the new structure.
    • Updated helpers and execution flow: permission checks, display name lookup, chat-completion conversion, MCP tool conversion, and argument validation.
    • Adjusted messages and docs to reference readFileTool.function.name consistently.
  • Bug Fixes

    • Eliminates type misalignment causing issues in OpenAPI adapters.
    • Adds safe defaults when parameter schemas are missing to prevent validation errors.

Written for commit c078b37. Summary will update automatically on new commits.

@chezsmithy
chezsmithy requested a review from a team as a code owner November 2, 2025 05:15
@chezsmithy
chezsmithy requested review from sestinj and removed request for a team November 2, 2025 05:15
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Nov 2, 2025

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 15 files

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 5 files

@chezsmithy
chezsmithy force-pushed the refactor-cli-tool-type branch from 3232ca8 to c078b37 Compare November 2, 2025 05:38

@RomneyDa RomneyDa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@chezsmithy I think this is a good direction. Added some comments, looks like tests are failing. Any specific reasons in mind for moving towards unifying/issues it might help solve?

processedArgs?: Record<string, unknown>,
) => ToolPolicy;
// CLI-specific properties
preprocess?: (args: any) => Promise<PreprocessToolCallResult>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

note Core tools have preprocess method now

},
displayTitle: "Diff",
readonly: true,
group: "Built-In",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use a constant for group name since shared between all

};
displayTitle: string;
wouldLikeTo?: string;
isCurrently?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I might comment out all these unused properties like wouldLikeTo, originalFunctionName, hasAlready, systemMessageDescription etc

@RomneyDa

RomneyDa commented Nov 11, 2025 •

Copy link
Copy Markdown
Contributor

Edit, I see your comment about Avoid type issues in OpenAPI adapters due to misalignment 👍

@RomneyDa

RomneyDa commented Nov 26, 2025 •

Copy link
Copy Markdown
Contributor

Taking another pass through PRs, note merge conflict and test failures

@chezsmithy chezsmithy closed this Dec 18, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 18, 2025
@github-actions
github-actions Bot deleted the refactor-cli-tool-type branch January 2, 2026 06:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants