docstodev 1.0.0 → 1.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.
@@ -1,148 +1,517 @@
1
- // Emplacement absolu : M:\workspace\extensions\docstodev\src\exporters\html.ts
2
1
  import { writeFileSync } from "node:fs";
3
2
  import path from "node:path";
4
- export function exportToHTML(docsDir, markdownContent, mermaidGraph, lang = "fr") {
5
- const lines = markdownContent.split('\n');
3
+ export function exportToHTML(docsDir, markdownContent, mermaidGraph, lang = "fr", fileTree) {
4
+ const lines = markdownContent.split("\n");
6
5
  let htmlResult = "";
7
6
  let inTable = false;
8
- const formatText = (text) => {
9
- return text
10
- .replace(/`(.*?)`/g, '<code>$1</code>')
11
- .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
12
- .replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2">$1</a>');
13
- };
14
- lines.forEach(line => {
15
- let processed = line.trim();
16
- if (processed.startsWith('|')) {
7
+ let inSection = false;
8
+ const formatText = (text) => text
9
+ .replace(/`(.*?)`/g, "<code>$1</code>")
10
+ .replace(/\*\*(.*?)\*\*/g, "$1")
11
+ .replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2">$1</a>');
12
+ for (const line of lines) {
13
+ const processed = line.trim();
14
+ /* ================= TABLES ================= */
15
+ if (processed.startsWith("|")) {
17
16
  if (!inTable) {
18
- htmlResult += '<div class="table-container"><table>';
17
+ htmlResult += `<div class="table-container"><table>`;
19
18
  inTable = true;
20
19
  }
21
- if (processed.includes('---'))
22
- return;
23
- const cells = processed.split('|').filter(c => c.trim() !== "");
24
- const tag = (processed.includes('Module') || processed.includes('Type')) ? 'th' : 'td';
25
- htmlResult += `<tr>${cells.map(c => `<${tag}>${formatText(c.trim())}</${tag}>`).join('')}</tr>`;
26
- return;
20
+ if (processed.includes("---"))
21
+ continue;
22
+ const cells = processed.split("|").filter(c => c.trim());
23
+ const isHeader = processed.includes("Module") || processed.includes("Type");
24
+ htmlResult += `<tr>${cells.map(c => isHeader
25
+ ? `<th>${formatText(c.trim())}</th>`
26
+ : `<td>${formatText(c.trim())}</td>`).join("")}</tr>`;
27
+ continue;
27
28
  }
28
29
  else if (inTable) {
29
- htmlResult += '</table></div>';
30
+ htmlResult += "</table></div>";
30
31
  inTable = false;
31
32
  }
32
- if (processed.includes('├─') || processed.includes('└─') || processed.includes('│')) {
33
- const treeLine = line
33
+ /* ================= TREE VIEW ================= */
34
+ if (processed.match(/^[│├└─\s]+/) ||
35
+ processed.includes("/") ||
36
+ processed.match(/\.(ts|js|py|java|cs|go|rs|tsx|jsx)$/)) {
37
+ const hasFile = processed.match(/\.(ts|js|py|java|cs|go|rs|tsx|jsx)$/);
38
+ const fileMatch = hasFile ? processed.match(/([\w-]+\.(ts|js|py|java|cs|go|rs|tsx|jsx))/)?.[0] : null;
39
+ let treeLine = line
34
40
  .replace(/├─/g, '<span class="branch">├─</span>')
35
41
  .replace(/└─/g, '<span class="branch">└─</span>')
36
42
  .replace(/│/g, '<span class="pipe">│</span>');
43
+ if (fileMatch) {
44
+ treeLine = treeLine.replace(fileMatch, `<span class="file-badge">${fileMatch}</span>`);
45
+ }
37
46
  htmlResult += `<div class="tree-line">${formatText(treeLine)}</div>`;
38
- return;
47
+ continue;
39
48
  }
40
- if (processed.startsWith('# ')) {
41
- htmlResult += `<h1>${processed.replace('# ', '')}</h1>`;
49
+ /* ================= HEADERS ================= */
50
+ if (processed.startsWith("# ")) {
51
+ htmlResult += `<h1>${processed.slice(2)}</h1>`;
42
52
  }
43
- else if (processed.startsWith('## ')) {
44
- htmlResult += `<h2>${processed.replace('## ', '')}</h2>`;
53
+ else if (processed.startsWith("## ")) {
54
+ if (inSection) {
55
+ htmlResult += "</section>";
56
+ inSection = false;
57
+ }
58
+ htmlResult += `<h2>${processed.slice(3)}</h2>`;
45
59
  }
46
- else if (processed.startsWith('### ')) {
47
- if (htmlResult.includes('</section>'))
48
- htmlResult += '</section>';
49
- htmlResult += `<section class="component-card"><h3 class="comp-title">${formatText(processed.replace('### ', ''))}</h3>`;
60
+ else if (processed.startsWith("### ")) {
61
+ if (inSection)
62
+ htmlResult += "</section>";
63
+ htmlResult += `<section class="component"><h3>${formatText(processed.slice(4))}</h3>`;
64
+ inSection = true;
50
65
  }
51
- else if (processed.startsWith('•') || processed.startsWith('- ') || processed.startsWith('* ')) {
52
- htmlResult += `<div class="list-item">${formatText(processed.replace(/^[\-\*•]\s+/, ''))}</div>`;
66
+ /* ================= LISTS ================= */
67
+ else if (/^[-*•]\s+/.test(processed)) {
68
+ htmlResult += `<div class="list-item">${formatText(processed.replace(/^[-*•]\s+/, ""))}</div>`;
53
69
  }
70
+ /* ================= PARAGRAPHS ================= */
54
71
  else if (processed.length > 0) {
55
72
  htmlResult += `<p>${formatText(processed)}</p>`;
56
73
  }
57
- });
58
- if (htmlResult.includes('<section'))
59
- htmlResult += '</section>';
74
+ }
75
+ if (inSection)
76
+ htmlResult += "</section>";
77
+ // Générer la vue hiérarchique dynamiquement
78
+ const hierarchyGraph = fileTree ? generateHierarchyGraph(fileTree) : getDefaultHierarchyGraph();
79
+ // Générer le flux de données (peut être personnalisé selon les imports/exports)
80
+ const dataFlowGraph = generateDataFlowGraph();
60
81
  const html = `<!DOCTYPE html>
61
82
  <html lang="${lang}" data-theme="dark">
62
83
  <head>
63
- <meta charset="UTF-8">
64
- <title>DocsToDev | Rapport Technique</title>
65
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&family=Fira+Code:wght@400&display=swap" rel="stylesheet">
66
- <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
67
- <style>
68
- :root[data-theme="dark"] {
69
- --bg: #0d1117; --card: #161b22; --text: #c9d1d9; --text-dim: #8b949e;
70
- --accent: #58a6ff; --border: #30363d; --code-bg: rgba(110, 118, 129, 0.2);
71
- --code-text: #ff7b72; --h-color: #f0f6fc;
72
- }
73
- :root[data-theme="light"] {
74
- --bg: #ffffff; --card: #f8f9fa; --text: #24292f; --text-dim: #57606a;
75
- --accent: #0969da; --border: #d0d7de; --code-bg: #afb8c133;
76
- --code-text: #cf222e; --h-color: #1b1f24;
77
- }
78
-
79
- body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); padding: 2rem; line-height: 1.6; font-weight: 300; transition: background 0.3s; }
80
- .container { max-width: 1100px; margin: auto; }
81
-
82
- .controls { position: sticky; top: 10px; display: flex; gap: 1rem; margin-bottom: 2rem; z-index: 100; }
83
- #search { flex: 1; padding: 12px 20px; border-radius: 25px; border: 1px solid var(--border); background: var(--card); color: var(--text); outline: none; font-weight: 300; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
84
- .btn { padding: 10px 20px; border-radius: 25px; cursor: pointer; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
85
- .pdf-btn { background: #238636; color: white; border: none; }
86
-
87
- h1 { font-weight: 500; font-size: 2.2rem; color: var(--accent); letter-spacing: -1px; }
88
- h2 { font-weight: 400; color: var(--h-color); border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-top: 3.5rem; }
89
-
90
- .mermaid { background: var(--card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); margin: 1.5rem 0; overflow: auto; }
91
- .component-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
92
- .comp-title { margin: 0 0 1rem 0 !important; color: var(--accent) !important; font-weight: 400; font-size: 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: 10px !important; }
93
-
94
- .tree-line { font-family: 'Fira Code', monospace; font-size: 0.85rem; color: var(--text-dim); white-space: pre; line-height: 1.4; }
95
- .branch { color: var(--accent); opacity: 0.7; }
96
-
97
- .table-container { margin: 1.5rem 0; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
98
- table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
99
- th { background: rgba(88, 166, 255, 0.05); color: var(--accent); font-weight: 500; text-align: left; padding: 12px; border-bottom: 1px solid var(--border); }
100
- td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
101
-
102
- code { font-family: 'Fira Code', monospace; background: var(--code-bg); color: var(--code-text); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; font-weight: 400; }
103
- a { color: var(--accent); text-decoration: none; }
104
- .list-item { margin-bottom: 8px; }
105
- .list-item::before { content: "•"; color: var(--accent); margin-right: 12px; font-weight: bold; }
106
-
107
- @media print { .controls { display: none; } body { padding: 0; } .container { max-width: 100%; border: none; } }
108
- </style>
84
+ <meta charset="UTF-8">
85
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
86
+ <title>DocsToDev Rapport Technique</title>
87
+
88
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400&family=Fira+Code&display=swap" rel="stylesheet">
89
+ <script defer src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
90
+
91
+ <style>
92
+ :root[data-theme="dark"] {
93
+ --bg: #0d1117;
94
+ --card: #161b22;
95
+ --text: #c9d1d9;
96
+ --muted: #8b949e;
97
+ --border: #30363d;
98
+ --accent: #58a6ff;
99
+ --code-bg: #1f2428;
100
+ --file-badge-bg: rgba(248, 81, 73, 0.15);
101
+ --file-badge-text: #f85149;
102
+ }
103
+
104
+ :root[data-theme="light"] {
105
+ --bg: #ffffff;
106
+ --card: #f6f8fa;
107
+ --text: #24292f;
108
+ --muted: #57606a;
109
+ --border: #d0d7de;
110
+ --accent: #0969da;
111
+ --code-bg: #eaeef2;
112
+ --file-badge-bg: rgba(218, 54, 51, 0.15);
113
+ --file-badge-text: #da3633;
114
+ }
115
+
116
+ * {
117
+ margin: 0;
118
+ padding: 0;
119
+ box-sizing: border-box;
120
+ }
121
+
122
+ body {
123
+ font-family: Inter, sans-serif;
124
+ background: var(--bg);
125
+ color: var(--text);
126
+ line-height: 1.6;
127
+ }
128
+
129
+ .container {
130
+ max-width: 1400px;
131
+ margin: 0 auto;
132
+ padding: 2rem;
133
+ }
134
+
135
+ .controls {
136
+ position: sticky;
137
+ top: 0;
138
+ background: var(--bg);
139
+ padding: 1rem 0;
140
+ display: flex;
141
+ gap: 0.75rem;
142
+ z-index: 100;
143
+ border-bottom: 1px solid var(--border);
144
+ margin-bottom: 2rem;
145
+ }
146
+
147
+ #search {
148
+ flex: 1;
149
+ padding: 0.6rem 1rem;
150
+ border: 1px solid var(--border);
151
+ background: var(--card);
152
+ color: var(--text);
153
+ font-size: 0.95rem;
154
+ font-family: Inter, sans-serif;
155
+ transition: border-color 0.2s;
156
+ }
157
+
158
+ #search:focus {
159
+ outline: none;
160
+ border-color: var(--accent);
161
+ }
162
+
163
+ button {
164
+ padding: 0.6rem 1.2rem;
165
+ border: 1px solid var(--border);
166
+ background: var(--card);
167
+ color: var(--text);
168
+ cursor: pointer;
169
+ font-size: 0.95rem;
170
+ font-family: Inter, sans-serif;
171
+ transition: all 0.2s;
172
+ display: flex;
173
+ align-items: center;
174
+ gap: 0.5rem;
175
+ }
176
+
177
+ button:hover {
178
+ background: var(--border);
179
+ }
180
+
181
+ button svg {
182
+ width: 16px;
183
+ height: 16px;
184
+ }
185
+
186
+ h1 {
187
+ font-size: 2.5rem;
188
+ color: var(--accent);
189
+ margin-bottom: 3rem;
190
+ font-weight: 400;
191
+ letter-spacing: -0.02em;
192
+ }
193
+
194
+ h2 {
195
+ font-size: 1.5rem;
196
+ margin: 3rem 0 1.5rem 0;
197
+ padding-bottom: 0.75rem;
198
+ border-bottom: 1px solid var(--border);
199
+ font-weight: 400;
200
+ color: var(--text);
201
+ }
202
+
203
+ h3 {
204
+ font-size: 1.1rem;
205
+ margin-bottom: 1rem;
206
+ color: var(--accent);
207
+ font-weight: 400;
208
+ }
209
+
210
+ .graphs-grid {
211
+ display: grid;
212
+ grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
213
+ gap: 2rem;
214
+ margin: 2rem 0;
215
+ }
216
+
217
+ .graph-container {
218
+ border: 1px solid var(--border);
219
+ background: var(--card);
220
+ padding: 1.5rem;
221
+ }
222
+
223
+ .graph-title {
224
+ font-size: 1rem;
225
+ color: var(--muted);
226
+ margin-bottom: 1rem;
227
+ text-transform: uppercase;
228
+ letter-spacing: 0.05em;
229
+ font-size: 0.85rem;
230
+ }
231
+
232
+ .component {
233
+ border: 1px solid var(--border);
234
+ background: var(--card);
235
+ padding: 1.5rem;
236
+ margin-bottom: 1.5rem;
237
+ }
238
+
239
+ .tree-line {
240
+ font-family: "Fira Code", monospace;
241
+ font-size: 0.85rem;
242
+ white-space: pre;
243
+ color: var(--muted);
244
+ line-height: 1.8;
245
+ }
246
+
247
+ .branch {
248
+ color: var(--accent);
249
+ }
250
+
251
+ .pipe {
252
+ color: var(--border);
253
+ }
254
+
255
+ .file-badge {
256
+ background: var(--file-badge-bg);
257
+ color: var(--file-badge-text);
258
+ padding: 0.15rem 0.5rem;
259
+ font-size: 0.8rem;
260
+ font-family: "Fira Code", monospace;
261
+ display: inline-block;
262
+ margin-left: 0.25rem;
263
+ }
264
+
265
+ .table-container {
266
+ border: 1px solid var(--border);
267
+ margin: 1.5rem 0;
268
+ overflow-x: auto;
269
+ background: var(--card);
270
+ }
271
+
272
+ table {
273
+ width: 100%;
274
+ border-collapse: collapse;
275
+ font-size: 0.9rem;
276
+ }
277
+
278
+ th, td {
279
+ border-bottom: 1px solid var(--border);
280
+ padding: 0.75rem 1rem;
281
+ text-align: left;
282
+ }
283
+
284
+ th {
285
+ background: var(--bg);
286
+ color: var(--muted);
287
+ text-transform: uppercase;
288
+ font-size: 0.8rem;
289
+ letter-spacing: 0.05em;
290
+ font-weight: 400;
291
+ }
292
+
293
+ tr:last-child td {
294
+ border-bottom: none;
295
+ }
296
+
297
+ code {
298
+ font-family: "Fira Code", monospace;
299
+ background: var(--code-bg);
300
+ padding: 0.2rem 0.4rem;
301
+ font-size: 0.9em;
302
+ color: var(--accent);
303
+ }
304
+
305
+ .list-item {
306
+ margin-bottom: 0.5rem;
307
+ padding-left: 1.5rem;
308
+ position: relative;
309
+ }
310
+
311
+ .list-item::before {
312
+ content: "";
313
+ position: absolute;
314
+ left: 0.5rem;
315
+ top: 0.7rem;
316
+ width: 4px;
317
+ height: 4px;
318
+ background: var(--accent);
319
+ }
320
+
321
+ p {
322
+ margin-bottom: 1rem;
323
+ color: var(--muted);
324
+ }
325
+
326
+ a {
327
+ color: var(--accent);
328
+ text-decoration: none;
329
+ }
330
+
331
+ a:hover {
332
+ text-decoration: underline;
333
+ }
334
+
335
+ mark {
336
+ background: #ffd33d;
337
+ color: #000;
338
+ padding: 0.1rem 0.3rem;
339
+ }
340
+
341
+ .mermaid {
342
+ background: transparent;
343
+ overflow: auto;
344
+ }
345
+
346
+ @media print {
347
+ .controls {
348
+ display: none;
349
+ }
350
+
351
+ .container {
352
+ max-width: 100%;
353
+ padding: 0;
354
+ }
355
+
356
+ .component {
357
+ page-break-inside: avoid;
358
+ }
359
+ }
360
+
361
+ @media (max-width: 768px) {
362
+ .graphs-grid {
363
+ grid-template-columns: 1fr;
364
+ }
365
+
366
+ .controls {
367
+ flex-direction: column;
368
+ }
369
+ }
370
+ </style>
109
371
  </head>
372
+
110
373
  <body>
111
- <div class="container">
112
- <div class="controls">
113
- <input type="text" id="search" placeholder="Rechercher par nom, rôle, technologie...">
114
- <button class="btn pdf-btn" onclick="window.print()">📥 Imprimer / PDF</button>
115
- <button class="btn" onclick="toggleTheme()">🌓 Theme</button>
116
- </div>
374
+ <div class="container">
375
+
376
+ <div class="controls">
377
+ <input id="search" placeholder="${lang === 'fr' ? 'Rechercher dans la documentation...' : 'Search in documentation...'}" type="text">
378
+ <button onclick="toggleTheme()">
379
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
380
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"/>
381
+ </svg>
382
+ ${lang === 'fr' ? 'Thème' : 'Theme'}
383
+ </button>
384
+ <button onclick="window.print()">
385
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
386
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
387
+ </svg>
388
+ ${lang === 'fr' ? 'Exporter PDF' : 'Export PDF'}
389
+ </button>
390
+ </div>
117
391
 
118
- <h2>📊 Graphe des Dépendances</h2>
392
+ <h2>${lang === 'fr' ? 'Architecture du projet' : 'Project Architecture'}</h2>
393
+ <div class="graphs-grid">
394
+ <div class="graph-container">
395
+ <div class="graph-title">${lang === 'fr' ? 'Graphe des dépendances' : 'Dependency Graph'}</div>
119
396
  <div class="mermaid">
120
- graph TD
121
- ${mermaidGraph || "A[Projet] --> B[Initialisation]"}
397
+ ${mermaidGraph || "graph TD\n Root[Projet]"}
122
398
  </div>
399
+ </div>
400
+
401
+ <div class="graph-container">
402
+ <div class="graph-title">${lang === 'fr' ? 'Structure du projet' : 'Project Structure'}</div>
403
+ <div class="mermaid">
404
+ ${hierarchyGraph}
405
+ </div>
406
+ </div>
407
+ </div>
123
408
 
124
- <div id="content-area">${htmlResult}</div>
409
+ <div class="graph-container" style="margin-bottom: 3rem;">
410
+ <div class="graph-title">${lang === 'fr' ? 'Flux de données' : 'Data Flow'}</div>
411
+ <div class="mermaid">
412
+ ${dataFlowGraph}
125
413
  </div>
414
+ </div>
126
415
 
127
- <script>
128
- mermaid.initialize({ startOnLoad: true, theme: 'dark', securityLevel: 'loose' });
129
- function toggleTheme() {
130
- const html = document.documentElement;
131
- const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
132
- html.setAttribute('data-theme', next);
133
- localStorage.setItem('docs-theme', next);
134
- }
135
- document.documentElement.setAttribute('data-theme', localStorage.getItem('docs-theme') || 'dark');
136
-
137
- document.getElementById('search').addEventListener('input', (e) => {
138
- const term = e.target.value.toLowerCase();
139
- document.querySelectorAll('.component-card, .tree-line, .table-container').forEach(el => {
140
- el.style.display = el.innerText.toLowerCase().includes(term) ? '' : 'none';
141
- });
416
+ <div id="content-area">${htmlResult}</div>
417
+
418
+ </div>
419
+
420
+ <script>
421
+ document.addEventListener("DOMContentLoaded", () => {
422
+ if (window.mermaid) {
423
+ mermaid.initialize({
424
+ startOnLoad: true,
425
+ theme: document.documentElement.dataset.theme === "dark" ? "dark" : "default",
426
+ themeVariables: {
427
+ darkMode: document.documentElement.dataset.theme === "dark",
428
+ background: "transparent",
429
+ primaryColor: "#58a6ff",
430
+ primaryTextColor: "#c9d1d9",
431
+ primaryBorderColor: "#30363d",
432
+ lineColor: "#8b949e",
433
+ secondaryColor: "#161b22",
434
+ tertiaryColor: "#0d1117"
435
+ }
142
436
  });
143
- </script>
437
+ }
438
+ });
439
+
440
+ function toggleTheme() {
441
+ const root = document.documentElement;
442
+ const next = root.dataset.theme === "dark" ? "light" : "dark";
443
+ root.dataset.theme = next;
444
+ localStorage.setItem("theme", next);
445
+
446
+ if (window.mermaid) {
447
+ location.reload();
448
+ }
449
+ }
450
+
451
+ document.documentElement.dataset.theme = localStorage.getItem("theme") || "dark";
452
+
453
+ const originalHTML = document.getElementById("content-area").innerHTML;
454
+
455
+ document.getElementById("search").addEventListener("input", e => {
456
+ const term = e.target.value.trim();
457
+ const container = document.getElementById("content-area");
458
+
459
+ if (!term) {
460
+ container.innerHTML = originalHTML;
461
+ return;
462
+ }
463
+
464
+ const regex = new RegExp("(" + term.replace(/[.*+?^\\\${}()|[\\]\\\\]/g, "\\\\$&") + ")", "gi");
465
+ container.innerHTML = originalHTML.replace(regex, "<mark>$1</mark>");
466
+
467
+ const first = container.querySelector("mark");
468
+ if (first) first.scrollIntoView({ behavior: "smooth", block: "center" });
469
+ });
470
+ </script>
471
+
144
472
  </body>
145
473
  </html>`;
146
474
  writeFileSync(path.join(docsDir, "report.html"), html);
147
475
  }
476
+ function generateHierarchyGraph(tree, maxDepth = 3) {
477
+ let graph = "graph TD\n";
478
+ let nodeId = 0;
479
+ const nodeMap = new Map();
480
+ function traverse(obj, parentId, depth, prefix = "") {
481
+ if (depth > maxDepth)
482
+ return;
483
+ const entries = Object.entries(obj).slice(0, 8); // Limiter pour lisibilité
484
+ entries.forEach(([key, value]) => {
485
+ const currentId = `node${nodeId++}`;
486
+ const isFolder = value && typeof value === 'object' && Object.keys(value).length > 0;
487
+ const label = isFolder ? `${key}/` : key;
488
+ nodeMap.set(currentId, label);
489
+ graph += ` ${currentId}["${label}"]\n`;
490
+ if (parentId) {
491
+ graph += ` ${parentId} --> ${currentId}\n`;
492
+ }
493
+ if (isFolder && value) {
494
+ traverse(value, currentId, depth + 1, prefix + key + "/");
495
+ }
496
+ });
497
+ }
498
+ traverse(tree, null, 0);
499
+ return graph || getDefaultHierarchyGraph();
500
+ }
501
+ function getDefaultHierarchyGraph() {
502
+ return `graph TD
503
+ A[Root] --> B[src]
504
+ A --> C[config]
505
+ B --> D[components]
506
+ B --> E[utils]
507
+ B --> F[services]`;
508
+ }
509
+ function generateDataFlowGraph() {
510
+ return `graph LR
511
+ A[Input] --> B[Analyzer]
512
+ B --> C[Parser]
513
+ C --> D[Generator]
514
+ D --> E[Exporter]
515
+ E --> F[Output]`;
516
+ }
148
517
  //# sourceMappingURL=html.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/exporters/html.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,eAAuB,EAAE,YAAoB,EAAE,OAAoB,IAAI;IACjH,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,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MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YAEzC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YAC9B,KAAK,IAAI,OAAO,SAAS,KAAK,KAAK,MAAM,CAAC;YAE1C,IAAI,QAAQ,EAAE,CAAC;gBACX,KAAK,IAAI,OAAO,QAAQ,QAAQ,SAAS,IAAI,CAAC;YAClD,CAAC;YAED,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;gBACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;YAC9D,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxB,OAAO,KAAK,IAAI,wBAAwB,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,wBAAwB;IAC7B,OAAO;;;;;sBAKW,CAAC;AACvB,CAAC;AAED,SAAS,qBAAqB;IAC1B,OAAO;;;;;oBAKS,CAAC;AACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docstodev",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Solution d’automatisation de documentation technique intelligente avec IA",
5
5
  "type": "module",
6
6
  "main": "dist/cli/index.js",
@@ -36,4 +36,4 @@
36
36
  "globby": "^14.0.2",
37
37
  "puppeteer": "^24.1.1"
38
38
  }
39
- }
39
+ }