Skip to content

Cadence Unified Developer CLI Reference ​

cadence is the developer CLI for this repository. It is a .NET 10 Native AOT console app: System.CommandLine parses the command line and Spectre.Console renders the output. The source is in packages/cli/src. Commands are registered in packages/cli/src/Program.cs with AddCommand and AddBranch; the cli-docs gate reads those calls to check that this page documents every command.

Running the CLI ​

Run it through the root package.json script. Run it from the repository root.

bash
pnpm cadence <command> [arguments] [options]

The script runs node scripts/run-cli.js, which executes the compiled Native AOT binary (./bin/cadence) and automatically compiles it on demand when needed. Examples:

bash
pnpm cadence doctor
pnpm cadence check duplication
pnpm cadence gxp sync --dry-run
pnpm cadence scaffold post "Ship Kernel Phase 3"

Some commands also have a make target. Those targets use pnpm cadence and share its on-demand CLI build.

make targetRuns
make doctorcadence doctor --auto-fix
make portscadence check-ports
make devcadence dev
make fixcadence fix
make checkcadence check
make action-pinningcadence check workflow-security
make testcadence test
make verifycadence check, then cadence test
make cicadence ci
make sync-gxp, make gxp-synccadence gxp sync
make rtmcadence gxp validate
make gxp-snapshotCADENCE_GXP_SNAPSHOT=1 cadence gxp snapshot
make adr TITLE="..."cadence scaffold adr "<title>"
make post TITLE="..."cadence scaffold post "<title>"
make db-reset, make db-reset-offlinecadence db reset

make wizard runs scripts/setup_wizard.sh directly. That is the same script as cadence wizard onboarding.

System.CommandLine adds -h|--help|-? to every command, for example pnpm cadence check --help, and --version to the root command. There are no other global options. Every run prints a "Cadence" banner first.

An unknown command or option, a missing required argument, or a group such as cadence gxp without a subcommand prints the error and the command's help, and exits 1. cadence check also rejects option-like tokens where it expects a gate or file name, so a typo such as --pre-comit fails instead of running as a gate name.

Exit code 0 means success. Any other exit code means failure. Some commands always exit 0; the sections below say which.

Commands ​

cadence doctor ​

Checks the local environment. It reports:

  • the .NET SDK version (from dotnet --version)
  • whether Directory.Packages.props exists in the current directory
  • whether the pnpm on the PATH runs and matches the packageManager pin in package.json (ADR-2508)
  • whether detect-secrets-hook runs from .cadence/venv, .venv, PATH, or uvx
  • whether actionlint and hadolint run from .cadence/bin or PATH
  • whether PostgreSQL answers on 127.0.0.1:5432

It exits 1 when the .NET SDK is missing, pnpm is missing/crashes/differs from the pin, or detect-secrets, actionlint, or hadolint is unavailable, and 0 otherwise.

OptionDescription
-f|--auto-fixDeclared as "remediate missing databases and recoverable issues". Currently ignored.

cadence check ​

Runs the quality gates.

bash
pnpm cadence check                       # every gate
pnpm cadence check <gate>                # one gate
pnpm cadence check <gate> <files>        # one gate, limited to these files
pnpm cadence check --exclude <gate>      # every gate except the named gate (repeatable)
pnpm cadence check --base <ref>          # scope branch diffs against <ref> (default: origin/main)
pnpm cadence check --push-before <sha>   # scope push diffs across <sha>..HEAD (falls back to git ls-files -z)
pnpm cadence check --pre-commit          # what the pre-commit hook runs
ArgumentDescription
[gate]One gate to run. Full or short name, for example duplication or detect-code-duplication. Underscores are treated as hyphens.
[files]Files to check. Only the gates marked in the table below use them.
--exclude <gate>Skip a gate by name or alias when running all gates (repeatable). Fails on an unknown gate name or when combined with [gate].
--base <ref>Base Git ref for revision-scoped gates (deid, adrs, gxp-snapshot, baseline-ratchet, and secret scanning; defaults to origin/main). Scans all tracked files when HEAD matches <ref>.
--push-before <sha>Pre-push SHA used in CI push runs (<sha>..HEAD). Falls back to every tracked file (git ls-files -z) when <sha> is all zeros, a tag, or not an ancestor of HEAD. Mutually exclusive with --base.
--pre-commitWhat the pre-commit hook runs: the staged files are the [files], and each gate runs, runs a quicker variant or is skipped as the last column of the table below says.

With no gate, every gate runs in the order below. A failing gate does not stop the run. The command exits 1 if any gate failed. An unknown gate name prints the gate names and exits 1.

The gates are defined once, in packages/cli/src/Services/QualityGates.cs. This table and the one in CI.md are generated from it by pnpm cadence generate-cli-docs; the cli-docs gate fails when either is stale. tests/Cadence.UnitTests/Packages/QualityGateRegistryTests.cs runs every gate against a fixture that must make it fail.

GateAlso acceptedTakes [files]Pre-commit hook (--pre-commit)
dotnet-formatyesQuick: checks staged C# blobs; fails closed when dotnet is missing
dotnet-format-styleyesQuick: checks staged C# files and fails closed when dotnet is missing or unstaged edits overlap MSBuild inputs
prettieryesQuick: streams staged JS, TS, Vue, CSS, JSON, Markdown and YAML blobs over stdin; fails closed when pnpm or node_modules is missing
eslintyesQuick: lints staged JS, TS and Vue blobs over stdin; fails closed when pnpm or node_modules is missing
actionlintvalidate-workflowsyesQuick: validates staged .github/workflows and .github/actions blobs; fails closed when actionlint is missing
hadolinthadolint-docker, validate-dockerfilesyesQuick: lints staged Dockerfile* blobs; fails closed when hadolint is missing
yamlcheck-yaml, validate-yamlyesRuns on the staged files
trailing-whitespacecheck-trailing-whitespaceyesRuns on the staged files
end-of-fileend-of-file-fixer, eof-newlineyesRuns on the staged files
clean-secretsclean-secrets-baselineQuick: validates staged .secrets.baseline JSON without mutating the working tree
detect-secretssecrets-scanyesQuick: scans materialized staged blobs instead of the working tree
duplicationdetect-code-duplicationyesRuns on the staged files
cli-docsvalidate-cli-docsRuns
adrsvalidate-adrsQuick: checks staged files for architectural changes, accepting ADRs already added on the branch
arch-driftvalidate-architecture-driftRuns
sanitizerpath-requirement-sanitizeryesQuick: reports lowercase @req:prd-… tags in staged Markdown blobs without rewriting working-tree files
markdownvalidate-markdownyesRuns on the staged files
env-varsvalidate-environment-variablesRuns
dev-envvalidate-dev-environment, dev-environmentRuns
readmesvalidate-readmesRuns
codeownersvalidate-codeownersRuns
workflow-securityvalidate-workflow-security, action-pinning, check-action-pinningyesRuns on the staged files
rulesetsvalidate-rulesetsRuns
importsvalidate-importsRuns
securityaudit-securityyesRuns on the staged files
deiddeid-compliance-scanyesRuns on the staged files
openapiauto-stage-openapiyesQuick: exports specs only for the services the staged C# files touch, otherwise checks staged docs/api against staged docs/openapi
api-clientsvalidate-api-clientsRuns
schema-docauto-stage-schema-docyesQuick: runs the drift check when staged files include Entity Framework entities, migrations, configurations, or docs/schema
path-patternsvalidate-path-patternsyesRuns on the staged files
query-linterquery-style-linteryesRuns on the staged files
vulnerabilitiesvalidate-vulnerabilitiesRuns
dependenciesvalidate-dependenciesRuns
doc-indexvalidate-doc-indexRuns
demo-manifestvalidate-demo-manifestRuns
rtmgxp-rtm-validateRuns
gxp-snapshotgxp-snapshot-guardQuick: checks the staged files instead of the branch
baseline-ratchetbaselinesQuick: checks staged files against HEAD; CADENCE_BASELINE_GROWTH="<reason>" admits growth
public-bundlevalidate-public-bundleSkipped: checks built VitePress, staff demo, and participant demo bundles in CI and deploy-docs after compilation

The gxp-snapshot gate (also gxp-snapshot-guard, ADR-2532) fails when the generated RTM, the IQ/OQ/PQ report or anything under docs/SDLC/runs/ is changed: the staged files with --pre-commit, the --push-before <sha>..HEAD range on pushes to main or release/*, and otherwise everything the branch changed since its merge base with --base <ref> (default origin/main), uncommitted changes included. With CADENCE_GXP_SNAPSHOT=1 it admits them, and outside the pre-commit hook it then runs cadence gxp diff instead. A branch that changed them restores main's copy with git checkout origin/main -- docs/SDLC/Requirements_Traceability_Matrix.md docs/SDLC/IQ_OQ_PQ_Execution_Report.md docs/SDLC/runs.

The baseline-ratchet gate (also baselines, #5318) fails when a ratchet baseline gained an entry: every tracked *.baseline.txt or *-baseline.txt file (comment lines ignored) and the results of .secrets.baseline, compared as multisets, so a reorder or a shrink passes. With --pre-commit it compares the staged index copies against HEAD and admits staged growth only when CADENCE_BASELINE_GROWTH="<reason>" is set. Outside --pre-commit it rejects any uncommitted working-tree growth and inspects every commit in compareBase..HEAD (--push-before <sha> or the merge base with --base <ref>), requiring each commit that grows a baseline file to carry a matching Baseline-Growth: <path> - <reason> trailer for each grown file. Without the base ref it is skipped locally and fails in CI (CI or GITHUB_ACTIONS set).

The deid gate scans the given files, or the candidate files resolved from --pre-commit, --push-before <sha>, or --base <ref> (default origin/main, falling back to every file git tracks via git ls-files -z when HEAD equals the base ref, the base ref is missing, or --push-before is all zeros, a tag, or a non-ancestor), with the full de-identification detector (packages/deid). Candidate files cover all 22 text extensions (including .vue, .sql, and .svg), AlwaysScannedNames (Dockerfile, Makefile, LICENSE, Pipfile, pyproject.toml, package.json, pnpm-workspace.yaml, pnpm-lock.yaml, uv.lock) and extensionless UTF-8 text files (such as .gitignore and .editorconfig), spanning application code, authored docs/, root portal docs (README.md, ARCHITECTURE.md, AGENTS.md, CONTEXT.md, CONTRIBUTING.md, SECURITY.md, SUPPORT.md, LICENSE), .vue templates, and stores/. Tests, scripts/, vendored standards (docs/CDISC/, docs/NCI/), generated OpenAPI/schema folders, and GxP qualification snapshots (docs/SDLC/runs/, Requirements_Traceability_Matrix.md, IQ_OQ_PQ_Execution_Report.md) are skipped. A source line containing deid-ignore is skipped by deid (never by public-bundle). Findings print as path:line:column and category, never the matched value. Findings that predate the full detector are listed in .deid-baseline.txt (path|category|line hash), which may only shrink: a new finding or a stale entry fails the gate. Run CADENCE_UPDATE_BASELINE=1 pnpm cadence check deid to drop stale entries.

The public-bundle gate (also validate-public-bundle, ADR-2497) scans every generated text file in docs/.vitepress/dist, apps/web/dist, and apps/subject-portal/dist after compilation with zero comment or pragma exemptions, rejecting national identifiers, unapproved email domains, secrets, external assets, executable local backend URLs, and missing or permissive Content-Security-Policy <meta> directives. It is skipped by --pre-commit and runs in docs-build and deploy-docs.yml.

See CI.md for the list of gates and what each one checks.

cadence test ​

Runs dotnet test Cadence.sln from the repository root.

OptionDescription
-f|--fastAdds --filter "Category!=Integration": every test project except the integration tests.
-i|--integrationRuns tests/Cadence.IntegrationTests only. It needs PostgreSQL (see TESTING.md).

With no option, all tests run. If both options are given, --fast wins.

cadence ci ​

Runs the jobs of .github/workflows/ci.yml on this machine, because GitHub Actions does not run jobs for this repository until 2027 (#5017). Each step runs the same command as in CI, in the same order, from the repository root.

bash
pnpm cadence ci                         # actionlint, native-aot-build, lint-and-static, dotnet-quality, docs-build, security, unit-tests, dotnet-tests, accessibility-e2e and compliance
pnpm cadence ci --job dotnet-tests      # one job (repeat --job for more)
pnpm cadence ci --job compliance        # a job and the jobs it needs (native-aot-build, unit-tests, dotnet-tests)
pnpm cadence ci --job accessibility-e2e # the Playwright E2E and browser-to-database job alone
pnpm cadence ci --list                  # what each step runs locally, without running it
OptionDescription
-j|--job <job>Runs this job and the jobs it needs. Jobs: actionlint, native-aot-build, lint-and-static, dotnet-quality, docs-build, security, unit-tests, dotnet-tests, accessibility-e2e, compliance.
--allow-skipSkips steps whose required binary (actionlint, hadolint, shellcheck, detect-secrets-hook, bash) is missing on PATH with the install hint, and accepts a run whose database tests did not execute (without PostgreSQL or with skipped TRX).
--base <ref>The ref forwarded as --base <ref> to CLI check steps and Check GxP Snapshot Policy. Default: origin/main.
--listPrints each step and what it runs locally, then exits 0.

It follows the workflow's rules: inside a job, a failed step stops the later steps unless CI gives them if: always(), and the compliance job runs only when the frontend and .NET test steps passed. The run itself never stops early. It ends with one line per step (passed, failed, covered, skipped or not run, with its time) and exits 1 if any step failed.

Where it differs from CI:

  • PostgreSQL is required. CI gives the .NET tests a database, so without CADENCE_TEST_POSTGRES or CADENCE_TEST_DOCKER=1 (TESTING.md) the test step fails before it starts instead of passing with every database test skipped. After the test step passes, its TRX files are read, and any test in Cadence.IntegrationTests or Cadence.E2ETests that was skipped or did not execute fails the step too (#5325), except the opt-in lineage benchmark and browser correction check listed in DatabaseTestEvidence.OptInTests (the browser correction check runs with CADENCE_TEST_BROWSER=1 in the accessibility-e2e job). --allow-skip accepts the skips.
  • Checks already run once are not repeated. actionlint runs actionlint, lint-and-static runs Prettier, ESLint, Hadolint, markdown and api-clients, dotnet-quality runs cadence check --exclude prettier --exclude eslint --exclude actionlint --exclude hadolint --exclude detect-secrets --exclude api-clients --exclude vulnerabilities --exclude public-bundle, docs-build builds the VitePress portal and co-hosted interactive demos and runs public-bundle, and security runs detect-secrets and vulnerabilities. Steps in security whose gate already ran inside Run Cadence quality sentinels (the static security audit, secrets and DEID) are reported as covered when Run Cadence quality sentinels passed; if that step failed, each runs on its own so the summary shows which gate failed. The Node install and UI build in later jobs are covered by earlier jobs. The documentation build (pnpm docs:build) also runs the read-only openapi, schema-doc, markdown and rtm checks; after Run Cadence quality sentinels passed it runs with CADENCE_DOCS_SKIP_CHECKS=1, which skips the duplicate openapi, schema-doc and markdown gates while keeping check rtm, saving several minutes without touching docs/SDLC or docs/schema.
  • The tests run once. The .NET test step writes its TRX files to TestResults/gxp, and the compliance job's Generate Compliance Reports step builds the RTM and IQ/OQ/PQ report from them instead of running gxp sync, which would run every test again. It writes them to TestResults/gxp/preview/ (to docs/SDLC only with CADENCE_GXP_SNAPSHOT=1), stages nothing, and fails on unknown requirement IDs and failing tagged tests. Check GxP Snapshot Policy (cadence check gxp-snapshot) then fails if the branch changed the committed reports. With CADENCE_GXP_SNAPSHOT=1 it runs cadence gxp diff instead, which fails if the regenerated reports differ from the committed ones outside their evidence block, and puts the committed copies back when they match.
  • Required binaries must be available. actionlint (rhysd/actionlint in CI), Hadolint, ShellCheck, detect-secrets-hook (resolved from .cadence/venv, .venv, or PATH) and bash are not installed for you: when any required binary is missing, the step fails with the install hint so an incomplete environment cannot report green. Pass --allow-skip to record missing tool steps as skipped, with the install hint, instead of failing.
  • Not run: the Playwright browser install, and the jobs that act on GitHub or container registries (container-security, ci-gate, classify, automerge, release-and-archive, deploy-docs).
  • Commit first. CI checks out the commit, so run cadence ci on committed work: gates that list files with git (the full DEID scan, for example) do not see untracked files, and a changed-files step falls back to the working tree only when the branch has no commits over the base.
  • The Native AOT publish targets this machine's runtime (linux-x64 in CI), since AOT does not cross-compile, and writes to a temporary folder.

tests/Cadence.UnitTests/Packages/LocalCiPlanTests.cs reads ci.yml and fails when a job or step is added, renamed or removed, or runs a different command, until packages/cli/src/Services/CiPlan.cs follows.

cadence rulesets ​

Validates the declarative GitHub Repository Rulesets in .github/rulesets/*.json (main.json, release_branches.json, version_tags.json) against .github/workflows/*.yml and reconciles them to GitHub via gh api.

bash
pnpm cadence rulesets --dry-run                       # validate locally and preview planned gh api operations
pnpm cadence rulesets                                 # reconcile .github/rulesets/*.json to GitHub via gh api
pnpm cadence rulesets --repo fderuiter/cadence-clinical # target an explicit owner/repo
OptionDescription
--dry-runValidates .github/rulesets/*.json and workflow parity, prints the planned gh api reconciliation, and exits without mutating GitHub.
--repo <owner/repo>Target GitHub repository (owner/repo). Defaults to GITHUB_REPOSITORY, then git remote get-url origin.

Before making any API request, cadence rulesets runs the rulesets quality gate (RulesetService.Validate): every branch ruleset must set strict_required_status_checks_policy: true, pin required status checks to GitHub Actions (integration_id: 15368), require CI Gate and Check for Merge Conflicts, and match active pull-request workflow jobs (CI Gate in .github/workflows/ci.yml must use if: always() and evaluate every pull-request validation job).

Without --dry-run, it fetches gh api --paginate repos/<owner>/<repo>/rulesets?per_page=100, updates existing rulesets by name (PUT repos/<owner>/<repo>/rulesets/<id> --input <file>), and creates missing ones (POST repos/<owner>/<repo>/rulesets --input <file>). Requires gh authenticated with Administration: write on the target repository, and exits 1 whenever validation fails or any gh api call returns a non-zero exit code or invalid JSON.

cadence dev ​

Starts the .NET Aspire AppHost: dotnet run --project apps/apphost/src/Cadence.AppHost.csproj. The AppHost starts the services, the datastores and the Aspire dashboard. The command waits until the AppHost exits and returns its exit code. It has no options.

cadence fix ​

Resolves the repository root from any working directory (Cadence.sln) and runs the self-healing pipeline in order:

  1. dotnet format whitespace and dotnet format style in the repository root (scoped to changed C# files by default; full Cadence.sln with --full).
  2. Root-wide Prettier auto-formatting across tracked JS, TS, Vue, CSS, JSON, Markdown and YAML files respecting .prettierignore.
  3. .secrets.baseline normalization (SecretsBaselineCleanerService.CleanSecretsBaseline) and upper-case @req:PRD-... tag sanitization in docs/**/*.md (excluding docs/SDLC/runs/).
  4. ADR index synchronization (docs/adr/index.md) and schema validation (AdrValidatorService.ValidateAdrs without git diff), quality gate table generation (GateDocs.Write), documentation index sync (docs/DOCUMENTATION_INDEX.md), and demo study manifest sync (packages/demo-fixtures).
  5. Diff-based EF Core schema documentation (docs/schema/): runs generate-schema-doc when EF Core entities, configurations, or migrations changed (or with --full), skipping otherwise.
  6. Diff-based OpenAPI specifications, API Markdown pages, and web TypeScript client types: exports docs/openapi/ and regenerates docs/api/ when backend C# contracts changed (or with --openapi / --full), and runs pnpm --filter web run generate:api whenever OpenAPI specs are exported or apps/web/src/api/generated/ is stale so check api-clients passes.

Options:

OptionWhat it does
--openapiForce full OpenAPI specification export, docs/api/ regeneration, and pnpm --filter web run generate:api.
--fullForce full regeneration of EF Core docs/schema/, all OpenAPI specs, docs/api/, and web OpenAPI client types.

It exits 1 if any step fails.

Tool commands ​

Single-purpose commands. Most are also run as gates by cadence check. None of them take arguments. Options are listed in the table.

Paths are relative to the repository root. "Calls" is the method the command runs, in packages/tooling_core/src/Services unless noted.

CommandWhat it doesCalls
detect-duplicationFinds duplicated blocks (over 15 normalized lines) in .cs, .py, .js, .vue and .css files under apps/ and packages/. Writes duplication_summary.json. Fails only when a duplicate involves a .cs file.DuplicationDetectorService.DetectDuplication
validate-importsFails when a .cs file in one apps/<service> has using Cadence.Apps.<other service>.ImportValidatorService.ValidateImports
validate-dependenciesValidates JSON syntax and structure across workspace package.json and .config/dotnet-tools.json manifests (failing closed on malformed JSON) and fails when any package.json lists node-forge, elliptic or jose. Passes if no manifests exist.DependencyValidatorService.ValidateDependencies
validate-path-patternsFails on directories named tmp, temp, scratch or old_src, .vue files outside apps/, packages/ and docs/.vitepress/, and .sh files outside scripts/.PathPatternValidatorService.ValidatePathPatterns
validate-readmesFails when a direct subdirectory of apps/ or packages/ has no README.md, or its README has no # title.ReadmeValidatorService.ValidateReadmes
validate-codeownersFails when .github/CODEOWNERS is missing or empty.CodeownersValidatorService.ValidateCodeowners
validate-workflow-securityValidates .github/workflows/*.{yml,yaml} and .github/actions/**/action.{yml,yaml} for 40-hex commit SHAs with version comments, sha256: digests on docker:// refs, persist-credentials: false on actions/checkout, and least-privilege permissions.WorkflowSecurityValidatorService.ValidateWorkflowSecurity
validate-markdownChecks workspace links and # heading spacing in docs/**/*.md.MarkdownValidatorService.ValidateMarkdown
query-linterScans .cs files outside tests/. Fails on interpolated FromSqlRaw($...) or ExecuteSqlRaw($...), and on == true or == false.QueryLinterService.LintQueries
extract-env-varsFinds environment variable reads in .cs and .py files. Fails if .env.example is missing. With --check, returns exit code 1 when variables missing from .env.example or docs/ENVIRONMENT_VARIABLES.md are found. It never writes files.EnvVarExtractorService.ExtractAndValidateEnvVars
audit-securityScans source files, .vue templates and scripts/ for secret patterns (private keys, cloud credentials, API tokens, hardcoded compliance secrets).SecurityAuditorService.AuditSecurity
validate-public-bundleVerifies built docs/.vitepress/dist, apps/web/dist, and apps/subject-portal/dist text artifacts with zero comment or pragma exemptions, rejecting national IDs, unapproved emails, secrets, external assets, executable localhost URLs, and missing/permissive CSP headers. This is the public-bundle gate.PublicBundleValidatorService.ValidatePublicBundles
validate-vulnerabilitiesAudits direct and transitive NuGet, pnpm workspace and Python (pip-audit) dependencies against active exemptions in docs/SDLC/vulnerability_exclusions_ledger.json. Fails closed when any scanner is missing, unrestored, times out or emits invalid JSON, or when unapproved vulnerabilities exist.VulnerabilityAuditorService.AuditVulnerabilities
clean-secrets-baselineNormalizes .secrets.baseline and its canonical file exclusion filter. Skips if the file is missing. Option: --check (verify normalization without modifying .secrets.baseline; exits 1 when unnormalized).SecretsBaselineCleanerService.CleanSecretsBaseline
validate-architecture-driftLists services in docker/docker-compose.yml. Warns when one is not mentioned in ARCHITECTURE.md or docs/SDLC/02_Technical_Design_Document_TDD.md. Fails only if the compose file is missing or has no services.ArchitectureDriftValidatorService.ValidateArchitectureDrift
sync-openapi-specRuns Cadence.OpenApiExporter, which boots every .NET service in memory and exports its OpenAPI document, then writes the specs and the cdisc_openapi.json aggregate to docs/openapi/ and deletes top-level specs no service serves. docs/openapi/legacy/ is left alone. Option: --validate (compare only; exits 1 on drift).OpenApiSyncService.SyncOpenApiSpec
validate-openapi-driftRuns sync-openapi-spec --validate and generate-api-docs --validate. Exits 1 if either finds drift.OpenApiDriftValidatorService.ValidateDrift
generate-api-docsWrites docs/api/<service>.md (one table of operations per service) and docs/api/index.md from docs/openapi/*_openapi.json, and deletes pages with no spec. Option: --validate (compare only; exits 1 on drift).ApiDocsGeneratorService.GenerateApiDocs
generate-schema-docRuns Cadence.SchemaDocExporter, which builds every module's EF Core design-time model (no database needed) and writes one Markdown page per module plus README.md to docs/schema/, deleting files no module produces. Option: --validate (compare only; exits 1 on drift). This is the schema-doc gate.SchemaDocGeneratorService.GenerateSchemaDocumentation
pre-commit-openapiSame as validate-openapi-drift. This is the openapi gate. It does not stage anything.PreCommitOpenApiService.ExecutePreCommitOpenApi
validate-api-clientsChecks that apps/web/src/api/generated/ matches docs/openapi/ (node scripts/generate-api-types.js --check), then runs pnpm exec tsc --noEmit in apps/web, which typechecks the apps/web/src/api clients against their generated OpenAPI types. Exits 1 on stale generated types or a type error. This is the api-clients gate.ApiClientValidatorService.ValidateApiClients
generate-cli-docsWithout options, rewrites the generated quality gate tables in docs/cli.md and docs/CI.md from QualityGates.cs. With --check, runs the cli-docs gate: fails when a table is stale, or this file lacks the required headings or a command registered in Program.cs.GateDocs.Write (packages/cli/src/Services), CliDocsGeneratorService.GenerateCliDocs
generate-doc-indexScans markdown files in docs/ and updates docs/DOCUMENTATION_INDEX.md organized by category. Option: --check (verify index completeness without editing; exits 1 on unindexed files). This is the validate-doc-index gate.DocIndexSyncService.SyncDocIndex
generate-demo-manifestExports the canonical synthetic demo study manifest (CADENCE-101, sites, participants, RFC 9562 UUIDv8 identifiers, and eight realm personas) from DevelopmentDemoData.cs, ExecutionDbSeeder.cs, and docker/cadence-realm.json into packages/demo-fixtures. Option: --check (verify parity without modifying files). This is the demo-manifest gate.DemoManifestGeneratorService.GenerateDemoManifest
generate-rtmBuilds the traceability matrix from requirements in docs/, @req tags in tests and report_dotnet.trx. Writes docs/SDLC/Requirements_Traceability_Matrix.md and docs/SDLC/IQ_OQ_PQ_Execution_Report.md. Options: --validate (write nothing; fail if a mapped test failed), --draft (mark tests as unverified when the report is missing).RtmGeneratorService.GenerateRtm (packages/compliance/src)
compliance-utilityWith --sanitize, upper-cases @req:PRD-... tags in docs/**/*.md, skipping docs/SDLC/runs/. Without it, does nothing.ComplianceUtilityService.ExecuteComplianceUtility
clean-test-dbsDeletes every .db and .sqlite file in the repository whose path does not contain node_modules, bin or obj.CleanTestDbsService.CleanTestDatabases
check-portsReports whether ports 8000-8002, 8004-8019, 5432, 7687 and 8080 are in use on 127.0.0.1. Always exits 0.PortCheckerService.CheckPorts
run-gating-pipelineRuns detect-duplication, validate-imports and validate-openapi-drift. Stops at the first failure.GatingPipelineService.RunGatingPipeline

These commands always exit 0: compliance-utility, clean-test-dbs and check-ports.

cadence gxp ​

GxP compliance documents. The RTM, the IQ/OQ/PQ report and docs/SDLC/runs/ are a snapshot that only cadence gxp snapshot writes, run by the integration owner on the integrated candidate (ADR-2532). A feature branch validates with cadence gxp sync and never commits the snapshot; the gxp-snapshot gate of cadence check enforces this.

cadence gxp sync ​

Validates a feature branch. It writes and stages nothing under docs/SDLC.

  1. Runs dotnet test Cadence.sln --no-restore --configuration Release, writing one TRX file per test project and the database fixtures' environment records (CADENCE_TEST_EVIDENCE_DIR) into TestResults/gxp/.
  2. Generates a preview of the RTM and IQ/OQ/PQ report (see generate-rtm) in TestResults/gxp/preview/ (gitignored), with an evidence block naming the tested revision, the generation time, the database and the runner.
  3. Fails if a test failed, a test declares an unknown requirement ID, a document's integrity stamp is broken, or a database test in the integration or E2E results did not execute.
OptionDescription
--dry-runRuns no tests and writes nothing. Validates the requirement tags and integrity stamps, and with CADENCE_GXP_SNAPSHOT=1 also that the committed RTM's test mapping matches the tags in tests/.
--results-dir <dir>Reuses existing TRX reports and *.database.txt fixture evidence under <dir> instead of running dotnet test, while enforcing all requirement tag, stamp and skipped-database-test gates.

cadence gxp snapshot ​

The integration owner's only command for writing the snapshot. Run it on the integrated candidate against PostgreSQL: CADENCE_GXP_SNAPSHOT=1 pnpm cadence gxp snapshot (or pass --results-dir <dir> to reuse verified CI PostgreSQL test evidence without re-running dotnet test).

  1. Runs the tests as cadence gxp sync does, or reuses existing TRX reports and *.database.txt fixture evidence under <dir> when --results-dir <dir> is given.
  2. Regenerates docs/SDLC/Requirements_Traceability_Matrix.md, docs/SDLC/IQ_OQ_PQ_Execution_Report.md and docs/SDLC/runs/.
  3. Fails, without staging, on the same errors as cadence gxp sync, when *.database.txt fixture metadata is missing under --results-dir, and when the RTM's test mapping does not match the tags in tests/.
  4. Otherwise stages those files with git add when .git is present. Commit them with CADENCE_GXP_SNAPSHOT=1 set, so the pre-commit gxp-snapshot gate admits them.
OptionDescription
--commitAfter staging, runs git commit -m "docs(rtm): take the GxP snapshot from the integrated candidate" with CADENCE_GXP_SNAPSHOT=1 set.
--results-dir <dir>Reuses verified TRX reports and *.database.txt fixture evidence under <dir> instead of running dotnet test; fails if *.database.txt is missing or any mandatory database test skipped.

cadence gxp validate ​

Same as cadence gxp sync --dry-run: no tests run and nothing is written. Unknown requirement IDs and broken integrity stamps fail it. It requires the committed RTM's test mapping to be current only with CADENCE_GXP_SNAPSHOT=1, and it does not compare the checked-in documents with freshly generated ones.

cadence gxp diff ​

Compares the RTM and IQ/OQ/PQ report in the working tree with the copies in the git index, leaving out the evidence block and the integrity stamp, which change on every run. Exits 1 and prints the differing lines when the results or the test mapping differ. The gxp-snapshot gate runs it in snapshot mode (CADENCE_GXP_SNAPSHOT=1) outside the pre-commit hook, as CI's Check GxP Snapshot Policy step does after regenerating the reports.

cadence db ​

Local database commands.

cadence db reset ​

Resets the local datastores:

  1. PostgreSQL: drops and re-creates the schemas. The connection string comes from POSTGRES_CONNECTION_STRING, then DATABASE_URL, then a localhost default.
  2. SQLite: deletes every .db and .sqlite file in the repository whose path does not contain node_modules, bin or obj.

It refuses to run when CADENCE_ENV, ASPNETCORE_ENVIRONMENT or ENVIRONMENT is Production or Prod. It also refuses connection strings that look remote (for example containing prod, aws or azure, or a non-local host). If a datastore cannot be reached, it prints a warning and continues. It exits 0 even when a reset step fails.

cadence db migrate ​

Runs dotnet ef database update --project apps/execution/src/Cadence.Apps.Execution.csproj in the current directory. Only the execution service is migrated. Use scripts/manage_migrations.ps1 to add migrations.

cadence settings ​

cadence settings export ​

Same as the extract-env-vars tool command, including the --check option. It does not write .env.example or any docs.

cadence scaffold ​

cadence scaffold service <name> ​

Runs bash scripts/migrate_service_wizard.sh -ServiceName <name> in the current directory. The script reads its first argument as the service name, so it receives -ServiceName instead of <name>. Use cadence wizard migrate instead. Needs bash, so it does not work on plain Windows.

cadence scaffold adr <title> ​

Creates docs/adr/<yyyy-mm-dd>-<slug>.md from a built-in template. The ADR number is one more than the highest ADR-<n>: found on the first line of existing ADRs, or 100 if there are none. Fails if the file already exists. Appends a link to docs/adr/index.md if that file exists.

The title is required. With make, pass it as make adr TITLE="Use X for Y".

cadence scaffold post <title> ​

Creates docs/blog/<yyyy-mm-dd>-<slug>.md with YAML frontmatter (title, date, authors, summary, tags, draft, related) and structured Markdown sections, then updates docs/DOCUMENTATION_INDEX.md under ## Engineering blog when that file exists. Posts start with draft: true by default so drafts stay excluded from public index pages, site search, and /feed.xml until flipped to draft: false (or created with --publish). Fails with exit code 1 if the title produces an empty slug or the dated file already exists.

The title is required. With make, pass it as make post TITLE="Ship X".

OptionDescription
-a|--author <value>Author GitHub handle or display name (comma-separated for multiple, e.g. fderuiter or --author=@fderuiter). Default: @fderuiter.
-t|--tag <slug>Topic tag slug; repeat or comma-separate for multiple tags. Default: engineering.
-s|--summary <text>One-sentence summary excerpt for the blog index and RSS feed. Defaults to a sentence derived from <title>.
--publishWrites draft: false so the post is published immediately instead of starting as a draft.

cadence hook ​

Agent lifecycle hooks (PRD-SYS-053). .agents/hooks.json runs them from the published binary (make build writes bin/cadence). Each hook reads the runtime's JSON payload on standard input, exits 0 to allow the step, and exits 2 with the reason on standard error to block it. The banner is not printed.

CommandPhaseWhat it does
cadence hook pre-toolPreToolUseBlocks --no-verify, force-pushing or deleting main/master, git filter-branch/filter-repo, rm -rf of /, ~ or the repository, git clean -x, and any write to the generated RTM, IQ/OQ/PQ report or docs/SDLC/runs/. An unreadable payload is blocked.
cadence hook post-writePostToolUseRuns the query-style lint on the edited .cs files and blocks on == true/== false comparisons.
cadence hook pre-invocationPreInvocationPrints the GxP working rules from AGENTS.md.
cadence hook stopStopBlocks finishing while a test declares an unknown requirement ID or a generated document's integrity stamp is broken; with CADENCE_GXP_SNAPSHOT=1 also while the RTM's test mapping is out of date with the requirement tags. Fix the tags and run cadence gxp sync.

cadence wizard ​

Interactive wizards. Each one runs a script in scripts/ from the repository root: the .sh script with bash, or the .ps1 script with PowerShell on Windows. The command returns the script's exit code, or 1 if the script is missing.

CommandScriptArguments
cadence wizard onboardingsetup_wizardNone
cadence wizard dotnetsetup_dotnet_wizardNone
cadence wizard migratemigrate_service_wizardNone. The script prompts for the service.

What each wizard does is defined by its script, not by the CLI.