{"id":43194905,"url":"https://github.com/nicobailon/pi-annotate","last_synced_at":"2026-04-20T05:10:00.250Z","repository":{"id":335776933,"uuid":"1140388766","full_name":"nicobailon/pi-annotate","owner":"nicobailon","description":"Visual feedback from browser to AI. Click elements, add comments, fix code.","archived":false,"fork":false,"pushed_at":"2026-04-04T02:13:29.000Z","size":5635,"stargazers_count":114,"open_issues_count":2,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-12T09:06:30.569Z","etag":null,"topics":["ai-tools","annotation","chrome-extension","pi"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicobailon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-23T07:58:58.000Z","updated_at":"2026-04-11T20:39:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nicobailon/pi-annotate","commit_stats":null,"previous_names":["nicobailon/pi-annotate"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/nicobailon/pi-annotate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicobailon%2Fpi-annotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicobailon%2Fpi-annotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicobailon%2Fpi-annotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicobailon%2Fpi-annotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicobailon","download_url":"https://codeload.github.com/nicobailon/pi-annotate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicobailon%2Fpi-annotate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32033772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","annotation","chrome-extension","pi"],"created_at":"2026-02-01T05:16:49.167Z","updated_at":"2026-04-20T05:10:00.243Z","avatar_url":"https://github.com/nicobailon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp\u003e\n  \u003cimg src=\"banner.png\" alt=\"Pi Annotate\" width=\"1100\"\u003e\n\u003c/p\u003e\n\n# Pi Annotate\n\n**Visual annotation for AI. Click elements, capture screenshots, fix code.**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE)\n[![Browser](https://img.shields.io/badge/Browser-Chrome%20%7C%20Chromium-blue?style=for-the-badge)]()\n\n```\n/annotate\n```\n\nFigma-like annotation experience with floating inline note cards. DevTools-like element picker in vanilla JS.\n\nClick elements, add comments, submit. The agent gets selectors, box model, accessibility, screenshots — everything it needs to fix your UI.\n\nhttps://github.com/user-attachments/assets/115b10ca-86e8-4b1c-b8a4-492c68759c58\n\n## Quick Start\n\n### 1. Install Pi Extension\n\n```bash\npi install npm:pi-annotate\n```\n\nRestart pi to load the extension.\n\n### 2. Load Supported Browser Extension\n\n1. Open the extensions page in Google Chrome, Google Chrome for Testing, or Chromium, and enable **Developer mode**\n2. Click **Load unpacked** → select the `chrome-extension/` folder inside the installed package\n3. Click the **Pi Annotate icon** in the toolbar\n\n### 3. Install Native Host\n\nThe popup shows your extension ID. Click **Copy** next to the install command, then run it from `chrome-extension/native/` in the installed package:\n\n```bash\n./install.sh \u003cextension-id\u003e\n```\n\nThis installs the native messaging manifest for Google Chrome, Google Chrome for Testing, and Chromium on macOS, plus the default/current config-home locations for those browsers on Linux. Fully quit and reopen that browser. The popup will show **Connected** when ready.\n\n## Usage\n\n```bash\n/annotate                  # Current browser tab\n/annotate https://x.com    # Opens URL first\n```\n\n| Action | How |\n|--------|-----|\n| Select element | Click on page |\n| Cycle ancestors | Alt/⌥+scroll while hovering |\n| Multi-select | Toggle \"Multi\" or Shift+click |\n| Add comment | Type in note card textarea |\n| Toggle screenshot | 📷 button in note card header |\n| Reposition note | Drag by header |\n| Scroll to element | Click selector in note card |\n| Toggle note | Click numbered badge |\n| Expand/collapse all | ▼/▲ buttons in toolbar |\n| Toggle edit capture | \"Etch\" toggle in toolbar |\n| Toggle annotation UI | `⌘/Ctrl+Shift+P` |\n| Close | `ESC` |\n\n## Features\n\n**Context Capture** — Each element automatically gets box model breakdown (padding, border, margin), accessibility info (role, name, focusable, ARIA states), all HTML attributes, and key CSS styles (display, position, overflow, colors, typography). Enable **Debug mode** for computed styles (40+ properties), parent context, and CSS variables.\n\n**Inline Note Cards** — Draggable floating cards with per-element comments, SVG connectors linking notes to elements, click-to-scroll, and per-element screenshot toggles.\n\n**Screenshots** — Individual crops per element (20px padding) or full-page mode with numbered badges drawn on the screenshot to identify elements. Toggle per element with the 📷 button.\n\n**Edit Capture** — Toggle \"Etch\" in the toolbar to record DevTools edits. Change inline styles, modify CSS rules, add/remove classes, edit text — everything is tracked via MutationObserver. A pulsing red dot and badge counter show recording status. At submit, the extension takes before/after screenshots by briefly undoing visual changes, and produces structured property-level diffs the agent can map to source code. Works alongside element selection or standalone.\n\n**Restricted Tabs** — If the current tab is `chrome://` or other restricted URLs, providing a URL opens a new tab automatically. Popup button and keyboard shortcut auto-inject the content script on fresh tabs.\n\n## Output\n\n```markdown\n## Page Annotation: https://example.com\n**Viewport:** 1440×900\n\n**Context:** Fix the styling issues\n\n### Selected Elements (2)\n\n1. **button**\n   - Selector: `#submit-btn`\n   - ID: `submit-btn`\n   - Classes: `btn, btn-primary`\n   - Text: \"Submit\"\n   - **Box Model:** 120×40 (content: 96×24, padding: 8 16, border: 1, margin: 0 8)\n   - **Attributes:** type=\"submit\", data-testid=\"submit\"\n   - **Styles:** display: flex, backgroundColor: rgb(59, 130, 246)\n   - **Accessibility:** role=button, name=\"Submit\", focusable=true, disabled=false\n   - **Comment:** Make this blue with rounded corners\n\n2. **div**\n   - Selector: `.error-message`\n   - Classes: `error-message, hidden`\n   - Text: \"Please fill required fields\"\n   - **Box Model:** 300×20 (content: 300×20, padding: 0, border: 0, margin: 0 0 8)\n   - **Accessibility:** focusable=false, disabled=false\n   - **Comment:** This should appear in red, not hidden\n\n### Screenshots\n\n- Element 1: /var/folders/.../pi-annotate-...-el1.png\n- Element 2: /var/folders/.../pi-annotate-...-el2.png\n\n## Edit Capture (2 changes, 35s)\n\n### Inline Style Changes\n\n**`#submit-btn`**\n- `background-color`: `rgb(59, 130, 246)` → `rgb(37, 99, 235)`\n- `border-radius`: added `8px`\n\n### CSS Rule Changes\n\n**`.btn-primary:hover`** (styles.css)\n- `background-color`: `rgb(37, 99, 235)` → `rgb(29, 78, 216)`\n\n### Before/After Screenshots\n\n- Before: /var/folders/.../pi-annotate-...-before.png\n- After: /var/folders/.../pi-annotate-...-after.png\n```\n\nDebug mode adds computed styles, parent context, and CSS variables per element. Edit capture appears when the Etch toggle is enabled and changes are detected.\n\n## Architecture\n\n```\nPi Extension (index.ts)\n    ↕ Unix Socket (/tmp/pi-annotate.sock)\nNative Host (host.cjs)\n    ↕ Browser Native Messaging\nBrowser Extension (background.js → content.js)\n```\n\n| File | Purpose |\n|------|---------|\n| `index.ts` | Pi extension — `/annotate` command + tool |\n| `types.ts` | TypeScript interfaces |\n| `chrome-extension/content.js` | Element picker UI (vanilla JS) |\n| `chrome-extension/background.js` | Native messaging, screenshots, tab routing |\n| `chrome-extension/native/host.cjs` | Socket ↔ native messaging bridge |\n| `chrome-extension/popup.html` | Connection status + setup |\n\nAuth token generated per-run at `/tmp/pi-annotate.token`. Socket and token files use 0600 permissions.\n\n## Development\n\nNo build step. Edit `content.js` or `background.js` directly, reload at `chrome://extensions`. Pi extension (TypeScript) loads via jiti — restart pi after changes.\n\n```bash\ntail -f /tmp/pi-annotate-host.log                    # Native host logs\n# chrome://extensions → Pi Annotate → service worker  # Background logs\n# DevTools on target page                              # Content script logs\n```\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| UI doesn't appear | Refresh page, check service worker console |\n| \"restricted URL\" error | Provide a URL: `/annotate https://example.com` |\n| Native host not connecting | Click extension icon → check status, re-run install, fully restart the supported browser |\n| \"Extension ID mismatch\" | Copy install command from popup, re-run |\n| Socket errors | `ls -la /tmp/pi-annotate.sock` |\n\n**Verify native host:**\n- macOS Google Chrome: `cat ~/Library/Application\\ Support/Google/Chrome/NativeMessagingHosts/com.pi.annotate.json`\n- macOS Google Chrome for Testing: `cat ~/Library/Application\\ Support/Google/ChromeForTesting/NativeMessagingHosts/com.pi.annotate.json`\n- macOS Chromium: `cat ~/Library/Application\\ Support/Chromium/NativeMessagingHosts/com.pi.annotate.json`\n- Linux Google Chrome (default path): `cat ~/.config/google-chrome/NativeMessagingHosts/com.pi.annotate.json`\n- Linux Google Chrome for Testing (default path): `cat ~/.config/google-chrome-for-testing/NativeMessagingHosts/com.pi.annotate.json`\n- Linux Chromium (default path): `cat ~/.config/chromium/NativeMessagingHosts/com.pi.annotate.json`\n- Linux with custom config home: `echo \"${CHROME_CONFIG_HOME:-${XDG_CONFIG_HOME:-$HOME/.config}}\"`\n\nIf your Linux browser uses a different XDG config root, export `CHROME_CONFIG_HOME` or `XDG_CONFIG_HOME` before running `./install.sh \u003cextension-id\u003e`. Custom `--user-data-dir` layouts are not handled by this installer.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicobailon%2Fpi-annotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicobailon%2Fpi-annotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicobailon%2Fpi-annotate/lists"}