@plainconceptsplatform/agent-harness 3.0.3 → 3.1.0

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,131 +0,0 @@
1
- ---
2
- name: pc-ops-evidence
3
- description: Writes a capturePlan in evidence.json for the Visual Evidence CI workflow to execute on a runner with Docker and Chrome access. Load after a change is implemented. Invoked by /ops-evidence.
4
- license: MIT
5
- ---
6
-
7
- # Ops Evidence
8
-
9
- Write a capture plan so the Visual Evidence CI workflow can capture screenshots on a runner with full Docker and Chrome access.
10
-
11
- The agent runs inside the awf sandbox where Docker-in-Docker is unsupported and headless Chromium's sandbox is blocked by the container security policy. The agent cannot capture screenshots itself. Instead, it analyzes the diff and writes a `capturePlan` in `evidence.json`. A separate CI workflow executes the plan.
12
-
13
- ## Convention
14
-
15
- Every platform project has `pnpm run dev` at root that starts the **full stack** (database + API + web). The app runs with mock auth in development mode (no real authentication needed). This is the only contract — no per-project evidence harness, fixture apps, or scenario registries.
16
-
17
- ## Input
18
-
19
- The caller provides (all optional):
20
- - change id: locates `openspec/changes/{change-id}/` (or the archived `archive/*{change-id}/`).
21
- - issue / work-item ref and PR number: where to publish.
22
- - output mode (`default` / `push` / `pr`): whether the branch was pushed.
23
- - operation: `capture` (default), `publish`, or `both`.
24
-
25
- ## Part 1: Capture (operation: capture / both)
26
-
27
- **Step 1: Decide whether evidence is required.** Inspect the change's diff:
28
- - Required when changed files include user-visible UI: `*.tsx/jsx/vue/svelte`, `*.css/scss/less`, pages, layouts, components, navigation.
29
- - Skipped when docs-only, internal refactor, dependency-only, test-only, backend-only.
30
- - Mixed or unknown: required (be safe).
31
-
32
- If skipped: write `evidence.json` with `status: "skipped"` and reason. Done.
33
-
34
- **Step 2: Discover routes from git diff.** Parse changed files to determine which routes to screenshot:
35
- - `pages/**/*.tsx` or `app/**/page.tsx` → extract the route path
36
- - `features/**/*.tsx` or `components/**/*.tsx` → screenshot the homepage and any routes that import the changed component
37
- - If no routes found → screenshot `/` only
38
- - Always include `/` (homepage) as a baseline
39
-
40
- **Step 3: Write `evidence.json` with `capturePlan`.** The agent never attempts to start the app stack or launch a browser — those always fail inside the awf sandbox. Instead, write a `capturePlan` immediately.
41
-
42
- ### The `capturePlan` schema
43
-
44
- ```
45
- capturePlan:
46
- routes: # Array of route objects to screenshot (at minimum [{ path: "/" }])
47
- - path: string # URL path, e.g. "/items/:id"
48
- sampleId: # string | "first" | "any" — how to resolve dynamic segments
49
- caption: # string — human-readable description of what this screenshot shows
50
- viewports: # Array of viewport objects
51
- - width: number
52
- height: number
53
- label: string # "desktop" | "mobile" | custom
54
- requireApi: # boolean — true when the route needs the backend API running
55
- requireLogin: # boolean — true when the route needs authentication
56
- loginMethod: # string — "mock-sso" | "none" | custom method identifier
57
- reason: # string — why evidence was blocked and what the screenshots should show
58
- ```
59
-
60
- ### Rules for writing capturePlan
61
-
62
- 1. `routes` MUST always include `{ path: "/", caption: "Homepage" }` as the first entry.
63
- 2. Every additional route discovered from the diff goes after the homepage entry.
64
- 3. `sampleId: "first"` means the CI workflow should use the first record returned by the API. `sampleId: "any"` means any valid ID.
65
- 4. `requireApi` is `true` when any route needs the backend to return data. It is `false` only for purely static pages (login, not-found).
66
- 5. `requireLogin` is `true` when any route needs authentication. For dev mode with mock auth, `loginMethod` is `"mock-sso"`.
67
- 6. `reason` should explain both WHY capture was blocked and WHAT the screenshots should show once captured.
68
-
69
- ### Example `evidence.json`
70
-
71
- Adapt the routes and captions to this repository. Edits between the `PC-PROJECT-EXAMPLE` markers are carried over when the harness updates; anything outside them is replaced by the shipped version.
72
-
73
- <!-- PC-PROJECT-EXAMPLE-START -->
74
- ```json
75
- {
76
- "version": 1,
77
- "changeId": "status-badge-in-detail-panel",
78
- "required": true,
79
- "status": "blocked",
80
- "assets": [],
81
- "capturePlan": {
82
- "routes": [
83
- { "path": "/", "sampleId": "any", "caption": "Homepage" },
84
- { "path": "/items/:id", "sampleId": "first", "caption": "Item detail with the new status badge" }
85
- ],
86
- "viewports": [
87
- { "width": 1280, "height": 720, "label": "desktop" },
88
- { "width": 375, "height": 667, "label": "mobile" }
89
- ],
90
- "requireApi": true,
91
- "requireLogin": true,
92
- "loginMethod": "mock-sso",
93
- "reason": "Status badge added to the item detail panel; visual change on the detail page."
94
- },
95
- "reason": "Visual evidence cannot be captured inside the awf sandbox (Docker-in-Docker unsupported, headless Chromium sandbox blocked). A capturePlan has been written for the Visual Evidence CI workflow.",
96
- "prMarkdown": "## Evidence\n\nVisual evidence for this change is **blocked** in this agent run. A `capturePlan` has been written to `evidence.json` — the Visual Evidence CI workflow will execute it on a runner with full Docker and Chrome access.\n\nAutomated verification that did run:\n- Lint: clean\n- Tests: all pass\n- Build: success"
97
- }
98
- ```
99
- <!-- PC-PROJECT-EXAMPLE-END -->
100
-
101
- ### When evidence is not required
102
-
103
- If evidence is skipped (no UI files changed), write without a `capturePlan`:
104
-
105
- ```json
106
- {
107
- "version": 1,
108
- "changeId": "{change-id}",
109
- "required": false,
110
- "status": "skipped",
111
- "assets": [],
112
- "reason": "No user-visible UI files changed in this PR.",
113
- "prMarkdown": "## Evidence\n\nSkipped: no user-visible UI changes."
114
- }
115
- ```
116
-
117
- Capture never commits, stages, or pushes. The caller owns git.
118
-
119
- ## Part 2: Publish (operation: publish / both)
120
-
121
- Preconditions:
122
- - An issue/PR number was provided. Else skip.
123
- - Image URLs resolve only if the branch was pushed (`pr`/`push` modes).
124
- - Backlog platform from `.opencode/harness.json`; `none` means skip.
125
-
126
- <!-- PC-PLATFORM-EVIDENCE-START -->
127
- <!-- PC-PLATFORM-EVIDENCE-END -->
128
-
129
- ## Report
130
-
131
- One block: the `status` (passed/skipped/failed/blocked) and why; capturePlan written or why not. Never present a blocked capture as passed.