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

147
factory.yaml Normal file
View File

@@ -0,0 +1,147 @@
# factory.yaml — L1 manifest
# Variables: {gitea}, {projects_dir}, {factory}, {home}
# Substitution happens at runtime from ~/.config/factory/home.toml
version: "0.1.0"
# Git host configuration (overrides {gitea} default)
git_host: "https://git.kzntsv.site"
git_org: "OpeItcLoc03"
# Components to install/update
components:
# === Core infrastructure ===
- name: dot-common
display_name: ".common shared libs"
source:
type: git
url: "{git_host}/{git_org}/common"
branch: master
target: "{projects_dir}/.common"
health_check:
type: file_exists
path: "{target}/scripts/claude-switch.ps1"
clients: [claude-code, copilot-cli, gemini-cli]
- name: projects-meta-mcp
display_name: "Projects-meta MCP server"
source:
type: git
url: "{git_host}/{git_org}/projects-meta-mcp"
branch: main
target: "{projects_dir}/.common/lib/projects-meta-mcp"
deps: [dot-common]
setup_skill: setup-projects-meta
health_check:
type: mcp_tool
tool: mcp__projects-meta__meta_status
clients: [claude-code, copilot-cli]
- name: interns-mcp
display_name: "Interns MCP server"
source:
type: git
url: "{git_host}/{git_org}/interns-mcp"
branch: main
target: "{projects_dir}/.common/lib/interns-mcp"
deps: [dot-common]
setup_skill: setup-interns
health_check:
type: mcp_tool
tool: mcp__interns__bulk_text_read
clients: [claude-code, copilot-cli]
# === Knowledge ===
- name: dot-wiki
display_name: "Shared project wiki"
source:
type: git
url: "{git_host}/{git_org}/projects-wiki"
branch: main
target: "{projects_dir}/.wiki"
deps: [projects-meta-mcp]
setup_skill: setup-wiki
health_check:
type: file_exists
path: "{target}/CLAUDE.md"
clients: [claude-code, copilot-cli, gemini-cli]
- name: dot-tasks
display_name: "Local task board"
target: "{projects_dir}/.tasks"
deps: [dot-wiki]
setup_skill: setup-tasks
health_check:
type: file_exists
path: "{target}/STATUS.md"
clients: [claude-code, copilot-cli, gemini-cli]
# === Tooling ===
- name: claude-skills
display_name: "Claude skills collection"
source:
type: git
url: "{git_host}/{git_org}/claude-skills"
branch: master
target: "{projects_dir}/claude-skills"
deps: [dot-common]
post_install:
shell: pwsh
script: "{target}/scripts/install.ps1"
shell_alt: bash
script_alt: "{target}/scripts/install.sh"
health_check:
type: directory_exists
path: "{home}/.claude/skills"
clients: [claude-code]
# === Fixtures (optional) ===
- name: dot-organization
display_name: "Organization roster & personas"
source:
type: git
url: "{git_host}/{git_org}/.organization"
branch: master
target: "{projects_dir}/.organization"
optional: true
health_check:
type: file_exists
path: "{target}/roster.md"
clients: [claude-code, copilot-cli, gemini-cli]
- name: dot-templates
display_name: "Project templates"
source:
type: git
url: "{git_host}/{git_org}/.templates"
branch: master
target: "{projects_dir}/.templates"
optional: true
health_check:
type: file_exists
path: "{target}/project/.gitkeep"
clients: [claude-code, copilot-cli, gemini-cli]
- name: dot-meeting-room
display_name: "Meeting room / brainstorm archive"
source:
type: git
url: "{git_host}/{git_org}/.meeting-room"
branch: master
target: "{projects_dir}/.meeting-room"
optional: true
health_check:
type: file_exists
path: "{target}/.brainstorm/.gitkeep"
clients: [claude-code, copilot-cli, gemini-cli]
# Health check types:
# file_exists: checks if file exists at {path}
# directory_exists: checks if directory exists at {path}
# mcp_tool: checks if MCP tool is available (via ~/.claude.json)
# command: runs command and checks exit code 0
# custom: runs custom health check script