feat: Enhance copy_env_file to support directory and destination path - #7
feat: Enhance copy_env_file to support directory and destination path#7FlamesCN wants to merge 9 commits into
Conversation
FlamesCN
commented
Nov 1, 2025
- Allow copy_env_file to copy directories.
- Support specifying a destination path.
- Add a message for missing source files.
- Allow copy_env_file to copy directories. - Support specifying a destination path. - Add a message for missing source files.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [ -z "$effective_port" ] && [ -n "$port_candidate" ]; then | ||
| if [ "$port_candidate" -lt 1024 ]; then | ||
| skip_dev=1 | ||
| skip_dev_port="$port_candidate" |
There was a problem hiding this comment.
Restore skip logic when no port can be inferred
The new condition now executes only when port_candidate is non-empty, so names like wt add docs leave effective_port and port_candidate empty and the block never sets skip_dev/skip_dev_reason. As a result the dev server is started with no PORT set, falling back to whatever default the command uses and potentially colliding with other services, whereas previously cmd_add explicitly skipped the dev command and printed dev_skipped_no_port. Consider reintroducing the skip_dev branch for the empty-port case so default ports are not started unexpectedly.
Useful? React with 👍 / 👎.
|
The local worktree is designed to be deleted immediately after use, so it only needs to copy one environment variable file to support local application startup. If not started locally, this environment variable is not even needed. The existing The Additionally, Codex's review comments pointed out regression issues introduced by this PR. |
OMX planning files and session state are generated per local run and should not keep showing up as untracked noise or get committed by accident. Recording them in the repository ignore rules keeps the working tree cleaner for anyone using the local agent workflow. Constraint: OMX planning and state files are local workspace artifacts, not shared source files Rejected: Use .git/info/exclude only | would not persist as a repository-level convention Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep local agent scratch files ignored unless a team workflow explicitly versions them Tested: git check-ignore -v .omx findings.md progress.md task_plan.md Tested: git status --short --ignored Not-tested: Fresh clone behavior on another machine
Core subcommands lacked dedicated help text, and `wt add --help` fell through to normal add execution because the dispatcher treated `--help` as the worktree name. This change centralizes subcommand usage output, routes help before scope/name validation, hardens `cmd_add` against option-like names, and documents the trailing-digit port rule such as `wt add ui9083`. Constraint: Help output must be safe even outside configured project scope Rejected: Only special-case `wt add --help` inside cmd_add | other subcommands would still lack targeted help and keep generic fallthroughs Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep subcommand help routing ahead of scope and positional validation when adding new commands Tested: bash -n bin/wt bin/messages.sh bin/lib/runtime.sh bin/lib/commands.sh Tested: git diff --check Tested: ./bin/wt help add; ./bin/wt add --help; ./bin/wt clean --help; ./bin/wt help sync Tested: disposable repo smoke for wt add --help (no new branch/worktree) and wt add ui9083 (feat/ui9083 with PORT=9083) Not-tested: shfmt and shellcheck (not installed in this environment)
Allow projects to register remove.pre-command and add.post-command hooks so repo-specific archive/restore logic can run around wt rm and wt add. Document the new keys in config-example.kv. Manual test steps: - bash -n bin/lib/runtime.sh bin/lib/commands.sh - ./bin/wt help
Keep shell integration from changing directories when users call wt --help, wt -h, or subcommand help. Add a regression test that exercises the generated hook behavior. Manual test steps: - bash tests/test_shell_hook.sh - shellcheck bin/lib/commands.sh tests/test_shell_hook.sh
Add a small helper that reinstalls the current checkout into the local prefix without shell-hook changes, so local testing can refresh ~/.local/bin/wt quickly. Manual test steps: - bash -n scripts/sync-installed-wt.sh - review script path and prefix handling