Class: BundlerSkills::CLI
- Inherits:
-
Object
- Object
- BundlerSkills::CLI
- Defined in:
- lib/bundler_skills/cli.rb
Overview
‘bundle exec skills [sync|list|clean|init] [–dry-run]`
The manual entry point (a plain executable, not a Bundler plugin command). Unlike the post_install hook it ignores the disable switch — running it is an explicit user action — and it reuses the same Synchronizer logic.
Defined Under Namespace
Classes: OverrideDryRun, StdoutLogger
Constant Summary collapse
- INIT_TEMPLATE =
<<~YAML # bundler-skills.yml — all keys are optional # # agents: # omit = auto-detect; or list: [claude, cursor]; or "*" # - claude # - cursor # gitignore: true # manage .gitignore (default true) # cleanup: true # prune stale gem-*--* links when a gem is removed (default true) # recursive: false # also scan skills/**/SKILL.md (default false) # include: # only these gems (empty = all). fnmatch on "gem" or "gem/skill" # - rubocop # - "rails-*" # exclude: # exclude these (wins over include) # - some-noisy-gem YAML
- USAGE =
<<~HELP Usage: bundle exec skills [SUBCOMMAND] [--dry-run] sync (default) discover skills and (re)create symlinks list show discovered skills and target agents (no changes) clean remove all gem-*--* symlinks this gem created init create a bundler-skills.yml config file with defaults Options: --dry-run show what would change without writing -h, --help show this help HELP
Instance Method Summary collapse
-
#initialize(logger: StdoutLogger.new) ⇒ CLI
constructor
A new instance of CLI.
-
#run(argv) ⇒ Integer
Process exit status.
Constructor Details
#initialize(logger: StdoutLogger.new) ⇒ CLI
Returns a new instance of CLI.
41 42 43 |
# File 'lib/bundler_skills/cli.rb', line 41 def initialize(logger: StdoutLogger.new) @logger = logger end |
Instance Method Details
#run(argv) ⇒ Integer
Returns process exit status.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bundler_skills/cli.rb', line 47 def run(argv) args = argv.dup opts = { dry_run: false } parser = OptionParser.new do |o| o.on("--dry-run") { opts[:dry_run] = true } o.on("-h", "--help") { @logger.info(USAGE); return 0 } end parser.order!(args) subcommand = args.shift || "sync" case subcommand when "sync" then run_sync(opts[:dry_run]) when "list" then run_list when "clean" then run_clean(opts[:dry_run]) when "init" then run_init when "help" then @logger.info(USAGE) else @logger.error("[bundler-skills] unknown subcommand: #{subcommand}") @logger.info(USAGE) return 1 end 0 rescue OptionParser::ParseError => e @logger.error("[bundler-skills] #{e.}") @logger.info(USAGE) 1 end |