Appearance
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 target | Runs |
|---|---|
make doctor | cadence doctor --auto-fix |
make ports | cadence check-ports |
make dev | cadence dev |
make fix | cadence fix |
make check | cadence check |
make action-pinning | cadence check workflow-security |
make test | cadence test |
make verify | cadence check, then cadence test |
make ci | cadence ci |
make sync-gxp, make gxp-sync | cadence gxp sync |
make rtm | cadence gxp validate |
make gxp-snapshot | CADENCE_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-offline | cadence 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.propsexists in the current directory - whether the pnpm on the
PATHruns and matches thepackageManagerpin inpackage.json(ADR-2508) - whether
detect-secrets-hookruns from.cadence/venv,.venv,PATH, oruvx - whether
actionlintandhadolintrun from.cadence/binorPATH - 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.
| Option | Description |
|---|---|
-f|--auto-fix | Declared 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| Argument | Description |
|---|---|
[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-commit | What 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.
| Gate | Also accepted | Takes [files] | Pre-commit hook (--pre-commit) |
|---|---|---|---|
dotnet-format | yes | Quick: checks staged C# blobs; fails closed when dotnet is missing | |
dotnet-format-style | yes | Quick: checks staged C# files and fails closed when dotnet is missing or unstaged edits overlap MSBuild inputs | |
prettier | yes | Quick: streams staged JS, TS, Vue, CSS, JSON, Markdown and YAML blobs over stdin; fails closed when pnpm or node_modules is missing | |
eslint | yes | Quick: lints staged JS, TS and Vue blobs over stdin; fails closed when pnpm or node_modules is missing | |
actionlint | validate-workflows | yes | Quick: validates staged .github/workflows and .github/actions blobs; fails closed when actionlint is missing |
hadolint | hadolint-docker, validate-dockerfiles | yes | Quick: lints staged Dockerfile* blobs; fails closed when hadolint is missing |
yaml | check-yaml, validate-yaml | yes | Runs on the staged files |
trailing-whitespace | check-trailing-whitespace | yes | Runs on the staged files |
end-of-file | end-of-file-fixer, eof-newline | yes | Runs on the staged files |
clean-secrets | clean-secrets-baseline | Quick: validates staged .secrets.baseline JSON without mutating the working tree | |
detect-secrets | secrets-scan | yes | Quick: scans materialized staged blobs instead of the working tree |
duplication | detect-code-duplication | yes | Runs on the staged files |
cli-docs | validate-cli-docs | Runs | |
adrs | validate-adrs | Quick: checks staged files for architectural changes, accepting ADRs already added on the branch | |
arch-drift | validate-architecture-drift | Runs | |
sanitizer | path-requirement-sanitizer | yes | Quick: reports lowercase @req:prd-… tags in staged Markdown blobs without rewriting working-tree files |
markdown | validate-markdown | yes | Runs on the staged files |
env-vars | validate-environment-variables | Runs | |
dev-env | validate-dev-environment, dev-environment | Runs | |
readmes | validate-readmes | Runs | |
codeowners | validate-codeowners | Runs | |
workflow-security | validate-workflow-security, action-pinning, check-action-pinning | yes | Runs on the staged files |
rulesets | validate-rulesets | Runs | |
imports | validate-imports | Runs | |
security | audit-security | yes | Runs on the staged files |
deid | deid-compliance-scan | yes | Runs on the staged files |
openapi | auto-stage-openapi | yes | Quick: exports specs only for the services the staged C# files touch, otherwise checks staged docs/api against staged docs/openapi |
api-clients | validate-api-clients | Runs | |
schema-doc | auto-stage-schema-doc | yes | Quick: runs the drift check when staged files include Entity Framework entities, migrations, configurations, or docs/schema |
path-patterns | validate-path-patterns | yes | Runs on the staged files |
query-linter | query-style-linter | yes | Runs on the staged files |
vulnerabilities | validate-vulnerabilities | Runs | |
dependencies | validate-dependencies | Runs | |
doc-index | validate-doc-index | Runs | |
demo-manifest | validate-demo-manifest | Runs | |
rtm | gxp-rtm-validate | Runs | |
gxp-snapshot | gxp-snapshot-guard | Quick: checks the staged files instead of the branch | |
baseline-ratchet | baselines | Quick: checks staged files against HEAD; CADENCE_BASELINE_GROWTH="<reason>" admits growth | |
public-bundle | validate-public-bundle | Skipped: 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.
| Option | Description |
|---|---|
-f|--fast | Adds --filter "Category!=Integration": every test project except the integration tests. |
-i|--integration | Runs 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| Option | Description |
|---|---|
-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-skip | Skips 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. |
--list | Prints 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_POSTGRESorCADENCE_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 inCadence.IntegrationTestsorCadence.E2ETeststhat was skipped or did not execute fails the step too (#5325), except the opt-in lineage benchmark and browser correction check listed inDatabaseTestEvidence.OptInTests(the browser correction check runs withCADENCE_TEST_BROWSER=1in theaccessibility-e2ejob).--allow-skipaccepts the skips. - Checks already run once are not repeated.
actionlintrunsactionlint,lint-and-staticruns Prettier, ESLint, Hadolint,markdownandapi-clients,dotnet-qualityrunscadence check --exclude prettier --exclude eslint --exclude actionlint --exclude hadolint --exclude detect-secrets --exclude api-clients --exclude vulnerabilities --exclude public-bundle,docs-buildbuilds the VitePress portal and co-hosted interactive demos and runspublic-bundle, andsecurityrunsdetect-secretsandvulnerabilities. Steps insecuritywhose gate already ran insideRun Cadence quality sentinels(the static security audit, secrets and DEID) are reported as covered whenRun Cadence quality sentinelspassed; 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-onlyopenapi,schema-doc,markdownandrtmchecks; afterRun Cadence quality sentinelspassed it runs withCADENCE_DOCS_SKIP_CHECKS=1, which skips the duplicateopenapi,schema-docandmarkdowngates while keepingcheck rtm, saving several minutes without touchingdocs/SDLCordocs/schema. - The tests run once. The .NET test step writes its TRX files to
TestResults/gxp, and the compliance job'sGenerate Compliance Reportsstep builds the RTM and IQ/OQ/PQ report from them instead of runninggxp sync, which would run every test again. It writes them toTestResults/gxp/preview/(todocs/SDLConly withCADENCE_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. WithCADENCE_GXP_SNAPSHOT=1it runscadence gxp diffinstead, 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/actionlintin CI), Hadolint, ShellCheck,detect-secrets-hook(resolved from.cadence/venv,.venv, orPATH) andbashare 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-skipto 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 cion 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-x64in 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| Option | Description |
|---|---|
--dry-run | Validates .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:
dotnet format whitespaceanddotnet format stylein the repository root (scoped to changed C# files by default; fullCadence.slnwith--full).- Root-wide Prettier auto-formatting across tracked JS, TS, Vue, CSS, JSON, Markdown and YAML files respecting
.prettierignore. .secrets.baselinenormalization (SecretsBaselineCleanerService.CleanSecretsBaseline) and upper-case@req:PRD-...tag sanitization indocs/**/*.md(excludingdocs/SDLC/runs/).- ADR index synchronization (
docs/adr/index.md) and schema validation (AdrValidatorService.ValidateAdrswithout git diff), quality gate table generation (GateDocs.Write), documentation index sync (docs/DOCUMENTATION_INDEX.md), and demo study manifest sync (packages/demo-fixtures). - Diff-based EF Core schema documentation (
docs/schema/): runsgenerate-schema-docwhen EF Core entities, configurations, or migrations changed (or with--full), skipping otherwise. - Diff-based OpenAPI specifications, API Markdown pages, and web TypeScript client types: exports
docs/openapi/and regeneratesdocs/api/when backend C# contracts changed (or with--openapi/--full), and runspnpm --filter web run generate:apiwhenever OpenAPI specs are exported orapps/web/src/api/generated/is stale socheck api-clientspasses.
Options:
| Option | What it does |
|---|---|
--openapi | Force full OpenAPI specification export, docs/api/ regeneration, and pnpm --filter web run generate:api. |
--full | Force 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.
| Command | What it does | Calls |
|---|---|---|
detect-duplication | Finds 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-imports | Fails when a .cs file in one apps/<service> has using Cadence.Apps.<other service>. | ImportValidatorService.ValidateImports |
validate-dependencies | Validates 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-patterns | Fails 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-readmes | Fails when a direct subdirectory of apps/ or packages/ has no README.md, or its README has no # title. | ReadmeValidatorService.ValidateReadmes |
validate-codeowners | Fails when .github/CODEOWNERS is missing or empty. | CodeownersValidatorService.ValidateCodeowners |
validate-workflow-security | Validates .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-markdown | Checks workspace links and # heading spacing in docs/**/*.md. | MarkdownValidatorService.ValidateMarkdown |
query-linter | Scans .cs files outside tests/. Fails on interpolated FromSqlRaw($...) or ExecuteSqlRaw($...), and on == true or == false. | QueryLinterService.LintQueries |
extract-env-vars | Finds 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-security | Scans source files, .vue templates and scripts/ for secret patterns (private keys, cloud credentials, API tokens, hardcoded compliance secrets). | SecurityAuditorService.AuditSecurity |
validate-public-bundle | Verifies 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-vulnerabilities | Audits 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-baseline | Normalizes .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-drift | Lists 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-spec | Runs 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-drift | Runs sync-openapi-spec --validate and generate-api-docs --validate. Exits 1 if either finds drift. | OpenApiDriftValidatorService.ValidateDrift |
generate-api-docs | Writes 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-doc | Runs 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-openapi | Same as validate-openapi-drift. This is the openapi gate. It does not stage anything. | PreCommitOpenApiService.ExecutePreCommitOpenApi |
validate-api-clients | Checks 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-docs | Without 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-index | Scans 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-manifest | Exports 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-rtm | Builds 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-utility | With --sanitize, upper-cases @req:PRD-... tags in docs/**/*.md, skipping docs/SDLC/runs/. Without it, does nothing. | ComplianceUtilityService.ExecuteComplianceUtility |
clean-test-dbs | Deletes every .db and .sqlite file in the repository whose path does not contain node_modules, bin or obj. | CleanTestDbsService.CleanTestDatabases |
check-ports | Reports 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-pipeline | Runs 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.
- 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) intoTestResults/gxp/. - Generates a preview of the RTM and IQ/OQ/PQ report (see
generate-rtm) inTestResults/gxp/preview/(gitignored), with an evidence block naming the tested revision, the generation time, the database and the runner. - 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.
| Option | Description |
|---|---|
--dry-run | Runs 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).
- Runs the tests as
cadence gxp syncdoes, or reuses existing TRX reports and*.database.txtfixture evidence under<dir>when--results-dir <dir>is given. - Regenerates
docs/SDLC/Requirements_Traceability_Matrix.md,docs/SDLC/IQ_OQ_PQ_Execution_Report.mdanddocs/SDLC/runs/. - Fails, without staging, on the same errors as
cadence gxp sync, when*.database.txtfixture metadata is missing under--results-dir, and when the RTM's test mapping does not match the tags intests/. - Otherwise stages those files with
git addwhen.gitis present. Commit them withCADENCE_GXP_SNAPSHOT=1set, so the pre-commitgxp-snapshotgate admits them.
| Option | Description |
|---|---|
--commit | After 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:
- PostgreSQL: drops and re-creates the schemas. The connection string comes from
POSTGRES_CONNECTION_STRING, thenDATABASE_URL, then a localhost default. - SQLite: deletes every
.dband.sqlitefile in the repository whose path does not containnode_modules,binorobj.
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".
| Option | Description |
|---|---|
-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>. |
--publish | Writes 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.
| Command | Phase | What it does |
|---|---|---|
cadence hook pre-tool | PreToolUse | Blocks --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-write | PostToolUse | Runs the query-style lint on the edited .cs files and blocks on == true/== false comparisons. |
cadence hook pre-invocation | PreInvocation | Prints the GxP working rules from AGENTS.md. |
cadence hook stop | Stop | Blocks 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.
| Command | Script | Arguments |
|---|---|---|
cadence wizard onboarding | setup_wizard | None |
cadence wizard dotnet | setup_dotnet_wizard | None |
cadence wizard migrate | migrate_service_wizard | None. The script prompts for the service. |
What each wizard does is defined by its script, not by the CLI.