@codewithdan/zingit 0.10.0 → 0.13.0
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.
- package/README.md +57 -249
- package/client/dist/zingit-client.js +162 -52
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,301 +1,109 @@
|
|
|
1
1
|
# ZingIt
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Streamline how you share UI changes with your AI assistant. Select elements, annotate them, and send directly to AI agents for automated fixes.
|
|
4
|
+
|
|
5
|
+
**[Try the Live Demo →](https://danwahlin.github.io/zingit)**
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
|
-
- **Visual Annotations
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **Bookmarklet Ready**: Single-file build for easy injection
|
|
9
|
+
- **Visual Annotations** - Click any element to describe changes you want
|
|
10
|
+
- **Multi-Agent Support** - Works with Claude Code, GitHub Copilot CLI, and OpenAI Codex
|
|
11
|
+
- **Real-time Streaming** - Watch the AI work in real-time
|
|
12
|
+
- **Smart Selectors** - Auto-generates CSS selectors for precise targeting
|
|
13
|
+
- **Screenshot Capture** - Automatically capture annotated elements to provide visual context to agents
|
|
13
14
|
|
|
14
15
|
## Quick Start
|
|
15
16
|
|
|
16
|
-
### 1
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Server
|
|
20
|
-
cd server
|
|
21
|
-
npm install
|
|
17
|
+
### Option 1: Try the Live Demo
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
cd ../client
|
|
25
|
-
npm install
|
|
26
|
-
```
|
|
19
|
+
Visit **[danwahlin.github.io/zingit](https://danwahlin.github.io/zingit)** and follow the setup steps.
|
|
27
20
|
|
|
28
|
-
### 2
|
|
21
|
+
### Option 2: Clone the Repo and Run Locally
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
- `PROJECT_DIR` - Path to the project the AI agent should work in
|
|
32
|
-
- `AGENT` - Which AI agent to use (`claude`, `copilot`, or `codex`)
|
|
23
|
+
1. Clone the repo.
|
|
33
24
|
|
|
34
|
-
|
|
35
|
-
cd server
|
|
25
|
+
2. Install an AI agent (Claude Code, GitHub Copilot CLI, or OpenAI Codex).
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
- [Claude Code](https://github.com/anthropics/claude-code)
|
|
28
|
+
- [GitHub Copilot CLI](https://github.com/github/copilot-cli)
|
|
29
|
+
- [OpenAI Codex](https://github.com/openai/codex)
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
PROJECT_DIR=/path/to/your/project AGENT=copilot npm run dev
|
|
31
|
+
3. Start the server:
|
|
42
32
|
|
|
43
|
-
|
|
44
|
-
PROJECT_DIR=/path/to/your/project
|
|
33
|
+
```bash
|
|
34
|
+
PROJECT_DIR=/path/to/your/project npx @codewithdan/zingit
|
|
45
35
|
```
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
Server runs on `ws://localhost:3000`
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### 3. Start the Client Dev Server
|
|
39
|
+
4. Open your web app in a browser.
|
|
52
40
|
|
|
53
41
|
```bash
|
|
54
42
|
cd client
|
|
55
43
|
npm run dev
|
|
56
44
|
```
|
|
57
45
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## Usage
|
|
61
|
-
|
|
62
|
-
1. **Click any element** on the page to open the annotation modal
|
|
63
|
-
2. **Add notes** describing the issue or change you want
|
|
64
|
-
3. **Repeat** for multiple elements
|
|
65
|
-
4. Click **"Send to Agent"** to send all annotations to the AI
|
|
66
|
-
5. Watch the **response panel** for the agent's work
|
|
67
|
-
|
|
68
|
-
### Keyboard Shortcuts
|
|
46
|
+
5. Visit [http://localhost:5200/index.html?zingit](http://localhost:5200/index.html?zingit) to load ZingIt.
|
|
69
47
|
|
|
70
|
-
|
|
71
|
-
- `Escape` - Close modals/panels
|
|
72
|
-
- `Cmd/Ctrl + Enter` - Save annotation in modal
|
|
48
|
+
6. Select the agent to use and start annotating!
|
|
73
49
|
|
|
74
|
-
|
|
50
|
+
### Option 3: Add to Your Page
|
|
75
51
|
|
|
76
|
-
|
|
52
|
+
Follow the step above to start the server, then add this script to your page:
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
cd client
|
|
82
|
-
npm run build
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
The `dist/zingit.iife.js` file contains everything needed. Create a bookmarklet:
|
|
86
|
-
|
|
87
|
-
```javascript
|
|
88
|
-
javascript:(function(){var s=document.createElement('script');s.src='http://localhost:5200/zingit.iife.js';document.body.appendChild(s);})()
|
|
54
|
+
```html
|
|
55
|
+
<script src="https://cdn.jsdelivr.net/npm/@codewithdan/zingit@latest/client/dist/zingit-client.js"></script>
|
|
56
|
+
<script>ZingIt.connect('ws://localhost:3000');</script>
|
|
89
57
|
```
|
|
90
58
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
For integration into existing projects:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
cd client
|
|
97
|
-
npm run build
|
|
98
|
-
```
|
|
59
|
+
## Usage
|
|
99
60
|
|
|
100
|
-
|
|
61
|
+
1. **Press `Z`** to toggle annotation mode
|
|
62
|
+
2. **Click elements** to annotate them
|
|
63
|
+
3. **Click the sparkle icon** (✨) to send to your AI agent
|
|
64
|
+
4. **Watch the agent work** in the response panel
|
|
101
65
|
|
|
102
66
|
## Configuration
|
|
103
67
|
|
|
104
|
-
Click the **gear icon**
|
|
68
|
+
Click the **gear icon** for settings:
|
|
105
69
|
|
|
106
70
|
| Setting | Default | Description |
|
|
107
71
|
|---------|---------|-------------|
|
|
108
|
-
| WebSocket URL | `ws://localhost:
|
|
109
|
-
| Project Directory | *(
|
|
110
|
-
| Highlight Color | `#fbbf24` |
|
|
111
|
-
| Marker Color | `#3b82f6` |
|
|
112
|
-
| Auto-connect | `true` | Connect to server on startup |
|
|
113
|
-
|
|
114
|
-
Settings are saved to localStorage.
|
|
115
|
-
|
|
116
|
-
**Project Directory Priority:**
|
|
117
|
-
1. Client setting (if specified) - highest priority
|
|
118
|
-
2. Server's `PROJECT_DIR` environment variable (required)
|
|
72
|
+
| WebSocket URL | `ws://localhost:3000` | Server connection |
|
|
73
|
+
| Project Directory | *(server default)* | Override project path |
|
|
74
|
+
| Highlight Color | `#fbbf24` | Element highlight color |
|
|
75
|
+
| Marker Color | `#3b82f6` | Annotation marker color |
|
|
119
76
|
|
|
120
77
|
## Architecture
|
|
121
78
|
|
|
122
79
|
```
|
|
123
80
|
zingit/
|
|
124
|
-
├── client/
|
|
125
|
-
│ ├── src/
|
|
126
|
-
│
|
|
127
|
-
│
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
│ │ │ ├── markers.ts # Numbered badges
|
|
131
|
-
│ │ │ ├── modal.ts # Annotation form
|
|
132
|
-
│ │ │ ├── settings.ts # Config panel
|
|
133
|
-
│ │ │ └── response.ts # AI response display
|
|
134
|
-
│ │ ├── services/ # WebSocket, storage, selectors
|
|
135
|
-
│ │ ├── utils/ # Geometry, markdown helpers
|
|
136
|
-
│ │ └── types/ # TypeScript interfaces
|
|
137
|
-
│ └── vite.config.ts
|
|
138
|
-
│
|
|
139
|
-
└── server/ # WebSocket server + AI agents
|
|
140
|
-
└── src/
|
|
141
|
-
├── agents/
|
|
142
|
-
│ ├── base.ts # Abstract agent interface
|
|
143
|
-
│ ├── claude.ts # Claude Agent SDK integration
|
|
144
|
-
│ ├── copilot.ts # GitHub Copilot SDK integration
|
|
145
|
-
│ └── codex.ts # OpenAI Codex SDK integration
|
|
146
|
-
├── types.ts
|
|
147
|
-
└── index.ts # WebSocket server
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Agents
|
|
151
|
-
|
|
152
|
-
### GitHub Copilot SDK
|
|
153
|
-
|
|
154
|
-
Uses the official `@github/copilot-sdk` package. Requires:
|
|
155
|
-
- GitHub Copilot CLI installed and in your PATH
|
|
156
|
-
- Active GitHub Copilot subscription
|
|
157
|
-
|
|
158
|
-
The SDK communicates with the Copilot CLI in server mode, handling session management, streaming responses, and tool execution automatically.
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Install Copilot CLI first
|
|
162
|
-
gh extension install github/gh-copilot
|
|
163
|
-
|
|
164
|
-
# Then run the server
|
|
165
|
-
PROJECT_DIR=/path/to/your/project AGENT=copilot npm run dev
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Claude Agent SDK
|
|
169
|
-
|
|
170
|
-
Uses the official `@anthropic-ai/claude-agent-sdk` package. Requires:
|
|
171
|
-
- Claude Code installed: `npm install -g @anthropic-ai/claude-code`
|
|
172
|
-
- Valid Anthropic API key or Claude Max subscription
|
|
173
|
-
|
|
174
|
-
The SDK provides streaming responses with tool execution status, allowing the agent to read files, search code, and make edits.
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
PROJECT_DIR=/path/to/your/project AGENT=claude npm run dev
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### OpenAI Codex SDK
|
|
181
|
-
|
|
182
|
-
Uses the official `@openai/codex-sdk` package. Requires:
|
|
183
|
-
- Codex CLI installed and logged in (run `codex` once to authenticate)
|
|
184
|
-
- Active ChatGPT Plus, Pro, Business, Edu, or Enterprise subscription
|
|
185
|
-
|
|
186
|
-
The SDK uses your cached Codex CLI credentials (`~/.codex/auth.json`) - no API key needed. Just login once via the browser flow.
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
# First time: login to Codex (opens browser)
|
|
190
|
-
npx codex
|
|
191
|
-
|
|
192
|
-
# Then run the server
|
|
193
|
-
PROJECT_DIR=/path/to/your/project AGENT=codex npm run dev
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
You can optionally set `CODEX_MODEL` to override the default model (gpt-5.2-codex).
|
|
197
|
-
|
|
198
|
-
## API
|
|
199
|
-
|
|
200
|
-
### WebSocket Messages
|
|
201
|
-
|
|
202
|
-
**Client → Server:**
|
|
203
|
-
|
|
204
|
-
```typescript
|
|
205
|
-
// Send batch of annotations
|
|
206
|
-
{ type: 'batch', data: { pageUrl, pageTitle, annotations, projectDir? } }
|
|
207
|
-
|
|
208
|
-
// Send follow-up message
|
|
209
|
-
{ type: 'message', content: '...' }
|
|
210
|
-
|
|
211
|
-
// Reset session
|
|
212
|
-
{ type: 'reset' }
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
Note: `projectDir` is optional. If omitted, the server uses its default (from `PROJECT_DIR` env var or cwd).
|
|
216
|
-
|
|
217
|
-
**Server → Client:**
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
{ type: 'connected', agent: 'claude', model: 'claude-sonnet-4-20250514', projectDir: '/path/to/project' }
|
|
221
|
-
{ type: 'processing' }
|
|
222
|
-
{ type: 'delta', content: '...' } // Streaming text
|
|
223
|
-
{ type: 'tool_start', tool: '...' } // Tool execution started
|
|
224
|
-
{ type: 'tool_end' } // Tool execution ended
|
|
225
|
-
{ type: 'idle' } // Processing complete
|
|
226
|
-
{ type: 'error', message: '...' }
|
|
227
|
-
{ type: 'reset_complete' }
|
|
81
|
+
├── client/ # Lit web components (browser UI)
|
|
82
|
+
│ ├── src/components/ # UI components
|
|
83
|
+
│ ├── src/services/ # WebSocket, storage
|
|
84
|
+
│ └── dist/ # Built bundle
|
|
85
|
+
└── server/ # WebSocket server + AI agents
|
|
86
|
+
└── src/agents/ # Claude, Copilot, Codex integrations
|
|
228
87
|
```
|
|
229
88
|
|
|
230
89
|
## Troubleshooting
|
|
231
90
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
2. Check the WebSocket URL in settings
|
|
236
|
-
3. Check browser console for connection errors
|
|
237
|
-
4. Click "Reconnect" if max attempts reached
|
|
238
|
-
|
|
239
|
-
### "Claude Code CLI not found"
|
|
240
|
-
|
|
241
|
-
Install Claude Code globally:
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
npm install -g @anthropic-ai/claude-code
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Annotations not persisting
|
|
91
|
+
**WebSocket not connected**
|
|
92
|
+
- Ensure server is running: `PROJECT_DIR=/path npx @codewithdan/zingit`
|
|
93
|
+
- Check WebSocket URL in settings (default: `ws://localhost:3000`)
|
|
248
94
|
|
|
249
|
-
|
|
250
|
-
-
|
|
95
|
+
**Agent not responding**
|
|
96
|
+
- Verify AI agent is installed and authenticated
|
|
97
|
+
- Check server logs for error messages
|
|
251
98
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
-
|
|
255
|
-
- Some elements may have pointer-events disabled
|
|
256
|
-
|
|
257
|
-
## Development
|
|
258
|
-
|
|
259
|
-
### Type Checking
|
|
260
|
-
|
|
261
|
-
```bash
|
|
262
|
-
# Client
|
|
263
|
-
cd client && npm run typecheck
|
|
264
|
-
|
|
265
|
-
# Server
|
|
266
|
-
cd server && npm run typecheck
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Testing
|
|
270
|
-
|
|
271
|
-
The server includes a test suite to validate agent WebSocket communication.
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
cd server
|
|
275
|
-
|
|
276
|
-
# Run a single test (requires server to be running)
|
|
277
|
-
npm run test # Simple scenario
|
|
278
|
-
npm run test -- --scenario=multi # Multiple annotations
|
|
279
|
-
npm run test -- --scenario=followup # With follow-up message
|
|
280
|
-
|
|
281
|
-
# Run all agents (starts/stops server automatically)
|
|
282
|
-
npm run test:all # Test all agents
|
|
283
|
-
npm run test:copilot # Test only Copilot
|
|
284
|
-
npm run test:claude # Test only Claude
|
|
285
|
-
npm run test:codex # Test only Codex
|
|
286
|
-
|
|
287
|
-
# Dry run to see what would be tested
|
|
288
|
-
./tests/run-all-tests.sh --dry-run
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
The test suite uses a sample project in `tests/test-project/` with a React file for agents to modify. Test scenarios send annotated UI changes and verify the agent responds correctly.
|
|
292
|
-
|
|
293
|
-
### Project Structure
|
|
294
|
-
|
|
295
|
-
The client uses Lit 3.x web components with Shadow DOM enabled for style isolation. This is critical for the bookmarklet use case where ZingIt must not conflict with the host page's styles.
|
|
296
|
-
|
|
297
|
-
The server is a simple WebSocket relay that forwards annotation data to the configured AI agent and streams responses back.
|
|
99
|
+
**Annotations not persisting**
|
|
100
|
+
- Annotations are URL-specific and stored in localStorage
|
|
101
|
+
- Changing pages clears annotations
|
|
298
102
|
|
|
299
103
|
## License
|
|
300
104
|
|
|
301
105
|
MIT
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
**Made by [Dan Wahlin](https://github.com/danwahlin)** | [Issues](https://github.com/danwahlin/zingit/issues) | [Contributing](CONTRIBUTING.md)
|