Skip to content

johnpole/promptshift

Repository files navigation

PromptShift

PromptShift is a Chrome extension that upgrades raw prompts directly where you type. It injects a floating "Enhance" control into text fields across websites and rewrites your prompt using proven prompt-engineering frameworks.

PromptShift Logo

Features

  • Works in textarea, text input, and contenteditable fields across websites.
  • One-click prompt enhancement powered by Gemini.
  • Multiple enhancement strategies, including:
    • Polish
    • Email
    • Chat
    • Structured Output
    • Persona
    • CO-STAR
    • Chain of Thought
    • Socratic
    • Agentic
  • Tone controls (Professional, Friendly, Casual, Direct, Confident, Empathetic).
  • Keyboard shortcuts:
    • Enhance: Ctrl+Shift+E (Cmd+Shift+E on macOS)
    • Show/Hide pill: Ctrl+Shift+Y (Cmd+Shift+Y on macOS)
  • Remembers selected framework and tone in Chrome local storage.

Tech Stack

  • React + TypeScript + Vite
  • Chrome Extension Manifest V3
  • Service worker + content script architecture
  • Gemini API (gemini-2.0-flash-lite) via REST

Prerequisites

Local Setup

  1. Install dependencies:
npm install
  1. Create .env.local in the project root:
GEMINI_API_KEY=YOUR_API_KEY_HERE
  1. Build the extension:
npm run build

Load the Extension in Chrome

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Click Load unpacked.
  4. Select the dist/ folder.

The extension icon is configured in manifest.json and generated from files in assets/icons/.

Scripts

  • npm run dev: Runs Vite dev server for the popup app UI.
  • npm run build: Builds popup + content script + service worker, and copies extension assets to dist/.
  • npm run preview: Previews the built popup app.

Project Structure

  • src/content.ts: Injected script for in-page UI and enhancement flow.
  • src/service_worker.ts: Background worker that calls Gemini API.
  • src/content.css: Styling for injected UI.
  • manifest.json: Chrome extension configuration.
  • assets/icons/: Extension icons used by Chrome.

Icon Assets

  • assets/icons/logo-1024.png: Compressed source logo.
  • assets/icons/icon16.png
  • assets/icons/icon32.png
  • assets/icons/icon48.png
  • assets/icons/icon128.png

Chrome uses these icon files for the extension entry and toolbar display.

Security Notes

  • Never commit real API keys.
  • Keep secrets in .env.local only.
  • Restrict your Gemini key in Google Cloud when possible.

Troubleshooting

  • If you reload the extension, refresh any open tabs where you expect PromptShift to run.
  • If enhancement fails, confirm GEMINI_API_KEY is set and run npm run build again.
  • If you hit rate limits, wait briefly and retry.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors