prizmkit 1.1.108 → 1.1.109

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 (39) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +20 -0
  3. package/bundled/dev-pipeline/prizmkit_runtime/commands.py +1 -0
  4. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +21 -0
  5. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -0
  6. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +208 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +508 -0
  8. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +3 -1
  9. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +3 -1
  10. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +3 -1
  11. package/bundled/dev-pipeline/scripts/prizmkit-runtime-helper.py +27 -0
  12. package/bundled/dev-pipeline/scripts/utils.py +48 -77
  13. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +33 -60
  14. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +35 -62
  15. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +40 -66
  16. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +2 -2
  17. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +2 -2
  18. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
  19. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +31 -54
  20. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +21 -30
  21. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +22 -62
  22. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +1 -1
  23. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +1 -1
  24. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +1 -1
  25. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +1 -1
  26. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +1 -1
  27. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -2
  28. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +1 -1
  29. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
  30. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +7 -6
  31. package/bundled/dev-pipeline/templates/sections/phase0-init.md +1 -1
  32. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
  33. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +45 -3
  34. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +2 -1
  35. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +2 -1
  36. package/bundled/dev-pipeline/tests/test_runtime_helper.py +211 -0
  37. package/bundled/dev-pipeline/tests/test_unified_cli.py +5 -0
  38. package/bundled/skills/_metadata.json +1 -1
  39. package/package.json +1 -1
@@ -79,7 +79,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
79
79
  ## Subagent Timeout Recovery
80
80
 
81
81
  If any agent times out:
82
- 1. `ls .prizmkit/specs/{{FEATURE_SLUG}}/` — check what exists
82
+ 1. `{{RUNTIME_HELPER_CMD}} artifact list .prizmkit/specs/{{FEATURE_SLUG}}` — check what exists
83
83
  2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and any Implementation Log/Review Notes from previous agents. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
84
84
  3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
85
85
 
@@ -90,7 +90,7 @@ If any agent times out:
90
90
  {{IF_INIT_NEEDED}}
91
91
  ### Phase 0: Project Bootstrap
92
92
  - Run `/prizmkit-init` (invoke the prizmkit-init skill)
93
- - Run `python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
93
+ - Run `{{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
94
94
  - **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
95
95
  {{END_IF_INIT_NEEDED}}
96
96
  {{IF_INIT_DONE}}
@@ -98,14 +98,14 @@ If any agent times out:
98
98
  ### Step 1: Initialize
99
99
 
100
100
  1. Run init script:
101
- `python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
101
+ `{{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
102
102
 
103
103
  2. Check for existing artifacts:
104
- `ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null`
104
+ `{{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}`
105
105
 
106
106
  {{IF_FRESH_START}}
107
107
  ```bash
108
- python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}
108
+ {{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}
109
109
  ```
110
110
  {{END_IF_FRESH_START}}
111
111
 
@@ -113,7 +113,7 @@ python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEAT
113
113
 
114
114
  Check existing artifacts first:
115
115
  ```bash
116
- ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null
116
+ {{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}
117
117
  ```
118
118
 
119
119
  - Both (spec.md, plan.md) exist → **SKIP to CP-1**
@@ -132,11 +132,11 @@ If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing
132
132
  **Step A — Build Context Snapshot** (skip if `context-snapshot.md` already exists):
133
133
 
134
134
  1. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 prizm docs
135
- 2. Detect source code directories: read KEY_FILES and STRUCTURE sections from `root.prizm` to identify where source code lives (e.g. `src/`, `app/`, `lib/`, `cmd/`, `packages/`, or project root). If `root.prizm` is missing, scan the project tree:
135
+ 2. Detect source code directories from KEY_FILES and STRUCTURE sections in `root.prizm`; if root docs are unavailable, use the helper to list likely source files:
136
136
  ```bash
137
- find . -maxdepth 2 -type f \( -name "*.js" -o -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.java" -o -name "*.rb" -o -name "*.rs" \) -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/vendor/*' | head -30
137
+ {{RUNTIME_HELPER_CMD}} artifact source-files . --json
138
138
  ```
139
- Identify the top-level source directories from the results.
139
+ Identify the top-level source directories from the helper output.
140
140
  3. Scan the detected source directories for files related to this feature; read each one
141
141
  4. Write `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`:
142
142
  - **Section 1 — Feature Brief**: feature description (2-3 lines) + acceptance criteria (copy from above)
@@ -155,14 +155,15 @@ If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing
155
155
 
156
156
  ### Known TRAPS (from .prizmkit/prizm-docs/)
157
157
  - <trap entries extracted from L1/L2 docs>
158
- 4. Confirm: `ls .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`
158
+ 4. Confirm: `{{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md`
159
159
 
160
160
  **After Step A**: Use context-snapshot.md Section 4 File Manifest to guide targeted file reads. Do NOT scan directories or read unrelated files.
161
161
 
162
162
  **Step B — Planning Artifacts** (generate only missing files):
163
163
 
164
164
  ```bash
165
- ls .prizmkit/specs/{{FEATURE_SLUG}}/spec.md .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null
165
+ {{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}/spec.md
166
+ {{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}/plan.md
166
167
  ```
167
168
 
168
169
  - spec.md missing: Run `/prizmkit-plan` → generate spec.md. Resolve uncertain requirements from the feature description, existing code, and conservative existing-project patterns.
@@ -202,7 +203,7 @@ Wait for Reviewer to return.
202
203
 
203
204
  **Guard**: Verify critic agent file exists before spawning:
204
205
  ```bash
205
- ls {{CRITIC_SUBAGENT_PATH}} 2>/dev/null && echo "CRITIC:READY" || echo "CRITIC:MISSING"
206
+ {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
206
207
  ```
207
208
  If CRITIC:MISSING — skip Phase 3.5 entirely and proceed to Phase 4. Log: "Critic agent not installed — skipping Plan Challenge."
208
209
 
@@ -308,7 +309,7 @@ The skill runs an internal review-fix loop (Reviewer Agent → filter → orches
308
309
  **Gate Check — Review Report**:
309
310
  After `/prizmkit-code-review` returns, verify the review report:
310
311
  ```bash
311
- grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
312
+ {{RUNTIME_HELPER_CMD}} text contains .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md --pattern "## Verdict"
312
313
  ```
313
314
  If GATE:MISSING:
314
315
  - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
@@ -328,8 +329,8 @@ Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLU
328
329
 
329
330
  Before invoking the skill, create a current-run marker so stale reports are ignored:
330
331
  ```bash
331
- mkdir -p .prizmkit/specs/{{FEATURE_SLUG}}
332
- touch .prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started
332
+ {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/specs/{{FEATURE_SLUG}}
333
+ {{RUNTIME_HELPER_CMD}} artifact touch .prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started
333
334
  ```
334
335
 
335
336
  Gate requirements:
@@ -360,13 +361,13 @@ You MUST execute this phase. Do NOT skip it.
360
361
 
361
362
  0a. Check if `playwright-cli` is installed:
362
363
  ```bash
363
- which playwright-cli 2>/dev/null && playwright-cli --version 2>/dev/null || echo "NOT_INSTALLED"
364
+ {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
364
365
  ```
365
366
  If output is `NOT_INSTALLED`, install it:
366
367
  ```bash
367
368
  npm install -g @playwright/cli@latest
368
369
  ```
369
- Then verify installation succeeded: `playwright-cli --version`. If installation fails, log `## Browser Verification: SKIPPED — playwright-cli installation failed` in context-snapshot.md and proceed to the next phase.
370
+ Then verify installation succeeded: `{{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version`. If installation fails, log `## Browser Verification: SKIPPED — playwright-cli installation failed` in context-snapshot.md and proceed to the next phase.
370
371
 
371
372
  0b. Learn playwright-cli usage (run once per session):
372
373
  ```bash
@@ -375,21 +376,9 @@ playwright-cli --help
375
376
 
376
377
  0c. Check if playwright-cli skill is installed for the current AI platform:
377
378
  ```bash
378
- CURRENT_PLATFORM=""
379
- if which claude >/dev/null 2>&1; then
380
- CURRENT_PLATFORM="claude"; SKILL_DIR="$HOME/.claude/skills"
381
- elif which cbc >/dev/null 2>&1; then
382
- CURRENT_PLATFORM="codebuddy"; SKILL_DIR="$HOME/.cbc/skills"
383
- else
384
- CURRENT_PLATFORM="unknown"
385
- fi
386
- if [ -d "$SKILL_DIR/playwright-cli" ] || ls "$SKILL_DIR"/playwright* 2>/dev/null | grep -q .; then
387
- echo "SKILL_EXISTS"
388
- else
389
- echo "SKILL_MISSING"
390
- fi
379
+ {{RUNTIME_HELPER_CMD}} platform skill playwright-cli --prefix
391
380
  ```
392
- If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform is NOT claude, copy installed skill from `$HOME/.claude/skills/playwright-cli` to `$SKILL_DIR/playwright-cli`.
381
+ If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform is NOT claude, copy installed skill from `$HOME/.claude/skills/playwright-cli` to the path shown by the helper output for the current platform.
393
382
 
394
383
  0d. Read the installed playwright-cli skill (SKILL.md) for workflow guidance. Use its recommended patterns to construct your verification flow.
395
384
 
@@ -398,28 +387,16 @@ If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform i
398
387
  You know this project's tech stack. Detect and start the dev server yourself:
399
388
 
400
389
  1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
401
- 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:
402
- ```bash
403
- DEV_PORT={{DEV_PORT}}
404
- if [ "$DEV_PORT" = "{{DEV_PORT}}" ]; then
405
- DEV_PORT=$(node -e "const s=require('./package.json').scripts.dev; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')")
406
- if [ -z "$DEV_PORT" ]; then
407
- DEV_PORT=$(echo "$NEXT_PUBLIC_SITE_URL" | sed -nE 's|.*:([0-9]+).*|\1|p')
408
- fi
409
- DEV_PORT=${DEV_PORT:-3000}
410
- fi
411
- echo "Detected DEV_PORT=$DEV_PORT"
412
- ```
390
+ 2. Determine the dev server port from the pre-detected pipeline value (`{{DEV_PORT}}`) or project config. Do NOT hardcode or guess the port. Record it as `DEV_PORT` in your notes.
413
391
  3. Verify the port is available:
414
392
  ```bash
415
- lsof -ti:$DEV_PORT 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
393
+ {{RUNTIME_HELPER_CMD}} port check $DEV_PORT
416
394
  ```
417
395
  4. Start the dev server in background, capture PID:
418
396
  ```bash
419
- <start-command> &
420
- DEV_SERVER_PID=$!
397
+ {{RUNTIME_HELPER_CMD}} process start --pid-file .prizmkit/state/browser-dev-server.pid -- <start-command tokens>
421
398
  ```
422
- 5. Wait for server to be ready: poll `http://localhost:$DEV_PORT` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
399
+ 5. Wait for server to be ready: run `{{RUNTIME_HELPER_CMD}} web wait-ready --url http://localhost:$DEV_PORT --timeout 30 --interval 2`
423
400
  6. Open the app in playwright-cli: `playwright-cli open http://localhost:$DEV_PORT`
424
401
  7. If the page requires authentication, use playwright-cli to register a test user and log in first
425
402
 
@@ -433,8 +410,8 @@ Construct your verification workflow based on: (1) the playwright-cli skill docu
433
410
  **Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
434
411
 
435
412
  1. Close the playwright-cli browser: `playwright-cli close`
436
- 2. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
437
- 3. Verify port is released: `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
413
+ 2. Kill the dev server process: `{{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>`
414
+ 3. Verify port is released: `{{RUNTIME_HELPER_CMD}} process cleanup-port $DEV_PORT`
438
415
  {{END_IF_BROWSER_TOOL_PLAYWRIGHT}}
439
416
  {{IF_BROWSER_TOOL_OPENCLI}}
440
417
  **Using: opencli** (reuses Chrome logged-in sessions)
@@ -447,45 +424,42 @@ Construct your verification workflow based on: (1) the playwright-cli skill docu
447
424
 
448
425
  0a. Check if `opencli` is installed:
449
426
  ```bash
450
- which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "NOT_INSTALLED"
427
+ {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
451
428
  ```
452
429
  If `NOT_INSTALLED`: `npm install -g @jackwener/opencli@latest`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` and proceed.
453
430
 
454
431
  0b. Verify Browser Bridge: `opencli doctor`. If fails, log skip and proceed.
455
432
 
456
- 0c. Learn usage: `opencli browser --help 2>/dev/null || opencli --help`
433
+ 0c. Learn usage: `opencli browser --help`
457
434
 
458
- **Step 1 — Start Dev Server**: (same port detection as playwright path)
459
- ```bash
460
- DEV_PORT={{DEV_PORT}}
461
- if [ "$DEV_PORT" = "{{DEV_PORT}}" ]; then
462
- DEV_PORT=$(node -e "const s=require('./package.json').scripts.dev; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')" 2>/dev/null)
463
- DEV_PORT=${DEV_PORT:-3000}
464
- fi
465
- ```
466
- Start server, wait for ready, then: `opencli browser open http://localhost:$DEV_PORT && opencli browser state`
435
+ **Step 1 — Start Dev Server**:
436
+ 1. Determine `DEV_PORT` from the pipeline value (`{{DEV_PORT}}`) or project config; do not guess.
437
+ 2. Verify port available: `{{RUNTIME_HELPER_CMD}} port check <DEV_PORT>`
438
+ 3. Start server: `{{RUNTIME_HELPER_CMD}} process start --pid-file .prizmkit/state/browser-dev-server.pid -- <start-command tokens>`
439
+ 4. Wait for ready: `{{RUNTIME_HELPER_CMD}} web wait-ready --url http://localhost:<DEV_PORT> --timeout 30 --interval 2`
440
+ 5. Open: `opencli browser open http://localhost:<DEV_PORT>`; then inspect: `opencli browser state`
467
441
 
468
442
  **Step 2 — Verification**:
469
443
 
470
444
  Use `opencli browser state` to discover elements with `[N]` indices, then verify:
471
445
  {{BROWSER_VERIFY_STEPS}}
472
446
 
473
- Chain commands: `opencli browser click <N> && opencli browser wait time 1 && opencli browser state`
447
+ Run page-changing commands sequentially, then run `opencli browser state` to refresh indices.
474
448
 
475
449
  **Step 3 — Cleanup**:
476
450
  1. `opencli browser close`
477
- 2. `kill $DEV_SERVER_PID 2>/dev/null || true`
478
- 3. `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
451
+ 2. `{{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>`
452
+ 3. `{{RUNTIME_HELPER_CMD}} process cleanup-port $DEV_PORT`
479
453
  {{END_IF_BROWSER_TOOL_OPENCLI}}
480
454
  {{IF_BROWSER_TOOL_AUTO}}
481
455
  **Tool Selection**: Choose the best browser tool at runtime.
482
456
 
483
457
  **Step 0 — Detect available tools**:
484
458
  ```bash
485
- echo "=== playwright-cli ===" && which playwright-cli 2>/dev/null && playwright-cli --version 2>/dev/null || echo "NOT_INSTALLED"
486
- echo "=== opencli ===" && which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "NOT_INSTALLED"
459
+ {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
460
+ {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
487
461
  ```
488
- If opencli installed: `opencli doctor 2>/dev/null || echo "OPENCLI_BRIDGE_FAILED"`
462
+ If opencli is installed, run `opencli doctor`. If it fails, mark OpenCLI unusable and choose playwright-cli or skip browser verification.
489
463
 
490
464
  **Decision table**:
491
465
  | Condition | Tool |
@@ -70,7 +70,7 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
70
70
  ### Phase 0: Initialize
71
71
 
72
72
  ```bash
73
- mkdir -p .prizmkit/bugfix/{{BUG_ID}}
73
+ {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/bugfix/{{BUG_ID}}
74
74
  ```
75
75
 
76
76
  {{IF_BROWSER_INTERACTION}}
@@ -186,7 +186,7 @@ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
186
186
  **Gate Check — Review Report**:
187
187
  After `/prizmkit-code-review` returns, verify the review report:
188
188
  ```bash
189
- grep -q "## Verdict" .prizmkit/bugfix/{{BUG_ID}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
189
+ {{RUNTIME_HELPER_CMD}} text contains .prizmkit/bugfix/{{BUG_ID}}/review-report.md --pattern "## Verdict"
190
190
  ```
191
191
  If GATE:MISSING:
192
192
  - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
@@ -96,7 +96,7 @@ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
96
96
 
97
97
  Create refactor artifacts directory:
98
98
  ```bash
99
- mkdir -p .prizmkit/refactor/{{REFACTOR_ID}}
99
+ {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/refactor/{{REFACTOR_ID}}
100
100
  ```
101
101
 
102
102
  ### Step 2: Pipeline Phases
@@ -208,7 +208,7 @@ Evidence must cover affected UI render, primary user interactions, behavior-sens
208
208
  - **Gate Check — Review Report**:
209
209
  After Reviewer returns, verify the review report contains a verdict:
210
210
  ```bash
211
- grep -q "## Verdict" .prizmkit/refactor/{{REFACTOR_ID}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
211
+ {{RUNTIME_HELPER_CMD}} text contains .prizmkit/refactor/{{REFACTOR_ID}}/review-report.md --pattern "## Verdict"
212
212
  ```
213
213
  If GATE:MISSING:
214
214
  - Do not enter an unbounded report-repair loop and do not repeatedly re-spawn Reviewer.
@@ -9,7 +9,7 @@ A checkpoint file tracks your progress through this workflow:
9
9
  Use this helper to update checkpoint status. Do not hand-edit `workflow-checkpoint.json` directly.
10
10
 
11
11
  ```bash
12
- python3 .prizmkit/dev-pipeline/scripts/update-checkpoint.py \
12
+ {{CHECKPOINT_PYTHON_CMD}} \
13
13
  --checkpoint-path {{CHECKPOINT_PATH}} \
14
14
  --step <step-id-or-skill-name> \
15
15
  --status <in_progress|completed|failed|skipped> \
@@ -6,10 +6,8 @@ You MUST attempt this phase. Mark it as skipped only when no usable browser tool
6
6
 
7
7
  0a. Check which browser tools are available:
8
8
  ```bash
9
- echo "=== playwright-cli ==="
10
- which playwright-cli 2>/dev/null && playwright-cli --version 2>/dev/null || echo "PLAYWRIGHT_CLI:NOT_INSTALLED"
11
- echo "=== opencli ==="
12
- which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "OPENCLI:NOT_INSTALLED"
9
+ {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
10
+ {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
13
11
  ```
14
12
 
15
13
  0b. Use this single decision tree:
@@ -18,19 +16,15 @@ which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "OPENCLI:NOT_
18
16
  3. Else install `playwright-cli` as the default:
19
17
  ```bash
20
18
  npm install -g @playwright/cli@latest
21
- playwright-cli --version
19
+ {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
22
20
  ```
23
21
  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.
24
22
 
25
23
  Use `opencli` instead of `playwright-cli` only when the scenario requires an existing Chrome login/session or third-party integration cookies.
26
24
 
27
- Record your choice:
28
- ```bash
29
- BROWSER_TOOL="playwright-cli" # or "opencli" or "skipped"
30
- echo "Selected browser tool: $BROWSER_TOOL"
31
- ```
25
+ Record your choice in the Browser Verification report as `Tool: playwright-cli`, `Tool: opencli`, or `Tool: skipped`.
32
26
 
33
- If `BROWSER_TOOL="skipped"`, do NOT start a dev server and do NOT run browser commands. Go directly to Step 4 Reporting and the checkpoint update.
27
+ If tool is `skipped`, do NOT start a dev server and do NOT run browser commands. Go directly to Step 4 Reporting and the checkpoint update.
34
28
 
35
29
  ---
36
30
 
@@ -38,27 +32,15 @@ If `BROWSER_TOOL="skipped"`, do NOT start a dev server and do NOT run browser co
38
32
 
39
33
  0d. Check if playwright-cli skill is installed for the current AI platform:
40
34
  ```bash
41
- CURRENT_PLATFORM=""
42
- if which claude >/dev/null 2>&1; then
43
- CURRENT_PLATFORM="claude"; SKILL_DIR="$HOME/.claude/skills"
44
- elif which cbc >/dev/null 2>&1; then
45
- CURRENT_PLATFORM="codebuddy"; SKILL_DIR="$HOME/.cbc/skills"
46
- else
47
- CURRENT_PLATFORM="unknown"
48
- fi
49
- if [ -d "$SKILL_DIR/playwright-cli" ] || ls "$SKILL_DIR"/playwright* 2>/dev/null | grep -q .; then
50
- echo "SKILL_EXISTS"
51
- else
52
- echo "SKILL_MISSING"
53
- fi
35
+ {{RUNTIME_HELPER_CMD}} platform skill playwright-cli --prefix
54
36
  ```
55
- If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform is NOT claude, copy installed skill from `$HOME/.claude/skills/playwright-cli` to `$SKILL_DIR/playwright-cli`.
37
+ If `SKILL_MISSING`: run `playwright-cli install --skills`. If current platform is NOT claude, copy installed skill from `$HOME/.claude/skills/playwright-cli` to the path shown by the helper output for the current platform.
56
38
 
57
39
  0e. Read the installed playwright-cli skill (SKILL.md) for workflow guidance. Learn usage: `playwright-cli --help`.
58
40
 
59
41
  **Step 1 — Start Dev Server + Open (playwright-cli)**:
60
- 1. Identify and start the dev server (see port detection below)
61
- 2. Open: `playwright-cli open http://localhost:$DEV_PORT`
42
+ 1. Identify and start the dev server (see shared helper commands below)
43
+ 2. Open: `playwright-cli open http://localhost:<DEV_PORT>`
62
44
  3. If auth needed, use playwright-cli to register a test user and log in
63
45
 
64
46
  **Step 2 — Verification (playwright-cli)**:
@@ -69,18 +51,18 @@ Construct your verification workflow based on: (1) the playwright-cli skill docu
69
51
 
70
52
  **Step 3 — Cleanup (playwright-cli)**:
71
53
  1. `playwright-cli close`
72
- 2. `kill $DEV_SERVER_PID 2>/dev/null || true`
73
- 3. `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
54
+ 2. `{{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>`
55
+ 3. `{{RUNTIME_HELPER_CMD}} port check <DEV_PORT>`
74
56
 
75
57
  ---
76
58
 
77
59
  **If you chose `opencli`**, follow this workflow:
78
60
 
79
- 0d. Learn usage: `opencli browser --help 2>/dev/null || opencli --help`
61
+ 0d. Learn usage: `opencli browser --help`
80
62
 
81
63
  **Step 1 — Start Dev Server + Open (opencli)**:
82
- 1. Identify and start the dev server (see port detection below)
83
- 2. Open and inspect: `opencli browser open http://localhost:$DEV_PORT && opencli browser state`
64
+ 1. Identify and start the dev server (see shared helper commands below)
65
+ 2. Open and inspect: `opencli browser open http://localhost:<DEV_PORT> && opencli browser state`
84
66
  3. If auth needed, opencli reuses Chrome cookies — SSO/OAuth may already be active
85
67
 
86
68
  **Step 2 — Verification (opencli)**:
@@ -95,30 +77,26 @@ Always run `state` after page-changing actions to get fresh indices.
95
77
 
96
78
  **Step 3 — Cleanup (opencli)**:
97
79
  1. `opencli browser close`
98
- 2. `kill $DEV_SERVER_PID 2>/dev/null || true`
99
- 3. `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
80
+ 2. `{{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>`
81
+ 3. `{{RUNTIME_HELPER_CMD}} port check <DEV_PORT>`
100
82
 
101
83
  ---
102
84
 
103
- **Shared: Dev Server Port Detection** (used by both tools):
104
-
105
- ```bash
106
- DEV_PORT={{DEV_PORT}}
107
- if [ "$DEV_PORT" = "{{DEV_PORT}}" ]; then
108
- DEV_PORT=$(node -e "const s=require('./package.json').scripts.dev; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')")
109
- if [ -z "$DEV_PORT" ]; then
110
- DEV_PORT=$(echo "$NEXT_PUBLIC_SITE_URL" | sed -nE 's|.*:([0-9]+).*|\1|p')
111
- fi
112
- DEV_PORT=${DEV_PORT:-3000}
113
- fi
114
- echo "Detected DEV_PORT=$DEV_PORT"
115
- ```
116
-
117
- Verify port available: `lsof -ti:$DEV_PORT 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"`
118
-
119
- Start dev server: `<start-command> & DEV_SERVER_PID=$!`
85
+ **Shared: Dev Server Port / Process Helpers** (used by both tools):
120
86
 
121
- Wait for ready: poll `http://localhost:$DEV_PORT` with `curl -s -o /dev/null -w "%{http_code}"` until 200/302 (max 30s, 2s interval).
87
+ 1. Determine `DEV_PORT` from the pipeline value (`{{DEV_PORT}}`) or project config; do not guess.
88
+ 2. Verify port available:
89
+ ```bash
90
+ {{RUNTIME_HELPER_CMD}} port check <DEV_PORT>
91
+ ```
92
+ 3. Start dev server:
93
+ ```bash
94
+ {{RUNTIME_HELPER_CMD}} process start --pid-file .prizmkit/state/browser-dev-server.pid -- <start-command tokens>
95
+ ```
96
+ 4. Wait for ready:
97
+ ```bash
98
+ {{RUNTIME_HELPER_CMD}} web wait-ready --url http://localhost:<DEV_PORT> --timeout 30 --interval 2
99
+ ```
122
100
 
123
101
  ---
124
102
 
@@ -128,7 +106,7 @@ Append results to `context-snapshot.md`:
128
106
  ```
129
107
  ## Browser Verification
130
108
  Tool: <playwright-cli or opencli>
131
- URL: http://localhost:$DEV_PORT
109
+ URL: http://localhost:<DEV_PORT>
132
110
  Dev Server Command: <actual command used>
133
111
  Tool version: <version>
134
112
  Steps executed: [list of commands used]
@@ -140,4 +118,3 @@ Append results to `context-snapshot.md`:
140
118
 
141
119
  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.
142
120
 
143
-
@@ -12,13 +12,13 @@ You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without
12
12
 
13
13
  0a. Check if `opencli` is installed:
14
14
  ```bash
15
- which opencli 2>/dev/null && opencli --version 2>/dev/null || echo "NOT_INSTALLED"
15
+ {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
16
16
  ```
17
17
  If output is `NOT_INSTALLED`, install it:
18
18
  ```bash
19
19
  npm install -g @jackwener/opencli@latest
20
20
  ```
21
- Then verify installation succeeded: `opencli --version`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` in context-snapshot.md and proceed to the next phase.
21
+ Then verify installation succeeded: `{{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version`. If installation fails, log `## Browser Verification: SKIPPED — opencli installation failed` in context-snapshot.md and proceed to the next phase.
22
22
 
23
23
  0b. Verify Browser Bridge connectivity:
24
24
  ```bash
@@ -28,7 +28,7 @@ If `opencli doctor` fails (Chrome not running or extension not installed), log `
28
28
 
29
29
  0c. Learn opencli browser usage (run once per session):
30
30
  ```bash
31
- opencli browser --help 2>/dev/null || opencli --help
31
+ opencli browser --help
32
32
  ```
33
33
 
34
34
  **Step 1 — Start Dev Server**:
@@ -36,31 +36,22 @@ opencli browser --help 2>/dev/null || opencli --help
36
36
  You know this project's tech stack. Detect and start the dev server yourself:
37
37
 
38
38
  1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
39
- 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:
39
+ 2. Determine the dev server port from the pre-detected pipeline value (`{{DEV_PORT}}`) or project config. Do NOT hardcode or guess the port. Record it as `DEV_PORT` in your notes.
40
+ 3. Verify the port is available:
40
41
  ```bash
41
- DEV_PORT={{DEV_PORT}}
42
- if [ "$DEV_PORT" = "{{DEV_PORT}}" ]; then
43
- DEV_PORT=$(node -e "const s=require('./package.json').scripts.dev; const m=s.match(/-p\s+(\d+)/); console.log(m?m[1]:'')")
44
- if [ -z "$DEV_PORT" ]; then
45
- DEV_PORT=$(echo "$NEXT_PUBLIC_SITE_URL" | sed -nE 's|.*:([0-9]+).*|\1|p')
46
- fi
47
- DEV_PORT=${DEV_PORT:-3000}
48
- fi
49
- echo "Detected DEV_PORT=$DEV_PORT"
42
+ {{RUNTIME_HELPER_CMD}} port check <DEV_PORT>
50
43
  ```
51
- 3. Verify the port is available:
44
+ 4. Start the dev server with the runtime helper and capture a PID file:
52
45
  ```bash
53
- lsof -ti:$DEV_PORT 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
46
+ {{RUNTIME_HELPER_CMD}} process start --pid-file .prizmkit/state/browser-dev-server.pid -- <start-command tokens>
54
47
  ```
55
- 4. Start the dev server in background, capture PID:
48
+ 5. Wait for server to be ready:
56
49
  ```bash
57
- <start-command> &
58
- DEV_SERVER_PID=$!
50
+ {{RUNTIME_HELPER_CMD}} web wait-ready --url http://localhost:<DEV_PORT> --timeout 30 --interval 2
59
51
  ```
60
- 5. Wait for server to be ready: poll `http://localhost:$DEV_PORT` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
61
52
  6. Open the app in opencli and inspect page state:
62
53
  ```bash
63
- opencli browser open http://localhost:$DEV_PORT && opencli browser state
54
+ opencli browser open http://localhost:<DEV_PORT> && opencli browser state
64
55
  ```
65
56
  7. If the page requires authentication, use opencli browser to interact with login forms (opencli reuses Chrome cookies, so SSO/OAuth may already be active)
66
57
 
@@ -82,13 +73,8 @@ Key opencli browser commands for verification:
82
73
 
83
74
  **Chain commands aggressively with `&&`** to minimize tool calls:
84
75
  ```bash
85
- # GOOD: open + inspect in one call
86
- opencli browser open http://localhost:$DEV_PORT && opencli browser state
87
-
88
- # GOOD: fill form in one call
76
+ opencli browser open http://localhost:<DEV_PORT> && opencli browser state
89
77
  opencli browser type 3 "hello" && opencli browser type 4 "world" && opencli browser click 7
90
-
91
- # GOOD: click + wait + re-inspect
92
78
  opencli browser click 12 && opencli browser wait time 1 && opencli browser state
93
79
  ```
94
80
 
@@ -99,8 +85,14 @@ Construct your verification workflow based on: (1) the `opencli browser --help`
99
85
  **Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
100
86
 
101
87
  1. Close the opencli browser session: `opencli browser close`
102
- 2. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
103
- 3. Verify port is released: `lsof -ti:$DEV_PORT | xargs kill -9 2>/dev/null || true`
88
+ 2. Stop the dev server process using the PID file written in Step 1:
89
+ ```bash
90
+ {{RUNTIME_HELPER_CMD}} process cleanup-pid <pid-from-.prizmkit/state/browser-dev-server.pid>
91
+ ```
92
+ 3. Verify port is released:
93
+ ```bash
94
+ {{RUNTIME_HELPER_CMD}} port check <DEV_PORT>
95
+ ```
104
96
 
105
97
  **Step 4 — Reporting**:
106
98
 
@@ -108,7 +100,7 @@ Append results to `context-snapshot.md`:
108
100
  ```
109
101
  ## Browser Verification
110
102
  Tool: opencli
111
- URL: http://localhost:$DEV_PORT
103
+ URL: http://localhost:<DEV_PORT>
112
104
  Dev Server Command: <actual command used>
113
105
  opencli version: <version>
114
106
  Steps executed: [list of opencli browser commands used]
@@ -120,4 +112,3 @@ Append results to `context-snapshot.md`:
120
112
 
121
113
  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.
122
114
 
123
-