Documentation
¶
Index ¶
- type CreateOpRequest
- type CreateOpResponse
- type CreateWorktreeRequest
- type CreateWorktreeResponse
- type ErrorBody
- type ListProjectsResponse
- type LogLine
- type OpDonePayload
- type Options
- type ProjectStatus
- type Server
- func (s *Server) CreateOp(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateWorktree(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListProjects(w http.ResponseWriter, r *http.Request)
- func (s *Server) Register(mux *http.ServeMux, base string)
- func (s *Server) StreamOpLogs(w http.ResponseWriter, r *http.Request)
- type WorktreeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOpRequest ¶
type CreateOpRequest struct {
Action string `json:"action"`
TargetID string `json:"target_id,omitempty"`
Label string `json:"label,omitempty"`
}
CreateOpRequest is the POST {base}/ops body.
type CreateOpResponse ¶
CreateOpResponse is returned when a mock op is started.
type CreateWorktreeRequest ¶
type CreateWorktreeRequest struct {
ProjectPath string `json:"project_path"`
Task string `json:"task,omitempty"`
}
CreateWorktreeRequest is the POST {base}/worktrees body.
type CreateWorktreeResponse ¶
CreateWorktreeResponse is the successful create payload.
type ErrorBody ¶
type ErrorBody struct {
Error string `json:"error"`
}
ErrorBody is the JSON error envelope for 4xx/5xx.
type ListProjectsResponse ¶
type ListProjectsResponse struct {
Projects []ProjectStatus `json:"projects"`
}
ListProjectsResponse is the GET {base}/projects envelope.
type LogLine ¶
type LogLine struct {
TS string `json:"ts"`
Level string `json:"level"`
Message string `json:"message"`
}
LogLine is one streamed log event payload.
type OpDonePayload ¶
type OpDonePayload struct {
OK bool `json:"ok"`
Summary string `json:"summary,omitempty"`
Error string `json:"error,omitempty"`
}
OpDonePayload is the final SSE event.
type Options ¶
type Options struct {
// WrkHome is the wrk storage root (projects.json, worktrees/).
// Empty resolves like the CLI (WRK_HOME or ~/.wrk).
WrkHome string
}
Options configures a wrkserver instance.
type ProjectStatus ¶
type ProjectStatus struct {
Path string `json:"path"`
Name string `json:"name"`
Branch string `json:"branch,omitempty"`
Commit string `json:"commit,omitempty"`
Subject string `json:"subject,omitempty"`
Clean bool `json:"clean"`
Error string `json:"error,omitempty"`
Worktrees []WorktreeStatus `json:"worktrees"`
}
ProjectStatus is one registered main repository and its linked worktrees.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds HTTP handlers for wrk project list and worktree create.
func (*Server) CreateOp ¶
func (s *Server) CreateOp(w http.ResponseWriter, r *http.Request)
CreateOp handles POST {base}/ops — starts a mock streaming operation.
func (*Server) CreateWorktree ¶
func (s *Server) CreateWorktree(w http.ResponseWriter, r *http.Request)
CreateWorktree handles POST {base}/worktrees.
func (*Server) ListProjects ¶
func (s *Server) ListProjects(w http.ResponseWriter, r *http.Request)
ListProjects handles GET {base}/projects.
func (*Server) Register ¶
Register mounts fixed leaves under base (trailing slash optional).
GET {base}/projects → ListProjects
POST {base}/worktrees → CreateWorktree
POST {base}/ops → CreateOp (mock streaming ops)
GET {base}/ops/{id}/logs → StreamOpLogs (SSE)
base is host-owned; wrkserver does not hardcode /api/wrk.
func (*Server) StreamOpLogs ¶
func (s *Server) StreamOpLogs(w http.ResponseWriter, r *http.Request)
StreamOpLogs handles GET {base}/ops/{id}/logs as Server-Sent Events.
type WorktreeStatus ¶
type WorktreeStatus struct {
Path string `json:"path"`
Name string `json:"name"`
Branch string `json:"branch,omitempty"`
Clean bool `json:"clean"`
IsMain bool `json:"is_main"`
Error string `json:"error,omitempty"`
}
WorktreeStatus is one linked worktree (main is not listed here).