task description auto

This commit is contained in:
Ian Gulliver
2026-10-20 08:57:37 -07:00
parent 8f3226350e
commit d530ec5edc
20 changed files with 434 additions and 342 deletions
+35
View File
@@ -638,6 +638,41 @@ func (m *Manager) setMergeTitle(ctx context.Context, l *live, raw json.RawMessag
return fmt.Sprintf("Merge commit title set to %q.", title), nil
}
func (m *Manager) setTaskTitleTool(l *live) mcp.Tool {
return mcp.Tool{
Name: "set_task_title",
Description: "Set this task's title, which names it in byre's task list and switcher. " +
"Keep it very short (two to four words), distinct from the project's other tasks, and to the point, for example \"webhook retries\". " +
"Until set_merge_title is called, the merge commit title follows it. It replaces any earlier title.",
InputSchema: json.RawMessage(`{
"type": "object",
"properties": {
"title": {"type": "string", "description": "One short line."}
},
"required": ["title"]
}`),
Handler: func(ctx context.Context, raw json.RawMessage) (string, error) {
args := setMergeTitleArgs{}
err := json.Unmarshal(raw, &args)
if err != nil {
return "", fmt.Errorf("malformed set_task_title call: %w", err)
}
title := strings.TrimSpace(args.Title)
if title == "" || strings.ContainsAny(title, "\r\n") {
return "", fmt.Errorf("%w: title must be one non-empty line", ErrInvalid)
}
err = m.store.SetTitle(ctx, l.taskID, title, agentActor)
if errors.Is(err, store.ErrNotFound) {
return "", fmt.Errorf("%w: this task is closed or merging", ErrConflict)
}
if err != nil {
return "", err
}
return fmt.Sprintf("Task title set to %q.", title), nil
},
}
}
type stopMergeArgs struct {
Reason string `json:"reason"`
}