cc-sessions 1.5.0 → 1.5.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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/bin/cc-bookmark +29 -7
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5d11bb510817b94f744a4fcbcf84377f11e0eb3dbacc62de24a12b070440ab3
4
- data.tar.gz: f39fcd03d01726cf2aed5373f1d8172a1775d7ad44f8e4945b86d2ee918c690a
3
+ metadata.gz: 17f3d3abaf69a414fca43e117ab74e8c8ee7ae7160916eeac37f500ede7ba67f
4
+ data.tar.gz: 9090fe2bb7999335aef10e4d9058c741353e2066408f4db764429339e2ace16f
5
5
  SHA512:
6
- metadata.gz: b107bb851e4a8cdb041a85da1fe94fe22327e52ff5d8cb2a149a36c07414f550f2f7c2f59e1ee5757cd6b63365926b90713482f5e030e220e39c2874a9335298
7
- data.tar.gz: '05790790d708513d61beabd74d8b372d6974dc66057418b48525ef4be979a3e6c883b3cd59209c75567727355304df2ca805512789f7da0a164f3a9e37d96c49'
6
+ metadata.gz: b245ba85c136be80547fcedc840f2e9a90dda0230c0da14f90221cef2471555e42d38b7783b9c872dd60579add274c8cfafe950c6d5de9ee2b3cf06b07b17e6d
7
+ data.tar.gz: 04717d6bde89c7419ceb3176c5998ab30b2a3efedba977cfc1834c15cf7c510e1f5c22d25e4ade820d6920d2089f84dc7c5f065995b82105d848563f3360a249
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.1] - 2026-03-04
4
+
5
+ ### Fixed
6
+ - Multiple sessions sharing a project dir no longer steal each other's bookmarks
7
+ - `detect_session_id` (newest `.jsonl`) no longer overrides `CC_SESSION_ID` when the original session file exists
8
+ - Query mode migration only triggers on true context continuation (original `.jsonl` gone), not when another session is simply newer
9
+ - Reserved words ("query", "?", "status", "show") now trigger query mode instead of being saved as tag names
10
+
11
+ ### Added
12
+ - `session_file_exists?` helper to distinguish "context continuation" from "another active session"
13
+
3
14
  ## [1.5.0] - 2026-03-03
4
15
 
5
16
  ### Fixed
data/bin/cc-bookmark CHANGED
@@ -39,6 +39,13 @@ def detect_session_id(session_dir, exclude_id: nil)
39
39
  File.basename(newest, '.jsonl')
40
40
  end
41
41
 
42
+ # Check if a session's .jsonl file still exists in the project dir
43
+ def session_file_exists?(session_id, session_dir)
44
+ return false unless session_id
45
+ encoded = session_dir.gsub('/', '-')
46
+ File.exist?(File.join(CLAUDE_PROJECTS, encoded, "#{session_id}.jsonl"))
47
+ end
48
+
42
49
  # Find resume breadcrumb for a specific session ID only.
43
50
  # Only matches exact session IDs — never scans siblings by path.
44
51
  def find_resume_breadcrumb(session_id)
@@ -99,15 +106,23 @@ cwd ||= resolve_session_dir(Dir.pwd)
99
106
  session_id = detect_session_id(cwd) # Fallback — picks newest .jsonl
100
107
  tags = ARGV
101
108
 
109
+ # Treat reserved words as query mode, not tag names
110
+ QUERY_WORDS = %w[? query status show].freeze
111
+ if tags.length == 1 && QUERY_WORDS.include?(tags.first.downcase)
112
+ tags = [] # Convert to query mode
113
+ end
114
+
102
115
  if tags.empty?
103
116
  # Query mode: show tags for current session
104
117
  # Priority: check the known original session ID first (from env var)
105
118
  if original_id
106
119
  entry = bookmarks['sessions'][original_id]
107
120
  if entry
108
- # Check if session was continued (newer .jsonl exists)
109
- if session_id && session_id != original_id
110
- # Migrate bookmark to the new session ID
121
+ # Check if session was continued: original .jsonl is GONE and a newer one exists.
122
+ # If original .jsonl still exists, another session is just more recent — NOT a continuation.
123
+ original_gone = !session_file_exists?(original_id, cwd)
124
+ if original_gone && session_id && session_id != original_id
125
+ # True context continuation — migrate bookmark to the new session ID
111
126
  bookmarks['sessions'].delete(original_id)
112
127
  bookmarks['sessions'][session_id] = entry
113
128
  save_bookmarks(bookmarks)
@@ -159,11 +174,18 @@ if tags.empty?
159
174
  end
160
175
  else
161
176
  # Bookmark mode: set tags for current session
162
- # Prefer detected (newest) session ID over env var the env var may be stale
163
- # after a context continuation where Claude created a new session ID
164
- key = session_id || original_id || "path:#{cwd}"
177
+ # Use CC_SESSION_ID when its .jsonl still exists (it's the real session).
178
+ # Only fall back to detect_session_id when the original is gone (context continuation).
179
+ if original_id && session_file_exists?(original_id, cwd)
180
+ key = original_id
181
+ elsif original_id && session_id && session_id != original_id
182
+ # Context continuation — original .jsonl gone, use the new one
183
+ key = session_id
184
+ else
185
+ key = session_id || original_id || "path:#{cwd}"
186
+ end
165
187
 
166
- # Clean up old bookmark if session ID changed (migration)
188
+ # Clean up old bookmark if session ID changed (true migration)
167
189
  if original_id && original_id != key && bookmarks['sessions'][original_id]
168
190
  bookmarks['sessions'].delete(original_id)
169
191
  FileUtils.rm_f(File.join(RESUME_DIR, "#{original_id}.json"))
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.5.0
4
+ version: 1.5.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-03-03 00:00:00.000000000 Z
11
+ date: 2026-03-04 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.5.0: Strict session-ID matching — no more
16
- path-based bookmark cross-contamination.'
15
+ them with ''cc <tag>'' from anywhere. v1.5.1: Fix multi-session bookmark isolation
16
+ sessions sharing a project dir no longer steal each other''s bookmarks.'
17
17
  email:
18
18
  - g@isene.com
19
19
  executables: