Documentation
¶
Overview ¶
Package client provides an HTTP API client for the arc server. It wraps REST endpoints for projects, issues, plans, and workspace paths.
Index ¶
- type AISessionResponse
- type Client
- func (c *Client) AddDependency(projID, issueID, dependsOnID, depType string) error
- func (c *Client) AddLabelToIssue(projectID, issueID, label string) error
- func (c *Client) BaseURL() string
- func (c *Client) CloseIssue(projID, id, reason string, cascade bool) (*types.Issue, error)
- func (c *Client) CreateAIAgent(sessionID string, agent *types.AIAgent) (*types.AIAgent, error)
- func (c *Client) CreateAISession(session *types.AISession) (*types.AISession, error)
- func (c *Client) CreateIssue(projID string, req CreateIssueRequest) (*types.Issue, error)
- func (c *Client) CreateLabel(name, color, description string) (*types.Label, error)
- func (c *Client) CreatePlan(filePath string) (*types.Plan, error)
- func (c *Client) CreatePlanComment(planID string, lineNumber *int, content string) (*types.PlanComment, error)
- func (c *Client) CreateProject(name, prefix, description string) (*types.Project, error)
- func (c *Client) CreateWorkspace(projID string, req CreateWorkspaceRequest) (*types.Workspace, error)
- func (c *Client) DeleteAISession(id string) error
- func (c *Client) DeleteIssue(projID, id string) error
- func (c *Client) DeleteLabel(name string) error
- func (c *Client) DeletePlan(planID string) error
- func (c *Client) DeleteProject(id string) error
- func (c *Client) DeleteWorkspace(projID, wsID string) error
- func (c *Client) GetAIAgent(sessionID, agentID string) (*types.AIAgent, error)
- func (c *Client) GetAISession(id string) (*AISessionResponse, error)
- func (c *Client) GetAgentTranscript(sessionID, agentID string) ([]map[string]any, error)
- func (c *Client) GetBlockedIssues(projID string, limit int) ([]*types.BlockedIssue, error)
- func (c *Client) GetIssue(projID, id string) (*types.Issue, error)
- func (c *Client) GetIssueDetails(projID, id string) (*types.IssueDetails, error)
- func (c *Client) GetPlan(planID string) (*types.PlanWithContent, error)
- func (c *Client) GetProject(id string) (*types.Project, error)
- func (c *Client) GetProjectStats(projID string) (*types.Statistics, error)
- func (c *Client) GetReadyWork(projID string, limit int, sortPolicy string) ([]*types.Issue, error)
- func (c *Client) Health() error
- func (c *Client) ListAIAgents(sessionID string) ([]*types.AIAgent, error)
- func (c *Client) ListAISessions(limit, offset int) ([]*types.AISession, error)
- func (c *Client) ListIssues(projID string, opts ListIssuesOptions) ([]*types.Issue, error)
- func (c *Client) ListLabels() ([]*types.Label, error)
- func (c *Client) ListPlanComments(planID string) ([]*types.PlanComment, error)
- func (c *Client) ListProjects() ([]*types.Project, error)
- func (c *Client) ListWorkspaces(projID string) ([]*types.Workspace, error)
- func (c *Client) MergeProjects(targetID string, sourceIDs []string) (*types.MergeResult, error)
- func (c *Client) RemoveDependency(projID, issueID, dependsOnID string) error
- func (c *Client) RemoveLabelFromIssue(projectID, issueID, label string) error
- func (c *Client) ResolveProjectByPath(fsPath string) (*types.ProjectResolution, error)
- func (c *Client) SetActor(actor string)
- func (c *Client) UpdateIssue(projID, id string, updates map[string]any) (*types.Issue, error)
- func (c *Client) UpdateLabel(name string, fields map[string]string) (*types.Label, error)
- func (c *Client) UpdatePlanContent(planID string, content string) error
- func (c *Client) UpdatePlanStatus(planID string, status string) error
- func (c *Client) UpdateProject(id string, updates map[string]any) (*types.Project, error)
- func (c *Client) UpdateWorkspace(projID, wsID string, updates map[string]string) (*types.Workspace, error)
- type CreateIssueRequest
- type CreateWorkspaceRequest
- type ListIssuesOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AISessionResponse ¶
AISessionResponse extends AISession with its agents for detail views. Used by GetAISession to return the session along with all registered agents.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the HTTP API client for the arc issue tracking server. It provides methods for all CRUD operations on projects, issues, dependencies, labels, plans, and comments.
func New ¶
New creates a new API client configured to connect to the given base URL. The client defaults to a 30-second timeout and "cli" as the actor identity.
func (*Client) AddDependency ¶
AddDependency adds a dependency between two issues. depType should be one of: "blocks", "parent-child", "related", "discovered-from".
func (*Client) AddLabelToIssue ¶
AddLabelToIssue associates a label with an issue.
func (*Client) CloseIssue ¶
CloseIssue closes an issue. When cascade is true, open children are closed recursively. When cascade is false and the issue has open children, a *types.OpenChildrenError is returned so the caller can prompt the user.
func (*Client) CreateAIAgent ¶
CreateAIAgent creates a new AI agent for a session.
func (*Client) CreateAISession ¶
CreateAISession creates a new AI session. The operation is idempotent: if a session with the same ID already exists, the existing record is returned.
func (*Client) CreateIssue ¶
CreateIssue creates a new issue.
func (*Client) CreateLabel ¶
CreateLabel creates a new global label.
func (*Client) CreatePlan ¶ added in v0.7.0
CreatePlan registers an ephemeral plan backed by a filesystem markdown file.
func (*Client) CreatePlanComment ¶
func (c *Client) CreatePlanComment(planID string, lineNumber *int, content string) (*types.PlanComment, error)
CreatePlanComment adds a review comment to a plan.
func (*Client) CreateProject ¶ added in v0.12.0
CreateProject creates a new project.
func (*Client) CreateWorkspace ¶
func (c *Client) CreateWorkspace(projID string, req CreateWorkspaceRequest) (*types.Workspace, error)
CreateWorkspace registers a new workspace (directory path) for a project.
func (*Client) DeleteAISession ¶
DeleteAISession deletes an AI session by ID.
func (*Client) DeleteIssue ¶
DeleteIssue deletes an issue.
func (*Client) DeleteLabel ¶
DeleteLabel deletes a global label.
func (*Client) DeletePlan ¶ added in v0.7.0
DeletePlan deletes a plan and its comments.
func (*Client) DeleteProject ¶ added in v0.12.0
DeleteProject deletes a project.
func (*Client) DeleteWorkspace ¶
DeleteWorkspace removes a workspace (directory path) from a project.
func (*Client) GetAIAgent ¶
GetAIAgent retrieves a single agent by ID within a session.
func (*Client) GetAISession ¶
func (c *Client) GetAISession(id string) (*AISessionResponse, error)
GetAISession retrieves an AI session by ID. The response includes the Agents field.
func (*Client) GetAgentTranscript ¶
GetAgentTranscript retrieves the transcript for an agent as a slice of JSON objects. The transcript is read from the agent's JSONL file on the server.
func (*Client) GetBlockedIssues ¶
GetBlockedIssues returns blocked issues.
func (*Client) GetIssueDetails ¶
func (c *Client) GetIssueDetails(projID, id string) (*types.IssueDetails, error)
GetIssueDetails retrieves an issue with all relational data.
func (*Client) GetPlan ¶ added in v0.7.0
func (c *Client) GetPlan(planID string) (*types.PlanWithContent, error)
GetPlan retrieves a plan by ID, including file content.
func (*Client) GetProject ¶ added in v0.12.0
GetProject retrieves a project by ID.
func (*Client) GetProjectStats ¶ added in v0.12.0
func (c *Client) GetProjectStats(projID string) (*types.Statistics, error)
GetProjectStats returns project statistics.
func (*Client) GetReadyWork ¶
GetReadyWork returns issues ready to work on. sortPolicy can be: "hybrid" (default), "priority", or "oldest".
func (*Client) ListAIAgents ¶
ListAIAgents returns all agents for a session.
func (*Client) ListAISessions ¶
ListAISessions returns a paginated list of AI sessions.
func (*Client) ListIssues ¶
ListIssues returns issues for a project.
func (*Client) ListLabels ¶
ListLabels returns all global labels.
func (*Client) ListPlanComments ¶
func (c *Client) ListPlanComments(planID string) ([]*types.PlanComment, error)
ListPlanComments returns all comments for a plan.
func (*Client) ListProjects ¶ added in v0.12.0
ListProjects returns all projects.
func (*Client) ListWorkspaces ¶
ListWorkspaces returns all workspaces (directory paths) for a project.
func (*Client) MergeProjects ¶ added in v0.12.0
MergeProjects merges one or more source projects into a target project.
func (*Client) RemoveDependency ¶
RemoveDependency removes a dependency between two issues.
func (*Client) RemoveLabelFromIssue ¶
RemoveLabelFromIssue removes a label association from an issue.
func (*Client) ResolveProjectByPath ¶ added in v0.12.0
func (c *Client) ResolveProjectByPath(fsPath string) (*types.ProjectResolution, error)
ResolveProjectByPath finds the project associated with a filesystem path.
func (*Client) SetActor ¶
SetActor sets the actor identity sent via the X-Actor header on all requests.
func (*Client) UpdateIssue ¶
UpdateIssue updates an issue.
func (*Client) UpdateLabel ¶
UpdateLabel updates a label's color or description. The fields map should contain only the fields that were explicitly set by the caller.
func (*Client) UpdatePlanContent ¶
UpdatePlanContent writes new content to the plan's file.
func (*Client) UpdatePlanStatus ¶
UpdatePlanStatus updates the status of a plan.
func (*Client) UpdateProject ¶ added in v0.12.0
UpdateProject updates a project.
type CreateIssueRequest ¶
type CreateIssueRequest struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Priority int `json:"priority,omitempty"`
IssueType string `json:"issue_type,omitempty"`
Assignee string `json:"assignee,omitempty"`
ParentID string `json:"parent_id,omitempty"` // For hierarchical child IDs
}
CreateIssueRequest is the request for creating an issue.
type CreateWorkspaceRequest ¶ added in v0.12.0
type CreateWorkspaceRequest struct {
Path string `json:"path"`
Label string `json:"label,omitempty"`
Hostname string `json:"hostname,omitempty"`
GitRemote string `json:"git_remote,omitempty"`
PathType string `json:"path_type,omitempty"`
}
CreateWorkspaceRequest is the request for registering a workspace (directory path).
type ListIssuesOptions ¶
type ListIssuesOptions struct {
Status string // Filter by status (e.g., "open", "closed")
Type string // Filter by issue type (e.g., "bug", "feature")
Assignee string // Filter by assignee name
Query string // Full-text search in title/description
Limit int // Maximum number of results
Parent string // Filter by parent issue ID
}
ListIssuesOptions configures issue listing. All fields are optional; zero values are omitted from the query.