cc-sessions 1.3.0 → 1.4.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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -0
  4. data/bin/cc +18 -2
  5. data/bin/cc-bookmark +21 -4
  6. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 605f4de2854d8c09e7930c20cb0bce3f3b511d6dc4d7f7e87258d1eb9082108f
4
- data.tar.gz: c87c3a2b615a1631c5932154055b49d8bebec23663031dd1ffb446fe79477cef
3
+ metadata.gz: 302db7d00c9681e2823893988f22267090d6d5f4fdce2d32a64ace1fca5aac52
4
+ data.tar.gz: 12fefe5a2c340b8c3cd6bb8b599a81131fa353e01b7716a7b74b5f8dabe95394
5
5
  SHA512:
6
- metadata.gz: 1f9d6e2c15ff339679c7a65fe43354b2ee4518c8ebe78af68092492244c35e82f4afeac6a119e36914ba63e4734283e188b28b7d65e3fa77cebb3f51e5b056f6
7
- data.tar.gz: 776a04d367ad4c6e169ebc58819a1cf62baa835f32f9fd9bd680a16d04fbabe65f5fe07b70f251d7221421be944a5e8226b489cd2099f625926243a1505bcba0
6
+ metadata.gz: 8898826c0e19218be5b433168ba3c436331d85b8452eb7d8eb29df33355d823d33628e2047a24eea26b444862eb47e6f8dfc41ca4d4e42a1f6c630d0dc891568
7
+ data.tar.gz: 6b8fe25b31450efecac302897df36624968d035c07d429e2d5f6174747847f515355c26c81faecf673a0e7b7b816ab5e9be045caddb04c0910f6c4c85ff49cfb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.1] - 2026-03-03
4
+
5
+ ### Fixed
6
+ - `cc-bookmark` query mode now proactively migrates bookmarks when a context continuation is detected (was only printing tags without migrating)
7
+ - Hook now detects new session IDs by comparing newest `.jsonl` against a stamp, instead of only running once per `CC_SESSION_ID`
8
+
9
+ ### Changed
10
+ - Hook outputs "Bookmark auto-migrated" when migration happens during a continuation
11
+ - Migration prints "Bookmark migrated:" instead of "Current bookmark:" so the hook can distinguish migration from no-op
12
+
13
+ ## [1.4.0] - 2026-03-03
14
+
15
+ ### Fixed
16
+ - Resuming a session that had a context continuation now auto-follows to the latest session ID instead of jumping back to the old one
17
+ - Re-bookmarking (`/bm`) in a continued session now uses the detected (newest) session ID instead of the stale env var
18
+
19
+ ### Changed
20
+ - `resume_session` detects newer `.jsonl` files and auto-migrates the bookmark before resuming
21
+ - `cc-bookmark` prefers detected session ID over `CC_SESSION_ID` env var in bookmark mode
22
+ - Old bookmarks and breadcrumbs cleaned up automatically during migration
23
+
3
24
  ## [1.3.0] - 2026-02-27
4
25
 
5
26
  ### Added
data/README.md CHANGED
@@ -19,6 +19,7 @@ meaningful names and quickly resume them.
19
19
  - **Resume sessions** with `cc tag` from anywhere
20
20
  - **Interactive list** with `cc -l` (arrow keys or j/k to navigate)
21
21
  - **Running indicator** shows green `●` next to active sessions in `cc -l`
22
+ - **Auto-follow continuations** — when Claude creates a new session (context reset), `cc` detects it and resumes the latest session automatically
22
23
  - **Delete bookmarks** with `d` in list or `cc -d tag`
23
24
  - **Auto-install** the `/bm` command and permission on first run
24
25
  - **Zero dependencies** - pure Ruby
data/bin/cc CHANGED
@@ -390,10 +390,26 @@ def resume_session(session_id, path)
390
390
  exit 1
391
391
  end
392
392
 
393
- # Save resume breadcrumb so cc-bookmark can track session continuations
394
- # (when context resets, Claude creates a new session ID)
395
393
  bookmarks = load_bookmarks
396
394
  entry = bookmarks['sessions'][session_id]
395
+
396
+ # Auto-migrate: if a newer session exists (context continuation), use it
397
+ unless session_id.start_with?('path:')
398
+ session_dir = resolve_session_dir(path)
399
+ newest_id = detect_session_id(session_dir)
400
+ if newest_id && newest_id != session_id && entry
401
+ puts dim("Session was continued — following to latest.")
402
+ bookmarks['sessions'].delete(session_id)
403
+ bookmarks['sessions'][newest_id] = entry
404
+ save_bookmarks(bookmarks)
405
+ # Clean up old breadcrumb if any
406
+ FileUtils.rm_f(File.join(CONFIG_DIR, 'resumed', "#{session_id}.json"))
407
+ session_id = newest_id
408
+ end
409
+ end
410
+
411
+ # Save resume breadcrumb so cc-bookmark can track session continuations
412
+ # (when context resets, Claude creates a new session ID)
397
413
  if entry && !session_id.start_with?('path:')
398
414
  resume_dir = File.join(CONFIG_DIR, 'resumed')
399
415
  FileUtils.mkdir_p(resume_dir)
data/bin/cc-bookmark CHANGED
@@ -114,8 +114,17 @@ if tags.empty?
114
114
  if original_id
115
115
  entry = bookmarks['sessions'][original_id]
116
116
  if entry
117
- # Session ID hasn't changed, or bookmark is still on the original ID
118
- puts "Current bookmark: #{entry['tags'].join(', ')}"
117
+ # Check if session was continued (newer .jsonl exists)
118
+ if session_id && session_id != original_id
119
+ # Migrate bookmark to the new session ID
120
+ bookmarks['sessions'].delete(original_id)
121
+ bookmarks['sessions'][session_id] = entry
122
+ save_bookmarks(bookmarks)
123
+ FileUtils.rm_f(File.join(RESUME_DIR, "#{original_id}.json"))
124
+ puts "Bookmark migrated: #{entry['tags'].join(', ')}"
125
+ else
126
+ puts "Current bookmark: #{entry['tags'].join(', ')}"
127
+ end
119
128
  else
120
129
  # Session ID changed (compaction/context reset).
121
130
  # The bookmark is on the original ID but CC created a new session.
@@ -170,8 +179,16 @@ if tags.empty?
170
179
  end
171
180
  else
172
181
  # Bookmark mode: set tags for current session
173
- # Prefer env var session ID, then detected, then path-based
174
- key = original_id || session_id || "path:#{cwd}"
182
+ # Prefer detected (newest) session ID over env var — the env var may be stale
183
+ # after a context continuation where Claude created a new session ID
184
+ key = session_id || original_id || "path:#{cwd}"
185
+
186
+ # Clean up old bookmark if session ID changed (migration)
187
+ if original_id && original_id != key && bookmarks['sessions'][original_id]
188
+ bookmarks['sessions'].delete(original_id)
189
+ FileUtils.rm_f(File.join(RESUME_DIR, "#{original_id}.json"))
190
+ end
191
+
175
192
  bookmarks['sessions'][key] = { 'path' => cwd, 'tags' => tags }
176
193
  save_bookmarks(bookmarks)
177
194
  puts "Bookmarked: #{cwd}"
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cc-sessions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-27 00:00:00.000000000 Z
11
+ date: 2026-03-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'A simple tool for bookmarking and resuming Claude Code sessions. Tag
14
14
  sessions with meaningful names using /bm inside Claude Code, then quickly resume
15
- them with ''cc <tag>'' from anywhere. v1.3.0: Running session indicator, resume
16
- breadcrumbs, env-var session tracking.'
15
+ them with ''cc <tag>'' from anywhere. v1.4.1: Proactive bookmark migration on context
16
+ continuations via hook.'
17
17
  email:
18
18
  - g@isene.com
19
19
  executables: