docstodev 1.0.0

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 (42) hide show
  1. package/.env +1 -0
  2. package/dist/ai/analyzer.d.ts +3 -0
  3. package/dist/ai/analyzer.d.ts.map +1 -0
  4. package/dist/ai/analyzer.js +42 -0
  5. package/dist/ai/analyzer.js.map +1 -0
  6. package/dist/cli/index.d.ts +3 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +59 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/commands/classify.d.ts +2 -0
  11. package/dist/commands/classify.d.ts.map +1 -0
  12. package/dist/commands/classify.js +37 -0
  13. package/dist/commands/classify.js.map +1 -0
  14. package/dist/commands/generateSummary.d.ts +5 -0
  15. package/dist/commands/generateSummary.d.ts.map +1 -0
  16. package/dist/commands/generateSummary.js +54 -0
  17. package/dist/commands/generateSummary.js.map +1 -0
  18. package/dist/commands/run.d.ts +2 -0
  19. package/dist/commands/run.d.ts.map +1 -0
  20. package/dist/commands/run.js +142 -0
  21. package/dist/commands/run.js.map +1 -0
  22. package/dist/exporters/html.d.ts +2 -0
  23. package/dist/exporters/html.d.ts.map +1 -0
  24. package/dist/exporters/html.js +148 -0
  25. package/dist/exporters/html.js.map +1 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +2 -0
  29. package/dist/index.js.map +1 -0
  30. package/docs/docs-to-dev.md +111 -0
  31. package/docs/report.html +90 -0
  32. package/docs/report.pdf +0 -0
  33. package/docs/summary.md +16 -0
  34. package/package.json +39 -0
  35. package/src/ai/analyzer.ts +46 -0
  36. package/src/cli/index.ts +70 -0
  37. package/src/commands/classify.ts +40 -0
  38. package/src/commands/generateSummary.ts +60 -0
  39. package/src/commands/run.ts +156 -0
  40. package/src/exporters/html.ts +142 -0
  41. package/src/index.ts +0 -0
  42. package/tsconfig.json +33 -0
@@ -0,0 +1,142 @@
1
+ // Emplacement absolu : M:\workspace\extensions\docstodev\src\exporters\html.ts
2
+ import { writeFileSync } from "node:fs";
3
+ import path from "node:path";
4
+
5
+ export function exportToHTML(docsDir: string, markdownContent: string, mermaidGraph: string, lang: "fr" | "en" = "fr") {
6
+ const lines = markdownContent.split('\n');
7
+ let htmlResult = "";
8
+ let inTable = false;
9
+
10
+ const formatText = (text: string) => {
11
+ return text
12
+ .replace(/`(.*?)`/g, '<code>$1</code>')
13
+ .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
14
+ .replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2">$1</a>');
15
+ };
16
+
17
+ lines.forEach(line => {
18
+ let processed = line.trim();
19
+
20
+ if (processed.startsWith('|')) {
21
+ if (!inTable) { htmlResult += '<div class="table-container"><table>'; inTable = true; }
22
+ if (processed.includes('---')) 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;
27
+ } else if (inTable) { htmlResult += '</table></div>'; inTable = false; }
28
+
29
+ if (processed.includes('├─') || processed.includes('└─') || processed.includes('│')) {
30
+ const treeLine = line
31
+ .replace(/├─/g, '<span class="branch">├─</span>')
32
+ .replace(/└─/g, '<span class="branch">└─</span>')
33
+ .replace(/│/g, '<span class="pipe">│</span>');
34
+ htmlResult += `<div class="tree-line">${formatText(treeLine)}</div>`;
35
+ return;
36
+ }
37
+
38
+ if (processed.startsWith('# ')) {
39
+ htmlResult += `<h1>${processed.replace('# ', '')}</h1>`;
40
+ } else if (processed.startsWith('## ')) {
41
+ htmlResult += `<h2>${processed.replace('## ', '')}</h2>`;
42
+ } else if (processed.startsWith('### ')) {
43
+ if (htmlResult.includes('</section>')) htmlResult += '</section>';
44
+ htmlResult += `<section class="component-card"><h3 class="comp-title">${formatText(processed.replace('### ', ''))}</h3>`;
45
+ } else if (processed.startsWith('•') || processed.startsWith('- ') || processed.startsWith('* ')) {
46
+ htmlResult += `<div class="list-item">${formatText(processed.replace(/^[\-\*•]\s+/, ''))}</div>`;
47
+ } else if (processed.length > 0) {
48
+ htmlResult += `<p>${formatText(processed)}</p>`;
49
+ }
50
+ });
51
+
52
+ if (htmlResult.includes('<section')) htmlResult += '</section>';
53
+
54
+ const html = `<!DOCTYPE html>
55
+ <html lang="${lang}" data-theme="dark">
56
+ <head>
57
+ <meta charset="UTF-8">
58
+ <title>DocsToDev | Rapport Technique</title>
59
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&family=Fira+Code:wght@400&display=swap" rel="stylesheet">
60
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
61
+ <style>
62
+ :root[data-theme="dark"] {
63
+ --bg: #0d1117; --card: #161b22; --text: #c9d1d9; --text-dim: #8b949e;
64
+ --accent: #58a6ff; --border: #30363d; --code-bg: rgba(110, 118, 129, 0.2);
65
+ --code-text: #ff7b72; --h-color: #f0f6fc;
66
+ }
67
+ :root[data-theme="light"] {
68
+ --bg: #ffffff; --card: #f8f9fa; --text: #24292f; --text-dim: #57606a;
69
+ --accent: #0969da; --border: #d0d7de; --code-bg: #afb8c133;
70
+ --code-text: #cf222e; --h-color: #1b1f24;
71
+ }
72
+
73
+ 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; }
74
+ .container { max-width: 1100px; margin: auto; }
75
+
76
+ .controls { position: sticky; top: 10px; display: flex; gap: 1rem; margin-bottom: 2rem; z-index: 100; }
77
+ #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); }
78
+ .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; }
79
+ .pdf-btn { background: #238636; color: white; border: none; }
80
+
81
+ h1 { font-weight: 500; font-size: 2.2rem; color: var(--accent); letter-spacing: -1px; }
82
+ h2 { font-weight: 400; color: var(--h-color); border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-top: 3.5rem; }
83
+
84
+ .mermaid { background: var(--card); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border); margin: 1.5rem 0; overflow: auto; }
85
+ .component-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
86
+ .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; }
87
+
88
+ .tree-line { font-family: 'Fira Code', monospace; font-size: 0.85rem; color: var(--text-dim); white-space: pre; line-height: 1.4; }
89
+ .branch { color: var(--accent); opacity: 0.7; }
90
+
91
+ .table-container { margin: 1.5rem 0; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
92
+ table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
93
+ 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); }
94
+ td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
95
+
96
+ 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; }
97
+ a { color: var(--accent); text-decoration: none; }
98
+ .list-item { margin-bottom: 8px; }
99
+ .list-item::before { content: "•"; color: var(--accent); margin-right: 12px; font-weight: bold; }
100
+
101
+ @media print { .controls { display: none; } body { padding: 0; } .container { max-width: 100%; border: none; } }
102
+ </style>
103
+ </head>
104
+ <body>
105
+ <div class="container">
106
+ <div class="controls">
107
+ <input type="text" id="search" placeholder="Rechercher par nom, rôle, technologie...">
108
+ <button class="btn pdf-btn" onclick="window.print()">📥 Imprimer / PDF</button>
109
+ <button class="btn" onclick="toggleTheme()">🌓 Theme</button>
110
+ </div>
111
+
112
+ <h2>📊 Graphe des Dépendances</h2>
113
+ <div class="mermaid">
114
+ graph TD
115
+ ${mermaidGraph || "A[Projet] --> B[Initialisation]"}
116
+ </div>
117
+
118
+ <div id="content-area">${htmlResult}</div>
119
+ </div>
120
+
121
+ <script>
122
+ mermaid.initialize({ startOnLoad: true, theme: 'dark', securityLevel: 'loose' });
123
+ function toggleTheme() {
124
+ const html = document.documentElement;
125
+ const next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
126
+ html.setAttribute('data-theme', next);
127
+ localStorage.setItem('docs-theme', next);
128
+ }
129
+ document.documentElement.setAttribute('data-theme', localStorage.getItem('docs-theme') || 'dark');
130
+
131
+ document.getElementById('search').addEventListener('input', (e) => {
132
+ const term = e.target.value.toLowerCase();
133
+ document.querySelectorAll('.component-card, .tree-line, .table-container').forEach(el => {
134
+ el.style.display = el.innerText.toLowerCase().includes(term) ? '' : 'none';
135
+ });
136
+ });
137
+ </script>
138
+ </body>
139
+ </html>`;
140
+
141
+ writeFileSync(path.join(docsDir, "report.html"), html);
142
+ }
package/src/index.ts ADDED
File without changes
package/tsconfig.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* File Layout */
4
+ "rootDir": "./src", // Source du code
5
+ "outDir": "./dist", // Destination de la compilation (crucial pour le bin du package.json)
6
+
7
+ /* Environment Settings */
8
+ "module": "nodenext",
9
+ "moduleResolution": "nodenext",
10
+ "target": "esnext",
11
+ "types": ["node"],
12
+
13
+ /* Other Outputs */
14
+ "sourceMap": true,
15
+ "declaration": true,
16
+ "declarationMap": true,
17
+
18
+ /* Stricter Typechecking Options */
19
+ "noUncheckedIndexedAccess": true,
20
+ "exactOptionalPropertyTypes": true,
21
+
22
+ /* Recommended Options */
23
+ "strict": true,
24
+ "jsx": "react-jsx",
25
+ "verbatimModuleSyntax": true,
26
+ "isolatedModules": true,
27
+ "noUncheckedSideEffectImports": true,
28
+ "moduleDetection": "force",
29
+ "skipLibCheck": true
30
+ },
31
+ "include": ["src/**/*"],
32
+ "exclude": ["node_modules", "dist", "docs"]
33
+ }