feat: add --json flag as no-op alias for --format json#1104
Conversation
Skip registration when a custom --json flag already exists on the command (e.g. base shortcuts use --json for body input).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR introduces a ChangesJSON flag shorthand
🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
AI agents frequently pass
--jsonwhen calling lark-cli commands, causing "unknown flag" errors. This adds--jsonas a no-op bool flag to api, service, and shortcut (HasFormat) commands so the flag is silently accepted. Since--formatalready defaults tojson, no behavioral wiring is needed.Changes
cmd.Flags().Bool("json", ...)tocmd/api/api.goafter--formatregistrationcmd.Flags().Bool("json", ...)tocmd/service/service.goafter--formatregistrationcmd.Flags().Bool("json", ...)toshortcuts/common/runner.goinsideHasFormatblock, with aLookup("json")guard to skip registration when a custom--jsonflag already exists (e.g. base domain shortcuts use--jsonfor body input)Test Plan
make unit-testpassedlark-cli api GET /open-apis/test --json --dry-runaccepted without error;lark-cli calendar +agenda --json --helpshows--jsonflagRelated Issues
N/A
Summary by CodeRabbit
New Features
--jsonflag as a shorthand for--format jsonacross API, service method, and shortcut commands.Tests
--jsonflag is correctly registered and accepted in various command contexts.