Skip to content

fix(cli): remove FLAGS section from root --help#1226

Merged
liangshuo-1 merged 1 commit into
mainfrom
fix/root-help-drop-flags-section
Jun 2, 2026
Merged

fix(cli): remove FLAGS section from root --help#1226
liangshuo-1 merged 1 commit into
mainfrom
fix/root-help-drop-flags-section

Conversation

@liangshuo-1

@liangshuo-1 liangshuo-1 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1223.

Why

The FLAGS: block in lark-cli --help is hand-written text that restates flags belonging to leaf commands (api, service). Those flags are not registered on the root command and error unknown flag there:

$ lark-cli --params '{}'
Error: unknown flag: --params

#1223 trimmed it to a short illustrative example list, but even that duplicates what Cobra's per-command --help already renders authoritatively, and any static flag list maintained by hand in root help drifts from the real per-command sets over time.

Change

Remove the FLAGS: section entirely. Cobra's per-command Flags: output is the single source of truth:

  • USAGE: / EXAMPLES: still show these flags in their correct position, after a <command> (e.g. lark-cli calendar events instance_view --params '...').
  • The Cobra-generated Flags: block at the bottom of lark-cli --help still lists the actual root flags (-h/--help, --profile, -v/--version).
  • Removes the now-obsolete TestRootLong_FlagsSectionPointsToCommandHelp, which asserted on the deleted text.

Verification

  • lark-cli --help now flows EXAMPLES → AI AGENT SKILLS.
  • go test ./cmd/ -run TestRoot passes; go vet ./cmd/ clean.

Summary by CodeRabbit

Release Notes

  • Documentation
    • Updated command help text to improve clarity and flow between API examples and AI AGENT SKILLS information.

Follow-up to #1223. The hand-written FLAGS block in `lark-cli --help`
restated leaf-command flags at the root level — flags that are not
registered on the root command (they error "unknown flag" there). Even
trimmed to an illustrative example list, it duplicated information Cobra's
per-command `--help` already renders authoritatively, and any static list
in root help drifts from the real per-command flag sets over time.

Drop the section entirely: Cobra's per-command `Flags:` output is the
single source of truth. `USAGE:`/`EXAMPLES:` still show flags in context,
and the `Flags:` block at the bottom of root help lists the actual root
flags. Also removes the now-obsolete TestRootLong_FlagsSectionPointsToCommandHelp.

Change-Id: Ie7f2acd3592c23606e452965b52fba34c113ad91
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3c627f37-a6b0-4526-8d81-3df4ce9b20df

📥 Commits

Reviewing files that changed from the base of the PR and between b0b163d and 7507581.

📒 Files selected for processing (2)
  • cmd/root.go
  • cmd/root_test.go
💤 Files with no reviewable changes (2)
  • cmd/root.go
  • cmd/root_test.go

📝 Walkthrough

Walkthrough

Removed a generic "FLAGS: …" line from the root command's help text in cmd/root.go so the "AI AGENT SKILLS" section flows directly from the usage example. Deleted the corresponding test that validated the removed FLAGS section behavior.

Changes

Help text cleanup

Layer / File(s) Summary
Remove FLAGS section from root help and its test
cmd/root.go, cmd/root_test.go
The generic "FLAGS: …" line is removed from the rootLong constant (4 lines), causing "AI AGENT SKILLS" to follow the example directly. The test TestRootLong_FlagsSectionPointsToCommandHelp that validated the removed FLAGS behavior is deleted (11 lines).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • larksuite/cli#1223: Both PRs modify cmd/root.go's rootLong help text around the FLAGS section (and cmd/root_test.go's assertions about that section) to avoid listing per-command flags as global.
  • larksuite/cli#289: Both PRs modify cmd/root.go's rootLong "AI AGENT SKILLS" help text to align documentation, with adjustments to cmd/root_test.go coverage accordingly.
  • larksuite/cli#769: Both PRs change the cmd/root.go long help text (rootLong) in the same section of the user-facing --help output.

Suggested labels

size/L

Suggested reviewers

  • liuxinyanglxy

Poem

A FLAGS line fades from help so bright,
The test that tracked it bids goodnight.
AI AGENT SKILLS now takes the stage,
Cleaner prose upon the page! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: removing the FLAGS section from the root help output.
Description check ✅ Passed The description includes all required sections with substantial detail: Summary explains the motivation, Changes lists the modifications, Test Plan confirms verification steps, and Related Issues is addressed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/root-help-drop-flags-section

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Jun 2, 2026
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@7507581802e339be3ae5437c2771fdf034b10c69

🧩 Skill update

npx skills add larksuite/cli#fix/root-help-drop-flags-section -y -g

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.19%. Comparing base (b0b163d) to head (7507581).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1226   +/-   ##
=======================================
  Coverage   69.19%   69.19%           
=======================================
  Files         634      634           
  Lines       59482    59482           
=======================================
  Hits        41161    41161           
  Misses      15007    15007           
  Partials     3314     3314           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liangshuo-1
liangshuo-1 merged commit b216363 into main Jun 2, 2026
21 checks passed
@liangshuo-1
liangshuo-1 deleted the fix/root-help-drop-flags-section branch June 2, 2026 12:31
@liangshuo-1 liangshuo-1 mentioned this pull request Jun 2, 2026
1 task
tuxedomm pushed a commit to zhumiaoxin/cli that referenced this pull request Jun 6, 2026
Follow-up to larksuite#1223. The hand-written FLAGS block in `lark-cli --help`
restated leaf-command flags at the root level — flags that are not
registered on the root command (they error "unknown flag" there). Even
trimmed to an illustrative example list, it duplicated information Cobra's
per-command `--help` already renders authoritatively, and any static list
in root help drifts from the real per-command flag sets over time.

Drop the section entirely: Cobra's per-command `Flags:` output is the
single source of truth. `USAGE:`/`EXAMPLES:` still show flags in context,
and the `Flags:` block at the bottom of root help lists the actual root
flags. Also removes the now-obsolete TestRootLong_FlagsSectionPointsToCommandHelp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants