|
| 1 | +--- |
| 2 | +sessionId: session-260426-221758-1o83 |
| 3 | +isActive: false |
| 4 | +--- |
| 5 | + |
| 6 | +# Requirements |
| 7 | + |
| 8 | +### Overview & Goals |
| 9 | +Improve APIReplay’s developer adoption by turning the current docs set into a practical onboarding path focused on **real client-fetch mocking workflows** and stronger **zero-boilerplate DX messaging**. |
| 10 | + |
| 11 | +### Scope |
| 12 | +#### In Scope |
| 13 | +- Restructure `README.md` into a clearer “install → first run → core workflows” path. |
| 14 | +- Add/expand documentation for **client-side fetch mocking** (not SSR recording) using existing Playwright integration utilities. |
| 15 | +- Add a concrete “record from central environment, replay locally” flow with minimal setup steps. |
| 16 | +- Refresh messaging consistency between `README.md`, `COMPARISON.md`, and docs pages. |
| 17 | + |
| 18 | +#### Out of Scope |
| 19 | +- Implementing new recorder/replayer runtime features. |
| 20 | +- Adding SSR recording claims. |
| 21 | +- Building Payload CMS integration unless explicitly prioritized later. |
| 22 | + |
| 23 | +### Functional Requirements |
| 24 | +- README must include: |
| 25 | + - concise value proposition, |
| 26 | + - setup commands from `package.json` scripts, |
| 27 | + - quick start for extension usage, |
| 28 | + - a practical workflow entry point to Playwright/client fetch mocking docs. |
| 29 | +- Documentation must explicitly clarify current capability boundary: client/network request mocking flows are supported; SSR recording is not positioned as a current feature. |
| 30 | +- A real-world flow must show: |
| 31 | + - recording against a shared/central env, |
| 32 | + - exporting fixture JSON, |
| 33 | + - replaying locally or in test runs without central-env dependency. |
| 34 | +- DX messaging must emphasize reduced infrastructure/tooling overhead and no context switching. |
| 35 | + |
| 36 | +### Non-Functional Requirements |
| 37 | +- Keep docs accurate to existing code paths and scripts. |
| 38 | +- Keep language concise and developer-oriented (copy/paste commands, concrete examples). |
| 39 | + |
| 40 | +# Technical Design |
| 41 | + |
| 42 | +### Current Implementation |
| 43 | +- `README.md` already covers architecture and basic development commands, plus a short Playwright snippet. |
| 44 | +- `docs/playwright-integration.md` documents exported recording reuse via `tests/helpers/recording-mock.ts` and its options (`fallbackMatching`, `strictUnmatched`, `debug`). |
| 45 | +- `tests/helpers/recording-mock.ts` is the canonical implementation for client fetch replay in tests: |
| 46 | + - `applyRecordingMocks(context, recordingPath, options)` |
| 47 | + - exact/fallback matching indexes |
| 48 | + - unmatched behavior and strict failure mode. |
| 49 | +- Background extension behavior is centered in `src/background/main.ts` (record/replay lifecycle via messages and command toggle), which should be reflected in user-facing flow descriptions. |
| 50 | + |
| 51 | +### Key Decisions |
| 52 | +1. **Client-fetch-first positioning (recommended by code reality):** Documentation will avoid SSR-recording claims and instead anchor on existing request replay behavior. |
| 53 | +2. **Workflow-first docs structure:** README becomes a navigator to specific guides (especially Playwright/client-fetch flow) instead of trying to embed all details inline. |
| 54 | +3. **No new feature promises:** Messaging updates will map strictly to shipped capabilities visible in `README.md`, `docs/playwright-integration.md`, and helper APIs. |
| 55 | + |
| 56 | +### Proposed Changes |
| 57 | +- Rework `README.md` sections to: |
| 58 | + - lead with explicit product identity (Chrome extension for recording/replaying API traffic), |
| 59 | + - add “Quick start in ~5 minutes,” |
| 60 | + - add “Common workflows” linking to detailed docs. |
| 61 | +- Expand `docs/playwright-integration.md` with a stronger end-to-end narrative for client fetch mocking and clearer option trade-offs. |
| 62 | +- Add a dedicated workflow doc (e.g., `docs/workflows/central-record-local-replay.md`) describing: |
| 63 | + - central env recording, |
| 64 | + - fixture curation/versioning, |
| 65 | + - local replay/test execution using `applyRecordingMocks`. |
| 66 | +- Update `COMPARISON.md` phrasing where needed so market messaging does not conflict with product reality. |
| 67 | + |
| 68 | +### File Structure |
| 69 | +- **Modify** `README.md` |
| 70 | +- **Modify** `docs/playwright-integration.md` |
| 71 | +- **Add** `docs/workflows/central-record-local-replay.md` (or similarly named path under `docs/`) |
| 72 | +- **Optionally modify** `COMPARISON.md` for claim alignment |
| 73 | + |
| 74 | +### Risks |
| 75 | +- **Risk:** Over-marketing beyond implemented capabilities. |
| 76 | + - **Mitigation:** Tie each claim to existing scripts/APIs/files. |
| 77 | +- **Risk:** Confusion between extension replay and Playwright helper replay. |
| 78 | + - **Mitigation:** Add explicit “when to use which flow” subsection and cross-links. |
| 79 | + |
| 80 | +# Testing |
| 81 | + |
| 82 | +### Validation Approach |
| 83 | +- Verify all commands and paths in docs map to real project artifacts (`package.json` scripts, existing helper files, fixture paths). |
| 84 | +- Ensure examples remain consistent with `tests/helpers/recording-mock.ts` signatures and option names. |
| 85 | + |
| 86 | +### Key Scenarios |
| 87 | +- New developer can follow README to install, build, and load unpacked extension. |
| 88 | +- Developer can follow docs to export a recording and replay it in Playwright client-fetch tests. |
| 89 | +- Developer can understand the central-record/local-replay workflow without inferring unsupported SSR behavior. |
| 90 | + |
| 91 | +### Edge Cases |
| 92 | +- Broken links between README and docs pages. |
| 93 | +- Stale file path references (e.g., fixture/helper paths). |
| 94 | +- Ambiguous wording that implies new runtime features not present in code. |
| 95 | + |
| 96 | +# Delivery Steps |
| 97 | + |
| 98 | +### ✓ Step 1: Restructure README into a workflow-driven onboarding guide |
| 99 | +README provides a clear first-run path and entry points to practical workflows. |
| 100 | + |
| 101 | +- Reorganize `README.md` around: value proposition, quick start commands, extension usage basics, and links to deeper guides. |
| 102 | +- Ensure commands and lifecycle steps align with `package.json` scripts and Chrome extension load flow. |
| 103 | +- Add a capability boundary note clarifying that the documented integration path is client fetch mocking, not SSR recording. |
| 104 | + |
| 105 | +### ✓ Step 2: Strengthen Playwright/client-fetch documentation with concrete usage patterns |
| 106 | +Playwright integration docs clearly describe how to replay recorded responses for client fetch flows. |
| 107 | + |
| 108 | +- Update `docs/playwright-integration.md` to better explain exact vs fallback matching and strict unmatched behavior. |
| 109 | +- Align examples with `tests/helpers/recording-mock.ts` API (`applyRecordingMocks`, options, dispose lifecycle). |
| 110 | +- Add clearer troubleshooting/debug guidance using the existing `debug` callback behavior. |
| 111 | + |
| 112 | +### ✓ Step 3: Add a real-world central-record → local-replay workflow guide |
| 113 | +A new docs page demonstrates recording in a shared environment and replaying locally with minimal boilerplate. |
| 114 | + |
| 115 | +- Create `docs/workflows/central-record-local-replay.md` (path/name can follow existing docs conventions). |
| 116 | +- Document step-by-step flow: capture traffic, export JSON, commit fixture, run local replay in tests/dev loops. |
| 117 | +- Include best-practice notes on fixture scope/versioning and reducing dependency on central environments. |
| 118 | + |
| 119 | +### ✓ Step 4: Align market-facing comparison messaging with actual capability scope |
| 120 | +Comparison copy stays compelling while remaining technically accurate. |
| 121 | + |
| 122 | +- Review `COMPARISON.md` claims against current product behavior and docs wording. |
| 123 | +- Adjust phrasing where necessary to avoid implying unsupported SSR recording. |
| 124 | +- Keep DX emphasis on no context switching, low infra overhead, and reproducible local flows. |
0 commit comments