Skip to content

feat(cli): add non-interactive usage command#2301

Open
binichallein wants to merge 1 commit into
MoonshotAI:mainfrom
binichallein:feat/noninteractive-usage-2169
Open

feat(cli): add non-interactive usage command#2301
binichallein wants to merge 1 commit into
MoonshotAI:mainfrom
binichallein:feat/noninteractive-usage-2169

Conversation

@binichallein
Copy link
Copy Markdown

@binichallein binichallein commented May 15, 2026

Resolve #2169

Summary

  • Add a lazy-loaded kimi usage subcommand for non-interactive Kimi Code quota checks.
  • Support default Rich panel output plus --json for scripts and CI.
  • Reuse the existing shell /usage request, parsing, and rendering logic, and document the CLI path in English and Chinese docs.

Test Plan

  • RED: uv run pytest tests/core/test_usage_cli.py tests/core/test_startup_imports.py -q failed before implementation with missing usage command.
  • GREEN: uv run pytest tests/core/test_usage_cli.py tests/core/test_startup_imports.py tests/ui/test_usage.py -q (43 passed, 1 upstream deprecation warning).
  • uv run ruff check src/kimi_cli/cli/usage.py src/kimi_cli/cli/_lazy_group.py src/kimi_cli/ui/shell/usage.py tests/core/test_usage_cli.py tests/core/test_startup_imports.py tests/ui/test_usage.py.
  • uv run ruff format --check src/kimi_cli/cli/usage.py src/kimi_cli/cli/_lazy_group.py src/kimi_cli/ui/shell/usage.py tests/core/test_usage_cli.py tests/core/test_startup_imports.py tests/ui/test_usage.py.
  • uv run pyright src/kimi_cli/cli/usage.py src/kimi_cli/ui/shell/usage.py tests/core/test_usage_cli.py.
  • git diff --check.
  • npx -y node@20 scripts/sync-changelog.mjs and npx -y node@20 node_modules/vitepress/bin/vitepress.js build from docs/; docs dependencies were provided via a temporary local node_modules symlink because fresh npm install --no-package-lock stalled without output.

Open in Devin Review

Copy link
Copy Markdown
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 4 additional findings.

Open in Devin Review

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.

Feature request: non-interactive kimi usage (or /usage via --print) for programmatic quota checks

1 participant