Skip to content

Commit cc67d69

Browse files
committed
Update feature to AGENTS.md
1 parent ee2dbee commit cc67d69

File tree

4 files changed

+56
-3
lines changed

4 files changed

+56
-3
lines changed

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Develop a Chrome extension that helps users stay mindful and aware whenever they
1818
- This input will help determine which websites are considered “safe” vs. “distracting.”
1919
- If no input is given, the extension remains in **inactive** mode (does nothing).
2020

21+
## Self-learning
22+
- The extension should Learn from user behavior and adjust its behavior accordingly by times.
23+
- The extension should Learn form user inputs and adjust its behavior accordingly by times.
24+
- The learned data should be stored locally in the browser as a JSON file.
25+
- The extension should be able to update the data it learned by times.
26+
2127
## 🧠 Distraction Detection via AI
2228

2329
- Use OpenAI API to analyze browser activity and detect distractions.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build",
8+
"build": "vite build && node scripts/post-build.js",
99
"test": "vitest run"
1010
},
1111
"keywords": [],

scripts/post-build.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
// Define source and destination paths
5+
const srcDir = path.resolve(__dirname, '../src');
6+
const distDir = path.resolve(__dirname, '../dist');
7+
8+
// Files to copy
9+
const filesToCopy = [
10+
'manifest.json',
11+
'background.js'
12+
];
13+
14+
// Create dist directory if it doesn't exist
15+
if (!fs.existsSync(distDir)) {
16+
fs.mkdirSync(distDir, { recursive: true });
17+
}
18+
19+
// Copy each file
20+
filesToCopy.forEach(file => {
21+
const srcPath = path.join(srcDir, file);
22+
const destPath = path.join(distDir, file);
23+
24+
if (fs.existsSync(srcPath)) {
25+
fs.copyFileSync(srcPath, destPath);
26+
console.log(`Copied ${file} to dist directory`);
27+
} else {
28+
console.error(`Source file not found: ${srcPath}`);
29+
}
30+
});
31+
32+
console.log('Post-build process completed successfully');

vite.config.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
33
import { resolve } from 'path';
4+
import fs from 'fs';
5+
import path from 'path';
46

57
export default defineConfig({
68
root: 'src',
@@ -10,9 +12,22 @@ export default defineConfig({
1012
rollupOptions: {
1113
input: {
1214
popup: resolve(__dirname, 'src/popup.html'),
13-
options: resolve(__dirname, 'src/options.html')
15+
options: resolve(__dirname, 'src/options.html'),
16+
background: resolve(__dirname, 'src/background.js')
1417
}
1518
}
1619
},
17-
plugins: [react()]
20+
plugins: [
21+
react(),
22+
{
23+
name: 'copy-manifest',
24+
buildEnd() {
25+
// Copy manifest.json to dist directory
26+
const srcManifestPath = path.resolve(__dirname, 'src/manifest.json');
27+
const destManifestPath = path.resolve(__dirname, 'dist/manifest.json');
28+
fs.copyFileSync(srcManifestPath, destManifestPath);
29+
console.log('Copied manifest.json to dist directory');
30+
}
31+
}
32+
]
1833
});

0 commit comments

Comments
 (0)