Class: SpecForge::CLI

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/spec_forge/cli.rb,
lib/spec_forge/cli/new.rb,
lib/spec_forge/cli/run.rb,
lib/spec_forge/cli/docs.rb,
lib/spec_forge/cli/init.rb,
lib/spec_forge/cli/serve.rb,
lib/spec_forge/cli/actions.rb,
lib/spec_forge/cli/command.rb,
lib/spec_forge/cli/docs/generate.rb

Overview

Command-line interface for SpecForge that provides the overall command structure and entry point for the CLI functionality.

Examples:

Running a specific command

# From command line: spec_forge init

Defined Under Namespace

Modules: Actions Classes: ActionContext, Command, Docs, Init, New, Run, Serve

Constant Summary collapse

COMMANDS =

Returns All available commands.

Returns:

[Docs, Init, New, Run, Serve].freeze

Instance Method Summary collapse

Instance Method Details

#register_commandsObject

Registers the command classes with Commander



48
49
50
51
52
# File 'lib/spec_forge/cli.rb', line 48

def register_commands
  COMMANDS.each do |command_class|
    command_class.register(self)
  end
end

#runObject

Runs the CLI application, setting up program information and registering commands



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/spec_forge/cli.rb', line 22

def run
  program :name, "SpecForge"
  program :version, SpecForge::VERSION
  program :description, <<~DESC.strip
    Write API tests as sequential workflows in YAML with RSpec matchers.

    Quick Start:
      spec_forge init                    # Set up your project
      spec_forge new blueprint users     # Create your first workflow
      spec_forge run                     # Execute workflows
      spec_forge docs                    # Generate OpenAPI docs
      spec_forge serve                   # Preview docs locally
  DESC

  register_commands

  default_command :help

  run!
end