cc-sessions 1.1.3 → 1.1.4

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 (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bin/cc +21 -6
  4. data/bin/cc-bookmark +16 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06e2ca6f4ef6b30f3405ddb5be9af6f30c0c9f9d2b3d71882df8b4fc3f37d043
4
- data.tar.gz: b021936ca48295dbe300b366cc1fef360be465559dd4fc94195b67a96b8a2d0b
3
+ metadata.gz: d599c44925b47fb2fd595e9956d6591eebd6d20491fbfcf9dabe0fd15713c36c
4
+ data.tar.gz: d33291906f06251ab048ecddb2e814d5344897222d0f08feb12a2ecdf0e57414
5
5
  SHA512:
6
- metadata.gz: 74a0948aba216611e7d6f6b0816e94f2371ab7861f3f23eff90f33631165149290036b106a902073e4d1131c3a6e7d4a3f7babf4046b9086e76543750490417d
7
- data.tar.gz: dc30be2e052937a75d2a8688583d26668f828ae65f94170527c05c57e5093d41b9657cd4c3c2734e2fb1b5d51df3b9e60cd5841c50b8a41fe75a4d99c0aa4809
6
+ metadata.gz: ca6d6a84a451646a729dbe14657b692991e2299429f4c96133b5136e188601812b64e6302873612e095ee132da743d6ee741bb8cf17b828fa0ca3c8bb1375fb8
7
+ data.tar.gz: 5ea42920ca5c79ab283409c538cedfe1f35e99858d59c8b23d507ba6730a1a4ee7d3fd67881ac3dd7e7a222b7c25a432f4c9259cf3a339e2481a6c33efcbd41b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.4] - 2025-02-10
4
+
5
+ ### Fixed
6
+ - Bookmark path resolution when claude changes directory during session
7
+ - `cc -C` now resolves original session directory via ~/.claude/projects/
8
+
3
9
  ## [1.1.3] - 2025-02-04
4
10
 
5
11
  ### Added
data/bin/cc CHANGED
@@ -81,12 +81,28 @@ rescue JSON::ParserError
81
81
  {}
82
82
  end
83
83
 
84
+ CLAUDE_PROJECTS = File.expand_path('~/.claude/projects')
85
+
86
+ def resolve_session_dir(cwd)
87
+ # Find the original session directory by checking ~/.claude/projects/
88
+ # Claude encodes project paths as /foo/bar -> -foo-bar
89
+ path = cwd
90
+ loop do
91
+ encoded = path.gsub('/', '-')
92
+ return path if Dir.exist?(File.join(CLAUDE_PROJECTS, encoded))
93
+ parent = File.dirname(path)
94
+ break if parent == path # reached root
95
+ path = parent
96
+ end
97
+ cwd # fallback to cwd if no project dir found
98
+ end
99
+
84
100
  def find_tags_for_path(path, bookmarks)
85
101
  bookmarks[path] || []
86
102
  end
87
103
 
88
104
  def show_current_sessions
89
- # Find running claude processes (exclude grep itself and this script)
105
+ # Find running claude processes
90
106
  pids = `pgrep -x claude 2>/dev/null`.split.map(&:to_i)
91
107
 
92
108
  if pids.empty?
@@ -96,23 +112,22 @@ def show_current_sessions
96
112
 
97
113
  bookmarks = load_bookmarks
98
114
 
99
- puts "Currently running Claude Code sessions:\n\n"
115
+ puts "Running sessions:\n\n"
100
116
 
101
117
  pids.each do |pid|
102
- # Get working directory from /proc
103
118
  cwd_link = "/proc/#{pid}/cwd"
104
119
  next unless File.exist?(cwd_link)
105
120
 
106
121
  begin
107
122
  cwd = File.readlink(cwd_link)
108
- tags = find_tags_for_path(cwd, bookmarks)
123
+ session_dir = resolve_session_dir(cwd)
124
+ tags = find_tags_for_path(session_dir, bookmarks)
109
125
  tag_str = tags.empty? ? dim('(no tags)') : green(tags.join(', '))
110
126
 
111
- puts " PID #{cyan(pid.to_s)}: #{cwd}"
127
+ puts " PID #{cyan(pid.to_s)}: #{session_dir}"
112
128
  puts " Tags: #{tag_str}"
113
129
  puts
114
130
  rescue Errno::EACCES
115
- # Can't read cwd for this process
116
131
  puts " PID #{cyan(pid.to_s)}: #{dim('(permission denied)')}"
117
132
  puts
118
133
  end
data/bin/cc-bookmark CHANGED
@@ -9,6 +9,21 @@ require 'fileutils'
9
9
 
10
10
  CONFIG_DIR = File.expand_path('~/.cc-sessions')
11
11
  BOOKMARKS_FILE = File.join(CONFIG_DIR, 'bookmarks.json')
12
+ CLAUDE_PROJECTS = File.expand_path('~/.claude/projects')
13
+
14
+ def resolve_session_dir(cwd)
15
+ # Find the original session directory by checking ~/.claude/projects/
16
+ # Claude encodes project paths as /foo/bar -> -foo-bar
17
+ path = cwd
18
+ loop do
19
+ encoded = path.gsub('/', '-')
20
+ return path if Dir.exist?(File.join(CLAUDE_PROJECTS, encoded))
21
+ parent = File.dirname(path)
22
+ break if parent == path
23
+ path = parent
24
+ end
25
+ cwd
26
+ end
12
27
 
13
28
  FileUtils.mkdir_p(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
14
29
 
@@ -18,7 +33,7 @@ bookmarks = if File.exist?(BOOKMARKS_FILE)
18
33
  {}
19
34
  end
20
35
 
21
- cwd = Dir.pwd
36
+ cwd = resolve_session_dir(Dir.pwd)
22
37
  tags = ARGV
23
38
 
24
39
  if tags.empty?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cc-sessions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
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-04 00:00:00.000000000 Z
11
+ date: 2026-02-10 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