Class: Aidp::Temporal::Activities::CreatePromptActivity

Inherits:
BaseActivity
  • Object
show all
Defined in:
lib/aidp/temporal/activities/create_prompt_activity.rb

Overview

Activity that creates the initial PROMPT.md for a work loop Assembles context, instructions, and constraints

Instance Method Summary collapse

Methods inherited from BaseActivity

#activity_context, #cancellation_requested?, #check_cancellation!, #heartbeat

Instance Method Details

#execute(input) ⇒ Object



11
12
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
# File 'lib/aidp/temporal/activities/create_prompt_activity.rb', line 11

def execute(input)
  with_activity_context do
    project_dir = input[:project_dir]
    step_name = input[:step_name]
    step_spec = input[:step_spec] || {}
    context = input[:context] || {}

    log_activity("creating_prompt",
      project_dir: project_dir,
      step_name: step_name)

    # Load configuration
    config = load_config(project_dir)

    # Create prompt manager
    prompt_manager = Aidp::Execute::PromptManager.new(project_dir, config: config)

    # Build initial prompt content
    prompt_content = build_prompt_content(
      project_dir: project_dir,
      step_name: step_name,
      step_spec: step_spec,
      context: context
    )

    # Write the prompt
    prompt_manager.write(prompt_content)

    heartbeat(phase: "prompt_created", step_name: step_name)

    success_result(
      prompt_path: prompt_manager.prompt_path,
      prompt_length: prompt_content.length,
      step_name: step_name
    )
  end
end