# sanjeet3326/glint architecture

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

- Interactive diagram: https://gitdiagram.com/sanjeet3326/glint
- Repository: https://github.com/sanjeet3326/glint

## Overview

Glint is an offline security scanner for AI-agent instruction files, settings, MCP servers, tools and hooks. Its main workflow discovers and parses project inputs, evaluates security rules and cross-tool capabilities, then presents findings through reports or the desktop app. Separate commands also reveal hidden text, inventory agent capabilities, compare approved MCP state, and explain or fix findings. The CLI and GUI excerpts show scan/configuration and presentation paths; several internal links rely only on the source index or README, so unverified runtime links are dashed.

Main entry points: [`glint/cli.py`](https://github.com/sanjeet3326/glint/blob/main/glint/cli.py) (CLI commands), [`glint/scanner.py`](https://github.com/sanjeet3326/glint/blob/main/glint/scanner.py) (Scan orchestration), [`glint/gui.py`](https://github.com/sanjeet3326/glint/blob/main/glint/gui.py) (Desktop GUI), [`glint/inventory.py`](https://github.com/sanjeet3326/glint/blob/main/glint/inventory.py) (Inventory and graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_desktop["Desktop GUI<br/>[gui.py]"]
end

subgraph group_analysis["Scanning and analysis"]
  node_scanner["Scan orchestration<br/>[scanner.py]"]
  node_collector["File collection<br/>[collector.py]"]
  node_parser["Input parsing<br/>[parser.py]"]
  node_rules["Security rules"]
  node_rule_helpers["Rule helpers<br/>[_helpers.py]"]
  node_models["Findings and models<br/>[models.py]"]
  node_scoring["Risk scoring<br/>[scoring.py]"]
end

subgraph group_agent["Agent configuration analysis"]
  node_mcp["MCP parsing<br/>[mcp.py]"]
  node_capabilities["Capability analysis<br/>[capabilities.py]"]
  node_inventory["Inventory and graph<br/>[inventory.py]"]
  node_lockfile["Approved tool lock<br/>[lockfile.py]"]
  node_drift["Tool drift rule"]
  node_config["Project configuration<br/>[config.py]"]
end

subgraph group_outputs["Findings and outputs"]
  node_terminal["Terminal report<br/>[terminal.py]"]
  node_json["JSON report<br/>[json_report.py]"]
  node_sarif["SARIF report<br/>[sarif.py]"]
  node_html["HTML report<br/>[html.py]"]
end

subgraph group_utilities["Security utilities"]
  node_reveal["Hidden-text reveal<br/>[reveal.py]"]
  node_fixer["Unicode fixer<br/>[fixer.py]"]
  node_explain["Rule explanations<br/>[explain.py]"]
  node_textutil["Text normalization<br/>[textutil.py]"]
end

node_user(("Engineer"))

node_user -->|"runs command"| node_cli
node_user -->|"opens app"| node_desktop
node_cli -->|"starts scan"| node_scanner
node_desktop -->|"starts scan"| node_scanner
node_desktop -->|"loads settings"| node_config
node_scanner -.->|"collects inputs"| node_collector
node_scanner -.->|"parses inputs"| node_parser
node_scanner -.->|"evaluates rules"| node_rules
node_rules -.->|"uses helpers"| node_rule_helpers
node_scanner -.->|"produces findings"| node_models
node_scanner -.->|"scores risk"| node_scoring
node_parser -->|"builds documents"| node_models
node_capabilities -->|"reads servers"| node_mcp
node_inventory -->|"analyzes providers"| node_capabilities
node_inventory -->|"lists tools"| node_mcp
node_cli -.->|"builds inventory"| node_inventory
node_cli -->|"handles lock"| node_lockfile
node_drift -->|"checks baseline"| node_lockfile
node_cli -->|"renders output"| node_terminal
node_cli -->|"renders output"| node_json
node_cli -->|"renders output"| node_sarif
node_cli -->|"renders output"| node_html
node_desktop -->|"exports report"| node_html
node_desktop -->|"exports report"| node_json
node_desktop -->|"exports report"| node_sarif
node_cli -->|"reveals content"| node_reveal
node_cli -->|"fixes text"| node_fixer
node_cli -->|"explains rule"| node_explain
node_reveal -->|"decodes hidden text"| node_textutil
node_rule_helpers -.->|"normalizes text"| node_textutil

click node_cli "https://github.com/sanjeet3326/glint/blob/main/glint/cli.py"
click node_desktop "https://github.com/sanjeet3326/glint/blob/main/glint/gui.py"
click node_scanner "https://github.com/sanjeet3326/glint/blob/main/glint/scanner.py"
click node_collector "https://github.com/sanjeet3326/glint/blob/main/glint/collector.py"
click node_parser "https://github.com/sanjeet3326/glint/blob/main/glint/parser.py"
click node_rules "https://github.com/sanjeet3326/glint/tree/main/glint/rules"
click node_rule_helpers "https://github.com/sanjeet3326/glint/blob/main/glint/rules/_helpers.py"
click node_models "https://github.com/sanjeet3326/glint/blob/main/glint/models.py"
click node_scoring "https://github.com/sanjeet3326/glint/blob/main/glint/scoring.py"
click node_mcp "https://github.com/sanjeet3326/glint/blob/main/glint/mcp.py"
click node_capabilities "https://github.com/sanjeet3326/glint/blob/main/glint/capabilities.py"
click node_inventory "https://github.com/sanjeet3326/glint/blob/main/glint/inventory.py"
click node_lockfile "https://github.com/sanjeet3326/glint/blob/main/glint/lockfile.py"
click node_drift "https://github.com/sanjeet3326/glint/blob/main/glint/rules/gl012_tool_drift.py"
click node_config "https://github.com/sanjeet3326/glint/blob/main/glint/config.py"
click node_terminal "https://github.com/sanjeet3326/glint/blob/main/glint/reporters/terminal.py"
click node_json "https://github.com/sanjeet3326/glint/blob/main/glint/reporters/json_report.py"
click node_sarif "https://github.com/sanjeet3326/glint/blob/main/glint/reporters/sarif.py"
click node_html "https://github.com/sanjeet3326/glint/blob/main/glint/reporters/html.py"
click node_reveal "https://github.com/sanjeet3326/glint/blob/main/glint/reveal.py"
click node_fixer "https://github.com/sanjeet3326/glint/blob/main/glint/fixer.py"
click node_explain "https://github.com/sanjeet3326/glint/blob/main/glint/explain.py"
click node_textutil "https://github.com/sanjeet3326/glint/blob/main/glint/textutil.py"

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_desktop toneBlue
class node_scanner,node_collector,node_parser,node_rules,node_rule_helpers,node_models,node_scoring toneAmber
class node_mcp,node_capabilities,node_inventory,node_lockfile,node_drift,node_config toneMint
class node_terminal,node_json,node_sarif,node_html toneRose
class node_reveal,node_fixer,node_explain,node_textutil,node_user toneIndigo
```

## Components

### User entry points

- [CLI commands](https://github.com/sanjeet3326/glint/blob/main/glint/cli.py): `glint/cli.py`
- [Desktop GUI](https://github.com/sanjeet3326/glint/blob/main/glint/gui.py): `glint/gui.py`

### Scanning and analysis

- [Scan orchestration](https://github.com/sanjeet3326/glint/blob/main/glint/scanner.py): `glint/scanner.py`
- [File collection](https://github.com/sanjeet3326/glint/blob/main/glint/collector.py): `glint/collector.py`
- [Input parsing](https://github.com/sanjeet3326/glint/blob/main/glint/parser.py): `glint/parser.py`
- [Security rules](https://github.com/sanjeet3326/glint/tree/main/glint/rules): `glint/rules`
- [Rule helpers](https://github.com/sanjeet3326/glint/blob/main/glint/rules/_helpers.py): `glint/rules/_helpers.py`
- [Findings and models](https://github.com/sanjeet3326/glint/blob/main/glint/models.py): `glint/models.py`
- [Risk scoring](https://github.com/sanjeet3326/glint/blob/main/glint/scoring.py): `glint/scoring.py`

### Agent configuration analysis

- [MCP parsing](https://github.com/sanjeet3326/glint/blob/main/glint/mcp.py): `glint/mcp.py`
- [Capability analysis](https://github.com/sanjeet3326/glint/blob/main/glint/capabilities.py): `glint/capabilities.py`
- [Inventory and graph](https://github.com/sanjeet3326/glint/blob/main/glint/inventory.py): `glint/inventory.py`
- [Approved tool lock](https://github.com/sanjeet3326/glint/blob/main/glint/lockfile.py): `glint/lockfile.py`
- [Tool drift rule](https://github.com/sanjeet3326/glint/blob/main/glint/rules/gl012_tool_drift.py): `glint/rules/gl012_tool_drift.py`
- [Project configuration](https://github.com/sanjeet3326/glint/blob/main/glint/config.py): `glint/config.py`

### Findings and outputs

- [Terminal report](https://github.com/sanjeet3326/glint/blob/main/glint/reporters/terminal.py): `glint/reporters/terminal.py`
- [JSON report](https://github.com/sanjeet3326/glint/blob/main/glint/reporters/json_report.py): `glint/reporters/json_report.py`
- [SARIF report](https://github.com/sanjeet3326/glint/blob/main/glint/reporters/sarif.py): `glint/reporters/sarif.py`
- [HTML report](https://github.com/sanjeet3326/glint/blob/main/glint/reporters/html.py): `glint/reporters/html.py`

### Security utilities

- [Hidden-text reveal](https://github.com/sanjeet3326/glint/blob/main/glint/reveal.py): `glint/reveal.py`
- [Unicode fixer](https://github.com/sanjeet3326/glint/blob/main/glint/fixer.py): `glint/fixer.py`
- [Rule explanations](https://github.com/sanjeet3326/glint/blob/main/glint/explain.py): `glint/explain.py`
- [Text normalization](https://github.com/sanjeet3326/glint/blob/main/glint/textutil.py): `glint/textutil.py`

### Other components

- **Engineer**

## Connections

- Engineer → CLI commands: runs command (evidence: `README.md`)
- Engineer → Desktop GUI: opens app (evidence: `README.md`)
- CLI commands → Scan orchestration: starts scan (evidence: `glint/cli.py`)
- Desktop GUI → Scan orchestration: starts scan (evidence: `glint/gui.py`)
- Desktop GUI → Project configuration: loads settings (evidence: `glint/gui.py`)
- Scan orchestration → File collection: collects inputs
- Scan orchestration → Input parsing: parses inputs
- Scan orchestration → Security rules: evaluates rules
- Security rules → Rule helpers: uses helpers (evidence: `glint/rules/gl009_auto_approve.py`)
- Scan orchestration → Findings and models: produces findings
- Scan orchestration → Risk scoring: scores risk
- Input parsing → Findings and models: builds documents (evidence: `glint/parser.py`)
- Capability analysis → MCP parsing: reads servers (evidence: `glint/capabilities.py`)
- Inventory and graph → Capability analysis: analyzes providers (evidence: `glint/inventory.py`)
- Inventory and graph → MCP parsing: lists tools (evidence: `glint/inventory.py`)
- CLI commands → Inventory and graph: builds inventory (evidence: `glint/cli.py`)
- CLI commands → Approved tool lock: handles lock (evidence: `glint/cli.py`)
- Tool drift rule → Approved tool lock: checks baseline (evidence: `glint/rules/gl012_tool_drift.py`)
- CLI commands → Terminal report: renders output (evidence: `glint/cli.py`)
- CLI commands → JSON report: renders output (evidence: `glint/cli.py`)
- CLI commands → SARIF report: renders output (evidence: `glint/cli.py`)
- CLI commands → HTML report: renders output (evidence: `glint/cli.py`)
- Desktop GUI → HTML report: exports report (evidence: `glint/gui.py`)
- Desktop GUI → JSON report: exports report (evidence: `glint/gui.py`)
- Desktop GUI → SARIF report: exports report (evidence: `glint/gui.py`)
- CLI commands → Hidden-text reveal: reveals content (evidence: `glint/cli.py`)
- CLI commands → Unicode fixer: fixes text (evidence: `glint/cli.py`)
- CLI commands → Rule explanations: explains rule (evidence: `glint/cli.py`)
- Hidden-text reveal → Text normalization: decodes hidden text (evidence: `glint/reveal.py`)
- Rule helpers → Text normalization: normalizes text
