@zinn-dev/cli 0.41.0 → 0.43.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 +4 -4
- package/skills/zinn/SKILL.md +1 -1
- package/src/capabilities-schema.d.ts +25 -26
- 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.d.ts +31 -3
- package/src/errors.js +77 -20
- package/src/input.d.ts +154 -43
- package/src/input.js +86 -13
- package/src/lib.d.ts +43 -6
- package/src/lib.js +134 -38
- package/src/list-continuation.d.ts +11 -0
- package/src/list-continuation.js +18 -0
- package/src/list-limit.d.ts +11 -0
- package/src/list-limit.js +17 -0
- package/src/presentation/activity-presentation.d.ts +9 -1
- package/src/presentation/activity-presentation.js +124 -28
- 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 +4 -0
- package/src/presentation/description-presentation.js +28 -5
- package/src/presentation/label-presentation.d.ts +8 -0
- package/src/presentation/label-presentation.js +28 -0
- package/src/presentation/project-presentation.d.ts +11 -0
- package/src/presentation/project-presentation.js +27 -0
- package/src/presentation/relation-presentation.d.ts +12 -0
- package/src/presentation/relation-presentation.js +87 -0
- package/src/presentation/row-layout.d.ts +1 -1
- package/src/presentation/row-layout.js +6 -5
- package/src/presentation/task-presentation.d.ts +3 -3
- package/src/presentation/task-presentation.js +29 -19
- package/src/presentation/text-width.d.ts +2 -0
- package/src/presentation/text-width.js +43 -0
- package/src/presentation/time.d.ts +3 -1
- package/src/presentation/time.js +5 -2
- package/src/project.d.ts +14 -5
- package/src/project.js +18 -6
- package/src/result-schemas.d.ts +279 -26
- package/src/result-schemas.js +72 -4
- package/src/results.d.ts +34 -17
- package/src/results.js +19 -0
- package/src/routes/activity-router.d.ts +79 -2
- package/src/routes/activity-router.js +209 -38
- 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 +74 -12
- package/src/routes/project-router.js +131 -66
- package/src/routes/relation-router.d.ts +13 -9
- package/src/routes/relation-router.js +116 -116
- package/src/routes/restore-router.js +3 -6
- package/src/routes/router.d.ts +1 -1
- package/src/routes/router.js +88 -32
- package/src/routes/routes.d.ts +420 -50
- package/src/routes/routes.js +4 -0
- package/src/routes/task-router.d.ts +189 -30
- package/src/routes/task-router.js +254 -158
- 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/timestamp-input.d.ts +3 -0
- package/src/timestamp-input.js +31 -0
- package/src/types.d.ts +32 -9
- package/src/types.js +9 -1
|
@@ -1,47 +1,26 @@
|
|
|
1
1
|
import { jsonResult } from "../results.js";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
|
-
import { column, project, columnOrderSchema } from "@zinn-dev/core";
|
|
3
|
+
import { column, project, columnOrderSchema, columnDeleteSchema, projectCreateSchema, projectEditSchema, } from "@zinn-dev/core";
|
|
4
4
|
import { CliError } from "../errors.js";
|
|
5
5
|
import { generateCommandUsage, getOptionInputs, noInput, violatesConstraint } from "../input.js";
|
|
6
|
-
import { confirmationDescription, canPrompt, confirmAction, dashValueHelp, diagnostic, output, quit, validatePositionals, validateOrderForms, requireStringOption, validateUniqueOptions, } from "../lib.js";
|
|
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
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { checkFieldsBeforeText, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
|
|
9
|
+
import { formatColumnList, presentColumn } from "../presentation/column-presentation.js";
|
|
10
|
+
import { formatProjectList, presentProject } from "../presentation/project-presentation.js";
|
|
11
11
|
import { formatSection } from "../presentation/section.js";
|
|
12
12
|
import { currentActor } from "../actor.js";
|
|
13
|
-
import { resolveProjectKey, requiredProjectDescription } from "../project.js";
|
|
14
|
-
function presentProject(projectMatch) {
|
|
15
|
-
return { key: projectMatch.key, name: projectMatch.name, description: projectMatch.description };
|
|
16
|
-
}
|
|
17
|
-
function formatProject(presented, options = {}) {
|
|
18
|
-
return formatProjectList([presented], options);
|
|
19
|
-
}
|
|
20
|
-
function formatProjectList(presentedProjects, { showsDescriptionPreview = true } = {}) {
|
|
21
|
-
return formatRows(presentedProjects.map((presented) => {
|
|
22
|
-
const descriptionPreview = showsDescriptionPreview
|
|
23
|
-
? formatDescriptionPreview(presented.description)
|
|
24
|
-
: "";
|
|
25
|
-
const description = descriptionPreview.length > 0 ? `${formatCellSeparator()}${descriptionPreview}` : "";
|
|
26
|
-
return [{ text: presented.key }, { text: `${presented.name}${description}` }];
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
function presentColumn(columnMatch) {
|
|
30
|
-
const columnProject = project.getById(columnMatch.project_id);
|
|
31
|
-
return { project: columnProject.key, name: columnMatch.name };
|
|
32
|
-
}
|
|
33
|
-
function formatColumn(presented) {
|
|
34
|
-
return formatColumnList([presented], { showsProject: true });
|
|
35
|
-
}
|
|
13
|
+
import { checkDefaultProject, chooseProjectKey, resolveProjectKey, requiredProjectDescription, } from "../project.js";
|
|
36
14
|
const projectEditConstraint = {
|
|
37
15
|
kind: "atLeastOne",
|
|
38
|
-
members: ["option:name", "option:description"],
|
|
16
|
+
members: ["option:name", "option:description", "option:description-file"],
|
|
39
17
|
};
|
|
40
18
|
const projectInputs = {
|
|
41
19
|
create: {
|
|
42
20
|
options: {
|
|
43
21
|
name: { type: "string", value: { kind: "text", name: "text" } },
|
|
44
22
|
description: { type: "string", value: { kind: "text", name: "text" } },
|
|
23
|
+
"description-file": textFileOption,
|
|
45
24
|
},
|
|
46
25
|
forms: [
|
|
47
26
|
{
|
|
@@ -49,7 +28,7 @@ const projectInputs = {
|
|
|
49
28
|
positionals: [{ name: "project-key", min: 1, max: 1, value: { kind: "project-key" } }],
|
|
50
29
|
},
|
|
51
30
|
],
|
|
52
|
-
constraints: [],
|
|
31
|
+
constraints: [textSourceConstraint("--description")],
|
|
53
32
|
},
|
|
54
33
|
list: noInput,
|
|
55
34
|
view: {
|
|
@@ -67,6 +46,7 @@ const projectInputs = {
|
|
|
67
46
|
options: {
|
|
68
47
|
name: { type: "string", value: { kind: "text", name: "text" } },
|
|
69
48
|
description: { type: "string", value: { kind: "text", name: "text" } },
|
|
49
|
+
"description-file": textFileOption,
|
|
70
50
|
...textEditOptions,
|
|
71
51
|
},
|
|
72
52
|
forms: [
|
|
@@ -75,7 +55,11 @@ const projectInputs = {
|
|
|
75
55
|
positionals: [{ name: "project-key", min: 0, max: 1, value: { kind: "project-key" } }],
|
|
76
56
|
},
|
|
77
57
|
],
|
|
78
|
-
constraints: [
|
|
58
|
+
constraints: [
|
|
59
|
+
textSourceConstraint("--description"),
|
|
60
|
+
...textEditConstraints("--description"),
|
|
61
|
+
projectEditConstraint,
|
|
62
|
+
],
|
|
79
63
|
notes: [requiredProjectDescription, textEditHelp("--description")],
|
|
80
64
|
},
|
|
81
65
|
delete: {
|
|
@@ -126,6 +110,19 @@ const projectInputs = {
|
|
|
126
110
|
],
|
|
127
111
|
constraints: [],
|
|
128
112
|
},
|
|
113
|
+
column_delete: {
|
|
114
|
+
options: { yes: { type: "boolean" } },
|
|
115
|
+
forms: [
|
|
116
|
+
{
|
|
117
|
+
id: "default",
|
|
118
|
+
positionals: [
|
|
119
|
+
{ name: "project-key", min: 1, max: 1, value: { kind: "project-key" } },
|
|
120
|
+
{ name: "column-name", min: 1, max: 1, value: { kind: "column-name" } },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
constraints: [],
|
|
125
|
+
},
|
|
129
126
|
column_order: {
|
|
130
127
|
options: {},
|
|
131
128
|
forms: [
|
|
@@ -167,7 +164,7 @@ export const projectRouter = {
|
|
|
167
164
|
confirmation: { kind: "none" },
|
|
168
165
|
input: projectInputs.create,
|
|
169
166
|
results: [jsonResult("Project")],
|
|
170
|
-
run: (args) => {
|
|
167
|
+
run: async (args) => {
|
|
171
168
|
const { values, positionals, tokens } = parseArgs({
|
|
172
169
|
args,
|
|
173
170
|
options: projectInputs.create.options,
|
|
@@ -178,9 +175,11 @@ export const projectRouter = {
|
|
|
178
175
|
validateUniqueOptions(tokens, projectInputs.create.options);
|
|
179
176
|
validatePositionals(positionals, projectInputs.create.forms[0]);
|
|
180
177
|
const projectKey = positionals[0];
|
|
178
|
+
checkFieldsBeforeText(projectCreateSchema, { key: projectKey, name: values.name });
|
|
179
|
+
const description = await resolveTextInput(values.description, values["description-file"], "--description");
|
|
181
180
|
try {
|
|
182
|
-
const createdProject = project.create({ key: projectKey, name: values.name, description
|
|
183
|
-
output(presentProject(createdProject),
|
|
181
|
+
const createdProject = project.create({ key: projectKey, name: values.name, description }, currentActor());
|
|
182
|
+
output(presentProject(createdProject), (entry) => formatProjectList([entry]));
|
|
184
183
|
}
|
|
185
184
|
catch (err) {
|
|
186
185
|
throw err;
|
|
@@ -194,13 +193,14 @@ Project keys are stored in uppercase.
|
|
|
194
193
|
An omitted name defaults to the uppercase project key.
|
|
195
194
|
Names are trimmed and cannot be blank or contain line breaks or control characters.
|
|
196
195
|
Descriptions may contain multiple lines. If omitted, they are saved as null.
|
|
196
|
+
${textFileHelp("--description")}
|
|
197
197
|
|
|
198
198
|
${dashValueHelp("--description")}
|
|
199
199
|
|
|
200
200
|
Example: zinn project create MDR --name 'Macrodata Refinement'`,
|
|
201
201
|
},
|
|
202
202
|
list: {
|
|
203
|
-
summary: "List projects
|
|
203
|
+
summary: "List projects with active and archived task counts.",
|
|
204
204
|
effects: { domain: "read", storage: "normal-open" },
|
|
205
205
|
confirmation: { kind: "none" },
|
|
206
206
|
input: projectInputs.list,
|
|
@@ -213,12 +213,16 @@ Example: zinn project create MDR --name 'Macrodata Refinement'`,
|
|
|
213
213
|
strict: true,
|
|
214
214
|
});
|
|
215
215
|
validatePositionals(positionals, projectInputs.list.forms[0]);
|
|
216
|
-
const projects = project
|
|
217
|
-
|
|
216
|
+
const projects = project
|
|
217
|
+
.getAllWithTaskCounts()
|
|
218
|
+
.map((entry) => ({ ...presentProject(entry), taskCounts: entry.taskCounts }));
|
|
219
|
+
output(projects, (entries) => formatProjectList(entries, { showsTaskCounts: true }));
|
|
218
220
|
},
|
|
219
221
|
help: `${generateCommandUsage("project list", projectInputs.list)}
|
|
220
222
|
|
|
221
|
-
List projects
|
|
223
|
+
List projects with active and archived task counts.
|
|
224
|
+
Active tasks are unarchived tasks in any column, including Done.
|
|
225
|
+
With --json, each project includes taskCounts: { active, archived }, including zeros.
|
|
222
226
|
|
|
223
227
|
Example: zinn project list`,
|
|
224
228
|
},
|
|
@@ -239,12 +243,13 @@ Example: zinn project list`,
|
|
|
239
243
|
const projectKey = resolveProjectKey(positionals[0], { required: true });
|
|
240
244
|
const projectMatch = project.getByKey(projectKey);
|
|
241
245
|
if (projectMatch == null) {
|
|
242
|
-
throw new CliError(`Project with key "${project.standardizeKey(projectKey)}" does not exist
|
|
246
|
+
throw new CliError(`Project with key "${project.standardizeKey(projectKey)}" does not exist`, "not_found", { entity: "project", key: project.standardizeKey(projectKey), source: "explicit" });
|
|
243
247
|
}
|
|
244
248
|
const taskCounts = column.getTaskCountsByProjectKey(projectMatch.key);
|
|
245
249
|
const presentedProject = {
|
|
246
250
|
...presentProject(projectMatch),
|
|
247
251
|
columns: taskCounts.columns.map((columnCount) => ({
|
|
252
|
+
id: columnCount.column.id,
|
|
248
253
|
name: columnCount.column.name,
|
|
249
254
|
taskCount: columnCount.taskCount,
|
|
250
255
|
})),
|
|
@@ -252,15 +257,17 @@ Example: zinn project list`,
|
|
|
252
257
|
};
|
|
253
258
|
output(presentedProject, (viewedProject) => {
|
|
254
259
|
// The full description follows as its own section, so the row leaves out the preview.
|
|
255
|
-
const sections = [
|
|
260
|
+
const sections = [formatProjectList([viewedProject], { showsDescriptionPreview: false })];
|
|
256
261
|
if (viewedProject.description != null) {
|
|
257
262
|
sections.push(formatSection("Description", viewedProject.description));
|
|
258
263
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
if (viewedProject.columns.length > 0) {
|
|
265
|
+
const columnTaskCounts = formatColumnList(viewedProject.columns, {
|
|
266
|
+
showsTaskCounts: true,
|
|
267
|
+
archivedTaskCount: viewedProject.archivedTaskCount,
|
|
268
|
+
});
|
|
269
|
+
sections.push(formatSection("Columns", columnTaskCounts));
|
|
270
|
+
}
|
|
264
271
|
return sections.join("\n\n");
|
|
265
272
|
});
|
|
266
273
|
},
|
|
@@ -277,8 +284,8 @@ Example: zinn project view MDR`,
|
|
|
277
284
|
effects: { domain: "update", storage: "normal-open" },
|
|
278
285
|
confirmation: { kind: "none" },
|
|
279
286
|
input: projectInputs.edit,
|
|
280
|
-
results: [jsonResult("
|
|
281
|
-
run: (args) => {
|
|
287
|
+
results: [jsonResult("ProjectChange")],
|
|
288
|
+
run: async (args) => {
|
|
282
289
|
const { values, positionals, tokens } = parseArgs({
|
|
283
290
|
args,
|
|
284
291
|
options: projectInputs.edit.options,
|
|
@@ -288,19 +295,29 @@ Example: zinn project view MDR`,
|
|
|
288
295
|
});
|
|
289
296
|
validateUniqueOptions(tokens, projectInputs.edit.options);
|
|
290
297
|
validatePositionals(positionals, projectInputs.edit.forms[0]);
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
298
|
+
const projectChoice = chooseProjectKey(positionals[0], { required: true });
|
|
299
|
+
checkFieldsBeforeText(projectEditSchema, {
|
|
300
|
+
projectKey: projectChoice.key,
|
|
301
|
+
name: values.name,
|
|
302
|
+
});
|
|
303
|
+
const description = await resolveTextEdit(values, "--description");
|
|
304
|
+
// Without a text source nothing was read, so this usage error still comes before any input
|
|
305
|
+
if (violatesConstraint(projectEditConstraint, getOptionInputs(values))) {
|
|
306
|
+
quit("Provide an edit flag: --name, --description or --description-file", undefined, {
|
|
307
|
+
field: [],
|
|
308
|
+
});
|
|
295
309
|
}
|
|
296
|
-
|
|
297
|
-
|
|
310
|
+
checkDefaultProject(projectChoice);
|
|
311
|
+
const editedProject = project.edit({ projectKey: projectChoice.key, name: values.name, description }, currentActor());
|
|
312
|
+
outputChanges([editedProject], (change) => presentProject(change.project), formatProjectList, (entry) => `Project ${entry.key} was unchanged`);
|
|
298
313
|
},
|
|
299
314
|
help: `${generateCommandUsage("project edit", projectInputs.edit)}
|
|
300
315
|
|
|
301
316
|
Change the supplied project fields. At least one edit flag is required.
|
|
317
|
+
With --json, changed is false when all supplied values already match.
|
|
302
318
|
${requiredProjectDescription}
|
|
303
319
|
Use --description '' to clear the description.
|
|
320
|
+
${textFileHelp("--description")}
|
|
304
321
|
|
|
305
322
|
${textEditHelp("--description")}
|
|
306
323
|
|
|
@@ -334,7 +351,7 @@ Examples:
|
|
|
334
351
|
try {
|
|
335
352
|
const projectMatch = project.getByKey(projectKey);
|
|
336
353
|
if (projectMatch == null) {
|
|
337
|
-
throw new CliError(`Project with key "${projectKey}" does not exist
|
|
354
|
+
throw new CliError(`Project with key "${projectKey}" does not exist`, "not_found", {
|
|
338
355
|
entity: "project",
|
|
339
356
|
key: projectKey,
|
|
340
357
|
source: "explicit",
|
|
@@ -353,10 +370,10 @@ Examples:
|
|
|
353
370
|
: undefined);
|
|
354
371
|
if (canDelete) {
|
|
355
372
|
const deletedProject = project.delete(projectKey, currentActor());
|
|
356
|
-
output(presentProject(deletedProject), (p) => `Deleted ${
|
|
373
|
+
output(presentProject(deletedProject), (p) => `Deleted ${formatProjectList([p])}`);
|
|
357
374
|
}
|
|
358
375
|
else {
|
|
359
|
-
output(presentProject(projectMatch), (p) => `Deletion cancelled for ${
|
|
376
|
+
output(presentProject(projectMatch), (p) => `Deletion cancelled for ${formatProjectList([p])}`);
|
|
360
377
|
}
|
|
361
378
|
}
|
|
362
379
|
catch (err) {
|
|
@@ -391,7 +408,7 @@ Example: zinn project delete MDR`,
|
|
|
391
408
|
const columnName = positionals[1];
|
|
392
409
|
try {
|
|
393
410
|
const createdColumn = column.create({ projectKey, name: columnName }, currentActor());
|
|
394
|
-
output(presentColumn(createdColumn),
|
|
411
|
+
output(presentColumn(createdColumn), (entry) => formatColumnList([entry], { showsProject: true }));
|
|
395
412
|
}
|
|
396
413
|
catch (err) {
|
|
397
414
|
throw err;
|
|
@@ -421,6 +438,7 @@ Example: zinn project column create MDR Boardlog`,
|
|
|
421
438
|
const projectKey = resolveProjectKey(positionals[0], { required: true });
|
|
422
439
|
const taskCounts = column.getTaskCountsByProjectKey(projectKey);
|
|
423
440
|
const columns = taskCounts.columns.map((columnCount) => ({
|
|
441
|
+
id: columnCount.column.id,
|
|
424
442
|
name: columnCount.column.name,
|
|
425
443
|
taskCount: columnCount.taskCount,
|
|
426
444
|
}));
|
|
@@ -440,7 +458,7 @@ Example: zinn project column list MDR`,
|
|
|
440
458
|
effects: { domain: "update", storage: "normal-open" },
|
|
441
459
|
confirmation: { kind: "none" },
|
|
442
460
|
input: projectInputs.column_edit,
|
|
443
|
-
results: [jsonResult("
|
|
461
|
+
results: [jsonResult("ColumnChange")],
|
|
444
462
|
run: (args) => {
|
|
445
463
|
const { values, positionals, tokens } = parseArgs({
|
|
446
464
|
args,
|
|
@@ -457,12 +475,13 @@ Example: zinn project column list MDR`,
|
|
|
457
475
|
columnName: positionals[1],
|
|
458
476
|
name,
|
|
459
477
|
}, currentActor());
|
|
460
|
-
|
|
478
|
+
outputChanges([editedColumn], (change) => presentColumn(change.column), (entries) => formatColumnList(entries, { showsProject: true }), (entry) => `Column "${entry.name}" was unchanged`);
|
|
461
479
|
},
|
|
462
480
|
help: `${generateCommandUsage("project column edit", projectInputs.column_edit)}
|
|
463
481
|
|
|
464
482
|
Rename a column.
|
|
465
483
|
The --name flag is required.
|
|
484
|
+
With --json, changed is false when the name already matches.
|
|
466
485
|
|
|
467
486
|
Columns are matched by name, and matching is case-insensitive.
|
|
468
487
|
Names are trimmed, and must remain unique within the same project.
|
|
@@ -477,7 +496,7 @@ Example: zinn project column edit MDR 'In Progress' --name Refining`,
|
|
|
477
496
|
effects: { domain: "update", storage: "normal-open" },
|
|
478
497
|
confirmation: { kind: "none" },
|
|
479
498
|
input: projectInputs.column_order,
|
|
480
|
-
results: [jsonResult("
|
|
499
|
+
results: [jsonResult("ColumnChange")],
|
|
481
500
|
run: (args) => {
|
|
482
501
|
const { positionals } = parseArgs({
|
|
483
502
|
options: projectInputs.column_order.options,
|
|
@@ -490,15 +509,17 @@ Example: zinn project column edit MDR 'In Progress' --name Refining`,
|
|
|
490
509
|
const columnName = positionals[1];
|
|
491
510
|
let orderedColumn;
|
|
492
511
|
if (form.id === "relative") {
|
|
493
|
-
|
|
494
|
-
|
|
512
|
+
orderedColumn = column.order({
|
|
513
|
+
projectKey,
|
|
514
|
+
columnName,
|
|
515
|
+
direction: form.direction,
|
|
516
|
+
targetColumnName: positionals[form.directionIndex + 1],
|
|
517
|
+
}, currentActor());
|
|
495
518
|
}
|
|
496
519
|
else {
|
|
497
|
-
|
|
498
|
-
orderedColumn = column.order({ projectKey, columnName, direction }, currentActor());
|
|
520
|
+
orderedColumn = column.order({ projectKey, columnName, direction: form.direction }, currentActor());
|
|
499
521
|
}
|
|
500
|
-
|
|
501
|
-
output(presentColumn(orderedColumn), formatColumn);
|
|
522
|
+
outputChanges([orderedColumn], (change) => presentColumn(change.column), (entries) => formatColumnList(entries, { showsProject: true }), (entry) => `Column "${entry.name}" was already in that position`);
|
|
502
523
|
},
|
|
503
524
|
help: `${generateCommandUsage("project column order", projectInputs.column_order)}
|
|
504
525
|
|
|
@@ -507,8 +528,52 @@ Use first or last for either end, previous or next for one position,
|
|
|
507
528
|
or before or after to place it relative to another column.
|
|
508
529
|
|
|
509
530
|
Columns are matched by name, and matching is case-insensitive.
|
|
531
|
+
Ordering to the current position, or before or after itself, leaves the column unchanged.
|
|
532
|
+
With --json, changed is false when the column was already in that position.
|
|
510
533
|
|
|
511
534
|
Example: zinn project column order MDR Review before 'In Progress'`,
|
|
512
535
|
},
|
|
536
|
+
delete: {
|
|
537
|
+
summary: "Delete an empty project column after confirmation.",
|
|
538
|
+
effects: { domain: "delete", storage: "normal-open" },
|
|
539
|
+
confirmation: { kind: "prompt", description: confirmationDescription },
|
|
540
|
+
input: projectInputs.column_delete,
|
|
541
|
+
results: [jsonResult("Column")],
|
|
542
|
+
run: async (args) => {
|
|
543
|
+
const { values, positionals, tokens } = parseArgs({
|
|
544
|
+
args,
|
|
545
|
+
options: projectInputs.column_delete.options,
|
|
546
|
+
allowPositionals: true,
|
|
547
|
+
strict: true,
|
|
548
|
+
tokens: true,
|
|
549
|
+
});
|
|
550
|
+
validateUniqueOptions(tokens, projectInputs.column_delete.options);
|
|
551
|
+
validatePositionals(positionals, projectInputs.column_delete.forms[0]);
|
|
552
|
+
const props = columnDeleteSchema.parse({
|
|
553
|
+
projectKey: positionals[0],
|
|
554
|
+
columnName: positionals[1],
|
|
555
|
+
});
|
|
556
|
+
const columnMatch = column.getByName(props.projectKey, props.columnName);
|
|
557
|
+
const presentedColumn = presentColumn(columnMatch);
|
|
558
|
+
const canDelete = await confirmAction(`Are you sure you want to delete column "${columnMatch.name}" from ${presentedColumn.project}?`, values.yes === true);
|
|
559
|
+
if (!canDelete) {
|
|
560
|
+
output(presentedColumn, (entry) => `Deletion cancelled for ${formatColumnList([entry], { showsProject: true })}`);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
const deletedColumn = column.delete(props, currentActor());
|
|
564
|
+
output(presentColumn(deletedColumn), (entry) => `Deleted ${formatColumnList([entry], { showsProject: true })}`);
|
|
565
|
+
},
|
|
566
|
+
help: `${generateCommandUsage("project column delete", projectInputs.column_delete)}
|
|
567
|
+
|
|
568
|
+
Delete an empty project column after confirmation.
|
|
569
|
+
Columns are matched by name, and matching is case-insensitive.
|
|
570
|
+
A column must hold no active or archived tasks. Use task move or task delete to clear it.
|
|
571
|
+
New tasks enter the project's first column unless --column selects another.
|
|
572
|
+
A project may have no columns. Add one with project column create before creating tasks.
|
|
573
|
+
|
|
574
|
+
Use --yes to skip the confirmation prompt, including with --json.
|
|
575
|
+
|
|
576
|
+
Example: zinn project column delete MDR Review`,
|
|
577
|
+
},
|
|
513
578
|
},
|
|
514
579
|
};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import type { PresentedRelation } from "../result-schemas.js";
|
|
2
|
-
import type { TaskWithKey } from "@zinn-dev/core";
|
|
3
|
-
export declare function presentRelations(taskMatch: TaskWithKey): Array<PresentedRelation>;
|
|
4
|
-
export declare function formatRelations(relations: Array<PresentedRelation>): string;
|
|
5
1
|
export declare const relationRouter: {
|
|
6
2
|
create: {
|
|
7
3
|
summary: string;
|
|
8
4
|
effects: {
|
|
9
|
-
domain: "
|
|
5
|
+
domain: "replace";
|
|
10
6
|
storage: "normal-open";
|
|
11
7
|
};
|
|
12
8
|
confirmation: {
|
|
13
|
-
kind: "
|
|
9
|
+
kind: "prompt";
|
|
10
|
+
description: string;
|
|
14
11
|
};
|
|
15
12
|
input: {
|
|
16
13
|
readonly options: {
|
|
14
|
+
readonly yes: {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
};
|
|
17
17
|
readonly type: {
|
|
18
18
|
readonly type: "string";
|
|
19
19
|
readonly required: true;
|
|
20
20
|
readonly value: {
|
|
21
21
|
readonly kind: "enum";
|
|
22
|
-
readonly name: "type";
|
|
23
22
|
readonly choices: ("related" | "dependency" | "duplicate" | "subtask")[];
|
|
24
23
|
};
|
|
25
24
|
};
|
|
@@ -45,7 +44,10 @@ export declare const relationRouter: {
|
|
|
45
44
|
readonly constraints: readonly [];
|
|
46
45
|
};
|
|
47
46
|
results: import("../results.js").CommandResult[];
|
|
48
|
-
|
|
47
|
+
guessedFlags: {
|
|
48
|
+
[k: string]: (args: Array<string>) => string[] | undefined;
|
|
49
|
+
};
|
|
50
|
+
run: (args: string[]) => Promise<void>;
|
|
49
51
|
help: string;
|
|
50
52
|
};
|
|
51
53
|
list: {
|
|
@@ -92,7 +94,6 @@ export declare const relationRouter: {
|
|
|
92
94
|
readonly required: true;
|
|
93
95
|
readonly value: {
|
|
94
96
|
readonly kind: "enum";
|
|
95
|
-
readonly name: "type";
|
|
96
97
|
readonly choices: ("related" | "dependency" | "duplicate" | "subtask")[];
|
|
97
98
|
};
|
|
98
99
|
};
|
|
@@ -118,6 +119,9 @@ export declare const relationRouter: {
|
|
|
118
119
|
readonly constraints: readonly [];
|
|
119
120
|
};
|
|
120
121
|
results: import("../results.js").CommandResult[];
|
|
122
|
+
guessedFlags: {
|
|
123
|
+
[k: string]: (args: Array<string>) => string[] | undefined;
|
|
124
|
+
};
|
|
121
125
|
run: (args: string[]) => void;
|
|
122
126
|
help: string;
|
|
123
127
|
};
|