phattarachai/worktree-prompt
A Laravel package that adds an interactive prompt for picking Git worktrees, so you can run Artisan commands against the right branch or parallel checkout without leaving your terminal.
Architecture fit: lwt is a developer-tooling CLI, not a runtime Laravel dependency. It fits teams that use Git worktrees for parallel feature work, AI-agent workspaces, or per-branch review environments. It automates Laravel-specific worktree setup: Composer vendor handling, .env bootstrapping, storage/cache folders, frontend assets, database provisioning, and setup verification. This is a good fit for local development and agent-assisted workflows, with little production architecture impact if scoped to dev environments.
Integration feasibility: High for standard Laravel projects using Git, Composer, npm, and local Postgres/MySQL/SQLite. The commands map cleanly to existing developer workflows: add, setup, remove, list. Existing plain-Git or agent-created worktrees can be adopted via lwt setup [path], which lowers migration friction. Feasibility depends on undocumented assumptions: supported OS/filesystems, Laravel/PHP versions, DB permissions, and how the tool is installed and updated.
Technical risk: Moderate because this is a first release with filesystem, database, and Git operations. Highest-risk areas are destructive cleanup (remove drops a database and may delete a branch), secrets copied or symlinked into worktrees, database copy semantics, fallback behavior when copy-on-write is unavailable, and platform-specific commands such as cp -c/--reflink. The tool appears to include safeguards—dirty-worktree refusal, tracked-file restoration, non-zero exit on incomplete setup—but these need validation in a pilot. Vendor is never symlinked, which reduces autoload ambiguity, and the App\ autoload check is a useful correctness gate.
Key questions:
.env secrets handled: copy vs symlink, permissions, and cleanup on remove?--db=copy clone data, schema only, or something else, and how are credentials and dumps secured?remove behave when database deletion fails or the worktree is partially set up?Stack fit: Best suited as an optional developer productivity tool in Laravel repositories. It complements Git worktrees, Composer, npm, and local databases. It should not be treated as production infrastructure. Teams already using AI agents in .claude/worktrees/ or similar isolated workspaces are a strong initial adopter group.
Migration path: Start with a single representative Laravel repository. Install the CLI, run lwt add for a new branch, exercise lwt setup against an existing worktree, then validate lwt list and lwt remove behavior. Compare setup time and failure rate against the current manual process. If successful, document it in onboarding and add it to team scripts/Makefiles.
Compatibility: Validate against the team’s actual Laravel versions, database engines, package managers, and OS mix before rollout. Pay particular attention to copy-on-write support, DB admin permissions, .env.* conventions, public/build, bootstrap/ssr, and .worktreeinclude needs. Treat Windows support as unproven until explicitly tested.
Sequencing:
lwt version in a pilot repository..env handling, and database naming.add, setup, list, and remove across clean, dirty, and partially configured worktrees.Maintenance: Low runtime maintenance, but the tool becomes part of developer setup and must be version-pinned. First-release status means API/CLI behavior may change. Assign an owner to track releases and validate upgrades. Disk usage can grow from vendor clones, node_modules, build artifacts, and per-worktree databases.
Support: Expect questions around Git worktree concepts, DB permissions, missing .env values, asset builds, and cleanup. Support load will be highest during onboarding and when setups partially fail. Clear runbooks and failure messages are important; the tool’s non-zero exit behavior helps, but teams still need guidance on recovery.
Scaling: Scales reasonably per developer and per repository, but not free: many worktrees multiply disk usage, database instances, and dependency copies. Copy-on-write helps where supported; otherwise composer install/npm ci fallbacks increase setup time. Shared test database checks are useful, but teams should define how test data is loaded and refreshed.
Failure modes: Partial setup after git worktree add; Composer/npm lock mismatch; unsupported reflink causing slow fallback; DB creation failure due to permissions; orphaned databases after failed removal; dirty worktree blocking cleanup; accidental branch deletion if confirmation is mishandled; secrets exposed through copied .env files; symlinked .env breaking when the main worktree moves; stale worktrees and empty parent folders; tracked files modified during setup. The release notes indicate mitigations for several of these, but a pilot should explicitly test failure and recovery paths.
Ramp-up: Low for Laravel developers familiar with Git worktrees; moderate for those new to worktrees or local DB administration. A short demo plus a documented “safe remove” and “recover from failed setup” runbook should be enough for initial adoption.
How can I help you explore Laravel packages today?