L0b (factory bootstrap): - bootstrap.ps1 (Windows): pre-checks, interactive config, clone .factory, home.toml - bootstrap.sh (Linux/Mac): same functionality for bash - Idempotent re-run with home.toml verification L1 (Go CLI): - factory.yaml: manifest schema with components, deps, health-checks - cmd/factory: Cobra CLI (install/update/status/diagnose) - pkg/config: home.toml reader - pkg/manifest: factory.yaml parser + topological sort - pkg/health: health-check logic (file/dir/mcp_tool/command) Scripts: - build.sh: cross-compile for linux/win/darwin × amd64/arm64 - build.ps1: PowerShell cross-compile Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
84 lines
3.1 KiB
Markdown
84 lines
3.1 KiB
Markdown
# .factory — software factory orchestrator
|
||
|
||
Размещение: `<projects_dir>/.factory/` (сиблинг `.common/`).
|
||
|
||
## Слои
|
||
|
||
- **L0a — System bootstrap (toolchain).** Голая ОС → git, mise, runtime'ы (node/python/go), опционально Claude Code / Cursor / Ollama. Native shell скрипты.
|
||
- **L0b — Factory bootstrap.** Спросить `$PROJECTS_DIR` → склонировать `.factory/` (если ещё нет) → записать `~/.config/factory/home.toml` → отдать управление в L1.
|
||
- **L1 — `factory` CLI** (Go-бинарь). Читает `factory.yaml`, обходит DAG зависимостей, запускает health-check'и и, при необходимости, setup-инструкции (L2).
|
||
- **L2 — `setup-*` skills** в `claude-skills/`. Уже существуют. L1 их вызывает (или печатает инструкцию запустить через slash-command).
|
||
|
||
## Статус
|
||
|
||
| Слой | Статус |
|
||
|------|--------|
|
||
| L0a | ✅ field-test complete (install-log.md) |
|
||
| L0b | ✅ bootstrap.ps1 + bootstrap.sh созданы |
|
||
| L1 | ⏳ Go-бинарь в разработке (structure done, build pending) |
|
||
| factory.yaml | ✅ manifest schema создан |
|
||
|
||
## Структура
|
||
|
||
```
|
||
.factory/
|
||
├── factory.yaml # Manifest компонентов
|
||
├── bootstrap.ps1 # L0b Windows bootstrap
|
||
├── bootstrap.sh # L0b Linux/Mac bootstrap
|
||
├── go.mod # Go module
|
||
├── cmd/
|
||
│ └── factory/
|
||
│ └── main.go # CLI entry point (cobra)
|
||
├── pkg/
|
||
│ ├── config/ # home.toml чтение
|
||
│ ├── manifest/ # factory.yaml парсинг
|
||
│ └── health/ # Health-check логика
|
||
├── L0/
|
||
│ └── install-log.md # Field-test лог
|
||
└── .wiki/
|
||
└── concepts/
|
||
└── factory-bootstrap.md
|
||
```
|
||
|
||
## Сборка L1
|
||
|
||
Требуется Go 1.23+:
|
||
|
||
```powershell
|
||
# Windows (pwsh)
|
||
cd C:\Users\vitya\projects\.factory
|
||
go build -o dist/factory.exe ./cmd/factory
|
||
|
||
# Linux/Mac
|
||
cd ~/projects/.factory
|
||
go build -o dist/factory ./cmd/factory
|
||
```
|
||
|
||
## Команды L1
|
||
|
||
```
|
||
factory install [component...] # Install components
|
||
factory update [component...] # Update installed
|
||
factory status # Show health table
|
||
factory diagnose <name> # Diagnose component
|
||
```
|
||
|
||
## Точки входа
|
||
|
||
- **Новый сотрудник на голой машине:**
|
||
1. `irm https://git.kzntsv.site/OpeItcLoc03/factory/raw/branch/master/bootstrap.ps1 | iex`
|
||
2. Ответить на вопросы (gitea URL, projects_dir, etc.)
|
||
3. `cd .factory && claude`
|
||
4. В Claude: `/login`, `/plugin install ...`, `/setup-*` ...
|
||
|
||
- **Существующая машина (миграция):**
|
||
1. `git clone ... .factory`
|
||
2. `factory install` напрямую
|
||
|
||
## TODO
|
||
|
||
- [ ] go-git clone/update имплементация
|
||
- [ ] Post-install shell script execution
|
||
- [ ] Cross-compile в dist/ (Win/Mac/Linux × amd64/arm64)
|
||
- [ ] Integration test на чистой VM
|