Skip to content

feat: add self-contained starter template - #271

Merged
antfu merged 3 commits into
mainfrom
social-paths-grow
Aug 21, 2026
Merged

feat: add self-contained starter template#271
antfu merged 3 commits into
mainfrom
social-paths-grow

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Summary

Adds a top-level starter/ folder — a minimal, self-contained devframe integration: a vanilla-TS Vite client, a CLI dev/build/MCP shell, single + hub playgrounds, and unit + e2e tests.

  • src/devframe.ts + src/rpc/ define the DevframeDefinition and two RPC functions (get-info static, list-items query+snapshot).
  • src/client/ is a dependency-light vanilla-TS SPA (hand-rolled DOM helpers, no UI framework), served by the CLI or built as a static deploy.
  • playground/single/ dev-serves the SPA with Vite HMR while devframeViteBridge answers RPC at the devframe's own base path — the config comments explain why the two can't share one base (the bridge's middleware claims 100% of requests under its mount base with no passthrough).
  • playground/hub/ mounts the devframe as a dock inside a @devframes/hub host.
  • test/ (vitest, RPC over a real WebSocket via the public initDevframe API) and e2e/ (playwright, against the single playground) cover both layers.

Versioning

The starter pins real dependency versions instead of the monorepo's catalog:/workspace:* specifiers, so the folder is copy-paste ready outside this workspace. Pnpm still links devframe/@devframes/* to the local packages during in-repo development. A root bump.config.ts + scripts/sync-starter-version.ts keep those versions in sync automatically whenever bumpp -r releases the monorepo.

Monorepo wiring

  • pnpm-workspace.yaml — registers starter as a workspace package
  • vitest.config.ts — adds starter to the root test aggregation
  • turbo.json — explicit devframe-starter#build / #cli:build task entries (this repo has no generic build task; every package needs its own entry, or pnpm build/pnpm test silently skip it)
  • scripts/verify-typecheck-coverage.ts — adds starter to the coverage safety net
  • AGENTS.md — documents the starter's purpose and version-sync mechanism

Verification

  • pnpm typecheck, pnpm lint, pnpm knip, and the root pnpm test (114 test files / 1253 tests) all pass with the starter included
  • Manually exercised every surface: CLI dev server, static build (with baked RPC dumps), both Vite playgrounds (curled their live endpoints), unit tests, and Playwright e2e — this surfaced and fixed several real bugs (IPv4/IPv6 loopback bind mismatches, a fixture-path bug, and the RPC-bridge/SPA base-path conflict noted above)

This PR was created with the help of an agent.

Add a top-level starter/ folder: a minimal devframe integration with a
vanilla-TS Vite client, single + hub playgrounds, and unit + e2e tests.

- devframe.ts + rpc/ define the DevframeDefinition and two RPC functions
  (get-info static, list-items query+snapshot).
- src/client/ is a dependency-light vanilla-TS SPA (hand-rolled DOM
  helpers, no UI framework) served by the CLI (bin.mjs) or built as a
  static deploy.
- playground/single/ dev-serves the SPA with Vite HMR while
  devframeViteBridge answers RPC at the devframe's own base path -
  documented why the two can't share one base.
- playground/hub/ mounts the devframe as a dock inside a @devframes/hub
  host.
- test/ (vitest, RPC over a real WebSocket) and e2e/ (playwright,
  against the single playground) cover both layers.

The starter pins real dependency versions instead of the monorepo's
catalog:/workspace:* specifiers, so it's copy-paste ready outside the
workspace; pnpm still links devframe/@devframes/* to the local packages
during in-repo development. A root bump.config.ts +
scripts/sync-starter-version.ts keep those versions in sync automatically
whenever `bumpp -r` releases the monorepo.

Wires the starter into the monorepo's tooling: pnpm-workspace.yaml,
vitest.config.ts (root test aggregation), turbo.json (explicit
devframe-starter#build/#cli:build task entries - this repo has no
generic build task, every package needs one), and
verify-typecheck-coverage.ts. Documented in AGENTS.md.

This PR was created with the help of an agent.
@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit ccd5add
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a87ddab4b06070008c3e407
😎 Deploy Preview https://deploy-preview-271--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

…ection

`auth: false` was set on every real surface (the CLI's cli.auth, and both
Vite playgrounds) - each one auto-trusted any connection that could reach
its port, with no interactive handshake at all. That's the framework's
documented opt-out for a tool that's genuinely single-user and
loopback-only, not a sane starter default: a copy-pasted template should
teach the secure-by-default posture, not silently disable it everywhere.

Leave `auth` unset on `src/devframe.ts`'s `cli` and both playground
configs, so they fall through to devframe's interactive OTP gate (the
same default every hosted adapter already ships). A developer who wants
to skip the prompt for a one-off loopback session now reaches for the
CLI's existing `--no-auth` flag per invocation instead of a baked-in
opt-out.

The single playground's e2e suite still needs to drive the bridge
without solving an interactive code, so `playwright.config.ts`'s
`webServer.env` sets an explicit `DEVFRAME_E2E` flag that the playground
config checks to disable auth *only* for that automated run - a plain
`pnpm run play:single` stays gated. The unit test's own ephemeral,
loopback-only `initDevframe` instance keeps `auth: false` outright (it's
a private test fixture torn down in `afterAll`, not a listening surface
anyone else can reach) - now with a comment explaining why that one is
fine.

This PR was created with the help of an agent.
Merge the two demo RPC functions (get-info static, list-items
query+snapshot) into a single get-state query+snapshot returning
{ cwd, node, items } in one round trip. Cuts an RPC file, a namespace
entry, a client fetch, and a test, without losing the pattern this
starter exists to demonstrate.

Also:
- Drop `cli.mcp: true` from the devframe definition - nothing in the
  starter exercised the MCP route, so it was dead surface.
- Drop the redundant `play` (duplicate of `play:single`) and `test:unit`
  (duplicate of `test`) package.json scripts.
- Rename test/rpc.test.ts -> test/get-state.test.ts to match the single
  function it now covers.

This PR was created with the help of an agent.
@antfu
antfu merged commit 3c01a91 into main Aug 21, 2026
12 checks passed
@antfu
antfu deleted the social-paths-grow branch August 21, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants