build: add Firefox development foundation

This commit is contained in:
golem 2026-07-29 16:13:35 -06:00
parent db4f65f5e6
commit 457d979fb2
9 changed files with 4273 additions and 22 deletions

@ -0,0 +1,36 @@
name: Firefox Extension CI
on:
pull_request:
push:
branches:
- develop
- main
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint and build
run: npm test
- name: Upload Firefox package
if: ${{ gitea.event_name == 'push' && gitea.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v4
with:
name: firefox-extension-${{ gitea.sha }}
path: web-ext-artifacts/*.zip
if-no-files-found: error
retention-days: 30

6
.gitignore vendored

@ -1,2 +1,4 @@
.idea
.idea/
node_modules/
web-ext-artifacts/
npm-debug.log*

43
AGENTS.md Normal file

@ -0,0 +1,43 @@
# Repository Guidelines
## Project Structure & Module Organization
This is a manifest-only Firefox WebExtension with npm-based development tooling.
- `manifest.json` defines the extension metadata and ChatGPT search provider.
- `icons/` contains size-specific PNG artwork named `powered-by-openai-icon-<size>x<size>.png`.
- `web-ext-config.mjs` controls linting, local execution, and ZIP packaging.
- `.gitea/workflows/firefox-extension.yml` validates pull requests and protected branches.
- `README.md`, `CHANGELOG.md`, and `LICENSE.txt` cover usage, releases, and licensing.
## Browser Scope
Firefox Desktop is the only current implementation and release target. Do not add Chrome, Brave, Chromium, or other browser packaging—or modify the sibling Chrome repository—unless a task explicitly requests it. Future ports remain desirable, so prefer standard WebExtension APIs where they preserve Firefox behavior and isolate unavoidable Firefox-specific code.
## Build, Test, and Development Commands
- `npm ci` installs the exact dependencies from `package-lock.json`; use Node.js 22 or newer.
- `npm run dev` launches a temporary Firefox profile with automatic extension reload.
- `npm run lint` runs strict Mozilla extension validation.
- `npm run build` creates the unsigned ZIP under `web-ext-artifacts/`.
- `npm test` runs lint and build checks together; run it before every pull request.
## Coding Style & Naming Conventions
Use two-space indentation in JSON, YAML, and JavaScript configuration. Preserve logical key grouping in `manifest.json`. Use lowercase, hyphenated filenames and include dimensions in icon names. Keep changes focused and avoid adding runtime dependencies without a concrete need.
## Testing Guidelines
Automated checks cover manifest validation and packaging, not browser behavior. After `npm test`, use `npm run dev` and confirm `gpt <query>` opens ChatGPT, the provider stays non-default, and Firefox search settings can configure it. Inspect ZIP contents whenever packaging rules or assets change.
Gitea Actions runs checks for every pull request and pushes to `develop` and `main`. Only successful `main` pushes upload an unsigned build artifact; CI does not publish to AMO.
## Commit & Pull Request Guidelines
Recent history uses short, lowercase prefixes such as `doc:` and `build:` (for example, `doc: fix git url`). Follow `<type>: <concise summary>` and keep each commit focused.
Pull requests should explain the user-visible effect, list manual Firefox checks, and link the relevant issue. Include screenshots for icons or browser-visible metadata. Explicitly call out permission, search URL, privacy, and packaging changes.
## Security & Privacy
Do not commit credentials or API keys. New permissions, telemetry, intermediary servers, or data collection require explicit justification and matching privacy documentation.

@ -1,20 +1,47 @@
Search with ChatGPT Powered by OpenAI Firefox Extension
=======================================================
# Search with ChatGPT Powered by OpenAI Firefox Extension
Extensions adds ChatGPT as a search engine configurable option
in the browser. Default prefix is "gpt <query term>" or can be set
in the settings. Does not require login, or API key, or use custom servers
or code. Simply queries your url bar into a new ChatGPT session.
This extension adds ChatGPT as a configurable Firefox search provider. Type
`gpt <query>` in the address bar to open the query in a new ChatGPT session.
It uses no API key, custom server, or intermediary handler.
Unofficial - Provided by Zavage Software Inc.
This is an unofficial extension provided by Zavage Software Inc.
See LICENSE.txt.
- [Firefox Add-ons listing](https://addons.mozilla.org/en-US/firefox/addon/search-with-chatgpt/)
- [Project repository](https://git-repos.zavage.net/zavage-software/search-with-chatgpt-powered-by-openai-extension)
- [Zavage Software](https://zavage-software.com)
* https://zavage-software.com
* https://git-repos.zavage.net/zavage-software/search-with-chatgpt-powered-by-openai-extension
See `LICENSE.txt` for licensing terms.
Firefox extension page: https://addons.mozilla.org/en-US/firefox/addon/search-with-chatgpt/
# Privacy Policy
## Browser Support
Firefox Desktop is the current development and release target. Chrome, Brave,
other Chromium browsers, and additional WebExtension platforms may be evaluated
after the Firefox feature set is more substantial; they are not current targets.
## Development
Install Node.js 22 or newer, Firefox, and the locked development dependencies:
```sh
npm ci
```
Available commands:
- `npm run dev` launches the extension in a temporary Firefox profile and
reloads it when files change.
- `npm run lint` validates the extension and treats warnings as errors.
- `npm run build` creates
`web-ext-artifacts/search-with-chatgpt-firefox-<version>.zip`.
- `npm test` runs the same lint and build checks used by Gitea Actions.
The generated ZIP is unsigned. Use `npm run dev` for local testing; signing and
submission to Mozilla Add-ons remain a separate release step.
Before submitting a change, confirm that `gpt <query>` opens
`https://chatgpt.com?q=<query>`, the provider remains non-default, and it can be
configured in Firefox search settings.
## Privacy Policy
This extension collects zero user data.

@ -1,7 +0,0 @@
#!/bin/bash
zip -r chatgpt-search-engine-extension.zip \
LICENSE.txt \
manifest.json \
icons/favicon.png

@ -5,6 +5,23 @@
"author": "Mathew Guest <mat@zavage.net>",
"homepage_url": "https://zavage-software.com/portfolio/search-with-ChatGPT",
"version": "1.0",
"icons": {
"16": "icons/powered-by-openai-icon-16x16.png",
"32": "icons/powered-by-openai-icon-32x32.png",
"48": "icons/powered-by-openai-icon-48x48.png",
"64": "icons/powered-by-openai-icon-64x64.png",
"128": "icons/powered-by-openai-icon-128x128.png"
},
"browser_specific_settings": {
"gecko": {
"id": "{24644f0c-bfcb-4ebd-a16b-bc8a7d154288}",
"data_collection_permissions": {
"required": [
"none"
]
}
}
},
"chrome_settings_overrides": {
"search_provider": {
"name": "ChatGPT",

4095
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

18
package.json Normal file

@ -0,0 +1,18 @@
{
"name": "search-with-chatgpt-powered-by-openai-extension",
"version": "1.0.0",
"private": true,
"description": "Development tooling for the Search with ChatGPT Firefox extension.",
"engines": {
"node": ">=22"
},
"scripts": {
"dev": "web-ext run",
"lint": "web-ext lint",
"build": "web-ext build",
"test": "npm run lint && npm run build"
},
"devDependencies": {
"web-ext": "10.5.0"
}
}

20
web-ext-config.mjs Normal file

@ -0,0 +1,20 @@
export default {
sourceDir: ".",
artifactsDir: "web-ext-artifacts",
ignoreFiles: [
"AGENTS.md",
"CHANGELOG.md",
"README.md",
"package.json",
"package-lock.json",
"web-ext-config.mjs",
"web-ext-artifacts/**",
],
build: {
filename: "search-with-chatgpt-firefox-{version}.zip",
overwriteDest: true,
},
lint: {
warningsAsErrors: true,
},
};