opdev 0.7.0a2__tar.gz → 0.7.0a3__tar.gz

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 (70) hide show
  1. opdev-0.7.0a3/PKG-INFO +96 -0
  2. opdev-0.7.0a3/README.md +78 -0
  3. {opdev-0.7.0a2 → opdev-0.7.0a3}/pyproject.toml +4 -4
  4. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/checks.py +16 -3
  5. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/cli.py +88 -16
  6. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/config.py +5 -2
  7. opdev-0.7.0a3/src/opdev/delegation.py +289 -0
  8. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/document_review.py +67 -9
  9. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/output.py +14 -6
  10. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/process.py +9 -3
  11. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/providers/gitlab.py +185 -28
  12. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/reports.py +22 -7
  13. opdev-0.7.0a3/src/opdev/resources/plugin_launcher.py +202 -0
  14. opdev-0.7.0a3/src/opdev/resources/skills/opdev/SKILL.md +41 -0
  15. opdev-0.7.0a3/src/opdev/resources/skills/opdev/references/runtime.md +23 -0
  16. opdev-0.7.0a3/src/opdev/resources/skills/opdev-adopt/SKILL.md +53 -0
  17. opdev-0.7.0a3/src/opdev/resources/skills/opdev-capture-issue/SKILL.md +51 -0
  18. opdev-0.7.0a3/src/opdev/resources/skills/opdev-change-scope/SKILL.md +66 -0
  19. opdev-0.7.0a3/src/opdev/resources/skills/opdev-check/SKILL.md +63 -0
  20. opdev-0.7.0a3/src/opdev/resources/skills/opdev-choose-execution/SKILL.md +17 -0
  21. opdev-0.7.0a3/src/opdev/resources/skills/opdev-design/SKILL.md +44 -0
  22. opdev-0.7.0a3/src/opdev/resources/skills/opdev-handoff/SKILL.md +73 -0
  23. opdev-0.7.0a3/src/opdev/resources/skills/opdev-implement/SKILL.md +48 -0
  24. opdev-0.7.0a3/src/opdev/resources/skills/opdev-integrate/SKILL.md +54 -0
  25. opdev-0.7.0a3/src/opdev/resources/skills/opdev-maintain-documents/SKILL.md +46 -0
  26. opdev-0.7.0a3/src/opdev/resources/skills/opdev-maintain-documents/references/catalog.md +30 -0
  27. opdev-0.7.0a3/src/opdev/resources/skills/opdev-maintain-documents/references/migration.md +43 -0
  28. opdev-0.7.0a3/src/opdev/resources/skills/opdev-map-requirements/SKILL.md +59 -0
  29. opdev-0.7.0a3/src/opdev/resources/skills/opdev-plan-issue/SKILL.md +57 -0
  30. opdev-0.7.0a3/src/opdev/resources/skills/opdev-plan-roadmap/SKILL.md +58 -0
  31. opdev-0.7.0a3/src/opdev/resources/skills/opdev-product-discovery/SKILL.md +24 -0
  32. opdev-0.7.0a3/src/opdev/resources/skills/opdev-publish/SKILL.md +52 -0
  33. opdev-0.7.0a3/src/opdev/resources/skills/opdev-quality-policy/SKILL.md +35 -0
  34. opdev-0.7.0a3/src/opdev/resources/skills/opdev-render-report/SKILL.md +42 -0
  35. opdev-0.7.0a3/src/opdev/resources/skills/opdev-review-assertions/SKILL.md +35 -0
  36. opdev-0.7.0a3/src/opdev/resources/skills/opdev-review-assertions/references/reviewer.md +20 -0
  37. opdev-0.7.0a3/src/opdev/resources/skills/opdev-review-boundaries/SKILL.md +40 -0
  38. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/snapshot.py +114 -10
  39. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/tracking.py +20 -1
  40. opdev-0.7.0a3/src/opdev/version.py +61 -0
  41. opdev-0.7.0a2/PKG-INFO +0 -99
  42. opdev-0.7.0a2/README.md +0 -81
  43. opdev-0.7.0a2/src/opdev/resources/skills/opdev/SKILL.md +0 -190
  44. opdev-0.7.0a2/src/opdev/resources/skills/opdev/references/adoption.md +0 -144
  45. opdev-0.7.0a2/src/opdev/resources/skills/opdev/references/design.md +0 -141
  46. opdev-0.7.0a2/src/opdev/resources/skills/opdev/references/development.md +0 -294
  47. opdev-0.7.0a2/src/opdev/resources/skills/opdev/references/engineering.md +0 -206
  48. opdev-0.7.0a2/src/opdev/resources/skills/opdev/references/planning.md +0 -101
  49. opdev-0.7.0a2/src/opdev/resources/skills/opdev/references/publication.md +0 -34
  50. opdev-0.7.0a2/src/opdev/version.py +0 -45
  51. {opdev-0.7.0a2 → opdev-0.7.0a3}/LICENSE +0 -0
  52. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/__init__.py +0 -0
  53. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/__main__.py +0 -0
  54. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/commands.py +0 -0
  55. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/document_catalog.py +0 -0
  56. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/documents.py +0 -0
  57. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/errors.py +0 -0
  58. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/files.py +0 -0
  59. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/init.py +0 -0
  60. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/junit.py +0 -0
  61. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/providers/__init__.py +0 -0
  62. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/publication.py +0 -0
  63. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/requirements.py +0 -0
  64. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/resources/reports/report.css +0 -0
  65. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/resources/reports/report.html +0 -0
  66. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/resources/reports/report.js +0 -0
  67. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/resources/templates/AGENTS.md +0 -0
  68. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/resources/templates/CLAUDE.md +0 -0
  69. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/resources/templates/guidance.md +0 -0
  70. {opdev-0.7.0a2 → opdev-0.7.0a3}/src/opdev/verification.py +0 -0
opdev-0.7.0a3/PKG-INFO ADDED
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: opdev
3
+ Version: 0.7.0a3
4
+ Summary: Configuration-driven software development workflow CLI
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Dist: pyyaml>=6.0.2,<7
10
+ Requires-Dist: defusedxml>=0.7.1,<1
11
+ Requires-Dist: markdown-it-py>=4,<5
12
+ Requires-Dist: psutil>=7,<8
13
+ Requires-Python: >=3.12
14
+ Project-URL: Documentation, https://gitlab.com/stolenfootball/opdev/-/blob/main/README.md
15
+ Project-URL: Issues, https://gitlab.com/stolenfootball/opdev/-/issues
16
+ Project-URL: Source, https://gitlab.com/stolenfootball/opdev
17
+ Description-Content-Type: text/markdown
18
+
19
+ # OpDev
20
+
21
+ OpDev is a development workflow for **Codex and Claude Code**. Work with your
22
+ coding agent to turn an idea into an agreed design, plan useful milestones, and
23
+ implement them with explicit requirements and checks.
24
+
25
+ You describe what you want and make the consequential decisions. The plugin guides
26
+ the agent; OpDev's Python CLI runs the configured tools, queries requirement-to-test
27
+ mappings and manages work in GitLab. Your application can use any language.
28
+
29
+ ## Start with the plugin
30
+
31
+ 1. [Install OpDev in your agent host](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/integrations.md#agent-hosts).
32
+ 2. Open your project in a fresh agent session and ask:
33
+
34
+ > Use OpDev to help me build this project. Start by understanding what I want,
35
+ > then propose a design for me to review before implementation.
36
+
37
+ 3. Review the product design, user interactions and technical choices. The agent
38
+ then helps you agree a phased plan with a useful early milestone.
39
+
40
+ For existing software, start with **“Adopt OpDev in this repository. Preserve
41
+ existing behavior and approved decisions.”** Installing the plugin does not adopt
42
+ a project; the agent inspects it and brings unresolved choices to you.
43
+
44
+ [Getting started](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/getting-started.md)
45
+ walks through that first session. You do not need to learn the command-line
46
+ interface to use the workflow; the agent invokes it for you.
47
+
48
+ **Distribution:** OpDev **0.7.0a3** bundles its matching CLI in the host archive.
49
+ The [installation guide](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/integrations.md#choose-your-package)
50
+ links to the archive and the optional standalone CLI. No public OpDev marketplace is configured yet.
51
+
52
+ OpDev is alpha software under
53
+ [Apache-2.0](https://gitlab.com/stolenfootball/opdev/-/blob/main/LICENSE).
54
+ Claude Code package validation has passed; **Claude behavioral testing remains
55
+ unverified**. The earlier Rust implementation is
56
+ [archived](https://gitlab.com/stolenfootball/opdev-legacy);
57
+ existing Rust projects need a reviewed migration.
58
+
59
+ ## How it fits your project
60
+
61
+ - **Configure once.** Define command arguments, directories and timeouts in
62
+ `.opdev/project.yaml`. Use your existing formatter, linter, test runner and build tools.
63
+ - **Check the right scope.** Use focused checks while iterating and `opdev check`
64
+ for every required check before integration. Native CI enforces remote checks.
65
+ - **Keep requirements concrete.** Store product obligations and direct test links
66
+ in `.opdev/requirements.json`; query the records you need through the CLI.
67
+ - **Track work remotely.** Keep phases, milestones, issues and progress in GitLab.
68
+ Keep current designs and requirements in Git, without a local backlog or evidence ledger.
69
+ - **Publish deliberately.** After explicit authorization, `opdev publish` runs
70
+ fresh checks against fixed inputs before invoking your configured publisher.
71
+
72
+ OpDev reports command outcomes and, with [JUnit validation](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/checks.md#validate-individual-tests-with-junit),
73
+ individual reported test results matched to explicit requirement mappings. It cannot
74
+ prove assertion adequacy or developer approval, or sandbox untrusted repository
75
+ commands. Those distinctions remain visible in its reports and workflow.
76
+
77
+ ## User documentation
78
+
79
+ | I want to... | Read |
80
+ | --- | --- |
81
+ | Start a project with my coding agent | [Getting started](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/getting-started.md) |
82
+ | Define tools and required checks | [Configuration](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/configuration.md) |
83
+ | Maintain development decisions and validate their structure | [Development documents](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/documentation.md) |
84
+ | Look up commands for direct use or CI | [Development commands](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/commands.md) |
85
+ | Preview checks and understand failures | [Checks](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/checks.md) |
86
+ | Record requirements and link tests | [Requirements](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/requirements.md) |
87
+ | Export a run for review or audit | [Verification reports](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/reports.md) |
88
+ | Manage phases, milestones and issues | [Work tracking](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/work-tracking.md) |
89
+ | Verify inputs before publication | [Publication](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/publication.md) |
90
+ | Connect Codex, Claude Code or CI | [Integrations](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/integrations.md) |
91
+
92
+ These guides are OpDev's manual. OpDev does not create, organize or enforce user
93
+ documentation in your project; its content and location are your choice.
94
+
95
+ To contribute to OpDev, start with [.opdev/guidance.md](https://gitlab.com/stolenfootball/opdev/-/blob/main/.opdev/guidance.md).
96
+ Implementation plans and progress belong in [GitLab issues](https://gitlab.com/stolenfootball/opdev/-/issues).
@@ -0,0 +1,78 @@
1
+ # OpDev
2
+
3
+ OpDev is a development workflow for **Codex and Claude Code**. Work with your
4
+ coding agent to turn an idea into an agreed design, plan useful milestones, and
5
+ implement them with explicit requirements and checks.
6
+
7
+ You describe what you want and make the consequential decisions. The plugin guides
8
+ the agent; OpDev's Python CLI runs the configured tools, queries requirement-to-test
9
+ mappings and manages work in GitLab. Your application can use any language.
10
+
11
+ ## Start with the plugin
12
+
13
+ 1. [Install OpDev in your agent host](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/integrations.md#agent-hosts).
14
+ 2. Open your project in a fresh agent session and ask:
15
+
16
+ > Use OpDev to help me build this project. Start by understanding what I want,
17
+ > then propose a design for me to review before implementation.
18
+
19
+ 3. Review the product design, user interactions and technical choices. The agent
20
+ then helps you agree a phased plan with a useful early milestone.
21
+
22
+ For existing software, start with **“Adopt OpDev in this repository. Preserve
23
+ existing behavior and approved decisions.”** Installing the plugin does not adopt
24
+ a project; the agent inspects it and brings unresolved choices to you.
25
+
26
+ [Getting started](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/getting-started.md)
27
+ walks through that first session. You do not need to learn the command-line
28
+ interface to use the workflow; the agent invokes it for you.
29
+
30
+ **Distribution:** OpDev **0.7.0a3** bundles its matching CLI in the host archive.
31
+ The [installation guide](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/integrations.md#choose-your-package)
32
+ links to the archive and the optional standalone CLI. No public OpDev marketplace is configured yet.
33
+
34
+ OpDev is alpha software under
35
+ [Apache-2.0](https://gitlab.com/stolenfootball/opdev/-/blob/main/LICENSE).
36
+ Claude Code package validation has passed; **Claude behavioral testing remains
37
+ unverified**. The earlier Rust implementation is
38
+ [archived](https://gitlab.com/stolenfootball/opdev-legacy);
39
+ existing Rust projects need a reviewed migration.
40
+
41
+ ## How it fits your project
42
+
43
+ - **Configure once.** Define command arguments, directories and timeouts in
44
+ `.opdev/project.yaml`. Use your existing formatter, linter, test runner and build tools.
45
+ - **Check the right scope.** Use focused checks while iterating and `opdev check`
46
+ for every required check before integration. Native CI enforces remote checks.
47
+ - **Keep requirements concrete.** Store product obligations and direct test links
48
+ in `.opdev/requirements.json`; query the records you need through the CLI.
49
+ - **Track work remotely.** Keep phases, milestones, issues and progress in GitLab.
50
+ Keep current designs and requirements in Git, without a local backlog or evidence ledger.
51
+ - **Publish deliberately.** After explicit authorization, `opdev publish` runs
52
+ fresh checks against fixed inputs before invoking your configured publisher.
53
+
54
+ OpDev reports command outcomes and, with [JUnit validation](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/checks.md#validate-individual-tests-with-junit),
55
+ individual reported test results matched to explicit requirement mappings. It cannot
56
+ prove assertion adequacy or developer approval, or sandbox untrusted repository
57
+ commands. Those distinctions remain visible in its reports and workflow.
58
+
59
+ ## User documentation
60
+
61
+ | I want to... | Read |
62
+ | --- | --- |
63
+ | Start a project with my coding agent | [Getting started](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/getting-started.md) |
64
+ | Define tools and required checks | [Configuration](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/configuration.md) |
65
+ | Maintain development decisions and validate their structure | [Development documents](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/documentation.md) |
66
+ | Look up commands for direct use or CI | [Development commands](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/commands.md) |
67
+ | Preview checks and understand failures | [Checks](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/checks.md) |
68
+ | Record requirements and link tests | [Requirements](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/requirements.md) |
69
+ | Export a run for review or audit | [Verification reports](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/reports.md) |
70
+ | Manage phases, milestones and issues | [Work tracking](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/work-tracking.md) |
71
+ | Verify inputs before publication | [Publication](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/publication.md) |
72
+ | Connect Codex, Claude Code or CI | [Integrations](https://gitlab.com/stolenfootball/opdev/-/blob/main/docs/integrations.md) |
73
+
74
+ These guides are OpDev's manual. OpDev does not create, organize or enforce user
75
+ documentation in your project; its content and location are your choice.
76
+
77
+ To contribute to OpDev, start with [.opdev/guidance.md](https://gitlab.com/stolenfootball/opdev/-/blob/main/.opdev/guidance.md).
78
+ Implementation plans and progress belong in [GitLab issues](https://gitlab.com/stolenfootball/opdev/-/issues).
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "opdev"
3
- version = "0.7.0a2"
3
+ version = "0.7.0a3"
4
4
  description = "Configuration-driven software development workflow CLI"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -15,9 +15,9 @@ dependencies = [
15
15
  ]
16
16
 
17
17
  [project.urls]
18
- Source = "https://gitlab.com/stolenfootball-tools/opdev"
19
- Documentation = "https://gitlab.com/stolenfootball-tools/opdev/-/blob/main/README.md"
20
- Issues = "https://gitlab.com/stolenfootball-tools/opdev/-/issues"
18
+ Source = "https://gitlab.com/stolenfootball/opdev"
19
+ Documentation = "https://gitlab.com/stolenfootball/opdev/-/blob/main/README.md"
20
+ Issues = "https://gitlab.com/stolenfootball/opdev/-/issues"
21
21
 
22
22
  [project.scripts]
23
23
  opdev = "opdev.cli:main"
@@ -55,11 +55,14 @@ class CheckReport:
55
55
  verification: Assessment | None = None
56
56
  commands_status: str = "not_run"
57
57
  documents: dict[str, Any] | None = None
58
+ check_snapshot: dict[str, str] | None = None
58
59
 
59
60
  def to_dict(self) -> dict[str, object]:
60
61
  result = asdict(self)
61
62
  if self.operation != "check":
62
63
  result["commands"] = result.pop("checks")
64
+ if self.check_snapshot is None:
65
+ result.pop("check_snapshot")
63
66
  return result
64
67
 
65
68
  @property
@@ -81,7 +84,12 @@ def check(
81
84
  *,
82
85
  plan: bool = False,
83
86
  report_path: Path | None = None,
87
+ bind_inputs: list[str] | None = None,
84
88
  ) -> CheckReport:
89
+ if bind_inputs is not None and (only is None or report_path is None or plan):
90
+ raise OpDevError(
91
+ "--bind-input requires a focused --only check with --report and no --plan."
92
+ )
85
93
  selected = tuple(dict.fromkeys(only)) if only is not None else project.checks
86
94
  return run_checks(
87
95
  project,
@@ -89,6 +97,7 @@ def check(
89
97
  "focused" if only is not None else "full",
90
98
  plan=plan,
91
99
  report_path=report_path,
100
+ bind_inputs=bind_inputs,
92
101
  )
93
102
 
94
103
 
@@ -100,6 +109,7 @@ def run_checks(
100
109
  plan: bool = False,
101
110
  operation: str = "check",
102
111
  report_path: Path | None = None,
112
+ bind_inputs: list[str] | None = None,
103
113
  ) -> CheckReport:
104
114
  _validate_selection(project, selected, operation, plan, report_path)
105
115
  results = [
@@ -121,7 +131,7 @@ def run_checks(
121
131
  )
122
132
  if plan:
123
133
  return report
124
- capture = Capture(project, report_path) if report_path is not None else None
134
+ capture = Capture(project, report_path, bind_inputs) if report_path is not None else None
125
135
  database: Database | None = None
126
136
  mapping_raw = None
127
137
  if (
@@ -163,7 +173,7 @@ def run_checks(
163
173
  operation == "check" and report.scope == "full" and report.status == "passed"
164
174
  )
165
175
  if capture:
166
- capture.finish(report)
176
+ report.check_snapshot = capture.finish(report)
167
177
  return report
168
178
 
169
179
 
@@ -224,7 +234,10 @@ def _run_command(
224
234
  with (
225
235
  TemporaryDirectory(prefix="opdev-junit-") if result.test_results else nullcontext()
226
236
  ) as directory:
227
- path = Path(directory) / "results.xml" if directory else None
237
+ # The OS temp directory may be reached through a platform alias such as
238
+ # macOS /var -> /private/var. Canonicalize our own directory before
239
+ # passing a path to the runner; read_regular still rejects a linked report.
240
+ path = Path(directory).resolve(strict=True) / "results.xml" if directory else None
228
241
  if path is not None:
229
242
  result.argv = tuple(arg.replace(JUNIT_PATH, str(path)) for arg in result.argv)
230
243
  outcome = (
@@ -14,6 +14,8 @@ from types import FrameType
14
14
  from opdev.checks import check
15
15
  from opdev.commands import execute_purpose, list_commands, validate_config
16
16
  from opdev.config import load_project
17
+ from opdev.delegation import SPEC_HELP
18
+ from opdev.delegation import prepare as prepare_delegation
17
19
  from opdev.document_catalog import DOCUMENTS
18
20
  from opdev.document_review import review as review_documents
19
21
  from opdev.documents import validate as validate_documents
@@ -26,8 +28,16 @@ from opdev.publication import publish
26
28
  from opdev.reports import render
27
29
  from opdev.requirements import STATES, load, mutate, query
28
30
  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
+ from opdev.tracking import (
32
+ ISSUE_TYPES,
33
+ KINDS,
34
+ create_work,
35
+ inspect_work,
36
+ reconcile,
37
+ roadmap,
38
+ update_work,
39
+ )
40
+ from opdev.version import describe, verify_binding
31
41
 
32
42
 
33
43
  def parser() -> argparse.ArgumentParser:
@@ -39,12 +49,24 @@ def parser() -> argparse.ArgumentParser:
39
49
  "--root", type=Path, default=Path.cwd(), help="Project directory (default: cwd)"
40
50
  )
41
51
  root.add_argument("--version", action="version", version=f"OpDev {version('opdev')} (Python)")
52
+ root.add_argument(
53
+ "--expect-runtime",
54
+ action="append",
55
+ metavar="IMPLEMENTATION:VERSION:WORKFLOW_SHA256",
56
+ help="Bind this operation to the selected runtime (before the subcommand)",
57
+ )
42
58
  commands = root.add_subparsers(dest="operation", required=True)
43
59
  check_parser = commands.add_parser("check", help="Plan or run configured checks")
44
60
  check_parser.add_argument(
45
61
  "--only", action="append", metavar="ID", help="Focused check; repeatable"
46
62
  )
47
63
  check_parser.add_argument("--report", type=Path, help="Save this run to a new snapshot file")
64
+ check_parser.add_argument(
65
+ "--bind-input",
66
+ action="append",
67
+ metavar="PATH",
68
+ help="Bind a project-relative input to a focused report; repeat for each input",
69
+ )
48
70
  report_parser = commands.add_parser("report", help="Render a saved snapshot; no checks run")
49
71
  report_parser.add_argument("--input", type=Path, required=True)
50
72
  report_parser.add_argument("--format", choices=("markdown", "html"), default="markdown")
@@ -58,6 +80,18 @@ def parser() -> argparse.ArgumentParser:
58
80
  )
59
81
  terminal_parsers = [check_parser, init_parser, publish_parser]
60
82
  terminal_parsers.append(commands.add_parser("version", help="Inspect package identity"))
83
+ delegation_actions = commands.add_parser(
84
+ "delegation", help="Prepare native-worker briefs; never start workers"
85
+ ).add_subparsers(dest="action", required=True)
86
+ delegation_parser = delegation_actions.add_parser(
87
+ "prepare",
88
+ help="Validate a declared runtime and exclusive paths, then write external briefs",
89
+ description=SPEC_HELP,
90
+ formatter_class=argparse.RawDescriptionHelpFormatter,
91
+ )
92
+ delegation_parser.add_argument("--spec", type=Path, required=True)
93
+ delegation_parser.add_argument("--output-dir", type=Path, required=True)
94
+ terminal_parsers.append(delegation_parser)
61
95
  execution_parsers = [check_parser, init_parser, publish_parser]
62
96
  purpose_parsers = _add_execution_parsers(commands)
63
97
  terminal_parsers.extend(purpose_parsers)
@@ -81,6 +115,11 @@ def parser() -> argparse.ArgumentParser:
81
115
  "review", help="Compare changed document owners with the selected task scope"
82
116
  )
83
117
  review_parser.add_argument("--base", required=True, help="Existing local base commit")
118
+ review_parser.add_argument(
119
+ "--check-report",
120
+ type=Path,
121
+ help="Compare a saved check's declared inputs without running it",
122
+ )
84
123
  review_parser.add_argument(
85
124
  "--allow",
86
125
  action="append",
@@ -261,6 +300,7 @@ def _add_tracking_action_arguments(
261
300
  command.add_argument("--offset", type=int, default=0)
262
301
  if kind == "issue":
263
302
  command.add_argument("--milestone")
303
+ command.add_argument("--type", dest="issue_type", choices=ISSUE_TYPES)
264
304
  elif kind == "milestone":
265
305
  command.add_argument("--phase")
266
306
  if action in {"create", "reconcile"}:
@@ -280,6 +320,7 @@ def _add_tracking_edit_arguments(command: argparse.ArgumentParser, kind: str, ac
280
320
  command.add_argument("--phase")
281
321
  elif kind == "issue":
282
322
  command.add_argument("--milestone")
323
+ command.add_argument("--type", dest="issue_type", choices=ISSUE_TYPES)
283
324
  refs = command.add_mutually_exclusive_group()
284
325
  refs.add_argument("--requirement", dest="requirements", action="append")
285
326
  refs.add_argument(
@@ -288,8 +329,11 @@ def _add_tracking_edit_arguments(command: argparse.ArgumentParser, kind: str, ac
288
329
 
289
330
 
290
331
  def requirements_command(args: argparse.Namespace) -> dict[str, object]:
332
+ reading = args.action in {"show", "list", "gaps"}
333
+ if not reading and args.expect_runtime is not None and not args.if_match:
334
+ raise OpDevError("Managed catalog edits require --if-match from an observed revision.")
291
335
  project = load_project(args.root)
292
- if args.action in {"show", "list", "gaps"}:
336
+ if reading:
293
337
  return query(
294
338
  project,
295
339
  args.record_kind,
@@ -351,6 +395,7 @@ def tracking_command(args: argparse.Namespace) -> dict[str, object]:
351
395
  args.operation,
352
396
  getattr(args, "id", None),
353
397
  state=getattr(args, "state", "all"),
398
+ issue_type=getattr(args, "issue_type", None),
354
399
  milestone=getattr(args, "milestone", None),
355
400
  phase=getattr(args, "phase", None),
356
401
  limit=getattr(args, "limit", 50),
@@ -360,7 +405,7 @@ def tracking_command(args: argparse.Namespace) -> dict[str, object]:
360
405
  return reconcile(tracker, args.operation, args.key)
361
406
  fields = {
362
407
  k: v
363
- for k in ("title", "key", "phase", "milestone")
408
+ for k in ("title", "key", "phase", "milestone", "issue_type")
364
409
  if (v := getattr(args, k, None)) is not None
365
410
  }
366
411
  if path := getattr(args, "description_file", None):
@@ -380,9 +425,25 @@ def tracking_command(args: argparse.Namespace) -> dict[str, object]:
380
425
  return update_work(tracker, args.operation, args.id, args.if_match, fields, plan=args.plan)
381
426
 
382
427
 
383
- def _dispatch(args: argparse.Namespace) -> tuple[dict[str, object], int]:
428
+ def _document_result(args: argparse.Namespace) -> tuple[dict[str, object], int]:
429
+ project = load_project(args.root)
430
+ if args.action != "review":
431
+ validation = validate_documents(project)
432
+ return validation, int(validation["status"] != "valid")
433
+ result = review_documents(project, args.base, args.allow, args.check_report)
434
+ freshness = result.get("check_freshness")
435
+ current = not isinstance(freshness, dict) or freshness["status"] == "current"
436
+ return result, int(result["status"] != "within_selected_scope" or not current)
437
+
438
+
439
+ def _dispatch(
440
+ args: argparse.Namespace, runtime: dict[str, str] | None
441
+ ) -> tuple[dict[str, object], int]:
384
442
  if args.operation == "version":
385
- result, code = describe(), 0
443
+ result, code = describe(runtime), 0
444
+ elif args.operation == "delegation":
445
+ result = prepare_delegation(args.root, args.spec, args.output_dir)
446
+ code = 0
386
447
  elif args.operation == "init":
387
448
  result = initialize(args.root, args.config, plan=args.plan)
388
449
  code = 0
@@ -397,13 +458,7 @@ def _dispatch(args: argparse.Namespace) -> tuple[dict[str, object], int]:
397
458
  elif args.operation == "commands":
398
459
  result, code = list_commands(load_project(args.root)), 0
399
460
  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
461
+ return _document_result(args)
407
462
  elif args.operation == "config":
408
463
  result, code = validate_config(load_project(args.root)), 0
409
464
  else:
@@ -424,14 +479,22 @@ def _execution_command(args: argparse.Namespace) -> tuple[dict[str, object], int
424
479
  )
425
480
  return report.to_dict(), report.exit_code
426
481
  else:
427
- report = check(load_project(args.root), args.only, plan=args.plan, report_path=args.report)
482
+ report = check(
483
+ load_project(args.root),
484
+ args.only,
485
+ plan=args.plan,
486
+ report_path=args.report,
487
+ bind_inputs=args.bind_input,
488
+ )
428
489
  return report.to_dict(), report.exit_code
429
490
 
430
491
 
431
492
  def main(argv: Sequence[str] | None = None) -> int:
432
493
  args = parser().parse_args(argv)
433
494
  previous = signal.signal(signal.SIGTERM, interrupt)
495
+ runtime = None
434
496
  try:
497
+ runtime = verify_binding(args.expect_runtime)
435
498
  if args.operation == "report":
436
499
  output = destination(args.output) if args.output else None
437
500
  content = render(*read(args.input), format=args.format)
@@ -440,12 +503,21 @@ def main(argv: Sequence[str] | None = None) -> int:
440
503
  else:
441
504
  print(content, end="")
442
505
  return 0
443
- result, code = _dispatch(args)
506
+ result, code = _dispatch(args, runtime)
507
+ if runtime is not None:
508
+ result["runtime_identity"] = runtime
444
509
  print_result(result, args.format)
445
510
  return code
446
511
  except (OpDevError, OSError, ValueError) as exc:
447
512
  if args.format == "json":
448
- print(json.dumps({"operation": args.operation, "status": "error", "detail": str(exc)}))
513
+ error: dict[str, object] = {
514
+ "operation": args.operation,
515
+ "status": "error",
516
+ "detail": str(exc),
517
+ }
518
+ if runtime is not None:
519
+ error["runtime_identity"] = runtime
520
+ print(json.dumps(error))
449
521
  else:
450
522
  print(f"opdev: {exc}", file=sys.stderr)
451
523
  return 2
@@ -190,8 +190,11 @@ def _parse_checks(value: Any, commands: dict[str, Command]) -> tuple[str, ...]:
190
190
  def _parse_documents(value: Any) -> dict[str, str]:
191
191
  if isinstance(value, dict) and set(value) & {"design", "interface", "tech_stack"}:
192
192
  raise OpDevError(
193
- "Legacy document routes need a reviewed migration to the fixed document layout. "
194
- "Preserve accepted decisions; no documents were moved or rewritten."
193
+ "Legacy document routes need a reviewed migration. Replace only documents, "
194
+ f"e.g. `documents: {{layout: {DOCUMENT_LAYOUT}, optional: []}}`; list accepted "
195
+ "optional roles. Keep commands, checks and publication unchanged. Conserve "
196
+ "decisions in canonical owners and run `opdev documents validate --format json` "
197
+ "successfully before deleting legacy files. This command changed nothing."
195
198
  )
196
199
  item = mapping(value, "documents", {"layout", "optional"})
197
200
  if item.get("layout", DOCUMENT_LAYOUT) != DOCUMENT_LAYOUT: