Display CLI config aliases in separate ALIASES help section#1867
Display CLI config aliases in separate ALIASES help section#1867
Conversation
📝 WalkthroughWalkthroughAdds annotation-based config alias support and switches alias execution to direct os/exec invocation; config aliases are excluded from normal command listings and rendered in a new ALIASES help section. Tests and golden snapshots updated to cover the new help output and telemetry banner. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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 |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1867 +/- ##
=======================================
Coverage 73.33% 73.33%
=======================================
Files 563 563
Lines 54217 54258 +41
=======================================
+ Hits 39760 39792 +32
- Misses 11601 11612 +11
+ Partials 2856 2854 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
CLI aliases defined in atmos.yaml config now appear in a dedicated "ALIASES" section in --help output instead of being mixed with regular commands in "AVAILABLE COMMANDS". This improves help clarity by distinguishing between built-in commands and user-defined shortcuts. Implementation: - Mark config aliases with "configAlias" annotation in processCommandAliases() - Add isConfigAlias() helper to identify config alias commands - Add getConfigAliases() to retrieve all config aliases - Add printConfigAliases() to render aliases in dedicated section - Filter config aliases from calculateMaxCommandWidth() and printAvailableCommands() - Add comprehensive unit tests for alias help rendering 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add CLI integration test that validates config aliases appear in the dedicated "ALIASES" section of `atmos --help` output when running from a project with aliases defined in atmos.yaml. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add integration tests validating config aliases work correctly: - tp alias executes terraform plan --help correctly - tr alias executes terraform --help correctly These tests ensure config aliases properly delegate to their target commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace shell execution with direct process execution (exec.Command) for CLI alias handling. The shell interpreter (mvdan.cc/sh) was misinterpreting Windows backslash paths as escape sequences, causing exit code 127 errors. Direct execution avoids path escaping issues, provides better performance, and correctly propagates exit codes from aliased commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3ac5fe7 to
982686a
Compare
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
The tests were failing in CI because the alias names used (tp, ta, td) could conflict with existing commands registered to global RootCmd. The processCommandAliases function internally checks getTopLevelCommands() which reads from the global RootCmd, not the test's local parentCmd. When running the full test suite, other tests may register commands that conflict with the short alias names. Changed to use unique alias names like "test-alias-tp" that won't conflict with any existing RootCmd commands. Also fixed TestProcessCommandAliases_DoesNotOverrideExistingCommands to properly test the actual behavior: verifying that aliases aren't added when they conflict with existing RootCmd commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
These changes were released in v1.202.0-rc.1. |
|
These changes were released in v1.203.0-test.1. |
what
atmos.yamlnow appear in a dedicated "ALIASES" section in--helpoutputwhy
Users reported that aliases added via CLI config (
atmos.yaml) appeared mixed with regular commands in the "AVAILABLE COMMANDS" section, making help output less clear. Creating a dedicated "ALIASES" section improves UX by clearly distinguishing shortcuts from actual commands.implementation
processCommandAliases()isConfigAlias()helper to identify config alias commandsprintAvailableCommands()andcalculateMaxCommandWidth()printConfigAliases()function to render aliases in dedicated sectionSummary by CodeRabbit
New Features
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.