kanbo-cli 0.1.3 → 0.2.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/dist/cli.cjs CHANGED
@@ -3084,7 +3084,7 @@ var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin((
3084
3084
  * `package.version`. A build carries it as a literal; running from source
3085
3085
  * (tests, `tsx`) reads the package's own `package.json` instead.
3086
3086
  */
3087
- const KANBO_PACKAGE_VERSION = "0.1.3";
3087
+ const KANBO_PACKAGE_VERSION = "0.2.0";
3088
3088
  /**
3089
3089
  * Every exit code this tool promises, and what it means — the capabilities
3090
3090
  * manifest's `exitCodes` reads this rather than naming the codes again. `0` and
@@ -10789,15 +10789,12 @@ async function approve(store, issueId, input, actor, scope) {
10789
10789
  * leaves even says "returned by you".
10790
10790
  */
10791
10791
  async function returnCard(store, issueId, input, actor, scope) {
10792
- if (actor.kind !== "user") throw new BoardError("board_return_requires_user", {
10793
- issueId,
10794
- actorKind: actor.kind
10795
- });
10796
10792
  return await runBoardWrite(store, async ({ tx }) => {
10793
+ await ensureDefaultColumns(tx, (await requireCard$1(tx, issueId)).workspaceId, { tx });
10794
+ const target = await assertReturnable(tx, issueId, input, actor);
10797
10795
  const card = await requireCard$1(tx, issueId);
10798
- const columns = await ensureDefaultColumns(tx, card.workspaceId, { tx });
10799
10796
  const updates = {
10800
- statusId: (input.toStatusName ? await requireColumn(tx, card.workspaceId, input.toStatusName) : previousColumn(columns, card)).id,
10797
+ statusId: target.id,
10801
10798
  waitingFor: null,
10802
10799
  updatedAt: currentUnixSeconds()
10803
10800
  };
@@ -10818,6 +10815,27 @@ async function returnCard(store, issueId, input, actor, scope) {
10818
10815
  };
10819
10816
  }, scope);
10820
10817
  }
10818
+ /**
10819
+ * Every reason `returnCard` would refuse, asked on reads alone, and the column
10820
+ * the card would go back to when none applies.
10821
+ *
10822
+ * `returnCard` asks exactly this inside its write. A caller that has to undo
10823
+ * something of its own before the return — stop listening for the approval the
10824
+ * card is waiting on, say — asks it first, so a return the board refuses leaves
10825
+ * that untouched. The refusals are the same `BoardError` codes: an actor who is
10826
+ * not a person (`board_return_requires_user`), a card that is not there
10827
+ * (`issue_not_found`), a named column the workspace does not hold
10828
+ * (`issue_status_not_found`), and a card already in the first column with no
10829
+ * column named (`board_return_no_previous_column`).
10830
+ */
10831
+ async function assertReturnable(store, issueId, input, actor) {
10832
+ if (actor.kind !== "user") throw new BoardError("board_return_requires_user", {
10833
+ issueId,
10834
+ actorKind: actor.kind
10835
+ });
10836
+ const card = await requireCard$1(store, issueId);
10837
+ return input.toStatusName ? await requireColumn(store, card.workspaceId, input.toStatusName) : previousColumn(await listColumns(store, card.workspaceId), card);
10838
+ }
10821
10839
  /** Write a comment on the card, as the actor unless the caller names another author. */
10822
10840
  async function addComment(store, input, actor, scope) {
10823
10841
  return await runBoardWrite(store, async ({ tx }) => {
@@ -11695,6 +11713,7 @@ function createBoardOps(store) {
11695
11713
  waitApproval: async (issueId, input, actor, scope) => await waitApproval(store, issueId, input, actor, scope),
11696
11714
  approve: async (issueId, input, actor, scope) => await approve(store, issueId, input, actor, scope),
11697
11715
  returnCard: async (issueId, input, actor, scope) => await returnCard(store, issueId, input, actor, scope),
11716
+ assertReturnable: async (issueId, input, actor) => await assertReturnable(store, issueId, input, actor),
11698
11717
  readApproval: async (issueId) => await readApproval(store, issueId),
11699
11718
  linkPullRequest: async (issueId, urlOrRef, actor, scope) => await linkPullRequest(store, issueId, urlOrRef, actor, scope),
11700
11719
  unlinkPullRequest: async (issueId, linkId, actor, scope) => await unlinkPullRequest(store, issueId, linkId, actor, scope),
@@ -43395,21 +43414,6 @@ function sendBoardPage(response, pathname, assets) {
43395
43414
  * reason turned around: the answer will be yes once the card meets them, and
43396
43415
  * `details.unmet` says what is missing.
43397
43416
  *
43398
- * The five failures about where a board is kept read the same rule. A database
43399
- * that holds no board this build can speak for is 409 — the setting is there,
43400
- * the board behind it is not yet, and `board-storage prepare` is what settles
43401
- * that — and one nobody could reach at all is 503, because nothing about the
43402
- * request was wrong. A workspace naming no board at all is 404: the caller
43403
- * asked about a setting that is not there. A board still holding cards when
43404
- * somebody asks to point the workspace elsewhere is 409, because the answer
43405
- * would have been yes on an empty board and `board-storage migrate` is what
43406
- * makes it one. An operation naming cards from two different boards is 400: no
43407
- * transaction reaches both, so the caller asked for something that cannot be
43408
- * done. A copy that would land on a card number or a column name the target
43409
- * already holds under a different id is 409 for the same reason the others
43410
- * are: the answer would have been yes on a target that did not hold that
43411
- * board, and `details.conflicts` names every value that clashed.
43412
- *
43413
43417
  * A failure may also be renamed here: the package names its codes after the
43414
43418
  * board, while every error the `/issues` routes answer with is named after the
43415
43419
  * issue, and a client matching on `issue_*` should not have to learn a second
@@ -43431,10 +43435,6 @@ const BOARD_ERROR_RESPONSES = {
43431
43435
  message: "The card does not meet what that column asks for yet",
43432
43436
  code: "issue_column_rules_unmet"
43433
43437
  },
43434
- board_copy_conflict: {
43435
- status: 409,
43436
- message: "That board already holds cards or columns of this workspace under the same numbers or names; nothing was copied"
43437
- },
43438
43438
  board_entry_rule_invalid: {
43439
43439
  status: 400,
43440
43440
  message: "Unknown column entry rule"
@@ -43443,10 +43443,6 @@ const BOARD_ERROR_RESPONSES = {
43443
43443
  status: 400,
43444
43444
  message: "Execution mode cannot change once the card has been launched"
43445
43445
  },
43446
- board_mixed_workspaces: {
43447
- status: 400,
43448
- message: "Those cards are not all on the same board"
43449
- },
43450
43446
  board_pull_request_invalid: {
43451
43447
  status: 400,
43452
43448
  message: "Not a GitHub pull request: give its URL or owner/repo#number"
@@ -43506,22 +43502,6 @@ const BOARD_ERROR_RESPONSES = {
43506
43502
  status: 400,
43507
43503
  message: "A sprint cannot start after it is due"
43508
43504
  },
43509
- board_storage_not_configured: {
43510
- status: 404,
43511
- message: "This workspace names no board storage"
43512
- },
43513
- board_storage_not_empty: {
43514
- status: 409,
43515
- message: "That board still holds cards of this workspace; move them with migrate before changing where the board is kept"
43516
- },
43517
- board_storage_not_prepared: {
43518
- status: 409,
43519
- message: "That board has not been prepared yet"
43520
- },
43521
- board_storage_unavailable: {
43522
- status: 503,
43523
- message: "That board could not be reached"
43524
- },
43525
43505
  issue_comment_delete_requires_user: {
43526
43506
  status: 403,
43527
43507
  message: "Only a person can delete a comment the board wrote"