foundry init
Initialize or refresh a Foundry platform in the current directory.
Usage
foundry init [OPTIONS]Options
| Flag | Description |
|---|---|
--name, -n | Platform name (kebab-case). Defaults to the current directory name. |
--template, -t | Template to scaffold from. Not yet implemented — any value other than default falls back to the default scaffold. |
--dry-run | Show what would be created without writing any files. |
--force, -f | Force regeneration of .foundry/workspace.yml even if it already exists. |
Behavior
foundry init detects the project state and acts accordingly:
Fresh directory (no foundry.json)
Runs the interactive wizard: scans the filesystem for components, lists what it found (with detected runtime), and offers to add them to the manifest. Discovered services are written with a stack block, an inferred scope, and a deploy.strategy (service for backends, static for frontends; packages get no deploy block). It then prompts for the cloud provider and IaC tool and writes foundry.json (schemaVersion 0.5.0), .foundry/, and updates .gitignore.
Existing manifest, no .foundry/ (upgrade)
Creates the .foundry/ directory, generates workspace.yml, and updates the .gitignore — bringing a manifest-only project up to date.
Already initialized
Prints a project summary (name, schema version, services) and regenerates .foundry/workspace.yml. If it already exists, use --force (or run foundry sync) to rewrite it. Drift between the manifest and the filesystem is reported.
What it writes
foundry.json # the manifest (schemaVersion 0.5.0)
.foundry/
workspace.yml # committed — service path map + drift
config.yml # gitignored — personal config (only when created)
.gitignore # managed — ignores config.yml
.gitignore # legacy blanket .foundry/ ignore is removedPrefix derivation
The platform prefix is derived from the first letter of each word in the name:
"An Average Platform" → prefix "aap"
"My Cool Service" → prefix "mcs"Override it with a top-level prefix (minimum 2 characters).
Structure
A monorepo service lives at apps/{type}/{name} (or packages/{name}). The top-level structure block can rename the top directories (appsDir, ciDir, packagesDir). Services in other repos use repository / path instead.