Repository navigation
[NO-TICKET] Add a doctor command that checks everything and says how to fix it - #453
Merged
Merged
Conversation
`npx @patchstack/connect doctor` runs every check Patchstack depends on in one go and prints each problem with its fix: the install, the site, the account, the guard's wiring, its rules file, the read-only rules credential (and whether Patchstack still accepts it), the map link and the build steps. With --url it also checks the live app: that it carries the widget, and that its guard blocks a test attack. Problems only the app's owner can fix (connecting the account, publishing) are marked as theirs, so an assistant fixes the rest and passes those on instead of waiting on them. It writes nothing and exits 1 when it finds a problem. AGENT-INSTALL.md tells the agent to run it after setup and fix each problem until none is left, and discloses what it sends. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
/review |
|
🎯 Elite quality (94%) — Adds a well-structured doctor command with injectable fetch and thorough tests for each finding path. 📦 Large, and not size-checked — 473 lines changed, over your team's 400-line limit. Coding agents can call the 🤖 Written by Claude Code — going by its own attribution. Unknown whether a person read it; agents can report that with the |
daniloradovic
approved these changes
Oct 26, 2026
doctor now reads Patchstack's record of the app's rules fetches from monitor/pulse/sync-status/<uuid>, with the token from the credential it already checks (the site key when this machine holds one, otherwise the read-only credential). It says when the published app last fetched its rules and how many, and never fetches rules itself, which would be recorded as a fetch and fake the signal. An app with no visitors does not fetch, so an old or missing fetch is a question until doctor --url has just visited the app, and a problem after. A fetch only on the site key is reported as such, not as the published app. A server without the endpoint is reported as not reporting syncing yet. AGENT-INSTALL.md discloses the extra token request and the read. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Pairs with patchstack/saas#2318 (the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
A new command,
npx @patchstack/connect doctor [--url <live app>], runs every check Patchstack depends on and prints each problem with its fix. It is meant for the assistant installing Patchstack as much as for a person.What it checks
protect --check) and carries the site.--url: the live app carries the widget, and its guard blocks a test attack (?file=../../../../etc/passwd). If the page itself does not load, no test attack is sent.monitor/pulse/sync-status/<uuid>(patchstack/saas PR below), with the token from the credential it already checks: the site key if this machine holds one, otherwise the read-only credential.?untildoctor --urlhas just visited the app, and a✗after.What it reports
Fix:line, then what could not be checked (?), then what passed.The endpoint answers only rules-fetch times and counts. It returns nothing about attack reports (that would be a detection oracle on a credential that can be public) and nothing about visitor activity.
These checks cover the silent failures found on Lovable and Hostinger apps: no read-only credential, a refused credential, a map not linked, a guard not wired, and a live app that has not been republished.
AGENT-INSTALL.mddoctorafter setup, fix each✗and run it again until none is left. Owner steps are passed on.doctorgets a row in the command table, disclosing what it sends:monitor/pulse/tokenwith the read-only credential (and the site key, when present);monitor/pulse/sync-status/<uuid>read;--url, two GET requests to that address, noting that another firewall may also flag the test attack.README.mdlists the command.Example (a copy of a real Lovable project)
How it was verified
tests/doctor.test.ts(16 tests):?, not a problem);--urlcases: blocked, let through, and a page that does not load (no test attack is sent);?without a visit and✗after one; never fetched after a visit; a key-only fetch; a server without the endpoint.npm run typecheck,npm run build, fullnpm test(4638 passed; 3 timing tests timed out under full-suite load and pass alone) andcapabilities:checkare green. No new endpoints: it reuses the claim-page lookup and the token endpoint, and starts no process.Rollout
New command and
AGENT-INSTALL.mdchanges, so the hostile field test is owed after the release that carries this, plusstandard/lovablefor doc accuracy.🤖 Generated with Claude Code