worktree
БесплатноБез исполняемых скриптовНе проверенCreates an isolated git worktree with its own WordPress test environment. Use when working on multi-day features or risky changes needing parallel testing.
от bonny★ 315 звёзд на GitHubОб этом скилле
Worktree Workflow
Use git worktrees for issues that require extended development (multiple days, risky changes, or parallel feature work). Each worktree gets its own branch, dependencies, and a WordPress test site.
Quick Path: scripts/parallel-dev.sh
For the common case (worktree + Playground instance per issue), use the helper script instead of the manual steps below:
# Create worktree, npm install + build, start Playground on a free port (9400+).
# With Valet's .test resolution available (/etc/resolver/test), the instance
# gets a named canonical URL like http://issue-42-some-feature.test:9400
# (WP_HOME/WP_SITEURL set via blueprint — avoids 127.0.0.1 redirects and
# Site Editor CORS issues). Falls back to http://localhost:<port> otherwise.
scripts/parallel-dev.sh up issue-42-some-feature
# Premium is mounted + activated by default (add-ons main checkout, or
# $SH_PREMIUM_DIR). Opt out, or point at a premium worktree:
scripts/parallel-dev.sh up issue-42-some-feature --no-premium
scripts/parallel-dev.sh up issue-42-premium-thing --premium=/path/to/premium-worktree
# Overview of all worktrees: port, URL, running?, dirty?
scripts/parallel-dev.sh status
# Stop the instance / stop and remove the worktree (refuses if dirty)
scripts/parallel-dev.sh down issue-42-some-feature
scripts/parallel-dev.sh down issue-42-some-feature --remove
# Tail the Playground server log
scripts/parallel-dev.sh logs issue-42-some-feature
Per-instance state lives inside the worktree as .playground.json / .playground.log / .playground-blueprint.json (all gitignored).
REST API access (Basic auth)
Instances started by parallel-dev.sh get a fixed application password (provisioned through the core API by a blueprint runPHP step), and a mounted mu-plugin (scripts/playground-mu-plugins/sh-allow-basic-auth.php) lets REST and Basic-auth requests through Playground's auto-login redirect — so plain curl -u works. Read the credentials from .playground.json (app_user / app_password) rather than hardcoding them:
URL=$(jq -r .url .playground.json)
curl -u "$(jq -r '.app_user + ":" + .app_password' .playground.json)" \
"$URL/wp-json/simple-history/v1/events?per_page=5"
Caveats:
- Instances started before this feature existed, and worktrees set up via the manual steps below, have no app password. If
jq -r .app_password .playground.jsonreturnsnull, restart withdown+up. - The script sets
WP_ENVIRONMENT_TYPE=local(app passwords are unavailable over plain HTTP otherwise) unless a custom--blueprintdefines its own environment type — so environment-gated behavior differs from a default production site. - Don't authenticate REST calls with the WP auth cookies — cookie auth without a nonce makes REST return 401.
For wp-admin HTML (non-REST), the first request auto-logs in and sets cookies — use a curl cookie jar:
jar=$(mktemp)
curl -s -c "$jar" -o /dev/null "$URL/"
curl -s -b "$jar" "$URL/wp-admin/admin.php?page=simple_history_admin_menu_page"
Run Playwright against an instance from inside its worktree — read the URL from the state file, since the instance's canonical URL may be the named .test one and localhost would get canonical-redirected cross-origin:
PLAYWRIGHT_BASE_URL=$(jq -r .url .playground.json) WP_ADMIN_USER=admin WP_ADMIN_PASSWORD=password \
npx playwright test tests/playwright/<spec>.spec.js
The manual steps below remain useful for special setups (custom blueprints).
Adding a test plugin to the instance
To reproduce what another plugin does (e.g. change roles from init), add it with a custom blueprint rather than editing the mounted dirs. Copy the generated .playground-blueprint.json, append the steps, and restart with it (parallel-dev.sh strips and re-injects its own steps, so starting from the generated file is fine):
jq --rawfile php my-plugin.php '.steps += [
{"step":"mkdir","path":"/wordpress/wp-content/plugins/my-plugin"},
{"step":"writeFile","path":"/wordpress/wp-content/plugins/my-plugin/my-plugin.php","data":$php},
{"step":"activatePlugin","pluginPath":"my-plugin/my-plugin.php"}
]' .playground-blueprint.json > /path/to/scratchpad/blueprint.json
scripts/parallel-dev.sh down <slug>
scripts/parallel-dev.sh up <slug> --blueprint=/path/to/scratchpad/blueprint.json
writeFile does not create parent directories; without the mkdir step the blueprint fails and the instance never starts (the error is only in .playground.log).
REST calls authenticated with the application password have no current user during init. WordPress only accepts application passwords once REST_REQUEST is defined, which happens after init, and the REST server then clears the cached anonymous user (class-wp-rest-server.php). Code that runs on init sees a logged-out request even though the endpoint later runs as admin. Cookie-authenticated requests do have the user on init.
Checks and tests
Установить worktree в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadWriteEditGlobFAQ
Что делает скилл worktree?
Creates an isolated git worktree with its own WordPress test environment. Use when working on multi-day features or risky changes needing parallel testing.
Как установить скилл worktree?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл worktree запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic