vite-plugin-ai-annotator 1.14.9 → 1.14.10

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 CHANGED
@@ -144,9 +144,10 @@ Example prompt: *"Make the selected button larger and change its color to blue"*
144
144
 
145
145
  ```typescript
146
146
  annotator({
147
- port: 7318, // Server port (default: 7318)
148
- autoSetupMcp: true, // Auto-configure MCP files (default: false)
149
- verbose: false, // Enable detailed logging (default: false)
147
+ port: 7318, // Server port (default: 7318)
148
+ autoSetupMcp: true, // Auto-configure MCP files (default: false)
149
+ autoSetupSkills: true, // Auto-write AI tool skill files (default: true)
150
+ verbose: false, // Enable detailed logging (default: false)
150
151
  })
151
152
  ```
152
153
 
@@ -166,4 +167,48 @@ When `autoSetupMcp: true`, the plugin automatically:
166
167
 
167
168
  3. **Preserves existing config** - merges with other MCP servers, doesn't overwrite
168
169
 
170
+ ### Auto AI Skills Setup
171
+
172
+ When `autoSetupSkills: true` (default), the plugin writes skill/instruction files on every dev server start with the correct server address baked in. This means AI tools automatically know how to call the REST API:
173
+
174
+ | AI Tool | File | Format |
175
+ |---------|------|--------|
176
+ | Claude Code | `.claude/skills/ai-annotator/SKILL.md` | YAML frontmatter (`name`, `description`) |
177
+ | Cursor | `.cursor/rules/ai-annotator.mdc` | `alwaysApply: true` |
178
+ | Windsurf | `.windsurf/rules/ai-annotator.md` | `trigger: always_on` |
179
+ | Codex | `AGENTS.md` | Marker-delimited section |
180
+ | Copilot | `.github/instructions/ai-annotator.instructions.md` | `applyTo: "**"` |
181
+ | Cline | `.clinerules/ai-annotator.md` | Plain markdown |
182
+
183
+ Files are updated on every server restart, so the address is always correct.
184
+
185
+ ## REST API
186
+
187
+ The server exposes a plain HTTP REST API at `/api/*`, usable by any HTTP client — no MCP required.
188
+
189
+ ```bash
190
+ # List sessions
191
+ curl http://localhost:7318/api/sessions
192
+
193
+ # Get feedback
194
+ curl http://localhost:7318/api/sessions/<id>/feedback
195
+
196
+ # Inject JS
197
+ curl -X POST http://localhost:7318/api/sessions/<id>/inject-js \
198
+ -H 'Content-Type: application/json' \
199
+ -d '{"code": "document.title"}'
200
+ ```
201
+
202
+ | Method | Endpoint | Body/Query | Description |
203
+ |--------|----------|------------|-------------|
204
+ | `GET` | `/api/sessions` | — | List connected browser sessions |
205
+ | `GET` | `/api/sessions/:id/page-context` | — | Page URL, title, selection count |
206
+ | `POST` | `/api/sessions/:id/select` | `{mode?, selector?, selectorType?}` | Trigger feedback selection |
207
+ | `GET` | `/api/sessions/:id/feedback` | `?fields=xpath,attributes,styles,children` | Get selected feedback items |
208
+ | `DELETE` | `/api/sessions/:id/feedback` | — | Clear all selections |
209
+ | `POST` | `/api/sessions/:id/screenshot` | `{type?, selector?, quality?}` | Capture screenshot |
210
+ | `POST` | `/api/sessions/:id/inject-css` | `{css}` | Inject CSS into page |
211
+ | `POST` | `/api/sessions/:id/inject-js` | `{code}` | Execute JS in page context |
212
+ | `GET` | `/api/sessions/:id/console` | `?clear=true` | Get captured console logs |
213
+
169
214
  **Happy coding! 🚀**
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Auto-setup AI tool skill/instruction files with the running server address.
3
+ *
4
+ * Writes proper skill/rule files for each AI tool:
5
+ * - Claude Code: .claude/skills/ai-annotator/SKILL.md
6
+ * - Cursor: .cursor/rules/ai-annotator.mdc (alwaysApply)
7
+ * - Windsurf: .windsurf/rules/ai-annotator.md (trigger: always_on)
8
+ * - Codex: AGENTS.md (marker-delimited section)
9
+ * - Copilot: .github/instructions/ai-annotator.instructions.md (applyTo: **)
10
+ * - Cline: .clinerules/ai-annotator.md
11
+ *
12
+ * Each file contains REST API docs with the actual server URL baked in.
13
+ * Updated on every server start so the address is always correct.
14
+ */
15
+ export interface AutoSetupSkillsOptions {
16
+ projectRoot: string;
17
+ serverUrl: string;
18
+ verbose?: boolean;
19
+ }
20
+ export interface AutoSetupSkillsResult {
21
+ updated: string[];
22
+ alreadyConfigured: string[];
23
+ }
24
+ export declare function autoSetupSkills(options: AutoSetupSkillsOptions): AutoSetupSkillsResult;