@zinn-dev/cli 0.41.0 → 0.42.0
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/README.md +11 -689
- package/index.js +2 -2
- package/package.json +3 -2
- package/skills/zinn/SKILL.md +1 -1
- package/src/capabilities-schema.d.ts +22 -23
- package/src/capabilities-schema.js +17 -82
- package/src/capabilities.d.ts +11 -3
- package/src/capabilities.js +12 -4
- package/src/column-hint.d.ts +3 -0
- package/src/column-hint.js +225 -0
- package/src/database.js +1 -4
- package/src/errors.js +2 -0
- package/src/input.d.ts +154 -43
- package/src/input.js +86 -13
- package/src/lib.d.ts +30 -2
- package/src/lib.js +74 -13
- package/src/presentation/activity-presentation.d.ts +9 -1
- package/src/presentation/activity-presentation.js +108 -25
- package/src/presentation/capabilities-presentation.d.ts +2 -0
- package/src/presentation/capabilities-presentation.js +3 -0
- package/src/presentation/column-presentation.d.ts +6 -0
- package/src/presentation/column-presentation.js +10 -0
- package/src/presentation/comment-presentation.d.ts +15 -0
- package/src/presentation/comment-presentation.js +29 -0
- package/src/presentation/description-presentation.d.ts +17 -0
- package/src/presentation/description-presentation.js +26 -4
- package/src/presentation/label-presentation.d.ts +8 -0
- package/src/presentation/label-presentation.js +28 -0
- package/src/presentation/project-presentation.d.ts +7 -0
- package/src/presentation/project-presentation.js +19 -0
- package/src/presentation/relation-presentation.d.ts +7 -0
- package/src/presentation/relation-presentation.js +73 -0
- package/src/presentation/task-presentation.d.ts +3 -3
- package/src/presentation/task-presentation.js +22 -18
- package/src/project.d.ts +14 -5
- package/src/project.js +18 -6
- package/src/result-schemas.d.ts +230 -23
- package/src/result-schemas.js +62 -3
- package/src/results.d.ts +34 -17
- package/src/results.js +19 -0
- package/src/routes/activity-router.d.ts +34 -1
- package/src/routes/activity-router.js +104 -31
- package/src/routes/aliases.d.ts +2 -0
- package/src/routes/aliases.js +11 -0
- package/src/routes/capabilities-router.js +9 -3
- package/src/routes/comment-router.d.ts +41 -18
- package/src/routes/comment-router.js +65 -48
- package/src/routes/label-router.d.ts +57 -7
- package/src/routes/label-router.js +84 -39
- package/src/routes/project-router.d.ts +34 -12
- package/src/routes/project-router.js +59 -55
- package/src/routes/relation-router.d.ts +6 -6
- package/src/routes/relation-router.js +52 -69
- package/src/routes/restore-router.js +1 -1
- package/src/routes/router.d.ts +1 -1
- package/src/routes/router.js +38 -9
- package/src/routes/routes.d.ts +253 -45
- package/src/routes/routes.js +4 -0
- package/src/routes/task-router.d.ts +107 -26
- package/src/routes/task-router.js +151 -143
- package/src/routes/whoami-router.d.ts +21 -0
- package/src/routes/whoami-router.js +31 -0
- package/src/text-edit.d.ts +13 -9
- package/src/text-edit.js +23 -18
- package/src/text-input.d.ts +47 -0
- package/src/text-input.js +187 -0
- package/src/types.d.ts +32 -9
- package/src/types.js +9 -1
package/src/result-schemas.js
CHANGED
|
@@ -7,9 +7,12 @@ const count = z.number().int().nonnegative();
|
|
|
7
7
|
const timestamp = z.number().int().describe("Milliseconds since the Unix epoch.");
|
|
8
8
|
const taskStatus = z.enum(["Active", "Archived"]);
|
|
9
9
|
export const taskSchema = z.strictObject({
|
|
10
|
+
id: z.string().describe("Stored task ID."),
|
|
10
11
|
key: z.string().describe("Readable project key and task number."),
|
|
12
|
+
project_id: z.string().describe("Owning project ID."),
|
|
11
13
|
status: taskStatus,
|
|
12
14
|
column: z.string().describe("Current column name."),
|
|
15
|
+
column_id: z.string().describe("Current column ID."),
|
|
13
16
|
title: z.string(),
|
|
14
17
|
description: nullableText,
|
|
15
18
|
priority: z
|
|
@@ -17,8 +20,10 @@ export const taskSchema = z.strictObject({
|
|
|
17
20
|
.nullable()
|
|
18
21
|
.describe(`Known priorities: ${taskPrioritySchema.options.join(", ")}. Other stored values may occur.`),
|
|
19
22
|
labels: z.array(z.string()).describe("Attached label names."),
|
|
23
|
+
label_ids: z.array(z.string()).describe("Attached label IDs, in the same order as labels."),
|
|
20
24
|
});
|
|
21
25
|
export const relationSchema = z.strictObject({
|
|
26
|
+
id: z.string().describe("Stored relation ID."),
|
|
22
27
|
type: z
|
|
23
28
|
.string()
|
|
24
29
|
.describe(`Known relation types: ${relationTypeSchema.options.join(", ")}. Other stored values may occur.`),
|
|
@@ -26,15 +31,28 @@ export const relationSchema = z.strictObject({
|
|
|
26
31
|
.enum(["outgoing", "incoming"])
|
|
27
32
|
.nullable()
|
|
28
33
|
.describe("Direction relative to the viewed task; null for a symmetric relation."),
|
|
29
|
-
task: taskSchema.pick({
|
|
34
|
+
task: taskSchema.pick({
|
|
35
|
+
id: true,
|
|
36
|
+
key: true,
|
|
37
|
+
project_id: true,
|
|
38
|
+
column: true,
|
|
39
|
+
column_id: true,
|
|
40
|
+
title: true,
|
|
41
|
+
status: true,
|
|
42
|
+
}),
|
|
30
43
|
});
|
|
31
44
|
export const relationChangeSchema = z.strictObject({
|
|
45
|
+
id: z.string().describe("Stored ID of the created or deleted relation."),
|
|
32
46
|
type: relationSchema.shape.type,
|
|
33
47
|
source: z.string().describe("Source task key, in the supplied direction."),
|
|
48
|
+
source_task_id: z.string().describe("Task ID matching source, in the supplied direction."),
|
|
34
49
|
target: z.string().describe("Target task key, in the supplied direction."),
|
|
50
|
+
target_task_id: z.string().describe("Task ID matching target, in the supplied direction."),
|
|
35
51
|
});
|
|
36
52
|
export const commentSchema = z.strictObject({
|
|
53
|
+
id: z.string().describe("Stored comment ID."),
|
|
37
54
|
key: z.string().describe("Readable task key and comment number."),
|
|
55
|
+
task_id: z.string().describe("Owning task ID."),
|
|
38
56
|
text: z.string(),
|
|
39
57
|
created_at: timestamp,
|
|
40
58
|
updated_at: timestamp,
|
|
@@ -65,7 +83,20 @@ export const activitySchema = z.strictObject({
|
|
|
65
83
|
.nullable()
|
|
66
84
|
.describe("Raw recorded JSON object, including unknown fields; null when no payload was recorded."),
|
|
67
85
|
});
|
|
86
|
+
export const actorSchema = activitySchema.pick({
|
|
87
|
+
actor_name: true,
|
|
88
|
+
actor_email: true,
|
|
89
|
+
actor_kind: true,
|
|
90
|
+
actor_source: true,
|
|
91
|
+
actor_session_id: true,
|
|
92
|
+
actor_thread_id: true,
|
|
93
|
+
actor_agent: true,
|
|
94
|
+
actor_model: true,
|
|
95
|
+
actor_effort: true,
|
|
96
|
+
});
|
|
68
97
|
export const taskDetailSchema = taskSchema.extend({
|
|
98
|
+
created_at: timestamp,
|
|
99
|
+
updated_at: timestamp,
|
|
69
100
|
relations: z.array(relationSchema),
|
|
70
101
|
comments: z.array(commentSchema),
|
|
71
102
|
});
|
|
@@ -78,23 +109,46 @@ export const taskChangeSchema = taskSchema.extend({
|
|
|
78
109
|
changed: z.boolean().describe("Whether this key occurrence changed the task's state."),
|
|
79
110
|
});
|
|
80
111
|
export const projectSchema = z.strictObject({
|
|
112
|
+
id: z.string().describe("Stored project ID."),
|
|
81
113
|
key: z.string(),
|
|
82
114
|
name: z.string(),
|
|
83
115
|
description: nullableText,
|
|
84
116
|
});
|
|
85
|
-
export const
|
|
86
|
-
|
|
117
|
+
export const projectChangeSchema = projectSchema.extend({
|
|
118
|
+
changed: z.boolean().describe("Whether the project's fields changed."),
|
|
119
|
+
});
|
|
120
|
+
export const columnSchema = z.strictObject({
|
|
121
|
+
id: z.string().describe("Stored column ID."),
|
|
122
|
+
project: z.string(),
|
|
123
|
+
project_id: z.string().describe("Owning project ID."),
|
|
124
|
+
name: z.string(),
|
|
125
|
+
});
|
|
126
|
+
export const columnChangeSchema = columnSchema.extend({
|
|
127
|
+
changed: z.boolean().describe("Whether the column's name or position changed."),
|
|
128
|
+
});
|
|
129
|
+
export const columnTaskCountSchema = z.strictObject({
|
|
130
|
+
id: columnSchema.shape.id,
|
|
131
|
+
name: z.string(),
|
|
132
|
+
taskCount: count,
|
|
133
|
+
});
|
|
87
134
|
export const projectViewSchema = projectSchema.extend({
|
|
88
135
|
columns: z.array(columnTaskCountSchema),
|
|
89
136
|
archivedTaskCount: count,
|
|
90
137
|
});
|
|
91
138
|
export const labelSchema = z.strictObject({
|
|
139
|
+
id: z.string().describe("Stored label ID."),
|
|
92
140
|
name: z.string(),
|
|
93
141
|
color: z
|
|
94
142
|
.string()
|
|
95
143
|
.describe(`Known label colors: ${labelColorSchema.options.join(", ")}. Other stored values may occur.`),
|
|
96
144
|
description: nullableText,
|
|
97
145
|
});
|
|
146
|
+
export const labelChangeSchema = labelSchema.extend({
|
|
147
|
+
changed: z.boolean().describe("Whether the label's fields changed."),
|
|
148
|
+
});
|
|
149
|
+
export const commentChangeSchema = commentSchema.extend({
|
|
150
|
+
changed: z.boolean().describe("Whether the comment's text changed."),
|
|
151
|
+
});
|
|
98
152
|
const settingsFileBase = z.strictObject({
|
|
99
153
|
path: z.string(),
|
|
100
154
|
source: settingsFileSourceSchema,
|
|
@@ -164,17 +218,22 @@ export const resultSchemas = {
|
|
|
164
218
|
RelationList: z.array(relationSchema),
|
|
165
219
|
RelationChange: relationChangeSchema,
|
|
166
220
|
Comment: commentSchema,
|
|
221
|
+
CommentChange: commentChangeSchema,
|
|
167
222
|
CommentList: z.array(commentSchema),
|
|
168
223
|
Project: projectSchema,
|
|
224
|
+
ProjectChange: projectChangeSchema,
|
|
169
225
|
ProjectList: z.array(projectSchema),
|
|
170
226
|
ProjectView: projectViewSchema,
|
|
171
227
|
Column: columnSchema,
|
|
228
|
+
ColumnChange: columnChangeSchema,
|
|
172
229
|
ColumnTaskCount: columnTaskCountSchema,
|
|
173
230
|
ColumnList: z.array(columnTaskCountSchema),
|
|
174
231
|
Label: labelSchema,
|
|
232
|
+
LabelChange: labelChangeSchema,
|
|
175
233
|
LabelList: z.array(labelSchema),
|
|
176
234
|
Activity: activitySchema,
|
|
177
235
|
ActivityList: z.array(activitySchema),
|
|
236
|
+
Actor: actorSchema,
|
|
178
237
|
Info: infoSchema,
|
|
179
238
|
Backup: backupSchema,
|
|
180
239
|
Restore: restoreSchema,
|
package/src/results.d.ts
CHANGED
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
import type { ResultSchemaName } from "./result-schemas.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const resultSelectorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
kind: z.ZodLiteral<"always">;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<"booleanOption">;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
value: z.ZodBoolean;
|
|
9
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"positionalCount">;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
min: z.ZodNumber;
|
|
13
|
+
max: z.ZodNullable<z.ZodNumber>;
|
|
14
|
+
}, z.core.$strict>], "kind">;
|
|
15
|
+
export declare const resultReferenceSchema: z.ZodString;
|
|
16
|
+
export declare const commandResultSchema: z.ZodObject<{
|
|
17
|
+
selector: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
|
+
kind: z.ZodLiteral<"always">;
|
|
19
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"booleanOption">;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
value: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"positionalCount">;
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
min: z.ZodNumber;
|
|
27
|
+
max: z.ZodNullable<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strict>], "kind">;
|
|
29
|
+
schemaRef: z.ZodString;
|
|
30
|
+
mode: z.ZodLiteral<"json">;
|
|
31
|
+
stream: z.ZodLiteral<"stdout">;
|
|
32
|
+
exitCode: z.ZodLiteral<0>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type ResultSelector = z.infer<typeof resultSelectorSchema>;
|
|
35
|
+
export type CommandResult = z.infer<typeof commandResultSchema> & {
|
|
16
36
|
schemaRef: `#/schemas/definitions/${ResultSchemaName}`;
|
|
17
|
-
mode: "json";
|
|
18
|
-
stream: "stdout";
|
|
19
|
-
exitCode: 0;
|
|
20
37
|
};
|
|
21
38
|
export declare function jsonResult(schema: ResultSchemaName, selector?: ResultSelector): CommandResult;
|
|
22
39
|
export declare const taskDetailResults: CommandResult[];
|
package/src/results.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const resultSelectorSchema = z.discriminatedUnion("kind", [
|
|
3
|
+
z.strictObject({ kind: z.literal("always") }),
|
|
4
|
+
z.strictObject({ kind: z.literal("booleanOption"), name: z.string(), value: z.boolean() }),
|
|
5
|
+
z.strictObject({
|
|
6
|
+
kind: z.literal("positionalCount"),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
min: z.number().int().nonnegative(),
|
|
9
|
+
max: z.number().int().nonnegative().nullable(),
|
|
10
|
+
}),
|
|
11
|
+
]);
|
|
12
|
+
export const resultReferenceSchema = z.string().regex(/^#\/schemas\/definitions\/[^/]+$/);
|
|
13
|
+
export const commandResultSchema = z.strictObject({
|
|
14
|
+
selector: resultSelectorSchema,
|
|
15
|
+
schemaRef: resultReferenceSchema,
|
|
16
|
+
mode: z.literal("json"),
|
|
17
|
+
stream: z.literal("stdout"),
|
|
18
|
+
exitCode: z.literal(0),
|
|
19
|
+
});
|
|
1
20
|
export function jsonResult(schema, selector = { kind: "always" }) {
|
|
2
21
|
return {
|
|
3
22
|
selector,
|
|
@@ -10,6 +10,21 @@ export declare const activityRouter: {
|
|
|
10
10
|
};
|
|
11
11
|
input: {
|
|
12
12
|
readonly options: {
|
|
13
|
+
readonly project: {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly value: {
|
|
16
|
+
readonly kind: "project-key";
|
|
17
|
+
readonly name: "project-key";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
readonly "project-id": {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly value: {
|
|
23
|
+
readonly kind: "project-id";
|
|
24
|
+
readonly name: "project-id";
|
|
25
|
+
readonly description: "Full project UUID; canonical or compact, case-insensitive";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
13
28
|
readonly task: {
|
|
14
29
|
readonly type: "string";
|
|
15
30
|
readonly value: {
|
|
@@ -17,6 +32,17 @@ export declare const activityRouter: {
|
|
|
17
32
|
readonly name: "task-key";
|
|
18
33
|
};
|
|
19
34
|
};
|
|
35
|
+
readonly "task-id": {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
readonly value: {
|
|
38
|
+
readonly kind: "task-id";
|
|
39
|
+
readonly name: "task-id";
|
|
40
|
+
readonly description: "Full task UUID; canonical or compact, case-insensitive";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly "show-deleted": {
|
|
44
|
+
readonly type: "boolean";
|
|
45
|
+
};
|
|
20
46
|
readonly session: {
|
|
21
47
|
readonly type: "string";
|
|
22
48
|
readonly value: {
|
|
@@ -44,7 +70,14 @@ export declare const activityRouter: {
|
|
|
44
70
|
readonly id: "default";
|
|
45
71
|
readonly positionals: readonly [];
|
|
46
72
|
}];
|
|
47
|
-
readonly constraints: readonly [
|
|
73
|
+
readonly constraints: readonly [{
|
|
74
|
+
readonly kind: "exclusive";
|
|
75
|
+
readonly members: readonly ["option:project", "option:project-id", "option:task", "option:task-id"];
|
|
76
|
+
}, {
|
|
77
|
+
readonly kind: "requiresAny";
|
|
78
|
+
readonly input: "option:show-deleted";
|
|
79
|
+
readonly members: readonly ["option:project", "option:task"];
|
|
80
|
+
}];
|
|
48
81
|
};
|
|
49
82
|
results: import("../results.js").CommandResult[];
|
|
50
83
|
run: (args: string[]) => void;
|
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { jsonResult } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { activity, activityLimitMessage, positiveIntegerPattern } from "@zinn-dev/core";
|
|
4
|
-
import { generateCommandUsage } from "../input.js";
|
|
3
|
+
import { activity, activityLimitMessage, CoreError, positiveIntegerPattern } from "@zinn-dev/core";
|
|
4
|
+
import { generateCommandUsage, getOptionInputs, violatesConstraint } from "../input.js";
|
|
5
|
+
import { CliError } from "../errors.js";
|
|
5
6
|
import { output, quit, validatePositionals, validateUniqueOptions } from "../lib.js";
|
|
6
7
|
import { formatActivityList, presentActivities } from "../presentation/activity-presentation.js";
|
|
7
8
|
const activityInputs = {
|
|
8
9
|
list: {
|
|
9
10
|
options: {
|
|
11
|
+
project: { type: "string", value: { kind: "project-key", name: "project-key" } },
|
|
12
|
+
"project-id": {
|
|
13
|
+
type: "string",
|
|
14
|
+
value: {
|
|
15
|
+
kind: "project-id",
|
|
16
|
+
name: "project-id",
|
|
17
|
+
description: "Full project UUID; canonical or compact, case-insensitive",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
10
20
|
task: { type: "string", value: { kind: "task-key", name: "task-key" } },
|
|
21
|
+
"task-id": {
|
|
22
|
+
type: "string",
|
|
23
|
+
value: {
|
|
24
|
+
kind: "task-id",
|
|
25
|
+
name: "task-id",
|
|
26
|
+
description: "Full task UUID; canonical or compact, case-insensitive",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
"show-deleted": { type: "boolean" },
|
|
11
30
|
session: { type: "string", value: { kind: "text", name: "id" } },
|
|
12
31
|
thread: { type: "string", value: { kind: "text", name: "id" } },
|
|
13
32
|
limit: {
|
|
@@ -16,7 +35,17 @@ const activityInputs = {
|
|
|
16
35
|
},
|
|
17
36
|
},
|
|
18
37
|
forms: [{ id: "default", positionals: [] }],
|
|
19
|
-
constraints: [
|
|
38
|
+
constraints: [
|
|
39
|
+
{
|
|
40
|
+
kind: "exclusive",
|
|
41
|
+
members: ["option:project", "option:project-id", "option:task", "option:task-id"],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
kind: "requiresAny",
|
|
45
|
+
input: "option:show-deleted",
|
|
46
|
+
members: ["option:project", "option:task"],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
20
49
|
},
|
|
21
50
|
view: {
|
|
22
51
|
options: {},
|
|
@@ -46,42 +75,90 @@ export const activityRouter = {
|
|
|
46
75
|
});
|
|
47
76
|
validateUniqueOptions(tokens, activityInputs.list.options);
|
|
48
77
|
validatePositionals(positionals, activityInputs.list.forms[0]);
|
|
78
|
+
const [selectorConstraint, deletedHistoryConstraint] = activityInputs.list.constraints;
|
|
79
|
+
const optionInputs = getOptionInputs(values);
|
|
80
|
+
if (violatesConstraint(selectorConstraint, optionInputs)) {
|
|
81
|
+
const conflictingSelector = selectorConstraint.members.filter((member) => optionInputs[member] !== undefined)[1];
|
|
82
|
+
quit("Use one of --project, --project-id, --task or --task-id", undefined, {
|
|
83
|
+
argument: conflictingSelector.replace("option:", "--"),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (violatesConstraint(deletedHistoryConstraint, optionInputs)) {
|
|
87
|
+
quit("--show-deleted requires --project or --task", undefined, {
|
|
88
|
+
argument: "--show-deleted",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
49
91
|
// Safe integers can have one more digit than readable task numbers.
|
|
50
92
|
const limitPattern = new RegExp(activityInputs.list.options.limit.value.pattern);
|
|
51
93
|
if (values.limit !== undefined && !limitPattern.test(values.limit)) {
|
|
52
94
|
quit(activityLimitMessage, undefined, { argument: "--limit" });
|
|
53
95
|
}
|
|
54
|
-
|
|
96
|
+
let events;
|
|
97
|
+
try {
|
|
98
|
+
events = activity.getAll({
|
|
99
|
+
projectKey: values.project,
|
|
100
|
+
projectId: values["project-id"],
|
|
101
|
+
taskKey: values.task,
|
|
102
|
+
taskId: values["task-id"],
|
|
103
|
+
showDeleted: values["show-deleted"],
|
|
104
|
+
sessionId: values.session,
|
|
105
|
+
threadId: values.thread,
|
|
106
|
+
limit: values.limit === undefined ? undefined : Number(values.limit),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const isMissingCurrentSelection = (values.task !== undefined || values.project !== undefined) &&
|
|
111
|
+
values["show-deleted"] !== true &&
|
|
112
|
+
error instanceof CoreError &&
|
|
113
|
+
error.kind === "missing" &&
|
|
114
|
+
error.facts.entity === (values.project !== undefined ? "project" : "task");
|
|
115
|
+
if (isMissingCurrentSelection) {
|
|
116
|
+
const selector = error.facts.entity === "project" ? "--project" : "--task";
|
|
117
|
+
throw new CliError(error.message, "not_found", {
|
|
118
|
+
entity: error.facts.entity,
|
|
119
|
+
key: error.facts.key,
|
|
120
|
+
source: "explicit",
|
|
121
|
+
argument: selector,
|
|
122
|
+
}, `Use ${selector} ${values.project ?? values.task} --show-deleted to include deleted history.`);
|
|
123
|
+
}
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
output(events, (items) => formatActivityList(presentActivities(items, {
|
|
127
|
+
projectKey: values.project,
|
|
128
|
+
projectId: values["project-id"],
|
|
129
|
+
showDeleted: values["show-deleted"],
|
|
55
130
|
taskKey: values.task,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
limit: values.limit === undefined ? undefined : Number(values.limit),
|
|
59
|
-
});
|
|
60
|
-
output(events, (items) => formatActivityList(presentActivities(items, { taskKey: values.task })));
|
|
131
|
+
taskId: values["task-id"],
|
|
132
|
+
})));
|
|
61
133
|
},
|
|
62
134
|
help: `${generateCommandUsage("activity list", activityInputs.list)}
|
|
63
135
|
|
|
64
136
|
List recorded activity across the database, newest first.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
137
|
+
Returns all matching events unless --limit is supplied.
|
|
138
|
+
|
|
139
|
+
--task <key> Select an existing active or archived task.
|
|
140
|
+
--project <key> Select an existing project's activity, including deleted tasks.
|
|
141
|
+
--project-id <uuid> Select one project identity, including deleted projects.
|
|
142
|
+
Requires a full UUID.
|
|
143
|
+
--show-deleted Also include deleted identities sharing the selected key.
|
|
144
|
+
--task-id <uuid> Select one task identity, including deleted tasks.
|
|
145
|
+
Requires a full UUID.
|
|
146
|
+
--session <id> Match an exact session ID, including case.
|
|
147
|
+
--thread <id> Match an exact thread ID, including case.
|
|
148
|
+
--limit <n> Return at most n matching events.
|
|
149
|
+
|
|
150
|
+
Use one of --project, --project-id, --task or --task-id.
|
|
151
|
+
--show-deleted requires --project or --task.
|
|
152
|
+
All supplied filters must match.
|
|
72
153
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Use activity view for full recorded changes; full IDs are durable, short prefixes may become ambiguous.
|
|
76
|
-
With --json, output is an array of full activity records, with parsed changes or null.
|
|
77
|
-
Group JSON records by entity_type and entity_id to distinguish tasks sharing a readable key.
|
|
78
|
-
id identifies the activity event.
|
|
79
|
-
A project deletion event's entity_id is the project ID and removed task IDs are in changes.tasks.
|
|
154
|
+
Use activity view <activity-id> for complete recorded changes.
|
|
155
|
+
With --json, return an array of full activity records.
|
|
80
156
|
|
|
81
157
|
Examples:
|
|
82
158
|
zinn activity list --limit 10
|
|
83
|
-
zinn activity list --
|
|
84
|
-
zinn activity list --
|
|
159
|
+
zinn activity list --project APP
|
|
160
|
+
zinn activity list --task APP-2
|
|
161
|
+
zinn activity list --task APP-2 --show-deleted`,
|
|
85
162
|
},
|
|
86
163
|
view: {
|
|
87
164
|
summary: "Show one recorded event with full activity/entity IDs, actor and complete changes.",
|
|
@@ -105,14 +182,10 @@ Examples:
|
|
|
105
182
|
help: `${generateCommandUsage("activity view", activityInputs.view)}
|
|
106
183
|
|
|
107
184
|
Show one recorded event with full activity/entity IDs, actor and complete changes.
|
|
108
|
-
|
|
109
|
-
Text times are local dates/times with a UTC offset.
|
|
185
|
+
Recorded text and line breaks are preserved.
|
|
110
186
|
|
|
111
187
|
Accept a full UUID or unique left prefix with at least eight hexadecimal digits.
|
|
112
|
-
|
|
113
|
-
An ambiguous prefix lists candidate IDs and requires more characters.
|
|
114
|
-
With --json, output is one full activity record, with parsed changes or null.
|
|
115
|
-
id identifies this event itself, while entity_type and entity_id identify its affected entity.
|
|
188
|
+
With --json, return one full activity record.
|
|
116
189
|
|
|
117
190
|
Example: zinn activity view 019abcdf-1234-7`,
|
|
118
191
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const commandAliases = {
|
|
2
|
+
view: ["show"],
|
|
3
|
+
list: ["ls"],
|
|
4
|
+
delete: ["rm"],
|
|
5
|
+
create: ["new"],
|
|
6
|
+
};
|
|
7
|
+
export function getCommandAliases(command) {
|
|
8
|
+
const words = command.split(" ");
|
|
9
|
+
const name = words.pop();
|
|
10
|
+
return (commandAliases[name] ?? []).map((alias) => [...words, alias]);
|
|
11
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { generateCommandUsage, noInput } from "../input.js";
|
|
3
|
-
import { output, validatePositionals } from "../lib.js";
|
|
3
|
+
import { getOutputMode, output, validatePositionals } from "../lib.js";
|
|
4
|
+
import { formatCapabilities } from "../presentation/capabilities-presentation.js";
|
|
4
5
|
import { jsonResult } from "../results.js";
|
|
5
6
|
export const capabilitiesCommand = {
|
|
6
7
|
summary: "Describe the installed CLI commands, inputs, results and errors.",
|
|
@@ -16,8 +17,13 @@ export const capabilitiesCommand = {
|
|
|
16
17
|
allowPositionals: true,
|
|
17
18
|
});
|
|
18
19
|
validatePositionals(positionals, noInput.forms[0]);
|
|
19
|
-
const { generateCapabilities } = await import("../capabilities.js");
|
|
20
|
-
|
|
20
|
+
const { generateCapabilities, getCapabilitySummary } = await import("../capabilities.js");
|
|
21
|
+
if (getOutputMode() === "json") {
|
|
22
|
+
output(generateCapabilities(), () => formatCapabilities(getCapabilitySummary()));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
output(getCapabilitySummary(), formatCapabilities);
|
|
26
|
+
}
|
|
21
27
|
},
|
|
22
28
|
help: `${generateCommandUsage("capabilities", noInput)}
|
|
23
29
|
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import type { PresentedComment } from "../result-schemas.js";
|
|
2
|
-
export declare function presentComments(taskKey: string): {
|
|
3
|
-
key: string;
|
|
4
|
-
text: string;
|
|
5
|
-
created_at: number;
|
|
6
|
-
updated_at: number;
|
|
7
|
-
}[];
|
|
8
|
-
export declare function formatComment(commentMatch: PresentedComment): string;
|
|
9
|
-
export declare function formatComments(comments: Array<PresentedComment>): string;
|
|
10
1
|
export declare const commentRouter: {
|
|
11
2
|
create: {
|
|
12
3
|
summary: string;
|
|
@@ -21,12 +12,19 @@ export declare const commentRouter: {
|
|
|
21
12
|
readonly options: {
|
|
22
13
|
readonly text: {
|
|
23
14
|
readonly type: "string";
|
|
24
|
-
readonly required: true;
|
|
25
15
|
readonly value: {
|
|
26
16
|
readonly kind: "text";
|
|
27
17
|
readonly name: "text";
|
|
28
18
|
};
|
|
29
19
|
};
|
|
20
|
+
readonly "text-file": {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly value: {
|
|
23
|
+
readonly kind: "path";
|
|
24
|
+
readonly name: "path";
|
|
25
|
+
readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
30
28
|
};
|
|
31
29
|
readonly forms: readonly [{
|
|
32
30
|
readonly id: "default";
|
|
@@ -39,10 +37,19 @@ export declare const commentRouter: {
|
|
|
39
37
|
};
|
|
40
38
|
}];
|
|
41
39
|
}];
|
|
42
|
-
readonly constraints: readonly [
|
|
40
|
+
readonly constraints: readonly [{
|
|
41
|
+
readonly kind: "exclusive";
|
|
42
|
+
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
43
|
+
}, {
|
|
44
|
+
readonly kind: "atLeastOne";
|
|
45
|
+
readonly members: readonly ["option:text", "option:text-file"];
|
|
46
|
+
}];
|
|
43
47
|
};
|
|
44
48
|
results: import("../results.js").CommandResult[];
|
|
45
|
-
|
|
49
|
+
guessedFlags: {
|
|
50
|
+
"--body": (args: string[]) => string[];
|
|
51
|
+
};
|
|
52
|
+
run: (args: string[]) => Promise<void>;
|
|
46
53
|
help: string;
|
|
47
54
|
};
|
|
48
55
|
list: {
|
|
@@ -127,12 +134,19 @@ export declare const commentRouter: {
|
|
|
127
134
|
};
|
|
128
135
|
readonly text: {
|
|
129
136
|
readonly type: "string";
|
|
130
|
-
readonly required: true;
|
|
131
137
|
readonly value: {
|
|
132
138
|
readonly kind: "text";
|
|
133
139
|
readonly name: "text";
|
|
134
140
|
};
|
|
135
141
|
};
|
|
142
|
+
readonly "text-file": {
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
readonly value: {
|
|
145
|
+
readonly kind: "path";
|
|
146
|
+
readonly name: "path";
|
|
147
|
+
readonly description: "A UTF-8 file, or \"-\" for stdin. Trailing line breaks are dropped; empty or blank input is an error.";
|
|
148
|
+
};
|
|
149
|
+
};
|
|
136
150
|
};
|
|
137
151
|
readonly forms: readonly [{
|
|
138
152
|
readonly id: "default";
|
|
@@ -146,25 +160,34 @@ export declare const commentRouter: {
|
|
|
146
160
|
}];
|
|
147
161
|
}];
|
|
148
162
|
readonly constraints: readonly [{
|
|
163
|
+
readonly kind: "exclusive";
|
|
164
|
+
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
165
|
+
}, {
|
|
149
166
|
readonly kind: "exclusive";
|
|
150
167
|
readonly members: readonly ["option:append", "option:replacing"];
|
|
151
168
|
}, {
|
|
152
|
-
readonly kind: "
|
|
169
|
+
readonly kind: "requiresAny";
|
|
153
170
|
readonly input: "option:append";
|
|
154
|
-
readonly
|
|
171
|
+
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
155
172
|
}, {
|
|
156
|
-
readonly kind: "
|
|
173
|
+
readonly kind: "requiresAny";
|
|
157
174
|
readonly input: "option:replacing";
|
|
158
|
-
readonly
|
|
175
|
+
readonly members: readonly ["option:description" | "option:text", "option:description-file" | "option:text-file"];
|
|
159
176
|
}, {
|
|
160
177
|
readonly kind: "requires";
|
|
161
178
|
readonly input: "option:all";
|
|
162
179
|
readonly requires: "option:replacing";
|
|
180
|
+
}, {
|
|
181
|
+
readonly kind: "atLeastOne";
|
|
182
|
+
readonly members: readonly ["option:text", "option:text-file"];
|
|
163
183
|
}];
|
|
164
184
|
readonly notes: readonly [string];
|
|
165
185
|
};
|
|
166
186
|
results: import("../results.js").CommandResult[];
|
|
167
|
-
|
|
187
|
+
guessedFlags: {
|
|
188
|
+
"--body": (args: string[]) => string[];
|
|
189
|
+
};
|
|
190
|
+
run: (args: string[]) => Promise<void>;
|
|
168
191
|
help: string;
|
|
169
192
|
};
|
|
170
193
|
delete: {
|