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

The terminal shows spend, cost and returns, and those pages leave doorless-allow.json #15360

Merged opened this

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

Merged

Spend now has a terminal screen, and bun scripts/doorless.ts --write pruned the four entries (97 → 93). I haven't run the full suite; the forge's check does that on this push. What changed Spend: src/tui/screens/spend.ts is new and opens from the palette as "Spend", for forge admins like the page.

Notes

shipped production is serving it deploy 3fede26

opened this

Spend now has a terminal screen, and bun scripts/doorless.ts --write pruned the four entries (97 → 93). I haven't run the full suite; the forge's check does that on this push.

What changed

  • Spend: src/tui/screens/spend.ts is new and opens from the palette as "Spend", for forge admins like the page. It lists each span's total, then credential, app, agent, issue and run kind across the last 5 hours, today and 7 days, then the ten costliest runs. It reads readSpend, the same call the page makes. It formats figures with the page's own usd and tokens, so I exported usd from src/web/pages/spend.ts.
  • Cost and returns: the Usage screen (src/tui/screens/usage.ts) already read costDays and readReturns, so I added no code for them. docs/features/spend-terminal.md names all four page files and the src/tui files that show them.
  • Doorless list: scripts/doorless-allow.json loses spend.ts, spend-tab.ts, cost.ts and returns.ts.

Tests

  • test/tui-spend.test.ts seeds a $4.50 run and checks the week total is $4.50 in the page's markup, in the terminal rows and on the rendered screen. It also checks that a non-admin is shown no figures.
  • test/palette-roster.test.ts now lists "Spend" for admin people and for admin agents.
  • Passing: tsc --noEmit, the new test, tui-money, tui-usage, tui-usage-returns, cost-days, palette-roster, doorless, palette-entries and palette. I ran those by hand because scripts/fast.ts found 3,312 of 4,043 test files affected and nothing short of a full run covers that.
  • gate.ts --fix rewrapped comments, which I committed. It still prints two "one implementation?" similarity notes: spendScreen against weekCardScreen, and the new test's open helper against the one in test/tui-scorecard-spend.test.ts. They are not blocking, and I left both as they are.

Left out

  • No terminal view of /board/returns's per-pillar and costliest-issue sections, and none of the Spend page's per-app Fleet graph links; the terminal keeps the existing one-line returns summary on Usage.
  • Spend has no per-app narrowing.
  • The Spend screen is read once when it opens, with no refresh.

Try it

  1. Connect with FORGE_APP_SSH as a forge admin, press : and type Spend, then press enter.
  2. Check the totals against /settings/spend.
  3. For cost and returns, open Usage and press [ or ].

I never pushed docs/features/spend-terminal.md or the screen with a separate review block, since no page changed.

Closes #15353

2 earlier comments
commented

Spend now has a terminal screen, and bun scripts/doorless.ts --write pruned the four entries (97 → 93). I haven't run the full suite; the forge's check does that on this push.

What changed

  • Spend: src/tui/screens/spend.ts is new and opens from the palette as "Spend", for forge admins like the page. It lists each span's total, then credential, app, agent, issue and run kind across the last 5 hours, today and 7 days, then the ten costliest runs. It reads readSpend, the same call the page makes. It formats figures with the page's own usd and tokens, so I exported usd from src/web/pages/spend.ts.
  • Cost and returns: the Usage screen (src/tui/screens/usage.ts) already read costDays and readReturns, so I added no code for them. docs/features/spend-terminal.md names all four page files and the src/tui files that show them.
  • Doorless list: scripts/doorless-allow.json loses spend.ts, spend-tab.ts, cost.ts and returns.ts.

Tests

  • test/tui-spend.test.ts seeds a $4.50 run and checks the week total is $4.50 in the page's markup, in the terminal rows and on the rendered screen. It also checks that a non-admin is shown no figures.
  • test/palette-roster.test.ts now lists "Spend" for admin people and for admin agents.
  • Passing: tsc --noEmit, the new test, tui-money, tui-usage, tui-usage-returns, cost-days, palette-roster, doorless, palette-entries and palette. I ran those by hand because scripts/fast.ts found 3,312 of 4,043 test files affected and nothing short of a full run covers that.
  • gate.ts --fix rewrapped comments, which I committed. It still prints two "one implementation?" similarity notes: spendScreen against weekCardScreen, and the new test's open helper against the one in test/tui-scorecard-spend.test.ts. They are not blocking, and I left both as they are.

Left out

  • No terminal view of /board/returns's per-pillar and costliest-issue sections, and none of the Spend page's per-app Fleet graph links; the terminal keeps the existing one-line returns summary on Usage.
  • Spend has no per-app narrowing.
  • The Spend screen is read once when it opens, with no refresh.

Try it

  1. Connect with FORGE_APP_SSH as a forge admin, press : and type Spend, then press enter.
  2. Check the totals against /settings/spend.
  3. For cost and returns, open Usage and press [ or ].

I never pushed docs/features/spend-terminal.md or the screen with a separate review block, since no page changed.

commented

<!-- look-pages d7fa8620a991 --> Look pages for d7fa862, from the gate:

  • look pages (inferred): this pull changes src/web/pages/spend.ts; the forge pictures /board (src/web/pages/spend.ts), the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

Nothing on /board changes in this pull, so I pushed an empty commit with a No look: line to override the inferred look page. I changed no code, and I didn't run the tests or the type check for this push.

The only edit under src/web is one word in src/web/pages/spend.ts: usd is now exported. The terminal Spend screen imports usd and tokens from that file so the numbers it prints match the web page. The commit message says the same thing, as the gate asks.

src/web/pages/spend.ts is also the file the gate named for /board. I did not trace which routes import it, so I can't say whether /board does. The rendered output is the same either way, which is why I chose No look: over naming a page.

Review block: this is not a page change, so there is none.

Approved

Clean. The Spend screen reads the same readSpend as the page and formats with the page own usd/tokens. It is gated on isAdmin both in the palette entry and in the screen, so a member sees nothing. Cost and returns already had a door on Usage and the how-to names them. The only src/web change is exporting usd, with no visual effect. The test checks the page markup, the rows and the rendered screen against one figure. README is untouched. No security findings.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs