Module: RailsAiBridge::Tools::UsageFormatter
- Includes:
- Registry::Truncatable
- Defined in:
- lib/rails_ai_bridge/tools/usage_formatter.rb
Overview
Shared message constants and output formatting for the rails_use_skill
and rails_use_agent tools.
Single responsibility: render resolved pack content as an in-context application directive — an intent header, an optional deprecation notice, the full content, and a follow-through footer. Resolver plumbing stays in the tool classes themselves.
Constant Summary collapse
- NO_REGISTRY_MESSAGE =
"No registry manifest found at `%<path>s`.\n\n" \ 'Set up a registry manifest to load skill packs (see docs/skill-registry-guide.md).'
- NOT_FOUND_SKILL_MESSAGE =
"Skill `%<name>s` not found in the loaded skill packs.\n\n" \ 'Use `rails_list_registry type=skills` to see available skills.'
- NOT_FOUND_AGENT_MESSAGE =
"Agent `%<name>s` not found in the loaded skill packs.\n\n" \ 'Use `rails_list_registry type=agents` to see available agents.'
- USAGE_VERBS =
{ skill: 'Applying skill', agent: 'Activating agent' }.freeze
- USAGE_FOOTERS =
{ skill: '_Work through every step of this skill in order. If a step does not apply, say so explicitly ' \ 'instead of skipping it silently._', agent: '_Follow this workflow end to end and respect its hard gates; do not skip steps silently._' }.freeze
Instance Method Summary collapse
-
#format_usage(resolved, kind:, deprecation_warning: nil) ⇒ String
Formats resolved skill/agent content for immediate in-context application.
Methods included from Registry::Truncatable
Instance Method Details
#format_usage(resolved, kind:, deprecation_warning: nil) ⇒ String
Formats resolved skill/agent content for immediate in-context application.
:reek:FeatureEnvy -- output assembly necessarily centres on the rendered section list
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rails_ai_bridge/tools/usage_formatter.rb', line 40 def format_usage(resolved, kind:, deprecation_warning: nil) [ usage_header(resolved, kind), '', deprecation_block(deprecation_warning), resolved.content, '', '---', USAGE_FOOTERS.fetch(kind) ].compact.join("\n") end |