feat(workspace): add repos JSONB field for GitHub repository URLs
Add a `repos` JSONB column to the workspace table for storing
associated repository URLs and descriptions. This enables the daemon
to clone repos and set up git worktrees for agent task execution.
Structure: [{"url": "https://github.com/org/repo", "description": "..."}]
- Migration 014: adds repos column with default '[]'
- UpdateWorkspace query: supports updating repos
- Workspace API: returns repos in GET, accepts in PUT
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1deae2a1e9
commit
83111761db
7 changed files with 116 additions and 90 deletions
|
|
@ -20,6 +20,7 @@ type WorkspaceResponse struct {
|
|||
Description *string `json:"description"`
|
||||
Context *string `json:"context"`
|
||||
Settings any `json:"settings"`
|
||||
Repos any `json:"repos"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
|
@ -32,6 +33,13 @@ func workspaceToResponse(w db.Workspace) WorkspaceResponse {
|
|||
if settings == nil {
|
||||
settings = map[string]any{}
|
||||
}
|
||||
var repos any
|
||||
if w.Repos != nil {
|
||||
json.Unmarshal(w.Repos, &repos)
|
||||
}
|
||||
if repos == nil {
|
||||
repos = []any{}
|
||||
}
|
||||
return WorkspaceResponse{
|
||||
ID: uuidToString(w.ID),
|
||||
Name: w.Name,
|
||||
|
|
@ -39,6 +47,7 @@ func workspaceToResponse(w db.Workspace) WorkspaceResponse {
|
|||
Description: textToPtr(w.Description),
|
||||
Context: textToPtr(w.Context),
|
||||
Settings: settings,
|
||||
Repos: repos,
|
||||
CreatedAt: timestampToString(w.CreatedAt),
|
||||
UpdatedAt: timestampToString(w.UpdatedAt),
|
||||
}
|
||||
|
|
@ -169,6 +178,7 @@ type UpdateWorkspaceRequest struct {
|
|||
Description *string `json:"description"`
|
||||
Context *string `json:"context"`
|
||||
Settings any `json:"settings"`
|
||||
Repos any `json:"repos"`
|
||||
}
|
||||
|
||||
func (h *Handler) UpdateWorkspace(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -204,6 +214,10 @@ func (h *Handler) UpdateWorkspace(w http.ResponseWriter, r *http.Request) {
|
|||
s, _ := json.Marshal(req.Settings)
|
||||
params.Settings = s
|
||||
}
|
||||
if req.Repos != nil {
|
||||
r, _ := json.Marshal(req.Repos)
|
||||
params.Repos = r
|
||||
}
|
||||
|
||||
ws, err := h.Queries.UpdateWorkspace(r.Context(), params)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue