Monarch Shield parses JavaScript and TypeScript, follows selected official x402 imports and client aliases, and fails paid calls that have no recognized syntactic abort or denial return on the same client path.
Run the Doctor command locally or in CI. No account or API key.
npx @monarch-shield/x402@0.2.0 doctor
Single-file static analysis. A pass does not prove that the policy is correct or the payment is safe.
npx @monarch-shield/x402@0.2.0 doctor --ci --strict
fetchWithPayment() can pay, but its x402 client has no recognized policy hook.
Add a recognized syntactic abort or denial return to the same client path, then rerun Doctor.
Doctor checks whether supported x402 payment creation has an earlier recognized syntactic abort or denial return on the same client path. It is a merge-time linter, not a runtime authorization or settlement system.
The product is strongest when the code, package, Action, docs, and claims all describe the same static-analysis contract.
Distinguishes official x402 client imports from unrelated functions with similar names.
Rejects late hooks, observer-only hooks, and hooks attached to the wrong client.
Parse failures and selected dynamic, reassigned, or cross-file escapes fail instead of returning a clean scan.
Custom wrappers, cross-file control flow, unsupported languages, and unrecognized x402 APIs still need manual review.
Ten public fixtures record expected status, exit code, policy-seam state, and analysis state. Packed-package checks rerun the corpus in a fresh temporary project.
Evidence boundary: these are maintainer-produced examples. No external adoption is claimed.
These are analyzer targets, not partnership or compatibility claims. Each target is tied to a public fixture and regression test.
Custom wrappers and APIs outside this list require manual review.
A paid wrapper created from an x402 client with no recognized policy seam fails.
An onBeforePaymentCreation callback that only observes or logs cannot block payment creation.
An MCP onBeforePayment observer cannot stop the automatic payment path.
A policy hook on one client does not protect a paid wrapper created with another client.
A hook registered after the paid call does not satisfy the source-order rule.
A function named checkBeforePayment from another package is not trusted.
Parse errors and selected dynamic or cross-file escapes fail closed.
Use Doctor as a merge-time check. Keep authorization, spend limits, simulation, delivery, and settlement controls in the runtime stack.
Doctor parses supported JavaScript and TypeScript and maps selected x402 imports and aliases.
Each finding names the file, source location, x402 call type, and missing or incomplete policy state.
Add a recognized syntactic abort or denial return to the real client path, rerun Doctor, and retain the check on pull requests.
The repository includes CLI help, a GitHub Action, SARIF, a machine-readable corpus, agent instructions, and exact limitations.
Open documentationMonarch Shield does not promise complete payment safety or prove general reachability. It checks for specific syntactic abort or denial returns and rejects obvious constant-dead branches.
Run the scanner locally, inspect every finding, and open an issue with a minimal fixture if Doctor misses a pattern or reports a false positive.
View the GitHub repository