claude_code_slash_commands 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c210edb72d63d4cdb518fb644dae19bad1f8b78fce946896832949dcf2b15a12
4
+ data.tar.gz: bd4a22abcae98bb843b902eee41eeeafc9575ec9dd8d127b03e4abe5b146afc6
5
+ SHA512:
6
+ metadata.gz: f994df51e9893d1a0bc8b37481470bf04846ff7ed5fac3a9ed1b9fbd0e8f7c005177a0d27dfd7a5575e7a5cd0e11a2b7c33c26204eeb86f1f3c59905d00397d5
7
+ data.tar.gz: a23b39eef771857dfff527f9ff070341e625051e70940b0380b57c7f3fac9cf0964cb5337e9a06a709c35b8dcf69035dce3c7b8b52625df14cc6974830c8d3de
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.4
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Andy Waite
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # claude_code_slash_commands
2
+
3
+ This gem is intended to distribute [slash commands](https://docs.anthropic.com/en/docs/claude-code/slash-commands) for [Claude Code](https://www.anthropic.com/claude-code).
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ ```bash
10
+ bundle add claude_code_slash_commands
11
+ ```
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ ```bash
16
+ gem install claude_code_slash_commands
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ This gem provides a tool to distribute custom slash commands for Claude Code.
22
+
23
+ ### Installing Commands
24
+
25
+ To install the included slash commands to your `~/.claude/commands` directory:
26
+
27
+ ```bash
28
+ claude_code_slash_commands install
29
+ ```
30
+
31
+ This will:
32
+ - Create `~/.claude/commands` directory if it doesn't exist
33
+ - Copy all command files from the gem
34
+ - Ask for confirmation before overwriting existing commands
35
+ - Skip files that are already identical
36
+
37
+ ### Available Commands
38
+
39
+ - `hello_world.md` - A simple example command that demonstrates the slash command format
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+
45
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/andyw8/claude_code_slash_commands.
50
+
51
+ ### Adding Your Own Commands
52
+
53
+ To add your own commands to this gem:
54
+
55
+ 1. Create `.md` files in the `commands/` directory
56
+ 2. Use YAML frontmatter for metadata (optional)
57
+ 3. Write the command prompt in the file content
58
+
59
+ Example command format:
60
+ ```markdown
61
+ ---
62
+ description: Brief description of the command
63
+ allowed-tools: Bash(git status:*)
64
+ ---
65
+
66
+ Your command prompt goes here. This text will be used as the instruction
67
+ when the slash command is invoked.
68
+ ```
69
+
70
+ ## License
71
+
72
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[test standard]
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: A simple hello world example command
3
+ ---
4
+
5
+ Say hello to the world! This is an example slash command that demonstrates the basic structure of a Claude Code slash command.
6
+
7
+ Respond with a friendly greeting and explain what slash commands are.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "claude_code_slash_commands"
5
+
6
+ ClaudeCodeSlashCommands::CLI.start(ARGV)
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "installer"
4
+
5
+ module ClaudeCodeSlashCommands
6
+ class CLI
7
+ def self.start(args)
8
+ new(args).run
9
+ end
10
+
11
+ def initialize(args)
12
+ @args = args
13
+ end
14
+
15
+ def run
16
+ case @args.first
17
+ when "install"
18
+ Installer.new.install
19
+ when "help", "-h", "--help", nil
20
+ show_help
21
+ else
22
+ puts "Unknown command: #{@args.first}"
23
+ show_help
24
+ exit(1)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def show_help
31
+ puts <<~HELP
32
+ Usage: claude_code_slash_commands <command>
33
+
34
+ Commands:
35
+ install Install slash commands to ~/.claude/commands
36
+ help Show this help message
37
+
38
+ Examples:
39
+ claude_code_slash_commands install
40
+ claude_code_slash_commands help
41
+ HELP
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "pathname"
5
+
6
+ module ClaudeCodeSlashCommands
7
+ class Installer
8
+ def initialize(commands_source: nil, commands_target: nil)
9
+ @gem_root = Pathname.new(__dir__).parent.parent
10
+ @commands_source = commands_source || @gem_root.join("commands")
11
+ @commands_target = commands_target || Pathname.new(Dir.home).join(".claude", "commands")
12
+ end
13
+
14
+ def install
15
+ ensure_target_directory
16
+
17
+ if command_files.empty?
18
+ puts "❌ No command files found to install"
19
+ return
20
+ end
21
+
22
+ command_files.each do |file|
23
+ install_command(file)
24
+ end
25
+
26
+ puts "✅ Installation complete!"
27
+ rescue => e
28
+ puts "❌ Installation failed: #{e.message}"
29
+ exit(1)
30
+ end
31
+
32
+ private
33
+
34
+ def ensure_target_directory
35
+ FileUtils.mkdir_p(@commands_target)
36
+ end
37
+
38
+ def command_files
39
+ @commands_source.glob("*.md")
40
+ end
41
+
42
+ def install_command(source_file)
43
+ target_file = @commands_target.join(source_file.basename)
44
+
45
+ if target_file.exist?
46
+ if files_identical?(source_file, target_file)
47
+ puts "⏭️ #{source_file.basename} already exists and is identical"
48
+ return
49
+ end
50
+
51
+ unless confirm_overwrite(source_file.basename)
52
+ puts "⏭️ Skipping #{source_file.basename}"
53
+ return
54
+ end
55
+ end
56
+
57
+ FileUtils.cp(source_file, target_file)
58
+ puts "📄 Installed #{source_file.basename}"
59
+ end
60
+
61
+ def files_identical?(file1, file2)
62
+ file1.read == file2.read
63
+ end
64
+
65
+ def confirm_overwrite(filename)
66
+ print "❓ #{filename} already exists. Overwrite? (y/N): "
67
+ response = $stdin.gets.chomp.downcase
68
+ response == "y" || response == "yes"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ClaudeCodeSlashCommands
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "claude_code_slash_commands/version"
4
+ require_relative "claude_code_slash_commands/cli"
5
+
6
+ module ClaudeCodeSlashCommands
7
+ class Error < StandardError; end
8
+ end
@@ -0,0 +1,4 @@
1
+ module ClaudeCodeSlashCommands
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: claude_code_slash_commands
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Andy Waite
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ email:
13
+ - 13400+andyw8@users.noreply.github.com
14
+ executables:
15
+ - claude_code_slash_commands
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ".ruby-version"
20
+ - ".standard.yml"
21
+ - LICENSE.txt
22
+ - README.md
23
+ - Rakefile
24
+ - commands/hello_world.md
25
+ - exe/claude_code_slash_commands
26
+ - lib/claude_code_slash_commands.rb
27
+ - lib/claude_code_slash_commands/cli.rb
28
+ - lib/claude_code_slash_commands/installer.rb
29
+ - lib/claude_code_slash_commands/version.rb
30
+ - sig/claude_code_slash_commands.rbs
31
+ homepage: https://github.com/andyw8/claude_code_slash_commands
32
+ licenses:
33
+ - MIT
34
+ metadata:
35
+ allowed_push_host: https://rubygems.org
36
+ homepage_uri: https://github.com/andyw8/claude_code_slash_commands
37
+ source_code_uri: https://github.com/andyw8/claude_code_slash_commands
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 3.1.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.6.9
53
+ specification_version: 4
54
+ summary: A tool for distributing Claude Code slash commands.
55
+ test_files: []