How jscraik/diagram-cli works
Archscope is a Node.js CLI that analyzes a repository and turns the results into architecture evidence for human review and AI-agent handoff. Its central workflow is scan/agent-pr: analyze the target repository, optionally add pull-request impact evidence, then write a manifest-indexed evidence pack. Other documented branches cover diagram generation (including schema-backed ERDs), policy validation, changed-file analysis, dependency explanation, and PR risk reporting. Paths reflect the supplied tree; several command-to-module details are based on README descriptions because those command implementations were not sampled.
Main entry points: scan.js Scan workflow · diagram.js CLI entry point · generate.js Generate command · index.js Analyzer registry
Components 23
CLI workflows
- CLI entry point
src/diagram.js - Scan workflow
src/commands/scan.js - Agent PR workflow
src/commands/agent-pr.js - Analyze command
src/commands/analyze.js - Generate command
src/commands/generate.js - Validate command
src/commands/validate.js - PR workflow
src/workflow/pr-command.js
Repository analysis
- Scan configuration
src/config/diagramrc.js - Analyzer registry
src/analyzers/index.js - Default analyzer
src/analyzers/default-analyzer.js - Analysis engine
src/core/analysis-generation.js - Architecture IR
src/ir/architecture-ir.js - Schema extraction
src/schema/erd-extractor.js
Evidence artifacts
- Evidence manifest
src/artifacts/evidence-manifest.js - Architecture brief
src/artifacts/brief.js - Agent handoff
src/artifacts/agent-context.js - Context pack
src/context/build-context-pack.js
Diagrams and reports
- Mermaid diagrams
src/core/analysis-generation-diagrams.js - HTML report
src/renderers/report-html.js - Result formatters
src/formatters/index.js
Pull request impact
- Impact and risk
src/workflow/pr-impact.js
Other components
- Engineer or agent
- Target repository
Connections 31
- Engineer or agent → CLI entry point: runs command
- CLI entry point → Scan workflow: dispatches
- CLI entry point → Agent PR workflow: dispatches
- CLI entry point → Analyze command: dispatches
- CLI entry point → Generate command: dispatches
- CLI entry point → Validate command: dispatches
- CLI entry point → PR workflow: dispatches
- Target repository → Scan workflow: provides source
- Scan workflow → Scan configuration: resolves defaults
- Scan workflow → Analyzer registry: runs analysis
- Analyze command → Analyzer registry: runs analysis
- Generate command → Analyzer registry: runs analysis
- Analyzer registry → Default analyzer: selects analyzer
- Default analyzer → Analysis engine: analyzes repository
- Analysis engine → Architecture IR: builds representation
- Generate command → Schema extraction: supports ERD output
- Scan workflow → Evidence manifest: indexes artifacts
- Scan workflow → Architecture brief: writes brief
- Scan workflow → Agent handoff: writes handoff
- Scan workflow → Mermaid diagrams: generates evidence
- Agent PR workflow → Scan workflow: delegates scan
- Agent PR workflow → Impact and risk: adds PR evidence
- PR workflow → Impact and risk: computes impact
- Impact and risk → Target repository: compares Git refs
- Agent handoff → Evidence manifest: reads artifact status
- Context pack → Evidence manifest: uses artifact index
- Generate command → Mermaid diagrams: generates diagrams
- Validate command → Result formatters: formats results
- PR workflow → HTML report: writes impact report
- Scan workflow → HTML report: writes human report
- Scan workflow → Result formatters: formats machine output