Scaffold bin/ with a starter refresh script for wt run - #55
Merged
Merged
Conversation
wt run gave scripts a home in .worktree.yml but nothing created a place for them to live. New projects now get a bin/ directory next to the shared dir (bin/ for wt clone, .worktrees/bin/ for wt init) and a bin/refresh starter registered as scripts.refresh. The starter is a no-op that prints where it lives. Its comments describe the general shape of an environment refresh, with docker compose as the example dialect: work in the main worktree, start services, pull, refresh data, capture a snapshot, publish it under shared/copy. It includes explicit guidance for AI agents asked to implement it. Existing files are never overwritten. Scripts also receive WT_SHARED_PATH, WT_MAIN_BRANCH, and WT_MAIN_WORKTREE_PATH so they no longer have to hardcode worktrees/main or shell out to wt cd. For wt init projects the main worktree resolves to the project root. Closes bd-2ti. Claude-Session: https://claude.ai/code/session_01NcatnJu3ZXYHL8DzupuhpF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #54. New projects get a
bin/directory next to the shared dir and abin/refreshstarter script registered asscripts.refresh, sowt run refreshworks out of the box and has an obvious place to be implemented.wt clonebin/refresh: bin/refreshwt init.worktrees/bin/refresh: .worktrees/bin/refreshThe starter script
internal/project/templates/refresh.sh, embedded and written with mode 0755. Never overwrites an existing file. Running it prints "not implemented" plus its own path and exits 0.Its comments are the real content: a generalized refresh skeleton (resolve main worktree, start services, pull, refresh data, snapshot, publish to
$WT_SHARED_PATH/copy) using docker compose as the example dialect, plus an explicit "note to AI agents" on how to fill it in for whatever stack the project uses. No project, ddev, or hosting-provider names.New script env vars
WT_SHARED_PATHWT_MAIN_BRANCHWT_MAIN_WORKTREE_PATH(empty if main is not checked out; the project root forwt initlayouts)These replace the
wt cd main || worktrees/mainfallback dance the existing real-world refresh scripts had to do.Testing
make devclean.BinPathfor both layouts,CreateScaffoldcreatesbin, starter renders and parses underbash -n, stub exits 0 with message,--helpworks, unknown args fail, existing file not clobbered, dry-run writes nothing, new env vars reach the script.clone_basicandinit_basicassert the script exists, the config entry is present, andwt run refreshsucceeds;run.txtarasserts the new env vars from inside a worktree.WT_MAIN_WORKTREE_PATHresolves toworktrees/main(clone) and the project root (init).Closes bd-2ti.
https://claude.ai/code/session_01NcatnJu3ZXYHL8DzupuhpF