env-provisioning
Provision a fast, reproducible dev environment for QA or standalone use — healthcheck-gated boot, reuse/teardown rules, host-mode fallback. Protocol for /orc:env, /orc:qa Phase 4, /orc:flow Phase 6, and the orc-env-provisioner agent.
- License 许可
- MIT
- 所属仓库
- HigorAlves/orc
- 最近更新
- 2026-11-07
- Stars
- ★ 7
- Forks
- 0
01 前言 Front Matter
- name
- env-provisioning
- description
- Provision a fast, reproducible dev environment for QA or standalone use — healthcheck-gated boot, reuse/teardown rules, host-mode fallback. Protocol for /orc:env, /orc:qa Phase 4, /orc:flow Phase 6, and the orc-env-provisioner agent.
02 资源文件 5
- 参考文档references/detection.md5.1 KB
- 参考文档references/FALLBACK.md1.6 KB
- 参考文档references/generation.md4.4 KB
- 参考文档references/STATE-SCHEMA.md1.7 KB
- 参考文档references/WORKSPACE.md1.0 KB
03 SKILL.md 正文
Environment Provisioning
Stand up the app (and its backing services) so QA — or the user — can run against a real, reproducible environment. Honors the project's own setup guidelines when they exist; generates the minimum when they don't. Speed is a design goal: the second boot on a branch takes seconds, not minutes.
Announce at start: "I'm using the env-provisioning skill because this task needs the app running."
Deep Docker knowledge (multi-stage builds, hardening, compose patterns) lives in orc:docker-best-practices — reference it, never duplicate it. This skill owns the protocol: detect → provision → prove → record.
Detection ladder
Evaluate top-down in the worktree (the code under test), first hit wins. Setup guidelines (README/CONTRIBUTING "Setup"/"Getting started" sections, Makefile, .env.example) are consulted at EVERY rung — they supply env values, seed/migrate steps, ports, and the service list; they never override a higher rung's boot mechanism. Rung specifics (override mechanics, devcontainer mapping, dev-stage preference, the hybrid rationale) + inference tables: references/detection.md.
- Existing compose —
compose.yaml|compose.yml|docker-compose.yml|docker-compose.yaml(+ overrides,devprofiles). Use as-is; NEVER edit it — extra needs go in an orc-owned override. - Devcontainer —
.devcontainer/devcontainer.json(or root variant).dockerComposeFile→ rung 1; else wrap its image/Dockerfile in a generated compose. - Dockerfile —
Dockerfile/Dockerfile.dev. Generate a compose: app builds from it, plus inferred backing services. - Nothing — generate from analysis (
references/generation.md). Default hybrid: backing services in containers, app on host;--containerize-appforces an app container.
All generated files land in .orc/<branch>/files/docker/ — never in the repo. Committing a real compose file into the project happens only on explicit user request, via the normal plan → PR path.
Provisioning protocol
- Attach first. Run
orc-docker-env is-ready <state-file>.ready→ verify line, setreused: true, refreshlastVerifiedAt, STOP — this is the sub-10-second path; skipping it throws away the main speed lever.--freshbypasses (down + re-provision). - Probe Docker.
orc-docker-env probe. Anything butok→ host-mode fallback (below). Never hard-block QA on a missing daemon. - Detect via the ladder; record the rung in
detectionRung. - Reconcile guidelines. Env values from
.env.example→env.orcwith dev-safe defaults (never invent secrets — placeholder + surface); seed/migrate commands run as one-shots AFTER healthy (destructive ones gate viaAskUserQuestion); the app's port/URL. - Generate (rungs 2–4, workspace wrapper) into
.orc/<branch>/files/docker/. Every generated service gets a healthcheck. Validate withdocker compose configbefore boot; save the rendered output as evidence. - Port pre-flight.
lsof -i :<port>per host port. Same-project occupancy → reuse. Foreign occupancy → gate: remap (generated files only, via override) / stop the other env / abort. - Boot.
docker compose -p <project> -f <files…> up -d --wait --wait-timeout 120.--buildonly whenbuildInputsHash(Dockerfile + lockfile hash) changed or--rebuildpassed. - Probe readiness beyond compose health:
curl -sf <appUrl>(retry ≤ 30s) and each HTTP endpoint inserviceEndpoints. Log every probe. - Capture evidence to
.orc/<branch>/files/env/:compose.rendered.yaml,ps.json,readiness.txt,boot.log,env-report.md(narrative: rung, found vs generated, boot seconds, reuse flag). - Write state —
docker-env-state.json(schema below), appenddocker_env_status: <status> (…)tocheckpoint.md, one line toprogress.md. - Report: state path, appUrl + endpoints, boot seconds, reused flag, verdict
ready|fallback|failed.
State contract — docker-env-state.json
Lives at .orc/<branch>/files/docker-env-state.json (workspace-level when context=workspace; per-repo otherwise). status enum: provisioning|ready|partial|failed|fallback|down. Read STATE-SCHEMA.md when writing the file (step 9) or reading it: the full schema, workspace additions, and the host-fallback shape.
Speed levers
| MUST | Why |
|---|---|
Attach before boot (orc-docker-env is-ready) |
The whole point — seconds, not minutes |
up -d --wait --wait-timeout <N=120> |
Healthcheck-gated readiness, no sleep-and-hope |
Named volumes keyed by project (db data; node_modules in full mode) |
Survive down; second boot near-instant |
Stable project name (orc-<name>-<branch>) |
Layer/volume/network reuse + orphan-sweep key |
Hash-gated --build (buildInputsHash) |
Rebuild only when Dockerfile/lockfile changed |
Port pre-flight via lsof |
Fail at gate, not mid-boot |
MAY: docker compose watch (only when the project's compose declares develop.watch), --profile dev selection, parallel docker compose pull pre-warm.
Workspace mode
One compose project per workspace branch (orc-<ws>-<branch>), all services on one network. Read WORKSPACE.md only when context is workspace: the include: wrapper, the per-repo fallback, dependency order, and the QA dispatch inputs.
Reuse & teardown
The environment stays up between QA runs on a branch — that is the speed win. Teardown owners: /orc:cleanup (adds docker compose -p <project> down to its destructive preview; volumes kept unless --down-volumes) and /orc:flow Phase 9. Standalone: /orc:env down. Orphans (orc-* compose projects with no registered session — orc-docker-env orphans) surface in previews, never auto-removed.
Iron rule
No "environment ready" claim without healthcheck evidence. status: ready requires env/ps.json showing every service running/healthy AND a successful appUrl probe in env/readiness.txt. Anything less is partial/failed:
> **🛑 Blocked — environment not ready**
>
> <service>: <state> after <N>s. Last log lines in env/boot.log. No QA against an unproven environment.
Fallback — never hard-block QA
Any failure on the probe ladder (docker installed → daemon up → compose v2 → containerizable) means host-mode fallback: the provisioner still owns the boot, still writes the state file and readiness evidence, and QA proceeds against the fallback appUrl. Read FALLBACK.md when step 1 returns anything but ok: the ladder, the Caution callout, and the pointers into orc:docker-best-practices.
04 同仓库更多 Skills
writing-plans
Write a comprehensive implementation plan of bite-sized TDD tasks that an engineer with zero codebase context could execute — exact files, code, tests, and verification steps
writing-for-agents
orc's doctrine layer for writing any document an agent consumes — skills, AGENTS.md/CLAUDE.md, reference docs
workspace-mode
Use when cwd is a parent dir holding multiple sibling git repos — defines repo auto-detection, --repos/--repo/--all-repos/--this-repo precedence, per-repo dispatch, and linked-PR mechanics.
wizard
Generate an interactive bash wizard walking a human through work only they can perform — credentials, secrets, one-off migrations
wait-what
Stop and re-pitch — the last message did not land; say it again simply, in the project's own vocabulary.
vitest
Vitest fast unit testing framework powered by Vite with Jest-compatible API