chore: auto-commit (28 archivos)
- app.md - auth.go - chat.go - chat.log - db.go - frontend/package.json - frontend/pnpm-lock.yaml - frontend/src/App.tsx - frontend/src/Root.tsx - frontend/src/api.ts - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,10 @@ func executeTool(db *DB, name string, input json.RawMessage) ToolResult {
|
||||
return toolCardHistory(db, input)
|
||||
case "find_cards":
|
||||
return toolFindCards(db, input)
|
||||
case "list_users":
|
||||
return toolListUsers(db)
|
||||
case "assign_card":
|
||||
return toolAssignCard(db, input)
|
||||
default:
|
||||
return errMsg("unknown tool: " + name)
|
||||
}
|
||||
@@ -55,7 +59,7 @@ func executeTool(db *DB, name string, input json.RawMessage) ToolResult {
|
||||
func toolMutates(name string) bool {
|
||||
switch name {
|
||||
case "create_column", "update_column", "rename_column", "delete_column", "reorder_columns",
|
||||
"create_card", "update_card", "delete_card", "move_card":
|
||||
"create_card", "update_card", "delete_card", "move_card", "assign_card":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -94,6 +98,8 @@ func toolUpdateColumn(db *DB, input json.RawMessage) ToolResult {
|
||||
Name *string `json:"name"`
|
||||
Location *string `json:"location"`
|
||||
Width *int `json:"width"`
|
||||
WIPLimit *int `json:"wip_limit"`
|
||||
IsDone *bool `json:"is_done"`
|
||||
}
|
||||
if err := json.Unmarshal(input, &in); err != nil {
|
||||
return errResult(err)
|
||||
@@ -101,10 +107,10 @@ func toolUpdateColumn(db *DB, input json.RawMessage) ToolResult {
|
||||
if in.ID == "" {
|
||||
return errMsg("id required")
|
||||
}
|
||||
if in.Name == nil && in.Location == nil && in.Width == nil {
|
||||
return errMsg("at least one of name/location/width required")
|
||||
if in.Name == nil && in.Location == nil && in.Width == nil && in.WIPLimit == nil && in.IsDone == nil {
|
||||
return errMsg("at least one of name/location/width/wip_limit/is_done required")
|
||||
}
|
||||
if err := db.UpdateColumn(in.ID, ColumnPatch{Name: in.Name, Location: in.Location, Width: in.Width}); err != nil {
|
||||
if err := db.UpdateColumn(in.ID, ColumnPatch{Name: in.Name, Location: in.Location, Width: in.Width, WIPLimit: in.WIPLimit, IsDone: in.IsDone}); err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
return okResult(nil)
|
||||
@@ -151,7 +157,7 @@ func toolCreateCard(db *DB, input json.RawMessage) ToolResult {
|
||||
if in.ColumnID == "" || strings.TrimSpace(in.Title) == "" {
|
||||
return errMsg("column_id and title required")
|
||||
}
|
||||
c, err := db.CreateCard(in.ColumnID, in.Requester, in.Title, in.Description)
|
||||
c, err := db.CreateCard(in.ColumnID, in.Requester, in.Title, in.Description, "")
|
||||
if err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
@@ -159,12 +165,57 @@ func toolCreateCard(db *DB, input json.RawMessage) ToolResult {
|
||||
}
|
||||
|
||||
func toolUpdateCard(db *DB, input json.RawMessage) ToolResult {
|
||||
var raw map[string]any
|
||||
if err := json.Unmarshal(input, &raw); err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
id, _ := raw["id"].(string)
|
||||
if id == "" {
|
||||
return errMsg("id required")
|
||||
}
|
||||
patch := CardPatch{}
|
||||
if v, ok := raw["requester"].(string); ok {
|
||||
patch.Requester = &v
|
||||
}
|
||||
if v, ok := raw["title"].(string); ok {
|
||||
patch.Title = &v
|
||||
}
|
||||
if v, ok := raw["description"].(string); ok {
|
||||
patch.Description = &v
|
||||
}
|
||||
if v, ok := raw["color"].(string); ok {
|
||||
patch.Color = &v
|
||||
}
|
||||
if v, ok := raw["locked"].(bool); ok {
|
||||
patch.Locked = &v
|
||||
}
|
||||
if v, present := raw["assignee_id"]; present {
|
||||
patch.HasAssignee = true
|
||||
if v == nil {
|
||||
empty := ""
|
||||
patch.AssigneeID = &empty
|
||||
} else if s, ok := v.(string); ok {
|
||||
patch.AssigneeID = &s
|
||||
}
|
||||
}
|
||||
if err := db.UpdateCard(id, patch); err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
return okResult(nil)
|
||||
}
|
||||
|
||||
func toolListUsers(db *DB) ToolResult {
|
||||
users, err := db.ListUsers()
|
||||
if err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
return okResult(users)
|
||||
}
|
||||
|
||||
func toolAssignCard(db *DB, input json.RawMessage) ToolResult {
|
||||
var in struct {
|
||||
ID string `json:"id"`
|
||||
Requester *string `json:"requester"`
|
||||
Title *string `json:"title"`
|
||||
Description *string `json:"description"`
|
||||
Color *string `json:"color"`
|
||||
ID string `json:"id"`
|
||||
AssigneeID *string `json:"assignee_id"`
|
||||
}
|
||||
if err := json.Unmarshal(input, &in); err != nil {
|
||||
return errResult(err)
|
||||
@@ -172,7 +223,14 @@ func toolUpdateCard(db *DB, input json.RawMessage) ToolResult {
|
||||
if in.ID == "" {
|
||||
return errMsg("id required")
|
||||
}
|
||||
if err := db.UpdateCard(in.ID, CardPatch{Requester: in.Requester, Title: in.Title, Description: in.Description, Color: in.Color}); err != nil {
|
||||
patch := CardPatch{HasAssignee: true}
|
||||
if in.AssigneeID == nil {
|
||||
empty := ""
|
||||
patch.AssigneeID = &empty
|
||||
} else {
|
||||
patch.AssigneeID = in.AssigneeID
|
||||
}
|
||||
if err := db.UpdateCard(in.ID, patch); err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
return okResult(nil)
|
||||
@@ -225,7 +283,7 @@ func toolMoveCard(db *DB, input json.RawMessage) ToolResult {
|
||||
ids = append(ids, in.ID)
|
||||
in.OrderedIDs = ids
|
||||
}
|
||||
if err := db.MoveCard(in.ID, in.ColumnID, in.OrderedIDs); err != nil {
|
||||
if err := db.MoveCard(in.ID, in.ColumnID, in.OrderedIDs, ""); err != nil {
|
||||
return errResult(err)
|
||||
}
|
||||
return okResult(nil)
|
||||
@@ -309,6 +367,7 @@ func validateToolName(name string) error {
|
||||
"delete_column": true, "reorder_columns": true, "create_card": true,
|
||||
"update_card": true, "delete_card": true, "move_card": true,
|
||||
"card_history": true, "find_cards": true,
|
||||
"list_users": true, "assign_card": true,
|
||||
}
|
||||
if !known[name] {
|
||||
return fmt.Errorf("unknown tool: %s", name)
|
||||
|
||||
Reference in New Issue
Block a user