# luantak/is-malicious architecture

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

- Interactive diagram: https://gitdiagram.com/luantak/is-malicious
- Repository: https://github.com/luantak/is-malicious

## Overview

is-malicious? is a CLI scanner that reviews eligible source, configuration, build, and CI files through Jev. Its main workflow discovers files while honoring ignore rules, optionally filters by Git diff, groups content into chunks, scores each chunk, and escalates suspicious or uncertain results for line-level review before reporting findings and usage. The graph also shows the built-in review checks, text-compaction/filtering layer, retry handling, and CLI progress/report presentation. Edges reflect shown imports, calls, or README workflow statements; unsampled implementation details are not inferred.

Main entry points: [`src/scan.ts`](https://github.com/luantak/is-malicious/blob/master/src/scan.ts) (Scan orchestrator), [`src/cli.ts`](https://github.com/luantak/is-malicious/blob/master/src/cli.ts) (CLI), [`src/discover.ts`](https://github.com/luantak/is-malicious/blob/master/src/discover.ts) (File discovery), [`src/jev.ts`](https://github.com/luantak/is-malicious/blob/master/src/jev.ts) (Jev request client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and results"]
  node_cli["CLI<br/>[cli.ts]"]
  node_progress["Progress display<br/>[progress.ts]"]
end

subgraph group_input["Input preparation"]
  node_discovery["File discovery<br/>[discover.ts]"]
  node_ignore["Ignore handling<br/>[gitignore.ts]"]
  node_filters["File filters<br/>[compact.ts]"]
  node_diff["Git diff selection<br/>[diff.ts]"]
  node_chunking["Chunk and windows<br/>[chunk.ts]"]
end

subgraph group_analysis["Review and scoring"]
  node_scanner["Scan orchestrator<br/>[scan.ts]"]
  node_checks["Built-in checks<br/>[builtin.ts]"]
  node_registry["Check registry<br/>[index.ts]"]
  node_jev["Jev request client<br/>[jev.ts]"]
  node_escalation["Escalation rules<br/>[escalate.ts]"]
  node_retry["Token-limit retry<br/>[tokens.ts]"]
end

subgraph group_reporting["Reporting"]
  node_report["Report formatter<br/>[report.ts]"]
  node_color["Terminal colors<br/>[color.ts]"]
end

node_user(("CLI user"))
node_provider{{"TypeSafe-compatible API"}}

node_user -->|"runs scan"| node_cli
node_cli -->|"starts scan"| node_scanner
node_cli -->|"formats results"| node_report
node_cli -->|"shows progress"| node_progress
node_scanner -->|"finds files"| node_discovery
node_discovery -->|"lists unignored paths"| node_ignore
node_discovery -->|"filters files"| node_filters
node_scanner -->|"selects changed files"| node_diff
node_scanner -->|"groups files"| node_chunking
node_chunking -->|"compacts content"| node_filters
node_registry -->|"registers checks"| node_checks
node_scanner -->|"gets checks"| node_registry
node_scanner -->|"submits chunks"| node_jev
node_jev -->|"requests evaluation"| node_provider
node_scanner -->|"evaluates escalation"| node_escalation
node_escalation -->|"reads answers"| node_jev
node_scanner -->|"checks token errors"| node_retry
node_scanner -->|"builds findings"| node_report
node_report -->|"applies palette"| node_color
node_scanner -->|"sends file contents"| node_provider

click node_cli "https://github.com/luantak/is-malicious/blob/master/src/cli.ts"
click node_scanner "https://github.com/luantak/is-malicious/blob/master/src/scan.ts"
click node_discovery "https://github.com/luantak/is-malicious/blob/master/src/discover.ts"
click node_ignore "https://github.com/luantak/is-malicious/blob/master/src/gitignore.ts"
click node_filters "https://github.com/luantak/is-malicious/blob/master/src/compact.ts"
click node_diff "https://github.com/luantak/is-malicious/blob/master/src/diff.ts"
click node_chunking "https://github.com/luantak/is-malicious/blob/master/src/chunk.ts"
click node_checks "https://github.com/luantak/is-malicious/blob/master/src/checks/builtin.ts"
click node_registry "https://github.com/luantak/is-malicious/blob/master/src/checks/index.ts"
click node_jev "https://github.com/luantak/is-malicious/blob/master/src/jev.ts"
click node_escalation "https://github.com/luantak/is-malicious/blob/master/src/escalate.ts"
click node_retry "https://github.com/luantak/is-malicious/blob/master/src/tokens.ts"
click node_report "https://github.com/luantak/is-malicious/blob/master/src/report.ts"
click node_color "https://github.com/luantak/is-malicious/blob/master/src/color.ts"
click node_progress "https://github.com/luantak/is-malicious/blob/master/src/progress.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_progress,node_user toneBlue
class node_discovery,node_ignore,node_filters,node_diff,node_chunking toneAmber
class node_scanner,node_checks,node_registry,node_jev,node_escalation,node_retry,node_provider toneMint
class node_report,node_color toneRose
```

## Components

### CLI and results

- [CLI](https://github.com/luantak/is-malicious/blob/master/src/cli.ts): `src/cli.ts`
- [Progress display](https://github.com/luantak/is-malicious/blob/master/src/progress.ts): `src/progress.ts`

### Input preparation

- [File discovery](https://github.com/luantak/is-malicious/blob/master/src/discover.ts): `src/discover.ts`
- [Ignore handling](https://github.com/luantak/is-malicious/blob/master/src/gitignore.ts): `src/gitignore.ts`
- [File filters](https://github.com/luantak/is-malicious/blob/master/src/compact.ts): `src/compact.ts`
- [Git diff selection](https://github.com/luantak/is-malicious/blob/master/src/diff.ts): `src/diff.ts`
- [Chunk and windows](https://github.com/luantak/is-malicious/blob/master/src/chunk.ts): `src/chunk.ts`

### Review and scoring

- [Scan orchestrator](https://github.com/luantak/is-malicious/blob/master/src/scan.ts): `src/scan.ts`
- [Built-in checks](https://github.com/luantak/is-malicious/blob/master/src/checks/builtin.ts): `src/checks/builtin.ts`
- [Check registry](https://github.com/luantak/is-malicious/blob/master/src/checks/index.ts): `src/checks/index.ts`
- [Jev request client](https://github.com/luantak/is-malicious/blob/master/src/jev.ts): `src/jev.ts`
- [Escalation rules](https://github.com/luantak/is-malicious/blob/master/src/escalate.ts): `src/escalate.ts`
- [Token-limit retry](https://github.com/luantak/is-malicious/blob/master/src/tokens.ts): `src/tokens.ts`

### Reporting

- [Report formatter](https://github.com/luantak/is-malicious/blob/master/src/report.ts): `src/report.ts`
- [Terminal colors](https://github.com/luantak/is-malicious/blob/master/src/color.ts): `src/color.ts`

### Other components

- **CLI user**
- **TypeSafe-compatible API**

## Connections

- CLI user → CLI: runs scan (evidence: `README.md`)
- CLI → Scan orchestrator: starts scan (evidence: `src/cli.ts`)
- CLI → Report formatter: formats results (evidence: `src/cli.ts`)
- CLI → Progress display: shows progress (evidence: `src/cli.ts`)
- Scan orchestrator → File discovery: finds files (evidence: `src/scan.ts`)
- File discovery → Ignore handling: lists unignored paths (evidence: `src/discover.ts`)
- File discovery → File filters: filters files (evidence: `src/discover.ts`)
- Scan orchestrator → Git diff selection: selects changed files (evidence: `src/scan.ts`)
- Scan orchestrator → Chunk and windows: groups files (evidence: `src/scan.ts`)
- Chunk and windows → File filters: compacts content (evidence: `src/chunk.ts`)
- Check registry → Built-in checks: registers checks (evidence: `src/checks/index.ts`)
- Scan orchestrator → Check registry: gets checks (evidence: `src/scan.ts`)
- Scan orchestrator → Jev request client: submits chunks (evidence: `src/scan.ts`)
- Jev request client → TypeSafe-compatible API: requests evaluation (evidence: `src/jev.ts`)
- Scan orchestrator → Escalation rules: evaluates escalation (evidence: `src/scan.ts`)
- Escalation rules → Jev request client: reads answers (evidence: `src/escalate.ts`)
- Scan orchestrator → Token-limit retry: checks token errors (evidence: `src/scan.ts`)
- Scan orchestrator → Report formatter: builds findings (evidence: `src/scan.ts`)
- Report formatter → Terminal colors: applies palette (evidence: `src/report.ts`)
- Scan orchestrator → TypeSafe-compatible API: sends file contents (evidence: `README.md`)
