Class: Ace::PromptPrep::Molecules::TemplateResolver
- Inherits:
-
Object
- Object
- Ace::PromptPrep::Molecules::TemplateResolver
- Defined in:
- lib/ace/prompt_prep/molecules/template_resolver.rb
Overview
Resolves template URIs using ace-nav tmpl:// protocol
Class Method Summary collapse
-
.call(uri:) ⇒ Hash
Resolve a template URI to an absolute file path.
Class Method Details
.call(uri:) ⇒ Hash
Resolve a template URI to an absolute file path
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ace/prompt_prep/molecules/template_resolver.rb', line 13 def call(uri:) # Normalize short form to full URI normalized_uri = normalize_template_uri(uri) # Try to resolve via ace-nav resolved_path = resolve_via_ace_nav(normalized_uri) if resolved_path && File.exist?(resolved_path) { success: true, path: resolved_path, error: nil } else # Fallback: check for bundled template bundled_path = resolve_bundled_template(normalized_uri) if bundled_path && File.exist?(bundled_path) { success: true, path: bundled_path, error: nil } else { success: false, path: nil, error: "Error: Template not found: #{normalized_uri}" } end end rescue => e { success: false, path: nil, error: "Error: Failed to resolve template: #{e.}" } end |