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.
Files changed (153) hide show
  1. speclogician/agent/funcs.py +29 -0
  2. speclogician/cmd/agent_cmd.py +89 -0
  3. speclogician/cmd/data_cmd.py +24 -0
  4. speclogician/cmd/model_cmd.py +42 -0
  5. speclogician/cmd/overlay_cmd.py +30 -0
  6. speclogician/cmd/scenario_cmd.py +61 -0
  7. speclogician/cmd/state_cmd.py +52 -0
  8. speclogician/data/artifact.py +8 -50
  9. speclogician/data/container.py +18 -384
  10. speclogician/data/mapping.py +18 -17
  11. speclogician/data/refs.py +12 -11
  12. speclogician/data/reports.py +11 -0
  13. speclogician/data/traces.py +15 -6
  14. speclogician/llms/llmtools.py +102 -0
  15. speclogician/llms/overlay.py +264 -0
  16. speclogician/main.py +36 -102
  17. speclogician/modeling/__init__.py +0 -31
  18. speclogician/modeling/component.py +4 -60
  19. speclogician/modeling/conflict.py +5 -19
  20. speclogician/modeling/domain.py +93 -280
  21. speclogician/modeling/model.py +206 -0
  22. speclogician/modeling/predicates.py +20 -22
  23. speclogician/modeling/report.py +33 -0
  24. speclogician/modeling/scenario.py +119 -87
  25. speclogician/sl_cmd.py +76 -0
  26. speclogician/state/change.py +98 -378
  27. speclogician/state/state.py +183 -399
  28. speclogician/tui/box.tcss +10 -0
  29. speclogician/tui/tui.py +131 -0
  30. speclogician/utils/__init__.py +1 -70
  31. speclogician/utils/imx.py +195 -0
  32. speclogician/utils/load.py +25 -147
  33. speclogician/utils/prompt.md +1 -325
  34. speclogician-0.0.0.dev1.dist-info/METADATA +21 -0
  35. speclogician-0.0.0.dev1.dist-info/RECORD +43 -0
  36. speclogician/commands/__init__.py +0 -15
  37. speclogician/commands/cmd_ch.py +0 -616
  38. speclogician/commands/cmd_find.py +0 -256
  39. speclogician/commands/cmd_view.py +0 -202
  40. speclogician/commands/runner.py +0 -149
  41. speclogician/commands/utils.py +0 -101
  42. speclogician/demos/.DS_Store +0 -0
  43. speclogician/demos/cmd_demo.py +0 -278
  44. speclogician/demos/loader.py +0 -135
  45. speclogician/demos/model.py +0 -27
  46. speclogician/demos/runner.py +0 -51
  47. speclogician/logic/__init__.py +0 -11
  48. speclogician/logic/api/__init__.py +0 -29
  49. speclogician/logic/api/client.py +0 -606
  50. speclogician/logic/api/decomp.py +0 -67
  51. speclogician/logic/api/scenario.py +0 -102
  52. speclogician/logic/api/traces.py +0 -59
  53. speclogician/logic/lib/__init__.py +0 -19
  54. speclogician/logic/lib/complement.py +0 -107
  55. speclogician/logic/lib/domain_model.py +0 -59
  56. speclogician/logic/lib/predicates.py +0 -151
  57. speclogician/logic/lib/scenarios.py +0 -369
  58. speclogician/logic/lib/traces.py +0 -114
  59. speclogician/logic/lib/transitions.py +0 -104
  60. speclogician/logic/main.py +0 -246
  61. speclogician/logic/strings.py +0 -194
  62. speclogician/logic/utils.py +0 -135
  63. speclogician/modeling/complement.py +0 -104
  64. speclogician/modeling/spec.py +0 -306
  65. speclogician/modeling/spec_stats.py +0 -39
  66. speclogician/presentation/api.py +0 -244
  67. speclogician/presentation/builders/_links.py +0 -44
  68. speclogician/presentation/builders/container.py +0 -53
  69. speclogician/presentation/builders/data_artifact.py +0 -42
  70. speclogician/presentation/builders/domain.py +0 -54
  71. speclogician/presentation/builders/instances_list.py +0 -38
  72. speclogician/presentation/builders/predicate.py +0 -51
  73. speclogician/presentation/builders/recommendations.py +0 -41
  74. speclogician/presentation/builders/scenario.py +0 -41
  75. speclogician/presentation/builders/scenario_complement.py +0 -82
  76. speclogician/presentation/builders/smart_find.py +0 -39
  77. speclogician/presentation/builders/spec.py +0 -39
  78. speclogician/presentation/builders/state_diff.py +0 -150
  79. speclogician/presentation/builders/state_instance.py +0 -42
  80. speclogician/presentation/builders/state_instance_summary.py +0 -84
  81. speclogician/presentation/builders/trace.py +0 -58
  82. speclogician/presentation/ctx.py +0 -38
  83. speclogician/presentation/models/container.py +0 -44
  84. speclogician/presentation/models/data_artifact.py +0 -33
  85. speclogician/presentation/models/domain.py +0 -50
  86. speclogician/presentation/models/instances_list.py +0 -23
  87. speclogician/presentation/models/predicate.py +0 -60
  88. speclogician/presentation/models/recommendations.py +0 -34
  89. speclogician/presentation/models/scenario.py +0 -31
  90. speclogician/presentation/models/scenario_complement.py +0 -40
  91. speclogician/presentation/models/smart_find.py +0 -34
  92. speclogician/presentation/models/spec.py +0 -32
  93. speclogician/presentation/models/state_diff.py +0 -34
  94. speclogician/presentation/models/state_instance.py +0 -31
  95. speclogician/presentation/models/state_instance_summary.py +0 -102
  96. speclogician/presentation/models/trace.py +0 -42
  97. speclogician/presentation/preview/__init__.py +0 -13
  98. speclogician/presentation/preview/cli.py +0 -50
  99. speclogician/presentation/preview/fixtures/__init__.py +0 -205
  100. speclogician/presentation/preview/fixtures/artifact_container.py +0 -150
  101. speclogician/presentation/preview/fixtures/data_artifact.py +0 -144
  102. speclogician/presentation/preview/fixtures/domain_model.py +0 -162
  103. speclogician/presentation/preview/fixtures/instances_list.py +0 -162
  104. speclogician/presentation/preview/fixtures/predicate.py +0 -184
  105. speclogician/presentation/preview/fixtures/scenario.py +0 -84
  106. speclogician/presentation/preview/fixtures/scenario_complement.py +0 -81
  107. speclogician/presentation/preview/fixtures/smart_find.py +0 -140
  108. speclogician/presentation/preview/fixtures/spec.py +0 -95
  109. speclogician/presentation/preview/fixtures/state_diff.py +0 -158
  110. speclogician/presentation/preview/fixtures/state_instance.py +0 -128
  111. speclogician/presentation/preview/fixtures/state_instance_summary.py +0 -80
  112. speclogician/presentation/preview/fixtures/trace.py +0 -206
  113. speclogician/presentation/preview/registry.py +0 -42
  114. speclogician/presentation/renderers/__init__.py +0 -24
  115. speclogician/presentation/renderers/container.py +0 -136
  116. speclogician/presentation/renderers/data_artifact.py +0 -144
  117. speclogician/presentation/renderers/domain.py +0 -123
  118. speclogician/presentation/renderers/instances_list.py +0 -120
  119. speclogician/presentation/renderers/predicate.py +0 -180
  120. speclogician/presentation/renderers/recommendations.py +0 -90
  121. speclogician/presentation/renderers/scenario.py +0 -94
  122. speclogician/presentation/renderers/scenario_complement.py +0 -59
  123. speclogician/presentation/renderers/smart_find.py +0 -307
  124. speclogician/presentation/renderers/spec.py +0 -105
  125. speclogician/presentation/renderers/state_diff.py +0 -102
  126. speclogician/presentation/renderers/state_instance.py +0 -82
  127. speclogician/presentation/renderers/state_instance_summary.py +0 -143
  128. speclogician/presentation/renderers/trace.py +0 -122
  129. speclogician/shell/app.py +0 -170
  130. speclogician/shell/shell_ch.py +0 -263
  131. speclogician/shell/shell_view.py +0 -153
  132. speclogician/state/change_result.py +0 -32
  133. speclogician/state/diff.py +0 -191
  134. speclogician/state/inst.py +0 -574
  135. speclogician/state/recommendation.py +0 -13
  136. speclogician/state/recommender.py +0 -577
  137. speclogician/state/state_stats.py +0 -133
  138. speclogician/tui/__init__.py +0 -0
  139. speclogician/tui/app.py +0 -257
  140. speclogician/tui/app.tcss +0 -160
  141. speclogician/tui/demo.py +0 -45
  142. speclogician/tui/images/speclogician-full.png +0 -0
  143. speclogician/tui/images/speclogician-minimal.png +0 -0
  144. speclogician/tui/main_screen.py +0 -454
  145. speclogician/tui/splash_screen.py +0 -51
  146. speclogician/tui/stats_screen.py +0 -125
  147. speclogician/utils/testing.py +0 -151
  148. speclogician-0.0.0b1.dist-info/METADATA +0 -116
  149. speclogician-0.0.0b1.dist-info/RECORD +0 -139
  150. /speclogician/{presentation → agent}/__init__.py +0 -0
  151. /speclogician/{presentation/builders → cmd}/__init__.py +0 -0
  152. /speclogician/{presentation/models → llms}/__init__.py +0 -0
  153. {speclogician-0.0.0b1.dist-info → speclogician-0.0.0.dev1.dist-info}/WHEEL +0 -0
@@ -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
- #-----------------------------------------------------------------------------