carson 3.9.0 → 3.10.0

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: ffbada076dd17e9f8ae9a85e9abce9abbc84e23b71324c8cde1ffec1db537071
4
- data.tar.gz: 4654c5d248f856818ffa83600b4db21838c0f665bb6a16f2d45d566643312ec6
3
+ metadata.gz: b0a28061ca9078e4ba0cf70626b209da67a9b85b6af31414d2a98e7f7e7abd36
4
+ data.tar.gz: de84e7e100d34a35ca9d844e34235eaf2e5b9dcf5071d2b651f28ee4bf83d3e6
5
5
  SHA512:
6
- metadata.gz: b4e517ccc14a75a2389bf5743fdd095b2796605c5c7fbeb4d12af4b0f237f370a275e2ff244436da4439b10e44b38a7aceae44c26b858d2224a8b0a25b1d193f
7
- data.tar.gz: a1de0764868ee6fda99d4f74f5ec10dfc2071a84e65102ab77749e83a8307aee37aa661d98b3670e1d62aeda28f1be1a05093283ac697de3a39ad542256e6da9
6
+ metadata.gz: 42ac93cfe9c110636f1327e2cf0a1cbd1fc4ad1cb258d745e3c487984153f95e3ec5ebe70016214d8f8a63de3ee13c8a248afedd6a6710277019011f5cf995d2
7
+ data.tar.gz: a64696f982dbe5947a333cf0fd2c94744a739b26dde0a60593f322a368ea9a6b371e6901007c762c012a810fbcb2702fcfc23d8b9543c51ffa966d4a83b97b6f
data/RELEASE.md CHANGED
@@ -5,6 +5,22 @@ 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.0 — CWD Safety Guard
9
+
10
+ ### What changed
11
+
12
+ - **CWD-inside-worktree guard** — `carson worktree remove` now detects when the caller's working directory is inside the worktree being removed, and blocks with `EXIT_BLOCK` instead of proceeding. This eliminates the #1 agent session crash scenario: removing a worktree directory while the shell is inside it kills the shell permanently.
13
+ - **Recovery command** — the block message includes the exact recovery: `cd <repo_root> && carson worktree remove <name>`.
14
+
15
+ ### UX
16
+
17
+ - No change when the caller's CWD is outside the worktree — removal proceeds normally.
18
+ - When blocked, the error is clear and the recovery is one command.
19
+
20
+ ### Migration
21
+
22
+ - No breaking changes. New safety guard — previously dangerous operations now fail safely.
23
+
8
24
  ## 3.9.0 — Agent Coordination Signals
9
25
 
10
26
  ### What changed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.9.0
1
+ 3.10.0
@@ -133,6 +133,17 @@ module Carson
133
133
  )
134
134
  end
135
135
 
136
+ # Safety: refuse if the caller's shell CWD is inside the worktree.
137
+ # Removing a directory while a shell is inside it kills the shell permanently.
138
+ if cwd_inside_worktree?( worktree_path: resolved_path )
139
+ return worktree_finish(
140
+ result: { command: "worktree remove", status: "block", name: File.basename( resolved_path ),
141
+ error: "current working directory is inside this worktree",
142
+ recovery: "cd #{repo_root} && carson worktree remove #{File.basename( resolved_path )}" },
143
+ exit_code: EXIT_BLOCK, json_output: json_output
144
+ )
145
+ end
146
+
136
147
  branch = worktree_branch( path: resolved_path )
137
148
  puts_verbose "worktree_remove: path=#{resolved_path} branch=#{branch} force=#{force}"
138
149
 
@@ -235,6 +246,17 @@ module Carson
235
246
  end
236
247
  end
237
248
 
249
+ # Returns true when the process CWD is inside the given worktree path.
250
+ # This detects the most common session-crash scenario: removing a worktree
251
+ # while the caller's shell is inside it.
252
+ def cwd_inside_worktree?( worktree_path: )
253
+ cwd = Dir.pwd
254
+ normalised_wt = File.join( worktree_path, "" )
255
+ cwd == worktree_path || cwd.start_with?( normalised_wt )
256
+ rescue StandardError
257
+ false
258
+ end
259
+
238
260
  # Resolves a worktree path: if it's a bare name, look under .claude/worktrees/.
239
261
  def resolve_worktree_path( worktree_path: )
240
262
  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.9.0
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hailei Wang