Skip to content

Serve TSX drafts from the design plugin (A/B with HTML) - #707

Merged
MarioCadenas merged 3 commits into
work/1-design-plugin-dev-only-design-from
work/38-serve-tsx-drafts-from-the-desi
Nov 5, 2026
Merged

MarioCadenas merged 3 commits into
work/1-design-plugin-dev-only-design-from
work/38-serve-tsx-drafts-from-the-desi

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

TSX drafts now run in the design plugin next to the HTML drafts, on branch work/38-serve-tsx-drafts-from-the-desi (one commit, 9ff9dc62a, nothing merged). I ran it live through the AI Gateway in an app scaffolded from template/, and it works end to end.

Results of the live runs:

  • Taxi dashboard: 41s, all 3 drafts compiled, one needed a fix round.
  • Tetris: 23s, all 3 compiled, and it replaced the taxi drafts.
  • In Chrome, all 3 pages reached ready in light and dark mode, and /design/__status showed tsx moving through writing → type-checking → rendering → ready.
  • Lock-in left a working /design (ready: true) and the app's own tsc still passes.
  • Repo checks pass: 959 tests, pnpm -r typecheck, pnpm check and knip are clean.

What I added:

  • appkit design tsx-drafts --prompt … --answers … --name <prefix>: KIT-37's writer, reused with its prompt files (components.schema.json, the appkit-ui export list, the example page and mock), with up to 2 fix rounds after the type check.
    • Files are written in client/src/design/.staging/, and a page moves into pages/ only once it compiles.
    • A new run deletes only the previous run's drafts, not other design pages.
    • --print-prompt prints the cached system prompt.
  • appkit design lock-in <name> [--home]: keeps the chosen page as /design/index.tsx, or with --home as client/src/pages/home/HomePage.tsx. It deletes the other drafts; the only change to the code is the ../mock import becoming ./mock.
  • A tsx section in /design/__status: each draft shows writing, type-checking, rendering, ready or failed. ready and failed come from what the page reports from the browser.
  • TSX drafts are ordinary /design/<name> pages, so the plugin's existing per-page error boundary and appkit:design-ready message already cover them. The HTML draft path is untouched.
  • A "TSX drafts" section in docs/docs/plugins/design.md.

Bug fixed during the live run: Tailwind didn't style a newly added page until the stylesheet changed. The writer now touches client/src/index.css, as KIT-37 did.

How to consume it: tarballs databricks-appkit-0.90.0.tgz and databricks-appkit-ui-0.90.0.tgz are in ~/.herdr-projects/reports/app-kit/38/. Install both as file: dependencies; both are needed because the appkit command comes from the appkit-ui package. The closing note has the exact commands, the checksums and how to rebuild them.

Caveats:

  • KIT-37 (PR chore(playground): prototype TSX drafts in an AppKit playground #706) isn't merged, so I copied its code rather than building on its branch.
  • --home doesn't edit App.tsx; the agent still has to route the page at /.
  • I haven't run it inside the real App Builder, and the tarballs are local builds, not published to npm.
  • I ran pnpm store prune once on the global pnpm store while reinstalling the test app.

Also noticed:

  • packages/appkit/src/plugins/design/vite-plugin.ts: hand-written pages added while the dev server runs have the same Tailwind styling gap.
  • A lint-staged automatic backup (2b8879a) entry is sitting in the shared git stash; it isn't from this task.

Task: KIT-38 (app-kit/38)

appkit design tsx-drafts writes a shared client/src/design/mock.ts and 3
appkit-ui pages at /design/<name>-a|b|c (KIT-37's writer: one cached system
prompt, mock export list streamed first, tsc + up to 2 fix rounds, a page
lands in pages/ only once it compiles). /design/__status reports each under
tsx: writing, type-checking, rendering, ready or failed. appkit design
lock-in keeps one as /design (or the home page with --home) and deletes the
others. HTML drafts are unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas

Copy link
Copy Markdown
Collaborator Author

Review 1 · Pass · 2 minor

Does the change do what the task asked? Yes. Gate: major and worse must be fixed.

The TSX draft path is built as asked: a writer CLI that reuses KIT-37's prompt files and runs tsc with up to 2 fix rounds, staging so a page only shows once it compiles, a tsx section in /design/__status, and lock-in. The HTML path is not touched, and the branch is pushed. I did not repeat the live AI Gateway run, so the end-to-end claims rest on the author's report plus the unit tests I ran.

Not required (below the gate)

  • minor: lock-in --home overwrites client/src/pages/home/HomePage.tsx without asking and does not route it at /, so the user still has to edit App.tsx by hand (the command description says so). (packages/shared/src/cli/commands/design/tsx-drafts.ts lockInTsxDraft)
    Proof: Read the code: fs.writeFile(target) is unconditional and App.tsx is never touched.
  • minor: A new tsx-drafts run replaces the shared client/src/design/mock.ts, so a non-run design page or a locked-in index.tsx that imports ./mock or ../mock can silently get different data or break. (packages/shared/src/cli/commands/design/tsx-drafts.ts writeTsxDrafts)
    Proof: Read the code: the mock is copied over designDir/mock.ts with no check for other importers.

…es them

Drop the appkit design tsx-drafts and lock-in commands and their prompt
files: App Builder owns prompting, mock data, type-check and lock-in.
/design/__status now reports per page compiled / compileError (built
server-side) and a state (compile-error, rendering, ready, failed) from the
plugin's own knowledge instead of a writer's status.json.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas

Copy link
Copy Markdown
Collaborator Author

Review 2 · Fail · 1 major, 1 minor

Does the change do what the task asked? Yes. Gate: major and worse must be fixed.

The branch adds per-page compiled/compileError/state to /design/__status on top of KIT-1's TSX page serving, leaves HTML drafts alone, and documents what a builder writes. The design tests pass. The one real gap: the docs leave out the Tailwind step the agent says it needed in its own live run.

Required

  • major: The agent says new pages stay unstyled until client/src/index.css is touched, but the docs' builder contract doesn't mention this, so a builder following the docs gets unstyled drafts. (docs/docs/plugins/design.md (TSX drafts section))
    Proof: Read the docs diff: no mention of index.css or Tailwind rescanning. The agent's own report says it hit this in the live run.

Not required (below the gate)

  • minor: Every /design/__status poll compiles every page's module graph server-side, which could slow down frequent builder polling when there are many drafts. (packages/appkit/src/plugins/design/vite-plugin.ts:926)
    Proof: Code read only. Not measured.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 41927351703 -R databricks/appkit -n appkit-template-0.90.0-pr.cd41c28-work-38-serve-tsx-drafts-from-the-desi-707 -D appkit-pr-707 \
  && unzip -o "appkit-pr-707/appkit-template-0.90.0-pr.cd41c28-work-38-serve-tsx-drafts-from-the-desi-707.zip" -d "appkit-pr-707" \
  && databricks apps init --template "appkit-pr-707"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas

Copy link
Copy Markdown
Collaborator Author

Review 3 · Pass · 1 minor

Does the change do what the task asked? Yes. Gate: major and worse must be fixed.

F3 is fixed: the TSX drafts section of the design plugin docs now tells the builder to touch client/src/index.css after moving a page in, and explains why. F4 was deliberately left as is: every status poll still compiles each page's module graph, and nobody has measured what that costs.

Not required (below the gate)

  • minor: Every /design/__status poll still compiles every page's module graph server-side; the agent assumes Vite's cache keeps it cheap but did not measure it. (packages/appkit/src/plugins/design/vite-plugin.ts:926)
    Proof: Commit b987252 touches only docs/docs/plugins/design.md; vite-plugin.ts is unchanged.

@MarioCadenas
MarioCadenas merged commit b987252 into work/1-design-plugin-dev-only-design- Nov 5, 2026
9 checks passed
@MarioCadenas
MarioCadenas deleted the work/38-serve-tsx-drafts-from-the-desi branch November 5, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant