cc-sessions 1.0.0 → 1.0.2

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 (8) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/LICENSE +20 -17
  4. data/README.md +23 -13
  5. data/bin/cc +27 -0
  6. data/bin/cc-bookmark +37 -0
  7. data/commands/bm.md +7 -35
  8. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52db66e364f567c81a0b225a661aef39244f8a05d2af99eb8984306c29496861
4
- data.tar.gz: 582efdbb8033444176c073b79a3b79e2804ee126aabf263d2f00643419102d14
3
+ metadata.gz: 76dc4063f182c1d78b8eead156b8e57ffe2728198e72ae30efbcd3234a7fc2a6
4
+ data.tar.gz: 4f739bbcde871c0db6b0473480ab2063d7777ea1ab73f5051fa7c6c6dc104b5d
5
5
  SHA512:
6
- metadata.gz: a883b1f7f0322e78d21d9bf7990697086a5f19d0822436470b4f905b483bc8c345ded04060c6d6c352c7af724326f3e445ce1e670e99b2006a859c14c947e595
7
- data.tar.gz: ee039f8506c02760a62c9bbd423fccc6f44a2be6420e6b80f269a0ef534b84dad6f9562b2561365a1a64295906683726cb6aa26d73c0b5ba0aef9e7d8788bd95
6
+ metadata.gz: 6998837a2bde9b9ce143d47f85d39e5cf1d12ac010849c8971ad1470b7e31d67a712668530a4fa960300e61140fa54e677ade91151bed102805ca4cf8e95cc1c
7
+ data.tar.gz: 2990b688c7cef2a6c87559aa5ed8d6ecd933a4741f84c4af8d965024297a11bc9ef52c7948a81d82da5bd2f8eabeb3e77481cfe594a8fecdfd8423f11722e12d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.2] - 2025-01-23
4
+
5
+ ### Added
6
+ - `cc-bookmark` helper script for reliable permission matching
7
+ - SVG logo
8
+
9
+ ### Changed
10
+ - `/bm` command now uses `cc-bookmark` script (auto-accepts without prompts)
11
+ - Updated README with badges and proper logo placement
12
+
13
+ ## [1.0.1] - 2025-01-23
14
+
15
+ ### Added
16
+ - Auto-add permission for `/bm` command on first run (no confirmation prompt)
17
+
3
18
  ## [1.0.0] - 2025-01-23
4
19
 
5
20
  ### Added
data/LICENSE CHANGED
@@ -1,21 +1,24 @@
1
- MIT License
1
+ This is free and unencumbered software released into the public domain.
2
2
 
3
- Copyright (c) 2026 Geir Isene
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
4
7
 
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:
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
11
15
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
14
23
 
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.
24
+ For more information, please refer to <https://unlicense.org>
data/README.md CHANGED
@@ -1,32 +1,38 @@
1
1
  # CC-sessions
2
2
 
3
- A simple tool for bookmarking and resuming Claude Code sessions with tags.
3
+ ![Ruby](https://img.shields.io/badge/language-Ruby-red) [![Gem Version](https://badge.fury.io/rb/cc-sessions.svg)](https://badge.fury.io/rb/cc-sessions) ![Unlicense](https://img.shields.io/badge/license-Unlicense-green)
4
+
5
+ <img src="img/cc-sessions_logo.svg" align="left" width="150" height="150">
4
6
 
5
- ## The Problem
7
+ A simple tool for bookmarking and resuming Claude Code sessions with tags.
6
8
 
7
9
  Claude Code sessions are tied to directories, making it hard to remember where
8
10
  you were working on specific projects. This tool lets you tag sessions with
9
11
  meaningful names and quickly resume them.
10
12
 
13
+ <br clear="left"/>
14
+
11
15
  ## Features
12
16
 
13
17
  - **Bookmark sessions** with `/bm tag1 tag2` inside Claude Code
14
18
  - **Resume sessions** with `cc tag` from anywhere
15
19
  - **List bookmarks** with `cc -l`
16
- - **Auto-install** the `/bm` command on first run
20
+ - **Auto-install** the `/bm` command and permission on first run
17
21
 
18
22
  ## Installation
19
23
 
24
+ ### From RubyGems (Recommended)
25
+
20
26
  ```bash
21
- # Clone the repository
22
- git clone https://github.com/isene/CC-sessions.git
23
- cd CC-sessions
27
+ gem install cc-sessions
28
+ ```
24
29
 
25
- # Add to your PATH (add to .zshrc or .bashrc)
26
- export PATH="$HOME/path/to/CC-sessions/bin:$PATH"
30
+ ### From Source
27
31
 
28
- # Or create a symlink
29
- ln -sf /path/to/CC-sessions/bin/cc ~/bin/cc
32
+ ```bash
33
+ git clone https://github.com/isene/CC-sessions.git
34
+ cd CC-sessions
35
+ ./install.sh
30
36
  ```
31
37
 
32
38
  ## Usage
@@ -60,8 +66,11 @@ cc -h
60
66
 
61
67
  ### First Run
62
68
 
63
- On first run, `cc` automatically installs the `/bm` command to `~/.claude/commands/`.
64
- This enables the `/bm` command inside Claude Code.
69
+ On first run, `cc` automatically:
70
+ 1. Installs the `/bm` command to `~/.claude/commands/`
71
+ 2. Adds auto-accept permission to `~/.claude/settings.json`
72
+
73
+ This enables `/bm` to work without confirmation prompts.
65
74
 
66
75
  ## Files
67
76
 
@@ -69,6 +78,7 @@ This enables the `/bm` command inside Claude Code.
69
78
  |------|---------|
70
79
  | `~/.cc-sessions/bookmarks.json` | Stores your bookmarks |
71
80
  | `~/.claude/commands/bm.md` | The `/bm` command definition |
81
+ | `~/.claude/settings.json` | Permission for auto-accept |
72
82
 
73
83
  ## Example Workflow
74
84
 
@@ -91,4 +101,4 @@ cc rtfm # Instantly back in that session
91
101
 
92
102
  ## License
93
103
 
94
- MIT
104
+ This software is released into the public domain under [The Unlicense](https://unlicense.org/).
data/bin/cc CHANGED
@@ -20,6 +20,8 @@ CONFIG_DIR = File.expand_path('~/.cc-sessions')
20
20
  BOOKMARKS_FILE = File.join(CONFIG_DIR, 'bookmarks.json')
21
21
  COMMAND_SOURCE = File.expand_path('../commands/bm.md', __dir__)
22
22
  COMMAND_DEST = File.expand_path('~/.claude/commands/bm.md')
23
+ SETTINGS_FILE = File.expand_path('~/.claude/settings.json')
24
+ BM_PERMISSION = 'Bash(cc-bookmark:*)'
23
25
 
24
26
  def ensure_setup
25
27
  # Create config directory
@@ -35,6 +37,31 @@ def ensure_setup
35
37
  puts
36
38
  end
37
39
  end
40
+
41
+ # Add auto-accept permission for /bm command
42
+ ensure_permission
43
+ end
44
+
45
+ def ensure_permission
46
+ settings = if File.exist?(SETTINGS_FILE)
47
+ JSON.parse(File.read(SETTINGS_FILE))
48
+ else
49
+ {}
50
+ end
51
+
52
+ settings['permissions'] ||= {}
53
+ settings['permissions']['allow'] ||= []
54
+
55
+ unless settings['permissions']['allow'].include?(BM_PERMISSION)
56
+ settings['permissions']['allow'] << BM_PERMISSION
57
+ FileUtils.mkdir_p(File.dirname(SETTINGS_FILE))
58
+ File.write(SETTINGS_FILE, JSON.pretty_generate(settings))
59
+ puts "Added auto-accept permission for /bm command"
60
+ puts
61
+ end
62
+ rescue JSON::ParserError
63
+ # If settings.json is malformed, skip permission setup
64
+ warn "Warning: Could not parse ~/.claude/settings.json - skipping permission setup"
38
65
  end
39
66
 
40
67
  def load_bookmarks
data/bin/cc-bookmark ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # CC-Bookmark - Helper script for /bm command
5
+ # Bookmarks the current directory with tags
6
+
7
+ require 'json'
8
+ require 'fileutils'
9
+
10
+ CONFIG_DIR = File.expand_path('~/.cc-sessions')
11
+ BOOKMARKS_FILE = File.join(CONFIG_DIR, 'bookmarks.json')
12
+
13
+ FileUtils.mkdir_p(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
14
+
15
+ bookmarks = if File.exist?(BOOKMARKS_FILE)
16
+ JSON.parse(File.read(BOOKMARKS_FILE))
17
+ else
18
+ {}
19
+ end
20
+
21
+ cwd = Dir.pwd
22
+ tags = ARGV
23
+
24
+ if tags.empty?
25
+ if bookmarks[cwd]
26
+ puts "Current bookmark: #{bookmarks[cwd].join(', ')}"
27
+ else
28
+ puts "No bookmark for this directory. Usage: /bm tag1 tag2 ..."
29
+ end
30
+ else
31
+ bookmarks[cwd] = tags
32
+ File.write(BOOKMARKS_FILE, JSON.pretty_generate(bookmarks))
33
+ puts "Bookmarked: #{cwd}"
34
+ puts "Tags: #{tags.join(', ')}"
35
+ puts ""
36
+ puts "Resume later with: cc #{tags.first}"
37
+ end
data/commands/bm.md CHANGED
@@ -10,44 +10,16 @@ The user provides space-separated tags after `/bm`. For example:
10
10
 
11
11
  ## What to Do
12
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:
13
+ Run the cc-bookmark command with the provided tags:
21
14
 
22
15
  ```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
16
+ cc-bookmark $TAGS
43
17
  ```
44
18
 
45
- ## Response Format
19
+ Replace `$TAGS` with the actual tags provided by the user.
46
20
 
47
- After bookmarking, confirm:
48
- ```
49
- Bookmarked: /path/to/session
50
- Tags: tag1, tag2, tag3
21
+ ## Example
51
22
 
52
- Resume later with: cc tag1
53
- ```
23
+ User types: `/bm rtfm ruby`
24
+
25
+ Run: `cc-bookmark rtfm ruby`
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cc-sessions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
@@ -17,6 +17,7 @@ email:
17
17
  - g@isene.com
18
18
  executables:
19
19
  - cc
20
+ - cc-bookmark
20
21
  extensions: []
21
22
  extra_rdoc_files: []
22
23
  files:
@@ -24,10 +25,11 @@ files:
24
25
  - LICENSE
25
26
  - README.md
26
27
  - bin/cc
28
+ - bin/cc-bookmark
27
29
  - commands/bm.md
28
30
  homepage: https://github.com/isene/CC-sessions
29
31
  licenses:
30
- - MIT
32
+ - Unlicense
31
33
  metadata:
32
34
  homepage_uri: https://github.com/isene/CC-sessions
33
35
  source_code_uri: https://github.com/isene/CC-sessions