npm.io
0.5.0 • Published 1h agoCLI

@jhayunu/wt

Licence
MIT
Version
0.5.0
Deps
6
Size
327 kB
Vulns
0
Weekly
0
Stars
1

wt — a runnable environment for every branch

wt gives each git worktree its own DDEV environment — its own URL, database and media — sized to the task at hand. Built for WordPress, Drupal, Laravel and React, and for the case where several AI agents work on one repository at the same time.

Full documentation, design notes and the isolation-level model: https://github.com/jhayunu/wt

Install

npm install -g @jhayunu/wt

Or, inside Claude Code, install it as a plugin (skill + /wt command + context hooks):

/plugin marketplace add jhayunu/wt
/plugin install wt@jhayunu

Requires DDEV + Docker and Node ≥ 20. All project tooling runs inside DDEV; no host PHP or Node is assumed.

Quick start

cd ~/sites/myshop          # your canonical checkout, a working DDEV project
ddev start                 # start once first, so wt can see whether Mutagen is in play
wt init                    # writes .wt.yml + .gitignore entries, excludes worktrees from the
                           # file sync (re-run this when upgrading from ≤ 0.3.x)
wt doctor                  # every check should be ✓

wt new feat/checkout --task "add checkout page with new orders table"
#   → https://feat-checkout.ddev.site

wt wp feat-checkout plugin list      # == ddev wp, in that worktree's containers
wt artisan feat-checkout migrate     # also: npm npx pnpm yarn composer php node mysql drush
wt exec feat-checkout -- <command>

wt db diff feat-checkout             # what changed in the DB since creation
wt db export feat-checkout           # → db/changes/… — commit it with the code
wt destroy feat-checkout             # containers, worktree, branch, generated files

Every command takes --json (before the subcommand: wt --json new …) and --dry-run, and nothing ever prompts — errors carry an exit code and a hint.

Isolation levels

level what you get default for
0 none worktree only docs, pure code review
1 shared worktree; tools run in main's web container React, Laravel without migrations
2 app own DDEV project, own DB cloned from main, media symlinked WordPress always; Laravel with migrations
3 full as 2, but media copied tasks that write media
4 clean own project, fresh DB, empty media greenfield, reproducibility

The level is inferred from the framework, the words in --task and .wt.yml; wt promote changes it in place.

Development

git clone https://github.com/jhayunu/wt && cd wt/cli
npm install
npm run test:all     # unit tests + an end-to-end run against a fake `ddev` (no Docker needed)
npm run build && npm link

MIT licensed. Bug reports from real projects are the most useful contribution right now — see the maturity note in the main README.

Keywords