run402-mcp
Version:
MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.
101 lines • 4.36 kB
TypeScript
/**
* `r.doctor()` — local health and configuration diagnostics, owned by the
* Node SDK: config directory, wallet, local project keys, API reachability,
* tier and organization lifecycle, account health, function runtime
* staleness, recovery posture, the vault, and the scoped source scan.
*
* The report is `{ ok, blocking[], warnings[], checks[] }`. `ok` answers ONE
* question — can this agent ship from here — and is true exactly when
* `blocking[]` is empty. Every check carries a `severity`:
* blocking would stop a deploy
* advisory a gap worth surfacing that never stops a deploy (`warnings[]`)
* info nothing to act on
* A status outside the known vocabulary fails closed as blocking.
*
* `run402 doctor` is a shim over this; the checks that belong to the calling
* program itself (whether the installed CLI is current, its resident vault
* helper) are hooks the caller supplies.
*/
import type { Run402 } from "../index.js";
/**
* The stable, complete registry of ordinary-mode check names, in the order
* each normally runs: the one list `only` validates against.
*/
export declare const DOCTOR_CHECK_NAMES: readonly ["config_dir", "cli_update", "wallet", "projects", "api_reachable", "tier", "account_health", "runtime_staleness", "retiring_routes", "recovery_posture", "vault", "source_scan"];
export type DoctorCheckName = (typeof DOCTOR_CHECK_NAMES)[number];
export type DoctorSeverity = "blocking" | "advisory" | "info";
/** One check as a check function produces it; `severity` is derived when absent. */
export interface DoctorCheck {
name: string;
status: string;
severity?: DoctorSeverity;
value?: unknown;
hint?: string;
message?: string;
code?: string;
[key: string]: unknown;
}
export interface DoctorReportCheck extends DoctorCheck {
severity: DoctorSeverity;
}
export interface DoctorReport {
ok: boolean;
blocking: Array<{
check: string;
status: string;
message: string;
hint?: string;
}>;
warnings: Array<{
check: string;
code?: string;
message: string;
hint?: string;
}>;
checks: DoctorReportCheck[];
}
export interface DoctorOptions {
/** Include extra detail (timing, wallet details without secrets). */
verbose?: boolean;
/** Force a live update check in the `cliUpdate` hook. */
refresh?: boolean;
/** Skip the source-tree scan. */
noScan?: boolean;
/** Advanced arbitrary scan directory; does not claim deployment readiness. */
scanDir?: string | null;
/** Application directory for deployment diagnostics. */
dir?: string | null;
/** Explicit manifest for deployment diagnostics. */
manifest?: string | null;
/** Target THIS project's vault check (scoped to the vault check only). */
project?: string | null;
/** Run only these checks; every other check's work is skipped entirely. */
only?: string[];
/** Directory the vault targeting and application scope start from. Default `process.cwd()`. */
cwd?: string;
/**
* The calling program's own update check, producing the `cli_update`
* check. Absent: `cli_update` reports `skipped`.
*/
cliUpdate?: (opts: {
refresh: boolean;
}) => Promise<DoctorCheck>;
/**
* The calling program's resident vault helper, reported inside the vault
* check's `value.daemon`. Absent: no `daemon` field.
*/
daemonStatus?: () => Promise<Record<string, unknown>>;
/** Receives the one-line warning when `project` disagrees with the repository's own remote. */
warn?: (line: string) => void;
}
/**
* Fold per-check results into `{ ok, blocking[], warnings[], checks[] }`:
* one warning per gap string of every advisory check (one for an advisory
* check with no gaps), one blocking entry per blocking check. Pure.
*/
export declare function buildDoctorReport(rawChecks: DoctorCheck[]): DoctorReport;
/** Refuse an `only` name outside {@link DOCTOR_CHECK_NAMES} (`BAD_USAGE`, listing the valid names). */
export declare function assertDoctorCheckNames(names: readonly string[]): void;
/** Run the ordinary-mode checks against `r` and fold them into the report. */
export declare function runDoctor(r: Run402, opts?: DoctorOptions): Promise<DoctorReport>;
//# sourceMappingURL=doctor.d.ts.map