@zinn-dev/cli 0.46.0 → 0.47.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.
Files changed (53) hide show
  1. package/package.json +2 -2
  2. package/skills/zinn/SKILL.md +1 -1
  3. package/src/capabilities-schema.d.ts +74 -0
  4. package/src/capabilities-schema.js +44 -0
  5. package/src/capabilities.d.ts +2 -0
  6. package/src/capabilities.js +2 -0
  7. package/src/column-hint.js +2 -9
  8. package/src/errors.d.ts +1 -0
  9. package/src/errors.js +1 -0
  10. package/src/input.d.ts +30 -0
  11. package/src/input.js +18 -0
  12. package/src/lib.d.ts +73 -5
  13. package/src/lib.js +69 -13
  14. package/src/presentation/activity-presentation.d.ts +2 -1
  15. package/src/presentation/activity-presentation.js +21 -6
  16. package/src/presentation/color.d.ts +12 -0
  17. package/src/presentation/color.js +12 -0
  18. package/src/presentation/project-presentation.d.ts +4 -1
  19. package/src/presentation/project-presentation.js +18 -0
  20. package/src/presentation/relation-presentation.js +8 -20
  21. package/src/presentation/section.d.ts +7 -4
  22. package/src/presentation/section.js +21 -7
  23. package/src/presentation/task-blame-presentation.d.ts +2 -1
  24. package/src/presentation/task-blame-presentation.js +4 -4
  25. package/src/presentation/task-presentation.d.ts +12 -1
  26. package/src/presentation/task-presentation.js +60 -9
  27. package/src/result-schemas.d.ts +93 -14
  28. package/src/result-schemas.js +1 -0
  29. package/src/routes/activity-router.d.ts +1 -1
  30. package/src/routes/activity-router.js +15 -31
  31. package/src/routes/backup-router.js +2 -9
  32. package/src/routes/capabilities-router.js +2 -9
  33. package/src/routes/comment-router.d.ts +2 -6
  34. package/src/routes/comment-router.js +13 -61
  35. package/src/routes/doctor-router.js +2 -9
  36. package/src/routes/info-router.js +2 -9
  37. package/src/routes/label-router.js +6 -43
  38. package/src/routes/migrate-router.js +2 -9
  39. package/src/routes/project-router.js +14 -100
  40. package/src/routes/reindex-router.js +2 -9
  41. package/src/routes/relation-router.d.ts +10 -4
  42. package/src/routes/relation-router.js +7 -18
  43. package/src/routes/restore-router.js +2 -11
  44. package/src/routes/router.js +32 -11
  45. package/src/routes/routes.d.ts +29 -30
  46. package/src/routes/skill-router.js +3 -18
  47. package/src/routes/task-router.d.ts +28 -28
  48. package/src/routes/task-router.js +62 -195
  49. package/src/routes/whoami-router.js +2 -9
  50. package/src/telemetry.js +3 -4
  51. package/src/types.d.ts +5 -1
  52. package/src/views.d.ts +117 -0
  53. package/src/views.js +54 -0
@@ -1,15 +1,14 @@
1
1
  import { jsonResult } from "../results.js";
2
- import { parseArgs } from "node:util";
3
2
  import { column, project, readSnapshot, columnCategorySchema, columnOrderSchema, columnDeleteSchema, projectCreateSchema, projectEditSchema, } from "@zinn-dev/core";
4
3
  import { CliError } from "../errors.js";
5
4
  import { generateCommandUsage, getOptionInputs, noInput, violatesConstraint } from "../input.js";
6
- import { confirmationDescription, canPrompt, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit, validatePositionals, validateOrderForms, requireStringOption, validateUniqueOptions, } from "../lib.js";
5
+ import { confirmationDescription, canPrompt, confirmAction, dashValueHelp, diagnostic, output, outputChanges, quit, parseCommandArgs, validateOrderForms, requireStringOption, } from "../lib.js";
7
6
  import { resolveTextEdit, textEditHelp, textEditOptions, textEditConstraints, } from "../text-edit.js";
8
7
  import { expectedValueFlags } from "../expected-values.js";
9
8
  import { checkFieldsBeforeText, checkSingleStdinReader, resolveTextInput, textFileHelp, textFileOption, textSourceConstraint, } from "../text-input.js";
10
9
  import { formatColumnList, presentColumn, presentColumnTaskCounts, } from "../presentation/column-presentation.js";
11
- import { formatProjectList, presentProject } from "../presentation/project-presentation.js";
12
- import { formatSection } from "../presentation/section.js";
10
+ import { formatProjectDetail, formatProjectList, presentProject, } from "../presentation/project-presentation.js";
11
+ import { readTerminalProps } from "../presentation/color.js";
13
12
  import { currentActor } from "../actor.js";
14
13
  import { checkDefaultProject, chooseProjectKey, resolveProjectKey, requiredProjectDescription, } from "../project.js";
15
14
  const projectEditConstraint = {
@@ -200,15 +199,7 @@ export const projectRouter = {
200
199
  input: projectInputs.create,
201
200
  results: [jsonResult("Project")],
202
201
  run: async (args) => {
203
- const { values, positionals, tokens } = parseArgs({
204
- args,
205
- options: projectInputs.create.options,
206
- allowPositionals: true,
207
- strict: true,
208
- tokens: true,
209
- });
210
- validateUniqueOptions(tokens, projectInputs.create.options);
211
- validatePositionals(positionals, projectInputs.create.forms[0]);
202
+ const { values, positionals } = parseCommandArgs(args, projectInputs.create);
212
203
  const projectKey = positionals[0];
213
204
  checkFieldsBeforeText(projectCreateSchema, { key: projectKey, name: values.name });
214
205
  const description = await resolveTextInput(values.description, values["description-file"], "--description");
@@ -241,13 +232,7 @@ Example: zinn project create MDR --name 'Macrodata Refinement'`,
241
232
  input: projectInputs.list,
242
233
  results: [jsonResult("ProjectList")],
243
234
  run: (args) => {
244
- const { positionals } = parseArgs({
245
- options: projectInputs.list.options,
246
- args,
247
- allowPositionals: true,
248
- strict: true,
249
- });
250
- validatePositionals(positionals, projectInputs.list.forms[0]);
235
+ parseCommandArgs(args, projectInputs.list);
251
236
  const projects = project
252
237
  .getAllWithTaskCounts()
253
238
  .map((entry) => ({ ...presentProject(entry), taskCounts: entry.taskCounts }));
@@ -268,13 +253,7 @@ Example: zinn project list`,
268
253
  input: projectInputs.view,
269
254
  results: [jsonResult("ProjectView")],
270
255
  run: (args) => {
271
- const { positionals } = parseArgs({
272
- options: projectInputs.view.options,
273
- args,
274
- allowPositionals: true,
275
- strict: true,
276
- });
277
- validatePositionals(positionals, projectInputs.view.forms[0]);
256
+ const { positionals } = parseCommandArgs(args, projectInputs.view);
278
257
  const projectChoice = chooseProjectKey(positionals[0], { required: true });
279
258
  const projectKey = projectChoice.key;
280
259
  const presentedProject = readSnapshot(() => {
@@ -290,21 +269,7 @@ Example: zinn project list`,
290
269
  archivedTaskCount: taskCounts.archivedTaskCount,
291
270
  };
292
271
  });
293
- output(presentedProject, (viewedProject) => {
294
- // The full description follows as its own section, so the row leaves out the preview.
295
- const sections = [formatProjectList([viewedProject], { showsDescriptionPreview: false })];
296
- if (viewedProject.description != null) {
297
- sections.push(formatSection("Description", viewedProject.description));
298
- }
299
- if (viewedProject.columns.length > 0) {
300
- const columnTaskCounts = formatColumnList(viewedProject.columns, {
301
- showsTaskCounts: true,
302
- archivedTaskCount: viewedProject.archivedTaskCount,
303
- });
304
- sections.push(formatSection("Columns", columnTaskCounts));
305
- }
306
- return sections.join("\n\n");
307
- });
272
+ output(presentedProject, (presented) => formatProjectDetail(presented, readTerminalProps()));
308
273
  },
309
274
  help: `${generateCommandUsage("project view", projectInputs.view)}
310
275
 
@@ -321,15 +286,7 @@ Example: zinn project view MDR`,
321
286
  input: projectInputs.edit,
322
287
  results: [jsonResult("ProjectChange")],
323
288
  run: async (args) => {
324
- const { values, positionals, tokens } = parseArgs({
325
- args,
326
- options: projectInputs.edit.options,
327
- allowPositionals: true,
328
- strict: true,
329
- tokens: true,
330
- });
331
- validateUniqueOptions(tokens, projectInputs.edit.options);
332
- validatePositionals(positionals, projectInputs.edit.forms[0]);
289
+ const { values, positionals } = parseCommandArgs(args, projectInputs.edit);
333
290
  const projectChoice = chooseProjectKey(positionals[0], { required: true });
334
291
  const expected = projectExpectations.parseValues(values);
335
292
  checkFieldsBeforeText(projectEditSchema, {
@@ -384,15 +341,7 @@ Examples:
384
341
  input: projectInputs.delete,
385
342
  results: [jsonResult("Project")],
386
343
  run: async (args) => {
387
- const { values, positionals, tokens } = parseArgs({
388
- args,
389
- options: projectInputs.delete.options,
390
- allowPositionals: true,
391
- strict: true,
392
- tokens: true,
393
- });
394
- validateUniqueOptions(tokens, projectInputs.delete.options);
395
- validatePositionals(positionals, projectInputs.delete.forms[0]);
344
+ const { values, positionals } = parseCommandArgs(args, projectInputs.delete);
396
345
  const typedProjectKey = positionals[0];
397
346
  const projectKey = resolveProjectKey(typedProjectKey, { required: true });
398
347
  try {
@@ -444,15 +393,7 @@ Example: zinn project delete MDR`,
444
393
  input: projectInputs.column_create,
445
394
  results: [jsonResult("Column")],
446
395
  run: (args) => {
447
- const { values, positionals, tokens } = parseArgs({
448
- options: projectInputs.column_create.options,
449
- args,
450
- allowPositionals: true,
451
- strict: true,
452
- tokens: true,
453
- });
454
- validateUniqueOptions(tokens, projectInputs.column_create.options);
455
- validatePositionals(positionals, projectInputs.column_create.forms[0]);
396
+ const { values, positionals } = parseCommandArgs(args, projectInputs.column_create);
456
397
  const category = requireStringOption(projectInputs.column_create.options.category, values.category, "category", `Provide the column's category with --category: ${columnCategoryValues}`);
457
398
  const createdColumn = column.create({
458
399
  projectKey: positionals[0],
@@ -480,13 +421,7 @@ Example: zinn project column create MDR Boardlog --category backlog`,
480
421
  input: projectInputs.column_list,
481
422
  results: [jsonResult("ColumnList")],
482
423
  run: (args) => {
483
- const { positionals } = parseArgs({
484
- options: projectInputs.column_list.options,
485
- args,
486
- allowPositionals: true,
487
- strict: true,
488
- });
489
- validatePositionals(positionals, projectInputs.column_list.forms[0]);
424
+ const { positionals } = parseCommandArgs(args, projectInputs.column_list);
490
425
  const projectChoice = chooseProjectKey(positionals[0], { required: true });
491
426
  const columns = readSnapshot(() => {
492
427
  checkDefaultProject(projectChoice);
@@ -513,15 +448,7 @@ Example: zinn project column list MDR`,
513
448
  input: projectInputs.column_edit,
514
449
  results: [jsonResult("ColumnChange")],
515
450
  run: async (args) => {
516
- const { values, positionals, tokens } = parseArgs({
517
- args,
518
- options: projectInputs.column_edit.options,
519
- allowPositionals: true,
520
- strict: true,
521
- tokens: true,
522
- });
523
- validateUniqueOptions(tokens, projectInputs.column_edit.options);
524
- validatePositionals(positionals, projectInputs.column_edit.forms[0]);
451
+ const { values, positionals } = parseCommandArgs(args, projectInputs.column_edit);
525
452
  if (violatesConstraint(columnEditConstraint, getOptionInputs(values))) {
526
453
  quit("Provide an edit flag: --name or --category", undefined, { field: [] });
527
454
  }
@@ -563,12 +490,7 @@ Examples:
563
490
  input: projectInputs.column_order,
564
491
  results: [jsonResult("ColumnChange")],
565
492
  run: (args) => {
566
- const { positionals } = parseArgs({
567
- options: projectInputs.column_order.options,
568
- args,
569
- allowPositionals: true,
570
- strict: true,
571
- });
493
+ const { positionals } = parseCommandArgs(args, projectInputs.column_order);
572
494
  const form = validateOrderForms(positionals, projectInputs.column_order.forms);
573
495
  const projectKey = positionals[0];
574
496
  const columnName = positionals[1];
@@ -605,15 +527,7 @@ Example: zinn project column order MDR Review before Doing`,
605
527
  input: projectInputs.column_delete,
606
528
  results: [jsonResult("Column")],
607
529
  run: async (args) => {
608
- const { values, positionals, tokens } = parseArgs({
609
- args,
610
- options: projectInputs.column_delete.options,
611
- allowPositionals: true,
612
- strict: true,
613
- tokens: true,
614
- });
615
- validateUniqueOptions(tokens, projectInputs.column_delete.options);
616
- validatePositionals(positionals, projectInputs.column_delete.forms[0]);
530
+ const { values, positionals } = parseCommandArgs(args, projectInputs.column_delete);
617
531
  const props = columnDeleteSchema.parse({
618
532
  projectKey: positionals[0],
619
533
  columnName: positionals[1],
@@ -1,9 +1,8 @@
1
1
  import { jsonResult } from "../results.js";
2
- import { parseArgs } from "node:util";
3
2
  import { reindex } from "@zinn-dev/core";
4
3
  import { reportLockWait } from "../database.js";
5
4
  import { generateCommandUsage, noInput } from "../input.js";
6
- import { output, validatePositionals } from "../lib.js";
5
+ import { output, parseCommandArgs } from "../lib.js";
7
6
  export const reindexCommand = {
8
7
  summary: "Rebuild the search index that `zinn task search` uses from the tasks and their comments, archived tasks included.",
9
8
  effects: { domain: "none", storage: "reindex", external: [] },
@@ -11,13 +10,7 @@ export const reindexCommand = {
11
10
  input: noInput,
12
11
  results: [jsonResult("Reindex")],
13
12
  run: (args) => {
14
- const { positionals } = parseArgs({
15
- options: noInput.options,
16
- args,
17
- strict: true,
18
- allowPositionals: true,
19
- });
20
- validatePositionals(positionals, noInput.forms[0]);
13
+ parseCommandArgs(args, noInput);
21
14
  const result = reindex.run({ onWait: reportLockWait });
22
15
  output(result, (r) => {
23
16
  const noun = r.taskCount === 1 ? "task" : "tasks";
@@ -20,7 +20,7 @@ export declare const relationRouter: {
20
20
  readonly required: true;
21
21
  readonly value: {
22
22
  readonly kind: "enum";
23
- readonly choices: ("related" | "dependency" | "duplicate" | "subtask")[];
23
+ readonly choices: ("dependency" | "subtask" | "duplicate" | "related")[];
24
24
  };
25
25
  };
26
26
  };
@@ -46,7 +46,10 @@ export declare const relationRouter: {
46
46
  };
47
47
  results: import("../results.js").CommandResult[];
48
48
  guessedFlags: {
49
- [k: string]: (args: Array<string>) => string[] | undefined;
49
+ [k: string]: (args: Array<string>) => {
50
+ args: string[];
51
+ guidance: string;
52
+ } | undefined;
50
53
  };
51
54
  run: (args: string[]) => Promise<void>;
52
55
  help: string;
@@ -97,7 +100,7 @@ export declare const relationRouter: {
97
100
  readonly required: true;
98
101
  readonly value: {
99
102
  readonly kind: "enum";
100
- readonly choices: ("related" | "dependency" | "duplicate" | "subtask")[];
103
+ readonly choices: ("dependency" | "subtask" | "duplicate" | "related")[];
101
104
  };
102
105
  };
103
106
  };
@@ -123,7 +126,10 @@ export declare const relationRouter: {
123
126
  };
124
127
  results: import("../results.js").CommandResult[];
125
128
  guessedFlags: {
126
- [k: string]: (args: Array<string>) => string[] | undefined;
129
+ [k: string]: (args: Array<string>) => {
130
+ args: string[];
131
+ guidance: string;
132
+ } | undefined;
127
133
  };
128
134
  run: (args: string[]) => void;
129
135
  help: string;
@@ -2,7 +2,7 @@ import { parseArgs } from "node:util";
2
2
  import { readSnapshot, relation, relationTypeSchema, task } from "@zinn-dev/core";
3
3
  import { jsonResult } from "../results.js";
4
4
  import { generateCommandUsage, taskKeyPositional } from "../input.js";
5
- import { output, diagnostic, confirmAction, confirmationDescription, quit, requireStringOption, validatePositionals, validateTaskKey, validateUniqueOptions, } from "../lib.js";
5
+ import { output, diagnostic, confirmAction, confirmationDescription, quit, requireStringOption, parseCommandArgs, validateTaskKey, } from "../lib.js";
6
6
  import { currentActor } from "../actor.js";
7
7
  import { formatRelationChange, formatRelationList, presentRelations, presentRelationChange, } from "../presentation/relation-presentation.js";
8
8
  const guessedRelationTypes = new Map([
@@ -40,21 +40,16 @@ function relationFlagSuggestions(action) {
40
40
  if (cannotSuggestRelation) {
41
41
  return undefined;
42
42
  }
43
- return ["task", "relation", action, positionals[0], guessed.value, "--type", type];
43
+ return {
44
+ args: ["task", "relation", action, positionals[0], guessed.value, "--type", type],
45
+ guidance: `Pass both task keys as positional arguments and use --type ${type}.`,
46
+ };
44
47
  };
45
48
  return Object.fromEntries([...guessedRelationTypes.keys()].map((name) => [`--${name}`, suggest]));
46
49
  }
47
50
  function parseRelationArgs(args, action) {
48
51
  const input = relationInputs[action];
49
- const { values, positionals, tokens } = parseArgs({
50
- args,
51
- options: input.options,
52
- allowPositionals: true,
53
- strict: true,
54
- tokens: true,
55
- });
56
- validateUniqueOptions(tokens, input.options);
57
- validatePositionals(positionals, input.forms[0]);
52
+ const { values, positionals } = parseCommandArgs(args, input);
58
53
  const type = requireStringOption(relationPairInput.options.type, values.type, "type", `--type must be one of these: ${relationPairInput.options.type.value.choices.join(", ")}`);
59
54
  const typeResult = relationTypeSchema.safeParse(type);
60
55
  if (!typeResult.success) {
@@ -173,13 +168,7 @@ Example: zinn task relation create APP-1 APP-2 --type dependency`,
173
168
  input: relationInputs.list,
174
169
  results: [jsonResult("RelationList")],
175
170
  run: (args) => {
176
- const { positionals } = parseArgs({
177
- options: relationInputs.list.options,
178
- args,
179
- allowPositionals: true,
180
- strict: true,
181
- });
182
- validatePositionals(positionals, relationInputs.list.forms[0]);
171
+ const { positionals } = parseCommandArgs(args, relationInputs.list);
183
172
  const taskKey = positionals[0];
184
173
  validateTaskKey(taskKey);
185
174
  const relations = readSnapshot(() => presentRelations(task.getByKey(taskKey)));
@@ -1,11 +1,10 @@
1
- import { parseArgs } from "node:util";
2
1
  import { resolve } from "node:path";
3
2
  import { backup, DatabaseChangeAppliedError, RestoreRefusedError, getBackupStorage, isSqliteErrorFamily, } from "@zinn-dev/core";
4
3
  import { jsonResult } from "../results.js";
5
4
  import { reportLockWait } from "../database.js";
6
5
  import { confirmationDescription } from "../lib.js";
7
6
  import { generateCommandUsage } from "../input.js";
8
- import { askConfirmation, diagnostic, output, validatePositionals, validateUniqueOptions, } from "../lib.js";
7
+ import { askConfirmation, diagnostic, output, parseCommandArgs, } from "../lib.js";
9
8
  import packageJson from "../../package.json" with { type: "json" };
10
9
  const build = { client: "cli", version: packageJson.version };
11
10
  const restoreInputs = {
@@ -24,15 +23,7 @@ export const restoreCommand = {
24
23
  input: restoreInputs.command,
25
24
  results: [jsonResult("Restore")],
26
25
  run: async (args) => {
27
- const { positionals, values, tokens } = parseArgs({
28
- args,
29
- strict: true,
30
- allowPositionals: true,
31
- tokens: true,
32
- options: restoreInputs.command.options,
33
- });
34
- validateUniqueOptions(tokens, restoreInputs.command.options);
35
- validatePositionals(positionals, restoreInputs.command.forms[0]);
26
+ const { positionals, values } = parseCommandArgs(args, restoreInputs.command);
36
27
  const path = resolve(positionals[0]);
37
28
  const storage = getBackupStorage();
38
29
  const { databasePath, backupDirectory } = storage;
@@ -1,11 +1,11 @@
1
1
  import { parseArgs } from "node:util";
2
- import { routerOptions, helpSpellings, versionSpellings, usageLabel, isHelpFlag, isRouterFlag, splitAtOptionSeparator, } from "../input.js";
2
+ import { routerOptions, helpSpellings, versionSpellings, usageLabel, isHelpFlag, isRouterFlag, optionAliasEntries, parseArgsOptions, 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
7
  import { formatOverview } from "../overview.js";
8
- import { boundParserMessage, dashValueHelp, diagnostic, failureMessage, finishRun, isDebugOutputEnabled, isParseArgsError, parseArgsFailure, prepareOutput, quit, renderFailure, UsageError, validateUniqueOptions, } from "../lib.js";
8
+ import { boundParserMessage, dashValueHelp, diagnostic, failureMessage, finishRun, isDebugOutputEnabled, isParseArgsError, parseArgsFailure, prepareOutput, quit, renameFlag, renderFailure, UsageError, validateUniqueOptions, } from "../lib.js";
9
9
  import { noteMatchedRun, noteParseArgsThrew, noteUnmatchedRun } from "../telemetry.js";
10
10
  function getIsRunnable(obj) {
11
11
  return Object.hasOwn(obj, "run");
@@ -24,13 +24,21 @@ function validateRouterFlags(routableArgs) {
24
24
  function getUsage(help) {
25
25
  return help.split("\n\n")[0];
26
26
  }
27
- function getCommandHelp(help, aliases) {
28
- if (aliases.length === 0) {
27
+ function getCommandHelp(help, aliases, options) {
28
+ const aliasLines = [];
29
+ if (aliases.length > 0) {
30
+ aliasLines.push(`Alias: ${aliases.map((path) => `zinn ${path.join(" ")}`).join(", ")}`);
31
+ }
32
+ const optionAliases = optionAliasEntries(options);
33
+ if (optionAliases.length > 0) {
34
+ const spellings = optionAliases.map(([alias, name]) => `--${alias} for --${name}`);
35
+ aliasLines.push(`Option aliases: ${spellings.join(", ")}`);
36
+ }
37
+ if (aliasLines.length === 0) {
29
38
  return help;
30
39
  }
31
40
  const [usage, ...details] = help.split("\n\n");
32
- const aliasLine = `Alias: ${aliases.map((path) => `zinn ${path.join(" ")}`).join(", ")}`;
33
- return [usage, aliasLine, ...details].join("\n\n");
41
+ return [usage, aliasLines.join("\n"), ...details].join("\n\n");
34
42
  }
35
43
  function toCommand(args) {
36
44
  return args.join(" ");
@@ -160,7 +168,7 @@ export function parseRoutes(routesDef, prefix) {
160
168
  ...definition,
161
169
  command: combinedRoute,
162
170
  aliases,
163
- help: getCommandHelp(definition.help, aliases),
171
+ help: getCommandHelp(definition.help, aliases, definition.input.options),
164
172
  });
165
173
  }
166
174
  else {
@@ -170,6 +178,19 @@ export function parseRoutes(routesDef, prefix) {
170
178
  }
171
179
  return routeDefinitions;
172
180
  }
181
+ function correctGuessedFlag(match, flag, args) {
182
+ const selectsTaskColumn = match.command.startsWith("task ") && "column" in match.input.options;
183
+ if (flag === "--status" && selectsTaskColumn) {
184
+ return {
185
+ args: [
186
+ ...match.command.split(" "),
187
+ ...renameFlag(args, parseArgsOptions(match.input.options), "status", "column"),
188
+ ],
189
+ guidance: "Use --column instead.",
190
+ };
191
+ }
192
+ return match.guessedFlags?.[flag]?.(args);
193
+ }
173
194
  async function route(parsedRoutes, rawArgs, beforeRun) {
174
195
  prepareOutput(rawArgs);
175
196
  // Anything after "--" belongs to the command, so "--json" there is search text, not a flag.
@@ -235,17 +256,17 @@ async function route(parsedRoutes, rawArgs, beforeRun) {
235
256
  }
236
257
  }
237
258
  const suggestFor = (flag) => {
238
- const suggestion = match.guessedFlags?.[flag]?.(commandArgs);
259
+ const suggestion = correctGuessedFlag(match, flag, commandArgs);
239
260
  if (suggestion === undefined) {
240
261
  return undefined;
241
262
  }
242
- const target = findCommand(parsedRoutes, suggestion);
263
+ const target = findCommand(parsedRoutes, suggestion.args);
243
264
  return target === undefined
244
265
  ? undefined
245
- : { args: suggestion, route: target.match.command.split(" ") };
266
+ : { ...suggestion, route: target.match.command.split(" ") };
246
267
  };
247
268
  if (isParseArgsError(err)) {
248
- const parserFailure = parseArgsFailure(err, rawArgs, suggestFor, match.command.split(" "), match.input.options);
269
+ const parserFailure = parseArgsFailure(err, rawArgs, suggestFor, match.command.split(" "), parseArgsOptions(match.input.options));
249
270
  parserFailure.help = getUsage(match.help);
250
271
  throw parserFailure;
251
272
  }
@@ -536,6 +536,7 @@ export declare const routes: {
536
536
  readonly kind: "text";
537
537
  readonly name: "text";
538
538
  };
539
+ readonly aliases: readonly ["body"];
539
540
  };
540
541
  readonly "description-file": {
541
542
  readonly type: "string";
@@ -550,7 +551,7 @@ export declare const routes: {
550
551
  readonly value: {
551
552
  readonly kind: "enum";
552
553
  readonly name: "priority";
553
- readonly choices: readonly [...("low" | "medium" | "high" | "urgent")[], "none"];
554
+ readonly choices: readonly [...("urgent" | "high" | "medium" | "low")[], "none"];
554
555
  readonly caseInsensitive: true;
555
556
  readonly description: "Omission leaves priority unassigned on creation and unchanged on edit. none clears priority; JSON uses null.";
556
557
  };
@@ -627,10 +628,6 @@ export declare const routes: {
627
628
  readonly notes: readonly ["Omit the project key to use defaultProject from settings; otherwise a project key is required."];
628
629
  };
629
630
  results: import("../results.js").CommandResult[];
630
- guessedFlags: {
631
- "--status": (args: string[]) => string[];
632
- "--body": (args: string[]) => string[];
633
- };
634
631
  run: (args: string[]) => Promise<void>;
635
632
  help: string;
636
633
  };
@@ -970,23 +967,23 @@ export declare const routes: {
970
967
  readonly name: "text";
971
968
  };
972
969
  };
973
- readonly "expect-title": {
974
- readonly type: "string";
975
- readonly value: {
976
- readonly kind: "text";
977
- readonly name: "text";
978
- };
979
- };
980
970
  readonly "expect-priority": {
981
971
  readonly type: "string";
982
972
  readonly value: {
983
973
  readonly description: "none expects no priority.";
984
974
  readonly kind: "enum";
985
975
  readonly name: "priority";
986
- readonly choices: readonly [...("low" | "medium" | "high" | "urgent")[], "none"];
976
+ readonly choices: readonly [...("urgent" | "high" | "medium" | "low")[], "none"];
987
977
  readonly caseInsensitive: true;
988
978
  };
989
979
  };
980
+ readonly "expect-title": {
981
+ readonly type: "string";
982
+ readonly value: {
983
+ readonly kind: "text";
984
+ readonly name: "text";
985
+ };
986
+ };
990
987
  readonly "expect-due": {
991
988
  readonly type: "string";
992
989
  readonly value: {
@@ -1008,7 +1005,7 @@ export declare const routes: {
1008
1005
  readonly value: {
1009
1006
  readonly kind: "enum";
1010
1007
  readonly name: "priority";
1011
- readonly choices: readonly [...("low" | "medium" | "high" | "urgent")[], "none"];
1008
+ readonly choices: readonly [...("urgent" | "high" | "medium" | "low")[], "none"];
1012
1009
  readonly caseInsensitive: true;
1013
1010
  readonly description: "Omission leaves priority unassigned on creation and unchanged on edit. none clears priority; JSON uses null.";
1014
1011
  };
@@ -1063,6 +1060,7 @@ export declare const routes: {
1063
1060
  readonly kind: "text";
1064
1061
  readonly name: "text";
1065
1062
  };
1063
+ readonly aliases: readonly ["body"];
1066
1064
  };
1067
1065
  readonly "description-file": {
1068
1066
  readonly type: "string";
@@ -1115,9 +1113,8 @@ export declare const routes: {
1115
1113
  run: (args: string[]) => Promise<void>;
1116
1114
  help: string;
1117
1115
  guessedFlags: {
1118
- "--status": (args: string[]) => string[];
1119
- "--column": (args: string[]) => string[];
1120
- "--body": (args: string[]) => string[];
1116
+ "--status": (args: string[]) => import("../types.js").FlagCorrection;
1117
+ "--column": (args: string[]) => import("../types.js").FlagCorrection;
1121
1118
  };
1122
1119
  };
1123
1120
  move: {
@@ -1164,8 +1161,8 @@ export declare const routes: {
1164
1161
  run: (args: string[]) => void;
1165
1162
  help: string;
1166
1163
  guessedFlags: {
1167
- "--status": (args: Array<string>, options?: import("node:util").ParseArgsOptionsConfig) => string[];
1168
- "--column": (args: Array<string>, options?: import("node:util").ParseArgsOptionsConfig) => string[];
1164
+ "--status": (args: Array<string>, options?: import("node:util").ParseArgsOptionsConfig) => import("../types.js").FlagCorrection;
1165
+ "--column": (args: Array<string>, options?: import("node:util").ParseArgsOptionsConfig) => import("../types.js").FlagCorrection;
1169
1166
  };
1170
1167
  };
1171
1168
  order: {
@@ -1463,7 +1460,7 @@ export declare const routes: {
1463
1460
  readonly required: true;
1464
1461
  readonly value: {
1465
1462
  readonly kind: "enum";
1466
- readonly choices: ("related" | "dependency" | "duplicate" | "subtask")[];
1463
+ readonly choices: ("dependency" | "subtask" | "duplicate" | "related")[];
1467
1464
  };
1468
1465
  };
1469
1466
  };
@@ -1489,7 +1486,10 @@ export declare const routes: {
1489
1486
  };
1490
1487
  results: import("../results.js").CommandResult[];
1491
1488
  guessedFlags: {
1492
- [k: string]: (args: Array<string>) => string[] | undefined;
1489
+ [k: string]: (args: Array<string>) => {
1490
+ args: string[];
1491
+ guidance: string;
1492
+ } | undefined;
1493
1493
  };
1494
1494
  run: (args: string[]) => Promise<void>;
1495
1495
  help: string;
@@ -1540,7 +1540,7 @@ export declare const routes: {
1540
1540
  readonly required: true;
1541
1541
  readonly value: {
1542
1542
  readonly kind: "enum";
1543
- readonly choices: ("related" | "dependency" | "duplicate" | "subtask")[];
1543
+ readonly choices: ("dependency" | "subtask" | "duplicate" | "related")[];
1544
1544
  };
1545
1545
  };
1546
1546
  };
@@ -1566,7 +1566,10 @@ export declare const routes: {
1566
1566
  };
1567
1567
  results: import("../results.js").CommandResult[];
1568
1568
  guessedFlags: {
1569
- [k: string]: (args: Array<string>) => string[] | undefined;
1569
+ [k: string]: (args: Array<string>) => {
1570
+ args: string[];
1571
+ guidance: string;
1572
+ } | undefined;
1570
1573
  };
1571
1574
  run: (args: string[]) => void;
1572
1575
  help: string;
@@ -1591,6 +1594,7 @@ export declare const routes: {
1591
1594
  readonly kind: "text";
1592
1595
  readonly name: "text";
1593
1596
  };
1597
+ readonly aliases: readonly ["body"];
1594
1598
  };
1595
1599
  readonly "text-file": {
1596
1600
  readonly type: "string";
@@ -1621,9 +1625,6 @@ export declare const routes: {
1621
1625
  }];
1622
1626
  };
1623
1627
  results: import("../results.js").CommandResult[];
1624
- guessedFlags: {
1625
- "--body": (args: string[]) => string[];
1626
- };
1627
1628
  run: (args: string[]) => Promise<void>;
1628
1629
  help: string;
1629
1630
  };
@@ -1731,6 +1732,7 @@ export declare const routes: {
1731
1732
  readonly kind: "text";
1732
1733
  readonly name: "text";
1733
1734
  };
1735
+ readonly aliases: readonly ["body"];
1734
1736
  };
1735
1737
  readonly "text-file": {
1736
1738
  readonly type: "string";
@@ -1780,9 +1782,6 @@ export declare const routes: {
1780
1782
  readonly notes: readonly [string, string];
1781
1783
  };
1782
1784
  results: import("../results.js").CommandResult[];
1783
- guessedFlags: {
1784
- "--body": (args: string[]) => string[];
1785
- };
1786
1785
  run: (args: string[]) => Promise<void>;
1787
1786
  help: string;
1788
1787
  };
@@ -2257,7 +2256,7 @@ export declare const routes: {
2257
2256
  readonly value: {
2258
2257
  readonly kind: "activity-action";
2259
2258
  readonly name: "action";
2260
- readonly choices: ("create" | "delete" | "claim" | "archive" | "edit" | "move" | "order" | "unarchive" | "relation_create" | "relation_delete" | "comment_create" | "comment_edit" | "comment_delete" | "claim_take" | "claim_heartbeat" | "claim_release")[];
2259
+ readonly choices: ("create" | "claim" | "delete" | "archive" | "edit" | "move" | "order" | "unarchive" | "relation_create" | "relation_delete" | "comment_create" | "comment_edit" | "comment_delete" | "claim_take" | "claim_heartbeat" | "claim_release")[];
2261
2260
  };
2262
2261
  };
2263
2262
  readonly changed: {