Add scripts CRUD UI and Storybook coverage - #12
Merged
Conversation
Wire the homepage to create, edit, run, and delete scripts against the API, and document the design system in Storybook. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The homepage was one card with a table and a modal editor. It is now a workbench: a rail of stored scripts, real routes, and a pane whose job depends on where you are. Writing is gone from the UI. Storing a script means validating it against the catalog and keeping it only if it checks, and the agent already does that in one turn through `/api/mcp` — a form here was a second, worse way to reach the same routes, so `/chat` is the only authoring path and the empty state says so. That took the editor, the diagnostics list, `useUpsertScript`, `useValidateScript` and most of `atoms.ts` with it. Routes replace the state machine. A pathless `_workbench` layout mounts the rail and the delete dialog once, so `/`, `/scripts/$name` and `/chat` each own a pane and nothing flickers between them. The script route reads through `useScript` rather than the list, so a deep link works cold, and it accepts an id as well as a name because the API resolves both. Deleting the script the URL names navigates away from it. A script's page is its run screen: the contract and the method sit behind a sheet, because the report is the only thing on that page a stored row cannot already tell you. Schemas are shown as the JSON Schema they are. `GET /api/scripts` now derives `authorization` per declared toolkit: the granted tools, their union of OAuth scopes, and whether any of them needs an account at all. The scopes were already mirrored in `tools.requirements`, never read. Three states have to stay distinct — a toolkit declared and never called authorizes nothing, `Math` needs no account, and Github demands one while declaring no scopes per tool — so `requiresAuth` is not `scopes.length > 0`. Hovering a toolkit on the run screen is what makes least privilege visible: two Gmail calls out of thirty tools ask for `gmail.readonly` and nothing else. Storybook keeps up: a `layouts` collection for the shell and the panes, plus molecules for the rail, the report, the metadata band and the scope badges, all driven by fixtures so every state — loading, empty, drifted, unauthorized — is reachable without a client. `panes.test.tsx` server-renders the panes and asserts what a reader sees, including that nothing offers to write a script. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Message,Conversation,Tool,CodeBlock).Test plan
pnpm storybookinapps/frontendand spot-check atoms + moleculesMade with Cursor