nukadoko 0.1.0 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +291 -0
- data/README.ja.md +58 -5
- data/README.md +15 -3
- data/exe/nuka +8 -0
- data/lib/nukadoko/aria_snapshot.rb +1008 -0
- data/lib/nukadoko/aria_tree.rb +150 -0
- data/lib/nukadoko/base.rb +274 -0
- data/lib/nukadoko/check.rb +669 -22
- data/lib/nukadoko/claim_check.rb +177 -0
- data/lib/nukadoko/claim_check_run.rb +293 -0
- data/lib/nukadoko/claim_line.rb +381 -0
- data/lib/nukadoko/claim_rules.rb +519 -0
- data/lib/nukadoko/claims.rb +407 -30
- data/lib/nukadoko/cli.rb +802 -19
- data/lib/nukadoko/codes.json +942 -0
- data/lib/nukadoko/codes.rb +19 -0
- data/lib/nukadoko/command.rb +214 -12
- data/lib/nukadoko/criteria.rb +172 -0
- data/lib/nukadoko/definition.rb +33 -41
- data/lib/nukadoko/env_check.rb +90 -0
- data/lib/nukadoko/features.rb +80 -10
- data/lib/nukadoko/fixtures.rb +296 -10
- data/lib/nukadoko/http_recording.rb +68 -0
- data/lib/nukadoko/init.rb +130 -0
- data/lib/nukadoko/judge.rb +221 -0
- data/lib/nukadoko/judgment_file.rb +78 -0
- data/lib/nukadoko/judgments.rb +256 -0
- data/lib/nukadoko/literal.rb +129 -0
- data/lib/nukadoko/measured.rb +105 -0
- data/lib/nukadoko/order.rb +84 -0
- data/lib/nukadoko/parts.rb +42 -21
- data/lib/nukadoko/pattern.rb +11 -1
- data/lib/nukadoko/poll.rb +17 -6
- data/lib/nukadoko/program.rb +105 -17
- data/lib/nukadoko/project_fixtures.rb +17 -2
- data/lib/nukadoko/report_allure.rb +751 -0
- data/lib/nukadoko/report_messages.rb +167 -0
- data/lib/nukadoko/report_run.rb +169 -0
- data/lib/nukadoko/run.rb +865 -88
- data/lib/nukadoko/run_record.rb +532 -0
- data/lib/nukadoko/scaffold.rb +1015 -0
- data/lib/nukadoko/schema.rb +61 -4
- data/lib/nukadoko/secrets.rb +359 -0
- data/lib/nukadoko/selection.rb +163 -0
- data/lib/nukadoko/signature.rb +4 -1
- data/lib/nukadoko/skill.rb +36 -0
- data/lib/nukadoko/step.rb +62 -21
- data/lib/nukadoko/summary.rb +662 -0
- data/lib/nukadoko/table.rb +34 -2
- data/lib/nukadoko/text_fit.rb +179 -0
- data/lib/nukadoko/trace.rb +244 -0
- data/lib/nukadoko/trace_actions.rb +116 -0
- data/lib/nukadoko/tree_passes.rb +119 -0
- data/lib/nukadoko/verdict.rb +128 -0
- data/lib/nukadoko/version.rb +2 -1
- data/lib/nukadoko/vocabulary.rb +6 -0
- data/lib/nukadoko/walk.rb +305 -0
- data/lib/nukadoko/walk_files.rb +473 -0
- data/lib/nukadoko/walk_step.rb +149 -0
- data/lib/nukadoko.rb +36 -0
- data/llms.txt +296 -0
- data/sig/generated/nukadoko/aria_snapshot.rbs +331 -0
- data/sig/generated/nukadoko/aria_tree.rbs +142 -0
- data/sig/generated/nukadoko/base.rbs +136 -0
- data/sig/generated/nukadoko/check.rbs +255 -0
- data/sig/generated/nukadoko/claim_check.rbs +118 -0
- data/sig/generated/nukadoko/claim_check_run.rbs +88 -0
- data/sig/generated/nukadoko/claim_line.rbs +158 -0
- data/sig/generated/nukadoko/claim_rules.rbs +172 -0
- data/sig/generated/nukadoko/claims.rbs +165 -0
- data/sig/generated/nukadoko/cli.rbs +182 -0
- data/sig/generated/nukadoko/codes.rbs +16 -0
- data/sig/generated/nukadoko/command.rbs +109 -0
- data/sig/generated/nukadoko/criteria.rbs +83 -0
- data/sig/generated/nukadoko/definition.rbs +30 -0
- data/sig/generated/nukadoko/env_check.rbs +38 -0
- data/sig/generated/nukadoko/features.rbs +101 -0
- data/sig/generated/nukadoko/fixtures.rbs +152 -0
- data/sig/generated/nukadoko/http_recording.rbs +29 -0
- data/sig/generated/nukadoko/init.rbs +66 -0
- data/sig/generated/nukadoko/judge.rbs +64 -0
- data/sig/generated/nukadoko/judgment_file.rbs +39 -0
- data/sig/generated/nukadoko/judgments.rbs +120 -0
- data/sig/generated/nukadoko/literal.rbs +71 -0
- data/sig/generated/nukadoko/measured.rbs +42 -0
- data/sig/generated/nukadoko/order.rbs +54 -0
- data/sig/generated/nukadoko/parts.rbs +35 -0
- data/sig/generated/nukadoko/pattern.rbs +28 -0
- data/sig/generated/nukadoko/poll.rbs +40 -0
- data/sig/generated/nukadoko/program.rbs +101 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +57 -0
- data/sig/generated/nukadoko/report_allure.rbs +268 -0
- data/sig/generated/nukadoko/report_messages.rbs +68 -0
- data/sig/generated/nukadoko/report_run.rbs +102 -0
- data/sig/generated/nukadoko/run.rbs +257 -0
- data/sig/generated/nukadoko/run_record.rbs +174 -0
- data/sig/generated/nukadoko/scaffold.rbs +328 -0
- data/sig/generated/nukadoko/schema.rbs +137 -0
- data/sig/generated/nukadoko/secrets.rbs +157 -0
- data/sig/generated/nukadoko/selection.rbs +73 -0
- data/sig/generated/nukadoko/signature.rbs +17 -0
- data/sig/generated/nukadoko/skill.rbs +20 -0
- data/sig/generated/nukadoko/step.rbs +115 -0
- data/sig/generated/nukadoko/summary.rbs +204 -0
- data/sig/generated/nukadoko/table.rbs +43 -0
- data/sig/generated/nukadoko/text_fit.rbs +70 -0
- data/sig/generated/nukadoko/trace.rbs +127 -0
- data/sig/generated/nukadoko/trace_actions.rbs +40 -0
- data/sig/generated/nukadoko/tree_passes.rbs +48 -0
- data/sig/generated/nukadoko/verdict.rbs +56 -0
- data/sig/generated/nukadoko/version.rbs +5 -0
- data/sig/generated/nukadoko/vocabulary.rbs +25 -0
- data/sig/generated/nukadoko/walk.rbs +139 -0
- data/sig/generated/nukadoko/walk_files.rbs +189 -0
- data/sig/generated/nukadoko/walk_step.rbs +50 -0
- data/sig/generated/nukadoko.rbs +15 -0
- data/sig/nukadoko.rbs +5 -48
- data/skills/nukadoko/SKILL.md +120 -0
- data/skills/nukadoko/references/checking-steps.md +200 -0
- data/skills/nukadoko/references/diagnosing.md +200 -0
- data/skills/nukadoko/references/done.md +99 -0
- data/skills/nukadoko/references/evidence.md +124 -0
- data/skills/nukadoko/references/examples/cli.md +230 -0
- data/skills/nukadoko/references/examples/http-api.md +339 -0
- data/skills/nukadoko/references/examples/workflow.md +173 -0
- data/skills/nukadoko/references/exploring.md +184 -0
- data/skills/nukadoko/references/fixtures.md +198 -0
- data/skills/nukadoko/references/from-prose.md +51 -0
- data/skills/nukadoko/references/judgments.md +95 -0
- data/skills/nukadoko/references/maintenance.md +97 -0
- data/skills/nukadoko/references/merge-risk.md +74 -0
- data/skills/nukadoko/references/parts.md +152 -0
- data/skills/nukadoko/references/perturbed-worlds.md +107 -0
- data/skills/nukadoko/references/program.md +200 -0
- data/skills/nukadoko/references/reviewing.md +200 -0
- data/skills/nukadoko/references/running.md +200 -0
- data/skills/nukadoko/references/scenario-rules.md +188 -0
- data/skills/nukadoko/references/states.md +66 -0
- data/skills/nukadoko/references/step-files.md +200 -0
- data/skills/nukadoko/references/verdicts.md +200 -0
- data/skills/nukadoko/references/writing-steps.md +200 -0
- data/skills/nukadoko/references/writing-the-feature.md +165 -0
- data/skills/nukadoko/scripts/claude-code-verdict-hook.mjs +99 -0
- data/skills/nukadoko/scripts/merge-risk.jq +56 -0
- data/skills/nukadoko-verification/SKILL.md +263 -0
- metadata +121 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/tree_passes.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# The base and the old world's passes of a `--base` run. Each row plans the
|
|
4
|
+
# cells its verdict needs from its head cells (RunRecord.planned_world_cells),
|
|
5
|
+
# and each tree runs its planned rows one environment at a time, in a
|
|
6
|
+
# process of its own started in the tree: a step file is loaded into the
|
|
7
|
+
# process that runs it, and head's steps are already loaded in this one.
|
|
8
|
+
# The pass writes its step records into the head run's directory, and its
|
|
9
|
+
# executions and cells come back as JSON. A cell whose pass did not run
|
|
10
|
+
# says why.
|
|
11
|
+
module Nukadoko
|
|
12
|
+
module Engine
|
|
13
|
+
class TreePasses
|
|
14
|
+
EXE: untyped
|
|
15
|
+
|
|
16
|
+
LIB: untyped
|
|
17
|
+
|
|
18
|
+
# `judged_by` says why head's passing executions of a row judged no
|
|
19
|
+
# claim in Then position (Run.then_judged_by).
|
|
20
|
+
# : (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped) -> void
|
|
21
|
+
def initialize: (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped) -> void
|
|
22
|
+
|
|
23
|
+
# The worlds each tree's passes started, as run.json names them.
|
|
24
|
+
attr_reader worlds: untyped
|
|
25
|
+
|
|
26
|
+
# Appends each tree execution to `executions`, and returns each row's
|
|
27
|
+
# base and old cells by its scenario.
|
|
28
|
+
# : (Array[Hash[Symbol, untyped]]) -> Hash[Scenario, Array[Hash[Symbol, untyped]]]
|
|
29
|
+
def call: (Array[Hash[Symbol, untyped]]) -> Hash[Scenario, Array[Hash[Symbol, untyped]]]
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
# : (Scenario) -> Hash[Symbol, Array[String]]
|
|
34
|
+
def plan: (Scenario) -> Hash[Symbol, Array[String]]
|
|
35
|
+
|
|
36
|
+
# Where a tree runs a head row: at its own place in the base tree,
|
|
37
|
+
# which holds head's features, and at the ref's place in the old one.
|
|
38
|
+
# : (String, Scenario) -> Array[untyped]
|
|
39
|
+
def place: (String, Scenario) -> Array[untyped]
|
|
40
|
+
|
|
41
|
+
# : (Scenario, String, Environment, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
42
|
+
def cell: (Scenario, String, Environment, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
43
|
+
|
|
44
|
+
# : (String, String, Environment, Array[Scenario]) -> Hash[Symbol, untyped]
|
|
45
|
+
def run_tree: (String, String, Environment, Array[Scenario]) -> Hash[Symbol, untyped]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/verdict.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# `nuka verdict`: whether the newest run that ended judged the working tree
|
|
4
|
+
# as it is now and left nothing red. It reads run.json files and one git
|
|
5
|
+
# tree id, and never starts a run. A run's red findings are relayed only
|
|
6
|
+
# when it judged this tree: a red row of an earlier tree may be fixed
|
|
7
|
+
# already, and a green one may not hold now.
|
|
8
|
+
module Nukadoko
|
|
9
|
+
module Engine
|
|
10
|
+
class Verdict
|
|
11
|
+
FIXES: untyped
|
|
12
|
+
|
|
13
|
+
attr_reader judged: String
|
|
14
|
+
|
|
15
|
+
attr_reader findings: Array[Hash[Symbol, untyped]]
|
|
16
|
+
|
|
17
|
+
attr_reader newest: Hash[Symbol, untyped]?
|
|
18
|
+
|
|
19
|
+
attr_reader working_tree: String?
|
|
20
|
+
|
|
21
|
+
# : (String) -> void
|
|
22
|
+
def initialize: (String) -> void
|
|
23
|
+
|
|
24
|
+
# The run with the latest start; a run.json whose run_id is not its
|
|
25
|
+
# directory's name, or that does not parse, is no run.
|
|
26
|
+
# : (String) -> Hash[Symbol, untyped]?
|
|
27
|
+
def self.newest_run: (String) -> Hash[Symbol, untyped]?
|
|
28
|
+
|
|
29
|
+
# : () -> bool
|
|
30
|
+
def open?: () -> bool
|
|
31
|
+
|
|
32
|
+
# : () -> Hash[Symbol, untyped]
|
|
33
|
+
def envelope_fields: () -> Hash[Symbol, untyped]
|
|
34
|
+
|
|
35
|
+
# : () -> String
|
|
36
|
+
def headline: () -> String
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
# : () -> String?
|
|
41
|
+
def recorded: () -> String?
|
|
42
|
+
|
|
43
|
+
# : () -> String
|
|
44
|
+
def again: () -> String
|
|
45
|
+
|
|
46
|
+
# : () -> [String, Array[Hash[Symbol, untyped]]]
|
|
47
|
+
def judge: () -> [ String, Array[Hash[Symbol, untyped]] ]
|
|
48
|
+
|
|
49
|
+
# : (String, String) -> Hash[Symbol, untyped]
|
|
50
|
+
def note: (String, String) -> Hash[Symbol, untyped]
|
|
51
|
+
|
|
52
|
+
# : () -> String
|
|
53
|
+
def stale_message: () -> String
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/vocabulary.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# What `nuka steps` and `nuka describe` print: each step as data, in the
|
|
4
|
+
# fields the TypeScript engine prints, so an agent picks a step from either
|
|
5
|
+
# engine's vocabulary without opening a file.
|
|
6
|
+
module Nukadoko
|
|
7
|
+
module Vocabulary
|
|
8
|
+
BROWSER: untyped
|
|
9
|
+
|
|
10
|
+
# : (singleton(Step), String) -> Hash[Symbol, untyped]
|
|
11
|
+
def self.entry: (singleton(Step), String) -> Hash[Symbol, untyped]
|
|
12
|
+
|
|
13
|
+
# : (singleton(Step), String) -> Hash[Symbol, untyped]
|
|
14
|
+
def self.describe: (singleton(Step), String) -> Hash[Symbol, untyped]
|
|
15
|
+
|
|
16
|
+
# : (singleton(Step)) -> Hash[untyped, untyped]?
|
|
17
|
+
def self.from: (singleton(Step)) -> Hash[untyped, untyped]?
|
|
18
|
+
|
|
19
|
+
# : (singleton(Step)) -> String
|
|
20
|
+
def self.text: (singleton(Step)) -> String
|
|
21
|
+
|
|
22
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
23
|
+
def self.claim_text: (Hash[Symbol, untyped]) -> String
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/walk.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# A walk of `nuka run --step` as data: the states one walk passes through,
|
|
4
|
+
# the one transition the run applies to move it, and what one `nuka step`
|
|
5
|
+
# call does next and prints, in the TypeScript engine's shape
|
|
6
|
+
# (src/run/walk.ts). Pure: no file system, no clock, no process. WalkFiles
|
|
7
|
+
# reads and writes the files both sides share, and Run holds the step that
|
|
8
|
+
# pauses.
|
|
9
|
+
#
|
|
10
|
+
# One walk is one execution of one scenario. Pause k comes after step k, so
|
|
11
|
+
# a pause number names the step a person was shown, and an answer names the
|
|
12
|
+
# walk and the pause it answers: an answer to a pause nobody was shown, or
|
|
13
|
+
# to an earlier walk the same command once answered, is refused, never
|
|
14
|
+
# applied to whichever pause is open. Pause numbers only increase, and
|
|
15
|
+
# `ended` absorbs every later event, so a replayed answer or a late signal
|
|
16
|
+
# cannot move a walk backwards.
|
|
17
|
+
#
|
|
18
|
+
# A state is a hash with symbol keys, as walk.json holds it once parsed:
|
|
19
|
+
# `state` is starting, running (with `after`), paused (with `pause`), or
|
|
20
|
+
# ended (with `end`, `ended_at`, and `reached`).
|
|
21
|
+
module Nukadoko
|
|
22
|
+
module Engine
|
|
23
|
+
module Walk
|
|
24
|
+
# A transition the walk's table does not have: a bug in the run that
|
|
25
|
+
# applies events, never something a reader of walk.json can cause.
|
|
26
|
+
class TransitionError < StandardError
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
START_KEYS: untyped
|
|
30
|
+
|
|
31
|
+
RUN_KEYS: untyped
|
|
32
|
+
|
|
33
|
+
# One line on what failed the scenario at a pause. The Ruby engine has
|
|
34
|
+
# no AfterStep hooks, but a pause read from a TypeScript walk can
|
|
35
|
+
# name one.
|
|
36
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
37
|
+
def self?.failure_text: (Hash[Symbol, untyped]) -> String
|
|
38
|
+
|
|
39
|
+
# The walk's first state, before the run knows its scenario.
|
|
40
|
+
# : (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
41
|
+
def self?.start: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
42
|
+
|
|
43
|
+
# One transition:
|
|
44
|
+
#
|
|
45
|
+
# starting --begun--> running(after 0) --paused(k > after)--> paused(k)
|
|
46
|
+
# paused(k) --answered(k)--> running(after k)
|
|
47
|
+
# any live state --ended--> ended, which absorbs every later event
|
|
48
|
+
#
|
|
49
|
+
# Raises TransitionError for any other pair.
|
|
50
|
+
# : (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
51
|
+
def self?.advance: (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
52
|
+
|
|
53
|
+
# The one spelling of an answer, for the do lines and the refusals.
|
|
54
|
+
# : (Integer, Integer, String) -> String
|
|
55
|
+
def self?.answer_command: (Integer, Integer, String) -> String
|
|
56
|
+
|
|
57
|
+
# The one spelling of a wait for one walk.
|
|
58
|
+
# : (Integer) -> String
|
|
59
|
+
def self?.wait_command: (Integer) -> String
|
|
60
|
+
|
|
61
|
+
# The command a walk that ended has to be started with again.
|
|
62
|
+
# : (String) -> String
|
|
63
|
+
def self?.restart_command: (String) -> String
|
|
64
|
+
|
|
65
|
+
# walk.json as `nuka step` reads it. A walk whose process is gone
|
|
66
|
+
# without recording its end is `gone`: killed, or crashed. `none`: no
|
|
67
|
+
# walk was ever recorded in the project.
|
|
68
|
+
# : (Hash[Symbol, untyped]?, ^(Integer) -> bool) -> Hash[Symbol, untyped]
|
|
69
|
+
def self?.see: (Hash[Symbol, untyped]?, ^(Integer) -> bool) -> Hash[Symbol, untyped]
|
|
70
|
+
|
|
71
|
+
# : (Hash[Symbol, untyped]) -> Integer
|
|
72
|
+
def self?.number_of: (Hash[Symbol, untyped]) -> Integer
|
|
73
|
+
|
|
74
|
+
# The walk one `nuka step` call is about, fixed when the call starts.
|
|
75
|
+
# A call is { kind: "wait", walk: Integer? } or { kind: "answer",
|
|
76
|
+
# walk:, pause:, answer: }. A wait that names no walk is about the
|
|
77
|
+
# newest walk until some `nuka step` call has reported how that walk
|
|
78
|
+
# ended, and about the next walk after that, which a `nuka run
|
|
79
|
+
# --step` started just before the wait may not have recorded yet. So
|
|
80
|
+
# a walk that ended before anyone looked is still reported, and an
|
|
81
|
+
# end is not reported in place of the walk that follows it.
|
|
82
|
+
# : (Hash[Symbol, untyped], Hash[Symbol, untyped], ^(Integer) -> bool) -> Integer
|
|
83
|
+
def self?.call_target: (Hash[Symbol, untyped], Hash[Symbol, untyped], ^(Integer) -> bool) -> Integer
|
|
84
|
+
|
|
85
|
+
# How a walk stands, after its number: "ended: interrupted by SIGTERM,
|
|
86
|
+
# exit 143", "is at pause 2".
|
|
87
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
88
|
+
def self?.standing: (Hash[Symbol, untyped]) -> String
|
|
89
|
+
|
|
90
|
+
# What follows "ended" in a walk's standing.
|
|
91
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
92
|
+
def self?.how_ended: (Hash[Symbol, untyped]) -> String
|
|
93
|
+
|
|
94
|
+
# The message of a wait that found no walk to report before its time
|
|
95
|
+
# ran out: which walk it waited for, and the last walk there is and
|
|
96
|
+
# how it stands, so the caller is not told that nothing ran.
|
|
97
|
+
# : (Hash[Symbol, untyped], Integer, Hash[Symbol, untyped]) -> String
|
|
98
|
+
def self?.nothing_started_message: (Hash[Symbol, untyped], Integer, Hash[Symbol, untyped]) -> String
|
|
99
|
+
|
|
100
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
101
|
+
def self?.where_text: (Hash[Symbol, untyped]) -> String
|
|
102
|
+
|
|
103
|
+
# Where the walk walk.json holds stands, for a refusal that names it.
|
|
104
|
+
# : (Hash[Symbol, untyped]) -> String
|
|
105
|
+
def self?.current_text: (Hash[Symbol, untyped]) -> String
|
|
106
|
+
|
|
107
|
+
# A call that names a walk walk.json no longer holds, or does not hold
|
|
108
|
+
# yet. The do is a wait for the walk there is, which answers nothing.
|
|
109
|
+
# : (Hash[Symbol, untyped], Integer, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
110
|
+
def self?.not_current: (Hash[Symbol, untyped], Integer, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
111
|
+
|
|
112
|
+
# What one `nuka step` call does next, from walk.json as it stands now
|
|
113
|
+
# (`seen`), the walk the call is about (`target`), and the answers
|
|
114
|
+
# that walk's run directory holds, by pause. Pure, so that repeating a
|
|
115
|
+
# call is a property test: an answer already given the same way
|
|
116
|
+
# reports where the walk went from it, and writes nothing again.
|
|
117
|
+
# : (Hash[Symbol, untyped], Integer, Hash[Symbol, untyped], Hash[Integer, String]) -> Hash[Symbol, untyped]
|
|
118
|
+
def self?.decide: (Hash[Symbol, untyped], Integer, Hash[Symbol, untyped], Hash[Integer, String]) -> Hash[Symbol, untyped]
|
|
119
|
+
|
|
120
|
+
# : (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
121
|
+
def self?.run_fields: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
122
|
+
|
|
123
|
+
# What `nuka step` prints beside the envelope's head: its exit code,
|
|
124
|
+
# its findings, and its fields. 0 for a walk paused, starting,
|
|
125
|
+
# running, or ended green; 1 for one paused where its scenario
|
|
126
|
+
# failed, ended red, interrupted, or gone. A walk starting or running
|
|
127
|
+
# is one the call's wait ran out on: the call itself is then the
|
|
128
|
+
# `do`, since repeating it is safe.
|
|
129
|
+
# : (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
130
|
+
def self?.report: (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
131
|
+
|
|
132
|
+
# The lines `nuka run --step` writes on stderr at a pause of walk
|
|
133
|
+
# `walk`, outside `--json`: the step, what failed when the scenario
|
|
134
|
+
# failed there, and the answers.
|
|
135
|
+
# : (Integer, Hash[Symbol, untyped]) -> String
|
|
136
|
+
def self?.pause_lines: (Integer, Hash[Symbol, untyped]) -> String
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/walk_files.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# The files a walk of `nuka run --step` and `nuka step` share, read and
|
|
4
|
+
# written from both sides, in the TypeScript engine's layout
|
|
5
|
+
# (src/run/walk-files.ts), so either engine's `nuka step` answers either
|
|
6
|
+
# engine's walk. Nothing else names these files, and nothing here decides
|
|
7
|
+
# anything: Walk says what a state becomes and what a call does next, Run
|
|
8
|
+
# says when a step is done, and the CLI prints.
|
|
9
|
+
#
|
|
10
|
+
# Each file has one writer, so no write needs a lock of its own:
|
|
11
|
+
#
|
|
12
|
+
# .nukadoko/walk.lock/<n> the run of walk n, created exclusively, holding its pid, then `released`
|
|
13
|
+
# .nukadoko/walk.json the run, replaced whole (written aside, then renamed)
|
|
14
|
+
# <run_dir>/answers/<n>.json nuka step, created exclusively, never rewritten
|
|
15
|
+
# <run_dir>/pauses/<n>/ the run: the views, and the open page's requests
|
|
16
|
+
# .nukadoko/walks-reported/<n> nuka step, created exclusively once it printed how walk n ended
|
|
17
|
+
#
|
|
18
|
+
# A process that holds the lock and is gone (a crash, a SIGKILL) leaves a
|
|
19
|
+
# walk.json that is not ended and a pid that is not alive: a reader sees the
|
|
20
|
+
# walk as gone, and the next `nuka run --step` takes the lock over. A pid
|
|
21
|
+
# check, not a lease a process renews: it needs no clock of its own.
|
|
22
|
+
module Nukadoko
|
|
23
|
+
module Engine
|
|
24
|
+
module WalkFiles
|
|
25
|
+
LOCK_DIR: ::String
|
|
26
|
+
|
|
27
|
+
RELEASED: ::String
|
|
28
|
+
|
|
29
|
+
STATE_FILE: ::String
|
|
30
|
+
|
|
31
|
+
REPORTED_DIR: ::String
|
|
32
|
+
|
|
33
|
+
POLL: ::Float
|
|
34
|
+
|
|
35
|
+
STATES: untyped
|
|
36
|
+
|
|
37
|
+
# The run's side of one walk.
|
|
38
|
+
class Handle
|
|
39
|
+
attr_reader number: untyped
|
|
40
|
+
|
|
41
|
+
# : (String, String, Integer, Hash[Symbol, untyped], (^(String) -> void)?) -> void
|
|
42
|
+
def initialize: (String, String, Integer, Hash[Symbol, untyped], (^(String) -> void)?) -> void
|
|
43
|
+
|
|
44
|
+
# The run has its directory and its one scenario.
|
|
45
|
+
# : (Hash[Symbol, untyped]) -> void
|
|
46
|
+
def begin: (Hash[Symbol, untyped]) -> void
|
|
47
|
+
|
|
48
|
+
# Writes the pause and waits for its answer. `hold` takes the pause's
|
|
49
|
+
# directory and the path the run records it as, and returns the
|
|
50
|
+
# views of the open page.
|
|
51
|
+
# : (Hash[Symbol, untyped]) { (String, String) -> Array[Hash[Symbol, untyped]] } -> String
|
|
52
|
+
def pause_after: (Hash[Symbol, untyped]) { (String, String) -> Array[Hash[Symbol, untyped]] } -> String
|
|
53
|
+
|
|
54
|
+
# run.json's `walk`: each pause so far, and its answer. It names only
|
|
55
|
+
# files that are there when it is written.
|
|
56
|
+
# : () -> Hash[Symbol, untyped]
|
|
57
|
+
def record: () -> Hash[Symbol, untyped]
|
|
58
|
+
|
|
59
|
+
# Records how the walk ended and releases the lock. The first call
|
|
60
|
+
# wins: a signal's cleanup and the run's own end can both reach it.
|
|
61
|
+
# : (Hash[Symbol, untyped]) -> void
|
|
62
|
+
def end: (Hash[Symbol, untyped]) -> void
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
# : (Hash[Symbol, untyped]) -> void
|
|
67
|
+
def apply: (Hash[Symbol, untyped]) -> void
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# : () -> String
|
|
71
|
+
def self?.now: () -> String
|
|
72
|
+
|
|
73
|
+
# Whether `pid` is a live process. EPERM is a process this one may
|
|
74
|
+
# not signal, which is alive.
|
|
75
|
+
# : (Integer) -> bool
|
|
76
|
+
def self?.alive?: (Integer) -> bool
|
|
77
|
+
|
|
78
|
+
# : (String) -> String
|
|
79
|
+
def self?.state_dir: (String) -> String
|
|
80
|
+
|
|
81
|
+
# : (String, String) -> String
|
|
82
|
+
def self?.answers_dir: (String, String) -> String
|
|
83
|
+
|
|
84
|
+
# : (String, String) -> void
|
|
85
|
+
def self?.replace_file: (String, String) -> void
|
|
86
|
+
|
|
87
|
+
# walk.json as one read found it: { state: } (nil for no file), or
|
|
88
|
+
# { unreadable: } with why. walk.json has one writer, so a reader
|
|
89
|
+
# checks only the fields every state carries and trusts the rest.
|
|
90
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
91
|
+
def self?.read_state: (String) -> Hash[Symbol, untyped]
|
|
92
|
+
|
|
93
|
+
# The whole-number names in a directory, and none when it is missing.
|
|
94
|
+
# : (String) -> Array[Integer]
|
|
95
|
+
def self?.numbered: (String) -> Array[Integer]
|
|
96
|
+
|
|
97
|
+
# One past every walk this project recorded, in walk.json or as a
|
|
98
|
+
# reported end, so a walk.json lost cannot give a new walk the number
|
|
99
|
+
# of one whose end a `nuka step` call already printed.
|
|
100
|
+
# : (String) -> Integer
|
|
101
|
+
def self?.highest_recorded: (String) -> Integer
|
|
102
|
+
|
|
103
|
+
# The highest lock file and its holder: a pid, "released", or nil for
|
|
104
|
+
# a file that holds neither. Only a number below the highest is ever
|
|
105
|
+
# removed, so a file gone between the listing and the read means a
|
|
106
|
+
# higher one exists: list again.
|
|
107
|
+
# : (String) -> Hash[Symbol, untyped]?
|
|
108
|
+
def self?.lock_top: (String) -> Hash[Symbol, untyped]?
|
|
109
|
+
|
|
110
|
+
# Creates `target` with `text` only when it does not exist. A link is
|
|
111
|
+
# exclusive, and the file appears with its whole text: a process
|
|
112
|
+
# killed between an exclusive create and its write would leave an
|
|
113
|
+
# empty lock no reader could tell from one being written.
|
|
114
|
+
# : (String, String) -> bool
|
|
115
|
+
def self?.link_whole: (String, String) -> bool
|
|
116
|
+
|
|
117
|
+
# : (String) -> void
|
|
118
|
+
def self?.remove_quietly: (String) -> void
|
|
119
|
+
|
|
120
|
+
# The pid of a live process, not this one, that holds a lock file
|
|
121
|
+
# below `walk`, or nil.
|
|
122
|
+
# : (String, Integer) -> Integer?
|
|
123
|
+
def self?.live_holder_below: (String, Integer) -> Integer?
|
|
124
|
+
|
|
125
|
+
# The lock is a directory with one file per walk that took it, named
|
|
126
|
+
# by the walk's number; the highest number holds it. A run takes the
|
|
127
|
+
# lock by creating the next number, so it never removes a file
|
|
128
|
+
# another process may hold: of two runs that find the same holder
|
|
129
|
+
# dead or released, only one creates the next number. A file is
|
|
130
|
+
# removed only once a higher one exists, and only by the process that
|
|
131
|
+
# created that higher one, or by its own creator giving way.
|
|
132
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
133
|
+
def self?.take_lock: (String) -> Hash[Symbol, untyped]
|
|
134
|
+
|
|
135
|
+
# The file stays, so the highest number never goes back down; it says
|
|
136
|
+
# `released`, which the next run takes over like a dead pid.
|
|
137
|
+
# : (String, Integer) -> void
|
|
138
|
+
def self?.release_lock: (String, Integer) -> void
|
|
139
|
+
|
|
140
|
+
# An answer file is created exclusively and written in one call, so a
|
|
141
|
+
# reader can catch it empty for a moment: that reads as not answered
|
|
142
|
+
# yet, and the next poll reads it whole.
|
|
143
|
+
# : (String) -> Hash[Symbol, String]?
|
|
144
|
+
def self?.read_answer: (String) -> Hash[Symbol, String]?
|
|
145
|
+
|
|
146
|
+
# The answer at `path`, once `nuka step` has written it.
|
|
147
|
+
# : (String) -> Hash[Symbol, String]
|
|
148
|
+
def self?.wait_answer: (String) -> Hash[Symbol, String]
|
|
149
|
+
|
|
150
|
+
# Starts the run's side of a walk: takes the lock, which numbers the
|
|
151
|
+
# walk one past every walk recorded, and writes it as starting. A
|
|
152
|
+
# Handle, or { refused: } with why. `announce` gets the lines of each
|
|
153
|
+
# pause, outside --json.
|
|
154
|
+
# : (String, String, ?announce: (^(String) -> void)?) -> (Handle | Hash[Symbol, untyped])
|
|
155
|
+
def self?.open: (String, String, ?announce: (^(String) -> void)?) -> (Handle | Hash[Symbol, untyped])
|
|
156
|
+
|
|
157
|
+
# The run directory of the walk that is live now, relative to the
|
|
158
|
+
# project root: a walk running or paused whose pid is alive, nil for
|
|
159
|
+
# none. A walk still starting has no run directory yet, so for it
|
|
160
|
+
# "starting" is returned. `nuka clean` keeps what this names.
|
|
161
|
+
# : (String) -> Hash[Symbol, untyped]?
|
|
162
|
+
def self?.live_run: (String) -> Hash[Symbol, untyped]?
|
|
163
|
+
|
|
164
|
+
# : (String, Hash[Symbol, untyped], Integer) -> Hash[Integer, String]
|
|
165
|
+
def self?.answers_of: (String, Hash[Symbol, untyped], Integer) -> Hash[Integer, String]
|
|
166
|
+
|
|
167
|
+
# One empty file per walk whose end a `nuka step` call printed.
|
|
168
|
+
# Created exclusively, so two calls that print the same end leave one
|
|
169
|
+
# file.
|
|
170
|
+
# : (String, Integer) -> bool
|
|
171
|
+
def self?.end_reported?: (String, Integer) -> bool
|
|
172
|
+
|
|
173
|
+
# : (String, Integer) -> void
|
|
174
|
+
def self?.mark_end_reported: (String, Integer) -> void
|
|
175
|
+
|
|
176
|
+
# : (String, String, Integer, String) -> void
|
|
177
|
+
def self?.write_answer: (String, String, Integer, String) -> void
|
|
178
|
+
|
|
179
|
+
# One `nuka step` call: reads walk.json until the walk reaches a state
|
|
180
|
+
# the call can report, writing the call's answer once when the walk
|
|
181
|
+
# waits at its pause. Repeating a call is safe. `timeout` (seconds)
|
|
182
|
+
# bounds the wait: a walk still running then is reported as running,
|
|
183
|
+
# with the call itself as its `do`, and a wait that never found its
|
|
184
|
+
# walk is refused as walk-not-found.
|
|
185
|
+
# : (String, Hash[Symbol, untyped], Numeric, ?alive: ^(Integer) -> bool) -> Hash[Symbol, untyped]
|
|
186
|
+
def self?.step_call: (String, Hash[Symbol, untyped], Numeric, ?alive: ^(Integer) -> bool) -> Hash[Symbol, untyped]
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/walk_step.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# `nuka step wait`, `nuka step next <pause> --walk <n>`, and `nuka step stop
|
|
4
|
+
# <pause> --walk <n>`, the side of a walk that answers it, in the
|
|
5
|
+
# TypeScript engine's shape (src/cli/step.ts). This class reads its
|
|
6
|
+
# arguments and prints; WalkFiles reads and writes the walk's files, and
|
|
7
|
+
# Walk decides what a call does. Findings go to stderr outside --json, as
|
|
8
|
+
# the TypeScript engine prints them, so stdout holds only where the walk
|
|
9
|
+
# stands.
|
|
10
|
+
module Nukadoko
|
|
11
|
+
class CLI
|
|
12
|
+
class Walked
|
|
13
|
+
ACTIONS: untyped
|
|
14
|
+
|
|
15
|
+
DEFAULT_TIMEOUT: ::Integer
|
|
16
|
+
|
|
17
|
+
# : (String, Array[String], Hash[String, Array[String]], json: bool, out: IO, ?err: IO) -> void
|
|
18
|
+
def initialize: (String, Array[String], Hash[String, Array[String]], json: bool, out: IO, ?err: IO) -> void
|
|
19
|
+
|
|
20
|
+
# : () -> Integer
|
|
21
|
+
def call: () -> Integer
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# A whole number of 1 or more, as the command line gave it, or nil.
|
|
26
|
+
# : (String?) -> Integer?
|
|
27
|
+
def whole: (String?) -> Integer?
|
|
28
|
+
|
|
29
|
+
# : () -> Hash[Symbol, untyped]
|
|
30
|
+
def call_of: () -> Hash[Symbol, untyped]
|
|
31
|
+
|
|
32
|
+
# : (String, String) -> String
|
|
33
|
+
def joined: (String, String) -> String
|
|
34
|
+
|
|
35
|
+
# What a person reads at a pause: where the step is, what it
|
|
36
|
+
# recorded, the views of the page it left open, and the two answers.
|
|
37
|
+
# : (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> String
|
|
38
|
+
def text: (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> String
|
|
39
|
+
|
|
40
|
+
# : (String, Integer, Array[Hash[Symbol, untyped]], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
41
|
+
def envelope: (String, Integer, Array[Hash[Symbol, untyped]], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
42
|
+
|
|
43
|
+
# : (String, String, String, ?run: String?, ?fields: Hash[Symbol, untyped]) -> Integer
|
|
44
|
+
def refuse: (String, String, String, ?run: String?, ?fields: Hash[Symbol, untyped]) -> Integer
|
|
45
|
+
|
|
46
|
+
# : (Hash[Symbol, untyped]) -> void
|
|
47
|
+
def print_finding: (Hash[Symbol, untyped]) -> void
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Generated from lib/nukadoko.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Nukadoko
|
|
4
|
+
# : (**untyped) -> Hash[Symbol, untyped]
|
|
5
|
+
def self.program: (**untyped) -> Hash[Symbol, untyped]
|
|
6
|
+
|
|
7
|
+
# : () -> Hash[Symbol, untyped]
|
|
8
|
+
def self.program_options: () -> Hash[Symbol, untyped]
|
|
9
|
+
|
|
10
|
+
# : (**untyped) -> Hash[Symbol, untyped]
|
|
11
|
+
def self.config: (**untyped) -> Hash[Symbol, untyped]
|
|
12
|
+
|
|
13
|
+
# : () -> Hash[Symbol, untyped]
|
|
14
|
+
def self.config_options: () -> Hash[Symbol, untyped]
|
|
15
|
+
end
|
data/sig/nukadoko.rbs
CHANGED
|
@@ -1,54 +1,11 @@
|
|
|
1
|
+
# What rbs-inline cannot write from lib/'s comments: the methods
|
|
2
|
+
# define_method defines, and the type of a command's result a step author
|
|
3
|
+
# reads. The rest is in sig/generated.
|
|
1
4
|
module Nukadoko
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def boolean: (Symbol, ?String, ?null: bool) -> void
|
|
5
|
-
def integer: (Symbol, ?String, ?null: bool) -> void
|
|
6
|
-
def number: (Symbol, ?String, ?null: bool) -> void
|
|
7
|
-
def strings: (Symbol, ?String, ?null: bool) -> void
|
|
8
|
-
def table: (Symbol, ?String, ?null: bool) -> void
|
|
9
|
-
def unknown: (Symbol, ?String) -> void
|
|
10
|
-
def enum: (Symbol, Array[String | Symbol], ?String, ?null: bool) -> void
|
|
11
|
-
def object: (Symbol, ?String, ?null: bool) { () [self: Schema] -> void } -> void
|
|
12
|
-
def field: (Symbol, Field, ?String) -> void
|
|
13
|
-
def []: (Symbol) -> Field
|
|
14
|
-
|
|
15
|
-
class Field
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
type command_result = { exitCode: Integer?, stdout: String, stderr: String }
|
|
20
|
-
|
|
21
|
-
def self.run_command: (String, ?Array[String], ?cwd: String, ?env: Hash[String | Symbol, String], ?stdin: String?) -> command_result
|
|
22
|
-
def self.fixture: (Symbol, ?scope: :scenario | :process) { (^(untyped) -> void, **untyped) -> void } -> untyped
|
|
23
|
-
|
|
24
|
-
class Step
|
|
25
|
-
def self.pattern: (String) -> String
|
|
26
|
-
def self.description: (String) -> String
|
|
27
|
-
def self.mutates: (bool) -> bool
|
|
28
|
-
def self.claims: (Array[Hash[Symbol, untyped]]) -> untyped
|
|
29
|
-
def self.poll: (untyped) -> untyped
|
|
30
|
-
def self.args: () { () [self: Schema] -> void } -> Schema
|
|
31
|
-
def self.returns: () { () [self: Schema] -> void } -> Schema
|
|
32
|
-
| () -> Schema
|
|
33
|
-
def self.from: (Hash[Symbol, untyped]) -> untyped
|
|
34
|
-
def self.parts: (Array[singleton(Step)]) -> Array[singleton(Step)]
|
|
35
|
-
end
|
|
5
|
+
# `files` is there when the run measured what changed under its cwd.
|
|
6
|
+
type command_result = { exitCode: Integer?, signal: String?, stdout: String, stderr: String, ?files: untyped }
|
|
36
7
|
|
|
37
8
|
module Engine
|
|
38
|
-
class Response
|
|
39
|
-
attr_reader status: Integer
|
|
40
|
-
def json: () -> untyped
|
|
41
|
-
def ok?: () -> bool
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
class Caller
|
|
45
|
-
def call: (singleton(Nukadoko::Step), ?Hash[String | Symbol, untyped], **untyped) -> untyped
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
class Scratch
|
|
49
|
-
def dir: (?String) -> String
|
|
50
|
-
end
|
|
51
|
-
|
|
52
9
|
class Request
|
|
53
10
|
def get: (String, ?data: untyped, ?body: String?, ?headers: Hash[String, String]) -> Response
|
|
54
11
|
def post: (String, ?data: untyped, ?body: String?, ?headers: Hash[String, String]) -> Response
|