Class: Harnex::ArtifactReportCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/harnex/commands/artifact_report.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ ArtifactReportCommand

Returns a new instance of ArtifactReportCommand.



29
30
31
# File 'lib/harnex/commands/artifact_report.rb', line 29

def initialize(argv)
  @argv = argv.dup
end

Class Method Details

.usage(program_name = "harnex artifact-report") ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/harnex/commands/artifact_report.rb', line 6

def self.usage(program_name = "harnex artifact-report")
  <<~TEXT
    Usage:
      #{program_name} init PATH [--force]
      #{program_name} validate PATH [--final]

    Commands:
      init       Write a legacy/manual harnex.artifact_report.v1 skeleton
      validate   Validate a harness receipt or legacy document without printing data

    Options:
      --final    Require an accepted/no_change final harness receipt, or the
                 legacy passing-proof contract
      --force    Replace an existing file during init
      -h, --help Show this help

    Normal `harnex run` sessions generate their own receipt; workers do not
    need `init`. Both commands print machine-readable JSON. `validate` exits
    0 only when the requested contract is satisfied; diagnostics contain
    field paths and shape errors, never report payloads or transcripts.
  TEXT
end

Instance Method Details

#runObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/harnex/commands/artifact_report.rb', line 33

def run
  command = @argv.shift
  case command
  when "init"
    run_init(@argv)
  when "validate"
    run_validate(@argv)
  when nil, "help", "-h", "--help"
    puts self.class.usage
    0
  else
    raise OptionParser::ParseError, "unknown artifact-report command #{command.inspect}"
  end
end