commit 676815a5985ceeba857210237f3d83b8b3b1493d Author: Zhongwei Li Date: Sun Nov 30 08:35:16 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..f746db4 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "rbs-goose", + "description": "Setup rbs type definitions for steep and automatically fix type errors", + "version": "1.1.0", + "author": { + "name": "kokuyouwind", + "url": "https://github.com/kokuyouwind" + }, + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e8f370 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# rbs-goose + +Setup rbs type definitions for steep and automatically fix type errors diff --git a/commands/run.md b/commands/run.md new file mode 100644 index 0000000..4bcb7ba --- /dev/null +++ b/commands/run.md @@ -0,0 +1,22 @@ +Follow these instructions: + +``` +# All file paths are relative to the plugin installation directory +# (e.g., ~/.claude/plugins/marketplaces/kokuyouwind-plugins/plugins/rbs-goose) +plugin_base_path = File.dirname(__FILE__) # This is the plugin root directory + +# First Run Setup +unless File.exists?('./rbs_goose.yml') + follow_instruction(File.join(plugin_base_path, 'commands/setup.md')) + return +end + +config = Config.load('./rbs_goose.yml') + +case config.type_annotation_mode +when :inline + follow_instruction(File.join(plugin_base_path, 'internal/type_inline.md')) +when :file + follow_instruction(File.join(plugin_base_path, 'internal/type_file.md')) +end +``` diff --git a/commands/setup.md b/commands/setup.md new file mode 100644 index 0000000..0eeba06 --- /dev/null +++ b/commands/setup.md @@ -0,0 +1,63 @@ +Follow these instructions: + +``` +# All file paths in this command are relative to the plugin installation directory +# (e.g., ~/.claude/plugins/marketplaces/kokuyouwind-plugins/plugins/rbs-goose) +plugin_base_path = File.dirname(__FILE__) # This is the plugin root directory + +# Setup configurations +file = File.copy(File.join(plugin_base_path, 'templates/rbs_goose.template.yml'), './rbs_goose.yml') + +puts(file.contents) +until('If there are no problems with the above settings file, please answer yes. If you wish to update the file, please describe the changes.') do + file.update_contents +end + +# Setup tools +config = Config.load('./rbs_goose.yml') +unless gemfile.contain?('rbs') + puts('setup rbs...') + fetch('https://github.com/soutaro/steep') + setup_rbs + + if config.type_annotation_mode.inline? + fetch('https://github.com/soutaro/rbs-inline') + + begin + setup_rbs_inline + rescue => CompatibilityError(['rbs-inline', 'rubocop-ast']) + # rbs-inline <= v0.11.0 requires prism < 1.3, so use rubocop with prism < 1.3 + # @see https://github.com/soutaro/rbs-inline/pull/207 + if (confirm('Due to compatibility issues with rbs-inline, we will downgrade rubocop to version 1.74.0. Is that okay?')) + gemfile.update('rubocop', '1.74.0') + retry + else + say('Failed to install rbs-inline. Please resolve the dependencies of rbs-inline or switch the mode to file and try the `/rbs-goose:setup` command again.') + exit(1) + end + end + end + + fetch('https://github.com/ruby/gem_rbs_collection') + setup_rbs_collection +end + +unless gemifle.contain?('steep') + puts('setup steep...') + fetch('https://github.com/soutaro/steep') + setup_steep + update_steep_config(directory_structure) +end + +if rails_app? && !gemfile.contain?('rbs') + puts('setup rbs-rails...') + fetch('https://github.com/pocke/rbs_rails') + setup_rails +end + +update_git_ignore(<<~"IGNORE") + .gem_rbs_collection/ + sig/generated/ +IGNORE +puts('Initialize Complete! Run `/rbs-goose:run` to start type checking.') +``` diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..7f01845 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,49 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:kokuyouwind/claude-plugins:plugins/rbs-goose", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "44bfb70e7b94498c69b810ae595b73ba8c90f921", + "treeHash": "fae7ecc014d380e410753a022fe3be616e9524171c2b63bb80ec0c233b4f2537", + "generatedAt": "2025-11-28T10:19:54.133585Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "rbs-goose", + "description": "Setup rbs type definitions for steep and automatically fix type errors", + "version": "1.1.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "5555b1aff09f4609896c978c07219704812e08e9fba71a7df289cab3a7e2a54c" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "850cf23194004e1b0bfcea75eb6a4a781a8b605f5d76c4f9868c9aca42c90bab" + }, + { + "path": "commands/setup.md", + "sha256": "1bb02759990dd19260ea030edfe644c1c23cf2daaa6f2d87eb7bfa3f0750a9a4" + }, + { + "path": "commands/run.md", + "sha256": "e93d7a41d117c173c695ae3d20997bf37bd117ea38a01c99ed2b24cea4855667" + } + ], + "dirSha256": "fae7ecc014d380e410753a022fe3be616e9524171c2b63bb80ec0c233b4f2537" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file