refactor: separate CLI layer from action logic in internal/app#614
Merged
refactor: separate CLI layer from action logic in internal/app#614
Conversation
- Fix gofmt alignment in App struct fields - Remove trailing periods from error strings (staticcheck ST1005) - Check os.MkdirAll/os.Chdir error returns in tests (errcheck) - Use 0600 permissions for WriteFile in tests (gosec G306) - Add nolint:gosec for intentional subprocess exec (gosec G204) - Fix variable shadowing in synthesizer tests (govet)
- Extract RootAction (root.go) and CdkAction (cdk.go) structs with private fields and New constructors, decoupled from urfave/cli - Restore StackDeleter as struct (was temporarily converted to functions) - Add CdkDeleter public struct in cdk_deleter.go - app.go now only contains App struct (CLI definition) and delegates to action structs via New().Run() - All helper functions are receiver methods on their respective structs - Fix lint errors from previous CDK integration PR - Restore App fields to public (minimize diff from original)
- RootAction: validation tests (no stacks, -i/-s conflict, negative -n) - CdkAction: validation, cdk.json not found, manifest not found, empty manifest, stack name not in manifest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RootActionandCdkActionstructs with private fields andNewconstructors, decoupled from urfave/cliapp.gonow only containsAppstruct (CLI definition) and delegates to action structs viaNew().Run()CdkDeleteras public struct incdk_deleter.goStackDeleterrestored as structcdksubcommand for CDK app integration #612)File structure
app.goAppstruct, CLI flag definitions, delegates to actionsroot.goRootAction— root command logiccdk.goCdkAction— CDK subcommand logicstack_deleter.goStackDeleter— single-region stack deletioncdk_deleter.goCdkDeleter— multi-region CDK stack deletionCloses the lint CI failure from #612.