Skip to content

feat: stream deployment logs with --follow flag#54

Merged
omattsson merged 1 commit intomainfrom
feat/51-follow-flag-stream-logs
Apr 24, 2026
Merged

feat: stream deployment logs with --follow flag#54
omattsson merged 1 commit intomainfrom
feat/51-follow-flag-stream-logs

Conversation

@omattsson
Copy link
Copy Markdown
Owner

Summary

  • Adds --follow / -f flag to deploy, stop, clean, rollback, and logs commands
  • Connects to the backend WebSocket (/ws), subscribes to the instance log channel, and streams deployment.log lines to stdout in real-time
  • Exits on terminal status (running, stopped, error, draft) with appropriate error if deployment failed
  • Graceful shutdown on Ctrl+C via signal.NotifyContext

Closes #51

Implementation

  • New StreamDeploymentLogs client method in cli/pkg/client/websocket.go
  • Sends a subscribe message after connecting (required -- the hub uses BroadcastToInstance for log lines, which only reaches subscribed clients)
  • New WS types (WSMessage, WSDeploymentLog, WSDeploymentStatus, StreamResult) in cli/pkg/types/types.go
  • followLogs helper in cli/cmd/stack.go wraps the client call with signal handling

Test plan

  • 11 WebSocket client tests: success flow, error status, instance filtering, context cancellation, JWT auth, API key auth, malformed messages, draft terminal, non-terminal status ignored, connection error, bad scheme
  • URL conversion tests (http to ws, https to wss, trailing slash, unsupported scheme)
  • All existing tests pass (go test ./...)

Generated with Claude Code

Adds real-time log streaming via WebSocket to deploy, stop, clean,
rollback, and logs commands. The client subscribes to the instance
log channel and prints lines to stdout until a terminal status arrives.

Closes #51

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@omattsson omattsson merged commit 9f35447 into main Apr 24, 2026
6 checks passed
@omattsson omattsson deleted the feat/51-follow-flag-stream-logs branch April 24, 2026 14:43
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.

feat: stream deployment logs with --follow flag

1 participant