@mcptoolshop/venvkit 0.2.0 → 0.2.5

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 (69) hide show
  1. package/README.es.md +263 -0
  2. package/README.fr.md +263 -0
  3. package/README.hi.md +267 -0
  4. package/README.it.md +263 -0
  5. package/README.ja.md +263 -0
  6. package/README.md +17 -3
  7. package/README.pt-BR.md +263 -0
  8. package/README.zh.md +263 -0
  9. package/package.json +69 -58
  10. package/dist/doctorLite.d.ts +0 -75
  11. package/dist/doctorLite.d.ts.map +0 -1
  12. package/dist/doctorLite.js +0 -705
  13. package/dist/doctorLite.js.map +0 -1
  14. package/dist/doctorLite.test.d.ts +0 -2
  15. package/dist/doctorLite.test.d.ts.map +0 -1
  16. package/dist/doctorLite.test.js +0 -268
  17. package/dist/doctorLite.test.js.map +0 -1
  18. package/dist/index.d.ts +0 -6
  19. package/dist/index.d.ts.map +0 -1
  20. package/dist/index.js +0 -6
  21. package/dist/index.js.map +0 -1
  22. package/dist/integration.test.d.ts +0 -2
  23. package/dist/integration.test.d.ts.map +0 -1
  24. package/dist/integration.test.js +0 -245
  25. package/dist/integration.test.js.map +0 -1
  26. package/dist/mapRender.d.ts +0 -105
  27. package/dist/mapRender.d.ts.map +0 -1
  28. package/dist/mapRender.js +0 -718
  29. package/dist/mapRender.js.map +0 -1
  30. package/dist/mapRender.test.d.ts +0 -2
  31. package/dist/mapRender.test.d.ts.map +0 -1
  32. package/dist/mapRender.test.js +0 -571
  33. package/dist/mapRender.test.js.map +0 -1
  34. package/dist/map_cli.d.ts +0 -3
  35. package/dist/map_cli.d.ts.map +0 -1
  36. package/dist/map_cli.js +0 -278
  37. package/dist/map_cli.js.map +0 -1
  38. package/dist/map_cli.test.d.ts +0 -2
  39. package/dist/map_cli.test.d.ts.map +0 -1
  40. package/dist/map_cli.test.js +0 -276
  41. package/dist/map_cli.test.js.map +0 -1
  42. package/dist/runLog.d.ts +0 -71
  43. package/dist/runLog.d.ts.map +0 -1
  44. package/dist/runLog.js +0 -98
  45. package/dist/runLog.js.map +0 -1
  46. package/dist/runLog.test.d.ts +0 -2
  47. package/dist/runLog.test.d.ts.map +0 -1
  48. package/dist/runLog.test.js +0 -327
  49. package/dist/runLog.test.js.map +0 -1
  50. package/dist/scanEnvPaths.d.ts +0 -18
  51. package/dist/scanEnvPaths.d.ts.map +0 -1
  52. package/dist/scanEnvPaths.js +0 -174
  53. package/dist/scanEnvPaths.js.map +0 -1
  54. package/dist/scanEnvPaths.test.d.ts +0 -2
  55. package/dist/scanEnvPaths.test.d.ts.map +0 -1
  56. package/dist/scanEnvPaths.test.js +0 -250
  57. package/dist/scanEnvPaths.test.js.map +0 -1
  58. package/dist/taskCluster.d.ts +0 -62
  59. package/dist/taskCluster.d.ts.map +0 -1
  60. package/dist/taskCluster.js +0 -180
  61. package/dist/taskCluster.js.map +0 -1
  62. package/dist/taskCluster.test.d.ts +0 -2
  63. package/dist/taskCluster.test.d.ts.map +0 -1
  64. package/dist/taskCluster.test.js +0 -375
  65. package/dist/taskCluster.test.js.map +0 -1
  66. package/dist/vitest.config.d.ts +0 -3
  67. package/dist/vitest.config.d.ts.map +0 -1
  68. package/dist/vitest.config.js +0 -8
  69. package/dist/vitest.config.js.map +0 -1
package/README.es.md ADDED
@@ -0,0 +1,263 @@
1
+ <p align="center">
2
+ <a href="README.md">English</a> | <a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
3
+ </p>
4
+
5
+ <p align="center">
6
+ <img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/venvkit/readme.png" alt="venvkit" width="400">
7
+ </p>
8
+
9
+ # venvkit
10
+
11
+ > Parte de [MCP Tool Shop](https://mcptoolshop.com)
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/mcp-tool-shop-org/venvkit/actions/workflows/ci.yml"><img src="https://github.com/mcp-tool-shop-org/venvkit/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
15
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"></a>
16
+ <a href="https://mcp-tool-shop-org.github.io/venvkit/"><img src="https://img.shields.io/badge/Landing_Page-live-blue?style=flat-square" alt="Landing Page"></a>
17
+ <a href="https://www.npmjs.com/package/@mcptoolshop/venvkit"><img src="https://img.shields.io/npm/v/@mcptoolshop/venvkit?style=flat-square&color=cb3837" alt="npm version"></a>
18
+ </p>
19
+
20
+ **Herramienta de diagnóstico para entornos virtuales de Python en flujos de trabajo de aprendizaje automático para Windows.**
21
+
22
+ Analiza su sistema en busca de entornos de Python, diagnostica problemas de salud (SSL, DLL, incompatibilidades de ABI, fugas de rutas), realiza un seguimiento del historial de ejecución de tareas, detecta tareas inestables y genera un mapa del ecosistema.
23
+
24
+ ## Guía de inicio rápido en 30 segundos
25
+
26
+ ```bash
27
+ git clone https://github.com/mcp-tool-shop-org/venvkit && cd venvkit
28
+ npm install && npm run build
29
+ node dist/map_cli.js --root C:\projects --httpsProbe
30
+ # Open .venvkit/venv-map.html in your browser
31
+ ```
32
+
33
+ ## Características
34
+
35
+ - **doctorLite** - Comprobación rápida de la salud para cualquier intérprete de Python
36
+ - Verificación SSL/TLS
37
+ - Fallos al cargar DLL (común con PyTorch/CUDA)
38
+ - Incompatibilidades de ABI (ARM vs x86)
39
+ - Comprobaciones de integridad de pip
40
+ - Detección de fugas de `user-site` y `PYTHONPATH`
41
+
42
+ - **scanEnvPaths** - Descubre todos los entornos de Python en tu sistema
43
+ - Encuentra entornos venv, entornos conda, versiones pyenv, intérpretes base
44
+ - Profundidad y filtrado configurables
45
+
46
+ - **mapRender** - Visualiza tu ecosistema de Python
47
+ - Salida de gráfico en formato JSON para uso programático
48
+ - Diagramas Mermaid para documentación
49
+ - Agrupación de intérpretes base con análisis de radio de impacto
50
+ - Visualización de enrutamiento de tareas
51
+
52
+ - **runLog** - Realiza un seguimiento del historial de ejecución de tareas
53
+ - Formato JSONL de solo anexión
54
+ - Registra qué entorno ejecutó qué tarea
55
+ - Captura el éxito/fracaso con clasificación de errores
56
+
57
+ - **taskCluster** - Agrupa las ejecuciones de tareas por firma
58
+ - Detección de tareas inestables (fallos/éxitos inconsistentes)
59
+ - Detección de inestabilidad dependiente del entorno
60
+ - Identificación de puntos críticos de fallo
61
+ - Análisis de contagio (causas raíz compartidas)
62
+
63
+ ## Instalación
64
+
65
+ ```bash
66
+ npm install
67
+ npm run build
68
+ ```
69
+
70
+ ## Uso de la línea de comandos
71
+
72
+ ```bash
73
+ # Scan current directory and generate ecosystem map
74
+ node dist/map_cli.js
75
+
76
+ # Scan specific directories
77
+ node dist/map_cli.js --root C:\projects --root D:\ml-experiments
78
+
79
+ # Include task run history
80
+ node dist/map_cli.js --runlog .venvkit/runs.jsonl
81
+
82
+ # Output options
83
+ node dist/map_cli.js --out ./output --minScore 50 --strict --httpsProbe
84
+ ```
85
+
86
+ ### Opciones de la línea de comandos
87
+
88
+ | Flag | Descripción |
89
+ | ------ | ------------- |
90
+ | `--root, -r` | Directorio a analizar (se puede especificar varios) |
91
+ | `--out` | Directorio de salida (por defecto: `.venvkit`) |
92
+ | `--maxDepth` | Profundidad máxima del directorio a analizar (por defecto: 5) |
93
+ | `--strict` | Habilitar comprobaciones de modo estricto |
94
+ | `--httpsProbe` | Probar la conectividad HTTPS |
95
+ | `--minScore` | Filtrar entornos por debajo de esta puntuación de salud |
96
+ | `--concurrency` | Comprobaciones paralelas (por defecto: número de núcleos de la CPU) |
97
+ | `--runlog` | Ruta al registro de ejecución de tareas (JSONL) |
98
+ | `--no-tasks` | Omitir la visualización de tareas |
99
+
100
+ ### Salidas
101
+
102
+ | File | Descripción |
103
+ | ------ | ------------- |
104
+ | `venv-map.json` | Datos completos del gráfico (nodos, aristas, resumen) |
105
+ | `venv-map.mmd` | Código fuente del diagrama Mermaid |
106
+ | `venv-map.html` | Visor interactivo |
107
+ | `reports.json` | Informes raw de doctorLite |
108
+ | `insights.json` | Recomendaciones prácticas |
109
+
110
+ ## Uso programático
111
+
112
+ ```typescript
113
+ import { doctorLite, scanEnvPaths, mapRender, readRunLog } from 'venvkit';
114
+
115
+ // Check a specific Python
116
+ const report = await doctorLite({
117
+ pythonPath: 'C:\\project\\.venv\\Scripts\\python.exe',
118
+ requiredModules: ['torch', 'transformers'],
119
+ httpsProbe: true,
120
+ });
121
+
122
+ console.log(report.status); // 'good' | 'warn' | 'bad'
123
+ console.log(report.score); // 0-100
124
+ console.log(report.findings); // Array of issues
125
+
126
+ // Scan for all Python environments
127
+ const scan = await scanEnvPaths({
128
+ roots: ['C:\\projects'],
129
+ maxDepth: 5,
130
+ });
131
+
132
+ // Run doctorLite on all found environments
133
+ const reports = await Promise.all(
134
+ scan.pythonPaths.map(p => doctorLite({ pythonPath: p }))
135
+ );
136
+
137
+ // Load task execution history
138
+ const runs = await readRunLog('.venvkit/runs.jsonl');
139
+
140
+ // Generate ecosystem visualization
141
+ const { graph, mermaid, insights } = mapRender(reports, runs, {
142
+ taskMode: 'clustered', // 'none' | 'runs' | 'clustered'
143
+ includeHotEdgeLabels: true,
144
+ });
145
+ ```
146
+
147
+ ## Esquema del registro
148
+
149
+ Realiza un seguimiento de las ejecuciones de tareas añadiendo eventos a un archivo JSONL:
150
+
151
+ ```typescript
152
+ import { appendRunLog, newRunId } from 'venvkit';
153
+
154
+ await appendRunLog('.venvkit/runs.jsonl', {
155
+ version: '1.0',
156
+ runId: newRunId(),
157
+ at: new Date().toISOString(),
158
+ task: {
159
+ name: 'train',
160
+ command: 'python train.py --epochs 10',
161
+ requirements: { packages: ['torch', 'transformers'] },
162
+ },
163
+ selected: {
164
+ pythonPath: 'C:\\project\\.venv\\Scripts\\python.exe',
165
+ score: 95,
166
+ status: 'good',
167
+ },
168
+ outcome: {
169
+ ok: true,
170
+ exitCode: 0,
171
+ durationMs: 45000,
172
+ },
173
+ });
174
+ ```
175
+
176
+ ## Agrupación de tareas
177
+
178
+ Cuando tienes muchas ejecuciones de tareas, venvkit las agrupa por firma:
179
+
180
+ ```typescript
181
+ import { clusterRuns, isFlaky, getFailingEnvs } from 'venvkit';
182
+
183
+ const clusters = clusterRuns(runs);
184
+
185
+ for (const c of clusters) {
186
+ console.log(`${c.sig.name}: ${c.ok}/${c.runs} (${(c.successRate * 100).toFixed(0)}%)`);
187
+
188
+ if (isFlaky(c)) {
189
+ console.log(` WARNING: Flaky task!`);
190
+ const badEnvs = getFailingEnvs(c, 3);
191
+ console.log(` Failing most on: ${badEnvs.map(e => e.pythonPath).join(', ')}`);
192
+ }
193
+ }
194
+ ```
195
+
196
+ ## Esquema del gráfico
197
+
198
+ La salida de `mapRender` sigue un esquema JSON estable:
199
+
200
+ ```typescript
201
+ type GraphJSONv1 = {
202
+ version: '1.0';
203
+ generatedAt: string;
204
+ host: { os: string; arch: string; hostname: string };
205
+ summary: {
206
+ envCount: number;
207
+ baseCount: number;
208
+ taskCount: number;
209
+ healthy: number;
210
+ warning: number;
211
+ broken: number;
212
+ runsPassed: number;
213
+ runsFailed: number;
214
+ topIssues: Array<{ code: string; count: number; hint: string }>;
215
+ };
216
+ nodes: GraphNode[];
217
+ edges: GraphEdge[];
218
+ };
219
+ ```
220
+
221
+ ### Tipos de nodos
222
+
223
+ | Type | Descripción |
224
+ | ------ | ------------- |
225
+ | `base` | Intérprete de Python base (por ejemplo, `C:\Python311`) |
226
+ | `venv` | Entorno virtual |
227
+ | `task` | Firma de tarea (ejecuciones agrupadas) |
228
+
229
+ ### Tipos de aristas
230
+
231
+ | Type | Descripción |
232
+ | ------ | ------------- |
233
+ | `USES_BASE` | Relación venv → base |
234
+ | `ROUTES_TASK_TO` | Enrutamiento de tarea → entorno |
235
+ | `FAILED_RUN` | Fallo de tarea → entorno (con líneas discontinuas en Mermaid) |
236
+
237
+ ## Códigos de error
238
+
239
+ | Code | Severidad | Descripción |
240
+ | ------ | ---------- | ------------- |
241
+ | `SSL_BROKEN` | bad | El módulo SSL no se puede importar |
242
+ | `CERT_STORE_FAIL` | warn | La verificación del certificado HTTPS falla |
243
+ | `DLL_LOAD_FAIL` | bad | La carga de la DLL de la extensión nativa falla |
244
+ | `ABI_MISMATCH` | bad | Incompatibilidad binaria (ARM/x86) |
245
+ | `PIP_MISSING` | warn | pip no está disponible |
246
+ | `PIP_CHECK_FAIL` | warn | Se detectan conflictos de dependencias |
247
+ | `USER_SITE_LEAK` | warn | Los paquetes del usuario están habilitados en el entorno virtual. |
248
+ | `PYTHONPATH_INJECTED` | warn | La variable de entorno PYTHONPATH está configurada. |
249
+ | `ARCH_MISMATCH` | bad | Se está utilizando una versión de Python de 32 bits cuando se requiere una versión de 64 bits. |
250
+ | `PYVENV_CFG_INVALID` | warn | Archivo pyvenv.cfg dañado o faltante. |
251
+
252
+ ## Desarrollo
253
+
254
+ ```bash
255
+ npm install
256
+ npm run typecheck # Type check
257
+ npm run test # Run tests
258
+ npm run build # Build to dist/
259
+ ```
260
+
261
+ ## Licencia
262
+
263
+ MIT.
package/README.fr.md ADDED
@@ -0,0 +1,263 @@
1
+ <p align="center">
2
+ <a href="README.md">English</a> | <a href="README.ja.md">日本語</a> | <a href="README.zh.md">中文</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
3
+ </p>
4
+
5
+ <p align="center">
6
+ <img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/venvkit/readme.png" alt="venvkit" width="400">
7
+ </p>
8
+
9
+ # venvkit
10
+
11
+ > Fait partie de [MCP Tool Shop](https://mcptoolshop.com)
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/mcp-tool-shop-org/venvkit/actions/workflows/ci.yml"><img src="https://github.com/mcp-tool-shop-org/venvkit/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
15
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"></a>
16
+ <a href="https://mcp-tool-shop-org.github.io/venvkit/"><img src="https://img.shields.io/badge/Landing_Page-live-blue?style=flat-square" alt="Landing Page"></a>
17
+ <a href="https://www.npmjs.com/package/@mcptoolshop/venvkit"><img src="https://img.shields.io/npm/v/@mcptoolshop/venvkit?style=flat-square&color=cb3837" alt="npm version"></a>
18
+ </p>
19
+
20
+ **Outil de diagnostic pour les environnements virtuels Python, conçu pour les flux de travail d'apprentissage automatique (ML) sous Windows.**
21
+
22
+ Analyse votre système pour détecter les environnements Python, diagnostique les problèmes de santé (SSL, DLL, incompatibilités ABI, fuites de chemins), suit l'historique d'exécution des tâches, détecte les tâches instables et génère une carte de l'écosystème.
23
+
24
+ ## Démarrage rapide en 30 secondes
25
+
26
+ ```bash
27
+ git clone https://github.com/mcp-tool-shop-org/venvkit && cd venvkit
28
+ npm install && npm run build
29
+ node dist/map_cli.js --root C:\projects --httpsProbe
30
+ # Open .venvkit/venv-map.html in your browser
31
+ ```
32
+
33
+ ## Fonctionnalités
34
+
35
+ - **doctorLite** - Vérification rapide de l'état de santé de n'importe quel interpréteur Python
36
+ - Vérification SSL/TLS
37
+ - Échecs de chargement des DLL (courant avec PyTorch/CUDA)
38
+ - Incompatibilités ABI (ARM vs x86)
39
+ - Vérifications de l'intégrité de pip
40
+ - Détection des fuites de `user-site` et de `PYTHONPATH`
41
+
42
+ - **scanEnvPaths** - Découvre tous les environnements Python de votre système
43
+ - Trouve les environnements venv, conda, les versions pyenv et les interpréteurs de base.
44
+ - Profondeur et filtrage configurables.
45
+
46
+ - **mapRender** - Visualise votre écosystème Python
47
+ - Sortie JSON pour une utilisation programmatique.
48
+ - Diagrammes Mermaid pour la documentation.
49
+ - Groupement des interpréteurs de base avec analyse du rayon d'impact.
50
+ - Visualisation du routage des tâches.
51
+
52
+ - **runLog** - Suit l'historique d'exécution des tâches
53
+ - Format JSONL uniquement en ajout.
54
+ - Enregistre quel environnement a exécuté quelle tâche.
55
+ - Enregistre les succès/échecs avec la classification des erreurs.
56
+
57
+ - **taskCluster** - Regroupe les exécutions de tâches par signature
58
+ - Détection des tâches instables (échec/succès incohérents).
59
+ - Détection des instabilités dépendantes de l'environnement.
60
+ - Identification des points chauds d'échec.
61
+ - Analyse de la contagion (causes profondes partagées).
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ npm install
67
+ npm run build
68
+ ```
69
+
70
+ ## Utilisation de l'interface en ligne de commande (CLI)
71
+
72
+ ```bash
73
+ # Scan current directory and generate ecosystem map
74
+ node dist/map_cli.js
75
+
76
+ # Scan specific directories
77
+ node dist/map_cli.js --root C:\projects --root D:\ml-experiments
78
+
79
+ # Include task run history
80
+ node dist/map_cli.js --runlog .venvkit/runs.jsonl
81
+
82
+ # Output options
83
+ node dist/map_cli.js --out ./output --minScore 50 --strict --httpsProbe
84
+ ```
85
+
86
+ ### Options de l'interface en ligne de commande (CLI)
87
+
88
+ | Flag | Description |
89
+ | ------ | ------------- |
90
+ | `--root, -r` | Répertoire à analyser (peut spécifier plusieurs) |
91
+ | `--out` | Répertoire de sortie (par défaut : `.venvkit`) |
92
+ | `--maxDepth` | Profondeur maximale du répertoire à analyser (par défaut : 5) |
93
+ | `--strict` | Activer les vérifications strictes |
94
+ | `--httpsProbe` | Tester la connectivité HTTPS |
95
+ | `--minScore` | Filtrer les environnements en fonction de leur score de santé |
96
+ | `--concurrency` | Vérifications parallèles (par défaut : nombre de cœurs CPU) |
97
+ | `--runlog` | Chemin vers le fichier journal d'exécution des tâches (JSONL) |
98
+ | `--no-tasks` | Ignorer la visualisation des tâches |
99
+
100
+ ### Sorties
101
+
102
+ | File | Description |
103
+ | ------ | ------------- |
104
+ | `venv-map.json` | Données complètes du graphique (nœuds, arêtes, résumé) |
105
+ | `venv-map.mmd` | Source du diagramme Mermaid |
106
+ | `venv-map.html` | Visualiseur interactif |
107
+ | `reports.json` | Rapports doctorLite bruts |
108
+ | `insights.json` | Recommandations exploitables |
109
+
110
+ ## Utilisation programmatique
111
+
112
+ ```typescript
113
+ import { doctorLite, scanEnvPaths, mapRender, readRunLog } from 'venvkit';
114
+
115
+ // Check a specific Python
116
+ const report = await doctorLite({
117
+ pythonPath: 'C:\\project\\.venv\\Scripts\\python.exe',
118
+ requiredModules: ['torch', 'transformers'],
119
+ httpsProbe: true,
120
+ });
121
+
122
+ console.log(report.status); // 'good' | 'warn' | 'bad'
123
+ console.log(report.score); // 0-100
124
+ console.log(report.findings); // Array of issues
125
+
126
+ // Scan for all Python environments
127
+ const scan = await scanEnvPaths({
128
+ roots: ['C:\\projects'],
129
+ maxDepth: 5,
130
+ });
131
+
132
+ // Run doctorLite on all found environments
133
+ const reports = await Promise.all(
134
+ scan.pythonPaths.map(p => doctorLite({ pythonPath: p }))
135
+ );
136
+
137
+ // Load task execution history
138
+ const runs = await readRunLog('.venvkit/runs.jsonl');
139
+
140
+ // Generate ecosystem visualization
141
+ const { graph, mermaid, insights } = mapRender(reports, runs, {
142
+ taskMode: 'clustered', // 'none' | 'runs' | 'clustered'
143
+ includeHotEdgeLabels: true,
144
+ });
145
+ ```
146
+
147
+ ## Schéma du journal d'exécution
148
+
149
+ Suivez les exécutions de tâches en ajoutant des événements à un fichier JSONL :
150
+
151
+ ```typescript
152
+ import { appendRunLog, newRunId } from 'venvkit';
153
+
154
+ await appendRunLog('.venvkit/runs.jsonl', {
155
+ version: '1.0',
156
+ runId: newRunId(),
157
+ at: new Date().toISOString(),
158
+ task: {
159
+ name: 'train',
160
+ command: 'python train.py --epochs 10',
161
+ requirements: { packages: ['torch', 'transformers'] },
162
+ },
163
+ selected: {
164
+ pythonPath: 'C:\\project\\.venv\\Scripts\\python.exe',
165
+ score: 95,
166
+ status: 'good',
167
+ },
168
+ outcome: {
169
+ ok: true,
170
+ exitCode: 0,
171
+ durationMs: 45000,
172
+ },
173
+ });
174
+ ```
175
+
176
+ ## Regroupement des tâches
177
+
178
+ Lorsque vous avez de nombreuses exécutions de tâches, venvkit les regroupe par signature :
179
+
180
+ ```typescript
181
+ import { clusterRuns, isFlaky, getFailingEnvs } from 'venvkit';
182
+
183
+ const clusters = clusterRuns(runs);
184
+
185
+ for (const c of clusters) {
186
+ console.log(`${c.sig.name}: ${c.ok}/${c.runs} (${(c.successRate * 100).toFixed(0)}%)`);
187
+
188
+ if (isFlaky(c)) {
189
+ console.log(` WARNING: Flaky task!`);
190
+ const badEnvs = getFailingEnvs(c, 3);
191
+ console.log(` Failing most on: ${badEnvs.map(e => e.pythonPath).join(', ')}`);
192
+ }
193
+ }
194
+ ```
195
+
196
+ ## Schéma du graphique
197
+
198
+ La sortie de `mapRender` suit un schéma JSON stable :
199
+
200
+ ```typescript
201
+ type GraphJSONv1 = {
202
+ version: '1.0';
203
+ generatedAt: string;
204
+ host: { os: string; arch: string; hostname: string };
205
+ summary: {
206
+ envCount: number;
207
+ baseCount: number;
208
+ taskCount: number;
209
+ healthy: number;
210
+ warning: number;
211
+ broken: number;
212
+ runsPassed: number;
213
+ runsFailed: number;
214
+ topIssues: Array<{ code: string; count: number; hint: string }>;
215
+ };
216
+ nodes: GraphNode[];
217
+ edges: GraphEdge[];
218
+ };
219
+ ```
220
+
221
+ ### Types de nœuds
222
+
223
+ | Type | Description |
224
+ | ------ | ------------- |
225
+ | `base` | Interpréteur Python de base (par exemple, `C:\Python311`) |
226
+ | `venv` | Environnement virtuel |
227
+ | `task` | Signature de la tâche (exécutions regroupées) |
228
+
229
+ ### Types d'arêtes
230
+
231
+ | Type | Description |
232
+ | ------ | ------------- |
233
+ | `USES_BASE` | Relation venv → base |
234
+ | `ROUTES_TASK_TO` | Routage tâche → environnement |
235
+ | `FAILED_RUN` | Échec de la tâche → environnement (pointillé dans Mermaid) |
236
+
237
+ ## Codes d'erreur
238
+
239
+ | Code | Gravité | Description |
240
+ | ------ | ---------- | ------------- |
241
+ | `SSL_BROKEN` | bad | Le module SSL ne parvient pas à s'importer |
242
+ | `CERT_STORE_FAIL` | warn | La vérification du certificat HTTPS échoue |
243
+ | `DLL_LOAD_FAIL` | bad | Le chargement de l'extension DLL native échoue |
244
+ | `ABI_MISMATCH` | bad | Incompatibilité binaire (ARM/x86) |
245
+ | `PIP_MISSING` | warn | pip n'est pas disponible |
246
+ | `PIP_CHECK_FAIL` | warn | Conflits de dépendances détectés |
247
+ | `USER_SITE_LEAK` | warn | L'installation des packages utilisateur est activée dans l'environnement virtuel. |
248
+ | `PYTHONPATH_INJECTED` | warn | La variable d'environnement PYTHONPATH est définie. |
249
+ | `ARCH_MISMATCH` | bad | Version 32 bits de Python utilisée alors qu'une version 64 bits est requise. |
250
+ | `PYVENV_CFG_INVALID` | warn | Fichier pyvenv.cfg corrompu ou manquant. |
251
+
252
+ ## Développement
253
+
254
+ ```bash
255
+ npm install
256
+ npm run typecheck # Type check
257
+ npm run test # Run tests
258
+ npm run build # Build to dist/
259
+ ```
260
+
261
+ ## Licence
262
+
263
+ MIT.