This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project: Firefox extension "Fancy Links" - copies formatted links with titles instead of plain URLs
Status: ✅ Production-ready with Jest test suite
# Test extension in Firefox
web-ext run --source-dir=src
# Run tests (multiple options available)
npm test # Run all tests
npm run test:watch # Watch mode for development
npm run test:coverage # Generate coverage report
npm run test:ci # CI optimized
# Build for distribution
web-ext build --source-dir=src --artifacts-dir=dist
# Check for lint/format issues (matches CI --warnings-as-errors)
web-ext lint --source-dir=src --warnings-as-errorssrc/formats/format-registry.js- All format logic (html, markdown, etc.)src/background/background.js- Main extension logicsrc/manifest.json- Extension configuration and version
ALWAYS execute Post-Change Workflow after:
- Modifying any
.jsfiles insrc/ - Changing
src/manifest.json - Adding/removing formats in
src/formats/format-registry.js - Updating package.json dependencies or build configuration
- Making functional changes to extension behavior
Exception: Documentation-only changes to .md files (skip workflow)
Pre-existing test failures: If tests reveal failures unrelated to your current changes, fix them anyway. Broken tests erode trust in the suite and only get harder to fix later.
CRITICAL: After triggering changes above, Claude Code must execute this sequence:
# Test functionality (REQUIRED for all functional changes)
npm test
# Check extension compliance (must match CI: --warnings-as-errors)
web-ext lint --source-dir=src --warnings-as-errors- Reference GitHub issues in commit message if resolving them
- Follow existing commit message style (
git log --oneline) - Include concise Claude attribution:
Co-Authored-By: Claude <noreply@anthropic.com>
For testing new features before public release:
Preferred: Use npm run version:bump to automate version bumps:
npm run version:bump rc minor # Start RC for next minor (1.4.5 -> 1.5.0-rc1)
npm run version:bump rc # Increment RC (1.5.0-rc1 -> 1.5.0-rc2)
npm run version:bump stable # Promote to stable (1.5.0-rc1 -> 1.5.0)-
Version Naming Scheme:
- manifest.json: Use two fields:
version:{previousStable}.{suffixNum}(e.g.,1.4.5.1for 1.5.0-rc1)version_name: Target version with suffix (e.g.,1.5.0-rc1)
- Supported suffixes (automatically detected from version_name):
rc- Release candidate (final testing before stable)beta- Beta version (feature complete, testing needed)alpha- Alpha version (early development, may be unstable)
- Examples (current stable 1.4.5 → target 1.5.0):
"version": "1.4.5.1", // {previousStable}.{suffixNum} "version_name": "1.5.0-rc1" // Target version with RC suffix
- Critical: Using previous version ensures 1.4.5.1 < 1.5.0 for proper auto-updates
- manifest.json: Use two fields:
-
Create pre-release:
# Automated (preferred): npm run version:bump rc minor # Then follow the suggested git commands # Manual (if needed): # Update manifest.json with BOTH fields # Example for 1.5.0-rc1 (assuming previous stable is 1.4.5): # "version": "1.4.5.1" # "version_name": "1.5.0-rc1" git commit -am "Prepare v1.5.0-rc1 pre-release" git tag v1.5.0-rc1 git push origin v1.5.0-rc1
-
Pre-release behavior:
- Automatically signed via AMO unlisted channel
- Creates GitHub pre-release (marked as pre-release)
- NOT submitted to AMO public listing
- Distributed via GitHub releases page
- Includes warning notice in release notes
- Auto-updates to stable when released
Update src/manifest.json version:
- PATCH: Bug fixes, documentation
- MINOR: New features, format additions
- MAJOR: Breaking changes
Publish release:
git tag v<version> # Triggers automated GitHub Actions build
git push origin v<version>Note: AMO submission is controlled by the AMO_SUBMISSION_ENABLED GitHub Variable.
Set to true in repository settings to enable automatic submission to addons.mozilla.org.
Production Code (src/):
background/- Main extension logic and clipboard operationspopup/- Toolbar UIoptions/- Settings pageformats/- Centralized format registryutils/- Shared utilities (browser API, clipboard, URL cleaning, diagnostics, keyboard shortcuts)icons/- Extension icons and assets
Development (root):
test/- Automated test suitestools/- Development utilities (icon generation)design/- Design assets and mockups
CI/CD (shared via evanwon/browser-extension-workflows):
.github/workflows/- Thin callers to shared reusable workflows- Version tooling (
version:bump,version:check) provided bybrowser-extension-workflowspackage
Consolidated registry with 4 formats:
html-<a href="URL">Title</a>markdown-[Title](URL)(Discord, Reddit, GitHub, Notion)plaintext-Title - URLurlparams-URL?_title=Page_Title
- Firefox 142+ with Manifest V2
- Permissions:
clipboardWrite,activeTab,storage,notifications - Support for other browsers like Chrome is expected in the future; ensure that feature development is designed with future cross-browser compatibility
- Development:
web-ext run --source-dir=src(loads temporarily in Firefox) - Manual Testing: Load
test/manual.htmlin Firefox with extension active
- CI/CD workflows are shared via
evanwon/browser-extension-workflows(reusable GitHub Actions) - GitHub Actions auto-signs releases when AMO secrets are configured, triggered by git tags
- Unsigned builds require Firefox Developer Edition or temporary loading
All tasks tracked at: https://github.com/evanwon/fancy-links/issues
enhancement/bug/documentationpriority: high|medium|low