You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/agents/corpus-fixer.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Use this agent when you need to fix or improve the detection logic
4
4
model: inherit
5
5
---
6
6
7
-
You are an expert Gitcasso corpus debugging specialist with deep knowledge of browser extension development. You operate exclusively within the `browser-extension` directory and specialize in using the corpus:view development environment to diagnose and fix detection logic issues.
7
+
You are an expert Gitcasso corpus debugging specialist with deep knowledge of browser extension development. You operate within the root project directory and specialize in using the corpus:view development environment to diagnose and fix detection logic issues.
Background -.->|manages| Storage[Comment State Storage<br/>openSpots JsonMap]
61
+
Content -.->|enhances| TextArea[textarea elements<br/>on web pages]
62
+
Popup -.->|displays| UI[Extension UI<br/>list of comment spots]
63
+
64
+
classDef entrypoint fill:#e1f5fe
65
+
classDef storage fill:#f3e5f5
66
+
classDef ui fill:#e8f5e8
67
+
68
+
class Content,Background,Popup entrypoint
69
+
class Storage storage
70
+
class TextArea,UI ui
71
+
```
72
+
73
+
Every time a `textarea` shows up on a page, on initial load or later on, it gets passed to a list of `CommentEnhancer`s. Each one gets a turn to say "I can enhance this box!". They show that they can enhance it by returning something non-null in the method `tryToEnhance(textarea: HTMLTextAreaElement): Spot | null`. Later on, that same `Spot` data will be used by the `tableRow(spot: Spot): ReactNode` method to create React components for rich formatting in the popup table.
74
+
75
+
Those `Spot` values get bundled up with the `HTMLTextAreaElement` itself into an `EnhancedTextarea`, which gets added to the `TextareaRegistry`. At some interval, draft edits get saved by the browser extension.
76
+
77
+
When the `textarea` gets removed from the page, the `TextareaRegistry` is notified so that the `CommentSpot` can be marked as abandoned or submitted as appropriate.
78
+
79
+
## Testing
80
+
81
+
-`pnpm playground` gives you a test environment where you can tinker with the popup with various test data, supports hot reload
82
+
-`pnpm corpus:view` gives you recordings of various web pages which you can see with and without enhancement by the browser extension
83
+
84
+
### Test Corpus
85
+
86
+
We maintain a corpus of test pages in two formats for testing the browser extension:
87
+
88
+
#### HAR Corpus (Automated)
89
+
90
+
- For testing initial page loads and network requests
91
+
- HAR recordings live in `tests/corpus/*.har`, complete recordings of the network requests of a single page load
92
+
- You can add or change URLs in `tests/corpus/_corpus-index.ts`
93
+
-**Recording new HAR files:**
94
+
-`npx playwright codegen https://github.com/login --save-storage=playwright/.auth/gh.json` will store new auth tokens
95
+
- login manually, then close the browser
96
+
-***these cookies are very sensitive! we only run this script using a test account that has no permissions or memberships to anything, recommend you do the same!***
97
+
-`pnpm corpus:har:record` records new HAR files using those auth tokens (it needs args, run it with no args for docs)
98
+
- DO NOT COMMIT AND PUSH NEW OR CHANGED HAR files!
99
+
- we try to sanitize these (see `corpus-har-record.ts` for details) but there may be important PII in them
100
+
- if you need new HAR files for something, let us know and we will generate them ourselves using a dummy account
101
+
- IF YOUR PR CHANGES OR ADDS HAR FILES WE WILL CLOSE IT. Ask for HAR files and we'll be happy to generate clean ones you can test against.
102
+
103
+
#### HTML Corpus (Manual)
104
+
105
+
- For testing post-interaction states (e.g., expanded textareas, modal dialogs, dynamic content)
106
+
- HTML snapshots live in `tests/corpus/*.html`, manually captured using SingleFile browser extension
107
+
- All assets are inlined in a single HTML file by SingleFile
108
+
-**Creating new HTML corpus files:**
109
+
1. Navigate to the desired page state (click buttons, expand textareas, etc.)
110
+
2. Use SingleFile browser extension to save the complete page
111
+
3. Save the `.html` file to `tests/corpus/html/` with a descriptive name
112
+
4. Add an entry to `tests/corpus/_corpus-index.ts` with `type: 'html'` and a description of the captured state
113
+
5. Feel free to contribute these if you want, but be mindful that they will be part of our immutable git history
114
+
115
+
#### Viewing Corpus Files
116
+
117
+
- Run `pnpm corpus:view` to start the test server at http://localhost:3001
118
+
- Select any corpus file to view in two modes:
119
+
-**Clean**: Original page without extension
120
+
-**Gitcasso**: Page with extension injected for testing
0 commit comments