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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/bin/cc +21 -6
- data/bin/cc-bookmark +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d599c44925b47fb2fd595e9956d6591eebd6d20491fbfcf9dabe0fd15713c36c
|
|
4
|
+
data.tar.gz: d33291906f06251ab048ecddb2e814d5344897222d0f08feb12a2ecdf0e57414
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca6d6a84a451646a729dbe14657b692991e2299429f4c96133b5136e188601812b64e6302873612e095ee132da743d6ee741bb8cf17b828fa0ca3c8bb1375fb8
|
|
7
|
+
data.tar.gz: 5ea42920ca5c79ab283409c538cedfe1f35e99858d59c8b23d507ba6730a1a4ee7d3fd67881ac3dd7e7a222b7c25a432f4c9259cf3a339e2481a6c33efcbd41b
|
data/CHANGELOG.md
CHANGED
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
|
|
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 "
|
|
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
|
-
|
|
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)}: #{
|
|
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.
|
|
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-
|
|
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
|