xtraq init [options]
| Flag | Description | Tracked Setting | Notes |
|---|---|---|---|
-p, --project-path <project-path> | Target directory (defaults CWD) | n/a | Directory must exist or will be created (no parent fallback) |
-n, --namespace <name> | Root namespace | Namespace | Optional override – CLI resolves automatically when omitted |
-c, --connection <cs> | Snapshot connection string | XTRAQ_GENERATOR_DB | Stored in .env; use least-privilege account |
-s, --schemas <list> | Comma separated allow-list | BuildSchemas | Example: core,identity |
-f, --force | Overwrite existing .env | n/a | Recreates from template and refreshes .xtraqconfig |
-h, --help | Show help | n/a |
{
"command": "init",
"idempotent": true,
"writes": [".env", ".env.example", ".xtraqconfig"],
"reads": [".env", ".env.example"],
"exitCodes": { "0": "Success", "2": "WriteFailure" },
"sideEffects": ["Preserves unknown XTRAQ_* keys and updates provided values"]
}
# Minimal non-interactive initialization
xtraq init --connection "Server=.;Database=AppDb;Trusted_Connection=True;TrustServerCertificate=True;"
# Allow-list schemas and force recreate .env
xtraq init -n Acme.Product.Data -c "Server=.;Database=AppDb;Trusted_Connection=True;" -s core,identity --force
.env contains only the sensitive XTRAQ_GENERATOR_DB placeholder/value. All other defaults live in .xtraqconfig..env are preserved verbatim.xtraq snapshot to refresh metadata before building or testing..xtraqconfig under source control so CI and teammates inherit the same defaults.xtraq (default command)
Default invocation behaviour when no subcommand is supplied. Running the CLI without an explicit subcommand is the fastest way to refresh metadata and generate artefacts in one shot. The root invocation behaves exactly like `xtraq build --refresh-snapshot`.
snapshot
Synchronizes stored procedures, parameters, and schema metadata into `.xtraq/` using the connection defined in your `.env` file.