cc-sessions 1.0.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 +7 -0
- data/CHANGELOG.md +12 -0
- data/LICENSE +21 -0
- data/README.md +94 -0
- data/bin/cc +165 -0
- data/commands/bm.md +53 -0
- metadata +54 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 52db66e364f567c81a0b225a661aef39244f8a05d2af99eb8984306c29496861
|
|
4
|
+
data.tar.gz: 582efdbb8033444176c073b79a3b79e2804ee126aabf263d2f00643419102d14
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a883b1f7f0322e78d21d9bf7990697086a5f19d0822436470b4f905b483bc8c345ded04060c6d6c352c7af724326f3e445ce1e670e99b2006a859c14c947e595
|
|
7
|
+
data.tar.gz: ee039f8506c02760a62c9bbd423fccc6f44a2be6420e6b80f269a0ef534b84dad6f9562b2561365a1a64295906683726cb6aa26d73c0b5ba0aef9e7d8788bd95
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - 2025-01-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Initial release
|
|
7
|
+
- `cc` command to manage Claude Code sessions
|
|
8
|
+
- `/bm` slash command for bookmarking sessions with tags
|
|
9
|
+
- `cc <tag>` to resume session by tag
|
|
10
|
+
- `cc -l` to list all bookmarked sessions
|
|
11
|
+
- `cc -h` for help
|
|
12
|
+
- Auto-install of `/bm` command on first run
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Geir Isene
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# CC-sessions
|
|
2
|
+
|
|
3
|
+
A simple tool for bookmarking and resuming Claude Code sessions with tags.
|
|
4
|
+
|
|
5
|
+
## The Problem
|
|
6
|
+
|
|
7
|
+
Claude Code sessions are tied to directories, making it hard to remember where
|
|
8
|
+
you were working on specific projects. This tool lets you tag sessions with
|
|
9
|
+
meaningful names and quickly resume them.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Bookmark sessions** with `/bm tag1 tag2` inside Claude Code
|
|
14
|
+
- **Resume sessions** with `cc tag` from anywhere
|
|
15
|
+
- **List bookmarks** with `cc -l`
|
|
16
|
+
- **Auto-install** the `/bm` command on first run
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Clone the repository
|
|
22
|
+
git clone https://github.com/isene/CC-sessions.git
|
|
23
|
+
cd CC-sessions
|
|
24
|
+
|
|
25
|
+
# Add to your PATH (add to .zshrc or .bashrc)
|
|
26
|
+
export PATH="$HOME/path/to/CC-sessions/bin:$PATH"
|
|
27
|
+
|
|
28
|
+
# Or create a symlink
|
|
29
|
+
ln -sf /path/to/CC-sessions/bin/cc ~/bin/cc
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Bookmarking Sessions
|
|
35
|
+
|
|
36
|
+
Inside a Claude Code session, use the `/bm` command:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
/bm rtfm ruby filemanager
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This bookmarks the current session with three tags. You can later resume it
|
|
43
|
+
using any of those tags.
|
|
44
|
+
|
|
45
|
+
### Resuming Sessions
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Resume session tagged 'rtfm'
|
|
49
|
+
cc rtfm
|
|
50
|
+
|
|
51
|
+
# Continue session in current directory (or start new)
|
|
52
|
+
cc
|
|
53
|
+
|
|
54
|
+
# List all bookmarked sessions
|
|
55
|
+
cc -l
|
|
56
|
+
|
|
57
|
+
# Show help
|
|
58
|
+
cc -h
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### First Run
|
|
62
|
+
|
|
63
|
+
On first run, `cc` automatically installs the `/bm` command to `~/.claude/commands/`.
|
|
64
|
+
This enables the `/bm` command inside Claude Code.
|
|
65
|
+
|
|
66
|
+
## Files
|
|
67
|
+
|
|
68
|
+
| File | Purpose |
|
|
69
|
+
|------|---------|
|
|
70
|
+
| `~/.cc-sessions/bookmarks.json` | Stores your bookmarks |
|
|
71
|
+
| `~/.claude/commands/bm.md` | The `/bm` command definition |
|
|
72
|
+
|
|
73
|
+
## Example Workflow
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Start working on RTFM project
|
|
77
|
+
cd ~/projects/rtfm
|
|
78
|
+
claude
|
|
79
|
+
|
|
80
|
+
# Inside Claude Code, bookmark it
|
|
81
|
+
/bm rtfm ruby filemanager
|
|
82
|
+
|
|
83
|
+
# Later, from anywhere
|
|
84
|
+
cc rtfm # Instantly back in that session
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Requirements
|
|
88
|
+
|
|
89
|
+
- Ruby 2.7+
|
|
90
|
+
- Claude Code CLI (`claude`)
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
data/bin/cc
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# CC - Claude Code Session Manager
|
|
5
|
+
# Easily bookmark and resume Claude Code sessions with tags
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# cc - Continue session in current dir, or start new
|
|
9
|
+
# cc <tag> - Resume session bookmarked with <tag>
|
|
10
|
+
# cc -l, --list - List all bookmarked sessions
|
|
11
|
+
# cc -h, --help - Show help
|
|
12
|
+
#
|
|
13
|
+
# Bookmarking (in Claude Code):
|
|
14
|
+
# /bm tag1 tag2 - Bookmark current session with tags
|
|
15
|
+
|
|
16
|
+
require 'json'
|
|
17
|
+
require 'fileutils'
|
|
18
|
+
|
|
19
|
+
CONFIG_DIR = File.expand_path('~/.cc-sessions')
|
|
20
|
+
BOOKMARKS_FILE = File.join(CONFIG_DIR, 'bookmarks.json')
|
|
21
|
+
COMMAND_SOURCE = File.expand_path('../commands/bm.md', __dir__)
|
|
22
|
+
COMMAND_DEST = File.expand_path('~/.claude/commands/bm.md')
|
|
23
|
+
|
|
24
|
+
def ensure_setup
|
|
25
|
+
# Create config directory
|
|
26
|
+
FileUtils.mkdir_p(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
|
|
27
|
+
|
|
28
|
+
# Install /bm command if not present
|
|
29
|
+
unless File.exist?(COMMAND_DEST)
|
|
30
|
+
if File.exist?(COMMAND_SOURCE)
|
|
31
|
+
FileUtils.mkdir_p(File.dirname(COMMAND_DEST))
|
|
32
|
+
FileUtils.cp(COMMAND_SOURCE, COMMAND_DEST)
|
|
33
|
+
puts "Installed /bm command to #{COMMAND_DEST}"
|
|
34
|
+
puts "You can now use '/bm tag1 tag2' in Claude Code to bookmark sessions."
|
|
35
|
+
puts
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def load_bookmarks
|
|
41
|
+
return {} unless File.exist?(BOOKMARKS_FILE)
|
|
42
|
+
JSON.parse(File.read(BOOKMARKS_FILE))
|
|
43
|
+
rescue JSON::ParserError
|
|
44
|
+
{}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def find_session_by_tag(tag)
|
|
48
|
+
bookmarks = load_bookmarks
|
|
49
|
+
bookmarks.each do |path, tags|
|
|
50
|
+
return path if tags.include?(tag)
|
|
51
|
+
end
|
|
52
|
+
nil
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def session_exists_in_dir?(dir)
|
|
56
|
+
# Check for .claude directory with session files
|
|
57
|
+
claude_dir = File.join(dir, '.claude')
|
|
58
|
+
return false unless Dir.exist?(claude_dir)
|
|
59
|
+
|
|
60
|
+
# Look for conversation files or other session indicators
|
|
61
|
+
Dir.glob(File.join(claude_dir, '**/*')).any? { |f| File.file?(f) }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def list_bookmarks
|
|
65
|
+
bookmarks = load_bookmarks
|
|
66
|
+
|
|
67
|
+
if bookmarks.empty?
|
|
68
|
+
puts "No bookmarked sessions."
|
|
69
|
+
puts
|
|
70
|
+
puts "To bookmark a session, use '/bm tag1 tag2' in Claude Code."
|
|
71
|
+
return
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
puts "Bookmarked Claude Code sessions:"
|
|
75
|
+
puts
|
|
76
|
+
|
|
77
|
+
bookmarks.each do |path, tags|
|
|
78
|
+
exists = Dir.exist?(path) ? '' : ' [NOT FOUND]'
|
|
79
|
+
puts "#{path}#{exists}"
|
|
80
|
+
puts " Tags: #{tags.join(', ')}"
|
|
81
|
+
puts
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def show_help
|
|
86
|
+
puts <<~HELP
|
|
87
|
+
CC - Claude Code Session Manager
|
|
88
|
+
|
|
89
|
+
Easily bookmark and resume Claude Code sessions with tags.
|
|
90
|
+
|
|
91
|
+
USAGE:
|
|
92
|
+
cc Continue session in current directory, or start new
|
|
93
|
+
cc <tag> Resume session bookmarked with <tag>
|
|
94
|
+
cc -l, --list List all bookmarked sessions
|
|
95
|
+
cc -h, --help Show this help
|
|
96
|
+
|
|
97
|
+
BOOKMARKING (inside Claude Code):
|
|
98
|
+
/bm tag1 tag2 Bookmark current session with one or more tags
|
|
99
|
+
|
|
100
|
+
EXAMPLES:
|
|
101
|
+
cc rtfm Resume session tagged 'rtfm'
|
|
102
|
+
cc Continue in current dir or start fresh
|
|
103
|
+
cc -l Show all bookmarked sessions
|
|
104
|
+
|
|
105
|
+
FILES:
|
|
106
|
+
~/.cc-sessions/bookmarks.json Bookmark storage
|
|
107
|
+
~/.claude/commands/bm.md The /bm command definition
|
|
108
|
+
|
|
109
|
+
FIRST RUN:
|
|
110
|
+
On first run, cc installs the /bm command to ~/.claude/commands/
|
|
111
|
+
This enables the '/bm' command inside Claude Code sessions.
|
|
112
|
+
HELP
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def resume_session(path)
|
|
116
|
+
unless Dir.exist?(path)
|
|
117
|
+
puts "Error: Directory not found: #{path}"
|
|
118
|
+
exit 1
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
Dir.chdir(path) do
|
|
122
|
+
puts "Resuming session in: #{path}"
|
|
123
|
+
# Use -c to continue most recent session in this directory (no picker)
|
|
124
|
+
exec('claude', '-c')
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def continue_or_start
|
|
129
|
+
if session_exists_in_dir?(Dir.pwd)
|
|
130
|
+
exec('claude', '-c')
|
|
131
|
+
else
|
|
132
|
+
exec('claude')
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Main
|
|
137
|
+
ensure_setup
|
|
138
|
+
|
|
139
|
+
case ARGV[0]
|
|
140
|
+
when '-h', '--help'
|
|
141
|
+
show_help
|
|
142
|
+
when '-l', '--list'
|
|
143
|
+
list_bookmarks
|
|
144
|
+
when nil
|
|
145
|
+
continue_or_start
|
|
146
|
+
else
|
|
147
|
+
tag = ARGV[0]
|
|
148
|
+
path = find_session_by_tag(tag)
|
|
149
|
+
|
|
150
|
+
if path
|
|
151
|
+
resume_session(path)
|
|
152
|
+
else
|
|
153
|
+
puts "No session found with tag '#{tag}'"
|
|
154
|
+
puts
|
|
155
|
+
puts "Available tags:"
|
|
156
|
+
bookmarks = load_bookmarks
|
|
157
|
+
if bookmarks.empty?
|
|
158
|
+
puts " (none - use '/bm tag1 tag2' in Claude Code to bookmark)"
|
|
159
|
+
else
|
|
160
|
+
all_tags = bookmarks.values.flatten.uniq.sort
|
|
161
|
+
all_tags.each { |t| puts " #{t}" }
|
|
162
|
+
end
|
|
163
|
+
exit 1
|
|
164
|
+
end
|
|
165
|
+
end
|
data/commands/bm.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Bookmark Session
|
|
2
|
+
|
|
3
|
+
Bookmark the current Claude Code session with tags for easy resumption later.
|
|
4
|
+
|
|
5
|
+
## Arguments
|
|
6
|
+
|
|
7
|
+
The user provides space-separated tags after `/bm`. For example:
|
|
8
|
+
- `/bm rtfm` - one tag
|
|
9
|
+
- `/bm rtfm ruby filemanager` - multiple tags
|
|
10
|
+
|
|
11
|
+
## What to Do
|
|
12
|
+
|
|
13
|
+
1. Get the current working directory (this is the session path)
|
|
14
|
+
2. Parse the tags from the command arguments (the text after `/bm`)
|
|
15
|
+
3. Store the bookmark in `~/.cc-sessions/bookmarks.json`
|
|
16
|
+
4. If no tags provided, show current bookmark for this directory (if any)
|
|
17
|
+
|
|
18
|
+
## Implementation
|
|
19
|
+
|
|
20
|
+
Run this bash command, replacing `$TAGS` with the actual tags provided:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
mkdir -p ~/.cc-sessions && ruby -rjson -e '
|
|
24
|
+
file = File.expand_path("~/.cc-sessions/bookmarks.json")
|
|
25
|
+
bookmarks = File.exist?(file) ? JSON.parse(File.read(file)) : {}
|
|
26
|
+
cwd = Dir.pwd
|
|
27
|
+
tags = ARGV
|
|
28
|
+
if tags.empty?
|
|
29
|
+
if bookmarks[cwd]
|
|
30
|
+
puts "Current bookmark: #{bookmarks[cwd].join(", ")}"
|
|
31
|
+
else
|
|
32
|
+
puts "No bookmark for this directory. Usage: /bm tag1 tag2 ..."
|
|
33
|
+
end
|
|
34
|
+
else
|
|
35
|
+
bookmarks[cwd] = tags
|
|
36
|
+
File.write(file, JSON.pretty_generate(bookmarks))
|
|
37
|
+
puts "Bookmarked: #{cwd}"
|
|
38
|
+
puts "Tags: #{tags.join(", ")}"
|
|
39
|
+
puts ""
|
|
40
|
+
puts "Resume later with: cc #{tags.first}"
|
|
41
|
+
end
|
|
42
|
+
' $TAGS
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Response Format
|
|
46
|
+
|
|
47
|
+
After bookmarking, confirm:
|
|
48
|
+
```
|
|
49
|
+
Bookmarked: /path/to/session
|
|
50
|
+
Tags: tag1, tag2, tag3
|
|
51
|
+
|
|
52
|
+
Resume later with: cc tag1
|
|
53
|
+
```
|
metadata
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cc-sessions
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Geir Isene
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-01-23 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple tool for bookmarking and resuming Claude Code sessions. Tag
|
|
14
|
+
sessions with meaningful names using /bm inside Claude Code, then quickly resume
|
|
15
|
+
them with 'cc <tag>' from anywhere.
|
|
16
|
+
email:
|
|
17
|
+
- g@isene.com
|
|
18
|
+
executables:
|
|
19
|
+
- cc
|
|
20
|
+
extensions: []
|
|
21
|
+
extra_rdoc_files: []
|
|
22
|
+
files:
|
|
23
|
+
- CHANGELOG.md
|
|
24
|
+
- LICENSE
|
|
25
|
+
- README.md
|
|
26
|
+
- bin/cc
|
|
27
|
+
- commands/bm.md
|
|
28
|
+
homepage: https://github.com/isene/CC-sessions
|
|
29
|
+
licenses:
|
|
30
|
+
- MIT
|
|
31
|
+
metadata:
|
|
32
|
+
homepage_uri: https://github.com/isene/CC-sessions
|
|
33
|
+
source_code_uri: https://github.com/isene/CC-sessions
|
|
34
|
+
changelog_uri: https://github.com/isene/CC-sessions/blob/main/CHANGELOG.md
|
|
35
|
+
post_install_message:
|
|
36
|
+
rdoc_options: []
|
|
37
|
+
require_paths:
|
|
38
|
+
- lib
|
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 2.7.0
|
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '0'
|
|
49
|
+
requirements: []
|
|
50
|
+
rubygems_version: 3.4.20
|
|
51
|
+
signing_key:
|
|
52
|
+
specification_version: 4
|
|
53
|
+
summary: Bookmark and resume Claude Code sessions with tags
|
|
54
|
+
test_files: []
|