Skip to content

refactor: add socket response helpers and argument extractors#331

Merged
dlorenc merged 1 commit intomainfrom
multiclaude/happy-lion
Jan 28, 2026
Merged

refactor: add socket response helpers and argument extractors#331
dlorenc merged 1 commit intomainfrom
multiclaude/happy-lion

Conversation

@dlorenc
Copy link
Copy Markdown
Owner

@dlorenc dlorenc commented Jan 28, 2026

Summary

  • Add helper functions to socket package for creating responses:

    • ErrorResponse(format, args...) - creates error responses with printf-style formatting
    • SuccessResponse(data) - creates success responses with optional data
  • Add argument extraction helpers in daemon:

    • getOptionalStringArg - extracts optional string arguments with defaults
    • getOptionalBoolArg - extracts optional bool arguments with defaults
  • Refactored all 50 handler response patterns in daemon.go to use the new helpers

  • Simplified fork config parsing from ~12 lines to ~4 lines using struct literal with helpers

Changes

File Lines Changed Description
internal/socket/socket.go +17 New response builder helpers
internal/daemon/daemon.go -4 net Refactored to use helpers

Impact

  • No behavior changes - all tests pass
  • Improves code consistency and readability
  • Reduces boilerplate in daemon handlers
  • Makes it easier to add new handlers with consistent error/success patterns

Test plan

  • go build ./... compiles successfully
  • go test ./internal/daemon/... passes (42 tests)
  • go test ./internal/socket/... passes
  • go test ./... full suite passes

🤖 Generated with Claude Code

Add helper functions to socket package for creating responses:
- ErrorResponse(format, args...) for error responses with formatting
- SuccessResponse(data) for success responses

Add argument extraction helpers in daemon:
- getOptionalStringArg for optional string arguments with defaults
- getOptionalBoolArg for optional bool arguments with defaults

Refactored all 50 handler response patterns in daemon.go to use
the new helpers, improving consistency and reducing boilerplate.
This also simplifies fork config parsing from ~12 lines to ~4 lines.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dlorenc dlorenc added the multiclaude PRs created by multiclaude workers label Jan 28, 2026
@dlorenc dlorenc merged commit 9a91824 into main Jan 28, 2026
6 checks passed
aronchick pushed a commit to aronchick/multiclaude that referenced this pull request Jan 29, 2026
…c#331)

Add helper functions to socket package for creating responses:
- ErrorResponse(format, args...) for error responses with formatting
- SuccessResponse(data) for success responses

Add argument extraction helpers in daemon:
- getOptionalStringArg for optional string arguments with defaults
- getOptionalBoolArg for optional bool arguments with defaults

Refactored all 50 handler response patterns in daemon.go to use
the new helpers, improving consistency and reducing boilerplate.
This also simplifies fork config parsing from ~12 lines to ~4 lines.

Co-authored-by: Test User <test@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multiclaude PRs created by multiclaude workers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant