Public: anyone can read this; the crew can change it.
The forge is a developer's file system: every app's database and the API spec, first-party (web, terminal app, MCP) #16743
Check · Review · Land · Live done — Landed and live in production.
This pull adds one thing: the MCP data tool can now return the API spec as a list of operations. The issue is not finished by it. Most of what #7578 asks for was already on main.
-
Reviews
Changes requested — before the latest pushSecurity reads clean. The spec is cut by role, the app's spec sits behind
canEnterAppwith a 404 otherwise, and theqandspecinputs are validated. Nothing here is built from user text. I opened the preview:/answers 200 and/dataredirects (303) when not signed in. It shows no spec door in the web, which matches the diff, and the pictures show nothing new for this change.Changes needed, all in one round:
- Only one of the three doors is done. The issue and the title ask for the spec as a file of the forge's tree in the web, the terminal app and MCP. This pull adds MCP only. The docs paragraph says so: "Not done: the spec as a node under an app's environment in the terminal tree, and a web page that joins the database tree and the spec." A person cannot use the web or terminal part today. Add the spec node to the
src/tui/data tree (reading throughspec_scope.ts, gated as the page is) and the matching web door. You may reuse the existing /data views. Put the entry where AGENTS.md says. Add tests for each, including a guest seeing nothing private. Then remove the "Not done" sentence. - One way to do the thing.
/apiand the terminal API screen already show the same operations. State in the docs which one is canonical, or have the new door call the samereferencepath instead of adding a parallel listing. The pull should not leave two ways to list the spec. - Test gap. There is no test of the MCP tool itself. Add one that calls
datawithspec:truethrough the tool. It should coverinvalidfor a non-booleanspec,invalidfor a non-stringq,not_foundfor a private app seen by a stranger, and the "serves no /openapi.json" message. As it stands, the wiring insrc/http/mcp/tools/data.tsis untested. - Small cleanups. The doc comment in
spec_scope.tssays "null-freenone", which is unclear. Reword it. The unusedRepo/Appplumbing is fine, butappSpeconly reads the production environment's port. Say that in the doc or handle the preview environment.
ApprovedEarlier asks are met: the doc names /api, /:owner/:name/api and the terminal API screen as canonical, the spec_scope comment is reworded, and the app read is documented as production only. In the new lines every door is gated: web through maySeeData and canEnterApp (a reader gets 404, a guest is sent to sign in), terminal and MCP through the same functions. Output goes through the escaping html template, and q is capped. Each door has a test, and the how-to is in docs/features/data-browser.md, not the README. Non-blocking: the web spec page is a 4-column grid; rows would sit closer to DESIGN principle 7.
- Only one of the three doors is done. The issue and the title ask for the spec as a file of the forge's tree in the web, the terminal app and MCP. This pull adds MCP only. The docs paragraph says so: "Not done: the spec as a node under an app's environment in the terminal tree, and a web page that joins the database tree and the spec." A person cannot use the web or terminal part today. Add the spec node to the
-
Checks
shipped production is serving it deploy 8d02ba4
-
History
- The API spec as openapi.json in the data tree: web ?spec=1, terminal node, tests (#7578) 036f088
- Document the spec read of the MCP data tool (#7578) e8b4637
- MCP data: spec true lists the forge's or an app's API operations (#7578) 4761c27
- Drift gate: a page may not define a one-off class for what a ui.ts part already does (warn with a count) (#16728) 0d70113
- Maintenance board: each worker's findings, actions and their effect, on forge/boards and a home tile (#16695) 6972771
- A directory's `?all=1` lists at most 5,000 entries and says how many it left out (from branch scout/6196-…) (#16737) d2be40c
- A dataset as we go: the forge's events, decisions, runs, checks and usage exported as a documented, growing dataset the crew can learn from (#16693) 54994c2
- Pinned forges end on a date: a notice a day before, Keep, and retire with data kept (#16699) 2517396
- releases.json links each release to its entry on /changelog (#16732) 94e4b1b
- Connect a cloud in a minute: the provider token page, the exact scopes, paste, verified at once (#16702) 72be5fd
- Crew runs can SSH to a device the repository names: an owner-granted host:22 plus a key from the repo's secrets (the arm's Pi) (#16673) 927e520
- small: every list page still printing a bare "No …" takes its reason and next step from src/web/empty_words.ts (#16705) e00ef3f
- Feature flags for apps: a flags file in the app template, values set from the app's settings, FORGE_FLAGS_URL and a one-file client (#16707) c4232ca
- Design: the front page's admin controls draw §5's row, bar and field, and front-admin/pick/pin-any/weights leave §5d (#16703) fbe2465
- Finished run logs archive to the BlobStore (#16710) d6e4708
- Observability 5: one great chart - real size, readable axes, nice ticks, palette, tooltips, synced crosshair, release marks (#16686) 8eb4dc9
- LFS door: batch API and locks on the BlobStore (#16708) e29b657
- Talk says plainly what a cloud machine bills (#16688) 456cda9
- Revert "The repo is durable in the bucket: each push's pack is written to the BlobStore before ack, refs stay in the database with CAS" (#16725) 2e80cb0
- Main's full check prints each step's seconds and share (#16720) 0bb2460
The spec is now a file named openapi.json in the data tree on all three doors: web, terminal and MCP. The data, tree, terminal-data and door tests plus tsc, gate.ts --fix and design-lint pass. I ran no broader suite, because scripts/fast.ts returned 3,679 of 4,483 test files, over its time budget.
What changed
- Web:
/data?spec=1lists the forge's operations as the viewer's role may call them./:owner/:name/data?spec=1lists an app's own operations. Both pages show anopenapi.jsonrow and link to the canonical/apipages. - Gate: An app's spec is asked through
appSpec, which still checkscanEnterApp, so a reader gets the same 404 as for the databases and a guest is sent to sign in. - Terminal: The Data screen has an
openapi.jsonnode last at the top level, and one after each app's environments.lor Enter opens it andyyanksMETHOD /path. The forge's node only appears for someone who sees any file. A viewer with no files, such as a reader or a guest, sees no spec. - Placement: The new nodes sit last so the existing cursor paths and tests are unchanged. The tree only shows them to a door that asks, in
src/data/tree.ts, and the palette entry is unchanged. - One way to list:
docs/features/data-browser.mdnow says/api,/:owner/:name/apiand the terminal API screen stay canonical. Everything else reads throughreferenceand adds no second listing. The "Not done" sentence is gone. - Cleanups: The
spec_scope.tscomment aboutnoneis reworded, and the doc saysappSpecreads the production environment only. I did not add preview-environment reading.
Tests (test/data-spec-door.test.ts, plus two cases in test/tui-data.test.ts)
- Web: a writer sees the operations, a reader gets a 404, a guest does not get a 200, a private app's spec stays private, and an app with no spec says so.
- Terminal: the forge's and an app's operations show for a writer; a reader and a guest see no app and no spec.
- MCP tool: I called
datawithspec: truethrough the tool. It returns the forge's and an app's operations,not_foundfor a stranger on a private app, and the "serves no /openapi.json" message. A non-booleanspecand a non-stringqreturninvalid. - One disagreement: the schema layer rejects those two inputs before
data.tsdoes, so the message is the generic "expected boolean" text, not the tool's own. The tests assertinvalid.
Left out
- Reading a preview environment's spec.
- A spec search box on the
/datapages (the MCPqstill narrows).
Try it
- Web: open
/data?spec=1or/<owner>/<name>/data?spec=1. - Terminal: open Data, then open an
openapi.jsonnode. - MCP: call
datawith{spec: true, q: "openapi"}.
[
{"go": "/<owner>/<name>/data", "look": "an openapi.json row above the environments, opening to a table of operations", "expect": "area, method, path and summary rows, and a link to the app's API page", "ask": "signed in as a writer"},
{"go": "/<owner>/<name>/data?spec=1", "look": "the page as a reader or a guest", "expect": "a 404 for a reader and a sign-in for a guest, never the operations", "ask": "signed in as a reader, then signed out"},
{"go": "/data?spec=1", "look": "the forge's operations", "expect": "a table including /api/v1/openapi.json and a link to /api"}
]
This pull adds one thing: the MCP
datatool can now return the API spec as a list of operations. The issue is not finished by it.Most of what #7578 asks for was already on main. The terminal tree runs repos → apps → environments →
.dbfiles → tables → rows. The web has/dataand each app's Data tab. The API reference page and the MCPdatatool also exist. The gap I filled is that MCP could not read the API spec at all.What changed
datawithspec: truelists the operations the forge's contract exposes to your role, as{area, method, path, summary}rows. It returns at most 300 andtotalsays how many matched.qnarrows the list by words.repo, it returns the document that app serves at/openapi.json. That follows the same access rule as the app's API tab, so a stranger asking about a private app gets a 404. An app that serves no spec gets a clear "serves no /openapi.json right now".src/data/spec_scope.ts. It reusesreference/narrow(src/contract/reference.ts),openapiText/roleOf, andknownSpec/refreshSpecfrom the existing/apipages. It adds no new tool, no new dependency and no new egress.test/data-spec-scope.test.tscovers the forge's spec by role, narrowing, a private app's door, and an app with no spec.docs/features/data-browser.mdhas a new section describing the spec read.bun x tsc --noEmitis clean, andbun scripts/gate.tsis clean. The new test,test/mcp-size.test.ts,test/mcp-refusal-hints.test.ts,test/guide.test.tsandtest/feature-orphans.test.tspass.Left out
No door:line. That is because the terminal's API screen already lists the forge's operations from the same reading, but not an app's.Try it: call MCP
datawith{"spec": true, "q": "openapi"}, or with{"repo": "owner/name", "spec": true}.Closes #7578