claude-queue 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server/index.js
CHANGED
|
@@ -617,6 +617,46 @@ router2.post("/:id/move", (req, res) => {
|
|
|
617
617
|
const updated = db2.prepare("SELECT * FROM tasks WHERE id = ?").get(req.params.id);
|
|
618
618
|
res.json(rowToTask(updated));
|
|
619
619
|
});
|
|
620
|
+
router2.post("/:id/force-reset", (req, res) => {
|
|
621
|
+
const { status = "backlog" } = req.body;
|
|
622
|
+
if (status !== "ready" && status !== "backlog") {
|
|
623
|
+
res.status(400).json({ error: "status must be 'ready' or 'backlog'" });
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
const db2 = getDb();
|
|
627
|
+
const task = db2.prepare("SELECT * FROM tasks WHERE id = ?").get(req.params.id);
|
|
628
|
+
if (!task) {
|
|
629
|
+
res.status(404).json({ error: "Task not found" });
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (task.status !== "in_progress") {
|
|
633
|
+
res.status(400).json({ error: "Can only force-reset tasks that are in progress" });
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const oldStatus = task.status;
|
|
637
|
+
db2.transaction(() => {
|
|
638
|
+
db2.prepare(`
|
|
639
|
+
UPDATE tasks SET position = position - 1
|
|
640
|
+
WHERE project_id = ? AND status = ? AND position > ?
|
|
641
|
+
`).run(task.project_id, oldStatus, task.position);
|
|
642
|
+
const maxPosition = db2.prepare("SELECT COALESCE(MAX(position), -1) as max FROM tasks WHERE project_id = ? AND status = ?").get(task.project_id, status);
|
|
643
|
+
const newPosition = maxPosition.max + 1;
|
|
644
|
+
db2.prepare(`
|
|
645
|
+
UPDATE tasks
|
|
646
|
+
SET status = ?, position = ?, started_at = NULL, starting_commit = NULL,
|
|
647
|
+
current_activity = NULL, blocked = 0, updated_at = CURRENT_TIMESTAMP
|
|
648
|
+
WHERE id = ?
|
|
649
|
+
`).run(status, newPosition, req.params.id);
|
|
650
|
+
db2.prepare(`
|
|
651
|
+
UPDATE comments SET seen = 1
|
|
652
|
+
WHERE task_id = ? AND author = 'user' AND seen = 0
|
|
653
|
+
AND (content LIKE '%[ACTION:CANCEL]%' OR content LIKE '%[ACTION:RESET]%')
|
|
654
|
+
`).run(req.params.id);
|
|
655
|
+
})();
|
|
656
|
+
logTaskActivity(req.params.id, "status_change", oldStatus, status);
|
|
657
|
+
const updated = db2.prepare("SELECT * FROM tasks WHERE id = ?").get(req.params.id);
|
|
658
|
+
res.json(rowToTask(updated));
|
|
659
|
+
});
|
|
620
660
|
router2.delete("/:id", (req, res) => {
|
|
621
661
|
const db2 = getDb();
|
|
622
662
|
const task = db2.prepare("SELECT * FROM tasks WHERE id = ?").get(req.params.id);
|