Skip to content

feat(server): the agent front door: /llms.txt, an installer and patchy setup - #500

Merged
allisonmahmood merged 5 commits into
mainfrom
t3code/implement-issue-36
Oct 3, 2026
Merged

allisonmahmood merged 5 commits into
mainfrom
t3code/implement-issue-36

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

A new beta user's agent had no way in. The CLI is deliberately not on npm, the install steps lived only in the README and inside the skill they would install, nothing registered that skill with any agent, and the empty portal said "Ask your agent to publish a page with Patchy" with nothing behind it. A stale global CLI was told patchy refresh, which only reconciles a repo.

Now the person gives their agent one line: Set up Patchy using https://<host>/llms.txt.

  • GET /llms.txt (public, no-store): what Patchy Cloud is, the private beta, Node ≥ 22.22.0, the install-and-login line for macOS/Linux and PowerShell, the browser handoff, and the skill to read next. The copy is a first draft for Allison to edit here.

  • GET /install.mjs (public, no-store): a dependency-free Node script in packages/sdk/front-door/, served with PATCHY_PUBLIC_BASE_URL baked in.

    • It refuses old Node, including real Node 14 and 18, and a missing npm.
    • It fetches /api/release and checks the tarball's SHA-512 against package.integrity before installing anything.
    • It always runs npm install --global --ignore-scripts, then runs the new package's setup --json by absolute path with no shell in between.
    • It names the fix for an unwritable prefix, a prefix inside Volta's Node image, patchy missing from PATH, or another runnable patchy ahead of it on PATH (which would otherwise loop on release mismatch).
    • On Windows no user-derived path is typed on a cmd command line, so % in a path can't expand and a UNC temp directory still works.
    • At about 180 lines it is a little over the brief's estimate; the extra lines are those cases.
  • patchy setup [--remove] [--json] links the bundled skills/patchy directory as ~/.agents/skills/patchy and ~/.claude/skills/patchy (symlinks on POSIX, junctions on Windows). It owns only links into a patchy package's skill, including dangling ones from a removed npm prefix. It checks both paths before changing either and refuses anything else with exit 1 and skill_conflict. --remove deletes only owned links.

  • Upgrade guidance: file publish with a stale global CLI names the instance's install line. Repo paths name pnpm patchy refresh. The server's own refusal can't tell the two apart, so it names both.

  • Surfaces: docs/API.md, the package README, ADR-0004, docs/SKILL_DISTRIBUTION.md, the global skill and its lock hash, the Publishing glossary, CONTEXT-MAP.md and docs/product.md. ADR-0011 is unchanged. Instance URLs in the install and login lines are single-quoted, as login's own next quotes them.

  • The empty portal walks a person through it in three steps: paste the selectable line Set up Patchy using <instance>/llms.txt to your agent, confirm the code it shows you, then ask for a page or a tool. This is mock C from feat(server): the agent front door: /llms.txt, an installer and patchy setup #36 (https://post.patchyhq.com/d/nu13cerlx61o), picked because many first publishers have never signed in a CLI. It uses only the shell's shared components.

Verified

  • packages/sdk/src/install.test.ts runs the real installer with real npm against a stub instance, with a clean HOME and a fresh npm prefix under paths with spaces. It covers:
    • install, then a reinstall that keeps the links
    • an integrity mismatch: npm never runs and nothing is installed
    • old Node and missing npm, with no request made
    • an unwritable prefix
    • a Volta-image prefix
    • patchy missing from PATH
    • a non-executable patchy ignored, and a runnable one refused
  • pnpm test:packed-cli-e2e fetches /llms.txt from the real server, runs its POSIX line on a clean HOME and npm prefix, and gets the login handoff. A second run reinstalls, keeps the links and polls the same login.
  • Setup's link ownership is tested in Setup.test.ts, and its --json and exit-code contract through the bundled CLI in cli.test.ts. The file-mode and repo-mode mismatch messages are tested in cliPublish.test.ts and cliRepoPublish.test.ts.
  • The empty-portal test checks the selectable setup line with the instance's address and the three steps; pnpm dev shot of a fresh instance matches the mock. On that live instance, /llms.txt and /install.mjs answer 200 with the address baked in.
  • pnpm verify passes: format, lint, typecheck, test, postgres-concurrency, cli-smoke, tier2-smoke and browser.
  • GPT 6.1 Sol in codex reviewed three rounds. Its installer findings are fixed: Volta PATH, Windows cmd expansion and UNC temp, IPv6 quoting, old Node loading, non-executable PATH entries. The last round found nothing new.

Hand checks (no CI runners)

Not breaking: new routes and a new command. The only changed behaviour is the repair text in release_mismatch messages.

Closes #36

Made by Claude Opus 5.5 via Claude Code; reviewed by GPT 6.1 Sol via codex.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:xl Over 1,000 changed lines; review in multiple passes area:ui Portal and first-party browser pages, shared rendering and styles labels Oct 2, 2026
allisonmahmood and others added 5 commits October 3, 2026 21:12
…y setup

An outside agent given "Set up Patchy using <host>/llms.txt" now has a
path in. /llms.txt says what Patchy Cloud is and gives the install-and-login
line. /install.mjs, served with the instance's address baked in, verifies
the release tarball's SHA-512 integrity, installs it globally with npm and
runs the new `patchy setup`, which links the bundled global skill as
~/.agents/skills/patchy and ~/.claude/skills/patchy.

A stale global CLI is now told to rerun its instance's installer; inside
a patch repo the guidance stays `pnpm patchy refresh`.

Refs #36

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- ReleaseMismatch carries the install line as a field instead of reading
  the platform in its message.
- The server's publish release refusal names both repairs, since it
  cannot tell a repo publish from a global CLI's file publish; the repo
  paths that said "patchy refresh" now say "pnpm patchy refresh".
- Setup errors name the step, path and errno code rather than copying the
  cause's text; ENOENT checks use Schema like the rest of the CLI.
- The front door has one error for an unreadable installer, and replaces
  its placeholder with a function so a URL cannot inject `$` patterns.
- /llms.txt and the global skill tell PowerShell agents to call patchy.cmd.

Refs #36

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…and old Node

From the codex review:

- Under Volta, node prepends its Node image's bin for its own children,
  so the PATH check passed while the calling shell could not find
  patchy. The check now ignores those directories.
- Windows ran npm.cmd and patchy.cmd through cmd with quoted paths, which
  still expands %VAR%. npm now gets only fixed arguments, naming the
  tarball relative to its cwd, and setup runs the package's entry with
  node, with no shell between them.
- The install and login lines single-quote the instance URL, as login's
  own `next` does, so an IPv6 host's brackets cannot glob.
- Default imports, no top-level await and a version check before any
  temp directory let Node 14 and 18 reach the upgrade message.

Adds installer tests for Volta and for another patchy shadowing the new
one on PATH.

Refs #36

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- Volta: refuse before installing when npm's prefix is inside Volta's
  Node image, naming a prefix to own, instead of filtering PATH, which
  also hid an image bin the user had put on PATH deliberately.
- Windows: the tarball reaches npm.cmd as an absolute path through an
  environment variable cmd expands once, so a UNC temp directory works
  and `%` in the path still cannot expand.
- Bare built-in specifiers load on Node 14.0 to 14.13.
- Only an executable file on PATH counts as a patchy the shell would run.

Refs #36

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…r agent

The empty portal said "Ask your agent to publish a page with Patchy",
which gave the agent nothing to start from. It now shows three steps:
paste the selectable line `Set up Patchy using <instance>/llms.txt` to
your agent, confirm the code it shows you, then ask for a page or a tool.
Allison picked this layout (mock C on #36) because many first publishers
have never signed in a CLI and the separate steps carry them through it.

Refs #36

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the t3code/implement-issue-36 branch from 019ac58 to 47f22de Compare October 3, 2026 19:15
@allisonmahmood
allisonmahmood merged commit f8c0f37 into main Oct 3, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the t3code/implement-issue-36 branch October 3, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(server): the agent front door: /llms.txt, an installer and patchy setup

1 participant