fix(cli): make completion command discoverable#307
fix(cli): make completion command discoverable#307zfaustk wants to merge 5 commits intolarksuite:mainfrom
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 101-104: The Zsh completion snippet is missing the fpath and
compinit configuration; update the README near the Zsh section (after the mkdir
and the generation step that writes to ~/.zfunc/_lark-cli) to instruct users to
add their function directory to fpath and initialize completions by adding
fpath=(~/.zfunc $fpath) and running autoload -Uz compinit && compinit in their
.zshrc so the generated _lark-cli file is discovered and activated.
In `@README.zh.md`:
- Around line 101-104: The Zsh section only creates ~/.zfunc and the _lark-cli
file but omits telling users to add that directory to their zsh fpath and
initialize completions; update the README.zh.md Zsh instructions to tell users
to add ~/.zfunc to their fpath in their .zshrc and to run the zsh completion
initialization (compinit) so the _lark-cli completion is loaded.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f07e8763-b24d-4ed6-9155-70271d1c27dc
📒 Files selected for processing (4)
README.mdREADME.zh.mdcmd/completion/completion.gocmd/completion/completion_test.go
💤 Files with no reviewable changes (1)
- cmd/completion/completion.go
| # Zsh | ||
| mkdir -p ~/.zfunc | ||
| lark-cli completion zsh > ~/.zfunc/_lark-cli | ||
| ``` |
There was a problem hiding this comment.
Zsh completion setup is incomplete (same issue as Chinese README).
Missing fpath configuration. Users need to add the function path to .zshrc:
fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinit🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` around lines 101 - 104, The Zsh completion snippet is missing the
fpath and compinit configuration; update the README near the Zsh section (after
the mkdir and the generation step that writes to ~/.zfunc/_lark-cli) to instruct
users to add their function directory to fpath and initialize completions by
adding fpath=(~/.zfunc $fpath) and running autoload -Uz compinit && compinit in
their .zshrc so the generated _lark-cli file is discovered and activated.
| # Zsh | ||
| mkdir -p ~/.zfunc | ||
| lark-cli completion zsh > ~/.zfunc/_lark-cli | ||
| ``` |
There was a problem hiding this comment.
Zsh completion setup is incomplete.
The Zsh instructions create the file but don't mention adding ~/.zfunc to fpath. Users would need to add this to their .zshrc:
fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinitConsider adding this note or linking to the Zsh completion documentation.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.zh.md` around lines 101 - 104, The Zsh section only creates ~/.zfunc
and the _lark-cli file but omits telling users to add that directory to their
zsh fpath and initialize completions; update the README.zh.md Zsh instructions
to tell users to add ~/.zfunc to their fpath in their .zshrc and to run the zsh
completion initialization (compinit) so the _lark-cli completion is loaded.
Greptile SummaryRemoves Confidence Score: 5/5Safe to merge; the core change is a one-field removal and the regression test is well-written All findings are P2 documentation style issues. The logic change (removing Hidden: true) is minimal and correct, and the new test properly guards both the visibility and auth-skip properties. No correctness or reliability issues in the code. README.md and README.zh.md — the zsh completion examples should include fpath and compinit instructions to avoid silent failures for zsh users Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User Shell
participant B as lark-cli binary
participant C as completion cmd
U->>B: lark-cli completion bash|zsh|fish|powershell
B->>C: cobra routes to NewCmdCompletion
Note over C: Auth check skipped (DisableAuthCheck)
Note over C: Update notice suppressed (isCompletionCommand)
C->>B: root.GenXxxCompletion(out)
B->>U: completion script written to stdout
U->>U: user redirects to shell completion dir
Note over U: zsh: ~/.zfunc/_lark-cli also needs<br/>fpath + compinit in .zshrc
Reviews (1): Last reviewed commit: "Create completion_test.go" | Re-trigger Greptile |
| # Zsh | ||
| mkdir -p ~/.zfunc | ||
| lark-cli completion zsh > ~/.zfunc/_lark-cli | ||
| ``` |
There was a problem hiding this comment.
Zsh setup missing
fpath and compinit steps
The example writes a completion file to ~/.zfunc/_lark-cli but does not tell users to register that directory with zsh or initialize the completion system. Without adding fpath=(~/.zfunc $fpath) and autoload -Uz compinit && compinit to ~/.zshrc, the file exists on disk but zsh never loads it — completions silently fail. The same gap is present in README.zh.md (lines 101–103).
| # Zsh | |
| mkdir -p ~/.zfunc | |
| lark-cli completion zsh > ~/.zfunc/_lark-cli | |
| ``` | |
| # Zsh | |
| mkdir -p ~/.zfunc | |
| lark-cli completion zsh > ~/.zfunc/_lark-cli | |
| # Add to ~/.zshrc (if not already present): | |
| # fpath=(~/.zfunc $fpath) | |
| # autoload -Uz compinit && compinit |
Summary
Fixes #264.
lark-cli completionalready works, but it is hidden from normal command discovery and is not documented in either README. This change makes the command visible and adds short shell completion setup examples in both English and Chinese docs.Changes
Hidden: truefromcmd/completion/completion.gocmd/completion/completion_test.goto verify the command stays visible and auth-freeREADME.mdREADME.zh.mdWhy this change
#264reports that the command is usable today but hidden from usersCHANGELOG.mdalready describes completion support as a shipped feature--helpdiscovery weaker than the actual product surfaceValidation
git diff --checkcmd/completion/completion.go,cmd/root.go,README.md, andREADME.zh.mdgois not installed in the containerSummary by CodeRabbit
New Features
Documentation