usm/cli-init
The usm init command analyzes the repo and generates a starter usmconfig.json.
Usage
bash
# Analyze repo and generate usmconfig.json
usm init
# Overwrite existing usmconfig.json
usm init --forceWhy this exists
New users need a config file that tells usm scan where to look. Init detects apps, packages, Prisma schemas, and Docker Compose services from the repo structure and writes a usmconfig.json so the next scan can work immediately.
How it works
Run usm init (run-init)
User runs usm init in the repo root to generate a usmconfig.json
- Setup — repo root directory
- Parse — apps/* and packages/* directories for package.json
- Parse — prisma schema files
- Generate — usmconfig.json with services, shared, data, outputs sections
Guarantees
init-creates-config
usm init must create a valid usmconfig.json at the specified output path
Acceptance criteria:
- [ ] Config has version: '1'
- [ ] Config has name, services, shared, data, sources, outputs fields
- [ ] Config does not overwrite unless --force is passed
Test specifications
init-default
Given:
- repo_with_apps: true
Then:
- assertion: usmconfig.json created with services matching apps/*
- assertion: exit code 0
init-no-overwrite
Given:
- existing_config: true
Then:
- assertion: error thrown "File already exists"
- assertion: exit code 1
Implementation
- Primary: src/scan/init.ts
- Test code status: none
See Also
- usm/system