CLI Reference
sparktype provides a command-line interface for generating, validating, and checking type definitions.
Installation
sh
npm install -D sparktypesh
pip install sparktypesh
brew install hntrl/tap/sparktypesh
go install github.com/hntrl/sparktype/cmd/sparktype@latestDirect Download
Pre-built binaries are available from GitHub Releases:
- macOS (Apple Silicon & Intel)
- Linux (x64 & ARM64)
- Windows (x64)
Commands
| Command | Description |
|---|---|
generate | Generate types from OpenAPI specs |
check | Verify generated files match current specs |
validate | Validate configuration file |
init | Create a new configuration file |
Global Options
These options are available on all commands:
--help, -h Show help message
--version, -v Show version numberQuick 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 initExit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (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.jsoncnpm 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