archlens 0.0.2

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Renato Wagner Anunciação
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ 🌎 **Language:** [English](#english) | [Português](#português)
2
+
3
+ ---
4
+
5
+ # English
6
+
7
+ # ArchLens
8
+
9
+ > Architecture health analyzer for JavaScript and TypeScript projects.
10
+
11
+ ArchLens detects structural problems that traditional code quality tools ignore.
12
+
13
+ - Dependency cycles
14
+ - Coupling hotspots
15
+ - Fan-in / Fan-out imbalance
16
+ - Structural instability
17
+ - Architecture Health Score (0–100)
18
+
19
+ > Code quality tools analyze lines.
20
+ > **ArchLens analyzes structure.**
21
+
22
+ ---
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ Run directly with npx:
27
+
28
+ ```bash
29
+ npx archlens analyze .
30
+ ```
31
+
32
+ Or install globally:
33
+
34
+ ```bash
35
+ npm install -g archlens
36
+ archlens analyze .
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 📊 Example Output
42
+
43
+ ```
44
+ ✅ ArchLens analysis complete
45
+ Project: my-app
46
+ Files analyzed: 124
47
+ Edges: 312
48
+
49
+ Architecture Health Score: 78/100 (B)
50
+ Status: Warning
51
+
52
+ Top Fan-in (critical modules):
53
+ - 8 in | 1 out | src/domain/core.ts
54
+
55
+ Top Fan-out (unstable modules):
56
+ - 1 in | 12 out | src/app/controller.ts
57
+
58
+ Danger (coupling hotspots):
59
+ - 6 in | 7 out | src/services/userService.ts
60
+
61
+ Cycles detected: 1
62
+ - cycle-1: A.ts -> B.ts -> C.ts -> A.ts
63
+ ```
64
+
65
+ ---
66
+
67
+ ## 🧮 Architecture Health Score
68
+
69
+ ArchLens starts at **100** and applies penalties for:
70
+
71
+ - Circular dependencies
72
+ - High coupling density
73
+ - Excessive fan-out modules
74
+
75
+ | Score | Status |
76
+ |--------|----------|
77
+ | 80–100 | Healthy |
78
+ | 60–79 | Warning |
79
+ | 0–59 | Critical |
80
+
81
+ ---
82
+
83
+ ## 🧩 Under the Hood
84
+
85
+ ArchLens performs static structural analysis:
86
+
87
+ 1. Collects project files (TS/JS)
88
+ 2. Extracts imports via AST parsing (Babel)
89
+ 3. Builds a directed dependency graph
90
+ 4. Detects cycles using Tarjan’s Algorithm (SCC)
91
+ 5. Computes structural metrics:
92
+ - `fanIn`
93
+ - `fanOut`
94
+ - `instability = fanOut / (fanIn + fanOut)`
95
+ - `dangerScore = fanIn × fanOut`
96
+ 6. Generates an Architecture Health Score
97
+
98
+ **Cycle detection complexity:** `O(V + E)`
99
+
100
+ ---
101
+
102
+ ## 📌 Why ArchLens?
103
+
104
+ Most tools measure:
105
+
106
+ - Code style
107
+ - Lint rules
108
+ - Test coverage
109
+
110
+ ArchLens measures:
111
+
112
+ - Structural integrity
113
+ - Architectural risk
114
+ - Coupling dynamics
115
+ - Long-term maintainability
116
+
117
+ ---
118
+
119
+ ## 📜 License
120
+
121
+ MIT
122
+
123
+ ---
124
+
125
+ # Português
126
+
127
+ # ArchLens
128
+
129
+ > Analisador de saúde arquitetural para projetos JavaScript e TypeScript.
130
+
131
+ O ArchLens detecta problemas estruturais que ferramentas tradicionais de qualidade de código não enxergam.
132
+
133
+ - Ciclos de dependência
134
+ - Pontos de alto acoplamento
135
+ - Desequilíbrio de fan-in / fan-out
136
+ - Instabilidade estrutural
137
+ - Score de saúde arquitetural (0–100)
138
+
139
+ > Ferramentas de qualidade analisam linhas.
140
+ > **O ArchLens analisa a estrutura.**
141
+
142
+ ---
143
+
144
+ ## 🚀 Início Rápido
145
+
146
+ Execute diretamente com npx:
147
+
148
+ ```bash
149
+ npx archlens analyze .
150
+ ```
151
+
152
+ Ou instale globalmente:
153
+
154
+ ```bash
155
+ npm install -g archlens
156
+ archlens analyze .
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 📊 Exemplo de Saída
162
+
163
+ ```
164
+ ✅ Análise concluída
165
+ Projeto: meu-app
166
+ Arquivos analisados: 124
167
+ Dependências: 312
168
+
169
+ Score de Saúde Arquitetural: 78/100 (B)
170
+ Status: Atenção
171
+
172
+ Top Fan-in (módulos críticos):
173
+ - 8 in | 1 out | src/domain/core.ts
174
+
175
+ Top Fan-out (módulos instáveis):
176
+ - 1 in | 12 out | src/app/controller.ts
177
+
178
+ Pontos de alto acoplamento:
179
+ - 6 in | 7 out | src/services/userService.ts
180
+
181
+ Ciclos detectados: 1
182
+ - cycle-1: A.ts -> B.ts -> C.ts -> A.ts
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 🧮 Score de Saúde Arquitetural
188
+
189
+ O ArchLens inicia em **100** e aplica penalidades para:
190
+
191
+ - Dependências circulares
192
+ - Alto acoplamento
193
+ - Módulos com fan-out excessivo
194
+
195
+ | Score | Status |
196
+ |--------|----------|
197
+ | 80–100 | Saudável |
198
+ | 60–79 | Atenção |
199
+ | 0–59 | Crítico |
200
+
201
+ ---
202
+
203
+ ## 🧩 Como Funciona
204
+
205
+ O ArchLens realiza análise estrutural estática:
206
+
207
+ 1. Varre arquivos TS/JS
208
+ 2. Extrai imports via parsing de AST (Babel)
209
+ 3. Constrói um grafo direcionado de dependências
210
+ 4. Detecta ciclos com o algoritmo de Tarjan (SCC)
211
+ 5. Calcula métricas estruturais:
212
+ - `fanIn`
213
+ - `fanOut`
214
+ - `instabilidade = fanOut / (fanIn + fanOut)`
215
+ - `dangerScore = fanIn × fanOut`
216
+ 6. Gera o Score de Saúde Arquitetural
217
+
218
+ **Complexidade para detecção de ciclos:** `O(V + E)`
219
+
220
+ ---
221
+
222
+ ## 📜 Licença
223
+
224
+ MIT
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "archlens",
3
+ "private": false,
4
+ "license": "MIT",
5
+ "workspaces": [
6
+ "packages/*"
7
+ ],
8
+ "scripts": {
9
+ "build": "npm -ws run build",
10
+ "dev": "npm -ws run dev",
11
+ "lint": "npm -ws run lint"
12
+ },
13
+ "devDependencies": {
14
+ "@types/node": "^25.3.0"
15
+ },
16
+ "keywords": [
17
+ "architecture",
18
+ "static-analysis",
19
+ "dependency-graph",
20
+ "typescript",
21
+ "code-quality",
22
+ "cli"
23
+ ],
24
+ "version": "0.0.2"
25
+ }
@@ -0,0 +1,224 @@
1
+ 🌎 **Language:** [English](#english) | [Português](#português)
2
+
3
+ ---
4
+
5
+ # English
6
+
7
+ # ArchLens
8
+
9
+ > Architecture health analyzer for JavaScript and TypeScript projects.
10
+
11
+ ArchLens detects structural problems that traditional code quality tools ignore.
12
+
13
+ - Dependency cycles
14
+ - Coupling hotspots
15
+ - Fan-in / Fan-out imbalance
16
+ - Structural instability
17
+ - Architecture Health Score (0–100)
18
+
19
+ > Code quality tools analyze lines.
20
+ > **ArchLens analyzes structure.**
21
+
22
+ ---
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ Run directly with npx:
27
+
28
+ ```bash
29
+ npx archlens analyze .
30
+ ```
31
+
32
+ Or install globally:
33
+
34
+ ```bash
35
+ npm install -g archlens
36
+ archlens analyze .
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 📊 Example Output
42
+
43
+ ```
44
+ ✅ ArchLens analysis complete
45
+ Project: my-app
46
+ Files analyzed: 124
47
+ Edges: 312
48
+
49
+ Architecture Health Score: 78/100 (B)
50
+ Status: Warning
51
+
52
+ Top Fan-in (critical modules):
53
+ - 8 in | 1 out | src/domain/core.ts
54
+
55
+ Top Fan-out (unstable modules):
56
+ - 1 in | 12 out | src/app/controller.ts
57
+
58
+ Danger (coupling hotspots):
59
+ - 6 in | 7 out | src/services/userService.ts
60
+
61
+ Cycles detected: 1
62
+ - cycle-1: A.ts -> B.ts -> C.ts -> A.ts
63
+ ```
64
+
65
+ ---
66
+
67
+ ## 🧮 Architecture Health Score
68
+
69
+ ArchLens starts at **100** and applies penalties for:
70
+
71
+ - Circular dependencies
72
+ - High coupling density
73
+ - Excessive fan-out modules
74
+
75
+ | Score | Status |
76
+ |--------|----------|
77
+ | 80–100 | Healthy |
78
+ | 60–79 | Warning |
79
+ | 0–59 | Critical |
80
+
81
+ ---
82
+
83
+ ## 🧩 Under the Hood
84
+
85
+ ArchLens performs static structural analysis:
86
+
87
+ 1. Collects project files (TS/JS)
88
+ 2. Extracts imports via AST parsing (Babel)
89
+ 3. Builds a directed dependency graph
90
+ 4. Detects cycles using Tarjan’s Algorithm (SCC)
91
+ 5. Computes structural metrics:
92
+ - `fanIn`
93
+ - `fanOut`
94
+ - `instability = fanOut / (fanIn + fanOut)`
95
+ - `dangerScore = fanIn × fanOut`
96
+ 6. Generates an Architecture Health Score
97
+
98
+ **Cycle detection complexity:** `O(V + E)`
99
+
100
+ ---
101
+
102
+ ## 📌 Why ArchLens?
103
+
104
+ Most tools measure:
105
+
106
+ - Code style
107
+ - Lint rules
108
+ - Test coverage
109
+
110
+ ArchLens measures:
111
+
112
+ - Structural integrity
113
+ - Architectural risk
114
+ - Coupling dynamics
115
+ - Long-term maintainability
116
+
117
+ ---
118
+
119
+ ## 📜 License
120
+
121
+ MIT
122
+
123
+ ---
124
+
125
+ # Português
126
+
127
+ # ArchLens
128
+
129
+ > Analisador de saúde arquitetural para projetos JavaScript e TypeScript.
130
+
131
+ O ArchLens detecta problemas estruturais que ferramentas tradicionais de qualidade de código não enxergam.
132
+
133
+ - Ciclos de dependência
134
+ - Pontos de alto acoplamento
135
+ - Desequilíbrio de fan-in / fan-out
136
+ - Instabilidade estrutural
137
+ - Score de saúde arquitetural (0–100)
138
+
139
+ > Ferramentas de qualidade analisam linhas.
140
+ > **O ArchLens analisa a estrutura.**
141
+
142
+ ---
143
+
144
+ ## 🚀 Início Rápido
145
+
146
+ Execute diretamente com npx:
147
+
148
+ ```bash
149
+ npx archlens analyze .
150
+ ```
151
+
152
+ Ou instale globalmente:
153
+
154
+ ```bash
155
+ npm install -g archlens
156
+ archlens analyze .
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 📊 Exemplo de Saída
162
+
163
+ ```
164
+ ✅ Análise concluída
165
+ Projeto: meu-app
166
+ Arquivos analisados: 124
167
+ Dependências: 312
168
+
169
+ Score de Saúde Arquitetural: 78/100 (B)
170
+ Status: Atenção
171
+
172
+ Top Fan-in (módulos críticos):
173
+ - 8 in | 1 out | src/domain/core.ts
174
+
175
+ Top Fan-out (módulos instáveis):
176
+ - 1 in | 12 out | src/app/controller.ts
177
+
178
+ Pontos de alto acoplamento:
179
+ - 6 in | 7 out | src/services/userService.ts
180
+
181
+ Ciclos detectados: 1
182
+ - cycle-1: A.ts -> B.ts -> C.ts -> A.ts
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 🧮 Score de Saúde Arquitetural
188
+
189
+ O ArchLens inicia em **100** e aplica penalidades para:
190
+
191
+ - Dependências circulares
192
+ - Alto acoplamento
193
+ - Módulos com fan-out excessivo
194
+
195
+ | Score | Status |
196
+ |--------|----------|
197
+ | 80–100 | Saudável |
198
+ | 60–79 | Atenção |
199
+ | 0–59 | Crítico |
200
+
201
+ ---
202
+
203
+ ## 🧩 Como Funciona
204
+
205
+ O ArchLens realiza análise estrutural estática:
206
+
207
+ 1. Varre arquivos TS/JS
208
+ 2. Extrai imports via parsing de AST (Babel)
209
+ 3. Constrói um grafo direcionado de dependências
210
+ 4. Detecta ciclos com o algoritmo de Tarjan (SCC)
211
+ 5. Calcula métricas estruturais:
212
+ - `fanIn`
213
+ - `fanOut`
214
+ - `instabilidade = fanOut / (fanIn + fanOut)`
215
+ - `dangerScore = fanIn × fanOut`
216
+ 6. Gera o Score de Saúde Arquitetural
217
+
218
+ **Complexidade para detecção de ciclos:** `O(V + E)`
219
+
220
+ ---
221
+
222
+ ## 📜 Licença
223
+
224
+ MIT