Skip to content

feat: implement rocket add handler command#22

Merged
muhfaris merged 3 commits into
masterfrom
feat/add-handler
Jun 25, 2026
Merged

feat: implement rocket add handler command#22
muhfaris merged 3 commits into
masterfrom
feat/add-handler

Conversation

@muhfaris

Copy link
Copy Markdown
Owner

Adds the ability to incrementally add new endpoints to an existing generated project without regenerating everything from scratch.

  • New shared/generate/append.go — Go file appenders (append to end, insert before closing brace, insert before package-level closer)
  • New builder/hexagonal/add_handler.go — single-endpoint generation: handler, presenter, domain, port service, service impl, router
  • New builder/add_handler.go — bridge from CLI to hexagonal, reads rocket.yaml for project context
  • Updated cmd/project/add/handler.go — wired the RunE, replaces the previous commented-out skeleton

Usage: cd && rocket add handler
--openapi spec.yaml --operationid CreateUser

Adds the ability to incrementally add new endpoints to an existing
generated project without regenerating everything from scratch.

- New shared/generate/append.go — Go file appenders (append to end,
  insert before closing brace, insert before package-level closer)
- New builder/hexagonal/add_handler.go — single-endpoint generation:
  handler, presenter, domain, port service, service impl, router
- New builder/add_handler.go — bridge from CLI to hexagonal, reads
  rocket.yaml for project context
- Updated cmd/project/add/handler.go — wired the RunE, replaces
  the previous commented-out skeleton

Usage: cd <project> && rocket add handler \
  --openapi spec.yaml --operationid CreateUser
- Use cmd.Flags() instead of viper.Get() to prevent rocket.yaml
  config values (like 'openapi') from overriding CLI flags
- Use projectDir (absolute path from cwd) as ProjectName so all
  generated file paths resolve correctly when running from within
  the project directory
- Fix spec copy path to use projectDir
@muhfaris
muhfaris merged commit 6fb5dfe into master Jun 25, 2026
1 check passed
@muhfaris
muhfaris deleted the feat/add-handler branch June 25, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant