Skip to content

feat(tools): make key argument width adaptive to terminal size#885

Open
zdyxry wants to merge 1 commit intoMoonshotAI:mainfrom
zdyxry:width
Open

feat(tools): make key argument width adaptive to terminal size#885
zdyxry wants to merge 1 commit intoMoonshotAI:mainfrom
zdyxry:width

Conversation

@zdyxry
Copy link

@zdyxry zdyxry commented Feb 4, 2026

Related Issue

#799

Description

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

Copilot AI review requested due to automatic review settings February 4, 2026 03:44
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the key-argument display width adaptive to the current terminal size, improving the readability of tool call summaries in the CLI.

Changes:

  • Introduced _get_key_argument_width() in kimi_cli.tools to compute a dynamic key-argument width based on shutil.get_terminal_size, with sensible min/max bounds and error handling.
  • Extended extract_key_argument() with an optional, keyword-only width parameter and wired it to use _get_key_argument_width() when width is not provided.
  • Added a dedicated test module tests/tools/test_extract_key_argument.py covering _get_key_argument_width() behavior across terminal widths and validating extraction/truncation logic for multiple tools and error cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/kimi_cli/tools/init.py Adds adaptive key-argument width calculation and integrates it into extract_key_argument while preserving existing behavior and call sites.
tests/tools/test_extract_key_argument.py Provides focused unit tests for the new width helper and extract_key_argument across various tools, terminal sizes, and failure scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant