rdev/internal/domain/command.go
jordan 3dbde72966
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: add claude_id tracking and session improvements for interactive dev
- Add claude_id field to sessions (migration 026) for tracking Claude
  process IDs across pod restarts
- Extend session repository with UpdateClaudeID and session lookup methods
- Improve kubernetes executor with better error handling and exec streaming
- Add claudebox client/server improvements for session lifecycle
- Expand sessions handler with exec streaming endpoint
- Add comprehensive tests for sessions and kubernetes executor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 00:20:32 -07:00

51 lines
1.2 KiB
Go

package domain
import "time"
// CommandID is a strongly-typed identifier for commands.
type CommandID string
// CommandType represents the type of command being executed.
type CommandType string
const (
CommandTypeClaude CommandType = "claude"
CommandTypeShell CommandType = "shell"
CommandTypeGit CommandType = "git"
)
// Command represents a command to execute in a project's pod.
type Command struct {
ID CommandID
ProjectID ProjectID
Type CommandType
Args []string
StartedAt time.Time
// ResumeSessionID, if set, causes the executor to pass --resume to claude.
ResumeSessionID string
}
// CommandResult represents the outcome of command execution.
type CommandResult struct {
CommandID CommandID
ExitCode int
DurationMs int64
Error error
}
// Success returns true if the command completed successfully.
func (r *CommandResult) Success() bool {
return r.Error == nil && r.ExitCode == 0
}
// OutputLine represents a single line of command output.
type OutputLine struct {
Stream string // "stdout" or "stderr"
Line string
Timestamp time.Time
}
// OutputHandler is called for each line of output from a command.
type OutputHandler func(line OutputLine)