Class: LcpRuby::Generators::AgentSetupGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LcpRuby::Generators::AgentSetupGenerator
- Defined in:
- lib/generators/lcp_ruby/agent_setup_generator.rb
Overview
Sets up agent affordances in a host app: copies/refreshes the bundled ‘lcp-*` AI authoring skills and writes the two thin entrypoint files (`CLAUDE.md` canonical orientation + `AGENTS.md` pointer) at the project root.
Idempotent and non-clobbering: the entrypoint files are written through a delimited ‘<!– lcp:begin –>…<!– lcp:end –>` managed block, so a host’s own ‘CLAUDE.md`/`AGENTS.md` content outside the block is never touched. Auto-invoked by `lcp new` and `lcp_ruby:install`; safe to re-run after `bundle update lcp` to refresh skills and the managed block.
Constant Summary collapse
- BEGIN_MARK =
"<!-- lcp:begin -->"- END_MARK =
"<!-- lcp:end -->"
Instance Method Summary collapse
- #install_skills ⇒ Object
- #show_post_install_message ⇒ Object
- #write_agents_md ⇒ Object
- #write_claude_md ⇒ Object
Instance Method Details
#install_skills ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/generators/lcp_ruby/agent_setup_generator.rb', line 25 def install_skills LcpRuby::SkillsInstaller.agent_skill_targets(root: destination_root).each do |agent, target| result = LcpRuby::SkillsInstaller.new( target: target ).call relative_target = File.join(LcpRuby::SkillsInstaller::AGENT_DIRECTORIES.fetch(agent), "skills") result.created.each { |n| say_status :create, "#{relative_target}/#{n}", :green } result.updated.each { |n| say_status :update, "#{relative_target}/#{n}", :yellow } result.removed.each { |n| say_status :remove, "#{relative_target}/#{n}", :red } end end |
#show_post_install_message ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/generators/lcp_ruby/agent_setup_generator.rb', line 46 def say "" say "LCP agent affordances ready.", :green say " - .claude/skills/lcp-* (authoring skills for Claude Code)" say " - .codex/skills/lcp-* (authoring skills for Codex)" say " - CLAUDE.md / AGENTS.md (orientation for AI agents)" say "" say "Re-run after `bundle update lcp` to refresh: rails generate lcp_ruby:agent_setup" say "" end |
#write_agents_md ⇒ Object
42 43 44 |
# File 'lib/generators/lcp_ruby/agent_setup_generator.rb', line 42 def write_agents_md write_managed_block "AGENTS.md", read_template("agents_md.md") end |
#write_claude_md ⇒ Object
38 39 40 |
# File 'lib/generators/lcp_ruby/agent_setup_generator.rb', line 38 def write_claude_md write_managed_block "CLAUDE.md", read_template("claude_md.md") end |