Skip to content

init

Initialize a specs.config.yaml file with production-ready defaults.

Usage

Terminal window
specs init [options]

Purpose

The init command scaffolds a fully-populated configuration file with:

  • Sensible defaults for dataDirectory (./data) and outputDirectory (./specs)
  • All processing, format, and include options with production-ready values
  • Inline documentation with links to the full configuration reference
  • Empty sources object ready for your Figma file keys

This is the recommended way to get started with Specs in a new project.

What Gets Created

The init command creates a specs.config.yaml file with the following structure:

# Specs CLI Configuration (production-ready defaults)
#
# This file configures how Specs fetches and processes Figma component data.
# See: https://directededges.github.io/specs/config/ for complete documentation.
# Where fetch writes payloads, and where generate reads from.
# See: https://docs.specs.dev/config/data-sources
dataDirectory: ./data
# Default location for generated spec files (can override with -o flag).
# See: https://docs.specs.dev/config/data-sources
outputDirectory: ./specs
# Figma file sources to fetch and process.
# See: https://docs.specs.dev/config/data-sources
sources: {}
# Processing and output configuration.
# See: https://docs.specs.dev/config/
config:
processing:
subcomponents:
# scope: NESTED
match:
- '{C} / _ / {S}'
# exclude:
# - '{C} / Examples / {S}'
# glyphNamePattern: 'DS Icon Glyph /'
variantDepth: 9999
details: LAYERED
format:
output: JSON
keys: SAFE
layout: LAYOUT
tokens: TOKEN
include:
invalidVariants: false
invalidCombinations: true

Each section includes inline comments with references to the full documentation.

Options

--force / -f

Overwrite existing config file without prompting.

By default, if specs.config.yaml exists, init prompts before overwriting. Use --force to skip the prompt.

Terminal window
# Prompt before overwrite (default)
specs init
# Overwrite without prompting
specs init --force

--config <path> / -c <path>

Custom path for the config file (default: specs.config.yaml).

Terminal window
# Create config in a custom location
specs init --config ./configs/dev.yaml
# Create multiple configs for different environments
specs init --config ./configs/dev.yaml --force
specs init --config ./configs/prod.yaml --force

Examples

Example 1: Basic Initialization

Terminal window
cd my-design-system
specs init
# Output:
# ✓ Created specs.config.yaml
# 📚 Next steps:
# 1. Edit the config file to add your Figma file keys
# 2. Run: specs fetch
# 3. Run: specs scan
# 4. Run: specs generate
#
# 📖 Documentation: https://directededges.github.io/specs/config/

Example 2: Environment-Specific Configs

Terminal window
# Development config
specs init --config .specs.dev.yaml --force
# Production config
specs init --config .specs.prod.yaml --force
# Use with --config flag on other commands
specs fetch --config .specs.dev.yaml
specs generate data/library.file.json -c "Button" --config .specs.prod.yaml

Example 3: Force Overwrite

Terminal window
# If you accidentally delete your config, recreate it
specs init --force

See Also: