feat: add preview tool — navigate + screenshot in one call with optional POST

New MCP tool `preview` combines goto + screenshot with viewport control.
Optionally POSTs result to any HTTP endpoint (e.g. HUD/visor) via previewUrl.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 12:44:52 +02:00
parent 7171fbfc76
commit a80224df36
16 changed files with 332 additions and 272 deletions
+28 -34
View File
@@ -1,39 +1,33 @@
# TODO: Playwright Debugging Features
# TODO: Preview Tool
## Phase 1: Core Debugging (Console & Errors)
- [x] Step 1.1: Add Console Command
- [x] Step 1.2: Add Page Errors Command
## Phase 1: Add `preview` tool
- [ ] Add `PreviewCommand` interface to `src/types.ts`
- [ ] Add to `BrowserCommand` discriminated union
- [ ] Add `pushToVisor()` helper method to `ClaudeBrowser` in `src/browser.ts`
- [ ] Add `preview()` method to `ClaudeBrowser`
- [ ] Add `case 'preview'` in `executeCommand()` switch
- [ ] Register `preview` MCP tool in `src/mcp.ts` with zod schema
- [ ] `npm run build` — compiles clean
- [ ] `npm run check` — lint/format pass
## Phase 2: Network Monitoring
- [x] Step 2.1: Add Network Logging
- [x] Step 2.2: Add Failed Requests Filter
- [x] Step 2.3: Add Request Interception
## Phase 2: Test & Publish
- [ ] Test with URL: `preview({ url: "https://kwit.fit", title: "TEST" })`
- [ ] Test with file: `preview({ url: "file:///tmp/test.html" })`
- [ ] Test visor push works
- [ ] Test visor-down graceful fallback (`visor: false` in response)
- [ ] Test viewport resize when browser already running
- [ ] Bump version, publish to npm
- [ ] Update marauder-plugin `.mcp.json` if needed
## Phase 3: Performance & Metrics
- [x] Step 3.1: Add Performance Metrics
- [x] Step 3.2: Add Resource Timing
## Phase 3: Skill cleanup
- [ ] Delete `marauder-plugin/skills/preview/preview.py`
- [ ] Rewrite `marauder-plugin/skills/preview/SKILL.md` as simple one-liner reference
## Phase 4: Accessibility
- [x] Step 4.1: Add Accessibility Snapshot
### ETA
## Phase 5: Dialog Handling
- [x] Step 5.1: Add Dialog Command
## Phase 6: Storage & Cookies
- [x] Step 6.1: Add Cookies Command
- [x] Step 6.2: Add Storage Command
## Phase 7: Advanced Interactions
- [x] Step 7.1: Add Hover Command
- [x] Step 7.2: Add Select Command
- [x] Step 7.3: Add Keys Command
- [x] Step 7.4: Add Upload Command
- [x] Step 7.5: Add Scroll Command
## Phase 8: Viewport & Emulation
- [x] Step 8.1: Add Viewport Command
- [x] Step 8.2: Add Emulate Command
## Phase 9: Documentation
- [x] Step 9.1: Update README
- [x] Step 9.2: Update CLAUDE.md
| Phase | Naive | Coop | Sessions | Notes |
|-------|-------|------|----------|-------|
| 1. Add tool | 2h | ~30m | 1 | Mechanical — follow existing pattern exactly |
| 2. Test & publish | 1h | ~15m | 1 | Same session |
| 3. Skill cleanup | 30m | ~10m | 1 | Delete + rewrite |
| **Total** | **3.5h** | **~55m** | **1** | Single session, single commit |