shipbench 0.8.0 → 0.9.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 +5 -5
- package/dist/index.js +571 -88
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,14 +40,14 @@ it byte-for-byte unchanged.
|
|
|
40
40
|
| Command | What it does |
|
|
41
41
|
| --- | --- |
|
|
42
42
|
| `shipbench init` | Create `.shipbench/` when absent. `--name <name>` sets the project name (defaults to the directory basename). |
|
|
43
|
-
| `shipbench task create <title>` | Create a task. `--status`, `--priority`, `--assignee`, `--tags=a,b,c`, `--depends-on=slug`, and `--json` to print the created task — the only way to learn a collision-suffixed slug programmatically. |
|
|
44
|
-
| `shipbench task list` | List live tasks in board order. Filters: `--status`, `--priority`, `--assignee` (comma-separated or repeatable, match any; unconfigured status/priority errors), `--tag` (AND), `--flagged`, `--available`, `--blocked`, `--archived`. `--json` for machine output. |
|
|
45
|
-
| `shipbench task get <slug>` | Retrieve one task as JSON. Alias: `task show`. |
|
|
46
|
-
| `shipbench task edit <slug>` | Revise the description (`--body` / `--body-file`) and/or validated metadata: `--title` (keeps the slug), `--priority`, `--assignee` / `--clear-assignee`, `--tags` / `--add-tag` / `--remove-tag` / `--clear-tags`, `--depends-on` / `--add-depends-on` / `--remove-depends-on` / `--clear-depends-on`. One validated write; a rejected value changes nothing. Status stays with `task move`. |
|
|
43
|
+
| `shipbench task create <title>` | Create a task. `--status`, `--priority`, `--assignee`, `--tags=a,b,c`, `--depends-on=slug`, `--related=slug`, and `--json` to print the created task — the only way to learn a collision-suffixed slug programmatically. |
|
|
44
|
+
| `shipbench task list` | List live tasks in board order. Filters: `--status`, `--priority`, `--assignee` (comma-separated or repeatable, match any; unconfigured status/priority errors), `--tag` (AND), `--exclude-tag` (drops a task carrying any), `--flagged`, `--available`, `--blocked`, `--archived`. `--json` for machine output. |
|
|
45
|
+
| `shipbench task get <slug>` | Retrieve one task as JSON (`--json` is accepted and changes nothing). Alias: `task show`. |
|
|
46
|
+
| `shipbench task edit <slug>` | Revise the description (`--body` / `--body-file`) and/or validated metadata: `--title` (keeps the slug), `--priority`, `--assignee` / `--clear-assignee`, `--tags` / `--add-tag` / `--remove-tag` / `--clear-tags`, `--depends-on` / `--add-depends-on` / `--remove-depends-on` / `--clear-depends-on`, `--related` / `--add-related` / `--remove-related` / `--clear-related`. One validated write; a rejected value changes nothing. Status stays with `task move`. |
|
|
47
47
|
| `shipbench task move <slug>` | `--to=<status>` picks the column; `--top`, `--bottom`, `--before=<slug>`, `--after=<slug>`, `--position=<n>` pick the spot within it. |
|
|
48
48
|
| `shipbench task flag <slug> [reason]` | Flag a task for attention without moving it. The reason is optional and one line; flagging again replaces it. `task unflag <slug>` clears it. What a flag means is your project's call. |
|
|
49
49
|
| `shipbench task comment <slug> <text>` | Append a timestamped entry to the task's `## Task Updates` section. `edit` and `delete` subcommands take a zero-based index. |
|
|
50
|
-
| `shipbench task search <query>` | Case-insensitive search over titles, tags, bodies, and Task Updates. Each term is a substring by default; `--whole-word` matches on word boundaries and a literal `"quoted"` run matches contiguously. Narrow with `task list`'s filters — `--status`, `--assignee`, `--priority` (comma-separated or repeatable, match any), `--tag` (AND), `--flagged`, `--available`/`--blocked` — plus `--archived`, `--all`, `--limit`. |
|
|
50
|
+
| `shipbench task search <query>` | Case-insensitive search over titles, tags, bodies, and Task Updates. Each term is a substring by default; `--whole-word` matches on word boundaries and a literal `"quoted"` run matches contiguously. Narrow with `task list`'s filters — `--status`, `--assignee`, `--priority` (comma-separated or repeatable, match any), `--tag` (AND), `--exclude-tag`, `--flagged`, `--available`/`--blocked` — plus `--archived`, `--all`, `--limit`. |
|
|
51
51
|
| `shipbench task graph` | Dependency graph as JSON when piped or with `--json`; an ASCII summary in an interactive terminal. |
|
|
52
52
|
| `shipbench task archive <slug>` | Move a task to `tasks/archive/`, byte-identical and restorable. `--done [--keep=N]` bulk-archives completed tasks. |
|
|
53
53
|
| `shipbench task unarchive <slug>` | Restore an archived task exactly as it was. |
|
package/dist/index.js
CHANGED
|
@@ -3641,11 +3641,13 @@ function dependencyStatus(slug, index) {
|
|
|
3641
3641
|
function taskDependenciesAreSatisfied(task, index, doneColumn) {
|
|
3642
3642
|
const dependencies = dependencySlugs(task);
|
|
3643
3643
|
if (dependencies === null) return false;
|
|
3644
|
-
return dependencies.every(
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3644
|
+
return dependencies.every(
|
|
3645
|
+
(dependency) => dependency !== task.slug && dependencyIsSatisfied(dependency, index, doneColumn)
|
|
3646
|
+
);
|
|
3647
|
+
}
|
|
3648
|
+
function dependencyIsSatisfied(slug, index, doneColumn) {
|
|
3649
|
+
const resolution = resolveTaskDependency(slug, index);
|
|
3650
|
+
return resolution.kind === "archived" || resolution.kind === "live" && resolution.status === doneColumn;
|
|
3649
3651
|
}
|
|
3650
3652
|
function buildTaskDependencyGraph(liveTasks, options2 = {}) {
|
|
3651
3653
|
const archivedTasks = options2.archivedTasks ?? [];
|
|
@@ -3688,6 +3690,124 @@ function buildTaskDependencyGraph(liveTasks, options2 = {}) {
|
|
|
3688
3690
|
])
|
|
3689
3691
|
);
|
|
3690
3692
|
}
|
|
3693
|
+
function queryTaskDependencies(slug, liveTasks, config, options2 = {}) {
|
|
3694
|
+
const archivedTasks = options2.archivedTasks ?? [];
|
|
3695
|
+
const index = createTaskDependencyIndex(
|
|
3696
|
+
liveTasks,
|
|
3697
|
+
archivedTasks,
|
|
3698
|
+
options2.archivedSlugs
|
|
3699
|
+
);
|
|
3700
|
+
const unreadable = new Set(options2.unreadableSlugs);
|
|
3701
|
+
const sourceTasks = new Map([
|
|
3702
|
+
...archivedTasks.map((task) => [task.slug, task]),
|
|
3703
|
+
...liveTasks.map((task) => [task.slug, task])
|
|
3704
|
+
]);
|
|
3705
|
+
const root = sourceTasks.get(slug);
|
|
3706
|
+
if (!root) return null;
|
|
3707
|
+
const dependentsOf = /* @__PURE__ */ new Map();
|
|
3708
|
+
for (const task of sourceTasks.values()) {
|
|
3709
|
+
for (const dependency of dependencySlugs(task) ?? []) {
|
|
3710
|
+
const list = dependentsOf.get(dependency) ?? [];
|
|
3711
|
+
list.push(task.slug);
|
|
3712
|
+
dependentsOf.set(dependency, list);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
const neighbors = (direction2, of) => {
|
|
3716
|
+
const task = sourceTasks.get(of);
|
|
3717
|
+
const found = direction2 === "blockers" ? task ? dependencySlugs(task) ?? [] : [] : dependentsOf.get(of) ?? [];
|
|
3718
|
+
return [...new Set(found)].sort((a, b) => a.localeCompare(b));
|
|
3719
|
+
};
|
|
3720
|
+
const statusOf = (of) => {
|
|
3721
|
+
const resolution = resolveTaskDependency(of, index);
|
|
3722
|
+
if (resolution.kind === "missing" && unreadable.has(of)) {
|
|
3723
|
+
return "unreadable";
|
|
3724
|
+
}
|
|
3725
|
+
return resolution.status;
|
|
3726
|
+
};
|
|
3727
|
+
const satisfied = (of) => dependencyIsSatisfied(of, index, config.done_column);
|
|
3728
|
+
const rootSatisfied = satisfied(slug);
|
|
3729
|
+
const maxDepth = options2.depth ?? Number.POSITIVE_INFINITY;
|
|
3730
|
+
let truncated = false;
|
|
3731
|
+
const walk = (direction2) => {
|
|
3732
|
+
const shallowest = /* @__PURE__ */ new Map([[slug, 0]]);
|
|
3733
|
+
let frontier = [slug];
|
|
3734
|
+
for (let level = 1; frontier.length > 0 && level <= maxDepth; level++) {
|
|
3735
|
+
const next = [];
|
|
3736
|
+
for (const current of frontier) {
|
|
3737
|
+
for (const neighbor of neighbors(direction2, current)) {
|
|
3738
|
+
if (shallowest.has(neighbor)) continue;
|
|
3739
|
+
shallowest.set(neighbor, level);
|
|
3740
|
+
next.push(neighbor);
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
frontier = next;
|
|
3744
|
+
}
|
|
3745
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
3746
|
+
const build = (current, level, path, parent) => {
|
|
3747
|
+
const task = sourceTasks.get(current);
|
|
3748
|
+
const dependencies = task ? dependencySlugs(task) : [];
|
|
3749
|
+
const node = {
|
|
3750
|
+
slug: current,
|
|
3751
|
+
status: statusOf(current),
|
|
3752
|
+
...task ? { title: task.frontmatter.title } : {}
|
|
3753
|
+
};
|
|
3754
|
+
let children = [];
|
|
3755
|
+
if (direction2 === "blockers") node.satisfied = satisfied(current);
|
|
3756
|
+
if (dependencies === null) node.invalid_depends_on = true;
|
|
3757
|
+
if (direction2 === "dependents" && level === 1) {
|
|
3758
|
+
const waiting = (dependencies ?? []).filter(
|
|
3759
|
+
(dependency) => (
|
|
3760
|
+
// A self-reference never resolves, even when it is the parent.
|
|
3761
|
+
dependency === current || dependency !== parent && !satisfied(dependency)
|
|
3762
|
+
)
|
|
3763
|
+
);
|
|
3764
|
+
node.unblocks_on_completion = index.liveTasksBySlug.has(current) && task?.frontmatter.status === config.default_column && dependencies !== null && !rootSatisfied && waiting.length === 0;
|
|
3765
|
+
node.waiting_on = waiting;
|
|
3766
|
+
}
|
|
3767
|
+
const next = neighbors(direction2, current);
|
|
3768
|
+
if (next.length === 0) return { ...node, children };
|
|
3769
|
+
if (path.has(current)) {
|
|
3770
|
+
node.omitted = "cycle";
|
|
3771
|
+
} else if (expanded.has(current) || shallowest.get(current) !== level) {
|
|
3772
|
+
node.omitted = "repeat";
|
|
3773
|
+
} else if (level >= maxDepth) {
|
|
3774
|
+
node.omitted = "depth";
|
|
3775
|
+
truncated = true;
|
|
3776
|
+
} else {
|
|
3777
|
+
expanded.add(current);
|
|
3778
|
+
const childPath = new Set(path).add(current);
|
|
3779
|
+
children = next.map(
|
|
3780
|
+
(child) => build(child, level + 1, childPath, current)
|
|
3781
|
+
);
|
|
3782
|
+
}
|
|
3783
|
+
return { ...node, children };
|
|
3784
|
+
};
|
|
3785
|
+
const rootPath = /* @__PURE__ */ new Set([slug]);
|
|
3786
|
+
return neighbors(direction2, slug).map(
|
|
3787
|
+
(child) => build(child, 1, rootPath, slug)
|
|
3788
|
+
);
|
|
3789
|
+
};
|
|
3790
|
+
const direction = options2.direction ?? "both";
|
|
3791
|
+
const dependenciesSatisfied = taskDependenciesAreSatisfied(
|
|
3792
|
+
root,
|
|
3793
|
+
index,
|
|
3794
|
+
config.done_column
|
|
3795
|
+
);
|
|
3796
|
+
const result = {
|
|
3797
|
+
slug,
|
|
3798
|
+
status: statusOf(slug),
|
|
3799
|
+
title: root.frontmatter.title,
|
|
3800
|
+
dependencies_satisfied: dependenciesSatisfied,
|
|
3801
|
+
available: index.liveTasksBySlug.has(slug) && root.frontmatter.status === config.default_column && dependenciesSatisfied,
|
|
3802
|
+
...dependencySlugs(root) === null ? { invalid_depends_on: true } : {},
|
|
3803
|
+
depth: options2.depth ?? null,
|
|
3804
|
+
truncated: false
|
|
3805
|
+
};
|
|
3806
|
+
if (direction !== "dependents") result.blockers = walk("blockers");
|
|
3807
|
+
if (direction !== "blockers") result.dependents = walk("dependents");
|
|
3808
|
+
result.truncated = truncated;
|
|
3809
|
+
return result;
|
|
3810
|
+
}
|
|
3691
3811
|
|
|
3692
3812
|
// ../../packages/core/src/availability.ts
|
|
3693
3813
|
function compareTaskReadiness(a, b, config) {
|
|
@@ -3999,6 +4119,55 @@ function orderedTasksForColumn(tasks, layout, columnId, validStatuses, doneColum
|
|
|
3999
4119
|
return [...ordered, ...leftovers];
|
|
4000
4120
|
}
|
|
4001
4121
|
|
|
4122
|
+
// ../../packages/core/src/related.ts
|
|
4123
|
+
function relatedSlugs(task) {
|
|
4124
|
+
const { related } = task.frontmatter;
|
|
4125
|
+
if (!Array.isArray(related)) return [];
|
|
4126
|
+
const slugs = related.filter((slug) => typeof slug === "string").map((slug) => slug.trim()).filter(Boolean);
|
|
4127
|
+
return [...new Set(slugs)];
|
|
4128
|
+
}
|
|
4129
|
+
function createRelatedIndex(input) {
|
|
4130
|
+
const archivedTasks = input.archivedTasks ?? [];
|
|
4131
|
+
const liveBySlug = new Map(input.tasks.map((task) => [task.slug, task]));
|
|
4132
|
+
const archivedBySlug = new Map(archivedTasks.map((task) => [task.slug, task]));
|
|
4133
|
+
const archivedSlugs = /* @__PURE__ */ new Set([
|
|
4134
|
+
...input.archivedSlugs ?? [],
|
|
4135
|
+
...archivedBySlug.keys()
|
|
4136
|
+
]);
|
|
4137
|
+
const incoming = /* @__PURE__ */ new Map();
|
|
4138
|
+
for (const source of [...input.tasks, ...archivedTasks]) {
|
|
4139
|
+
for (const target of relatedSlugs(source)) {
|
|
4140
|
+
if (target === source.slug) continue;
|
|
4141
|
+
const sources = incoming.get(target) ?? [];
|
|
4142
|
+
if (!sources.includes(source.slug)) sources.push(source.slug);
|
|
4143
|
+
incoming.set(target, sources);
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
const resolve3 = (slug, direction) => {
|
|
4147
|
+
const live = liveBySlug.get(slug);
|
|
4148
|
+
const archived = live ? void 0 : archivedBySlug.get(slug);
|
|
4149
|
+
const found = live ?? archived;
|
|
4150
|
+
return {
|
|
4151
|
+
slug,
|
|
4152
|
+
direction,
|
|
4153
|
+
title: found?.frontmatter.title ?? null,
|
|
4154
|
+
status: found?.frontmatter.status ?? null,
|
|
4155
|
+
archived: !live && archivedSlugs.has(slug)
|
|
4156
|
+
};
|
|
4157
|
+
};
|
|
4158
|
+
return (task) => {
|
|
4159
|
+
const outgoing = relatedSlugs(task).filter((slug) => slug !== task.slug);
|
|
4160
|
+
const fromOthers = incoming.get(task.slug) ?? [];
|
|
4161
|
+
const own = new Set(outgoing);
|
|
4162
|
+
return [
|
|
4163
|
+
...outgoing.map(
|
|
4164
|
+
(slug) => resolve3(slug, fromOthers.includes(slug) ? "both" : "outgoing")
|
|
4165
|
+
),
|
|
4166
|
+
...fromOthers.filter((slug) => !own.has(slug)).map((slug) => resolve3(slug, "incoming"))
|
|
4167
|
+
];
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
|
|
4002
4171
|
// ../../packages/core/src/slug.ts
|
|
4003
4172
|
function slugify(title) {
|
|
4004
4173
|
return title.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
@@ -4061,6 +4230,7 @@ var KNOWN_FRONTMATTER_FIELDS = /* @__PURE__ */ new Set([
|
|
|
4061
4230
|
"assignee",
|
|
4062
4231
|
"tags",
|
|
4063
4232
|
"depends_on",
|
|
4233
|
+
"related",
|
|
4064
4234
|
"flag",
|
|
4065
4235
|
"created",
|
|
4066
4236
|
"updated"
|
|
@@ -4323,6 +4493,28 @@ function normalizeFlag(value) {
|
|
|
4323
4493
|
}
|
|
4324
4494
|
return reason;
|
|
4325
4495
|
}
|
|
4496
|
+
async function assertValidRelated(adapter, slug, related, existing = []) {
|
|
4497
|
+
if (!related || related.length === 0) return;
|
|
4498
|
+
if (related.includes(slug)) {
|
|
4499
|
+
throw new Error(`Task "${slug}" cannot be related to itself.`);
|
|
4500
|
+
}
|
|
4501
|
+
const added = related.filter((target) => !existing.includes(target));
|
|
4502
|
+
if (added.length === 0) return;
|
|
4503
|
+
const [liveFiles, archivedFiles] = await Promise.all([
|
|
4504
|
+
adapter.listFiles(TASKS_DIR),
|
|
4505
|
+
adapter.listFiles(ARCHIVE_DIR)
|
|
4506
|
+
]);
|
|
4507
|
+
const known = new Set(
|
|
4508
|
+
[...liveFiles, ...archivedFiles].filter((file) => file.endsWith(".md")).map((file) => file.replace(/\.md$/, ""))
|
|
4509
|
+
);
|
|
4510
|
+
for (const target of added) {
|
|
4511
|
+
if (!known.has(target)) {
|
|
4512
|
+
throw new Error(
|
|
4513
|
+
`Unknown related task "${target}" \u2014 no live or archived task file matches that slug.`
|
|
4514
|
+
);
|
|
4515
|
+
}
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4326
4518
|
async function assertValidDependsOn(adapter, config, slug, dependsOn) {
|
|
4327
4519
|
if (!dependsOn || dependsOn.length === 0) return;
|
|
4328
4520
|
if (dependsOn.includes(slug)) {
|
|
@@ -4352,7 +4544,7 @@ function unreadableUpdatesWarning(task) {
|
|
|
4352
4544
|
message: `Malformed Updates section: ${task.unreadableUpdates.reason} The section is preserved verbatim in the file and is not part of the description.`
|
|
4353
4545
|
};
|
|
4354
4546
|
}
|
|
4355
|
-
function validateTask(task, config, knownSlugs) {
|
|
4547
|
+
function validateTask(task, config, knownSlugs, knownRelatedSlugs) {
|
|
4356
4548
|
const warnings = [];
|
|
4357
4549
|
const validStatuses = new Set(config.columns.map((c) => c.id));
|
|
4358
4550
|
const updatesWarning = unreadableUpdatesWarning(task);
|
|
@@ -4391,6 +4583,23 @@ function validateTask(task, config, knownSlugs) {
|
|
|
4391
4583
|
}
|
|
4392
4584
|
}
|
|
4393
4585
|
}
|
|
4586
|
+
const related = task.frontmatter.related;
|
|
4587
|
+
if (related !== void 0 && related !== null && (!Array.isArray(related) || related.some((entry) => typeof entry !== "string"))) {
|
|
4588
|
+
warnings.push({
|
|
4589
|
+
slug: task.slug,
|
|
4590
|
+
field: "related",
|
|
4591
|
+
message: "Expected related to be a list of task slugs."
|
|
4592
|
+
});
|
|
4593
|
+
}
|
|
4594
|
+
for (const target of relatedSlugs(task)) {
|
|
4595
|
+
if (!knownRelatedSlugs.has(target)) {
|
|
4596
|
+
warnings.push({
|
|
4597
|
+
slug: task.slug,
|
|
4598
|
+
field: "related",
|
|
4599
|
+
message: `Dangling related task "${target}" \u2014 no live or archived task file matches that slug.`
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4394
4603
|
const flag = task.frontmatter.flag;
|
|
4395
4604
|
if (flag !== void 0 && flag !== null && !taskFlag(task)) {
|
|
4396
4605
|
warnings.push({
|
|
@@ -4410,7 +4619,7 @@ function validateTask(task, config, knownSlugs) {
|
|
|
4410
4619
|
}
|
|
4411
4620
|
return warnings;
|
|
4412
4621
|
}
|
|
4413
|
-
async function listTasksInDirectory(adapter, config, directory, additionalKnownSlugs = []) {
|
|
4622
|
+
async function listTasksInDirectory(adapter, config, directory, additionalKnownSlugs = [], otherDirectorySlugs = []) {
|
|
4414
4623
|
const files = await adapter.listFiles(directory);
|
|
4415
4624
|
const mdFiles = files.filter((f) => f.endsWith(".md"));
|
|
4416
4625
|
if (mdFiles.length === 0) {
|
|
@@ -4435,12 +4644,17 @@ async function listTasksInDirectory(adapter, config, directory, additionalKnownS
|
|
|
4435
4644
|
});
|
|
4436
4645
|
}
|
|
4437
4646
|
}
|
|
4647
|
+
const directorySlugs = mdFiles.map((file) => file.replace(/\.md$/, ""));
|
|
4438
4648
|
const knownSlugs = /* @__PURE__ */ new Set([
|
|
4439
4649
|
...await additionalKnownSlugs,
|
|
4440
|
-
...
|
|
4650
|
+
...directorySlugs
|
|
4651
|
+
]);
|
|
4652
|
+
const knownRelatedSlugs = /* @__PURE__ */ new Set([
|
|
4653
|
+
...await otherDirectorySlugs,
|
|
4654
|
+
...directorySlugs
|
|
4441
4655
|
]);
|
|
4442
4656
|
for (const task of tasks) {
|
|
4443
|
-
warnings.push(...validateTask(task, config, knownSlugs));
|
|
4657
|
+
warnings.push(...validateTask(task, config, knownSlugs, knownRelatedSlugs));
|
|
4444
4658
|
}
|
|
4445
4659
|
return { tasks, warnings, unreadable };
|
|
4446
4660
|
}
|
|
@@ -4452,7 +4666,17 @@ async function listTasks(adapter, config, options2 = {}) {
|
|
|
4452
4666
|
...tasks.map((task) => task.slug),
|
|
4453
4667
|
...fileSlugs
|
|
4454
4668
|
]);
|
|
4455
|
-
|
|
4669
|
+
const archiveFiles = adapter.listFiles(ARCHIVE_DIR).then(
|
|
4670
|
+
(files) => files.filter((file) => file.endsWith(".md")).map((file) => file.replace(/\.md$/, ""))
|
|
4671
|
+
);
|
|
4672
|
+
const result = await listTasksInDirectory(
|
|
4673
|
+
adapter,
|
|
4674
|
+
config,
|
|
4675
|
+
TASKS_DIR,
|
|
4676
|
+
archivedSlugs,
|
|
4677
|
+
archiveFiles
|
|
4678
|
+
);
|
|
4679
|
+
return { ...result, archivedSlugs: await archiveFiles };
|
|
4456
4680
|
}
|
|
4457
4681
|
async function getTask(adapter, config, slug, options2 = {}) {
|
|
4458
4682
|
void config;
|
|
@@ -4464,7 +4688,13 @@ async function getTask(adapter, config, slug, options2 = {}) {
|
|
|
4464
4688
|
async function listArchivedTasks(adapter, config) {
|
|
4465
4689
|
const liveFiles = await adapter.listFiles(TASKS_DIR);
|
|
4466
4690
|
const liveSlugs = liveFiles.filter((file) => file.endsWith(".md")).map((file) => file.replace(/\.md$/, ""));
|
|
4467
|
-
return listTasksInDirectory(
|
|
4691
|
+
return listTasksInDirectory(
|
|
4692
|
+
adapter,
|
|
4693
|
+
config,
|
|
4694
|
+
ARCHIVE_DIR,
|
|
4695
|
+
liveSlugs,
|
|
4696
|
+
liveSlugs
|
|
4697
|
+
);
|
|
4468
4698
|
}
|
|
4469
4699
|
function taskFileSlugs(result) {
|
|
4470
4700
|
return [
|
|
@@ -4497,6 +4727,8 @@ async function createTask(adapter, config, title, fields, body) {
|
|
|
4497
4727
|
assertValidPriority(priority, config);
|
|
4498
4728
|
const dependsOn = normalizeDependsOn(fields?.depends_on);
|
|
4499
4729
|
await assertValidDependsOn(adapter, config, slug, dependsOn);
|
|
4730
|
+
const related = normalizeDependsOn(fields?.related);
|
|
4731
|
+
await assertValidRelated(adapter, slug, related);
|
|
4500
4732
|
const flag = normalizeFlag(fields?.flag);
|
|
4501
4733
|
const task = {
|
|
4502
4734
|
slug,
|
|
@@ -4507,6 +4739,7 @@ async function createTask(adapter, config, title, fields, body) {
|
|
|
4507
4739
|
assignee: fields?.assignee,
|
|
4508
4740
|
tags: fields?.tags,
|
|
4509
4741
|
depends_on: dependsOn,
|
|
4742
|
+
related,
|
|
4510
4743
|
flag,
|
|
4511
4744
|
created: now,
|
|
4512
4745
|
updated: now
|
|
@@ -4541,6 +4774,11 @@ async function updateTask(adapter, config, slug, fields, body) {
|
|
|
4541
4774
|
if (dependsOnProvided) {
|
|
4542
4775
|
await assertValidDependsOn(adapter, config, slug, dependsOn);
|
|
4543
4776
|
}
|
|
4777
|
+
const relatedProvided = "related" in fields;
|
|
4778
|
+
const related = relatedProvided ? normalizeDependsOn(fields.related) : void 0;
|
|
4779
|
+
if (relatedProvided) {
|
|
4780
|
+
await assertValidRelated(adapter, slug, related, relatedSlugs(task));
|
|
4781
|
+
}
|
|
4544
4782
|
const flagProvided = "flag" in fields;
|
|
4545
4783
|
const flag = flagProvided ? normalizeFlag(fields.flag) : void 0;
|
|
4546
4784
|
const statusChanged = fields.status !== void 0 && fields.status !== task.frontmatter.status;
|
|
@@ -4548,6 +4786,7 @@ async function updateTask(adapter, config, slug, fields, body) {
|
|
|
4548
4786
|
...task.frontmatter,
|
|
4549
4787
|
...fields,
|
|
4550
4788
|
...dependsOnProvided ? { depends_on: dependsOn } : {},
|
|
4789
|
+
...relatedProvided ? { related } : {},
|
|
4551
4790
|
...flagProvided ? { flag } : {},
|
|
4552
4791
|
// `created` is set once at creation and is not user-modifiable.
|
|
4553
4792
|
created: task.frontmatter.created,
|
|
@@ -4986,6 +5225,7 @@ priority: medium
|
|
|
4986
5225
|
assignee:
|
|
4987
5226
|
tags: []
|
|
4988
5227
|
depends_on: []
|
|
5228
|
+
related: []
|
|
4989
5229
|
created: 2024-01-01T00:00:00.000Z
|
|
4990
5230
|
updated: 2024-01-01T00:00:00.000Z
|
|
4991
5231
|
---
|
|
@@ -5001,6 +5241,7 @@ Task description in Markdown.
|
|
|
5001
5241
|
- **assignee** (optional): Freeform string label (e.g. \`claude\`, \`antigravity\`, or \`human\`). Informational only \u2014 task eligibility is governed strictly by \`status\` and \`depends_on\`. Moving a task to \`in-progress\` signals that work has started.
|
|
5002
5242
|
- **tags** (optional): Array of freeform strings.
|
|
5003
5243
|
- **depends_on** (optional): Array of task slugs that must be finished before this task can start. An omitted field and an empty array mean the same thing. A slug must name a task file that exists; a task may not depend on itself, and two tasks may not depend on each other.
|
|
5244
|
+
- **related** (optional): Array of task slugs this task is associated with \u2014 the spike behind a decision, a sibling task sharing a surface. It points at other work without ordering it: it gates nothing, never blocks archiving, and stays out of the dependency graph. A slug must name a live or archived task file, and a task may not name itself. The association reads in both directions: JSON from \`task list\` and \`task search\` shows it from either task in \`related_tasks\`, while \`task get\` reports the file as written. Use \`depends_on\` when one task has to finish first, and \`related\` when the other task only explains or shares context.
|
|
5004
5245
|
- **flag** (optional): Marks the task for attention without changing its column \u2014 a one-line reason, or \`true\` when there is none to give. What a flag means is this project's call. Informational only: it gates nothing, and nothing clears it automatically. Omit the field when the task is not flagged.
|
|
5005
5246
|
- **created** (required): ISO 8601 timestamp. Set once on creation, never modify.
|
|
5006
5247
|
- **updated** (required): ISO 8601 timestamp. Update on every modification.
|
|
@@ -5053,7 +5294,7 @@ shipbench task list --available --tag backend --json
|
|
|
5053
5294
|
shipbench task list --available --tag backend,auth --assignee agent --json
|
|
5054
5295
|
\`\`\`
|
|
5055
5296
|
|
|
5056
|
-
\`--tag\` accepts comma-separated values or repeated flags and uses AND semantics. \`--status\`, \`--assignee\`, and \`--priority\` take the same comma-separated or repeated form but match a task whose value is any of the ones listed; \`--limit\` caps the count. A \`--status\` or \`--priority\` value that is not configured is an error naming the valid set, not a silently empty result. Use \`--status\` when the project's actionable column differs from its configured default. \`shipbench task search\` takes the same filters \u2014 including \`--available\` / \`--blocked\` \u2014 so "ready work that mentions X" is one query rather than a search plus a hand filter.
|
|
5297
|
+
\`--tag\` accepts comma-separated values or repeated flags and uses AND semantics. \`--exclude-tag\` takes the same form and drops a task carrying any of the listed tags, so \`--available --exclude-tag plan\` leaves out tasks that are not work items. \`--status\`, \`--assignee\`, and \`--priority\` take the same comma-separated or repeated form but match a task whose value is any of the ones listed; \`--limit\` caps the count. A \`--status\` or \`--priority\` value that is not configured is an error naming the valid set, not a silently empty result. Use \`--status\` when the project's actionable column differs from its configured default. \`shipbench task search\` takes the same filters \u2014 including \`--available\` / \`--blocked\` \u2014 so "ready work that mentions X" is one query rather than a search plus a hand filter.
|
|
5057
5298
|
|
|
5058
5299
|
\`task search\` matches each term as a case-insensitive substring by default. Add \`--whole-word\` to match on word boundaries, and wrap a run in literal double quotes (\`task search '"exact phrase"'\`) to require it to match contiguously.
|
|
5059
5300
|
|
|
@@ -5071,6 +5312,7 @@ Use the other discovery commands when the task needs more context:
|
|
|
5071
5312
|
- **Load complete matching descriptions**: \`shipbench task search "<query>" --json --include-body\`
|
|
5072
5313
|
- **Search live and archived tasks**: \`shipbench task search "<query>" --all --json\`
|
|
5073
5314
|
- **Inspect the dependency DAG**: \`shipbench task graph --json\` (add \`--archived\` to resolve archived nodes)
|
|
5315
|
+
- **Trace one task's dependencies**: \`shipbench task graph <slug> --json\` shows what it waits on and what finishing it would unblock (\`--blockers\` or \`--dependents\` for one side, \`--depth 1\` for direct neighbors only)
|
|
5074
5316
|
- **List archived tasks**: \`shipbench task list --archived --json\`
|
|
5075
5317
|
|
|
5076
5318
|
Following that principle, add \`--include-body\` to a JSON \`task list\` only when you need every returned description and Updates array. Add it to a JSON \`task search\` when you need complete matching descriptions instead of snippets. Prefer \`task get\` after narrowing when one matching task answers the question.
|
|
@@ -5079,6 +5321,8 @@ Following that principle, add \`--include-body\` to a JSON \`task list\` only wh
|
|
|
5079
5321
|
|
|
5080
5322
|
A task with unfinished dependencies is not ready, even if nothing prevents you from editing it \u2014 \`depends_on\` is data, not a lock.
|
|
5081
5323
|
|
|
5324
|
+
\`related\` never affects readiness. It names work worth reading for context, not work that has to land first.
|
|
5325
|
+
|
|
5082
5326
|
Prose sections in a task body (\`## Depends on\`, \`## Blocked by\`, and similar) are commentary. Read them for context, but do not treat them as the dependency graph.
|
|
5083
5327
|
|
|
5084
5328
|
Note that \`depends_on\` and the task's column are orthogonal. A column says where a task is; \`depends_on\` says what has to land first.
|
|
@@ -5110,14 +5354,16 @@ Ordering is a human judgment call, so reorder only when the user explicitly asks
|
|
|
5110
5354
|
|
|
5111
5355
|
## Operations
|
|
5112
5356
|
|
|
5113
|
-
Prefer the ShipBench CLI for task mutations when it is available. The CLI routes through core, so slug generation, validation, timestamps, collision handling, and layout updates stay consistent.
|
|
5357
|
+
Prefer the ShipBench CLI for task mutations when it is available. The CLI routes through core, so slug generation, validation, timestamps, collision handling, and layout updates stay consistent. Every \`task\` command accepts \`--json\`. A write with \`--json\` prints the resulting task in the \`task get\` shape, so you can confirm it without a second read.
|
|
5358
|
+
|
|
5359
|
+
Commands work from any subdirectory of the board: the CLI uses the nearest \`.shipbench/\` at or above the current directory. \`-C <path>\` names a board's directory exactly.
|
|
5114
5360
|
|
|
5115
5361
|
### Preferred CLI Operations
|
|
5116
5362
|
|
|
5117
5363
|
- **List available tasks**: \`shipbench task list --available --json\`
|
|
5118
5364
|
- **List blocked tasks**: \`shipbench task list --blocked --json\`
|
|
5119
5365
|
- **List flagged tasks**: \`shipbench task list --flagged --json\`
|
|
5120
|
-
- **Filter by tags**: \`shipbench task list --available --tag backend,auth --json\`
|
|
5366
|
+
- **Filter by tags**: \`shipbench task list --available --tag backend,auth --json\` (\`--exclude-tag\` leaves out tasks carrying any listed tag)
|
|
5121
5367
|
- **Read one task**: \`shipbench task get <slug>\`
|
|
5122
5368
|
- **Search tasks**: \`shipbench task search "<query>" --json\`
|
|
5123
5369
|
- **Inspect dependencies**: \`shipbench task graph --json\`
|
|
@@ -5125,8 +5371,9 @@ Prefer the ShipBench CLI for task mutations when it is available. The CLI routes
|
|
|
5125
5371
|
- **Create a task**: \`shipbench task create "Task title" --status=todo\`
|
|
5126
5372
|
- **Create a task with a description**: \`shipbench task create "Task title" --body-file=description.md\` (or \`--body "One-line description."\`)
|
|
5127
5373
|
- **Rewrite a description**: \`shipbench task edit <slug> --body-file=description.md\` (replaces it whole; \`--body ""\` clears it)
|
|
5128
|
-
- **Revise task metadata**: \`shipbench task edit <slug> --priority=high --assignee=agent --add-tag=urgent --remove-tag=stale\` (also \`--title\`, \`--tags\`, \`--clear-tags\`, \`--clear-assignee\`, \`--depends-on\`, \`--add-depends-on\`, \`--remove-depends-on\`, \`--clear-depends-on\`). Every flag is applied in one validated write, so a rejected value leaves the task untouched. A title edit keeps the existing slug and filename. Status and board placement stay with \`task move\`.
|
|
5374
|
+
- **Revise task metadata**: \`shipbench task edit <slug> --priority=high --assignee=agent --add-tag=urgent --remove-tag=stale\` (also \`--title\`, \`--tags\`, \`--clear-tags\`, \`--clear-assignee\`, \`--depends-on\`, \`--add-depends-on\`, \`--remove-depends-on\`, \`--clear-depends-on\`, \`--related\`, \`--add-related\`, \`--remove-related\`, \`--clear-related\`). Every flag is applied in one validated write, so a rejected value leaves the task untouched. The related flags edit only this task's own list; removing a link the other task's file records is rejected with the task to edit instead. A title edit keeps the existing slug and filename. Status and board placement stay with \`task move\`.
|
|
5129
5375
|
- **Create a dependent task**: \`shipbench task create "Task title" --depends-on=other-slug,another-slug\`
|
|
5376
|
+
- **Link related work**: \`shipbench task create "Task title" --related=spike-slug\` (or \`task edit <slug> --add-related=other-slug\`)
|
|
5130
5377
|
- **Add a time-anchored update**: \`shipbench task comment <slug> "What changed and why."\`
|
|
5131
5378
|
- **Add a multi-line update**: \`shipbench task comment <slug> --body-file update.md\`
|
|
5132
5379
|
- **Edit an update's text**: \`shipbench task comment edit <slug> <index> "Corrected text."\` (also takes \`--body-file\`)
|
|
@@ -5141,7 +5388,7 @@ Prefer the ShipBench CLI for task mutations when it is available. The CLI routes
|
|
|
5141
5388
|
- **Unarchive a task**: \`shipbench task unarchive <slug>\`
|
|
5142
5389
|
- **Delete a task**: \`shipbench task delete <slug>\`
|
|
5143
5390
|
- **Open the board**: \`shipbench board\`
|
|
5144
|
-
- **Watch the board in the terminal**: \`shipbench board terminal\` (read-only; \`--status\`, \`--tag\`, \`--assignee\`, \`--priority\`, \`--flagged\` narrow it)
|
|
5391
|
+
- **Watch the board in the terminal**: \`shipbench board terminal\` (read-only; \`--status\`, \`--tag\`, \`--exclude-tag\`, \`--assignee\`, \`--priority\`, \`--flagged\` narrow it)
|
|
5145
5392
|
|
|
5146
5393
|
### Direct File Operations
|
|
5147
5394
|
|
|
@@ -5149,7 +5396,7 @@ Use direct edits only when the CLI is unavailable.
|
|
|
5149
5396
|
|
|
5150
5397
|
- **Create a task**: Add a new \`.md\` file in \`tasks/\` following the format above.
|
|
5151
5398
|
- **Move a task**: Change the \`status\` field and update the \`updated\` timestamp.
|
|
5152
|
-
- **Edit a task**: Modify frontmatter fields and/or the description above \`## Task Updates\`. Always update \`updated\`. \`shipbench task edit\` reaches the description and the validated metadata fields (title, priority, assignee, tags, depends_on) \u2014 use it rather than rewriting a file by hand.
|
|
5399
|
+
- **Edit a task**: Modify frontmatter fields and/or the description above \`## Task Updates\`. Always update \`updated\`. \`shipbench task edit\` reaches the description and the validated metadata fields (title, priority, assignee, tags, depends_on, related) \u2014 use it rather than rewriting a file by hand.
|
|
5153
5400
|
- **Add an Update without the CLI**: Append a \`### <ISO 8601 timestamp>\` heading and text below the trailing \`## Task Updates\` marker.
|
|
5154
5401
|
- **Edit an Update without the CLI**: Change only its text; preserve the \`###\` timestamp heading and update the frontmatter \`updated\` value.
|
|
5155
5402
|
- **Flag a task without the CLI**: Set \`flag\` to a one-line reason or \`true\`, remove the field to clear it, and update \`updated\`.
|
|
@@ -5911,16 +6158,15 @@ function matchesFilters(task, filters) {
|
|
|
5911
6158
|
return false;
|
|
5912
6159
|
}
|
|
5913
6160
|
if (filters.flagged && !isTaskFlagged(task)) return false;
|
|
6161
|
+
const tags = (task.frontmatter.tags ?? []).map((tag) => tag.toLowerCase());
|
|
6162
|
+
const unwanted = filters.excludedTags ?? [];
|
|
6163
|
+
if (unwanted.some((tag) => tags.includes(tag.toLowerCase()))) return false;
|
|
5914
6164
|
const wanted = filters.tags ?? [];
|
|
5915
|
-
|
|
5916
|
-
const tags = (task.frontmatter.tags ?? []).map((tag) => tag.toLowerCase());
|
|
5917
|
-
if (!wanted.every((tag) => tags.includes(tag.toLowerCase()))) return false;
|
|
5918
|
-
}
|
|
5919
|
-
return true;
|
|
6165
|
+
return wanted.every((tag) => tags.includes(tag.toLowerCase()));
|
|
5920
6166
|
}
|
|
5921
6167
|
function hasTaskFilters(filters) {
|
|
5922
6168
|
return Boolean(
|
|
5923
|
-
filters.assignee || filters.priority || filters.flagged || filters.tags && filters.tags.length > 0
|
|
6169
|
+
filters.assignee || filters.priority || filters.flagged || filters.tags && filters.tags.length > 0 || filters.excludedTags && filters.excludedTags.length > 0
|
|
5924
6170
|
);
|
|
5925
6171
|
}
|
|
5926
6172
|
function buildBoardModel(config, tasks, warnings, filters = {}, archivedTasks = [], archivedSlugs = [], now = /* @__PURE__ */ new Date()) {
|
|
@@ -6627,7 +6873,7 @@ async function runTui(options2) {
|
|
|
6627
6873
|
}
|
|
6628
6874
|
|
|
6629
6875
|
// src/cli.ts
|
|
6630
|
-
var VERSION = true ? "0.
|
|
6876
|
+
var VERSION = true ? "0.9.0" : "0.0.0-dev";
|
|
6631
6877
|
function commaList(value) {
|
|
6632
6878
|
return value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
6633
6879
|
}
|
|
@@ -6675,6 +6921,7 @@ function resolveTaskFilters(command, raw, config) {
|
|
|
6675
6921
|
priorities,
|
|
6676
6922
|
assignees: raw.assignee ?? [],
|
|
6677
6923
|
tags: raw.tag ?? [],
|
|
6924
|
+
excludedTags: raw.excludeTag ?? [],
|
|
6678
6925
|
flagged: Boolean(raw.flagged)
|
|
6679
6926
|
};
|
|
6680
6927
|
}
|
|
@@ -6691,6 +6938,11 @@ function taskMatchesFilters(task, filters, options2 = {}) {
|
|
|
6691
6938
|
}
|
|
6692
6939
|
if (filters.flagged && !isTaskFlagged(task)) return false;
|
|
6693
6940
|
const taskTags = (frontmatter.tags ?? []).map((tag) => tag.toLowerCase());
|
|
6941
|
+
if (filters.excludedTags.some(
|
|
6942
|
+
(unwanted) => taskTags.includes(unwanted.toLowerCase())
|
|
6943
|
+
)) {
|
|
6944
|
+
return false;
|
|
6945
|
+
}
|
|
6694
6946
|
return filters.tags.every((wanted) => taskTags.includes(wanted.toLowerCase()));
|
|
6695
6947
|
}
|
|
6696
6948
|
function flagSuffix(task) {
|
|
@@ -6712,6 +6964,13 @@ function parseNonNegativeInteger(value) {
|
|
|
6712
6964
|
}
|
|
6713
6965
|
return parsed;
|
|
6714
6966
|
}
|
|
6967
|
+
function parsePositiveInteger(value) {
|
|
6968
|
+
const parsed = Number(value);
|
|
6969
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
6970
|
+
throw new InvalidArgumentError("Value must be a positive integer.");
|
|
6971
|
+
}
|
|
6972
|
+
return parsed;
|
|
6973
|
+
}
|
|
6715
6974
|
function parseLayoutPosition(value) {
|
|
6716
6975
|
const parsed = Number(value);
|
|
6717
6976
|
if (!Number.isInteger(parsed) || parsed < -1) {
|
|
@@ -6780,6 +7039,52 @@ function formatTaskDependencyGraph(graph) {
|
|
|
6780
7039
|
}
|
|
6781
7040
|
return lines;
|
|
6782
7041
|
}
|
|
7042
|
+
function formatTaskDependencyQuery(query) {
|
|
7043
|
+
const state = query.available ? "available" : query.dependencies_satisfied ? "dependencies satisfied" : "blocked";
|
|
7044
|
+
const lines = [
|
|
7045
|
+
`${query.slug} [${query.status}]: ${state}${query.invalid_depends_on ? ", invalid depends_on" : ""}`
|
|
7046
|
+
];
|
|
7047
|
+
const describe = (node) => {
|
|
7048
|
+
const notes = [];
|
|
7049
|
+
if (node.satisfied !== void 0) {
|
|
7050
|
+
notes.push(node.satisfied ? "satisfied" : "unsatisfied");
|
|
7051
|
+
}
|
|
7052
|
+
if (node.unblocks_on_completion) notes.push("unblocks on completion");
|
|
7053
|
+
if (node.waiting_on?.length) {
|
|
7054
|
+
notes.push(`waiting on ${node.waiting_on.join(", ")}`);
|
|
7055
|
+
}
|
|
7056
|
+
if (node.invalid_depends_on) notes.push("invalid depends_on");
|
|
7057
|
+
if (node.omitted === "repeat") notes.push("expanded above");
|
|
7058
|
+
if (node.omitted === "cycle") notes.push("cycle");
|
|
7059
|
+
if (node.omitted === "depth") notes.push("more beyond --depth");
|
|
7060
|
+
const suffix = notes.length > 0 ? ` (${notes.join("; ")})` : "";
|
|
7061
|
+
return `${node.slug} [${node.status}]${suffix}`;
|
|
7062
|
+
};
|
|
7063
|
+
const tree = (nodes, prefix) => {
|
|
7064
|
+
nodes.forEach((node, index) => {
|
|
7065
|
+
const isLast = index === nodes.length - 1;
|
|
7066
|
+
lines.push(`${prefix}${isLast ? "`-" : "+-"} ${describe(node)}`);
|
|
7067
|
+
tree(node.children, `${prefix}${isLast ? " " : "| "}`);
|
|
7068
|
+
});
|
|
7069
|
+
};
|
|
7070
|
+
const section = (label, nodes) => {
|
|
7071
|
+
if (!nodes) return;
|
|
7072
|
+
if (nodes.length === 0) {
|
|
7073
|
+
lines.push(`${label}: none`);
|
|
7074
|
+
return;
|
|
7075
|
+
}
|
|
7076
|
+
lines.push(`${label}:`);
|
|
7077
|
+
tree(nodes, "");
|
|
7078
|
+
};
|
|
7079
|
+
section("Blockers", query.blockers);
|
|
7080
|
+
section("Dependents", query.dependents);
|
|
7081
|
+
if (query.truncated) {
|
|
7082
|
+
lines.push(
|
|
7083
|
+
`Stopped at --depth ${query.depth}; some branches continue past it.`
|
|
7084
|
+
);
|
|
7085
|
+
}
|
|
7086
|
+
return lines;
|
|
7087
|
+
}
|
|
6783
7088
|
function bodyOption() {
|
|
6784
7089
|
return new Option("--body <text>", "Description as Markdown text").conflicts([
|
|
6785
7090
|
"bodyFile"
|
|
@@ -6814,6 +7119,15 @@ function enableExitOverride(command) {
|
|
|
6814
7119
|
function formatUnreadableFile(file) {
|
|
6815
7120
|
return `[unreadable] ${file.path}: ${file.reason} (${file.slug})`;
|
|
6816
7121
|
}
|
|
7122
|
+
function taskJson(task) {
|
|
7123
|
+
return {
|
|
7124
|
+
slug: task.slug,
|
|
7125
|
+
status: task.frontmatter.status,
|
|
7126
|
+
frontmatter: task.frontmatter,
|
|
7127
|
+
body: task.body,
|
|
7128
|
+
comments: task.comments
|
|
7129
|
+
};
|
|
7130
|
+
}
|
|
6817
7131
|
function unreadableFileJson(file, includeBody) {
|
|
6818
7132
|
return {
|
|
6819
7133
|
slug: file.slug,
|
|
@@ -6889,6 +7203,7 @@ function createCli(opts) {
|
|
|
6889
7203
|
);
|
|
6890
7204
|
return null;
|
|
6891
7205
|
};
|
|
7206
|
+
const printTask = (task2) => data(JSON.stringify(taskJson(task2), null, 2));
|
|
6892
7207
|
const program = new Command().name("shipbench").description("Git-native project management for solo developers.").enablePositionalOptions().version(VERSION, "-v, --version", "output the version").option(
|
|
6893
7208
|
"-C <path>",
|
|
6894
7209
|
"Use the board in the specified directory, without searching above it"
|
|
@@ -6972,6 +7287,11 @@ function createCli(opts) {
|
|
|
6972
7287
|
"Slugs this task depends on (comma-separated, repeatable)",
|
|
6973
7288
|
accumulateCommaList,
|
|
6974
7289
|
[]
|
|
7290
|
+
).option(
|
|
7291
|
+
"--related <slugs>",
|
|
7292
|
+
"Slugs of live or archived tasks this one relates to, without depending on them (comma-separated, repeatable)",
|
|
7293
|
+
accumulateCommaList,
|
|
7294
|
+
[]
|
|
6975
7295
|
).addOption(bodyOption()).addOption(bodyFileOption()).option("--json", "Output the created task as JSON").addHelpText(
|
|
6976
7296
|
"after",
|
|
6977
7297
|
"\nPrefer --body-file for anything multi-line: the file is read as UTF-8 by\nShipBench, so the description never passes through shell quoting or encoding.\n"
|
|
@@ -6987,24 +7307,13 @@ function createCli(opts) {
|
|
|
6987
7307
|
assignee: raw.assignee,
|
|
6988
7308
|
priority: raw.priority,
|
|
6989
7309
|
tags: raw.tags && dedupePreservingCase(raw.tags),
|
|
6990
|
-
depends_on: raw.dependsOn
|
|
7310
|
+
depends_on: raw.dependsOn,
|
|
7311
|
+
related: raw.related
|
|
6991
7312
|
},
|
|
6992
7313
|
body
|
|
6993
7314
|
);
|
|
6994
7315
|
if (raw.json) {
|
|
6995
|
-
|
|
6996
|
-
JSON.stringify(
|
|
6997
|
-
{
|
|
6998
|
-
slug: created.slug,
|
|
6999
|
-
status: created.frontmatter.status,
|
|
7000
|
-
frontmatter: created.frontmatter,
|
|
7001
|
-
body: created.body,
|
|
7002
|
-
comments: created.comments
|
|
7003
|
-
},
|
|
7004
|
-
null,
|
|
7005
|
-
2
|
|
7006
|
-
)
|
|
7007
|
-
);
|
|
7316
|
+
printTask(created);
|
|
7008
7317
|
return;
|
|
7009
7318
|
}
|
|
7010
7319
|
chrome(`Created task: ${created.slug}`);
|
|
@@ -7063,6 +7372,26 @@ function createCli(opts) {
|
|
|
7063
7372
|
"addDependsOn",
|
|
7064
7373
|
"removeDependsOn"
|
|
7065
7374
|
])
|
|
7375
|
+
).addOption(
|
|
7376
|
+
commaListOption(
|
|
7377
|
+
"--related <slugs>",
|
|
7378
|
+
"Replace every related task (comma-separated or repeatable)"
|
|
7379
|
+
).conflicts(["addRelated", "removeRelated", "clearRelated"])
|
|
7380
|
+
).addOption(
|
|
7381
|
+
commaListOption(
|
|
7382
|
+
"--add-related <slugs>",
|
|
7383
|
+
"Add related tasks, keeping the others (comma-separated or repeatable)"
|
|
7384
|
+
).conflicts(["related", "clearRelated"])
|
|
7385
|
+
).addOption(
|
|
7386
|
+
commaListOption(
|
|
7387
|
+
"--remove-related <slugs>",
|
|
7388
|
+
"Remove related tasks, keeping the others (comma-separated or repeatable)"
|
|
7389
|
+
).conflicts(["related", "clearRelated"])
|
|
7390
|
+
).addOption(
|
|
7391
|
+
new Option(
|
|
7392
|
+
"--clear-related",
|
|
7393
|
+
"Remove every related task this task's file records"
|
|
7394
|
+
).conflicts(["related", "addRelated", "removeRelated"])
|
|
7066
7395
|
).addOption(bodyOption()).addOption(bodyFileOption()).option("--json", "Output the edited task as JSON").addHelpText(
|
|
7067
7396
|
"after",
|
|
7068
7397
|
"\nPass at least one change. Every change is applied in a single validated\nwrite: if any value is rejected the task is left exactly as it was. Status\nand board placement stay with `shipbench task move`; the Task Updates section\nstays with `shipbench task comment`. A title edit never renames the file.\n"
|
|
@@ -7078,10 +7407,14 @@ function createCli(opts) {
|
|
|
7078
7407
|
const addDependsOn = raw.addDependsOn;
|
|
7079
7408
|
const removeDependsOn = raw.removeDependsOn;
|
|
7080
7409
|
const replaceDependsOn = raw.dependsOn;
|
|
7081
|
-
const
|
|
7410
|
+
const clearRelated = Boolean(raw.clearRelated);
|
|
7411
|
+
const addRelated = raw.addRelated;
|
|
7412
|
+
const removeRelated = raw.removeRelated;
|
|
7413
|
+
const replaceRelated = raw.related;
|
|
7414
|
+
const requestedAnything = body !== void 0 || raw.title !== void 0 || raw.priority !== void 0 || raw.assignee !== void 0 || clearAssignee || replaceTags !== void 0 || addTag !== void 0 || removeTag !== void 0 || clearTags || replaceDependsOn !== void 0 || addDependsOn !== void 0 || removeDependsOn !== void 0 || clearDependsOn || replaceRelated !== void 0 || addRelated !== void 0 || removeRelated !== void 0 || clearRelated;
|
|
7082
7415
|
if (!requestedAnything) {
|
|
7083
7416
|
editCommand.error(
|
|
7084
|
-
"Provide at least one change: --body/--body-file, --title, --priority, --assignee/--clear-assignee, --tags/--add-tag/--remove-tag/--clear-tags,
|
|
7417
|
+
"Provide at least one change: --body/--body-file, --title, --priority, --assignee/--clear-assignee, --tags/--add-tag/--remove-tag/--clear-tags, --depends-on/--add-depends-on/--remove-depends-on/--clear-depends-on, or --related/--add-related/--remove-related/--clear-related."
|
|
7085
7418
|
);
|
|
7086
7419
|
return;
|
|
7087
7420
|
}
|
|
@@ -7152,24 +7485,53 @@ function createCli(opts) {
|
|
|
7152
7485
|
fields.depends_on = nextDeps;
|
|
7153
7486
|
changes.push(`depends_on ${list(currentDeps)} \u2192 ${list(nextDeps)}`);
|
|
7154
7487
|
}
|
|
7488
|
+
const currentRelated = relatedSlugs(existing);
|
|
7489
|
+
let nextRelated;
|
|
7490
|
+
if (replaceRelated !== void 0) {
|
|
7491
|
+
nextRelated = dedupePreservingCase(replaceRelated);
|
|
7492
|
+
} else if (clearRelated) {
|
|
7493
|
+
nextRelated = [];
|
|
7494
|
+
} else if (addRelated !== void 0 || removeRelated !== void 0) {
|
|
7495
|
+
const notOwn = (removeRelated ?? []).filter(
|
|
7496
|
+
(target) => !currentRelated.includes(target)
|
|
7497
|
+
);
|
|
7498
|
+
if (notOwn.length > 0) {
|
|
7499
|
+
const [live, archived] = await Promise.all([
|
|
7500
|
+
listTasks(adapter, config),
|
|
7501
|
+
listArchivedTasks(adapter, config)
|
|
7502
|
+
]);
|
|
7503
|
+
const holds = (candidate, target) => candidate.slug === target && relatedSlugs(candidate).includes(slug);
|
|
7504
|
+
for (const target of notOwn) {
|
|
7505
|
+
if (live.tasks.some((candidate) => holds(candidate, target))) {
|
|
7506
|
+
editCommand.error(
|
|
7507
|
+
`Cannot remove related task "${target}" from ${slug}: the link is recorded in ${target}'s file, not this one. Remove it there: shipbench task edit ${target} --remove-related ${slug}`
|
|
7508
|
+
);
|
|
7509
|
+
return;
|
|
7510
|
+
}
|
|
7511
|
+
if (archived.tasks.some((candidate) => holds(candidate, target))) {
|
|
7512
|
+
editCommand.error(
|
|
7513
|
+
`Cannot remove related task "${target}" from ${slug}: the link is recorded in the archived task ${target}'s file, not this one. Unarchive ${target} to edit it.`
|
|
7514
|
+
);
|
|
7515
|
+
return;
|
|
7516
|
+
}
|
|
7517
|
+
}
|
|
7518
|
+
}
|
|
7519
|
+
const removed = new Set(removeRelated ?? []);
|
|
7520
|
+
nextRelated = dedupePreservingCase([
|
|
7521
|
+
...currentRelated.filter((target) => !removed.has(target)),
|
|
7522
|
+
...addRelated ?? []
|
|
7523
|
+
]);
|
|
7524
|
+
}
|
|
7525
|
+
if (nextRelated !== void 0 && (nextRelated.length !== currentRelated.length || nextRelated.some((target, index) => target !== currentRelated[index]))) {
|
|
7526
|
+
fields.related = nextRelated;
|
|
7527
|
+
changes.push(`related ${list(currentRelated)} \u2192 ${list(nextRelated)}`);
|
|
7528
|
+
}
|
|
7155
7529
|
if (body !== void 0) {
|
|
7156
7530
|
changes.push(body.trim() ? "description" : "description cleared");
|
|
7157
7531
|
}
|
|
7158
7532
|
if (changes.length === 0) {
|
|
7159
7533
|
if (raw.json) {
|
|
7160
|
-
|
|
7161
|
-
JSON.stringify(
|
|
7162
|
-
{
|
|
7163
|
-
slug: existing.slug,
|
|
7164
|
-
status: existing.frontmatter.status,
|
|
7165
|
-
frontmatter: existing.frontmatter,
|
|
7166
|
-
body: existing.body,
|
|
7167
|
-
comments: existing.comments
|
|
7168
|
-
},
|
|
7169
|
-
null,
|
|
7170
|
-
2
|
|
7171
|
-
)
|
|
7172
|
-
);
|
|
7534
|
+
printTask(existing);
|
|
7173
7535
|
return;
|
|
7174
7536
|
}
|
|
7175
7537
|
chrome(`No changes for ${slug}: every field already holds that value.`);
|
|
@@ -7183,19 +7545,7 @@ function createCli(opts) {
|
|
|
7183
7545
|
body
|
|
7184
7546
|
);
|
|
7185
7547
|
if (raw.json) {
|
|
7186
|
-
|
|
7187
|
-
JSON.stringify(
|
|
7188
|
-
{
|
|
7189
|
-
slug: edited.slug,
|
|
7190
|
-
status: edited.frontmatter.status,
|
|
7191
|
-
frontmatter: edited.frontmatter,
|
|
7192
|
-
body: edited.body,
|
|
7193
|
-
comments: edited.comments
|
|
7194
|
-
},
|
|
7195
|
-
null,
|
|
7196
|
-
2
|
|
7197
|
-
)
|
|
7198
|
-
);
|
|
7548
|
+
printTask(edited);
|
|
7199
7549
|
return;
|
|
7200
7550
|
}
|
|
7201
7551
|
chrome(`Updated ${edited.slug}: ${changes.join("; ")}`);
|
|
@@ -7204,7 +7554,7 @@ function createCli(opts) {
|
|
|
7204
7554
|
}
|
|
7205
7555
|
});
|
|
7206
7556
|
const BODY_FILE_HELP = "\nPrefer --body-file for anything multi-line: the file is read as UTF-8 by\nShipBench, so the text never passes through shell quoting or encoding.\n";
|
|
7207
|
-
const commentCommand = task.command("comment").description("Manage timestamped entries in the task Updates section").argument("[slug]", "Task slug").argument("[text]", "Update text").addOption(updateTextOption()).addOption(updateTextFileOption()).addHelpText("after", BODY_FILE_HELP);
|
|
7557
|
+
const commentCommand = task.command("comment").description("Manage timestamped entries in the task Updates section").argument("[slug]", "Task slug").argument("[text]", "Update text").addOption(updateTextOption()).addOption(updateTextFileOption()).option("--json", "Output the resulting task as JSON").addHelpText("after", BODY_FILE_HELP);
|
|
7208
7558
|
commentCommand.action(async (slug, text, raw) => {
|
|
7209
7559
|
const resolved = await resolveUpdateText(commentCommand, text, raw);
|
|
7210
7560
|
if (!slug || resolved === void 0) {
|
|
@@ -7214,11 +7564,15 @@ function createCli(opts) {
|
|
|
7214
7564
|
}
|
|
7215
7565
|
const config = await loadCliConfig();
|
|
7216
7566
|
const updated = await addComment(adapter, config, slug, resolved);
|
|
7567
|
+
if (raw.json) {
|
|
7568
|
+
printTask(updated);
|
|
7569
|
+
return;
|
|
7570
|
+
}
|
|
7217
7571
|
chrome(`Added update to ${updated.slug}`);
|
|
7218
7572
|
});
|
|
7219
7573
|
const commentEditCommand = commentCommand.command("edit <slug> <index> [text]").description(
|
|
7220
7574
|
"Edit an Updates entry by zero-based index without changing its timestamp"
|
|
7221
|
-
).addOption(updateTextOption()).addOption(updateTextFileOption()).addHelpText("after", BODY_FILE_HELP);
|
|
7575
|
+
).addOption(updateTextOption()).addOption(updateTextFileOption()).option("--json", "Output the resulting task as JSON").addHelpText("after", BODY_FILE_HELP);
|
|
7222
7576
|
commentEditCommand.action(async (slug, index, text, raw) => {
|
|
7223
7577
|
const resolved = await resolveUpdateText(commentEditCommand, text, raw);
|
|
7224
7578
|
if (resolved === void 0) {
|
|
@@ -7236,15 +7590,26 @@ function createCli(opts) {
|
|
|
7236
7590
|
parsedIndex,
|
|
7237
7591
|
resolved
|
|
7238
7592
|
);
|
|
7593
|
+
if (raw.json) {
|
|
7594
|
+
printTask(updated);
|
|
7595
|
+
return;
|
|
7596
|
+
}
|
|
7239
7597
|
chrome(`Edited update ${parsedIndex} on ${updated.slug}`);
|
|
7240
7598
|
});
|
|
7241
|
-
commentCommand.command("delete <slug> <index>").description("Delete an Updates entry by zero-based index").action(async (slug, index) => {
|
|
7599
|
+
commentCommand.command("delete <slug> <index>").description("Delete an Updates entry by zero-based index").option("--json", "Output the resulting task as JSON").action(async (slug, index, raw) => {
|
|
7242
7600
|
const config = await loadCliConfig();
|
|
7243
7601
|
const parsedIndex = parseNonNegativeInteger(index);
|
|
7244
7602
|
const updated = await deleteComment(adapter, config, slug, parsedIndex);
|
|
7603
|
+
if (raw.json) {
|
|
7604
|
+
printTask(updated);
|
|
7605
|
+
return;
|
|
7606
|
+
}
|
|
7245
7607
|
chrome(`Deleted update ${parsedIndex} from ${updated.slug}`);
|
|
7246
7608
|
});
|
|
7247
|
-
const getTaskCommand = task.command("get <slug>").alias("show").description("Retrieve one task as JSON").option("--archived", "Retrieve the task from the archive instead")
|
|
7609
|
+
const getTaskCommand = task.command("get <slug>").alias("show").description("Retrieve one task as JSON").option("--archived", "Retrieve the task from the archive instead").option(
|
|
7610
|
+
"--json",
|
|
7611
|
+
"Accepted for consistency; the output is JSON either way"
|
|
7612
|
+
);
|
|
7248
7613
|
getTaskCommand.action(async (slug, raw) => {
|
|
7249
7614
|
const config = await loadCliConfig();
|
|
7250
7615
|
const found = await getTask(adapter, config, slug, {
|
|
@@ -7272,11 +7637,7 @@ function createCli(opts) {
|
|
|
7272
7637
|
data(
|
|
7273
7638
|
JSON.stringify(
|
|
7274
7639
|
{
|
|
7275
|
-
|
|
7276
|
-
status: found.frontmatter.status,
|
|
7277
|
-
frontmatter: found.frontmatter,
|
|
7278
|
-
body: found.body,
|
|
7279
|
-
comments: found.comments,
|
|
7640
|
+
...taskJson(found),
|
|
7280
7641
|
...found.unreadableUpdates ? { unreadable_updates: found.unreadableUpdates } : {}
|
|
7281
7642
|
},
|
|
7282
7643
|
null,
|
|
@@ -7284,12 +7645,12 @@ function createCli(opts) {
|
|
|
7284
7645
|
)
|
|
7285
7646
|
);
|
|
7286
7647
|
});
|
|
7287
|
-
const flagCommand = task.command("flag <slug> [reason]").description("Flag a task for attention, with an optional one-line reason").addHelpText(
|
|
7648
|
+
const flagCommand = task.command("flag <slug> [reason]").description("Flag a task for attention, with an optional one-line reason").option("--json", "Output the resulting task as JSON").addHelpText(
|
|
7288
7649
|
"after",
|
|
7289
7650
|
"\nWhat a flag means is the project's call. A flag never moves the task, and\nnothing clears it for you: run `shipbench task unflag <slug>` once it no\nlonger applies. Flagging a flagged task replaces its reason.\n"
|
|
7290
7651
|
);
|
|
7291
7652
|
flagCommand.action(
|
|
7292
|
-
async (slug, reason) => {
|
|
7653
|
+
async (slug, reason, raw) => {
|
|
7293
7654
|
const config = await loadCliConfig();
|
|
7294
7655
|
const existing = await requireLiveTask(
|
|
7295
7656
|
flagCommand,
|
|
@@ -7301,20 +7662,28 @@ function createCli(opts) {
|
|
|
7301
7662
|
const flag = reason == null ? true : reason;
|
|
7302
7663
|
const before = taskFlag(existing);
|
|
7303
7664
|
if (before && before.reason === (flag === true ? null : flag.trim())) {
|
|
7665
|
+
if (raw.json) {
|
|
7666
|
+
printTask(existing);
|
|
7667
|
+
return;
|
|
7668
|
+
}
|
|
7304
7669
|
chrome(`No changes for ${slug}: it already carries that flag.`);
|
|
7305
7670
|
return;
|
|
7306
7671
|
}
|
|
7307
7672
|
const { task: flagged } = await updateTask(adapter, config, slug, {
|
|
7308
7673
|
flag
|
|
7309
7674
|
});
|
|
7675
|
+
if (raw.json) {
|
|
7676
|
+
printTask(flagged);
|
|
7677
|
+
return;
|
|
7678
|
+
}
|
|
7310
7679
|
const after = taskFlag(flagged);
|
|
7311
7680
|
chrome(
|
|
7312
7681
|
after?.reason ? `Flagged ${flagged.slug}: ${after.reason}` : `Flagged ${flagged.slug}`
|
|
7313
7682
|
);
|
|
7314
7683
|
}
|
|
7315
7684
|
);
|
|
7316
|
-
const unflagCommand = task.command("unflag <slug>").description("Clear a task's flag");
|
|
7317
|
-
unflagCommand.action(async (slug) => {
|
|
7685
|
+
const unflagCommand = task.command("unflag <slug>").description("Clear a task's flag").option("--json", "Output the resulting task as JSON");
|
|
7686
|
+
unflagCommand.action(async (slug, raw) => {
|
|
7318
7687
|
const config = await loadCliConfig();
|
|
7319
7688
|
const existing = await requireLiveTask(
|
|
7320
7689
|
unflagCommand,
|
|
@@ -7324,10 +7693,20 @@ function createCli(opts) {
|
|
|
7324
7693
|
);
|
|
7325
7694
|
if (!existing) return;
|
|
7326
7695
|
if (existing.frontmatter.flag === void 0) {
|
|
7696
|
+
if (raw.json) {
|
|
7697
|
+
printTask(existing);
|
|
7698
|
+
return;
|
|
7699
|
+
}
|
|
7327
7700
|
chrome(`No changes for ${slug}: it is not flagged.`);
|
|
7328
7701
|
return;
|
|
7329
7702
|
}
|
|
7330
|
-
await updateTask(adapter, config, slug, {
|
|
7703
|
+
const { task: unflagged } = await updateTask(adapter, config, slug, {
|
|
7704
|
+
flag: void 0
|
|
7705
|
+
});
|
|
7706
|
+
if (raw.json) {
|
|
7707
|
+
printTask(unflagged);
|
|
7708
|
+
return;
|
|
7709
|
+
}
|
|
7331
7710
|
chrome(`Unflagged ${slug}`);
|
|
7332
7711
|
});
|
|
7333
7712
|
const moveCommand = task.command("move <slug>").description("Move a task to another column and/or another position").option(
|
|
@@ -7359,7 +7738,7 @@ function createCli(opts) {
|
|
|
7359
7738
|
).conflicts(["top", "bottom", "before", "position"])
|
|
7360
7739
|
).addOption(
|
|
7361
7740
|
new Option("--position <n>", "Place at this 0-based index (-1 appends)").argParser(parseLayoutPosition).conflicts(["top", "bottom", "before", "after"])
|
|
7362
|
-
).addHelpText(
|
|
7741
|
+
).option("--json", "Output the resulting task as JSON").addHelpText(
|
|
7363
7742
|
"after",
|
|
7364
7743
|
"\nPlacement flags are mutually exclusive and cannot target the done column,\nwhich is always ordered by last update. Reorder only when asked to.\n"
|
|
7365
7744
|
).action(async (slug, raw) => {
|
|
@@ -7373,6 +7752,10 @@ function createCli(opts) {
|
|
|
7373
7752
|
return;
|
|
7374
7753
|
}
|
|
7375
7754
|
const moved2 = await moveTask(adapter, config, slug, raw.to);
|
|
7755
|
+
if (raw.json) {
|
|
7756
|
+
printTask(moved2);
|
|
7757
|
+
return;
|
|
7758
|
+
}
|
|
7376
7759
|
chrome(`Moved ${moved2.slug} \u2192 ${moved2.frontmatter.status}`);
|
|
7377
7760
|
return;
|
|
7378
7761
|
}
|
|
@@ -7444,6 +7827,10 @@ function createCli(opts) {
|
|
|
7444
7827
|
toStatus,
|
|
7445
7828
|
position
|
|
7446
7829
|
);
|
|
7830
|
+
if (raw.json) {
|
|
7831
|
+
printTask(moved);
|
|
7832
|
+
return;
|
|
7833
|
+
}
|
|
7447
7834
|
const placedAt = position < 0 || position > column.length ? column.length : position;
|
|
7448
7835
|
chrome(
|
|
7449
7836
|
fromStatus === toStatus ? `Reordered ${moved.slug} in ${toStatus} \u2192 position ${placedAt} of ${column.length + 1}` : `Moved ${moved.slug} \u2192 ${toStatus} at position ${placedAt} of ${column.length + 1}`
|
|
@@ -7470,6 +7857,10 @@ function createCli(opts) {
|
|
|
7470
7857
|
"--tag <tag>",
|
|
7471
7858
|
"Filter by tag (comma-separated or repeatable with AND semantics)",
|
|
7472
7859
|
accumulateCommaList
|
|
7860
|
+
).option(
|
|
7861
|
+
"--exclude-tag <tag>",
|
|
7862
|
+
"Leave out tasks carrying any of these tags (comma-separated or repeatable)",
|
|
7863
|
+
accumulateCommaList
|
|
7473
7864
|
).option("--flagged", "Only tasks with a flag set").addOption(
|
|
7474
7865
|
new Option(
|
|
7475
7866
|
"--available",
|
|
@@ -7521,10 +7912,23 @@ function createCli(opts) {
|
|
|
7521
7912
|
})
|
|
7522
7913
|
).slice(0, raw.limit);
|
|
7523
7914
|
if (raw.json) {
|
|
7915
|
+
const relatedOf = createRelatedIndex(
|
|
7916
|
+
raw.archived ? {
|
|
7917
|
+
tasks: (await listTasks(adapter, config)).tasks,
|
|
7918
|
+
archivedTasks: result.tasks,
|
|
7919
|
+
archivedSlugs: taskFileSlugs(result)
|
|
7920
|
+
} : {
|
|
7921
|
+
tasks: result.tasks,
|
|
7922
|
+
archivedTasks: archived?.tasks,
|
|
7923
|
+
archivedSlugs: result.archivedSlugs
|
|
7924
|
+
}
|
|
7925
|
+
);
|
|
7524
7926
|
const tasks = filtered.map((t) => ({
|
|
7525
7927
|
slug: t.slug,
|
|
7526
7928
|
...t.frontmatter,
|
|
7527
7929
|
depends_on: t.frontmatter.depends_on ?? [],
|
|
7930
|
+
related: t.frontmatter.related ?? [],
|
|
7931
|
+
related_tasks: relatedOf(t),
|
|
7528
7932
|
...boardOrder ? { position: boardOrder.positions.get(t.slug) } : {},
|
|
7529
7933
|
...raw.includeBody ? {
|
|
7530
7934
|
body: t.body,
|
|
@@ -7576,6 +7980,10 @@ function createCli(opts) {
|
|
|
7576
7980
|
"--tag <tag>",
|
|
7577
7981
|
"Filter by tag (comma-separated or repeatable with AND semantics)",
|
|
7578
7982
|
accumulateCommaList
|
|
7983
|
+
).option(
|
|
7984
|
+
"--exclude-tag <tag>",
|
|
7985
|
+
"Leave out tasks carrying any of these tags (comma-separated or repeatable)",
|
|
7986
|
+
accumulateCommaList
|
|
7579
7987
|
).option("--flagged", "Only tasks with a flag set").addOption(
|
|
7580
7988
|
new Option(
|
|
7581
7989
|
"--available",
|
|
@@ -7659,6 +8067,13 @@ function createCli(opts) {
|
|
|
7659
8067
|
...searchArchive ? archivedResult?.unreadable ?? [] : []
|
|
7660
8068
|
];
|
|
7661
8069
|
if (raw.json) {
|
|
8070
|
+
const relatedLive = liveResult ?? await listTasks(adapter, config);
|
|
8071
|
+
const relatedArchive = archivedResult ?? await listArchivedTasks(adapter, config);
|
|
8072
|
+
const relatedOf = createRelatedIndex({
|
|
8073
|
+
tasks: relatedLive.tasks,
|
|
8074
|
+
archivedTasks: relatedArchive.tasks,
|
|
8075
|
+
archivedSlugs: taskFileSlugs(relatedArchive)
|
|
8076
|
+
});
|
|
7662
8077
|
const payloadMatches = matches.map((match) => {
|
|
7663
8078
|
const source = candidatesBySlug.get(match.slug);
|
|
7664
8079
|
return {
|
|
@@ -7667,6 +8082,7 @@ function createCli(opts) {
|
|
|
7667
8082
|
status: match.status,
|
|
7668
8083
|
location: locationOf(match.slug),
|
|
7669
8084
|
matched_fields: match.matched_fields,
|
|
8085
|
+
related_tasks: source ? relatedOf(source) : [],
|
|
7670
8086
|
...source && isTaskFlagged(source) ? { flag: source.frontmatter.flag } : {},
|
|
7671
8087
|
...match.snippet !== void 0 ? { snippet: match.snippet } : {},
|
|
7672
8088
|
...match.update_matches ? { update_matches: match.update_matches } : {},
|
|
@@ -7729,10 +8145,50 @@ function createCli(opts) {
|
|
|
7729
8145
|
}
|
|
7730
8146
|
}
|
|
7731
8147
|
});
|
|
7732
|
-
task.command("graph").description("Show the task dependency graph").option("--archived", "Include archived tasks as graph nodes").option("--
|
|
8148
|
+
const graphCommand = task.command("graph [slug]").description("Show the task dependency graph, or the chain around one task").option("--archived", "Include archived tasks as graph nodes").option("--blockers", "With a slug: walk only what the task depends on").option("--dependents", "With a slug: walk only what depends on the task").option(
|
|
8149
|
+
"--depth <n>",
|
|
8150
|
+
"With a slug: levels to walk (1 lists direct neighbors only)",
|
|
8151
|
+
parsePositiveInteger
|
|
8152
|
+
).option("--json", "Emit machine-readable JSON");
|
|
8153
|
+
graphCommand.action(async (slug, raw) => {
|
|
7733
8154
|
const config = await loadCliConfig();
|
|
8155
|
+
if (slug === void 0) {
|
|
8156
|
+
if (raw.blockers || raw.dependents || raw.depth !== void 0) {
|
|
8157
|
+
graphCommand.error(
|
|
8158
|
+
"--blockers, --dependents, and --depth need a task slug."
|
|
8159
|
+
);
|
|
8160
|
+
return;
|
|
8161
|
+
}
|
|
8162
|
+
}
|
|
7734
8163
|
const liveResult = await listTasks(adapter, config);
|
|
7735
8164
|
const archivedResult = raw.archived ? await listArchivedTasks(adapter, config) : void 0;
|
|
8165
|
+
if (slug !== void 0) {
|
|
8166
|
+
const query = queryTaskDependencies(slug, liveResult.tasks, config, {
|
|
8167
|
+
direction: raw.blockers && !raw.dependents ? "blockers" : raw.dependents && !raw.blockers ? "dependents" : "both",
|
|
8168
|
+
depth: raw.depth,
|
|
8169
|
+
archivedTasks: archivedResult?.tasks,
|
|
8170
|
+
// Readiness matches `task list`: an archived dependency is
|
|
8171
|
+
// satisfied whether or not --archived walks into it.
|
|
8172
|
+
archivedSlugs: archivedResult ? taskFileSlugs(archivedResult) : liveResult.archivedSlugs,
|
|
8173
|
+
unreadableSlugs: liveResult.unreadable.map((file) => file.slug)
|
|
8174
|
+
});
|
|
8175
|
+
if (!query) {
|
|
8176
|
+
if (!raw.archived && liveResult.archivedSlugs?.includes(slug)) {
|
|
8177
|
+
graphCommand.error(
|
|
8178
|
+
`Task '${slug}' is archived. Pass --archived to query it.`
|
|
8179
|
+
);
|
|
8180
|
+
} else {
|
|
8181
|
+
graphCommand.error(`Task '${slug}' not found.`);
|
|
8182
|
+
}
|
|
8183
|
+
return;
|
|
8184
|
+
}
|
|
8185
|
+
if (raw.json || !isInteractive) {
|
|
8186
|
+
data(JSON.stringify(query, null, 2));
|
|
8187
|
+
return;
|
|
8188
|
+
}
|
|
8189
|
+
for (const line of formatTaskDependencyQuery(query)) data(line);
|
|
8190
|
+
return;
|
|
8191
|
+
}
|
|
7736
8192
|
const graph = buildTaskDependencyGraph(liveResult.tasks, {
|
|
7737
8193
|
archivedTasks: archivedResult?.tasks,
|
|
7738
8194
|
archivedSlugs: archivedResult ? taskFileSlugs(archivedResult) : void 0
|
|
@@ -7750,6 +8206,9 @@ function createCli(opts) {
|
|
|
7750
8206
|
).option(
|
|
7751
8207
|
"--force",
|
|
7752
8208
|
"Archive a non-done task even when live tasks depend on it"
|
|
8209
|
+
).option(
|
|
8210
|
+
"--json",
|
|
8211
|
+
"Output the archived task as JSON (an array of them with --done)"
|
|
7753
8212
|
).addHelpText(
|
|
7754
8213
|
"after",
|
|
7755
8214
|
"\nA non-done task with live dependents is blocked unless --force is used.\n"
|
|
@@ -7773,15 +8232,26 @@ function createCli(opts) {
|
|
|
7773
8232
|
);
|
|
7774
8233
|
const keep = raw.keep === void 0 && config.done_display.max <= 0 ? doneTasks.length : raw.keep ?? config.done_display.max;
|
|
7775
8234
|
const candidates = doneTasks.slice(keep);
|
|
8235
|
+
const archived = [];
|
|
7776
8236
|
for (const candidate of candidates) {
|
|
7777
|
-
await archiveTask(adapter, config, candidate.slug);
|
|
7778
|
-
chrome(`Archived task: ${candidate.slug}`);
|
|
8237
|
+
archived.push(await archiveTask(adapter, config, candidate.slug));
|
|
8238
|
+
if (!raw.json) chrome(`Archived task: ${candidate.slug}`);
|
|
8239
|
+
}
|
|
8240
|
+
if (raw.json) {
|
|
8241
|
+
data(JSON.stringify(archived.map(taskJson), null, 2));
|
|
8242
|
+
return;
|
|
7779
8243
|
}
|
|
7780
8244
|
if (candidates.length === 0) chrome("No done tasks archived.");
|
|
7781
8245
|
return;
|
|
7782
8246
|
}
|
|
7783
8247
|
try {
|
|
7784
|
-
await archiveTask(adapter, config, slug, {
|
|
8248
|
+
const archived = await archiveTask(adapter, config, slug, {
|
|
8249
|
+
force: raw.force
|
|
8250
|
+
});
|
|
8251
|
+
if (raw.json) {
|
|
8252
|
+
printTask(archived);
|
|
8253
|
+
return;
|
|
8254
|
+
}
|
|
7785
8255
|
chrome(`Archived task: ${slug}`);
|
|
7786
8256
|
} catch (error) {
|
|
7787
8257
|
if (error instanceof ArchiveBlockedError) {
|
|
@@ -7792,14 +8262,22 @@ function createCli(opts) {
|
|
|
7792
8262
|
throw error;
|
|
7793
8263
|
}
|
|
7794
8264
|
});
|
|
7795
|
-
task.command("unarchive <slug>").description("Restore an archived task").action(async (slug) => {
|
|
8265
|
+
task.command("unarchive <slug>").description("Restore an archived task").option("--json", "Output the resulting task as JSON").action(async (slug, raw) => {
|
|
7796
8266
|
const config = await loadCliConfig();
|
|
7797
|
-
await unarchiveTask(adapter, config, slug);
|
|
8267
|
+
const restored = await unarchiveTask(adapter, config, slug);
|
|
8268
|
+
if (raw.json) {
|
|
8269
|
+
printTask(restored);
|
|
8270
|
+
return;
|
|
8271
|
+
}
|
|
7798
8272
|
chrome(`Unarchived task: ${slug}`);
|
|
7799
8273
|
});
|
|
7800
|
-
task.command("delete <slug>").description("Delete a task").action(async (slug) => {
|
|
8274
|
+
task.command("delete <slug>").description("Delete a task").option("--json", "Output the deleted slug as JSON").action(async (slug, raw) => {
|
|
7801
8275
|
const config = await loadCliConfig();
|
|
7802
8276
|
await deleteTask(adapter, config, slug);
|
|
8277
|
+
if (raw.json) {
|
|
8278
|
+
data(JSON.stringify({ slug, deleted: true }, null, 2));
|
|
8279
|
+
return;
|
|
8280
|
+
}
|
|
7803
8281
|
chrome(`Deleted task: ${slug}`);
|
|
7804
8282
|
});
|
|
7805
8283
|
const board = program.command("board").description("Open the board UI");
|
|
@@ -7836,6 +8314,10 @@ function createCli(opts) {
|
|
|
7836
8314
|
"--tag <tag>",
|
|
7837
8315
|
"Filter by tag (comma-separated or repeatable with AND semantics)",
|
|
7838
8316
|
accumulateCommaList
|
|
8317
|
+
).option(
|
|
8318
|
+
"--exclude-tag <tag>",
|
|
8319
|
+
"Leave out tasks carrying any of these tags (comma-separated or repeatable)",
|
|
8320
|
+
accumulateCommaList
|
|
7839
8321
|
).option("--flagged", "Only tasks with a flag set").addHelpText(
|
|
7840
8322
|
"after",
|
|
7841
8323
|
"\nTakes no keyboard input: Ctrl-C exits. Never writes to the board.\nWith stdout redirected it prints one 80x24 frame and exits.\n"
|
|
@@ -7847,6 +8329,7 @@ function createCli(opts) {
|
|
|
7847
8329
|
filters: {
|
|
7848
8330
|
statuses: raw.status,
|
|
7849
8331
|
tags: raw.tag,
|
|
8332
|
+
excludedTags: raw.excludeTag,
|
|
7850
8333
|
assignee: raw.assignee,
|
|
7851
8334
|
priority: raw.priority,
|
|
7852
8335
|
flagged: raw.flagged
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Git-native project management for solo developers. Each task is a Markdown file in your repository, with a CLI and a local board on top.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"chokidar": "^5.0.0",
|
|
35
35
|
"commander": "^15.0.0",
|
|
36
|
-
"@shipbench/board": "0.
|
|
36
|
+
"@shipbench/board": "0.9.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26.0.1",
|
|
40
40
|
"gray-matter": "^4.0.3",
|
|
41
41
|
"tsup": "^8.0.0",
|
|
42
42
|
"typescript": "^5.5.0",
|
|
43
|
-
"@shipbench/core": "0.
|
|
43
|
+
"@shipbench/core": "0.9.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsup",
|