Agent SkillsLanternOps/breeze › worktree-stack

worktree-stack

GitHub

管理 Git worktree 隔离的端到端测试环境,自动化启动包含数据库、API 和前端的全栈服务,提供 Playwright 测试支持及严格的资源清理机制。

.claude/skills/worktree-stack/SKILL.md LanternOps/breeze

Trigger Scenarios

需要为当前 git worktree 搭建独立的测试环境 运行 Playwright 端到端测试 清理残留的 Docker 容器或 Compose 项目

Install

npx skills add LanternOps/breeze --skill worktree-stack -g -y
More Options

Non-standard path

npx skills add https://github.com/LanternOps/breeze/tree/main/.claude/skills/worktree-stack -g -y

Use without installing

npx skills use LanternOps/breeze@worktree-stack

指定 Agent (Claude Code)

npx skills add LanternOps/breeze --skill worktree-stack -a claude-code -g -y

安装 repo 全部 skill

npx skills add LanternOps/breeze --all -g -y

预览 repo 内 skill

npx skills add LanternOps/breeze --list

SKILL.md

Frontmatter
{
    "name": "worktree-stack",
    "description": "Use when an agent needs a running, seeded, Playwright-ready Breeze stack for the current git worktree. Brings up pg+redis+api+web+portal+caddy running the worktree's own code and emits a JSON descriptor."
}

Worktree Test Stack

Loop for testing the current worktree end to end:

  1. Bring up the stack (per-worktree isolated): pnpm wt-stack up
    • Add --shared for the singleton stack (ports are always ephemeral, read from .breeze-stack.json).
    • Add --rebuild after Dockerfile or dependency changes.
  2. Read .breeze-stack.json at the worktree root for baseUrl, apiUrl, portalUrl, and admin creds (admin@breeze.local / BreezeAdmin123!).
  3. Drive Playwright: pnpm wt-stack test -- tests/<spec>.spec.ts, or point the Playwright MCP browser at baseUrl.
  4. Tear down: pnpm wt-stack down (removes volumes by default). Run it from the same worktree and branch that ran up — the project name is derived from the branch, so a renamed branch or deleted worktree orphans the stack (see "Tear down when done" below for how to reap those).

Notes:

  • Requires Node v22.20.0 on PATH and a populated root .env (image refs).
  • Caddy serves plain HTTP in dev; baseUrl is http://localhost:<port>.
  • OrbStack is recommended for speed but not required — the CLI uses only the standard docker compose interface.
  • pnpm wt-stack ls lists running stacks; pnpm wt-stack info prints the descriptor.

Tear down when done (mandatory — nothing reaps a local stack for you)

Every stack you bring up stays up until something tears it down: OrbStack / Docker never expire them, and each agent session tends to leave its own behind. On 2026-09-01 the dev machine had five Breeze compose projects and two bare containers running from earlier sessions. Tear down what you brought up before you end, and say in your final summary what you left running and why.

pnpm wt-stack ls is not the whole picture. It lists only breeze and breeze-wt-* projects. pnpm test-stack ls lists only breeze-test-*. Neither shows a docker-compose.test.yml brought up without -p (project = directory name, e.g. worktree-quiet-field-f8d5) or an ad-hoc docker run Postgres from a plan task. Use the engine-wide listing below.

# 1. What is still up, across ALL worktrees and sessions?
docker compose ls -a --format json \
  | jq -r '.[] | select(.ConfigFiles|test("breeze")) | "\(.Name)\t\(.Status)"'
docker ps -a --format '{{.Names}}\t{{.Status}}\t{{.Label "com.docker.compose.project"}}' \
  | grep -i breeze            # blank 3rd column = bare `docker run` container, no compose project

# 2. Tear down what YOU brought up, from the worktree that created it
pnpm wt-stack down                                    # this worktree's dev stack (drops volumes)
pnpm test-stack down                                  # this worktree's integration pg+redis
pnpm --filter @breeze/api test:docker:down            # the shared :5433 test stack (docker-compose.test.yml, no -p)
docker compose -f docker-compose.yml -f docker-compose.override.yml.dev down -v --remove-orphans
                                                      # a compose-mode stack — pass the same -f files you used for `up`

# 3. Anything left over (worktree deleted, branch renamed, another session's stack)
docker compose -p <name> down -v --remove-orphans     # <name> = first column of step 1; no -f needed
docker rm -f <container>                              # bare containers, e.g. breeze-<issue>-drift

# 4. Verify — both must print nothing
docker compose ls -a --format json | jq -r '.[] | select(.ConfigFiles|test("breeze")) | .Name'
docker ps -a --format '{{.Names}}' | grep -i breeze

Everything-Breeze reset. Only when you own every stack on the machine — this kills other sessions' stacks too, so never run it from a parallel agent:

docker compose ls -a --format json | jq -r '.[] | select(.ConfigFiles|test("breeze")) | .Name' \
  | xargs -r -I{} docker compose -p {} down -v --remove-orphans
docker ps -aq --filter name=breeze | xargs -r docker rm -f
docker network ls --format '{{.Name}}' | grep -i breeze | xargs -r docker network rm   # stray *-net networks

--keep-volumes on wt-stack down keeps the Postgres data for a re-up; the default drops it, which is what you want at the end of a task.

Version History

  • 1c3a08e Current 2026-09-22 22:18

    新增强制性的环境清理指南与排查命令;集成备份恢复审计、安全扫描门禁及灾难恢复文档更新。

  • 10bb1af 2026-08-20 08:50

Same Skill Collection

.claude/skills/agent-info/SKILL.md
.claude/skills/agent-log-debugging/SKILL.md
.claude/skills/breeze-helper/SKILL.md
.claude/skills/breeze-testing/SKILL.md
.claude/skills/e2e-coverage/SKILL.md
.claude/skills/feature-delivery/SKILL.md
.claude/skills/feature-testing/SKILL.md
.claude/skills/issue-to-pr/SKILL.md
.claude/skills/security-review/SKILL.md
.claude/skills/gh-queue/SKILL.md
.claude/skills/pre-release-sweep/SKILL.md
.claude/skills/ui-qa-sweep/SKILL.md

Metadata

Files
0
Version
1c3a08e
Hash
e7ee8c90
Indexed
2026-08-20 08:50

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 14:47
浙ICP备14020137号-1