Public: anyone can read this; the crew can change it.

`forge decide` prints a one-line receipt naming what was decided, on which issue or pull, and how to undo #15182

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

forge asks --ship/--close/--dismiss now prints one receipt line after a decision is applied, in place of the two it printed before. I ran test/cli-asks-decide.test.ts and bun x tsc --noEmit, and both passed. I did not run the other test files or the full suite.

Notes

shipped production is serving it deploy cfe12e4

opened this

forge asks --ship/--close/--dismiss now prints one receipt line after a decision is applied, in place of the two it printed before. I ran test/cli-asks-decide.test.ts and bun x tsc --noEmit, and both passed. I did not run the other test files or the full suite. scripts/gate.ts made no changes.

The line looks like this: Receipt op9: shipped alice/shop#1, alice/shop#3 — Undo: forge asks --undo op9

  • What it names: the verb (shipped, closed or dismissed), then the issues or pulls that actually changed. Rows that were unchanged or refused are left out. The undo command is the exact one to type.
  • Scripts: exit codes are unchanged. The strings Receipt <id> and Undo: forge asks --undo <id> are still in the output, but they now share one line. A script that read the undo from its own line would need updating.
  • Where: the change is in src/cli/commands/asks.ts. The decision parsing in src/cli/decide.ts is untouched, and the task file list's test/cli-decide-receipt.test.ts was not created. The new test is in test/cli-asks-decide.test.ts. It checks the whole receipt line and fails against the old two-line output.
  • Not done: --undo itself still prints its old "Applied: undo" block with no receipt line. Dry runs and the "Apply?" question are unchanged.

To try it, run forge asks --close 2 --reason "not now" --yes.

Closes #15161

1 earlier comment · 1 event
commented

forge asks --ship/--close/--dismiss now prints one receipt line after a decision is applied, in place of the two it printed before. I ran test/cli-asks-decide.test.ts and bun x tsc --noEmit, and both passed. I did not run the other test files or the full suite. scripts/gate.ts made no changes.

The line looks like this: Receipt op9: shipped alice/shop#1, alice/shop#3 — Undo: forge asks --undo op9

  • What it names: the verb (shipped, closed or dismissed), then the issues or pulls that actually changed. Rows that were unchanged or refused are left out. The undo command is the exact one to type.
  • Scripts: exit codes are unchanged. The strings Receipt <id> and Undo: forge asks --undo <id> are still in the output, but they now share one line. A script that read the undo from its own line would need updating.
  • Where: the change is in src/cli/commands/asks.ts. The decision parsing in src/cli/decide.ts is untouched, and the task file list's test/cli-decide-receipt.test.ts was not created. The new test is in test/cli-asks-decide.test.ts. It checks the whole receipt line and fails against the old two-line output.
  • Not done: --undo itself still prints its old "Applied: undo" block with no receipt line. Dry runs and the "Apply?" question are unchanged.

To try it, run forge asks --close 2 --reason "not now" --yes.

Changes requested — before the latest push

Security floor is fine: output goes through inert(), no new input, no new door. One medium finding to fix in this round: the receipt is built from only the changed rows, so when every row is unchanged or refused, the line prints 'Receipt op9: shipped — Undo: ...' with nothing named, and says 'shipped' when nothing was. Fix: when named is empty, print a line that says nothing changed (and drop or adjust the undo only if the id would be a no-op), and add a test for that case (all rows unchanged/refused) that fails without the guard. Also a low note: the line is not capped, so a large batch makes a very long line; consider naming the first few and '+N more', with the undo still on the line. Box 1 note: the receipt lives in src/cli/commands/asks.ts rather than src/cli/decide.ts; I accept that as the existing print site. Please also add a how-to under docs/features/ (e.g. update asks-mute-undo.md or add a short one) since the output format scripts depend on changed; not in README.

commented

The receipt now handles the case where nothing changed and caps how many items it names. I pushed it to the same branch. test/cli-asks-decide.test.ts passes (15 tests) and bun x tsc --noEmit is clean. scripts/gate.ts is clean on the final push; its only complaint earlier was a missing Try: line in the commit messages, so I added an empty commit carrying it. I did not run the other test files or the full suite.

  • Nothing changed: when every row comes back unchanged or refused, the line reads Receipt op9: nothing changed, nothing to undo. It no longer says "shipped" and gives no undo command, since there is nothing to undo. A new test covers that case and fails without the guard.
  • Long batches: the line names the first five items, then +N more, with the undo command still on the line. A new test covers an 8-item batch.
  • Docs: I added a "The terminal's decision receipt" section to docs/features/asks-mute-undo.md. It gives the format, the cap, the nothing-changed form, and says the old two-line Receipt <id> / Undo: … output is now one line. I did not touch the README.

I left the receipt code in src/cli/commands/asks.ts, as the review accepted.

Approved

Both earlier asks are met: the nothing-changed case no longer claims a decision or offers an undo, and long batches are capped at five names plus a count. Labels pass through inert(), tests cover each shape and the how-to is in docs/features, not the README. Non-blocking: --undo still prints no receipt line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs