Lighthouse for developers. Beacons for API endpoints, fog as downtime, ships as deployments, rocks as bugs.
- JavaScript 100%
| node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 | ||
| src | ||
| tests | ||
| package.json | ||
| README.md | ||
code-lighthouse
Lighthouse for developers. Beacons for API endpoints, fog as downtime, ships as deployments, rocks as bugs.
Usage
const { Lighthouse, WEATHER, BEACON_PATTERNS, ROCK_TYPES } = require('./src/lighthouse');
const lh = new Lighthouse('Point Production');
lh.setKeeper('Old Salt');
// Install beacons for API endpoints
lh.addBeacon('users-api', { endpoint: '/api/users', range: 60, pattern: BEACON_PATTERNS.STEADY });
lh.addBeacon('payments-api', { endpoint: '/api/payments', range: 40, pattern: BEACON_PATTERNS.FLASHING });
// Place known rocks (bugs)
lh.placeRock(ROCK_TYPES.NULL_REF, 30);
lh.placeRock(ROCK_TYPES.RACE_CONDITION, 45);
// Incoming deployment
lh.registerShip('SS Deploy v2', { cargo: 'release-2.0', distance: 80 });
// Weather changes
lh.setWeather(WEATHER.FOGGY);
// Scan for hazards
lh.scan();
// Sound the horn if danger
lh.soundHorn();
// Time passes
for (let i = 0; i < 10; i++) lh.tick();
console.log(lh.towerView());
console.log(lh.report());
Components
- Beacon — 6 patterns (steady, flashing, rotating, occulting, quick, SOS), fuel/visibility tracking
- Ship — Deployments with cargo, health, ETA, collision damage
- Rock — 5 bug types (null ref, race condition, off-by-one, circular dep, memory leak)
- Lighthouse — Keeper, weather (clear/cloudy/foggy/stormy), horn alerts, scanning, ASCII tower