feat: Add default value support for custom command flags @osterman (#1848)
## what- Add
defaultfield toCommandFlagschema to support default values for both boolean and string flags - Boolean flags can now default to
true(previously always defaulted tofalse) - Update flag registration in Cobra to use configured defaults
- Add comprehensive documentation with usage patterns for boolean flags in bash and Go templates
why
Enable custom commands to have special behavior triggers without requiring unnecessary flag values. Users can define type: bool flags with default: true to handle cold start edge cases more cleanly.
references
Closes #1847
Summary by CodeRabbit
- New Features
- Custom commands now support configurable default values for boolean and string flags, allowing defaults to be preserved during flag registration
- Boolean flags can be set to default true or false; string flags can have explicit default values
- Added comprehensive documentation, blog posts, and usage examples for boolean flag patterns in templates and conditional execution
✏️ Tip: You can customize this high-level summary in your review settings.
🚀 Enhancements
Fix and redesign Atmos workflows @aknysh (#1849)
## what- Fixed quoted argument parsing bug: Workflow commands with quoted arguments (e.g.,
--query '.metadata.component == "gcp/compute/v0.2.0"') are now parsed correctly usingshell.Fields()instead ofstrings.Fields(), which was incorrectly splitting on spaces within quotes - Redesigned workflow execution architecture: Introduced interface-based dependency injection for testability and maintainability:
- Created new
pkg/workflow/package with clean separation of concerns - Added
CommandRunner,AuthProvider,UIProviderinterfaces for dependency injection - Created
Executorstruct that orchestrates workflow execution with injected dependencies - Added adapter layer in
internal/exec/workflow_adapters.goto bridge interfaces with existing code - Reduced
Executefunction from 6 parameters to 1 (*WorkflowParamsstruct) to comply with argument-limit linter rules
- Created new
why
- Quoted argument bug: Users reported that workflow commands with complex query expressions containing spaces and quotes were being parsed incorrectly, causing command failures. The fix uses proper shell parsing that respects quote boundaries.
- Architecture redesign: The previous workflow execution code was difficult to test without spawning real processes. The new interface-based design enables:
- Unit testing with mocks (generated via
go.uber.org/mock/mockgen) - Clear separation between workflow orchestration logic and execution details
- Better maintainability through smaller, focused components
- Compliance with golangci-lint rules (argument-limit, hugeParam, etc.)
- Unit testing with mocks (generated via
references
- Uses
mvdan.cc/sh/v3/shellfor proper shell argument parsing - Follows Atmos architectural patterns: interface-driven design, dependency injection, mock generation
Summary by CodeRabbit
-
New Features
- Modular workflow executor with resume support and --from-step to restart from a specific step
- Improved command parsing to preserve quoted arguments
-
Improvements
- Clearer failure messages with contextual hints and resume commands
- Better authentication and environment handling during workflow runs
-
Chores
- Bumped multiple dependencies
-
Tests
- Expanded test coverage for workflows, parsing, auth, and resume behaviors
✏️ Tip: You can customize this high-level summary in your review settings.