CLI Commands
Complete reference for all MAKI commands.
maki build
Section titled “maki build”Build FSH files to FHIR resources (SUSHI-compatible).
maki build [OPTIONS] [PROJECT_PATH]The build command compiles FSH files from input/fsh/ into FHIR JSON resources in fsh-generated/.
Options
Section titled “Options”Build Options
Section titled “Build Options”--output, -o <PATH>- Output directory (default:fsh-generated)--snapshot- Generate snapshots in StructureDefinitions--preprocessed- Output preprocessed FSH for debugging--clean- Clean output directory before building--progress- Show progress bar during build--no-cache- Disable incremental compilation cache--skip-deps- Skip installing FHIR package dependencies
Quality Options
Section titled “Quality Options”--lint- Run linter before build--strict- Treat warnings as errors (requires--lint)--format- Auto-format FSH files before build
Configuration
Section titled “Configuration”--config, -c <KEY:VALUE>- Override config values (version, status, releaselabel)
Examples
Section titled “Examples”# Build current directorymaki build
# Build with progress barmaki build --progress
# Run linter before buildingmaki build --lint
# Format FSH files before buildingmaki build --format
# Clean output and rebuildmaki build --clean
# Strict mode (treat warnings as errors)maki build --lint --strict
# Specify project path and outputmaki build ./my-ig --output ./output
# Override version for releasemaki build -c version:1.0.0 -c status:activeBuild Process
Section titled “Build Process”- Load Configuration - Reads
sushi-config.yamlormaki.yaml - Format (optional) - Auto-formats FSH files if
--formatis specified - Lint (optional) - Runs linter if
--lintis specified - Parse FSH - Parses all FSH files from
input/fsh/ - Build Semantic Model - Constructs the semantic representation
- Export Resources - Generates FHIR JSON for all resource types
- Generate Artifacts - Creates
package.json, FSH index, etc.
Output Structure
Section titled “Output Structure”fsh-generated/├── resources/│ ├── StructureDefinition-*.json│ ├── ValueSet-*.json│ ├── CodeSystem-*.json│ └── *.json (instances)├── package.json└── fsh-index.jsonmaki gofsh
Section titled “maki gofsh”Convert FHIR resources (JSON/XML) back to FSH (GoFSH functionality).
maki gofsh [OPTIONS] <INPUT>Options
Section titled “Options”--output, -o <PATH>- Output directory for FSH files (default:output)--fhir-version <VERSION>- FHIR version:R4orR5(default:R4)--dependency, -d <PKG>- FHIR package dependencies (e.g.,hl7.fhir.us.core@5.0.1)--strategy <STRATEGY>- File organization strategy:file- One file per definition (default)type- Group by FSH type (profiles.fsh, valuesets.fsh, etc.)profile- Group by profilesingle- All definitions in one file
--indent-size <N>- Number of spaces for indentation (default: 2)--line-width <N>- Maximum line width (default: 100)--progress- Show progress bar and detailed output
Examples
Section titled “Examples”# Convert FHIR resources in a directorymaki gofsh ./fsh-generated
# Specify output directorymaki gofsh ./fsh-generated -o ./input/fsh
# With FHIR dependenciesmaki gofsh ./resources -d hl7.fhir.us.core@5.0.1
# Use R5 FHIR versionmaki gofsh ./resources --fhir-version R5
# With progress reportingmaki gofsh ./resources --progress
# Group output by FSH typemaki gofsh ./resources --strategy type
# All in one filemaki gofsh ./resources --strategy singleConversion Process
Section titled “Conversion Process”- Setup Packages - Installs base FHIR packages and dependencies
- Load Resources - Reads FHIR JSON/XML files from input
- Process Resources - Extracts FSH definitions:
- StructureDefinitions → Profiles, Extensions, Logical Models
- ValueSets → ValueSet definitions
- CodeSystems → CodeSystem definitions
- Other resources → Instance definitions
- Optimize - Applies rule optimizations:
- Remove duplicate rules
- Combine related rules
- Simplify cardinality expressions
- Remove implied/redundant rules
- Write FSH - Generates formatted FSH files
- Generate Config - Creates
sushi-config.yamland.makirc.json
Output Structure
Section titled “Output Structure”With --strategy file (default):
output/├── MyProfile.fsh├── MyExtension.fsh├── MyValueSet.fsh├── sushi-config.yaml└── .makirc.jsonWith --strategy type:
output/├── profiles.fsh├── extensions.fsh├── valuesets.fsh├── codesystems.fsh├── instances.fsh├── sushi-config.yaml└── .makirc.jsonmaki lint
Section titled “maki lint”Lint FSH files and report diagnostics.
maki lint [OPTIONS] <FILES>...Options
Section titled “Options”Autofix Options
Section titled “Autofix Options”--fix- Automatically fix safe issues (no semantic changes)--unsafe- Apply unsafe fixes (semantic changes) in addition to safe fixes--dry-run- Preview fixes without modifying files--interactive,-i- Prompt for confirmation on each unsafe fix-w, --write- Write fixes to files (alias for--fix)
Diagnostic Options
Section titled “Diagnostic Options”--severity <LEVEL>- Only show diagnostics at or above this level:error,warning,info,hint--format <FORMAT>- Output format:human,json,sarif,github--max-diagnostics <N>- Limit number of diagnostics shown
Configuration Options
Section titled “Configuration Options”--config <PATH>- Path to configuration file--no-config- Don’t load configuration files
Examples
Section titled “Examples”# Lint all FSH filesmaki lint **/*.fsh
# Apply safe fixes onlymaki lint --fix input/fsh/*.fsh
# Apply all fixes (safe + unsafe)maki lint --fix --unsafe input/fsh/*.fsh
# Preview fixes without applyingmaki lint --fix --dry-run input/fsh/*.fsh
# Interactive mode - review each unsafe fixmaki lint --fix --unsafe --interactive input/fsh/*.fsh
# Show only errorsmaki lint --severity error **/*.fsh
# Output JSON formatmaki lint --format json **/*.fsh > diagnostics.jsonFix Safety Levels
Section titled “Fix Safety Levels”Safe fixes (applied with --fix):
- Add missing metadata (
Id,Title,Description) - Remove unused code (redundant aliases)
- Fix formatting and whitespace
- No semantic changes
Unsafe fixes (require --unsafe flag):
- Change naming conventions
- Add FHIR constraints
- Modify cardinality
- Semantic changes that should be reviewed
See the Automatic Fixes guide for detailed information.
maki format
Section titled “maki format”Automatically format FSH files to maintain consistent code style.
maki format [OPTIONS] <FILES>...The formatter uses a lossless Concrete Syntax Tree (CST) to ensure perfect preservation of:
- All comments (line and block)
- Blank lines and whitespace
- Semantic content
See the FSH Formatter Guide for detailed documentation.
Options
Section titled “Options”--check- Check if files are formatted without modifying them (exit code 1 if formatting needed)--diff- Show formatting differences without modifying files--config <PATH>- Path to configuration file--no-config- Don’t load configuration files-v, --verbose- Enable verbose output
Examples
Section titled “Examples”# Format all FSH filesmaki format **/*.fsh
# Format specific directorymaki format input/fsh/*.fsh
# Check formatting without modifying (useful for CI)maki format --check **/*.fsh
# Show what would changemaki format --diff input/fsh/*.fsh
# Use custom configurationmaki format --config custom-config.json **/*.fshFormatting Features
Section titled “Formatting Features”The formatter provides:
- Consistent indentation - Configurable spaces or tabs
- Rule alignment - Align cardinality and flags for readability
- Spacing normalization - Consistent spacing around
:and= - Blank line control - Maintain intentional spacing
- Comment preservation - All comments are preserved exactly
Example:
// Before formattingProfile:MyProfileParent:PatientId: my-profile* name 1..1 MS* birthDate 1..1 MS* gender 1..1 MS
// After formattingProfile: MyProfileParent: PatientId: my-profile
* name 1..1 MS* birthDate 1..1 MS* gender 1..1 MSCI/CD Integration
Section titled “CI/CD Integration”Use --check mode in continuous integration:
# Exit code 0 if formatted, 1 if needs formattingmaki format --check input/fsh/**/*.fshExit codes:
0- All files are properly formatted1- Some files need formatting2- Error occurred during formatting
Performance
Section titled “Performance”The formatter is highly optimized:
- Single files: <50ms
- Large projects: Parallel processing enabled automatically
- Memory efficient: Streaming processing
- Token optimization: 2-5% performance boost
See the Formatter Guide for configuration options and best practices.
maki init
Section titled “maki init”Initialize a new FHIR Implementation Guide project.
maki init [OPTIONS] [NAME]Arguments
Section titled “Arguments”NAME- Project name (default:MyIG)
Options
Section titled “Options”--default- Use default values without prompting (non-interactive mode)
Examples
Section titled “Examples”# Initialize interactivelymaki init
# Initialize with project namemaki init MyCustomIG
# Non-interactive with defaultsmaki init --defaultGenerated Files
Section titled “Generated Files”The init command creates the basic IG structure:
my-ig/├── input/│ └── fsh/│ └── patient.fsh (example)├── sushi-config.yaml└── .makirc.jsonmaki rules
Section titled “maki rules”List available rules.
maki rules [OPTIONS]Options
Section titled “Options”--detailed- Show detailed information--category <CATEGORY>- Filter by category--search <QUERY>- Search rules
Examples
Section titled “Examples”# List all rulesmaki rules
# Show detailed info for a categorymaki rules --detailed --category style
# Search for specific rulesmaki rules --search namingmaki check
Section titled “maki check”Check configuration validity.
maki check [OPTIONS]Options
Section titled “Options”--config <PATH>- Path to configuration file
Examples
Section titled “Examples”# Check default configmaki check
# Check specific configmaki check --config custom-config.jsonGlobal Options
Section titled “Global Options”Available for all commands:
-h, --help- Print help information-V, --version- Print version information-v, --verbose- Enable verbose output--color <WHEN>- Colorize output:auto,always,never
Exit Codes
Section titled “Exit Codes”See Exit Codes for details.