textus 0.22.0 → 0.26.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/ARCHITECTURE.md +148 -45
- data/CHANGELOG.md +102 -0
- data/README.md +1 -1
- data/SPEC.md +12 -12
- data/docs/conventions.md +10 -0
- data/lib/textus/application/caps.rb +49 -0
- data/lib/textus/application/context.rb +2 -2
- data/lib/textus/application/envelope/reader.rb +44 -0
- data/lib/textus/application/{writes/envelope_io.rb → envelope/writer.rb} +24 -50
- data/lib/textus/application/maintenance/key_delete_prefix.rb +44 -0
- data/lib/textus/application/maintenance/key_mv_prefix.rb +57 -0
- data/lib/textus/application/maintenance/migrate.rb +59 -0
- data/lib/textus/application/maintenance/rule_lint.rb +65 -0
- data/lib/textus/application/maintenance/zone_mv.rb +60 -0
- data/lib/textus/application/maintenance.rb +17 -0
- data/lib/textus/application/projection.rb +12 -10
- data/lib/textus/application/read/audit.rb +106 -0
- data/lib/textus/application/read/blame.rb +91 -0
- data/lib/textus/application/read/deps.rb +34 -0
- data/lib/textus/application/read/freshness.rb +110 -0
- data/lib/textus/application/read/get.rb +75 -0
- data/lib/textus/application/read/get_or_refresh.rb +63 -0
- data/lib/textus/application/read/list.rb +25 -0
- data/lib/textus/application/read/policy_explain.rb +47 -0
- data/lib/textus/application/read/published.rb +25 -0
- data/lib/textus/application/read/pulse.rb +101 -0
- data/lib/textus/application/read/rdeps.rb +35 -0
- data/lib/textus/application/read/schema_envelope.rb +26 -0
- data/lib/textus/application/read/stale.rb +23 -0
- data/lib/textus/application/read/uid.rb +30 -0
- data/lib/textus/application/read/validate_all.rb +32 -0
- data/lib/textus/application/{reads → read}/validator.rb +2 -2
- data/lib/textus/application/read/where.rb +26 -0
- data/lib/textus/application/use_case.rb +22 -0
- data/lib/textus/application/write/accept.rb +102 -0
- data/lib/textus/application/{writes → write}/authority_gate.rb +3 -3
- data/lib/textus/application/write/delete.rb +45 -0
- data/lib/textus/application/{writes → write}/materializer.rb +14 -15
- data/lib/textus/application/write/mv.rb +118 -0
- data/lib/textus/application/write/publish.rb +96 -0
- data/lib/textus/application/write/put.rb +49 -0
- data/lib/textus/application/write/refresh_all.rb +63 -0
- data/lib/textus/application/{refresh/orchestrator.rb → write/refresh_orchestrator.rb} +32 -8
- data/lib/textus/application/write/refresh_worker.rb +134 -0
- data/lib/textus/application/write/reject.rb +62 -0
- data/lib/textus/boot.rb +27 -29
- data/lib/textus/builder/pipeline.rb +3 -3
- data/lib/textus/cli/group/mcp.rb +9 -0
- data/lib/textus/cli/group/zone.rb +9 -0
- data/lib/textus/cli/verb/accept.rb +1 -1
- data/lib/textus/cli/verb/audit.rb +2 -2
- data/lib/textus/cli/verb/blame.rb +1 -1
- data/lib/textus/cli/verb/boot.rb +1 -1
- data/lib/textus/cli/verb/build.rb +2 -2
- data/lib/textus/cli/verb/delete.rb +1 -1
- data/lib/textus/cli/verb/deps.rb +1 -1
- data/lib/textus/cli/verb/doctor.rb +1 -1
- data/lib/textus/cli/verb/freshness.rb +1 -1
- data/lib/textus/cli/verb/get.rb +1 -1
- data/lib/textus/cli/verb/hook_run.rb +3 -4
- data/lib/textus/cli/verb/hooks.rb +11 -14
- data/lib/textus/cli/verb/key_delete.rb +24 -0
- data/lib/textus/cli/verb/list.rb +1 -1
- data/lib/textus/cli/verb/mcp_serve.rb +17 -0
- data/lib/textus/cli/verb/migrate.rb +18 -0
- data/lib/textus/cli/verb/mv.rb +11 -3
- data/lib/textus/cli/verb/published.rb +1 -1
- data/lib/textus/cli/verb/pulse.rb +1 -1
- data/lib/textus/cli/verb/put.rb +8 -6
- data/lib/textus/cli/verb/rdeps.rb +1 -1
- data/lib/textus/cli/verb/refresh.rb +1 -1
- data/lib/textus/cli/verb/refresh_stale.rb +1 -1
- data/lib/textus/cli/verb/reject.rb +1 -1
- data/lib/textus/cli/verb/rule_explain.rb +1 -1
- data/lib/textus/cli/verb/rule_lint.rb +18 -0
- data/lib/textus/cli/verb/schema.rb +1 -1
- data/lib/textus/cli/verb/uid.rb +1 -1
- data/lib/textus/cli/verb/where.rb +1 -1
- data/lib/textus/cli/verb/zone_mv.rb +19 -0
- data/lib/textus/cli/verb.rb +4 -4
- data/lib/textus/doctor/check/audit_log.rb +2 -2
- data/lib/textus/doctor/check/handler_allowlist.rb +2 -2
- data/lib/textus/doctor/check/hooks.rb +4 -3
- data/lib/textus/doctor/check/illegal_keys.rb +2 -2
- data/lib/textus/doctor/check/intake_registration.rb +2 -2
- data/lib/textus/doctor/check/manifest_files.rb +2 -2
- data/lib/textus/doctor/check/protocol_version.rb +2 -2
- data/lib/textus/doctor/check/refresh_locks.rb +2 -2
- data/lib/textus/doctor/check/rule_ambiguity.rb +2 -2
- data/lib/textus/doctor/check/schema_parse_error.rb +1 -1
- data/lib/textus/doctor/check/schema_violations.rb +1 -1
- data/lib/textus/doctor/check/schemas.rb +2 -2
- data/lib/textus/doctor/check/sentinels.rb +2 -2
- data/lib/textus/doctor/check/templates.rb +2 -2
- data/lib/textus/doctor/check/unowned_schema_fields.rb +1 -1
- data/lib/textus/doctor/check.rb +5 -3
- data/lib/textus/doctor.rb +24 -27
- data/lib/textus/domain/authorizer.rb +4 -4
- data/lib/textus/{application → domain}/policy/predicates/accept_authority_signed.rb +2 -2
- data/lib/textus/{application → domain}/policy/predicates/schema_valid.rb +1 -1
- data/lib/textus/{application → domain}/policy/promotion.rb +1 -1
- data/lib/textus/domain/staleness/generator_check.rb +2 -2
- data/lib/textus/domain/staleness/intake_check.rb +2 -2
- data/lib/textus/domain/staleness.rb +1 -1
- data/lib/textus/hooks/builtin.rb +14 -14
- data/lib/textus/hooks/context.rb +13 -13
- data/lib/textus/hooks/error_log.rb +32 -0
- data/lib/textus/hooks/{bus.rb → event_bus.rb} +41 -53
- data/lib/textus/hooks/loader.rb +29 -3
- data/lib/textus/hooks/rpc_registry.rb +77 -0
- data/lib/textus/infra/audit_subscriber.rb +6 -7
- data/lib/textus/infra/refresh/detached.rb +1 -1
- data/lib/textus/key/path.rb +7 -3
- data/lib/textus/manifest/data.rb +78 -0
- data/lib/textus/manifest/entry/base.rb +4 -4
- data/lib/textus/manifest/entry/derived.rb +4 -5
- data/lib/textus/manifest/entry/validators/events.rb +1 -1
- data/lib/textus/manifest/policy.rb +48 -0
- data/lib/textus/manifest/resolver.rb +14 -14
- data/lib/textus/manifest/rules.rb +1 -1
- data/lib/textus/manifest.rb +53 -111
- data/lib/textus/mcp/errors.rb +32 -0
- data/lib/textus/mcp/server.rb +127 -0
- data/lib/textus/mcp/session.rb +31 -0
- data/lib/textus/mcp/tool_schemas.rb +71 -0
- data/lib/textus/mcp/tools.rb +129 -0
- data/lib/textus/mcp.rb +6 -0
- data/lib/textus/schema/tools.rb +14 -10
- data/lib/textus/session.rb +84 -0
- data/lib/textus/store.rb +14 -9
- data/lib/textus/version.rb +1 -1
- data/lib/textus.rb +8 -1
- metadata +61 -36
- data/lib/textus/application/reads/audit.rb +0 -94
- data/lib/textus/application/reads/blame.rb +0 -82
- data/lib/textus/application/reads/deps.rb +0 -26
- data/lib/textus/application/reads/freshness.rb +0 -88
- data/lib/textus/application/reads/get.rb +0 -67
- data/lib/textus/application/reads/get_or_refresh.rb +0 -51
- data/lib/textus/application/reads/list.rb +0 -17
- data/lib/textus/application/reads/policy_explain.rb +0 -39
- data/lib/textus/application/reads/published.rb +0 -17
- data/lib/textus/application/reads/pulse.rb +0 -63
- data/lib/textus/application/reads/rdeps.rb +0 -27
- data/lib/textus/application/reads/schema_envelope.rb +0 -18
- data/lib/textus/application/reads/stale.rb +0 -15
- data/lib/textus/application/reads/uid.rb +0 -23
- data/lib/textus/application/reads/validate_all.rb +0 -24
- data/lib/textus/application/reads/where.rb +0 -18
- data/lib/textus/application/refresh/all.rb +0 -52
- data/lib/textus/application/refresh/worker.rb +0 -116
- data/lib/textus/application/writes/accept.rb +0 -89
- data/lib/textus/application/writes/delete.rb +0 -33
- data/lib/textus/application/writes/mv.rb +0 -105
- data/lib/textus/application/writes/publish.rb +0 -81
- data/lib/textus/application/writes/put.rb +0 -37
- data/lib/textus/application/writes/reject.rb +0 -50
- data/lib/textus/infra/event_bus.rb +0 -27
- data/lib/textus/operations.rb +0 -176
data/lib/textus/operations.rb
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
module Textus
|
|
2
|
-
# Single canonical entrypoint for invoking application use-cases against a
|
|
3
|
-
# store. Public surface is flat — one method per use case:
|
|
4
|
-
#
|
|
5
|
-
# ops = Textus::Operations.for(store, role: "agent")
|
|
6
|
-
# ops.put(key, body: "...")
|
|
7
|
-
# ops.get(key) # pure read
|
|
8
|
-
# ops.get_or_refresh(key) # read + refresh-on-stale
|
|
9
|
-
# ops.refresh(key) # synchronous worker refresh
|
|
10
|
-
# ops.refresh_all(prefix: ..., zone: ...)
|
|
11
|
-
class Operations
|
|
12
|
-
def self.for(store, role: Role::DEFAULT, correlation_id: nil, dry_run: false)
|
|
13
|
-
new(
|
|
14
|
-
ctx: Application::Context.build(role: role, correlation_id: correlation_id, dry_run: dry_run),
|
|
15
|
-
manifest: store.manifest,
|
|
16
|
-
file_store: store.file_store,
|
|
17
|
-
schemas: store.schemas,
|
|
18
|
-
audit_log: store.audit_log,
|
|
19
|
-
bus: store.bus,
|
|
20
|
-
root: store.root,
|
|
21
|
-
store: store,
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
attr_reader :ctx, :store
|
|
26
|
-
|
|
27
|
-
# rubocop:disable Metrics/ParameterLists
|
|
28
|
-
def initialize(ctx:, manifest:, file_store:, schemas:, audit_log:, bus:, root:, store:)
|
|
29
|
-
@ctx = ctx
|
|
30
|
-
@manifest = manifest
|
|
31
|
-
@file_store = file_store
|
|
32
|
-
@schemas = schemas
|
|
33
|
-
@audit_log = audit_log
|
|
34
|
-
@bus = bus
|
|
35
|
-
@root = root
|
|
36
|
-
@store = store
|
|
37
|
-
@authorizer = Textus::Domain::Authorizer.new(manifest: @manifest)
|
|
38
|
-
end
|
|
39
|
-
# rubocop:enable Metrics/ParameterLists
|
|
40
|
-
|
|
41
|
-
def with_role(role)
|
|
42
|
-
self.class.new(
|
|
43
|
-
ctx: @ctx.with_role(role),
|
|
44
|
-
manifest: @manifest, file_store: @file_store, schemas: @schemas,
|
|
45
|
-
audit_log: @audit_log, bus: @bus,
|
|
46
|
-
root: @root, store: @store
|
|
47
|
-
)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def hook_context
|
|
51
|
-
@hook_context ||= Textus::Hooks::Context.new(ops: self)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# writes
|
|
55
|
-
def put(...)
|
|
56
|
-
Application::Writes::Put.new(
|
|
57
|
-
ctx: @ctx, manifest: @manifest, envelope_io: envelope_io,
|
|
58
|
-
bus: @bus, authorizer: @authorizer, hook_context: hook_context
|
|
59
|
-
).call(...)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def delete(...)
|
|
63
|
-
Application::Writes::Delete.new(
|
|
64
|
-
ctx: @ctx, manifest: @manifest, envelope_io: envelope_io,
|
|
65
|
-
bus: @bus, authorizer: @authorizer, hook_context: hook_context
|
|
66
|
-
).call(...)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def mv(...)
|
|
70
|
-
Application::Writes::Mv.new(
|
|
71
|
-
ctx: @ctx, manifest: @manifest, envelope_io: envelope_io,
|
|
72
|
-
bus: @bus, authorizer: @authorizer, hook_context: hook_context
|
|
73
|
-
).call(...)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def accept(...)
|
|
77
|
-
Application::Writes::Accept.new(
|
|
78
|
-
ctx: @ctx, manifest: @manifest, file_store: @file_store, schemas: @schemas,
|
|
79
|
-
envelope_io: envelope_io, bus: @bus, authorizer: @authorizer, hook_context: hook_context
|
|
80
|
-
).call(...)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def reject(...)
|
|
84
|
-
Application::Writes::Reject.new(
|
|
85
|
-
ctx: @ctx, manifest: @manifest, file_store: @file_store,
|
|
86
|
-
envelope_io: envelope_io, bus: @bus, authorizer: @authorizer, hook_context: hook_context
|
|
87
|
-
).call(...)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def publish(...)
|
|
91
|
-
Application::Writes::Publish.new(
|
|
92
|
-
ctx: @ctx, manifest: @manifest, file_store: @file_store,
|
|
93
|
-
bus: @bus, root: @root, store: @store, hook_context: hook_context
|
|
94
|
-
).call(...)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# reads
|
|
98
|
-
def get(...)
|
|
99
|
-
Application::Reads::Get.new(ctx: @ctx, manifest: @manifest, file_store: @file_store).call(...)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def get_or_refresh(...)
|
|
103
|
-
Application::Reads::GetOrRefresh.new(
|
|
104
|
-
manifest: @manifest,
|
|
105
|
-
get: Application::Reads::Get.new(ctx: @ctx, manifest: @manifest, file_store: @file_store),
|
|
106
|
-
orchestrator: orchestrator,
|
|
107
|
-
).call(...)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def list(...) = Application::Reads::List.new(manifest: @manifest).call(...)
|
|
111
|
-
def where(...) = Application::Reads::Where.new(manifest: @manifest).call(...)
|
|
112
|
-
def uid(...) = Application::Reads::Uid.new(ctx: @ctx, manifest: @manifest, file_store: @file_store).call(...)
|
|
113
|
-
def schema_envelope(...) = Application::Reads::SchemaEnvelope.new(manifest: @manifest, schemas: @schemas).call(...)
|
|
114
|
-
def deps(...) = Application::Reads::Deps.new(manifest: @manifest).call(...)
|
|
115
|
-
def rdeps(...) = Application::Reads::Rdeps.new(manifest: @manifest).call(...)
|
|
116
|
-
def published(...) = Application::Reads::Published.new(manifest: @manifest).call(...)
|
|
117
|
-
def stale(...) = Application::Reads::Stale.new(manifest: @manifest).call(...)
|
|
118
|
-
def audit(...) = Application::Reads::Audit.new(manifest: @manifest, root: @root, audit_log: @audit_log).call(...)
|
|
119
|
-
def blame(...) = Application::Reads::Blame.new(manifest: @manifest, root: @root).call(...)
|
|
120
|
-
def policy_explain(...) = Application::Reads::PolicyExplain.new(manifest: @manifest).call(...)
|
|
121
|
-
def freshness(...) = Application::Reads::Freshness.new(ctx: @ctx, manifest: @manifest, file_store: @file_store).call(...)
|
|
122
|
-
|
|
123
|
-
def pulse(...)
|
|
124
|
-
Application::Reads::Pulse.new(
|
|
125
|
-
ctx: @ctx, manifest: @manifest, file_store: @file_store,
|
|
126
|
-
audit_log: @audit_log, root: @root, store: @store
|
|
127
|
-
).call(...)
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def validate_all(...)
|
|
131
|
-
Application::Reads::ValidateAll.new(
|
|
132
|
-
ctx: @ctx, manifest: @manifest, file_store: @file_store, schemas: @schemas, audit_log: @audit_log,
|
|
133
|
-
).call(...)
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
# refresh
|
|
137
|
-
def refresh(key) = refresh_worker.run(key)
|
|
138
|
-
|
|
139
|
-
def refresh_all(**)
|
|
140
|
-
Application::Refresh::All.new(
|
|
141
|
-
ctx: @ctx, manifest: @manifest, envelope_io: envelope_io, bus: @bus,
|
|
142
|
-
store: @store, authorizer: @authorizer, hook_context: hook_context
|
|
143
|
-
).call(**)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
private
|
|
147
|
-
|
|
148
|
-
def envelope_io
|
|
149
|
-
@envelope_io ||= Application::Writes::EnvelopeIO.new(
|
|
150
|
-
file_store: @file_store,
|
|
151
|
-
manifest: @manifest,
|
|
152
|
-
schemas: @schemas,
|
|
153
|
-
audit_log: @audit_log,
|
|
154
|
-
ctx: @ctx,
|
|
155
|
-
)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
def refresh_worker
|
|
159
|
-
@refresh_worker ||= Application::Refresh::Worker.new(
|
|
160
|
-
ctx: @ctx, manifest: @manifest, envelope_io: envelope_io, bus: @bus,
|
|
161
|
-
store: @store, authorizer: @authorizer, hook_context: hook_context
|
|
162
|
-
)
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
def orchestrator
|
|
166
|
-
@orchestrator ||= Application::Refresh::Orchestrator.new(
|
|
167
|
-
worker: refresh_worker,
|
|
168
|
-
store_root: @root,
|
|
169
|
-
bus: @bus,
|
|
170
|
-
store: @store,
|
|
171
|
-
ctx: @ctx,
|
|
172
|
-
hook_context: hook_context,
|
|
173
|
-
)
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
end
|