Skip to content

CLI Reference

sparktype provides a command-line interface for generating, validating, and checking type definitions.

Installation

sh
npm install -D sparktype
sh
pip install sparktype
sh
brew install hntrl/tap/sparktype
sh
go install github.com/hntrl/sparktype/cmd/sparktype@latest

Direct Download

Pre-built binaries are available from GitHub Releases:

  • macOS (Apple Silicon & Intel)
  • Linux (x64 & ARM64)
  • Windows (x64)

Commands

CommandDescription
generateGenerate types from OpenAPI specs
checkVerify generated files match current specs
validateValidate configuration file
initCreate a new configuration file

Global Options

These options are available on all commands:

--help, -h     Show help message
--version, -v  Show version number

Quick Reference

sh
# Generate types
sparktype generate

# Generate with custom config path
sparktype generate --config ./config/typegen.jsonc

# Generate with watch mode
sparktype generate --watch

# Check if types are in sync (for CI)
sparktype check

# Validate configuration
sparktype validate

# Create new config file
sparktype init

Exit Codes

CodeMeaning
0Success
1Error (invalid config, generation failure, or drift detected)

Configuration File Discovery

By default, all commands look for typegen.jsonc in the current directory. Override with --config:

sh
sparktype generate --config ./path/to/typegen.jsonc

npm Scripts

Add sparktype to your package.json scripts:

json
{
  "scripts": {
    "types": "sparktype generate",
    "types:watch": "sparktype generate --watch",
    "types:check": "sparktype check"
  }
}

Then run:

sh
npm run types
npm run types:watch
npm run types:check

Next Steps

  • generate - Full generate command documentation
  • check - CI/CD integration with check
  • validate - Config validation
  • init - Initialize new projects

Released under the MIT License.