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

Surface the flow report in the terminal Flow dialog and the MCP flow tool #16999

Merged opened this

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

Merged

The flow report is now reachable from the terminal Flow dialog and from the MCP flow tool. It reuses flowReadings and flowReportLines from src/flow/report.ts. What changed Shared reader: flowReportFor(db, reader) in src/flow/report.ts returns { readings, lines }.

Notes

opened this

The flow report is now reachable from the terminal Flow dialog and from the MCP flow tool. It reuses flowReadings and flowReportLines from src/flow/report.ts.

What changed

  • Shared reader: flowReportFor(db, reader) in src/flow/report.ts returns { readings, lines }. It sets publicOnly when the reader is an agent, so agents see public repositories only.
  • MCP: flow with { kind: "report" } returns { readings, lines }.
    • It is a new kind on the existing tool, not a new tool.
    • It is gated like the no-argument flow read, by telemetryReader: an admin or an agent holding telemetry:read. Any other agent is refused.
    • It records the read through noteRead and countRead, as the plain read does.
  • Terminal: the Flow dialog now ends with a "Flow report:" block of the ten lines, wrapped to the dialog width. It is added in src/tui/forge.ts, after flowLines(...) and laneTimeLines(...), not inside flowLines.
  • Docs: docs/features/flow-report.md is new, and the flow tool's doc string in src/http/mcp/tools/flow.ts now covers kind: report.

Tests

  • test/flow-report-doors.test.ts covers both doors: the MCP call (owner, granted agent, ungranted agent refused) and the terminal Flow dialog showing the report.
  • test/tui-flow-lead.test.ts (the "0 h" test), test/mcp-size.test.ts and test/flow-report.test.ts pass, as does the new doors test.
  • bun x tsc --noEmit printed nothing.

What I did not do

  • I did not run the full suite; the forge runs it on push.
  • I left the "outsiders: … oldest 0 h" wording in flowReportLines alone. test/flow-report.test.ts asserts it. It only shows up in the new report block, which tui-flow-lead doesn't read, so that test stays green.
  • I did not add a new MCP tool or touch the size ceilings.
  • The gate flagged the new test's call helper as 1.00 similar to test/mcp-board-delete.test.ts#call. That was a note, not a failure, and I did not fold the two together.
  • I made no web page changes, so there is no review block.

Try it

  • Call the flow MCP tool with {"kind":"report"}.
  • Or open Flow in the terminal (: palette) and scroll to "Flow report:".

🤖 Generated with Claude Code

Closes #6756

commented

The flow report is now reachable from the terminal Flow dialog and from the MCP flow tool. It reuses flowReadings and flowReportLines from src/flow/report.ts.

What changed

  • Shared reader: flowReportFor(db, reader) in src/flow/report.ts returns { readings, lines }. It sets publicOnly when the reader is an agent, so agents see public repositories only.
  • MCP: flow with { kind: "report" } returns { readings, lines }.
    • It is a new kind on the existing tool, not a new tool.
    • It is gated like the no-argument flow read, by telemetryReader: an admin or an agent holding telemetry:read. Any other agent is refused.
    • It records the read through noteRead and countRead, as the plain read does.
  • Terminal: the Flow dialog now ends with a "Flow report:" block of the ten lines, wrapped to the dialog width. It is added in src/tui/forge.ts, after flowLines(...) and laneTimeLines(...), not inside flowLines.
  • Docs: docs/features/flow-report.md is new, and the flow tool's doc string in src/http/mcp/tools/flow.ts now covers kind: report.

Tests

  • test/flow-report-doors.test.ts covers both doors: the MCP call (owner, granted agent, ungranted agent refused) and the terminal Flow dialog showing the report.
  • test/tui-flow-lead.test.ts (the "0 h" test), test/mcp-size.test.ts and test/flow-report.test.ts pass, as does the new doors test.
  • bun x tsc --noEmit printed nothing.

What I did not do

  • I did not run the full suite; the forge runs it on push.
  • I left the "outsiders: … oldest 0 h" wording in flowReportLines alone. test/flow-report.test.ts asserts it. It only shows up in the new report block, which tui-flow-lead doesn't read, so that test stays green.
  • I did not add a new MCP tool or touch the size ceilings.
  • The gate flagged the new test's call helper as 1.00 similar to test/mcp-board-delete.test.ts#call. That was a note, not a failure, and I did not fold the two together.
  • I made no web page changes, so there is no review block.

Try it

  • Call the flow MCP tool with {"kind":"report"}.
  • Or open Flow in the terminal (: palette) and scroll to "Flow report:".

🤖 Generated with Claude Code

commented

Both requested changes are in and pushed. The flow-report test file and tsc --noEmit pass, and gate.ts --fix changed nothing. I did not run the full suite or the dead-code export test; the forge's check runs those on the push.

  • Doc count: the flow tool doc now says "the ten flow reads" (src/http/mcp/tools/flow.ts).
  • Public-only test: test/flow-report-doors.test.ts now creates a private repository and opens a pull in it. It asserts the owner's openers: line counts that pull ("alice 1") and the granted agent's reads openers: none in 1 h. I did not run it with publicOnly removed to see it fail.
  • call helper: I used the existing mcpTool in test/helpers/mcp.ts instead of a private copy. I left the call in test/mcp-board-delete.test.ts alone, because it differs from mcpTool.
  • forge.ts readability: the report lines are built in a named reportLines const before the .concat(...).
  • Gate rules: the commit subject names the issue ("Direction: … (#6756)"). It carries No door: with a reason, since this change touches only a doc string, a local variable and tests.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs