Skip to content

[NO-TICKET] Mark a one-line root layout, and end setup's output with the claim link - #461

Merged
mariojgt merged 3 commits into
mainfrom
mariot/marker-one-line-shell
Oct 28, 2026
Merged

mariojgt merged 3 commits into
mainfrom
mariot/marker-one-line-shell

Conversation

@mariojgt

@mariojgt mariojgt commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

No ticket.

What changed

Two fixes from installing Patchstack on a v0 app published to Vercel:

  1. Setup and scan now add Patchstack's production marker (window.__PATCHSTACK_PROD__ / window.__PATCHSTACK_BUILD__) to a JSX root layout written on one line. That is the shape v0 generates for a Next.js app. The published page now says which build it runs.
  2. Setup's output, and summary's, now end with one line telling the assistant to pass the summary on. While the site has no owner, that line carries the link to connect the Patchstack account.

Why

The marker was missing. findJsxShellAnchor in src/mark-build.ts matched <head or <body only at the start of a line. A v0 project's app/layout.tsx reads:

return <html lang="en"><body className="antialiased">{children}…</body></html>

<body follows <html lang="en"> on the same line, so the step found no anchor, returned no-anchor and added nothing. The widget tag went in fine (a different step), so the published page loaded the widget but named no build. The dashboard could not identify the live build, and doctor --url flagged it.

The claim link was dropped. The owner asked v0's assistant only to "install and set up @patchstack/connect by running npx @patchstack/connect setup --widget". The assistant replied with nothing more than "completed with exit code 0" and never passed on the summary, so the person never saw the link to connect their account. The instruction to pass the summary on (SUMMARY_INTRO) is printed just before the summary, at the end of long output that an assistant may cut short or only skim. Setup already saves the summary to a file for exactly that reason.

Fix

  • Marker (src/mark-build.ts):
    • try line starts first, exactly as before;
    • failing that, accept the tag when it is part of the chain of opening tags a return or an arrow function => starts with. A tag inside a string ("<html><body>") is not in such a chain and is still ignored. Indentation comes from the line the tag is on, and the marker region goes in as the first child of <body>, as for any shell without <head>.
  • Closing line (src/report.ts, src/cli.ts):
    • summaryClosingLine() is printed after the summary, as the very last line of setup's output. While the site has no owner it reads "Your reply to the person must include the summary above, as written, with this link to connect their Patchstack account: ". Otherwise it says the summary is their result and next step.
    • npx @patchstack/connect summary ends the same way, from the claimed and claimUrl values .patchstackrc.json records.
  • AGENT-INSTALL.md: "The message you end on" says the output ends with that line, and that reporting only success leaves the person without their results or the link.

Verified

  • Marker on the real v0 project's app/layout.tsx (shared by the owner):
    • before: no-anchor;
    • after: the marker region is added inside <body>, the file parses as TSX with no errors, and a second run changes nothing.
  • tests/mark-build.test.ts, two new tests with synthetic fixtures:
    • a one-line layout gets the marker, still parses, and is idempotent. This fails on the previous code.
    • <html><body> inside a string is not an anchor.
    • All 65 pass.
  • tests/bin-invocation.test.ts:
    • setup run as an assistant runs it (output not a terminal) ends with the closing line, carrying /monitor/claim?site=<uuid>;
    • summary reprints the same summary and ends with the closing line;
    • the saved summary.md is unchanged.
    • All 39 pass.
  • Gates: npm run typecheck, npm run build and capabilities:check are green. Full npm test: 4649 passed.

Out of scope, worth a follow-up

  • The same v0 app still does not show the widget in v0's in-chat preview. vusercontent.net is already a preview domain (widget Test the published package, and fix two defects it found #190, SaaS #2355, both live), so v0's preview most likely runs on another host now, probably Vercel Sandbox's *.vercel.run. That needs the frame's actual URL before adding it.
  • Existing apps get the marker on their next scan (every build runs one) once they update @patchstack/connect.

Docs: AGENT-INSTALL.md updated ("The message you end on"). This and the new last line of setup's output are what agents read, so the hostile field test is owed after the release that carries this, plus standard/lovable for doc accuracy.

🤖 Generated with Claude Code

The marker step looked for <head> or <body> only at the start of a line.
A v0 app's Next.js layout is written on one line
(`return <html lang="en"><body …>…`), so it found no anchor, added no
marker, and the published page never said which build it ran: the
dashboard could not identify the live build.

It now also anchors on a tag in the chain a `return` or an arrow
function opens with, after trying line starts as before. A tag inside a
string is not in such a chain and is still ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mariojgt

Copy link
Copy Markdown
Contributor Author

/review

@coderbuds

coderbuds Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🎯 Elite quality (94%) — Extends JSX shell anchoring to one-line root layouts, with tests covering the new path and a string false positive.

📦 Small

🤖 Written by Claude Code — going by its own attribution. Unknown whether a person read it; agents can report that with the report-ai-usage tool.

See how your team is trending →

An assistant that ran setup reported only that the command succeeded and
left out the summary, so the person never got the link to connect their
Patchstack account. The instruction to pass the summary on came before
it, in the middle of long output that an assistant may cut or skim.

Setup's output, and summary's, now end with one line, the one an
assistant is surest to read: include the summary above as written, and,
while the site has no owner, with this link to connect the account.
AGENT-INSTALL.md says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mariojgt mariojgt changed the title [NO-TICKET] Add the production marker to a root layout written on one line [NO-TICKET] Mark a one-line root layout, and end setup's output with the claim link Oct 28, 2026
@mariojgt

Copy link
Copy Markdown
Contributor Author

/review

@mariojgt
mariojgt merged commit b8b04fd into main Oct 28, 2026
23 checks passed
@mariojgt
mariojgt deleted the mariot/marker-one-line-shell branch October 28, 2026 14:38
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.

3 participants