Commands
agent-commerce init
Interactively generate a config.yaml — validated before anything is written.
agent-commerce init [--output <path>] [--force] [--yes]Options
--output <path>stringdefault: config.yamlWhere to write the file. Parent directories are created.
--forcebooleandefault: falseOverwrite an existing file. Without it an existing file stops the run.
--yesbooleandefault: falseNon-interactive defaults — required for scripts and tests.
Prompts
| Prompt | Default |
|---|---|
| Backend base URL (your existing merchant API) | http://localhost:3000 |
| Which example resource(s) do you want to expose? | Weather (free), Market report (paid) |
| Which protocols should be enabled? | HTTP, MCP |
| Enable x402 payments? | yes |
| Merchant settlement address (enter an address you control) | Anvil development account #1, asked only when x402 is enabled |
The prompts reject a URL without http:// or https://, an empty protocol selection and a malformed address. The answers are then validated in memory; if that fails, nothing is written and the configuration error names the field.
The result is a local starting pointThe file binds
127.0.0.1, leaves server.adminToken and allowedOrigins unset, settles on the local chain eip155:31337, and uses Anvil's public development keys with a placeholder asset. Set the MockUSDC address from .deploy/local.json before running locally, and your own payTo before any funded network.Output
$ agent-commerce init --yes
PASS Wrote config.yaml
PASS config.yaml is valid: 2 resource(s)
Next steps:
agent-commerce validate --config config.yaml
agent-commerce start --config config.yaml # needs the x402 and MCP peers
agent-commerce doctor --config config.yaml # from a second terminal
docker compose up # or the whole local demo stack, from a repo clone$ agent-commerce init
FAIL config.yaml already exists. Re-run with --force to overwrite.