botdocs 0.1.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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/bin/botdocs.js +6 -0
  4. package/dist/src/builder/chunker.d.ts +41 -0
  5. package/dist/src/builder/chunker.js +139 -0
  6. package/dist/src/builder/embedder.d.ts +26 -0
  7. package/dist/src/builder/embedder.js +75 -0
  8. package/dist/src/builder/index.d.ts +5 -0
  9. package/dist/src/builder/index.js +142 -0
  10. package/dist/src/builder/markdown-processor.d.ts +26 -0
  11. package/dist/src/builder/markdown-processor.js +161 -0
  12. package/dist/src/builder/site-generator.d.ts +24 -0
  13. package/dist/src/builder/site-generator.js +152 -0
  14. package/dist/src/builder/template-engine.d.ts +30 -0
  15. package/dist/src/builder/template-engine.js +77 -0
  16. package/dist/src/builder/vector-db-builder.d.ts +20 -0
  17. package/dist/src/builder/vector-db-builder.js +63 -0
  18. package/dist/src/cli/index.d.ts +1 -0
  19. package/dist/src/cli/index.js +47 -0
  20. package/dist/src/cli/options.d.ts +7 -0
  21. package/dist/src/cli/options.js +5 -0
  22. package/dist/src/types/config.d.ts +24 -0
  23. package/dist/src/types/config.js +16 -0
  24. package/dist/src/types/document.d.ts +20 -0
  25. package/dist/src/types/document.js +1 -0
  26. package/dist/src/types/vector-db.d.ts +21 -0
  27. package/dist/src/types/vector-db.js +1 -0
  28. package/dist-client/assets/chatbox-CmTTiB2Z.js +1 -0
  29. package/dist-client/assets/rag-engine-L2vj3Y0G.js +7 -0
  30. package/dist-client/bundle.js +1 -0
  31. package/package.json +71 -0
  32. package/src/styles/chat.css +420 -0
  33. package/src/styles/main.css +532 -0
  34. package/src/styles/themes.css +78 -0
  35. package/src/templates/doc-page.html +27 -0
  36. package/src/templates/index.html +28 -0
  37. package/src/templates/layout.html +59 -0
@@ -0,0 +1,532 @@
1
+ /* Reset and base styles */
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ :root {
9
+ /* Colors - Light theme */
10
+ --bg-primary: #ffffff;
11
+ --bg-secondary: #f8f9fa;
12
+ --bg-tertiary: #e9ecef;
13
+ --text-primary: #212529;
14
+ --text-secondary: #6c757d;
15
+ --border-color: #dee2e6;
16
+ --link-color: #3b82f6;
17
+ --link-hover: #2563eb;
18
+ --code-bg: #f8f9fa;
19
+ --sidebar-width: 280px;
20
+ --content-max-width: 800px;
21
+ }
22
+
23
+ body {
24
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
25
+ Ubuntu, Cantarell, sans-serif;
26
+ line-height: 1.6;
27
+ color: var(--text-primary);
28
+ background: var(--bg-primary);
29
+ }
30
+
31
+ /* Layout */
32
+ .layout {
33
+ display: flex;
34
+ min-height: 100vh;
35
+ }
36
+
37
+ /* Sidebar */
38
+ .sidebar {
39
+ width: var(--sidebar-width);
40
+ background: var(--bg-secondary);
41
+ border-right: 1px solid var(--border-color);
42
+ padding: 2rem;
43
+ overflow-y: auto;
44
+ position: fixed;
45
+ height: 100vh;
46
+ left: 0;
47
+ top: 0;
48
+ }
49
+
50
+ .sidebar-header {
51
+ margin-bottom: 2rem;
52
+ }
53
+
54
+ .site-title {
55
+ font-size: 1.5rem;
56
+ font-weight: 700;
57
+ color: var(--text-primary);
58
+ margin-bottom: 0.5rem;
59
+ }
60
+
61
+ .site-description {
62
+ font-size: 0.875rem;
63
+ color: var(--text-secondary);
64
+ }
65
+
66
+ .sidebar-nav {
67
+ margin-top: 1.5rem;
68
+ }
69
+
70
+ .nav-list {
71
+ list-style: none;
72
+ }
73
+
74
+ .nav-list li {
75
+ margin-bottom: 0.5rem;
76
+ }
77
+
78
+ .nav-list a {
79
+ color: var(--text-primary);
80
+ text-decoration: none;
81
+ display: block;
82
+ padding: 0.5rem 0.75rem;
83
+ border-radius: 0.375rem;
84
+ transition: background-color 0.2s;
85
+ }
86
+
87
+ .nav-list a:hover {
88
+ background: var(--bg-tertiary);
89
+ }
90
+
91
+ .nav-list a.active {
92
+ background: var(--link-color);
93
+ color: white;
94
+ font-weight: 500;
95
+ }
96
+
97
+ /* Main Content */
98
+ .main-content {
99
+ margin-left: var(--sidebar-width);
100
+ flex: 1;
101
+ padding: 3rem;
102
+ }
103
+
104
+ .content-wrapper {
105
+ max-width: var(--content-max-width);
106
+ margin: 0 auto;
107
+ }
108
+
109
+ /* Typography */
110
+ h1, h2, h3, h4, h5, h6 {
111
+ margin-top: 2rem;
112
+ margin-bottom: 1rem;
113
+ font-weight: 600;
114
+ line-height: 1.3;
115
+ color: var(--text-primary);
116
+ }
117
+
118
+ h1 {
119
+ font-size: 2.5rem;
120
+ margin-top: 0;
121
+ }
122
+
123
+ h2 {
124
+ font-size: 2rem;
125
+ padding-bottom: 0.5rem;
126
+ border-bottom: 1px solid var(--border-color);
127
+ }
128
+
129
+ h3 {
130
+ font-size: 1.5rem;
131
+ }
132
+
133
+ h4 {
134
+ font-size: 1.25rem;
135
+ }
136
+
137
+ p {
138
+ margin-bottom: 1rem;
139
+ }
140
+
141
+ a {
142
+ color: var(--link-color);
143
+ text-decoration: none;
144
+ }
145
+
146
+ a:hover {
147
+ color: var(--link-hover);
148
+ text-decoration: underline;
149
+ }
150
+
151
+ /* Code */
152
+ code {
153
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
154
+ font-size: 0.875rem;
155
+ background: var(--code-bg);
156
+ padding: 0.2rem 0.4rem;
157
+ border-radius: 0.25rem;
158
+ }
159
+
160
+ pre {
161
+ background: var(--code-bg);
162
+ padding: 1rem;
163
+ border-radius: 0.5rem;
164
+ overflow-x: auto;
165
+ margin: 1.5rem 0;
166
+ border: 1px solid var(--border-color);
167
+ }
168
+
169
+ pre code {
170
+ background: none;
171
+ padding: 0;
172
+ }
173
+
174
+ /* Blockquotes */
175
+ blockquote {
176
+ border-left: 4px solid var(--link-color);
177
+ padding-left: 1rem;
178
+ margin: 1.5rem 0;
179
+ color: var(--text-secondary);
180
+ font-style: italic;
181
+ }
182
+
183
+ /* GitHub-style Alerts/Callouts */
184
+ .markdown-alert {
185
+ padding: 1rem;
186
+ margin: 1.5rem 0;
187
+ border-left: 4px solid;
188
+ border-radius: 0.25rem;
189
+ background: var(--bg-secondary);
190
+ }
191
+
192
+ .markdown-alert-title {
193
+ font-weight: 600;
194
+ margin-bottom: 0.5rem;
195
+ display: flex;
196
+ align-items: center;
197
+ gap: 0.5rem;
198
+ }
199
+
200
+ /* Hide the GitHub SVG icons */
201
+ .markdown-alert-title svg {
202
+ display: none;
203
+ }
204
+
205
+ .markdown-alert-title::before {
206
+ font-size: 1.2rem;
207
+ }
208
+
209
+ .markdown-alert > *:last-child {
210
+ margin-bottom: 0;
211
+ }
212
+
213
+ /* Note - Blue */
214
+ .markdown-alert-note {
215
+ border-left-color: #3b82f6;
216
+ background: rgba(59, 130, 246, 0.1);
217
+ }
218
+
219
+ .markdown-alert-note .markdown-alert-title {
220
+ color: #3b82f6;
221
+ }
222
+
223
+ .markdown-alert-note .markdown-alert-title::before {
224
+ content: 'ℹ️';
225
+ }
226
+
227
+ /* Tip - Green */
228
+ .markdown-alert-tip {
229
+ border-left-color: #10b981;
230
+ background: rgba(16, 185, 129, 0.1);
231
+ }
232
+
233
+ .markdown-alert-tip .markdown-alert-title {
234
+ color: #10b981;
235
+ }
236
+
237
+ .markdown-alert-tip .markdown-alert-title::before {
238
+ content: '💡';
239
+ }
240
+
241
+ /* Important - Purple */
242
+ .markdown-alert-important {
243
+ border-left-color: #8b5cf6;
244
+ background: rgba(139, 92, 246, 0.1);
245
+ }
246
+
247
+ .markdown-alert-important .markdown-alert-title {
248
+ color: #8b5cf6;
249
+ }
250
+
251
+ .markdown-alert-important .markdown-alert-title::before {
252
+ content: '❗';
253
+ }
254
+
255
+ /* Warning - Orange */
256
+ .markdown-alert-warning {
257
+ border-left-color: #f59e0b;
258
+ background: rgba(245, 158, 11, 0.1);
259
+ }
260
+
261
+ .markdown-alert-warning .markdown-alert-title {
262
+ color: #f59e0b;
263
+ }
264
+
265
+ .markdown-alert-warning .markdown-alert-title::before {
266
+ content: '⚠️';
267
+ }
268
+
269
+ /* Caution - Red */
270
+ .markdown-alert-caution {
271
+ border-left-color: #ef4444;
272
+ background: rgba(239, 68, 68, 0.1);
273
+ }
274
+
275
+ .markdown-alert-caution .markdown-alert-title {
276
+ color: #ef4444;
277
+ }
278
+
279
+ .markdown-alert-caution .markdown-alert-title::before {
280
+ content: '🔥';
281
+ }
282
+
283
+ /* Lists */
284
+ ul, ol {
285
+ margin-left: 1.5rem;
286
+ margin-bottom: 1rem;
287
+ }
288
+
289
+ li {
290
+ margin-bottom: 0.5rem;
291
+ }
292
+
293
+ /* Task Lists */
294
+ .task-list-item {
295
+ list-style: none;
296
+ margin-left: -1.5rem;
297
+ }
298
+
299
+ .task-list-item-checkbox {
300
+ margin-right: 0.5rem;
301
+ margin-left: 0.25rem;
302
+ cursor: pointer;
303
+ }
304
+
305
+ .task-list-item-checkbox[checked] {
306
+ accent-color: var(--link-color);
307
+ }
308
+
309
+ /* Footnotes */
310
+ .footnotes {
311
+ margin-top: 3rem;
312
+ padding-top: 2rem;
313
+ border-top: 1px solid var(--border-color);
314
+ font-size: 0.875rem;
315
+ color: var(--text-secondary);
316
+ }
317
+
318
+ .footnotes-sep {
319
+ display: none;
320
+ }
321
+
322
+ .footnotes ol {
323
+ padding-left: 1.5rem;
324
+ }
325
+
326
+ .footnote-ref {
327
+ text-decoration: none;
328
+ font-weight: 600;
329
+ }
330
+
331
+ .footnote-ref a {
332
+ color: var(--link-color);
333
+ text-decoration: none;
334
+ }
335
+
336
+ .footnote-ref a:hover {
337
+ text-decoration: underline;
338
+ }
339
+
340
+ .footnote-backref {
341
+ text-decoration: none;
342
+ margin-left: 0.25rem;
343
+ }
344
+
345
+ sup.footnote-ref {
346
+ margin-left: 0.125rem;
347
+ }
348
+
349
+ /* Tables */
350
+ table {
351
+ width: 100%;
352
+ border-collapse: collapse;
353
+ margin: 1.5rem 0;
354
+ }
355
+
356
+ th, td {
357
+ padding: 0.75rem;
358
+ text-align: left;
359
+ border: 1px solid var(--border-color);
360
+ }
361
+
362
+ th {
363
+ background: var(--bg-secondary);
364
+ font-weight: 600;
365
+ }
366
+
367
+ /* Images */
368
+ img {
369
+ max-width: 100%;
370
+ height: auto;
371
+ border-radius: 0.5rem;
372
+ margin: 1rem 0;
373
+ }
374
+
375
+ /* Table of Contents */
376
+ .toc {
377
+ background: var(--bg-secondary);
378
+ padding: 1.5rem;
379
+ border-radius: 0.5rem;
380
+ margin: 2rem 0;
381
+ }
382
+
383
+ .toc ul {
384
+ margin-left: 1rem;
385
+ }
386
+
387
+ /* Theme Toggle */
388
+ .theme-toggle {
389
+ position: fixed;
390
+ top: 1rem;
391
+ right: 1rem;
392
+ width: 3rem;
393
+ height: 3rem;
394
+ border-radius: 50%;
395
+ background: var(--bg-secondary);
396
+ border: 1px solid var(--border-color);
397
+ cursor: pointer;
398
+ display: flex;
399
+ align-items: center;
400
+ justify-content: center;
401
+ transition: all 0.2s;
402
+ z-index: 100;
403
+ }
404
+
405
+ .theme-toggle:hover {
406
+ background: var(--bg-tertiary);
407
+ transform: scale(1.1);
408
+ }
409
+
410
+ .theme-icon::before {
411
+ content: '☀️';
412
+ font-size: 1.5rem;
413
+ }
414
+
415
+ [data-theme='dark'] .theme-icon::before {
416
+ content: '🌙';
417
+ }
418
+
419
+ /* Doc metadata */
420
+ .doc-meta {
421
+ color: var(--text-secondary);
422
+ font-size: 0.875rem;
423
+ margin-bottom: 2rem;
424
+ padding-bottom: 1rem;
425
+ border-bottom: 1px solid var(--border-color);
426
+ }
427
+
428
+ .doc-author {
429
+ margin-left: 1rem;
430
+ }
431
+
432
+ /* Doc navigation (prev/next) */
433
+ .doc-navigation {
434
+ display: flex;
435
+ justify-content: space-between;
436
+ margin-top: 3rem;
437
+ padding-top: 2rem;
438
+ border-top: 1px solid var(--border-color);
439
+ }
440
+
441
+ .nav-prev,
442
+ .nav-next {
443
+ padding: 0.75rem 1rem;
444
+ background: var(--bg-secondary);
445
+ border-radius: 0.5rem;
446
+ text-decoration: none;
447
+ color: var(--text-primary);
448
+ transition: background-color 0.2s;
449
+ }
450
+
451
+ .nav-prev:hover,
452
+ .nav-next:hover {
453
+ background: var(--bg-tertiary);
454
+ }
455
+
456
+ .nav-next {
457
+ margin-left: auto;
458
+ }
459
+
460
+ /* Home page */
461
+ .home-header {
462
+ text-align: center;
463
+ margin-bottom: 3rem;
464
+ }
465
+
466
+ .lead {
467
+ font-size: 1.25rem;
468
+ color: var(--text-secondary);
469
+ margin-top: 1rem;
470
+ }
471
+
472
+ .link-grid {
473
+ display: grid;
474
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
475
+ gap: 1.5rem;
476
+ margin-top: 2rem;
477
+ }
478
+
479
+ .link-card {
480
+ padding: 1.5rem;
481
+ background: var(--bg-secondary);
482
+ border-radius: 0.5rem;
483
+ border: 1px solid var(--border-color);
484
+ text-decoration: none;
485
+ transition: all 0.2s;
486
+ }
487
+
488
+ .link-card:hover {
489
+ border-color: var(--link-color);
490
+ transform: translateY(-2px);
491
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
492
+ }
493
+
494
+ .link-card h3 {
495
+ margin: 0 0 0.5rem 0;
496
+ color: var(--text-primary);
497
+ font-size: 1.25rem;
498
+ }
499
+
500
+ .link-card p {
501
+ margin: 0;
502
+ color: var(--text-secondary);
503
+ font-size: 0.875rem;
504
+ }
505
+
506
+ /* Responsive */
507
+ @media (max-width: 768px) {
508
+ .sidebar {
509
+ position: static;
510
+ width: 100%;
511
+ height: auto;
512
+ border-right: none;
513
+ border-bottom: 1px solid var(--border-color);
514
+ }
515
+
516
+ .main-content {
517
+ margin-left: 0;
518
+ padding: 1.5rem;
519
+ }
520
+
521
+ .layout {
522
+ flex-direction: column;
523
+ }
524
+
525
+ h1 {
526
+ font-size: 2rem;
527
+ }
528
+
529
+ h2 {
530
+ font-size: 1.5rem;
531
+ }
532
+ }
@@ -0,0 +1,78 @@
1
+ /* Dark theme colors */
2
+ [data-theme='dark'] {
3
+ --bg-primary: #1a1a1a;
4
+ --bg-secondary: #2d2d2d;
5
+ --bg-tertiary: #404040;
6
+ --text-primary: #e4e4e7;
7
+ --text-secondary: #a1a1aa;
8
+ --border-color: #404040;
9
+ --link-color: #60a5fa;
10
+ --link-hover: #93c5fd;
11
+ --code-bg: #2d2d2d;
12
+ }
13
+
14
+ /* Dark theme alerts */
15
+ [data-theme='dark'] .markdown-alert-note {
16
+ background: rgba(59, 130, 246, 0.15);
17
+ }
18
+
19
+ [data-theme='dark'] .markdown-alert-tip {
20
+ background: rgba(16, 185, 129, 0.15);
21
+ }
22
+
23
+ [data-theme='dark'] .markdown-alert-important {
24
+ background: rgba(139, 92, 246, 0.15);
25
+ }
26
+
27
+ [data-theme='dark'] .markdown-alert-warning {
28
+ background: rgba(245, 158, 11, 0.15);
29
+ }
30
+
31
+ [data-theme='dark'] .markdown-alert-caution {
32
+ background: rgba(239, 68, 68, 0.15);
33
+ }
34
+
35
+ /* Smooth theme transition */
36
+ * {
37
+ transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
38
+ }
39
+
40
+ /* Prevent transition on initial load */
41
+ .no-transition * {
42
+ transition: none !important;
43
+ }
44
+
45
+ /* System preference detection */
46
+ @media (prefers-color-scheme: dark) {
47
+ :root:not([data-theme='light']) {
48
+ --bg-primary: #1a1a1a;
49
+ --bg-secondary: #2d2d2d;
50
+ --bg-tertiary: #404040;
51
+ --text-primary: #e4e4e7;
52
+ --text-secondary: #a1a1aa;
53
+ --border-color: #404040;
54
+ --link-color: #60a5fa;
55
+ --link-hover: #93c5fd;
56
+ --code-bg: #2d2d2d;
57
+ }
58
+
59
+ :root:not([data-theme='light']) .markdown-alert-note {
60
+ background: rgba(59, 130, 246, 0.15);
61
+ }
62
+
63
+ :root:not([data-theme='light']) .markdown-alert-tip {
64
+ background: rgba(16, 185, 129, 0.15);
65
+ }
66
+
67
+ :root:not([data-theme='light']) .markdown-alert-important {
68
+ background: rgba(139, 92, 246, 0.15);
69
+ }
70
+
71
+ :root:not([data-theme='light']) .markdown-alert-warning {
72
+ background: rgba(245, 158, 11, 0.15);
73
+ }
74
+
75
+ :root:not([data-theme='light']) .markdown-alert-caution {
76
+ background: rgba(239, 68, 68, 0.15);
77
+ }
78
+ }
@@ -0,0 +1,27 @@
1
+ <article class="doc-page">
2
+ {{#if metadata.date}}
3
+ <div class="doc-meta">
4
+ <time datetime="{{metadata.date}}">{{metadata.date}}</time>
5
+ {{#if metadata.author}}
6
+ <span class="doc-author">by {{metadata.author}}</span>
7
+ {{/if}}
8
+ </div>
9
+ {{/if}}
10
+
11
+ <div class="doc-content">
12
+ {{html}}
13
+ </div>
14
+
15
+ <nav class="doc-navigation">
16
+ {{#if prevPage}}
17
+ <a href="{{prevPage.url}}" class="nav-prev">
18
+ ← {{prevPage.title}}
19
+ </a>
20
+ {{/if}}
21
+ {{#if nextPage}}
22
+ <a href="{{nextPage.url}}" class="nav-next">
23
+ {{nextPage.title}} →
24
+ </a>
25
+ {{/if}}
26
+ </nav>
27
+ </article>
@@ -0,0 +1,28 @@
1
+ <div class="home-page">
2
+ <header class="home-header">
3
+ <h1>{{title}}</h1>
4
+ {{#if description}}
5
+ <p class="lead">{{description}}</p>
6
+ {{/if}}
7
+ </header>
8
+
9
+ <section class="home-content">
10
+ {{html}}
11
+ </section>
12
+
13
+ {{#if pages}}
14
+ <section class="quick-links">
15
+ <h2>Documentation</h2>
16
+ <div class="link-grid">
17
+ {{#each pages}}
18
+ <a href="{{url}}" class="link-card">
19
+ <h3>{{title}}</h3>
20
+ {{#if description}}
21
+ <p>{{description}}</p>
22
+ {{/if}}
23
+ </a>
24
+ {{/each}}
25
+ </div>
26
+ </section>
27
+ {{/if}}
28
+ </div>
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="light">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="description" content="{{description}}">
7
+ <title>{{title}} - {{siteTitle}}</title>
8
+ <script>
9
+ // Apply theme immediately to prevent flash
10
+ (function() {
11
+ const savedTheme = localStorage.getItem('botdocs-theme');
12
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
13
+ const theme = savedTheme || (prefersDark ? 'dark' : 'light');
14
+ document.documentElement.setAttribute('data-theme', theme);
15
+ })();
16
+ </script>
17
+ <link rel="stylesheet" href="/assets/css/bundle.css">
18
+ </head>
19
+ <body>
20
+ <div class="layout">
21
+ <!-- Sidebar Navigation -->
22
+ <aside class="sidebar">
23
+ <div class="sidebar-header">
24
+ <h1 class="site-title">{{siteTitle}}</h1>
25
+ <p class="site-description">{{siteDescription}}</p>
26
+ </div>
27
+ <nav class="sidebar-nav">
28
+ {{navigation}}
29
+ </nav>
30
+ </aside>
31
+
32
+ <!-- Main Content -->
33
+ <main class="main-content">
34
+ <div class="content-wrapper">
35
+ {{content}}
36
+ </div>
37
+ </main>
38
+
39
+ <!-- Theme Toggle -->
40
+ <button class="theme-toggle" aria-label="Toggle dark mode">
41
+ <span class="theme-icon"></span>
42
+ </button>
43
+
44
+ {{#if chatEnabled}}
45
+ <!-- Chat Widget -->
46
+ <div class="chat-widget" id="chat-widget">
47
+ <button class="chat-toggle" id="chat-toggle" aria-label="Open chat">
48
+ <span class="chat-icon">💬</span>
49
+ </button>
50
+ <div class="chat-container" id="chat-container" style="display: none;">
51
+ <!-- Chat UI will be injected here -->
52
+ </div>
53
+ </div>
54
+ {{/if}}
55
+ </div>
56
+
57
+ <script type="module" src="/assets/js/bundle.js"></script>
58
+ </body>
59
+ </html>