group file-browser tasks into category submenus
Every task declares a directory trigger, so right-clicking any folder listed all fifteen at once — Tag Album offered on a folder of photos. TASK.md gains an optional `category`, and the context menu nests by it: Run Task > Video > … Nesting only kicks in when more than one category matches. A .mp4 matches eight tasks that are all Video, so file menus stay flat rather than gaining a pointless hop. Known categories lead (Video, Audio, Cleanup); anything else follows alphabetically with Other last. Applied to both menus — the right-click one and the ⋮ dropdown — which carried identical blocks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1d0842cc01
commit
6a77ec22df
@@ -11,6 +11,7 @@ const YAML = (Bun as unknown as { YAML: { parse(input: string): unknown } }).YAM
|
||||
export type TaskFrontmatter = {
|
||||
name: string;
|
||||
description: string | null;
|
||||
category: string | null; // groups the task into a context-menu submenu; null falls back to 'Other'
|
||||
version: number;
|
||||
mode: string;
|
||||
inline: boolean; // quick/interactive tasks run in the modal instead of as a background job
|
||||
@@ -37,6 +38,7 @@ export type TaskSummary = {
|
||||
dirName: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
category: string | null;
|
||||
mode: string;
|
||||
inline: boolean;
|
||||
version: number;
|
||||
@@ -47,6 +49,7 @@ export type TaskSummary = {
|
||||
const FM_KEYS = [
|
||||
'name',
|
||||
'description',
|
||||
'category',
|
||||
'version',
|
||||
'mode',
|
||||
'inline',
|
||||
@@ -106,6 +109,7 @@ function parseTaskMd(raw: string): { fm: TaskFrontmatter; body: string } {
|
||||
fm: {
|
||||
name: parsed.name == null ? '' : String(parsed.name),
|
||||
description: parsed.description == null ? null : String(parsed.description),
|
||||
category: parsed.category == null ? null : String(parsed.category),
|
||||
version,
|
||||
mode: parsed.mode == null ? 'agentic' : String(parsed.mode),
|
||||
inline: parsed.inline === true,
|
||||
@@ -163,6 +167,7 @@ export async function listTasks(): Promise<TaskSummary[]> {
|
||||
dirName: entry.name,
|
||||
name: fm.name || entry.name,
|
||||
description: fm.description,
|
||||
category: fm.category,
|
||||
mode: fm.mode,
|
||||
inline: fm.inline,
|
||||
version: fm.version,
|
||||
@@ -209,6 +214,7 @@ export async function createTask(input: CreateTaskInput): Promise<TaskSummary &
|
||||
dirName,
|
||||
name,
|
||||
description: input.description ?? null,
|
||||
category: null,
|
||||
mode,
|
||||
inline: false,
|
||||
version: 1,
|
||||
|
||||
@@ -12,6 +12,7 @@ tasksRouter.get('/', async (ctx) => {
|
||||
dirName: row.dirName,
|
||||
name: row.name,
|
||||
description: row.description,
|
||||
category: row.category,
|
||||
triggers: (row.trigger as TriggerConfig[]) ?? [],
|
||||
mode: row.mode ?? 'agentic',
|
||||
}));
|
||||
@@ -29,6 +30,7 @@ tasksRouter.get('/:name', async (ctx) => {
|
||||
dirName: task.dirName,
|
||||
name: task.name,
|
||||
description: task.description,
|
||||
category: task.category,
|
||||
mode: task.mode,
|
||||
inline: task.inline,
|
||||
language: task.language,
|
||||
|
||||
Reference in New Issue
Block a user