carson 3.12.0 → 3.13.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: d436c55fe8aa3dcd6d680a4051acf5456ccbf93ae4891bc7aeeb70878fa9a945
4
- data.tar.gz: 501ccae43b713c7d0394b58af4816197c79e5bb643a617852b7982f089b5df5e
3
+ metadata.gz: 1d653b3c6ec67aa729186db46215c6e51c85a42ac82ca782f5004f9d84e32a31
4
+ data.tar.gz: 5caa70de1a5c9538c3ef3027ba0862445c9ff2d985ec6f4659231bb40d8e5cb7
5
5
  SHA512:
6
- metadata.gz: e0179948219588b434de25b80159c3b0c57fb57acc09ec57e02e2be480d65afc61e184048667cc0d8155f6ac870fcde80d15b31eff94ed79316285274a5c30a8
7
- data.tar.gz: 22b1fd4044c4ec1918f1b4570e98728d1f645a343ecdb3ce87836c7c373fba6428b417b824f8248ca94620baf21cb48e4e5b1a98a84858b95946e729240f9ef3
6
+ metadata.gz: 91bd6ee521d91f31c3593558e1b544fcba99eefd1d084fb8c618fad428c470d308ed774e7655b31be9d0fc35969bd9d5354832d5002042396e3d48b8ffde77b2
7
+ data.tar.gz: 10758df9aeb5d246211592671eb19c59156cbd9fd7cb5d6e31e32186ee36d1caef8fe3dc7c785bdbfbac4e1339ee8d56bf445556a6722395f8eb42a2bfdabe12
data/RELEASE.md CHANGED
@@ -5,6 +5,18 @@ 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.13.0
9
+
10
+ ### What changed
11
+
12
+ - **Worktree create auto-syncs main** — `carson worktree create` now pulls the main branch from remote (`--ff-only`) before branching. Prevents stale-base merge conflicts that waste agent context resolving later. Best-effort: if pull fails (offline, non-fast-forward), creation continues from the local main.
13
+ - **Deliver prints next steps after merge** — `carson deliver --merge` now tells the agent exactly what to do after a successful merge. If running inside a worktree, prints `cd <main_root> && carson worktree remove <name>`. If not, suggests `carson prune`. Available in both human and JSON output (`next_step` field).
14
+
15
+ ### UX improvement
16
+
17
+ - Agents no longer need to remember post-merge cleanup steps — Carson tells them.
18
+ - Agents no longer hit merge conflicts from stale main — Carson syncs before branching.
19
+
8
20
  ## 3.12.0
9
21
 
10
22
  ### What changed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.12.0
1
+ 3.13.0
@@ -77,6 +77,9 @@ module Carson
77
77
  # Step 6: sync main in the main worktree.
78
78
  sync_after_merge!( remote: remote, main: main, result: result )
79
79
 
80
+ # Step 7: compute next-step guidance for the agent.
81
+ compute_post_merge_next_step!( result: result )
82
+
80
83
  deliver_finish( result: result, exit_code: EXIT_OK, json_output: json_output )
81
84
  end
82
85
 
@@ -128,6 +131,7 @@ module Carson
128
131
 
129
132
  if result[ :merged ]
130
133
  puts_line "Merged PR ##{result[ :pr_number ]} via #{result[ :merge_method ]}."
134
+ puts_line " Next: #{result[ :next_step ]}" if result[ :next_step ]
131
135
  end
132
136
  end
133
137
 
@@ -290,6 +294,24 @@ module Carson
290
294
  puts_verbose "sync failed: #{pull_stderr.to_s.strip}"
291
295
  end
292
296
  end
297
+
298
+ # Builds next-step guidance after a successful merge.
299
+ # Detects whether the agent is inside a worktree and suggests cleanup.
300
+ def compute_post_merge_next_step!( result: )
301
+ main_root = main_worktree_root
302
+ cwd = realpath_safe( Dir.pwd )
303
+ current_wt = worktree_list.select { |wt| wt.fetch( :path ) != realpath_safe( main_root ) }
304
+ .find { |wt| cwd == wt.fetch( :path ) || cwd.start_with?( File.join( wt.fetch( :path ), "" ) ) }
305
+
306
+ if current_wt
307
+ wt_name = File.basename( current_wt.fetch( :path ) )
308
+ result[ :next_step ] = "cd #{main_root} && carson worktree remove #{wt_name}"
309
+ else
310
+ result[ :next_step ] = "carson prune"
311
+ end
312
+ rescue StandardError
313
+ # Best-effort — do not fail deliver because of next-step detection.
314
+ end
293
315
  end
294
316
 
295
317
  include Deliver
@@ -24,6 +24,13 @@ module Carson
24
24
  # Determine the base branch (main branch from config).
25
25
  base = config.main_branch
26
26
 
27
+ # Sync main from remote before branching so the worktree starts
28
+ # from the latest code. Prevents stale-base merge conflicts later.
29
+ # Best-effort — if pull fails (non-ff, offline), continue anyway.
30
+ main_root = main_worktree_root
31
+ _, _, pull_ok, = Open3.capture3( "git", "-C", main_root, "pull", "--ff-only", config.git_remote, base )
32
+ puts_verbose pull_ok.success? ? "synced #{base} before branching" : "sync skipped — continuing from local #{base}"
33
+
27
34
  # Ensure .claude/ is excluded from git status in the host repository.
28
35
  # Uses .git/info/exclude (local-only, never committed) to respect the outsider boundary.
29
36
  ensure_claude_dir_excluded!
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.12.0
4
+ version: 3.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hailei Wang