prizmkit 1.1.70 → 1.1.74

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 (57) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/agents/prizm-dev-team-dev.md +11 -1
  3. package/bundled/dev-pipeline/lib/common.sh +427 -0
  4. package/bundled/dev-pipeline/lib/heartbeat.sh +101 -36
  5. package/bundled/dev-pipeline/run-feature.sh +109 -29
  6. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +198 -3
  7. package/bundled/dev-pipeline/scripts/update-feature-status.py +27 -3
  8. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +21 -0
  9. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +1 -1
  10. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -9
  11. package/bundled/dev-pipeline/templates/sections/feature-context.md +3 -18
  12. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +11 -0
  13. package/bundled/dev-pipeline/templates/sections/phase-commit.md +11 -0
  14. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +1 -1
  15. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +6 -12
  16. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +10 -3
  17. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +1 -0
  18. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +4 -8
  19. package/bundled/dev-pipeline-windows/lib/common.ps1 +61 -1
  20. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +325 -16
  21. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +198 -3
  22. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +27 -3
  23. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +21 -0
  24. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +1 -1
  25. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +27 -0
  26. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +543 -14
  27. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +664 -14
  28. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +741 -14
  29. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +2 -2
  30. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +1 -1
  31. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +1 -1
  32. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +1 -1
  33. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +3 -3
  34. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +1 -1
  35. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +3 -18
  36. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +239 -40
  37. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +75 -26
  38. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +142 -36
  39. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +13 -2
  40. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +12 -1
  41. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +1 -1
  42. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +7 -17
  43. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +10 -3
  44. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +1 -1
  45. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +1 -1
  46. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +3 -1
  47. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +7 -3
  48. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +1 -3
  49. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +1 -1
  50. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +1 -1
  51. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +1 -1
  52. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +2 -2
  53. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +13 -17
  54. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +2 -4
  55. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +1 -1
  56. package/bundled/skills/_metadata.json +1 -1
  57. package/package.json +1 -1
@@ -48,7 +48,7 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
48
48
  1. **context-snapshot.md is your single source of truth** — After it is built, read context-snapshot.md instead of re-reading individual source files.
49
49
  2. **Never re-read your own writes** — Trust your write was correct.
50
50
  3. **Stay focused** — Do NOT explore code unrelated to this bug.
51
- 4. **Minimize tool output** — Capture to temp file, scan head/tail, filter with Select-String/PowerShell object filtering. Never load full output.
51
+ 4. **Minimize tool output** — Capture to temp file, scan first/last lines, filter with Select-String, regex matching, or PowerShell object filtering. Never load full output.
52
52
  5. **No intermediate commits** — All changes committed once at the end via `/prizmkit-committer`.
53
53
 
54
54
  ## Bug Fix Artifacts Directory
@@ -195,7 +195,7 @@ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
195
195
  **Gate Check — Review Report**:
196
196
  After `/prizmkit-code-review` returns, verify the review report:
197
197
  ```powershell
198
- if (Select-String -Path .prizmkit/bugfix/{{BUG_ID}}/review-report.md -Pattern "## Verdict" -Quiet) { "GATE:PASS" } else { "GATE:MISSING" }
198
+ if (Select-String -Path .prizmkit/bugfix/{{BUG_ID}}/review-report.md -Pattern "## Verdict" -Quiet -ErrorAction SilentlyContinue) { "GATE:PASS" } else { "GATE:MISSING" }
199
199
  ```
200
200
  If GATE:MISSING:
201
201
  - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
@@ -163,7 +163,7 @@
163
163
  "items": {
164
164
  "type": "string"
165
165
  },
166
- "description": "AI-generated summary of key changes from this feature session. Useful to provide rich dependency context to downstream features. Each item is a concise statement about what was built/changed (e.g. APIs added, models created, key file paths)."
166
+ "description": "AI-generated summary of key changes from this feature session. Used to provide rich dependency context to downstream features. Each item is a concise statement about what was built/changed (e.g. APIs added, models created, key file paths)."
167
167
  },
168
168
  "user_context": {
169
169
  "type": "array",
@@ -219,7 +219,7 @@ Evidence must cover affected UI render, primary user interactions, behavior-sens
219
219
  - **Gate Check — Review Report**:
220
220
  After Reviewer returns, verify the review report contains a verdict:
221
221
  ```powershell
222
- if (Select-String -Path .prizmkit/refactor/{{REFACTOR_ID}}/review-report.md -Pattern "## Verdict" -Quiet) { "GATE:PASS" } else { "GATE:MISSING" }
222
+ if (Select-String -Path .prizmkit/refactor/{{REFACTOR_ID}}/review-report.md -Pattern "## Verdict" -Quiet -ErrorAction SilentlyContinue) { "GATE:PASS" } else { "GATE:MISSING" }
223
223
  ```
224
224
  If GATE:MISSING:
225
225
  - Do not enter an unbounded report-repair loop and do not repeatedly re-spawn Reviewer.
@@ -182,7 +182,7 @@
182
182
  "items": {
183
183
  "type": "string"
184
184
  },
185
- "description": "AI-generated summary of key changes from this refactor session. Useful to provide rich dependency context to downstream refactors. Each item is a concise statement about what was refactored (e.g. modules extracted, files restructured, interfaces changed)."
185
+ "description": "AI-generated summary of key changes from this refactor session. Used to provide rich dependency context to downstream refactors. Each item is a concise statement about what was refactored (e.g. modules extracted, files restructured, interfaces changed)."
186
186
  },
187
187
  "user_context": {
188
188
  "type": "array",
@@ -8,16 +8,16 @@ You are running in **headless non-interactive mode** with a FINITE context windo
8
8
  2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
9
9
  3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
10
10
  4. **One task at a time** — Complete and test one task before starting the next.
11
- 5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`cmd 2>&1 | Tee-Object (Join-Path $env:TEMP "out.txt") | Select-Object -Last 20`), then scan the head/tail to identify relevant fields, and use targeted filtering (`Select-String`, `filtering`, `PowerShell object filtering`) to extract only the information needed for the current task. Only read the filtered result — never the raw full output.
11
+ 5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`& { <command> } 2>&1 | Tee-Object (Join-Path $env:TEMP "out.txt") | Select-Object -Last 20`), then scan the first/last lines to identify relevant fields, and use targeted filtering (`Select-String`, regex matching, PowerShell object filtering) to extract only the information needed for the current task. Only read the filtered result — never the raw full output.
12
12
  6. **No intermediate commits** — Do NOT run `git add`/`git commit` during implementation phases. All changes are committed once at the end via `/prizmkit-committer`.
13
- 7. **Capture test output once** — When running test suites, always use `& { {{TEST_CMD}} } 2>&1 | Tee-Object (Join-Path $env:TEMP "test-out.txt") | Select-Object -Last 20`. Then Select-String (Join-Path $env:TEMP "test-out.txt") for details. Never re-run the suite just to apply a different filter.
13
+ 7. **Capture test output once** — When running test suites, always use `& { {{TEST_CMD}} } 2>&1 | Tee-Object (Join-Path $env:TEMP "test-out.txt") | Select-Object -Last 20`. Then Select-String `(Join-Path $env:TEMP "test-out.txt")` for details. Never re-run the suite just to apply a different filter.
14
14
  8. **Scaffold / generated file awareness (CRITICAL)** — When you run a scaffolding tool or package manager init command (`npm init`, `npx create-*`, `vite create`, `cargo init`, `go mod init`, `rails new`, `django-admin startproject`, `npx shadcn-ui init`, etc.), the output files are **generated boilerplate**. You MUST:
15
15
  - Identify and mentally tag all files created by the tool as "scaffold files"
16
16
  - Record the list of scaffold-generated files in context-snapshot.md under a `### Scaffold Files (do not re-read)` section
17
17
  - **NEVER re-read scaffold files** after initial creation. Their content is standard boilerplate — you already know what they contain from the tool that generated them
18
18
  - If you need to modify a scaffold file, make the edit directly without reading it first (you know the standard template content)
19
19
  - This applies equally to `node_modules/`, `package-lock.json`, generated config files (`tsconfig.json`, `vite.config.ts`, `tailwind.config.js`, `.eslintrc`, etc.) produced by init commands
20
- - When passing context to subagents, explicitly tell them the scaffold-generated files so they skip reading them too
20
+ - When passing context to subagents, explicitly tell them Get-Command files are scaffold-generated so they skip reading them too
21
21
  9. **Package version verification (HARD CONSTRAINT — BLOCKING)** — Before writing ANY dependency version in `package.json`, `requirements.txt`, `Cargo.toml`, `go.mod`, `Gemfile`, `pyproject.toml`, or any other dependency manifest:
22
22
  - You MUST verify the real version exists by querying the package registry first:
23
23
  - npm/Node.js: `npm view <package> dist-tags.latest 2>$null`
@@ -5,7 +5,7 @@ If you encounter an unrecoverable error, context overflow, or are about to exit
5
5
  1. Write `.prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md` BEFORE exiting:
6
6
  ```
7
7
  FAILURE_TYPE: timeout | test_failure | review_rejected | context_overflow | unknown
8
- PHASE: <failed phase>
8
+ PHASE: <Get-Command phase failed>
9
9
  ROOT_CAUSE: <1-2 sentence explanation>
10
10
  ATTEMPTED: <approaches already tried>
11
11
  SUGGESTION: <what the next session should try differently>
@@ -4,33 +4,18 @@
4
4
  Use this material according to the following priority:
5
5
 
6
6
  1. **Task Contract** — defines current scope and Verification Gates.
7
- 2. **User Raw Context** — authoritative constraints, but not automatic scope expansion.
8
- 3. **Completed Dependencies** — existing behavior and interfaces; do not re-implement them.
9
- 4. **Project Brief** — product background and architecture alignment.
10
- 5. **App Global Context** — stack, runtime, and testing conventions.
11
- 6. **Project Conventions** — repository-specific rules.
12
-
13
- ### User Raw Context
14
-
15
- {{USER_CONTEXT}}
7
+ 2. **Completed Dependencies** — existing interfaces; do not re-implement.
8
+ 3. **App Global Context** — stack, runtime, testing conventions.
16
9
 
17
10
  ### Completed Dependencies
18
11
 
19
- > Use this section to understand available interfaces and avoid duplicating completed work.
20
-
21
12
  {{COMPLETED_DEPENDENCIES}}
22
13
 
23
- ### Project Brief
24
-
25
- > Use this section for alignment only. Do not treat unrelated backlog items as current feature scope.
26
-
27
- {{PROJECT_BRIEF}}
28
-
29
14
  ### App Global Context
30
15
 
31
16
  {{GLOBAL_CONTEXT}}
32
17
 
33
18
  ### Project Conventions
34
19
 
35
- > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards, architecture decisions, and development rules. Follow these conventions throughout implementation.
20
+ > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards and architecture decisions.
36
21
  </feature-context>
@@ -1,84 +1,283 @@
1
- ### Browser Verification — MANDATORY
1
+ ### Browser Verification (Auto-Select Tool) — MANDATORY
2
2
 
3
- You MUST attempt this phase. Mark it as skipped only when no usable browser tool can be found, installed, or started. Use native PowerShell commands for setup, server lifecycle, and cleanup.
3
+ You MUST execute this phase. Do NOT skip it. Select the best available browser tool at runtime and use PowerShell-native commands for setup, server lifecycle, and cleanup.
4
4
 
5
- **Step 0 — Tool Selection (BLOCKING decide before any browser action)**:
5
+ **Tool Selection**: Choose the best browser tool at runtime.
6
6
 
7
+ **Step 0 — Detect available tools**:
7
8
  ```powershell
9
+ "=== playwright-cli ==="
8
10
  $playwright = Get-Command playwright-cli -ErrorAction SilentlyContinue
11
+ if ($playwright) { playwright-cli --version } else { "NOT_INSTALLED" }
12
+ "=== opencli ==="
9
13
  $opencli = Get-Command opencli -ErrorAction SilentlyContinue
10
- if ($playwright) { playwright-cli --version } else { "PLAYWRIGHT_CLI:NOT_INSTALLED" }
11
- if ($opencli) { opencli --version } else { "OPENCLI:NOT_INSTALLED" }
14
+ if ($opencli) { opencli --version } else { "NOT_INSTALLED" }
15
+ if ($opencli) {
16
+ opencli doctor 2>$null
17
+ if ($LASTEXITCODE -ne 0) { "OPENCLI_BRIDGE_FAILED" }
18
+ }
12
19
  ```
13
20
 
14
- Use this single decision tree:
15
- 1. If `playwright-cli` is available, use it by default for local dev-server verification.
16
- 2. Else if `opencli` is available, run `opencli doctor`; use `opencli` only if doctor passes.
17
- 3. Else install `playwright-cli` as the default:
21
+ **Decision table**:
22
+ | Condition | Tool |
23
+ |-----------|------|
24
+ | Only playwright-cli available | playwright-cli |
25
+ | Only opencli available (doctor passes) | opencli |
26
+ | Both — local dev server, forms, components | playwright-cli |
27
+ | Both — needs real login state (OAuth/SSO) | opencli |
28
+ | Both — third-party integration verification | opencli |
29
+ | Neither available | Install playwright-cli as default |
30
+
31
+ Then follow the corresponding tool's workflow above (Steps 1-3).
32
+
33
+ If you choose playwright-cli, follow this workflow:
34
+
35
+ **Using: playwright-cli**
36
+
37
+ **CRITICAL CONSTRAINT — playwright-cli ONLY, NO Playwright MCP**:
38
+ - You MUST use `playwright-cli` (the CLI tool) for ALL browser interactions in this phase
39
+ - **NEVER** use Playwright MCP server, Playwright MCP tools, or any MCP-based browser automation
40
+ - If you have Playwright MCP configured, IGNORE it entirely — use the CLI command `playwright-cli` exclusively
41
+ - All browser actions go through `playwright-cli <command>` in the PowerShell tool, not through any MCP tool call
42
+
43
+ **Step 0 — Playwright CLI Readiness Check (BLOCKING — must pass before any browser action)**:
44
+
45
+ 0a. Check if `playwright-cli` is installed:
46
+ ```powershell
47
+ $playwright = Get-Command playwright-cli -ErrorAction SilentlyContinue
48
+ if ($playwright) { playwright-cli --version } else { "NOT_INSTALLED" }
49
+ ```
50
+ If output is `NOT_INSTALLED`, install it:
51
+ ```powershell
52
+ npm install -g @playwright/cli@latest
53
+ ```
54
+ Then verify installation succeeded:
55
+ ```powershell
56
+ playwright-cli --version
57
+ ```
58
+ If installation fails, log the error in context-snapshot.md under `## Browser Verification: SKIPPED — playwright-cli installation failed` and proceed to the next phase. Do NOT attempt browser verification without playwright-cli.
59
+
60
+ 0b. Learn playwright-cli usage (run once per session to understand available commands):
61
+ ```powershell
62
+ playwright-cli --help
63
+ ```
64
+ Use this output to determine the correct commands for your verification steps. Do NOT guess command syntax — refer to the help output.
65
+
66
+ 0c. Check if playwright-cli skill is installed for the current AI platform:
67
+ ```powershell
68
+ $currentPlatform = "unknown"
69
+ $skillDir = $null
70
+ if (Get-Command claude -ErrorAction SilentlyContinue) {
71
+ $currentPlatform = "claude"
72
+ $skillDir = Join-Path $HOME ".claude\skills"
73
+ } elseif (Get-Command cbc -ErrorAction SilentlyContinue) {
74
+ $currentPlatform = "codebuddy"
75
+ $skillDir = Join-Path $HOME ".cbc\skills"
76
+ }
77
+
78
+ $skillExists = $false
79
+ if ($skillDir) {
80
+ $directSkill = Join-Path $skillDir "playwright-cli"
81
+ $matchingSkills = Get-ChildItem -Path $skillDir -Filter "playwright*" -ErrorAction SilentlyContinue
82
+ $skillExists = (Test-Path -LiteralPath $directSkill) -or [bool]$matchingSkills
83
+ }
84
+ if ($skillExists) { "SKILL_EXISTS" } else { "SKILL_MISSING" }
85
+ ```
86
+ If `SKILL_MISSING`:
87
+ ```powershell
88
+ playwright-cli install --skills
89
+ ```
90
+ If the current platform is NOT claude, move the installed skill files to the correct location:
91
+ ```powershell
92
+ $claudeSkillDir = Join-Path $HOME ".claude\skills"
93
+ $sourceSkill = Join-Path $claudeSkillDir "playwright-cli"
94
+ if ($currentPlatform -ne "claude" -and $currentPlatform -ne "unknown" -and $skillDir -and (Test-Path -LiteralPath $sourceSkill)) {
95
+ New-Item -ItemType Directory -Force -Path $skillDir | Out-Null
96
+ Copy-Item -Recurse -Force -Path $sourceSkill -Destination $skillDir
97
+ "Moved playwright-cli skill from claude to $currentPlatform"
98
+ }
99
+ ```
100
+
101
+ 0d. Read the installed playwright-cli skill for workflow guidance:
102
+ After skill installation, read the skill's SKILL.md to understand recommended workflows and patterns. Use these patterns to construct your verification flow — do NOT invent your own patterns if the skill provides them.
103
+
104
+ **Step 1 — Start Dev Server**:
105
+
106
+ You know this project's tech stack. Detect and start the dev server yourself:
107
+
108
+ 1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
109
+ 2. **Detect the dev server port** — use the pre-detected port from pipeline if available, otherwise extract from project config. Do NOT hardcode or guess the port:
110
+ ```powershell
111
+ $DEV_PORT = "{{DEV_PORT}}"
112
+ if ($DEV_PORT -eq "{{DEV_PORT}}" -or [string]::IsNullOrWhiteSpace($DEV_PORT)) {
113
+ $detectedPort = ""
114
+ if (Test-Path -LiteralPath "package.json") {
115
+ $detectedPort = node -e "const p=require('./package.json'); const s=(p.scripts?.dev) || ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
116
+ }
117
+ if (-not $detectedPort -and $env:NEXT_PUBLIC_SITE_URL -match ':([0-9]+)') {
118
+ $detectedPort = $Matches[1]
119
+ }
120
+ if ($detectedPort) { $DEV_PORT = $detectedPort } else { $DEV_PORT = "3000" }
121
+ }
122
+ "Detected DEV_PORT=$DEV_PORT"
123
+ ```
124
+ 3. Verify the port is available and start the dev server in the background, capturing its process id:
125
+ ```powershell
126
+ $portBusy = Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue
127
+ if ($portBusy) { "PORT_IN_USE" } else { "PORT_FREE" }
128
+ $devServerCommand = "<start-command>"
129
+ $server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", $devServerCommand) -PassThru
130
+ $DEV_SERVER_PID = $server.Id
131
+ ```
132
+
133
+ Wait for server to be ready: poll `http://localhost:$DEV_PORT` until it returns 200 or 302 (max 30 seconds, 2s interval):
18
134
  ```powershell
19
- npm install -g @playwright/cli@latest
20
- playwright-cli --version
135
+ $ready = $false
136
+ for ($i = 0; $i -lt 15; $i++) {
137
+ try {
138
+ $response = Invoke-WebRequest -Uri "http://localhost:$DEV_PORT" -UseBasicParsing -TimeoutSec 2
139
+ if ($response.StatusCode -in @(200, 302)) { $ready = $true; break }
140
+ } catch {
141
+ Start-Sleep -Seconds 2
142
+ }
143
+ }
144
+ if (-not $ready) { "DEV_SERVER_NOT_READY" }
21
145
  ```
22
- 4. If no browser tool is usable after these steps, append `## Browser Verification: SKIPPED — no usable browser tool` to `context-snapshot.md`, then continue to reporting/checkpoint.
146
+ 4. Open the app in playwright-cli: `playwright-cli open "http://localhost:$DEV_PORT"`
147
+ 5. If the page requires authentication, use playwright-cli to register a test user and log in first
148
+
149
+ **Step 2 — Verification**:
150
+
151
+ Use `playwright-cli snapshot` on the running app to discover actual element refs, then verify these goals:
152
+ {{BROWSER_VERIFY_STEPS}}
153
+
154
+ Construct your verification workflow based on:
155
+ 1. The playwright-cli skill documentation (read in Step 0d)
156
+ 2. The `playwright-cli --help` output (captured in Step 0b)
157
+ 3. The current task's Verification Gates and implemented features
158
+
159
+ Decide the concrete playwright-cli actions (click, fill, snapshot, screenshot, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW using playwright-cli commands.
160
+
161
+ Take a final screenshot for evidence: `playwright-cli screenshot`
162
+
163
+ **Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
164
+
165
+ 1. Close the playwright-cli browser: `playwright-cli close`
166
+ 2. Stop the dev server process and any remaining process bound to the dev server port:
167
+ ```powershell
168
+ if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
169
+ Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
170
+ Select-Object -ExpandProperty OwningProcess -Unique |
171
+ ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
172
+ ```
173
+
174
+ If you choose opencli, follow this workflow:
175
+
176
+ **Using: opencli** (reuses Chrome logged-in sessions)
177
+
178
+ **CRITICAL CONSTRAINT — opencli browser ONLY**:
179
+ - You MUST use `opencli browser` for ALL browser interactions in this phase
180
+ - All browser actions go through `opencli browser <command>` in the PowerShell tool
23
181
 
24
- Use `opencli` instead of `playwright-cli` only when the scenario requires an existing Chrome login/session or third-party integration cookies.
182
+ **Step 0 OpenCLI Readiness Check (BLOCKING)**:
25
183
 
26
- Record your choice:
184
+ 0a. Check if `opencli` is installed:
27
185
  ```powershell
28
- $BROWSER_TOOL = "playwright-cli" # or "opencli" or "skipped"
29
- "Selected browser tool: $BROWSER_TOOL"
186
+ $opencli = Get-Command opencli -ErrorAction SilentlyContinue
187
+ if ($opencli) { opencli --version } else { "NOT_INSTALLED" }
30
188
  ```
189
+ If `NOT_INSTALLED`: `npm install -g @jackwener/opencli@latest`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` and proceed.
190
+
191
+ 0b. Verify Browser Bridge: `opencli doctor`. If fails, log skip and proceed.
31
192
 
32
- If `$BROWSER_TOOL -eq "skipped"`, do NOT start a dev server and do NOT run browser commands. Go directly to result reporting and the checkpoint update.
193
+ 0c. Learn usage:
194
+ ```powershell
195
+ opencli browser --help 2>$null
196
+ if ($LASTEXITCODE -ne 0) { opencli --help }
197
+ ```
33
198
 
34
- **Dev server setup**:
199
+ **Step 1 — Start Dev Server**: use the same port detection and server lifecycle pattern as the playwright-cli path:
35
200
  ```powershell
36
201
  $DEV_PORT = "{{DEV_PORT}}"
37
- if ($DEV_PORT -eq "{{DEV_PORT}}") {
38
- $detected = node -e "const p=require('./package.json'); const s = p.scripts ? p.scripts.dev : ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
39
- if ($detected) { $DEV_PORT = $detected } else { $DEV_PORT = "3000" }
202
+ if ($DEV_PORT -eq "{{DEV_PORT}}" -or [string]::IsNullOrWhiteSpace($DEV_PORT)) {
203
+ $detectedPort = ""
204
+ if (Test-Path -LiteralPath "package.json") {
205
+ $detectedPort = node -e "const p=require('./package.json'); const s=(p.scripts?.dev) || ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
206
+ }
207
+ if (-not $detectedPort -and $env:NEXT_PUBLIC_SITE_URL -match ':([0-9]+)') {
208
+ $detectedPort = $Matches[1]
209
+ }
210
+ if ($detectedPort) { $DEV_PORT = $detectedPort } else { $DEV_PORT = "3000" }
40
211
  }
41
212
  "Detected DEV_PORT=$DEV_PORT"
213
+ ```
214
+ ```powershell
42
215
  $portBusy = Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue
43
216
  if ($portBusy) { "PORT_IN_USE" } else { "PORT_FREE" }
44
-
45
- # Replace <start-command> with the project-specific dev command.
46
- $server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", "<start-command>") -PassThru
217
+ $devServerCommand = "<start-command>"
218
+ $server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", $devServerCommand) -PassThru
47
219
  $DEV_SERVER_PID = $server.Id
48
220
  ```
49
221
 
50
- Wait for readiness:
222
+ Wait for server to be ready: poll `http://localhost:$DEV_PORT` until it returns 200 or 302 (max 30 seconds, 2s interval):
51
223
  ```powershell
52
224
  $ready = $false
53
225
  for ($i = 0; $i -lt 15; $i++) {
54
226
  try {
55
227
  $response = Invoke-WebRequest -Uri "http://localhost:$DEV_PORT" -UseBasicParsing -TimeoutSec 2
56
228
  if ($response.StatusCode -in @(200, 302)) { $ready = $true; break }
57
- } catch { Start-Sleep -Seconds 2 }
229
+ } catch {
230
+ Start-Sleep -Seconds 2
231
+ }
58
232
  }
59
233
  if (-not $ready) { "DEV_SERVER_NOT_READY" }
60
234
  ```
61
235
 
62
- **Verification goals**:
236
+ Start server, wait for ready, then:
237
+ ```powershell
238
+ opencli browser open "http://localhost:$DEV_PORT"
239
+ if ($LASTEXITCODE -eq 0) { opencli browser state }
240
+ ```
241
+
242
+ **Step 2 — Verification**:
243
+
244
+ Use `opencli browser state` to discover elements with `[N]` indices, then verify:
63
245
  {{BROWSER_VERIFY_STEPS}}
64
246
 
65
- Use the selected browser tool to inspect current page state, perform actions, and take a final screenshot:
66
- - `playwright-cli open http://localhost:$DEV_PORT`, `playwright-cli snapshot`, `playwright-cli screenshot`, `playwright-cli close`
67
- - `opencli browser open http://localhost:$DEV_PORT`, `opencli browser state`, `opencli browser screenshot`, `opencli browser close`
247
+ Chain commands in PowerShell with semicolons and inspect each result, for example: `opencli browser click <N>; opencli browser wait time 1; opencli browser state`
248
+
249
+ **Step 3 Cleanup**:
250
+ 1. `opencli browser close`
251
+ 2. Stop the dev server process and any remaining process bound to the dev server port:
252
+ ```powershell
253
+ if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
254
+ Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
255
+ Select-Object -ExpandProperty OwningProcess -Unique |
256
+ ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
257
+ ```
68
258
 
69
- Base concrete actions on the Task Contract's Verification Gates.
259
+ **Step 4 Reporting**:
70
260
 
71
- **Cleanup**:
72
- ```powershell
73
- if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
74
- Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
75
- Select-Object -ExpandProperty OwningProcess -Unique |
76
- ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
261
+ Append results to `context-snapshot.md`:
262
+ ```
263
+ ## Browser Verification
264
+ Tool: <playwright-cli or opencli>
265
+ URL: http://localhost:$DEV_PORT
266
+ Dev Server Command: <actual command used>
267
+ Tool version: <version>
268
+ Steps executed: [list of commands used]
269
+ Screenshot: [path]
270
+ Result: PASS / FAIL (reason)
271
+ Server cleanup: confirmed
272
+ Browser cleanup: confirmed
77
273
  ```
78
274
 
79
- Append results to `context-snapshot.md` with tool, URL, commands used, screenshot path, PASS/FAIL/SKIPPED reason, and cleanup status.
275
+ If verification fails, log the failure details but continue to commit. Failures do NOT block the commit, but you MUST attempt verification and MUST clean up the dev server.
80
276
 
81
- **Checkpoint update**:
277
+ **Checkpoint update**: Run the update script to set step `browser-verification` to `"completed"`:
82
278
  ```powershell
83
- Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py --checkpoint-path {{CHECKPOINT_PATH}} --step browser-verification --status completed
279
+ Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py `
280
+ --checkpoint-path {{CHECKPOINT_PATH}} `
281
+ --step browser-verification `
282
+ --status completed
84
283
  ```
@@ -1,63 +1,112 @@
1
1
  ### Browser Verification (opencli) — MANDATORY
2
2
 
3
- You MUST execute this phase with `opencli browser`. Use native PowerShell commands for setup, server lifecycle, and cleanup.
3
+ You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without actually running opencli.
4
4
 
5
- **Readiness**:
5
+ **Using: opencli** (reuses Chrome logged-in sessions)
6
+
7
+ **CRITICAL CONSTRAINT — opencli browser ONLY**:
8
+ - You MUST use `opencli browser` for ALL browser interactions in this phase
9
+ - All browser actions go through `opencli browser <command>` in the PowerShell tool
10
+
11
+ **Step 0 — OpenCLI Readiness Check (BLOCKING)**:
12
+
13
+ 0a. Check if `opencli` is installed:
6
14
  ```powershell
7
15
  $opencli = Get-Command opencli -ErrorAction SilentlyContinue
8
- if ($opencli) { opencli --version } else { "OPENCLI:NOT_INSTALLED" }
9
- opencli doctor
16
+ if ($opencli) { opencli --version } else { "NOT_INSTALLED" }
10
17
  ```
18
+ If `NOT_INSTALLED`: `npm install -g @jackwener/opencli@latest`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` and proceed.
19
+
20
+ 0b. Verify Browser Bridge: `opencli doctor`. If fails, log skip and proceed.
11
21
 
12
- If opencli is not available, install it:
22
+ 0c. Learn usage:
13
23
  ```powershell
14
- npm install -g @jackwener/opencli@latest
15
- opencli --version
24
+ opencli browser --help 2>$null
25
+ if ($LASTEXITCODE -ne 0) { opencli --help }
16
26
  ```
17
27
 
18
- **Dev server setup**:
28
+ **Step 1 — Start Dev Server**: use the same port detection and server lifecycle pattern as the playwright-cli path:
19
29
  ```powershell
20
30
  $DEV_PORT = "{{DEV_PORT}}"
21
- if ($DEV_PORT -eq "{{DEV_PORT}}") {
22
- $detected = node -e "const p=require('./package.json'); const s = p.scripts ? p.scripts.dev : ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
23
- if ($detected) { $DEV_PORT = $detected } else { $DEV_PORT = "3000" }
31
+ if ($DEV_PORT -eq "{{DEV_PORT}}" -or [string]::IsNullOrWhiteSpace($DEV_PORT)) {
32
+ $detectedPort = ""
33
+ if (Test-Path -LiteralPath "package.json") {
34
+ $detectedPort = node -e "const p=require('./package.json'); const s=(p.scripts?.dev) || ''; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')"
35
+ }
36
+ if (-not $detectedPort -and $env:NEXT_PUBLIC_SITE_URL -match ':([0-9]+)') {
37
+ $detectedPort = $Matches[1]
38
+ }
39
+ if ($detectedPort) { $DEV_PORT = $detectedPort } else { $DEV_PORT = "3000" }
24
40
  }
25
41
  "Detected DEV_PORT=$DEV_PORT"
42
+ ```
43
+ ```powershell
26
44
  $portBusy = Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue
27
45
  if ($portBusy) { "PORT_IN_USE" } else { "PORT_FREE" }
28
- $server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", "<start-command>") -PassThru
46
+ $devServerCommand = "<start-command>"
47
+ $server = Start-Process -FilePath "powershell" -ArgumentList @("-NoProfile", "-Command", $devServerCommand) -PassThru
29
48
  $DEV_SERVER_PID = $server.Id
30
49
  ```
31
50
 
32
- Wait for readiness:
51
+ Wait for server to be ready: poll `http://localhost:$DEV_PORT` until it returns 200 or 302 (max 30 seconds, 2s interval):
33
52
  ```powershell
34
53
  $ready = $false
35
54
  for ($i = 0; $i -lt 15; $i++) {
36
55
  try {
37
56
  $response = Invoke-WebRequest -Uri "http://localhost:$DEV_PORT" -UseBasicParsing -TimeoutSec 2
38
57
  if ($response.StatusCode -in @(200, 302)) { $ready = $true; break }
39
- } catch { Start-Sleep -Seconds 2 }
58
+ } catch {
59
+ Start-Sleep -Seconds 2
60
+ }
40
61
  }
41
62
  if (-not $ready) { "DEV_SERVER_NOT_READY" }
42
63
  ```
43
64
 
44
- **Verification goals**:
65
+ Start server, wait for ready, then:
66
+ ```powershell
67
+ opencli browser open "http://localhost:$DEV_PORT"
68
+ if ($LASTEXITCODE -eq 0) { opencli browser state }
69
+ ```
70
+
71
+ **Step 2 — Verification**:
72
+
73
+ Use `opencli browser state` to discover elements with `[N]` indices, then verify:
45
74
  {{BROWSER_VERIFY_STEPS}}
46
75
 
47
- Use `opencli browser open http://localhost:$DEV_PORT`, `opencli browser state`, indexed interaction commands from `opencli browser --help`, and `opencli browser screenshot`.
76
+ Chain commands in PowerShell with semicolons and inspect each result, for example: `opencli browser click <N>; opencli browser wait time 1; opencli browser state`
48
77
 
49
- **Cleanup**:
50
- ```powershell
51
- opencli browser close
52
- if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
53
- Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
54
- Select-Object -ExpandProperty OwningProcess -Unique |
55
- ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
78
+ **Step 3 — Cleanup**:
79
+ 1. `opencli browser close`
80
+ 2. Stop the dev server process and any remaining process bound to the dev server port:
81
+ ```powershell
82
+ if ($DEV_SERVER_PID) { Stop-Process -Id $DEV_SERVER_PID -Force -ErrorAction SilentlyContinue }
83
+ Get-NetTCPConnection -LocalPort ([int]$DEV_PORT) -ErrorAction SilentlyContinue |
84
+ Select-Object -ExpandProperty OwningProcess -Unique |
85
+ ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
86
+ ```
87
+
88
+ **Step 4 — Reporting**:
89
+
90
+ Append results to `context-snapshot.md`:
91
+ ```
92
+ ## Browser Verification
93
+ Tool: <playwright-cli or opencli>
94
+ URL: http://localhost:$DEV_PORT
95
+ Dev Server Command: <actual command used>
96
+ Tool version: <version>
97
+ Steps executed: [list of commands used]
98
+ Screenshot: [path]
99
+ Result: PASS / FAIL (reason)
100
+ Server cleanup: confirmed
101
+ Browser cleanup: confirmed
56
102
  ```
57
103
 
58
- Append results to `context-snapshot.md` with URL, command used, opencli version, steps executed, screenshot path, PASS/FAIL reason, and cleanup status.
104
+ If verification fails, log the failure details but continue to commit. Failures do NOT block the commit, but you MUST attempt verification and MUST clean up the dev server.
59
105
 
60
- **Checkpoint update**:
106
+ **Checkpoint update**: Run the update script to set step `browser-verification` to `"completed"`:
61
107
  ```powershell
62
- Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py --checkpoint-path {{CHECKPOINT_PATH}} --step browser-verification --status completed
108
+ Invoke-PrizmPython {{PIPELINE_DIR}}\scripts\update-checkpoint.py `
109
+ --checkpoint-path {{CHECKPOINT_PATH}} `
110
+ --step browser-verification `
111
+ --status completed
63
112
  ```