read the task category order from the items store
CATEGORY_ORDER hardcoded Video/Audio/Cleanup in the frontend, so adding a category meant a code change. The order now lives in categories.yaml at the root of the items store and reaches the client via GET /tasks/categories — the platform no longer knows any category by name. The endpoint is declared before /:name, which would otherwise match "categories". Categories used by a task but absent from the file still work: they sort alphabetically after the listed ones, and Other stays last. Menus consume grouped tasks rather than grouping them per row. Groups are built from the tasks and the file only ranks them, so a category listed with no matching tasks cannot produce an empty submenu — locked in by tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
6a77ec22df
commit
5f7d574dec
@@ -1,5 +1,5 @@
|
||||
import { createRouter } from '../../create-router';
|
||||
import { listTasks, getTaskByDirName, createTask, deleteTask } from './task-files';
|
||||
import { listTasks, getTaskByDirName, createTask, deleteTask, readCategoryOrder } from './task-files';
|
||||
|
||||
type TriggerConfig = { type: 'file'; extensions: string[] } | { type: 'directory' };
|
||||
|
||||
@@ -20,6 +20,11 @@ tasksRouter.get('/', async (ctx) => {
|
||||
return ctx.json(tasks);
|
||||
});
|
||||
|
||||
// Must be declared before '/:name', which would otherwise match "categories".
|
||||
tasksRouter.get('/categories', async (ctx) => {
|
||||
return ctx.json(await readCategoryOrder());
|
||||
});
|
||||
|
||||
tasksRouter.get('/:name', async (ctx) => {
|
||||
const name = ctx.req.param('name');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user