docstodev 1.0.2 → 1.0.3

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 (39) hide show
  1. package/package.json +1 -1
  2. package/src/ai/analyzer.ts +3 -1
  3. package/src/analyzers/languageAnalyzer.ts +297 -5
  4. package/src/commands/generateSummary.ts +129 -39
  5. package/src/exporters/html.ts +134 -52
  6. package/.env +0 -1
  7. package/dist/ai/analyzer.d.ts +0 -3
  8. package/dist/ai/analyzer.d.ts.map +0 -1
  9. package/dist/ai/analyzer.js +0 -43
  10. package/dist/ai/analyzer.js.map +0 -1
  11. package/dist/analyzers/languageAnalyzer.d.ts +0 -18
  12. package/dist/analyzers/languageAnalyzer.d.ts.map +0 -1
  13. package/dist/analyzers/languageAnalyzer.js +0 -251
  14. package/dist/analyzers/languageAnalyzer.js.map +0 -1
  15. package/dist/cache/cacheManager.d.ts +0 -38
  16. package/dist/cache/cacheManager.d.ts.map +0 -1
  17. package/dist/cache/cacheManager.js +0 -141
  18. package/dist/cache/cacheManager.js.map +0 -1
  19. package/dist/cli/index.d.ts +0 -3
  20. package/dist/cli/index.d.ts.map +0 -1
  21. package/dist/cli/index.js +0 -316
  22. package/dist/cli/index.js.map +0 -1
  23. package/dist/commands/classify.d.ts +0 -2
  24. package/dist/commands/classify.d.ts.map +0 -1
  25. package/dist/commands/classify.js +0 -37
  26. package/dist/commands/classify.js.map +0 -1
  27. package/dist/commands/generateSummary.d.ts +0 -5
  28. package/dist/commands/generateSummary.d.ts.map +0 -1
  29. package/dist/commands/generateSummary.js +0 -54
  30. package/dist/commands/generateSummary.js.map +0 -1
  31. package/dist/commands/run.d.ts +0 -5
  32. package/dist/commands/run.d.ts.map +0 -1
  33. package/dist/commands/run.js +0 -326
  34. package/dist/commands/run.js.map +0 -1
  35. package/dist/exporters/html.d.ts +0 -6
  36. package/dist/exporters/html.d.ts.map +0 -1
  37. package/dist/exporters/html.js +0 -517
  38. package/dist/exporters/html.js.map +0 -1
  39. package/src/commands/classify.ts +0 -40
@@ -1,517 +0,0 @@
1
- import { writeFileSync } from "node:fs";
2
- import path from "node:path";
3
- export function exportToHTML(docsDir, markdownContent, mermaidGraph, lang = "fr", fileTree) {
4
- const lines = markdownContent.split("\n");
5
- let htmlResult = "";
6
- let inTable = false;
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("|")) {
16
- if (!inTable) {
17
- htmlResult += `<div class="table-container"><table>`;
18
- inTable = true;
19
- }
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;
28
- }
29
- else if (inTable) {
30
- htmlResult += "</table></div>";
31
- inTable = false;
32
- }
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
40
- .replace(/├─/g, '<span class="branch">├─</span>')
41
- .replace(/└─/g, '<span class="branch">└─</span>')
42
- .replace(/│/g, '<span class="pipe">│</span>');
43
- if (fileMatch) {
44
- treeLine = treeLine.replace(fileMatch, `<span class="file-badge">${fileMatch}</span>`);
45
- }
46
- htmlResult += `<div class="tree-line">${formatText(treeLine)}</div>`;
47
- continue;
48
- }
49
- /* ================= HEADERS ================= */
50
- if (processed.startsWith("# ")) {
51
- htmlResult += `<h1>${processed.slice(2)}</h1>`;
52
- }
53
- else if (processed.startsWith("## ")) {
54
- if (inSection) {
55
- htmlResult += "</section>";
56
- inSection = false;
57
- }
58
- htmlResult += `<h2>${processed.slice(3)}</h2>`;
59
- }
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;
65
- }
66
- /* ================= LISTS ================= */
67
- else if (/^[-*•]\s+/.test(processed)) {
68
- htmlResult += `<div class="list-item">${formatText(processed.replace(/^[-*•]\s+/, ""))}</div>`;
69
- }
70
- /* ================= PARAGRAPHS ================= */
71
- else if (processed.length > 0) {
72
- htmlResult += `<p>${formatText(processed)}</p>`;
73
- }
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();
81
- const html = `<!DOCTYPE html>
82
- <html lang="${lang}" data-theme="dark">
83
- <head>
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>
371
- </head>
372
-
373
- <body>
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>
391
-
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>
396
- <div class="mermaid">
397
- ${mermaidGraph || "graph TD\n Root[Projet]"}
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>
408
-
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}
413
- </div>
414
- </div>
415
-
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
- }
436
- });
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
-
472
- </body>
473
- </html>`;
474
- writeFileSync(path.join(docsDir, "report.html"), html);
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
- }
517
- //# sourceMappingURL=html.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/exporters/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,MAAM,UAAU,YAAY,CACxB,OAAe,EACf,eAAuB,EACvB,YAAoB,EACpB,OAAoB,IAAI,EACxB,QAAwB;IAExB,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE1C,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAChC,IAAI;SACC,OAAO,CAAC,UAAU,EAAE,iBAAiB,CAAC;SACtC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC;SAC/B,OAAO,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;IAE/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE9B,gDAAgD;QAChD,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,UAAU,IAAI,sCAAsC,CAAC;gBACrD,OAAO,GAAG,IAAI,CAAC;YACnB,CAAC;YACD,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,SAAS;YAExC,MAAM,KAAK,GAAG,SAAS,CAAC,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AE,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"}
@@ -1,40 +0,0 @@
1
- // Emplacement absolu : M:\workspace\extensions\docstodev\src\commands\classify.ts
2
- import path from "node:path";
3
-
4
- export function determineRole(filePath: string, content: string, lang: "fr" | "en" = "fr"): string {
5
- const fileName = path.basename(filePath).toLowerCase();
6
- const ext = path.extname(filePath);
7
-
8
- const roles = {
9
- fr: {
10
- cli: "Lanceur CLI",
11
- logic: "Logique Métier / Service",
12
- ui: "Interface Utilisateur (UI)",
13
- api: "Point d'Entrée API",
14
- config: "Configuration Système",
15
- unknown: "Inconnu"
16
- },
17
- en: {
18
- cli: "CLI Entry Point",
19
- logic: "Business Logic / Service",
20
- ui: "User Interface (UI)",
21
- api: "API Endpoint",
22
- config: "System Configuration",
23
- unknown: "Unknown"
24
- }
25
- };
26
-
27
- const t = roles[lang];
28
-
29
- if (filePath.includes("cli") || fileName === "index.ts") return t.cli;
30
-
31
- if (filePath.includes("commands") || content.includes("export function")) return t.logic;
32
-
33
- if (content.includes("react") || ext === ".tsx") return t.ui;
34
-
35
- if (content.includes("NextResponse") || filePath.includes("api/")) return t.api;
36
-
37
- if (fileName.includes("config") || ext === ".json") return t.config;
38
-
39
- return t.unknown;
40
- }