Class: RosettAi::Workflow::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/workflow/manager.rb

Overview

MCP-facing facade for workflow operations.

Delegates to Engine for the actual workflow logic, providing the simplified interface expected by Mcp::Tools::WorkflowTool.

Author:

  • hugo

  • claude

Constant Summary collapse

WORKFLOW_DIR =
File.join(Dir.home, '.claude', 'conf', 'workflows')

Instance Method Summary collapse

Constructor Details

#initializeManager

Returns a new instance of Manager.



18
19
20
# File 'lib/rosett_ai/workflow/manager.rb', line 18

def initialize
  @workflow_dir = Pathname.new(WORKFLOW_DIR)
end

Instance Method Details

#listArray<Hash>

Lists all available workflows.

Returns:

  • (Array<Hash>)

    workflow summaries



25
26
27
# File 'lib/rosett_ai/workflow/manager.rb', line 25

def list
  workflow_files.map { |path| build_workflow_summary(path) }
end

#simulate(name) ⇒ Hash

Simulates a workflow without executing.

Parameters:

  • name (String)

    workflow name

Returns:

  • (Hash)

    with :steps and :duration keys



50
51
52
53
54
# File 'lib/rosett_ai/workflow/manager.rb', line 50

def simulate(name)
  engine = build_engine(name)
  steps = engine.simulate
  { steps: steps, duration: steps.size }
end

#validate(name) ⇒ Hash

Validates a specific workflow by name.

Parameters:

  • name (String)

    workflow name

Returns:

  • (Hash)

    with :errors key



33
34
35
36
# File 'lib/rosett_ai/workflow/manager.rb', line 33

def validate(name)
  engine = build_engine(name)
  { errors: engine.validate }
end

#validate_allHash

Validates all workflows.

Returns:

  • (Hash)

    with :errors key



41
42
43
44
# File 'lib/rosett_ai/workflow/manager.rb', line 41

def validate_all
  errors = workflow_files.flat_map { |path| validate_workflow_file(path) }
  { errors: errors }
end