Architecture

February 18, 2026 · View on GitHub

Overview

Decision Guardian is a platform-agnostic tool for surfacing architectural decisions on code changes. It runs as both a GitHub Action and a standalone CLI.

System Architecture

Diagram source (editable): docs/mermaid_code.md

Design Principles

  1. Dependency Inversion: Core engine depends on interfaces (ILogger, ISCMProvider), not concrete implementations.
  2. Adapter Pattern: Platform-specific code is isolated in src/adapters/.
  3. Zero PII in telemetry: Privacy blocklist enforced at the module boundary.
  4. Fire-and-forget: Telemetry never blocks or affects tool behavior.

Module Map

Core (src/core/)

FileResponsibility
parser.tsMarkdown → structured decisions (AST-based)
matcher.tsFile-to-decision matching with glob + trie
rule-evaluator.tsAdvanced JSON rule evaluation (regex, content, boolean logic)
trie.tsPrefix trie for O(log n) file lookups
metrics.tsPlatform-agnostic metrics collection
logger.tsStructured logging helper
health.tsDecision file existence checks
types.tsShared type definitions
rule-types.tsRule system type definitions

Adapters (src/adapters/)

FileResponsibility
github/actions-logger.tsILogger@actions/core
github/github-provider.tsISCMProvider → GitHub API
github/comment.tsPR comment management
github/health.tsToken validation
local/console-logger.tsILogger → colored console output
local/local-git-provider.tsISCMProvider → local git diff

CLI (src/cli/)

FileResponsibility
index.tsEntry point, arg parsing, command routing
commands/check.tscheck / checkall command
commands/init.tsScaffold .decispher/ directory
commands/template.tsTemplate listing and output
formatter.tsANSI-colored tables and summaries
paths.tsTemplate directory resolution

Telemetry (src/telemetry/)

FileResponsibility
payload.tsType-safe payload builder
privacy.tsBlocklist validation
sender.tsOpt-in fire-and-forget sender

Worker (workers/telemetry/)

FileResponsibility
worker.tsCloudflare Worker: collect + aggregate
wrangler.tomlDeployment configuration

Data Flow

GitHub Action

Data Flow (GitHub Action)

Diagram source (editable): docs/mermaid_code.md

CLI

Data Flow (CLI)

Diagram source (editable): docs/mermaid_code.md

Build Outputs

ScriptOutputSize
npm run bundledist/index.jsAction entry point
npm run build:clidist/cli/index.jsCLI bundle (~430KB)