Skip to content

Scaffold bin/ with a starter refresh script for wt run - #55

Merged
bkildow merged 1 commit into
mainfrom
feat/scaffold-bin-refresh
Sep 17, 2026
Merged

bkildow merged 1 commit into
mainfrom
feat/scaffold-bin-refresh

Conversation

@bkildow

@bkildow bkildow commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #54. New projects get a bin/ directory next to the shared dir and a bin/refresh starter script registered as scripts.refresh, so wt run refresh works out of the box and has an obvious place to be implemented.

Layout bin dir config entry
wt clone bin/ refresh: bin/refresh
wt init .worktrees/bin/ refresh: .worktrees/bin/refresh

The 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_PATH
  • WT_MAIN_BRANCH
  • WT_MAIN_WORKTREE_PATH (empty if main is not checked out; the project root for wt init layouts)

These replace the wt cd main || worktrees/main fallback dance the existing real-world refresh scripts had to do.

Testing

  • make dev clean.
  • Unit: BinPath for both layouts, CreateScaffold creates bin, starter renders and parses under bash -n, stub exits 0 with message, --help works, unknown args fail, existing file not clobbered, dry-run writes nothing, new env vars reach the script.
  • e2e: clone_basic and init_basic assert the script exists, the config entry is present, and wt run refresh succeeds; run.txtar asserts the new env vars from inside a worktree.
  • Manual: both layouts in scratch projects, confirmed WT_MAIN_WORKTREE_PATH resolves to worktrees/main (clone) and the project root (init).

Closes bd-2ti.

https://claude.ai/code/session_01NcatnJu3ZXYHL8DzupuhpF

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
Base automatically changed from feat/wt-run-scripts to main September 17, 2026 16:55
@bkildow
bkildow merged commit 491cf84 into main Sep 17, 2026
5 checks passed
@bkildow
bkildow deleted the feat/scaffold-bin-refresh branch September 17, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant