shipbench 0.8.0 → 0.10.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 +624 -89
- 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. When a description links to another task, also record that task here (or in \`depends_on\`): a slug resolves wherever the task is filed, while a relative Markdown link stops resolving once either file moves to \`tasks/archive/\`.
|
|
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\`.
|
|
@@ -5236,6 +5483,45 @@ async function initProject(adapter, options2) {
|
|
|
5236
5483
|
};
|
|
5237
5484
|
}
|
|
5238
5485
|
|
|
5486
|
+
// ../../packages/core/src/links.ts
|
|
5487
|
+
var INLINE_LINK = /\]\(\s*(<[^>\n]*>|[^\s)]+)(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?\s*\)/g;
|
|
5488
|
+
var REFERENCE_DEFINITION = /^ {0,3}\[[^\]\n]+\]:\s*(<[^>\n]*>|\S+)/gm;
|
|
5489
|
+
var FENCED_CODE = /^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?(?:^ {0,3}\1[^\n]*$|(?![\s\S]))/gm;
|
|
5490
|
+
var INLINE_CODE = /(`+)[^`]*?\1/g;
|
|
5491
|
+
var SCHEME = /^[a-z][a-z0-9+.-]*:/i;
|
|
5492
|
+
var TASK_HREF = /^(?:\.\/)?(?:archive\/|\.\.\/)?([^/]+)\.md$|(?:^|\/)\.shipbench\/tasks\/(?:archive\/)?([^/]+)\.md$/;
|
|
5493
|
+
function taskSlugOfHref(raw) {
|
|
5494
|
+
const href = raw.startsWith("<") ? raw.slice(1, -1).trim() : raw;
|
|
5495
|
+
if (!href || href.startsWith("#") || SCHEME.test(href)) return null;
|
|
5496
|
+
const path = href.replace(/[?#].*$/, "");
|
|
5497
|
+
let decoded;
|
|
5498
|
+
try {
|
|
5499
|
+
decoded = decodeURIComponent(path);
|
|
5500
|
+
} catch {
|
|
5501
|
+
return null;
|
|
5502
|
+
}
|
|
5503
|
+
const match = TASK_HREF.exec(decoded);
|
|
5504
|
+
return match ? match[1] ?? match[2] : null;
|
|
5505
|
+
}
|
|
5506
|
+
function taskLinkTargets(markdown) {
|
|
5507
|
+
const prose = markdown.replace(FENCED_CODE, "").replace(INLINE_CODE, "");
|
|
5508
|
+
const slugs = /* @__PURE__ */ new Set();
|
|
5509
|
+
for (const pattern of [INLINE_LINK, REFERENCE_DEFINITION]) {
|
|
5510
|
+
for (const match of prose.matchAll(pattern)) {
|
|
5511
|
+
const slug = taskSlugOfHref(match[1]);
|
|
5512
|
+
if (slug) slugs.add(slug);
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
return [...slugs];
|
|
5516
|
+
}
|
|
5517
|
+
function tasksLinkingTo(tasks, slug) {
|
|
5518
|
+
return tasks.filter(
|
|
5519
|
+
(task) => task.slug !== slug && [task.body, ...task.comments.map((comment) => comment.text)].some(
|
|
5520
|
+
(text) => taskLinkTargets(text).includes(slug)
|
|
5521
|
+
)
|
|
5522
|
+
).map((task) => task.slug).sort();
|
|
5523
|
+
}
|
|
5524
|
+
|
|
5239
5525
|
// ../../packages/core/src/search.ts
|
|
5240
5526
|
var SNIPPET_CONTEXT_BEFORE = 40;
|
|
5241
5527
|
var SNIPPET_CONTEXT_AFTER = 80;
|
|
@@ -5911,16 +6197,15 @@ function matchesFilters(task, filters) {
|
|
|
5911
6197
|
return false;
|
|
5912
6198
|
}
|
|
5913
6199
|
if (filters.flagged && !isTaskFlagged(task)) return false;
|
|
6200
|
+
const tags = (task.frontmatter.tags ?? []).map((tag) => tag.toLowerCase());
|
|
6201
|
+
const unwanted = filters.excludedTags ?? [];
|
|
6202
|
+
if (unwanted.some((tag) => tags.includes(tag.toLowerCase()))) return false;
|
|
5914
6203
|
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;
|
|
6204
|
+
return wanted.every((tag) => tags.includes(tag.toLowerCase()));
|
|
5920
6205
|
}
|
|
5921
6206
|
function hasTaskFilters(filters) {
|
|
5922
6207
|
return Boolean(
|
|
5923
|
-
filters.assignee || filters.priority || filters.flagged || filters.tags && filters.tags.length > 0
|
|
6208
|
+
filters.assignee || filters.priority || filters.flagged || filters.tags && filters.tags.length > 0 || filters.excludedTags && filters.excludedTags.length > 0
|
|
5924
6209
|
);
|
|
5925
6210
|
}
|
|
5926
6211
|
function buildBoardModel(config, tasks, warnings, filters = {}, archivedTasks = [], archivedSlugs = [], now = /* @__PURE__ */ new Date()) {
|
|
@@ -6627,7 +6912,7 @@ async function runTui(options2) {
|
|
|
6627
6912
|
}
|
|
6628
6913
|
|
|
6629
6914
|
// src/cli.ts
|
|
6630
|
-
var VERSION = true ? "0.
|
|
6915
|
+
var VERSION = true ? "0.10.0" : "0.0.0-dev";
|
|
6631
6916
|
function commaList(value) {
|
|
6632
6917
|
return value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
6633
6918
|
}
|
|
@@ -6675,6 +6960,7 @@ function resolveTaskFilters(command, raw, config) {
|
|
|
6675
6960
|
priorities,
|
|
6676
6961
|
assignees: raw.assignee ?? [],
|
|
6677
6962
|
tags: raw.tag ?? [],
|
|
6963
|
+
excludedTags: raw.excludeTag ?? [],
|
|
6678
6964
|
flagged: Boolean(raw.flagged)
|
|
6679
6965
|
};
|
|
6680
6966
|
}
|
|
@@ -6691,6 +6977,11 @@ function taskMatchesFilters(task, filters, options2 = {}) {
|
|
|
6691
6977
|
}
|
|
6692
6978
|
if (filters.flagged && !isTaskFlagged(task)) return false;
|
|
6693
6979
|
const taskTags = (frontmatter.tags ?? []).map((tag) => tag.toLowerCase());
|
|
6980
|
+
if (filters.excludedTags.some(
|
|
6981
|
+
(unwanted) => taskTags.includes(unwanted.toLowerCase())
|
|
6982
|
+
)) {
|
|
6983
|
+
return false;
|
|
6984
|
+
}
|
|
6694
6985
|
return filters.tags.every((wanted) => taskTags.includes(wanted.toLowerCase()));
|
|
6695
6986
|
}
|
|
6696
6987
|
function flagSuffix(task) {
|
|
@@ -6712,6 +7003,13 @@ function parseNonNegativeInteger(value) {
|
|
|
6712
7003
|
}
|
|
6713
7004
|
return parsed;
|
|
6714
7005
|
}
|
|
7006
|
+
function parsePositiveInteger(value) {
|
|
7007
|
+
const parsed = Number(value);
|
|
7008
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
7009
|
+
throw new InvalidArgumentError("Value must be a positive integer.");
|
|
7010
|
+
}
|
|
7011
|
+
return parsed;
|
|
7012
|
+
}
|
|
6715
7013
|
function parseLayoutPosition(value) {
|
|
6716
7014
|
const parsed = Number(value);
|
|
6717
7015
|
if (!Number.isInteger(parsed) || parsed < -1) {
|
|
@@ -6780,6 +7078,52 @@ function formatTaskDependencyGraph(graph) {
|
|
|
6780
7078
|
}
|
|
6781
7079
|
return lines;
|
|
6782
7080
|
}
|
|
7081
|
+
function formatTaskDependencyQuery(query) {
|
|
7082
|
+
const state = query.available ? "available" : query.dependencies_satisfied ? "dependencies satisfied" : "blocked";
|
|
7083
|
+
const lines = [
|
|
7084
|
+
`${query.slug} [${query.status}]: ${state}${query.invalid_depends_on ? ", invalid depends_on" : ""}`
|
|
7085
|
+
];
|
|
7086
|
+
const describe = (node) => {
|
|
7087
|
+
const notes = [];
|
|
7088
|
+
if (node.satisfied !== void 0) {
|
|
7089
|
+
notes.push(node.satisfied ? "satisfied" : "unsatisfied");
|
|
7090
|
+
}
|
|
7091
|
+
if (node.unblocks_on_completion) notes.push("unblocks on completion");
|
|
7092
|
+
if (node.waiting_on?.length) {
|
|
7093
|
+
notes.push(`waiting on ${node.waiting_on.join(", ")}`);
|
|
7094
|
+
}
|
|
7095
|
+
if (node.invalid_depends_on) notes.push("invalid depends_on");
|
|
7096
|
+
if (node.omitted === "repeat") notes.push("expanded above");
|
|
7097
|
+
if (node.omitted === "cycle") notes.push("cycle");
|
|
7098
|
+
if (node.omitted === "depth") notes.push("more beyond --depth");
|
|
7099
|
+
const suffix = notes.length > 0 ? ` (${notes.join("; ")})` : "";
|
|
7100
|
+
return `${node.slug} [${node.status}]${suffix}`;
|
|
7101
|
+
};
|
|
7102
|
+
const tree = (nodes, prefix) => {
|
|
7103
|
+
nodes.forEach((node, index) => {
|
|
7104
|
+
const isLast = index === nodes.length - 1;
|
|
7105
|
+
lines.push(`${prefix}${isLast ? "`-" : "+-"} ${describe(node)}`);
|
|
7106
|
+
tree(node.children, `${prefix}${isLast ? " " : "| "}`);
|
|
7107
|
+
});
|
|
7108
|
+
};
|
|
7109
|
+
const section = (label, nodes) => {
|
|
7110
|
+
if (!nodes) return;
|
|
7111
|
+
if (nodes.length === 0) {
|
|
7112
|
+
lines.push(`${label}: none`);
|
|
7113
|
+
return;
|
|
7114
|
+
}
|
|
7115
|
+
lines.push(`${label}:`);
|
|
7116
|
+
tree(nodes, "");
|
|
7117
|
+
};
|
|
7118
|
+
section("Blockers", query.blockers);
|
|
7119
|
+
section("Dependents", query.dependents);
|
|
7120
|
+
if (query.truncated) {
|
|
7121
|
+
lines.push(
|
|
7122
|
+
`Stopped at --depth ${query.depth}; some branches continue past it.`
|
|
7123
|
+
);
|
|
7124
|
+
}
|
|
7125
|
+
return lines;
|
|
7126
|
+
}
|
|
6783
7127
|
function bodyOption() {
|
|
6784
7128
|
return new Option("--body <text>", "Description as Markdown text").conflicts([
|
|
6785
7129
|
"bodyFile"
|
|
@@ -6814,6 +7158,15 @@ function enableExitOverride(command) {
|
|
|
6814
7158
|
function formatUnreadableFile(file) {
|
|
6815
7159
|
return `[unreadable] ${file.path}: ${file.reason} (${file.slug})`;
|
|
6816
7160
|
}
|
|
7161
|
+
function taskJson(task) {
|
|
7162
|
+
return {
|
|
7163
|
+
slug: task.slug,
|
|
7164
|
+
status: task.frontmatter.status,
|
|
7165
|
+
frontmatter: task.frontmatter,
|
|
7166
|
+
body: task.body,
|
|
7167
|
+
comments: task.comments
|
|
7168
|
+
};
|
|
7169
|
+
}
|
|
6817
7170
|
function unreadableFileJson(file, includeBody) {
|
|
6818
7171
|
return {
|
|
6819
7172
|
slug: file.slug,
|
|
@@ -6889,6 +7242,7 @@ function createCli(opts) {
|
|
|
6889
7242
|
);
|
|
6890
7243
|
return null;
|
|
6891
7244
|
};
|
|
7245
|
+
const printTask = (task2) => data(JSON.stringify(taskJson(task2), null, 2));
|
|
6892
7246
|
const program = new Command().name("shipbench").description("Git-native project management for solo developers.").enablePositionalOptions().version(VERSION, "-v, --version", "output the version").option(
|
|
6893
7247
|
"-C <path>",
|
|
6894
7248
|
"Use the board in the specified directory, without searching above it"
|
|
@@ -6972,6 +7326,11 @@ function createCli(opts) {
|
|
|
6972
7326
|
"Slugs this task depends on (comma-separated, repeatable)",
|
|
6973
7327
|
accumulateCommaList,
|
|
6974
7328
|
[]
|
|
7329
|
+
).option(
|
|
7330
|
+
"--related <slugs>",
|
|
7331
|
+
"Slugs of live or archived tasks this one relates to, without depending on them (comma-separated, repeatable)",
|
|
7332
|
+
accumulateCommaList,
|
|
7333
|
+
[]
|
|
6975
7334
|
).addOption(bodyOption()).addOption(bodyFileOption()).option("--json", "Output the created task as JSON").addHelpText(
|
|
6976
7335
|
"after",
|
|
6977
7336
|
"\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 +7346,13 @@ function createCli(opts) {
|
|
|
6987
7346
|
assignee: raw.assignee,
|
|
6988
7347
|
priority: raw.priority,
|
|
6989
7348
|
tags: raw.tags && dedupePreservingCase(raw.tags),
|
|
6990
|
-
depends_on: raw.dependsOn
|
|
7349
|
+
depends_on: raw.dependsOn,
|
|
7350
|
+
related: raw.related
|
|
6991
7351
|
},
|
|
6992
7352
|
body
|
|
6993
7353
|
);
|
|
6994
7354
|
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
|
-
);
|
|
7355
|
+
printTask(created);
|
|
7008
7356
|
return;
|
|
7009
7357
|
}
|
|
7010
7358
|
chrome(`Created task: ${created.slug}`);
|
|
@@ -7063,6 +7411,26 @@ function createCli(opts) {
|
|
|
7063
7411
|
"addDependsOn",
|
|
7064
7412
|
"removeDependsOn"
|
|
7065
7413
|
])
|
|
7414
|
+
).addOption(
|
|
7415
|
+
commaListOption(
|
|
7416
|
+
"--related <slugs>",
|
|
7417
|
+
"Replace every related task (comma-separated or repeatable)"
|
|
7418
|
+
).conflicts(["addRelated", "removeRelated", "clearRelated"])
|
|
7419
|
+
).addOption(
|
|
7420
|
+
commaListOption(
|
|
7421
|
+
"--add-related <slugs>",
|
|
7422
|
+
"Add related tasks, keeping the others (comma-separated or repeatable)"
|
|
7423
|
+
).conflicts(["related", "clearRelated"])
|
|
7424
|
+
).addOption(
|
|
7425
|
+
commaListOption(
|
|
7426
|
+
"--remove-related <slugs>",
|
|
7427
|
+
"Remove related tasks, keeping the others (comma-separated or repeatable)"
|
|
7428
|
+
).conflicts(["related", "clearRelated"])
|
|
7429
|
+
).addOption(
|
|
7430
|
+
new Option(
|
|
7431
|
+
"--clear-related",
|
|
7432
|
+
"Remove every related task this task's file records"
|
|
7433
|
+
).conflicts(["related", "addRelated", "removeRelated"])
|
|
7066
7434
|
).addOption(bodyOption()).addOption(bodyFileOption()).option("--json", "Output the edited task as JSON").addHelpText(
|
|
7067
7435
|
"after",
|
|
7068
7436
|
"\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 +7446,14 @@ function createCli(opts) {
|
|
|
7078
7446
|
const addDependsOn = raw.addDependsOn;
|
|
7079
7447
|
const removeDependsOn = raw.removeDependsOn;
|
|
7080
7448
|
const replaceDependsOn = raw.dependsOn;
|
|
7081
|
-
const
|
|
7449
|
+
const clearRelated = Boolean(raw.clearRelated);
|
|
7450
|
+
const addRelated = raw.addRelated;
|
|
7451
|
+
const removeRelated = raw.removeRelated;
|
|
7452
|
+
const replaceRelated = raw.related;
|
|
7453
|
+
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
7454
|
if (!requestedAnything) {
|
|
7083
7455
|
editCommand.error(
|
|
7084
|
-
"Provide at least one change: --body/--body-file, --title, --priority, --assignee/--clear-assignee, --tags/--add-tag/--remove-tag/--clear-tags,
|
|
7456
|
+
"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
7457
|
);
|
|
7086
7458
|
return;
|
|
7087
7459
|
}
|
|
@@ -7152,24 +7524,53 @@ function createCli(opts) {
|
|
|
7152
7524
|
fields.depends_on = nextDeps;
|
|
7153
7525
|
changes.push(`depends_on ${list(currentDeps)} \u2192 ${list(nextDeps)}`);
|
|
7154
7526
|
}
|
|
7527
|
+
const currentRelated = relatedSlugs(existing);
|
|
7528
|
+
let nextRelated;
|
|
7529
|
+
if (replaceRelated !== void 0) {
|
|
7530
|
+
nextRelated = dedupePreservingCase(replaceRelated);
|
|
7531
|
+
} else if (clearRelated) {
|
|
7532
|
+
nextRelated = [];
|
|
7533
|
+
} else if (addRelated !== void 0 || removeRelated !== void 0) {
|
|
7534
|
+
const notOwn = (removeRelated ?? []).filter(
|
|
7535
|
+
(target) => !currentRelated.includes(target)
|
|
7536
|
+
);
|
|
7537
|
+
if (notOwn.length > 0) {
|
|
7538
|
+
const [live, archived] = await Promise.all([
|
|
7539
|
+
listTasks(adapter, config),
|
|
7540
|
+
listArchivedTasks(adapter, config)
|
|
7541
|
+
]);
|
|
7542
|
+
const holds = (candidate, target) => candidate.slug === target && relatedSlugs(candidate).includes(slug);
|
|
7543
|
+
for (const target of notOwn) {
|
|
7544
|
+
if (live.tasks.some((candidate) => holds(candidate, target))) {
|
|
7545
|
+
editCommand.error(
|
|
7546
|
+
`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}`
|
|
7547
|
+
);
|
|
7548
|
+
return;
|
|
7549
|
+
}
|
|
7550
|
+
if (archived.tasks.some((candidate) => holds(candidate, target))) {
|
|
7551
|
+
editCommand.error(
|
|
7552
|
+
`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.`
|
|
7553
|
+
);
|
|
7554
|
+
return;
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
}
|
|
7558
|
+
const removed = new Set(removeRelated ?? []);
|
|
7559
|
+
nextRelated = dedupePreservingCase([
|
|
7560
|
+
...currentRelated.filter((target) => !removed.has(target)),
|
|
7561
|
+
...addRelated ?? []
|
|
7562
|
+
]);
|
|
7563
|
+
}
|
|
7564
|
+
if (nextRelated !== void 0 && (nextRelated.length !== currentRelated.length || nextRelated.some((target, index) => target !== currentRelated[index]))) {
|
|
7565
|
+
fields.related = nextRelated;
|
|
7566
|
+
changes.push(`related ${list(currentRelated)} \u2192 ${list(nextRelated)}`);
|
|
7567
|
+
}
|
|
7155
7568
|
if (body !== void 0) {
|
|
7156
7569
|
changes.push(body.trim() ? "description" : "description cleared");
|
|
7157
7570
|
}
|
|
7158
7571
|
if (changes.length === 0) {
|
|
7159
7572
|
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
|
-
);
|
|
7573
|
+
printTask(existing);
|
|
7173
7574
|
return;
|
|
7174
7575
|
}
|
|
7175
7576
|
chrome(`No changes for ${slug}: every field already holds that value.`);
|
|
@@ -7183,19 +7584,7 @@ function createCli(opts) {
|
|
|
7183
7584
|
body
|
|
7184
7585
|
);
|
|
7185
7586
|
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
|
-
);
|
|
7587
|
+
printTask(edited);
|
|
7199
7588
|
return;
|
|
7200
7589
|
}
|
|
7201
7590
|
chrome(`Updated ${edited.slug}: ${changes.join("; ")}`);
|
|
@@ -7204,7 +7593,7 @@ function createCli(opts) {
|
|
|
7204
7593
|
}
|
|
7205
7594
|
});
|
|
7206
7595
|
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);
|
|
7596
|
+
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
7597
|
commentCommand.action(async (slug, text, raw) => {
|
|
7209
7598
|
const resolved = await resolveUpdateText(commentCommand, text, raw);
|
|
7210
7599
|
if (!slug || resolved === void 0) {
|
|
@@ -7214,11 +7603,15 @@ function createCli(opts) {
|
|
|
7214
7603
|
}
|
|
7215
7604
|
const config = await loadCliConfig();
|
|
7216
7605
|
const updated = await addComment(adapter, config, slug, resolved);
|
|
7606
|
+
if (raw.json) {
|
|
7607
|
+
printTask(updated);
|
|
7608
|
+
return;
|
|
7609
|
+
}
|
|
7217
7610
|
chrome(`Added update to ${updated.slug}`);
|
|
7218
7611
|
});
|
|
7219
7612
|
const commentEditCommand = commentCommand.command("edit <slug> <index> [text]").description(
|
|
7220
7613
|
"Edit an Updates entry by zero-based index without changing its timestamp"
|
|
7221
|
-
).addOption(updateTextOption()).addOption(updateTextFileOption()).addHelpText("after", BODY_FILE_HELP);
|
|
7614
|
+
).addOption(updateTextOption()).addOption(updateTextFileOption()).option("--json", "Output the resulting task as JSON").addHelpText("after", BODY_FILE_HELP);
|
|
7222
7615
|
commentEditCommand.action(async (slug, index, text, raw) => {
|
|
7223
7616
|
const resolved = await resolveUpdateText(commentEditCommand, text, raw);
|
|
7224
7617
|
if (resolved === void 0) {
|
|
@@ -7236,15 +7629,26 @@ function createCli(opts) {
|
|
|
7236
7629
|
parsedIndex,
|
|
7237
7630
|
resolved
|
|
7238
7631
|
);
|
|
7632
|
+
if (raw.json) {
|
|
7633
|
+
printTask(updated);
|
|
7634
|
+
return;
|
|
7635
|
+
}
|
|
7239
7636
|
chrome(`Edited update ${parsedIndex} on ${updated.slug}`);
|
|
7240
7637
|
});
|
|
7241
|
-
commentCommand.command("delete <slug> <index>").description("Delete an Updates entry by zero-based index").action(async (slug, index) => {
|
|
7638
|
+
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
7639
|
const config = await loadCliConfig();
|
|
7243
7640
|
const parsedIndex = parseNonNegativeInteger(index);
|
|
7244
7641
|
const updated = await deleteComment(adapter, config, slug, parsedIndex);
|
|
7642
|
+
if (raw.json) {
|
|
7643
|
+
printTask(updated);
|
|
7644
|
+
return;
|
|
7645
|
+
}
|
|
7245
7646
|
chrome(`Deleted update ${parsedIndex} from ${updated.slug}`);
|
|
7246
7647
|
});
|
|
7247
|
-
const getTaskCommand = task.command("get <slug>").alias("show").description("Retrieve one task as JSON").option("--archived", "Retrieve the task from the archive instead")
|
|
7648
|
+
const getTaskCommand = task.command("get <slug>").alias("show").description("Retrieve one task as JSON").option("--archived", "Retrieve the task from the archive instead").option(
|
|
7649
|
+
"--json",
|
|
7650
|
+
"Accepted for consistency; the output is JSON either way"
|
|
7651
|
+
);
|
|
7248
7652
|
getTaskCommand.action(async (slug, raw) => {
|
|
7249
7653
|
const config = await loadCliConfig();
|
|
7250
7654
|
const found = await getTask(adapter, config, slug, {
|
|
@@ -7272,11 +7676,7 @@ function createCli(opts) {
|
|
|
7272
7676
|
data(
|
|
7273
7677
|
JSON.stringify(
|
|
7274
7678
|
{
|
|
7275
|
-
|
|
7276
|
-
status: found.frontmatter.status,
|
|
7277
|
-
frontmatter: found.frontmatter,
|
|
7278
|
-
body: found.body,
|
|
7279
|
-
comments: found.comments,
|
|
7679
|
+
...taskJson(found),
|
|
7280
7680
|
...found.unreadableUpdates ? { unreadable_updates: found.unreadableUpdates } : {}
|
|
7281
7681
|
},
|
|
7282
7682
|
null,
|
|
@@ -7284,12 +7684,12 @@ function createCli(opts) {
|
|
|
7284
7684
|
)
|
|
7285
7685
|
);
|
|
7286
7686
|
});
|
|
7287
|
-
const flagCommand = task.command("flag <slug> [reason]").description("Flag a task for attention, with an optional one-line reason").addHelpText(
|
|
7687
|
+
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
7688
|
"after",
|
|
7289
7689
|
"\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
7690
|
);
|
|
7291
7691
|
flagCommand.action(
|
|
7292
|
-
async (slug, reason) => {
|
|
7692
|
+
async (slug, reason, raw) => {
|
|
7293
7693
|
const config = await loadCliConfig();
|
|
7294
7694
|
const existing = await requireLiveTask(
|
|
7295
7695
|
flagCommand,
|
|
@@ -7301,20 +7701,28 @@ function createCli(opts) {
|
|
|
7301
7701
|
const flag = reason == null ? true : reason;
|
|
7302
7702
|
const before = taskFlag(existing);
|
|
7303
7703
|
if (before && before.reason === (flag === true ? null : flag.trim())) {
|
|
7704
|
+
if (raw.json) {
|
|
7705
|
+
printTask(existing);
|
|
7706
|
+
return;
|
|
7707
|
+
}
|
|
7304
7708
|
chrome(`No changes for ${slug}: it already carries that flag.`);
|
|
7305
7709
|
return;
|
|
7306
7710
|
}
|
|
7307
7711
|
const { task: flagged } = await updateTask(adapter, config, slug, {
|
|
7308
7712
|
flag
|
|
7309
7713
|
});
|
|
7714
|
+
if (raw.json) {
|
|
7715
|
+
printTask(flagged);
|
|
7716
|
+
return;
|
|
7717
|
+
}
|
|
7310
7718
|
const after = taskFlag(flagged);
|
|
7311
7719
|
chrome(
|
|
7312
7720
|
after?.reason ? `Flagged ${flagged.slug}: ${after.reason}` : `Flagged ${flagged.slug}`
|
|
7313
7721
|
);
|
|
7314
7722
|
}
|
|
7315
7723
|
);
|
|
7316
|
-
const unflagCommand = task.command("unflag <slug>").description("Clear a task's flag");
|
|
7317
|
-
unflagCommand.action(async (slug) => {
|
|
7724
|
+
const unflagCommand = task.command("unflag <slug>").description("Clear a task's flag").option("--json", "Output the resulting task as JSON");
|
|
7725
|
+
unflagCommand.action(async (slug, raw) => {
|
|
7318
7726
|
const config = await loadCliConfig();
|
|
7319
7727
|
const existing = await requireLiveTask(
|
|
7320
7728
|
unflagCommand,
|
|
@@ -7324,10 +7732,20 @@ function createCli(opts) {
|
|
|
7324
7732
|
);
|
|
7325
7733
|
if (!existing) return;
|
|
7326
7734
|
if (existing.frontmatter.flag === void 0) {
|
|
7735
|
+
if (raw.json) {
|
|
7736
|
+
printTask(existing);
|
|
7737
|
+
return;
|
|
7738
|
+
}
|
|
7327
7739
|
chrome(`No changes for ${slug}: it is not flagged.`);
|
|
7328
7740
|
return;
|
|
7329
7741
|
}
|
|
7330
|
-
await updateTask(adapter, config, slug, {
|
|
7742
|
+
const { task: unflagged } = await updateTask(adapter, config, slug, {
|
|
7743
|
+
flag: void 0
|
|
7744
|
+
});
|
|
7745
|
+
if (raw.json) {
|
|
7746
|
+
printTask(unflagged);
|
|
7747
|
+
return;
|
|
7748
|
+
}
|
|
7331
7749
|
chrome(`Unflagged ${slug}`);
|
|
7332
7750
|
});
|
|
7333
7751
|
const moveCommand = task.command("move <slug>").description("Move a task to another column and/or another position").option(
|
|
@@ -7359,7 +7777,7 @@ function createCli(opts) {
|
|
|
7359
7777
|
).conflicts(["top", "bottom", "before", "position"])
|
|
7360
7778
|
).addOption(
|
|
7361
7779
|
new Option("--position <n>", "Place at this 0-based index (-1 appends)").argParser(parseLayoutPosition).conflicts(["top", "bottom", "before", "after"])
|
|
7362
|
-
).addHelpText(
|
|
7780
|
+
).option("--json", "Output the resulting task as JSON").addHelpText(
|
|
7363
7781
|
"after",
|
|
7364
7782
|
"\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
7783
|
).action(async (slug, raw) => {
|
|
@@ -7373,6 +7791,10 @@ function createCli(opts) {
|
|
|
7373
7791
|
return;
|
|
7374
7792
|
}
|
|
7375
7793
|
const moved2 = await moveTask(adapter, config, slug, raw.to);
|
|
7794
|
+
if (raw.json) {
|
|
7795
|
+
printTask(moved2);
|
|
7796
|
+
return;
|
|
7797
|
+
}
|
|
7376
7798
|
chrome(`Moved ${moved2.slug} \u2192 ${moved2.frontmatter.status}`);
|
|
7377
7799
|
return;
|
|
7378
7800
|
}
|
|
@@ -7444,6 +7866,10 @@ function createCli(opts) {
|
|
|
7444
7866
|
toStatus,
|
|
7445
7867
|
position
|
|
7446
7868
|
);
|
|
7869
|
+
if (raw.json) {
|
|
7870
|
+
printTask(moved);
|
|
7871
|
+
return;
|
|
7872
|
+
}
|
|
7447
7873
|
const placedAt = position < 0 || position > column.length ? column.length : position;
|
|
7448
7874
|
chrome(
|
|
7449
7875
|
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 +7896,10 @@ function createCli(opts) {
|
|
|
7470
7896
|
"--tag <tag>",
|
|
7471
7897
|
"Filter by tag (comma-separated or repeatable with AND semantics)",
|
|
7472
7898
|
accumulateCommaList
|
|
7899
|
+
).option(
|
|
7900
|
+
"--exclude-tag <tag>",
|
|
7901
|
+
"Leave out tasks carrying any of these tags (comma-separated or repeatable)",
|
|
7902
|
+
accumulateCommaList
|
|
7473
7903
|
).option("--flagged", "Only tasks with a flag set").addOption(
|
|
7474
7904
|
new Option(
|
|
7475
7905
|
"--available",
|
|
@@ -7521,10 +7951,23 @@ function createCli(opts) {
|
|
|
7521
7951
|
})
|
|
7522
7952
|
).slice(0, raw.limit);
|
|
7523
7953
|
if (raw.json) {
|
|
7954
|
+
const relatedOf = createRelatedIndex(
|
|
7955
|
+
raw.archived ? {
|
|
7956
|
+
tasks: (await listTasks(adapter, config)).tasks,
|
|
7957
|
+
archivedTasks: result.tasks,
|
|
7958
|
+
archivedSlugs: taskFileSlugs(result)
|
|
7959
|
+
} : {
|
|
7960
|
+
tasks: result.tasks,
|
|
7961
|
+
archivedTasks: archived?.tasks,
|
|
7962
|
+
archivedSlugs: result.archivedSlugs
|
|
7963
|
+
}
|
|
7964
|
+
);
|
|
7524
7965
|
const tasks = filtered.map((t) => ({
|
|
7525
7966
|
slug: t.slug,
|
|
7526
7967
|
...t.frontmatter,
|
|
7527
7968
|
depends_on: t.frontmatter.depends_on ?? [],
|
|
7969
|
+
related: t.frontmatter.related ?? [],
|
|
7970
|
+
related_tasks: relatedOf(t),
|
|
7528
7971
|
...boardOrder ? { position: boardOrder.positions.get(t.slug) } : {},
|
|
7529
7972
|
...raw.includeBody ? {
|
|
7530
7973
|
body: t.body,
|
|
@@ -7576,6 +8019,10 @@ function createCli(opts) {
|
|
|
7576
8019
|
"--tag <tag>",
|
|
7577
8020
|
"Filter by tag (comma-separated or repeatable with AND semantics)",
|
|
7578
8021
|
accumulateCommaList
|
|
8022
|
+
).option(
|
|
8023
|
+
"--exclude-tag <tag>",
|
|
8024
|
+
"Leave out tasks carrying any of these tags (comma-separated or repeatable)",
|
|
8025
|
+
accumulateCommaList
|
|
7579
8026
|
).option("--flagged", "Only tasks with a flag set").addOption(
|
|
7580
8027
|
new Option(
|
|
7581
8028
|
"--available",
|
|
@@ -7659,6 +8106,13 @@ function createCli(opts) {
|
|
|
7659
8106
|
...searchArchive ? archivedResult?.unreadable ?? [] : []
|
|
7660
8107
|
];
|
|
7661
8108
|
if (raw.json) {
|
|
8109
|
+
const relatedLive = liveResult ?? await listTasks(adapter, config);
|
|
8110
|
+
const relatedArchive = archivedResult ?? await listArchivedTasks(adapter, config);
|
|
8111
|
+
const relatedOf = createRelatedIndex({
|
|
8112
|
+
tasks: relatedLive.tasks,
|
|
8113
|
+
archivedTasks: relatedArchive.tasks,
|
|
8114
|
+
archivedSlugs: taskFileSlugs(relatedArchive)
|
|
8115
|
+
});
|
|
7662
8116
|
const payloadMatches = matches.map((match) => {
|
|
7663
8117
|
const source = candidatesBySlug.get(match.slug);
|
|
7664
8118
|
return {
|
|
@@ -7667,6 +8121,7 @@ function createCli(opts) {
|
|
|
7667
8121
|
status: match.status,
|
|
7668
8122
|
location: locationOf(match.slug),
|
|
7669
8123
|
matched_fields: match.matched_fields,
|
|
8124
|
+
related_tasks: source ? relatedOf(source) : [],
|
|
7670
8125
|
...source && isTaskFlagged(source) ? { flag: source.frontmatter.flag } : {},
|
|
7671
8126
|
...match.snippet !== void 0 ? { snippet: match.snippet } : {},
|
|
7672
8127
|
...match.update_matches ? { update_matches: match.update_matches } : {},
|
|
@@ -7729,10 +8184,50 @@ function createCli(opts) {
|
|
|
7729
8184
|
}
|
|
7730
8185
|
}
|
|
7731
8186
|
});
|
|
7732
|
-
task.command("graph").description("Show the task dependency graph").option("--archived", "Include archived tasks as graph nodes").option("--
|
|
8187
|
+
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(
|
|
8188
|
+
"--depth <n>",
|
|
8189
|
+
"With a slug: levels to walk (1 lists direct neighbors only)",
|
|
8190
|
+
parsePositiveInteger
|
|
8191
|
+
).option("--json", "Emit machine-readable JSON");
|
|
8192
|
+
graphCommand.action(async (slug, raw) => {
|
|
7733
8193
|
const config = await loadCliConfig();
|
|
8194
|
+
if (slug === void 0) {
|
|
8195
|
+
if (raw.blockers || raw.dependents || raw.depth !== void 0) {
|
|
8196
|
+
graphCommand.error(
|
|
8197
|
+
"--blockers, --dependents, and --depth need a task slug."
|
|
8198
|
+
);
|
|
8199
|
+
return;
|
|
8200
|
+
}
|
|
8201
|
+
}
|
|
7734
8202
|
const liveResult = await listTasks(adapter, config);
|
|
7735
8203
|
const archivedResult = raw.archived ? await listArchivedTasks(adapter, config) : void 0;
|
|
8204
|
+
if (slug !== void 0) {
|
|
8205
|
+
const query = queryTaskDependencies(slug, liveResult.tasks, config, {
|
|
8206
|
+
direction: raw.blockers && !raw.dependents ? "blockers" : raw.dependents && !raw.blockers ? "dependents" : "both",
|
|
8207
|
+
depth: raw.depth,
|
|
8208
|
+
archivedTasks: archivedResult?.tasks,
|
|
8209
|
+
// Readiness matches `task list`: an archived dependency is
|
|
8210
|
+
// satisfied whether or not --archived walks into it.
|
|
8211
|
+
archivedSlugs: archivedResult ? taskFileSlugs(archivedResult) : liveResult.archivedSlugs,
|
|
8212
|
+
unreadableSlugs: liveResult.unreadable.map((file) => file.slug)
|
|
8213
|
+
});
|
|
8214
|
+
if (!query) {
|
|
8215
|
+
if (!raw.archived && liveResult.archivedSlugs?.includes(slug)) {
|
|
8216
|
+
graphCommand.error(
|
|
8217
|
+
`Task '${slug}' is archived. Pass --archived to query it.`
|
|
8218
|
+
);
|
|
8219
|
+
} else {
|
|
8220
|
+
graphCommand.error(`Task '${slug}' not found.`);
|
|
8221
|
+
}
|
|
8222
|
+
return;
|
|
8223
|
+
}
|
|
8224
|
+
if (raw.json || !isInteractive) {
|
|
8225
|
+
data(JSON.stringify(query, null, 2));
|
|
8226
|
+
return;
|
|
8227
|
+
}
|
|
8228
|
+
for (const line of formatTaskDependencyQuery(query)) data(line);
|
|
8229
|
+
return;
|
|
8230
|
+
}
|
|
7736
8231
|
const graph = buildTaskDependencyGraph(liveResult.tasks, {
|
|
7737
8232
|
archivedTasks: archivedResult?.tasks,
|
|
7738
8233
|
archivedSlugs: archivedResult ? taskFileSlugs(archivedResult) : void 0
|
|
@@ -7750,6 +8245,9 @@ function createCli(opts) {
|
|
|
7750
8245
|
).option(
|
|
7751
8246
|
"--force",
|
|
7752
8247
|
"Archive a non-done task even when live tasks depend on it"
|
|
8248
|
+
).option(
|
|
8249
|
+
"--json",
|
|
8250
|
+
"Output the archived task as JSON (an array of them with --done)"
|
|
7753
8251
|
).addHelpText(
|
|
7754
8252
|
"after",
|
|
7755
8253
|
"\nA non-done task with live dependents is blocked unless --force is used.\n"
|
|
@@ -7764,6 +8262,17 @@ function createCli(opts) {
|
|
|
7764
8262
|
throw new Error("--force can only be used when archiving one task.");
|
|
7765
8263
|
}
|
|
7766
8264
|
const config = await loadCliConfig();
|
|
8265
|
+
const warnAboutLinksToArchived = async (slugs) => {
|
|
8266
|
+
if (slugs.length === 0) return;
|
|
8267
|
+
const { tasks } = await listTasks(adapter, config);
|
|
8268
|
+
for (const archivedSlug of slugs) {
|
|
8269
|
+
const linking = tasksLinkingTo(tasks, archivedSlug);
|
|
8270
|
+
if (linking.length === 0) continue;
|
|
8271
|
+
output.warning(
|
|
8272
|
+
`${linking.join(", ")} ${linking.length === 1 ? "links" : "link"} to ${archivedSlug}, which is now at archive/${archivedSlug}.md. Update the link, or name ${archivedSlug} in related.`
|
|
8273
|
+
);
|
|
8274
|
+
}
|
|
8275
|
+
};
|
|
7767
8276
|
if (raw.done) {
|
|
7768
8277
|
const { tasks } = await listTasks(adapter, config);
|
|
7769
8278
|
const doneTasks = tasks.filter(
|
|
@@ -7773,16 +8282,29 @@ function createCli(opts) {
|
|
|
7773
8282
|
);
|
|
7774
8283
|
const keep = raw.keep === void 0 && config.done_display.max <= 0 ? doneTasks.length : raw.keep ?? config.done_display.max;
|
|
7775
8284
|
const candidates = doneTasks.slice(keep);
|
|
8285
|
+
const archived = [];
|
|
7776
8286
|
for (const candidate of candidates) {
|
|
7777
|
-
await archiveTask(adapter, config, candidate.slug);
|
|
7778
|
-
chrome(`Archived task: ${candidate.slug}`);
|
|
8287
|
+
archived.push(await archiveTask(adapter, config, candidate.slug));
|
|
8288
|
+
if (!raw.json) chrome(`Archived task: ${candidate.slug}`);
|
|
8289
|
+
}
|
|
8290
|
+
await warnAboutLinksToArchived(archived.map((task2) => task2.slug));
|
|
8291
|
+
if (raw.json) {
|
|
8292
|
+
data(JSON.stringify(archived.map(taskJson), null, 2));
|
|
8293
|
+
return;
|
|
7779
8294
|
}
|
|
7780
8295
|
if (candidates.length === 0) chrome("No done tasks archived.");
|
|
7781
8296
|
return;
|
|
7782
8297
|
}
|
|
7783
8298
|
try {
|
|
7784
|
-
await archiveTask(adapter, config, slug, {
|
|
7785
|
-
|
|
8299
|
+
const archived = await archiveTask(adapter, config, slug, {
|
|
8300
|
+
force: raw.force
|
|
8301
|
+
});
|
|
8302
|
+
if (raw.json) {
|
|
8303
|
+
printTask(archived);
|
|
8304
|
+
} else {
|
|
8305
|
+
chrome(`Archived task: ${slug}`);
|
|
8306
|
+
}
|
|
8307
|
+
await warnAboutLinksToArchived([archived.slug]);
|
|
7786
8308
|
} catch (error) {
|
|
7787
8309
|
if (error instanceof ArchiveBlockedError) {
|
|
7788
8310
|
throw new Error(
|
|
@@ -7792,14 +8314,22 @@ function createCli(opts) {
|
|
|
7792
8314
|
throw error;
|
|
7793
8315
|
}
|
|
7794
8316
|
});
|
|
7795
|
-
task.command("unarchive <slug>").description("Restore an archived task").action(async (slug) => {
|
|
8317
|
+
task.command("unarchive <slug>").description("Restore an archived task").option("--json", "Output the resulting task as JSON").action(async (slug, raw) => {
|
|
7796
8318
|
const config = await loadCliConfig();
|
|
7797
|
-
await unarchiveTask(adapter, config, slug);
|
|
8319
|
+
const restored = await unarchiveTask(adapter, config, slug);
|
|
8320
|
+
if (raw.json) {
|
|
8321
|
+
printTask(restored);
|
|
8322
|
+
return;
|
|
8323
|
+
}
|
|
7798
8324
|
chrome(`Unarchived task: ${slug}`);
|
|
7799
8325
|
});
|
|
7800
|
-
task.command("delete <slug>").description("Delete a task").action(async (slug) => {
|
|
8326
|
+
task.command("delete <slug>").description("Delete a task").option("--json", "Output the deleted slug as JSON").action(async (slug, raw) => {
|
|
7801
8327
|
const config = await loadCliConfig();
|
|
7802
8328
|
await deleteTask(adapter, config, slug);
|
|
8329
|
+
if (raw.json) {
|
|
8330
|
+
data(JSON.stringify({ slug, deleted: true }, null, 2));
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
7803
8333
|
chrome(`Deleted task: ${slug}`);
|
|
7804
8334
|
});
|
|
7805
8335
|
const board = program.command("board").description("Open the board UI");
|
|
@@ -7836,6 +8366,10 @@ function createCli(opts) {
|
|
|
7836
8366
|
"--tag <tag>",
|
|
7837
8367
|
"Filter by tag (comma-separated or repeatable with AND semantics)",
|
|
7838
8368
|
accumulateCommaList
|
|
8369
|
+
).option(
|
|
8370
|
+
"--exclude-tag <tag>",
|
|
8371
|
+
"Leave out tasks carrying any of these tags (comma-separated or repeatable)",
|
|
8372
|
+
accumulateCommaList
|
|
7839
8373
|
).option("--flagged", "Only tasks with a flag set").addHelpText(
|
|
7840
8374
|
"after",
|
|
7841
8375
|
"\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 +8381,7 @@ function createCli(opts) {
|
|
|
7847
8381
|
filters: {
|
|
7848
8382
|
statuses: raw.status,
|
|
7849
8383
|
tags: raw.tag,
|
|
8384
|
+
excludedTags: raw.excludeTag,
|
|
7850
8385
|
assignee: raw.assignee,
|
|
7851
8386
|
priority: raw.priority,
|
|
7852
8387
|
flagged: raw.flagged
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.10.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.10.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsup",
|