carson 3.9.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 +4 -4
- data/RELEASE.md +22 -0
- data/VERSION +1 -1
- data/lib/carson/runtime/local/worktree.rb +33 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e11a0b3de1e579e809455fca256a40882a226ae914e296cf0a670f0268c6ee3
|
|
4
|
+
data.tar.gz: 2b6bfb9124d69bec88912fae936d7394d1bb77a5e37fed2653e026fff14a531b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2126c426ece435a94905532f7e7776cc873debb62aa57ba5267ec830a5995da330db79ebe28c5939835c1e15084132d60f0084abd7bee6e1d7780ec35fc288d
|
|
7
|
+
data.tar.gz: 5d4d9442043aa1abb923714ceabacae0edadba4b55b870a85cf2d0697364d92951299e86d85641202671ec0ceddd30407e52d8d2db8a65bd55782214ab45aa8f
|
data/RELEASE.md
CHANGED
|
@@ -5,6 +5,28 @@ 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
|
+
|
|
14
|
+
## 3.10.0 — CWD Safety Guard
|
|
15
|
+
|
|
16
|
+
### What changed
|
|
17
|
+
|
|
18
|
+
- **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.
|
|
19
|
+
- **Recovery command** — the block message includes the exact recovery: `cd <repo_root> && carson worktree remove <name>`.
|
|
20
|
+
|
|
21
|
+
### UX
|
|
22
|
+
|
|
23
|
+
- No change when the caller's CWD is outside the worktree — removal proceeds normally.
|
|
24
|
+
- When blocked, the error is clear and the recovery is one command.
|
|
25
|
+
|
|
26
|
+
### Migration
|
|
27
|
+
|
|
28
|
+
- No breaking changes. New safety guard — previously dangerous operations now fail safely.
|
|
29
|
+
|
|
8
30
|
## 3.9.0 — Agent Coordination Signals
|
|
9
31
|
|
|
10
32
|
### What changed
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.10.1
|
|
@@ -133,6 +133,18 @@ 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
|
+
safe_root = main_worktree_root
|
|
140
|
+
return worktree_finish(
|
|
141
|
+
result: { command: "worktree remove", status: "block", name: File.basename( resolved_path ),
|
|
142
|
+
error: "current working directory is inside this worktree",
|
|
143
|
+
recovery: "cd #{safe_root} && carson worktree remove #{File.basename( resolved_path )}" },
|
|
144
|
+
exit_code: EXIT_BLOCK, json_output: json_output
|
|
145
|
+
)
|
|
146
|
+
end
|
|
147
|
+
|
|
136
148
|
branch = worktree_branch( path: resolved_path )
|
|
137
149
|
puts_verbose "worktree_remove: path=#{resolved_path} branch=#{branch} force=#{force}"
|
|
138
150
|
|
|
@@ -235,6 +247,27 @@ module Carson
|
|
|
235
247
|
end
|
|
236
248
|
end
|
|
237
249
|
|
|
250
|
+
# Returns true when the process CWD is inside the given worktree path.
|
|
251
|
+
# This detects the most common session-crash scenario: removing a worktree
|
|
252
|
+
# while the caller's shell is inside it.
|
|
253
|
+
def cwd_inside_worktree?( worktree_path: )
|
|
254
|
+
cwd = Dir.pwd
|
|
255
|
+
normalised_wt = File.join( worktree_path, "" )
|
|
256
|
+
cwd == worktree_path || cwd.start_with?( normalised_wt )
|
|
257
|
+
rescue StandardError
|
|
258
|
+
false
|
|
259
|
+
end
|
|
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
|
+
|
|
238
271
|
# Resolves a worktree path: if it's a bare name, look under .claude/worktrees/.
|
|
239
272
|
def resolve_worktree_path( worktree_path: )
|
|
240
273
|
return File.expand_path( worktree_path ) if worktree_path.include?( "/" )
|