create-addfox-app 0.1.1-beta.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -18
- package/dist/cli.js +259 -102
- package/package.json +9 -8
- package/templates/README.md +3 -0
- package/templates/template-preact-js/AGENTS.md +54 -0
- package/templates/template-preact-js/addfox.config.js +27 -0
- package/templates/template-preact-js/app/background/index.js +8 -0
- package/templates/template-preact-js/app/content/index.js +1 -0
- package/templates/template-preact-js/app/options/App.jsx +5 -0
- package/templates/template-preact-js/app/options/index.jsx +5 -0
- package/templates/template-preact-js/app/popup/App.jsx +31 -0
- package/templates/template-preact-js/app/popup/index.jsx +5 -0
- package/templates/template-preact-js/app/sidepanel/App.jsx +5 -0
- package/templates/template-preact-js/app/sidepanel/index.jsx +5 -0
- package/templates/template-preact-js/package.json +18 -0
- package/templates/template-preact-js/public/icons/icon_128.png +0 -0
- package/templates/template-preact-js/public/welcome.html +20 -0
- package/templates/template-preact-ts/AGENTS.md +61 -0
- package/templates/template-preact-ts/addfox.config.ts +27 -0
- package/templates/template-preact-ts/app/background/index.ts +8 -0
- package/templates/template-preact-ts/app/content/index.ts +1 -0
- package/templates/template-preact-ts/app/options/App.tsx +5 -0
- package/templates/template-preact-ts/app/options/index.tsx +5 -0
- package/templates/template-preact-ts/app/popup/App.tsx +31 -0
- package/templates/template-preact-ts/app/popup/index.tsx +5 -0
- package/templates/template-preact-ts/app/sidepanel/App.tsx +5 -0
- package/templates/template-preact-ts/app/sidepanel/index.tsx +5 -0
- package/templates/template-preact-ts/package.json +20 -0
- package/templates/template-preact-ts/public/icons/icon_128.png +0 -0
- package/templates/template-preact-ts/public/welcome.html +20 -0
- package/templates/template-preact-ts/tsconfig.json +19 -0
- package/templates/template-react-js/AGENTS.md +66 -0
- package/templates/template-react-js/addfox.config.js +27 -0
- package/templates/template-react-js/app/background/index.js +8 -0
- package/templates/template-react-js/app/content/index.js +1 -0
- package/templates/template-react-js/app/options/App.jsx +3 -0
- package/templates/template-react-js/app/options/index.jsx +5 -0
- package/templates/template-react-js/app/popup/App.jsx +29 -0
- package/templates/template-react-js/app/popup/index.jsx +5 -0
- package/templates/template-react-js/app/sidepanel/App.jsx +3 -0
- package/templates/template-react-js/app/sidepanel/index.jsx +5 -0
- package/templates/template-react-js/package.json +19 -0
- package/templates/template-react-js/public/icons/icon_128.png +0 -0
- package/templates/template-react-js/public/welcome.html +20 -0
- package/templates/template-react-ts/AGENTS.md +93 -0
- package/templates/template-react-ts/addfox.config.ts +27 -0
- package/templates/template-react-ts/app/background/index.ts +8 -0
- package/templates/template-react-ts/app/content/index.ts +1 -0
- package/templates/template-react-ts/app/options/App.tsx +3 -0
- package/templates/template-react-ts/app/options/index.tsx +5 -0
- package/templates/template-react-ts/app/popup/App.tsx +29 -0
- package/templates/template-react-ts/app/popup/index.tsx +5 -0
- package/templates/template-react-ts/app/sidepanel/App.tsx +3 -0
- package/templates/template-react-ts/app/sidepanel/index.tsx +5 -0
- package/templates/template-react-ts/package.json +23 -0
- package/templates/template-react-ts/public/icons/icon_128.png +0 -0
- package/templates/template-react-ts/public/welcome.html +20 -0
- package/templates/template-react-ts/tsconfig.json +19 -0
- package/templates/template-solid-js/AGENTS.md +54 -0
- package/templates/template-solid-js/addfox.config.js +28 -0
- package/templates/template-solid-js/app/background/index.js +8 -0
- package/templates/template-solid-js/app/content/index.js +1 -0
- package/templates/template-solid-js/app/options/App.jsx +3 -0
- package/templates/template-solid-js/app/options/index.jsx +5 -0
- package/templates/template-solid-js/app/popup/App.jsx +34 -0
- package/templates/template-solid-js/app/popup/index.jsx +5 -0
- package/templates/template-solid-js/app/sidepanel/App.jsx +3 -0
- package/templates/template-solid-js/app/sidepanel/index.jsx +5 -0
- package/templates/template-solid-js/package.json +19 -0
- package/templates/template-solid-js/public/icons/icon_128.png +0 -0
- package/templates/template-solid-js/public/welcome.html +20 -0
- package/templates/template-solid-ts/AGENTS.md +61 -0
- package/templates/template-solid-ts/addfox.config.ts +28 -0
- package/templates/template-solid-ts/app/background/index.ts +8 -0
- package/templates/template-solid-ts/app/content/index.ts +1 -0
- package/templates/template-solid-ts/app/options/App.tsx +3 -0
- package/templates/template-solid-ts/app/options/index.tsx +5 -0
- package/templates/template-solid-ts/app/popup/App.tsx +34 -0
- package/templates/template-solid-ts/app/popup/index.tsx +5 -0
- package/templates/template-solid-ts/app/sidepanel/App.tsx +3 -0
- package/templates/template-solid-ts/app/sidepanel/index.tsx +5 -0
- package/templates/template-solid-ts/package.json +21 -0
- package/templates/template-solid-ts/public/icons/icon_128.png +0 -0
- package/templates/template-solid-ts/public/welcome.html +20 -0
- package/templates/template-solid-ts/tsconfig.json +19 -0
- package/templates/template-svelte-js/AGENTS.md +54 -0
- package/templates/template-svelte-js/addfox.config.js +27 -0
- package/templates/template-svelte-js/app/background/index.js +8 -0
- package/templates/template-svelte-js/app/content/index.js +1 -0
- package/templates/template-svelte-js/app/options/App.svelte +4 -0
- package/templates/template-svelte-js/app/options/index.js +4 -0
- package/templates/template-svelte-js/app/popup/App.svelte +30 -0
- package/templates/template-svelte-js/app/popup/index.js +4 -0
- package/templates/template-svelte-js/app/sidepanel/App.svelte +4 -0
- package/templates/template-svelte-js/app/sidepanel/index.js +4 -0
- package/templates/template-svelte-js/package.json +18 -0
- package/templates/template-svelte-js/public/icons/icon_128.png +0 -0
- package/templates/template-svelte-js/public/welcome.html +20 -0
- package/templates/template-svelte-ts/AGENTS.md +61 -0
- package/templates/template-svelte-ts/addfox.config.ts +27 -0
- package/templates/template-svelte-ts/app/background/index.ts +8 -0
- package/templates/template-svelte-ts/app/content/index.ts +1 -0
- package/templates/template-svelte-ts/app/options/App.svelte +4 -0
- package/templates/template-svelte-ts/app/options/index.ts +4 -0
- package/templates/template-svelte-ts/app/popup/App.svelte +30 -0
- package/templates/template-svelte-ts/app/popup/index.ts +4 -0
- package/templates/template-svelte-ts/app/sidepanel/App.svelte +4 -0
- package/templates/template-svelte-ts/app/sidepanel/index.ts +4 -0
- package/templates/template-svelte-ts/package.json +20 -0
- package/templates/template-svelte-ts/public/icons/icon_128.png +0 -0
- package/templates/template-svelte-ts/public/welcome.html +20 -0
- package/templates/template-svelte-ts/tsconfig.json +19 -0
- package/templates/template-vanilla-js/AGENTS.md +52 -0
- package/templates/template-vanilla-js/addfox.config.js +25 -0
- package/templates/template-vanilla-js/app/background/index.js +8 -0
- package/templates/template-vanilla-js/app/content/index.js +1 -0
- package/templates/template-vanilla-js/app/options/index.js +2 -0
- package/templates/template-vanilla-js/app/popup/index.js +48 -0
- package/templates/template-vanilla-js/app/sidepanel/index.js +2 -0
- package/templates/template-vanilla-js/package.json +13 -0
- package/templates/template-vanilla-js/public/icons/icon_128.png +0 -0
- package/templates/template-vanilla-js/public/welcome.html +20 -0
- package/templates/template-vanilla-ts/AGENTS.md +59 -0
- package/templates/template-vanilla-ts/addfox.config.ts +25 -0
- package/templates/template-vanilla-ts/app/background/index.ts +8 -0
- package/templates/template-vanilla-ts/app/content/index.ts +1 -0
- package/templates/template-vanilla-ts/app/options/index.ts +2 -0
- package/templates/template-vanilla-ts/app/popup/index.ts +48 -0
- package/templates/template-vanilla-ts/app/sidepanel/index.ts +2 -0
- package/templates/template-vanilla-ts/package.json +14 -0
- package/templates/template-vanilla-ts/public/icons/icon_128.png +0 -0
- package/templates/template-vanilla-ts/public/welcome.html +20 -0
- package/templates/template-vanilla-ts/tsconfig.json +17 -0
- package/templates/template-vue-js/AGENTS.md +60 -0
- package/templates/template-vue-js/addfox.config.js +27 -0
- package/templates/template-vue-js/app/background/index.js +8 -0
- package/templates/template-vue-js/app/content/index.js +1 -0
- package/templates/template-vue-js/app/options/App.vue +6 -0
- package/templates/template-vue-js/app/options/index.js +5 -0
- package/templates/template-vue-js/app/popup/App.vue +34 -0
- package/templates/template-vue-js/app/popup/index.js +5 -0
- package/templates/template-vue-js/app/sidepanel/App.vue +6 -0
- package/templates/template-vue-js/app/sidepanel/index.js +5 -0
- package/templates/template-vue-js/package.json +18 -0
- package/templates/template-vue-js/public/icons/icon_128.png +0 -0
- package/templates/template-vue-js/public/welcome.html +20 -0
- package/templates/template-vue-ts/AGENTS.md +65 -0
- package/templates/template-vue-ts/addfox.config.ts +27 -0
- package/templates/template-vue-ts/app/background/index.ts +8 -0
- package/templates/template-vue-ts/app/content/index.ts +1 -0
- package/templates/template-vue-ts/app/options/App.vue +6 -0
- package/templates/template-vue-ts/app/options/index.ts +5 -0
- package/templates/template-vue-ts/app/popup/App.vue +32 -0
- package/templates/template-vue-ts/app/popup/index.ts +5 -0
- package/templates/template-vue-ts/app/sidepanel/App.vue +6 -0
- package/templates/template-vue-ts/app/sidepanel/index.ts +5 -0
- package/templates/template-vue-ts/package.json +20 -0
- package/templates/template-vue-ts/public/icons/icon_128.png +0 -0
- package/templates/template-vue-ts/public/welcome.html +20 -0
- package/templates/template-vue-ts/tsconfig.json +19 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# AI Agent Guide - Vanilla Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Vanilla TypeScript browser extension using Addfox build tool. No framework plugins needed.
|
|
8
|
+
|
|
9
|
+
## Key Configuration Fields (addfox.config.ts)
|
|
10
|
+
|
|
11
|
+
### Required Fields
|
|
12
|
+
|
|
13
|
+
- **`manifest`** - Extension manifest.json content
|
|
14
|
+
- Supports `chromium` and `firefox` variants
|
|
15
|
+
- Addfox auto-injects entry paths
|
|
16
|
+
|
|
17
|
+
### Optional Fields (use when needed)
|
|
18
|
+
|
|
19
|
+
- **`appDir`** - Source directory (default: "app")
|
|
20
|
+
- **`outDir`** - Build output directory
|
|
21
|
+
- **`entry`** - Manual entry mapping
|
|
22
|
+
- **`hotReload`** - Dev server settings
|
|
23
|
+
- **`debug`** - Enable debug logging
|
|
24
|
+
- **`zip`** - Output zip configuration
|
|
25
|
+
- **`rsbuild`** - Override Rsbuild configuration
|
|
26
|
+
- **`plugins`** - Add Rsbuild plugins if needed (no framework plugin required)
|
|
27
|
+
|
|
28
|
+
## Entry Structure
|
|
29
|
+
|
|
30
|
+
Entries auto-discovered from `appDir` subdirectories:
|
|
31
|
+
|
|
32
|
+
- `app/background/` → Service Worker (index.ts)
|
|
33
|
+
- `app/content/` → Content Script (index.ts)
|
|
34
|
+
- `app/popup/` → Popup page (index.ts + HTML)
|
|
35
|
+
- `app/options/` → Options page
|
|
36
|
+
- `app/sidepanel/` → Side panel
|
|
37
|
+
|
|
38
|
+
## Notes
|
|
39
|
+
|
|
40
|
+
### TypeScript
|
|
41
|
+
|
|
42
|
+
- Pure TypeScript without framework
|
|
43
|
+
- DOM APIs available directly
|
|
44
|
+
- No JSX transform needed
|
|
45
|
+
|
|
46
|
+
### Browser Extension APIs
|
|
47
|
+
|
|
48
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
49
|
+
- Or use `chrome.*` APIs directly
|
|
50
|
+
|
|
51
|
+
### Styling
|
|
52
|
+
|
|
53
|
+
- Plain CSS or CSS Modules
|
|
54
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
55
|
+
|
|
56
|
+
## Resources
|
|
57
|
+
|
|
58
|
+
- Addfox docs: https://addfox.dev
|
|
59
|
+
- WebExtension API: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
|
|
3
|
+
const manifest = {
|
|
4
|
+
name: "My Extension",
|
|
5
|
+
version: "1.0.0",
|
|
6
|
+
manifest_version: 3,
|
|
7
|
+
description: "Browser extension built with addfox",
|
|
8
|
+
permissions: ["activeTab"],
|
|
9
|
+
icons: {
|
|
10
|
+
"16": "icons/icon_128.png",
|
|
11
|
+
"48": "icons/icon_128.png",
|
|
12
|
+
"128": "icons/icon_128.png",
|
|
13
|
+
},
|
|
14
|
+
action: {
|
|
15
|
+
default_icon: {
|
|
16
|
+
"16": "icons/icon_128.png",
|
|
17
|
+
"48": "icons/icon_128.png",
|
|
18
|
+
"128": "icons/icon_128.png",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
25
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function openWelcomePage() {
|
|
2
|
+
chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
chrome.runtime.onInstalled.addListener((details) => {
|
|
6
|
+
if (details.reason === "install" || details.reason === "update") openWelcomePage();
|
|
7
|
+
console.log("Extension installed");
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Content script loaded");
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function applyPopupLayout(el: HTMLElement): void {
|
|
2
|
+
el.style.width = "320px";
|
|
3
|
+
el.style.minHeight = "200px";
|
|
4
|
+
el.style.padding = "16px";
|
|
5
|
+
el.style.boxSizing = "border-box";
|
|
6
|
+
el.style.display = "flex";
|
|
7
|
+
el.style.flexDirection = "column";
|
|
8
|
+
el.style.alignItems = "center";
|
|
9
|
+
el.style.justifyContent = "center";
|
|
10
|
+
el.style.gap = "12px";
|
|
11
|
+
el.style.fontFamily = 'system-ui, -apple-system, "Segoe UI", sans-serif';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function createIcon(): HTMLImageElement {
|
|
15
|
+
const img = document.createElement("img");
|
|
16
|
+
img.src = "/icons/icon_128.png";
|
|
17
|
+
img.alt = "";
|
|
18
|
+
img.width = 64;
|
|
19
|
+
img.height = 64;
|
|
20
|
+
return img;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function createTitle(): HTMLDivElement {
|
|
24
|
+
const title = document.createElement("div");
|
|
25
|
+
title.textContent = "AddFox Vanilla";
|
|
26
|
+
title.style.fontSize = "18px";
|
|
27
|
+
title.style.fontWeight = "600";
|
|
28
|
+
return title;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function createSiteLink(): HTMLAnchorElement {
|
|
32
|
+
const a = document.createElement("a");
|
|
33
|
+
a.href = "https://addfox.dev/";
|
|
34
|
+
a.target = "_blank";
|
|
35
|
+
a.rel = "noopener noreferrer";
|
|
36
|
+
a.textContent = "addfox.dev";
|
|
37
|
+
a.style.fontSize = "13px";
|
|
38
|
+
a.style.color = "#2563eb";
|
|
39
|
+
return a;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function mountPopup(root: HTMLElement): void {
|
|
43
|
+
applyPopupLayout(root);
|
|
44
|
+
root.append(createIcon(), createTitle(), createSiteLink());
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const root = document.getElementById("root");
|
|
48
|
+
if (root) mountPopup(root);
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome - Addfox + Vanilla</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #fafafa; color: #1a1a1a; }
|
|
9
|
+
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; }
|
|
10
|
+
p { font-size: 1rem; color: #666; margin: 0; }
|
|
11
|
+
.welcome-icon { width: 96px; height: 96px; margin-bottom: 1rem; object-fit: contain; border-radius: 12px; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<img class="welcome-icon" src="/icons/icon_128.png" alt="" width="96" height="96" />
|
|
16
|
+
<h1>Addfox + Vanilla</h1>
|
|
17
|
+
<p>Your extension is ready. Happy building!</p>
|
|
18
|
+
<p style="margin-top: 1rem;"><a href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a></p>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"types": []
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"app"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# AI Agent Guide - Vue Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Vue 3 browser extension using Addfox build tool. Uses `@rsbuild/plugin-vue` for SFC support.
|
|
8
|
+
|
|
9
|
+
## Key Configuration Fields (addfox.config.js)
|
|
10
|
+
|
|
11
|
+
### Required Fields
|
|
12
|
+
|
|
13
|
+
- **`manifest`** - Extension manifest.json content
|
|
14
|
+
- Supports `chromium` and `firefox` variants
|
|
15
|
+
- Addfox auto-injects entry paths
|
|
16
|
+
|
|
17
|
+
- **`plugins`** - Rsbuild plugins array
|
|
18
|
+
- Must include `pluginVue()` for Vue SFC support
|
|
19
|
+
|
|
20
|
+
### Optional Fields (use when needed)
|
|
21
|
+
|
|
22
|
+
- **`appDir`** - Source directory (default: "app")
|
|
23
|
+
- **`outDir`** - Build output directory
|
|
24
|
+
- **`entry`** - Manual entry mapping
|
|
25
|
+
- **`hotReload`** - Dev server settings
|
|
26
|
+
- **`debug`** - Enable debug logging
|
|
27
|
+
- **`zip`** - Output zip configuration
|
|
28
|
+
- **`rsbuild`** - Override Rsbuild configuration
|
|
29
|
+
|
|
30
|
+
## Entry Structure
|
|
31
|
+
|
|
32
|
+
Entries auto-discovered from `appDir` subdirectories:
|
|
33
|
+
|
|
34
|
+
- `app/background/` → Service Worker (index.js)
|
|
35
|
+
- `app/content/` → Content Script (index.js)
|
|
36
|
+
- `app/popup/` → Popup page (index.js + App.vue)
|
|
37
|
+
- `app/options/` → Options page
|
|
38
|
+
- `app/sidepanel/` → Side panel
|
|
39
|
+
|
|
40
|
+
## Framework-Specific Notes
|
|
41
|
+
|
|
42
|
+
### Vue 3
|
|
43
|
+
|
|
44
|
+
- Uses Vue 3 Composition API
|
|
45
|
+
- Single File Components (`.vue` files)
|
|
46
|
+
|
|
47
|
+
### Browser Extension APIs
|
|
48
|
+
|
|
49
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
50
|
+
|
|
51
|
+
### Styling
|
|
52
|
+
|
|
53
|
+
- Vue scoped styles supported
|
|
54
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
55
|
+
|
|
56
|
+
## Resources
|
|
57
|
+
|
|
58
|
+
- Addfox docs: https://addfox.dev
|
|
59
|
+
- Rsbuild Vue plugin: https://rsbuild.dev/plugins/list/plugin-vue
|
|
60
|
+
- Vue 3 docs: https://vuejs.org
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginVue } from "@rsbuild/plugin-vue";
|
|
3
|
+
|
|
4
|
+
const manifest = {
|
|
5
|
+
name: "My Extension",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
manifest_version: 3,
|
|
8
|
+
description: "Browser extension built with addfox",
|
|
9
|
+
permissions: ["activeTab"],
|
|
10
|
+
icons: {
|
|
11
|
+
"16": "icons/icon_128.png",
|
|
12
|
+
"48": "icons/icon_128.png",
|
|
13
|
+
"128": "icons/icon_128.png",
|
|
14
|
+
},
|
|
15
|
+
action: {
|
|
16
|
+
default_icon: {
|
|
17
|
+
"16": "icons/icon_128.png",
|
|
18
|
+
"48": "icons/icon_128.png",
|
|
19
|
+
"128": "icons/icon_128.png",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
26
|
+
plugins: [pluginVue()],
|
|
27
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function openWelcomePage() {
|
|
2
|
+
chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
chrome.runtime.onInstalled.addListener((details) => {
|
|
6
|
+
if (details.reason === "install" || details.reason === "update") openWelcomePage();
|
|
7
|
+
console.log("Extension installed");
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Content script loaded");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="popup">
|
|
3
|
+
<img src="/icons/icon_128.png" alt="" width="64" height="64" />
|
|
4
|
+
<div class="title">AddFox Vue</div>
|
|
5
|
+
<a class="site-link" href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup></script>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.popup {
|
|
13
|
+
width: 320px;
|
|
14
|
+
min-height: 200px;
|
|
15
|
+
padding: 16px;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
gap: 12px;
|
|
22
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.title {
|
|
26
|
+
font-size: 18px;
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.site-link {
|
|
31
|
+
font-size: 13px;
|
|
32
|
+
color: #2563eb;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-extension",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "addfox dev",
|
|
8
|
+
"build": "addfox build"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@addfox/utils": "0.1.1",
|
|
12
|
+
"vue": "^3.5.30"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"addfox": "0.1.1",
|
|
16
|
+
"@rsbuild/plugin-vue": "^1.2.8"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome - Addfox + Vue</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #fafafa; color: #1a1a1a; }
|
|
9
|
+
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; }
|
|
10
|
+
p { font-size: 1rem; color: #666; margin: 0; }
|
|
11
|
+
.welcome-icon { width: 96px; height: 96px; margin-bottom: 1rem; object-fit: contain; border-radius: 12px; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<img class="welcome-icon" src="/icons/icon_128.png" alt="" width="96" height="96" />
|
|
16
|
+
<h1>Addfox + Vue</h1>
|
|
17
|
+
<p>Your extension is ready. Happy building!</p>
|
|
18
|
+
<p style="margin-top: 1rem;"><a href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a></p>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# AI Agent Guide - Vue Addfox Extension
|
|
2
|
+
|
|
3
|
+
> **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Vue 3 browser extension using Addfox build tool. Uses `@rsbuild/plugin-vue` for SFC support.
|
|
8
|
+
|
|
9
|
+
## Key Configuration Fields (addfox.config.ts)
|
|
10
|
+
|
|
11
|
+
### Required Fields
|
|
12
|
+
|
|
13
|
+
- **`manifest`** - Extension manifest.json content
|
|
14
|
+
- Supports `chromium` and `firefox` variants
|
|
15
|
+
- Addfox auto-injects entry paths
|
|
16
|
+
|
|
17
|
+
- **`plugins`** - Rsbuild plugins array
|
|
18
|
+
- Must include `pluginVue()` for Vue SFC support
|
|
19
|
+
|
|
20
|
+
### Optional Fields (use when needed)
|
|
21
|
+
|
|
22
|
+
- **`appDir`** - Source directory (default: "app")
|
|
23
|
+
- **`outDir`** - Build output directory (default: ".addfox/extension")
|
|
24
|
+
- **`entry`** - Manual entry mapping (when auto-discovery fails)
|
|
25
|
+
- **`hotReload`** - Dev server settings
|
|
26
|
+
- **`debug`** - Enable debug logging
|
|
27
|
+
- **`zip`** - Output zip configuration
|
|
28
|
+
- **`rsbuild`** - Override Rsbuild configuration
|
|
29
|
+
|
|
30
|
+
## Entry Structure
|
|
31
|
+
|
|
32
|
+
Entries auto-discovered from `appDir` subdirectories:
|
|
33
|
+
|
|
34
|
+
- `app/background/` → Service Worker (index.ts)
|
|
35
|
+
- `app/content/` → Content Script (index.ts)
|
|
36
|
+
- `app/popup/` → Popup page (index.ts + App.vue)
|
|
37
|
+
- `app/options/` → Options page
|
|
38
|
+
- `app/sidepanel/` → Side panel
|
|
39
|
+
- `app/devtools/` → DevTools page
|
|
40
|
+
|
|
41
|
+
## Framework-Specific Notes
|
|
42
|
+
|
|
43
|
+
### Vue 3
|
|
44
|
+
|
|
45
|
+
- Uses Vue 3 Composition API
|
|
46
|
+
- Single File Components (`.vue` files)
|
|
47
|
+
- TypeScript support enabled
|
|
48
|
+
|
|
49
|
+
### Browser Extension APIs
|
|
50
|
+
|
|
51
|
+
- Install `webextension-polyfill` for cross-browser compatibility
|
|
52
|
+
- Use in setup scripts or component methods
|
|
53
|
+
|
|
54
|
+
### Styling
|
|
55
|
+
|
|
56
|
+
- Vue scoped styles supported
|
|
57
|
+
- CSS Modules available
|
|
58
|
+
- Content scripts: use `@addfox/utils` with Shadow DOM
|
|
59
|
+
|
|
60
|
+
## Resources
|
|
61
|
+
|
|
62
|
+
- Addfox docs: https://addfox.dev
|
|
63
|
+
- Rsbuild Vue plugin: https://rsbuild.dev/plugins/list/plugin-vue
|
|
64
|
+
- Vue 3 docs: https://vuejs.org
|
|
65
|
+
- WebExtension API: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from "addfox";
|
|
2
|
+
import { pluginVue } from "@rsbuild/plugin-vue";
|
|
3
|
+
|
|
4
|
+
const manifest = {
|
|
5
|
+
name: "My Extension",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
manifest_version: 3,
|
|
8
|
+
description: "Browser extension built with addfox",
|
|
9
|
+
permissions: ["activeTab"],
|
|
10
|
+
icons: {
|
|
11
|
+
"16": "icons/icon_128.png",
|
|
12
|
+
"48": "icons/icon_128.png",
|
|
13
|
+
"128": "icons/icon_128.png",
|
|
14
|
+
},
|
|
15
|
+
action: {
|
|
16
|
+
default_icon: {
|
|
17
|
+
"16": "icons/icon_128.png",
|
|
18
|
+
"48": "icons/icon_128.png",
|
|
19
|
+
"128": "icons/icon_128.png",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
manifest: { chromium: manifest, firefox: { ...manifest } },
|
|
26
|
+
plugins: [pluginVue()],
|
|
27
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function openWelcomePage() {
|
|
2
|
+
chrome.tabs.create({ url: chrome.runtime.getURL("welcome.html") });
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
chrome.runtime.onInstalled.addListener((details) => {
|
|
6
|
+
if (details.reason === "install" || details.reason === "update") openWelcomePage();
|
|
7
|
+
console.log("Extension installed");
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("Content script loaded");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="popup">
|
|
3
|
+
<img src="/icons/icon_128.png" alt="" width="64" height="64" />
|
|
4
|
+
<div class="title">AddFox Vue</div>
|
|
5
|
+
<a class="site-link" href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<style scoped>
|
|
10
|
+
.popup {
|
|
11
|
+
width: 320px;
|
|
12
|
+
min-height: 200px;
|
|
13
|
+
padding: 16px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
gap: 12px;
|
|
20
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.title {
|
|
24
|
+
font-size: 18px;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.site-link {
|
|
29
|
+
font-size: 13px;
|
|
30
|
+
color: #2563eb;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-extension",
|
|
3
|
+
"version": "1.0.1-beta.2",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "addfox dev",
|
|
8
|
+
"build": "addfox build"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@addfox/utils": "0.1.1",
|
|
12
|
+
"vue": "^3.5.30"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"addfox": "0.1.1",
|
|
16
|
+
"@rsbuild/plugin-vue": "^1.2.8",
|
|
17
|
+
"typescript": "^5.9.3",
|
|
18
|
+
"@types/chrome": "^0.1.38"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Welcome - Addfox + Vue</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #fafafa; color: #1a1a1a; }
|
|
9
|
+
h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; }
|
|
10
|
+
p { font-size: 1rem; color: #666; margin: 0; }
|
|
11
|
+
.welcome-icon { width: 96px; height: 96px; margin-bottom: 1rem; object-fit: contain; border-radius: 12px; }
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<img class="welcome-icon" src="/icons/icon_128.png" alt="" width="96" height="96" />
|
|
16
|
+
<h1>Addfox + Vue</h1>
|
|
17
|
+
<p>Your extension is ready. Happy building!</p>
|
|
18
|
+
<p style="margin-top: 1rem;"><a href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a></p>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|