Skip to content

Commit 78a2382

Browse files
Improve documentation
1 parent 1b3a1bf commit 78a2382

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
This is a browser extension to add a custom Bookmarks view to the collection of GitHub built-in
44
views at: `github.com/issues`
55

6+
The GitHub repo is: richardkmichael/github-bookmarked-issues
7+
68
# Implementation
79

810
The github.com/issues page has GitHub built-in views as a React app:
@@ -341,3 +343,71 @@ template.innerHTML = '<svg aria-hidden="true" viewBox="0 0 16 16"><path d="M3 2.
341343
3. **textContent auto-escapes**: No need for `escapeHtml()` helpers
342344
4. **Zero warnings**: This approach eliminates all web-ext linter warnings
343345
5. **Readable code**: Templates keep HTML structure visible and maintainable
346+
347+
# Researching Primer CSS
348+
349+
## Caching Primer Source
350+
351+
To avoid repeatedly downloading Primer CSS when searching for class names or patterns:
352+
353+
1. Check if already cached: `ls tmp/primer-css/`
354+
2. If not cached, download once:
355+
```bash
356+
mkdir -p tmp && cd tmp
357+
npm pack @primer/css && tar -xzf primer-css-*.tgz && mv package primer-css
358+
```
359+
3. Search the cached source: `grep -r "pattern" tmp/primer-css/`
360+
361+
## Primer View Components
362+
363+
Between Primer v21 and v22, components were extracted from main Primer to separate packages like
364+
`primer_view_components`. When implementing UI elements that match GitHub's style:
365+
366+
1. First inspect the live GitHub page to see actual class names
367+
2. Search Primer CSS for the class patterns
368+
3. If not found, check `primer_view_components` or other Primer-related packages
369+
4. Example: Label classes were found by reviewing the label view component implementation
370+
371+
# Development Commands
372+
373+
## Reloading the Extension
374+
375+
After code changes:
376+
377+
Chrome:
378+
1. `npm run build:chrome`
379+
2. Go to `chrome://extensions`
380+
3. Click the refresh icon on the extension card
381+
382+
Firefox:
383+
1. `npm run build:firefox` (or just reload if using symlink method)
384+
2. Go to `about:debugging#/runtime/this-firefox`
385+
3. Click "Reload" on the extension
386+
387+
With watch mode (`npm run dev:watch`), step 1 is automatic - just reload in the browser.
388+
389+
## Reading Extension Errors
390+
391+
Chrome:
392+
- `chrome://extensions` → Click "Errors" on the extension card
393+
- Or: Click "Inspect views service worker" → Console tab
394+
395+
Firefox:
396+
- `about:debugging#/runtime/this-firefox` → Click "Inspect" on the extension
397+
- Console tab shows errors from background script
398+
399+
Content script errors appear in the page's DevTools console (F12 on github.com).
400+
401+
# MCP Chrome DevTools
402+
403+
The `chrome-devtools` MCP server connects to Chrome Canary for automated browser control.
404+
405+
## Handle chrome-devtools MCP server error
406+
407+
When any chrome-devtools tool returns this error:
408+
409+
```
410+
Error: Could not connect to Chrome. Check if Chrome is running and remote debugging is enabled by going to chrome://inspect/#remote-debugging.
411+
```
412+
413+
Start Chrome manually with: `./chrome-canary.sh --start`

GITHUB_OPERATION.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,12 @@ Due to the Sec-Fetch-Site restriction, extension components have different capab
383383
| Popup | ✗ No | ✓ Yes | Toolbar popup (rate-limited) |
384384
| Background | ✗ No | ✓ Yes | API proxy for content scripts |
385385
386+
Why REST API calls route through the background worker:
387+
- **PAT token access**: Stored in `browser.storage.sync`, only accessible from background
388+
- **CORS handling**: `api.github.com` is cross-origin from content scripts
389+
- **Centralized caching**: Fallback to cached data on rate limit (403)
390+
- **Rate limit tracking**: Response headers logged for debugging
391+
386392
This creates an architectural asymmetry:
387393
- The bookmarks view (content script) can use efficient batch GraphQL queries
388394
- The popup must use REST API (60/hour unauthenticated, 5,000/hour with PAT)

0 commit comments

Comments
 (0)