Skip to content

feat(deploy): inline README into playground metadata#36

Merged
UtkarshBhardwaj007 merged 1 commit intomainfrom
feat/inline-readme-in-playground-metadata
Apr 20, 2026
Merged

feat(deploy): inline README into playground metadata#36
UtkarshBhardwaj007 merged 1 commit intomainfrom
feat/inline-readme-in-playground-metadata

Conversation

@UtkarshBhardwaj007
Copy link
Copy Markdown
Member

@UtkarshBhardwaj007 UtkarshBhardwaj007 commented Apr 20, 2026

Summary

  • dot deploy --playground now reads README.md from the project root and inlines it into the playground metadata JSON. Previously only { repository } was written, so every published app showed "No readme provided." on its detail page.
  • 20 KB cap on inlined READMEs to keep the playground feed lean. Oversized READMEs are dropped silently from the payload; the confirm screen surfaces a warning ("readme will not be uploaded" with actual vs. allowed size) before the user presses Enter to deploy.
  • Missing README → silent no-op. No user action required for repos that already have a README.md at their root.
  • No contract change needed. The registry already stores a metadata_uri pointer, and the reader side (playground-app AppDetailPanel) already renders metadata.readme via marked + DOMPurify — it was half-built; this PR completes the writer side.

Implementation notes

  • New readReadme(cwd, capBytes?) helper in src/utils/deploy/playground.ts returns a tagged union { kind: "ok" | "oversized" | "missing" }. Uses readdirSync + case-insensitive regex so casing variants (README.md / readme.md / Readme.md) resolve uniformly on case-sensitive filesystems (Linux CI).
  • publishToPlayground consumes the helper; only inlines on kind === "ok".
  • DeployScreen.ConfirmStage runs the same helper once (memoized) and renders the warning Callout only for kind === "oversized". Deploy utils stay free of React/Ink imports per the SDK/WebContainer boundary documented in CLAUDE.md.
  • readReadme, README_CAP_BYTES, and ReadmeStatus are re-exported from src/utils/deploy/index.ts so the TUI layer consumes the same helper rather than duplicating IO.

Follow-up (out of scope)

The playground-app's in-browser publish form (App.tsx:483-489) also omits readme from the metadata it builds. Separate repo, separate PR — flagged for later.

Test plan

  • Unit tests for readReadme: ok / oversized / missing / custom cap / lowercase readme.md / titlecased Readme.md (6 cases).
  • Unit tests for publishToPlayground: README inlined when under cap; omitted when oversized. Existing tests updated to pass explicit tmpdirs so they don't accidentally pick up the CLI's own README.
  • Full suite: pnpm vitest run — 203/203 passing.
  • Type check: pnpm exec tsc --noEmit — clean.
  • Lint: pnpm exec biome check on touched files — clean.
  • Changeset: .changeset/inline-readme-in-playground-metadata.md (minor bump, user-voiced).
  • Manual: run dot deploy --playground against a repo with a normal-sized README.md and confirm the playground detail page shows it rendered.
  • Manual: run the same against a repo with a >20 KB README and confirm the confirm-stage warning appears and the deploy still succeeds without the readme.

`dot deploy --playground` now reads README.md from the project root and
inlines it into the metadata JSON so published apps render a readme on
their playground detail page. Previously only { repository } was
written, so every app showed "No readme provided."

- Adds readReadme() helper with a 20 KB cap and tagged-union return
  ({ ok, oversized, missing }).
- Uses readdirSync + case-insensitive regex for discovery so casing
  variations (README.md / readme.md / Readme.md) resolve uniformly on
  case-sensitive filesystems (Linux CI).
- Oversized READMEs are dropped silently from the payload; the confirm
  stage surfaces a warning Callout with actual vs. allowed size before
  the user presses Enter. Missing READMEs are a silent no-op.
- Exposes readReadme / README_CAP_BYTES / ReadmeStatus on the deploy
  SDK surface so the TUI layer can prompt without duplicating IO.

No contract change needed — the registry already stores a metadata_uri
pointer, and the reader side (AppDetailPanel) already renders
metadata.readme via marked + DOMPurify.
@github-actions
Copy link
Copy Markdown
Contributor

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/feat/inline-readme-in-playground-metadata bash

@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 2db5394 into main Apr 20, 2026
5 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the feat/inline-readme-in-playground-metadata branch April 20, 2026 22:27
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