codarch 0.0.0-stage → 0.1.1

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 CodArch contributors
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 CHANGED
@@ -1,3 +1,91 @@
1
- # Temporary Holding Version
1
+ # codarch
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Mapa de arquitectura para equipos y agentes de IA. Analiza un repositorio TypeScript/JavaScript y
4
+ produce un snapshot interoperable con CodeCharta (`cc.json`), un mapa HTML autocontenido y un diff
5
+ de arquitectura para PR/CI.
6
+
7
+ ## Instalación
8
+
9
+ ```bash
10
+ npm install -g codarch
11
+ codarch --version
12
+ ```
13
+
14
+ Sin instalación global:
15
+
16
+ ```bash
17
+ npx codarch analyze .
18
+ ```
19
+
20
+ Requiere Node 22 o superior. El análisis usa `git log` para churn y autores; sin historial se puede
21
+ pasar `--no-git`.
22
+
23
+ ## Uso
24
+
25
+ ```bash
26
+ # Snapshot + mapa en .codarch/
27
+ codarch analyze .
28
+
29
+ # Elegir salida y título
30
+ codarch analyze . -o .codarch --title "Mi proyecto"
31
+
32
+ # Inspeccionar un cc.json existente (CodeCharta 1.x o 2.x)
33
+ codarch inspect mapa.cc.json --top 10
34
+
35
+ # Renderizar un cc.json sin volver a analizar
36
+ codarch render mapa.cc.json -o mapa.html --area rloc --color risk
37
+
38
+ # Comparar base y head, y bloquear el PR si hay violaciones nuevas
39
+ codarch diff base.cc.json head.cc.json -o report.json --config .codarch.yml --fail-on violations
40
+ ```
41
+
42
+ Códigos de salida de `diff`: `0` sin bloqueo, `2` política incumplida, `1` error de lectura o
43
+ configuración.
44
+
45
+ ## Lente de migración
46
+
47
+ `analyze` mide TS/JS, Rust y artefactos `.wasm`/`.node`. El snapshot incluye la lente `migration` y
48
+ las métricas `migrationDebt` (complejidad × consumidores) y `ffiCrossings`.
49
+
50
+ ```bash
51
+ codarch inspect .codarch/snapshot.cc.json --metric migrationDebt --top 10
52
+ codarch render .codarch/snapshot.cc.json --area rloc --color migrationDebt -o migration.html
53
+ ```
54
+
55
+ Rust se mide con un escáner léxico; las aristas napi no se inventan si el glue generado no está en el
56
+ fuente. Ver [`docs/migration.md`](https://github.com/jaminsmoke/codarch/blob/main/docs/migration.md).
57
+
58
+ ## Reglas
59
+
60
+ `.codarch.yml` define capas, dependencias prohibidas, umbrales y ciclos. Solo bloquean las
61
+ violaciones **introducidas** con severidad `error`, así se puede adoptar en repos con deuda previa.
62
+
63
+ ```yaml
64
+ version: 1
65
+
66
+ layers:
67
+ - name: domain
68
+ paths: [src/domain/**]
69
+ - name: infrastructure
70
+ paths: [src/infra/**]
71
+
72
+ rules:
73
+ - name: domain-no-infra
74
+ type: forbidden
75
+ from: domain
76
+ to: infrastructure
77
+ severity: error
78
+ - name: sin-ciclos
79
+ type: cycles
80
+ severity: error
81
+ ```
82
+
83
+ ## Integración
84
+
85
+ - GitHub Action repo-local: [`apps/github-action`](https://github.com/jaminsmoke/codarch/tree/main/apps/github-action).
86
+ - MCP de solo lectura para agentes: [`docs/mcp.md`](https://github.com/jaminsmoke/codarch/blob/main/docs/mcp.md).
87
+ - Modelo y formato: [`docs/model.md`](https://github.com/jaminsmoke/codarch/blob/main/docs/model.md).
88
+
89
+ ## Licencia
90
+
91
+ MIT.