Skip to content

Development Guide

GlomarGadaffi edited this page Jun 4, 2026 · 1 revision

Development Guide

Prerequisites

  • Node.js 18+
  • npm 9+
  • Chrome or Edge for testing (Web Serial API required)
  • A BCD325P2 scanner for hardware testing (optional — UI changes can be developed without hardware)

Setup

git clone https://github.com/GlomarGadaffi/BearSentinel.git
cd BearSentinel
npm install

Development Server

npm run dev

The dev server starts with HTTPS enabled (configured in vite.config.ts). You will need a local TLS certificate and key; paths are configured in vite.config.ts. If you do not have certificates, you can temporarily disable HTTPS — Chrome's localhost exemption for the Web Serial API typically covers plain HTTP on localhost.

Why HTTPS? The Web Serial API is a "powerful feature" that browsers require to run in a secure context.

Building

npm run build

Vite compiles TypeScript, bundles React, and runs vite-plugin-singlefile to inline all CSS, JavaScript, and assets into a single .html file in the dist/ directory.

Linting

npm run lint

Key Architectural Constraints

  1. No external network requests — the application must remain fully offline. Do not add fetch() calls, CDN script tags, or any external resource references.
  2. No server dependency — the built output must open as a plain file (file:// protocol).
  3. State flows through SentinelStore — components must not maintain their own copies of scanner data.
  4. Serial access is a singleton — use the exported Serial singleton from SerialMonitor.ts. Do not instantiate SerialMonitor directly in components.
  5. TypeScript strict mode — all new code must compile without errors.

Adding a New Agency to AgencyDB

  1. Open src/core/AgencyDB.ts
  2. Add an entry to the DB object under the appropriate category (INT, FHP, FWC, FDLE, LOC, or TEC)
  3. Key is the frequency/talkgroup code string; value is { a: 'ABBR', n: 'Full Agency Name' }
  4. If adding a new category, also add it to agClass() and agColor()

Common Debugging Scenarios

Grant Feed is empty but scanner is on a trunked system

  • Confirm "Extended Control Channel Output" is enabled on the BCD325P2
  • Open the Raw Log Drawer — if also empty, the serial connection is not passing data
  • Confirm you selected the correct port in the browser permission dialog

LCN Map is not building

  • The LCN map populates from grant messages. No active traffic = empty map. Expected behavior.

this-binding crash (resolved)

  • Fixed in commit 685aa41 (April 10, 2026). Update to main if on an older version.

Commit History

Date Key changes
Feb 3, 2026 Initial commit
Feb 5, 2026 Multiple README iterations, initial file uploads
Mar 15, 2026 Added cc_hunter.py
Apr 10, 2026 Core architecture rewrite; this-binding crash fix; HTTPS dev server

Clone this wiki locally