Add todo mode and replace the plan with TODO.md
This commit is contained in:
+15
-5
@@ -206,6 +206,8 @@ UPDATE inbox_items SET payload = json_set(json_remove(payload, '$.recommended_op
|
||||
WHERE kind = 'question' AND json_type(payload, '$.recommended_option') IS NOT NULL;
|
||||
`}, {"unsnooze-inbox-items", `
|
||||
UPDATE inbox_items SET snoozed_until = NULL WHERE snoozed_until IS NOT NULL;
|
||||
`}, {"add-task-todo-item", `
|
||||
ALTER TABLE tasks ADD COLUMN todo_item TEXT NOT NULL DEFAULT '';
|
||||
`}}
|
||||
|
||||
type Store struct {
|
||||
@@ -426,11 +428,15 @@ func (s *Store) GetProject(ctx context.Context, id string) (api.Project, error)
|
||||
}
|
||||
|
||||
func (s *Store) CreateTask(ctx context.Context, t api.Task) error {
|
||||
todoItem := ""
|
||||
if t.TodoItem != nil {
|
||||
todoItem = *t.TodoItem
|
||||
}
|
||||
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
|
||||
_, err := tx.ExecContext(ctx, `
|
||||
INSERT INTO tasks (id, project_id, title, branch, worktree_path, base_ref, status, created_by, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`, t.Id, t.ProjectId, t.Title, t.Branch, t.WorktreePath, t.BaseRef, string(t.Status), t.CreatedBy, formatTime(t.CreatedAt))
|
||||
INSERT INTO tasks (id, project_id, title, branch, worktree_path, base_ref, status, created_by, created_at, todo_item)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`, t.Id, t.ProjectId, t.Title, t.Branch, t.WorktreePath, t.BaseRef, string(t.Status), t.CreatedBy, formatTime(t.CreatedAt), todoItem)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -801,7 +807,7 @@ func (s *Store) write(ctx context.Context, fn func(tx *sql.Tx, emit emitFunc) er
|
||||
|
||||
const projectColumns = `id, name, repo_path, default_branch, remote, created_by, created_at`
|
||||
|
||||
const taskColumns = `id, project_id, title, merge_title, branch, worktree_path, base_ref, status, created_by, created_at, closed_at, merge_commit`
|
||||
const taskColumns = `id, project_id, title, merge_title, branch, worktree_path, base_ref, status, created_by, created_at, closed_at, merge_commit, todo_item`
|
||||
|
||||
const sessionColumns = `id, task_id, vendor, model, vendor_session_id, state, role, created_by, created_at`
|
||||
|
||||
@@ -826,7 +832,8 @@ func scanTask(row scanner) (api.Task, error) {
|
||||
createdAt := ""
|
||||
closedAt := sql.NullString{}
|
||||
mergeCommit := ""
|
||||
err := row.Scan(&t.Id, &t.ProjectId, &t.Title, &t.MergeTitle, &t.Branch, &t.WorktreePath, &t.BaseRef, &status, &t.CreatedBy, &createdAt, &closedAt, &mergeCommit)
|
||||
todoItem := ""
|
||||
err := row.Scan(&t.Id, &t.ProjectId, &t.Title, &t.MergeTitle, &t.Branch, &t.WorktreePath, &t.BaseRef, &status, &t.CreatedBy, &createdAt, &closedAt, &mergeCommit, &todoItem)
|
||||
if err != nil {
|
||||
return t, err
|
||||
}
|
||||
@@ -848,6 +855,9 @@ func scanTask(row scanner) (api.Task, error) {
|
||||
if mergeCommit != "" {
|
||||
t.MergeCommit = &mergeCommit
|
||||
}
|
||||
if todoItem != "" {
|
||||
t.TodoItem = &todoItem
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user