Class: OKF::CLI::Skill
Overview
Install this gem's companion agent skill into a destination directory. The
destination is required (no magic default) so the user always decides where
their agent picks the skill up. By default the skill lands in a skills/okf/
folder under it — point at a project or skills dir (.claude, .agents/skills)
and it settles in its own folder, never loose among the others — so the
resolved path is echoed back. --here installs straight into .
Constant Summary
Constants inherited
from Command
Command::DUCK_TYPE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
hidden?, #initialize
Class Method Details
.group ⇒ Object
16
17
18
|
# File 'lib/okf/cli/skill.rb', line 16
def self.group
:act
end
|
.help_rows ⇒ Object
20
21
22
23
24
|
# File 'lib/okf/cli/skill.rb', line 20
def self.help_rows
[
[ "skill <dest> [--here] [--force]", "install the companion agent skill" ]
]
end
|
.id ⇒ Object
12
13
14
|
# File 'lib/okf/cli/skill.rb', line 12
def self.id
:skill
end
|
Instance Method Details
#call(argv) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/okf/cli/skill.rb', line 26
def call(argv)
options = { force: false, nest: true }
parser = OptionParser.new do |o|
o.banner = "Usage: okf skill <dest-dir> [--here] [--force]"
o.on("--here", "install straight into <dest-dir>, wherever it is (no skills/okf nesting)") { options[:nest] = false }
o.on("--force", "overwrite a non-empty destination") { options[:force] = true }
help_flag(o)
end
dest = positional(parser, argv) or return 2
(argv) or return 2
skill = OKF::Skill.new(dest, force: options[:force], nest: options[:nest])
files = skill.install
@out.puts "installed the okf skill (#{files.size} files) -> #{skill.dest}"
files.each { |f| @out.puts " #{f}" }
@out.puts "your agent picks it up from #{skill.dest} (needs the `okf` CLI, which you already have)."
0
rescue OKF::Skill::Error => e
@err.puts "error: #{e.message}"
2
end
|