v0.7.0 cli client with readline added, directory structure updated

This commit is contained in:
2025-11-13 08:55:06 -05:00
parent 52868af4ea
commit 6bdc061508
52 changed files with 2260 additions and 157 deletions

View File

@ -0,0 +1,87 @@
// FILE: lixenwraith/chess/internal/server/processor/command.go
package processor
import (
"chess/internal/server/core"
)
// CommandType defines the type of command being executed
type CommandType int
const (
CmdCreateGame CommandType = iota
CmdConfigurePlayers
CmdGetGame
CmdDeleteGame
CmdMakeMove
CmdUndoMove
CmdGetBoard
)
// Command is a unified structure for all processor operations
type Command struct {
Type CommandType
UserID string
GameID string // For game-specific commands
Args interface{} // Command-specific arguments
}
// ProcessorResponse wraps the response with metadata
type ProcessorResponse struct {
Success bool `json:"success"`
Pending bool `json:"pending,omitempty"` // For async operations
Data interface{} `json:"data,omitempty"`
Error *core.ErrorResponse `json:"error,omitempty"`
}
func NewCreateGameCommand(req core.CreateGameRequest) Command {
return Command{
Type: CmdCreateGame,
Args: req,
}
}
func NewConfigurePlayersCommand(gameID string, req core.ConfigurePlayersRequest) Command {
return Command{
Type: CmdConfigurePlayers,
GameID: gameID,
Args: req,
}
}
func NewGetGameCommand(gameID string) Command {
return Command{
Type: CmdGetGame,
GameID: gameID,
}
}
func NewMakeMoveCommand(gameID string, req core.MoveRequest) Command {
return Command{
Type: CmdMakeMove,
GameID: gameID,
Args: req,
}
}
func NewUndoMoveCommand(gameID string, req core.UndoRequest) Command {
return Command{
Type: CmdUndoMove,
GameID: gameID,
Args: req,
}
}
func NewDeleteGameCommand(gameID string) Command {
return Command{
Type: CmdDeleteGame,
GameID: gameID,
}
}
func NewGetBoardCommand(gameID string) Command {
return Command{
Type: CmdGetBoard,
GameID: gameID,
}
}