Skip to content

CLI Reference

Fleet ships the fleet command-line tool for bootstrapping studies, executing derivation pipelines, validating datasets, generating Define-XML, managing CDISC Controlled Terminology, and rendering TLGs. Commands that query the CDISC Library require a valid CDISC_API_KEY — set it in a .env file at your project root or as an environment variable. Fleet reads only this key from .env; set CDISC_BASE_URL, proxies and FLEET_* variables in the shell.

.env
CDISC_API_KEY=your-api-key-here

Conventions

  • Config discovery — every command that needs study_config.yaml finds it git-style: the current directory first, then each parent. Pass --config <path> to override.
  • Exit codes — 0 success, 1 on a Fleet error (a single clean message on stderr), 2 on a usage error (missing/unknown command or flag). fleet compare turns its verdict into the exit code: 0 equal, 1 different, 2 the comparison could not run.
  • Errors go to stderr; results go to stdout.
  • fleet --version prints the installed version.

Run fleet <command> --help for the authoritative, always-current usage.

Command inventory

Command What it does
fleet init Bootstrapping pipeline: cfg → define → ct → rules.
fleet run Execute define.yaml derivation pipelines and write datasets.
fleet validate Validate datasets with the CDISC Rules Engine, one engine run per standard. Every finding blocks unless validation.accepted lists it (exit 0 nothing blocks, 1 a finding blocks, 2 a dataset could not run).
fleet check CI gate: config parse + define.yaml schema + codelists.py + run setup + custom-rule YAMLs.
fleet compare Compare a candidate dataset against a base on keys (exit 0 equal, 1 different, 2 could not run).
fleet new Bootstrap a study: init cfg → define → ct → rules, one confirmation.
fleet migrate Rewrite removed pre-alpha spellings: Python verbs and kwargs (libcst), or, with --spec, define.yaml algorithms and keys (ADR-0008).
fleet tdd Trial design workflow: build/audit TDD datasets from trial_design.yaml.
fleet tlg TLG workflow: list templates, run/explore YAML specs, export summaries.
fleet define-xml Generate Define-XML 2.1 from a define.yaml specification.
fleet add-acrf Declare the annotated CRF document (study.documents block) in define.yaml.
fleet add-ct Add domains to an existing codelists.py (preserves existing).
fleet add-rule Scaffold a new custom validation rule YAML.
fleet check-rule Validate a custom rule YAML (syntax, structure, schema).
fleet install-engine Download the CDISC Rules Engine binary for validation.
fleet uninstall-engine Remove the managed CDISC Rules Engine binary.
fleet doctor Check Fleet setup: engine, API key, codelists.py, optional extras.
fleet derivation Scaffold and manage study-specific derivations.
fleet mcp Serve Fleet tools to MCP-capable assistants (requires the 'mcp' extra).
fleet lsp Language server for define.yaml files (requires the 'lsp' extra).

fleet init

fleet init cfg

Option Default Description
--study-id (required) Study identifier (e.g. CDISCPILOT01).
--company (none) Originator / company name (study.originator in define.yaml).
--description (none) Study description (study.description in define.yaml).
--domains (none) Comma-separated SDTM domains (e.g. DM,AE,VS,EX).
--adam-datasets (none) Comma-separated ADaM datasets (e.g. ADSL,ADVS,ADAE).
--ig 3-4 SDTM IG version (default: 3-4).
--adam-ig 1-3 ADaM IG version (default: 1-3).
--package sdtmct-2023-12-15 SDTM CT package version (default: sdtmct-2023-12-15).
--adam-package (none) ADaM CT package, for the codelists only ADaM CT holds (DTYPE). Default with ADaM datasets: adamct-2023-06-30, the latest on or before the default SDTM package; required with another --package.
--root / -r . Study root directory (default: current directory).

fleet init define

Option Default Description
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).
--sdtm-only (none) Generate SDTM define.yaml only (skip ADaM).
--adam-only (none) Generate ADaM define.yaml only (skip SDTM).
--force (none) Overwrite existing define.yaml files.

fleet init ct

Option Default Description
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).
--no-docs (none) Omit definitions and preferred terms from generated code.
--force (none) Overwrite existing codelists.py.

fleet init rules

Option Default Description
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).
--sdtm-only (none) Fetch SDTM rules only (skip ADaM).
--adam-only (none) Fetch ADaM rules only (skip SDTM).
--force (none) Overwrite existing rule files.

fleet run

Option Default Description
--dataset (none) Dataset to build (repeatable). Default: every dataset in the define files.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).
--out / --output / -o (none) Output directory for every dataset. Default: the configured data/sdtm and data/adam directories. Fleet only writes here: inputs are read from the run, a declared path:, the raw directory (type: raw) or the data directory of the input's standard (type: dataset).
--format (none) Output format of every dataset. Default: the output_format of the dataset, else of define.yaml, else parquet (the rule of the Define-XML leaf). Choices: parquet, xpt, dataset-json.
--strict / --no-strict (on) Raise on unknown spec algorithms (default). --no-strict warns and skips.

fleet validate

Argument Description
paths Dataset files or directories (parquet / csv / xpt / sas7bdat). Default: the configured sdtm_data and adam_data directories.
Option Default Description
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).
--standard (none) Force the standard. Default: the configured data directory that holds the dataset, else AD* datasets → adam, others → sdtm. Choices: sdtm, adam.
--version (none) IG version. Default: the sdtm/adam ig_version declared in the discovered study_config.yaml (3.4 / 1.3 outside a study).
--define (none) Define-XML file that CORE checks with the datasets (CORE -dxp). Opt-in: Fleet never passes a define by default.
--custom-rules (none) Directory of custom validation rule YAML files, relative to the working directory. Default: validation.custom_rules from the discovered study_config.yaml.
--timeout (none) Seconds before an engine run is stopped. Default: validation.timeout from the discovered study_config.yaml, else 300.
--report (none) Write an HTML findings report to PATH.
--encoding (none) Text encoding of the CSV and SAS files, e.g. iso-8859-1 for files from a WLATIN1 SAS session (default: UTF-8).

fleet check

CI gate: parse the study config, check each define.yaml against its schema, check codelists.py against ct.package, ct.adam_package and the define.yaml files, build the validation run setup for SDTM and ADaM with no datasets, and check each custom rule YAML. An unsupported sdtm.ig_version or adam.ig_version and a configured validation.custom_rules directory that does not exist fail the gate. A missing rules engine and an unset CDISC_API_KEY are warnings only, because CI installs no engine. Exit 1 on any failure, else 0.

Option Default Description
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet compare

PROC COMPARE analogue: pair the two datasets on --keys, match variables by name and print the comparison report. --pairs compares variables named differently on each side and --variables restricts the comparison to the ones that matter. Equality is exact unless --abs-tol, --rel-tol or --ignore-trailing-whitespace widens it. --by sections the report per group and --allow-duplicates pairs duplicate keys by position. Exit 0 when the datasets are equal, 1 when they differ, 2 when the comparison could not run (unreadable file, missing keys, duplicate keys without --allow-duplicates, a negative tolerance, a --variables list of keys only, --out or --report not writable).

Argument Description
base The reference dataset (parquet / csv / xpt / sas7bdat; SAS formats need the io extra).
candidate The dataset measured against the base (same formats).
Option Default Description
--keys (required) Comma-separated variables that identify one observation on each side, e.g. USUBJID,AESEQ. Required; keys are never looked up.
--by (none) Comma-separated variables to section the report by, e.g. TRT01P. They are prepended to --keys automatically, so they need not be repeated there. The observation and values summaries are also reported per group, and a group present on one side only is flagged and listed; the verdict stays global.
--pairs (none) Comma-separated variable pairs whose sides carry different names, e.g. WEIGHT=WT. Applied on top of the automatic name matching, so a renamed column is compared rather than reported missing; the report names it after the base. A pair whose candidate variable is absent reports the base one as missing from the candidate.
--variables (none) Comma-separated variables to restrict the comparison to, in base names, so a work-in-progress candidate is checked on the columns that are finished. A variable outside the list is ignored on both sides: neither compared nor reported as missing.
--abs-tol 0.0 Absolute tolerance on the numeric variables (default: 0, exact). A numeric pair differs when the absolute difference exceeds max(--abs-tol, --rel-tol x |base|).
--rel-tol 0.0 Relative tolerance on the numeric variables, as a fraction of the base value (default: 0, exact). It anchors on the base because the base is the reference, as in SAS: 0.01 is one percent of the base.
--ignore-trailing-whitespace (none) Strip trailing whitespace from both sides of a string before comparing, so a legacy SAS dataset's padded character values equal Fleet's stripped ones. Leading whitespace still differs.
--blank-is-missing (none) Read an empty string as missing on both sides, keys included, as SAS does. Use it when one side comes from a tool that kept blanks as empty strings (an R data frame without convert_blanks_to_na). A SAS file always reads a blank as missing.
--text (none) Comma-separated CSV columns to read as text, the equivalent of a SAS $ informat, e.g. LBORRES. A CSV file holds no types: a column is text when a value on either side has a leading zero or is not a number, a number otherwise, and the other side's type when that side is not a CSV file.
--encoding (none) Text encoding of a CSV or SAS file, e.g. iso-8859-1 for a file from a WLATIN1 SAS session (default: UTF-8).
--allow-duplicates (none) Pair duplicate keys by their position within each key group instead of refusing to run. The report then counts the duplicates per side, raises the duplicate_keys flag and warns at the top: order within a key group decides which observations pair.
--all (none) Print every unequal value (default: 50 per variable, 500 overall).
--format text Output format: the text report, or one JSON document (verdict, flags, summaries, listing within the print limits, settings, Fleet version) and nothing else on stdout (default: text). Choices: text, json.
--out (none) Also write the complete value listing (never truncated) to PATH as parquet, e.g. differences.parquet.
--report (none) Also write a self-contained HTML report to PATH for a reviewer without Python: structural findings as chips, then every mismatched observation with the base and candidate values side by side, one collapsible block per variable.

fleet new

Argument Description
study_id Study identifier (e.g. STUDY01).
Option Default Description
--domains (none) Comma-separated SDTM domains (e.g. DM,AE,VS,EX).
--adam-datasets (none) Comma-separated ADaM datasets (e.g. ADSL,ADVS,ADAE).
--company (none) Originator / company name (study.originator in define.yaml).
--description (none) Study description (study.description in define.yaml).
--ig 3-4 SDTM IG version (default: 3-4).
--adam-ig 1-3 ADaM IG version (default: 1-3).
--package sdtmct-2023-12-15 SDTM CT package version (default: sdtmct-2023-12-15).
--adam-package (none) ADaM CT package, for the codelists only ADaM CT holds (DTYPE). Default with ADaM datasets: adamct-2023-06-30, the latest on or before the default SDTM package; required with another --package.
--root / -r . Study root directory (default: current directory).
--yes / -y (none) Skip the confirmation prompt.

fleet migrate

Argument Description
files Python files or directories to migrate (define.yaml files with --spec).
Option Default Description
--spec (none) Migrate define.yaml files to the verb vocabulary (fleet_spec_version 2).
--write (none) Rewrite files in place (default: print a unified diff).

fleet tdd

fleet tdd build

Option Default Description
--design (none) Path to the trial design YAML spec. Default: /trial_design.yaml from the discovered study_config.yaml.
--out / -o (none) Output directory. Default: the sdtm_data directory from the discovered study_config.yaml.
--format parquet Output format (default: parquet). Choices: parquet, xpt, dataset-json.
--force (none) Write datasets even when the conformance audit reports errors.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet tdd ctgov

Argument Description
nct_id ClinicalTrials.gov identifier (e.g. NCT04280705).
Option Default Description
--write (none) Merge the parameters into the trial design spec (new TSPARMCD/TSSEQ rows only) instead of printing YAML to stdout.
--design (none) Trial design spec to merge into with --write. Default: /trial_design.yaml from the discovered study_config.yaml.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet tdd audit

Option Default Description
--design (none) Path to the trial design YAML spec. Default: /trial_design.yaml from the discovered study_config.yaml.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet tlg

fleet tlg list

fleet tlg schema

Argument Description
template_id Registry template id (e.g. aet01). See fleet tlg list.

fleet tlg run

Argument Description
spec A spec .yaml file or a directory of spec files.
Option Default Description
--data (none) Analysis dataset path, repeatable. Plain PATH applies to every spec; NAME=PATH (e.g. ADAE=adae.parquet) targets the template's analysis domain.
--adsl (none) ADSL dataset path (population denominators for tables).
--output / -o (none) Output directory. Default: the configured outputs directory (current directory outside a study workspace).
--format html Output format (default: html). Choices: html, rtf, pdf, pptx.
--groupby (none) Treatment-arm column. Default: the spec's columns: field when it declares one, else auto-detect (TRTA → TRT01A → TRT01P).
--adsl-groupby (none) ADSL arm column for the big N when ADSL lacks the analysis arm (e.g. TRT01A for an ADAE grouped by TRTA). Sets adsl_group_col.
--title "" Output title (default: template title).
--subtitle "" Output subtitle.
--footnote (none) Footnote (repeatable).
--rows-per-page (none) Maximum body rows per page (model-layer pagination).
--page-by (none) ARD variable to page-break on (e.g. PARAMCD).
--watch (none) Re-run whenever a spec file changes (requires the 'watch' extra).

fleet tlg explore

Argument Description
spec A spec .yaml file or a directory of spec files.
Option Default Description
--data (none) Analysis dataset path, repeatable. Plain PATH applies to every spec; NAME=PATH (e.g. ADAE=adae.parquet) targets the template's analysis domain.
--adsl (none) ADSL dataset path (population denominators for tables).
--output / -o (none) Output HTML file. Default: explorer.html in the configured outputs directory (current directory outside a study workspace).
--groupby (none) Treatment-arm column for specs without a groupby axis. Default: the spec's columns: field when it declares one, else auto-detect (TRTA → TRT01A → TRT01P).
--adsl-groupby (none) ADSL arm column for the big N when ADSL lacks the analysis arm (e.g. TRT01A for an ADAE grouped by TRTA). Sets adsl_group_col.
--title "" Output title (default: template title).
--subtitle "" Output subtitle.
--footnote (none) Footnote (repeatable).
--watch (none) Rebuild whenever a spec file changes (requires the 'watch' extra).

fleet tlg export

Option Default Description
--domain (required) TLG sub-namespace to summarise. Choices: ae, cm, dm, ds, eg, ex, lb, mh, vs.
--format html Output format (default: html). Choices: html, rtf, pdf, pptx.
--data (none) Path to the primary analysis dataset. Default: the analysis dataset the domain's t_summary template declares (e.g. ADAE for ae, ADSL for dm/ds), found in the configured data directories.
--adsl (none) Path to the ADSL dataset. Default: ADSL found in the configured adam_data directory.
--output / -o (none) Output file path. Default: _summary. in the configured outputs directory (current directory outside a study).
--groupby (none) Treatment-arm column. Default: auto-detect (TRTA → TRT01A → TRT01P); TRT01A → TRT01P for the ADSL domains dm and ds.
--adsl-groupby (none) ADSL arm column for the big N when ADSL lacks the analysis arm (e.g. TRT01A for an ADAE grouped by TRTA). Sets adsl_group_col.
--population (none) ADSL population filter, passed to the spec's adsl_filter and shown in a footnote, e.g. 'pl.col("SAFFL") == "Y"'. Default: none (all ADSL subjects).
--title "" Table title.
--subtitle "" Table subtitle.
--footnote (none) Footnote (repeatable).
--rows-per-page (none) Maximum body rows per page (model-layer pagination).
--page-by (none) ARD variable to page-break on (e.g. PARAMCD).
--wrap (none) Path to an HTML wrapper template with {table} placeholder.

fleet define-xml

Generate Define-XML 2.1 from a define.yaml specification. This imports the spec's derivations_module (study Python code) to describe callable: derivations: run it only on a study you trust.

Option Default Description
--spec / -s (none) Path to the define.yaml specification file. Default: /define.yaml from the discovered study_config.yaml (per --standard).
--output / -o (none) Output path for the Define-XML file. Default: /define_.xml from the discovered study_config.yaml.
--standard sdtm Which define.yaml to use for the config-based defaults (default: sdtm). Choices: sdtm, adam.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).
--no-preview (none) Skip generating the HTML preview alongside the XML.
--enrich-methods (none) Kept for old scripts: MethodDefs are on by default. Every Derived variable with a comment: or a derivation: gets a MethodDef. This imports the spec's derivations_module (study Python code).
--strict (none) Refuse to write the file when the define has gaps: a Derived variable with no method text, a text, integer or float variable with no length, a float with no significant_digits. Without it the gaps are warnings.
--watch (none) Re-generate whenever the spec file changes (requires the 'watch' extra).

fleet add-acrf

Option Default Description
--href blankcrf.pdf aCRF file path in the submission package (default: blankcrf.pdf).
--title (none) Display title (default: "Annotated Case Report Form").
--page-map (none) External DOMAIN.VARIABLE → pages YAML file, relative to define.yaml.
--standard sdtm Which define.yaml to update (default: sdtm). Choices: sdtm, adam, both.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet add-ct

Option Default Description
--domains (required) Comma-separated SDTM domain abbreviations to add.
--ig (none) SDTM IG version. Default: sdtm.ig_version from the discovered study_config.yaml (3-4 outside a study).
--package (none) CT package version. Default: ct.package from the discovered study_config.yaml (sdtmct-2023-12-15 outside a study). Refused when it differs from the package an existing codelists.py was generated from.
--output / -o (none) Path to the existing codelists.py. Default: /codelists.py from the discovered study_config.yaml (./codelists.py outside a study).
--no-docs (none) Omit definitions and preferred terms from generated code.

fleet add-rule

Option Default Description
--domain (required) SDTM/ADaM domain code (e.g. AE, DM, VS).
--description (required) Human-readable description of the rule.
--prefix FLEET Rule ID prefix (default: FLEET).
--id (none) Explicit rule ID (e.g. ACME-AE-042). Skips auto-increment.
--output / -o (none) Output directory for the rule YAML. Defaults to validation.custom_rules from study_config.yaml.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet check-rule

Argument Description
rule_file Path to the custom rule YAML file to validate.

fleet install-engine

Option Default Description
--version v0.15 Release tag to download (default: v0.15, the CORE release that Fleet is tested with). 'latest' gets the newest release and warns.
--force (none) Re-download even if already installed.

fleet uninstall-engine


fleet doctor

Option Default Description
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet derivation

fleet derivation add

Argument Description
name Variable name to create (e.g. AGEGR1).
Option Default Description
--dataset ADSL Target dataset name (default: ADSL).
--kind column Derivation kind: column / frame (default: column). For a new parameter row, use .adam.derive_param(). Choices: column, frame.
--config / -c (none) Path to study_config.yaml. Default: discovered by walking up from the current directory (git-style).

fleet mcp

Option Default Description
--stdio (none) Serve over stdio (the only supported transport; accepted for explicitness).
--trust-study-engine (none) Let fleet_validate start the engine that validation.engine_path of a study config names. Without it, such a run could not run.

fleet lsp

Option Default Description
--stdio (none) Serve over stdio (the only supported transport; accepted for explicitness).