Class: CafeCar::AgentsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- CafeCar::AgentsGenerator
- Defined in:
- lib/generators/cafe_car/agents/agents_generator.rb
Constant Summary collapse
- BLOCK =
<<~MD.freeze <!-- cafe_car:start --> This app uses the **cafe_car** gem. Before hand-rolling any admin / back-office / index / CRUD UI, read `.claude/skills/cafe_car/SKILL.md` — point a controller at a model and the Pundit policy drives the whole UI (filtering, sorting, turbo-streams, CSV) for free. <!-- cafe_car:end --> MD
- MARKED_BLOCK =
/^<!-- cafe_car:start -->.*?<!-- cafe_car:end -->/m
Instance Method Summary collapse
Instance Method Details
#copy_skill ⇒ Object
14 15 16 17 |
# File 'lib/generators/cafe_car/agents/agents_generator.rb', line 14 def copy_skill directory "skills/cafe_car", ".claude/skills/cafe_car", force: true directory "skills/cafe_car", ".agents/skills/cafe_car", force: true end |
#post_install ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/cafe_car/agents/agents_generator.rb', line 29 def post_install say <<~MSG CafeCar agent docs installed: .claude/skills/cafe_car/ Claude Code skill .agents/skills/cafe_car/ mirror for Codex, Copilot, and other agents AGENTS.md pointer block (re-runs replace only the marked block) Optional, for your team: npx skills add craft-concept/cafe_car # install the skill in any skills-aware tool https://gitmcp.io/craft-concept/cafe_car # live CafeCar docs over MCP, zero setup MSG end |
#update_agents_md ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/cafe_car/agents/agents_generator.rb', line 19 def update_agents_md if agents_md&.match?(MARKED_BLOCK) gsub_file "AGENTS.md", MARKED_BLOCK, BLOCK.chomp elsif agents_md append_to_file "AGENTS.md", "\n#{BLOCK}" else create_file "AGENTS.md", BLOCK end end |