opdev 0.7.0a2__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 (42) hide show
  1. opdev/__init__.py +1 -0
  2. opdev/__main__.py +3 -0
  3. opdev/checks.py +300 -0
  4. opdev/cli.py +459 -0
  5. opdev/commands.py +76 -0
  6. opdev/config.py +278 -0
  7. opdev/document_catalog.py +107 -0
  8. opdev/document_review.py +115 -0
  9. opdev/documents.py +415 -0
  10. opdev/errors.py +5 -0
  11. opdev/files.py +82 -0
  12. opdev/init.py +87 -0
  13. opdev/junit.py +99 -0
  14. opdev/output.py +141 -0
  15. opdev/process.py +145 -0
  16. opdev/providers/__init__.py +1 -0
  17. opdev/providers/gitlab.py +374 -0
  18. opdev/publication.py +209 -0
  19. opdev/reports.py +512 -0
  20. opdev/requirements.py +642 -0
  21. opdev/resources/reports/report.css +158 -0
  22. opdev/resources/reports/report.html +27 -0
  23. opdev/resources/reports/report.js +110 -0
  24. opdev/resources/skills/opdev/SKILL.md +190 -0
  25. opdev/resources/skills/opdev/references/adoption.md +144 -0
  26. opdev/resources/skills/opdev/references/design.md +141 -0
  27. opdev/resources/skills/opdev/references/development.md +294 -0
  28. opdev/resources/skills/opdev/references/engineering.md +206 -0
  29. opdev/resources/skills/opdev/references/planning.md +101 -0
  30. opdev/resources/skills/opdev/references/publication.md +34 -0
  31. opdev/resources/templates/AGENTS.md +7 -0
  32. opdev/resources/templates/CLAUDE.md +6 -0
  33. opdev/resources/templates/guidance.md +36 -0
  34. opdev/snapshot.py +484 -0
  35. opdev/tracking.py +224 -0
  36. opdev/verification.py +234 -0
  37. opdev/version.py +45 -0
  38. opdev-0.7.0a2.dist-info/METADATA +99 -0
  39. opdev-0.7.0a2.dist-info/RECORD +42 -0
  40. opdev-0.7.0a2.dist-info/WHEEL +4 -0
  41. opdev-0.7.0a2.dist-info/entry_points.txt +3 -0
  42. opdev-0.7.0a2.dist-info/licenses/LICENSE +201 -0
opdev/cli.py ADDED
@@ -0,0 +1,459 @@
1
+ """CLI presentation; operations own validation and effects."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import signal
8
+ import sys
9
+ from collections.abc import Sequence
10
+ from importlib.metadata import version
11
+ from pathlib import Path
12
+ from types import FrameType
13
+
14
+ from opdev.checks import check
15
+ from opdev.commands import execute_purpose, list_commands, validate_config
16
+ from opdev.config import load_project
17
+ from opdev.document_catalog import DOCUMENTS
18
+ from opdev.document_review import review as review_documents
19
+ from opdev.documents import validate as validate_documents
20
+ from opdev.errors import OpDevError
21
+ from opdev.files import read_regular
22
+ from opdev.init import initialize
23
+ from opdev.output import print_result
24
+ from opdev.providers.gitlab import GitLab
25
+ from opdev.publication import publish
26
+ from opdev.reports import render
27
+ from opdev.requirements import STATES, load, mutate, query
28
+ from opdev.snapshot import destination, read, save
29
+ from opdev.tracking import KINDS, create_work, inspect_work, reconcile, roadmap, update_work
30
+ from opdev.version import describe
31
+
32
+
33
+ def parser() -> argparse.ArgumentParser:
34
+ root = argparse.ArgumentParser(
35
+ prog="opdev",
36
+ description="OpDev: project checks, requirements, work tracking and guarded publication.",
37
+ )
38
+ root.add_argument(
39
+ "--root", type=Path, default=Path.cwd(), help="Project directory (default: cwd)"
40
+ )
41
+ root.add_argument("--version", action="version", version=f"OpDev {version('opdev')} (Python)")
42
+ commands = root.add_subparsers(dest="operation", required=True)
43
+ check_parser = commands.add_parser("check", help="Plan or run configured checks")
44
+ check_parser.add_argument(
45
+ "--only", action="append", metavar="ID", help="Focused check; repeatable"
46
+ )
47
+ check_parser.add_argument("--report", type=Path, help="Save this run to a new snapshot file")
48
+ report_parser = commands.add_parser("report", help="Render a saved snapshot; no checks run")
49
+ report_parser.add_argument("--input", type=Path, required=True)
50
+ report_parser.add_argument("--format", choices=("markdown", "html"), default="markdown")
51
+ report_parser.add_argument("--output", type=Path, help="New output file; default: stdout")
52
+ init_parser = commands.add_parser(
53
+ "init", help="Create managed files from a reviewed configuration"
54
+ )
55
+ init_parser.add_argument("--config", type=Path, required=True, help="Reviewed YAML file")
56
+ publish_parser = commands.add_parser(
57
+ "publish", help="Verify fixed inputs and run the configured publisher"
58
+ )
59
+ terminal_parsers = [check_parser, init_parser, publish_parser]
60
+ terminal_parsers.append(commands.add_parser("version", help="Inspect package identity"))
61
+ execution_parsers = [check_parser, init_parser, publish_parser]
62
+ purpose_parsers = _add_execution_parsers(commands)
63
+ terminal_parsers.extend(purpose_parsers)
64
+ execution_parsers.extend(purpose_parsers)
65
+ terminal_parsers.append(commands.add_parser("commands", help="List configured commands"))
66
+ config_actions = commands.add_parser("config", help="Inspect configuration").add_subparsers(
67
+ dest="action", required=True
68
+ )
69
+ terminal_parsers.append(
70
+ config_actions.add_parser("validate", help="Validate without execution")
71
+ )
72
+ document_actions = commands.add_parser(
73
+ "documents", help="Inspect the fixed project document contract"
74
+ ).add_subparsers(dest="action", required=True)
75
+ terminal_parsers.append(
76
+ document_actions.add_parser(
77
+ "validate", help="Validate document structure without execution"
78
+ )
79
+ )
80
+ review_parser = document_actions.add_parser(
81
+ "review", help="Compare changed document owners with the selected task scope"
82
+ )
83
+ review_parser.add_argument("--base", required=True, help="Existing local base commit")
84
+ review_parser.add_argument(
85
+ "--allow",
86
+ action="append",
87
+ default=[],
88
+ choices=tuple(DOCUMENTS),
89
+ help="Selected document owner; repeatable, not proof of approval",
90
+ )
91
+ terminal_parsers.append(review_parser)
92
+ terminal_parsers.extend(_add_requirement_parsers(commands))
93
+ terminal_parsers.extend(_add_tracking_parsers(commands))
94
+ roadmap_parser = commands.add_parser("roadmap").add_subparsers(dest="action", required=True)
95
+ terminal_parsers.append(roadmap_parser.add_parser("show"))
96
+ for command in terminal_parsers:
97
+ command.add_argument("--root", type=Path, default=argparse.SUPPRESS)
98
+ command.add_argument("--format", choices=("text", "json"), default="text")
99
+ for command in execution_parsers:
100
+ command.add_argument(
101
+ "--plan", action="store_true", help="Inspect only; no writes or execution"
102
+ )
103
+ return root
104
+
105
+
106
+ def _add_execution_parsers(
107
+ commands: argparse._SubParsersAction[argparse.ArgumentParser],
108
+ ) -> list[argparse.ArgumentParser]:
109
+ terminal_parsers = []
110
+ for purpose in ("build", "test", "run", "lint", "format"):
111
+ command = commands.add_parser(purpose, help=f"Run configured {purpose} commands")
112
+ terminal_parsers.append(command)
113
+ if purpose == "run":
114
+ command.add_argument("target", nargs="?", help="One configured run command ID")
115
+ else:
116
+ command.add_argument("--only", action="append", metavar="ID", help="Select command IDs")
117
+ if purpose == "format":
118
+ command.add_argument(
119
+ "--check", action="store_true", help="Check without formatting edits"
120
+ )
121
+ if purpose == "test":
122
+ command.add_argument("--report", type=Path, help="Save this run to a new snapshot file")
123
+ return terminal_parsers
124
+
125
+
126
+ def _add_requirement_parsers(
127
+ commands: argparse._SubParsersAction[argparse.ArgumentParser],
128
+ ) -> list[argparse.ArgumentParser]:
129
+ terminal_parsers = []
130
+ requirement_actions = None
131
+ for kind in ("requirement", "test"):
132
+ owner = commands if kind == "requirement" else requirement_actions
133
+ assert owner is not None
134
+ group = owner.add_parser(
135
+ kind,
136
+ help=f"Maintain and query {kind} mappings",
137
+ description="Standalone product obligations and direct test mappings. "
138
+ "Hierarchy is explicit; mappings never imply test execution or approval.",
139
+ )
140
+ actions = group.add_subparsers(dest="action", required=True)
141
+ group.set_defaults(record_kind=kind)
142
+ if kind == "requirement":
143
+ requirement_actions = actions
144
+ terminal_parsers.extend(_add_mapping_actions(actions, kind))
145
+ return terminal_parsers
146
+
147
+
148
+ def _add_mapping_actions(
149
+ actions: argparse._SubParsersAction[argparse.ArgumentParser], kind: str
150
+ ) -> list[argparse.ArgumentParser]:
151
+ terminal_parsers = []
152
+ for action in ("add", "update", "delete", "show", "list", "link", "unlink", "gaps"):
153
+ if kind == "test" and action in {"link", "unlink", "gaps"}:
154
+ continue
155
+ command = actions.add_parser(
156
+ action,
157
+ description=(
158
+ "Update only supplied fields; omitted fields, direct links and test selectors "
159
+ "are preserved. Read with show, pass its revision with --if-match, then "
160
+ "read back. On conflict, reread and reconcile before retrying."
161
+ if action == "update"
162
+ else None
163
+ ),
164
+ )
165
+ terminal_parsers.append(command)
166
+ if action not in {"list", "gaps"}:
167
+ command.add_argument("id")
168
+ if action in {"link", "unlink"}:
169
+ command.add_argument("test_id")
170
+ if action in {"add", "update"}:
171
+ _add_mapping_edit_arguments(command, kind, action)
172
+ if action in {"show", "list", "gaps"}:
173
+ _add_mapping_query_arguments(command, kind, action)
174
+ else:
175
+ command.add_argument("--if-match", help="Expected store revision from a query")
176
+ command.add_argument("--plan", action="store_true", help="Validate without writing")
177
+ return terminal_parsers
178
+
179
+
180
+ def _add_mapping_edit_arguments(command: argparse.ArgumentParser, kind: str, action: str) -> None:
181
+ if kind == "requirement":
182
+ command.add_argument("--statement", required=action == "add")
183
+ command.add_argument("--state", choices=STATES)
184
+ parent_group = command.add_mutually_exclusive_group()
185
+ parent_group.add_argument("--parent", help="Existing parent ID; IDs stay stable")
186
+ parent_group.add_argument("--clear-parent", action="store_true")
187
+ command.add_argument("--rationale", help="Why this obligation exists; empty clears")
188
+ source_group = command.add_mutually_exclusive_group()
189
+ source_group.add_argument("--source", dest="sources", action="append")
190
+ source_group.add_argument("--clear-sources", dest="sources", action="store_const", const=[])
191
+ else:
192
+ command.add_argument("--check", required=action == "add")
193
+ command.add_argument("--location", required=action == "add")
194
+ command.add_argument("--result-classname", help="Exact JUnit classname")
195
+ command.add_argument("--result-name", help="Exact JUnit case name")
196
+ command.add_argument("--clear-result", action="store_true")
197
+ command.add_argument(
198
+ "--verifies",
199
+ required=action == "add",
200
+ help="Behavior this particular test is intended to verify",
201
+ )
202
+
203
+
204
+ def _add_mapping_query_arguments(command: argparse.ArgumentParser, kind: str, action: str) -> None:
205
+ command.add_argument("--fields", help="Comma-separated output fields")
206
+ command.add_argument("--limit", type=int, default=50)
207
+ command.add_argument("--offset", type=int, default=0)
208
+ if kind == "requirement":
209
+ command.add_argument(
210
+ "--tests",
211
+ dest="include_tests",
212
+ action="store_true",
213
+ help="Expand directly mapped tests; does not run them",
214
+ )
215
+ if action == "show":
216
+ command.add_argument(
217
+ "--tree",
218
+ action="store_true",
219
+ help="Root and descendants in preorder; paginated, no inherited pass",
220
+ )
221
+ else:
222
+ command.add_argument(
223
+ "--requirements",
224
+ dest="include_requirements",
225
+ action="store_true",
226
+ help="Show directly linked requirement statements",
227
+ )
228
+ if action in {"list", "gaps"}:
229
+ command.add_argument("--check")
230
+ command.add_argument("--search")
231
+ if kind == "requirement":
232
+ command.add_argument("--test", dest="test_id")
233
+ command.add_argument("--state", choices=STATES)
234
+ parent_group = command.add_mutually_exclusive_group()
235
+ parent_group.add_argument("--parent")
236
+ parent_group.add_argument("--roots", action="store_true")
237
+
238
+
239
+ def _add_tracking_parsers(
240
+ commands: argparse._SubParsersAction[argparse.ArgumentParser],
241
+ ) -> list[argparse.ArgumentParser]:
242
+ terminal_parsers = []
243
+ for kind in KINDS:
244
+ group = commands.add_parser(kind, help=f"Maintain configured tracker {kind} records")
245
+ actions = group.add_subparsers(dest="action", required=True)
246
+ for action in ("show", "list", "create", "update", "close", "reopen", "reconcile"):
247
+ command = actions.add_parser(action)
248
+ terminal_parsers.append(command)
249
+ _add_tracking_action_arguments(command, kind, action)
250
+ return terminal_parsers
251
+
252
+
253
+ def _add_tracking_action_arguments(
254
+ command: argparse.ArgumentParser, kind: str, action: str
255
+ ) -> None:
256
+ if action in {"show", "update", "close", "reopen"}:
257
+ command.add_argument("id")
258
+ if action == "list":
259
+ command.add_argument("--state", choices=("all", "open", "closed"), default="all")
260
+ command.add_argument("--limit", type=int, default=50)
261
+ command.add_argument("--offset", type=int, default=0)
262
+ if kind == "issue":
263
+ command.add_argument("--milestone")
264
+ elif kind == "milestone":
265
+ command.add_argument("--phase")
266
+ if action in {"create", "reconcile"}:
267
+ command.add_argument("--key", required=True)
268
+ if action in {"create", "update"}:
269
+ _add_tracking_edit_arguments(command, kind, action)
270
+ if action in {"create", "update", "close", "reopen"}:
271
+ command.add_argument("--plan", action="store_true")
272
+ if action in {"update", "close", "reopen"}:
273
+ command.add_argument("--if-match", required=True)
274
+
275
+
276
+ def _add_tracking_edit_arguments(command: argparse.ArgumentParser, kind: str, action: str) -> None:
277
+ command.add_argument("--title", required=action == "create")
278
+ command.add_argument("--description-file", type=Path, required=action == "create")
279
+ if kind == "milestone":
280
+ command.add_argument("--phase")
281
+ elif kind == "issue":
282
+ command.add_argument("--milestone")
283
+ refs = command.add_mutually_exclusive_group()
284
+ refs.add_argument("--requirement", dest="requirements", action="append")
285
+ refs.add_argument(
286
+ "--clear-requirements", dest="requirements", action="store_const", const=[]
287
+ )
288
+
289
+
290
+ def requirements_command(args: argparse.Namespace) -> dict[str, object]:
291
+ project = load_project(args.root)
292
+ if args.action in {"show", "list", "gaps"}:
293
+ return query(
294
+ project,
295
+ args.record_kind,
296
+ getattr(args, "id", None),
297
+ test_id=getattr(args, "test_id", None),
298
+ check=getattr(args, "check", None),
299
+ state=getattr(args, "state", None),
300
+ search=getattr(args, "search", None),
301
+ fields=args.fields.split(",") if args.fields is not None else None,
302
+ limit=getattr(args, "limit", 50),
303
+ offset=getattr(args, "offset", 0),
304
+ parent=getattr(args, "parent", None),
305
+ roots=getattr(args, "roots", False),
306
+ tree=getattr(args, "tree", False),
307
+ include_tests=getattr(args, "include_tests", False),
308
+ include_requirements=getattr(args, "include_requirements", False),
309
+ gaps=args.action == "gaps",
310
+ )
311
+ return mutate(
312
+ project,
313
+ args.record_kind,
314
+ args.action,
315
+ args.id,
316
+ statement=getattr(args, "statement", None),
317
+ state=getattr(args, "state", None),
318
+ sources=getattr(args, "sources", None),
319
+ parent=getattr(args, "parent", None),
320
+ clear_parent=getattr(args, "clear_parent", False),
321
+ rationale=getattr(args, "rationale", None),
322
+ check=getattr(args, "check", None),
323
+ location=getattr(args, "location", None),
324
+ verifies=getattr(args, "verifies", None),
325
+ result_classname=getattr(args, "result_classname", None),
326
+ result_name=getattr(args, "result_name", None),
327
+ clear_result=getattr(args, "clear_result", False),
328
+ test_id=getattr(args, "test_id", None),
329
+ if_match=args.if_match,
330
+ plan=args.plan,
331
+ )
332
+
333
+
334
+ def interrupt(signum: int, frame: FrameType | None) -> None:
335
+ raise KeyboardInterrupt
336
+
337
+
338
+ def tracking_command(args: argparse.Namespace) -> dict[str, object]:
339
+ project = load_project(args.root)
340
+ if project.tracking is None:
341
+ raise OpDevError(
342
+ "Tracking is not configured. Set tracking.provider, host and project first; "
343
+ "no remote calls made."
344
+ )
345
+ tracker = GitLab(project.tracking, project.root)
346
+ if args.operation == "roadmap":
347
+ return roadmap(tracker)
348
+ if args.action in {"show", "list"}:
349
+ return inspect_work(
350
+ tracker,
351
+ args.operation,
352
+ getattr(args, "id", None),
353
+ state=getattr(args, "state", "all"),
354
+ milestone=getattr(args, "milestone", None),
355
+ phase=getattr(args, "phase", None),
356
+ limit=getattr(args, "limit", 50),
357
+ offset=getattr(args, "offset", 0),
358
+ )
359
+ if args.action == "reconcile":
360
+ return reconcile(tracker, args.operation, args.key)
361
+ fields = {
362
+ k: v
363
+ for k in ("title", "key", "phase", "milestone")
364
+ if (v := getattr(args, k, None)) is not None
365
+ }
366
+ if path := getattr(args, "description_file", None):
367
+ fields["description"] = read_regular(path).decode("utf-8")
368
+ refs = getattr(args, "requirements", None)
369
+ if refs is not None:
370
+ database, _ = load(project)
371
+ if unknown := set(refs) - set(database.requirements):
372
+ raise OpDevError(
373
+ f"Unknown requirement references: {', '.join(sorted(unknown))}. Nothing written."
374
+ )
375
+ fields["requirements"] = tuple(refs)
376
+ if args.action == "create":
377
+ return create_work(tracker, args.operation, fields, plan=args.plan)
378
+ if args.action in {"close", "reopen"}:
379
+ fields["state"] = "closed" if args.action == "close" else "open"
380
+ return update_work(tracker, args.operation, args.id, args.if_match, fields, plan=args.plan)
381
+
382
+
383
+ def _dispatch(args: argparse.Namespace) -> tuple[dict[str, object], int]:
384
+ if args.operation == "version":
385
+ result, code = describe(), 0
386
+ elif args.operation == "init":
387
+ result = initialize(args.root, args.config, plan=args.plan)
388
+ code = 0
389
+ elif args.operation == "requirement":
390
+ result = requirements_command(args)
391
+ code = 0
392
+ elif args.operation in {*KINDS, "roadmap"}:
393
+ result = tracking_command(args)
394
+ code = 0
395
+ elif args.operation == "publish":
396
+ result, code = publish(load_project(args.root), plan=args.plan)
397
+ elif args.operation == "commands":
398
+ result, code = list_commands(load_project(args.root)), 0
399
+ elif args.operation == "documents":
400
+ project = load_project(args.root)
401
+ result = (
402
+ review_documents(project, args.base, args.allow)
403
+ if args.action == "review"
404
+ else validate_documents(project)
405
+ )
406
+ code = 0 if result["status"] in {"valid", "within_selected_scope"} else 1
407
+ elif args.operation == "config":
408
+ result, code = validate_config(load_project(args.root)), 0
409
+ else:
410
+ return _execution_command(args)
411
+ return result, code
412
+
413
+
414
+ def _execution_command(args: argparse.Namespace) -> tuple[dict[str, object], int]:
415
+ if args.operation in {"build", "test", "run", "lint", "format"}:
416
+ purpose = "format-check" if args.operation == "format" and args.check else args.operation
417
+ only = ([args.target] if args.target else None) if args.operation == "run" else args.only
418
+ report = execute_purpose(
419
+ load_project(args.root),
420
+ purpose,
421
+ only,
422
+ plan=args.plan,
423
+ report_path=getattr(args, "report", None),
424
+ )
425
+ return report.to_dict(), report.exit_code
426
+ else:
427
+ report = check(load_project(args.root), args.only, plan=args.plan, report_path=args.report)
428
+ return report.to_dict(), report.exit_code
429
+
430
+
431
+ def main(argv: Sequence[str] | None = None) -> int:
432
+ args = parser().parse_args(argv)
433
+ previous = signal.signal(signal.SIGTERM, interrupt)
434
+ try:
435
+ if args.operation == "report":
436
+ output = destination(args.output) if args.output else None
437
+ content = render(*read(args.input), format=args.format)
438
+ if output:
439
+ save(output, content)
440
+ else:
441
+ print(content, end="")
442
+ return 0
443
+ result, code = _dispatch(args)
444
+ print_result(result, args.format)
445
+ return code
446
+ except (OpDevError, OSError, ValueError) as exc:
447
+ if args.format == "json":
448
+ print(json.dumps({"operation": args.operation, "status": "error", "detail": str(exc)}))
449
+ else:
450
+ print(f"opdev: {exc}", file=sys.stderr)
451
+ return 2
452
+ except KeyboardInterrupt:
453
+ if args.format == "json":
454
+ print(json.dumps({"operation": args.operation, "status": "interrupted"}))
455
+ else:
456
+ print("opdev: interrupted; completion is not verified.", file=sys.stderr)
457
+ return 130
458
+ finally:
459
+ signal.signal(signal.SIGTERM, previous)
opdev/commands.py ADDED
@@ -0,0 +1,76 @@
1
+ """Select configured command purposes and inspect settings; no task graph or tool guessing."""
2
+
3
+ from dataclasses import asdict
4
+ from pathlib import Path
5
+
6
+ from opdev.checks import CheckReport, run_checks
7
+ from opdev.config import Project
8
+ from opdev.errors import OpDevError
9
+ from opdev.requirements import load, revision
10
+
11
+
12
+ def execute_purpose(
13
+ project: Project,
14
+ purpose: str,
15
+ only: list[str] | None = None,
16
+ *,
17
+ plan: bool = False,
18
+ report_path: Path | None = None,
19
+ ) -> CheckReport:
20
+ available = tuple(name for name, item in project.commands.items() if item.purpose == purpose)
21
+ selected = tuple(dict.fromkeys(only)) if only is not None else available
22
+ if not selected:
23
+ raise OpDevError(
24
+ f"No {purpose} commands configured. Set the command purpose explicitly; nothing ran."
25
+ )
26
+ if any(name not in available for name in selected):
27
+ raise OpDevError(f"Select only declared {purpose} command IDs; nothing ran.")
28
+ if purpose == "run" and len(selected) != 1:
29
+ raise OpDevError("Multiple run targets configured. Select one with opdev run TARGET.")
30
+ report = run_checks(
31
+ project, selected, purpose, plan=plan, operation=purpose, report_path=report_path
32
+ )
33
+ report.detail = "Selected commands only; full verification is not established. " + report.detail
34
+ return report
35
+
36
+
37
+ def list_commands(project: Project) -> dict[str, object]:
38
+ publisher = project.publication.command if project.publication else None
39
+ prerequisites = project.publication.prerequisites if project.publication else ()
40
+ return {
41
+ "operation": "commands",
42
+ "status": "read",
43
+ "scope": "configuration",
44
+ "config_sha256": project.digest,
45
+ "records": [
46
+ {
47
+ "id": name,
48
+ **asdict(command),
49
+ "required_check": name in project.checks,
50
+ "required_order": project.checks.index(name) + 1
51
+ if name in project.checks
52
+ else None,
53
+ "publisher": name == publisher,
54
+ "publication_prerequisite": name in prerequisites,
55
+ }
56
+ for name, command in project.commands.items()
57
+ ],
58
+ "detail": "Configured commands only. No commands ran; tools were not installed or probed.",
59
+ }
60
+
61
+
62
+ def validate_config(project: Project) -> dict[str, object]:
63
+ database, raw = load(project)
64
+ return {
65
+ "operation": "config validate",
66
+ "status": "valid",
67
+ "scope": "configuration",
68
+ "config_sha256": project.digest,
69
+ "revision": revision(raw),
70
+ "store_exists": raw is not None,
71
+ "records": [{"requirements": len(database.requirements), "tests": len(database.tests)}],
72
+ "detail": (
73
+ "Configuration and existing requirements references are valid. No commands ran; "
74
+ "tool availability, test adequacy and design approval are not verified."
75
+ ),
76
+ }