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.
Files changed (160) hide show
  1. package/README.md +18 -18
  2. package/dist/cli.js +259 -102
  3. package/package.json +9 -8
  4. package/templates/README.md +3 -0
  5. package/templates/template-preact-js/AGENTS.md +54 -0
  6. package/templates/template-preact-js/addfox.config.js +27 -0
  7. package/templates/template-preact-js/app/background/index.js +8 -0
  8. package/templates/template-preact-js/app/content/index.js +1 -0
  9. package/templates/template-preact-js/app/options/App.jsx +5 -0
  10. package/templates/template-preact-js/app/options/index.jsx +5 -0
  11. package/templates/template-preact-js/app/popup/App.jsx +31 -0
  12. package/templates/template-preact-js/app/popup/index.jsx +5 -0
  13. package/templates/template-preact-js/app/sidepanel/App.jsx +5 -0
  14. package/templates/template-preact-js/app/sidepanel/index.jsx +5 -0
  15. package/templates/template-preact-js/package.json +18 -0
  16. package/templates/template-preact-js/public/icons/icon_128.png +0 -0
  17. package/templates/template-preact-js/public/welcome.html +20 -0
  18. package/templates/template-preact-ts/AGENTS.md +61 -0
  19. package/templates/template-preact-ts/addfox.config.ts +27 -0
  20. package/templates/template-preact-ts/app/background/index.ts +8 -0
  21. package/templates/template-preact-ts/app/content/index.ts +1 -0
  22. package/templates/template-preact-ts/app/options/App.tsx +5 -0
  23. package/templates/template-preact-ts/app/options/index.tsx +5 -0
  24. package/templates/template-preact-ts/app/popup/App.tsx +31 -0
  25. package/templates/template-preact-ts/app/popup/index.tsx +5 -0
  26. package/templates/template-preact-ts/app/sidepanel/App.tsx +5 -0
  27. package/templates/template-preact-ts/app/sidepanel/index.tsx +5 -0
  28. package/templates/template-preact-ts/package.json +20 -0
  29. package/templates/template-preact-ts/public/icons/icon_128.png +0 -0
  30. package/templates/template-preact-ts/public/welcome.html +20 -0
  31. package/templates/template-preact-ts/tsconfig.json +19 -0
  32. package/templates/template-react-js/AGENTS.md +66 -0
  33. package/templates/template-react-js/addfox.config.js +27 -0
  34. package/templates/template-react-js/app/background/index.js +8 -0
  35. package/templates/template-react-js/app/content/index.js +1 -0
  36. package/templates/template-react-js/app/options/App.jsx +3 -0
  37. package/templates/template-react-js/app/options/index.jsx +5 -0
  38. package/templates/template-react-js/app/popup/App.jsx +29 -0
  39. package/templates/template-react-js/app/popup/index.jsx +5 -0
  40. package/templates/template-react-js/app/sidepanel/App.jsx +3 -0
  41. package/templates/template-react-js/app/sidepanel/index.jsx +5 -0
  42. package/templates/template-react-js/package.json +19 -0
  43. package/templates/template-react-js/public/icons/icon_128.png +0 -0
  44. package/templates/template-react-js/public/welcome.html +20 -0
  45. package/templates/template-react-ts/AGENTS.md +93 -0
  46. package/templates/template-react-ts/addfox.config.ts +27 -0
  47. package/templates/template-react-ts/app/background/index.ts +8 -0
  48. package/templates/template-react-ts/app/content/index.ts +1 -0
  49. package/templates/template-react-ts/app/options/App.tsx +3 -0
  50. package/templates/template-react-ts/app/options/index.tsx +5 -0
  51. package/templates/template-react-ts/app/popup/App.tsx +29 -0
  52. package/templates/template-react-ts/app/popup/index.tsx +5 -0
  53. package/templates/template-react-ts/app/sidepanel/App.tsx +3 -0
  54. package/templates/template-react-ts/app/sidepanel/index.tsx +5 -0
  55. package/templates/template-react-ts/package.json +23 -0
  56. package/templates/template-react-ts/public/icons/icon_128.png +0 -0
  57. package/templates/template-react-ts/public/welcome.html +20 -0
  58. package/templates/template-react-ts/tsconfig.json +19 -0
  59. package/templates/template-solid-js/AGENTS.md +54 -0
  60. package/templates/template-solid-js/addfox.config.js +28 -0
  61. package/templates/template-solid-js/app/background/index.js +8 -0
  62. package/templates/template-solid-js/app/content/index.js +1 -0
  63. package/templates/template-solid-js/app/options/App.jsx +3 -0
  64. package/templates/template-solid-js/app/options/index.jsx +5 -0
  65. package/templates/template-solid-js/app/popup/App.jsx +34 -0
  66. package/templates/template-solid-js/app/popup/index.jsx +5 -0
  67. package/templates/template-solid-js/app/sidepanel/App.jsx +3 -0
  68. package/templates/template-solid-js/app/sidepanel/index.jsx +5 -0
  69. package/templates/template-solid-js/package.json +19 -0
  70. package/templates/template-solid-js/public/icons/icon_128.png +0 -0
  71. package/templates/template-solid-js/public/welcome.html +20 -0
  72. package/templates/template-solid-ts/AGENTS.md +61 -0
  73. package/templates/template-solid-ts/addfox.config.ts +28 -0
  74. package/templates/template-solid-ts/app/background/index.ts +8 -0
  75. package/templates/template-solid-ts/app/content/index.ts +1 -0
  76. package/templates/template-solid-ts/app/options/App.tsx +3 -0
  77. package/templates/template-solid-ts/app/options/index.tsx +5 -0
  78. package/templates/template-solid-ts/app/popup/App.tsx +34 -0
  79. package/templates/template-solid-ts/app/popup/index.tsx +5 -0
  80. package/templates/template-solid-ts/app/sidepanel/App.tsx +3 -0
  81. package/templates/template-solid-ts/app/sidepanel/index.tsx +5 -0
  82. package/templates/template-solid-ts/package.json +21 -0
  83. package/templates/template-solid-ts/public/icons/icon_128.png +0 -0
  84. package/templates/template-solid-ts/public/welcome.html +20 -0
  85. package/templates/template-solid-ts/tsconfig.json +19 -0
  86. package/templates/template-svelte-js/AGENTS.md +54 -0
  87. package/templates/template-svelte-js/addfox.config.js +27 -0
  88. package/templates/template-svelte-js/app/background/index.js +8 -0
  89. package/templates/template-svelte-js/app/content/index.js +1 -0
  90. package/templates/template-svelte-js/app/options/App.svelte +4 -0
  91. package/templates/template-svelte-js/app/options/index.js +4 -0
  92. package/templates/template-svelte-js/app/popup/App.svelte +30 -0
  93. package/templates/template-svelte-js/app/popup/index.js +4 -0
  94. package/templates/template-svelte-js/app/sidepanel/App.svelte +4 -0
  95. package/templates/template-svelte-js/app/sidepanel/index.js +4 -0
  96. package/templates/template-svelte-js/package.json +18 -0
  97. package/templates/template-svelte-js/public/icons/icon_128.png +0 -0
  98. package/templates/template-svelte-js/public/welcome.html +20 -0
  99. package/templates/template-svelte-ts/AGENTS.md +61 -0
  100. package/templates/template-svelte-ts/addfox.config.ts +27 -0
  101. package/templates/template-svelte-ts/app/background/index.ts +8 -0
  102. package/templates/template-svelte-ts/app/content/index.ts +1 -0
  103. package/templates/template-svelte-ts/app/options/App.svelte +4 -0
  104. package/templates/template-svelte-ts/app/options/index.ts +4 -0
  105. package/templates/template-svelte-ts/app/popup/App.svelte +30 -0
  106. package/templates/template-svelte-ts/app/popup/index.ts +4 -0
  107. package/templates/template-svelte-ts/app/sidepanel/App.svelte +4 -0
  108. package/templates/template-svelte-ts/app/sidepanel/index.ts +4 -0
  109. package/templates/template-svelte-ts/package.json +20 -0
  110. package/templates/template-svelte-ts/public/icons/icon_128.png +0 -0
  111. package/templates/template-svelte-ts/public/welcome.html +20 -0
  112. package/templates/template-svelte-ts/tsconfig.json +19 -0
  113. package/templates/template-vanilla-js/AGENTS.md +52 -0
  114. package/templates/template-vanilla-js/addfox.config.js +25 -0
  115. package/templates/template-vanilla-js/app/background/index.js +8 -0
  116. package/templates/template-vanilla-js/app/content/index.js +1 -0
  117. package/templates/template-vanilla-js/app/options/index.js +2 -0
  118. package/templates/template-vanilla-js/app/popup/index.js +48 -0
  119. package/templates/template-vanilla-js/app/sidepanel/index.js +2 -0
  120. package/templates/template-vanilla-js/package.json +13 -0
  121. package/templates/template-vanilla-js/public/icons/icon_128.png +0 -0
  122. package/templates/template-vanilla-js/public/welcome.html +20 -0
  123. package/templates/template-vanilla-ts/AGENTS.md +59 -0
  124. package/templates/template-vanilla-ts/addfox.config.ts +25 -0
  125. package/templates/template-vanilla-ts/app/background/index.ts +8 -0
  126. package/templates/template-vanilla-ts/app/content/index.ts +1 -0
  127. package/templates/template-vanilla-ts/app/options/index.ts +2 -0
  128. package/templates/template-vanilla-ts/app/popup/index.ts +48 -0
  129. package/templates/template-vanilla-ts/app/sidepanel/index.ts +2 -0
  130. package/templates/template-vanilla-ts/package.json +14 -0
  131. package/templates/template-vanilla-ts/public/icons/icon_128.png +0 -0
  132. package/templates/template-vanilla-ts/public/welcome.html +20 -0
  133. package/templates/template-vanilla-ts/tsconfig.json +17 -0
  134. package/templates/template-vue-js/AGENTS.md +60 -0
  135. package/templates/template-vue-js/addfox.config.js +27 -0
  136. package/templates/template-vue-js/app/background/index.js +8 -0
  137. package/templates/template-vue-js/app/content/index.js +1 -0
  138. package/templates/template-vue-js/app/options/App.vue +6 -0
  139. package/templates/template-vue-js/app/options/index.js +5 -0
  140. package/templates/template-vue-js/app/popup/App.vue +34 -0
  141. package/templates/template-vue-js/app/popup/index.js +5 -0
  142. package/templates/template-vue-js/app/sidepanel/App.vue +6 -0
  143. package/templates/template-vue-js/app/sidepanel/index.js +5 -0
  144. package/templates/template-vue-js/package.json +18 -0
  145. package/templates/template-vue-js/public/icons/icon_128.png +0 -0
  146. package/templates/template-vue-js/public/welcome.html +20 -0
  147. package/templates/template-vue-ts/AGENTS.md +65 -0
  148. package/templates/template-vue-ts/addfox.config.ts +27 -0
  149. package/templates/template-vue-ts/app/background/index.ts +8 -0
  150. package/templates/template-vue-ts/app/content/index.ts +1 -0
  151. package/templates/template-vue-ts/app/options/App.vue +6 -0
  152. package/templates/template-vue-ts/app/options/index.ts +5 -0
  153. package/templates/template-vue-ts/app/popup/App.vue +32 -0
  154. package/templates/template-vue-ts/app/popup/index.ts +5 -0
  155. package/templates/template-vue-ts/app/sidepanel/App.vue +6 -0
  156. package/templates/template-vue-ts/app/sidepanel/index.ts +5 -0
  157. package/templates/template-vue-ts/package.json +20 -0
  158. package/templates/template-vue-ts/public/icons/icon_128.png +0 -0
  159. package/templates/template-vue-ts/public/welcome.html +20 -0
  160. package/templates/template-vue-ts/tsconfig.json +19 -0
@@ -0,0 +1,54 @@
1
+ # AI Agent Guide - Svelte Addfox Extension
2
+
3
+ > **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
4
+
5
+ ## Project Overview
6
+
7
+ Svelte browser extension using Addfox build tool. Uses `@rsbuild/plugin-svelte` for Svelte 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 `pluginSvelte()` for Svelte 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. Each needs `index.js` as entry.
33
+
34
+ ## Framework-Specific Notes
35
+
36
+ ### Svelte
37
+
38
+ - Single File Components (`.svelte` files)
39
+ - Reactive statements with `$:`
40
+
41
+ ### Browser Extension APIs
42
+
43
+ - Install `webextension-polyfill` for cross-browser compatibility
44
+
45
+ ### Styling
46
+
47
+ - Svelte scoped styles by default
48
+ - Content scripts: use `@addfox/utils` with Shadow DOM
49
+
50
+ ## Resources
51
+
52
+ - Addfox docs: https://addfox.dev
53
+ - Rsbuild Svelte plugin: https://rsbuild.dev/plugins/list/plugin-svelte
54
+ - Svelte docs: https://svelte.dev
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from "addfox";
2
+ import { pluginSvelte } from "@rsbuild/plugin-svelte";
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: [pluginSvelte()],
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,4 @@
1
+ <script>
2
+ </script>
3
+
4
+ <div>Hello from Svelte</div>
@@ -0,0 +1,4 @@
1
+ import App from "./App.svelte";
2
+
3
+ const target = document.getElementById("root");
4
+ if (target) new App({ target });
@@ -0,0 +1,30 @@
1
+ <div class="popup">
2
+ <img src="/icons/icon_128.png" alt="" width="64" height="64" />
3
+ <div class="title">AddFox Svelte</div>
4
+ <a class="site-link" href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a>
5
+ </div>
6
+
7
+ <style>
8
+ .popup {
9
+ width: 320px;
10
+ min-height: 200px;
11
+ padding: 16px;
12
+ box-sizing: border-box;
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ justify-content: center;
17
+ gap: 12px;
18
+ font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
19
+ }
20
+
21
+ .title {
22
+ font-size: 18px;
23
+ font-weight: 600;
24
+ }
25
+
26
+ .site-link {
27
+ font-size: 13px;
28
+ color: #2563eb;
29
+ }
30
+ </style>
@@ -0,0 +1,4 @@
1
+ import App from "./App.svelte";
2
+
3
+ const target = document.getElementById("root");
4
+ if (target) new App({ target });
@@ -0,0 +1,4 @@
1
+ <script>
2
+ </script>
3
+
4
+ <div>Hello from Svelte</div>
@@ -0,0 +1,4 @@
1
+ import App from "./App.svelte";
2
+
3
+ const target = document.getElementById("root");
4
+ if (target) new App({ target });
@@ -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
+ "svelte": "^5.54.1"
13
+ },
14
+ "devDependencies": {
15
+ "addfox": "0.1.1",
16
+ "@rsbuild/plugin-svelte": "1.1.1"
17
+ }
18
+ }
@@ -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 + Svelte</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 + Svelte</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,61 @@
1
+ # AI Agent Guide - Svelte Addfox Extension
2
+
3
+ > **Priority**: Follow `.agents/skills/` first, then this guide, then [official docs](https://addfox.dev)
4
+
5
+ ## Project Overview
6
+
7
+ Svelte browser extension using Addfox build tool. Uses `@rsbuild/plugin-svelte` for Svelte 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 `pluginSvelte()` for Svelte 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.ts)
35
+ - `app/content/` → Content Script (index.ts)
36
+ - `app/popup/` → Popup page (index.ts + App.svelte)
37
+ - `app/options/` → Options page
38
+ - `app/sidepanel/` → Side panel
39
+
40
+ ## Framework-Specific Notes
41
+
42
+ ### Svelte
43
+
44
+ - Single File Components (`.svelte` files)
45
+ - TypeScript support in `<script lang="ts">`
46
+ - Reactive statements with `$:`
47
+
48
+ ### Browser Extension APIs
49
+
50
+ - Install `webextension-polyfill` for cross-browser compatibility
51
+
52
+ ### Styling
53
+
54
+ - Svelte scoped styles by default
55
+ - Content scripts: use `@addfox/utils` with Shadow DOM
56
+
57
+ ## Resources
58
+
59
+ - Addfox docs: https://addfox.dev
60
+ - Rsbuild Svelte plugin: https://rsbuild.dev/plugins/list/plugin-svelte
61
+ - Svelte docs: https://svelte.dev
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from "addfox";
2
+ import { pluginSvelte } from "@rsbuild/plugin-svelte";
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: [pluginSvelte()],
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,4 @@
1
+ <script>
2
+ </script>
3
+
4
+ <div>Hello from Svelte</div>
@@ -0,0 +1,4 @@
1
+ import App from "./App.svelte";
2
+
3
+ const target = document.getElementById("root");
4
+ if (target) new App({ target });
@@ -0,0 +1,30 @@
1
+ <div class="popup">
2
+ <img src="/icons/icon_128.png" alt="" width="64" height="64" />
3
+ <div class="title">AddFox Svelte</div>
4
+ <a class="site-link" href="https://addfox.dev/" target="_blank" rel="noopener noreferrer">addfox.dev</a>
5
+ </div>
6
+
7
+ <style>
8
+ .popup {
9
+ width: 320px;
10
+ min-height: 200px;
11
+ padding: 16px;
12
+ box-sizing: border-box;
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ justify-content: center;
17
+ gap: 12px;
18
+ font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
19
+ }
20
+
21
+ .title {
22
+ font-size: 18px;
23
+ font-weight: 600;
24
+ }
25
+
26
+ .site-link {
27
+ font-size: 13px;
28
+ color: #2563eb;
29
+ }
30
+ </style>
@@ -0,0 +1,4 @@
1
+ import App from "./App.svelte";
2
+
3
+ const target = document.getElementById("root");
4
+ if (target) new App({ target });
@@ -0,0 +1,4 @@
1
+ <script>
2
+ </script>
3
+
4
+ <div>Hello from Svelte</div>
@@ -0,0 +1,4 @@
1
+ import App from "./App.svelte";
2
+
3
+ const target = document.getElementById("root");
4
+ if (target) new App({ target });
@@ -0,0 +1,20 @@
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
+ "svelte": "^5.54.1"
13
+ },
14
+ "devDependencies": {
15
+ "addfox": "0.1.1",
16
+ "@rsbuild/plugin-svelte": "1.1.1",
17
+ "typescript": "^5.9.3",
18
+ "@types/chrome": "^0.1.38"
19
+ }
20
+ }
@@ -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 + Svelte</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 + Svelte</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,19 @@
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
+ "chrome"
14
+ ]
15
+ },
16
+ "include": [
17
+ "app"
18
+ ]
19
+ }
@@ -0,0 +1,52 @@
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 JavaScript browser extension using Addfox build tool. No framework plugins needed.
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
+ ### 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
27
+
28
+ ## Entry Structure
29
+
30
+ Entries auto-discovered from `appDir` subdirectories. Each needs `index.js` as entry.
31
+
32
+ ## Notes
33
+
34
+ ### JavaScript
35
+
36
+ - Pure JavaScript without framework
37
+ - DOM APIs available directly
38
+
39
+ ### Browser Extension APIs
40
+
41
+ - Install `webextension-polyfill` for cross-browser compatibility
42
+ - Or use `chrome.*` APIs directly
43
+
44
+ ### Styling
45
+
46
+ - Plain CSS
47
+ - Content scripts: use `@addfox/utils` with Shadow DOM
48
+
49
+ ## Resources
50
+
51
+ - Addfox docs: https://addfox.dev
52
+ - 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,2 @@
1
+ const root = document.getElementById("root");
2
+ if (root) root.textContent = "Options";
@@ -0,0 +1,48 @@
1
+ function applyPopupLayout(el) {
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() {
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() {
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() {
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) {
43
+ applyPopupLayout(root);
44
+ root.append(createIcon(), createTitle(), createSiteLink());
45
+ }
46
+
47
+ const root = document.getElementById("root");
48
+ if (root) mountPopup(root);
@@ -0,0 +1,2 @@
1
+ const root = document.getElementById("root");
2
+ if (root) root.textContent = "Side panel";
@@ -0,0 +1,13 @@
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
+ "devDependencies": {
11
+ "addfox": "0.1.1"
12
+ }
13
+ }
@@ -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>