Expand description
Init command implementation.
This module implements the workspace init command which initializes a workspace
for changeset-based version management.
§What
Provides the init command that:
- Detects workspace structure (single package or monorepo)
- Collects configuration through interactive prompts or CLI flags
- Generates repo.config.format file
- Creates necessary directory structure (.changesets, .changesets/history, .workspace-backups)
- Sets up .gitignore entries
- Creates example changeset file with documentation
§How
The command flow:
- Validates the target directory is a Node.js project
- Detects if it’s a monorepo or single package
- Checks for existing configuration
- Collects configuration via prompts or flags
- Generates configuration file
- Creates directory structure
- Updates .gitignore
- Creates example changeset
- Outputs success message
§Why
Initialization must be robust to handle various project structures, provide helpful defaults, and ensure proper setup for the changeset workflow. Clear output and documentation help users understand the setup.
Functions§
- execute_
init - Execute the init command.