Class: Ace::Support::Items::Molecules::LlmSlugGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/support/items/molecules/llm_slug_generator.rb

Overview

Generates hierarchical slugs using LLM with fallback to deterministic generation. Soft dependency on ace-llm — gracefully falls back if not available.

Constant Summary collapse

GOAL_TYPES =

Goal type keywords for consistent naming

%w[add enhance fix refactor].freeze

Instance Method Summary collapse

Constructor Details

#initialize(debug: false) ⇒ LlmSlugGenerator

Returns a new instance of LlmSlugGenerator.



15
16
17
# File 'lib/ace/support/items/molecules/llm_slug_generator.rb', line 15

def initialize(debug: false)
  @debug = debug
end

Instance Method Details

#generate_idea_slugs(description, context = {}) ⇒ Hash

Generate hierarchical slugs for an idea

Parameters:

  • description (String)

    Idea description/content

  • context (Hash) (defaults to: {})

    Additional context

Returns:

  • (Hash)

    { folder_slug:, file_slug:, success:, source: } or fallback result



35
36
37
38
39
40
41
# File 'lib/ace/support/items/molecules/llm_slug_generator.rb', line 35

def generate_idea_slugs(description, context = {})
  llm_result = try_llm_idea_generation(description, context)
  return llm_result if llm_result[:success]

  debug_log("LLM generation failed, using fallback")
  fallback_idea_generation(description, context)
end

#generate_task_slugs(title, context = {}) ⇒ Hash

Generate hierarchical slugs for a task

Parameters:

  • title (String)

    Task title

  • context (Hash) (defaults to: {})

    Additional context (project_name, type, etc.)

Returns:

  • (Hash)

    { folder_slug:, file_slug:, success:, source: } or fallback result



23
24
25
26
27
28
29
# File 'lib/ace/support/items/molecules/llm_slug_generator.rb', line 23

def generate_task_slugs(title, context = {})
  llm_result = try_llm_task_generation(title, context)
  return llm_result if llm_result[:success]

  debug_log("LLM generation failed, using fallback")
  fallback_task_generation(title, context)
end