@zinn-dev/cli 0.18.0 → 0.20.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 CHANGED
@@ -78,6 +78,7 @@ Labels are global and reusable in all the available projects.
78
78
  ```sh
79
79
  zinn label create urgent --color red --description "Needs attention soon"
80
80
  zinn label create review
81
+ zinn label edit review --name ready --color green
81
82
  zinn label list
82
83
  ```
83
84
 
@@ -98,6 +99,8 @@ Descriptions default to an empty string and the label colors default to white. A
98
99
 
99
100
  `label create` and `label list` print each label name in its color. `--json` output shows the color as a value instead.
100
101
 
102
+ `label edit` changes only the supplied name, color, or description. Renaming preserves every task attachment because attachments refer to the label's internal ID. Also, updating a label does not affect any tasks' timestamps that it is attached to.
103
+
101
104
  Task creation and edits apply content and label changes together, or roll back together on failure.
102
105
  Note that label changes also update the task's modification timestamp. Archived tasks can also have their labels edited.
103
106
 
package/index.ts CHANGED
@@ -1,16 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
3
  import { isHelpFlag } from "./src/lib";
4
+ import packageJson from "./package.json";
4
5
 
5
6
  const args = process.argv.slice(2);
7
+ const isVersionRequest = args.length === 1 && args[0] === "--version";
6
8
 
7
- if (args.length === 0 || isHelpFlag(args[0]!)) {
9
+ if (isVersionRequest) {
10
+ console.info(packageJson.version);
11
+ } else if (args.length === 0 || isHelpFlag(args[0]!)) {
8
12
  console.info(`ZINN - A kanban workflow in the terminal
9
13
 
10
14
  Usage: zinn <command>
11
15
 
12
16
  Options:
13
17
  -h, --help Show help
18
+ --version Show version
14
19
  --json Print command output as JSON
15
20
 
16
21
  Commands:
@@ -39,6 +44,7 @@ Commands:
39
44
  task label add
40
45
  task label remove
41
46
  label create
47
+ label edit
42
48
  label list
43
49
  label delete
44
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zinn-dev/cli",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "A kanban workflow in the terminal.",
5
5
  "license": "MIT",
6
6
  "bugs": {
@@ -42,6 +42,6 @@
42
42
  "access": "public"
43
43
  },
44
44
  "dependencies": {
45
- "@zinn-dev/core": "0.13.0"
45
+ "@zinn-dev/core": "0.14.0"
46
46
  }
47
47
  }
@@ -2,7 +2,7 @@ import type { Label } from "@zinn-dev/core";
2
2
  import type { RouteDef } from "../types";
3
3
 
4
4
  import { parseArgs, styleText } from "node:util";
5
- import { label, labelCreateSchema, labelDeleteSchema } from "@zinn-dev/core";
5
+ import { label, labelCreateSchema, labelDeleteSchema, labelEditSchema } from "@zinn-dev/core";
6
6
 
7
7
  import {
8
8
  confirmAction,
@@ -56,6 +56,38 @@ Description defaults to an empty string; color defaults to white.
56
56
  Colors: red, green, yellow, blue, magenta, cyan, white, gray.
57
57
 
58
58
  Example: zinn label create bug --description "Unexpected behavior" --color red`,
59
+ },
60
+ edit: {
61
+ run: (args) => {
62
+ const { values, positionals, tokens } = parseArgs({
63
+ args,
64
+ options: {
65
+ name: { type: "string" },
66
+ description: { type: "string" },
67
+ color: { type: "string" },
68
+ },
69
+ allowPositionals: true,
70
+ strict: true,
71
+ tokens: true,
72
+ });
73
+
74
+ validatePositionalCount(positionals, 1, "Exactly one label name is required");
75
+ validateUniqueOptions(tokens);
76
+
77
+ const input = labelEditSchema.parse({ labelName: positionals[0], ...values });
78
+ const edited = label.edit(input);
79
+
80
+ output(presentLabel(edited), formatLabel);
81
+ },
82
+ help: `Usage: zinn label edit <name> [--name <text>] [--description <text>] [--color <color>]
83
+
84
+ Change specified fields.
85
+ Provide at least one edit flag. Use --description "" for an empty description.
86
+
87
+ Names are case-sensitive, trimmed, and must remain unique.
88
+ Editing does not affect task attachments or task timestamps.
89
+
90
+ Example: zinn label edit bug --name defect --color yellow`,
59
91
  },
60
92
  list: {
61
93
  run: (args) => {