agentic-development-framework 0.2.0__py3-none-any.whl → 0.3.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentic-development-framework
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A local-first framework for agentic software development workflows.
5
5
  Project-URL: Homepage, https://github.com/Badsha-ugv/ide-agentic-development-framework
6
6
  Project-URL: Repository, https://github.com/Badsha-ugv/ide-agentic-development-framework
@@ -39,7 +39,7 @@ The project is being delivered incrementally. The current implementation provide
39
39
  installable package, strict configuration validation, structured logging, safe project
40
40
  initialization, immutable requirements versioning, SQLite workflow state, recovery checkpoints,
41
41
  lifecycle commands, structured stage execution contracts, artifact validation, approval history,
42
- and Codex/Antigravity project configuration.
42
+ Codex/Antigravity project configuration, and a browser-verified final visual prototype workflow.
43
43
 
44
44
  ## Requirements
45
45
 
@@ -74,6 +74,7 @@ adt --version
74
74
  adt init
75
75
  adt config validate path/to/config.yaml
76
76
  adt requirements ingest
77
+ adt requirements screenshots
77
78
  adt start
78
79
  adt status
79
80
  adt pause
@@ -137,6 +138,24 @@ clear unsupported-extraction status. Optional binary-format extractors are futur
137
138
 
138
139
  See `docs/REQUIREMENTS_MANAGEMENT.md` for the file contract and safety behavior.
139
140
 
141
+ Place PNG, JPG, JPEG, or WEBP design references anywhere below `requirements/screenshots/` and
142
+ run `adt requirements screenshots`. ADF recursively catalogs them, preserves immutable reference
143
+ revisions, records dimensions and contextual folder hints, and updates
144
+ `docs/ui-ux/screenshot-reference-analysis.md` without modifying originals. Requirements ingestion
145
+ also performs this synchronization.
146
+
147
+ ## UI/UX final visual workflow
148
+
149
+ The `ui_ux_design` stage accepts authenticated Figma MCP context, generated HTML/CSS/Tailwind
150
+ design, screenshot references, or a combination. Its prototype is the final visual source of truth,
151
+ not a preliminary wireframe. The stage requires a design system, complete page and role inventory,
152
+ responsive and interactive states, immutable prototype versions, and browser evidence for desktop,
153
+ tablet, and mobile rendering. Structured evidence is validated before completion.
154
+
155
+ The following `design_review` stage always waits for explicit human approval. Frontend work must
156
+ follow the approved prototype and produce design-reference traceability. See
157
+ [`docs/UI_UX_WORKFLOW.md`](docs/UI_UX_WORKFLOW.md).
158
+
140
159
  ## Runtime state and recovery
141
160
 
142
161
  Initialization creates `.agentic/database/agentic.db` as the transactional source of truth,
@@ -1,29 +1,30 @@
1
- agentic_framework/__init__.py,sha256=S1gT5jrk4C2azsQ87hh1jLDJOMm7h9XDrQPlAKJf-Z0,112
1
+ agentic_framework/__init__.py,sha256=JksBsPSAXOYXJRemfZT4nF2_Vxq6kTHEpNqdQOlO4aE,112
2
2
  agentic_framework/__main__.py,sha256=fHn8AFsz1H4xtmbMVsTaBxC9PNr96qqd8aocXjUsVuQ,140
3
- agentic_framework/cli.py,sha256=wypOrQWw8DAXiBUosuMNwoo0QizcrafYN26EPwwHcyU,15020
3
+ agentic_framework/cli.py,sha256=9n99mxysd0SdmPrlB9PJfYed56dGft6ovMBZxlJQiwA,15857
4
4
  agentic_framework/exceptions.py,sha256=C8bMuXkRaYr3sXXbsMOZcPrwiglDm8myZ4f6W7x7lrQ,610
5
5
  agentic_framework/logging.py,sha256=mHa65Qt-KdA6XsjcnM0RYbCyaxGrvGNt3FB9sexOXJU,2247
6
6
  agentic_framework/adapters/__init__.py,sha256=1vR3_hu_F6m0YSFBPTvme16p-98IZYv743xm9EalGy8,176
7
- agentic_framework/adapters/generator.py,sha256=DAlIIxrganfM7X5A4azEqXf7ME2O6qDjBuKgfz-hCfc,9799
7
+ agentic_framework/adapters/generator.py,sha256=ossrD8F18lWV4K8ZJVnFZyt5HAX394jK5XpnSiL6JcQ,11712
8
8
  agentic_framework/core/__init__.py,sha256=-n3tAT8X8Smg8FcQghm9kMHh_3Ck_Z9LnFhA7tAVXZQ,32
9
9
  agentic_framework/core/command_registry.py,sha256=usRxLLonXIpHzd9dF811485wQDLPpoN14eUbOI3tvF0,771
10
10
  agentic_framework/core/config.py,sha256=sLs_-NbjwOXgT5OFtGKczKLpVEfmQoisuJeN1SK5t4g,4425
11
11
  agentic_framework/core/custom_commands.py,sha256=pk2vlFJaLef04KzGeXg2kmZMWpkywunq7H6V3MKAjhs,4114
12
- agentic_framework/core/initialization.py,sha256=aDZCUzTfwAtERkccRZwo1wxMcTrfLFOskKQXpyJP1Vw,8837
12
+ agentic_framework/core/initialization.py,sha256=csokf3e68vFv4srqZPUVb1s-b6ihjay2yhmekhpukq0,9811
13
13
  agentic_framework/core/project.py,sha256=MVVmxepUFlF4PL7tfOwk7uae0ddti-s8OJL1AbxS9Dg,2827
14
- agentic_framework/core/stages.py,sha256=aUtAY1FNoTmDGATIZKo0IIrpXLK6fHD0p8BYgTNXfNI,13550
15
- agentic_framework/core/workflow.py,sha256=yIjwk4tKLzTTxfhkaEIOGCANKgWFq2jMOX31W8T1pk4,13548
16
- agentic_framework/requirements_manager/__init__.py,sha256=Q1T1sIh9n2VxbBucCg_RNzZ6hYgYVJHWZdGe6ccC02M,234
14
+ agentic_framework/core/stages.py,sha256=P0UgSY3sdGbIN1D9KSosx3DGckFR4_FTMs8C6w-6y2w,18721
15
+ agentic_framework/core/workflow.py,sha256=89wKnNdQJfj_rG3pq05Ke44mIxUOGdsy9Zv4rlrfZwM,18110
16
+ agentic_framework/requirements_manager/__init__.py,sha256=DP4QfMZBG3TVxZkkrzEY08sqF4OSI2YAHWsjoCGwc6M,584
17
17
  agentic_framework/requirements_manager/comparison.py,sha256=04Yxd-eK1EST1tbt-ps8wKlULHjhmS2OgwsLGWnXnR8,4807
18
18
  agentic_framework/requirements_manager/extraction.py,sha256=SSRbc6W4VDSS7jpnirCfFU2lVuyVCwPWCLoc50dhLvE,1362
19
- agentic_framework/requirements_manager/ingestion.py,sha256=iYRIXB8HQt15KHl05mjVXoN2nWpp-9_rx5wYfWAkMlI,14947
19
+ agentic_framework/requirements_manager/ingestion.py,sha256=NP8KScJOUkFzwZGGsqxo37LY0ABeDqfRgJKNMEkxk9M,15084
20
+ agentic_framework/requirements_manager/screenshots.py,sha256=qozKzhFWm8qN5onoajM8d7mMdjNRsjNWDDYLvfI3WZ0,16804
20
21
  agentic_framework/requirements_manager/traceability.py,sha256=azvdk3rc8Uq_gknNn3H9KMg7cUP0q13ltG56f8gq6LE,2254
21
22
  agentic_framework/state/__init__.py,sha256=w4no5X4gzvJr935HcZvszZscATGSkEepsMBbBKzQQu8,135
22
23
  agentic_framework/state/database.py,sha256=8-8U86jezQuC_YiShLC2dyQ0U3uO2A41rpwKCWnW_XE,18196
23
24
  agentic_framework/templates/__init__.py,sha256=D1B-_zlAKldwEbDY_kEvAfltg6OLZOuLyt4b5Ujgtdw,42
24
- agentic_framework/templates/skills/agentic-commands/SKILL.md,sha256=ssfqqV_rT5_-izPvou-Ko2hv12wyxHMFXI6Ll214IWg,3577
25
- agentic_development_framework-0.2.0.dist-info/METADATA,sha256=CJGEnatPmOB3dlcoy9upkN0sYYf_rY2v55qUjwPTESo,9007
26
- agentic_development_framework-0.2.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
27
- agentic_development_framework-0.2.0.dist-info/entry_points.txt,sha256=yLrtkLPdApbQjlyVZYNpmRtgc0prbjpJGwF3G9td_zk,50
28
- agentic_development_framework-0.2.0.dist-info/licenses/LICENSE,sha256=6BzOzZ1c-kyBOz_uNhWQKM1xPmPEQzSNwubTqgniGM0,1100
29
- agentic_development_framework-0.2.0.dist-info/RECORD,,
25
+ agentic_framework/templates/skills/agentic-commands/SKILL.md,sha256=vNDBywh0P5dqmC6fO4vkZv12X5iSnr55G9o7vFWjl8c,4151
26
+ agentic_development_framework-0.3.0.dist-info/METADATA,sha256=nB-s1EohrpicNz9i8ce1H8JZidykN6o2LskKmPl8xok,10220
27
+ agentic_development_framework-0.3.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
28
+ agentic_development_framework-0.3.0.dist-info/entry_points.txt,sha256=yLrtkLPdApbQjlyVZYNpmRtgc0prbjpJGwF3G9td_zk,50
29
+ agentic_development_framework-0.3.0.dist-info/licenses/LICENSE,sha256=6BzOzZ1c-kyBOz_uNhWQKM1xPmPEQzSNwubTqgniGM0,1100
30
+ agentic_development_framework-0.3.0.dist-info/RECORD,,
@@ -1,6 +1,6 @@
1
1
  """Agentic Development Framework public package metadata."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.3.0"
4
4
 
5
5
  __all__ = ["__version__"]
6
6
 
@@ -31,6 +31,8 @@ read the shared command skill and
31
31
  `.agentic/execution-contracts.yaml`; do not merely run a lifecycle command and report its output.
32
32
  The IDE agent performs reasoning and artifact creation while `adt` persists execution, artifacts,
33
33
  validation, approvals, and recovery. Never bypass approval gates or overwrite unrelated changes.
34
+ For the UI/UX stage, treat the browser-verified prototype as the final visual specification, sync
35
+ and inspect screenshot references, and require explicit approval before frontend implementation.
34
36
  """
35
37
 
36
38
  _CODEX_NOTE = """# Codex adapter
@@ -78,24 +80,57 @@ def _workflow() -> str:
78
80
  "checkpoint_policy": "on_completion",
79
81
  }
80
82
  )
81
- return _yaml({"schema_version": 2, "name": "default", "stages": stages})
83
+ return _yaml({"schema_version": 3, "name": "default", "stages": stages})
82
84
 
83
85
 
84
86
  def _registry() -> str:
85
87
  agents = []
86
88
  for agent_id, name in _AGENTS:
89
+ responsibilities = [f"Perform {name.lower()} work within approved scope"]
90
+ required_inputs: list[str] = []
91
+ expected_outputs = ["standardized agent result"]
92
+ verification = ["run relevant checks"]
93
+ if agent_id == "ui_ux_designer":
94
+ responsibilities = [
95
+ "Create the complete high-fidelity final visual prototype",
96
+ "Analyze Figma, screenshots, and approved requirements without inventing evidence",
97
+ "Verify every page, viewport, and interaction in a browser",
98
+ ]
99
+ required_inputs = [
100
+ "approved requirements and architecture",
101
+ "screenshot manifest and actual images",
102
+ "optional authenticated Figma design context",
103
+ ]
104
+ expected_outputs = [
105
+ "versioned interactive prototype",
106
+ "design system and page inventory",
107
+ "browser verification evidence",
108
+ ]
109
+ verification = [
110
+ "inspect desktop, tablet, and mobile rendering",
111
+ "test meaningful behavior for every visible control",
112
+ "preserve revision and visual-reference traceability",
113
+ ]
114
+ elif agent_id == "frontend_developer":
115
+ responsibilities = [
116
+ "Implement the explicitly approved final visual prototype faithfully",
117
+ "Preserve approved layouts, components, interactions, and responsive behavior",
118
+ ]
119
+ required_inputs = ["approved design prototype and browser evidence"]
120
+ expected_outputs = ["frontend design-reference traceability"]
121
+ verification = ["compare production rendering with approved prototype screenshots"]
87
122
  agents.append(
88
123
  {
89
124
  "id": agent_id,
90
125
  "name": name,
91
126
  "role": name,
92
- "responsibilities": [f"Perform {name.lower()} work within approved scope"],
127
+ "responsibilities": responsibilities,
93
128
  "scope": "assigned tasks only",
94
- "required_inputs": [],
95
- "expected_outputs": ["standardized agent result"],
129
+ "required_inputs": required_inputs,
130
+ "expected_outputs": expected_outputs,
96
131
  "allowed_tools": ["repository read/write tools", "project test commands"],
97
132
  "restricted_operations": ["secrets", "force push", "unapproved deployment"],
98
- "verification_requirements": ["run relevant checks"],
133
+ "verification_requirements": verification,
99
134
  "handoff_format": "agent result contract",
100
135
  "failure_and_escalation": "record blocker and escalate to orchestrator",
101
136
  }
agentic_framework/cli.py CHANGED
@@ -19,7 +19,7 @@ from agentic_framework.exceptions import (
19
19
  RequirementsError,
20
20
  StateError,
21
21
  )
22
- from agentic_framework.requirements_manager import RequirementsManager
22
+ from agentic_framework.requirements_manager import RequirementsManager, ScreenshotManager
23
23
 
24
24
  app = typer.Typer(
25
25
  name="adt",
@@ -427,3 +427,24 @@ def ingest_requirements(
427
427
  relative_report = result.impact_report.relative_to(result.version_path.parents[1])
428
428
  typer.echo(f"Impact report: {relative_report}")
429
429
 
430
+
431
+ @requirements_app.command("screenshots")
432
+ def sync_screenshots(
433
+ path: Annotated[
434
+ Path,
435
+ typer.Option("--path", help="Project directory containing requirements/screenshots."),
436
+ ] = Path("."),
437
+ ) -> None:
438
+ """Discover screenshot references and publish an immutable manifest revision."""
439
+
440
+ try:
441
+ result = ScreenshotManager(path).sync()
442
+ except RequirementsError as exc:
443
+ typer.echo(f"Error: {exc}", err=True)
444
+ raise typer.Exit(code=2) from exc
445
+ action = "Unchanged" if result.duplicate else "Published"
446
+ typer.echo(f"{action} screenshot revision {result.revision}.")
447
+ typer.echo(f"Screenshot files: {result.file_count}")
448
+ typer.echo("Manifest: requirements/screenshots/manifest.json")
449
+ typer.echo("Analysis: docs/ui-ux/screenshot-reference-analysis.md")
450
+
@@ -34,12 +34,23 @@ _DIRECTORIES = (
34
34
  ".github/instructions",
35
35
  ".github/workflows",
36
36
  "requirements/inbox",
37
+ "requirements/screenshots/desktop/homepage",
38
+ "requirements/screenshots/desktop/dashboard",
39
+ "requirements/screenshots/desktop/other",
40
+ "requirements/screenshots/mobile/homepage",
41
+ "requirements/screenshots/mobile/dashboard",
42
+ "requirements/screenshots/mobile/other",
43
+ "requirements/screenshots/admin-dashboard",
44
+ "requirements/screenshots/vendor-dashboard",
45
+ "requirements/screenshots/customer-dashboard",
46
+ "requirements/screenshots/references",
37
47
  "requirements/versions",
38
48
  "requirements/reports",
39
49
  "docs/discovery",
40
50
  "docs/requirements",
41
51
  "docs/architecture",
42
52
  "docs/design",
53
+ "docs/ui-ux",
43
54
  "docs/decisions",
44
55
  "docs/planning",
45
56
  "docs/technical",
@@ -64,6 +75,8 @@ This project uses the Agentic Development Framework (ADF).
64
75
  and run `adt stage complete`. The CLI persists state; the IDE agent performs the work.
65
76
  - Never treat successful `adt continue` output as completion or stage advancement.
66
77
  - Do not claim a task or phase is complete until its required checks pass.
78
+ - Treat the UI/UX prototype as the final visual specification: inspect actual Figma/screenshots,
79
+ browser-test all pages and viewports, preserve revisions, and wait for explicit design approval.
67
80
  """
68
81
 
69
82
  _REQUIREMENTS_README = """# Project requirements
@@ -72,6 +85,10 @@ Place source requirement files in `inbox/`, then run `adt requirements ingest`.
72
85
  source byte-for-byte into an immutable directory under `versions/`, detects duplicates using
73
86
  SHA-256 hashes, and compares each new version with its predecessor. Files in `inbox/` are never
74
87
  silently overwritten or removed.
88
+
89
+ Place PNG, JPG, JPEG, or WEBP visual references anywhere under `screenshots/`. ADF discovers them
90
+ recursively, preserves immutable revisions, and updates the screenshot manifest with
91
+ `adt requirements screenshots`. Folder names provide context but never replace visual inspection.
75
92
  """
76
93
 
77
94
  _GITIGNORE = """# Agentic Development Framework local runtime data
@@ -21,6 +21,7 @@ class StageContract:
21
21
  expected_outputs: tuple[str, ...]
22
22
  validation_criteria: tuple[str, ...]
23
23
  completion_conditions: tuple[str, ...]
24
+ supported_design_inputs: tuple[str, ...] = ()
24
25
  approval_required: bool = False
25
26
  failure_behavior: str = "Record the error, preserve work, and do not advance."
26
27
  max_attempts: int = 3
@@ -47,6 +48,7 @@ def _contract(
47
48
  "Every required output is registered with its current SHA-256 digest.",
48
49
  "Validation succeeds without unresolved execution errors.",
49
50
  ),
51
+ design_inputs: tuple[str, ...] = (),
50
52
  approval: bool = False,
51
53
  ) -> StageContract:
52
54
  return StageContract(
@@ -61,6 +63,7 @@ def _contract(
61
63
  expected_outputs=outputs,
62
64
  validation_criteria=validation,
63
65
  completion_conditions=completion,
66
+ supported_design_inputs=design_inputs,
64
67
  approval_required=approval,
65
68
  )
66
69
 
@@ -204,26 +207,100 @@ CONTRACTS = (
204
207
  ),
205
208
  _contract(
206
209
  "ui_ux_design",
207
- "UI/UX design",
208
- "Create a reviewable experience design before production frontend work.",
210
+ "UI/UX Design & Final Visual Prototype",
211
+ "Produce the complete, high-fidelity visual specification that frontend work must follow.",
209
212
  prerequisites=("architecture_review",),
210
- inputs=("docs/requirements/*.md", "docs/architecture/*.md"),
213
+ inputs=(
214
+ "docs/requirements/*.md",
215
+ "docs/architecture/*.md",
216
+ "requirements/screenshots/manifest.json",
217
+ "requirements/screenshots/**",
218
+ "existing project design assets",
219
+ "optional Figma file or frame URL",
220
+ ),
211
221
  agent="ui_ux_designer",
222
+ responsibilities=(
223
+ "Inventory every required page, user role, journey, state, and responsive layout.",
224
+ "Treat the interactive prototype as the final visual source of truth, not a wireframe.",
225
+ "Establish or faithfully preserve a coherent design system before building pages.",
226
+ "Preserve traceability from requirements and visual references to generated pages.",
227
+ ),
212
228
  instructions=(
213
- "Use a configured Figma integration only when a Figma file is supplied.",
214
- "Otherwise create an interactive local HTML/CSS/JavaScript prototype.",
229
+ "Run adt requirements screenshots before analysis and inspect every discovered image.",
230
+ "Record the selected Figma, generated-prototype, and screenshot methods in "
231
+ "docs/ui-ux/design-inputs.json; methods may be combined.",
232
+ "For Figma, use an available authenticated MCP integration, retrieve design context "
233
+ "and screenshots, and block honestly when access or authentication fails.",
234
+ "When no external source exists, propose the visual direction and design system for "
235
+ "human review before generating every page.",
236
+ "Build complete role-aware pages with realistic data, responsive layouts, reusable "
237
+ "components, and loading, empty, success, validation, and error states.",
238
+ "Give every visible control meaningful behavior; do not ship decorative controls.",
239
+ "Run the prototype in a browser, inspect all pages at desktop, tablet, and mobile "
240
+ "sizes, exercise interactions, capture rendered screenshots, fix defects, and repeat.",
241
+ "Create an immutable prototype version under design-prototype/versions and update "
242
+ "the revision history without overwriting the only prior approved version.",
243
+ ),
244
+ outputs=(
245
+ "docs/design/ui-ux-specification.md",
246
+ "docs/ui-ux/design-inputs.json",
247
+ "docs/ui-ux/page-inventory.md",
248
+ "docs/ui-ux/design-system.md",
249
+ "docs/ui-ux/screenshot-reference-analysis.md",
250
+ "docs/ui-ux/browser-verification.json",
251
+ "docs/ui-ux/revision-history.md",
252
+ "design-prototype/index.html",
253
+ "design-prototype/versions/*/index.html",
254
+ "design-prototype/verification-screenshots/**",
255
+ ),
256
+ validation=(
257
+ "Design-input evidence selects a supported method and never claims unavailable Figma "
258
+ "context was inspected.",
259
+ "Page inventory covers approved roles, requirements, states, and responsive variants.",
260
+ "The prototype uses a consistent documented design system and reusable components.",
261
+ "Every visible interactive control has meaningful browser-tested behavior.",
262
+ "Browser evidence passes every page at desktop, tablet, and mobile viewports and links "
263
+ "to captured rendered screenshots.",
264
+ "A versioned prototype and revision history preserve prior visual decisions.",
215
265
  ),
216
- outputs=("docs/design/ui-ux-specification.md", "design-prototype/index.html"),
266
+ completion=(
267
+ "Every required output and rendered verification screenshot is registered with its "
268
+ "current SHA-256 digest.",
269
+ "Structured design-input and browser-verification evidence passes validation.",
270
+ "The final prototype is complete enough for faithful production implementation.",
271
+ ),
272
+ design_inputs=("figma_mcp", "generated_prototype", "screenshots"),
217
273
  ),
218
274
  _contract(
219
275
  "design_review",
220
- "Design review",
221
- "Validate the prototype and request explicit approval before implementation.",
276
+ "Final visual prototype review",
277
+ "Present the complete browser-verified prototype for explicit human approval.",
222
278
  prerequisites=("ui_ux_design",),
223
- inputs=("docs/design/*.md", "design-prototype/**"),
279
+ inputs=("docs/design/*.md", "docs/ui-ux/**", "design-prototype/**"),
224
280
  agent="main_orchestrator",
225
- instructions=("Review accessibility, flows, requirements coverage, and feedback.",),
226
- outputs=("docs/design/ui-ux-specification.md", "design-prototype/index.html"),
281
+ instructions=(
282
+ "Present the page inventory, local preview instructions, design system, responsive and "
283
+ "interaction evidence, outstanding issues, and revision history.",
284
+ "Require explicit human approval; never infer it from generated files or silence.",
285
+ "For revision feedback, preserve unrelated approved decisions, update affected screens "
286
+ "consistently, create a new prototype version, and rerun browser verification.",
287
+ ),
288
+ outputs=(
289
+ "docs/design/ui-ux-specification.md",
290
+ "docs/ui-ux/design-inputs.json",
291
+ "docs/ui-ux/page-inventory.md",
292
+ "docs/ui-ux/design-system.md",
293
+ "docs/ui-ux/browser-verification.json",
294
+ "docs/ui-ux/revision-history.md",
295
+ "design-prototype/index.html",
296
+ "design-prototype/versions/*/index.html",
297
+ "design-prototype/verification-screenshots/**",
298
+ ),
299
+ validation=(
300
+ "All final visual prototype evidence remains current and registered.",
301
+ "Outstanding issues and assumptions are disclosed for human review.",
302
+ "No frontend implementation begins before explicit approval is recorded.",
303
+ ),
227
304
  approval=True,
228
305
  ),
229
306
  _contract(
@@ -246,12 +323,24 @@ CONTRACTS = (
246
323
  "Implementation",
247
324
  "Implement approved tasks traceably against requirements and architecture.",
248
325
  prerequisites=("development_planning",),
249
- inputs=("docs/planning/*.md",),
326
+ inputs=(
327
+ "docs/planning/*.md",
328
+ "docs/ui-ux/*.md",
329
+ "docs/ui-ux/*.json",
330
+ "design-prototype/**",
331
+ ),
250
332
  agent="main_orchestrator",
251
333
  instructions=(
252
334
  "Delegate sequential work, run focused tests, and record changed artifacts.",
335
+ "Implement frontend pages from the approved prototype without independently "
336
+ "redesigning or simplifying its layouts, components, interactions, or responsiveness.",
337
+ "Compare production frontend rendering with approved prototype screenshots and record "
338
+ "requirement, page, component, and visual-reference traceability.",
339
+ ),
340
+ outputs=(
341
+ ".agentic/reports/implementation.md",
342
+ "docs/reports/frontend-design-traceability.md",
253
343
  ),
254
- outputs=(".agentic/reports/implementation.md",),
255
344
  ),
256
345
  _contract(
257
346
  "integration",
@@ -331,7 +420,7 @@ def contract_document() -> dict[str, Any]:
331
420
  """Return the complete versioned stage contract document."""
332
421
 
333
422
  return {
334
- "schema_version": 2,
423
+ "schema_version": 3,
335
424
  "execution_model": "ide_agent",
336
425
  "stages": [contract.as_dict() for contract in CONTRACTS],
337
426
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import json
5
6
  import shutil
6
7
  from dataclasses import dataclass, field
7
8
  from pathlib import Path
@@ -13,7 +14,8 @@ from agentic_framework.core.stages import (
13
14
  STAGES,
14
15
  StageContract,
15
16
  )
16
- from agentic_framework.exceptions import StateError
17
+ from agentic_framework.exceptions import RequirementsError, StateError
18
+ from agentic_framework.requirements_manager import ScreenshotManager
17
19
  from agentic_framework.state import RuntimeStore
18
20
 
19
21
 
@@ -111,6 +113,11 @@ class WorkflowService:
111
113
  if execution["status"] == "completed":
112
114
  raise StateError(f"stage is already complete: {stage}")
113
115
  contract = self.stage_contract(stage)
116
+ if stage in {"ui_ux_design", "design_review"}:
117
+ try:
118
+ ScreenshotManager(self.project_root).sync()
119
+ except RequirementsError as exc:
120
+ raise StateError(f"cannot prepare visual references: {exc}") from exc
114
121
  if execution["status"] == "failed" and execution["attempt_count"] >= contract.max_attempts:
115
122
  self.store.update_execution(
116
123
  stage,
@@ -209,8 +216,89 @@ class WorkflowService:
209
216
  raise StateError("required outputs are not registered: " + ", ".join(unregistered))
210
217
  if stale:
211
218
  raise StateError("registered outputs changed; register them again: " + ", ".join(stale))
219
+ if stage in {"ui_ux_design", "design_review"}:
220
+ self._validate_design_evidence()
212
221
  return [path.relative_to(self.project_root).as_posix() for path in files]
213
222
 
223
+ def _read_evidence(self, relative: str) -> dict[str, Any]:
224
+ path = self.project_root / relative
225
+ try:
226
+ value = json.loads(path.read_text(encoding="utf-8"))
227
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
228
+ raise StateError(f"invalid structured design evidence {relative}: {exc}") from exc
229
+ if not isinstance(value, dict):
230
+ raise StateError(f"structured design evidence must be an object: {relative}")
231
+ return value
232
+
233
+ def _validate_design_evidence(self) -> None:
234
+ inputs = self._read_evidence("docs/ui-ux/design-inputs.json")
235
+ methods = inputs.get("methods")
236
+ supported = set(CONTRACT_BY_ID["ui_ux_design"].supported_design_inputs)
237
+ if (
238
+ not isinstance(methods, list)
239
+ or not methods
240
+ or any(not isinstance(method, str) or method not in supported for method in methods)
241
+ ):
242
+ raise StateError(
243
+ "design-input evidence must select one or more supported methods: "
244
+ + ", ".join(sorted(supported))
245
+ )
246
+ if "figma_mcp" in methods:
247
+ figma = inputs.get("figma")
248
+ if not isinstance(figma, dict) or figma.get("status") != "inspected":
249
+ raise StateError(
250
+ "Figma is selected but authenticated MCP inspection is not recorded; "
251
+ "record the blocker instead of claiming completion"
252
+ )
253
+ if "screenshots" in methods:
254
+ manifest = self._read_evidence("requirements/screenshots/manifest.json")
255
+ screenshots = manifest.get("screenshots")
256
+ if not isinstance(screenshots, list) or not screenshots:
257
+ raise StateError(
258
+ "screenshot design input is selected but the screenshot manifest is empty"
259
+ )
260
+
261
+ evidence = self._read_evidence("docs/ui-ux/browser-verification.json")
262
+ pages = evidence.get("pages")
263
+ if evidence.get("passed") is not True or not isinstance(pages, list) or not pages:
264
+ raise StateError("browser verification must pass and include every prototype page")
265
+ required_viewports = {"desktop", "tablet", "mobile"}
266
+ for page in pages:
267
+ if not isinstance(page, dict) or not isinstance(page.get("id"), str):
268
+ raise StateError("each browser-verified page must have a stable id")
269
+ viewports = page.get("viewports")
270
+ if (
271
+ not isinstance(viewports, list)
272
+ or any(not isinstance(viewport, str) for viewport in viewports)
273
+ or not required_viewports <= set(viewports)
274
+ ):
275
+ raise StateError(
276
+ f"browser verification for {page['id']} must cover desktop, tablet, and mobile"
277
+ )
278
+ if page.get("interactions_passed") is not True:
279
+ raise StateError(f"interactive controls did not pass for page: {page['id']}")
280
+ screenshots = page.get("screenshots")
281
+ if not isinstance(screenshots, list) or not screenshots:
282
+ raise StateError(f"rendered screenshots are missing for page: {page['id']}")
283
+ for screenshot in screenshots:
284
+ if not isinstance(screenshot, str):
285
+ raise StateError(f"invalid rendered screenshot path for page: {page['id']}")
286
+ relative = Path(screenshot)
287
+ rendered = (self.project_root / relative).resolve()
288
+ allowed = (
289
+ self.project_root / "design-prototype/verification-screenshots"
290
+ ).resolve()
291
+ if (
292
+ relative.is_absolute()
293
+ or ".." in relative.parts
294
+ or not rendered.is_relative_to(allowed)
295
+ or not rendered.is_file()
296
+ or rendered.is_symlink()
297
+ ):
298
+ raise StateError(
299
+ f"browser evidence references an unsafe or missing screenshot: {screenshot}"
300
+ )
301
+
214
302
  def complete_stage(self) -> dict[str, Any]:
215
303
  """Validate and complete the current stage, stopping at approval gates."""
216
304
 
@@ -4,5 +4,20 @@ from agentic_framework.requirements_manager.ingestion import (
4
4
  IngestionResult,
5
5
  RequirementsManager,
6
6
  )
7
+ from agentic_framework.requirements_manager.screenshots import (
8
+ SUPPORTED_SCREENSHOT_SUFFIXES,
9
+ ScreenshotManager,
10
+ ScreenshotReference,
11
+ ScreenshotSyncResult,
12
+ image_dimensions,
13
+ )
7
14
 
8
- __all__ = ["IngestionResult", "RequirementsManager"]
15
+ __all__ = [
16
+ "SUPPORTED_SCREENSHOT_SUFFIXES",
17
+ "IngestionResult",
18
+ "RequirementsManager",
19
+ "ScreenshotManager",
20
+ "ScreenshotReference",
21
+ "ScreenshotSyncResult",
22
+ "image_dimensions",
23
+ ]
@@ -23,6 +23,7 @@ from agentic_framework.requirements_manager.comparison import (
23
23
  render_impact_report,
24
24
  )
25
25
  from agentic_framework.requirements_manager.extraction import ExtractionResult, extract_text
26
+ from agentic_framework.requirements_manager.screenshots import ScreenshotManager
26
27
  from agentic_framework.requirements_manager.traceability import (
27
28
  RequirementRecord,
28
29
  extract_requirement_records,
@@ -333,6 +334,7 @@ class RequirementsManager:
333
334
  self._prepare_directories()
334
335
  with _ingestion_lock(self.requirements_root):
335
336
  items = self.inventory()
337
+ ScreenshotManager(self.project_root).sync()
336
338
  published = self._published_versions()
337
339
  latest = published[-1] if published else None
338
340
  if latest and self._manifest_signature(latest[1]) == self._signature(items):
@@ -0,0 +1,435 @@
1
+ """Immutable screenshot-reference discovery and metadata versioning."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import json
7
+ import os
8
+ import shutil
9
+ import struct
10
+ import tempfile
11
+ from dataclasses import dataclass
12
+ from datetime import UTC, datetime
13
+ from pathlib import Path
14
+ from typing import Any
15
+
16
+ from agentic_framework.exceptions import RequirementsError
17
+
18
+ SUPPORTED_SCREENSHOT_SUFFIXES = frozenset({".png", ".jpg", ".jpeg", ".webp"})
19
+ _GENERATED_START = "<!-- ADF:SCREENSHOT-INVENTORY:START -->"
20
+ _GENERATED_END = "<!-- ADF:SCREENSHOT-INVENTORY:END -->"
21
+
22
+
23
+ @dataclass(frozen=True, slots=True)
24
+ class ScreenshotReference:
25
+ """Metadata for one unmodified screenshot reference."""
26
+
27
+ path: Path
28
+ relative_path: Path
29
+ sha256: str
30
+ size: int
31
+ width: int
32
+ height: int
33
+ format: str
34
+ context: tuple[str, ...]
35
+ device_hint: str
36
+ page_hint: str
37
+ role_hint: str | None
38
+
39
+ def as_dict(self) -> dict[str, Any]:
40
+ """Return stable JSON-compatible metadata."""
41
+
42
+ return {
43
+ "path": self.relative_path.as_posix(),
44
+ "sha256": self.sha256,
45
+ "size": self.size,
46
+ "width": self.width,
47
+ "height": self.height,
48
+ "format": self.format,
49
+ "context": list(self.context),
50
+ "device_hint": self.device_hint,
51
+ "page_hint": self.page_hint,
52
+ "role_hint": self.role_hint,
53
+ }
54
+
55
+
56
+ @dataclass(frozen=True, slots=True)
57
+ class ScreenshotSyncResult:
58
+ """Outcome of screenshot discovery and immutable catalog publication."""
59
+
60
+ revision: int
61
+ file_count: int
62
+ duplicate: bool
63
+ manifest_path: Path
64
+ analysis_path: Path
65
+ version_path: Path | None
66
+
67
+
68
+ def _sha256(path: Path) -> str:
69
+ digest = hashlib.sha256()
70
+ try:
71
+ with path.open("rb") as source:
72
+ for chunk in iter(lambda: source.read(1024 * 1024), b""):
73
+ digest.update(chunk)
74
+ except OSError as exc:
75
+ raise RequirementsError(f"cannot read screenshot reference {path}: {exc}") from exc
76
+ return digest.hexdigest()
77
+
78
+
79
+ def _png_dimensions(data: bytes) -> tuple[int, int] | None:
80
+ if len(data) >= 24 and data.startswith(b"\x89PNG\r\n\x1a\n") and data[12:16] == b"IHDR":
81
+ return struct.unpack(">II", data[16:24])
82
+ return None
83
+
84
+
85
+ def _jpeg_dimensions(data: bytes) -> tuple[int, int] | None:
86
+ if not data.startswith(b"\xff\xd8"):
87
+ return None
88
+ offset = 2
89
+ start_of_frame = {
90
+ 0xC0,
91
+ 0xC1,
92
+ 0xC2,
93
+ 0xC3,
94
+ 0xC5,
95
+ 0xC6,
96
+ 0xC7,
97
+ 0xC9,
98
+ 0xCA,
99
+ 0xCB,
100
+ 0xCD,
101
+ 0xCE,
102
+ 0xCF,
103
+ }
104
+ while offset + 4 <= len(data):
105
+ if data[offset] != 0xFF:
106
+ offset += 1
107
+ continue
108
+ while offset < len(data) and data[offset] == 0xFF:
109
+ offset += 1
110
+ if offset >= len(data):
111
+ break
112
+ marker = data[offset]
113
+ offset += 1
114
+ if marker in {0x01, *range(0xD0, 0xDA)}:
115
+ continue
116
+ if offset + 2 > len(data):
117
+ break
118
+ length = int.from_bytes(data[offset : offset + 2], "big")
119
+ if length < 2 or offset + length > len(data):
120
+ break
121
+ if marker in start_of_frame and length >= 7:
122
+ height = int.from_bytes(data[offset + 3 : offset + 5], "big")
123
+ width = int.from_bytes(data[offset + 5 : offset + 7], "big")
124
+ return width, height
125
+ offset += length
126
+ return None
127
+
128
+
129
+ def _little_uint24(value: bytes) -> int:
130
+ return int.from_bytes(value, "little")
131
+
132
+
133
+ def _webp_dimensions(data: bytes) -> tuple[int, int] | None:
134
+ if len(data) < 30 or data[:4] != b"RIFF" or data[8:12] != b"WEBP":
135
+ return None
136
+ kind = data[12:16]
137
+ if kind == b"VP8X":
138
+ return 1 + _little_uint24(data[24:27]), 1 + _little_uint24(data[27:30])
139
+ if kind == b"VP8 " and data[23:26] == b"\x9d\x01\x2a":
140
+ width = int.from_bytes(data[26:28], "little") & 0x3FFF
141
+ height = int.from_bytes(data[28:30], "little") & 0x3FFF
142
+ return width, height
143
+ if kind == b"VP8L" and len(data) >= 25 and data[20] == 0x2F:
144
+ bits = int.from_bytes(data[21:25], "little")
145
+ return 1 + (bits & 0x3FFF), 1 + ((bits >> 14) & 0x3FFF)
146
+ return None
147
+
148
+
149
+ def image_dimensions(path: Path) -> tuple[int, int]:
150
+ """Read dimensions from a supported image header without modifying the file."""
151
+
152
+ try:
153
+ data = path.read_bytes()
154
+ except OSError as exc:
155
+ raise RequirementsError(f"cannot read screenshot reference {path}: {exc}") from exc
156
+ suffix = path.suffix.lower()
157
+ dimensions = {
158
+ ".png": _png_dimensions,
159
+ ".jpg": _jpeg_dimensions,
160
+ ".jpeg": _jpeg_dimensions,
161
+ ".webp": _webp_dimensions,
162
+ }[suffix](data)
163
+ if dimensions is None or min(dimensions) <= 0:
164
+ raise RequirementsError(f"invalid or unsupported {suffix} screenshot image: {path}")
165
+ return dimensions
166
+
167
+
168
+ def _hints(relative: Path, width: int, height: int) -> tuple[str, str, str | None]:
169
+ context = [part.lower() for part in relative.parent.parts if part not in {".", ""}]
170
+ if "mobile" in context:
171
+ device = "mobile"
172
+ elif "desktop" in context:
173
+ device = "desktop"
174
+ elif "tablet" in context:
175
+ device = "tablet"
176
+ else:
177
+ ratio = width / height
178
+ device = "mobile" if ratio < 0.75 else "desktop" if ratio > 1.15 else "unknown"
179
+ roles = ("admin", "vendor", "customer")
180
+ role = next((name for name in roles if any(name in part for part in context)), None)
181
+ ignored = {"desktop", "mobile", "tablet", "references", "other"}
182
+ page = next((part for part in reversed(context) if part not in ignored), relative.stem)
183
+ return device, page, role
184
+
185
+
186
+ class ScreenshotManager:
187
+ """Discover screenshots recursively and preserve immutable reference revisions."""
188
+
189
+ def __init__(self, project_root: Path) -> None:
190
+ self.project_root = project_root.expanduser().resolve()
191
+ self.root = self.project_root / "requirements" / "screenshots"
192
+ self.versions = self.root / ".versions"
193
+ self.manifest_path = self.root / "manifest.json"
194
+ self.analysis_path = self.project_root / "docs" / "ui-ux" / (
195
+ "screenshot-reference-analysis.md"
196
+ )
197
+
198
+ def discover(self) -> tuple[ScreenshotReference, ...]:
199
+ """Recursively inventory supported screenshot files and contextual folder hints."""
200
+
201
+ self.root.mkdir(parents=True, exist_ok=True)
202
+ references: list[ScreenshotReference] = []
203
+ for path in sorted(self.root.rglob("*")):
204
+ relative = path.relative_to(self.root)
205
+ if relative.parts and relative.parts[0] == ".versions":
206
+ continue
207
+ if path.is_symlink():
208
+ raise RequirementsError(f"symbolic screenshot references are not accepted: {path}")
209
+ if not path.is_file() or path.suffix.lower() not in SUPPORTED_SCREENSHOT_SUFFIXES:
210
+ continue
211
+ width, height = image_dimensions(path)
212
+ device, page, role = _hints(relative, width, height)
213
+ references.append(
214
+ ScreenshotReference(
215
+ path=path,
216
+ relative_path=relative,
217
+ sha256=_sha256(path),
218
+ size=path.stat().st_size,
219
+ width=width,
220
+ height=height,
221
+ format=path.suffix.lower().removeprefix(".").replace("jpeg", "jpg"),
222
+ context=relative.parent.parts,
223
+ device_hint=device,
224
+ page_hint=page,
225
+ role_hint=role,
226
+ )
227
+ )
228
+ return tuple(references)
229
+
230
+ @staticmethod
231
+ def _signature(references: tuple[ScreenshotReference, ...]) -> dict[str, str]:
232
+ return {item.relative_path.as_posix(): item.sha256 for item in references}
233
+
234
+ def _read_manifest(self) -> dict[str, Any] | None:
235
+ if not self.manifest_path.is_file():
236
+ return None
237
+ try:
238
+ value = json.loads(self.manifest_path.read_text(encoding="utf-8"))
239
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
240
+ raise RequirementsError(
241
+ f"cannot read screenshot manifest {self.manifest_path}: {exc}"
242
+ ) from exc
243
+ if not isinstance(value, dict) or not isinstance(value.get("screenshots"), list):
244
+ raise RequirementsError(f"invalid screenshot manifest: {self.manifest_path}")
245
+ return value
246
+
247
+ def _validate_versions(self) -> list[dict[str, Any]]:
248
+ manifests: list[dict[str, Any]] = []
249
+ if not self.versions.is_dir():
250
+ return manifests
251
+ for directory in sorted(self.versions.glob("version-*")):
252
+ manifest_path = directory / "manifest.json"
253
+ try:
254
+ manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
255
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
256
+ raise RequirementsError(
257
+ f"cannot validate immutable screenshot revision {directory}: {exc}"
258
+ ) from exc
259
+ if not isinstance(manifest, dict) or manifest.get("immutable") is not True:
260
+ raise RequirementsError(f"invalid immutable screenshot revision: {directory}")
261
+ expected_revision = int(directory.name.removeprefix("version-"))
262
+ if manifest.get("revision") != expected_revision:
263
+ raise RequirementsError(f"invalid screenshot revision number: {directory}")
264
+ screenshots = manifest.get("screenshots")
265
+ if not isinstance(screenshots, list):
266
+ raise RequirementsError(f"invalid screenshot inventory: {directory}")
267
+ source_root = (directory / "source-files").resolve()
268
+ for item in screenshots:
269
+ if not isinstance(item, dict) or not isinstance(item.get("path"), str):
270
+ raise RequirementsError(f"invalid screenshot record: {directory}")
271
+ source = (source_root / item["path"]).resolve()
272
+ if (
273
+ not source.is_relative_to(source_root)
274
+ or not source.is_file()
275
+ or source.is_symlink()
276
+ or _sha256(source) != item.get("sha256")
277
+ ):
278
+ raise RequirementsError(
279
+ f"immutable screenshot reference was modified or removed: {source}"
280
+ )
281
+ manifests.append(manifest)
282
+ return manifests
283
+
284
+ @staticmethod
285
+ def _manifest_signature(manifest: dict[str, Any]) -> dict[str, str]:
286
+ return {item["path"]: item["sha256"] for item in manifest["screenshots"]}
287
+
288
+ @staticmethod
289
+ def _atomic_text(path: Path, content: str) -> None:
290
+ path.parent.mkdir(parents=True, exist_ok=True)
291
+ temporary = path.with_suffix(path.suffix + ".tmp")
292
+ temporary.write_text(content, encoding="utf-8")
293
+ os.replace(temporary, path)
294
+
295
+ def _analysis_inventory(
296
+ self, references: tuple[ScreenshotReference, ...], revision: int
297
+ ) -> str:
298
+ lines = [
299
+ _GENERATED_START,
300
+ "# Screenshot reference analysis",
301
+ "",
302
+ f"Manifest revision: **{revision}**",
303
+ "",
304
+ "## Screenshot inventory",
305
+ "",
306
+ ]
307
+ if not references:
308
+ lines.append("No screenshot references were discovered.")
309
+ else:
310
+ lines.extend(
311
+ [
312
+ "| Original path | Dimensions | Device hint | Page hint | Role hint |",
313
+ "| --- | ---: | --- | --- | --- |",
314
+ ]
315
+ )
316
+ for item in references:
317
+ role = item.role_hint or "unspecified"
318
+ lines.append(
319
+ f"| `requirements/screenshots/{item.relative_path.as_posix()}` | "
320
+ f"{item.width}×{item.height} | {item.device_hint} | "
321
+ f"{item.page_hint} | {role} |"
322
+ )
323
+ lines.extend(
324
+ [
325
+ "",
326
+ "> Folder-derived labels are contextual hints only. The UI/UX agent must inspect "
327
+ "the actual images before recording conclusions.",
328
+ _GENERATED_END,
329
+ ]
330
+ )
331
+ return "\n".join(lines)
332
+
333
+ def _update_analysis(
334
+ self, references: tuple[ScreenshotReference, ...], revision: int
335
+ ) -> None:
336
+ generated = self._analysis_inventory(references, revision)
337
+ editable = """
338
+
339
+ ## Visual patterns and reusable components
340
+
341
+ To be completed by the UI/UX agent after visual inspection.
342
+
343
+ ## Missing pages and responsive states
344
+
345
+ To be completed against approved requirements and the page inventory.
346
+
347
+ ## Assumptions and inferred design decisions
348
+
349
+ Record evidence, confidence, and questions that materially affect usability.
350
+
351
+ ## Reference-to-generated-page traceability
352
+
353
+ Map each reference to the prototype pages and components that use it.
354
+ """
355
+ if self.analysis_path.is_file():
356
+ existing = self.analysis_path.read_text(encoding="utf-8")
357
+ if _GENERATED_END in existing:
358
+ editable = existing.split(_GENERATED_END, maxsplit=1)[1]
359
+ elif existing.strip():
360
+ editable = (
361
+ "\n\n## Preserved pre-existing analysis\n\n"
362
+ + existing.rstrip()
363
+ + "\n"
364
+ )
365
+ self._atomic_text(self.analysis_path, generated + editable.rstrip() + "\n")
366
+
367
+ def sync(self) -> ScreenshotSyncResult:
368
+ """Publish a new immutable screenshot revision when reference bytes change."""
369
+
370
+ references = self.discover()
371
+ versions = self._validate_versions()
372
+ current = self._read_manifest()
373
+ if versions and current is None:
374
+ raise RequirementsError(
375
+ "current screenshot manifest is missing while immutable revisions exist"
376
+ )
377
+ if current and versions:
378
+ latest = versions[-1]
379
+ if current.get("revision") != latest.get("revision") or self._manifest_signature(
380
+ current
381
+ ) != self._manifest_signature(latest):
382
+ raise RequirementsError(
383
+ "current screenshot manifest does not match the latest immutable revision"
384
+ )
385
+ if current and self._manifest_signature(current) == self._signature(references):
386
+ revision = int(current.get("revision", 1))
387
+ self._update_analysis(references, revision)
388
+ return ScreenshotSyncResult(
389
+ revision=revision,
390
+ file_count=len(references),
391
+ duplicate=True,
392
+ manifest_path=self.manifest_path,
393
+ analysis_path=self.analysis_path,
394
+ version_path=self.versions / f"version-{revision:03d}",
395
+ )
396
+
397
+ revision = int(current.get("revision", 0)) + 1 if current else 1
398
+ version_path = self.versions / f"version-{revision:03d}"
399
+ self.versions.mkdir(parents=True, exist_ok=True)
400
+ if version_path.exists():
401
+ raise RequirementsError(f"screenshot revision target already exists: {version_path}")
402
+ manifest: dict[str, Any] = {
403
+ "schema_version": 1,
404
+ "revision": revision,
405
+ "created_at": datetime.now(UTC).isoformat(),
406
+ "immutable": True,
407
+ "previous_revision": int(current["revision"]) if current else None,
408
+ "screenshots": [item.as_dict() for item in references],
409
+ }
410
+ with tempfile.TemporaryDirectory(prefix=".adf-screenshots-", dir=self.versions) as temp:
411
+ staging = Path(temp)
412
+ for item in references:
413
+ destination = staging / "source-files" / item.relative_path
414
+ destination.parent.mkdir(parents=True, exist_ok=True)
415
+ shutil.copyfile(item.path, destination)
416
+ if _sha256(destination) != item.sha256:
417
+ raise RequirementsError(
418
+ f"copied screenshot failed hash verification: {item.path}"
419
+ )
420
+ (staging / "manifest.json").write_text(
421
+ json.dumps(manifest, indent=2, sort_keys=True) + "\n", encoding="utf-8"
422
+ )
423
+ os.replace(staging, version_path)
424
+ self._atomic_text(
425
+ self.manifest_path, json.dumps(manifest, indent=2, sort_keys=True) + "\n"
426
+ )
427
+ self._update_analysis(references, revision)
428
+ return ScreenshotSyncResult(
429
+ revision=revision,
430
+ file_count=len(references),
431
+ duplicate=False,
432
+ manifest_path=self.manifest_path,
433
+ analysis_path=self.analysis_path,
434
+ version_path=version_path,
435
+ )
@@ -20,6 +20,11 @@ For `/start`, `/continue`, or `/adf-resume`, perform this loop from the project
20
20
  3. Inspect every available required input and relevant project source. Do not invent missing facts.
21
21
  4. Perform the stage's reasoning and repository work using the named specialist role. Keep work
22
22
  within the project and preserve unrelated changes.
23
+ For `ui_ux_design`, run `adt requirements screenshots`, inspect the actual reference images,
24
+ and treat the interactive prototype as the final visual specification. A metadata manifest does
25
+ not count as visual inspection. When Figma is selected, use authenticated MCP design context or
26
+ persist an honest blocker. Browser-test every page at desktop, tablet, and mobile sizes, capture
27
+ rendered evidence, exercise visible controls, and preserve a versioned prototype.
23
28
  5. If a material clarification or external dependency blocks correct work, record it in the
24
29
  appropriate artifact and run `adt stage fail --blocked "<actionable blocker>"`. Stop there.
25
30
  6. Create every expected output. Outputs must be substantive, non-empty, and traceable to inputs.
@@ -30,6 +35,7 @@ For `/start`, `/continue`, or `/adf-resume`, perform this loop from the project
30
35
  9. Run `adt stage complete`. This is the only normal command that may advance a non-review stage.
31
36
  10. If the stage enters `awaiting_approval`, show the registered deliverables and stop. Only the
32
37
  user may authorize `adt approve <stage>` or request `adt revise <stage> <feedback>`.
38
+ Never infer approval of the final visual prototype or begin frontend implementation early.
33
39
  11. After revision feedback, update the deliverables, register the new bytes, rerun checks, and
34
40
  complete the same stage again. ADF preserves the previous reviewed artifact snapshot.
35
41
  12. Summarize artifacts, checks, persisted state, and any remaining blocker. Never claim a stage is