Skip to content

Conversation

@chezsmithy
Copy link
Contributor

@chezsmithy chezsmithy commented Nov 2, 2025

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
Copy link
Contributor

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

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

Copy link
Contributor

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

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
Copy link
Collaborator

@RomneyDa RomneyDa left a comment

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
Collaborator

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
Collaborator

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
Collaborator

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

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Nov 11, 2025
@RomneyDa
Copy link
Collaborator

RomneyDa commented Nov 11, 2025

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

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

Labels

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

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants