# cipherx2433/bugbundle architecture

> Architecture diagram of the GitHub repository cipherx2433/bugbundle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cipherx2433/bugbundle
- Repository: https://github.com/cipherx2433/bugbundle

## Overview

bugbundle is a local-first Node.js diagnostics CLI. Its principal workflow loads project configuration, collects selected system/runtime/dependency facts, sanitizes and validates the bundle, builds a Markdown preview, requires explicit review for collection, and safely exports only after approval; inspect stops at preview. The graph preserves the documented collector, configuration, security, review, and export stages. Relationships involving unsampled implementations are shown only where the CLI excerpt or README supports them.

Main entry points: [`src/cli/program.ts`](https://github.com/cipherx2433/bugbundle/blob/main/src/cli/program.ts) (Command interface), [`src/security/pipeline.ts`](https://github.com/cipherx2433/bugbundle/blob/main/src/security/pipeline.ts) (Security pipeline), [`src/cli/index.ts`](https://github.com/cipherx2433/bugbundle/blob/main/src/cli/index.ts) (CLI entrypoint), [`src/config/init.ts`](https://github.com/cipherx2433/bugbundle/blob/main/src/config/init.ts) (Initialize config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_cli["Command interface<br/>[program.ts]"]
  node_entry["CLI entrypoint<br/>[index.ts]"]
end

subgraph group_config["Configuration"]
  node_config_init["Initialize config<br/>[init.ts]"]
  node_config_load["Load config<br/>[loader.ts]"]
  node_config_schema["Validate config<br/>[schema.ts]"]
  node_config_selection["Select collectors<br/>[selection.ts]"]
end

subgraph group_collect["Diagnostics collection"]
  node_orchestrator["Diagnostic orchestration<br/>[orchestrator.ts]"]
  node_system["System collector<br/>[system.ts]"]
  node_runtimes["Runtime detection<br/>[runtimes.ts]"]
  node_dependencies["Dependency inspection<br/>[dependencies.ts]"]
end

subgraph group_security["Security and privacy"]
  node_guard["Collection path guard<br/>[path-guard.ts]"]
  node_pipeline["Security pipeline<br/>[pipeline.ts]"]
  node_scanner["Secret scanner<br/>[scanner.ts]"]
  node_redactor["Secret redactor<br/>[redactor.ts]"]
  node_sanitizer["Path sanitizer<br/>[path-sanitizer.ts]"]
  node_validator["Privacy validator"]
end

subgraph group_output["Report and approval"]
  node_report["Markdown report"]
  node_review["Review gate<br/>[review-gate.ts]"]
  node_export["Safe report export<br/>[report-exporter.ts]"]
end

node_user(("CLI user"))
node_project["Project files"]
node_host["Host and runtimes"]

node_user -->|"runs commands"| node_entry
node_entry -->|"creates program"| node_cli
node_cli -->|"initializes config"| node_config_init
node_cli -->|"loads config"| node_config_load
node_cli -->|"resolves selection"| node_config_selection
node_config_load -->|"validates config"| node_config_schema
node_config_init -->|"uses schema"| node_config_schema
node_cli -->|"runs collection"| node_orchestrator
node_cli -->|"guards paths"| node_guard
node_system -->|"reads system facts"| node_host
node_runtimes -->|"checks runtimes"| node_host
node_dependencies -->|"inspects manifests"| node_project
node_cli -->|"sanitizes bundle"| node_pipeline
node_pipeline -->|"scans secrets"| node_scanner
node_pipeline -->|"redacts secrets"| node_redactor
node_pipeline -->|"sanitizes paths"| node_sanitizer
node_pipeline -->|"validates privacy"| node_validator
node_cli -->|"builds Markdown"| node_report
node_cli -->|"requests approval"| node_review
node_review -->|"shows preview"| node_user
node_cli -->|"exports approved report"| node_export

click node_cli "https://github.com/cipherx2433/bugbundle/blob/main/src/cli/program.ts"
click node_entry "https://github.com/cipherx2433/bugbundle/blob/main/src/cli/index.ts"
click node_config_init "https://github.com/cipherx2433/bugbundle/blob/main/src/config/init.ts"
click node_config_load "https://github.com/cipherx2433/bugbundle/blob/main/src/config/loader.ts"
click node_config_schema "https://github.com/cipherx2433/bugbundle/blob/main/src/config/schema.ts"
click node_config_selection "https://github.com/cipherx2433/bugbundle/blob/main/src/config/selection.ts"
click node_orchestrator "https://github.com/cipherx2433/bugbundle/blob/main/src/core/orchestrator.ts"
click node_system "https://github.com/cipherx2433/bugbundle/blob/main/src/collectors/system.ts"
click node_runtimes "https://github.com/cipherx2433/bugbundle/blob/main/src/collectors/runtimes.ts"
click node_dependencies "https://github.com/cipherx2433/bugbundle/blob/main/src/collectors/dependencies.ts"
click node_guard "https://github.com/cipherx2433/bugbundle/blob/main/src/security/path-guard.ts"
click node_pipeline "https://github.com/cipherx2433/bugbundle/blob/main/src/security/pipeline.ts"
click node_scanner "https://github.com/cipherx2433/bugbundle/blob/main/src/security/scanner.ts"
click node_redactor "https://github.com/cipherx2433/bugbundle/blob/main/src/security/redactor.ts"
click node_sanitizer "https://github.com/cipherx2433/bugbundle/blob/main/src/security/path-sanitizer.ts"
click node_validator "https://github.com/cipherx2433/bugbundle/blob/main/src/security/privacy-validator.ts"
click node_report "https://github.com/cipherx2433/bugbundle/blob/main/src/report/markdown-builder.ts"
click node_review "https://github.com/cipherx2433/bugbundle/blob/main/src/review/review-gate.ts"
click node_export "https://github.com/cipherx2433/bugbundle/blob/main/src/export/report-exporter.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_entry,node_user toneBlue
class node_config_init,node_config_load,node_config_schema,node_config_selection toneAmber
class node_orchestrator,node_system,node_runtimes,node_dependencies toneMint
class node_guard,node_pipeline,node_scanner,node_redactor,node_sanitizer,node_validator toneRose
class node_report,node_review,node_export,node_project,node_host toneIndigo
```

## Components

### CLI workflow

- [Command interface](https://github.com/cipherx2433/bugbundle/blob/main/src/cli/program.ts): `src/cli/program.ts`
- [CLI entrypoint](https://github.com/cipherx2433/bugbundle/blob/main/src/cli/index.ts): `src/cli/index.ts`

### Configuration

- [Initialize config](https://github.com/cipherx2433/bugbundle/blob/main/src/config/init.ts): `src/config/init.ts`
- [Load config](https://github.com/cipherx2433/bugbundle/blob/main/src/config/loader.ts): `src/config/loader.ts`
- [Validate config](https://github.com/cipherx2433/bugbundle/blob/main/src/config/schema.ts): `src/config/schema.ts`
- [Select collectors](https://github.com/cipherx2433/bugbundle/blob/main/src/config/selection.ts): `src/config/selection.ts`

### Diagnostics collection

- [Diagnostic orchestration](https://github.com/cipherx2433/bugbundle/blob/main/src/core/orchestrator.ts): `src/core/orchestrator.ts`
- [System collector](https://github.com/cipherx2433/bugbundle/blob/main/src/collectors/system.ts): `src/collectors/system.ts`
- [Runtime detection](https://github.com/cipherx2433/bugbundle/blob/main/src/collectors/runtimes.ts): `src/collectors/runtimes.ts`
- [Dependency inspection](https://github.com/cipherx2433/bugbundle/blob/main/src/collectors/dependencies.ts): `src/collectors/dependencies.ts`

### Security and privacy

- [Collection path guard](https://github.com/cipherx2433/bugbundle/blob/main/src/security/path-guard.ts): `src/security/path-guard.ts`
- [Security pipeline](https://github.com/cipherx2433/bugbundle/blob/main/src/security/pipeline.ts): `src/security/pipeline.ts`
- [Secret scanner](https://github.com/cipherx2433/bugbundle/blob/main/src/security/scanner.ts): `src/security/scanner.ts`
- [Secret redactor](https://github.com/cipherx2433/bugbundle/blob/main/src/security/redactor.ts): `src/security/redactor.ts`
- [Path sanitizer](https://github.com/cipherx2433/bugbundle/blob/main/src/security/path-sanitizer.ts): `src/security/path-sanitizer.ts`
- [Privacy validator](https://github.com/cipherx2433/bugbundle/blob/main/src/security/privacy-validator.ts): `src/security/privacy-validator.ts`

### Report and approval

- [Markdown report](https://github.com/cipherx2433/bugbundle/blob/main/src/report/markdown-builder.ts): `src/report/markdown-builder.ts`
- [Review gate](https://github.com/cipherx2433/bugbundle/blob/main/src/review/review-gate.ts): `src/review/review-gate.ts`
- [Safe report export](https://github.com/cipherx2433/bugbundle/blob/main/src/export/report-exporter.ts): `src/export/report-exporter.ts`

### Other components

- **CLI user**
- **Project files**
- **Host and runtimes**

## Connections

- CLI user → CLI entrypoint: runs commands (evidence: `README.md`)
- CLI entrypoint → Command interface: creates program (evidence: `src/cli/index.ts`)
- Command interface → Initialize config: initializes config (evidence: `src/cli/program.ts`)
- Command interface → Load config: loads config (evidence: `src/cli/program.ts`)
- Command interface → Select collectors: resolves selection (evidence: `src/cli/program.ts`)
- Load config → Validate config: validates config (evidence: `src/config/loader.ts`)
- Initialize config → Validate config: uses schema (evidence: `src/config/init.ts`)
- Command interface → Diagnostic orchestration: runs collection (evidence: `src/cli/program.ts`)
- Command interface → Collection path guard: guards paths (evidence: `src/cli/program.ts`)
- System collector → Host and runtimes: reads system facts (evidence: `README.md`)
- Runtime detection → Host and runtimes: checks runtimes (evidence: `README.md`)
- Dependency inspection → Project files: inspects manifests (evidence: `README.md`)
- Command interface → Security pipeline: sanitizes bundle (evidence: `src/cli/program.ts`)
- Security pipeline → Secret scanner: scans secrets (evidence: `src/security/pipeline.ts`)
- Security pipeline → Secret redactor: redacts secrets (evidence: `src/security/pipeline.ts`)
- Security pipeline → Path sanitizer: sanitizes paths (evidence: `src/security/pipeline.ts`)
- Security pipeline → Privacy validator: validates privacy (evidence: `src/security/pipeline.ts`)
- Command interface → Markdown report: builds Markdown (evidence: `src/cli/program.ts`)
- Command interface → Review gate: requests approval (evidence: `src/cli/program.ts`)
- Review gate → CLI user: shows preview (evidence: `README.md`)
- Command interface → Safe report export: exports approved report (evidence: `src/cli/program.ts`)
