weir init — scaffold a new app in under a minute
Permalink to weir init — scaffold a new app in under a minuteweir init is the first command a new integration runs: give it an app id and a platform, and it writes a valid weir/app.json, a working starter flow, and the flow's built baseline bundle. For a delivery-backed integration, first export the supplied delivery origin and app token: init uses them to write weir.config.json with that origin's manifest URL and pinned public key. Run it right after installing the toolkit, before you hand-author anything.
It reuses weir_app_scaffold's scaffold logic exactly (same files, same doctor-ready guarantee) and is registered under both names; weir init is the discoverable "first five minutes" name.
Invocation
Permalink to InvocationDelivery-backed app (React Native/Expo and production-like local stacks)
Permalink to Delivery-backed app (React Native/Expo and production-like local stacks)Export these values before the first init, then run init once. They are deliberately environment variables rather than flow fields, so they cannot be committed with the app configuration:
export WEIR_API_URL="<the supplied local or delivery API URL>"
export WEIR_API_TOKEN="<the supplied app token>"
./node_modules/.bin/weir init --appId my-app --platform reactNative --appRoot . --acknowledgePrivateRuntimeFor a delivered/private toolkit, invoke only the binary in this app's installed kit: ./node_modules/.bin/weir. Do not use a bare weir command from your shell PATH; a globally installed toolkit can be older or a different build and may silently write a different scaffold. The rest of this page uses weir as shorthand for that local binary.
Confirm that both weir/app.json and weir.config.json now exist before editing the starter flow. Do not run weir init --force after beginning integration: it overwrites the scaffold and starter flow. If the first init was missing its delivery settings, restore the clean app checkout, export both values, then run the single normal init again.
Offline scaffold
Permalink to Offline scaffoldFor a source-only offline scaffold with no delivery origin, use the normal invocation below. It does not create a deployment-pinned weir.config.json; add delivery credentials before a real publish.
As an MCP tool (from an agent host with the Weir MCP server registered — see Install the toolkit):
weir_init({ appId: "my-app", platform: "ios" })As the CLI (identical behavior, same field names):
weir init --appId my-app --platform iosArguments
Permalink to Arguments| Field | Required | Default | Meaning |
|---|---|---|---|
appId | yes | — | New app id. Used in weir/app.json, the feature-flag name, and (sanitized) the starter paywall's product id. |
appRoot | no | current working directory | Root directory of the host app to scaffold weir/ into. |
platform | no | "ios" | "ios", "android", or "reactNative". Only iOS has a public runtime; the other values are private design-partner contracts. |
appVersion | no | "1.0.0" | The host app's semantic marketing version in exact x.y.z form, used for compatibility status. |
acknowledgePrivateRuntime | no | false | Required for Android or React Native. Confirms you already understand that no public runtime can be acquired; it does not install or grant the private runtime. |
flowId | no | "onboarding" | Id for the starter flow; also its spec file name (weir/flows/<flowId>.json). |
placement | no | "launch" | Where this flow is presented from, e.g. "launch" or "verdict_ready". |
force | no | false | Overwrite an existing weir/app.json and starter flow spec. Without it, weir init refuses to run a second time over an existing scaffold. |
What it writes
Permalink to What it writes<appRoot>/
weir/
app.json # complete, valid weir/app.json — parses against weirAppConfigSchema
flows/
onboarding.json # starter specVersion-4 flow: welcome -> paywall (stock screen types only)
config/
onboarding/
config.json # native v4 baseline config embedded by the host appThe starter flow already passes @x/spec's validate()/normalizeFlow() and the full weir_conform gate (a persona walk reaches complete(), the event stream matches the manifest, perf budgets and native-feel checks hold). So weir_app_doctor, run immediately after weir init, reports sourceContractReady: true with readinessKind: "source-contract-only" and zero failures. This is not a runtime or shipping verdict. No integrationFile is scaffolded — wiring Weir.configure/present into the host app is deliberately left to you — so the doctor's native-adapter check only warns ("integrationFile not declared") until you add one.
Output and next steps
Permalink to Output and next stepsweir init prints a JSON result with scaffolded: true, the resolved appId/platform/ flowId, the paths it wrote, and a next array of agent-legible next steps:
- Wire the native SDK. Add
integrationFileinside that flow object inweir/app.jsononce you call the printed platform-specific SDK API; the doctor'ssdk-usecheck fails the source contract if that file exists but never calls the SDK. - Validate the contract:
weir app-doctor --appRoot <app-root>. - Optional browser QA only:
weir dev --specPath <app-root>/weir/flows/<flow-id>.json --serve. This previews mocked native behavior; it does not validate native embedding. - Learn the flow vocabulary before editing:
weir schemafor all screen types and flow fields, orweir schema <screenType>for one type. - Replace the starter screens. Edit
weir/flows/<flow-id>.json, rebuildweir/config/<flow-id>/config.jsonfrom the normalized v4 spec, then re-runweir app-doctor. - Test the publish path with no account and no network:
weir release --appRoot <app-root> --flowId <flow-id> --dryRun(builds once, runs the full conform gate, never calls any API). - View the flow in a real local dashboard:
weir dashboardstarts a dev-mode local API and dashboard UI, signs you in automatically, and prints the URL to open. It requires Node.js 22+; other toolkit commands work on Node 18+. - Publish for real once you have a token: get one from the Weir dashboard, set
WEIR_API_TOKEN, then runweir release --appRoot <app-root> --flowId <flow-id>(drop--dryRun).
Re-running
Permalink to Re-runningweir init refuses to overwrite an existing weir/app.json or starter flow spec unless force: true is passed — safe to run once per app id without silently clobbering hand-edited files.
See also
Permalink to See also- Install the Weir skill / MCP server — register the tools first.
- Onboard an app — the full
weir/app.jsoncontract, monorepo--appRootconventions, and Android SDK/wiring details. - Run everything locally — why every step above works with zero network and zero account.