archmind 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. archmind-0.1.0/PKG-INFO +204 -0
  2. archmind-0.1.0/README.md +191 -0
  3. archmind-0.1.0/pyproject.toml +31 -0
  4. archmind-0.1.0/setup.cfg +4 -0
  5. archmind-0.1.0/src/archmind/__init__.py +3 -0
  6. archmind-0.1.0/src/archmind/__main__.py +5 -0
  7. archmind-0.1.0/src/archmind/analysis.py +580 -0
  8. archmind-0.1.0/src/archmind/cli.py +49 -0
  9. archmind-0.1.0/src/archmind/evaluation.py +28 -0
  10. archmind-0.1.0/src/archmind/graphing.py +1142 -0
  11. archmind-0.1.0/src/archmind/inspection.py +207 -0
  12. archmind-0.1.0/src/archmind/knowledge.py +38 -0
  13. archmind-0.1.0/src/archmind/llm.py +87 -0
  14. archmind-0.1.0/src/archmind/models.py +93 -0
  15. archmind-0.1.0/src/archmind/pipeline.py +131 -0
  16. archmind-0.1.0/src/archmind/reporting.py +359 -0
  17. archmind-0.1.0/src/archmind/repository.py +168 -0
  18. archmind-0.1.0/src/archmind/ui.py +116 -0
  19. archmind-0.1.0/src/archmind/utils.py +53 -0
  20. archmind-0.1.0/src/archmind/visualization.py +384 -0
  21. archmind-0.1.0/src/archmind.egg-info/PKG-INFO +204 -0
  22. archmind-0.1.0/src/archmind.egg-info/SOURCES.txt +31 -0
  23. archmind-0.1.0/src/archmind.egg-info/dependency_links.txt +1 -0
  24. archmind-0.1.0/src/archmind.egg-info/entry_points.txt +2 -0
  25. archmind-0.1.0/src/archmind.egg-info/requires.txt +6 -0
  26. archmind-0.1.0/src/archmind.egg-info/top_level.txt +1 -0
  27. archmind-0.1.0/tests/test_analysis.py +63 -0
  28. archmind-0.1.0/tests/test_cli.py +51 -0
  29. archmind-0.1.0/tests/test_graphing.py +117 -0
  30. archmind-0.1.0/tests/test_llm.py +112 -0
  31. archmind-0.1.0/tests/test_pipeline.py +150 -0
  32. archmind-0.1.0/tests/test_reporting.py +86 -0
  33. archmind-0.1.0/tests/test_visualization.py +46 -0
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: archmind
3
+ Version: 0.1.0
4
+ Summary: REPL-style architecture analysis CLI for Git repositories.
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: rich>=13.7.0
8
+ Requires-Dist: litellm>=1.51.0
9
+ Requires-Dist: torch>=2.4.0
10
+ Requires-Dist: torch-geometric>=2.6.0
11
+ Requires-Dist: networkx>=3.3
12
+ Requires-Dist: matplotlib>=3.9.0
13
+
14
+ # ArchMind
15
+
16
+ ArchMind is a tool for exploring and analyzing the architecture of a software project from its GitHub repository. It scans a Python or Java codebase, builds architecture graphs, looks for structural problems like tight coupling or weak boundaries, and produces a report you can read in the terminal or export as Markdown. Current support is limited to Python and Java repositories.
17
+
18
+ Under the hood, ArchMind turns the codebase into several graph views, such as dependency graphs, architecture boundary graphs, data-flow graphs, and function relationship graphs. It then analyzes those graphs to detect patterns that often signal architecture problems, and uses an LLM to turn the raw graph findings into a more readable explanation and report.
19
+
20
+ ## Demo
21
+
22
+ - Watch the ArchMind demo video: [https://youtu.be/csiNiZG_ygQ](https://youtu.be/csiNiZG_ygQ)
23
+ - Sample outputs: see the `sample_results` folder
24
+
25
+ ## v0 product shape
26
+ - Interface: CLI-only REPL
27
+ - Language: Python 3.11+
28
+ - Input: GitHub repository URL for a Python or Java repository
29
+ - Branch selection: optional, default `main`
30
+ - Core output: architecture graph plus analysis findings
31
+ - Report output: print to terminal and export a result folder named `result` by default
32
+ - LLM access: user selects provider and supplies their own API key
33
+ - Terminal UX: ASCII-art opening intro with version, modern prompts, progress bars, and tasteful emoji or ASCII icons
34
+
35
+ ## Core analysis direction
36
+ The first useful analysis set should stay concrete and explainable:
37
+ - DSM generation from the dependency graph
38
+ - coupling analysis such as fan-in, fan-out, and shared-dependency pressure
39
+ - cycle and strongly connected component detection
40
+ - centrality and bridge-node analysis to identify architectural choke points
41
+ - LLM-based interpretation that turns graph evidence into architecture findings and recommendations
42
+
43
+ ## Graphs generated in v0
44
+ ArchMind now builds several graph views from the same repository scan:
45
+ - `dependency_graph`: module and external dependency relationships
46
+ - `architecture_graph`: repository, package, and module boundary structure
47
+ - `data_flow_graph`: inferred reads, writes, emits, and external data interactions
48
+ - `interface_graph`: public interfaces, entrypoints, and their consumers
49
+ - `function_graph`: function-level call relationships across modules and classes
50
+ - `operational_risk_graph`: inferred observability and security capability coverage
51
+
52
+ The issue-inspection rules in [knowledge/graph_catalog.json](/Volumes/1TB/Personal_projects/ArchMind/knowledge/graph_catalog.json) map each architecture issue to the graph views most relevant to that inspection.
53
+
54
+ PDF graph exports use graph-aware layouts through `networkx` and `matplotlib`. Very large graphs are sampled down to the most structurally important nodes so the exported PDF remains readable.
55
+
56
+ ## Language support
57
+ - Supported repository languages: Python and Java
58
+ - Other repository languages are not supported yet and may produce sparse or empty graph artifacts
59
+
60
+ ## Default technical direction
61
+ - Python 3.11+ for the REPL, ingestion, graph processing, evaluation, and report generation
62
+ - PyTorch plus PyTorch Geometric (PyG) for graph encoding, transforms, and GNNs
63
+ - LiteLLM for provider abstraction across OpenAI, Anthropic, and Gemini
64
+ - `torch_geometric.data.HeteroData` as the default graph container
65
+ - Typed schemas for durable contracts
66
+ - JSON, JSONL, Markdown, and trusted tensor artifacts as the primary interchange formats
67
+
68
+ ## Intended CLI shape
69
+ ```bash
70
+ archmind [<github_url>] [--branch main] [--output result] [--llm-provider openai]
71
+ ```
72
+
73
+ If a repository URL, branch, output folder, LLM provider, or API key is not provided at startup, the REPL should ask for it interactively.
74
+
75
+ ## How to run
76
+ Use Python 3.11+.
77
+
78
+ ### Setup with `uv`
79
+ Create a virtual environment:
80
+
81
+ ```bash
82
+ uv venv
83
+ ```
84
+
85
+ Activate it:
86
+
87
+ ```bash
88
+ source .venv/bin/activate
89
+ ```
90
+
91
+ Install runtime dependencies and the package:
92
+
93
+ ```bash
94
+ uv pip install -r requirements.txt
95
+ uv pip install -e .
96
+ ```
97
+
98
+ ### Setup with `pip`
99
+ Create a virtual environment:
100
+
101
+ ```bash
102
+ python3 -m venv .venv
103
+ source .venv/bin/activate
104
+ ```
105
+
106
+ Install runtime dependencies and the package:
107
+
108
+ ```bash
109
+ python3 -m pip install -r requirements.txt
110
+ python3 -m pip install -e .
111
+ ```
112
+
113
+ ### Start the program
114
+ Launch the REPL:
115
+
116
+ ```bash
117
+ archmind
118
+ ```
119
+
120
+ Launch with startup parameters:
121
+
122
+ ```bash
123
+ archmind https://github.com/example/project --branch main --output result --llm-provider openai
124
+ ```
125
+
126
+ Run it without installing the console script:
127
+
128
+ ```bash
129
+ PYTHONPATH=src python3 -m archmind
130
+ ```
131
+
132
+ ### Run tests
133
+ Install test tooling if needed:
134
+
135
+ ```bash
136
+ python3 -m pip install pytest
137
+ ```
138
+
139
+ Then run:
140
+
141
+ ```bash
142
+ python3 -m pytest
143
+ ```
144
+
145
+ ## Result output structure
146
+ The user-facing export target is a folder, not a single file.
147
+
148
+ Default exported folder:
149
+
150
+ ```text
151
+ result/
152
+ result.md
153
+ dependency_graph.pdf
154
+ architecture_graph.pdf
155
+ data_flow_graph.pdf
156
+ interface_graph.pdf
157
+ function_graph.pdf
158
+ operational_risk_graph.pdf
159
+ dependency_graph_metrics.json
160
+ architecture_graph_metrics.json
161
+ data_flow_graph_metrics.json
162
+ interface_graph_metrics.json
163
+ function_graph_metrics.json
164
+ operational_risk_graph_metrics.json
165
+ dependency_graph_dsm.csv
166
+ issue_summary.json
167
+ issue_assessments.json
168
+ ```
169
+
170
+ Workspace artifacts remain under `workspaces/<run_id>/` and include:
171
+ - graph JSON files under `graph/`
172
+ - PyG payloads per graph
173
+ - PDFs per graph under `graph/`
174
+ - per-graph metrics and findings under `analysis/`
175
+ - per-issue inspection outputs under `analysis/issues/`
176
+ - evaluation files and provenance metadata
177
+
178
+ ## Reading order
179
+ 1. `AGENTS.md` for repo-local coding instructions
180
+ 2. `SPEC.md` for system scope, domain contracts, and artifacts
181
+ 3. `WORKFLOW.md` for runtime policy and execution defaults
182
+ 4. `architecture.md` for module boundaries and graph flow
183
+ 5. `agent_roles.md` for role definitions and artifact ownership
184
+ 6. `data.md`, `eval.md`, and `security.md` for operational constraints
185
+
186
+ ## Repository rules
187
+ - Treat docs as the system of record. If behavior changes, update docs before or with implementation.
188
+ - Keep every stage artifact-backed: repo fetch, graph construction, analysis, explanation, report generation, evaluation, provenance.
189
+ - Prefer explicit schemas over prompt-only conventions.
190
+ - Record seeds, versions, hashes, and feature-schema changes whenever results should be reproducible.
191
+
192
+ ## Documents
193
+ - `AGENTS.md` - repo instructions for coding agents
194
+ - `SPEC.md` - system specification and domain contracts
195
+ - `agent_roles.md` - execution roles and artifact ownership
196
+ - `WORKFLOW.md` - workflow contract and runtime defaults
197
+ - `architecture.md` - module boundaries and graph-aware execution flow
198
+ - `api.md` - CLI contract and internal interfaces
199
+ - `data.md` - source ingestion, graph artifacts, and dataset handling
200
+ - `eval.md` - evaluation harness and metrics
201
+ - `security.md` - threat model and guardrails
202
+ - `roadmap.md` - milestones
203
+ - `decisions.md` - architecture decisions
204
+ - `CONTRIBUTING.md` - contribution expectations
@@ -0,0 +1,191 @@
1
+ # ArchMind
2
+
3
+ ArchMind is a tool for exploring and analyzing the architecture of a software project from its GitHub repository. It scans a Python or Java codebase, builds architecture graphs, looks for structural problems like tight coupling or weak boundaries, and produces a report you can read in the terminal or export as Markdown. Current support is limited to Python and Java repositories.
4
+
5
+ Under the hood, ArchMind turns the codebase into several graph views, such as dependency graphs, architecture boundary graphs, data-flow graphs, and function relationship graphs. It then analyzes those graphs to detect patterns that often signal architecture problems, and uses an LLM to turn the raw graph findings into a more readable explanation and report.
6
+
7
+ ## Demo
8
+
9
+ - Watch the ArchMind demo video: [https://youtu.be/csiNiZG_ygQ](https://youtu.be/csiNiZG_ygQ)
10
+ - Sample outputs: see the `sample_results` folder
11
+
12
+ ## v0 product shape
13
+ - Interface: CLI-only REPL
14
+ - Language: Python 3.11+
15
+ - Input: GitHub repository URL for a Python or Java repository
16
+ - Branch selection: optional, default `main`
17
+ - Core output: architecture graph plus analysis findings
18
+ - Report output: print to terminal and export a result folder named `result` by default
19
+ - LLM access: user selects provider and supplies their own API key
20
+ - Terminal UX: ASCII-art opening intro with version, modern prompts, progress bars, and tasteful emoji or ASCII icons
21
+
22
+ ## Core analysis direction
23
+ The first useful analysis set should stay concrete and explainable:
24
+ - DSM generation from the dependency graph
25
+ - coupling analysis such as fan-in, fan-out, and shared-dependency pressure
26
+ - cycle and strongly connected component detection
27
+ - centrality and bridge-node analysis to identify architectural choke points
28
+ - LLM-based interpretation that turns graph evidence into architecture findings and recommendations
29
+
30
+ ## Graphs generated in v0
31
+ ArchMind now builds several graph views from the same repository scan:
32
+ - `dependency_graph`: module and external dependency relationships
33
+ - `architecture_graph`: repository, package, and module boundary structure
34
+ - `data_flow_graph`: inferred reads, writes, emits, and external data interactions
35
+ - `interface_graph`: public interfaces, entrypoints, and their consumers
36
+ - `function_graph`: function-level call relationships across modules and classes
37
+ - `operational_risk_graph`: inferred observability and security capability coverage
38
+
39
+ The issue-inspection rules in [knowledge/graph_catalog.json](/Volumes/1TB/Personal_projects/ArchMind/knowledge/graph_catalog.json) map each architecture issue to the graph views most relevant to that inspection.
40
+
41
+ PDF graph exports use graph-aware layouts through `networkx` and `matplotlib`. Very large graphs are sampled down to the most structurally important nodes so the exported PDF remains readable.
42
+
43
+ ## Language support
44
+ - Supported repository languages: Python and Java
45
+ - Other repository languages are not supported yet and may produce sparse or empty graph artifacts
46
+
47
+ ## Default technical direction
48
+ - Python 3.11+ for the REPL, ingestion, graph processing, evaluation, and report generation
49
+ - PyTorch plus PyTorch Geometric (PyG) for graph encoding, transforms, and GNNs
50
+ - LiteLLM for provider abstraction across OpenAI, Anthropic, and Gemini
51
+ - `torch_geometric.data.HeteroData` as the default graph container
52
+ - Typed schemas for durable contracts
53
+ - JSON, JSONL, Markdown, and trusted tensor artifacts as the primary interchange formats
54
+
55
+ ## Intended CLI shape
56
+ ```bash
57
+ archmind [<github_url>] [--branch main] [--output result] [--llm-provider openai]
58
+ ```
59
+
60
+ If a repository URL, branch, output folder, LLM provider, or API key is not provided at startup, the REPL should ask for it interactively.
61
+
62
+ ## How to run
63
+ Use Python 3.11+.
64
+
65
+ ### Setup with `uv`
66
+ Create a virtual environment:
67
+
68
+ ```bash
69
+ uv venv
70
+ ```
71
+
72
+ Activate it:
73
+
74
+ ```bash
75
+ source .venv/bin/activate
76
+ ```
77
+
78
+ Install runtime dependencies and the package:
79
+
80
+ ```bash
81
+ uv pip install -r requirements.txt
82
+ uv pip install -e .
83
+ ```
84
+
85
+ ### Setup with `pip`
86
+ Create a virtual environment:
87
+
88
+ ```bash
89
+ python3 -m venv .venv
90
+ source .venv/bin/activate
91
+ ```
92
+
93
+ Install runtime dependencies and the package:
94
+
95
+ ```bash
96
+ python3 -m pip install -r requirements.txt
97
+ python3 -m pip install -e .
98
+ ```
99
+
100
+ ### Start the program
101
+ Launch the REPL:
102
+
103
+ ```bash
104
+ archmind
105
+ ```
106
+
107
+ Launch with startup parameters:
108
+
109
+ ```bash
110
+ archmind https://github.com/example/project --branch main --output result --llm-provider openai
111
+ ```
112
+
113
+ Run it without installing the console script:
114
+
115
+ ```bash
116
+ PYTHONPATH=src python3 -m archmind
117
+ ```
118
+
119
+ ### Run tests
120
+ Install test tooling if needed:
121
+
122
+ ```bash
123
+ python3 -m pip install pytest
124
+ ```
125
+
126
+ Then run:
127
+
128
+ ```bash
129
+ python3 -m pytest
130
+ ```
131
+
132
+ ## Result output structure
133
+ The user-facing export target is a folder, not a single file.
134
+
135
+ Default exported folder:
136
+
137
+ ```text
138
+ result/
139
+ result.md
140
+ dependency_graph.pdf
141
+ architecture_graph.pdf
142
+ data_flow_graph.pdf
143
+ interface_graph.pdf
144
+ function_graph.pdf
145
+ operational_risk_graph.pdf
146
+ dependency_graph_metrics.json
147
+ architecture_graph_metrics.json
148
+ data_flow_graph_metrics.json
149
+ interface_graph_metrics.json
150
+ function_graph_metrics.json
151
+ operational_risk_graph_metrics.json
152
+ dependency_graph_dsm.csv
153
+ issue_summary.json
154
+ issue_assessments.json
155
+ ```
156
+
157
+ Workspace artifacts remain under `workspaces/<run_id>/` and include:
158
+ - graph JSON files under `graph/`
159
+ - PyG payloads per graph
160
+ - PDFs per graph under `graph/`
161
+ - per-graph metrics and findings under `analysis/`
162
+ - per-issue inspection outputs under `analysis/issues/`
163
+ - evaluation files and provenance metadata
164
+
165
+ ## Reading order
166
+ 1. `AGENTS.md` for repo-local coding instructions
167
+ 2. `SPEC.md` for system scope, domain contracts, and artifacts
168
+ 3. `WORKFLOW.md` for runtime policy and execution defaults
169
+ 4. `architecture.md` for module boundaries and graph flow
170
+ 5. `agent_roles.md` for role definitions and artifact ownership
171
+ 6. `data.md`, `eval.md`, and `security.md` for operational constraints
172
+
173
+ ## Repository rules
174
+ - Treat docs as the system of record. If behavior changes, update docs before or with implementation.
175
+ - Keep every stage artifact-backed: repo fetch, graph construction, analysis, explanation, report generation, evaluation, provenance.
176
+ - Prefer explicit schemas over prompt-only conventions.
177
+ - Record seeds, versions, hashes, and feature-schema changes whenever results should be reproducible.
178
+
179
+ ## Documents
180
+ - `AGENTS.md` - repo instructions for coding agents
181
+ - `SPEC.md` - system specification and domain contracts
182
+ - `agent_roles.md` - execution roles and artifact ownership
183
+ - `WORKFLOW.md` - workflow contract and runtime defaults
184
+ - `architecture.md` - module boundaries and graph-aware execution flow
185
+ - `api.md` - CLI contract and internal interfaces
186
+ - `data.md` - source ingestion, graph artifacts, and dataset handling
187
+ - `eval.md` - evaluation harness and metrics
188
+ - `security.md` - threat model and guardrails
189
+ - `roadmap.md` - milestones
190
+ - `decisions.md` - architecture decisions
191
+ - `CONTRIBUTING.md` - contribution expectations
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "archmind"
7
+ version = "0.1.0"
8
+ description = "REPL-style architecture analysis CLI for Git repositories."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = [
12
+ "rich>=13.7.0",
13
+ "litellm>=1.51.0",
14
+ "torch>=2.4.0",
15
+ "torch-geometric>=2.6.0",
16
+ "networkx>=3.3",
17
+ "matplotlib>=3.9.0",
18
+ ]
19
+
20
+ [project.scripts]
21
+ archmind = "archmind.cli:main"
22
+
23
+ [tool.setuptools]
24
+ package-dir = {"" = "src"}
25
+
26
+ [tool.setuptools.packages.find]
27
+ where = ["src"]
28
+
29
+ [tool.pytest.ini_options]
30
+ testpaths = ["tests"]
31
+ addopts = "-q"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ __all__ = ["__version__"]
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ from archmind.cli import main
2
+
3
+
4
+ if __name__ == "__main__": # pragma: no cover
5
+ raise SystemExit(main())