Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4.1 KiB
4.1 KiB
@suaveplan/health-check - Server-tier standardised /health, /ready, /live endpoints with dependency checks — HealthChecker/ResponseBuilder/HttpCheck/TcpCheck with injectable Clock+TimersLike+LoggerLike+fetch, HEALTH_CHECK_CODES error registry, and OTel self-telemetry.
Server-tier health-check core for /health, /ready, /live endpoints with
dependency checks (HTTP, TCP, custom), aggregated status, caching, and
typed lifecycle events.
Documentation tree
- error-codes —
error-codesprovides the canonical error namespace for@suaveplan/health-check. Every public failure path — invalid…- error-codes —
error-codesprovides the canonical error namespace for@suaveplan/health-check. Every public failure path — invalid…
- error-codes —
- health-checker —
HealthCheckeris the orchestration core of@suaveplan/health-check. It owns a registry of dependency checks, runs t…- health-checker.helpers —
health-checker.helperscarries the pure helpers that back theHealthCheckerclass: the Zod schemas that validate co… - health-checker —
HealthCheckeris the orchestration core of@suaveplan/health-check. It owns a registry of dependency checks, runs t…
- health-checker.helpers —
- http-check —
createHttpCheckreturns aCheckFnthat probes an HTTP endpoint and reportshealthywhen the response status appea…- http-check —
createHttpCheckreturns aCheckFnthat probes an HTTP endpoint and reportshealthywhen the response status appea…
- http-check —
- response-builder —
ResponseBuilderadapts aHealthCheckerinto HTTP-shaped responses suitable for direct return from a Hono / Express…- response-builder —
ResponseBuilderadapts aHealthCheckerinto HTTP-shaped responses suitable for direct return from a Hono / Express…
- response-builder —
- tcp-check —
createTcpCheckreturns aCheckFnthat opens a TCP socket against ahost:portpair and resolves tohealthyonce…- tcp-check —
createTcpCheckreturns aCheckFnthat opens a TCP socket against ahost:portpair and resolves tohealthyonce…
- tcp-check —
- telemetry —
telemetryregisters the OpenTelemetry meter that the health-check package emits to on every public call. The instrume…- telemetry —
telemetryregisters the OpenTelemetry meter that the health-check package emits to on every public call. The instrume…
- telemetry —
Modules
health-checker/—HealthChecker: registry, runner, aggregator,EventBus.http-check/—createHttpCheck: fetch-based probe with injectablefetchImpl.tcp-check/—createTcpCheck: socket probe with injectableTcpConnectFn.response-builder/—ResponseBuilder: maps statuses to HTTP codes.error-codes/—HEALTH_CHECK_CODES+HealthCheckError.telemetry/— OTel meter (counter + histogram).
Install
bun add @suaveplan/health-check
Usage
import {
HealthChecker,
ResponseBuilder,
createHttpCheck,
createTcpCheck,
} from "@suaveplan/health-check";
const checker = new HealthChecker({ name: "api", version: "1.0.0" });
checker.addCheck({
name: "upstream",
check: createHttpCheck({ url: "https://up.example.com/health" }),
});
checker.addCheck({
name: "postgres",
check: createTcpCheck({ host: "db.internal", port: 5432 }),
});
const builder = new ResponseBuilder(checker);
const { statusCode, body } = await builder.health();
License
MIT