Module: Jazari
- Defined in:
- lib/jazari.rb,
lib/jazari/runs.rb,
lib/jazari/errors.rb,
lib/jazari/recipe.rb,
lib/jazari/anchors.rb,
lib/jazari/railtie.rb,
lib/jazari/targets.rb,
lib/jazari/version.rb,
lib/jazari/checklist.rb,
app/models/jazari/run.rb,
lib/jazari/operations.rb,
lib/jazari/mcp/actions.rb,
lib/jazari/mcp/handler.rb,
lib/jazari/recipe_files.rb,
app/models/jazari/anchor.rb,
app/models/jazari/runbook.rb,
lib/jazari/recipe_registry.rb,
lib/jazari/resolved_runbook.rb,
app/models/jazari/recipe_record.rb,
app/models/jazari/application_record.rb,
lib/generators/jazari/install/install_generator.rb,
lib/generators/jazari/upgrade/upgrade_generator.rb
Overview
Addressable operating procedures.
RECIPE the canon - how this ritual is done. Data, not code.
RUNBOOK one subject's override of it.
QUEUE a stable name for a ritual that outlives any record.
RUN one execution - who, when, which ticks, what evidence.
This module is the only public mutation interface. It never accepts a raw id,
an arbitrary record, or an actor: hosts authorize first, then pass exactly one
immutable target value.
Defined Under Namespace
Modules: Anchors, Checklist, Generators, Mcp, Operations, RecipeFiles, RecipeRegistry, RunPolicy, Runs
Classes: Anchor, AnchorTarget, ApplicationRecord, Configuration, Error, InvalidRunbook, ItemNotFound, QueueTarget, Railtie, ReadOnlyTarget, Recipe, RecipeRecord, RecordTarget, ResolvedRunbook, RevisionConflict, Run, RunClosed, Runbook, TargetNotFound
Constant Summary
collapse
- TABLES =
{ recipes: "recipes", runbooks: "runbooks", anchors: "anchors", runs: "runs" }.freeze
- VERSION =
"0.5.2"
Class Attribute Summary collapse
Class Method Summary
collapse
-
.add_item(target:, expected_revision:, text:, required: true) ⇒ Object
-
.apply_table_names! ⇒ Object
-
.attach_evidence(run:, expected_revision:, item_id:, kind:, value:, actor_ref: nil) ⇒ Object
-
.check_item(target:, expected_revision:, item_id:, done:) ⇒ Object
-
.close_run(run:, expected_revision:, outcome:) ⇒ Object
-
.config ⇒ Object
-
.configure {|configuration| ... } ⇒ Object
-
.customize(target:, expected_revision:, topic:, description:, checklist:, origin: nil) ⇒ Object
-
.forget_subject(subject) ⇒ Object
Call from the host's after-commit when a subject is destroyed.
-
.last_run(target:) ⇒ Object
-
.models_loaded? ⇒ Boolean
Kept for hosts that call it explicitly; the models now resolve their own names on every call, so nothing depends on this having run.
-
.open_run(target:, actor_ref: nil, now: Time.now.utc) ⇒ Object
-
.remove_item(target:, expected_revision:, item_id:) ⇒ Object
-
.reset(target:, expected_revision:) ⇒ Object
-
.resolve(target:) ⇒ Object
-
.table_name_for(key) ⇒ Object
-
.tick(run:, expected_revision:, item_id:, done:, actor_ref: nil, note: nil) ⇒ Object
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
33
34
35
|
# File 'lib/jazari.rb', line 33
def configuration
@configuration
end
|
Class Method Details
.add_item(target:, expected_revision:, text:, required: true) ⇒ Object
119
120
121
122
|
# File 'lib/jazari.rb', line 119
def add_item(target:, expected_revision:, text:, required: true)
Operations.add_item(target: target, expected_revision: expected_revision,
text: text, required: required)
end
|
.apply_table_names! ⇒ Object
84
|
# File 'lib/jazari.rb', line 84
def self.apply_table_names! = models_loaded?
|
.attach_evidence(run:, expected_revision:, item_id:, kind:, value:, actor_ref: nil) ⇒ Object
100
101
102
103
|
# File 'lib/jazari.rb', line 100
def attach_evidence(run:, expected_revision:, item_id:, kind:, value:, actor_ref: nil)
Runs.attach_evidence(run: run, expected_revision: expected_revision,
item_id: item_id, kind: kind, value: value, actor_ref: actor_ref)
end
|
.check_item(target:, expected_revision:, item_id:, done:) ⇒ Object
128
129
130
131
|
# File 'lib/jazari.rb', line 128
def check_item(target:, expected_revision:, item_id:, done:)
Operations.check_item(target: target, expected_revision: expected_revision,
item_id: item_id, done: done)
end
|
.close_run(run:, expected_revision:, outcome:) ⇒ Object
105
106
107
|
# File 'lib/jazari.rb', line 105
def close_run(run:, expected_revision:, outcome:)
Runs.close(run: run, expected_revision: expected_revision, outcome: outcome)
end
|
.config ⇒ Object
86
|
# File 'lib/jazari.rb', line 86
def self.config = configuration || configure
|
67
68
69
70
71
72
73
|
# File 'lib/jazari.rb', line 67
def self.configure
self.configuration ||= Configuration.new
yield configuration if block_given?
configuration.validate!
apply_table_names!
configuration
end
|
.customize(target:, expected_revision:, topic:, description:, checklist:, origin: nil) ⇒ Object
113
114
115
116
117
|
# File 'lib/jazari.rb', line 113
def customize(target:, expected_revision:, topic:, description:, checklist:, origin: nil)
Operations.customize(target: target, expected_revision: expected_revision,
topic: topic, description: description, checklist: checklist,
origin: origin)
end
|
.forget_subject(subject) ⇒ Object
Call from the host's after-commit when a subject is destroyed. See
Operations.forget_subject — runs survive on purpose.
.last_run(target:) ⇒ Object
109
|
# File 'lib/jazari.rb', line 109
def last_run(target:) = Runs.last(target: target)
|
.models_loaded? ⇒ Boolean
Kept for hosts that call it explicitly; the models now resolve their own
names on every call, so nothing depends on this having run.
82
|
# File 'lib/jazari.rb', line 82
def self.models_loaded? = const_defined?(:RecipeRecord)
|
.open_run(target:, actor_ref: nil, now: Time.now.utc) ⇒ Object
91
92
93
|
# File 'lib/jazari.rb', line 91
def open_run(target:, actor_ref: nil, now: Time.now.utc)
Runs.open(target: target, actor_ref: actor_ref, now: now)
end
|
.remove_item(target:, expected_revision:, item_id:) ⇒ Object
124
125
126
|
# File 'lib/jazari.rb', line 124
def remove_item(target:, expected_revision:, item_id:)
Operations.remove_item(target: target, expected_revision: expected_revision, item_id: item_id)
end
|
.reset(target:, expected_revision:) ⇒ Object
133
134
135
|
# File 'lib/jazari.rb', line 133
def reset(target:, expected_revision:)
Operations.reset(target: target, expected_revision: expected_revision)
end
|
.resolve(target:) ⇒ Object
111
|
# File 'lib/jazari.rb', line 111
def resolve(target:) = Operations.resolve(target: target)
|
.table_name_for(key) ⇒ Object
75
76
77
78
|
# File 'lib/jazari.rb', line 75
def self.table_name_for(key)
TABLES.fetch(key) config.table_names[key]&.to_s || "#{config.table_prefix}#{TABLES.fetch(key)}"
end
|
.tick(run:, expected_revision:, item_id:, done:, actor_ref: nil, note: nil) ⇒ Object
95
96
97
98
|
# File 'lib/jazari.rb', line 95
def tick(run:, expected_revision:, item_id:, done:, actor_ref: nil, note: nil)
Runs.tick(run: run, expected_revision: expected_revision, item_id: item_id,
done: done, actor_ref: actor_ref, note: note)
end
|