Skip to content

Commit bfc6bd3

Browse files
authored
fix(cli): honor inherited tasks options (#117528)
* fix(cli): honor inherited tasks options * test(cli): classify task flow JSON support
1 parent 3bfc9bc commit bfc6bd3

7 files changed

Lines changed: 643 additions & 392 deletions

‎config/assertion-safety-baseline.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2481,7 +2481,7 @@ src/cli/program/register.configure.ts 1
24812481
src/cli/program/register.migrate.ts 12
24822482
src/cli/program/register.onboard.ts 37
24832483
src/cli/program/register.setup.ts 10
2484-
src/cli/program/register.status-health-sessions.ts 41
2484+
src/cli/program/register.status-health-sessions.ts 29
24852485
src/cli/program/route-specs.ts 1
24862486
src/cli/run-main.ts 1
24872487
src/cli/sandbox-cli.ts 4

‎config/max-lines-baseline.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ src/cli/plugins-cli-test-helpers.ts
499499
src/cli/plugins-cli.install.test.ts
500500
src/cli/plugins-cli.runtime.ts
501501
src/cli/plugins-cli.update.test.ts
502-
src/cli/program/register.status-health-sessions.ts
503502
src/cli/run-main.exit.test.ts
504503
src/cli/run-main.ts
505504
src/cli/skills-cli.commands.test.ts

‎src/cli/program/register.status-health-sessions.test.ts‎

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ const mocks = vi.hoisted(() => ({
1414
sessionsArchiveCommand: vi.fn(),
1515
sessionsDeleteCommand: vi.fn(),
1616
exportTrajectoryCommand: vi.fn(),
17-
tasksListCommand: vi.fn(),
18-
tasksAuditCommand: vi.fn(),
19-
tasksMaintenanceCommand: vi.fn(),
20-
tasksShowCommand: vi.fn(),
21-
tasksNotifyCommand: vi.fn(),
22-
tasksCancelCommand: vi.fn(),
23-
flowsListCommand: vi.fn(),
24-
flowsShowCommand: vi.fn(),
25-
flowsCancelCommand: vi.fn(),
2617
setVerbose: vi.fn(),
2718
runtime: {
2819
log: vi.fn(),
@@ -40,15 +31,6 @@ const sessionsCompactCommand = mocks.sessionsCompactCommand;
4031
const sessionsArchiveCommand = mocks.sessionsArchiveCommand;
4132
const sessionsDeleteCommand = mocks.sessionsDeleteCommand;
4233
const exportTrajectoryCommand = mocks.exportTrajectoryCommand;
43-
const tasksListCommand = mocks.tasksListCommand;
44-
const tasksAuditCommand = mocks.tasksAuditCommand;
45-
const tasksMaintenanceCommand = mocks.tasksMaintenanceCommand;
46-
const tasksShowCommand = mocks.tasksShowCommand;
47-
const tasksNotifyCommand = mocks.tasksNotifyCommand;
48-
const tasksCancelCommand = mocks.tasksCancelCommand;
49-
const flowsListCommand = mocks.flowsListCommand;
50-
const flowsShowCommand = mocks.flowsShowCommand;
51-
const flowsCancelCommand = mocks.flowsCancelCommand;
5234
const setVerbose = mocks.setVerbose;
5335
const runtime = mocks.runtime;
5436

@@ -106,21 +88,6 @@ vi.mock("../../commands/export-trajectory.js", () => ({
10688
exportTrajectoryCommand: mocks.exportTrajectoryCommand,
10789
}));
10890

109-
vi.mock("../../commands/tasks.js", () => ({
110-
tasksListCommand: mocks.tasksListCommand,
111-
tasksAuditCommand: mocks.tasksAuditCommand,
112-
tasksMaintenanceCommand: mocks.tasksMaintenanceCommand,
113-
tasksShowCommand: mocks.tasksShowCommand,
114-
tasksNotifyCommand: mocks.tasksNotifyCommand,
115-
tasksCancelCommand: mocks.tasksCancelCommand,
116-
}));
117-
118-
vi.mock("../../commands/flows.js", () => ({
119-
flowsListCommand: mocks.flowsListCommand,
120-
flowsShowCommand: mocks.flowsShowCommand,
121-
flowsCancelCommand: mocks.flowsCancelCommand,
122-
}));
123-
12491
vi.mock("../../globals.js", () => ({
12592
setVerbose: mocks.setVerbose,
12693
}));
@@ -152,15 +119,6 @@ describe("registerStatusHealthSessionsCommands", () => {
152119
sessionsArchiveCommand.mockResolvedValue(undefined);
153120
sessionsDeleteCommand.mockResolvedValue(undefined);
154121
exportTrajectoryCommand.mockResolvedValue(undefined);
155-
tasksListCommand.mockResolvedValue(undefined);
156-
tasksAuditCommand.mockResolvedValue(undefined);
157-
tasksMaintenanceCommand.mockResolvedValue(undefined);
158-
tasksShowCommand.mockResolvedValue(undefined);
159-
tasksNotifyCommand.mockResolvedValue(undefined);
160-
tasksCancelCommand.mockResolvedValue(undefined);
161-
flowsListCommand.mockResolvedValue(undefined);
162-
flowsShowCommand.mockResolvedValue(undefined);
163-
flowsCancelCommand.mockResolvedValue(undefined);
164122
});
165123

166124
it("runs status command with timeout and debug-derived verbose", async () => {
@@ -605,102 +563,4 @@ describe("registerStatusHealthSessionsCommands", () => {
605563
expect(runtime.exit).toHaveBeenCalledWith(1);
606564
expect(exportTrajectoryCommand).not.toHaveBeenCalled();
607565
});
608-
609-
it("runs tasks list from the parent command", async () => {
610-
await runCli(["tasks", "--json", "--runtime", "acp", "--status", "running"]);
611-
612-
expectCommandOptions(tasksListCommand, {
613-
json: true,
614-
runtime: "acp",
615-
status: "running",
616-
});
617-
});
618-
619-
it("runs tasks show subcommand with lookup forwarding", async () => {
620-
await runCli(["tasks", "show", "run-123", "--json"]);
621-
622-
expectCommandOptions(tasksShowCommand, {
623-
lookup: "run-123",
624-
json: true,
625-
});
626-
});
627-
628-
it("runs tasks maintenance subcommand with apply forwarding", async () => {
629-
await runCli(["tasks", "--json", "maintenance", "--apply"]);
630-
631-
expectCommandOptions(tasksMaintenanceCommand, {
632-
json: true,
633-
apply: true,
634-
});
635-
});
636-
637-
it("runs tasks audit subcommand with filters", async () => {
638-
await runCli([
639-
"tasks",
640-
"--json",
641-
"audit",
642-
"--severity",
643-
"error",
644-
"--code",
645-
"stale_running",
646-
"--limit",
647-
"5",
648-
]);
649-
650-
expectCommandOptions(tasksAuditCommand, {
651-
json: true,
652-
severity: "error",
653-
code: "stale_running",
654-
limit: 5,
655-
});
656-
});
657-
658-
it("rejects partially numeric tasks audit limits", async () => {
659-
await runCli(["tasks", "--json", "audit", "--limit", "5abc"]);
660-
661-
expect(runtime.error).toHaveBeenCalledWith(
662-
"--limit must be a positive integer, for example --limit 25.",
663-
);
664-
expect(runtime.exit).toHaveBeenCalledWith(1);
665-
expect(tasksAuditCommand).not.toHaveBeenCalled();
666-
});
667-
668-
it("routes tasks flow commands through the TaskFlow handlers", async () => {
669-
await runCli(["tasks", "flow", "list", "--json", "--status", "blocked"]);
670-
expectCommandOptions(flowsListCommand, {});
671-
672-
await runCli(["tasks", "flow", "show", "flow-123", "--json"]);
673-
expectCommandOptions(flowsShowCommand, {
674-
lookup: "flow-123",
675-
});
676-
677-
await runCli(["tasks", "flow", "cancel", "flow-123"]);
678-
expectCommandOptions(flowsCancelCommand, {
679-
lookup: "flow-123",
680-
});
681-
});
682-
683-
it("runs tasks notify subcommand with lookup and policy forwarding", async () => {
684-
await runCli(["tasks", "notify", "run-123", "state_changes"]);
685-
686-
expectCommandOptions(tasksNotifyCommand, {
687-
lookup: "run-123",
688-
notify: "state_changes",
689-
});
690-
});
691-
692-
it("runs tasks cancel subcommand with lookup forwarding", async () => {
693-
await runCli(["tasks", "cancel", "run-123"]);
694-
695-
expectCommandOptions(tasksCancelCommand, {
696-
lookup: "run-123",
697-
});
698-
});
699-
700-
it("does not register the legacy top-level flows command", () => {
701-
const program = new Command();
702-
registerStatusHealthSessionsCommands(program);
703-
704-
expect(program.commands.find((command) => command.name() === "flows")).toBeUndefined();
705-
});
706566
});

0 commit comments

Comments
 (0)