@ytspar/sweetlink 1.24.3 → 1.24.5-canary.765d8f8

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.
@@ -10,6 +10,28 @@ After implementing any visual/UI changes, you MUST:
10
10
  2. **Compare before/after** when making layout or styling changes
11
11
  3. **Verify at multiple viewports** for responsive design changes (mobile, tablet, desktop)
12
12
 
13
+ ## Coverage — scale verification to the change
14
+
15
+ Screenshots must show the change **where it actually appears in the running
16
+ app, in context** — verifying a component only in isolation (a component
17
+ library / gallery view) is a *secondary* source, never the only proof. Scale
18
+ coverage to the change:
19
+
20
+ - **New or edited page / view** → capture it **in context** in the running app.
21
+ - **Interactive element** → capture each meaningful **state** (default, hover,
22
+ focus, validation-error, empty, loading, disabled) as a named shot.
23
+ - **Multi-step or branching element** (wizard, stepper, multi-stage modal,
24
+ branching form) → walk and capture **every step and every branch** ("all
25
+ paths"), not just the entry state. Use Playwright MCP to drive each path.
26
+ - **New feature with a complex multi-stage process** → produce a **storyboard**:
27
+ an ordered screenshot sequence documenting the whole journey end to end.
28
+ - **Reuse before create** → before adding an e2e spec for an affected area,
29
+ search the existing test suite and **expand or improve** a spec that already
30
+ covers it rather than writing a duplicate. Add a new spec only when none exists.
31
+ - **Specs are durable, reusable assets** → capture specs are committed to the
32
+ project's e2e suite (not one-off throwaways), named by the affected area, and
33
+ runnable standalone so they re-verify in CI and on every future change.
34
+
13
35
  ## Tools
14
36
 
15
37
  ### Sweetlink (Quick Verification)
@@ -6,325 +6,105 @@ allowed-tools: Bash
6
6
 
7
7
  # Console Check Sweetlink Skill
8
8
 
9
- Quickly check browser console for errors and warnings using Sweetlink's real-time log monitoring.
9
+ Fast browser-console verification using Sweetlink's real-time log capture. Enforces the **zero-error policy** before marking a task complete or committing.
10
10
 
11
- ## Purpose
11
+ > Sweetlink architecture, prerequisites, daemon ring buffer, and setup are documented in [@ytspar/sweetlink's canonical context](../../claude-context/sweetlink-architecture.md). This skill assumes that context is loaded. The skill-specific scope is *when to check the console*, *which filter to use*, and *how to interpret results*.
12
12
 
13
- This skill provides a fast way to verify there are no console errors in the running application. It's essential for maintaining code quality and catching runtime issues immediately after making changes.
13
+ ## When to invoke (automatic)
14
14
 
15
- ## When to Use
15
+ - After any code change (catch errors immediately)
16
+ - Before marking a task complete (zero-error policy)
17
+ - After every screenshot (pair with `screenshot` skill — visual + console)
18
+ - User reports unexpected behavior, asks to "check console", or mentions runtime bugs
19
+ - Before committing code; during code reviews
16
20
 
17
- **Automatically use this skill when:**
18
-
19
- - After making ANY code changes (catch errors immediately)
20
- - Before marking a task as complete (zero errors policy)
21
- - User reports unexpected behavior or bugs
22
- - During debugging workflows
23
- - After deploying new features
24
- - User asks to "check console" or "check for errors"
25
- - Before committing code
26
- - During code reviews
27
-
28
- ## How It Works
29
-
30
- Sweetlink maintains a real-time connection to the browser and captures all console messages. This skill:
31
-
32
- 1. Queries Sweetlink for recent console logs
33
- 2. Filters for errors (and optionally warnings)
34
- 3. Returns a summary with error details
35
- 4. Helps identify the root cause quickly
36
-
37
- ## Commands
38
-
39
- ### Check for Errors Only
21
+ ## Commands call patterns
40
22
 
41
23
  ```bash
24
+ # Errors only (default check)
42
25
  pnpm sweetlink logs --filter error
43
- ```
44
-
45
- ### Check for Errors and Warnings
46
26
 
47
- ```bash
27
+ # Errors + warnings (stricter)
48
28
  pnpm sweetlink logs --filter error && pnpm sweetlink logs --filter warning
49
- ```
50
29
 
51
- ### Get All Console Logs
30
+ # LLM-optimized summary (deduped JSON — best for analysis)
31
+ pnpm sweetlink logs --format summary
52
32
 
53
- ```bash
54
- pnpm sweetlink logs
55
- ```
33
+ # Deduplicate noisy repeated messages (text mode)
34
+ pnpm sweetlink logs --dedupe
56
35
 
57
- ### Filter by Specific Term
58
-
59
- ```bash
60
- pnpm sweetlink logs --filter "API"
36
+ # Search for a specific term
37
+ pnpm sweetlink logs --filter "hydration"
61
38
  pnpm sweetlink logs --filter "Failed to"
62
- pnpm sweetlink logs --filter "undefined"
63
- ```
64
-
65
- ## Understanding Console Errors
66
-
67
- ### Common Error Types
68
-
69
- **1. TypeError - Type-related errors**
70
-
71
- ```text
72
- TypeError: Cannot read property 'data' of undefined
73
- TypeError: undefined is not a function
74
- ```
75
-
76
- **2. ReferenceError - Variable not defined**
77
-
78
- ```text
79
- ReferenceError: myVariable is not defined
80
- ```
81
-
82
- **3. Hydration Errors (React/SSR)**
83
-
84
- ```text
85
- Warning: Text content did not match. Server: "..." Client: "..."
86
- Error: Hydration failed because the initial UI does not match...
87
- ```
88
-
89
- **4. Network Errors**
90
-
91
- ```text
92
- Failed to fetch
93
- NetworkError when attempting to fetch resource
94
- ```
95
-
96
- **5. React Errors**
97
-
98
- ```text
99
- Warning: Each child in a list should have a unique "key" prop
100
- Error: Maximum update depth exceeded
101
- ```
102
-
103
- ## Output Format
104
-
105
- ### Zero Errors (Success)
106
-
107
- ```text
108
- ✅ Console Check: CLEAN
109
-
110
- Errors: 0
111
- Warnings: 0
112
- Status: Ready for commit ✓
113
-
114
- The application has no console errors. Zero-error policy maintained.
115
- ```
116
-
117
- ### Errors Found
118
-
119
- ```markdown
120
- ❌ Console Check: ERRORS FOUND
121
-
122
- Errors: 3
123
- Warnings: 1
124
-
125
- ### Errors:
126
-
127
- 1. [ERROR] TypeError: Cannot read property 'data' of undefined
128
- Location: Card.tsx:45
129
- Timestamp: 14:23:15.234
130
-
131
- 2. [ERROR] Failed to fetch data from API
132
- Location: api.ts:89
133
- Timestamp: 14:23:16.891
134
-
135
- 3. [ERROR] Hydration failed: content mismatch
136
- Location: page.tsx:12
137
- Timestamp: 14:23:17.023
138
-
139
- ### Warnings:
140
-
141
- 1. [WARN] Missing key prop in list rendering
142
- Location: List.tsx:34
143
- Timestamp: 14:23:15.456
144
-
145
- ### Recommendations:
146
- - Fix null safety in Card.tsx (add null check for data)
147
- - Add error handling to API fetch in api.ts
148
- - Fix hydration by ensuring SSR/client consistency in page.tsx
149
- - Add unique keys to list items in List.tsx
150
- ```
151
-
152
- ## Best Practices
153
-
154
- ### Development Workflow
155
-
156
- ```bash
157
- # 1. Check baseline (before making changes)
158
- pnpm sweetlink logs --filter error
159
- # Should show 0 errors
160
-
161
- # 2. Make code changes
162
-
163
- # 3. Wait for HMR reload (2-3 seconds)
164
-
165
- # 4. Check for new errors immediately
166
- pnpm sweetlink logs --filter error
39
+ pnpm sweetlink logs --filter "MyComponent"
167
40
 
168
- # 5. If errors found, fix immediately
169
- # 6. Repeat until 0 errors
41
+ # Ring-buffer view from daemon (captured since daemon start)
42
+ pnpm sweetlink console --errors
43
+ pnpm sweetlink console --last 20
170
44
  ```
171
45
 
172
- ### Before Committing
46
+ Full flag reference for `logs` / `console` → run `pnpm sweetlink <cmd> --help` (authoritative, always live).
173
47
 
174
- ```bash
175
- # Always check console before commit
176
- pnpm sweetlink logs --filter error
48
+ ## Zero-error policy
177
49
 
178
- # Only commit if 0 errors
179
- git commit -m "Add feature (0 console errors)"
180
- ```
50
+ Before marking ANY task complete:
181
51
 
182
- ### During Code Review
52
+ 1. Run the error check.
53
+ 2. If non-zero: fix immediately, re-check until clean.
54
+ 3. Only then mark complete or commit.
183
55
 
184
- ```bash
185
- # Check PR branch for console errors
186
- git checkout pr-branch
187
- pnpm sweetlink logs --filter error
188
- ```
56
+ A change with passing tests + a clean screenshot but console errors is **not done**.
189
57
 
190
- ## Integration with Other Skills
58
+ ## Common error categories and the typical fix shape
191
59
 
192
- **Works well with:**
60
+ | Pattern | Example | Typical fix |
61
+ |---------|---------|-------------|
62
+ | **TypeError — null/undefined access** | `Cannot read property 'data' of undefined` | Optional chaining `user?.name`, default values |
63
+ | **ReferenceError** | `myVariable is not defined` | Missing import, typo, scope issue |
64
+ | **Hydration mismatch** (SSR) | `Hydration failed because the initial UI does not match` | Move client-only values into `useEffect`; check date/random/locale in render |
65
+ | **Network failure** | `Failed to fetch` | Add `.catch()`, check endpoint, CORS |
66
+ | **React: missing key** | `Each child in a list should have a unique "key" prop` | Add stable `key` on mapped JSX |
67
+ | **React: update loop** | `Maximum update depth exceeded` | Effect-loop — fix dependency array or setState in render |
193
68
 
194
- - `quick-typecheck` - Check both compile-time and runtime errors
195
- - `screenshot` - Visual verification + console check
196
- - `responsive-screenshots` - Check errors across viewports
69
+ ## Output expectations
197
70
 
198
- **Complete quality check:**
71
+ **Clean state (target):**
199
72
 
200
- ```bash
201
- # 1. Type errors (compile-time)
202
- pnpm run typecheck
203
-
204
- # 2. Console errors (runtime)
205
- pnpm sweetlink logs --filter error
206
-
207
- # 3. Visual verification
208
- pnpm sweetlink screenshot --output .tmp/screenshots/verify.png
209
-
210
- # If all pass: ✅ Ready to commit
211
73
  ```
212
-
213
- ## Common Error Patterns
214
-
215
- ### Pattern 1: Null/Undefined Access
216
-
217
- ```javascript
218
- // Error: Cannot read property 'name' of undefined
219
- const name = user.name;
220
-
221
- // Fix: Add null check
222
- const name = user?.name;
74
+ ✅ Console Check: CLEAN — Errors: 0, Warnings: 0 → ready for commit
223
75
  ```
224
76
 
225
- ### Pattern 2: Hydration Mismatch
77
+ **With findings report shape:**
226
78
 
227
- ```javascript
228
- // Error: Hydration failed
229
- <div>{new Date().toString()}</div>
230
-
231
- // Fix: Use useEffect for client-only values
232
- const [time, setTime] = useState('');
233
- useEffect(() => setTime(new Date().toString()), []);
234
79
  ```
80
+ ❌ Console Check: ERRORS FOUND — Errors: N, Warnings: M
235
81
 
236
- ### Pattern 3: Missing Error Handling
237
-
238
- ```javascript
239
- // Error: Unhandled promise rejection
240
- fetch('/api/data');
241
-
242
- // Fix: Add error handling
243
- fetch('/api/data').catch(err => console.error(err));
82
+ Errors:
83
+ 1. [ERROR] <message> — <file>:<line> — <timestamp>
84
+ ...
85
+ Recommendation: <one line per finding>
244
86
  ```
245
87
 
246
- ## Troubleshooting
247
-
248
- ### "No browser client connected"
249
-
250
- **Solution:**
88
+ Always group findings, cite source location when surfaced, and propose the fix.
251
89
 
252
- ```bash
253
- # 1. Start dev server
254
- pnpm run dev
255
-
256
- # 2. Open browser at http://localhost:3000
257
- # 3. Look for Sweetlink connection indicator (bottom-right)
258
- ```
90
+ ## Composition with other skills
259
91
 
260
- ### Old Errors Showing
92
+ - **`screenshot`** every screenshot pairs with `logs --filter error` and `--filter warning`. Visual + console = verification.
93
+ - **`quick-typecheck`** — compile-time errors. Combine: `pnpm run typecheck && pnpm sweetlink logs --filter error`.
94
+ - **`responsive-screenshots`** — check console at each viewport (errors can be viewport-specific via media queries / matchMedia).
261
95
 
262
- **Solution:**
96
+ Complete quality gate:
263
97
 
264
98
  ```bash
265
- # Hard refresh browser to clear cache
266
- # Mac: Cmd + Shift + R
267
- # Windows/Linux: Ctrl + Shift + R
99
+ pnpm run typecheck # 1. types
100
+ pnpm sweetlink logs --filter error # 2. runtime
101
+ pnpm sweetlink screenshot --output .tmp/screenshots/check.png # 3. visual
268
102
  ```
269
103
 
270
- ### Too Many Logs
271
-
272
- **Solution:**
273
-
274
- ```bash
275
- # Filter to focus on errors only
276
- pnpm sweetlink logs --filter error
277
-
278
- # Or search for specific term
279
- pnpm sweetlink logs --filter "MyComponent"
280
- ```
281
-
282
- ## Zero-Error Policy
283
-
284
- This skill enforces the zero-error policy:
285
-
286
- **Before marking ANY task complete:**
287
-
288
- 1. Run console check
289
- 2. Ensure 0 errors
290
- 3. If errors found, fix them
291
- 4. Re-check until clean
292
- 5. Only then mark task as complete
293
-
294
- **Why this matters:**
295
-
296
- - Prevents bugs from accumulating
297
- - Catches issues immediately
298
- - Maintains code quality
299
- - Improves user experience
300
- - Reduces debugging time later
301
-
302
- ## Quick Reference
303
-
304
- ### Fast Error Check
305
-
306
- ```bash
307
- pnpm sweetlink logs --filter error
308
- ```
309
-
310
- ### Full Console Analysis
311
-
312
- ```bash
313
- pnpm sweetlink logs
314
- ```
315
-
316
- ### Search Specific Issue
317
-
318
- ```bash
319
- pnpm sweetlink logs --filter "hydration"
320
- ```
321
-
322
- ### Check Warnings Too
323
-
324
- ```bash
325
- pnpm sweetlink logs --filter warning
326
- ```
104
+ ## Troubleshooting (skill-scoped)
327
105
 
328
- ## Examples
106
+ - **"No browser client connected"** — start dev server, open the URL, confirm Sweetlink indicator (bottom-right) before re-running.
107
+ - **Old errors persist after a fix** — hard refresh the browser tab (`Cmd+Shift+R` mac / `Ctrl+Shift+R` win/linux) to clear stale state.
108
+ - **Too many logs to read** — switch to `--format summary` (deduped JSON) or narrow with `--filter <term>`.
329
109
 
330
- See `examples.md` for detailed usage scenarios.
110
+ Daemon-not-running / bridge-not-mounted / port-conflict → see the canonical context.