# trashr0x/fcabedrock architecture

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

- Interactive diagram: https://gitdiagram.com/trashr0x/fcabedrock
- Repository: https://github.com/trashr0x/fcabedrock

## Overview

FcaBedrock is a .NET preprocessing tool that turns wide CSV/TSV or triple data into deterministic FCA formal contexts using a Bedrock spec. The main workflow is CLI request → run orchestration → spec loading and resolution → source reading and any required calibration → planning and conversion → CXT/DAT writing and transactional publication. Separate capabilities include probing data to draft specs, migrating legacy BED specs, and fingerprints. Some links are based on README documentation or the RunPipeline SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/FcaBedrock.Orchestration/RunPipeline.cs`](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Orchestration/RunPipeline.cs) (Run orchestration), [`src/FcaBedrock.Cli/Commands`](https://github.com/trashr0x/fcabedrock/tree/main/src/FcaBedrock.Cli/Commands) (CLI commands), [`src/FcaBedrock.Core/Planning/ConversionPlanner.cs`](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Planning/ConversionPlanner.cs) (Conversion planning), [`src/FcaBedrock.Discovery/Prober.cs`](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Discovery/Prober.cs) (Spec discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_cli["CLI commands<br/>[Commands]"]
  node_host["CLI host<br/>[Program.cs]"]
end

subgraph group_specs["Specs"]
  node_specdoc["Spec loading<br/>[SpecReader.cs]"]
  node_composition["Spec composition<br/>[SpecComposer.cs]"]
  node_resolve["Spec resolution<br/>[SpecResolver.cs]"]
  node_migration["BED migration<br/>[BedMigrator.cs]"]
end

subgraph group_conversion["Conversion"]
  node_source["CSV source readers<br/>[CsvReadPipeline.cs]"]
  node_calibration["Calibration"]
  node_calibrated["Effective spec<br/>[CalibratedSpec.cs]"]
  node_planning["Conversion planning"]
  node_discretizers["Discretization<br/>[Discretizer.cs]"]
  node_scales["Conceptual scaling<br/>[Scale.cs]"]
  node_emitter["Context emission<br/>[Emitter.cs]"]
  node_writers["CXT and DAT writers<br/>[CxtWriter.cs]"]
end

subgraph group_operations["Operations"]
  node_run["Run orchestration<br/>[RunPipeline.cs]"]
  node_publication["Publication transaction"]
  node_fingerprints["Fingerprints"]
  node_manifest["Run manifest"]
end

subgraph group_discovery["Discovery"]
  node_probe["Spec discovery<br/>[Prober.cs]"]
end

node_user(("User"))
node_files["Input and output files"]

node_user -->|"invokes"| node_cli
node_cli -->|"dispatches"| node_host
node_host -->|"starts run"| node_run
node_run -->|"reads spec"| node_specdoc
node_run -->|"composes spec"| node_composition
node_run -->|"resolves spec"| node_resolve
node_run -->|"opens source"| node_source
node_source -->|"reads records"| node_files
node_run -->|"calibrates"| node_calibration
node_calibration -->|"produces effective spec"| node_calibrated
node_run -->|"plans conversion"| node_planning
node_planning -->|"uses bin definitions"| node_discretizers
node_planning -->|"uses scale definitions"| node_scales
node_run -->|"emits context"| node_emitter
node_emitter -->|"writes formats"| node_writers
node_run -->|"publishes outputs"| node_publication
node_publication -->|"commits files"| node_files
node_cli -->|"runs probe"| node_probe
node_probe -->|"reads data"| node_files
node_probe -->|"drafts spec"| node_specdoc
node_cli -->|"runs migration"| node_migration
node_migration -->|"converts BED"| node_files
node_run -->|"computes fingerprints"| node_fingerprints
node_run -->|"records run"| node_manifest

click node_cli "https://github.com/trashr0x/fcabedrock/tree/main/src/FcaBedrock.Cli/Commands"
click node_host "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Cli/Program.cs"
click node_run "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Orchestration/RunPipeline.cs"
click node_specdoc "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Toml/SpecReader.cs"
click node_composition "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Toml/SpecComposer.cs"
click node_resolve "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Toml/SpecResolver.cs"
click node_source "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Sources/CsvReadPipeline.cs"
click node_calibration "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Calibration/AttributeCalibration.cs"
click node_calibrated "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Calibration/CalibratedSpec.cs"
click node_planning "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Planning/ConversionPlanner.cs"
click node_discretizers "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Discretization/Discretizer.cs"
click node_scales "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Scaling/Scale.cs"
click node_emitter "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Conversion/Emitter.cs"
click node_writers "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Export/CxtWriter.cs"
click node_publication "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Orchestration/Publication/PublicationTransaction.cs"
click node_probe "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Discovery/Prober.cs"
click node_migration "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/BedMigrator.cs"
click node_fingerprints "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Fingerprinting/FingerprintCalculator.cs"
click node_manifest "https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Manifest/RunManifestWriter.cs"

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_host,node_user toneBlue
class node_specdoc,node_composition,node_resolve,node_migration toneAmber
class node_source,node_calibration,node_calibrated,node_planning,node_discretizers,node_scales,node_emitter,node_writers toneMint
class node_run,node_publication,node_fingerprints,node_manifest toneRose
class node_probe,node_files toneIndigo
```

## Components

### CLI

- [CLI commands](https://github.com/trashr0x/fcabedrock/tree/main/src/FcaBedrock.Cli/Commands): `src/FcaBedrock.Cli/Commands`
- [CLI host](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Cli/Program.cs): `src/FcaBedrock.Cli/Program.cs`

### Specs

- [Spec loading](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Toml/SpecReader.cs): `src/FcaBedrock.Spec/Toml/SpecReader.cs`
- [Spec composition](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Toml/SpecComposer.cs): `src/FcaBedrock.Spec/Toml/SpecComposer.cs`
- [Spec resolution](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Toml/SpecResolver.cs): `src/FcaBedrock.Spec/Toml/SpecResolver.cs`
- [BED migration](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/BedMigrator.cs): `src/FcaBedrock.Spec/BedMigrator.cs`

### Conversion

- [CSV source readers](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Sources/CsvReadPipeline.cs): `src/FcaBedrock.Sources/CsvReadPipeline.cs`
- [Calibration](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Calibration/AttributeCalibration.cs): `src/FcaBedrock.Core/Calibration/AttributeCalibration.cs`
- [Effective spec](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Calibration/CalibratedSpec.cs): `src/FcaBedrock.Core/Calibration/CalibratedSpec.cs`
- [Conversion planning](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Planning/ConversionPlanner.cs): `src/FcaBedrock.Core/Planning/ConversionPlanner.cs`
- [Discretization](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Discretization/Discretizer.cs): `src/FcaBedrock.Core/Discretization/Discretizer.cs`
- [Conceptual scaling](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Scaling/Scale.cs): `src/FcaBedrock.Core/Scaling/Scale.cs`
- [Context emission](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Conversion/Emitter.cs): `src/FcaBedrock.Conversion/Emitter.cs`
- [CXT and DAT writers](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Export/CxtWriter.cs): `src/FcaBedrock.Export/CxtWriter.cs`

### Operations

- [Run orchestration](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Orchestration/RunPipeline.cs): `src/FcaBedrock.Orchestration/RunPipeline.cs`
- [Publication transaction](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Orchestration/Publication/PublicationTransaction.cs): `src/FcaBedrock.Orchestration/Publication/PublicationTransaction.cs`
- [Fingerprints](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Core/Fingerprinting/FingerprintCalculator.cs): `src/FcaBedrock.Core/Fingerprinting/FingerprintCalculator.cs`
- [Run manifest](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Spec/Manifest/RunManifestWriter.cs): `src/FcaBedrock.Spec/Manifest/RunManifestWriter.cs`

### Discovery

- [Spec discovery](https://github.com/trashr0x/fcabedrock/blob/main/src/FcaBedrock.Discovery/Prober.cs): `src/FcaBedrock.Discovery/Prober.cs`

### Other components

- **User**
- **Input and output files**

## Connections

- User → CLI commands: invokes (evidence: `README.md`)
- CLI commands → CLI host: dispatches (evidence: `src/FcaBedrock.Cli/Program.cs`)
- CLI host → Run orchestration: starts run (evidence: `src/FcaBedrock.Cli/Program.cs`)
- Run orchestration → Spec loading: reads spec (evidence: `src/FcaBedrock.Orchestration/RunPipeline.cs`)
- Run orchestration → Spec composition: composes spec (evidence: `src/FcaBedrock.Orchestration/RunPipeline.cs`)
- Run orchestration → Spec resolution: resolves spec (evidence: `src/FcaBedrock.Orchestration/RunPipeline.cs`)
- Run orchestration → CSV source readers: opens source (evidence: `src/FcaBedrock.Orchestration/RunPipeline.cs`)
- CSV source readers → Input and output files: reads records (evidence: `README.md`)
- Run orchestration → Calibration: calibrates (evidence: `README.md`)
- Calibration → Effective spec: produces effective spec (evidence: `src/FcaBedrock.Core/Calibration/CalibratedSpec.cs`)
- Run orchestration → Conversion planning: plans conversion (evidence: `README.md`)
- Conversion planning → Discretization: uses bin definitions (evidence: `src/FcaBedrock.Core/Planning/ConversionPlanner.cs`)
- Conversion planning → Conceptual scaling: uses scale definitions (evidence: `src/FcaBedrock.Core/Planning/ConversionPlanner.cs`)
- Run orchestration → Context emission: emits context (evidence: `README.md`)
- Context emission → CXT and DAT writers: writes formats (evidence: `README.md`)
- Run orchestration → Publication transaction: publishes outputs (evidence: `README.md`)
- Publication transaction → Input and output files: commits files (evidence: `README.md`)
- CLI commands → Spec discovery: runs probe (evidence: `README.md`)
- Spec discovery → Input and output files: reads data (evidence: `README.md`)
- Spec discovery → Spec loading: drafts spec (evidence: `README.md`)
- CLI commands → BED migration: runs migration (evidence: `README.md`)
- BED migration → Input and output files: converts BED (evidence: `README.md`)
- Run orchestration → Fingerprints: computes fingerprints (evidence: `src/FcaBedrock.Core/Fingerprinting/FingerprintCalculator.cs`)
- Run orchestration → Run manifest: records run (evidence: `README.md`)
