Add ready_for_merge tool and prompt agents for it after review
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE tasks ADD COLUMN ready_prompt_n INTEGER NOT NULL DEFAULT 0;
|
||||
@@ -746,6 +746,34 @@ func (s *Store) SetTaskSummary(ctx context.Context, id, summary, actor string) e
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Store) ReadyPromptN(ctx context.Context, id string) (int, error) {
|
||||
n := 0
|
||||
err := s.db.QueryRowContext(ctx, `SELECT ready_prompt_n FROM tasks WHERE id = ?`, id).Scan(&n)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return 0, ErrNotFound
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (s *Store) SetReadyPromptN(ctx context.Context, id string, snapshotN int) error {
|
||||
_, err := s.db.ExecContext(ctx, `UPDATE tasks SET ready_prompt_n = ? WHERE id = ?`, snapshotN, id)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *Store) MarkReady(ctx context.Context, id, overview, actor string) error {
|
||||
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
|
||||
projectID := ""
|
||||
err := tx.QueryRowContext(ctx, `SELECT project_id FROM tasks WHERE id = ? AND status = ?`, id, string(api.TaskStatusActive)).Scan(&projectID)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return ErrNotFound
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return emit(api.Event{Kind: "task.ready", ProjectId: &projectID, TaskId: &id, Actor: actor, Payload: map[string]any{"id": id, "overview": overview}})
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Store) TaskSummary(ctx context.Context, id string) (string, error) {
|
||||
summary := ""
|
||||
err := s.db.QueryRowContext(ctx, `SELECT summary FROM tasks WHERE id = ?`, id).Scan(&summary)
|
||||
|
||||
Reference in New Issue
Block a user