← Back to Skills Marketplace
pereirajair

Worktree Manager

by Jair Pereira · GitHub ↗ · v1.0.3 · MIT-0
linuxdarwin ⚠ suspicious
64
Downloads
0
Stars
1
Active Installs
4
Versions
Install in OpenClaw
/install worktree-manager
Description
Manage Docker-based dev instances and git worktrees. Handles app container lifecycle, database seeding, and proxy route activation. Requires mysql-manager an...
README (SKILL.md)

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-\x3Cname> 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-\x3Cname>      # per-worktree env (gitignored)
└── .worktrees/
    └── \x3Cname>/               # git worktree (gitignored)
  • main.env.base, project root
  • worktree.env.worktree-\x3Cname>, checked out at .worktrees/\x3Cname>
  • URLs: http://\x3Cname>.frontend.localhost / http://\x3Cname>.backend.localhost

Commands

All commands run from the project root:

./run.sh list                        # show all instances + mysql/proxy status
./run.sh start [main|\x3Cname>]         # seed db, start containers, connect proxy
./run.sh stop  [main|\x3Cname>]         # stop containers (db persists)
./run.sh restart [main|\x3Cname>]       # stop then start
./run.sh logs  [main|\x3Cname>]         # follow container logs
./run.sh create-worktree \x3Cname>      # git worktree + branch + env file
./run.sh remove-worktree \x3Cname>      # 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 \x3Cname> — creates branch worktree/\x3Cname>, dir .worktrees/\x3Cname>, env file
  2. ./run.sh start \x3Cname> — seeds db from main snapshot, starts containers, activates proxy route
  3. URLs reported at the end

Stop an instance

./run.sh stop \x3Cname>

Remove a worktree (destructive — always confirm first)

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

./run.sh remove-worktree \x3Cname>

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

Variable Default Purpose
MYSQL_CONTAINER codai_db MySQL container name
MYSQL_ROOT_PASS secret MySQL root password
MYSQL_MAIN_DB codai_main Source DB for snapshots
PROXY_CONTAINER codai_nginx_proxy nginx-proxy container name
PROJECT_PREFIX codai-dev Docker Compose project prefix

Related Plugins

  • proxy-manager — nginx-proxy lifecycle and network management (start first)
  • mysql-manager — MySQL lifecycle and database admin (start second)
Usage Guidance
Review this carefully before installing. It appears intended for local development, not data theft, but it has enough authority to build and run containers, alter MySQL databases, create persistent worktrees, and remove local resources. Use it only in a trusted project, set a non-default MySQL root password, inspect the Docker Compose files, run list before changes, and require explicit human approval before any remove-worktree action.
Capability Analysis
Type: OpenClaw Skill Name: worktree-manager Version: 1.0.3 The Worktree Manager skill is a legitimate developer tool for managing Docker-compose environments and Git worktrees. The 'run.sh' script includes robust input validation (validate_name, validate_db_name) to prevent shell and SQL injection, and the 'SKILL.md' instructions correctly guide the agent to confirm destructive actions like worktree removal. No indicators of data exfiltration, unauthorized remote execution, or malicious intent were found.
Capability Assessment
Purpose & Capability
The Docker, git worktree, database seeding, and proxy actions match the stated local-development purpose, but they are high-impact operations on the user's local project environment.
Instruction Scope
The skill documents an irreversible remove-worktree command and says to confirm first, but the script's confirmation helper only prompts when stdin is a TTY and otherwise appears to fall through, which is risky for agent/non-interactive execution.
Install Mechanism
There is no install script, but the supplied metadata is inconsistent across artifacts and the source/homepage are not provided, so users should verify provenance before trusting the included script.
Credentials
Docker, git, MySQL root, and proxy network operations are proportionate to the stated purpose, but they can alter containers, databases, networks, branches, and local files.
Persistence & Privilege
The skill creates persistent worktrees, branches, env files, Docker resources, and databases; this persistence is disclosed and purpose-aligned, but removal is destructive.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install worktree-manager
  3. After installation, invoke the skill by name or use /worktree-manager
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
No code or functionality changes; updated metadata only. - Internal metadata file (_meta.json) updated. - No user-visible changes.
v1.0.2
- Hardened database operations by validating database and instance names across all commands - Eliminated shell injection risks from SQL dump logic by removing backtick and sh -c usage in dump_main_to (now uses two docker execs) - Added/remove-worktree command name validation and user confirmation for destructive actions - Updated to align password variable with MYSQL_ROOT_PASSWORD and warn if default password is used
v1.0.1
- Updated internal version from 1.0.1 to 1.1.0. - No functional or documentation changes; metadata update only.
v1.0.0
v1.1.0: Focuses Worktree Manager on app instance and worktree handling only. - Split MySQL and proxy container management into separate plugins (`mysql-manager`, `proxy-manager`) - Worktree Manager now manages only Docker app instances and git worktrees - Updated instructions and architecture overview to reflect new plugin dependencies - Requires `mysql-manager` and `proxy-manager` to be running before starting instances - New changelog section highlights these changes
Metadata
Slug worktree-manager
Version 1.0.3
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 4
Frequently Asked Questions

What is Worktree Manager?

Manage Docker-based dev instances and git worktrees. Handles app container lifecycle, database seeding, and proxy route activation. Requires mysql-manager an... It is an AI Agent Skill for Claude Code / OpenClaw, with 64 downloads so far.

How do I install Worktree Manager?

Run "/install worktree-manager" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Worktree Manager free?

Yes, Worktree Manager is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Worktree Manager support?

Worktree Manager is cross-platform and runs anywhere OpenClaw / Claude Code is available (linux, darwin).

Who created Worktree Manager?

It is built and maintained by Jair Pereira (@pereirajair); the current version is v1.0.3.

💬 Comments