You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bad5a93
Browse filesBrowse the repository at this point in the historyBrowse files
`go-live` on Vercel tells the person to run `npx vercel --prod`. The Vercel
CLI uploads the project folder, reads `.vercelignore` rather than
`.gitignore`, and its default ignore list does not cover
`.patchstackrc.local.json`, so the API key was uploaded with the deploy.
`go-live` now adds `.patchstackrc.local.json` to `.vercelignore` when the
host is Vercel (creating the file if needed, never adding the line twice)
and says so. If it cannot, it says why and asks the person to add it. `next`
only reads, so its Vercel steps ask for the line instead.
The printed `vercel env add` command now uses `--environment production`,
the syntax the Vercel CLI documents.
The CLI help, README, AGENT-INSTALL.md and the Claude plugin's `next` skill
now say that `go-live` writes this one entry on Vercel.
Amp-Thread-ID: https://ampcode.com/threads/T-2e659ca3-7bd0-4d70-b3d3-09638251060b
Co-authored-by: Danilo Radovic <danilo@patchstack.com>
Copy file name to clipboardExpand all lines: AGENT-INSTALL.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ Every command at a glance — what it does, whether it reads your source, what i
89
89
|`next`| Say where the project stands and the one thing to do now: connect the account (with the link), or go live (with the same steps `go-live` prints, or asking where the app is hosted when the project does not say). Answers the "done" the summary ends on. | Reads the project files `guide` and `go-live` read | The connected note in `.patchstackrc.json`, when it changed | The site UUID, to the public claim page that says whether it is connected (skipped once `.patchstackrc.json` records that it is) |
90
90
| `doctor [--url <live app>]` | Check that everything Patchstack needs works, and print each problem with its fix: the install, the site, the account, the guard's wiring, its rules file, the read-only rules credential, the map link, the build steps, and whether the published app fetches its rules. A problem only the app's owner can fix (connecting the account, publishing) is marked as theirs. Exits 1 when it finds a problem. | Reads the project files `guide` and `protect --check` read | Nothing | The site UUID, to the public claim page that says whether it is connected (skipped once `.patchstackrc.json` records that it is); the read-only rules credential from the guard's rules file, and the site key when this machine holds one, each once to `monitor/pulse/token`, to check Patchstack accepts them; one GET with that token to `monitor/pulse/sync-status/<your site uuid>`, which answers only when the published app (read-only credential) and a key-holding copy last fetched rules, and how many (doctor never fetches rules itself, which would be recorded as a fetch); with `--url`, two GET requests to that address: its page, and the same page with a test attack in a `file` parameter, which another firewall in front of the app may also flag |
91
91
|`vulns`| Show what Patchstack found in this project's packages: vulnerabilities by severity and outdated packages, as counts, with the link that shows the details. Package names are shown in the dashboard once the site is connected. | No | Nothing | The site UUID, to the public claim page that returns the counts |
92
-
|`go-live [--host <name>]`| Show how to add the project's API key to its host and deploy, in three steps. The host is read from project files (`vercel.json`, `netlify.toml`, `wrangler.toml`, `fly.toml`, `render.yaml`, `railway.json`, `amplify.yml`, `Procfile`, `.replit`, a Lovable project's packages) or named with `--host`. The commands it prints read the key from `.patchstackrc.local.json` as they run; it never prints the key. | Reads those project files only |Nothing| Nothing |
92
+
|`go-live [--host <name>]`| Show how to add the project's API key to its host and deploy, in three steps. The host is read from project files (`vercel.json`, `netlify.toml`, `wrangler.toml`, `fly.toml`, `render.yaml`, `railway.json`, `amplify.yml`, `Procfile`, `.replit`, a Lovable project's packages) or named with `--host`. The commands it prints read the key from `.patchstackrc.local.json` as they run; it never prints the key. | Reads those project files only |On Vercel only, a `.vercelignore` entry for `.patchstackrc.local.json` (the file is created if missing): the Vercel CLI uploads the project folder and does not read `.gitignore`| Nothing |
93
93
|`widget [--remove]`| Add the Patchstack Connector widget tag to the root page (in a workspace repo, the app package's root page), or take the tag Connect added out with `--remove` (a tag added by hand is left alone). Saves the choice as `"widget"` in `.patchstackrc.json`, which `scan` and `mark-build` follow; `setup --widget` saves the same choice. | Reads the root page to find where the tag goes |`.patchstackrc.json`; the widget `<script>` tag in the root HTML shell or framework root | Nothing |
94
94
|`init <site-uuid>`| Optional: pre-seed `.patchstackrc.json` with an existing UUID. | No |`.patchstackrc.json` only | Nothing |
95
95
|`mark-build`| Ensure the widget tag in built pages, and — **on a production build only** — stamp the live-site flag + build fingerprint. A local or preview build is stamped with neither, and has a stale marker removed; `--production` forces it for a build published by hand. Run as a `postbuild` step. | No | Build output only (`dist/ build/ out/ .output/public/ _site/`) — never source | The same manifest `scan` sent, plus one word for what it did with the marker — and only for a site already registered |
@@ -218,13 +218,15 @@ Only when the person asks you to publish the site. Start with `npx @patchstack/c
218
218
```
219
219
220
220
A preview deploy runs without the prefix.
221
-
-**A deploy that builds on the host** (`vercel --prod`, or any git-connected Netlify or Vercel site) labels production by itself, but the host never receives`.patchstackrc.local.json`. Before the first production deploy, put the key in the host's production settings, read straight from the file so it is never printed:
221
+
-**A deploy that builds on the host** (`vercel --prod`, or any git-connected Netlify or Vercel site) labels production by itself, but the host must not receive`.patchstackrc.local.json`. Before the first production deploy, put the key in the host's production settings, read straight from the file so it is never printed:
npx netlify env:set PATCHSTACK_API_KEY "$(node -p "require('./.patchstackrc.local.json').apiKey")" --context production --secret
226
226
```
227
227
228
+
`vercel --prod` uploads the project folder, and the Vercel CLI reads `.vercelignore`, not `.gitignore`. `go-live` on a Vercel project adds `.patchstackrc.local.json` to `.vercelignore`; if it says it could not, add the line yourself before deploying.
229
+
228
230
An app with a server needs this for runtime protection: the guard fetches its rules with the key. Without it the deploy is still recognised as long as the packages have not changed since the last scan, but nothing is protected. Never put the key in a committed file, in a public variable (`NEXT_PUBLIC_*`, `VITE_*`), or in your reply.
229
231
-**A host that builds the site itself but is not named under "How each environment is labelled"** — ChatGPT Sites (`*.chatgpt.site`, published from Codex) is one — gives Patchstack nothing that says "production", so its builds report `local` and the live site is never recognised as deployed. In that host's environment settings for the published site, set two variables: `PATCHSTACK_API_KEY`, read from `.patchstackrc.local.json` as above, and `PATCHSTACK_ENVIRONMENT=production`. Set the label only where the published build reads it, never in a committed file, and not in settings a preview or the local dev server also reads. Then publish again: the deployed site keeps serving the build from before setup until it is rebuilt.
230
232
-**Give Patchstack the live address when the host does not.** Patchstack confirms a deploy by reading the build marker off the live page, either when a visitor's browser loads the widget or through its own scheduled check of the site's address. A new site may get no visitors for days, so the scheduled check is often the only confirmation, and it can only read an address Patchstack has. Vercel, Netlify, Render and Railway production builds report their address themselves (see "Package and command behavior"). Anywhere else, including ChatGPT Sites, Lovable or Bolt, a custom domain, GitHub Pages, Cloudflare Pages or a folder uploaded by hand, take the public address from the deploy output or ask the person for it. Then:
@@ -1139,7 +1141,7 @@ Remove only the pieces that are actually present — check for each first. If no
1139
1141
4.**Remove the hooks from `package.json` scripts.** If a hook was chained (e.g. `"postbuild": "existing-command && patchstack-connect mark-build"`), remove only the `patchstack-connect …` part and keep the rest; if removal leaves a script empty, delete the key.
1140
1142
5.**Signal Patchstack that the package is being removed**: run `npx @patchstack/connect uninstall` (while the package is still installed and `.patchstackrc.json` still exists). If the site was never claimed, this deletes its anonymous record on Patchstack; if the site is claimed, it is only flagged — the record stays until its owner removes it in the dashboard. A failed signal must not stop the uninstall; continue with the remaining steps.
1141
1143
6.**Uninstall the package** with the manager matching the lockfile: `npm uninstall` / `pnpm remove` / `yarn remove` / `bun remove``@patchstack/connect`. Don't hand-edit `node_modules` or the lockfile.
1142
-
7.**Delete `.patchstackrc.json` and `.patchstackrc.local.json`** (the second holds the API key and is git-ignored, so it is present locally even when the repo shows nothing), remove the `.gitignore` entry setup added for it, and remove `PATCHSTACK_SITE_UUID`, `PATCHSTACK_API_KEY` (and public-prefixed variants like `NEXT_PUBLIC_PATCHSTACK_SITE_UUID`) from env files and CI variables.
1144
+
7.**Delete `.patchstackrc.json` and `.patchstackrc.local.json`** (the second holds the API key and is git-ignored, so it is present locally even when the repo shows nothing), remove the `.gitignore` entry setup added for it (and the `.vercelignore` entry `go-live` added on Vercel), and remove `PATCHSTACK_SITE_UUID`, `PATCHSTACK_API_KEY` (and public-prefixed variants like `NEXT_PUBLIC_PATCHSTACK_SITE_UUID`) from env files and CI variables.
1143
1145
8.**Commit** the changes. Reporting stops immediately. On HTML shells the `window.__PATCHSTACK_PROD__` flag that `mark-build` stamped on production builds lives only in build output — the next build simply won't contain it (rebuild if build output is committed). On JSX roots and Astro layouts `scan` wrote the same marker into source; remove that managed `#region patchstack` block (or the hand-pasted equivalent) with the widget tag in step 2.
1144
1146
1145
1147
The `uninstall` signal is the only account-side effect local removal can have: it deletes an *unclaimed* (anonymous) record and merely flags a *claimed* one. A claimed site keeps using a site slot until its owner removes it in the dashboard at https://app.patchstack.com — end your report by telling the user this, alongside the site UUID from step 1. Never attempt to authenticate or remove a claimed site on the user's behalf.
Copy file name to clipboardExpand all lines: claude-plugin/skills/next/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,6 @@ Run the command that matches what the person said, in the project root, and show
29
29
| "What did Patchstack find?", "show me the vulnerabilities" |`npx @patchstack/connect vulns`|
30
30
| "Show my Patchstack summary" |`npx @patchstack/connect summary`|
31
31
32
-
`next` checks with Patchstack whether the account is connected, so it sends the project's site ID; the others read the project only. None of them starts, builds or deploys the app, and you should not either: deploying is the person's step, and `go-live` prints how to do it on their host.
32
+
`next` checks with Patchstack whether the account is connected, so it sends the project's site ID; the others read the project only, except that `go-live` on a Vercel project adds `.patchstackrc.local.json` to `.vercelignore` so a `vercel` deploy does not upload the key. None of them starts, builds or deploys the app, and you should not either: deploying is the person's step, and `go-live` prints how to do it on their host.
33
33
34
34
If the project has no `.patchstackrc.json`, Patchstack is not set up here yet: use the `setup` skill.
0 commit comments