Restyle the web console and tidy its labels, Ask tab, cleanup and help

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-17 18:08:01 -08:00
1 parent 710c751c2f
commit e9679c47b9
103 files changed
+4054 -2273

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
diff --git a/src/tasks/paginate.js b/src/tasks/paginate.js
index 3f1a2b4..8c9d0e1 100644
--- a/src/tasks/paginate.js
+++ b/src/tasks/paginate.js
@@ -1,7 +1,9 @@
// Cursor paging for GET /tasks: up to 50 tasks a page, oldest first.
-export function paginate(tasks, cursor, limit = 50) {
+export const MAX_LIMIT = 50;
+
+export function paginate(tasks, cursor, limit = MAX_LIMIT) {
const start = cursor ? tasks.findIndex((t) => t.id === cursor) + 1 : 0;
- const page = tasks.slice(start, start + limit);
+ const page = tasks.slice(start, start + Math.min(limit, MAX_LIMIT));
return { tasks: page, nextCursor: page.length === limit ? page[page.length - 1].id : null };
}
diff --git a/src/tasks/routes.js b/src/tasks/routes.js
new file mode 100644
index 0000000..b7d5e22
--- /dev/null
+++ b/src/tasks/routes.js
@@ -0,0 +1,14 @@
+import { paginate } from "./paginate.js";
+import { taskSchema } from "./schema.js";
+
+// The /tasks routes: list with paging and filters, create, update, delete.
+export default async function routes(app) {
+ app.get("/tasks", async (req) => {
+ const { cursor, limit, status, assignee } = req.query;
+ const all = await app.db.tasks.find({ status, assignee });
+ return paginate(all, cursor, Number(limit) || undefined);
+ });
+
+ app.post("/tasks", { schema: { body: taskSchema } }, async (req, reply) => {
+ return reply.code(201).send(await app.db.tasks.insert(req.body));
+ });
+}
diff --git a/src/tasks/schema.js b/src/tasks/schema.js
new file mode 100644
index 0000000..4d0e9a1
--- /dev/null
+++ b/src/tasks/schema.js
@@ -0,0 +1,8 @@
+// The Zod schema for a task.
+export const taskSchema = {
+ type: "object",
+ required: ["title"],
+ properties: {
+ title: { type: "string", minLength: 1 },
+ status: { enum: ["todo", "doing", "done"] },
+ },
+};
+26
View File
@@ -0,0 +1,26 @@
{
"workflow": "deps",
"title": "Update dependencies",
"headline": { "stage": "Report", "cleared": 4, "total": 4, "confidence": "2 updates applied, 1 undone, 1 left alone." },
"docs": [
{
"id": "report",
"title": "Report",
"blocks": [
{
"id": "report",
"state": "settled",
"md": "## What happened\n\n2 updates were applied and pass the tests. 1 update broke a test and was undone. 1 was left alone because it needs a newer Node.\n\n**Folder looked at:** `task-api` (npm, 4 updates).\n\n| Package | Change | Size | Outcome |\n| --- | --- | --- | --- |\n| `fastify` | 4.26.0 to 4.28.1 | small fix | Updated, tests pass |\n| `zod` | 3.22.4 to 3.23.8 | small fix | Updated, tests pass |\n| `pg` | 8.11.3 to 8.13.1 | new features | Undone: `test/db.test.js` failed after the update |\n| `pino` | 8.19.0 to 9.5.0 | big change | Not tried: needs Node 20, you declare 18 |\n\n**Still open:** no known security problems.\n\n**Changes already there before the run:** none.\n\nThe updates are not saved in git yet. The Git skill commits them."
}
]
}
],
"finish": {
"headline": "2 updates applied, 1 undone, 1 not tried",
"body": "`fastify` and `zod` are updated and `npm test` passes. `pg` broke `test/db.test.js` and was put back. `pino` needs Node 20, so it was left alone.",
"command": "/plan2code-git",
"doc": "report",
"dashboard": true
},
"agent": { "status": "waiting" }
}
+61
View File
@@ -0,0 +1,61 @@
{
"title": "task-api: Phase 3",
"headline": { "stage": "Phase 3: API endpoints", "cleared": 11, "total": 11 },
"items": [
{
"id": "lessons",
"kind": "lessons",
"title": "Lessons to keep",
"body": "Choose for each one. Nothing is kept unless you choose it, and anything you leave keeps waiting.",
"opening": null,
"rows": [
{
"id": "l1",
"type": "lesson",
"text": "Every list endpoint pages with a cursor, never an offset.",
"why": "Offsets skip rows when tasks are created while a client is paging.",
"origin": "You said this.",
"note": "",
"flags": [],
"refused": null,
"area": "General",
"kind": "convention",
"about": ["src/tasks"],
"areas": ["General"],
"choices": ["Keep", "Reword", "Drop"]
},
{
"id": "l2",
"type": "lesson",
"text": "Run a single test file with node --test test/tasks.test.js; npm test also starts the Postgres container.",
"why": "",
"origin": "Found by reading the code.",
"note": "",
"flags": [],
"refused": null,
"area": "General",
"kind": "command",
"about": ["test/tasks.test.js"],
"areas": ["General"],
"choices": ["Keep", "Reword", "Drop"]
},
{
"id": "l3",
"type": "lesson",
"text": "Every error goes through errorShape() in src/app.js, so 400, 404 and 409 answer in one shape.",
"why": "",
"origin": "Found by reading the code.",
"note": "",
"flags": [],
"refused": null,
"area": "General",
"kind": "how-it-works",
"about": ["src/app.js"],
"areas": ["General"],
"choices": ["Keep", "Reword", "Drop"]
}
]
}
],
"agent": { "status": "waiting" }
}
+1
View File
@@ -0,0 +1 @@
{"specDir":"specs/task-api"}
+14
View File
@@ -0,0 +1,14 @@
{
"docs": [
{
"id": "changes",
"title": "Changes",
"blocks": [
{
"id": "diff",
"diff": "changes.diff"
}
]
}
]
}