Previously, wt init would delete globally-ignored and untracked files
from the project root after creating the worktree. Since git worktree
add only creates tracked files, these files were permanently lost.
Now wt init:
- Uses git status --porcelain=v1 -z --ignored=matching to detect all
file states
- Aborts only on tracked modifications (staged/unstaged changes)
- Copies untracked and ignored files to the worktree before cleanup
- Checks for destination conflicts to prevent overwriting tracked files
- Properly quotes all shell arguments to handle special characters
Assisted-by: Claude Opus 4.5 via Amp
cded6e8
docs: update AGENTS.md for modular structure
Click to expand commit body
- Document src/wt/ module structure with cmd/ subdirectory
- Add make dist/install commands and bundling workflow
- Update testing section with actual patterns from spec/
- Consolidate non-obvious behaviors; remove outdated info
- Remove utility function list (agents discover via requires)
Assisted-by: Claude Opus 4.5 via Crush
Amolith
created
0f27ea6
fix(cmd): resolve type checker nil warnings
Click to expand commit body
Add ---@cast annotations in clone.lua and new.lua where the type checker
couldn't infer that loop-bounded array access returns non-nil.
Add early return after shell.die() in add.lua so type checker knows file
handle is non-nil when close() is called.
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
f270fe5
fix(cmd): allow flags anywhere in argument list
Click to expand commit body
Refactored argument parsing in add, clone, and new commands to use a
for-loop pattern that collects flags and positional args separately.
This allows POSIX-style flexible flag positioning (e.g., `wt a -b
branch` works the same as `wt a branch -b`).
Also adds @cast annotations after validation to satisfy the type
checker.
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
83f78b6
feat(add): improve UX with idempotency and hints
Click to expand commit body
- Make wt a idempotent: succeed if worktree exists for branch
- Validate existing worktree path (detect stale entries)
- Warn if existing path differs from current config
- Friendlier orphan branch error with actionable message
- Add hint for multiple remotes case
- Improve hook skip warning to be more actionable
Add helper functions to git.lua:
- ref_has_commits() for orphan detection
- find_worktree_by_branch() for idempotency check
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
88bd695
fix(bundle): use literal bracket in delimiter
After removing a nested worktree like feature/auth/oauth2, removes the
now-empty parent directories up to project root.
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
011a9b6
feat(add): default start-point to source branch
Click to expand commit body
When using -b from inside a worktree without specifying a start-point,
defaults to the current worktree's branch.
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
f443715
feat(hooks): forward run hook stdout to user
Click to expand commit body
Allows hooks to emit reminders or messages during worktree creation.
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
1c52896
fix(fetch): exit 0 on partial remote failure
Click to expand commit body
Previously exited non-zero if ANY remote failed, even when others
succeeded. Now fetches each remote individually, prints warnings for
failures, and exits 0 if at least one remote succeeded.
Assisted-by: Claude Opus 4.5 via Amp
- Add prominent warning listing files that will be deleted from root
- Clarify that files are preserved in the new worktree
- Improve dirty repo error with complete stash/pop workflow hint
Assisted-by: Claude Opus 4.5 via Amp
Amolith
created
a041fa1
docs(clone): clarify push behavior for modes
Click to expand commit body
Contributor mode pushes to all selected remotes (fork copies). Own mode
pushes only to additional remotes (mirrors), not the first.
Assisted-by: Claude Opus 4.5 via Amp
- Add GlobalConfig type annotation in config.lua with typed fields
- Type remotes values as string? to allow nil lookups
- Replace local aliases with direct module exports in main.lua
- Suppress duplicate-set-field for test API re-exports
- Suppress unnecessary-if for union type discrimination
- Use explicit if-narrowing for global_config.remotes
Assisted-by: Claude Opus 4.5 via Amp
Create src/wt/hooks.lua with load_hook_permissions,
save_hook_permissions, summarize_hooks, check_hook_permission, and
run_hooks functions. Update main.lua to import from the new module.
Assisted-by: Claude Opus 4.5 via Amp
3b2c3b2
test: suppress git noise and add quiet test target
Click to expand commit body
- Add spec/test_helper.lua with git() function that configures
init.defaultBranch, user.email, user.name, and advice.detachedHead to
suppress hints and warnings while preserving real errors
- Update spec files to use the helper
- Add make test-quiet target that shows full output only on failure
Assisted-by: Claude Opus 4.5 via Amp
Adds infrastructure for splitting src/main.lua into modules while
preserving the single-file curl installation story.
- scripts/bundle.lua concatenates modules into dist/wt
- Makefile gains 'dist' and 'clean' targets
- README updated to curl from dist/wt
Assisted-by: Claude Opus 4.5 via Amp
Previously, syntax errors in config files were silently ignored, causing
confusing behavior (e.g. "remote 'github' not found").
Both load_global_config and load_project_config now:
- Try loading with and without implicit return
- Report syntax errors with line numbers
- Report execution errors (e.g. undefined variables)
- Report when config doesn't return a table
Assisted-by: Claude Opus 4.5 via Amp