Commit Graph

373 Commits

Author SHA1 Message Date
5c378ab239 Merge branch 'conflict-resolution'
# Conflicts:
#	src/git.ts
2026-04-10 10:13:03 -07:00
a7285a4347 Add comment explaining why clearActivity is called before process.exit
process.exit(1) skips the finally block, so cleanup must happen
explicitly in the catch block.
2026-04-10 10:06:00 -07:00
101651b107 Extract shared gitError helper to deduplicate stderr formatting
Also clear activity on failed merge and improve error context for
conflicted file reads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 10:02:23 -07:00
fbb8680376 Guard against empty stdout when resolving merge conflicts
Claude can exit 0 but produce no output, leaving the file blank.
2026-04-10 09:41:39 -07:00
f226f30e6f Handle reset failure gracefully when squash produces no changes
The reset during early exit could throw if the worktree is already in a
conflicted state, masking the real "no changes" diagnostic.
2026-04-10 08:58:45 -07:00
b4d0d9e948 Add "(no output)" fallback to all git error messages
The helpers already handled empty stderr but the git module did not,
leading to confusing error messages with a trailing colon and no detail.
2026-04-10 08:54:17 -07:00
106ff20de7 Fix squash error handling and exit codes
Skip unnecessary rollback when reset never happened, show fallback
notice when AI commit message generation fails, and exit non-zero
when squash produces no changes.
2026-04-10 08:44:18 -07:00
374454f0fb Add missing lockfiles to skip list and show fallback for empty stderr
Several ecosystem lockfiles (Nix flake, Gradle, npm-shrinkwrap, Swift PM)
were missing from SKIP_RESOLVE, causing unnecessary conflict resolution
attempts. Empty stderr on failure produced confusing error messages.
2026-04-10 08:44:17 -07:00
cbb6bac1b9 Expand the lock-file skip list for merge conflict resolution
Add bun.lockb, mix.lock, Pipfile.lock, Podfile.lock, pubspec.lock, and
uv.lock to SKIP_RESOLVE so generated files from additional ecosystems are
auto-resolved with theirs during rebases. Sort entries alphabetically.
2026-04-10 08:29:45 -07:00
f1825c65da Move reset into try block so rollback covers all failure paths
Hoist mainBranch lookup before the new-commits check to avoid a
duplicate call, and report clearly when rollback itself fails so
the user knows to consult git reflog.
2026-04-10 08:19:58 -07:00
85cf9cc02f Expand lock-file skip list and extract checkoutTheirs into git module
Covers all common ecosystem lock files (npm, yarn, pnpm, Go, Ruby,
PHP, Poetry) so merge conflicts in any of them are auto-resolved
with --theirs rather than sent to Claude.
2026-04-10 08:17:55 -07:00
27afe67aec Rework squash to collapse commits in-place instead of merging
The old squash-merge workflow closed the branch, which made it
impossible to keep working after squashing. Now squash uses
git reset --soft to the merge base, preserving all changes as a
single commit on the current branch. Rolls back to the original
HEAD on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 08:12:57 -07:00
a9043d154d Rework squash command to collapse commits in-place
Instead of squash-merging into main, `sandlot squash` now soft-resets
to the merge base and recommits, keeping the branch independent.
This removes the --force flag and all squash-merge logic from
mergeAndClose, which goes back to being a plain merge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 08:07:51 -07:00
cc61e09384 Propagate git-add failures instead of silently swallowing them
The old `stageFile` call discarded non-zero exit codes, hiding issues
like unresolved conflicts or missing files from the caller.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 08:07:43 -07:00
e694ab06d7 Accept theirs for conflicting lock files instead of deleting them
Removing lock files during conflict resolution caused missing dependencies
after the merge. Checking out theirs and staging preserves a valid lockfile.
2026-04-07 17:55:40 -07:00
29cbf29b76 Remove lock files instead of resolving them during conflict resolution
Lock files like bun.lock and Cargo.lock get regenerated, so resolving
their conflict markers is unnecessary work.
2026-04-07 09:26:55 -07:00
1143bf08c9 Skip AI conflict resolution for lock files
Lock files like bun.lock and Cargo.lock contain auto-generated content
that Claude cannot meaningfully merge. Remove them during conflict
resolution so they get regenerated cleanly.
2026-04-07 09:21:11 -07:00
dfb62f7646 0.0.49 2026-03-30 20:27:15 -07:00
bbf12b8c56 Install sccache from prebuilt binary instead of compiling from source
Downloading the release tarball is significantly faster than
cargo install, which must compile sccache and all its dependencies.
2026-03-30 18:42:51 -07:00
0ff6fd5bf1 0.0.48 2026-03-30 12:51:01 -07:00
7daf2d87a5 Set max effort level for Claude invocations 2026-03-30 12:50:55 -07:00
6e2b817887 0.0.47 2026-03-25 10:26:45 -07:00
f50d8eb90e Deduplicate repos in loadAll to prevent repeated sessions
Symlinks or multiple entries can resolve to the same repoRoot,
causing duplicate sessions in the returned list.
2026-03-25 10:26:35 -07:00
9f54ec9d51 0.0.46 2026-03-23 21:35:28 -07:00
e71ba84cc0 Sort repositories alphabetically by name in list --all output 2026-03-23 21:35:20 -07:00
d402a3f980 Derive repo name from repoRoot instead of storing it separately
Remove the redundant `repo` field from GlobalSession and compute it
via basename(repoRoot) at render time. Also fix prompt truncation
when terminal is extremely narrow, and simplify backfillPrompts to
avoid an intermediate array allocation.
2026-03-23 21:20:44 -07:00
99b0fc0f12 Add config command and replace project registry with filesystem discovery
The global registry (registry.json, locking, scan-and-register) was
unnecessary complexity — we can discover repos by scanning ~/.sandlot/
worktree .git pointers. This also moves the --add/--remove flags off
`list` into a proper `config` subcommand for managing settings like
VM memory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
491c6d7eab Skip clearing stale reviews when VM is not running
Avoids unnecessary cleanup when there is no VM to reconcile against
2026-03-23 18:27:09 -07:00
4574749cde Fix prompt truncation edge case and harden global state handling
Correct list truncation logic to avoid eliding prompts that already fit,
and gracefully handle narrow terminals. Sanitize project entries on load,
deduplicate registration through a shared registerPaths helper, and
simplify scanAndRegister by reusing it.
2026-03-23 18:27:09 -07:00
da7adc674d Fix lock race condition, scan depth off-by-one, and minor cleanups
Close TOCTOU window in withGlobalLock by retrying mkdir immediately
after removing a stale lock. Fix off-by-one in scanAndRegister where
maxDepth was exceeded by one level. Export normalizePath to eliminate
duplicate logic in list.ts, use a Set for faster dedup in scan, and
simplify the styles map to a plain object literal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
965f233245 Simplify session status tracking with identity-keyed Map
Replace the repoRoot/branch composite-key workaround with a Map keyed
directly by session objects. Also tighten the global lock to properly
throw on acquisition failure and fix prompt truncation at narrow widths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
3ba27c80b4 Simplify list command and inline resolveAllStatuses
Remove generic helper that obscured a three-line call site, flatten
try/catch nesting in backfillPrompts, and push results directly in
loadAll instead of collecting intermediate objects. Also export
normalizePath for use in actionRemove and drop redundant `acquired`
flag from the lock loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
e5f1de4717 Remove ListSession type and harden lock acquisition
Consolidate on state.GlobalSession to eliminate redundant interface,
extract clearStaleReviews for clarity, and fix withGlobalLock to
explicitly throw when the lock cannot be acquired instead of
silently proceeding.
2026-03-23 18:27:09 -07:00
3d07643547 Move ListSession interface to module scope and harden error paths
Simplify stale-lock recovery to just retry the loop instead of
nesting a second mkdir, and surface lock failures in actionRemove
rather than letting them propagate as unhandled exceptions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
ac168d3019 Harden and parallelize session listing
Replace deprecated fs.exists with stat, wrap git calls in try/catch
to gracefully degrade to "idle" for inaccessible worktrees, and load
all projects concurrently in loadAll. Also fix stale-lock retry in
withGlobalLock to re-attempt mkdir immediately after cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
c46ad53fa3 Inline stale-review cleanup and fix state-loading bugs
Re-load state before clearing stale reviews to narrow the race window
with concurrent writers. Also fix missing await on withGlobalLock,
remove redundant mkdir and normalizePath calls, and reuse the existing
load() helper instead of duplicating file-reading logic in loadAll().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
7bea6f376b Harden state management against stale and missing entries
The registry lock could spin silently forever on contention, worktrees
could vanish between runs, and loadAll swallowed errors from projects
whose state files were removed. Also skip symlinks during scan to avoid
cycles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
3f8a3839f1 Unify list and list --all into a single code path
The separate actionAll function duplicated most of the listing logic.
Merging it simplifies status resolution by removing the key/repoRoot
indirection, fixes stale-review detection inline, and batches
scanAndRegister writes into a single lock acquisition. Also bumps the
stale lock timeout to 5 minutes and fixes normalizePath matching bare ~.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
e2a76a6ad9 Extract resolveAllStatuses helper and fix stale review detection
Move stale review flag outside the vm-running block so sessions
marked in_review are caught even when the VM is stopped. Extract
shared status-resolution logic into resolveAllStatuses to deduplicate
the list and list-all commands. Add stale lock detection to prevent
deadlocks from crashed processes, and include status in JSON output
for list-all.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
f0b2a55c9c Extract shared helpers in list command and add file lock for global registry
Deduplicate status resolution, stale-review cleanup, and prompt
backfill between single-repo and all-repo list paths. Protect
the global registry file with a mkdir-based lock to prevent
concurrent read-modify-write races, and add a max-depth guard
to scanAndRegister.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
751b4773c9 Fix status collisions in multi-repo list and clear stale review flags
Keying statuses by branch alone caused collisions when multiple repos
shared branch names. Key by repo/branch instead and auto-clear
in_review when Claude is no longer active. Also extract shared
rendering helpers, batch scanAndRegister writes, normalize paths
in the global registry, and move registerProject to setSession.
2026-03-23 18:27:09 -07:00
5893e07530 Replace filesystem-scanning session discovery with an explicit project registry
The old loadAll() walked ~/.sandlot/ and reverse-engineered repo roots
from .git worktree pointers, which was fragile and slow. A simple
registry (~/.sandlot/state.json) tracks known projects explicitly,
with commands to add, remove, and list across all of them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:27:09 -07:00
f504584ce4 0.0.45 2026-03-20 22:12:05 -07:00
1e928e1603 Remove the Stop hook for activity idle tracking
The idle state is now determined by the absence of activity
heartbeats rather than an explicit hook signal, which is more
reliable when the process exits unexpectedly.
2026-03-20 22:10:23 -07:00
befad9b539 0.0.44 2026-03-20 22:04:01 -07:00
2b25170c0c Handle rebase-in-progress detection via state directories and catch rebase errors
REBASE_HEAD can linger after an interrupted rebase, causing false positives.
Checking rebase-merge/ and rebase-apply/ directories matches how git itself
determines rebase state. Also surface rebase failures in the CLI spinner
instead of letting them propagate as unhandled exceptions.
2026-03-20 22:03:47 -07:00
6175d753f0 0.0.43 2026-03-20 11:12:55 -07:00
a992e2b12e Add fish shell completions for config subcommand keys 2026-03-20 11:12:45 -07:00
84845af28b 0.0.42 2026-03-20 11:02:09 -07:00
f7a8ff6a3c Fix config command to pass actual key instead of hardcoded "memory"
The config command already parsed the key but ignored it when calling
set() and printing the result. Also clarify sync vs async convention
in CLAUDE.md and log invalid memory config instead of silently falling
back.
2026-03-20 10:59:37 -07:00