Commands

init

Initialize a xtraq project with a tracked `.xtraqconfig` snapshot and minimal `.env` secrets. Bootstraps a `.env` file (or updates an existing one) with the generator connection string and logging toggles only, and writes a tracked `.xtraqconfig` snapshot for every non-sensitive default.

Usage

xtraq init [options]

Options

FlagDescriptionTracked SettingNotes
-p, --project-path <project-path>Target directory (defaults CWD)n/aDirectory must exist or will be created (no parent fallback)
-n, --namespace <name>Root namespaceNamespaceOptional override – CLI resolves automatically when omitted
-c, --connection <cs>Snapshot connection stringXTRAQ_GENERATOR_DBStored in .env; use least-privilege account
-s, --schemas <list>Comma separated allow-listBuildSchemasExample: core,identity
-f, --forceOverwrite existing .envn/aRecreates from template and refreshes .xtraqconfig
-h, --helpShow helpn/a

Behavior Contract

{
  "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"]
}

Examples

# 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

Notes

  • .env contains only the sensitive XTRAQ_GENERATOR_DB placeholder/value. All other defaults live in .xtraqconfig.
  • Unknown XTRAQ_* keys in existing .env are preserved verbatim.
  • Follow up with xtraq snapshot to refresh metadata before building or testing.
  • Keep .xtraqconfig under source control so CI and teammates inherit the same defaults.

See Also