speclogician 0.0.0b1__py3-none-any.whl → 0.0.0.dev1__py3-none-any.whl
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.
- speclogician/agent/funcs.py +29 -0
- speclogician/cmd/agent_cmd.py +89 -0
- speclogician/cmd/data_cmd.py +24 -0
- speclogician/cmd/model_cmd.py +42 -0
- speclogician/cmd/overlay_cmd.py +30 -0
- speclogician/cmd/scenario_cmd.py +61 -0
- speclogician/cmd/state_cmd.py +52 -0
- speclogician/data/artifact.py +8 -50
- speclogician/data/container.py +18 -384
- speclogician/data/mapping.py +18 -17
- speclogician/data/refs.py +12 -11
- speclogician/data/reports.py +11 -0
- speclogician/data/traces.py +15 -6
- speclogician/llms/llmtools.py +102 -0
- speclogician/llms/overlay.py +264 -0
- speclogician/main.py +36 -102
- speclogician/modeling/__init__.py +0 -31
- speclogician/modeling/component.py +4 -60
- speclogician/modeling/conflict.py +5 -19
- speclogician/modeling/domain.py +93 -280
- speclogician/modeling/model.py +206 -0
- speclogician/modeling/predicates.py +20 -22
- speclogician/modeling/report.py +33 -0
- speclogician/modeling/scenario.py +119 -87
- speclogician/sl_cmd.py +76 -0
- speclogician/state/change.py +98 -378
- speclogician/state/state.py +183 -399
- speclogician/tui/box.tcss +10 -0
- speclogician/tui/tui.py +131 -0
- speclogician/utils/__init__.py +1 -70
- speclogician/utils/imx.py +195 -0
- speclogician/utils/load.py +25 -147
- speclogician/utils/prompt.md +1 -325
- speclogician-0.0.0.dev1.dist-info/METADATA +21 -0
- speclogician-0.0.0.dev1.dist-info/RECORD +43 -0
- speclogician/commands/__init__.py +0 -15
- speclogician/commands/cmd_ch.py +0 -616
- speclogician/commands/cmd_find.py +0 -256
- speclogician/commands/cmd_view.py +0 -202
- speclogician/commands/runner.py +0 -149
- speclogician/commands/utils.py +0 -101
- speclogician/demos/.DS_Store +0 -0
- speclogician/demos/cmd_demo.py +0 -278
- speclogician/demos/loader.py +0 -135
- speclogician/demos/model.py +0 -27
- speclogician/demos/runner.py +0 -51
- speclogician/logic/__init__.py +0 -11
- speclogician/logic/api/__init__.py +0 -29
- speclogician/logic/api/client.py +0 -606
- speclogician/logic/api/decomp.py +0 -67
- speclogician/logic/api/scenario.py +0 -102
- speclogician/logic/api/traces.py +0 -59
- speclogician/logic/lib/__init__.py +0 -19
- speclogician/logic/lib/complement.py +0 -107
- speclogician/logic/lib/domain_model.py +0 -59
- speclogician/logic/lib/predicates.py +0 -151
- speclogician/logic/lib/scenarios.py +0 -369
- speclogician/logic/lib/traces.py +0 -114
- speclogician/logic/lib/transitions.py +0 -104
- speclogician/logic/main.py +0 -246
- speclogician/logic/strings.py +0 -194
- speclogician/logic/utils.py +0 -135
- speclogician/modeling/complement.py +0 -104
- speclogician/modeling/spec.py +0 -306
- speclogician/modeling/spec_stats.py +0 -39
- speclogician/presentation/api.py +0 -244
- speclogician/presentation/builders/_links.py +0 -44
- speclogician/presentation/builders/container.py +0 -53
- speclogician/presentation/builders/data_artifact.py +0 -42
- speclogician/presentation/builders/domain.py +0 -54
- speclogician/presentation/builders/instances_list.py +0 -38
- speclogician/presentation/builders/predicate.py +0 -51
- speclogician/presentation/builders/recommendations.py +0 -41
- speclogician/presentation/builders/scenario.py +0 -41
- speclogician/presentation/builders/scenario_complement.py +0 -82
- speclogician/presentation/builders/smart_find.py +0 -39
- speclogician/presentation/builders/spec.py +0 -39
- speclogician/presentation/builders/state_diff.py +0 -150
- speclogician/presentation/builders/state_instance.py +0 -42
- speclogician/presentation/builders/state_instance_summary.py +0 -84
- speclogician/presentation/builders/trace.py +0 -58
- speclogician/presentation/ctx.py +0 -38
- speclogician/presentation/models/container.py +0 -44
- speclogician/presentation/models/data_artifact.py +0 -33
- speclogician/presentation/models/domain.py +0 -50
- speclogician/presentation/models/instances_list.py +0 -23
- speclogician/presentation/models/predicate.py +0 -60
- speclogician/presentation/models/recommendations.py +0 -34
- speclogician/presentation/models/scenario.py +0 -31
- speclogician/presentation/models/scenario_complement.py +0 -40
- speclogician/presentation/models/smart_find.py +0 -34
- speclogician/presentation/models/spec.py +0 -32
- speclogician/presentation/models/state_diff.py +0 -34
- speclogician/presentation/models/state_instance.py +0 -31
- speclogician/presentation/models/state_instance_summary.py +0 -102
- speclogician/presentation/models/trace.py +0 -42
- speclogician/presentation/preview/__init__.py +0 -13
- speclogician/presentation/preview/cli.py +0 -50
- speclogician/presentation/preview/fixtures/__init__.py +0 -205
- speclogician/presentation/preview/fixtures/artifact_container.py +0 -150
- speclogician/presentation/preview/fixtures/data_artifact.py +0 -144
- speclogician/presentation/preview/fixtures/domain_model.py +0 -162
- speclogician/presentation/preview/fixtures/instances_list.py +0 -162
- speclogician/presentation/preview/fixtures/predicate.py +0 -184
- speclogician/presentation/preview/fixtures/scenario.py +0 -84
- speclogician/presentation/preview/fixtures/scenario_complement.py +0 -81
- speclogician/presentation/preview/fixtures/smart_find.py +0 -140
- speclogician/presentation/preview/fixtures/spec.py +0 -95
- speclogician/presentation/preview/fixtures/state_diff.py +0 -158
- speclogician/presentation/preview/fixtures/state_instance.py +0 -128
- speclogician/presentation/preview/fixtures/state_instance_summary.py +0 -80
- speclogician/presentation/preview/fixtures/trace.py +0 -206
- speclogician/presentation/preview/registry.py +0 -42
- speclogician/presentation/renderers/__init__.py +0 -24
- speclogician/presentation/renderers/container.py +0 -136
- speclogician/presentation/renderers/data_artifact.py +0 -144
- speclogician/presentation/renderers/domain.py +0 -123
- speclogician/presentation/renderers/instances_list.py +0 -120
- speclogician/presentation/renderers/predicate.py +0 -180
- speclogician/presentation/renderers/recommendations.py +0 -90
- speclogician/presentation/renderers/scenario.py +0 -94
- speclogician/presentation/renderers/scenario_complement.py +0 -59
- speclogician/presentation/renderers/smart_find.py +0 -307
- speclogician/presentation/renderers/spec.py +0 -105
- speclogician/presentation/renderers/state_diff.py +0 -102
- speclogician/presentation/renderers/state_instance.py +0 -82
- speclogician/presentation/renderers/state_instance_summary.py +0 -143
- speclogician/presentation/renderers/trace.py +0 -122
- speclogician/shell/app.py +0 -170
- speclogician/shell/shell_ch.py +0 -263
- speclogician/shell/shell_view.py +0 -153
- speclogician/state/change_result.py +0 -32
- speclogician/state/diff.py +0 -191
- speclogician/state/inst.py +0 -574
- speclogician/state/recommendation.py +0 -13
- speclogician/state/recommender.py +0 -577
- speclogician/state/state_stats.py +0 -133
- speclogician/tui/__init__.py +0 -0
- speclogician/tui/app.py +0 -257
- speclogician/tui/app.tcss +0 -160
- speclogician/tui/demo.py +0 -45
- speclogician/tui/images/speclogician-full.png +0 -0
- speclogician/tui/images/speclogician-minimal.png +0 -0
- speclogician/tui/main_screen.py +0 -454
- speclogician/tui/splash_screen.py +0 -51
- speclogician/tui/stats_screen.py +0 -125
- speclogician/utils/testing.py +0 -151
- speclogician-0.0.0b1.dist-info/METADATA +0 -116
- speclogician-0.0.0b1.dist-info/RECORD +0 -139
- /speclogician/{presentation → agent}/__init__.py +0 -0
- /speclogician/{presentation/builders → cmd}/__init__.py +0 -0
- /speclogician/{presentation/models → llms}/__init__.py +0 -0
- {speclogician-0.0.0b1.dist-info → speclogician-0.0.0.dev1.dist-info}/WHEEL +0 -0
speclogician/commands/cmd_ch.py
DELETED
|
@@ -1,616 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Imandra Inc.
|
|
3
|
-
#
|
|
4
|
-
# speclogician/commands/ch_cmd.py
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
import typer
|
|
8
|
-
from typing import Optional
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
from ..state.change import (
|
|
11
|
-
DomainModelBaseEdit,
|
|
12
|
-
PredicateAdd,
|
|
13
|
-
PredicateEdit,
|
|
14
|
-
PredicateRemove,
|
|
15
|
-
TransitionAdd,
|
|
16
|
-
TransitionEdit,
|
|
17
|
-
TransitionRemove,
|
|
18
|
-
ScenarioAdd,
|
|
19
|
-
ScenarioEdit,
|
|
20
|
-
ScenarioRemove,
|
|
21
|
-
AddTestTrace,
|
|
22
|
-
EditTestTrace,
|
|
23
|
-
AddLogTrace,
|
|
24
|
-
EditLogTrace,
|
|
25
|
-
RemoveTraceArtifact,
|
|
26
|
-
AddDocRef,
|
|
27
|
-
EditDocRef,
|
|
28
|
-
AddSrcCodeRef,
|
|
29
|
-
EditSrcCodeRef,
|
|
30
|
-
RemoveDataArtifact,
|
|
31
|
-
LinkArtifactsComponents,
|
|
32
|
-
RemoveArtComponentLink
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
from ..modeling.scenario import ScenarioDelta
|
|
36
|
-
from ..modeling.predicates import PredicateType
|
|
37
|
-
from .utils import (
|
|
38
|
-
parse_scenario_delta,
|
|
39
|
-
get_state
|
|
40
|
-
)
|
|
41
|
-
from .runner import run_change_and_render
|
|
42
|
-
|
|
43
|
-
app = typer.Typer(help="Change state commands")
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
#-----------------------------------------------------------------------------
|
|
47
|
-
# Base Model
|
|
48
|
-
#-----------------------------------------------------------------------------
|
|
49
|
-
|
|
50
|
-
@app.command("base-edit")
|
|
51
|
-
def domain_base_edit(
|
|
52
|
-
ctx: typer.Context,
|
|
53
|
-
src: Optional[str] = typer.Option(
|
|
54
|
-
None,
|
|
55
|
-
"--src",
|
|
56
|
-
help="IML source code for the domain base component",
|
|
57
|
-
),
|
|
58
|
-
file: Optional[Path] = typer.Option(
|
|
59
|
-
None,
|
|
60
|
-
"--file",
|
|
61
|
-
exists=True,
|
|
62
|
-
readable=True,
|
|
63
|
-
help="Path to a file containing IML base source code",
|
|
64
|
-
),
|
|
65
|
-
json_only: bool = typer.Option(
|
|
66
|
-
False,
|
|
67
|
-
"--json",
|
|
68
|
-
help="Emit JSON only (no rich output)",
|
|
69
|
-
),
|
|
70
|
-
):
|
|
71
|
-
"""
|
|
72
|
-
Edit the base component of the domain model.
|
|
73
|
-
"""
|
|
74
|
-
|
|
75
|
-
state = get_state(ctx)
|
|
76
|
-
|
|
77
|
-
# --- input validation ---
|
|
78
|
-
if src is None and file is None:
|
|
79
|
-
raise typer.BadParameter("One of --src or --file must be provided")
|
|
80
|
-
|
|
81
|
-
if src is not None and file is not None:
|
|
82
|
-
raise typer.BadParameter("Only one of --src or --file may be provided")
|
|
83
|
-
|
|
84
|
-
if file is not None:
|
|
85
|
-
src = file.read_text()
|
|
86
|
-
|
|
87
|
-
assert src is not None # for type checkers
|
|
88
|
-
|
|
89
|
-
change = DomainModelBaseEdit(new_base_src=src)
|
|
90
|
-
|
|
91
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
92
|
-
state.save()
|
|
93
|
-
|
|
94
|
-
#-----------------------------------------------------------------------------
|
|
95
|
-
# Scenarios
|
|
96
|
-
#-----------------------------------------------------------------------------
|
|
97
|
-
@app.command(name="scenario-add")
|
|
98
|
-
def scenario_add(
|
|
99
|
-
ctx: typer.Context,
|
|
100
|
-
scenario_name: str = typer.Argument(
|
|
101
|
-
...,
|
|
102
|
-
help="Name of the scenario to add",
|
|
103
|
-
),
|
|
104
|
-
given: list[str] = typer.Option(
|
|
105
|
-
[],
|
|
106
|
-
"--given",
|
|
107
|
-
help=(
|
|
108
|
-
"State predicate name (repeatable).\n"
|
|
109
|
-
"Examples:\n"
|
|
110
|
-
" --given pred_eq_ten\n"
|
|
111
|
-
" --given pred_gte_ten --given pred_ne_ten"
|
|
112
|
-
),
|
|
113
|
-
),
|
|
114
|
-
when: list[str] = typer.Option(
|
|
115
|
-
[],
|
|
116
|
-
"--when",
|
|
117
|
-
help=(
|
|
118
|
-
"Action predicate name (repeatable).\n"
|
|
119
|
-
"Examples:\n"
|
|
120
|
-
" --when act_gt_x\n"
|
|
121
|
-
" --when act_gt_x --when act_lte_x"
|
|
122
|
-
),
|
|
123
|
-
),
|
|
124
|
-
then: list[str] = typer.Option(
|
|
125
|
-
[],
|
|
126
|
-
"--then",
|
|
127
|
-
help=(
|
|
128
|
-
"Transition name (repeatable).\n"
|
|
129
|
-
"Examples:\n"
|
|
130
|
-
" --then step1\n"
|
|
131
|
-
" --then step1 --then step2"
|
|
132
|
-
),
|
|
133
|
-
),
|
|
134
|
-
given_list: str | None = typer.Option(
|
|
135
|
-
None,
|
|
136
|
-
"--given-list",
|
|
137
|
-
help=(
|
|
138
|
-
"Comma-separated list of state predicates.\n"
|
|
139
|
-
'Example: --given-list "pred_eq_ten,pred_ne_ten"'
|
|
140
|
-
),
|
|
141
|
-
),
|
|
142
|
-
when_list: str | None = typer.Option(
|
|
143
|
-
None,
|
|
144
|
-
"--when-list",
|
|
145
|
-
help=(
|
|
146
|
-
"Comma-separated list of action predicates.\n"
|
|
147
|
-
'Example: --when-list "act_gt_x,act_lte_x"'
|
|
148
|
-
),
|
|
149
|
-
),
|
|
150
|
-
then_list: str | None = typer.Option(
|
|
151
|
-
None,
|
|
152
|
-
"--then-list",
|
|
153
|
-
help=(
|
|
154
|
-
"Comma-separated list of transitions.\n"
|
|
155
|
-
'Example: --then-list "step1,step2"'
|
|
156
|
-
),
|
|
157
|
-
),
|
|
158
|
-
json_only: bool = typer.Option(
|
|
159
|
-
False,
|
|
160
|
-
"--json",
|
|
161
|
-
help="Output the parsed ScenarioAdd as JSON",
|
|
162
|
-
),
|
|
163
|
-
) -> None:
|
|
164
|
-
|
|
165
|
-
state = get_state(ctx)
|
|
166
|
-
|
|
167
|
-
def _split_csv(s: str | None) -> list[str]:
|
|
168
|
-
if not s:
|
|
169
|
-
return []
|
|
170
|
-
return [x.strip() for x in s.split(",") if x.strip()]
|
|
171
|
-
|
|
172
|
-
# Merge repeatable flags + csv lists (dedup preserving order)
|
|
173
|
-
def _merge(a: list[str], b: list[str]) -> list[str]:
|
|
174
|
-
return list(dict.fromkeys([*a, *b]))
|
|
175
|
-
|
|
176
|
-
given_all = _merge(given, _split_csv(given_list))
|
|
177
|
-
when_all = _merge(when, _split_csv(when_list))
|
|
178
|
-
then_all = _merge(then, _split_csv(then_list))
|
|
179
|
-
|
|
180
|
-
def _delta_from_add(xs: list[str]) -> ScenarioDelta | None:
|
|
181
|
-
d = ScenarioDelta(add=xs)
|
|
182
|
-
return None if d.is_empty() else d
|
|
183
|
-
|
|
184
|
-
change = ScenarioAdd(
|
|
185
|
-
scenario_name=scenario_name,
|
|
186
|
-
given=_delta_from_add(given_all),
|
|
187
|
-
when=_delta_from_add(when_all),
|
|
188
|
-
then=_delta_from_add(then_all),
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
192
|
-
state.save()
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
@app.command(name="scenario-edit", help="Edit an existing scenario by adding/removing predicates and transitions")
|
|
196
|
-
def scenario_edit_cmd(
|
|
197
|
-
ctx: typer.Context,
|
|
198
|
-
scenario_name: str = typer.Argument(
|
|
199
|
-
...,
|
|
200
|
-
help="Name of the scenario to edit",
|
|
201
|
-
),
|
|
202
|
-
given: str | None = typer.Option(
|
|
203
|
-
None,
|
|
204
|
-
"--given",
|
|
205
|
-
help=(
|
|
206
|
-
"Delta for GIVEN (state predicates).\n"
|
|
207
|
-
"Formats:\n"
|
|
208
|
-
" '+p1,+p2,-p3' add/remove predicates\n"
|
|
209
|
-
" 'p1,p2' add predicates\n"
|
|
210
|
-
" JSON string or path to JSON file\n"
|
|
211
|
-
"Example: --given '+pred_eq_ten,-pred_lt_ten'"
|
|
212
|
-
),
|
|
213
|
-
),
|
|
214
|
-
when: str | None = typer.Option(
|
|
215
|
-
None,
|
|
216
|
-
"--when",
|
|
217
|
-
help=(
|
|
218
|
-
"Delta for WHEN (action predicates).\n"
|
|
219
|
-
"Formats:\n"
|
|
220
|
-
" '+q1,+q2,-q3' add/remove predicates\n"
|
|
221
|
-
" 'q1,q2' add predicates\n"
|
|
222
|
-
" JSON string or path to JSON file\n"
|
|
223
|
-
"Example: --when '+act_gt_x,-act_lte_x'"
|
|
224
|
-
),
|
|
225
|
-
),
|
|
226
|
-
then: str | None = typer.Option(
|
|
227
|
-
None,
|
|
228
|
-
"--then",
|
|
229
|
-
help=(
|
|
230
|
-
"Delta for THEN (transition names).\n"
|
|
231
|
-
"Formats:\n"
|
|
232
|
-
" '+t1,+t2,-t3' add/remove transitions\n"
|
|
233
|
-
" 't1,t2' add transitions\n"
|
|
234
|
-
" JSON string or path to JSON file\n"
|
|
235
|
-
"Example: --then '+step1,-step2'"
|
|
236
|
-
),
|
|
237
|
-
),
|
|
238
|
-
json_only: bool = typer.Option(
|
|
239
|
-
False,
|
|
240
|
-
"--json",
|
|
241
|
-
help="Output the parsed ScenarioEdit as JSON",
|
|
242
|
-
),
|
|
243
|
-
):
|
|
244
|
-
|
|
245
|
-
state = get_state(ctx)
|
|
246
|
-
change = ScenarioEdit(
|
|
247
|
-
scenario_name=scenario_name,
|
|
248
|
-
given=parse_scenario_delta(given),
|
|
249
|
-
when=parse_scenario_delta(when),
|
|
250
|
-
then=parse_scenario_delta(then),
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
254
|
-
state.save()
|
|
255
|
-
|
|
256
|
-
@app.command(name="scenario-remove", help="Remove a scenario from the current spec/state.")
|
|
257
|
-
def scenario_remove_cmd(
|
|
258
|
-
ctx: typer.Context,
|
|
259
|
-
scenario_name: str = typer.Argument(
|
|
260
|
-
...,
|
|
261
|
-
help="Name of the scenario to remove (identifier). Example: scenario_1",
|
|
262
|
-
),
|
|
263
|
-
json_only: bool = typer.Option(
|
|
264
|
-
False,
|
|
265
|
-
"--json",
|
|
266
|
-
help="Output machine-readable JSON (includes change + state summaries + diff).",
|
|
267
|
-
),
|
|
268
|
-
) -> None:
|
|
269
|
-
"""
|
|
270
|
-
Examples:
|
|
271
|
-
|
|
272
|
-
speclogician scenario remove scenario_1
|
|
273
|
-
|
|
274
|
-
speclogician --state-json /path/to/project scenario remove scenario_1 --json
|
|
275
|
-
|
|
276
|
-
speclogician scenario remove scenario_1 -y
|
|
277
|
-
"""
|
|
278
|
-
state = get_state(ctx)
|
|
279
|
-
change = ScenarioRemove(scenario_name=scenario_name)
|
|
280
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
281
|
-
state.save()
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
#-----------------------------------------------------------------------------
|
|
285
|
-
# Traces (TestTrace and LogTrace)
|
|
286
|
-
#-----------------------------------------------------------------------------
|
|
287
|
-
|
|
288
|
-
trace_app = typer.Typer(help="Trace artifacts (TestTrace, LogTrace).")
|
|
289
|
-
app.add_typer(trace_app, name="trace")
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
@app.command("test-add")
|
|
293
|
-
def add_test_trace(
|
|
294
|
-
ctx: typer.Context,
|
|
295
|
-
art_id: str = typer.Option(..., "--art-id", help="Artifact ID (uuid string)"),
|
|
296
|
-
name: str = typer.Option(..., "--name", help="Test name (NOT unique)"),
|
|
297
|
-
given: str = typer.Option(..., "--given", help="Concrete state expression, e.g. { x = 1 }"),
|
|
298
|
-
when: Optional[str] = typer.Option(None, "--when", help="Concrete action expression"),
|
|
299
|
-
then: Optional[str] = typer.Option(None, "--then", help="Concrete resulting state expression"),
|
|
300
|
-
filepath: str = typer.Option("", "--filepath", help="Original test filepath"),
|
|
301
|
-
language: Optional[str] = typer.Option(None, "--language", help="Language"),
|
|
302
|
-
contents: Optional[str] = typer.Option(None, "--contents", help="Original test contents"),
|
|
303
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON result (no rich output)"),
|
|
304
|
-
) -> None:
|
|
305
|
-
state = get_state(ctx)
|
|
306
|
-
change = AddTestTrace(
|
|
307
|
-
art_id=art_id,
|
|
308
|
-
name=name,
|
|
309
|
-
given=given,
|
|
310
|
-
when=when,
|
|
311
|
-
then=then,
|
|
312
|
-
filepath=filepath,
|
|
313
|
-
language=language,
|
|
314
|
-
contents=contents,
|
|
315
|
-
)
|
|
316
|
-
|
|
317
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
318
|
-
state.save()
|
|
319
|
-
|
|
320
|
-
@app.command("test-edit")
|
|
321
|
-
def edit_test_trace(
|
|
322
|
-
ctx: typer.Context,
|
|
323
|
-
art_id: str = typer.Argument(..., help="Artifact ID"),
|
|
324
|
-
name: Optional[str] = typer.Option(None, "--name"),
|
|
325
|
-
given: Optional[str] = typer.Option(None, "--given"),
|
|
326
|
-
when: Optional[str] = typer.Option(None, "--when"),
|
|
327
|
-
then: Optional[str] = typer.Option(None, "--then"),
|
|
328
|
-
filepath: Optional[str] = typer.Option(None, "--filepath"),
|
|
329
|
-
language: Optional[str] = typer.Option(None, "--language"),
|
|
330
|
-
contents: Optional[str] = typer.Option(None, "--contents"),
|
|
331
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
332
|
-
) -> None:
|
|
333
|
-
state = get_state(ctx)
|
|
334
|
-
change = EditTestTrace(
|
|
335
|
-
art_id=art_id,
|
|
336
|
-
name=name,
|
|
337
|
-
given=given,
|
|
338
|
-
when=when,
|
|
339
|
-
then=then,
|
|
340
|
-
filepath=filepath,
|
|
341
|
-
language=language,
|
|
342
|
-
contents=contents,
|
|
343
|
-
)
|
|
344
|
-
|
|
345
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
346
|
-
state.save()
|
|
347
|
-
|
|
348
|
-
@app.command("log-add")
|
|
349
|
-
def add_log_trace(
|
|
350
|
-
ctx: typer.Context,
|
|
351
|
-
art_id: str = typer.Option(..., "--art-id", help="Artifact ID (uuid string)"),
|
|
352
|
-
filename: str = typer.Option(..., "--filename", help="Log filename (NOT unique)"),
|
|
353
|
-
contents: str = typer.Option(..., "--contents", help="Log contents"),
|
|
354
|
-
given: str = typer.Option(..., "--given", help="Concrete state expression"),
|
|
355
|
-
when: Optional[str] = typer.Option(None, "--when", help="Concrete action expression"),
|
|
356
|
-
then: Optional[str] = typer.Option(None, "--then", help="Concrete resulting state expression"),
|
|
357
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
358
|
-
) -> None:
|
|
359
|
-
state = get_state(ctx)
|
|
360
|
-
change = AddLogTrace(
|
|
361
|
-
art_id=art_id,
|
|
362
|
-
filename=filename,
|
|
363
|
-
contents=contents,
|
|
364
|
-
given=given,
|
|
365
|
-
when=when,
|
|
366
|
-
then=then,
|
|
367
|
-
)
|
|
368
|
-
|
|
369
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
370
|
-
state.save()
|
|
371
|
-
|
|
372
|
-
@app.command("log-edit")
|
|
373
|
-
def edit_log_trace(
|
|
374
|
-
ctx: typer.Context,
|
|
375
|
-
art_id: str = typer.Argument(..., help="Artifact ID"),
|
|
376
|
-
filename: Optional[str] = typer.Option(None, "--filename"),
|
|
377
|
-
contents: Optional[str] = typer.Option(None, "--contents"),
|
|
378
|
-
given: Optional[str] = typer.Option(None, "--given"),
|
|
379
|
-
when: Optional[str] = typer.Option(None, "--when"),
|
|
380
|
-
then: Optional[str] = typer.Option(None, "--then"),
|
|
381
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
382
|
-
) -> None:
|
|
383
|
-
state = get_state(ctx)
|
|
384
|
-
change = EditLogTrace(
|
|
385
|
-
art_id=art_id,
|
|
386
|
-
filename=filename,
|
|
387
|
-
contents=contents,
|
|
388
|
-
given=given,
|
|
389
|
-
when=when,
|
|
390
|
-
then=then,
|
|
391
|
-
)
|
|
392
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
393
|
-
state.save()
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
@app.command("trace-remove")
|
|
397
|
-
def remove_trace(
|
|
398
|
-
ctx: typer.Context,
|
|
399
|
-
art_id: str = typer.Argument(..., help="Artifact ID"),
|
|
400
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
401
|
-
) -> None:
|
|
402
|
-
state = get_state(ctx)
|
|
403
|
-
change = RemoveTraceArtifact(art_id=art_id)
|
|
404
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
405
|
-
state.save()
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
# --------------------------------------------------------
|
|
409
|
-
# Data artifacts (DocRefs and SrcRefs)
|
|
410
|
-
# --------------------------------------------------------
|
|
411
|
-
|
|
412
|
-
@app.command("add-doc")
|
|
413
|
-
def add_doc(
|
|
414
|
-
ctx: typer.Context,
|
|
415
|
-
art_id: str = typer.Option(..., "--art-id"),
|
|
416
|
-
text: str = typer.Option(..., "--text"),
|
|
417
|
-
meta: Optional[str] = typer.Option(None, "--meta"),
|
|
418
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
419
|
-
) -> None:
|
|
420
|
-
state = get_state(ctx)
|
|
421
|
-
change = AddDocRef(art_id=art_id, text=text, meta=meta)
|
|
422
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
423
|
-
state.save()
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
@app.command("edit-doc")
|
|
427
|
-
def edit_doc(
|
|
428
|
-
ctx: typer.Context,
|
|
429
|
-
art_id: str = typer.Argument(...),
|
|
430
|
-
text: Optional[str] = typer.Option(None, "--text"),
|
|
431
|
-
meta: Optional[str] = typer.Option(None, "--meta"),
|
|
432
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
433
|
-
) -> None:
|
|
434
|
-
state = get_state(ctx)
|
|
435
|
-
change = EditDocRef(art_id=art_id, text=text, meta=meta)
|
|
436
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
437
|
-
state.save()
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
@app.command("add-src")
|
|
441
|
-
def add_src(
|
|
442
|
-
ctx: typer.Context,
|
|
443
|
-
art_id: str = typer.Option(..., "--art-id"),
|
|
444
|
-
src_code: str = typer.Option(..., "--src-code"),
|
|
445
|
-
language: Optional[str] = typer.Option(None, "--language"),
|
|
446
|
-
file_path: Optional[str] = typer.Option(None, "--file-path"),
|
|
447
|
-
iml_code: Optional[str] = typer.Option(None, "--iml-code"),
|
|
448
|
-
meta: Optional[str] = typer.Option(None, "--meta"),
|
|
449
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
450
|
-
) -> None:
|
|
451
|
-
state = get_state(ctx)
|
|
452
|
-
change = AddSrcCodeRef(
|
|
453
|
-
art_id=art_id,
|
|
454
|
-
src_code=src_code,
|
|
455
|
-
language=language,
|
|
456
|
-
file_path=file_path,
|
|
457
|
-
iml_code=iml_code,
|
|
458
|
-
meta=meta,
|
|
459
|
-
)
|
|
460
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
461
|
-
state.save()
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
@app.command("edit-src")
|
|
465
|
-
def edit_src(
|
|
466
|
-
ctx: typer.Context,
|
|
467
|
-
art_id: str = typer.Argument(...),
|
|
468
|
-
src_code: Optional[str] = typer.Option(None, "--src-code"),
|
|
469
|
-
language: Optional[str] = typer.Option(None, "--language"),
|
|
470
|
-
file_path: Optional[str] = typer.Option(None, "--file-path"),
|
|
471
|
-
iml_code: Optional[str] = typer.Option(None, "--iml-code"),
|
|
472
|
-
meta: Optional[str] = typer.Option(None, "--meta"),
|
|
473
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
474
|
-
) -> None:
|
|
475
|
-
state = get_state(ctx)
|
|
476
|
-
change = EditSrcCodeRef(
|
|
477
|
-
art_id=art_id,
|
|
478
|
-
src_code=src_code,
|
|
479
|
-
language=language,
|
|
480
|
-
file_path=file_path,
|
|
481
|
-
iml_code=iml_code,
|
|
482
|
-
meta=meta,
|
|
483
|
-
)
|
|
484
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
485
|
-
state.save()
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
@app.command("remove-art")
|
|
489
|
-
def remove_data_art(
|
|
490
|
-
ctx: typer.Context,
|
|
491
|
-
art_id: str = typer.Argument(...),
|
|
492
|
-
json_only: bool = typer.Option(False, "--json"),
|
|
493
|
-
) -> None:
|
|
494
|
-
state = get_state(ctx)
|
|
495
|
-
change = RemoveDataArtifact(art_id=art_id)
|
|
496
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
497
|
-
state.save()
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
#-----------------------------------------------------------------------------
|
|
501
|
-
# Scenarios
|
|
502
|
-
#-----------------------------------------------------------------------------
|
|
503
|
-
|
|
504
|
-
@app.command("pred-add")
|
|
505
|
-
def predicate_add(
|
|
506
|
-
ctx: typer.Context,
|
|
507
|
-
pred_type: PredicateType = typer.Option(..., "--pred-type", help="STATE or ACTION"),
|
|
508
|
-
pred_name: str = typer.Option(..., "--pred-name", help="Predicate name"),
|
|
509
|
-
pred_src: str = typer.Option(..., "--pred-src", help="Predicate source code"),
|
|
510
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON output"),
|
|
511
|
-
):
|
|
512
|
-
"""
|
|
513
|
-
Add a new predicate to the domain model.
|
|
514
|
-
"""
|
|
515
|
-
state = get_state(ctx)
|
|
516
|
-
change = PredicateAdd(
|
|
517
|
-
pred_type=pred_type,
|
|
518
|
-
pred_name=pred_name,
|
|
519
|
-
pred_src=pred_src,
|
|
520
|
-
)
|
|
521
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
522
|
-
state.save()
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
@app.command("pred-edit")
|
|
526
|
-
def predicate_edit(
|
|
527
|
-
ctx: typer.Context,
|
|
528
|
-
pred_name: str = typer.Option(..., "--pred-name", help="Predicate name"),
|
|
529
|
-
pred_src: str = typer.Option(..., "--pred-src", help="Updated predicate source"),
|
|
530
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON output"),
|
|
531
|
-
):
|
|
532
|
-
"""
|
|
533
|
-
Edit an existing predicate.
|
|
534
|
-
"""
|
|
535
|
-
state = get_state(ctx)
|
|
536
|
-
|
|
537
|
-
change = PredicateEdit(
|
|
538
|
-
pred_name=pred_name,
|
|
539
|
-
pred_src=pred_src,
|
|
540
|
-
)
|
|
541
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
542
|
-
state.save()
|
|
543
|
-
|
|
544
|
-
@app.command("pred-remove")
|
|
545
|
-
def predicate_remove(
|
|
546
|
-
ctx: typer.Context,
|
|
547
|
-
pred_name: str = typer.Option(..., "--pred-name", help="Predicate name to remove"),
|
|
548
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON output"),
|
|
549
|
-
):
|
|
550
|
-
"""
|
|
551
|
-
Remove a predicate from the domain model.
|
|
552
|
-
"""
|
|
553
|
-
state = get_state(ctx)
|
|
554
|
-
change = PredicateRemove(pred_name=pred_name)
|
|
555
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
556
|
-
state.save()
|
|
557
|
-
|
|
558
|
-
#-----------------------------------------------------------------------------
|
|
559
|
-
# Transitions
|
|
560
|
-
#-----------------------------------------------------------------------------
|
|
561
|
-
|
|
562
|
-
@app.command("trans-add")
|
|
563
|
-
def transition_add(
|
|
564
|
-
ctx: typer.Context,
|
|
565
|
-
trans_name: str = typer.Option(..., "--trans-name", help="Transition name"),
|
|
566
|
-
trans_src: str = typer.Option(..., "--trans-src", help="Transition source code"),
|
|
567
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON output"),
|
|
568
|
-
):
|
|
569
|
-
"""
|
|
570
|
-
Add a new transition function.
|
|
571
|
-
"""
|
|
572
|
-
state = get_state(ctx)
|
|
573
|
-
change = TransitionAdd(
|
|
574
|
-
trans_name=trans_name,
|
|
575
|
-
trans_src=trans_src,
|
|
576
|
-
)
|
|
577
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
578
|
-
state.save()
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
@app.command("trans-edit")
|
|
582
|
-
def transition_edit(
|
|
583
|
-
ctx: typer.Context,
|
|
584
|
-
trans_name: str = typer.Option(..., "--trans-name", help="Transition name"),
|
|
585
|
-
trans_src: str = typer.Option(..., "--trans-src", help="Updated transition source"),
|
|
586
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON output"),
|
|
587
|
-
):
|
|
588
|
-
"""
|
|
589
|
-
Edit an existing transition function.
|
|
590
|
-
"""
|
|
591
|
-
state = get_state(ctx)
|
|
592
|
-
change = TransitionEdit(
|
|
593
|
-
trans_name=trans_name,
|
|
594
|
-
trans_src=trans_src,
|
|
595
|
-
)
|
|
596
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
597
|
-
state.save()
|
|
598
|
-
|
|
599
|
-
@app.command("trans-remove")
|
|
600
|
-
def transition_remove(
|
|
601
|
-
ctx: typer.Context,
|
|
602
|
-
trans_name: str = typer.Option(..., "--trans-name", help="Transition name to remove"),
|
|
603
|
-
json_only: bool = typer.Option(False, "--json", help="Emit JSON output"),
|
|
604
|
-
):
|
|
605
|
-
"""
|
|
606
|
-
Remove a transition function.
|
|
607
|
-
"""
|
|
608
|
-
state = get_state(ctx)
|
|
609
|
-
change = TransitionRemove(trans_name=trans_name)
|
|
610
|
-
run_change_and_render(state, change, json_only=json_only)
|
|
611
|
-
state.save()
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
#-----------------------------------------------------------------------------
|
|
615
|
-
# Artifact Mapping
|
|
616
|
-
#-----------------------------------------------------------------------------
|