Skip to content

Install the capture snippet without an agent for common frameworks - #54

Draft
nrodd wants to merge 2 commits into
mainfrom
static-snippet-install
Draft

nrodd wants to merge 2 commits into
mainfrom
static-snippet-install

Conversation

@nrodd

@nrodd nrodd commented Oct 2, 2026

Copy link
Copy Markdown
Member

Summary

Step 1 (installing the capture snippet) no longer needs a coding agent for the frameworks we recognize. The wizard detects the framework, previews the exact lines it will add, and writes them once the user confirms. Anything it can't place with certainty goes to the agent-driven install, which is unchanged.

Supported

Framework Edit
Next.js App Router <Script strategy="beforeInteractive"> in the root layout's <head> (or first in <body>), adds the next/script import if missing
Next.js Pages Router inside <Head> in _document, or creates _document
Remix / React Router v7 inside <head> in app/root
Nuxt 3+ adds app.head.script to nuxt.config
Gatsby creates gatsby-ssr with onRenderBody
Astro the single layout with a <head>, as <script is:inline>
SvelteKit, Angular, Vite, CRA, Vue CLI, plain HTML before </head> in the entry HTML

JS/TS edits use @babel/parser to find insertion points and splice text, so the rest of the file's formatting is untouched, and the edited file must parse again before it's written. A write is refused if the file changed after the preview.

Falls back to the agent when

Monorepo roots, React Native, unsupported frameworks (TanStack Start, SolidStart, Qwik, Redwood, Ember), Nuxt 2, any detected Content-Security-Policy (including helmet / nuxt-security), mixed App/Pages Router, custom appDirectory or Vite root, multi-page Vite apps, an existing gatsby-ssr or Nuxt app block, zero or several <head>s, unparseable files, a declined edit, or a failed write.

Flow changes (run.ts)

  • After a static install (or an already-installed snippet), the step-1 prompt review and handoff are skipped on the terminal, app, and manual paths; the agent is still picked for session review and step 2.
  • The wizard reports precheck/explore/plan/install itself, so the funnel shape is unchanged.
  • --print-prompt previews the edit without writing.

Other

  • @babel/parser is now a runtime dependency (was already in the lockfile transitively).
  • README and a changeset are updated.

Test plan

  • npm test: new suite with throwaway projects for every framework and fallback case (88 tests passing)
  • npm run typecheck, npm run build
  • Mock end-to-end run against a scratch Vite project
  • Try it against a fresh create-next-app (App and Pages Router) and a Nuxt starter

nrodd added 2 commits October 2, 2026 15:25
Detect the framework, preview the exact edit, and write the snippet after
confirmation. Anything ambiguous falls back to the agent-driven install.
…files

- Optional extras: package.json pre-check scopes the agent run, consent
  sits right before launch, and the wizard prints its own results summary
  from .subtext/extras-result.json. Reports move to .subtext/.
- Output: combined sign-in line, Claude Code spinner (stderr captured, no
  MCP servers loaded), shorter snippet preview, Next steps box, framed demo
  prompt, conditional outro.
- Static installer split into one file per framework under
  src/staticInstall/frameworks, with shared edit helpers in edit/.
@nrodd nrodd mentioned this pull request Oct 8, 2026
2 of 4 tasks

This branch has not been deployed

No deployments
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