Files
nostr-connect/AGENTS.md
T
2026-10-21 15:29:03 +07:00

41 lines
1.9 KiB
Markdown

# AGENTS.md
## Build Commands
```bash
npm run dev # Development: runs build.js + tailwindcss --watch
npm run build # Production build → extension/output
npm run package:chrome # Creates extension/releases/nostrconnect_chrome.zip
npm run package:firefox # Creates extension/releases/nostrconnect_firefox.xpi
npm run lint # Run Biome linter
npm run format # Format with Biome (auto-fix)
npm run test # Run tests with Vitest
npm run test:watch # Run tests in watch mode
```
## Key Facts
- **Package manager**: npm. Peer dependency conflicts are tolerated via `legacy-peer-deps=true` in `.npmrc`
- **Build output**: `extension/output/` (not `dist/`)
- **Ignore `extension/output/`**: It contains generated JS/HTML/CSS and is gitignored
- **Tailwind source**: `extension/style.css` → `extension/output/style.css`
## Architecture
| File | Purpose |
| ---------------------------------------- | --------------------------------------------------------- |
| `background.js` | Core logic: state, permissions, crypto (signEvent, nip04) |
| `nostr-provider.js` | Injected into web pages, provides `window.nostr` |
| `content-script.js` | Bridges provider ↔ background via postMessage |
| `popup.jsx`, `prompt.jsx`, `options.jsx` | React UI components |
| `extension/chrome/manifest.json` | Chrome Manifest V3 config |
| `extension/firefox/manifest.json` | Firefox Manifest V2 config |
The build script (`build.js`) auto-selects the correct manifest based on `prod`/`firefox` args.
## Code Style
- No semicolons
- Single quotes
- Biome (configured in `biome.json`)