feat(agentic): surface workspace metadata in status output
This commit is contained in:
parent
6b78f0c137
commit
c83df5f113
3 changed files with 54 additions and 0 deletions
|
|
@ -96,6 +96,9 @@ type WorkspaceInfo struct {
|
|||
Status string `json:"status"`
|
||||
Agent string `json:"agent"`
|
||||
Repo string `json:"repo"`
|
||||
Branch string `json:"branch,omitempty"`
|
||||
Issue int `json:"issue,omitempty"`
|
||||
PRURL string `json:"pr_url,omitempty"`
|
||||
Task string `json:"task"`
|
||||
Age string `json:"age"`
|
||||
Question string `json:"question,omitempty"`
|
||||
|
|
@ -144,6 +147,9 @@ func (s *PrepSubsystem) status(ctx context.Context, _ *mcp.CallToolRequest, inpu
|
|||
info.Status = st.Status
|
||||
info.Agent = st.Agent
|
||||
info.Repo = st.Repo
|
||||
info.Branch = st.Branch
|
||||
info.Issue = st.Issue
|
||||
info.PRURL = st.PRURL
|
||||
info.Task = st.Task
|
||||
info.Runs = st.Runs
|
||||
info.Age = time.Since(st.StartedAt).Truncate(time.Minute).String()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package agentic
|
|||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
|
@ -52,3 +53,42 @@ func TestPlanRead_Good_ReturnsWrittenPlan(t *testing.T) {
|
|||
t.Fatalf("expected title %q, got %q", plan.Title, out.Plan.Title)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatus_Good_ExposesWorkspaceMetadata(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
sub := &PrepSubsystem{codePath: root}
|
||||
|
||||
wsDir := filepath.Join(root, ".core", "workspace", "repo-123")
|
||||
plan := &WorkspaceStatus{
|
||||
Status: "completed",
|
||||
Agent: "claude",
|
||||
Repo: "go-mcp",
|
||||
Branch: "agent/issue-42-fix-status",
|
||||
Issue: 42,
|
||||
PRURL: "https://forge.example/pr/42",
|
||||
Task: "Fix status output",
|
||||
Runs: 2,
|
||||
}
|
||||
if err := writeStatus(wsDir, plan); err != nil {
|
||||
t.Fatalf("writeStatus failed: %v", err)
|
||||
}
|
||||
|
||||
_, out, err := sub.status(context.Background(), nil, StatusInput{})
|
||||
if err != nil {
|
||||
t.Fatalf("status failed: %v", err)
|
||||
}
|
||||
if out.Count != 1 {
|
||||
t.Fatalf("expected count 1, got %d", out.Count)
|
||||
}
|
||||
|
||||
info := out.Workspaces[0]
|
||||
if info.Branch != plan.Branch {
|
||||
t.Fatalf("expected branch %q, got %q", plan.Branch, info.Branch)
|
||||
}
|
||||
if info.Issue != plan.Issue {
|
||||
t.Fatalf("expected issue %d, got %d", plan.Issue, info.Issue)
|
||||
}
|
||||
if info.PRURL != plan.PRURL {
|
||||
t.Fatalf("expected PR URL %q, got %q", plan.PRURL, info.PRURL)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ type WatchResult struct {
|
|||
Agent string `json:"agent"`
|
||||
Repo string `json:"repo"`
|
||||
Status string `json:"status"`
|
||||
Branch string `json:"branch,omitempty"`
|
||||
Issue int `json:"issue,omitempty"`
|
||||
PRURL string `json:"pr_url,omitempty"`
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +109,9 @@ func (s *PrepSubsystem) watch(ctx context.Context, req *mcp.CallToolRequest, inp
|
|||
Agent: info.Agent,
|
||||
Repo: info.Repo,
|
||||
Status: info.Status,
|
||||
Branch: info.Branch,
|
||||
Issue: info.Issue,
|
||||
PRURL: info.PRURL,
|
||||
})
|
||||
delete(remaining, info.Name)
|
||||
case "failed", "blocked":
|
||||
|
|
@ -115,6 +120,9 @@ func (s *PrepSubsystem) watch(ctx context.Context, req *mcp.CallToolRequest, inp
|
|||
Agent: info.Agent,
|
||||
Repo: info.Repo,
|
||||
Status: info.Status,
|
||||
Branch: info.Branch,
|
||||
Issue: info.Issue,
|
||||
PRURL: info.PRURL,
|
||||
})
|
||||
delete(remaining, info.Name)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue