carson 3.10.0 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0a28061ca9078e4ba0cf70626b209da67a9b85b6af31414d2a98e7f7e7abd36
4
- data.tar.gz: de84e7e100d34a35ca9d844e34235eaf2e5b9dcf5071d2b651f28ee4bf83d3e6
3
+ metadata.gz: 5e11a0b3de1e579e809455fca256a40882a226ae914e296cf0a670f0268c6ee3
4
+ data.tar.gz: 2b6bfb9124d69bec88912fae936d7394d1bb77a5e37fed2653e026fff14a531b
5
5
  SHA512:
6
- metadata.gz: 42ac93cfe9c110636f1327e2cf0a1cbd1fc4ad1cb258d745e3c487984153f95e3ec5ebe70016214d8f8a63de3ee13c8a248afedd6a6710277019011f5cf995d2
7
- data.tar.gz: a64696f982dbe5947a333cf0fd2c94744a739b26dde0a60593f322a368ea9a6b371e6901007c762c012a810fbcb2702fcfc23d8b9543c51ffa966d4a83b97b6f
6
+ metadata.gz: b2126c426ece435a94905532f7e7776cc873debb62aa57ba5267ec830a5995da330db79ebe28c5939835c1e15084132d60f0084abd7bee6e1d7780ec35fc288d
7
+ data.tar.gz: 5d4d9442043aa1abb923714ceabacae0edadba4b55b870a85cf2d0697364d92951299e86d85641202671ec0ceddd30407e52d8d2db8a65bd55782214ab45aa8f
data/RELEASE.md CHANGED
@@ -5,6 +5,12 @@ Release-note scope rule:
5
5
  - `RELEASE.md` records only version deltas, breaking changes, and migration actions.
6
6
  - Operational usage guides live in `MANUAL.md` and `API.md`.
7
7
 
8
+ ## 3.10.1
9
+
10
+ ### What changed
11
+
12
+ - **CWD guard recovery points to main worktree** — the recovery command in the CWD safety block now uses `git rev-parse --git-common-dir` to find the main repository root, not the current worktree's root. Previously, when invoked from inside a worktree, the recovery command would `cd` back to the worktree itself instead of the main repo.
13
+
8
14
  ## 3.10.0 — CWD Safety Guard
9
15
 
10
16
  ### What changed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.10.0
1
+ 3.10.1
@@ -136,10 +136,11 @@ module Carson
136
136
  # Safety: refuse if the caller's shell CWD is inside the worktree.
137
137
  # Removing a directory while a shell is inside it kills the shell permanently.
138
138
  if cwd_inside_worktree?( worktree_path: resolved_path )
139
+ safe_root = main_worktree_root
139
140
  return worktree_finish(
140
141
  result: { command: "worktree remove", status: "block", name: File.basename( resolved_path ),
141
142
  error: "current working directory is inside this worktree",
142
- recovery: "cd #{repo_root} && carson worktree remove #{File.basename( resolved_path )}" },
143
+ recovery: "cd #{safe_root} && carson worktree remove #{File.basename( resolved_path )}" },
143
144
  exit_code: EXIT_BLOCK, json_output: json_output
144
145
  )
145
146
  end
@@ -257,6 +258,16 @@ module Carson
257
258
  false
258
259
  end
259
260
 
261
+ # Returns the main (non-worktree) repository root.
262
+ # Uses git-common-dir to find the shared .git directory, then takes its parent.
263
+ # Falls back to repo_root if detection fails.
264
+ def main_worktree_root
265
+ common_dir, _, success, = git_run( "rev-parse", "--path-format=absolute", "--git-common-dir" )
266
+ return File.dirname( common_dir.strip ) if success && !common_dir.strip.empty?
267
+
268
+ repo_root
269
+ end
270
+
260
271
  # Resolves a worktree path: if it's a bare name, look under .claude/worktrees/.
261
272
  def resolve_worktree_path( worktree_path: )
262
273
  return File.expand_path( worktree_path ) if worktree_path.include?( "/" )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carson
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 3.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hailei Wang