Worktree Manager

Manage Docker-based dev instances and git worktrees. Handles app container lifecycle, database seeding, and proxy route activation. Requires mysql-manager and proxy-manager to be running first.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Worktree Manager" with this command: npx skills add pereirajair/worktree-manager

Worktree Manager

Manages Docker app instances and git worktrees for local development.

Each instance gets its own docker-compose stack (backend + frontend), isolated git branch, and .env.worktree-<name> file. MySQL and nginx-proxy are managed separately by their own plugins.

Prerequisites

Start these first (order matters):

  1. proxy-manager start — creates the shared Docker network (nginx-proxy_net)
  2. mysql-manager start — starts the shared MySQL container

Architecture

project/
├── docker-compose.yml        # app stack template (backend + frontend)
├── run.sh                    # this plugin's entry point (copy to project root)
├── .env.base                 # main instance env
├── .env.worktree-<name>      # per-worktree env (gitignored)
└── .worktrees/
    └── <name>/               # git worktree (gitignored)
  • main.env.base, project root
  • worktree.env.worktree-<name>, checked out at .worktrees/<name>
  • URLs: http://<name>.frontend.localhost / http://<name>.backend.localhost

Commands

All commands run from the project root:

./run.sh list                        # show all instances + mysql/proxy status
./run.sh start [main|<name>]         # seed db, start containers, connect proxy
./run.sh stop  [main|<name>]         # stop containers (db persists)
./run.sh restart [main|<name>]       # stop then start
./run.sh logs  [main|<name>]         # follow container logs
./run.sh create-worktree <name>      # git worktree + branch + env file
./run.sh remove-worktree <name>      # stop containers + drop db + remove worktree

How to Execute Tasks

Full environment setup (first time)

proxy-manager/run.sh start        # network + nginx-proxy
mysql-manager/run.sh start        # MySQL
./run.sh start main               # main app instance

Create a new worktree and start it

  1. ./run.sh create-worktree <name> — creates branch worktree/<name>, dir .worktrees/<name>, env file
  2. ./run.sh start <name> — seeds db from main snapshot, starts containers, activates proxy route
  3. URLs reported at the end

Stop an instance

./run.sh stop <name>

Remove a worktree (destructive — always confirm first)

Confirm with user: "Remove worktree '<name>'? Deletes containers, database, git worktree (branch worktree/<name>), and .env.worktree-<name>."

./run.sh remove-worktree <name>

List all instances

./run.sh list

What start Does

  1. Checks MySQL container is running (exits with error if not)
  2. CREATE DATABASE IF NOT EXISTS for the instance
  3. For non-main instances: dumps codai_main → instance db
  4. docker compose up --build -d
  5. docker network connect — proxy to instance network (activates routes)

Rules

  • Always check ./run.sh list before starting — it shows MySQL/proxy status.
  • Always confirm before remove-worktree — it is irreversible.
  • After start, print the frontend and backend URLs.
  • If ./run.sh is not executable: chmod +x run.sh
  • .env.worktree-* files and .worktrees/ dir must be gitignored.

Configuration

VariableDefaultPurpose
MYSQL_CONTAINERcodai_dbMySQL container name
MYSQL_ROOT_PASSsecretMySQL root password
MYSQL_MAIN_DBcodai_mainSource DB for snapshots
PROXY_CONTAINERcodai_nginx_proxynginx-proxy container name
PROJECT_PREFIXcodai-devDocker Compose project prefix

Related Plugins

  • proxy-manager — nginx-proxy lifecycle and network management (start first)
  • mysql-manager — MySQL lifecycle and database admin (start second)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Google Docs Formatter

Instruction-only workflow for formatting, editing, and creating Google Docs using the existing gog skill/CLI. Use when a user asks to format a Google Doc, co...

Registry SourceRecently Updated
Coding

vibe-coding-skills-installer

Install vibe coding skill sets (openspec, gstack, superpowers) for any supported agent platform (Cursor, Claude Code, Codex, etc.). Interactively asks about...

Registry SourceRecently Updated
Coding

基于课程内容说明生成图文并茂的的PPT

高校教师课程PPT生成技能。当老师需要制作教学内容课件、备课PPT、教学演示文稿、实验指导手册时触发。支持数据科学、大数据技术、Python编程、深度学习、机器学习、数据可视化等多个学科领域。触发词:课程PPT、制作课件、备课PPT、教学演示、实验指导。

Registry SourceRecently Updated
Coding

HSCIQ MCP - Customs Query

HS Code Lookup for Chinese Products. Query customs codes, tariff rates, declaration elements, and regulatory requirements via HSCIQ MCP API. Create classific...

Registry SourceRecently Updated
5320toucao