Skip to content

Package Dependencies

Current State (v0.13.0)

mermaid
graph TD
    core["@gitwire/core<br/>Constants + Enums<br/>72 lines, 0 deps"]
    runtime["@gitwire/runtime<br/>db, queue, logger, GitHub client<br/>8 deps: pg, bullmq, ioredis, pino, @octokit/*"]
    rules["@gitwire/rules<br/>Config schema, validation, helpers<br/>251 tests"]
    web["@gitwire/web<br/>Express API + Workers + Routes<br/>34 services, 10 workers, 25 routes"]
    dashboard["@gitwire/web-dashboard<br/>Next.js dashboard<br/>25 pages"]
    bot["@gitwire/bot<br/>Telegram bot (grammy)<br/>13 commands"]
    demo["@gitwire/demo-dashboard<br/>Static demo site<br/>15 pages"]

    web -->|"QUEUES, enums"| core
    web -->|"initRuntime(config)"| runtime
    web -->|"isPillarEnabled, scoreCIRisk"| rules
    runtime -->|"QUEUES"| core
    dashboard -->|"fetches from API"| web
    bot -->|"notifications bridge"| web

    style core fill:#4ade80,color:#000
    style runtime fill:#60a5fa,color:#000
    style rules fill:#fbbf24,color:#000

@gitwire/runtime Architecture

Factory Pattern

Each infrastructure module is a factory function that accepts config — no config imports:

FactoryAcceptsReturns
createLogger({ logLevel, env })Server configpino Logger
createDatabase({ url, logger })DB URL + logger{ query, transaction, end, pool }
createRedisConnection(url, { logger })Redis URL + loggerIORedis instance
createQueue(redis, name)Redis + queue nameBullMQ Queue
createWorker(redis, name, processor, opts)Redis + processorBullMQ Worker
createGitHubApp({ appId, privateKey, ... })GitHub credentials{ getWebhookApp, getInstallationClient, forEachInstallation, forEachRepo }

Init Pattern

javascript
// Called once at startup (src/index.js)
import { initRuntime } from "@gitwire/runtime";
const runtime = initRuntime(config);  // { logger, db, redis, github, QUEUES }

Compat Layer (backward compatibility)

compat/ modules provide lazy proxies that delegate to the runtime. This means all existing imports keep working:

javascript
// Old code still works — zero changes needed
import { db } from "../lib/db.js";
import { logger } from "../lib/logger.js";
import { redis, createQueue, webhookQueue } from "../lib/queue.js";
import { getInstallationClient } from "../lib/github.js";

The lib/*.js files are now thin re-exports from @gitwire/runtime/compat/*.

Auto-initialization

Workers call createQueue() at module top level (before main() runs). The compat layer handles this via ensureRuntime() which picks up the config set by config/index.js through setConfig().

Dependency Inventory

What lives where

ModulePackageLinesDependencies
Constants/enums@gitwire/core72None
DB client@gitwire/runtime (factory)67pg
Queue factory@gitwire/runtime (factory)72bullmq, ioredis
Logger@gitwire/runtime (factory)24pino
GitHub client@gitwire/runtime (factory)91@octokit/app
Config schema + helpers@gitwire/rules~600js-yaml, minimatch
Config validation@gitwire/web/config/172zod, dotenv
Services (34)@gitwire/web/src/services/~8,000runtime, rules, anthropic
Webhook routing@gitwire/web/src/lib/webhookHandlers/~500runtime, services
Workers (10)@gitwire/web/src/workers/~4,000runtime, rules, services
Issue Fix pipeline@gitwire/web/src/workers/issueFix/~500runtime, services, anthropic
Maintainer commands@gitwire/web/src/workers/maintainer/~200runtime, services
Routes (25)@gitwire/web/src/routes/~3,000runtime, services

Test coverage

PackageTestsType
@gitwire/coreConstants only
@gitwire/rules251Pure unit tests
@gitwire/runtime16Factory + init tests
@gitwire/web245 unit + 80 E2EUnit, integration, stress
Total512

Package Role Taxonomy

PackageRoleRuntime depsPure/testable without DB?
@gitwire/coreConstants, enumsNone✅ Yes
@gitwire/runtimeDB, queue, logger, GitHubpg, bullmq, ioredis, pino, @octokit/*❌ No — needs Postgres, Redis
@gitwire/rulesConfig schema, validation, scoringNone✅ Yes
@gitwire/webAPI surface, orchestrationexpress, helmet, cors, everything❌ No
@gitwire/web-dashboardBrowser UInext, swr, tailwind✅ Yes (mock API)
@gitwire/botTelegram botgrammy❌ No — needs Redis + API
@gitwire/demo-dashboardStatic demonext (export)✅ Yes

Last validated: v0.13.0

Released under the MIT License.