fix: skip config loading for __complete command#111
Conversation
Summary of ChangesHello @kitsunoff, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical user experience issue where shell autocompletion for the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughWalkthroughReplaces inline command-name checks with a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a bug where shell autocompletion would fail outside of a talm project directory. The fix is correctly implemented by adding the __complete command to the list of commands that skip configuration loading. Extracting this list into a package-level variable skipConfigCommands is a good refactoring that improves code clarity and maintainability. The addition of main_test.go with comprehensive unit tests, including for the new __complete case, is excellent and ensures the fix is well-covered. I have one suggestion to improve the readability of a test helper function.
The __complete command is cobra's internal hidden command used for shell autocompletion (triggered when user presses Tab). It was not included in the skip list after PR cozystack#109, causing autocompletion to fail outside project directories. Bug reproduction: $ talm __complete ini "" error loading configuration: error reading configuration file: open Chart.yaml: no such file or directory Changes: - Add "__complete" to skipConfigCommands list - Extract command list to a variable for testability and documentation - Add unit tests for isCommandOrParent and skipConfigCommands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: ZverGuy <maximbel2003@gmail.com>
f553e76 to
c68c17f
Compare
|
fixed |
Summary
Fix shell autocompletion (Tab key) failing with "error loading configuration" when used outside a talm project directory.
This is a follow-up to PR #109 which fixed
completion bash/zshsubcommands but missed the__completecommand.Problem
$ talm __complete ini "" error loading configuration: error reading configuration file: open Chart.yaml: no such file or directoryRoot cause:
__completeis cobra's internal hidden command for shell autocompletion, triggered when the user presses Tab. It's a separate top-level command, not a child ofcompletion, so the fix in PR #109 didn't cover it.Changes
__completetoskipConfigCommandslistmain_test.goTest Plan
Unit tests
Tests cover:
completioncommandcompletion bashsubcommandcompletion zshsubcommand__complete(cobra internal) ← newinitcommandapplycommand (should NOT skip)templatecommand (should NOT skip)Manual testing
How to verify the bug exists (before this fix)
Remove
__completefromskipConfigCommandsinmain.go:Run tests:
Test
__complete_(cobra_internal_for_shell_autocompletion)will fail:🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Tests