Skip to content

Commit ee2dbee

Browse files
authored
Merge pull request #2 from qitpydev/codex/initialize-project-step-by-step
Remove icons and update manifest
2 parents db65fd2 + 8c34753 commit ee2dbee

File tree

16 files changed

+2353
-4
lines changed

16 files changed

+2353
-4
lines changed

.github/workflows/node.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Node.js CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Use Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '20'
19+
- run: npm install
20+
- run: npm test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
dist/

README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
# Disturb-AI Chrome Extension
22

3-
Disturb-AI is a proposed browser extension that helps you stay mindful of distractions while working online. It prompts you to state your focus goal, detects distracting browsing behavior using the OpenAI API, and alerts you when your focus strays for too long. The extension is meant to be subtle and customizable, letting you set thresholds, alert style, and site whitelist.
3+
Disturb-AI helps you stay mindful of distractions while working online. It lets you set a focus goal, detects distracting browsing behavior and alerts you when your focus strays too long.
44

55
## Development Setup
66

77
1. Clone this repository.
8-
2. Install dependencies and load the extension in Chrome's developer mode.
9-
3. Provide your OpenAI API key in the settings page to enable distraction detection.
8+
2. Run `npm install` to install dependencies.
9+
3. During development, use `npm run dev` and load the `src` folder as an unpacked extension.
10+
4. For production, run `npm run build` to generate the extension in the `dist/` folder.
11+
5. Load the `dist` folder as an unpacked extension in Chrome.
12+
6. Provide your OpenAI API key on the settings page to enable distraction detection.
13+
7. Saved options and focus goals are automatically loaded the next time you open the popup or options page.
14+
8. Optionally add your own extension icons under `src/icons` and reference them in `manifest.json`.
1015

11-
For details on planned features, see the [idea document](prompts.md).
16+
The source under `src/` contains a minimal working skeleton. Edit the scripts to add advanced distraction detection logic.
17+
18+
### Bootstrapping From Scratch
19+
20+
If you'd like to recreate this extension completely from scratch, follow these basic steps. They mirror how this repository was initialized.
21+
22+
1. Initialise a new Node project:
23+
```sh
24+
npm init -y
25+
```
26+
2. Install React, Vite and the React plugin for Vite:
27+
```sh
28+
npm install -D vite @vitejs/plugin-react react react-dom
29+
```
30+
3. Create a `src/` directory and within it add `popup.html` and `options.html`.
31+
4. Create React entry points (e.g. `popup-main.jsx` and `options-main.jsx`) that mount your React components.
32+
5. Write a minimal `manifest.json` referencing your HTML files and a background service worker script.
33+
6. Add a `vite.config.js` (see this repo for reference) so that `npm run dev` and `npm run build` work correctly.
34+
7. Update `package.json` scripts to include `dev`, `build` and optionally `test` commands.
35+
36+
## CI
37+
38+
A simple GitHub Actions workflow installs dependencies and runs `npm test` on pull requests.
1239

1340
## License
1441

0 commit comments

Comments
 (0)