Skip to content

CLI Reference ​

The Voltage Schema CLI provides several commands to help you manage your analytics schema and generate types.

Installation ​

For the core tracking functionality:

bash
npm install voltage-schema

For documentation generation (recommended as dev dependency):

bash
npm install --save-dev voltage-autodoc

Commands ​

voltage init ​

Initializes a new Voltage Schema project.

bash
npm voltage init

Creates:

  • voltage.config.js - Configuration file
  • Initial schema files
  • Basic project structure

voltage generate ​

Generates TypeScript types and tracking configuration from your schema files.

bash
npm voltage generate

Options:

  • --watch - Watch for schema changes and regenerate

voltage events ​

Lists all events defined in your schema.

bash
npm voltage events

Options:

  • -verbose - Output full taxonomy data as JSON

Auto-Documentation ​

The autodoc generation is handled by the separate voltage-autodoc dev package to keep the dependency footprint small for voltage-schema.

voltage-autodoc ​

Generates documentation from your schema files.

bash
npm voltage-autodoc

Options:

  • --output-html - Generate HTML documentation

CI/CD Integration ​

The CLI tools are designed to work well in CI/CD environments:

bash
# Generate types
npm voltage generate

# Output taxonomy data for CI automation
npm voltage events -- -verbose

# Generate documentation for self-hosting
npm voltage-autodoc -- --output-html