Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build Commands

```sh
npm ci # Install dependencies
npm run build # Build both Chrome and Firefox extensions
npm run build-chrome # Build Chrome extension only
npm run build-firefox # Build Firefox extension only
npm run watch-chrome # Watch mode for Chrome development
npm run watch-firefox # Watch mode for Firefox development
npm run format # Format code with Biome
npm run lint # Check code with Biome
npm test # Run linter (alias for npm run lint)
```

Build outputs go to `built/kagi_{browser}_{version}.zip`.

## Architecture

This is a monorepo containing Kagi Search browser extensions for Chrome, Firefox, and Safari.

### Code Sharing Model

- **`shared/`** - Common code used by both Chrome and Firefox extensions
- `src/background.js` - Service worker: session token management, auth header injection, context menus
- `src/popup.js` - Extension popup UI and settings management
- `src/summarize_result.js` - Universal Summarizer feature
- `src/lib/utils.js` - Shared utilities (API calls, storage, permissions)
- `icons/` - Extension icons
- **`chrome/`** - Chrome-specific manifest only
- **`firefox/`** - Firefox-specific manifest only
- **`safari/`** - Separate Swift-based implementations (not part of JS build)

The build script (`build.js`) combines `shared/*` with browser-specific manifests into zip files.

### Safari Extensions

Safari extensions are Swift-based native apps, separate from the npm build system. Built with Xcode.

- **`safari/Universal/`** - Universal extension for iOS + macOS (MV3). Still under development - background scripts are unreliable and may be killed or fail to load.
- **`safari/Legacy iOS/`** - Legacy iOS implementation
- **`safari/Legacy macOS/`** - Legacy macOS implementation (minimum macOS 10.14)

The iOS extension is published at: https://apps.apple.com/us/app/kagi-search-for-safari/id1607766153

### Browser Detection

```javascript
IS_CHROME = typeof browser.runtime.getBrowserInfo !== 'function'
```

### Key APIs

- `kagi.com/api/v0/summarize` - API-based summarization
- `kagisuggest.com` - Search autocomplete

## Code Style

- Biome for linting/formatting (2-space indent, single quotes)
- Safari code is excluded from linting
- Node 20.x, npm 10.x required

## Contributing

Bugfixes and improvements are welcome. New features require prior approval via the issue tracker.
28 changes: 23 additions & 5 deletions safari/Universal/macOS (Extension)/manifest.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
{
"manifest_version": 2,
"manifest_version": 3,
"default_locale": "en",

"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
"version": "2.2.3",
"version": "2.2.4",

"icons": {
"512": "images/Icon.png"
},

"background": {
"scripts": [
"rule-builder.js",
"background.js"
],
"persistent": false
},

"browser_action": {
"content_scripts": [{
"js": [ "content-script.js" ],
"matches": [ "<all_urls>" ],
"exclude_matches" : ["*://*.kagi.com/*"],
"run_at": "document_start"
}, {
"js": ["kagi-content-script.js"],
"matches": ["*://*.kagi.com/*"],
"run_at": "document_start"
}],

"action": {
"default_popup": "popup.html",
"default_icon": {
"128": "images/ToolbarItemIcon.pdf"
Expand All @@ -27,8 +39,14 @@
"permissions": [
"nativeMessaging",
"webNavigation",
"storage"
"declarativeNetRequestWithHostAccess",
"storage",
"activeTab"
],

"host_permissions": [
"<all_urls>"
],

"optional_permissions": []
}
Loading