@knowcode/doc-builder 1.9.30 → 1.10.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 (198) hide show
  1. package/lib/core-builder.js +164 -174
  2. package/lib/emoji-mapper.js +27 -12
  3. package/package.json +12 -2
  4. package/.claude/settings.local.json +0 -56
  5. package/CACHE-BUSTING-GUIDE.md +0 -82
  6. package/CLAUDE.md +0 -86
  7. package/CONTRIBUTING.md +0 -148
  8. package/GITHUB_SETUP.md +0 -203
  9. package/RELEASE-NOTES-1.7.5.md +0 -64
  10. package/Screenshot 2025-07-22 at 19.51.21.png +0 -0
  11. package/Screenshot 2025-07-26 at 17.06.49.png +0 -0
  12. package/add-user-clive.sql +0 -35
  13. package/add-user-lindsay-fixed.sql +0 -85
  14. package/add-user-lindsay.sql +0 -68
  15. package/add-user-pmorgan.sql +0 -35
  16. package/add-user-robbie.sql +0 -35
  17. package/add-wru-users.sql +0 -105
  18. package/debug-login.sql +0 -30
  19. package/doc-builder.config.js +0 -126
  20. package/doc-builder.config.js.backup.1753793768283 +0 -47
  21. package/doc-builder.config.js.backup.1753803964423 +0 -114
  22. package/doc-builder.config.js.backup.1753945707032 +0 -115
  23. package/doc-builder.config.js.backup.1754059241330 +0 -115
  24. package/doc-builder.config.js.backup.1754119567787 +0 -123
  25. package/doc-builder.config.js.backup.1754120048862 +0 -124
  26. package/doc-builder.config.js.backup.1754120529913 +0 -124
  27. package/doc-builder.config.js.backup.1754218469785 +0 -124
  28. package/doc-builder.config.js.backup.1754384764054 +0 -124
  29. package/doc-builder.config.js.backup.1754567425847 +0 -124
  30. package/doc-builder.config.js.backup.1754568137859 +0 -126
  31. package/doc-builder.config.js.backup.1754569388252 +0 -126
  32. package/doc-builder.config.js.backup.1754576694123 +0 -126
  33. package/doc-builder.config.js.backup.1755031374829 +0 -126
  34. package/doc-builder.config.js.backup.1755034500990 +0 -126
  35. package/doc-builder.config.js.backup.1755034809236 +0 -126
  36. package/grant-access.sql +0 -15
  37. package/html/11.png +0 -0
  38. package/html/404.html +0 -115
  39. package/html/README.html +0 -522
  40. package/html/Screenshot 2025-08-12 at 21.35.07.png +0 -0
  41. package/html/about-doc-builder.html +0 -491
  42. package/html/auth.js +0 -157
  43. package/html/claude-workflow-guide.html +0 -525
  44. package/html/css/notion-style.css +0 -2502
  45. package/html/documentation-index.html +0 -471
  46. package/html/guides/authentication-default-change.html +0 -370
  47. package/html/guides/authentication-guide.html +0 -509
  48. package/html/guides/cache-control-anti-pattern.html +0 -361
  49. package/html/guides/claude-workflow-guide.html +0 -1074
  50. package/html/guides/configuration-guide.html +0 -472
  51. package/html/guides/document-standards.html +0 -518
  52. package/html/guides/documentation-standards.html +0 -694
  53. package/html/guides/html-embedding-guide.html +0 -461
  54. package/html/guides/image-modal-guide.html +0 -515
  55. package/html/guides/next-steps-walkthrough.html +0 -638
  56. package/html/guides/phosphor-icons-guide.html +0 -584
  57. package/html/guides/private-directory-authentication-troubleshooting.html +0 -555
  58. package/html/guides/private-directory-authentication.html +0 -541
  59. package/html/guides/public-site-deployment.html +0 -431
  60. package/html/guides/search-engine-verification-guide.html +0 -542
  61. package/html/guides/seo-guide.html +0 -661
  62. package/html/guides/seo-optimization-guide.html +0 -887
  63. package/html/guides/supabase-auth-implementation-plan.html +0 -543
  64. package/html/guides/supabase-auth-integration-plan.html +0 -671
  65. package/html/guides/supabase-auth-setup-guide.html +0 -498
  66. package/html/guides/supabase-authentication-complete-guide.html +0 -866
  67. package/html/guides/troubleshooting-guide.html +0 -633
  68. package/html/guides/vercel-deployment-auth-setup.html +0 -337
  69. package/html/guides/windows-setup-guide.html +0 -859
  70. package/html/image-modal-test.html +0 -318
  71. package/html/index.html +0 -522
  72. package/html/js/auth.js +0 -157
  73. package/html/js/main.js +0 -1754
  74. package/html/launch/README.html +0 -297
  75. package/html/launch/bubble-plugin-specification.html +0 -933
  76. package/html/launch/go-to-market-strategy.html +0 -663
  77. package/html/launch/launch-announcements.html +0 -593
  78. package/html/login.html +0 -102
  79. package/html/logout.html +0 -18
  80. package/html/private/cache-control-anti-pattern.html +0 -429
  81. package/html/private/launch/README.html +0 -371
  82. package/html/private/launch/auth-cleanup-summary.html +0 -361
  83. package/html/private/launch/bubble-plugin-specification.html +0 -1007
  84. package/html/private/launch/go-to-market-strategy.html +0 -737
  85. package/html/private/launch/launch-announcements.html +0 -667
  86. package/html/private/launch/vercel-deployment-auth-setup.html +0 -417
  87. package/html/private/next-steps-walkthrough.html +0 -679
  88. package/html/private/supabase-auth-implementation-completed.html +0 -454
  89. package/html/private/supabase-auth-implementation-plan.html +0 -594
  90. package/html/private/supabase-auth-integration-plan.html +0 -704
  91. package/html/private/supabase-auth-setup-guide.html +0 -555
  92. package/html/private/test-private-doc.html +0 -302
  93. package/html/private/user-management-tooling.html +0 -601
  94. package/html/prompts/Screenshot 2025-08-02 at 08.49.55.png +0 -0
  95. package/html/prompts/beautiful-documentation-design.html +0 -784
  96. package/html/prompts/markdown-document-standards.html +0 -422
  97. package/html/prompts/project-rename-strategy-sasha-publish.html +0 -530
  98. package/html/robots.txt +0 -9
  99. package/html/sitemap.xml +0 -357
  100. package/html/test-questions/how-does-it-work%3F.html +0 -294
  101. package/html/test-questions/step-1%3A%20getting-started.html +0 -289
  102. package/html/test-questions/what-is-the-purpose.html +0 -293
  103. package/html/test-status.html +0 -281
  104. package/html/vercel-cli-setup-guide.html +0 -495
  105. package/html/vercel-first-time-setup-guide.html +0 -454
  106. package/html/vercel.json +0 -29
  107. package/html-static/11.png +0 -0
  108. package/html-static/404.html +0 -115
  109. package/html-static/README.html +0 -609
  110. package/html-static/Screenshot 2025-08-12 at 21.35.07.png +0 -0
  111. package/html-static/about-doc-builder.html +0 -578
  112. package/html-static/css/notion-style.css +0 -2502
  113. package/html-static/documentation-index.html +0 -558
  114. package/html-static/guides/authentication-default-change.html +0 -457
  115. package/html-static/guides/authentication-guide.html +0 -596
  116. package/html-static/guides/claude-workflow-guide.html +0 -1161
  117. package/html-static/guides/configuration-guide.html +0 -559
  118. package/html-static/guides/documentation-standards.html +0 -781
  119. package/html-static/guides/html-embedding-guide.html +0 -548
  120. package/html-static/guides/image-modal-guide.html +0 -602
  121. package/html-static/guides/phosphor-icons-guide.html +0 -671
  122. package/html-static/guides/private-directory-authentication-troubleshooting.html +0 -642
  123. package/html-static/guides/private-directory-authentication.html +0 -628
  124. package/html-static/guides/public-site-deployment.html +0 -518
  125. package/html-static/guides/search-engine-verification-guide.html +0 -629
  126. package/html-static/guides/seo-guide.html +0 -748
  127. package/html-static/guides/seo-optimization-guide.html +0 -974
  128. package/html-static/guides/supabase-authentication-complete-guide.html +0 -953
  129. package/html-static/guides/troubleshooting-guide.html +0 -720
  130. package/html-static/guides/windows-setup-guide.html +0 -946
  131. package/html-static/image-modal-test.html +0 -405
  132. package/html-static/index.html +0 -609
  133. package/html-static/js/main.js +0 -1754
  134. package/html-static/prompts/Screenshot 2025-08-02 at 08.49.55.png +0 -0
  135. package/html-static/prompts/beautiful-documentation-design.html +0 -871
  136. package/html-static/prompts/markdown-document-standards.html +0 -509
  137. package/html-static/prompts/project-rename-strategy-sasha-publish.html +0 -617
  138. package/html-static/robots.txt +0 -5
  139. package/html-static/sitemap.xml +0 -195
  140. package/html-static/test-questions/how-does-it-work%3F.html +0 -381
  141. package/html-static/test-questions/step-1%3A%20getting-started.html +0 -376
  142. package/html-static/test-questions/what-is-the-purpose.html +0 -380
  143. package/html-static/vercel-cli-setup-guide.html +0 -582
  144. package/html-static/vercel-first-time-setup-guide.html +0 -541
  145. package/manage-users.sql +0 -191
  146. package/migrate-to-domain-auth.sql +0 -47
  147. package/package/CACHE-BUSTING-GUIDE.md +0 -82
  148. package/package/CHANGELOG.md +0 -902
  149. package/package/README.md +0 -248
  150. package/package/assets/css/notion-style.css +0 -2211
  151. package/package/assets/js/auth.js +0 -67
  152. package/package/assets/js/main.js +0 -1565
  153. package/package/cli.js +0 -764
  154. package/package/index.js +0 -38
  155. package/package/knowcode-doc-builder-1.3.15.tgz +0 -0
  156. package/package/lib/builder.js +0 -32
  157. package/package/lib/config.js +0 -278
  158. package/package/lib/core-builder.js +0 -957
  159. package/package/lib/deploy.js +0 -497
  160. package/package/lib/dev-server.js +0 -96
  161. package/package/package.json +0 -34
  162. package/package/scripts/npx-runner.js +0 -27
  163. package/package/scripts/setup.js +0 -56
  164. package/package/test-cache-bust.sh +0 -43
  165. package/public-config.js +0 -22
  166. package/public-html/404.html +0 -115
  167. package/public-html/README.html +0 -149
  168. package/public-html/css/notion-style.css +0 -2036
  169. package/public-html/index.html +0 -149
  170. package/public-html/js/auth.js +0 -67
  171. package/public-html/js/main.js +0 -1485
  172. package/quick-test-commands.md +0 -40
  173. package/recordings/Screenshot 2025-07-24 at 18.22.01.png +0 -0
  174. package/recordings/mh-ls-22jul.txt +0 -2305
  175. package/screenshot.png +0 -0
  176. package/scripts/Screenshot 2025-07-23 at 15.39.41.png +0 -0
  177. package/setup-database-v2.sql +0 -53
  178. package/setup-database.sql +0 -41
  179. package/test-auth-config.js +0 -17
  180. package/test-cache-bust.sh +0 -43
  181. package/test-docs/README.md +0 -39
  182. package/test-html/404.html +0 -115
  183. package/test-html/README.html +0 -172
  184. package/test-html/auth.js +0 -97
  185. package/test-html/css/notion-style.css +0 -2036
  186. package/test-html/index.html +0 -172
  187. package/test-html/js/auth.js +0 -97
  188. package/test-html/js/main.js +0 -1485
  189. package/test-html/login.html +0 -102
  190. package/test-html/logout.html +0 -18
  191. package/update-domain.sql +0 -9
  192. package/user-access-view.sql +0 -49
  193. package/user-management/README.md +0 -301
  194. package/user-management/add-users.sh +0 -776
  195. package/user-management/create-user.js +0 -65
  196. package/user-management/users.txt +0 -15
  197. package/view-all-users.sql +0 -40
  198. package/wru-auth-config.js +0 -17
package/package/cli.js DELETED
@@ -1,764 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { program } = require('commander');
4
- const chalk = require('chalk');
5
- const prompts = require('prompts');
6
- const ora = require('ora');
7
- const fs = require('fs-extra');
8
- const path = require('path');
9
- const { build } = require('./lib/builder');
10
- const { startDevServer } = require('./lib/dev-server');
11
- const { deployToVercel, setupVercelProject, prepareDeployment } = require('./lib/deploy');
12
- const { loadConfig, createDefaultConfig } = require('./lib/config');
13
- const { execSync } = require('child_process');
14
-
15
- // Package info
16
- const packageJson = require('./package.json');
17
-
18
- program
19
- .name('doc-builder')
20
- .description(packageJson.description)
21
- .version(packageJson.version)
22
- .addHelpText('before', `
23
- ${chalk.cyan('🚀 @knowcode/doc-builder')} - Transform your markdown into beautiful documentation sites
24
-
25
- ${chalk.bgGreen.black(' TL;DR ')} ${chalk.green('Just run:')} ${chalk.cyan.bold('npx @knowcode/doc-builder deploy')} ${chalk.green('→ Your docs are live on Vercel!')}
26
-
27
- ${chalk.gray('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
28
-
29
- ${chalk.yellow('What it does:')}
30
- • Converts markdown files to static HTML with a beautiful Notion-inspired theme
31
- • Automatically generates navigation from your folder structure
32
- • Supports mermaid diagrams, syntax highlighting, and dark mode
33
- • Deploys to Vercel with one command (zero configuration)
34
- • ${chalk.green.bold('NEW:')} Shows help by default, use 'deploy' to publish (v1.3.0+)
35
- • Optional authentication to protect private documentation
36
-
37
- ${chalk.yellow('Requirements:')}
38
- • Node.js 14+ installed
39
- • A ${chalk.cyan('docs/')} folder with markdown files (or specify custom folder)
40
- • Vercel CLI for deployment (optional)
41
-
42
- ${chalk.yellow('Quick Start:')}
43
- ${chalk.cyan('1. Create your docs:')}
44
- ${chalk.gray('$')} mkdir docs
45
- ${chalk.gray('$')} echo "# My Documentation" > docs/README.md
46
-
47
- ${chalk.cyan('2. Build and deploy:')}
48
- ${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('# Show help and available commands')}
49
- ${chalk.gray('$')} npx @knowcode/doc-builder deploy ${chalk.gray('# Build and deploy to production')}
50
- ${chalk.gray('$')} npx @knowcode/doc-builder build ${chalk.gray('# Build HTML files only')}
51
- ${chalk.gray('$')} npx @knowcode/doc-builder dev ${chalk.gray('# Start development server')}
52
-
53
- ${chalk.yellow('No docs folder yet?')}
54
- ${chalk.gray('$')} npx @knowcode/doc-builder init --example ${chalk.gray('# Create example docs')}
55
- `);
56
-
57
- // Build command
58
- program
59
- .command('build')
60
- .description('Build the documentation site to static HTML')
61
- .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
62
- .option('-i, --input <dir>', 'input directory containing markdown files (default: docs)')
63
- .option('-o, --output <dir>', 'output directory for HTML files (default: html)')
64
- .option('--preset <preset>', 'use a preset configuration (available: notion-inspired)')
65
- .option('--legacy', 'use legacy mode for backward compatibility')
66
- .option('--no-auth', 'disable authentication even if configured')
67
- .option('--no-changelog', 'disable automatic changelog generation')
68
- .addHelpText('after', `
69
- ${chalk.yellow('Examples:')}
70
- ${chalk.gray('$')} doc-builder build ${chalk.gray('# Build with defaults')}
71
- ${chalk.gray('$')} doc-builder build --input docs --output dist
72
- ${chalk.gray('$')} doc-builder build --preset notion-inspired ${chalk.gray('# Use Notion-inspired preset')}
73
- ${chalk.gray('$')} doc-builder build --config my-config.js ${chalk.gray('# Use custom config')}
74
- `)
75
- .action(async (options) => {
76
- const spinner = ora('Building documentation...').start();
77
-
78
- try {
79
- const config = await loadConfig(options.config || 'doc-builder.config.js', options);
80
- await build(config);
81
- spinner.succeed('Documentation built successfully!');
82
- } catch (error) {
83
- spinner.fail('Build failed');
84
- console.error(chalk.red(error.message));
85
- if (error.stack) {
86
- console.error(chalk.gray(error.stack));
87
- }
88
- process.exit(1);
89
- }
90
- });
91
-
92
- // Dev server command
93
- program
94
- .command('dev')
95
- .description('Start development server with live reload')
96
- .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
97
- .option('-p, --port <port>', 'port to run dev server on (default: 3000)')
98
- .option('-h, --host <host>', 'host to bind to (default: localhost)')
99
- .option('--no-open', 'don\'t open browser automatically')
100
- .addHelpText('after', `
101
- ${chalk.yellow('Examples:')}
102
- ${chalk.gray('$')} doc-builder dev ${chalk.gray('# Start on http://localhost:3000')}
103
- ${chalk.gray('$')} doc-builder dev --port 8080 ${chalk.gray('# Use custom port')}
104
- ${chalk.gray('$')} doc-builder dev --host 0.0.0.0 ${chalk.gray('# Allow external connections')}
105
- `)
106
- .action(async (options) => {
107
- try {
108
- const config = await loadConfig(options.config, options);
109
- await startDevServer(config, options.port);
110
- } catch (error) {
111
- console.error(chalk.red(error.message));
112
- process.exit(1);
113
- }
114
- });
115
-
116
- // Deploy command
117
- program
118
- .command('deploy')
119
- .description('Deploy documentation to Vercel production (requires Vercel CLI)')
120
- .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
121
- .option('--no-prod', 'deploy as preview instead of production')
122
- .option('--force', 'force deployment without confirmation')
123
- .addHelpText('after', `
124
- ${chalk.yellow('Examples:')}
125
- ${chalk.gray('$')} doc-builder deploy ${chalk.gray('# Deploy to production')}
126
- ${chalk.gray('$')} doc-builder deploy --no-prod ${chalk.gray('# Deploy preview only')}
127
-
128
- ${chalk.yellow('First-time Vercel Setup:')}
129
-
130
- ${chalk.cyan('1. Install Vercel CLI:')}
131
- ${chalk.gray('$')} npm install -g vercel
132
- ${chalk.gray(' or')}
133
- ${chalk.gray('$')} brew install vercel ${chalk.gray('# macOS with Homebrew')}
134
-
135
- ${chalk.cyan('2. Login to Vercel:')}
136
- ${chalk.gray('$')} vercel login
137
- ${chalk.gray(' This will open your browser to authenticate')}
138
-
139
- ${chalk.cyan('3. Run doc-builder deploy:')}
140
- ${chalk.gray('$')} npx @knowcode/doc-builder deploy
141
-
142
- You'll be asked several questions:
143
-
144
- ${chalk.green('Q: Would you like to set up a new Vercel project?')}
145
- → Answer: ${chalk.yellow('Yes')} (first time only)
146
-
147
- ${chalk.green('Q: What is your project name?')}
148
- → Answer: ${chalk.yellow('Your project name')} (e.g., "my-docs" or "gasworld")
149
-
150
- ${chalk.bgRed.white.bold(' ⚠️ CRITICAL: ABOUT ROOT DIRECTORY ')}
151
- ${chalk.red('If asked about Root Directory at ANY point:')}
152
- ${chalk.red('• LEAVE IT EMPTY (blank)')}
153
- ${chalk.red('• DO NOT enter "html"')}
154
- ${chalk.red('• We deploy FROM html folder already!')}
155
-
156
- ${chalk.green('Q: Which framework preset?')}
157
- → Answer: ${chalk.yellow('Other (Static HTML)')} (always choose this)
158
-
159
- ${chalk.green('Q: Make the deployment publicly accessible?')}
160
- → Answer: ${chalk.yellow('Yes')} for public docs, ${chalk.yellow('No')} for private
161
-
162
- ${chalk.gray('Then Vercel CLI will ask:')}
163
-
164
- ${chalk.green('Q: Set up [your directory]?')}
165
- → Answer: ${chalk.yellow('Yes')}
166
-
167
- ${chalk.green('Q: Which scope should contain your project?')}
168
- → Answer: ${chalk.yellow('Select your account')} (usually your username)
169
-
170
- ${chalk.green('Q: Link to existing project?')}
171
- → Answer: ${chalk.yellow('No')} (first time), ${chalk.yellow('Yes')} (if redeploying)
172
-
173
- ${chalk.gray('Note: Vercel will auto-detect that we\'re deploying from the output directory')}
174
-
175
- ${chalk.green('Q: Want to modify these settings?')}
176
- → Answer: ${chalk.yellow('No')} (doc-builder handles this)
177
-
178
- ${chalk.cyan('4. Configure Access (Important!):')}
179
- After deployment, go to your Vercel dashboard:
180
- • Navigate to Project Settings → General
181
- • Under "Deployment Protection", set to ${chalk.yellow('Disabled')}
182
- • This allows public access to your docs
183
-
184
- ${chalk.yellow('Deployment Behavior:')}
185
- ${chalk.green.bold('🎯 DEFAULT: All deployments go to PRODUCTION')}
186
-
187
- ${chalk.gray('$')} npx @knowcode/doc-builder ${chalk.gray('# → Shows help (v1.3.0+)')}
188
- ${chalk.gray('$')} npx @knowcode/doc-builder deploy ${chalk.gray('# → yourdocs.vercel.app')}
189
- ${chalk.gray('$')} npx @knowcode/doc-builder deploy --no-prod ${chalk.gray('# → preview URL only')}
190
-
191
- ${chalk.yellow('When All Else Fails - Delete and Start Fresh:')}
192
- Sometimes the cleanest solution is to delete the Vercel project:
193
-
194
- 1. Go to your project settings on Vercel
195
- 2. Scroll to bottom and click ${chalk.red('"Delete Project"')}
196
- 3. Run: ${chalk.gray('npx @knowcode/doc-builder reset-vercel')}
197
- 4. Run: ${chalk.gray('npx @knowcode/doc-builder deploy')}
198
- 5. Create a NEW project with correct settings
199
-
200
- This removes all conflicting configurations!
201
-
202
- ${chalk.yellow('Troubleshooting:')}
203
- • ${chalk.cyan('Command not found:')} Install Vercel CLI globally
204
- • ${chalk.cyan('Not authenticated:')} Run ${chalk.gray('vercel login')}
205
- • ${chalk.cyan('Project not linked:')} Delete ${chalk.gray('.vercel')} folder and redeploy
206
-
207
- ${chalk.red.bold('• Path "html/html" does not exist error:')}
208
- ${chalk.yellow('This happens when Vercel has the wrong Root Directory setting.')}
209
-
210
- ${chalk.green('Fix:')}
211
- 1. Go to your Vercel project settings
212
- 2. Under "Build & Development Settings"
213
- 3. Set "Root Directory" to ${chalk.yellow.bold('empty (leave blank)')}
214
- 4. Save and redeploy
215
-
216
- ${chalk.red.bold('• Linked to wrong project (username/html):')}
217
- ${chalk.yellow('Never link to the generic "html" project!')}
218
-
219
- ${chalk.green('Fix:')}
220
- 1. Delete the ${chalk.gray('html/.vercel')} folder
221
- 2. Run deployment again
222
- 3. When asked "Link to existing project?" say ${chalk.red.bold('NO')}
223
- 4. Create a new project with your actual name
224
-
225
- ${chalk.red.bold('• "buildCommand should be string,null" error:')}
226
- ${chalk.yellow('Your Vercel project has conflicting build settings.')}
227
-
228
- ${chalk.green('Fix:')}
229
- 1. Go to project settings > Build & Development Settings
230
- 2. Clear ALL fields (Build Command, Output Directory, etc.)
231
- 3. Save and try again
232
- ${chalk.gray('OR')}
233
- Delete the project and start fresh (see below)
234
-
235
- ${chalk.red.bold('• "Project was deleted or you don\'t have access" error:')}
236
- ${chalk.yellow('The Vercel project was deleted but local config remains.')}
237
-
238
- ${chalk.green('Fix:')}
239
- ${chalk.gray('$')} npx @knowcode/doc-builder reset-vercel
240
- ${chalk.gray('$')} npx @knowcode/doc-builder deploy
241
-
242
- This removes old project references and starts fresh
243
- `)
244
- .action(async (options) => {
245
- const spinner = ora('Deploying to Vercel...').start();
246
-
247
- try {
248
- const config = await loadConfig(options.config || 'doc-builder.config.js', options);
249
-
250
- // First check if Vercel CLI is installed
251
- try {
252
- execSync('vercel --version', { stdio: 'ignore' });
253
- } catch (vercelError) {
254
- spinner.fail('Vercel CLI not found');
255
- console.log(chalk.yellow('\n📦 Vercel CLI is required for deployment\n'));
256
- console.log(chalk.cyan('Install it with one of these commands:'));
257
- console.log(chalk.gray(' npm install -g vercel'));
258
- console.log(chalk.gray(' yarn global add vercel'));
259
- console.log(chalk.gray(' brew install vercel # macOS\n'));
260
- console.log(chalk.yellow('Then run deployment again:'));
261
- console.log(chalk.gray(' npx @knowcode/doc-builder deploy\n'));
262
- process.exit(1);
263
- }
264
-
265
- // Always build first
266
- spinner.stop();
267
- console.log(chalk.blue('\n📦 Building documentation first...\n'));
268
- await build(config);
269
- spinner.start('Deploying to Vercel...');
270
-
271
- // Prepare deployment files
272
- await prepareDeployment(config);
273
-
274
- // Check if this is the first deployment
275
- const outputPath = path.join(process.cwd(), config.outputDir || 'html');
276
- const vercelProjectPath = path.join(outputPath, '.vercel', 'project.json');
277
- if (!fs.existsSync(vercelProjectPath)) {
278
- spinner.stop();
279
- console.log(chalk.yellow('\n🚀 First time deploying to Vercel!\n'));
280
-
281
- // Show critical warning about Root Directory
282
- console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
283
- console.log(chalk.bgRed.white.bold(' ⚠️ CRITICAL WARNING - READ BEFORE CONTINUING! '));
284
- console.log(chalk.bgRed.white.bold('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
285
-
286
- console.log(chalk.yellow.bold('During setup, if Vercel asks about Root Directory:'));
287
- console.log(chalk.red.bold('• LEAVE IT EMPTY (blank)'));
288
- console.log(chalk.red.bold('• DO NOT ENTER "html"'));
289
- console.log(chalk.red.bold('• We are ALREADY deploying from the html folder!\n'));
290
-
291
- console.log(chalk.white('Setting Root Directory to "html" will cause errors.'));
292
- console.log(chalk.white('You\'ll need to fix it in project settings later.\n'));
293
-
294
- const setupConfirm = await prompts({
295
- type: 'confirm',
296
- name: 'value',
297
- message: 'Would you like to set up a new Vercel project?',
298
- initial: true
299
- });
300
-
301
- if (setupConfirm.value) {
302
- await setupVercelProject(config);
303
- } else {
304
- console.log(chalk.gray('Run `vercel` manually to set up your project.'));
305
- process.exit(0);
306
- }
307
- }
308
-
309
- spinner.start('Deploying to Vercel...');
310
- // Default to production deployment
311
- const isProduction = options.prod !== false; // Default true unless explicitly --no-prod
312
- const url = await deployToVercel(config, isProduction);
313
- spinner.succeed(`Deployed successfully!`);
314
-
315
- // Extract project name from URL
316
- const projectName = url.match(/https:\/\/([^-]+)/)?.[1] || 'your-project';
317
-
318
- console.log(chalk.green('\n✅ Deployment Complete!\n'));
319
-
320
- if (isProduction) {
321
- console.log(chalk.yellow('🌐 Your documentation is live at:'));
322
- console.log(chalk.cyan.bold(` ${projectName}.vercel.app`) + chalk.gray(' (Production URL - share this!)'));
323
- console.log();
324
- console.log(chalk.gray('This deployment also created a unique preview URL:'));
325
- console.log(chalk.gray(` ${url}`));
326
- console.log(chalk.gray(' (This URL is specific to this deployment)'));
327
- } else {
328
- console.log(chalk.yellow('🔍 Preview deployment created at:'));
329
- console.log(chalk.cyan(` ${url}`));
330
- console.log();
331
- console.log(chalk.gray('To deploy to production, run:'));
332
- console.log(chalk.gray(' npx @knowcode/doc-builder deploy'));
333
- }
334
- console.log();
335
-
336
- } catch (error) {
337
- spinner.fail('Deployment failed');
338
- console.error(chalk.red(error.message));
339
- if (error.stack) {
340
- console.error(chalk.gray(error.stack));
341
- }
342
- process.exit(1);
343
- }
344
- });
345
-
346
- // Reset command for Vercel issues
347
- program
348
- .command('reset-vercel')
349
- .description('Reset Vercel configuration (fixes common deployment issues)')
350
- .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
351
- .addHelpText('after', `
352
- ${chalk.yellow('What this does:')}
353
- • Removes .vercel folder from your output directory
354
- • Lets you set up a fresh Vercel project
355
- • Fixes "html/html does not exist" errors
356
- • Fixes wrong project linking issues
357
-
358
- ${chalk.yellow('When to use:')}
359
- • After "html/html does not exist" error
360
- • When linked to wrong project (e.g., username/html)
361
- • When Root Directory settings are incorrect
362
- • After deleting a Vercel project
363
- • When you get "Project was deleted" errors
364
- • Any time you want to start fresh with deployment
365
- `)
366
- .action(async (options) => {
367
- try {
368
- const config = await loadConfig(options.config || 'doc-builder.config.js', options);
369
- const outputPath = path.join(process.cwd(), config.outputDir || 'html');
370
- const vercelPath = path.join(outputPath, '.vercel');
371
-
372
- if (fs.existsSync(vercelPath)) {
373
- console.log(chalk.yellow('🗑️ Removing .vercel folder from ' + config.outputDir + '...'));
374
- fs.removeSync(vercelPath);
375
- console.log(chalk.green('✅ Vercel configuration reset!'));
376
- console.log(chalk.gray('\nNow run deployment again:'));
377
- console.log(chalk.cyan(' npx @knowcode/doc-builder deploy'));
378
- console.log(chalk.gray('\nThis time:'));
379
- console.log(chalk.gray('• Create a NEW project (not username/html)'));
380
- console.log(chalk.gray('• Use a descriptive name like "my-docs"'));
381
- console.log(chalk.gray('• Leave Root Directory EMPTY'));
382
- } else {
383
- console.log(chalk.gray('No .vercel folder found. Ready for fresh deployment!'));
384
- }
385
- } catch (error) {
386
- console.error(chalk.red(error.message));
387
- process.exit(1);
388
- }
389
- });
390
-
391
- // Init command
392
- program
393
- .command('init')
394
- .description('Initialize doc-builder in your project')
395
- .option('--config', 'create configuration file')
396
- .option('--example', 'create example documentation structure')
397
- .addHelpText('after', `
398
- ${chalk.yellow('Examples:')}
399
- ${chalk.gray('$')} doc-builder init --config ${chalk.gray('# Create doc-builder.config.js')}
400
- ${chalk.gray('$')} doc-builder init --example ${chalk.gray('# Create example docs folder')}
401
- ${chalk.gray('$')} doc-builder init --example --config ${chalk.gray('# Create both')}
402
-
403
- ${chalk.yellow('What gets created:')}
404
- ${chalk.cyan('--example:')} Creates a docs/ folder with:
405
- • README.md with welcome message and mermaid diagram
406
- • getting-started.md with setup instructions
407
- • guides/configuration.md with config options
408
-
409
- ${chalk.cyan('--config:')} Creates doc-builder.config.js with:
410
- • Site name and description
411
- • Feature toggles (auth, dark mode, etc.)
412
- • Directory paths
413
- • Authentication settings
414
- `)
415
- .action(async (options) => {
416
- if (options.config) {
417
- const configPath = path.join(process.cwd(), 'doc-builder.config.js');
418
-
419
- if (fs.existsSync(configPath)) {
420
- const overwrite = await prompts({
421
- type: 'confirm',
422
- name: 'value',
423
- message: 'Config file already exists. Overwrite?',
424
- initial: false
425
- });
426
-
427
- if (!overwrite.value) {
428
- console.log(chalk.gray('Cancelled.'));
429
- process.exit(0);
430
- }
431
- }
432
-
433
- const config = await createDefaultConfig();
434
- fs.writeFileSync(configPath, `module.exports = ${JSON.stringify(config, null, 2)};`);
435
- console.log(chalk.green('✅ Created doc-builder.config.js'));
436
- }
437
-
438
- if (options.example) {
439
- const docsDir = path.join(process.cwd(), 'docs');
440
-
441
- if (!fs.existsSync(docsDir)) {
442
- fs.mkdirSync(docsDir, { recursive: true });
443
-
444
- // Create example files
445
- const exampleFiles = {
446
- 'README.md': `# Welcome to Your Documentation\n\nThis is an example documentation site created with @knowcode/doc-builder.\n\n## Features\n\n- 📝 Write in Markdown\n- 🎨 Beautiful Notion-inspired design\n- 📊 Mermaid diagram support\n- 🌙 Dark mode\n- 🚀 Deploy to Vercel\n\n## Getting Started\n\n1. Edit this file and add your content\n2. Create new markdown files\n3. Run \`npx @knowcode/doc-builder\` to build and deploy\n\n## Example Diagram\n\n\`\`\`mermaid\ngraph TD\n A[Write Docs] --> B[Build]\n B --> C[Deploy]\n C --> D[Share]\n\`\`\`\n`,
447
- 'getting-started.md': `# Getting Started\n\n**Generated**: ${new Date().toISOString().split('T')[0]}\n**Status**: Draft\n**Verified**: ❓\n\n## Overview\n\nThis guide will help you get started with your documentation.\n\n## Installation\n\nNo installation required! Just use:\n\n\`\`\`bash\nnpx @knowcode/doc-builder\n\`\`\`\n\n## Writing Documentation\n\n1. Create markdown files in the \`docs\` folder\n2. Use folders to organize your content\n3. Add front matter for metadata\n\n## Building\n\nTo build your documentation:\n\n\`\`\`bash\nnpx @knowcode/doc-builder build\n\`\`\`\n\n## Deployment\n\nDeploy to Vercel:\n\n\`\`\`bash\nnpx @knowcode/doc-builder deploy\n\`\`\`\n`,
448
- 'guides/configuration.md': `# Configuration Guide\n\n**Generated**: ${new Date().toISOString().split('T')[0]}\n**Status**: Draft\n**Verified**: ❓\n\n## Overview\n\n@knowcode/doc-builder works with zero configuration, but you can customize it.\n\n## Configuration File\n\nCreate \`doc-builder.config.js\`:\n\n\`\`\`javascript\nmodule.exports = {\n siteName: 'My Documentation',\n siteDescription: 'Documentation for my project',\n \n features: {\n authentication: false,\n changelog: true,\n mermaid: true,\n darkMode: true\n }\n};\n\`\`\`\n\n## Options\n\n### Site Information\n\n- \`siteName\`: Your documentation site name\n- \`siteDescription\`: Brief description\n\n### Directories\n\n- \`docsDir\`: Input directory (default: 'docs')\n- \`outputDir\`: Output directory (default: 'html')\n\n### Features\n\n- \`authentication\`: Enable password protection\n- \`changelog\`: Generate changelog automatically\n- \`mermaid\`: Support for diagrams\n- \`darkMode\`: Dark theme support\n`
449
- };
450
-
451
- // Create example files
452
- for (const [filePath, content] of Object.entries(exampleFiles)) {
453
- const fullPath = path.join(docsDir, filePath);
454
- const dir = path.dirname(fullPath);
455
-
456
- if (!fs.existsSync(dir)) {
457
- fs.mkdirSync(dir, { recursive: true });
458
- }
459
-
460
- fs.writeFileSync(fullPath, content);
461
- console.log(chalk.green(`✅ Created ${filePath}`));
462
- }
463
-
464
- console.log(chalk.cyan('\\n📚 Example documentation created in docs/ folder'));
465
- console.log(chalk.gray('\\nNext steps:'));
466
- console.log(chalk.gray('1. Edit the example files to add your content'));
467
- console.log(chalk.gray('2. Run `npx @knowcode/doc-builder` to build and deploy'));
468
- } else {
469
- console.log(chalk.yellow('⚠️ docs/ directory already exists'));
470
- }
471
- }
472
- });
473
-
474
- // Claude hints command
475
- program
476
- .command('claude-hints')
477
- .description('Generate Claude.md hints for documentation standards')
478
- .option('-o, --output <path>', 'output file path (default: stdout)')
479
- .option('--format <format>', 'output format: md or text (default: md)')
480
- .addHelpText('after', `
481
- ${chalk.yellow('What this does:')}
482
- Generates a comprehensive guide for Claude.md configuration
483
- that helps Claude produce well-structured markdown documentation
484
- following best practices and consistent standards.
485
-
486
- ${chalk.yellow('Usage:')}
487
- ${chalk.gray('$')} doc-builder claude-hints ${chalk.gray('# Display to console')}
488
- ${chalk.gray('$')} doc-builder claude-hints -o CLAUDE.md ${chalk.gray('# Save to file')}
489
- ${chalk.gray('$')} doc-builder claude-hints --format text ${chalk.gray('# Plain text format')}
490
-
491
- ${chalk.yellow('What gets included:')}
492
- • Document structure standards
493
- • Naming conventions for different doc types
494
- • Mermaid diagram best practices
495
- • Information verification standards (✅/❓)
496
- • File organization patterns
497
- • Git commit practices
498
- • Markdown formatting guidelines
499
- `)
500
- .action((options) => {
501
- const claudeHints = `# Documentation Standards for Claude.md
502
-
503
- Add these instructions to your CLAUDE.md file to ensure consistent, high-quality documentation generation.
504
-
505
- ## Document Standards and Conventions
506
-
507
- ### Document Structure
508
-
509
- **Document Title Format**
510
- - Use \`# Document Title\`
511
- - Include metadata:
512
- - **Generated**: YYYY-MM-DD HH:MM UTC
513
- - **Status**: Draft/In Progress/Complete
514
- - **Verified**: ✅ (for verified information) / ❓ (for speculated information)
515
-
516
- ### Overview Section
517
- - Provide a brief description of the document's contents
518
- - Clearly explain the purpose and scope
519
-
520
- ## Content Sections
521
- ### Subsection
522
- Content with clear headings and logical flow.
523
-
524
- ## Document History
525
- | Date | Author | Changes |
526
- |------|--------|---------|
527
- | YYYY-MM-DD | Name | Initial creation |
528
- | YYYY-MM-DD | Name | Updated section X |
529
-
530
- ### Naming Conventions
531
-
532
- - Analysis documents: analysis-{topic}-{specifics}.md
533
- - Design documents: design-{component}-{feature}.md
534
- - Implementation plans: plan-{feature}-implementation.md
535
- - Technical guides: {component}-{topic}-guide.md
536
- - Overview documents: {system}-overview.md
537
- - Testing documents: test-{component}-{type}.md
538
- - Troubleshooting guides: troubleshoot-{issue}-guide.md
539
- - API documentation: api-{service}-reference.md
540
-
541
- ## Content Standards
542
-
543
- ### 1. Mermaid Diagrams
544
- - Include diagrams wherever they help explain complex concepts
545
- - Use consistent node naming and styling
546
- - Add clear labels and descriptions
547
- - Example:
548
- \`\`\`mermaid
549
- graph TD
550
- A[Start] --> B{Decision}
551
- B -->|Yes| C[Process]
552
- B -->|No| D[End]
553
-
554
- style A fill:#f9f,stroke:#333,stroke-width:2px
555
- style B fill:#bbf,stroke:#333,stroke-width:2px
556
- \`\`\`
557
-
558
- ### 2. Information Verification
559
- - Mark all information as either verified (✅) or speculated (❓)
560
- - Include sources for verified information
561
- - Clearly indicate assumptions
562
- - Example:
563
- - ✅ **Verified**: Based on official documentation
564
- - ❓ **Speculated**: Assumed based on common patterns
565
-
566
- ### 3. Code Examples
567
- - Use proper syntax highlighting
568
- - Include context and explanations
569
- - Show both correct and incorrect usage where applicable
570
- - Add comments explaining key concepts
571
-
572
- ### 4. File Organization
573
- - Active files in appropriate directories
574
- - Unused files moved to archive/ with descriptive names
575
- - Temporary files include "temp" in filename
576
- - Create docs/ directory structure:
577
- \`\`\`
578
- docs/
579
- ├── architecture/
580
- ├── api/
581
- ├── guides/
582
- ├── troubleshooting/
583
- └── README.md
584
- \`\`\`
585
-
586
- ### 5. Version Control
587
- - Commit after material changes or milestones
588
- - Use descriptive commit messages
589
- - Group related changes
590
- - Example commit messages:
591
- - "Add API authentication guide"
592
- - "Update deployment architecture diagram"
593
- - "Fix broken links in troubleshooting guide"
594
-
595
- ## Markdown Best Practices
596
-
597
- ### Headers
598
- - Use hierarchical structure (H1 for title, H2 for main sections)
599
- - Don't skip header levels
600
- - Keep headers concise but descriptive
601
-
602
- ### Lists
603
- - Use bullet points for unordered lists
604
- - Use numbers for sequential steps
605
- - Indent nested lists properly
606
-
607
- ### Tables
608
- - Include headers and alignment
609
- - Keep tables readable in raw markdown
610
- - Example:
611
- \`\`\`markdown
612
- | Feature | Status | Notes |
613
- |---------|--------|-------|
614
- | Auth | ✅ Done | Uses JWT |
615
- | API | 🚧 WIP | In progress |
616
- \`\`\`
617
-
618
- ### Links
619
- - Use descriptive link text, not "click here"
620
- - Prefer relative links for internal docs
621
- - Check links regularly for validity
622
-
623
- ### Images
624
- - Include alt text and captions
625
- - Store images in docs/assets/ or docs/images/
626
- - Use descriptive filenames
627
-
628
- ## Documentation Requirements
629
-
630
- ### Timestamp
631
- - Always include generation date at top
632
- - Format: **Generated**: YYYY-MM-DD HH:MM UTC
633
-
634
- ### Status Tracking
635
- - Mark document status (Draft/Complete)
636
- - Include last review date
637
- - Note planned updates
638
-
639
- ### Cross-references
640
- - Link to related documents
641
- - Create index/navigation pages
642
- - Maintain a documentation map
643
-
644
- ### Examples
645
- - Include practical examples
646
- - Show real-world use cases
647
- - Provide sample configurations
648
-
649
- ### Troubleshooting
650
- - Add common issues and solutions
651
- - Include error messages verbatim
652
- - Provide step-by-step resolution
653
-
654
- ## Quality Standards
655
-
656
- ### Clarity
657
- - Write for your audience's technical level
658
- - Define acronyms on first use
659
- - Avoid jargon without explanation
660
-
661
- ### Completeness
662
- - Cover all aspects of the topic
663
- - Include edge cases
664
- - Document limitations
665
-
666
- ### Accuracy
667
- - Verify technical details
668
- - Test code examples
669
- - Update when systems change
670
-
671
- ### Consistency
672
- - Use same terminology throughout
673
- - Follow established patterns
674
- - Maintain style guide compliance
675
-
676
- ### Maintenance
677
- - Review quarterly
678
- - Update version numbers
679
- - Archive outdated content
680
-
681
- ## Special Considerations
682
-
683
- ### Security
684
- - Never include credentials or sensitive data
685
- - Use placeholders for secrets
686
- - Document security implications
687
-
688
- ### Performance
689
- - Document performance implications
690
- - Include benchmarks where relevant
691
- - Note resource requirements
692
-
693
- ### Dependencies
694
- - List all dependencies and versions
695
- - Note compatibility requirements
696
- - Document upgrade paths
697
-
698
- ### Compatibility
699
- - Note platform/version requirements
700
- - Document breaking changes
701
- - Provide migration guides
702
-
703
- ### Accessibility
704
- - Use clear language and structure
705
- - Provide text alternatives
706
- - Consider screen reader users
707
-
708
- ## Additional Claude.md Instructions
709
-
710
- ### When Creating Documentation
711
- - Always put md documents in the docs/ directory
712
- - Use mermaid diagrams whenever it makes sense to explain something
713
- - Explain things diagrammatically when possible
714
- - Create any new md docs into the docs directory and put in a relevant folder
715
-
716
- ### Git Practices
717
- - Do a git commit after material changes or milestone
718
- - After any material changes or a milestone commit the changes to git
719
- - As files become unused - move them to archive and rename
720
-
721
- ### Testing and Temporary Files
722
- - When creating temporary temp files for testing - put "temp" in the file name
723
- - Create temp files with descriptive names like "temp-test-api-response.json"
724
-
725
- ### Documentation Maintenance
726
- - Regularly remove outdated mermaid diagram files (.md) from docs/ directory
727
- - When diagram generation scripts are run, they should REPLACE existing MD files
728
- - Use clean, consistent naming without version suffixes
729
-
730
- This comprehensive guide ensures consistent, high-quality documentation that is easy to maintain and navigate.`;
731
-
732
- // Output the hints
733
- if (options.output) {
734
- try {
735
- fs.writeFileSync(options.output, claudeHints);
736
- console.log(chalk.green(`✅ Claude hints saved to ${options.output}`));
737
- } catch (error) {
738
- console.error(chalk.red(`Error writing file: ${error.message}`));
739
- process.exit(1);
740
- }
741
- } else {
742
- // Output to console
743
- if (options.format === 'text') {
744
- // Strip markdown formatting for plain text
745
- const plainText = claudeHints
746
- .replace(/#{1,6}\s/g, '')
747
- .replace(/\*\*/g, '')
748
- .replace(/`([^`]+)`/g, '$1')
749
- .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
750
- console.log(plainText);
751
- } else {
752
- console.log(claudeHints);
753
- }
754
- }
755
- });
756
-
757
- // Parse arguments
758
- program.parse(process.argv);
759
-
760
- // Show help if no command was provided
761
- if (!process.argv.slice(2).length) {
762
- program.outputHelp();
763
- process.exit(0);
764
- }