Class: Harnex::Skills
- Inherits:
-
Object
- Object
- Harnex::Skills
- Defined in:
- lib/harnex/commands/skills.rb
Constant Summary collapse
- SKILLS_ROOT =
File.("../../../../skills", __FILE__)
- INSTALL_SKILLS =
%w[harnex-dispatch harnex-chain harnex-buddy].freeze
- DEPRECATED_SKILLS =
%w[dispatch chain-implement].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Skills
constructor
A new instance of Skills.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Skills
Returns a new instance of Skills.
30 31 32 |
# File 'lib/harnex/commands/skills.rb', line 30 def initialize(argv) @argv = argv.dup end |
Class Method Details
.usage ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/harnex/commands/skills.rb', line 9 def self.usage <<~TEXT Usage: harnex skills <subcommand> [--local] Subcommands: install Install bundled skills (globally by default) uninstall Remove installed skills (globally by default) Options: --local Target the current repo instead of global ~/.claude/ Installs: #{INSTALL_SKILLS.join(', ')} By default, copies each skill to ~/.claude/skills/<skill>/ and symlinks ~/.codex/skills/<skill> to it. With --local, copies each skill to .claude/skills/<skill>/ in the current repo and symlinks .codex/skills/<skill> to it. TEXT end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/harnex/commands/skills.rb', line 34 def run subcommand = @argv.shift case subcommand when "install" local, help = parse_args(@argv) return (puts self.class.usage; 0) if help remove_deprecated(local) INSTALL_SKILLS.each do |skill_name| skill_source = resolve_skill_source(skill_name) unless skill_source return missing_skill(skill_name) end result = local ? install_local(skill_name, skill_source) : install_global(skill_name, skill_source) return result unless result == 0 end 0 when "uninstall" local, help = parse_args(@argv) return (puts self.class.usage; 0) if help (INSTALL_SKILLS + DEPRECATED_SKILLS).each do |skill_name| local ? uninstall_local(skill_name) : uninstall_global(skill_name) end 0 when "-h", "--help", nil puts self.class.usage 0 else warn("harnex skills: unknown subcommand #{subcommand.inspect}") puts self.class.usage 1 end end |