/** * `paygate init` — orchestration: parse argv → validate → plan → write. * * Zero runtime deps by design (paygate ships with `dependencies: {}`): * hand-rolled argv parser, node:readline for the interactive prompts, * node:fs / node:path for writes. All pure logic (parsing, validation, * planning, conflict detection) is exported for unit tests; only * `runInit` touches process/stdin. */ import { type GeneratedFile, type InitFramework, type TemplateOptions } from "./init-templates.js"; export declare const WALLET_RE: RegExp; export interface RawArgs { framework?: string; wallet?: string; route?: string; method?: string; price?: string; currency?: string; network?: string; directory?: string; merchantId?: string; yes: boolean; dryRun: boolean; help: boolean; } export type ParseResult = { ok: true; args: RawArgs; } | { ok: false; error: string; }; export declare function parseArgv(argv: string[]): ParseResult; export interface ValidatedOptions extends TemplateOptions { directory: string; dryRun: boolean; } export type ValidateResult = { ok: true; options: ValidatedOptions; } | { ok: false; errors: string[]; }; export declare function validateArgs(args: RawArgs): ValidateResult; export declare function deriveProjectName(framework: InitFramework, merchantMode: boolean): string; export declare function planFiles(options: ValidatedOptions): GeneratedFile[]; export interface WritePlan { /** Files that will be created. */ create: GeneratedFile[]; /** Files that already exist byte-identical (idempotent re-run — skipped). */ identical: string[]; /** Files that exist with DIFFERENT content — the plan must be refused. */ conflicts: string[]; } /** * Directory safety: writing is allowed iff every planned file either does * not exist yet or exists byte-identical (idempotent re-run). Unrelated * files in the directory are left alone and do not block. */ export declare function checkWritePlan(directory: string, files: GeneratedFile[]): WritePlan; export declare function writeFiles(directory: string, files: GeneratedFile[]): void; export declare function dryRunOutput(options: ValidatedOptions, files: GeneratedFile[]): string; export declare const HELP_TEXT = "paygate init \u2014 make your API payable in one command.\n\nScaffolds a working x402 seller with the ArisPay facilitator as the\nproduction default. Fully non-interactive with flags (for agents/CI).\n\nUsage:\n npx paygate init --framework express --wallet 0xYourAddress [options]\n\nOptions:\n --framework express | fastify | next | hono | workers | fastapi\n --wallet <0x...> EVM address that receives funds (public info, not a secret)\n --route Paid route path (default: /api/paid)\n --method GET | POST | PUT | DELETE (default: GET)\n --price Price in INTEGER cents (default: 1 = $0.01)\n --currency USD | EUR (default: USD; EUR requires --network base)\n --network base | base-sepolia (default: base-sepolia \u2014 testnet.\n Base mainnet is used ONLY when you pass --network base.)\n --directory Target directory (default: ./)\n --merchant-id Hosted PayGate mode (express/fastify): use the paygate\n SDK + your merchant account instead of the account-free\n upstream template.\n --yes, -y Accept defaults, never prompt.\n --dry-run Print the file plan (JSON lines + summary), write nothing.\n --help, -h Show this help.\n\nNetworks & facilitators:\n base-sepolia (default) testnet \u2014 FACILITATOR_URL defaults to\n https://x402.org/facilitator (Coinbase's public\n testnet facilitator). The ArisPay facilitator does\n NOT settle testnets.\n base production \u2014 FACILITATOR_URL defaults to\n https://facilitator.arispay.app (Base mainnet,\n USDC + EURC, no facilitator fee).\n"; export interface InitIO { stdout: (s: string) => void; stderr: (s: string) => void; /** Whether stdin is a TTY (prompting allowed). */ isTTY: boolean; /** Ask one question; resolve with the raw answer. Only called when isTTY. */ ask: (question: string) => Promise; } export declare function defaultIO(): InitIO; /** Which required inputs are missing for a non-interactive run? */ export declare function missingRequired(args: RawArgs): string[]; /** Run `paygate init`. Returns a process exit code. */ export declare function runInit(argv: string[], io?: InitIO): Promise; //# sourceMappingURL=init.d.ts.map