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

The terminal opens the board's returns, in the same rows as /board/returns #16798

Merged opened this

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

Merged

The terminal now opens the board's returns, with the same figures and row order as /board/returns. I started from main, not the old branch: mason/10997-… and scout/10997-… aren't on the remote, so I had no check log to read.

Notes

opened this

The terminal now opens the board's returns, with the same figures and row order as /board/returns. I started from main, not the old branch: mason/10997-… and scout/10997-… aren't on the remote, so I had no check log to read.

What changed

  • New screen (src/tui/screens/returns.ts): it reads through readReturns, the same reader the page uses. It shows spent and landed, then "Where it went", then "What did not land, and why" with the failure reasons, then "What cost the most". d cycles the window through 1, 7 and 30 days, and j/k scroll.
  • Gate: the same one as the page. Only someone holding owner facts for at least one repository sees it. For anyone else there is no palette entry, no dashboard line, and a screen reached any other way is empty. The page itself shows such a viewer zeros rather than refusing, so the terminal is slightly stricter.
  • Dashboard (src/tui/screens/dashboard.ts): a "Tokens, 7 days: $X → N landed · … closed with nothing · … still open T opens" line, shown only when something ran. T opens the screen. The palette entry "What the tokens bought" opens it too.
  • Not added: the page's "By pillar", "Reported from outside" and "A run" sections. The issue asked for spent and landed, what did not land, and the costliest.
  • Docs: docs/features/returns-terminal.md.

Tests

  • test/tui-returns.test.ts has four tests:
    • A non-owner gets no lines and no palette entry.
    • For one fixture (an ok run of $1.25 and a failed run of $2.50), every dollar figure on the screen appears on the page, and the failure reason matches.
    • The palette opens the screen, and d cycles 7, 30, 1, 7.
    • T opens it from the dashboard line.
  • The file is in the slow-test list in scripts/gate.ts.
  • bun x tsc --noEmit is clean. I ran this file and nine related ones (hollow, doorless, feature-doors, tui-asks-first, tui-usage-returns and the dashboard tests): 82 pass. bun scripts/gate.ts --explain reports all 32 rules read, none failing. I did not run the full suite: scripts/fast.ts named 3700 files, so I picked the related tests myself.

Reuse: readReturns and returnsRepos for the data and the gate, usd and plural for the figures, and the Scroll/drawLines pattern from bottleneck.ts. I did not run scripts/similar.ts. The page's row wording is reproduced in returnsLines because the page builds HTML and the screen builds plain lines.

Try it: SSH in as an owner with some runs in the last week, press T on the dashboard, then d.

Closes #16267

2 earlier comments
commented

The terminal now opens the board's returns, with the same figures and row order as /board/returns. I started from main, not the old branch: mason/10997-… and scout/10997-… aren't on the remote, so I had no check log to read.

What changed

  • New screen (src/tui/screens/returns.ts): it reads through readReturns, the same reader the page uses. It shows spent and landed, then "Where it went", then "What did not land, and why" with the failure reasons, then "What cost the most". d cycles the window through 1, 7 and 30 days, and j/k scroll.
  • Gate: the same one as the page. Only someone holding owner facts for at least one repository sees it. For anyone else there is no palette entry, no dashboard line, and a screen reached any other way is empty. The page itself shows such a viewer zeros rather than refusing, so the terminal is slightly stricter.
  • Dashboard (src/tui/screens/dashboard.ts): a "Tokens, 7 days: $X → N landed · … closed with nothing · … still open T opens" line, shown only when something ran. T opens the screen. The palette entry "What the tokens bought" opens it too.
  • Not added: the page's "By pillar", "Reported from outside" and "A run" sections. The issue asked for spent and landed, what did not land, and the costliest.
  • Docs: docs/features/returns-terminal.md.

Tests

  • test/tui-returns.test.ts has four tests:
    • A non-owner gets no lines and no palette entry.
    • For one fixture (an ok run of $1.25 and a failed run of $2.50), every dollar figure on the screen appears on the page, and the failure reason matches.
    • The palette opens the screen, and d cycles 7, 30, 1, 7.
    • T opens it from the dashboard line.
  • The file is in the slow-test list in scripts/gate.ts.
  • bun x tsc --noEmit is clean. I ran this file and nine related ones (hollow, doorless, feature-doors, tui-asks-first, tui-usage-returns and the dashboard tests): 82 pass. bun scripts/gate.ts --explain reports all 32 rules read, none failing. I did not run the full suite: scripts/fast.ts named 3700 files, so I picked the related tests myself.

Reuse: readReturns and returnsRepos for the data and the gate, usd and plural for the figures, and the Scroll/drawLines pattern from bottleneck.ts. I did not run scripts/similar.ts. The page's row wording is reproduced in returnsLines because the page builds HTML and the screen builds plain lines.

Try it: SSH in as an owner with some runs in the last week, press T on the dashboard, then d.

commented

The terminal now has a returns screen. It opens from the T key on the dashboard's Tokens line, and d cycles the window through 1, 7 and 30 days.

The check failed on one rule, "name the issue": no commit message named the issue the new screen serves. I added a commit with Direction: the terminal shows what the board's tokens returned, as the web board does (#16267). After that, bun scripts/gate.ts printed no failures. I pushed it, but I haven't seen the forge's own re-run yet. I didn't run tsc or the tests again, since the only change is an empty commit.

The gate also left two duplicate-function notes, which I did not act on:

  • returnsScreen: it is 0.68 similar to datasetScreen.
  • boot in test/tui-returns.test.ts: it is a copy of the one in test/tui-quotas.test.ts. Sharing it would mean editing an existing test file for a pull that doesn't otherwise touch it.

To try it: sign in over ssh as the owner, press T on the Tokens line of the dashboard, then d to cycle the window.

🤖 Generated with Claude Code

commented

The four failing tests came from one line in docs/features/returns-terminal.md. Its front matter named the topic "Know what the crew spent", and docs/features/README.md has no such heading. I changed it to "Bring your own AI", the topic the sibling cost notes (cost-ledger.md, cost-days.md) use.

test/feature-orphans.test.ts and test/feature-front-matter.test.ts now pass here (15 tests), and bun scripts/gate.ts printed no failures. I pushed the fix but haven't seen the forge's re-run, and I didn't run the full suite or tsc locally.

If "Bring your own AI" is the wrong home for a returns note, the alternative is to add a new ### heading to the index.

Pull description: the terminal now opens the board's returns, with a returns screen, a dashboard Tokens line opened with T, and d cycling the window through 1, 7 and 30 days (#16267). To try it: sign in over ssh as the owner, press T on the dashboard's Tokens line, then d.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs