archilens 0.2.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.
- archilens-0.2.0/.archilens.yml +173 -0
- archilens-0.2.0/.github/workflows/archilens.yml +102 -0
- archilens-0.2.0/.github/workflows/ci.yml +60 -0
- archilens-0.2.0/.github/workflows/publish.yml +48 -0
- archilens-0.2.0/.gitignore +39 -0
- archilens-0.2.0/CHANGELOG.md +60 -0
- archilens-0.2.0/CONTRIBUTING.md +147 -0
- archilens-0.2.0/LICENSE +15 -0
- archilens-0.2.0/PKG-INFO +488 -0
- archilens-0.2.0/README.md +438 -0
- archilens-0.2.0/archilens/__init__.py +10 -0
- archilens-0.2.0/archilens/__main__.py +3 -0
- archilens-0.2.0/archilens/ai/__init__.py +441 -0
- archilens-0.2.0/archilens/analyzers/__init__.py +6 -0
- archilens-0.2.0/archilens/analyzers/dependencies.py +462 -0
- archilens-0.2.0/archilens/analyzers/diff.py +241 -0
- archilens-0.2.0/archilens/analyzers/discovery.py +233 -0
- archilens-0.2.0/archilens/analyzers/evolution.py +453 -0
- archilens-0.2.0/archilens/analyzers/git_utils.py +109 -0
- archilens-0.2.0/archilens/analyzers/treesitter.py +419 -0
- archilens-0.2.0/archilens/cli.py +476 -0
- archilens-0.2.0/archilens/config.py +224 -0
- archilens-0.2.0/archilens/engine.py +254 -0
- archilens-0.2.0/archilens/generators/__init__.py +5 -0
- archilens-0.2.0/archilens/generators/base.py +153 -0
- archilens-0.2.0/archilens/generators/d2.py +260 -0
- archilens-0.2.0/archilens/generators/mermaid.py +387 -0
- archilens-0.2.0/archilens/generators/plantuml.py +292 -0
- archilens-0.2.0/archilens/mcp/__init__.py +1 -0
- archilens-0.2.0/archilens/mcp/cache.py +87 -0
- archilens-0.2.0/archilens/mcp/server.py +434 -0
- archilens-0.2.0/archilens/models/__init__.py +225 -0
- archilens-0.2.0/archilens/utils/__init__.py +1 -0
- archilens-0.2.0/archilens/viewer/__init__.py +1 -0
- archilens-0.2.0/archilens/viewer/app.py +944 -0
- archilens-0.2.0/docs/index.html +969 -0
- archilens-0.2.0/github_action/action.yml +115 -0
- archilens-0.2.0/pyproject.toml +91 -0
- archilens-0.2.0/tests/__init__.py +0 -0
- archilens-0.2.0/tests/test_cli.py +276 -0
- archilens-0.2.0/tests/test_core.py +224 -0
- archilens-0.2.0/tests/test_coverage.py +334 -0
- archilens-0.2.0/tests/test_internals.py +509 -0
- archilens-0.2.0/tests/test_new_features.py +688 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# ArchiLens Configuration
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# This file defines how ArchiLens analyzes your repository and maps code
|
|
5
|
+
# to business capabilities. Place at the root of your repository.
|
|
6
|
+
|
|
7
|
+
# Project metadata
|
|
8
|
+
project:
|
|
9
|
+
name: "My Application"
|
|
10
|
+
description: "Order management platform"
|
|
11
|
+
type: "microservices" # monolith | microservices | modular-monolith | library
|
|
12
|
+
|
|
13
|
+
# Analysis settings
|
|
14
|
+
analysis:
|
|
15
|
+
# Languages to analyze (auto-detected if omitted)
|
|
16
|
+
languages: ["python", "typescript", "java"]
|
|
17
|
+
|
|
18
|
+
# Entry points for process flow tracing
|
|
19
|
+
entry_points:
|
|
20
|
+
- pattern: "**/*controller*.py"
|
|
21
|
+
type: "http_handler"
|
|
22
|
+
- pattern: "**/*handler*.py"
|
|
23
|
+
type: "event_handler"
|
|
24
|
+
- pattern: "**/main.py"
|
|
25
|
+
type: "application_entry"
|
|
26
|
+
- pattern: "**/routes/**/*.ts"
|
|
27
|
+
type: "http_handler"
|
|
28
|
+
|
|
29
|
+
# Directories/patterns to exclude from analysis
|
|
30
|
+
exclude:
|
|
31
|
+
- "**/node_modules/**"
|
|
32
|
+
- "**/__pycache__/**"
|
|
33
|
+
- "**/venv/**"
|
|
34
|
+
- "**/.git/**"
|
|
35
|
+
- "**/dist/**"
|
|
36
|
+
- "**/build/**"
|
|
37
|
+
- "**/*.test.*"
|
|
38
|
+
- "**/*.spec.*"
|
|
39
|
+
|
|
40
|
+
# Max depth for dependency resolution
|
|
41
|
+
max_depth: 5
|
|
42
|
+
|
|
43
|
+
# Diagram generation settings
|
|
44
|
+
diagrams:
|
|
45
|
+
# Output directory for generated diagrams
|
|
46
|
+
output_dir: ".archilens/diagrams"
|
|
47
|
+
|
|
48
|
+
# Output format: mermaid | d2 | plantuml
|
|
49
|
+
format: "mermaid"
|
|
50
|
+
|
|
51
|
+
# Diagram levels to generate
|
|
52
|
+
levels:
|
|
53
|
+
# L0: System Context - your system as a black box with external actors
|
|
54
|
+
- level: 0
|
|
55
|
+
name: "System Context"
|
|
56
|
+
enabled: true
|
|
57
|
+
|
|
58
|
+
# L1: Module/Service Overview - major components and their relationships
|
|
59
|
+
- level: 1
|
|
60
|
+
name: "Module Architecture"
|
|
61
|
+
enabled: true
|
|
62
|
+
|
|
63
|
+
# L2: Component Detail - internals of each module
|
|
64
|
+
- level: 2
|
|
65
|
+
name: "Component Detail"
|
|
66
|
+
enabled: true
|
|
67
|
+
# Which modules to drill into (all if omitted)
|
|
68
|
+
modules: []
|
|
69
|
+
|
|
70
|
+
# L3: Process Flows - runtime behavior, request lifecycles
|
|
71
|
+
- level: 3
|
|
72
|
+
name: "Process Flows"
|
|
73
|
+
enabled: true
|
|
74
|
+
# Max number of flows to generate
|
|
75
|
+
max_flows: 10
|
|
76
|
+
|
|
77
|
+
# Theme for Mermaid diagrams
|
|
78
|
+
theme: "default" # default | dark | forest | neutral
|
|
79
|
+
|
|
80
|
+
# Business capability mapping
|
|
81
|
+
# Maps code modules to business domains (DDD bounded contexts)
|
|
82
|
+
capabilities:
|
|
83
|
+
- name: "Order Management"
|
|
84
|
+
description: "Handles order lifecycle from creation to fulfillment"
|
|
85
|
+
modules:
|
|
86
|
+
- "src/orders/**"
|
|
87
|
+
- "services/order-service/**"
|
|
88
|
+
|
|
89
|
+
- name: "Payment Processing"
|
|
90
|
+
description: "Payment gateway integration and transaction management"
|
|
91
|
+
modules:
|
|
92
|
+
- "src/payments/**"
|
|
93
|
+
- "services/payment-service/**"
|
|
94
|
+
|
|
95
|
+
- name: "User Management"
|
|
96
|
+
description: "Authentication, authorization, and user profiles"
|
|
97
|
+
modules:
|
|
98
|
+
- "src/auth/**"
|
|
99
|
+
- "src/users/**"
|
|
100
|
+
|
|
101
|
+
- name: "Inventory"
|
|
102
|
+
description: "Stock tracking and warehouse management"
|
|
103
|
+
modules:
|
|
104
|
+
- "src/inventory/**"
|
|
105
|
+
|
|
106
|
+
# External systems your application interacts with
|
|
107
|
+
external_systems:
|
|
108
|
+
- name: "PostgreSQL"
|
|
109
|
+
type: "database"
|
|
110
|
+
description: "Primary data store"
|
|
111
|
+
|
|
112
|
+
- name: "Redis"
|
|
113
|
+
type: "cache"
|
|
114
|
+
description: "Session and query cache"
|
|
115
|
+
|
|
116
|
+
- name: "Stripe API"
|
|
117
|
+
type: "external_api"
|
|
118
|
+
description: "Payment processing"
|
|
119
|
+
|
|
120
|
+
- name: "SendGrid"
|
|
121
|
+
type: "external_api"
|
|
122
|
+
description: "Email notifications"
|
|
123
|
+
|
|
124
|
+
# AI configuration
|
|
125
|
+
ai:
|
|
126
|
+
# Provider: anthropic | openai | ollama | litellm
|
|
127
|
+
provider: "anthropic"
|
|
128
|
+
|
|
129
|
+
# Model to use for analysis
|
|
130
|
+
model: "claude-sonnet-4-20250514"
|
|
131
|
+
|
|
132
|
+
# What AI should help with
|
|
133
|
+
features:
|
|
134
|
+
# Infer process flows from code that static analysis can't capture
|
|
135
|
+
process_flow_inference: true
|
|
136
|
+
# Generate natural-language annotations for diagram nodes
|
|
137
|
+
node_annotations: true
|
|
138
|
+
# Suggest business capability mappings
|
|
139
|
+
capability_suggestions: true
|
|
140
|
+
# Detect architectural patterns (MVC, hexagonal, event-driven, etc.)
|
|
141
|
+
pattern_detection: true
|
|
142
|
+
# Summarize module responsibilities
|
|
143
|
+
module_summaries: true
|
|
144
|
+
|
|
145
|
+
# CI/CD integration
|
|
146
|
+
ci:
|
|
147
|
+
# Run on pull requests to detect architecture drift
|
|
148
|
+
drift_detection: true
|
|
149
|
+
|
|
150
|
+
# Comment on PRs with architecture diff
|
|
151
|
+
pr_comments: true
|
|
152
|
+
|
|
153
|
+
# Fail the build if certain rules are violated
|
|
154
|
+
rules:
|
|
155
|
+
# Disallow direct dependencies from presentation to infrastructure
|
|
156
|
+
- name: "no-layer-skip"
|
|
157
|
+
from: "src/presentation/**"
|
|
158
|
+
to: "src/infrastructure/**"
|
|
159
|
+
action: "warn" # warn | fail
|
|
160
|
+
|
|
161
|
+
# Max allowed module fan-out (number of dependencies)
|
|
162
|
+
- name: "max-fan-out"
|
|
163
|
+
threshold: 10
|
|
164
|
+
action: "warn"
|
|
165
|
+
|
|
166
|
+
# Evolution tracking
|
|
167
|
+
evolution:
|
|
168
|
+
# Track architecture changes across Git tags/releases
|
|
169
|
+
enabled: true
|
|
170
|
+
# Compare against these refs
|
|
171
|
+
baseline_refs:
|
|
172
|
+
- "main"
|
|
173
|
+
- "tags/v*"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# .github/workflows/archilens.yml
|
|
2
|
+
#
|
|
3
|
+
# ArchiLens CI/CD Integration
|
|
4
|
+
# Generates architecture diagrams on push and detects drift on PRs.
|
|
5
|
+
|
|
6
|
+
name: Architecture Analysis
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [main]
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
pull-requests: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
architecture:
|
|
20
|
+
name: ArchiLens Analysis
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0 # Full history for diff analysis
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Install ArchiLens
|
|
34
|
+
run: pip install archilens
|
|
35
|
+
|
|
36
|
+
# ── Generate diagrams on push to main ──
|
|
37
|
+
- name: Generate Architecture Diagrams
|
|
38
|
+
if: github.event_name == 'push'
|
|
39
|
+
env:
|
|
40
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
41
|
+
run: |
|
|
42
|
+
archilens analyze --repo . --output .archilens/diagrams --verbose
|
|
43
|
+
|
|
44
|
+
- name: Commit Updated Diagrams
|
|
45
|
+
if: github.event_name == 'push'
|
|
46
|
+
run: |
|
|
47
|
+
git config user.name "ArchiLens Bot"
|
|
48
|
+
git config user.email "archilens[bot]@users.noreply.github.com"
|
|
49
|
+
git add .archilens/diagrams/
|
|
50
|
+
git diff --cached --quiet || git commit -m "docs: update architecture diagrams [skip ci]"
|
|
51
|
+
git push
|
|
52
|
+
|
|
53
|
+
# ── Drift detection on PRs ──
|
|
54
|
+
- name: Architecture Drift Detection
|
|
55
|
+
if: github.event_name == 'pull_request'
|
|
56
|
+
env:
|
|
57
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
58
|
+
run: |
|
|
59
|
+
archilens diff \
|
|
60
|
+
--repo . \
|
|
61
|
+
--base origin/${{ github.base_ref }} \
|
|
62
|
+
--head HEAD \
|
|
63
|
+
> /tmp/arch-diff.md
|
|
64
|
+
|
|
65
|
+
- name: Comment PR with Architecture Changes
|
|
66
|
+
if: github.event_name == 'pull_request'
|
|
67
|
+
uses: actions/github-script@v7
|
|
68
|
+
with:
|
|
69
|
+
script: |
|
|
70
|
+
const fs = require('fs');
|
|
71
|
+
let body;
|
|
72
|
+
try {
|
|
73
|
+
body = fs.readFileSync('/tmp/arch-diff.md', 'utf8');
|
|
74
|
+
} catch {
|
|
75
|
+
body = '## 🏗️ ArchiLens\n\nNo architecture changes detected.';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const { data: comments } = await github.rest.issues.listComments({
|
|
79
|
+
owner: context.repo.owner,
|
|
80
|
+
repo: context.repo.repo,
|
|
81
|
+
issue_number: context.issue.number,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const existing = comments.find(c =>
|
|
85
|
+
c.body.includes('ArchiLens')
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (existing) {
|
|
89
|
+
await github.rest.issues.updateComment({
|
|
90
|
+
owner: context.repo.owner,
|
|
91
|
+
repo: context.repo.repo,
|
|
92
|
+
comment_id: existing.id,
|
|
93
|
+
body,
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
await github.rest.issues.createComment({
|
|
97
|
+
owner: context.repo.owner,
|
|
98
|
+
repo: context.repo.repo,
|
|
99
|
+
issue_number: context.issue.number,
|
|
100
|
+
body,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master, main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
cache: pip
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: pip install -e ".[dev,viewer]"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest tests/ -v --cov=archilens --cov-report=term-missing --cov-report=xml
|
|
32
|
+
|
|
33
|
+
- name: Upload coverage
|
|
34
|
+
uses: codecov/codecov-action@v4
|
|
35
|
+
if: matrix.python-version == '3.11'
|
|
36
|
+
with:
|
|
37
|
+
files: coverage.xml
|
|
38
|
+
fail_ci_if_error: false
|
|
39
|
+
|
|
40
|
+
lint:
|
|
41
|
+
name: Lint
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v4
|
|
45
|
+
|
|
46
|
+
- uses: actions/setup-python@v5
|
|
47
|
+
with:
|
|
48
|
+
python-version: "3.11"
|
|
49
|
+
cache: pip
|
|
50
|
+
|
|
51
|
+
- name: Install dependencies
|
|
52
|
+
run: pip install -e ".[dev]"
|
|
53
|
+
|
|
54
|
+
- name: Ruff (lint + format check)
|
|
55
|
+
run: |
|
|
56
|
+
ruff check archilens/
|
|
57
|
+
ruff format --check archilens/
|
|
58
|
+
|
|
59
|
+
- name: Mypy
|
|
60
|
+
run: mypy archilens/ --ignore-missing-imports
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write # required for trusted publishing
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Build distribution
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.11"
|
|
22
|
+
|
|
23
|
+
- name: Install build tools
|
|
24
|
+
run: pip install build
|
|
25
|
+
|
|
26
|
+
- name: Build wheel and sdist
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- name: Upload dist artifacts
|
|
30
|
+
uses: actions/upload-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
|
|
35
|
+
publish:
|
|
36
|
+
name: Publish to PyPI
|
|
37
|
+
needs: build
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
environment: pypi
|
|
40
|
+
steps:
|
|
41
|
+
- name: Download dist artifacts
|
|
42
|
+
uses: actions/download-artifact@v4
|
|
43
|
+
with:
|
|
44
|
+
name: dist
|
|
45
|
+
path: dist/
|
|
46
|
+
|
|
47
|
+
- name: Publish to PyPI
|
|
48
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.eggs/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.vscode/
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
|
|
21
|
+
# Testing
|
|
22
|
+
.coverage
|
|
23
|
+
htmlcov/
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.mypy_cache/
|
|
26
|
+
|
|
27
|
+
# ArchiLens output
|
|
28
|
+
.archilens/diagrams/
|
|
29
|
+
|
|
30
|
+
# OS
|
|
31
|
+
.DS_Store
|
|
32
|
+
Thumbs.db
|
|
33
|
+
|
|
34
|
+
# Environment
|
|
35
|
+
.env
|
|
36
|
+
.env.local
|
|
37
|
+
|
|
38
|
+
# Claude Code project settings
|
|
39
|
+
.claude/
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ArchiLens are documented here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## [0.2.0] — 2026-06-10
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **MCP server** (`archilens serve-mcp`): exposes architecture knowledge to AI coding agents
|
|
16
|
+
(Claude Code, Cursor, Copilot) via four tools: `get_module_context`,
|
|
17
|
+
`check_dependency_allowed`, `find_capability_owner`, `get_architecture_context`.
|
|
18
|
+
Supports stdio and SSE transports. Snapshot cache backed by SQLite at
|
|
19
|
+
`~/.archilens/snapshots.db` — avoids re-analysis on repeated agent sessions.
|
|
20
|
+
- **Cytoscape.js interactive graph** for L1 module architecture. Handles 500+ nodes
|
|
21
|
+
with compound capability groups, LOC-proportional node sizing, weighted edges,
|
|
22
|
+
click-to-drill to L2, hover tooltips, and selectable layout algorithms.
|
|
23
|
+
Mermaid retained for L2 class diagrams and L3 sequence diagrams.
|
|
24
|
+
- New `/api/graph/l1` endpoint returning Cytoscape-format JSON with capability parent
|
|
25
|
+
nodes, module nodes, and weighted dependency edges.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **AI module**: all three analysis functions (`infer_process_flows`,
|
|
29
|
+
`generate_module_summaries`, `detect_patterns`) now use Anthropic tool use
|
|
30
|
+
(`tool_choice={"type":"tool"}`) for deterministic structured output — no more
|
|
31
|
+
JSON fence-stripping. Non-Anthropic providers retain the text-parsing fallback.
|
|
32
|
+
- `generate_module_summaries` now runs up to 5 completions in parallel via
|
|
33
|
+
`ThreadPoolExecutor` — ~12x faster on large repos.
|
|
34
|
+
- `ArchSnapshot.version` renamed to `project_type` to correctly store
|
|
35
|
+
`monolith|library|service` instead of a version number.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
- Diff engine now emits `modified` entries for real signals: node LOC changes >20%
|
|
39
|
+
between refs, and edge weight (coupling) changes >20%.
|
|
40
|
+
Previously `0 modified` was always reported despite the field existing.
|
|
41
|
+
- Hardcoded `your-org/archilens` link in diff markdown output replaced with correct URL.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## [0.1.0] — 2026-05-17
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- Initial release
|
|
49
|
+
- Core static analysis pipeline (`archilens analyze`)
|
|
50
|
+
- L0–L3 Mermaid diagram generation
|
|
51
|
+
- AI-powered module summaries and process flow inference
|
|
52
|
+
- `archilens diff` for architecture drift detection
|
|
53
|
+
- `archilens serve` for interactive web viewer
|
|
54
|
+
- `archilens init` for config scaffolding
|
|
55
|
+
- GitHub Action composite workflow
|
|
56
|
+
- `.archilens.yml` configuration schema
|
|
57
|
+
|
|
58
|
+
[Unreleased]: https://github.com/saurabh-oss/archilens/compare/v0.2.0...HEAD
|
|
59
|
+
[0.2.0]: https://github.com/saurabh-oss/archilens/compare/v0.1.0...v0.2.0
|
|
60
|
+
[0.1.0]: https://github.com/saurabh-oss/archilens/releases/tag/v0.1.0
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Contributing to ArchiLens
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! This guide covers everything you need to get started.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Development setup](#development-setup)
|
|
8
|
+
- [Project structure](#project-structure)
|
|
9
|
+
- [Running tests](#running-tests)
|
|
10
|
+
- [Submitting changes](#submitting-changes)
|
|
11
|
+
- [Areas for contribution](#areas-for-contribution)
|
|
12
|
+
- [Code style](#code-style)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Development Setup
|
|
17
|
+
|
|
18
|
+
**Requirements**: Python 3.10+, Git
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Fork and clone
|
|
22
|
+
git clone https://github.com/<your-username>/archilens.git
|
|
23
|
+
cd archilens
|
|
24
|
+
|
|
25
|
+
# Create a virtual environment
|
|
26
|
+
python -m venv .venv
|
|
27
|
+
source .venv/bin/activate # Linux / macOS
|
|
28
|
+
# .venv\Scripts\activate # Windows
|
|
29
|
+
|
|
30
|
+
# Install in editable mode with all extras
|
|
31
|
+
pip install -e ".[dev,viewer]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Project Structure
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
archilens/
|
|
40
|
+
├── analyzers/ # AST extraction, dependency analysis, diff, evolution
|
|
41
|
+
├── generators/ # Diagram output (Mermaid, D2, PlantUML)
|
|
42
|
+
├── viewer/ # Flask interactive viewer
|
|
43
|
+
├── ai/ # LLM integration (Anthropic / OpenAI / LiteLLM)
|
|
44
|
+
├── models/ # Pydantic data models
|
|
45
|
+
├── cli.py # Click CLI entry point
|
|
46
|
+
├── config.py # YAML config loader
|
|
47
|
+
└── engine.py # Main analysis pipeline
|
|
48
|
+
tests/
|
|
49
|
+
├── test_core.py # Core engine tests
|
|
50
|
+
└── test_new_features.py # Generators, viewer, diff, evolution
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Key data flow: `config.py` → `engine.py` → `analyzers/` → `ArchSnapshot` → `generators/` → diagrams.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Running Tests
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Full suite with coverage
|
|
61
|
+
pytest tests/ -v --cov=archilens --cov-report=term-missing
|
|
62
|
+
|
|
63
|
+
# Single file
|
|
64
|
+
pytest tests/test_new_features.py -v
|
|
65
|
+
|
|
66
|
+
# Single test class or test
|
|
67
|
+
pytest tests/test_new_features.py::TestD2Generator -v
|
|
68
|
+
pytest tests/test_new_features.py::TestViewer::test_module_map_returns_sanitised_keys -v
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
All tests must pass before a PR can be merged. CI runs on Python 3.10, 3.11, and 3.12.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Submitting Changes
|
|
76
|
+
|
|
77
|
+
1. **Open an issue first** for any non-trivial change so we can discuss the approach.
|
|
78
|
+
2. Create a feature branch from `master`: `git checkout -b feat/my-feature`
|
|
79
|
+
3. Make your changes with tests.
|
|
80
|
+
4. Run the full test suite and linters locally (see [Code style](#code-style)).
|
|
81
|
+
5. Open a pull request. The CI pipeline will run automatically.
|
|
82
|
+
|
|
83
|
+
### Commit message format
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
type: short description (under 72 chars)
|
|
87
|
+
|
|
88
|
+
Optional longer explanation.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Areas for Contribution
|
|
96
|
+
|
|
97
|
+
### Language parsers
|
|
98
|
+
Add Tree-sitter support for a new language (Ruby, Rust, C#, etc.):
|
|
99
|
+
1. Add the `tree-sitter-<lang>` package to `pyproject.toml` dependencies.
|
|
100
|
+
2. Add query strings to `archilens/analyzers/treesitter.py` (`_IMPORT_QUERIES`, `_CLASS_QUERIES`, `_FUNCTION_QUERIES`).
|
|
101
|
+
3. Wire up the language in `_get_language()`.
|
|
102
|
+
4. Add tests in `TestTreeSitter`.
|
|
103
|
+
|
|
104
|
+
### Architectural pattern detection
|
|
105
|
+
Patterns are detected heuristically in `archilens/engine.py` (`_detect_patterns`).
|
|
106
|
+
Add a new pattern by extending the heuristic logic and the `ArchPattern` enum in `archilens/models/__init__.py`.
|
|
107
|
+
|
|
108
|
+
### Diagram generators
|
|
109
|
+
All generators share the `DiagramGenerator` base class in `archilens/generators/base.py`.
|
|
110
|
+
To add a new format, subclass `DiagramGenerator`, implement the four abstract methods (`system_context`, `module_architecture`, `component_detail`, `process_flow`), and register it in `get_generator()`.
|
|
111
|
+
|
|
112
|
+
### Interactive viewer improvements
|
|
113
|
+
The viewer is a self-contained Flask app in `archilens/viewer/app.py`.
|
|
114
|
+
The entire frontend is a single embedded HTML template (`_HTML_TEMPLATE`).
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Code Style
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Lint (must pass)
|
|
122
|
+
ruff check archilens/
|
|
123
|
+
|
|
124
|
+
# Format check (must pass)
|
|
125
|
+
ruff format --check archilens/
|
|
126
|
+
|
|
127
|
+
# Auto-fix formatting
|
|
128
|
+
ruff format archilens/
|
|
129
|
+
|
|
130
|
+
# Type checking (advisory — strict mode, warnings expected on some modules)
|
|
131
|
+
mypy archilens/ --ignore-missing-imports
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- Line length: 100
|
|
135
|
+
- Target: Python 3.10+
|
|
136
|
+
- No emojis in terminal output (Windows cp1252 compatibility)
|
|
137
|
+
- New public functions need a one-line docstring
|
|
138
|
+
- Comments only where the *why* is non-obvious
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Reporting Issues
|
|
143
|
+
|
|
144
|
+
Please open an issue at https://github.com/saurabh-oss/archilens/issues with:
|
|
145
|
+
- Python version and OS
|
|
146
|
+
- Full error traceback
|
|
147
|
+
- Minimal reproduction steps (ideally a small sample repo)
|
archilens-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|