Imported from chrismdemian/termwatch (
AGENTS.md). Install upstream withnpx skills add chrismdemian/termwatch. Copyright stays with the author.
TermWatch — Claude Code Instructions
Global standards (completion checklist, working standards, frontend toolkit, git rules) are in ~/CLAUDE.md. This file contains TermWatch-specific instructions only.
Project Overview
Electron desktop app: transparent terminal panels over a web browser video view. Two WebContentsViews stacked — video (bottom, isolated) and app UI (top, transparent with nodeIntegration).
Architecture
- Main process:
src/main/— index.js (window setup), ipc-handlers.js (all IPC), pty-manager.js (shell spawning), updater.js (auto-updates), store.js (electron-store), logger.js (electron-log) - Preload:
src/preload/— app-preload.js (terminal/video/window/store APIs), video-preload.js (video detection, frame tracking) - Renderer:
src/renderer/— app.html + js/ (terminal-manager, layout-manager, settings, controls, bookmarks, hotkeys, titlebar) + css/ - Tests:
test/— main/ (unit), renderer/ (unit, happy-dom), integration/ (mocked IPC), e2e/ (Playwright) - Build: electron-builder.yml, build/ (icons, entitlements, VMP signing)
- CI:
.github/workflows/ci.yml(PR checks),release.yml(tagged builds) - Scripts:
scripts/— generate-licenses.js, generate-icons.js, bump-version.js
Key Technical Constraints
@lydell/node-pty(not standard node-pty) — prebuilt binaries, no native compilation- App view uses nodeIntegration=true because xterm.js constructors can't pass through contextBridge
- Video view uses contextIsolation=true, partition='persist:video'
- Frameless transparent window — fullscreen is simulated manually (BaseWindow.setFullScreen fails)
- CastLabs Electron fork for Widevine DRM
- User agent strips "Electron/" to avoid bot detection
Workflow
Making Changes
- Create a worktree or feature branch — never commit directly to master
- Make changes
- Run
npm run lint(0 errors required) andnpm test(all tests must pass) - For UI changes, verify with
npm start - Push to feature branch, merge to master, delete the remote branch
Commit Messages
- Write like a normal open-source project. Never reference phases, sessions, sprints, or planning milestones.
- Start with a verb: Add, Fix, Update, Remove, Refactor
- Keep subject under 72 chars
Releases
npm run version:bump -- patch(or minor/major)- Commit:
git add package.json package-lock.json && git commit -m "Bump version to X.Y.Z" - Tag:
git tag vX.Y.Z - Push:
git push origin master --tags - GitHub Actions builds Windows (.exe) and macOS (.dmg) installers automatically
Bug Fixes
- Reproduce or understand the issue
- Write a failing test if possible
- Fix it
- Verify lint + tests pass
- Commit with
Fix <description>
Available Scripts
| Script | Purpose |
|---|---|
npm start |
Run the app |
npm test |
Unit + integration tests (Vitest) |
npm run test:e2e |
E2E tests (Playwright, needs real Electron) |
npm run lint |
ESLint with security plugins |
npm run build:win |
Build Windows installer |
npm run build:mac |
Build macOS installer |
npm run licenses |
Regenerate THIRD-PARTY-LICENSES.txt |
npm run icons |
Regenerate app icons from build/icon.png |
npm run version:bump |
Bump version (patch/minor/major) |
Testing
- Unit/integration tests mock Electron via
test/setup-electron-mock.js(patches Module._load) - Tests run on any OS — no native modules needed
- E2E tests need real Electron + native modules (not in CI)
- Mock electron modules: electron, electron-store, electron-log, electron-updater