# muhammadmirza97/ai-test-integrity-review architecture

> Architecture diagram of the GitHub repository muhammadmirza97/ai-test-integrity-review, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muhammadmirza97/ai-test-integrity-review
- Repository: https://github.com/muhammadmirza97/ai-test-integrity-review

## Overview

AI Test Integrity Review is a local-first GitHub Action and CLI that checks whether a pull request weakened tests and whether changed tests exercise the change. Its main workflow loads base/head revisions and policy, discovers and compares tests, optionally verifies changed tests against base code and runs targeted mutation testing, then evaluates and reports PASS, WARN, BLOCK, or ERROR. The README documents preflight/doctor as a separate capability. Some subsystem links reflect documented behavior; unsampled source limits call-level detail.

Main entry points: [`packages/core/src/check/run-check.ts`](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/check/run-check.ts) (Check orchestrator), [`packages/cli/src/cli.ts`](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/cli/src/cli.ts) (Local CLI), [`packages/action/src/run.ts`](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/action/src/run.ts) (GitHub Action), [`packages/core/src/report/text.ts`](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/report/text.ts) (Text and JSON reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entrypoints["Entry points"]
  node_cli["Local CLI<br/>[cli.ts]"]
  node_action["GitHub Action<br/>[run.ts]"]
  node_doctor["Preflight doctor<br/>[doctor.ts]"]
end

subgraph group_analysis["PR analysis"]
  node_check["Check orchestrator<br/>[run-check.ts]"]
  node_git[("Git revisions<br/>[repository.ts]")]
  node_config["Policy config<br/>[load.ts]"]
  node_framework["Framework discovery<br/>[discovery.ts]"]
  node_compatibility["Setup compatibility<br/>[compatibility.ts]"]
  node_testast["Test structure analysis<br/>[tests.ts]"]
  node_rules["Integrity rules<br/>[registry.ts]"]
end

subgraph group_verification["Test verification"]
  node_redgreen["Red-green verification<br/>[verifier.ts]"]
  node_worktree["Isolated worktrees<br/>[worktree.ts]"]
  node_mutation["Targeted mutation<br/>[stryker.ts]"]
end

subgraph group_results["Policy and results"]
  node_policy["Finding policy<br/>[evaluate.ts]"]
  node_result["PASS / WARN / BLOCK / ERROR<br/>[result.ts]"]
  node_report["Text and JSON reports<br/>[text.ts]"]
  node_summary["Action summary<br/>[summary.ts]"]
end

node_developer(("Developer / CI"))
node_github(("GitHub PR workflow"))

node_developer -->|"runs locally"| node_cli
node_github -->|"invokes check"| node_action
node_cli -->|"runs check"| node_check
node_cli -->|"runs preflight"| node_doctor
node_action -->|"runs check"| node_check
node_check -->|"reads revisions"| node_git
node_check -->|"loads policy"| node_config
node_check -->|"discovers tests"| node_framework
node_doctor -->|"checks support"| node_compatibility
node_check -->|"analyzes tests"| node_testast
node_check -->|"evaluates changes"| node_rules
node_check -->|"verifies changed tests"| node_redgreen
node_redgreen -->|"creates worktrees"| node_worktree
node_check -.->|"runs when enabled"| node_mutation
node_check -->|"applies policy"| node_policy
node_policy -->|"sets outcome"| node_result
node_check -->|"renders result"| node_report
node_action -->|"writes summary"| node_summary
node_report -->|"returns output"| node_cli
node_report -->|"returns output"| node_action

click node_cli "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/cli/src/cli.ts"
click node_action "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/action/src/run.ts"
click node_doctor "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/environment/doctor.ts"
click node_check "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/check/run-check.ts"
click node_git "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/git/repository.ts"
click node_config "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/config/load.ts"
click node_framework "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/framework/discovery.ts"
click node_compatibility "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/environment/compatibility.ts"
click node_testast "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/ast/tests.ts"
click node_rules "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/rules/registry.ts"
click node_redgreen "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/red-green/verifier.ts"
click node_worktree "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/red-green/worktree.ts"
click node_mutation "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/mutation/stryker.ts"
click node_policy "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/policy/evaluate.ts"
click node_result "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/domain/result.ts"
click node_report "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/report/text.ts"
click node_summary "https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/action/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_cli,node_action,node_doctor toneBlue
class node_check,node_git,node_config,node_framework,node_compatibility,node_testast,node_rules toneAmber
class node_redgreen,node_worktree,node_mutation toneMint
class node_policy,node_result,node_report,node_summary toneRose
class node_developer,node_github toneIndigo
```

## Components

### Entry points

- [Local CLI](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/cli/src/cli.ts): `packages/cli/src/cli.ts`
- [GitHub Action](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/action/src/run.ts): `packages/action/src/run.ts`
- [Preflight doctor](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/environment/doctor.ts): `packages/core/src/environment/doctor.ts`

### PR analysis

- [Check orchestrator](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/check/run-check.ts): `packages/core/src/check/run-check.ts`
- [Git revisions](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/git/repository.ts): `packages/core/src/git/repository.ts`
- [Policy config](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/config/load.ts): `packages/core/src/config/load.ts`
- [Framework discovery](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/framework/discovery.ts): `packages/core/src/framework/discovery.ts`
- [Setup compatibility](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/environment/compatibility.ts): `packages/core/src/environment/compatibility.ts`
- [Test structure analysis](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/ast/tests.ts): `packages/core/src/ast/tests.ts`
- [Integrity rules](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/rules/registry.ts): `packages/core/src/rules/registry.ts`

### Test verification

- [Red-green verification](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/red-green/verifier.ts): `packages/core/src/red-green/verifier.ts`
- [Isolated worktrees](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/red-green/worktree.ts): `packages/core/src/red-green/worktree.ts`
- [Targeted mutation](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/mutation/stryker.ts): `packages/core/src/mutation/stryker.ts`

### Policy and results

- [Finding policy](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/policy/evaluate.ts): `packages/core/src/policy/evaluate.ts`
- [PASS / WARN / BLOCK / ERROR](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/domain/result.ts): `packages/core/src/domain/result.ts`
- [Text and JSON reports](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/core/src/report/text.ts): `packages/core/src/report/text.ts`
- [Action summary](https://github.com/muhammadmirza97/ai-test-integrity-review/blob/main/packages/action/src/summary.ts): `packages/action/src/summary.ts`

### Other components

- **Developer / CI**
- **GitHub PR workflow**

## Connections

- Developer / CI → Local CLI: runs locally
- GitHub PR workflow → GitHub Action: invokes check
- Local CLI → Check orchestrator: runs check
- Local CLI → Preflight doctor: runs preflight
- GitHub Action → Check orchestrator: runs check
- Check orchestrator → Git revisions: reads revisions
- Check orchestrator → Policy config: loads policy
- Check orchestrator → Framework discovery: discovers tests
- Preflight doctor → Setup compatibility: checks support
- Check orchestrator → Test structure analysis: analyzes tests
- Check orchestrator → Integrity rules: evaluates changes
- Check orchestrator → Red-green verification: verifies changed tests
- Red-green verification → Isolated worktrees: creates worktrees
- Check orchestrator → Targeted mutation: runs when enabled
- Check orchestrator → Finding policy: applies policy
- Finding policy → PASS / WARN / BLOCK / ERROR: sets outcome
- Check orchestrator → Text and JSON reports: renders result
- GitHub Action → Action summary: writes summary
- Text and JSON reports → Local CLI: returns output
- Text and JSON reports → GitHub Action: returns output
