Class: RosettAi::Tooling::CiYamlValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/tooling/ci_yaml_validator.rb

Overview

MCP-facing facade for CI YAML validation.

Delegates to the GitLab CI YAML validators, providing the simplified interface expected by Mcp::Tools::ToolingTool.

Author:

  • hugo

  • claude

Instance Method Summary collapse

Constructor Details

#initialize(project_dir: Dir.pwd) ⇒ CiYamlValidator

Returns a new instance of CiYamlValidator.



16
17
18
# File 'lib/rosett_ai/tooling/ci_yaml_validator.rb', line 16

def initialize(project_dir: Dir.pwd)
  @project_dir = project_dir
end

Instance Method Details

#validateHash

Validates all CI YAML files in the project.

Returns:

  • (Hash)

    with :errors and :files keys



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rosett_ai/tooling/ci_yaml_validator.rb', line 23

def validate
  validator = RosettAi::Gitlab::Validators::SupplementaryGitlabCiYamlValidator.new(
    project_dir: @project_dir
  )
  result = validator.validate
  valid_files = result.fetch(:valid, []).map { |entry| entry[:file] }
  invalid_entries = result.fetch(:invalid, [])
  {
    errors: invalid_entries.map { |entry| entry[:message] },
    files: valid_files + invalid_entries.map { |entry| entry[:file] }
  }
end