Commit Graph

33 Commits

Author SHA1 Message Date
can1357 4db3d68bdb feat(coding-agent): implemented git worktree detection and rendering
- Added `git.repo.linkedWorktreeSync` to identify and resolve git worktree metadata without spawning subprocesses.
- Updated `StatusLineComponent` to detect linked worktrees and resolve project/worktree context names.
- Modified path segment rendering to collapse nested git worktree paths and display the worktree name when it diverges from the active branch.
- Introduced `icon.worktree` symbol across themes to visually distinguish git worktree paths.
2026-06-28 22:50:30 +02:00
can1357 c5cf47aa7f fix(coding-agent/utils): handled EISDIR and ENOTDIR errors during ref resolution
- Update `shouldRetry` to treat `EISDIR` and `ENOTDIR` as terminal errors, preventing unnecessary retries when encountering Git reference directory conflicts.
- Add a test suite to verify graceful resolution of branches in scenarios where a packed ref conflicts with a directory path in the filesystem.
2026-06-21 07:36:25 +02:00
can1357 edbdda6fbd fix(git): disable tag following during pushes
Programmatic `git push` operations should not follow annotated tags configured by a user's `push.followTags = true`. This setting can lead to push failures if the remote rejects tag creation (e.g., in PR-head forks), even if the branch update itself is valid.

Adding `--no-follow-tags` explicitly overrides this user setting, ensuring only the specified refspec is pushed and preventing rejections.
2026-06-11 21:05:26 +02:00
can1357 10c979ca05 fix(coding-agent): detect reftable refStorage values with format suffixes 2026-06-10 09:51:48 +02:00
can1357 f75ee75905 fix(coding-agent): return the checkout root from primaryRoot for non-worktree repos 2026-06-10 09:51:48 +02:00
can1357 9001ab3732 Merge pull request #2233: fix(hindsight): share project tag across git worktrees 2026-06-10 08:27:00 +02:00
roboomp 901fa4c013 fix(hindsight): share tags for bare worktrees
Bare-repository worktrees resolve their git common dir to the bare repo
itself (for example /repos/foo.git), not to a directory literally named
.git. The first fix only collapsed non-bare linked worktrees, so bare
worktree layouts still fell back to each individual worktree root.

Return the shared commonDir for bare repositories from both
repo.primaryRoot and repo.primaryRootSync, update project-label docs,
and cover two worktrees attached to one bare repository in the
hindsight bank regression test.

Fixes #2232
2026-06-10 08:26:01 +02:00
Matt Anger 91ff632d6a feat(coding-agent): verify HEAD before resolving reftable HEAD commit 2026-06-10 08:26:01 +02:00
Matt Anger b5b6424e7a feat(coding-agent): strip comments before matching section headers in git config 2026-06-10 08:26:01 +02:00
Matt Anger 4943d8d639 feat(coding-agent): use git rev-parse --verify when resolving reftable refs 2026-06-10 08:26:01 +02:00
Matt Anger c99751ac43 feat(coding-agent): strip adjacent git config comments 2026-06-10 08:26:01 +02:00
roboomp 29b2b51203 fix(hindsight): share project tag across git worktrees
Per-project-tagged scoping derived projectLabel() from
path.basename(cwd), so linked git worktrees of one repo landed retains
under distinct project:<basename> tags and recall (recallTagsMatch:
"any") missed cross-worktree memories.

- utils/git.ts: add sync sibling primaryRootSync to git.repo, walking
  .git + commondir with sync file reads (no subprocess), returning null
  outside a repo. Mirrors the async primaryRoot resolution.
- hindsight/bank.ts: projectLabel() resolves the primary checkout root
  via primaryRootSync and basenames that; falls back to the cwd
  basename when outside a repo. Sync only, so computeBankScope keeps
  its sync API and the async cascade that sank #1218 is avoided.
- test/hindsight-bank.test.ts: regression block builds a real repo +
  git worktree add fixture and asserts both produce the same
  project:<primary> tag and per-project bank id, plus a non-repo
  fallback case.
- CHANGELOG: Fixed entry under Unreleased.

Fixes #2232
2026-06-10 08:26:00 +02:00
Matt Anger 2e31abcc16 feat(coding-agent): address PR comments and improve reftable support 2026-06-10 08:26:00 +02:00
Matt Anger 08982932b2 feat(coding-agent): add support for git reftables 2026-06-10 08:26:00 +02:00
can1357 243ad581e6 perf(commit): reuse split diff parser 2026-06-08 15:17:38 -03:00
can1357 22b152e220 fix(commit): allow deferred changelog targets 2026-06-08 14:56:36 -03:00
can1357 5d468a2378 fix(commit): reject empty split hunk selectors 2026-06-08 13:31:09 -03:00
can1357 9b4a951919 refactor(jj): replaced subprocess-based workspace detection with fs walk
- Replaced `jj workspace root` subprocess call with a local `.jj/repo/store` directory traversal, eliminating process spawning overhead.
- Added LRU cache for resolved workspace roots to avoid redundant filesystem walks.
- Renamed internal `runCommand` helpers to `git`/`jj` for clarity.
- Replaced git subprocess setup in review test with mocked `git.status` and `git.diff` calls.
2026-06-03 00:10:23 +02:00
roboomp 56b222f544 fix(coding-agent): clone full repo when plugin source pins a SHA
git clone --depth 1 --single-branch only fetches the tip of the
requested branch, so any subsequent git checkout <sha> for a non-tip
commit fails with 'reference is not a tree'. The error was caught and
rethrown as 'shallow clone may not contain this commit', but the clone
arguments were never adjusted.

Drop --depth 1 (and --single-branch when no ref is requested) when the
caller supplies options.sha so the desired commit is present in the
local object store. The ref-only path remains shallow.

Fixes #1589
2026-05-31 14:47:14 +00:00
can1357 1228c96959 feat(coding-agent): added worktree list/clear CLI with orphan pruning
- Added the new `omp worktree` (`wt`) command with `list|clear`, `all/dry-run/json` options, and CLI registration.
- Added `listWorktrees`/`clearWorktrees` flows that scan worktrees, classify orphaned entries, emit JSON, and call `worktree.prune`.
- Replaced legacy path encoding with `hashPath` via `getWorktreeDir`, updating task isolation, storage keys, and PR checkout paths.
- Added bounded PR worktree path retries before `git worktree add` and updated checkout-path tests for hashed names.
2026-05-22 12:47:13 +09:00
can1357 1cffb3473a fix: corrected worktree baseline capture with synthetic tree diff
- Added untracked worktree baseline capture via `untrackedPatch` and synthetic tree diffing.
- Added fallback-aware backend ordering by collecting host candidates and retrying alternates on unavailable PAL.
- Hardened overlay mount lifecycle by removing stale overlays and deleting upper/work dirs after unmount.
- Refined ZFS clone deletion to validate ownership and remove dataset+origin only when checks pass.
- Updated ProjFS integration to use extended-info callbacks and symlink metadata reads.
- Updated rcopy path handling to absolutize paths, and added `writeTree` plus combined shell timeout checks.
2026-05-12 14:36:31 +02:00
can1357 f641938344 fix(coding-agent): split commit with new files
runSplitCommit reset the index and then re-staged each split via
git.stage.hunks, but stage.hunks builds its file map from the current
diff. After the reset, newly created files were untracked again and
absent from that map, throwing "No diff found for <path>" mid-split.
Preserve the original staged diff so new files remain locatable
through every split iteration.

Fixes #966
2026-05-09 03:11:18 +02:00
can1357 6b4de15353 fix(coding-agent): retry sync git metadata reads on EINTR
POSIX permits short syscalls (incl. open/read/stat) to be interrupted
by a signal and surface as EINTR. Optional sync git metadata helpers
(used by the status line) propagated the raw error and crashed the
agent. Add a small bounded retry around the sync stat/read calls and
classify persistent EINTR as 'metadata unavailable' so optional reads
fall back to undefined instead of throwing.

Fixes #899
2026-05-02 07:55:30 +02:00
can1357 16a96b4b0b feat(coding-agent/utils): added git reset utility with hard/mixed/soft options
- Added a `reset` helper in git utilities to execute `git reset` with optional flags.
- Added support for `hard`, `mixed`, and `soft` mode options, an optional target revision, and signal forwarding to `runEffect`.
2026-05-02 00:56:11 +02:00
can1357 90fabf6d4f feat(coding-agent): added batch PR handling to pr_view and pr_diff
- Added support for batch PR operations by accepting `pr` as string or array and dropping `worktree` input.
- Updated `pr_view` and `pr_diff` to normalize PR IDs, process multiple PRs in parallel, and emit combined summaries.
- Refactored checkout into `checkoutPullRequest`, added repo-locking, fixed worktree paths, and summary metadata outputs.
- Updated `remote.add` handling with URL-aware idempotency and per-repo queueing for serialized git mutations.
- Added temp-home test scaffolding and expanded tests for batched PR flows and remote add conflict/no-op cases.
2026-04-30 03:48:25 +02:00
can1357 537ee2237e fix(coding-agent/utils): handled ENFILE/EMFILE as optional git metadata errors
- Extended optional git metadata checks to treat ENFILE and EMFILE like missing paths.
- Updated sync and async helper functions to return null for those filesystem errors instead of throwing.
- Documented the status-line branch-rendering fallback for ENFILE/EMFILE failures in the changelog.
2026-04-26 03:16:44 +02:00
can1357 1e439a05d4 fix(coding-agent/tools): demoted existing in_progress todos when starting another task
- Updated todo start handling to set the requested task to in_progress while demoting all other in_progress tasks to pending.
- Added task note rendering in summary output by prefixing each note line with "Note:".
- Set GIT_OPTIONAL_LOCKS to 0 in git execution options and added tests for out-of-order start jumps and note summaries.
2026-04-16 14:58:58 +02:00
can1357 90f1672b2b fix(coding-agent): resolved duplicate -c in coding-agent git commands
- Added SHORT_LIVED_GIT_CONFIG constants and withShortLivedGitConfig helper for short-lived overrides.
- Updated runCommand to route git args through short-lived config normalization and avoid duplicate -c entries.
- Added scripts/release git() helper and replaced raw release git invocations with config-safe calls.
- Added git-process-config tests asserting status and stage spawn git with disabled core.fsmonitor/untrackedCache.
2026-04-11 08:54:27 +02:00
can1357 6d07944654 refactor: migrated binary detection to $which() utility across codebase
- Replaced all Bun.which() calls with $which() utility from @oh-my-pi/pi-utils across 22 files.
- Removed findBashOnPath() wrapper function from procmgr.ts, consolidating binary path resolution.
- Updated AGENTS.md documentation to reflect new $which() API usage pattern.
- Centralized binary detection logic through shared utility, reducing code duplication.
2026-04-08 05:28:22 +02:00
can1357 3d29a48e7a fix(coding-agent): fixed memory leak by cancelling idle compaction
- Fixed memory leak by cancelling idle compaction timer on event controller disposal.
- Fixed session resumption to preserve last non-empty session when starting fresh.
- Fixed stash detection to use git ref resolution instead of output parsing for reliability.
- Fixed secret obfuscation to deobfuscate restored session messages locally while keeping LLM messages obfuscated.
- Fixed stash pop operation to preserve staged changes with --index flag after task branch merges.
- Changed idle compaction settings from enum to numeric type for flexible configuration.
2026-04-05 03:50:52 +02:00
DeprecatedLuke d64fa7e859 feat(coding-agent): preserve results on isolated merge failures 2026-04-04 11:52:58 +01:00
can1357 80f771d22f refactor(coding-agent): migrated GitHub CLI utilities to git.github namespace
- Migrated GitHub CLI utilities from gh-cli.ts module to utils/git.ts github namespace.
- Consolidated GitHub CLI command execution (available, run, json, text) into git.github namespace with unified error handling.
- Removed gh-cli.ts module and ControlledGit class infrastructure; updated all tool imports and call sites.
- Exported git utilities from main package entry point for extension use.
2026-04-02 07:39:11 +02:00
can1357 418b6801a0 refactor(coding-agent): migrated git operations to centralized utils module
- Extracted git operations from ControlledGit class into centralized utils/git module with 1276 lines of typed command wrappers.
- Replaced dependency injection of ControlledGit instances with direct cwd string parameters across commit agent tools and workflows.
- Migrated all git command execution from inline shell calls and custom helpers to structured git module API (diff, status, branch, worktree, patch, etc.).
- Removed ControlledGit class, operations.ts, and helper functions (findGitHeadPath, mergeStdoutStderr, joinPatch) now provided by git module.
- Exported git utilities from main package entry point for extension and plugin use.
2026-04-02 07:35:44 +02:00