From f057c66155ef27c0e12add088b215da26b5b3237 Mon Sep 17 00:00:00 2001 From: golem Date: Wed, 29 Jul 2026 20:35:25 -0600 Subject: [PATCH] doc: add extension options panel design spec Design for an options panel reachable from about:addons, configuring a context-menu entry on selected text and an Alt+Shift+G shortcut. Adds storage and menus permissions only, both in Firefox's no-prompt class, so the install dialog gains no lines and data_collection_permissions stays "none". The gpt search provider is deliberately untouched. Technical claims were verified rather than assumed: MV2 background type:"module" works from Firefox 112 (tested in 153.0.1), so no background HTML shim is needed; package.json needs "type":"module" or node --test fails on Node 22.0-22.6; the ChatGPT model/hints/temporary-chat params are undocumented and unreliable, so every label is written at hint strength. q= no longer auto-submits, only prefills. Also excludes docs/ and test/ from the packaged ZIP. Verified: without this the spec doc itself shipped inside the extension, and a bare glob alone leaves empty directory entries behind. Co-Authored-By: Claude Opus 5 (1M context) --- .../2026-07-29-extension-options-design.md | 604 ++++++++++++++++++ web-ext-config.mjs | 6 + 2 files changed, 610 insertions(+) create mode 100644 docs/superpowers/specs/2026-07-29-extension-options-design.md diff --git a/docs/superpowers/specs/2026-07-29-extension-options-design.md b/docs/superpowers/specs/2026-07-29-extension-options-design.md new file mode 100644 index 0000000..6b6a45a --- /dev/null +++ b/docs/superpowers/specs/2026-07-29-extension-options-design.md @@ -0,0 +1,604 @@ +# Extension Options Panel — Design + +- **Date:** 2026-07-29 +- **Status:** Approved for planning +- **Branch:** `feat/extension-options-panel` (cut from `develop` @ `5edb288`) + +## Summary + +Add an options panel to the extension, reachable from `about:addons` → the +extension's detail card → the **Options** tab (Windows) / **Preferences** tab +(macOS, Linux). The panel configures two new entry points that this change also +introduces: a context-menu item on selected text, and a keyboard shortcut that +opens a fresh ChatGPT chat. + +The existing `gpt ` address-bar search provider is **not** modified and +does not read the settings. See [Why the search provider is untouched](#why-the-search-provider-is-untouched). + +New permissions: `storage` and `menus`. Both are in Firefox's no-prompt class, +so the install dialog gains no new lines and `data_collection_permissions: +["none"]` remains truthful. + +## Goals + +1. Ship a working options panel embedded in `about:addons`. +2. Ship two new entry points whose behaviour the panel controls. +3. Add no permission-warning lines to the install prompt. +4. Keep `data_collection_permissions: ["none"]` accurate. +5. Introduce unit testing for the pure logic, without new runtime dependencies. +6. Never promise behaviour that ChatGPT does not reliably deliver. + +## Non-goals + +- Making the `gpt ` search provider configurable. Out of scope by + decision; it requires either host permissions on `chatgpt.com` or a + navigation-interception mechanism, both of which conflict with goals 3 and 4. +- A toolbar button. +- Named/multiple prompt templates with add-remove-reorder UI. One template only. +- Reading the page selection from the keyboard shortcut. That requires + `activeTab` + `tabs.executeScript`; deliberately excluded (see + [Rejected alternatives](#rejected-alternatives)). +- Migrating to Manifest V3. +- Chrome or other-browser packaging (`AGENTS.md` browser scope). +- User-facing error notifications. The `notifications` permission *does* + generate an install warning, so every failure path degrades silently instead. + +## Background and constraints + +The extension is currently manifest-only: no JavaScript exists, and the +manifest declares no `background`, `content_scripts`, or +`web_accessible_resources` key. Its single feature is +`chrome_settings_overrides.search_provider` with +`search_url: "https://chatgpt.com?q={searchTerms}"`. + +### Why the search provider is untouched + +`chrome_settings_overrides.search_provider` is declarative and fixed at install +time. No WebExtension API can rewrite an installed engine's URL. Making +`gpt ` honour the settings would require intercepting the navigation it +starts, which needs host access to `chatgpt.com` plus `webRequest` or `tabs` — +all of which add install-prompt lines. Rejected in favour of goals 3 and 4. + +`is_default` stays `false`. Setting it to `true` triggers a second, separate +consent doorhanger (`webext-default-search-description`) outside any permission +list, plus an allowlist requirement. + +### ChatGPT URL parameters are undocumented + +None of `q`, `model`, `hints`, or `temporary-chat` is documented by OpenAI. +There is no contract and no support channel. The design is therefore resilient +by construction: the URL is built from a template with no runtime dependency on +any parameter being honoured, each parameter is independently removable so a +user can bisect when ChatGPT ignores one, and all user-facing copy is written at +hint strength. See [Appendix A](#appendix-a-verification-findings) for the +evidence behind each parameter's confidence rating. + +The one parameter with quasi-official standing is `q`, because OpenAI's own +"ChatGPT search" browser extension uses `https://chatgpt.com/?q=`. Build on it; +treat everything else as best-effort. + +**`q` prefills but does not submit.** Auto-submit was real historically but has +been prefill-only since approximately November 2025, after OpenAI gated it on +the `Sec-Fetch-Site` header as a prompt-injection mitigation. No copy in the +options panel, README, or AMO listing may say the query is *searched*, *sent*, +or *asked* — only that ChatGPT opens **with the query filled in**. + +## Architecture + +Manifest stays **V2**. Mozilla has not announced any MV2 deprecation and +commits to at least 12 months' notice. The repo is MV2 today and has no Chrome +target, so migration is an orthogonal change. The code is nonetheless kept +MV3-portable: ES-module background, `persistent: false`, no `browser_style: true`. + +ES modules work in an MV2 background script via +`"background": {"scripts": [...], "type": "module"}`, supported since Firefox +112 and verified empirically in Firefox 153.0.1. No background HTML shim is +needed. The options page is a normal extension page and can use +`