diogenes 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7437b70a7659349d8486c0f1e5c6cf7a6735b120e1710cb94d3dacf05ba85b8
4
- data.tar.gz: ffeee3838b29625af1f2f07f55459fd96d1678cfa2e161160433d818c36826fb
3
+ metadata.gz: 8590686fd3f111b4286290f58a9ca7818201a3693c57bd141bf9e63eed0faecc
4
+ data.tar.gz: 9cc0cd2735ca360cefc82bf7c53116f9603ac00ee738e7c3729efbd8aaf3ab9f
5
5
  SHA512:
6
- metadata.gz: 8c533c33b568af4710da44f2ca825710bfed3c6d7ccfa4956303183817b36aca7facb46b469e3081998ce0ca4b21a01f61e12dcaaace3f711db5d2feb4721faa
7
- data.tar.gz: 10ab65d16346cd75fb17f1c6e9a1fbbae742ce12a62255eb5e2845a2d65840c58510f15a5da9df6c439c29f02a66b5aae00d7ae768180c7d800d0f5b271235d5
6
+ metadata.gz: 8338868da9847a7eace4b9fa0379de833ca6d94716b97f4c71e34b06f735804d3b41ad9b7457560566487698b01f60fa828b4486a8a298c6aec7df327a8f12ce
7
+ data.tar.gz: 3e9270df51a313e335513c13a2d576d43bf2900c81c270ad7e82233ea4a6df46a76b37bebbdd4b5bb151b99a9e6b630c5e222e411ec3d8b406d3242d4cbc5496
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.1.6"
2
+ ".": "0.1.7"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.7](https://github.com/meaganewaller/diogenes/compare/diogenes/v0.1.6...diogenes/v0.1.7) (2026-06-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * **evaluate:** non-interactive CI mode for gate evaluation :rocket: ([#13](https://github.com/meaganewaller/diogenes/issues/13)) ([624937d](https://github.com/meaganewaller/diogenes/commit/624937dd6eb69c02013a2272401ce66458652e5a))
9
+
3
10
  ## [0.1.6](https://github.com/meaganewaller/diogenes/compare/diogenes/v0.1.5...diogenes/v0.1.6) (2026-06-27)
4
11
 
5
12
 
@@ -1,19 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
  # rbs_inline: enabled
3
3
 
4
+ require "optparse"
5
+
4
6
  module Diogenes
5
7
  class Cli
6
8
  class Evaluate
7
9
  #: (argv: Array[String], out: IO, err: IO, **untyped) -> Integer
8
10
  def self.run(argv:, out:, err:, **opts)
9
- description = argv.join(" ").strip
11
+ options = {} #: Hash[Symbol, String]
12
+ remaining = argv.dup
13
+ OptionParser.new do |o|
14
+ o.on("--answers ANSWERS") { |v| options[:answers] = v }
15
+ o.on("--format FORMAT") { |v| options[:format] = v }
16
+ end.parse!(remaining)
17
+
18
+ description = remaining.join(" ").strip
10
19
 
11
20
  if description.empty?
12
- err.puts "Usage: diogenes evaluate \"<feature description>\""
21
+ err.puts "Usage: diogenes evaluate \"<feature description>\" [--answers gate1=pass,...] [--format json]"
13
22
  return 1
14
23
  end
15
24
 
16
- Evaluation::Session.new(description:, out:, err:, **opts).run
25
+ if options[:answers]
26
+ Evaluation::CiRunner.new(description:, answers: options[:answers], format: options[:format], out:, err:).run
27
+ else
28
+ Evaluation::Session.new(description:, out:, err:, **opts).run
29
+ end
17
30
  end
18
31
  end
19
32
  end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require "json"
5
+
6
+ module Diogenes
7
+ module Evaluation
8
+ class CiRunner
9
+ #: (description: String, answers: String, out: IO, err: IO, ?format: String?) -> void
10
+ def initialize(description:, answers:, out:, err:, format: nil)
11
+ @description = description
12
+ @parsed_answers = parse_answers(answers) #: Hash[Symbol, bool]
13
+ @format = format
14
+ @out = out
15
+ @err = err
16
+ end
17
+
18
+ #: () -> Integer
19
+ def run
20
+ missing = Gates::ALL.map(&:key) - @parsed_answers.keys
21
+ unless missing.empty?
22
+ @err.puts "Missing answer#{"s" if missing.size > 1} for: #{missing.join(", ")}. " \
23
+ "Provide all 5 gate answers: --answers failure_mode=pass,user_verifiable=pass,..."
24
+ return 1
25
+ end
26
+
27
+ results = build_results
28
+ (@format == "json") ? output_json(results) : output_text(results)
29
+ results.all?(&:passed?) ? 0 : 1
30
+ end
31
+
32
+ private
33
+
34
+ #: (String) -> Hash[Symbol, bool]
35
+ def parse_answers(answers_str)
36
+ answers_str.split(",").each_with_object({}) do |pair, hash|
37
+ key, value = pair.split("=", 2)
38
+ hash[key.strip.to_sym] = value&.strip == "pass"
39
+ end
40
+ end
41
+
42
+ #: () -> Array[untyped]
43
+ def build_results
44
+ Gates::ALL.map { |gate| Session::Result.new(gate:, passed: @parsed_answers[gate.key]) }
45
+ end
46
+
47
+ #: (Array[untyped]) -> void
48
+ def output_text(results)
49
+ verdict = results.all?(&:passed?) ? "PROCEED" : "REJECT"
50
+ @out.puts
51
+ @out.puts "Evaluating: \"#{@description}\" (CI mode)"
52
+ @out.puts
53
+ results.each_with_index do |r, i|
54
+ @out.puts " Gate #{i + 1} — #{r.gate.name.ljust(22)} #{r.passed? ? "PASS" : "FAIL"}"
55
+ end
56
+ @out.puts
57
+ @out.puts "Verdict: #{verdict}"
58
+ end
59
+
60
+ #: (Array[untyped]) -> void
61
+ def output_json(results)
62
+ all_passed = results.all?(&:passed?)
63
+ @out.puts JSON.generate(
64
+ feature: @description,
65
+ verdict: all_passed ? "PROCEED" : "REJECT",
66
+ all_passed: all_passed,
67
+ gates: results.map.with_index(1) do |r, i|
68
+ {number: i, key: r.gate.key, name: r.gate.name, passed: r.passed?}
69
+ end
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end
@@ -2,5 +2,5 @@
2
2
  # rbs_inline: enabled
3
3
 
4
4
  module Diogenes
5
- VERSION = "0.1.6" #: String
5
+ VERSION = "0.1.7" #: String
6
6
  end
@@ -0,0 +1,27 @@
1
+ # Generated from lib/diogenes/evaluation/ci_runner.rb with RBS::Inline
2
+
3
+ module Diogenes
4
+ module Evaluation
5
+ class CiRunner
6
+ # : (description: String, answers: String, out: IO, err: IO, ?format: String?) -> void
7
+ def initialize: (description: String, answers: String, out: IO, err: IO, ?format: String?) -> void
8
+
9
+ # : () -> Integer
10
+ def run: () -> Integer
11
+
12
+ private
13
+
14
+ # : (String) -> Hash[Symbol, bool]
15
+ def parse_answers: (String) -> Hash[Symbol, bool]
16
+
17
+ # : () -> Array[untyped]
18
+ def build_results: () -> Array[untyped]
19
+
20
+ # : (Array[untyped]) -> void
21
+ def output_text: (Array[untyped]) -> void
22
+
23
+ # : (Array[untyped]) -> void
24
+ def output_json: (Array[untyped]) -> void
25
+ end
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diogenes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meagan Waller
@@ -61,6 +61,7 @@ files:
61
61
  - lib/diogenes/dsl/hook.rb
62
62
  - lib/diogenes/dsl/rule.rb
63
63
  - lib/diogenes/dsl/skill.rb
64
+ - lib/diogenes/evaluation/ci_runner.rb
64
65
  - lib/diogenes/evaluation/decision_record.rb
65
66
  - lib/diogenes/evaluation/gate.rb
66
67
  - lib/diogenes/evaluation/gates.rb
@@ -80,6 +81,7 @@ files:
80
81
  - sig/generated/diogenes/dsl/hook.rbs
81
82
  - sig/generated/diogenes/dsl/rule.rbs
82
83
  - sig/generated/diogenes/dsl/skill.rbs
84
+ - sig/generated/diogenes/evaluation/ci_runner.rbs
83
85
  - sig/generated/diogenes/evaluation/decision_record.rbs
84
86
  - sig/generated/diogenes/evaluation/gate.rbs
85
87
  - sig/generated/diogenes/evaluation/gates.rbs