@zinn-dev/cli 0.28.1 → 0.29.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 +6 -2
- package/package.json +2 -2
- package/src/routes/relation-router.ts +20 -11
package/README.md
CHANGED
|
@@ -167,12 +167,16 @@ zinn task relation list MDR-1
|
|
|
167
167
|
|
|
168
168
|
`dependency` means the first task depends on the second, `duplicate` means the first task is a duplicate of the second. `related` is a bit different as the order of the tasks mentioned _does not matter_, either case describes the same relation.
|
|
169
169
|
|
|
170
|
-
Relations do not
|
|
170
|
+
Relations do not automatically move, complete, or archive tasks.
|
|
171
171
|
Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
|
|
172
172
|
|
|
173
173
|
`task view` a task's existing relations.
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
Use `zinn task relation create APP-2 APP-1 --type subtask` to make APP-2 a child of APP-1. Each task can have at most one parent and any number of subtasks. A nested type of relationship is allowed, so a task can have both a parent and a child. Parents are also just ordinary tasks, including tasks in other projects or archived tasks. Relation list and task view show **Parent** on the child and **Subtask** on the parent.
|
|
176
|
+
|
|
177
|
+
Remove the existing subtask relation before assigning a different parent. Moving or archiving a parent does not change its children, and deleting a parent removes its child relations while retaining child task data.
|
|
178
|
+
|
|
179
|
+
Remove a relation with `zinn task relation delete MDR-1 MDR-2 --type dependency`, using its original direction for `dependency`, `duplicate`, and `subtask`. For `related`, order does not matter.
|
|
176
180
|
Note that a deletion happens _without_ confirmation.
|
|
177
181
|
|
|
178
182
|
Use `task relation create --help` to discover types.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.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.
|
|
45
|
+
"@zinn-dev/core": "0.20.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TaskRelationType, TaskWithKey } from "@zinn-dev/core";
|
|
2
2
|
import type { RouteDef } from "../types";
|
|
3
3
|
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
@@ -6,11 +6,8 @@ import { relation, relationCreateSchema, task } from "@zinn-dev/core";
|
|
|
6
6
|
import { output, quit, validatePositionalCount, validateUniqueOptions } from "../lib";
|
|
7
7
|
import { currentActor } from "../actor";
|
|
8
8
|
|
|
9
|
-
// TODO: maybe core should export it as a reusable if we need it in more places
|
|
10
|
-
type RelationType = RelationCreateInput["relation_type"];
|
|
11
|
-
|
|
12
9
|
type PresentedRelation = {
|
|
13
|
-
type:
|
|
10
|
+
type: TaskRelationType;
|
|
14
11
|
direction: "outgoing" | "incoming" | null;
|
|
15
12
|
task: { key: string; title: string; status: "Active" | "Archived" };
|
|
16
13
|
};
|
|
@@ -55,6 +52,10 @@ export function formatRelations(relations: Array<PresentedRelation>) {
|
|
|
55
52
|
label = isOutgoing ? "Depends on" : "Depended on by";
|
|
56
53
|
break;
|
|
57
54
|
}
|
|
55
|
+
case "subtask": {
|
|
56
|
+
label = isOutgoing ? "Parent" : "Subtask";
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
58
59
|
case "duplicate": {
|
|
59
60
|
label = isOutgoing ? "Duplicate of" : "Duplicated by";
|
|
60
61
|
break;
|
|
@@ -67,7 +68,7 @@ export function formatRelations(relations: Array<PresentedRelation>) {
|
|
|
67
68
|
.join("\n");
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
type PresentedRelationChange = { type:
|
|
71
|
+
type PresentedRelationChange = { type: TaskRelationType; source: string; target: string };
|
|
71
72
|
|
|
72
73
|
function parseRelationArgs(args: string[]) {
|
|
73
74
|
const { values, positionals, tokens } = parseArgs({
|
|
@@ -85,7 +86,9 @@ function parseRelationArgs(args: string[]) {
|
|
|
85
86
|
const typeResult = relationCreateSchema.shape.relation_type.safeParse(values.type);
|
|
86
87
|
|
|
87
88
|
if (!typeResult.success) {
|
|
88
|
-
quit(
|
|
89
|
+
quit(
|
|
90
|
+
`--type must be one of these: ${relationCreateSchema.shape.relation_type.options.join(", ")}`,
|
|
91
|
+
);
|
|
89
92
|
}
|
|
90
93
|
const sourceTaskKey = positionals[0]!;
|
|
91
94
|
const targetTaskKey = positionals[1]!;
|
|
@@ -114,6 +117,7 @@ export const relationRouter = {
|
|
|
114
117
|
related: "related to",
|
|
115
118
|
dependency: "depends on",
|
|
116
119
|
duplicate: "is a duplicate of",
|
|
120
|
+
subtask: "is a subtask of",
|
|
117
121
|
}[r.type];
|
|
118
122
|
|
|
119
123
|
return `${r.source} ${label} ${r.target}`;
|
|
@@ -125,8 +129,13 @@ Types:
|
|
|
125
129
|
related Connect two tasks, with any order provided to indicate relation.
|
|
126
130
|
dependency Source depends on target.
|
|
127
131
|
duplicate Source is a duplicate of target.
|
|
132
|
+
subtask Source is a subtask of target (child -> parent).
|
|
133
|
+
|
|
134
|
+
A task may have one parent and many subtasks. Nesting is allowed; cycles are rejected.
|
|
135
|
+
Remove an existing subtask relation before assigning a different parent.
|
|
128
136
|
|
|
129
|
-
Relations do not
|
|
137
|
+
Relations do not automatically move, complete, or archive tasks.
|
|
138
|
+
Deleting a parent removes its links and preserves its subtasks.
|
|
130
139
|
Tasks from separate projects can be related to each other. Tasks can also be related to archived tasks.
|
|
131
140
|
|
|
132
141
|
Example: zinn task relation create APP-1 APP-2 --type dependency`,
|
|
@@ -164,11 +173,11 @@ Example: zinn task relation list APP-1`,
|
|
|
164
173
|
|
|
165
174
|
Remove only the specified relation. No confirmation is required.
|
|
166
175
|
|
|
167
|
-
Types:
|
|
176
|
+
Types: ${relationCreateSchema.shape.relation_type.options.join(", ")}.
|
|
168
177
|
|
|
169
178
|
For related, either task order works.
|
|
170
|
-
For dependency and
|
|
171
|
-
source depends on target, or
|
|
179
|
+
For dependency, duplicate, and subtask, use the creation direction:
|
|
180
|
+
source depends on target, is a duplicate of target, or is a subtask of target.
|
|
172
181
|
|
|
173
182
|
Archived and cross-project tasks are supported.
|
|
174
183
|
A missing relation is an error.
|