Skip to content

Change website's frontend from your browser. Built during a weekend long hackathon at Entrepreneur's First, The Bridge Builder's retreat

Notifications You must be signed in to change notification settings

TonyStef/Polish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Polish - AI-Powered Website Editor

Chrome extension that lets you modify YOUR website using natural language and Claude AI

Version Status License


🎯 What is Polish?

Polish is a Chrome extension that allows users to modify website elements using plain English commands powered by Claude AI.

Example:

  1. Click the Polish extension icon
  2. Select "Select Element" and click any element on the page
  3. Type: "Make this button blue and larger"
  4. Claude AI generates and applies the CSS/HTML changes instantly

Core Concept: User installs extension β†’ Types modifications in natural language β†’ Claude AI processes β†’ Changes applied locally (no upload to production)


πŸ—οΈ Project Status

Current Phase: POC/MVP - Backend Complete βœ… Version: 0.1.0 Backend: Production-ready (100% complete) Frontend: Wireframe only (UI team to implement)

What's Done

βœ… Complete backend logic and infrastructure βœ… Claude API integration βœ… Element selection system βœ… DOM manipulation & modification application βœ… Message passing architecture βœ… Error handling with recovery βœ… State management (state machine) βœ… Keyboard shortcuts βœ… Comprehensive documentation

What's Next

⏳ UI/UX design (handled by cofounder) ⏳ Extension icons (final design) ⏳ Testing & deployment


πŸ“ Project Structure

Polish/
β”œβ”€β”€ README.md                      # You are here
β”œβ”€β”€ CONTRIBUTING.md                # How to contribute
β”œβ”€β”€ manifest.json                  # Chrome extension configuration
β”‚
β”œβ”€β”€ docs/                          # Complete documentation
β”‚   β”œβ”€β”€ INDEX.md                   # Documentation navigation
β”‚   β”œβ”€β”€ README.md                  # Docs overview
β”‚   β”œβ”€β”€ BACKEND_ARCHITECTURE.md    # System architecture
β”‚   β”œβ”€β”€ IMPLEMENTATION_DETAILS.md  # Technical deep dive
β”‚   β”œβ”€β”€ MESSAGE_PROTOCOL.md        # Message passing spec
β”‚   └── DOM_CONTRACT.md            # For UI team
β”‚
β”œβ”€β”€ src/                           # Source code
β”‚   β”œβ”€β”€ background/                # Background service worker
β”‚   β”‚   └── service-worker.js      # Claude API handler
β”‚   β”œβ”€β”€ content/                   # Content scripts (run on pages)
β”‚   β”‚   β”œβ”€β”€ content.js             # Element selection & modification
β”‚   β”‚   └── content.css            # Selection UI styles
β”‚   β”œβ”€β”€ popup/                     # Popup scripts
β”‚   β”‚   β”œβ”€β”€ popup.js               # Backend logic (state machine)
β”‚   β”‚   └── popup.html             # UI reference wireframe
β”‚   └── utils/                     # Shared utilities
β”‚       β”œβ”€β”€ api.js                 # Claude API wrapper
β”‚       └── dom-parser.js          # DOM context extraction
β”‚
└── icons/                         # Extension icons (placeholders)

Each folder has its own README - Check docs/INDEX.md for navigation guide


πŸš€ Quick Start

Prerequisites

  • Google Chrome (latest version)
  • Anthropic API key (Get one here)
  • Node.js/npm (optional, for development)

Installation

1. Clone the repository:

git clone <repository-url>
cd Polish

2. Load extension in Chrome:

# 1. Open Chrome and go to:
chrome://extensions/

# 2. Enable "Developer mode" (top right toggle)

# 3. Click "Load unpacked"

# 4. Select the Polish folder

# Extension should load successfully βœ…

3. Set up API key:

# 1. Click the Polish extension icon
# 2. Enter your Anthropic API key (starts with sk-ant-)
# 3. Click "Save"

First Use

1. Navigate to any website (e.g., https://wikipedia.org)

2. Click Polish extension icon

3. Click "Select Element" button

4. Click any element on the page

  • Should see blue highlight on hover
  • Should see green highlight when clicked

5. Type a modification request

  • Example: "Make this text bigger and blue"
  • Press Ctrl+Enter (or Cmd+Enter on Mac)

6. Wait 2-10 seconds for Claude to process

7. Modifications applied!

Getting Started

Step 1: Read documentation

docs/DOM_CONTRACT.md  # Required element IDs and structure
src/popup/README.md   # What popup.js does

Step 2: Start with wireframe

src/popup/popup.html  # Use as starting point
# Replace with your custom HTML
# Keep same element IDs

Step 3: Build your design

  • Use any CSS framework (Tailwind, Bootstrap, etc.)
  • Add animations, transitions, icons
  • Make it beautiful!

Step 4: Test

  • Load extension in Chrome
  • Verify all buttons/inputs work
  • Test all states (API key setup, selection, modification)

See: docs/DOM_CONTRACT.md for complete guide


πŸ› οΈ For Backend Developers

Architecture Overview

Components:

  1. Popup (popup.js) - State machine, message coordinator
  2. Content Script (content.js) - Element selection, DOM manipulation
  3. Service Worker (service-worker.js) - Claude API handler
  4. Utils (api.js, dom-parser.js) - Shared utilities

Message Flow:

User β†’ popup.js β†’ content.js β†’ service-worker.js β†’ Claude API
                                                          ↓
User ← popup.js ← content.js ← service-worker.js ← Response

Getting Started

Step 1: Understand the system

docs/BACKEND_ARCHITECTURE.md  # Read first
docs/IMPLEMENTATION_DETAILS.md  # Deep dive
docs/MESSAGE_PROTOCOL.md       # All message types

Step 2: Find what you need to modify

src/README.md  # Source code guide
# Each folder has its own README

Step 3: Make changes and test

# Modify code
# Load extension in Chrome
# Test in browser DevTools

πŸ“– Documentation

Essential Reading

Document For Purpose
docs/INDEX.md Everyone Documentation navigation
docs/README.md Everyone Documentation overview
docs/BACKEND_ARCHITECTURE.md Backend devs System architecture
docs/IMPLEMENTATION_DETAILS.md Backend devs Technical implementation
docs/MESSAGE_PROTOCOL.md Backend devs Message specifications
docs/DOM_CONTRACT.md UI devs UI integration guide

Folder Documentation

Each source folder has its own README:


πŸ”§ Development

Prerequisites

# Chrome browser (latest)
# Anthropic API key
# Text editor (VS Code recommended)

Local Setup

# 1. Clone repository
git clone <repository-url>
cd Polish

# 2. No build process needed (vanilla JavaScript)

# 3. Load in Chrome as described above

Testing

Load extension:

chrome://extensions/
β†’ Developer mode ON
β†’ Load unpacked
β†’ Select Polish folder

View logs:

# Popup logs:
Right-click popup β†’ Inspect β†’ Console

# Service worker logs:
chrome://extensions/ β†’ Polish β†’ "service worker" link

# Content script logs:
Page DevTools β†’ Console (filter for "Polish")

Debug mode: In popup.js line 19, set:

const DEBUG_MODE = true;  // Verbose logging

🎯 Features

Current Features (v0.1.0)

βœ… Element Selection

  • Visual highlighting (blue hover, green selected)
  • Click any element to select
  • Safe element validation

βœ… Natural Language Modifications

  • Type requests in plain English
  • Claude AI processes and generates code
  • CSS and HTML modifications supported

βœ… State Management

  • Professional state machine (8 states)
  • Handles popup lifecycle
  • Race condition prevention

βœ… Error Handling

  • Comprehensive error recovery
  • User-friendly error messages
  • Network timeout handling

βœ… Keyboard Shortcuts

  • Enter: Save API key
  • Ctrl+Enter: Submit modification
  • Escape: Cancel selection mode

βœ… Security

  • XSS protection (HTML sanitization)
  • Safe element validation
  • API key encryption (via Chrome storage)

Planned Features (Future)

⏳ Modification persistence ⏳ Undo/redo functionality ⏳ Multi-element selection ⏳ Modification templates ⏳ Export as CSS file ⏳ Collaborative sharing


βš™οΈ Configuration

API Key

Required: Anthropic API key

Get one: https://console.anthropic.com/settings/keys

Set in extension:

  1. Click extension icon
  2. Enter key (starts with sk-ant-)
  3. Click "Save"

Storage: chrome.storage.local (encrypted by Chrome)

Extension Permissions

Required permissions (in manifest.json):

  • activeTab - Access current tab
  • storage - Store API key
  • scripting - Inject scripts
  • <all_urls> - Work on any website

πŸ› Troubleshooting

Common Issues

Extension won't load:

  • Check Chrome version (need latest)
  • Verify all files exist
  • Check for syntax errors in console

"No active tab found":

  • Refresh the page
  • Make sure you're on a regular webpage (not chrome:// pages)

"Could not establish connection":

  • Content script not loaded yet
  • Refresh page and try again

"API rate limit exceeded":

  • Wait a few moments
  • Claude API has rate limits
  • Try again shortly

Modifications not applying:

  • Check DevTools console for errors
  • Verify element is still on page
  • Check Claude's response in service worker logs

Getting Help

Check documentation:

Enable debug logging:

// In popup.js line 19:
const DEBUG_MODE = true;

🀝 Contributing

See CONTRIBUTING.md for development guidelines.

Quick guide:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Backend changes: Follow state machine pattern, add tests UI changes: Keep element IDs, test with popup.js


πŸ“ License

MIT License - See LICENSE file for details


πŸ‘₯ Team

Backend/Infrastructure: Backend team UI/Design: Cofounder AI Integration: Claude 3.5 Sonnet (Anthropic)


πŸ™ Acknowledgments


πŸ“ž Contact

Questions?

  • Read docs/INDEX.md for navigation
  • Check folder READMEs
  • Open an issue

Current Status: Backend complete βœ… | UI in progress ⏳ | Ready for deployment πŸš€


Version: 0.1.0 Last Updated: 2025-11-01 Status: Beta

About

Change website's frontend from your browser. Built during a weekend long hackathon at Entrepreneur's First, The Bridge Builder's retreat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •