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 =

Returns Default directory for workflow definition files.

Returns:

  • (Object)

    Default directory for workflow definition files.

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

Instance Method Summary collapse

Constructor Details

#initializeManager

Returns a new instance of Manager.



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

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

Instance Method Details

#listArray<Hash>

Lists all available workflows.

Returns:

  • (Array<Hash>)

    workflow summaries



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

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



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

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



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

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

#validate_allHash

Validates all workflows.

Returns:

  • (Hash)

    with :errors key



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

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