Skip to content

refactor: separate CLI layer from action logic in internal/app#614

Merged
go-to-k merged 4 commits intomainfrom
refactor/app-action-separation
Mar 30, 2026
Merged

refactor: separate CLI layer from action logic in internal/app#614
go-to-k merged 4 commits intomainfrom
refactor/app-action-separation

Conversation

@go-to-k
Copy link
Copy Markdown
Owner

@go-to-k go-to-k commented Mar 30, 2026

Summary

  • Extract RootAction and CdkAction structs with private fields and New constructors, decoupled from urfave/cli
  • app.go now only contains App struct (CLI definition) and delegates to action structs via New().Run()
  • CdkDeleter as public struct in cdk_deleter.go
  • StackDeleter restored as struct
  • All helper functions are receiver methods on their respective structs
  • Fix lint errors from CDK integration PR (feat: add cdk subcommand for CDK app integration #612)

File structure

File Responsibility
app.go App struct, CLI flag definitions, delegates to actions
root.go RootAction — root command logic
cdk.go CdkAction — CDK subcommand logic
stack_deleter.go StackDeleter — single-region stack deletion
cdk_deleter.go CdkDeleter — multi-region CDK stack deletion

Closes the lint CI failure from #612.

go-to-k added 2 commits March 30, 2026 14:28
- 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)
go-to-k added 2 commits March 30, 2026 15:55
- 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
@go-to-k go-to-k merged commit c793ba5 into main Mar 30, 2026
2 checks passed
@go-to-k go-to-k deleted the refactor/app-action-separation branch March 30, 2026 07:13
This was referenced Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant