Class: Insika::PromptCatalog

Inherits:
Object
  • Object
show all
Defined in:
lib/insika/prompt_catalog.rb

Overview

Catalog of prompts: NON-executable content (it is a Catalog, not a Registry). Mirrors the SkillCatalog: each prompt is a directory with a PROMPT.md (YAML frontmatter name/description + markdown body). Source for the Prompt provider when the profile uses prompt_refs.

Defined Under Namespace

Classes: Prompt

Instance Method Summary collapse

Constructor Details

#initialize(roots) ⇒ PromptCatalog

roots ordered by PRECEDENCE (highest first) — same name in more than one root: the first wins (identical to SkillCatalog).



15
16
17
18
# File 'lib/insika/prompt_catalog.rb', line 15

def initialize(roots)
  @roots = Array(roots)
  @prompts = load_all
end

Instance Method Details

#allObject



20
# File 'lib/insika/prompt_catalog.rb', line 20

def all = @prompts.values

#find(name) ⇒ Object

-> Prompt | nil (the Prompt provider converts nil into a ContextError; it is not the catalog's job to raise).



24
# File 'lib/insika/prompt_catalog.rb', line 24

def find(name) = @prompts[name.to_s]

#reloadObject

Rescan + atomic index swap: parity with the SkillCatalog for reload without a restart when the on-disk seed changes.



28
29
30
31
# File 'lib/insika/prompt_catalog.rb', line 28

def reload
  @prompts = load_all
  self
end