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

`scorecard` over MCP says merged, returned and cost this week per member, the same words as /crew #10913

Merged opened this

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

Merged

MCP `scorecard` now gives each member a `week: { merged, returned, cost }`, taken from the same function the /crew week line uses, and the `ui://` crew card shows it.

shipped production is serving it deploy 5795cea

opened this

MCP scorecard now gives each member a week: { merged, returned, cost }, taken from the same function the /crew week line uses, and the ui:// crew card shows it.

  • Source: readScorecards in src/actions/scorecard.ts calls weekCard from src/crew/week_card.ts, which already lived outside the page module, so nothing moved. cost is the ledger spend in USD for the last 7 days, and a member with no activity gets zeros.
  • Card: src/web/studio/cards.ts adds "N merged · N returned · $X.XX this week" to each member's row, after the month's landed and red rate.
  • Tool description: I added the week fields to the doc line in src/http/mcp/tools/scorecard.ts. test/mcp-size.test.ts passes without raising a ceiling.
  • New test: test/crew-scorecard-week.test.ts seeds one merged pull, one returned pull and one run cost. It reads the same numbers from MCP and from the /crew page, and checks the card line. The seeded numbers in the test are 1 merged, 1 returned and $1.25.
  • Existing test changed: test/crew-scorecard-api.test.ts compared an idle agent to an exact object, so I added week to that expectation. The test was stale, not wrong.

bun x tsc --noEmit is clean, and the four test files I ran pass. scripts/gate.ts printed only a pre-push note asking for a "Try:" commit line. I added an empty commit carrying one, and the push then went through. I didn't run the full suite; the forge's check does that on push.

To try it: call the scorecard MCP tool as an admin and read agents[].week; it matches the "This week" table on /settings/crew.

Not done: I didn't add a new tool or change the /crew page.

🤖 Generated with Claude Code

Closes #10905

commented

MCP scorecard now gives each member a week: { merged, returned, cost }, taken from the same function the /crew week line uses, and the ui:// crew card shows it.

  • Source: readScorecards in src/actions/scorecard.ts calls weekCard from src/crew/week_card.ts, which already lived outside the page module, so nothing moved. cost is the ledger spend in USD for the last 7 days, and a member with no activity gets zeros.
  • Card: src/web/studio/cards.ts adds "N merged · N returned · $X.XX this week" to each member's row, after the month's landed and red rate.
  • Tool description: I added the week fields to the doc line in src/http/mcp/tools/scorecard.ts. test/mcp-size.test.ts passes without raising a ceiling.
  • New test: test/crew-scorecard-week.test.ts seeds one merged pull, one returned pull and one run cost. It reads the same numbers from MCP and from the /crew page, and checks the card line. The seeded numbers in the test are 1 merged, 1 returned and $1.25.
  • Existing test changed: test/crew-scorecard-api.test.ts compared an idle agent to an exact object, so I added week to that expectation. The test was stale, not wrong.

bun x tsc --noEmit is clean, and the four test files I ran pass. scripts/gate.ts printed only a pre-push note asking for a "Try:" commit line. I added an empty commit carrying one, and the push then went through. I didn't run the full suite; the forge's check does that on push.

To try it: call the scorecard MCP tool as an admin and read agents[].week; it matches the "This week" table on /settings/crew.

Not done: I didn't add a new tool or change the /crew page.

🤖 Generated with Claude Code

commented

MCP scorecard now gives each member week: { merged, returned, cost }. The numbers come from the same weekCard function the /crew week line uses, and the ui:// crew card shows them as "N merged · N returned · $X.XX this week" after the month's landed and red rate.

What the failed check was:

  • Crew card test: test/mcp-flow-card.test.ts compared card rows to exact strings. The card now appends the week line, so I updated those expectations: smith's row reads "1 merged · 0 returned · $0.00 this week", and the rows built from hand-made input read zeros.
  • Search test: "a repeat search answers identically and far faster than the greps" is a timing check unrelated to this change. It failed on a loaded shard and passes here, so I did not touch it. If it fails again on this pull, it is a flake.

What I ran: I reran test/mcp-flow-card.test.ts and test/search-cache.test.ts; both pass. Earlier I ran test/crew-scorecard-week.test.ts (new: one merged pull, one returned pull and one run cost, read from MCP, the /crew page and the card), test/crew-scorecard-api.test.ts, test/mcp-size.test.ts (no ceiling raised) and test/crew-week-card.test.ts, and tsc was clean. I have not rerun the full suite; the forge's check does that on push.

What I chose not to do: no new tool, and no change to the /crew page.

To try it: call scorecard as an admin and read agents[].week. It matches the "This week" table on /settings/crew.

🤖 Generated with Claude Code

Changes requested — before the latest push

The numbers are right and come from weekCard. Two things to fix in one round.

  1. The docs do not mention the new door. docs/features/crew-week-card.md lists every door for the week line; add that MCP scorecard carries agents[].week { merged, returned, cost } (cost is USD, zero for an idle member, not the word idle) and that the crew card shows it.
  2. The crew card line now says 'landed this month' and 'merged ... this week' in one row, under a status 'N landed this week'. Three counts of nearly the same thing in different windows, and it reads as contradictory (principle 1, plain words, docs/WRITING.md). Show the week figures alone or drop the month landed; keep one window per row.

Smaller: the week lookup is repeated three times in readScorecards (read it once); the page assertion in the new test is a loose regex (>1<[\s\S]*>1<) that would pass on wrong cells; assert the three cells.

Box 1 is met, 2 is met in substance but with the weak page check, 3 is met but the row text is muddled (see 2), and 4 was reported passing but I did not rerun it.

commented

All four points from the review are addressed and pushed. I ran tsc --noEmit, scripts/gate.ts, and test/crew-scorecard-week.test.ts plus test/mcp-flow-card.test.ts (7 pass); the full suite is left to the forge check.

  • MCP scorecard: each agents[] entry carries week { merged, returned, cost }. The figures come from weekCard, the same source as /settings/crew.
  • Docs: docs/features/crew-week-card.md now names the MCP scorecard door. It says cost is USD and 0 for an idle member, never the word idle. It also says the crew card shows the week line.
  • One window per row: the crew card row now reads N merged · N returned · $X this week. I dropped "landed this month" from the row, and the month's red-check percentage with it, because it was the same kind of month figure in a week row. Say if you want the red rate back. The status line "N landed this week" is unchanged.
  • Lookup: readScorecards reads week.get(username) once into a const.
  • Test: the page check pulls the smith row's three numeric cells and asserts each one, not a loose regex. The merged cell is exactly 1, the returned cell starts with 1, and the cost cell is exactly $1.25. I updated the expected card rows in test/mcp-flow-card.test.ts to the new row text.

To try it, call the scorecard tool over MCP, or open /settings/crew as an admin.

Approved

Earlier asks are met. The MCP scorecard carries week {merged, returned, cost} from weekCard, the same function /crew uses. The doc names the door and the cost unit. The card row shows one window. The lookup is read once. The test asserts each cell exactly. The change is small, and the test would fail without it. Non-blocking: the crew card row no longer shows the month red rate. The week line replaces it, as the issue asked, but say so if someone misses it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs