fix: add missing route imports in server index.ts (server crash fix)

This commit is contained in:
Brad Groux 2026-01-28 12:20:06 -06:00
parent 485fedade6
commit c77f2b092a
5 changed files with 89 additions and 2 deletions

View file

@ -2167,3 +2167,6 @@
{"type":"task.created","taskId":"task_20260128_OgXGkk","status":"todo","id":"evt_WxsQ4lTtVVlo","timestamp":"2026-01-28T18:18:35.974Z"}
{"type":"task.created","taskId":"task_20260128_N81BNu","status":"todo","id":"evt_DqdIl0sJ62OO","timestamp":"2026-01-28T18:18:35.974Z"}
{"type":"task.created","taskId":"task_20260128_-MLrjY","status":"todo","id":"evt_Uq3tmL-gTpTY","timestamp":"2026-01-28T18:18:35.975Z"}
{"type":"task.status_changed","taskId":"task_20260128_HUc92E","project":"veritas-kanban","status":"done","previousStatus":"in-progress","id":"evt_100CucAjLnzI","timestamp":"2026-01-28T18:18:48.434Z"}
{"type":"task.status_changed","taskId":"task_20260128_vIi7cG","project":"veritas-kanban","status":"in-progress","previousStatus":"todo","id":"evt_HNmt6F9nP9y-","timestamp":"2026-01-28T18:19:18.519Z"}
{"type":"task.created","taskId":"task_20260128_Mobksx","status":"todo","id":"evt_8SCBvkLypJce","timestamp":"2026-01-28T18:19:22.117Z"}

View file

@ -97,6 +97,38 @@ veritas-kanban/
└── agent-requests/
```
## API Versioning
All API endpoints support versioned paths. The current (and default) version is **v1**.
### URL Patterns
| Path | Description |
|------|-------------|
| `/api/v1/tasks` | Canonical versioned endpoint |
| `/api/tasks` | Backwards-compatible alias (same as v1) |
Both paths return identical responses. Existing clients using `/api/...` will continue to work without changes.
### Version Header
Every API response includes an `X-API-Version: v1` header. Clients may optionally send an `X-API-Version` request header to explicitly request a version:
```bash
# Explicit version request
curl -H "X-API-Version: v1" http://localhost:3001/api/tasks
# Requesting an unsupported version returns 400
curl -H "X-API-Version: v99" http://localhost:3001/api/tasks
# → {"error":"Unsupported API version","supported":["v1"]}
```
### Versioning Strategy
- **Non-breaking changes** (new fields, new endpoints) are added to the current version.
- **Breaking changes** will introduce a new version (`v2`). The previous version will remain available during a deprecation period.
- The unversioned `/api/...` alias always points to the latest stable version.
## CLI
```bash

View file

@ -1,4 +1,48 @@
[
{
"id": "activity_1769624362117_qqkovb929",
"type": "task_created",
"taskId": "task_20260128_Mobksx",
"taskTitle": "test-cache-check",
"details": {
"type": "code",
"priority": "medium"
},
"timestamp": "2026-01-28T18:19:22.117Z"
},
{
"id": "activity_1769624358520_c3xljtn9p",
"type": "status_changed",
"taskId": "task_20260128_vIi7cG",
"taskTitle": "PERF: Memoize TaskCard cardMetrics to prevent unnecessary re-renders",
"details": {
"from": "todo",
"status": "in-progress"
},
"timestamp": "2026-01-28T18:19:18.520Z"
},
{
"id": "activity_1769624333283_mrcee6a4t",
"type": "comment_added",
"taskId": "task_20260128_HUc92E",
"taskTitle": "PERF: Implement in-memory caching for TaskService with file watchers",
"details": {
"author": "Veritas",
"preview": "Added in-memory Map<taskId, Task> cache with lazy ..."
},
"timestamp": "2026-01-28T18:18:53.283Z"
},
{
"id": "activity_1769624328434_x39kzrrt3",
"type": "status_changed",
"taskId": "task_20260128_HUc92E",
"taskTitle": "PERF: Implement in-memory caching for TaskService with file watchers",
"details": {
"from": "in-progress",
"status": "done"
},
"timestamp": "2026-01-28T18:18:48.434Z"
},
{
"id": "activity_1769624199491_2nk1070ar",
"type": "status_changed",

View file

@ -23,6 +23,14 @@ import { apiRateLimit } from './middleware/rate-limit.js';
import { apiVersionMiddleware } from './middleware/api-version.js';
import { apiCacheHeaders } from './middleware/cache-control.js';
import type { AgentOutput } from './services/clawdbot-agent-service.js';
import { taskArchiveRoutes } from './routes/task-archive.js';
import { taskTimeRoutes } from './routes/task-time.js';
import { taskRoutes } from './routes/tasks.js';
import { taskCommentRoutes } from './routes/task-comments.js';
import { taskSubtaskRoutes } from './routes/task-subtasks.js';
import attachmentRoutes from './routes/attachments.js';
import { configRoutes } from './routes/config.js';
import { agentRoutes } from './routes/agents.js';
const app = express();
const PORT = process.env.PORT || 3001;

View file

@ -8,7 +8,7 @@
* - Archive and time routes MUST come before main taskRoutes so that
* /archived and /time/summary are matched before the /:id param.
*/
import { Router } from 'express';
import { Router, type IRouter } from 'express';
// Task routes (order-sensitive — see note above)
import { taskArchiveRoutes } from '../task-archive.js';
@ -41,7 +41,7 @@ import { agentStatusRoutes } from '../agent-status.js';
import { statusHistoryRoutes } from '../status-history.js';
import digestRoutes from '../digest.js';
const v1Router = Router();
const v1Router: IRouter = Router();
// ── Task routes (order-sensitive) ────────────────────────────
v1Router.use('/tasks', taskArchiveRoutes);