usm/cli-init
The usm init command analyzes the repo and generates a starter usmconfig.json.
Intent
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.
Flows
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
Contracts
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
Tests
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