# sraisl/polyscan-action architecture

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

- Interactive diagram: https://gitdiagram.com/sraisl/polyscan-action
- Repository: https://github.com/sraisl/polyscan-action

## Overview

PolyScan is a GitHub Action that runs selected security scanners against a workspace, normalizes their findings, then evaluates a quality gate and writes reports. The README also documents broad language and artifact capabilities; unsampled engine adapters are represented collectively. Edges follow the visible entry-point dispatch and report calls, or documented responsibilities; unsampled implementation details are not inferred.

Main entry points: [`src/main.ts`](https://github.com/sraisl/polyscan-action/blob/main/src/main.ts) (Action entry), [`src/engines/betterleaks.ts`](https://github.com/sraisl/polyscan-action/blob/main/src/engines/betterleaks.ts) (Betterleaks), [`src/engines/trivy.ts`](https://github.com/sraisl/polyscan-action/blob/main/src/engines/trivy.ts) (Trivy), [`src/engines/gosec.ts`](https://github.com/sraisl/polyscan-action/blob/main/src/engines/gosec.ts) (Gosec)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Action orchestration"]
  node_entry["Action entry<br/>[main.ts]"]
  node_selection["Engine selection<br/>[engines.ts]"]
  node_scheduler["Scan scheduler<br/>[scheduler.ts]"]
end

subgraph group_scanners["Security scanners"]
  node_semgrep["Semgrep parsers<br/>[semgrep-json.ts]"]
  node_betterleaks["Betterleaks<br/>[betterleaks.ts]"]
  node_detekt["Detekt<br/>[detekt.ts]"]
  node_gosec["Gosec<br/>[gosec.ts]"]
  node_spotbugs["SpotBugs<br/>[spotbugs.ts]"]
  node_trivy["Trivy<br/>[trivy.ts]"]
  node_trufflehog["Trufflehog<br/>[trufflehog.ts]"]
  node_otherengines["Other engine adapters"]
end

subgraph group_runtime["Shared runtime"]
  node_target["Workspace paths<br/>[target.ts]"]
  node_execution["Process execution<br/>[exec.ts]"]
  node_tools["Tool management<br/>[tools.ts]"]
  node_versions["Pinned tool versions<br/>[tool-versions.ts]"]
  node_schema["Finding schema<br/>[schema.ts]"]
end

subgraph group_results["Results and reports"]
  node_gate["Quality gate<br/>[gate.ts]"]
  node_sarif["SARIF output<br/>[sarif.ts]"]
  node_sbom["CycloneDX SBOM<br/>[sbom.ts]"]
  node_summary["Job summary<br/>[summary.ts]"]
end

node_github(("GitHub workflow"))

node_github -->|"starts action"| node_entry
node_entry -->|"resolves engines"| node_selection
node_entry -->|"resolves paths"| node_target
node_entry -->|"schedules scans"| node_scheduler
node_entry -->|"dispatches scan"| node_semgrep
node_entry -->|"dispatches scan"| node_betterleaks
node_entry -->|"dispatches scan"| node_detekt
node_entry -->|"dispatches scan"| node_gosec
node_entry -->|"dispatches scan"| node_spotbugs
node_entry -->|"dispatches scan"| node_trivy
node_entry -->|"dispatches scan"| node_trufflehog
node_entry -->|"dispatches scans"| node_otherengines
node_entry -->|"evaluates findings"| node_gate
node_entry -->|"writes SARIF"| node_sarif
node_entry -->|"writes SBOM"| node_sbom
node_entry -->|"renders summary"| node_summary
node_entry -->|"counts findings"| node_schema
node_betterleaks -->|"runs command"| node_execution
node_betterleaks -->|"prepares binary"| node_tools
node_betterleaks -->|"gets tool metadata"| node_versions
node_betterleaks -->|"resolves target"| node_target
node_betterleaks -->|"returns findings"| node_schema
node_gosec -->|"runs scanner"| node_execution
node_gosec -->|"prepares binary"| node_tools
node_gosec -->|"gets tool metadata"| node_versions
node_gosec -->|"returns findings"| node_schema
node_spotbugs -->|"runs builds and scanner"| node_execution
node_spotbugs -->|"prepares binaries"| node_tools
node_spotbugs -->|"gets tool metadata"| node_versions
node_spotbugs -->|"returns findings"| node_schema
node_trivy -->|"runs scanner"| node_execution
node_trivy -->|"prepares binary"| node_tools
node_trivy -->|"gets tool metadata"| node_versions
node_trivy -->|"resolves target"| node_target
node_trivy -->|"returns findings"| node_schema
node_entry -->|"publishes summary"| node_summary

click node_entry "https://github.com/sraisl/polyscan-action/blob/main/src/main.ts"
click node_selection "https://github.com/sraisl/polyscan-action/blob/main/src/engines.ts"
click node_scheduler "https://github.com/sraisl/polyscan-action/blob/main/src/scheduler.ts"
click node_semgrep "https://github.com/sraisl/polyscan-action/blob/main/src/engines/semgrep-json.ts"
click node_betterleaks "https://github.com/sraisl/polyscan-action/blob/main/src/engines/betterleaks.ts"
click node_detekt "https://github.com/sraisl/polyscan-action/blob/main/src/engines/detekt.ts"
click node_gosec "https://github.com/sraisl/polyscan-action/blob/main/src/engines/gosec.ts"
click node_spotbugs "https://github.com/sraisl/polyscan-action/blob/main/src/engines/spotbugs.ts"
click node_trivy "https://github.com/sraisl/polyscan-action/blob/main/src/engines/trivy.ts"
click node_trufflehog "https://github.com/sraisl/polyscan-action/blob/main/src/engines/trufflehog.ts"
click node_otherengines "https://github.com/sraisl/polyscan-action/tree/main/src/engines"
click node_target "https://github.com/sraisl/polyscan-action/blob/main/src/target.ts"
click node_execution "https://github.com/sraisl/polyscan-action/blob/main/src/exec.ts"
click node_tools "https://github.com/sraisl/polyscan-action/blob/main/src/tools.ts"
click node_versions "https://github.com/sraisl/polyscan-action/blob/main/src/tool-versions.ts"
click node_schema "https://github.com/sraisl/polyscan-action/blob/main/src/schema.ts"
click node_gate "https://github.com/sraisl/polyscan-action/blob/main/src/gate.ts"
click node_sarif "https://github.com/sraisl/polyscan-action/blob/main/src/sarif.ts"
click node_sbom "https://github.com/sraisl/polyscan-action/blob/main/src/sbom.ts"
click node_summary "https://github.com/sraisl/polyscan-action/blob/main/src/summary.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_entry,node_selection,node_scheduler toneBlue
class node_semgrep,node_betterleaks,node_detekt,node_gosec,node_spotbugs,node_trivy,node_trufflehog,node_otherengines toneAmber
class node_target,node_execution,node_tools,node_versions,node_schema toneMint
class node_gate,node_sarif,node_sbom,node_summary toneRose
class node_github toneIndigo
```

## Components

### Action orchestration

- [Action entry](https://github.com/sraisl/polyscan-action/blob/main/src/main.ts): `src/main.ts`
- [Engine selection](https://github.com/sraisl/polyscan-action/blob/main/src/engines.ts): `src/engines.ts`
- [Scan scheduler](https://github.com/sraisl/polyscan-action/blob/main/src/scheduler.ts): `src/scheduler.ts`

### Security scanners

- [Semgrep parsers](https://github.com/sraisl/polyscan-action/blob/main/src/engines/semgrep-json.ts): `src/engines/semgrep-json.ts`
- [Betterleaks](https://github.com/sraisl/polyscan-action/blob/main/src/engines/betterleaks.ts): `src/engines/betterleaks.ts`
- [Detekt](https://github.com/sraisl/polyscan-action/blob/main/src/engines/detekt.ts): `src/engines/detekt.ts`
- [Gosec](https://github.com/sraisl/polyscan-action/blob/main/src/engines/gosec.ts): `src/engines/gosec.ts`
- [SpotBugs](https://github.com/sraisl/polyscan-action/blob/main/src/engines/spotbugs.ts): `src/engines/spotbugs.ts`
- [Trivy](https://github.com/sraisl/polyscan-action/blob/main/src/engines/trivy.ts): `src/engines/trivy.ts`
- [Trufflehog](https://github.com/sraisl/polyscan-action/blob/main/src/engines/trufflehog.ts): `src/engines/trufflehog.ts`
- [Other engine adapters](https://github.com/sraisl/polyscan-action/tree/main/src/engines): `src/engines`

### Shared runtime

- [Workspace paths](https://github.com/sraisl/polyscan-action/blob/main/src/target.ts): `src/target.ts`
- [Process execution](https://github.com/sraisl/polyscan-action/blob/main/src/exec.ts): `src/exec.ts`
- [Tool management](https://github.com/sraisl/polyscan-action/blob/main/src/tools.ts): `src/tools.ts`
- [Pinned tool versions](https://github.com/sraisl/polyscan-action/blob/main/src/tool-versions.ts): `src/tool-versions.ts`
- [Finding schema](https://github.com/sraisl/polyscan-action/blob/main/src/schema.ts): `src/schema.ts`

### Results and reports

- [Quality gate](https://github.com/sraisl/polyscan-action/blob/main/src/gate.ts): `src/gate.ts`
- [SARIF output](https://github.com/sraisl/polyscan-action/blob/main/src/sarif.ts): `src/sarif.ts`
- [CycloneDX SBOM](https://github.com/sraisl/polyscan-action/blob/main/src/sbom.ts): `src/sbom.ts`
- [Job summary](https://github.com/sraisl/polyscan-action/blob/main/src/summary.ts): `src/summary.ts`

### Other components

- **GitHub workflow**

## Connections

- GitHub workflow → Action entry: starts action (evidence: `README.md`)
- Action entry → Engine selection: resolves engines (evidence: `src/main.ts`)
- Action entry → Workspace paths: resolves paths (evidence: `src/main.ts`)
- Action entry → Scan scheduler: schedules scans (evidence: `src/main.ts`)
- Action entry → Semgrep parsers: dispatches scan (evidence: `src/main.ts`)
- Action entry → Betterleaks: dispatches scan (evidence: `src/main.ts`)
- Action entry → Detekt: dispatches scan (evidence: `src/main.ts`)
- Action entry → Gosec: dispatches scan (evidence: `src/main.ts`)
- Action entry → SpotBugs: dispatches scan (evidence: `src/main.ts`)
- Action entry → Trivy: dispatches scan (evidence: `src/main.ts`)
- Action entry → Trufflehog: dispatches scan (evidence: `src/main.ts`)
- Action entry → Other engine adapters: dispatches scans (evidence: `README.md`)
- Action entry → Quality gate: evaluates findings (evidence: `src/main.ts`)
- Action entry → SARIF output: writes SARIF (evidence: `src/main.ts`)
- Action entry → CycloneDX SBOM: writes SBOM (evidence: `src/main.ts`)
- Action entry → Job summary: renders summary (evidence: `src/main.ts`)
- Action entry → Finding schema: counts findings (evidence: `src/main.ts`)
- Betterleaks → Process execution: runs command (evidence: `src/engines/betterleaks.ts`)
- Betterleaks → Tool management: prepares binary (evidence: `src/engines/betterleaks.ts`)
- Betterleaks → Pinned tool versions: gets tool metadata (evidence: `src/engines/betterleaks.ts`)
- Betterleaks → Workspace paths: resolves target (evidence: `src/engines/betterleaks.ts`)
- Betterleaks → Finding schema: returns findings (evidence: `src/engines/betterleaks.ts`)
- Gosec → Process execution: runs scanner (evidence: `src/engines/gosec.ts`)
- Gosec → Tool management: prepares binary (evidence: `src/engines/gosec.ts`)
- Gosec → Pinned tool versions: gets tool metadata (evidence: `src/engines/gosec.ts`)
- Gosec → Finding schema: returns findings (evidence: `src/engines/gosec.ts`)
- SpotBugs → Process execution: runs builds and scanner (evidence: `src/engines/spotbugs.ts`)
- SpotBugs → Tool management: prepares binaries (evidence: `src/engines/spotbugs.ts`)
- SpotBugs → Pinned tool versions: gets tool metadata (evidence: `src/engines/spotbugs.ts`)
- SpotBugs → Finding schema: returns findings (evidence: `src/engines/spotbugs.ts`)
- Trivy → Process execution: runs scanner (evidence: `src/engines/trivy.ts`)
- Trivy → Tool management: prepares binary (evidence: `src/engines/trivy.ts`)
- Trivy → Pinned tool versions: gets tool metadata (evidence: `src/engines/trivy.ts`)
- Trivy → Workspace paths: resolves target (evidence: `src/engines/trivy.ts`)
- Trivy → Finding schema: returns findings (evidence: `src/engines/trivy.ts`)
- Action entry → Job summary: publishes summary (evidence: `src/main.ts`)
