feat: L0b bootstrap scripts + L1 Go CLI structure

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>
This commit is contained in:
2026-05-06 23:59:09 +03:00
parent 47b41aa2f7
commit 561a7fd66f
12 changed files with 1380 additions and 43 deletions

View File

@@ -11,13 +11,73 @@
## Статус
- Дизайн: `~/projects/.meeting-room/.brainstorm/factory-bootstrap.md`
- L0a в разработке (field-test на новом Win11 ноуте, лог в `L0/install-log.md`)
- L0b — нет
- L1 — нет (Go-бинарь, после L0)
- `factory.yaml` — нет (черновик в design-буфере)
| Слой | Статус |
|------|--------|
| 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
```
## Точки входа
- Новый сотрудник на голой машине: запускает L0a (`bootstrap.ps1` / `bootstrap.sh`) → L0a кончает L0b → L0b кончает `factory install` (L1) → L1 проходит manifest → готово.
- Существующая машина (миграция): `factory install` напрямую, L0a/b пропускаем (всё уже стоит).
- **Новый сотрудник на голой машине:**
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