monoban 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,7 +36,7 @@ monoban done SHOP-14
36
36
  | **Coding agents** | `setup claude` · `setup codex` · `runner` · `run` · `runs` · `agentpipe install` |
37
37
  | **This machine** | `doctor` (what's missing, and how to fix it) · `upgrade` |
38
38
 
39
- `monoban <command> --help` says more. Columns match loosely (`move SHOP-14 in-prog`), and Tab completes
39
+ `monoban <command> --help` says more, and [the guide](https://monoban.dev/guide) walks through it all. Columns match loosely (`move SHOP-14 in-prog`), and Tab completes
40
40
  commands, projects, columns and tasks (`monoban completion zsh`).
41
41
 
42
42
  ## Coding agents
package/dist/index.mjs CHANGED
@@ -5790,7 +5790,9 @@ const LIMITS = {
5790
5790
  linkTitle: 200,
5791
5791
  /** A comment on a task, in characters. */
5792
5792
  commentBody: 2e4,
5793
- commentsPerTask: 500
5793
+ commentsPerTask: 500,
5794
+ /** Why a task won't be done (archiving it outside Done), in characters. */
5795
+ archiveReason: 500
5794
5796
  };
5795
5797
  //#endregion
5796
5798
  //#region ../../packages/contract/src/dates.ts
@@ -6660,6 +6662,8 @@ strictObject({
6660
6662
  /** A task's tags: ids of its project's tags or shared ones, at most 10, each once. */
6661
6663
  const tagIds = array(IdSchema).max(LIMITS.tagsPerTask).refine((ids) => new Set(ids.map((id) => id.toLowerCase())).size === ids.length, "Each tag once").meta({ uniqueItems: true });
6662
6664
  const taskTitle = text().min(1, "Required").max(LIMITS.taskTitle);
6665
+ /** Why a task won't be done. */
6666
+ const archiveReason = text().min(1, "Required").max(LIMITS.archiveReason);
6663
6667
  /** Markdown; kept as written (not trimmed). */
6664
6668
  const taskDescription = string().max(LIMITS.taskDescription).regex(/^[^\u0000]*$/, "Can't contain NUL characters");
6665
6669
  string().regex(/^[A-Za-z][A-Za-z0-9]{1,4}-[1-9][0-9]{0,8}$/, "A task reference like MON-12").meta({ example: "MON-12" });
@@ -6735,10 +6739,22 @@ strictObject({
6735
6739
  /** Its tags from now on (all of them: the list replaces the old one). */
6736
6740
  tagIds: tagIds.optional(),
6737
6741
  /** The day you plan to work on it; null takes the date off. */
6738
- scheduledOn: DaySchema.nullable().optional()
6739
- }).refine((patch) => Object.keys(patch).length > 0, "Send at least one field to change").meta({
6742
+ scheduledOn: DaySchema.nullable().optional(),
6743
+ /**
6744
+ * true: archive it now (off the board). In the Done column (or with `columnId` moving it there) that's
6745
+ * done; anywhere else it's "won't do", and needs an `archiveReason` (else 400). false: back on the board
6746
+ * (in Done, for another archiveAfterDays), without its reason.
6747
+ */
6748
+ archived: boolean().optional(),
6749
+ /** Why it won't be done, with `archived: true`. Archiving it again with another reason replaces it. */
6750
+ archiveReason: archiveReason.optional()
6751
+ }).refine((patch) => Object.keys(patch).length > 0, "Send at least one field to change").refine((patch) => patch.archiveReason === void 0 || patch.archived === true, {
6752
+ message: "archiveReason goes with archived: true",
6753
+ path: ["archiveReason"]
6754
+ }).meta({
6740
6755
  id: "TaskPatch",
6741
- minProperties: 1
6756
+ minProperties: 1,
6757
+ dependentRequired: { archiveReason: ["archived"] }
6742
6758
  });
6743
6759
  strictObject({
6744
6760
  /** The project's key (MON). */
@@ -6775,6 +6791,10 @@ strictObject({
6775
6791
  createdAt: datetime({ offset: true }).optional(),
6776
6792
  /** When it came into its column, so an undone delete doesn't start its archive clock again. */
6777
6793
  columnSince: Timestamp.optional(),
6794
+ /** When it was archived by hand, so an undone delete leaves it archived. */
6795
+ archivedAt: Timestamp.nullable().optional(),
6796
+ /** Why it won't be done, with `archivedAt`. */
6797
+ archiveReason: archiveReason.nullable().optional(),
6778
6798
  ref: string().optional(),
6779
6799
  version: string().optional(),
6780
6800
  updatedAt: string().optional()
@@ -6796,6 +6816,13 @@ const TaskSchema = object({
6796
6816
  scheduledOn: DaySchema.nullable(),
6797
6817
  /** When it came into its column. In the Done column for longer than its project's archiveAfterDays, it's archived. */
6798
6818
  columnSince: Timestamp,
6819
+ /**
6820
+ * When it was archived by hand, or null: done (in the Done column), or won't do (anywhere, with an
6821
+ * `archiveReason`). Moving it to another column clears it.
6822
+ */
6823
+ archivedAt: Timestamp.nullable(),
6824
+ /** Why it won't be done, when it was archived with a reason; else null. */
6825
+ archiveReason: string().nullable(),
6799
6826
  version: Version,
6800
6827
  createdAt: Timestamp,
6801
6828
  updatedAt: Timestamp
@@ -6901,7 +6928,12 @@ discriminatedUnion("kind", [
6901
6928
  status: _enum(RUN_ENDINGS$1),
6902
6929
  reason: string().nullable(),
6903
6930
  prUrl: string().nullable()
6904
- }).meta({ id: "EventRunEnding" }) })
6931
+ }).meta({ id: "EventRunEnding" }) }),
6932
+ event("archived", {
6933
+ column: EventColumn,
6934
+ reason: string().nullable()
6935
+ }),
6936
+ event("unarchived", { column: EventColumn })
6905
6937
  ]).meta({ id: "TaskEvent" });
6906
6938
  /**
6907
6939
  * Every list takes `?limit=` and `?cursor=` and answers `{ <items>: [...], nextCursor }` (keyset
@@ -7127,9 +7159,12 @@ const SEARCH_LIMITS = {
7127
7159
  PageQuerySchema.extend({ q: string().trim().min(1).max(SEARCH_LIMITS.length).regex(/^[^\u0000]*$/).describe(`Words, all of which a task must have (any case): in its title or description, as its tag's name, or as its reference (\`MON-12\`). At most ${SEARCH_LIMITS.words} words.`) });
7128
7160
  TaskSchema.extend({
7129
7161
  ...TaskPlace,
7130
- /** Done long enough ago that its board leaves it out (its project's archive setting). */
7162
+ /** Archived: off its board (archived by hand, or done longer ago than its project's archive setting). */
7131
7163
  archived: boolean()
7132
7164
  }).meta({ id: "FoundTask" });
7165
+ object({
7166
+ /** How many tasks it archived (the ones in the Done column that weren't archived yet). */
7167
+ archived: number$1().int().nonnegative() }).meta({ id: "ArchivedDone" });
7133
7168
  object({
7134
7169
  project: ProjectSchema,
7135
7170
  columns: array(ColumnSchema),
@@ -7139,9 +7174,24 @@ object({
7139
7174
  tasks: array(TaskSchema),
7140
7175
  /** How many archived tasks it leaves out. */
7141
7176
  archived: number$1().int().nonnegative(),
7177
+ /** The same, per column (by column id): only the columns that have any. */
7178
+ archivedIn: record(string(), number$1().int().positive()),
7142
7179
  /** More tasks than the board returns at once (2,000): load the rest from the paginated task list. */
7143
- truncated: boolean()
7180
+ truncated: boolean(),
7181
+ /**
7182
+ * Goes up with every change to what the board shows (not with a done task that the days archive):
7183
+ * `GET /v1/sync` answers it without loading the board.
7184
+ */
7185
+ version: string().regex(/^\d+$/).meta({ example: "42" })
7144
7186
  }).meta({ id: "Board" });
7187
+ object({
7188
+ /** Changes with the project list (`GET /v1/projects`): a project made, changed, moved or deleted, or a task count. */
7189
+ projects: string(),
7190
+ /** The board's `version` (`GET /v1/projects/{key}/board`), with `project`. */
7191
+ board: string().nullable(),
7192
+ /** The notes' `version` (`GET /v1/projects/{key}/notes`), with `project`. */
7193
+ notes: string().nullable()
7194
+ }).meta({ id: "Sync" });
7145
7195
  /** Notes text: kept as written (not trimmed). */
7146
7196
  const notesText = string().max(LIMITS.projectNotes).regex(/^[^\u0000]*$/, "Can't contain NUL characters");
7147
7197
  object({
@@ -7900,6 +7950,14 @@ function describeEvent(event, now = today()) {
7900
7950
  verb: "commented",
7901
7951
  detail: event.comment.excerpt
7902
7952
  };
7953
+ case "archived": return {
7954
+ verb: "archived",
7955
+ detail: `in ${event.column.name}${event.reason ? `: ${event.reason}` : ""}`
7956
+ };
7957
+ case "unarchived": return {
7958
+ verb: "unarchived",
7959
+ detail: `in ${event.column.name}`
7960
+ };
7903
7961
  case "run_started": return {
7904
7962
  verb: "run started",
7905
7963
  detail: `${event.run.adapter} on ${event.run.runner}`
@@ -8014,18 +8072,24 @@ function matchColumn(columns, query) {
8014
8072
  }
8015
8073
  const DAY_MS = 864e5;
8016
8074
  /**
8017
- * Whether a task is archived: in its project's Done column (`doneColumnId`: doneColumn()) for longer
8018
- * than the project's `archiveAfterDays` (null: never). The API applies the same rule when it reads.
8075
+ * Whether a task is archived: archived by hand (in any column: in Done it's done, elsewhere it won't be), or
8076
+ * in its project's Done column (`doneColumnId`: doneColumn()) for longer than the project's
8077
+ * `archiveAfterDays` (null: never). The API applies the same rule when it reads.
8019
8078
  */
8020
8079
  function isArchived(task, doneColumnId, archiveAfterDays, now = Date.now()) {
8021
- if (archiveAfterDays === null || !doneColumnId || task.columnId !== doneColumnId) return false;
8022
- return Date.parse(task.columnSince) < now - archiveAfterDays * DAY_MS;
8080
+ if (task.archivedAt) return true;
8081
+ if (!doneColumnId || task.columnId !== doneColumnId || archiveAfterDays === null) return false;
8082
+ return archivedByTime(task, archiveAfterDays, now);
8083
+ }
8084
+ /** Whether a task has been in its column for longer than `archiveAfterDays` (in Done, that archives it). */
8085
+ function archivedByTime(task, archiveAfterDays, now = Date.now()) {
8086
+ return archiveAfterDays !== null && Date.parse(task.columnSince) < now - archiveAfterDays * DAY_MS;
8023
8087
  }
8024
8088
  strictObject({ email: email().max(254).meta({ example: "ada@example.com" }) }).meta({ id: "WaitlistJoin" });
8025
8089
  //#endregion
8026
8090
  //#region src/version.ts
8027
8091
  /** This CLI's version, from package.json (set at build time by tsdown, and by vitest in tests). */
8028
- const VERSION = "1.6.0";
8092
+ const VERSION = "1.7.0";
8029
8093
  /** Sent as X-Monoban-Client, and shown in Devices & tokens. */
8030
8094
  const CLIENT = `cli/${VERSION}`;
8031
8095
  //#endregion
@@ -11589,9 +11653,9 @@ const RELEASES = `https://github.com/thiagodmont/homebrew-tap/releases`;
11589
11653
  * agentpipe comes with a new monoban: change these three lines (from the release's checksums.txt) and release.
11590
11654
  */
11591
11655
  const AGENTPIPE = {
11592
- version: "0.2.0",
11593
- wheelSha256: "3ae6d9a2d8d9c5fe5b866a447a78bd4888c0e658b5bab16e0dc26ff68e63364c",
11594
- requirementsSha256: "5a5de7c5a55e2e0eff86a56661244b888a91551d36d69fbc01ee8ec5020f85b5"
11656
+ version: "0.5.0",
11657
+ wheelSha256: "e69545311cfc99f09df165facf7fb74540d3b0903400ed5311f8245cfba00a89",
11658
+ requirementsSha256: "41a8d073b0087efb80efafeb6a2b4750340d0f64920159cd4c723ed9167d0a98"
11595
11659
  };
11596
11660
  const agentpipeWheel = (version) => `agentpipe-${version}-py3-none-any.whl`;
11597
11661
  const agentpipeRequirements = (version) => `agentpipe-${version}-requirements.txt`;
@@ -11696,7 +11760,7 @@ async function latestVersion(ctx) {
11696
11760
  async function upgrade(ctx, options, kind = thisInstall()) {
11697
11761
  const latest = await latestVersion(ctx);
11698
11762
  const { how, command } = UPGRADE[kind];
11699
- const outdated = latest !== null && newer(latest, "1.6.0");
11763
+ const outdated = latest !== null && newer(latest, "1.7.0");
11700
11764
  if (options.json) {
11701
11765
  ctx.out(JSON.stringify({
11702
11766
  version: VERSION,
@@ -12665,7 +12729,7 @@ async function projects(ctx, options) {
12665
12729
  const tasks = (p) => `${p.taskCount} ${p.taskCount === 1 ? "task" : "tasks"}`;
12666
12730
  /**
12667
12731
  * `monoban list [COLUMN…]`: the board, by column (every column, or the ones named); `--tag` keeps a tag's
12668
- * tasks. `--archived`: the archived ones instead (done a while ago, off the board).
12732
+ * tasks. `--archived`: the archived ones instead (done a while ago, or won't do: with why).
12669
12733
  */
12670
12734
  async function list(ctx, columnQueries, options) {
12671
12735
  const api = apis(ctx).signedIn;
@@ -12710,7 +12774,9 @@ async function list(ctx, columnQueries, options) {
12710
12774
  const pad = " ".repeat(Math.max(0, titleWidth - visibleLength(title)));
12711
12775
  ctx.out(` ${dim(t.ref.padEnd(refWidth))} ${title}${pad} ${dim(meta(t).padStart(metaWidth))}`.trimEnd());
12712
12776
  }
12713
- if (!options.archived && board.archived > 0 && column.id === done && options.tag === void 0) ctx.out(dim(` + ${board.archived} archived (monoban list --archived)`));
12777
+ for (const t of options.archived ? inColumn : []) if (t.archiveReason) ctx.out(dim(` ${" ".repeat(refWidth)} won't do: ${oneLine(t.archiveReason)}`));
12778
+ const hidden = board.archivedIn[column.id] ?? 0;
12779
+ if (!options.archived && hidden > 0 && options.tag === void 0) ctx.out(dim(` + ${hidden} archived (monoban list --archived)`));
12714
12780
  }
12715
12781
  }
12716
12782
  /**
@@ -12768,14 +12834,16 @@ async function show(ctx, ref, options) {
12768
12834
  if (options.json) return printJson$1(ctx, taskJson(task, columns, tags));
12769
12835
  const { bold, dim } = ctx.style;
12770
12836
  const doneId = doneColumn(columns)?.id;
12771
- const archived = task.columnId === doneId && isArchived(task, doneId, (await unwrap(api.GET("/v1/projects/{key}", { params: { path: { key } } }))).project.archiveAfterDays);
12772
- const column = `${columns.find((c) => c.id === task.columnId)?.name ?? "?"}${archived ? " · archived" : ""}`;
12837
+ const archived = Boolean(task.archivedAt) || task.columnId === doneId && isArchived(task, doneId, (await unwrap(api.GET("/v1/projects/{key}", { params: { path: { key } } }))).project.archiveAfterDays);
12838
+ const mark = task.archiveReason && archived ? " · won't do" : archived ? " · archived" : "";
12839
+ const column = `${columns.find((c) => c.id === task.columnId)?.name ?? "?"}${mark}`;
12773
12840
  const list = checklist(task.description);
12774
12841
  ctx.out(`${bold(task.ref)} ${bold(task.title)}`);
12775
12842
  const when = task.scheduledOn ? ` · ${planned(task, columns)}` : "";
12776
12843
  ctx.out(dim(`${column}${when} · created ${ago(task.createdAt)} · updated ${ago(task.updatedAt)}`));
12777
12844
  const own = tagsOfTask(task, tags);
12778
12845
  if (own.length) ctx.out(tagWords(own, ctx.style));
12846
+ if (task.archiveReason && archived) ctx.out(`Won't do: ${task.archiveReason}`);
12779
12847
  if (list) ctx.out(dim(`Checklist ${list.done}/${list.all}`));
12780
12848
  if (task.links.length) {
12781
12849
  const width = Math.max(...task.links.map((l) => linkLabel(l).length));
@@ -14150,7 +14218,7 @@ async function checks(ctx, deps = {}) {
14150
14218
  const found = [];
14151
14219
  const latest = await (deps.latest ?? latestVersion)(ctx);
14152
14220
  const upgrade = UPGRADE[thisInstall()].command;
14153
- found.push(latest && newer(latest, "1.6.0") ? {
14221
+ found.push(latest && newer(latest, "1.7.0") ? {
14154
14222
  name: "monoban",
14155
14223
  status: "warn",
14156
14224
  detail: `${VERSION}; ${latest} is out`,
@@ -15586,7 +15654,7 @@ go?"). Once the user agrees:
15586
15654
  | Command | Does |
15587
15655
  | --- | --- |
15588
15656
  | \`monoban projects\` | the projects and their keys |
15589
- | \`monoban list [COLUMN…] [--tag TAG] [--archived]\` | tasks by column (--archived: the ones done long ago) |
15657
+ | \`monoban list [COLUMN…] [--tag TAG] [--archived]\` | tasks by column (--archived: done long ago, or won't do) |
15590
15658
  | \`monoban show MON-12\` | one task in full |
15591
15659
  | \`monoban log MON-12 [-n COUNT]\` | what happened to it, newest first |
15592
15660
  | \`monoban comments MON-12 [-n COUNT]\` | its latest comments |
@@ -15860,7 +15928,7 @@ function program(ctx) {
15860
15928
  cli.command("projects").description("List your projects and their keys").addOption(json()).action(async (options) => projects(await ctx(), options));
15861
15929
  cli.command("link").argument("[key]", "the project (else the one already linked, or your only one)").description("Link a project to this clone's GitHub repository, so commands here use it").addOption(json()).action(async (key, options) => link(await ctx(), key, options));
15862
15930
  cli.command("unlink").description("Undo `monoban link` for this clone's repository").addOption(json()).action(async (options) => unlink(await ctx(), options));
15863
- cli.command("list").alias("ls").argument("[columns...]", "only these columns (any case; a prefix works: `back`, `inp`)").description("Show the board's tasks by column").option("-t, --tag <tag>", "only tasks with this tag").option("--archived", "the archived tasks instead (done a while ago, off the board)").addOption(project()).addOption(json()).action(async (columns, options) => list(await ctx(), columns, options));
15931
+ cli.command("list").alias("ls").argument("[columns...]", "only these columns (any case; a prefix works: `back`, `inp`)").description("Show the board's tasks by column").option("-t, --tag <tag>", "only tasks with this tag").option("--archived", "the archived tasks instead (done a while ago, or won't do), with why").addOption(project()).addOption(json()).action(async (columns, options) => list(await ctx(), columns, options));
15864
15932
  cli.command("show").argument("<task>", "like MON-12").description("Show a task: title, column, tags, checklist and description").addOption(json()).action(async (ref, options) => show(await ctx(), ref, options));
15865
15933
  cli.command("log").argument("<task>", "like MON-12").description("Show what happened to a task, newest first: created, moved, edited, tags, links").option("-n, --number <count>", "how many events (default 20)").addOption(json()).action(async (ref, options) => log(await ctx(), ref, options));
15866
15934
  cli.command("comment").argument("<task>", "like MON-12").argument("<text...>", "what to say, in Markdown (- reads it from stdin)").description("Comment on a task").addOption(json()).action(async (ref, words, options) => comment(await ctx(), ref, words, options));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoban",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Your monoban.dev kanban board in the terminal: add, move and start tasks, and hand them to coding agents.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://monoban.dev",
@@ -29,17 +29,17 @@
29
29
  "LICENSE"
30
30
  ],
31
31
  "optionalDependencies": {
32
- "@napi-rs/keyring": "^2.1.1"
32
+ "@napi-rs/keyring": "^2.1.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@monoban/contract": "0.0.0",
36
36
  "@types/bun": "~1.4.3",
37
37
  "@types/node": "^24.19.2",
38
- "@vitest/coverage-v8": "^5.0.4",
38
+ "@vitest/coverage-v8": "^5.0.5",
39
39
  "commander": "^15.0.0",
40
40
  "tsdown": "^0.23.1",
41
41
  "typescript": "^7.0.2",
42
- "vitest": "^5.0.4"
42
+ "vitest": "^5.0.5"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=22.12"