@agentuity/cli 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +7 -0
- package/dist/auth.js.map +1 -1
- package/dist/cache/resource-region.d.ts +1 -1
- package/dist/cache/resource-region.d.ts.map +1 -1
- package/dist/cache/resource-region.js.map +1 -1
- package/dist/cmd/ai/claude-code/install.d.ts.map +1 -1
- package/dist/cmd/ai/claude-code/install.js +0 -1
- package/dist/cmd/ai/claude-code/install.js.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +4 -2
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.js +18 -4
- package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +1 -1
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/email/create.d.ts +3 -0
- package/dist/cmd/cloud/email/create.d.ts.map +1 -0
- package/dist/cmd/cloud/email/create.js +58 -0
- package/dist/cmd/cloud/email/create.js.map +1 -0
- package/dist/cmd/cloud/email/delete.d.ts +3 -0
- package/dist/cmd/cloud/email/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/email/delete.js +47 -0
- package/dist/cmd/cloud/email/delete.js.map +1 -0
- package/dist/cmd/cloud/email/destination/delete.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/delete.js +54 -0
- package/dist/cmd/cloud/email/destination/delete.js.map +1 -0
- package/dist/cmd/cloud/email/destination/index.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/index.js +14 -0
- package/dist/cmd/cloud/email/destination/index.js.map +1 -0
- package/dist/cmd/cloud/email/destination/list.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/list.js +39 -0
- package/dist/cmd/cloud/email/destination/list.js.map +1 -0
- package/dist/cmd/cloud/email/destination/schemas.d.ts +9 -0
- package/dist/cmd/cloud/email/destination/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/schemas.js +9 -0
- package/dist/cmd/cloud/email/destination/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/destination/url.d.ts +3 -0
- package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -0
- package/dist/cmd/cloud/email/destination/url.js +64 -0
- package/dist/cmd/cloud/email/destination/url.js.map +1 -0
- package/dist/cmd/cloud/email/get.d.ts +3 -0
- package/dist/cmd/cloud/email/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/get.js +43 -0
- package/dist/cmd/cloud/email/get.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/get.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/get.js +44 -0
- package/dist/cmd/cloud/email/inbound/get.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/index.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/index.js +12 -0
- package/dist/cmd/cloud/email/inbound/index.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/list.d.ts +3 -0
- package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/list.js +43 -0
- package/dist/cmd/cloud/email/inbound/list.js.map +1 -0
- package/dist/cmd/cloud/email/inbound/schemas.d.ts +11 -0
- package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/inbound/schemas.js +11 -0
- package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/index.d.ts +3 -0
- package/dist/cmd/cloud/email/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/index.js +28 -0
- package/dist/cmd/cloud/email/index.js.map +1 -0
- package/dist/cmd/cloud/email/list.d.ts +3 -0
- package/dist/cmd/cloud/email/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/list.js +37 -0
- package/dist/cmd/cloud/email/list.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/get.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/get.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/get.js +45 -0
- package/dist/cmd/cloud/email/outbound/get.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/index.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/index.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/index.js +12 -0
- package/dist/cmd/cloud/email/outbound/index.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/list.d.ts +3 -0
- package/dist/cmd/cloud/email/outbound/list.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/list.js +43 -0
- package/dist/cmd/cloud/email/outbound/list.js.map +1 -0
- package/dist/cmd/cloud/email/outbound/schemas.d.ts +15 -0
- package/dist/cmd/cloud/email/outbound/schemas.d.ts.map +1 -0
- package/dist/cmd/cloud/email/outbound/schemas.js +15 -0
- package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -0
- package/dist/cmd/cloud/email/send.d.ts +3 -0
- package/dist/cmd/cloud/email/send.d.ts.map +1 -0
- package/dist/cmd/cloud/email/send.js +77 -0
- package/dist/cmd/cloud/email/send.js.map +1 -0
- package/dist/cmd/cloud/email/util.d.ts +26 -0
- package/dist/cmd/cloud/email/util.d.ts.map +1 -0
- package/dist/cmd/cloud/email/util.js +57 -0
- package/dist/cmd/cloud/email/util.js.map +1 -0
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +8 -0
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts.map +1 -1
- package/dist/cmd/cloud/region-lookup.js +44 -2
- package/dist/cmd/cloud/region-lookup.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts +7 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +46 -28
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js +5 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.js.map +1 -1
- package/dist/cmd/cloud/schedule/create.d.ts +3 -0
- package/dist/cmd/cloud/schedule/create.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/create.js +72 -0
- package/dist/cmd/cloud/schedule/create.js.map +1 -0
- package/dist/cmd/cloud/schedule/delete.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delete.js +38 -0
- package/dist/cmd/cloud/schedule/delete.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/get.js +78 -0
- package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/index.js +23 -0
- package/dist/cmd/cloud/schedule/delivery/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/delivery/list.js +67 -0
- package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/create.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/create.js +97 -0
- package/dist/cmd/cloud/schedule/destination/create.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/delete.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/delete.js +41 -0
- package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/get.js +57 -0
- package/dist/cmd/cloud/schedule/destination/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/index.js +26 -0
- package/dist/cmd/cloud/schedule/destination/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/destination/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/destination/list.js +58 -0
- package/dist/cmd/cloud/schedule/destination/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/get.d.ts +3 -0
- package/dist/cmd/cloud/schedule/get.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/get.js +76 -0
- package/dist/cmd/cloud/schedule/get.js.map +1 -0
- package/dist/cmd/cloud/schedule/index.d.ts +3 -0
- package/dist/cmd/cloud/schedule/index.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/index.js +35 -0
- package/dist/cmd/cloud/schedule/index.js.map +1 -0
- package/dist/cmd/cloud/schedule/list.d.ts +3 -0
- package/dist/cmd/cloud/schedule/list.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/list.js +60 -0
- package/dist/cmd/cloud/schedule/list.js.map +1 -0
- package/dist/cmd/cloud/schedule/update.d.ts +3 -0
- package/dist/cmd/cloud/schedule/update.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/update.js +65 -0
- package/dist/cmd/cloud/schedule/update.js.map +1 -0
- package/dist/cmd/cloud/schedule/util.d.ts +11 -0
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/util.js +17 -0
- package/dist/cmd/cloud/schedule/util.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts +3 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -0
- package/dist/cmd/cloud/task/create.js +108 -0
- package/dist/cmd/cloud/task/create.js.map +1 -0
- package/dist/cmd/cloud/task/get.d.ts +3 -0
- package/dist/cmd/cloud/task/get.d.ts.map +1 -0
- package/dist/cmd/cloud/task/get.js +124 -0
- package/dist/cmd/cloud/task/get.js.map +1 -0
- package/dist/cmd/cloud/task/index.d.ts +3 -0
- package/dist/cmd/cloud/task/index.d.ts.map +1 -0
- package/dist/cmd/cloud/task/index.js +33 -0
- package/dist/cmd/cloud/task/index.js.map +1 -0
- package/dist/cmd/cloud/task/list.d.ts +3 -0
- package/dist/cmd/cloud/task/list.d.ts.map +1 -0
- package/dist/cmd/cloud/task/list.js +174 -0
- package/dist/cmd/cloud/task/list.js.map +1 -0
- package/dist/cmd/cloud/task/update.d.ts +3 -0
- package/dist/cmd/cloud/task/update.d.ts.map +1 -0
- package/dist/cmd/cloud/task/update.js +118 -0
- package/dist/cmd/cloud/task/update.js.map +1 -0
- package/dist/cmd/cloud/task/util.d.ts +18 -0
- package/dist/cmd/cloud/task/util.d.ts.map +1 -0
- package/dist/cmd/cloud/task/util.js +45 -0
- package/dist/cmd/cloud/task/util.js.map +1 -0
- package/dist/cmd/cloud/webhook/create.d.ts +3 -0
- package/dist/cmd/cloud/webhook/create.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/create.js +54 -0
- package/dist/cmd/cloud/webhook/create.js.map +1 -0
- package/dist/cmd/cloud/webhook/delete.d.ts +3 -0
- package/dist/cmd/cloud/webhook/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/delete.js +50 -0
- package/dist/cmd/cloud/webhook/delete.js.map +1 -0
- package/dist/cmd/cloud/webhook/deliveries.d.ts +3 -0
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/deliveries.js +123 -0
- package/dist/cmd/cloud/webhook/deliveries.js.map +1 -0
- package/dist/cmd/cloud/webhook/destinations.d.ts +3 -0
- package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/destinations.js +212 -0
- package/dist/cmd/cloud/webhook/destinations.js.map +1 -0
- package/dist/cmd/cloud/webhook/get.d.ts +3 -0
- package/dist/cmd/cloud/webhook/get.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/get.js +50 -0
- package/dist/cmd/cloud/webhook/get.js.map +1 -0
- package/dist/cmd/cloud/webhook/index.d.ts +3 -0
- package/dist/cmd/cloud/webhook/index.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/index.js +45 -0
- package/dist/cmd/cloud/webhook/index.js.map +1 -0
- package/dist/cmd/cloud/webhook/list.d.ts +3 -0
- package/dist/cmd/cloud/webhook/list.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/list.js +72 -0
- package/dist/cmd/cloud/webhook/list.js.map +1 -0
- package/dist/cmd/cloud/webhook/receipts.d.ts +3 -0
- package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/receipts.js +128 -0
- package/dist/cmd/cloud/webhook/receipts.js.map +1 -0
- package/dist/cmd/cloud/webhook/util.d.ts +27 -0
- package/dist/cmd/cloud/webhook/util.d.ts.map +1 -0
- package/dist/cmd/cloud/webhook/util.js +20 -0
- package/dist/cmd/cloud/webhook/util.js.map +1 -0
- package/dist/cmd/project/add/domain.d.ts.map +1 -1
- package/dist/cmd/project/add/domain.js +6 -4
- package/dist/cmd/project/add/domain.js.map +1 -1
- package/dist/cmd/project/domain/check.d.ts.map +1 -1
- package/dist/cmd/project/domain/check.js +10 -5
- package/dist/cmd/project/domain/check.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +2 -1
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/domain.d.ts +3 -2
- package/dist/domain.d.ts.map +1 -1
- package/dist/domain.js +87 -21
- package/dist/domain.js.map +1 -1
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -2
- package/dist/types.js.map +1 -1
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +18 -3
- package/dist/version-check.js.map +1 -1
- package/package.json +6 -6
- package/src/auth.ts +7 -0
- package/src/cache/resource-region.ts +4 -1
- package/src/cmd/ai/claude-code/install.ts +0 -3
- package/src/cmd/build/vite/public-asset-path-plugin.ts +18 -4
- package/src/cmd/cloud/deploy.ts +1 -0
- package/src/cmd/cloud/email/create.ts +70 -0
- package/src/cmd/cloud/email/delete.ts +53 -0
- package/src/cmd/cloud/email/destination/delete.ts +65 -0
- package/src/cmd/cloud/email/destination/index.ts +15 -0
- package/src/cmd/cloud/email/destination/list.ts +46 -0
- package/src/cmd/cloud/email/destination/schemas.ts +9 -0
- package/src/cmd/cloud/email/destination/url.ts +75 -0
- package/src/cmd/cloud/email/get.ts +52 -0
- package/src/cmd/cloud/email/inbound/get.ts +53 -0
- package/src/cmd/cloud/email/inbound/index.ts +13 -0
- package/src/cmd/cloud/email/inbound/list.ts +50 -0
- package/src/cmd/cloud/email/inbound/schemas.ts +11 -0
- package/src/cmd/cloud/email/index.ts +29 -0
- package/src/cmd/cloud/email/list.ts +44 -0
- package/src/cmd/cloud/email/outbound/get.ts +54 -0
- package/src/cmd/cloud/email/outbound/index.ts +13 -0
- package/src/cmd/cloud/email/outbound/list.ts +50 -0
- package/src/cmd/cloud/email/outbound/schemas.ts +15 -0
- package/src/cmd/cloud/email/send.ts +91 -0
- package/src/cmd/cloud/email/util.ts +89 -0
- package/src/cmd/cloud/index.ts +8 -0
- package/src/cmd/cloud/region-lookup.ts +58 -2
- package/src/cmd/cloud/sandbox/snapshot/build.ts +59 -55
- package/src/cmd/cloud/sandbox/snapshot/generate.ts +5 -1
- package/src/cmd/cloud/schedule/create.ts +83 -0
- package/src/cmd/cloud/schedule/delete.ts +43 -0
- package/src/cmd/cloud/schedule/delivery/get.ts +85 -0
- package/src/cmd/cloud/schedule/delivery/index.ts +24 -0
- package/src/cmd/cloud/schedule/delivery/list.ts +82 -0
- package/src/cmd/cloud/schedule/destination/create.ts +110 -0
- package/src/cmd/cloud/schedule/destination/delete.ts +46 -0
- package/src/cmd/cloud/schedule/destination/get.ts +66 -0
- package/src/cmd/cloud/schedule/destination/index.ts +27 -0
- package/src/cmd/cloud/schedule/destination/list.ts +72 -0
- package/src/cmd/cloud/schedule/get.ts +92 -0
- package/src/cmd/cloud/schedule/index.ts +36 -0
- package/src/cmd/cloud/schedule/list.ts +78 -0
- package/src/cmd/cloud/schedule/update.ts +74 -0
- package/src/cmd/cloud/schedule/util.ts +34 -0
- package/src/cmd/cloud/task/create.ts +124 -0
- package/src/cmd/cloud/task/get.ts +138 -0
- package/src/cmd/cloud/task/index.ts +34 -0
- package/src/cmd/cloud/task/list.ts +191 -0
- package/src/cmd/cloud/task/update.ts +123 -0
- package/src/cmd/cloud/task/util.ts +74 -0
- package/src/cmd/cloud/webhook/create.ts +66 -0
- package/src/cmd/cloud/webhook/delete.ts +57 -0
- package/src/cmd/cloud/webhook/deliveries.ts +149 -0
- package/src/cmd/cloud/webhook/destinations.ts +274 -0
- package/src/cmd/cloud/webhook/get.ts +59 -0
- package/src/cmd/cloud/webhook/index.ts +46 -0
- package/src/cmd/cloud/webhook/list.ts +82 -0
- package/src/cmd/cloud/webhook/receipts.ts +157 -0
- package/src/cmd/cloud/webhook/util.ts +35 -0
- package/src/cmd/project/add/domain.ts +10 -4
- package/src/cmd/project/domain/check.ts +16 -5
- package/src/cmd/project/template-flow.ts +2 -1
- package/src/domain.ts +96 -21
- package/src/types.ts +3 -1
- package/src/version-check.ts +22 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const ScheduleListResponseSchema = z.object({
|
|
8
|
+
schedules: z.array(
|
|
9
|
+
z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
created_at: z.string(),
|
|
12
|
+
updated_at: z.string(),
|
|
13
|
+
created_by: z.string(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
description: z.string().nullable(),
|
|
16
|
+
expression: z.string(),
|
|
17
|
+
due_date: z.string(),
|
|
18
|
+
})
|
|
19
|
+
),
|
|
20
|
+
total: z.number(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const listSubcommand = createCommand({
|
|
24
|
+
name: 'list',
|
|
25
|
+
aliases: ['ls'],
|
|
26
|
+
description: 'List schedules',
|
|
27
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
28
|
+
requires: { auth: true, region: true },
|
|
29
|
+
optional: { project: true },
|
|
30
|
+
idempotent: true,
|
|
31
|
+
examples: [
|
|
32
|
+
{ command: getCommand('cloud schedule list'), description: 'List schedules' },
|
|
33
|
+
{ command: getCommand('cloud schedule list --limit 20'), description: 'List 20 schedules' },
|
|
34
|
+
],
|
|
35
|
+
schema: {
|
|
36
|
+
options: z.object({
|
|
37
|
+
limit: z.coerce.number().min(0).optional().describe('Maximum number of schedules'),
|
|
38
|
+
offset: z.coerce.number().min(0).optional().describe('Pagination offset'),
|
|
39
|
+
}),
|
|
40
|
+
response: ScheduleListResponseSchema,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
async handler(ctx) {
|
|
44
|
+
const { opts, options } = ctx;
|
|
45
|
+
const schedule = createScheduleAdapter(ctx);
|
|
46
|
+
const result = await schedule.list({ limit: opts.limit, offset: opts.offset });
|
|
47
|
+
|
|
48
|
+
if (!options.json) {
|
|
49
|
+
if (result.schedules.length === 0) {
|
|
50
|
+
tui.info('No schedules found');
|
|
51
|
+
} else {
|
|
52
|
+
tui.table(
|
|
53
|
+
result.schedules.map((item: {
|
|
54
|
+
id: string;
|
|
55
|
+
created_at: string;
|
|
56
|
+
updated_at: string;
|
|
57
|
+
created_by: string;
|
|
58
|
+
name: string;
|
|
59
|
+
description: string | null;
|
|
60
|
+
expression: string;
|
|
61
|
+
due_date: string;
|
|
62
|
+
}) => ({
|
|
63
|
+
Name: item.name,
|
|
64
|
+
ID: item.id,
|
|
65
|
+
Expression: item.expression,
|
|
66
|
+
'Next Due': item.due_date,
|
|
67
|
+
Created: new Date(item.created_at).toLocaleString(),
|
|
68
|
+
})),
|
|
69
|
+
['Name', 'ID', 'Expression', 'Next Due', 'Created']
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return result;
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export default listSubcommand;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createScheduleAdapter } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const ScheduleUpdateResponseSchema = z.object({
|
|
8
|
+
schedule: z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
created_at: z.string(),
|
|
11
|
+
updated_at: z.string(),
|
|
12
|
+
created_by: z.string(),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
description: z.string().nullable(),
|
|
15
|
+
expression: z.string(),
|
|
16
|
+
due_date: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const updateSubcommand = createCommand({
|
|
21
|
+
name: 'update',
|
|
22
|
+
description: 'Update a schedule',
|
|
23
|
+
tags: ['mutating', 'requires-auth'],
|
|
24
|
+
requires: { auth: true, region: true },
|
|
25
|
+
optional: { project: true },
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
command: getCommand("cloud schedule update sched_abc123 --expression '*/5 * * * *'"),
|
|
29
|
+
description: 'Update schedule expression',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
schema: {
|
|
33
|
+
args: z.object({
|
|
34
|
+
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
35
|
+
}),
|
|
36
|
+
options: z.object({
|
|
37
|
+
name: z.string().optional().describe('Schedule name'),
|
|
38
|
+
expression: z.string().optional().describe('Cron expression'),
|
|
39
|
+
description: z.string().optional().describe('Schedule description'),
|
|
40
|
+
}),
|
|
41
|
+
response: ScheduleUpdateResponseSchema,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
async handler(ctx) {
|
|
45
|
+
const { args, opts, options } = ctx;
|
|
46
|
+
const schedule = createScheduleAdapter(ctx);
|
|
47
|
+
const result = await schedule.update(args.schedule_id, {
|
|
48
|
+
name: opts.name,
|
|
49
|
+
expression: opts.expression,
|
|
50
|
+
description: opts.description,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (!options.json) {
|
|
54
|
+
tui.success(`Updated schedule: ${result.schedule.name}`);
|
|
55
|
+
tui.table(
|
|
56
|
+
[
|
|
57
|
+
{
|
|
58
|
+
Name: result.schedule.name,
|
|
59
|
+
ID: result.schedule.id,
|
|
60
|
+
Expression: result.schedule.expression,
|
|
61
|
+
Description: result.schedule.description ?? '-',
|
|
62
|
+
Updated: new Date(result.schedule.updated_at).toLocaleString(),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
undefined,
|
|
66
|
+
{ layout: 'vertical' }
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return result;
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export default updateSubcommand;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ScheduleService, type Logger } from '@agentuity/core';
|
|
2
|
+
import { createServerFetchAdapter } from '@agentuity/server';
|
|
3
|
+
import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../types';
|
|
4
|
+
import { getCatalystUrl } from '../../../catalyst';
|
|
5
|
+
import * as tui from '../../../tui';
|
|
6
|
+
|
|
7
|
+
export function createScheduleAdapter(
|
|
8
|
+
ctx: {
|
|
9
|
+
logger: Logger;
|
|
10
|
+
auth: AuthData;
|
|
11
|
+
region: string;
|
|
12
|
+
project?: ProjectConfig;
|
|
13
|
+
config: Config | null;
|
|
14
|
+
options: GlobalOptions;
|
|
15
|
+
},
|
|
16
|
+
explicitOrgId?: string
|
|
17
|
+
) {
|
|
18
|
+
const orgId =
|
|
19
|
+
explicitOrgId ??
|
|
20
|
+
ctx.project?.orgId ??
|
|
21
|
+
ctx.options.orgId ??
|
|
22
|
+
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
23
|
+
if (!orgId) {
|
|
24
|
+
tui.fatal(
|
|
25
|
+
'Organization ID is required. Either run from a project directory or use --org-id flag.'
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const adapter = createServerFetchAdapter(
|
|
29
|
+
{ headers: { Authorization: `Bearer ${ctx.auth.apiKey}`, 'x-agentuity-orgid': orgId } },
|
|
30
|
+
ctx.logger
|
|
31
|
+
);
|
|
32
|
+
const baseUrl = getCatalystUrl(ctx.region);
|
|
33
|
+
return new ScheduleService(baseUrl, adapter);
|
|
34
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createStorageAdapter, parseMetadataFlag, cacheTaskId } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import type { TaskPriority, TaskStatus, TaskType } from '@agentuity/core';
|
|
7
|
+
|
|
8
|
+
const TaskCreateResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
|
+
task: z.object({
|
|
11
|
+
id: z.string().describe('Task ID'),
|
|
12
|
+
title: z.string().describe('Task title'),
|
|
13
|
+
type: z.string().describe('Task type'),
|
|
14
|
+
status: z.string().describe('Task status'),
|
|
15
|
+
priority: z.string().describe('Task priority'),
|
|
16
|
+
created_at: z.string().describe('Creation timestamp'),
|
|
17
|
+
}),
|
|
18
|
+
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const createSubcommand = createCommand({
|
|
22
|
+
name: 'create',
|
|
23
|
+
aliases: ['new', 'add'],
|
|
24
|
+
description: 'Create a new task',
|
|
25
|
+
tags: ['mutating', 'slow', 'requires-auth'],
|
|
26
|
+
requires: { auth: true },
|
|
27
|
+
optional: { project: true },
|
|
28
|
+
examples: [
|
|
29
|
+
{
|
|
30
|
+
command: getCommand('cloud task create "Fix login bug" --type bug --created-id agent_001'),
|
|
31
|
+
description: 'Create a bug task',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
command: getCommand(
|
|
35
|
+
'cloud task create "Add dark mode" --type feature --created-id agent_001 --priority high --description "Implement dark mode toggle"'
|
|
36
|
+
),
|
|
37
|
+
description: 'Create a feature with priority and description',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
command: getCommand(
|
|
41
|
+
'cloud task create "Q1 Planning" --type epic --created-id agent_001 --metadata \'{"team":"engineering"}\''
|
|
42
|
+
),
|
|
43
|
+
description: 'Create an epic with metadata',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
schema: {
|
|
47
|
+
args: z.object({
|
|
48
|
+
title: z.string().min(1).describe('the task title'),
|
|
49
|
+
}),
|
|
50
|
+
options: z.object({
|
|
51
|
+
type: z.enum(['epic', 'feature', 'enhancement', 'bug', 'task']).describe('the task type'),
|
|
52
|
+
createdId: z.string().min(1).describe('the ID of the creator (agent or user)'),
|
|
53
|
+
description: z.string().optional().describe('task description'),
|
|
54
|
+
priority: z
|
|
55
|
+
.enum(['high', 'medium', 'low', 'none'])
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('task priority (default: none)'),
|
|
58
|
+
status: z
|
|
59
|
+
.enum(['open', 'in_progress', 'closed'])
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('initial task status (default: open)'),
|
|
62
|
+
parentId: z.string().optional().describe('parent task ID for subtasks'),
|
|
63
|
+
assignedId: z.string().optional().describe('ID of the assigned agent or user'),
|
|
64
|
+
metadata: z.string().optional().describe('JSON metadata object'),
|
|
65
|
+
}),
|
|
66
|
+
response: TaskCreateResponseSchema,
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
async handler(ctx) {
|
|
70
|
+
const { args, opts, options } = ctx;
|
|
71
|
+
const started = Date.now();
|
|
72
|
+
const storage = await createStorageAdapter(ctx);
|
|
73
|
+
|
|
74
|
+
const metadata = parseMetadataFlag(opts.metadata);
|
|
75
|
+
|
|
76
|
+
const task = await storage.create({
|
|
77
|
+
title: args.title,
|
|
78
|
+
type: opts.type as TaskType,
|
|
79
|
+
created_id: opts.createdId,
|
|
80
|
+
description: opts.description,
|
|
81
|
+
priority: opts.priority as TaskPriority,
|
|
82
|
+
status: opts.status as TaskStatus,
|
|
83
|
+
parent_id: opts.parentId,
|
|
84
|
+
assigned_id: opts.assignedId,
|
|
85
|
+
metadata,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const durationMs = Date.now() - started;
|
|
89
|
+
await cacheTaskId(ctx, task.id);
|
|
90
|
+
|
|
91
|
+
if (!options.json) {
|
|
92
|
+
tui.success(`Task created: ${tui.bold(task.id)}`);
|
|
93
|
+
|
|
94
|
+
const tableData: Record<string, string> = {
|
|
95
|
+
Title: task.title,
|
|
96
|
+
Type: task.type,
|
|
97
|
+
Status: task.status,
|
|
98
|
+
Priority: task.priority,
|
|
99
|
+
Created: new Date(task.created_at).toLocaleString(),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (task.description) {
|
|
103
|
+
tableData['Description'] = task.description;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
success: true,
|
|
111
|
+
task: {
|
|
112
|
+
id: task.id,
|
|
113
|
+
title: task.title,
|
|
114
|
+
type: task.type,
|
|
115
|
+
status: task.status,
|
|
116
|
+
priority: task.priority,
|
|
117
|
+
created_at: task.created_at,
|
|
118
|
+
},
|
|
119
|
+
durationMs,
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export default createSubcommand;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createStorageAdapter, cacheTaskId } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
|
|
7
|
+
const TaskGetResponseSchema = z.object({
|
|
8
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
9
|
+
task: z.object({
|
|
10
|
+
id: z.string().describe('Task ID'),
|
|
11
|
+
title: z.string().describe('Task title'),
|
|
12
|
+
description: z.string().optional().describe('Task description'),
|
|
13
|
+
type: z.string().describe('Task type'),
|
|
14
|
+
status: z.string().describe('Task status'),
|
|
15
|
+
priority: z.string().describe('Task priority'),
|
|
16
|
+
parent_id: z.string().optional().describe('Parent task ID'),
|
|
17
|
+
assigned_id: z.string().optional().describe('Assigned agent or user ID'),
|
|
18
|
+
created_id: z.string().describe('Creator ID'),
|
|
19
|
+
closed_id: z.string().optional().describe('Closer ID'),
|
|
20
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe('Task metadata'),
|
|
21
|
+
created_at: z.string().describe('Creation timestamp'),
|
|
22
|
+
updated_at: z.string().describe('Last update timestamp'),
|
|
23
|
+
open_date: z.string().optional().describe('Date task was opened'),
|
|
24
|
+
in_progress_date: z.string().optional().describe('Date task moved to in-progress'),
|
|
25
|
+
closed_date: z.string().optional().describe('Date task was closed'),
|
|
26
|
+
}),
|
|
27
|
+
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const getSubcommand = createCommand({
|
|
31
|
+
name: 'get',
|
|
32
|
+
aliases: ['show', 'info'],
|
|
33
|
+
description: 'Get details of a task by ID',
|
|
34
|
+
tags: ['read-only', 'slow', 'requires-auth'],
|
|
35
|
+
idempotent: true,
|
|
36
|
+
requires: { auth: true },
|
|
37
|
+
optional: { project: true },
|
|
38
|
+
examples: [
|
|
39
|
+
{
|
|
40
|
+
command: getCommand('cloud task get task_abc123'),
|
|
41
|
+
description: 'Get task details',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
command: getCommand('cloud task get task_abc123 --json'),
|
|
45
|
+
description: 'Get task details as JSON',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
schema: {
|
|
49
|
+
args: z.object({
|
|
50
|
+
id: z.string().min(1).describe('the task ID to get'),
|
|
51
|
+
}),
|
|
52
|
+
response: TaskGetResponseSchema,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
async handler(ctx) {
|
|
56
|
+
const { args, options } = ctx;
|
|
57
|
+
const started = Date.now();
|
|
58
|
+
const storage = await createStorageAdapter(ctx);
|
|
59
|
+
|
|
60
|
+
const task = await storage.get(args.id);
|
|
61
|
+
const durationMs = Date.now() - started;
|
|
62
|
+
|
|
63
|
+
if (!task) {
|
|
64
|
+
tui.fatal(`Task not found: ${args.id}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
await cacheTaskId(ctx, task.id);
|
|
68
|
+
|
|
69
|
+
if (!options.json) {
|
|
70
|
+
const tableData: Record<string, string> = {
|
|
71
|
+
ID: task.id,
|
|
72
|
+
Title: task.title,
|
|
73
|
+
Type: task.type,
|
|
74
|
+
Status: task.status,
|
|
75
|
+
Priority: task.priority,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
if (task.description) {
|
|
79
|
+
tableData['Description'] = task.description;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
tableData['Creator'] = task.created_id;
|
|
83
|
+
|
|
84
|
+
if (task.assigned_id) {
|
|
85
|
+
tableData['Assigned'] = task.assigned_id;
|
|
86
|
+
}
|
|
87
|
+
if (task.parent_id) {
|
|
88
|
+
tableData['Parent'] = task.parent_id;
|
|
89
|
+
}
|
|
90
|
+
if (task.closed_id) {
|
|
91
|
+
tableData['Closed By'] = task.closed_id;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
tableData['Created'] = new Date(task.created_at).toLocaleString();
|
|
95
|
+
tableData['Updated'] = new Date(task.updated_at).toLocaleString();
|
|
96
|
+
|
|
97
|
+
if (task.open_date) {
|
|
98
|
+
tableData['Opened'] = new Date(task.open_date).toLocaleString();
|
|
99
|
+
}
|
|
100
|
+
if (task.in_progress_date) {
|
|
101
|
+
tableData['In Progress'] = new Date(task.in_progress_date).toLocaleString();
|
|
102
|
+
}
|
|
103
|
+
if (task.closed_date) {
|
|
104
|
+
tableData['Closed'] = new Date(task.closed_date).toLocaleString();
|
|
105
|
+
}
|
|
106
|
+
if (task.metadata && Object.keys(task.metadata).length > 0) {
|
|
107
|
+
tableData['Metadata'] = JSON.stringify(task.metadata);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
success: true,
|
|
115
|
+
task: {
|
|
116
|
+
id: task.id,
|
|
117
|
+
title: task.title,
|
|
118
|
+
description: task.description,
|
|
119
|
+
type: task.type,
|
|
120
|
+
status: task.status,
|
|
121
|
+
priority: task.priority,
|
|
122
|
+
parent_id: task.parent_id,
|
|
123
|
+
assigned_id: task.assigned_id,
|
|
124
|
+
created_id: task.created_id,
|
|
125
|
+
closed_id: task.closed_id,
|
|
126
|
+
metadata: task.metadata,
|
|
127
|
+
created_at: task.created_at,
|
|
128
|
+
updated_at: task.updated_at,
|
|
129
|
+
open_date: task.open_date,
|
|
130
|
+
in_progress_date: task.in_progress_date,
|
|
131
|
+
closed_date: task.closed_date,
|
|
132
|
+
},
|
|
133
|
+
durationMs,
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export default getSubcommand;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
|
+
import { getSubcommand } from './get';
|
|
3
|
+
import { createSubcommand } from './create';
|
|
4
|
+
import { updateSubcommand } from './update';
|
|
5
|
+
import { listSubcommand } from './list';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
export const taskCommand = createCommand({
|
|
9
|
+
name: 'task',
|
|
10
|
+
description: 'Manage tasks for your projects',
|
|
11
|
+
tags: ['requires-auth', 'slow'],
|
|
12
|
+
examples: [
|
|
13
|
+
{
|
|
14
|
+
command: getCommand('cloud task get task_abc123'),
|
|
15
|
+
description: 'Get task details',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
command: getCommand('cloud task create "Fix bug" --type bug --created-id agent_001'),
|
|
19
|
+
description: 'Create a new bug task',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
command: getCommand('cloud task list --status open'),
|
|
23
|
+
description: 'List open tasks',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
command: getCommand('cloud task update task_abc123 --status in_progress'),
|
|
27
|
+
description: 'Update task status',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
subcommands: [getSubcommand, createSubcommand, updateSubcommand, listSubcommand],
|
|
31
|
+
requires: { auth: true },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default taskCommand;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createCommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { createStorageAdapter } from './util';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import type { TaskPriority, TaskStatus, TaskType, Task } from '@agentuity/core';
|
|
7
|
+
|
|
8
|
+
const TaskListResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
|
+
tasks: z.array(
|
|
11
|
+
z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
title: z.string(),
|
|
14
|
+
type: z.string(),
|
|
15
|
+
status: z.string(),
|
|
16
|
+
priority: z.string(),
|
|
17
|
+
assigned_id: z.string().optional(),
|
|
18
|
+
created_at: z.string(),
|
|
19
|
+
updated_at: z.string(),
|
|
20
|
+
})
|
|
21
|
+
),
|
|
22
|
+
total: z.number().describe('Total number of matching tasks'),
|
|
23
|
+
limit: z.number().describe('Page size'),
|
|
24
|
+
offset: z.number().describe('Page offset'),
|
|
25
|
+
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const PRIORITY_COLORS: Record<string, (s: string) => string> = {
|
|
29
|
+
high: tui.colorError,
|
|
30
|
+
medium: tui.colorWarning,
|
|
31
|
+
low: tui.colorInfo,
|
|
32
|
+
none: tui.muted,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const STATUS_COLORS: Record<string, (s: string) => string> = {
|
|
36
|
+
open: tui.colorSuccess,
|
|
37
|
+
in_progress: tui.colorWarning,
|
|
38
|
+
closed: tui.muted,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function formatPriority(p: string): string {
|
|
42
|
+
const colorFn = PRIORITY_COLORS[p] ?? tui.muted;
|
|
43
|
+
return colorFn(p);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function formatStatus(s: string): string {
|
|
47
|
+
const colorFn = STATUS_COLORS[s] ?? tui.muted;
|
|
48
|
+
return colorFn(s);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function truncate(s: string, max: number): string {
|
|
52
|
+
if (s.length <= max) return s;
|
|
53
|
+
return `${s.slice(0, max - 1)}…`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const listSubcommand = createCommand({
|
|
57
|
+
name: 'list',
|
|
58
|
+
aliases: ['ls'],
|
|
59
|
+
description: 'List tasks with optional filtering and sorting',
|
|
60
|
+
tags: ['read-only', 'slow', 'requires-auth'],
|
|
61
|
+
requires: { auth: true },
|
|
62
|
+
optional: { project: true },
|
|
63
|
+
idempotent: true,
|
|
64
|
+
pagination: {
|
|
65
|
+
supported: true,
|
|
66
|
+
defaultLimit: 50,
|
|
67
|
+
maxLimit: 100,
|
|
68
|
+
parameters: { limit: 'limit', offset: 'offset' },
|
|
69
|
+
},
|
|
70
|
+
examples: [
|
|
71
|
+
{
|
|
72
|
+
command: getCommand('cloud task list'),
|
|
73
|
+
description: 'List all tasks',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
command: getCommand('cloud task list --status open --priority high'),
|
|
77
|
+
description: 'List open high-priority tasks',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
command: getCommand('cloud task list --type bug --sort created_at --order asc'),
|
|
81
|
+
description: 'List bugs sorted by oldest first',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
command: getCommand('cloud task list --assigned-id agent_001 --limit 10'),
|
|
85
|
+
description: 'List first 10 tasks assigned to an agent',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
schema: {
|
|
89
|
+
options: z.object({
|
|
90
|
+
status: z.enum(['open', 'in_progress', 'closed']).optional().describe('filter by status'),
|
|
91
|
+
type: z
|
|
92
|
+
.enum(['epic', 'feature', 'enhancement', 'bug', 'task'])
|
|
93
|
+
.optional()
|
|
94
|
+
.describe('filter by type'),
|
|
95
|
+
priority: z
|
|
96
|
+
.enum(['high', 'medium', 'low', 'none'])
|
|
97
|
+
.optional()
|
|
98
|
+
.describe('filter by priority'),
|
|
99
|
+
assignedId: z.string().optional().describe('filter by assigned agent or user ID'),
|
|
100
|
+
parentId: z.string().optional().describe('filter by parent task ID'),
|
|
101
|
+
sort: z
|
|
102
|
+
.enum([
|
|
103
|
+
'created_at',
|
|
104
|
+
'updated_at',
|
|
105
|
+
'priority',
|
|
106
|
+
'status',
|
|
107
|
+
'title',
|
|
108
|
+
'type',
|
|
109
|
+
'open_date',
|
|
110
|
+
'in_progress_date',
|
|
111
|
+
'closed_date',
|
|
112
|
+
])
|
|
113
|
+
.optional()
|
|
114
|
+
.describe('field to sort by (default: created_at)'),
|
|
115
|
+
order: z.enum(['asc', 'desc']).optional().describe('sort order (default: desc)'),
|
|
116
|
+
limit: z.coerce.number().optional().describe('max results to return (default: 50)'),
|
|
117
|
+
offset: z.coerce.number().optional().describe('offset for pagination'),
|
|
118
|
+
}),
|
|
119
|
+
response: TaskListResponseSchema,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
async handler(ctx) {
|
|
123
|
+
const { opts, options } = ctx;
|
|
124
|
+
const started = Date.now();
|
|
125
|
+
const storage = await createStorageAdapter(ctx);
|
|
126
|
+
|
|
127
|
+
const result = await storage.list({
|
|
128
|
+
status: opts.status as TaskStatus | undefined,
|
|
129
|
+
type: opts.type as TaskType | undefined,
|
|
130
|
+
priority: opts.priority as TaskPriority | undefined,
|
|
131
|
+
assigned_id: opts.assignedId,
|
|
132
|
+
parent_id: opts.parentId,
|
|
133
|
+
sort: opts.sort,
|
|
134
|
+
order: opts.order,
|
|
135
|
+
limit: opts.limit,
|
|
136
|
+
offset: opts.offset,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const durationMs = Date.now() - started;
|
|
140
|
+
|
|
141
|
+
if (!options.json) {
|
|
142
|
+
if (result.tasks.length === 0) {
|
|
143
|
+
tui.info('No tasks found');
|
|
144
|
+
} else {
|
|
145
|
+
const tableData = result.tasks.map((task: Task) => ({
|
|
146
|
+
ID: tui.muted(truncate(task.id, 28)),
|
|
147
|
+
Title: truncate(task.title, 40),
|
|
148
|
+
Type: task.type,
|
|
149
|
+
Status: formatStatus(task.status),
|
|
150
|
+
Priority: formatPriority(task.priority),
|
|
151
|
+
Assigned: task.assigned_id ?? tui.muted('—'),
|
|
152
|
+
Updated: new Date(task.updated_at).toLocaleDateString(),
|
|
153
|
+
}));
|
|
154
|
+
|
|
155
|
+
tui.table(tableData, [
|
|
156
|
+
{ name: 'ID', alignment: 'left' },
|
|
157
|
+
{ name: 'Title', alignment: 'left' },
|
|
158
|
+
{ name: 'Type', alignment: 'left' },
|
|
159
|
+
{ name: 'Status', alignment: 'left' },
|
|
160
|
+
{ name: 'Priority', alignment: 'left' },
|
|
161
|
+
{ name: 'Assigned', alignment: 'left' },
|
|
162
|
+
{ name: 'Updated', alignment: 'left' },
|
|
163
|
+
]);
|
|
164
|
+
|
|
165
|
+
tui.info(
|
|
166
|
+
`\nShowing ${result.tasks.length} of ${result.total} ${tui.plural(result.total, 'task', 'tasks')} (${durationMs.toFixed(1)}ms)`
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
success: true,
|
|
173
|
+
tasks: result.tasks.map((task: Task) => ({
|
|
174
|
+
id: task.id,
|
|
175
|
+
title: task.title,
|
|
176
|
+
type: task.type,
|
|
177
|
+
status: task.status,
|
|
178
|
+
priority: task.priority,
|
|
179
|
+
assigned_id: task.assigned_id,
|
|
180
|
+
created_at: task.created_at,
|
|
181
|
+
updated_at: task.updated_at,
|
|
182
|
+
})),
|
|
183
|
+
total: result.total,
|
|
184
|
+
limit: result.limit,
|
|
185
|
+
offset: result.offset,
|
|
186
|
+
durationMs,
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export default listSubcommand;
|