Class: Ace::Review::Molecules::NavPromptResolver
- Inherits:
-
Object
- Object
- Ace::Review::Molecules::NavPromptResolver
- Defined in:
- lib/ace/review/molecules/nav_prompt_resolver.rb
Overview
Resolves prompt:// URIs using ace-nav NavigationEngine
Constant Summary collapse
- PROTOCOL_PREFIX =
"prompt://"
Instance Method Summary collapse
-
#initialize ⇒ NavPromptResolver
constructor
A new instance of NavPromptResolver.
-
#list_available(category = nil) ⇒ Object
List available prompt modules in a category.
-
#resolve(reference, config_dir: nil) ⇒ Object
Resolve a prompt reference to actual content.
Constructor Details
#initialize ⇒ NavPromptResolver
Returns a new instance of NavPromptResolver.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ace/review/molecules/nav_prompt_resolver.rb', line 12 def initialize begin require "ace/support/nav" require "ace/support/nav/organisms/navigation_engine" @engine = Ace::Support::Nav::Organisms::NavigationEngine.new rescue LoadError # Fall back to basic resolution if ace-nav is not available @engine = nil end @project_root = find_project_root end |
Instance Method Details
#list_available(category = nil) ⇒ Object
List available prompt modules in a category
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ace/review/molecules/nav_prompt_resolver.rb', line 39 def list_available(category = nil) return {} unless @engine begin if category # List resources in specific category # Use the category as part of the path uri = "#{PROTOCOL_PREFIX}#{category}/" resources = @engine.list(uri) else # List all prompt resources resources = @engine.list(PROTOCOL_PREFIX) end parse_listing(resources, category) rescue => e warn "Error listing prompts: #{e.}" if ENV["DEBUG"] {} end end |
#resolve(reference, config_dir: nil) ⇒ Object
Resolve a prompt reference to actual content
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ace/review/molecules/nav_prompt_resolver.rb', line 26 def resolve(reference, config_dir: nil) return nil unless reference if reference.start_with?(PROTOCOL_PREFIX) # Use ace-nav for prompt:// URIs resolve_via_nav(reference) else # Keep existing file resolution for relative/absolute paths resolve_file_path(reference, config_dir) end end |