@zinn-dev/cli 0.43.0 → 0.44.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 +1 -1
- package/index.js +3 -3
- package/package.json +7 -4
- package/skills/zinn/SKILL.md +1 -1
- package/src/actor.d.ts +8 -0
- package/src/actor.js +5 -1
- package/src/capabilities-schema.d.ts +1 -1
- package/src/column-hint.js +3 -4
- package/src/errors.d.ts +12 -3
- package/src/errors.js +19 -2
- package/src/failure-log.d.ts +6 -0
- package/src/failure-log.js +167 -0
- package/src/input.d.ts +11 -0
- package/src/input.js +25 -1
- package/src/lib.d.ts +7 -5
- package/src/lib.js +52 -33
- package/src/list-limit.d.ts +2 -2
- package/src/list-limit.js +2 -2
- package/src/overview.d.ts +10 -0
- package/src/overview.js +41 -0
- package/src/presentation/activity-presentation.d.ts +2 -0
- package/src/presentation/activity-presentation.js +96 -35
- package/src/presentation/column-presentation.d.ts +17 -2
- package/src/presentation/column-presentation.js +45 -6
- package/src/presentation/info-presentation.js +36 -6
- package/src/presentation/relation-presentation.d.ts +6 -2
- package/src/presentation/relation-presentation.js +36 -26
- package/src/presentation/task-blame-presentation.d.ts +11 -0
- package/src/presentation/task-blame-presentation.js +56 -0
- package/src/presentation/task-presentation.d.ts +6 -1
- package/src/presentation/task-presentation.js +21 -9
- package/src/result-schemas.d.ts +480 -15
- package/src/result-schemas.js +54 -1
- package/src/routes/activity-router.d.ts +9 -1
- package/src/routes/activity-router.js +15 -2
- package/src/routes/info-router.js +3 -2
- package/src/routes/migrate-router.js +2 -2
- package/src/routes/project-router.d.ts +1 -1
- package/src/routes/project-router.js +3 -12
- package/src/routes/restore-router.js +9 -3
- package/src/routes/router.js +24 -11
- package/src/routes/routes.d.ts +51 -8
- package/src/routes/task-router.d.ts +41 -6
- package/src/routes/task-router.js +81 -24
- package/src/routes/whoami-router.js +1 -1
- package/src/run-facts.d.ts +14 -0
- package/src/run-facts.js +14 -0
- package/src/store-folder.d.ts +5 -0
- package/src/store-folder.js +16 -0
- package/src/telemetry.d.ts +31 -0
- package/src/telemetry.js +329 -0
- package/src/text-input.js +1 -5
- package/src/types.d.ts +1 -1
package/src/result-schemas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { activityActionSchema, activityEntityTypeSchema, actorKindSchema, infoDatabaseStateSchema, labelColorSchema, relationTypeSchema, settingsFileSourceSchema, settingsFileStateSchema, settingsSchema, storageSourceSchema, taskPrioritySchema, } from "@zinn-dev/core";
|
|
2
|
+
import { activityActionSchema, activityEntityTypeSchema, actorKindSchema, infoDatabaseStateSchema, labelColorSchema, relationTypeSchema, settingsFileSourceSchema, settingsFileStateSchema, settingsSchema, storageSourceSchema, taskPrioritySchema, telemetryModeSchema, telemetrySourceSchema, } from "@zinn-dev/core";
|
|
3
3
|
import { errorDocumentSchema } from "./errors.js";
|
|
4
4
|
import { capabilitiesSchema, jsonValueSchema } from "./capabilities-schema.js";
|
|
5
5
|
const nullableText = z.string().nullable();
|
|
@@ -13,6 +13,8 @@ export const taskSchema = z.strictObject({
|
|
|
13
13
|
status: taskStatus,
|
|
14
14
|
column: z.string().describe("Current column name."),
|
|
15
15
|
column_id: z.string().describe("Current column ID."),
|
|
16
|
+
is_first: z.boolean().describe("Whether the task's column is the first column of its board."),
|
|
17
|
+
is_last: z.boolean().describe("Whether the task's column is the last column of its board."),
|
|
16
18
|
title: z.string(),
|
|
17
19
|
description: nullableText,
|
|
18
20
|
priority: z
|
|
@@ -42,6 +44,8 @@ export const relationSchema = z.strictObject({
|
|
|
42
44
|
project_id: true,
|
|
43
45
|
column: true,
|
|
44
46
|
column_id: true,
|
|
47
|
+
is_first: true,
|
|
48
|
+
is_last: true,
|
|
45
49
|
title: true,
|
|
46
50
|
status: true,
|
|
47
51
|
}),
|
|
@@ -76,6 +80,7 @@ export const activitySchema = z.strictObject({
|
|
|
76
80
|
actor_agent: nullableText,
|
|
77
81
|
actor_model: nullableText,
|
|
78
82
|
actor_effort: nullableText,
|
|
83
|
+
actor_client: nullableText,
|
|
79
84
|
entity_type: z
|
|
80
85
|
.string()
|
|
81
86
|
.describe(`Known entity types: ${activityEntityTypeSchema.options.join(", ")}. Other stored values may occur.`),
|
|
@@ -98,6 +103,11 @@ export const actorSchema = activitySchema.pick({
|
|
|
98
103
|
actor_agent: true,
|
|
99
104
|
actor_model: true,
|
|
100
105
|
actor_effort: true,
|
|
106
|
+
actor_client: true,
|
|
107
|
+
});
|
|
108
|
+
export const taskAttributionSchema = actorSchema.extend({
|
|
109
|
+
id: activitySchema.shape.id,
|
|
110
|
+
created_at: timestamp,
|
|
101
111
|
});
|
|
102
112
|
export const taskDetailSchema = taskSchema.extend({
|
|
103
113
|
relations: z.array(relationSchema),
|
|
@@ -131,6 +141,8 @@ export const columnSchema = z.strictObject({
|
|
|
131
141
|
project: z.string(),
|
|
132
142
|
project_id: z.string().describe("Owning project ID."),
|
|
133
143
|
name: z.string(),
|
|
144
|
+
is_first: z.boolean().describe("Whether this column is the first column of its board."),
|
|
145
|
+
is_last: z.boolean().describe("Whether this column is the last column of its board."),
|
|
134
146
|
});
|
|
135
147
|
export const columnChangeSchema = columnSchema.extend({
|
|
136
148
|
changed: z.boolean().describe("Whether the column's name or position changed."),
|
|
@@ -138,6 +150,8 @@ export const columnChangeSchema = columnSchema.extend({
|
|
|
138
150
|
export const columnTaskCountSchema = z.strictObject({
|
|
139
151
|
id: columnSchema.shape.id,
|
|
140
152
|
name: z.string(),
|
|
153
|
+
is_first: columnSchema.shape.is_first,
|
|
154
|
+
is_last: columnSchema.shape.is_last,
|
|
141
155
|
taskCount: count,
|
|
142
156
|
});
|
|
143
157
|
export const projectViewSchema = projectSchema.extend({
|
|
@@ -155,6 +169,33 @@ export const labelSchema = z.strictObject({
|
|
|
155
169
|
export const labelChangeSchema = labelSchema.extend({
|
|
156
170
|
changed: z.boolean().describe("Whether the label's fields changed."),
|
|
157
171
|
});
|
|
172
|
+
const blameTaskIdentity = taskSchema.pick({ id: true, key: true });
|
|
173
|
+
function blamedValue(value) {
|
|
174
|
+
return z.strictObject({ value, attribution: taskAttributionSchema.nullable() });
|
|
175
|
+
}
|
|
176
|
+
export const taskBlameSchema = z.strictObject({
|
|
177
|
+
task: blameTaskIdentity,
|
|
178
|
+
fields: z.strictObject({
|
|
179
|
+
title: blamedValue(z.string()),
|
|
180
|
+
column: blamedValue(columnSchema.pick({ id: true, name: true })),
|
|
181
|
+
priority: blamedValue(taskSchema.shape.priority),
|
|
182
|
+
due_at: blamedValue(taskSchema.shape.due_at),
|
|
183
|
+
labels: blamedValue(z.array(labelSchema.pick({ id: true, name: true }))),
|
|
184
|
+
parent: blamedValue(blameTaskIdentity.nullable()),
|
|
185
|
+
}),
|
|
186
|
+
relations: z.array(z.strictObject({
|
|
187
|
+
id: relationSchema.shape.id,
|
|
188
|
+
type: relationSchema.shape.type,
|
|
189
|
+
direction: relationSchema.shape.direction,
|
|
190
|
+
task: blameTaskIdentity,
|
|
191
|
+
attribution: taskAttributionSchema.nullable(),
|
|
192
|
+
})),
|
|
193
|
+
description: z.array(z.strictObject({
|
|
194
|
+
line: z.number().int().positive(),
|
|
195
|
+
text: z.string(),
|
|
196
|
+
attribution: taskAttributionSchema.nullable(),
|
|
197
|
+
})),
|
|
198
|
+
});
|
|
158
199
|
export const commentChangeSchema = commentSchema.extend({
|
|
159
200
|
changed: z.boolean().describe("Whether the comment's text changed."),
|
|
160
201
|
});
|
|
@@ -188,6 +229,17 @@ export const infoSchema = z.strictObject({
|
|
|
188
229
|
settingsPath: nullableText,
|
|
189
230
|
error: nullableText,
|
|
190
231
|
}),
|
|
232
|
+
telemetry: z.strictObject({
|
|
233
|
+
mode: telemetryModeSchema.nullable(),
|
|
234
|
+
source: telemetrySourceSchema.nullable(),
|
|
235
|
+
settingsPath: nullableText,
|
|
236
|
+
maxMegabytes: z.number().int().positive().nullable(),
|
|
237
|
+
maxAgeDays: z.number().int().positive().nullable(),
|
|
238
|
+
directory: nullableText,
|
|
239
|
+
exists: z.boolean().nullable(),
|
|
240
|
+
sizeBytes: count.nullable(),
|
|
241
|
+
error: nullableText,
|
|
242
|
+
}),
|
|
191
243
|
database: z.strictObject({
|
|
192
244
|
path: nullableText,
|
|
193
245
|
state: infoDatabaseStateSchema,
|
|
@@ -220,6 +272,7 @@ export const resultSchemas = {
|
|
|
220
272
|
Task: taskSchema,
|
|
221
273
|
TaskList: z.array(taskSchema),
|
|
222
274
|
TaskDetail: taskDetailSchema,
|
|
275
|
+
TaskBlame: taskBlameSchema,
|
|
223
276
|
TaskDetailHistory: taskDetailHistorySchema,
|
|
224
277
|
TaskChange: taskChangeSchema,
|
|
225
278
|
TaskChanges: z.array(taskChangeSchema).min(2),
|
|
@@ -57,6 +57,14 @@ export declare const activityRouter: {
|
|
|
57
57
|
readonly name: "id";
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
+
readonly client: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly value: {
|
|
63
|
+
readonly kind: "text";
|
|
64
|
+
readonly name: "name";
|
|
65
|
+
readonly description: "Match a client name or its colon-separated parts, including case.";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
60
68
|
readonly since: {
|
|
61
69
|
readonly type: "string";
|
|
62
70
|
readonly value: {
|
|
@@ -99,7 +107,7 @@ export declare const activityRouter: {
|
|
|
99
107
|
readonly name: "n";
|
|
100
108
|
readonly pattern: string;
|
|
101
109
|
};
|
|
102
|
-
readonly description: "Return at most n results after all filters.
|
|
110
|
+
readonly description: "Return at most n results after all filters.";
|
|
103
111
|
};
|
|
104
112
|
readonly "starting-after": {
|
|
105
113
|
readonly type: "string";
|
|
@@ -33,6 +33,14 @@ const activityInputs = {
|
|
|
33
33
|
"show-deleted": { type: "boolean" },
|
|
34
34
|
session: { type: "string", value: { kind: "text", name: "id" } },
|
|
35
35
|
thread: { type: "string", value: { kind: "text", name: "id" } },
|
|
36
|
+
client: {
|
|
37
|
+
type: "string",
|
|
38
|
+
value: {
|
|
39
|
+
kind: "text",
|
|
40
|
+
name: "name",
|
|
41
|
+
description: "Match a client name or its colon-separated parts, including case.",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
36
44
|
since: {
|
|
37
45
|
type: "string",
|
|
38
46
|
value: {
|
|
@@ -135,6 +143,7 @@ export const activityRouter = {
|
|
|
135
143
|
showDeleted: values["show-deleted"],
|
|
136
144
|
sessionId: values.session,
|
|
137
145
|
threadId: values.thread,
|
|
146
|
+
client: values.client,
|
|
138
147
|
actions: values.action?.map((action) => {
|
|
139
148
|
const parsed = activityActionSchema.safeParse(action);
|
|
140
149
|
if (!parsed.success) {
|
|
@@ -184,8 +193,8 @@ export const activityRouter = {
|
|
|
184
193
|
taskKey: values.task,
|
|
185
194
|
taskId: values["task-id"],
|
|
186
195
|
})));
|
|
187
|
-
if (page.
|
|
188
|
-
diagnostic(`More activity. Continue with: ${formatListContinuation(["activity", "list"], [], tokens, "starting-after", page.
|
|
196
|
+
if (page.nextCursor !== undefined) {
|
|
197
|
+
diagnostic(`More activity. Continue with: ${formatListContinuation(["activity", "list"], [], tokens, "starting-after", page.nextCursor)}`);
|
|
189
198
|
}
|
|
190
199
|
},
|
|
191
200
|
help: `${generateCommandUsage("activity list", activityInputs.list)}
|
|
@@ -202,6 +211,9 @@ Returns all matching events unless --limit is supplied.
|
|
|
202
211
|
Requires a full UUID.
|
|
203
212
|
--session <id> Match an exact session ID, including case.
|
|
204
213
|
--thread <id> Match an exact thread ID, including case.
|
|
214
|
+
--client <name> Match a client name or its colon-separated parts, including case.
|
|
215
|
+
zinn-opencode matches zinn-opencode and zinn-opencode:panel.
|
|
216
|
+
Versions are ignored. Names are taken from whitespace-separated tokens.
|
|
205
217
|
--since <time> Include events at or after this time.
|
|
206
218
|
--until <time> Include events at or before this time.
|
|
207
219
|
--action <action> Match a recorded action. Repeat to match any listed action.
|
|
@@ -235,6 +247,7 @@ With --json, return an array of full activity records.
|
|
|
235
247
|
Examples:
|
|
236
248
|
zinn activity list --limit 10
|
|
237
249
|
zinn activity list --project APP
|
|
250
|
+
zinn activity list --client zinn-opencode:panel
|
|
238
251
|
zinn activity list --since 2026-10-25T00:00:00Z --until 2026-10-25T12:00:00Z
|
|
239
252
|
zinn activity list --action comment_create --action comment_edit
|
|
240
253
|
zinn activity list --action edit --changed description
|
|
@@ -5,7 +5,7 @@ import { generateCommandUsage, noInput } from "../input.js";
|
|
|
5
5
|
import { output, validatePositionals } from "../lib.js";
|
|
6
6
|
import { formatInfo, presentInfo } from "../presentation/info-presentation.js";
|
|
7
7
|
export const infoCommand = {
|
|
8
|
-
summary: "Show the selected store, settings sources, database schema state and CLI, core and runtime versions.",
|
|
8
|
+
summary: "Show the selected store, settings sources, telemetry state, database schema state and CLI, core and runtime versions.",
|
|
9
9
|
effects: { domain: "none", storage: "inspect" },
|
|
10
10
|
confirmation: { kind: "none" },
|
|
11
11
|
input: noInput,
|
|
@@ -22,8 +22,9 @@ export const infoCommand = {
|
|
|
22
22
|
},
|
|
23
23
|
help: `${generateCommandUsage("info", noInput)}
|
|
24
24
|
|
|
25
|
-
Show the selected store, settings sources, database schema state and CLI, core and runtime versions.
|
|
25
|
+
Show the selected store, settings sources, telemetry state, database schema state and CLI, core and runtime versions.
|
|
26
26
|
|
|
27
27
|
Reports unusable settings and database errors and exits successfully.
|
|
28
|
+
Telemetry is local (collected on this machine, never sent) or off. A telemetry.mode in a settings file overrides DO_NOT_TRACK=1 (https://donottrack.sh/). The telemetry folder is reported but never created.
|
|
28
29
|
SQLite may perform its normal file housekeeping when this command is triggered.`,
|
|
29
30
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsonResult } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { migrate, MigrationRefusedError,
|
|
3
|
+
import { migrate, MigrationRefusedError, getBackupStorage } from "@zinn-dev/core";
|
|
4
4
|
import { generateCommandUsage, noInput } from "../input.js";
|
|
5
5
|
import { reportLockWait } from "../database.js";
|
|
6
6
|
import { diagnostic, output, validatePositionals } from "../lib.js";
|
|
@@ -20,7 +20,7 @@ export const migrateCommand = {
|
|
|
20
20
|
});
|
|
21
21
|
validatePositionals(positionals, noInput.forms[0]);
|
|
22
22
|
// Resolved before the try, so a store that cannot be resolved fails without the note about backups.
|
|
23
|
-
const { backupDirectory } =
|
|
23
|
+
const { backupDirectory } = getBackupStorage();
|
|
24
24
|
try {
|
|
25
25
|
const result = migrate.run({
|
|
26
26
|
client: "cli",
|
|
@@ -365,7 +365,7 @@ export declare const projectRouter: {
|
|
|
365
365
|
readonly max: 1;
|
|
366
366
|
readonly value: {
|
|
367
367
|
readonly kind: "enum";
|
|
368
|
-
readonly choices: ("
|
|
368
|
+
readonly choices: ("next" | "first" | "previous" | "last")[];
|
|
369
369
|
};
|
|
370
370
|
}];
|
|
371
371
|
}, {
|
|
@@ -6,7 +6,7 @@ import { generateCommandUsage, getOptionInputs, noInput, violatesConstraint } fr
|
|
|
6
6
|
import { confirmationDescription, canPrompt, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit, validatePositionals, validateOrderForms, requireStringOption, validateUniqueOptions, } from "../lib.js";
|
|
7
7
|
import { resolveTextEdit, textEditHelp, textEditOptions, textEditConstraints, } from "../text-edit.js";
|
|
8
8
|
import { checkFieldsBeforeText, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
|
|
9
|
-
import { formatColumnList, presentColumn } from "../presentation/column-presentation.js";
|
|
9
|
+
import { formatColumnList, presentColumn, presentColumnTaskCounts, } from "../presentation/column-presentation.js";
|
|
10
10
|
import { formatProjectList, presentProject } from "../presentation/project-presentation.js";
|
|
11
11
|
import { formatSection } from "../presentation/section.js";
|
|
12
12
|
import { currentActor } from "../actor.js";
|
|
@@ -248,11 +248,7 @@ Example: zinn project list`,
|
|
|
248
248
|
const taskCounts = column.getTaskCountsByProjectKey(projectMatch.key);
|
|
249
249
|
const presentedProject = {
|
|
250
250
|
...presentProject(projectMatch),
|
|
251
|
-
columns: taskCounts
|
|
252
|
-
id: columnCount.column.id,
|
|
253
|
-
name: columnCount.column.name,
|
|
254
|
-
taskCount: columnCount.taskCount,
|
|
255
|
-
})),
|
|
251
|
+
columns: presentColumnTaskCounts(taskCounts),
|
|
256
252
|
archivedTaskCount: taskCounts.archivedTaskCount,
|
|
257
253
|
};
|
|
258
254
|
output(presentedProject, (viewedProject) => {
|
|
@@ -436,12 +432,7 @@ Example: zinn project column create MDR Boardlog`,
|
|
|
436
432
|
});
|
|
437
433
|
validatePositionals(positionals, projectInputs.column_list.forms[0]);
|
|
438
434
|
const projectKey = resolveProjectKey(positionals[0], { required: true });
|
|
439
|
-
const
|
|
440
|
-
const columns = taskCounts.columns.map((columnCount) => ({
|
|
441
|
-
id: columnCount.column.id,
|
|
442
|
-
name: columnCount.column.name,
|
|
443
|
-
taskCount: columnCount.taskCount,
|
|
444
|
-
}));
|
|
435
|
+
const columns = presentColumnTaskCounts(column.getTaskCountsByProjectKey(projectKey));
|
|
445
436
|
output(columns, (presentedColumns) => formatColumnList(presentedColumns, {
|
|
446
437
|
showsTaskCounts: true,
|
|
447
438
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import { backup, RestoreRefusedError,
|
|
3
|
+
import { backup, RestoreRefusedError, getBackupStorage, isSqliteErrorFamily } from "@zinn-dev/core";
|
|
4
4
|
import { jsonResult } from "../results.js";
|
|
5
5
|
import { reportLockWait } from "../database.js";
|
|
6
6
|
import { confirmationDescription } from "../lib.js";
|
|
@@ -34,7 +34,8 @@ export const restoreCommand = {
|
|
|
34
34
|
validateUniqueOptions(tokens, restoreInputs.command.options);
|
|
35
35
|
validatePositionals(positionals, restoreInputs.command.forms[0]);
|
|
36
36
|
const path = resolve(positionals[0]);
|
|
37
|
-
const
|
|
37
|
+
const storage = getBackupStorage();
|
|
38
|
+
const { databasePath, backupDirectory } = storage;
|
|
38
39
|
const isPreconfirmed = values.yes === true;
|
|
39
40
|
// A backup that would be refused is refused before the prompt.
|
|
40
41
|
if (!isPreconfirmed) {
|
|
@@ -46,7 +47,12 @@ export const restoreCommand = {
|
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
try {
|
|
49
|
-
const result = backup.restore({
|
|
50
|
+
const result = backup.restore({
|
|
51
|
+
...build,
|
|
52
|
+
path,
|
|
53
|
+
storage,
|
|
54
|
+
onWait: reportLockWait,
|
|
55
|
+
});
|
|
50
56
|
output(result, (r) => {
|
|
51
57
|
const restored = `Restored the database from ${path} at schema version ${r.restoredVersion}.`;
|
|
52
58
|
return r.backupPath == null
|
package/src/routes/router.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
|
-
import { routerOptions, helpSpellings, versionSpellings, usageLabel } from "../input.js";
|
|
2
|
+
import { routerOptions, helpSpellings, versionSpellings, usageLabel, isAllowLegacyReadFlag, isHelpFlag, isRouterFlag, splitAtOptionSeparator, } from "../input.js";
|
|
3
3
|
import { getCommandAliases } from "./aliases.js";
|
|
4
4
|
import { classifyFailure, CliError } from "../errors.js";
|
|
5
5
|
import { quotedColumnHint } from "../column-hint.js";
|
|
6
6
|
import { formatCell } from "../presentation/row-layout.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return process.env.ZINN_DEBUG === "1";
|
|
11
|
-
}
|
|
7
|
+
import { formatOverview } from "../overview.js";
|
|
8
|
+
import { boundParserMessage, dashValueHelp, diagnostic, failureMessage, finishRun, isDebugOutputEnabled, isParseArgsError, parseArgsFailure, prepareOutput, quit, renderFailure, setLegacyReadAllowed, UsageError, validateUniqueOptions, } from "../lib.js";
|
|
9
|
+
import { noteMatchedRun, noteParseArgsThrew, noteUnmatchedRun } from "../telemetry.js";
|
|
12
10
|
function getIsRunnable(obj) {
|
|
13
11
|
return Object.hasOwn(obj, "run");
|
|
14
12
|
}
|
|
@@ -84,6 +82,9 @@ Options:
|
|
|
84
82
|
Commands:
|
|
85
83
|
${formatCommands(parsedRoutes, "")}
|
|
86
84
|
|
|
85
|
+
What Zinn can do:
|
|
86
|
+
${formatOverview()}
|
|
87
|
+
|
|
87
88
|
Run zinn <namespace> --help or zinn <command> --help for more information.
|
|
88
89
|
--help shows help for the command words before it and runs nothing. The rest of the line is ignored.
|
|
89
90
|
-- ends the options; every word after it is positional, even if it starts with a dash.
|
|
@@ -112,6 +113,11 @@ function routeToNamespace(parsedRoutes, words, isHelpRequest) {
|
|
|
112
113
|
const { namespace, wordCount, help } = findNearestNamespace(parsedRoutes, words);
|
|
113
114
|
const unknownWord = words[wordCount];
|
|
114
115
|
const commandName = namespace === "" ? "zinn" : `zinn ${namespace}`;
|
|
116
|
+
noteUnmatchedRun({
|
|
117
|
+
namespace,
|
|
118
|
+
help: isHelpRequest,
|
|
119
|
+
...(unknownWord == null ? {} : { unmatchedWord: unknownWord }),
|
|
120
|
+
});
|
|
115
121
|
if (unknownWord == null && isHelpRequest) {
|
|
116
122
|
console.info(help);
|
|
117
123
|
return;
|
|
@@ -168,9 +174,7 @@ export function parseRoutes(routesDef, prefix) {
|
|
|
168
174
|
async function route(parsedRoutes, rawArgs, beforeRun) {
|
|
169
175
|
prepareOutput(rawArgs);
|
|
170
176
|
// Anything after "--" belongs to the command, so "--json" there is search text, not a flag.
|
|
171
|
-
const
|
|
172
|
-
const routableArgs = separatorIndex === -1 ? rawArgs : rawArgs.slice(0, separatorIndex);
|
|
173
|
-
const passthroughArgs = separatorIndex === -1 ? [] : rawArgs.slice(separatorIndex);
|
|
177
|
+
const { optionWords: routableArgs, passthroughWords: passthroughArgs } = splitAtOptionSeparator(rawArgs);
|
|
174
178
|
const filteredRoutableArgs = routableArgs.filter((arg) => !isRouterFlag(arg));
|
|
175
179
|
if (routableArgs.some(isAllowLegacyReadFlag)) {
|
|
176
180
|
setLegacyReadAllowed(true);
|
|
@@ -192,17 +196,26 @@ async function route(parsedRoutes, rawArgs, beforeRun) {
|
|
|
192
196
|
routeToNamespace(parsedRoutes, args, isHelpRequest);
|
|
193
197
|
return;
|
|
194
198
|
}
|
|
199
|
+
const commandArgs = args.slice(nestingLevel);
|
|
200
|
+
noteMatchedRun({
|
|
201
|
+
match,
|
|
202
|
+
typedRoute: toCommand(args.slice(0, nestingLevel)),
|
|
203
|
+
commandArgs,
|
|
204
|
+
help: isHelpRequest,
|
|
205
|
+
});
|
|
195
206
|
if (isHelpRequest) {
|
|
196
207
|
console.info(match.help);
|
|
197
208
|
return;
|
|
198
209
|
}
|
|
199
210
|
validateRouterFlags(routableArgs);
|
|
200
|
-
const commandArgs = args.slice(nestingLevel);
|
|
201
211
|
try {
|
|
202
212
|
await beforeRun?.(match);
|
|
203
213
|
await match.run(commandArgs);
|
|
204
214
|
}
|
|
205
215
|
catch (err) {
|
|
216
|
+
if (isParseArgsError(err)) {
|
|
217
|
+
noteParseArgsThrew();
|
|
218
|
+
}
|
|
206
219
|
if (err instanceof UsageError) {
|
|
207
220
|
err.help = getUsage(match.help);
|
|
208
221
|
}
|
|
@@ -249,7 +262,7 @@ export function createRouter(routesDef, beforeRun) {
|
|
|
249
262
|
route: async (args) => {
|
|
250
263
|
try {
|
|
251
264
|
await route(parsedRoutes, args, beforeRun);
|
|
252
|
-
|
|
265
|
+
finishRun();
|
|
253
266
|
}
|
|
254
267
|
catch (error) {
|
|
255
268
|
renderFailure(error);
|
package/src/routes/routes.d.ts
CHANGED
|
@@ -366,7 +366,7 @@ export declare const routes: {
|
|
|
366
366
|
readonly max: 1;
|
|
367
367
|
readonly value: {
|
|
368
368
|
readonly kind: "enum";
|
|
369
|
-
readonly choices: ("
|
|
369
|
+
readonly choices: ("next" | "first" | "previous" | "last")[];
|
|
370
370
|
};
|
|
371
371
|
}];
|
|
372
372
|
}, {
|
|
@@ -592,7 +592,7 @@ export declare const routes: {
|
|
|
592
592
|
readonly name: "n";
|
|
593
593
|
readonly pattern: string;
|
|
594
594
|
};
|
|
595
|
-
readonly description: "Return at most n results after all filters.
|
|
595
|
+
readonly description: "Return at most n results after all filters.";
|
|
596
596
|
};
|
|
597
597
|
readonly sort: {
|
|
598
598
|
readonly type: "string";
|
|
@@ -629,9 +629,9 @@ export declare const routes: {
|
|
|
629
629
|
readonly "starting-after": {
|
|
630
630
|
readonly type: "string";
|
|
631
631
|
readonly value: {
|
|
632
|
-
readonly kind: "task-
|
|
633
|
-
readonly name: "
|
|
634
|
-
readonly description: "
|
|
632
|
+
readonly kind: "task-cursor";
|
|
633
|
+
readonly name: "cursor";
|
|
634
|
+
readonly description: "Cursor from the continuation command that task list prints on stderr when more tasks remain";
|
|
635
635
|
};
|
|
636
636
|
};
|
|
637
637
|
readonly "due-since": {
|
|
@@ -669,7 +669,7 @@ export declare const routes: {
|
|
|
669
669
|
readonly kind: "exclusive";
|
|
670
670
|
readonly members: readonly ["positional:project-key", "option:all-projects"];
|
|
671
671
|
}];
|
|
672
|
-
readonly notes: readonly ["An omitted project key uses defaultProject, or all projects if unset. --all-projects overrides the default and cannot be combined with a project key.", "A --starting-after
|
|
672
|
+
readonly notes: readonly ["An omitted project key uses defaultProject, or all projects if unset. --all-projects overrides the default and cannot be combined with a project key.", "A --starting-after cursor works only with the --sort it was made for. Filters may change between pages."];
|
|
673
673
|
};
|
|
674
674
|
results: import("../results.js").CommandResult[];
|
|
675
675
|
run: (args: string[]) => void;
|
|
@@ -702,7 +702,7 @@ export declare const routes: {
|
|
|
702
702
|
readonly name: "n";
|
|
703
703
|
readonly pattern: string;
|
|
704
704
|
};
|
|
705
|
-
readonly description: "Return at most n results after all filters.
|
|
705
|
+
readonly description: "Return at most n results after all filters.";
|
|
706
706
|
};
|
|
707
707
|
readonly label: {
|
|
708
708
|
readonly type: "string";
|
|
@@ -712,6 +712,13 @@ export declare const routes: {
|
|
|
712
712
|
readonly name: "name";
|
|
713
713
|
};
|
|
714
714
|
};
|
|
715
|
+
readonly column: {
|
|
716
|
+
readonly type: "string";
|
|
717
|
+
readonly value: {
|
|
718
|
+
readonly kind: "column-name";
|
|
719
|
+
readonly name: "name";
|
|
720
|
+
};
|
|
721
|
+
};
|
|
715
722
|
readonly "due-since": {
|
|
716
723
|
readonly type: "string";
|
|
717
724
|
readonly value: {
|
|
@@ -792,6 +799,34 @@ export declare const routes: {
|
|
|
792
799
|
run: (args: string[]) => void;
|
|
793
800
|
help: string;
|
|
794
801
|
};
|
|
802
|
+
blame: {
|
|
803
|
+
summary: string;
|
|
804
|
+
effects: {
|
|
805
|
+
domain: "read";
|
|
806
|
+
storage: "normal-open";
|
|
807
|
+
};
|
|
808
|
+
confirmation: {
|
|
809
|
+
kind: "none";
|
|
810
|
+
};
|
|
811
|
+
input: {
|
|
812
|
+
readonly options: {};
|
|
813
|
+
readonly forms: readonly [{
|
|
814
|
+
readonly id: "default";
|
|
815
|
+
readonly positionals: readonly [{
|
|
816
|
+
readonly name: "task-key";
|
|
817
|
+
readonly min: 1;
|
|
818
|
+
readonly max: 1;
|
|
819
|
+
readonly value: {
|
|
820
|
+
readonly kind: "task-key";
|
|
821
|
+
};
|
|
822
|
+
}];
|
|
823
|
+
}];
|
|
824
|
+
readonly constraints: readonly [];
|
|
825
|
+
};
|
|
826
|
+
results: import("../results.js").CommandResult[];
|
|
827
|
+
run: (args: string[]) => void;
|
|
828
|
+
help: string;
|
|
829
|
+
};
|
|
795
830
|
edit: {
|
|
796
831
|
summary: string;
|
|
797
832
|
effects: {
|
|
@@ -1843,6 +1878,14 @@ export declare const routes: {
|
|
|
1843
1878
|
readonly name: "id";
|
|
1844
1879
|
};
|
|
1845
1880
|
};
|
|
1881
|
+
readonly client: {
|
|
1882
|
+
readonly type: "string";
|
|
1883
|
+
readonly value: {
|
|
1884
|
+
readonly kind: "text";
|
|
1885
|
+
readonly name: "name";
|
|
1886
|
+
readonly description: "Match a client name or its colon-separated parts, including case.";
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1846
1889
|
readonly since: {
|
|
1847
1890
|
readonly type: "string";
|
|
1848
1891
|
readonly value: {
|
|
@@ -1885,7 +1928,7 @@ export declare const routes: {
|
|
|
1885
1928
|
readonly name: "n";
|
|
1886
1929
|
readonly pattern: string;
|
|
1887
1930
|
};
|
|
1888
|
-
readonly description: "Return at most n results after all filters.
|
|
1931
|
+
readonly description: "Return at most n results after all filters.";
|
|
1889
1932
|
};
|
|
1890
1933
|
readonly "starting-after": {
|
|
1891
1934
|
readonly type: "string";
|
|
@@ -142,7 +142,7 @@ export declare const taskRouter: {
|
|
|
142
142
|
readonly name: "n";
|
|
143
143
|
readonly pattern: string;
|
|
144
144
|
};
|
|
145
|
-
readonly description: "Return at most n results after all filters.
|
|
145
|
+
readonly description: "Return at most n results after all filters.";
|
|
146
146
|
};
|
|
147
147
|
readonly sort: {
|
|
148
148
|
readonly type: "string";
|
|
@@ -179,9 +179,9 @@ export declare const taskRouter: {
|
|
|
179
179
|
readonly "starting-after": {
|
|
180
180
|
readonly type: "string";
|
|
181
181
|
readonly value: {
|
|
182
|
-
readonly kind: "task-
|
|
183
|
-
readonly name: "
|
|
184
|
-
readonly description: "
|
|
182
|
+
readonly kind: "task-cursor";
|
|
183
|
+
readonly name: "cursor";
|
|
184
|
+
readonly description: "Cursor from the continuation command that task list prints on stderr when more tasks remain";
|
|
185
185
|
};
|
|
186
186
|
};
|
|
187
187
|
readonly "due-since": {
|
|
@@ -219,7 +219,7 @@ export declare const taskRouter: {
|
|
|
219
219
|
readonly kind: "exclusive";
|
|
220
220
|
readonly members: readonly ["positional:project-key", "option:all-projects"];
|
|
221
221
|
}];
|
|
222
|
-
readonly notes: readonly ["An omitted project key uses defaultProject, or all projects if unset. --all-projects overrides the default and cannot be combined with a project key.", "A --starting-after
|
|
222
|
+
readonly notes: readonly ["An omitted project key uses defaultProject, or all projects if unset. --all-projects overrides the default and cannot be combined with a project key.", "A --starting-after cursor works only with the --sort it was made for. Filters may change between pages."];
|
|
223
223
|
};
|
|
224
224
|
results: import("../results.js").CommandResult[];
|
|
225
225
|
run: (args: string[]) => void;
|
|
@@ -252,7 +252,7 @@ export declare const taskRouter: {
|
|
|
252
252
|
readonly name: "n";
|
|
253
253
|
readonly pattern: string;
|
|
254
254
|
};
|
|
255
|
-
readonly description: "Return at most n results after all filters.
|
|
255
|
+
readonly description: "Return at most n results after all filters.";
|
|
256
256
|
};
|
|
257
257
|
readonly label: {
|
|
258
258
|
readonly type: "string";
|
|
@@ -262,6 +262,13 @@ export declare const taskRouter: {
|
|
|
262
262
|
readonly name: "name";
|
|
263
263
|
};
|
|
264
264
|
};
|
|
265
|
+
readonly column: {
|
|
266
|
+
readonly type: "string";
|
|
267
|
+
readonly value: {
|
|
268
|
+
readonly kind: "column-name";
|
|
269
|
+
readonly name: "name";
|
|
270
|
+
};
|
|
271
|
+
};
|
|
265
272
|
readonly "due-since": {
|
|
266
273
|
readonly type: "string";
|
|
267
274
|
readonly value: {
|
|
@@ -342,6 +349,34 @@ export declare const taskRouter: {
|
|
|
342
349
|
run: (args: string[]) => void;
|
|
343
350
|
help: string;
|
|
344
351
|
};
|
|
352
|
+
blame: {
|
|
353
|
+
summary: string;
|
|
354
|
+
effects: {
|
|
355
|
+
domain: "read";
|
|
356
|
+
storage: "normal-open";
|
|
357
|
+
};
|
|
358
|
+
confirmation: {
|
|
359
|
+
kind: "none";
|
|
360
|
+
};
|
|
361
|
+
input: {
|
|
362
|
+
readonly options: {};
|
|
363
|
+
readonly forms: readonly [{
|
|
364
|
+
readonly id: "default";
|
|
365
|
+
readonly positionals: readonly [{
|
|
366
|
+
readonly name: "task-key";
|
|
367
|
+
readonly min: 1;
|
|
368
|
+
readonly max: 1;
|
|
369
|
+
readonly value: {
|
|
370
|
+
readonly kind: "task-key";
|
|
371
|
+
};
|
|
372
|
+
}];
|
|
373
|
+
}];
|
|
374
|
+
readonly constraints: readonly [];
|
|
375
|
+
};
|
|
376
|
+
results: import("../results.js").CommandResult[];
|
|
377
|
+
run: (args: string[]) => void;
|
|
378
|
+
help: string;
|
|
379
|
+
};
|
|
345
380
|
edit: {
|
|
346
381
|
summary: string;
|
|
347
382
|
effects: {
|