@@ -5,6 +5,14 @@ import { formatDocsLink } from "../../../packages/terminal-core/src/links.js";
55import { theme } from "../../../packages/terminal-core/src/theme.js" ;
66import { setVerbose } from "../../globals.js" ;
77import { defaultRuntime } from "../../runtime.js" ;
8+ import { TASK_FLOW_STATUSES } from "../../tasks/task-flow-registry.types.js" ;
9+ import { TASK_RUNTIMES , TASK_STATUSES } from "../../tasks/task-registry.types.js" ;
10+ import {
11+ TASK_SYSTEM_AUDIT_CODES ,
12+ TASK_SYSTEM_AUDIT_SEVERITIES ,
13+ type TaskSystemAuditCode ,
14+ type TaskSystemAuditSeverity ,
15+ } from "../../tasks/task-system-audit.types.js" ;
816import { runCommandWithRuntime } from "../cli-utils.js" ;
917import { formatHelpExamples } from "../help-format.js" ;
1018
@@ -591,11 +599,8 @@ export function registerStatusHealthSessionsCommands(program: Command) {
591599 . command ( "tasks" )
592600 . description ( "Inspect durable background tasks and TaskFlow state" )
593601 . option ( "--json" , "Output as JSON" , false )
594- . option ( "--runtime <name>" , "Filter by kind (subagent, acp, cron, cli)" )
595- . option (
596- "--status <name>" ,
597- "Filter by status (queued, running, succeeded, failed, timed_out, cancelled, lost)" ,
598- )
602+ . option ( "--runtime <name>" , `Filter by kind (${ TASK_RUNTIMES . join ( ", " ) } )` )
603+ . option ( "--status <name>" , `Filter by status (${ TASK_STATUSES . join ( ", " ) } )` )
599604 . action ( async ( opts ) => {
600605 await runCommandWithRuntime ( defaultRuntime , async ( ) => {
601606 const { tasksListCommand } = await loadTasksCommands ( ) ;
@@ -615,11 +620,8 @@ export function registerStatusHealthSessionsCommands(program: Command) {
615620 . command ( "list" )
616621 . description ( "List tracked background tasks" )
617622 . option ( "--json" , "Output as JSON" , false )
618- . option ( "--runtime <name>" , "Filter by kind (subagent, acp, cron, cli)" )
619- . option (
620- "--status <name>" ,
621- "Filter by status (queued, running, succeeded, failed, timed_out, cancelled, lost)" ,
622- )
623+ . option ( "--runtime <name>" , `Filter by kind (${ TASK_RUNTIMES . join ( ", " ) } )` )
624+ . option ( "--status <name>" , `Filter by status (${ TASK_STATUSES . join ( ", " ) } )` )
623625 . action ( async ( opts , command ) => {
624626 const parentOpts = command . parent ?. opts ( ) as
625627 | {
@@ -645,11 +647,8 @@ export function registerStatusHealthSessionsCommands(program: Command) {
645647 . command ( "audit" )
646648 . description ( "Show stale or broken background tasks and TaskFlows" )
647649 . option ( "--json" , "Output as JSON" , false )
648- . option ( "--severity <level>" , "Filter by severity (warn, error)" )
649- . option (
650- "--code <name>" ,
651- "Filter by finding code (stale_queued, stale_running, lost, delivery_failed, missing_cleanup, inconsistent_timestamps, restore_failed, stale_waiting, stale_blocked, cancel_stuck, missing_linked_tasks, blocked_task_missing)" ,
652- )
650+ . option ( "--severity <level>" , `Filter by severity (${ TASK_SYSTEM_AUDIT_SEVERITIES . join ( ", " ) } )` )
651+ . option ( "--code <name>" , `Filter by finding code (${ TASK_SYSTEM_AUDIT_CODES . join ( ", " ) } )` )
653652 . option ( "--limit <n>" , "Limit displayed findings" )
654653 . action ( async ( opts , command ) => {
655654 const parentOpts = command . parent ?. opts ( ) as { json ?: boolean } | undefined ;
@@ -662,21 +661,8 @@ export function registerStatusHealthSessionsCommands(program: Command) {
662661 await tasksAuditCommand (
663662 {
664663 json : Boolean ( opts . json || parentOpts ?. json ) ,
665- severity : opts . severity as "warn" | "error" | undefined ,
666- code : opts . code as
667- | "stale_queued"
668- | "stale_running"
669- | "lost"
670- | "delivery_failed"
671- | "missing_cleanup"
672- | "inconsistent_timestamps"
673- | "restore_failed"
674- | "stale_waiting"
675- | "stale_blocked"
676- | "cancel_stuck"
677- | "missing_linked_tasks"
678- | "blocked_task_missing"
679- | undefined ,
664+ severity : opts . severity as TaskSystemAuditSeverity | undefined ,
665+ code : opts . code as TaskSystemAuditCode | undefined ,
680666 limit,
681667 } ,
682668 defaultRuntime ,
@@ -784,10 +770,7 @@ export function registerStatusHealthSessionsCommands(program: Command) {
784770 . command ( "list" )
785771 . description ( "List tracked TaskFlows" )
786772 . option ( "--json" , "Output as JSON" , false )
787- . option (
788- "--status <name>" ,
789- "Filter by status (queued, running, waiting, blocked, succeeded, failed, cancelled, lost)" ,
790- )
773+ . option ( "--status <name>" , `Filter by status (${ TASK_FLOW_STATUSES . join ( ", " ) } )` )
791774 . action ( async ( opts ) => {
792775 await runCommandWithRuntime ( defaultRuntime , async ( ) => {
793776 const { flowsListCommand } = await loadFlowsCommands ( ) ;
0 commit comments