Repository navigation
This release adds mkwt adopt for linked worktrees already created by T3 Code or Git.
What's new
- Adopt an existing registered worktree, persist its caller-supplied identity, and generate a fresh private env file without checkout, symlinks, or hooks.
- Retry safely with
already_configuredwhen the identity, recorded env path, exact file contents, ownership, and mode0600match. - Reserve no numeric slot when an unattended template does not use
{n}. The stored slot and managed marker are0;{id}still substitutes the worktree identity. - Support relative Git registrations and symlink aliases, and avoid blocking allocation because an unrelated worktree directory is inaccessible.
- Correct the Rails dotenv 3.x guidance for overwrite precedence and development/test file loading.
Contract and usage
- Executable version:
0.4.0 - Source revision:
e5ea3c47cb9c169dacca0e0483aba900bf2e60ce - CLI, configuration, JSON, recovery, and locking contract
- Implementation and reviewed fixes: PR #12
flock /srv/locks/project-worktrees.lock mkwt adopt \
--repo /srv/repos/project \
--path /home/t3/.t3/worktrees/project/run-123 \
--config /etc/orchestrator/project-mkwt.conf \
--worktree-id a82c4d9e10 \
--non-interactive --jsonThe caller must still hold one exclusive repository lock for identity checks and persistence, including templates without numeric slots. All callers using the same Git common directory must use the same lock. flock is an example caller tool, not a runtime requirement.
Automation configuration is parsed as literal assignments and never sourced. Env files use exclusive creation and mode 0600; unsafe paths and existing destinations are refused. Initial adoption preflights collisions before reserving an identity. Interrupted or failed writes can still require inspection and repair; the README names the remaining recovery limits.
The human mkwt <branch> workflow and existing create/remove contracts remain supported. JSON schema version stays 1. Automation requires Bash 4.4+ and Git 2.48+, with standard base-system utilities. mkwt runs as the invoking user and needs no root privileges. Database creation, migrations, application startup, and database cleanup remain the caller's responsibility.
For Rails, a generated .env.development.local is not loaded in test. Explicitly load the generated file in both environments or have the caller link it to .env.test.local, as documented.
Install and verify
git clone --branch v0.4.0 --depth 1 https://github.com/EdoMon93/mkwt.git mkwt-v0.4.0
cd mkwt-v0.4.0
./setup.sh
mkwt --version --jsonThe attached standalone mkwt executable embeds the source revision and can report it without the source checkout.
Validation: all three local CI commands passed, with four human-workflow checks and 75 automation tests: 74 passed and one root-only ownership fixture skipped. The fixture requires root only to construct a file owned by another user; the host denied that test's elevation. GitHub Actions passed on the final PR head. Additional reverted-code checks confirmed the alias and relative-registration regression tests detect the original defects.