@knowcode/doc-builder 1.7.4 → 1.7.6

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 (71) hide show
  1. package/.claude/settings.local.json +6 -1
  2. package/CHANGELOG.md +50 -0
  3. package/README.md +47 -7
  4. package/RELEASE-NOTES-1.7.5.md +64 -0
  5. package/add-user-clive.sql +35 -0
  6. package/add-user-lindsay-fixed.sql +85 -0
  7. package/add-user-lindsay.sql +68 -0
  8. package/add-user-pmorgan.sql +35 -0
  9. package/add-user-robbie.sql +35 -0
  10. package/add-wru-users.sql +105 -0
  11. package/cli.js +223 -8
  12. package/grant-access.sql +15 -0
  13. package/html/README.html +14 -4
  14. package/html/auth.js +97 -0
  15. package/html/documentation-index.html +14 -4
  16. package/html/guides/authentication-default-change.html +302 -0
  17. package/html/guides/authentication-guide.html +32 -14
  18. package/html/guides/cache-control-anti-pattern.html +361 -0
  19. package/html/guides/claude-workflow-guide.html +14 -4
  20. package/html/guides/documentation-standards.html +14 -4
  21. package/html/guides/next-steps-walkthrough.html +638 -0
  22. package/html/guides/phosphor-icons-guide.html +14 -4
  23. package/html/guides/public-site-deployment.html +363 -0
  24. package/html/guides/search-engine-verification-guide.html +14 -4
  25. package/html/guides/seo-guide.html +14 -4
  26. package/html/guides/seo-optimization-guide.html +14 -4
  27. package/html/guides/supabase-auth-implementation-plan.html +543 -0
  28. package/html/guides/supabase-auth-integration-plan.html +671 -0
  29. package/html/guides/supabase-auth-setup-guide.html +498 -0
  30. package/html/guides/troubleshooting-guide.html +14 -4
  31. package/html/guides/vercel-deployment-auth-setup.html +337 -0
  32. package/html/guides/windows-setup-guide.html +14 -4
  33. package/html/index.html +14 -4
  34. package/html/launch/README.html +14 -4
  35. package/html/launch/bubble-plugin-specification.html +14 -4
  36. package/html/launch/go-to-market-strategy.html +14 -4
  37. package/html/launch/launch-announcements.html +14 -4
  38. package/html/login.html +102 -0
  39. package/html/logout.html +18 -0
  40. package/html/sitemap.xml +69 -21
  41. package/html/vercel-cli-setup-guide.html +14 -4
  42. package/html/vercel-first-time-setup-guide.html +14 -4
  43. package/lib/config.js +33 -29
  44. package/lib/core-builder.js +142 -88
  45. package/lib/supabase-auth.js +295 -0
  46. package/manage-users.sql +191 -0
  47. package/package.json +2 -1
  48. package/public-config.js +22 -0
  49. package/public-html/404.html +115 -0
  50. package/public-html/README.html +149 -0
  51. package/public-html/css/notion-style.css +2036 -0
  52. package/public-html/index.html +149 -0
  53. package/public-html/js/main.js +1485 -0
  54. package/quick-test-commands.md +40 -0
  55. package/recordings/Screenshot 2025-07-24 at 18.22.01.png +0 -0
  56. package/setup-database.sql +41 -0
  57. package/test-auth-config.js +17 -0
  58. package/test-docs/README.md +39 -0
  59. package/test-html/404.html +115 -0
  60. package/test-html/README.html +172 -0
  61. package/test-html/auth.js +97 -0
  62. package/test-html/css/notion-style.css +2036 -0
  63. package/test-html/index.html +172 -0
  64. package/test-html/js/auth.js +97 -0
  65. package/test-html/js/main.js +1485 -0
  66. package/test-html/login.html +102 -0
  67. package/test-html/logout.html +18 -0
  68. package/update-domain.sql +9 -0
  69. package/view-all-users.sql +40 -0
  70. package/wru-auth-config.js +17 -0
  71. /package/{assets → public-html}/js/auth.js +0 -0
package/cli.js CHANGED
@@ -13,6 +13,7 @@ const { loadConfig, createDefaultConfig } = require('./lib/config');
13
13
  const { generateDescription } = require('./lib/seo');
14
14
  const { execSync } = require('child_process');
15
15
  const matter = require('gray-matter');
16
+ const SupabaseAuth = require('./lib/supabase-auth');
16
17
 
17
18
  // Package info
18
19
  const packageJson = require('./package.json');
@@ -70,22 +71,32 @@ program
70
71
  .option('-o, --output <dir>', 'output directory for HTML files (default: html)')
71
72
  .option('--preset <preset>', 'use a preset configuration (available: notion-inspired)')
72
73
  .option('--legacy', 'use legacy mode for backward compatibility')
73
- .option('--no-auth', 'disable authentication even if configured')
74
74
  .option('--no-changelog', 'disable automatic changelog generation')
75
75
  .option('--no-pdf', 'hide PDF download icon in header')
76
76
  .option('--menu-closed', 'start with navigation menu closed')
77
+ .option('--no-auth', 'build without authentication (for public sites)')
78
+ .option('--no-attachments', 'skip copying attachment files (Excel, PDF, etc.)')
77
79
  .addHelpText('after', `
78
80
  ${chalk.yellow('Examples:')}
79
81
  ${chalk.gray('$')} doc-builder build ${chalk.gray('# Build with defaults')}
80
82
  ${chalk.gray('$')} doc-builder build --input docs --output dist
81
83
  ${chalk.gray('$')} doc-builder build --preset notion-inspired ${chalk.gray('# Use Notion-inspired preset')}
82
84
  ${chalk.gray('$')} doc-builder build --config my-config.js ${chalk.gray('# Use custom config')}
85
+ ${chalk.gray('$')} doc-builder build --no-auth ${chalk.gray('# Build public site without authentication')}
83
86
  `)
84
87
  .action(async (options) => {
85
88
  const spinner = ora('Building documentation...').start();
86
89
 
87
90
  try {
88
91
  const config = await loadConfig(options.config || 'doc-builder.config.js', { ...options, command: 'build' });
92
+
93
+ // Handle no-auth option
94
+ if (options.auth === false) {
95
+ // Temporarily disable authentication for this build
96
+ config.features = config.features || {};
97
+ config.features.authentication = false;
98
+ }
99
+
89
100
  await build(config);
90
101
  spinner.succeed('Documentation built successfully!');
91
102
  } catch (error) {
@@ -595,10 +606,13 @@ program
595
606
  .option('--no-prod', 'deploy as preview instead of production')
596
607
  .option('--force', 'force deployment without confirmation')
597
608
  .option('--production-url <url>', 'override production URL for this deployment')
609
+ .option('--no-auth', 'build without authentication (for public sites)')
610
+ .option('--no-attachments', 'skip copying attachment files (Excel, PDF, etc.)')
598
611
  .addHelpText('after', `
599
612
  ${chalk.yellow('Examples:')}
600
613
  ${chalk.gray('$')} doc-builder deploy ${chalk.gray('# Deploy to production')}
601
614
  ${chalk.gray('$')} doc-builder deploy --no-prod ${chalk.gray('# Deploy preview only')}
615
+ ${chalk.gray('$')} doc-builder deploy --no-auth ${chalk.gray('# Deploy public site without authentication')}
602
616
 
603
617
  ${chalk.yellow('First-time Vercel Setup:')}
604
618
 
@@ -744,6 +758,19 @@ ${chalk.yellow('Troubleshooting:')}
744
758
  : 'https://' + options.productionUrl;
745
759
  }
746
760
 
761
+ // Handle no-auth option
762
+ if (options.auth === false) {
763
+ // Temporarily disable authentication for this build
764
+ config.features = config.features || {};
765
+ config.features.authentication = false;
766
+ }
767
+
768
+ // Handle no-attachments option
769
+ if (options.attachments === false) {
770
+ config.features = config.features || {};
771
+ config.features.attachments = false;
772
+ }
773
+
747
774
  // Always build first
748
775
  spinner.stop();
749
776
  console.log(chalk.blue('\n📦 Building documentation first...\n'));
@@ -1134,7 +1161,7 @@ ${chalk.yellow('What gets created:')}
1134
1161
  const exampleFiles = {
1135
1162
  '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@latest\` 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`,
1136
1163
  '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@latest\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@latest build\n\`\`\`\n\n## Deployment\n\nDeploy to Vercel:\n\n\`\`\`bash\nnpx @knowcode/doc-builder@latest deploy\n\`\`\`\n`,
1137
- '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`
1164
+ '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 Supabase authentication\n- \`changelog\`: Generate changelog automatically\n- \`mermaid\`: Support for diagrams\n- \`darkMode\`: Dark theme support\n`
1138
1165
  };
1139
1166
 
1140
1167
  // Create example files
@@ -1466,7 +1493,7 @@ program
1466
1493
  console.log(` • Favicon: ${chalk.green(config.favicon || '✨')}`);
1467
1494
 
1468
1495
  console.log(chalk.yellow('\n✨ Features:'));
1469
- console.log(` • Authentication: ${config.features?.authentication ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
1496
+ console.log(` • Authentication: ${config.features?.authentication === 'supabase' ? chalk.green('Supabase') : chalk.gray('Disabled')}`);
1470
1497
  console.log(` • Dark mode: ${config.features?.darkMode !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
1471
1498
  console.log(` • Mermaid diagrams: ${config.features?.mermaid !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
1472
1499
  console.log(` • Changelog: ${config.features?.changelog !== false ? chalk.green('Enabled') : chalk.gray('Disabled')}`);
@@ -1475,10 +1502,11 @@ program
1475
1502
  console.log(` • PDF download: ${config.features?.showPdfDownload !== false ? chalk.green('Shown') : chalk.gray('Hidden')}`);
1476
1503
  console.log(` • Menu default: ${config.features?.menuDefaultOpen !== false ? chalk.green('Open') : chalk.gray('Closed')}`);
1477
1504
 
1478
- if (config.features?.authentication) {
1479
- console.log(chalk.yellow('\n🔐 Authentication:'));
1480
- console.log(` • Username: ${chalk.green(config.auth?.username || 'admin')}`);
1481
- console.log(` • Password: ${chalk.gray('***' + (config.auth?.password?.slice(-2) || '**'))}`);
1505
+ if (config.features?.authentication === 'supabase') {
1506
+ console.log(chalk.yellow('\n🔐 Supabase Authentication:'));
1507
+ console.log(` • Supabase URL: ${config.auth?.supabaseUrl ? chalk.green('Configured') : chalk.red('Missing')}`);
1508
+ console.log(` • Anonymous Key: ${config.auth?.supabaseAnonKey ? chalk.green('Configured') : chalk.red('Missing')}`);
1509
+ console.log(` • Site ID: ${config.auth?.siteId ? chalk.green('Configured') : chalk.red('Missing')}`);
1482
1510
  }
1483
1511
 
1484
1512
  if (config.seo?.enabled) {
@@ -1495,11 +1523,198 @@ program
1495
1523
  }
1496
1524
  });
1497
1525
 
1498
- // Update the help text to mention the settings command
1526
+ // Authentication management commands
1527
+ program
1528
+ .command('auth:init')
1529
+ .description('Initialize Supabase authentication for this project')
1530
+ .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
1531
+ .action(async (options) => {
1532
+ console.log(chalk.cyan('\n🔐 Initialize Supabase Authentication\n'));
1533
+
1534
+ try {
1535
+ const answers = await prompts([
1536
+ {
1537
+ type: 'text',
1538
+ name: 'supabaseUrl',
1539
+ message: 'Enter your Supabase project URL:',
1540
+ validate: (value) => value.match(/^https:\/\/\w+\.supabase\.co$/) ? true : 'Please enter a valid Supabase URL (https://xxx.supabase.co)'
1541
+ },
1542
+ {
1543
+ type: 'password',
1544
+ name: 'supabaseAnonKey',
1545
+ message: 'Enter your Supabase anonymous key:'
1546
+ },
1547
+ {
1548
+ type: 'text',
1549
+ name: 'siteName',
1550
+ message: 'Enter a name for this documentation site:',
1551
+ initial: 'Documentation'
1552
+ }
1553
+ ]);
1554
+
1555
+ if (!answers.supabaseUrl || !answers.supabaseAnonKey) {
1556
+ console.log(chalk.yellow('Setup cancelled.'));
1557
+ return;
1558
+ }
1559
+
1560
+ // Create or update config file
1561
+ const configPath = options.config || 'doc-builder.config.js';
1562
+ const configContent = `module.exports = {
1563
+ siteName: '${answers.siteName}',
1564
+
1565
+ features: {
1566
+ authentication: 'supabase'
1567
+ },
1568
+
1569
+ auth: {
1570
+ supabaseUrl: '${answers.supabaseUrl}',
1571
+ supabaseAnonKey: '${answers.supabaseAnonKey}',
1572
+ siteId: '' // Will be set after creating site in database
1573
+ }
1574
+ };`;
1575
+
1576
+ await fs.writeFile(configPath, configContent);
1577
+ console.log(chalk.green(`✓ Configuration saved to ${configPath}`));
1578
+
1579
+ console.log(chalk.yellow('\n📋 Next steps:'));
1580
+ console.log('1. Create the database tables in your Supabase project (see documentation)');
1581
+ console.log('2. Add your site to the database using: doc-builder auth:add-site');
1582
+ console.log('3. Update the siteId in your config file');
1583
+
1584
+ } catch (error) {
1585
+ console.error(chalk.red('Error initializing auth:'), error.message);
1586
+ }
1587
+ });
1588
+
1589
+ program
1590
+ .command('auth:add-site')
1591
+ .description('Add a documentation site to Supabase database')
1592
+ .requiredOption('--domain <domain>', 'site domain (e.g., docs.example.com)')
1593
+ .requiredOption('--name <name>', 'site display name')
1594
+ .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
1595
+ .action(async (options) => {
1596
+ console.log(chalk.cyan('\n🌐 Add Documentation Site\n'));
1597
+
1598
+ try {
1599
+ const config = await loadConfig(options.config || 'doc-builder.config.js', {});
1600
+
1601
+ if (config.features?.authentication !== 'supabase') {
1602
+ console.error(chalk.red('Error: Supabase authentication is not configured. Run "doc-builder auth:init" first.'));
1603
+ return;
1604
+ }
1605
+
1606
+ // This would connect to Supabase and create the site record
1607
+ console.log(chalk.yellow('🚧 This command requires Supabase admin integration.'));
1608
+ console.log('For now, manually add to your Supabase database:');
1609
+ console.log('');
1610
+ console.log(chalk.gray('INSERT INTO docbuilder_sites (domain, name)'));
1611
+ console.log(chalk.gray(`VALUES ('${options.domain}', '${options.name}');`));
1612
+ console.log('');
1613
+ console.log('Then update your config file with the returned site ID.');
1614
+
1615
+ } catch (error) {
1616
+ console.error(chalk.red('Error adding site:'), error.message);
1617
+ }
1618
+ });
1619
+
1620
+ program
1621
+ .command('auth:grant')
1622
+ .description('Grant user access to documentation site')
1623
+ .requiredOption('--email <email>', 'user email address')
1624
+ .requiredOption('--site-id <id>', 'site ID from database')
1625
+ .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
1626
+ .action(async (options) => {
1627
+ console.log(chalk.cyan('\n👥 Grant User Access\n'));
1628
+
1629
+ try {
1630
+ const config = await loadConfig(options.config || 'doc-builder.config.js', {});
1631
+
1632
+ if (config.features?.authentication !== 'supabase') {
1633
+ console.error(chalk.red('Error: Supabase authentication is not configured.'));
1634
+ return;
1635
+ }
1636
+
1637
+ console.log(chalk.yellow('🚧 This command requires Supabase admin integration.'));
1638
+ console.log('For now, manually add to your Supabase database:');
1639
+ console.log('');
1640
+ console.log(chalk.gray('-- First, get the user ID from auth.users where email = \'user@example.com\''));
1641
+ console.log(chalk.gray('INSERT INTO docbuilder_access (user_id, site_id)'));
1642
+ console.log(chalk.gray(`VALUES ('user-uuid-here', '${options.siteId}');`));
1643
+
1644
+ } catch (error) {
1645
+ console.error(chalk.red('Error granting access:'), error.message);
1646
+ }
1647
+ });
1648
+
1649
+ program
1650
+ .command('auth:revoke')
1651
+ .description('Revoke user access to documentation site')
1652
+ .requiredOption('--email <email>', 'user email address')
1653
+ .requiredOption('--site-id <id>', 'site ID from database')
1654
+ .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
1655
+ .action(async (options) => {
1656
+ console.log(chalk.cyan('\n🚫 Revoke User Access\n'));
1657
+
1658
+ try {
1659
+ const config = await loadConfig(options.config || 'doc-builder.config.js', {});
1660
+
1661
+ if (config.features?.authentication !== 'supabase') {
1662
+ console.error(chalk.red('Error: Supabase authentication is not configured.'));
1663
+ return;
1664
+ }
1665
+
1666
+ console.log(chalk.yellow('🚧 This command requires Supabase admin integration.'));
1667
+ console.log('For now, manually remove from your Supabase database:');
1668
+ console.log('');
1669
+ console.log(chalk.gray('DELETE FROM docbuilder_access'));
1670
+ console.log(chalk.gray('WHERE user_id = (SELECT id FROM auth.users WHERE email = \'user@example.com\')'));
1671
+ console.log(chalk.gray(`AND site_id = '${options.siteId}';`));
1672
+
1673
+ } catch (error) {
1674
+ console.error(chalk.red('Error revoking access:'), error.message);
1675
+ }
1676
+ });
1677
+
1678
+ program
1679
+ .command('auth:list-users')
1680
+ .description('List users with access to documentation site')
1681
+ .requiredOption('--site-id <id>', 'site ID from database')
1682
+ .option('-c, --config <path>', 'path to config file (default: doc-builder.config.js)')
1683
+ .action(async (options) => {
1684
+ console.log(chalk.cyan('\n👥 List Site Users\n'));
1685
+
1686
+ try {
1687
+ const config = await loadConfig(options.config || 'doc-builder.config.js', {});
1688
+
1689
+ if (config.features?.authentication !== 'supabase') {
1690
+ console.error(chalk.red('Error: Supabase authentication is not configured.'));
1691
+ return;
1692
+ }
1693
+
1694
+ console.log(chalk.yellow('🚧 This command requires Supabase admin integration.'));
1695
+ console.log('For now, manually query your Supabase database:');
1696
+ console.log('');
1697
+ console.log(chalk.gray('SELECT u.email, da.created_at as granted_at'));
1698
+ console.log(chalk.gray('FROM docbuilder_access da'));
1699
+ console.log(chalk.gray('JOIN auth.users u ON u.id = da.user_id'));
1700
+ console.log(chalk.gray(`WHERE da.site_id = '${options.siteId}';`));
1701
+
1702
+ } catch (error) {
1703
+ console.error(chalk.red('Error listing users:'), error.message);
1704
+ }
1705
+ });
1706
+
1707
+ // Update the help text to mention new commands
1499
1708
  program.addHelpText('after', `
1500
1709
  ${chalk.cyan('📋 View Settings:')}
1501
1710
  ${chalk.gray('$')} doc-builder settings ${chalk.gray('# Show current configuration')}
1502
1711
  ${chalk.gray('$')} doc-builder settings --config custom.js ${chalk.gray('# Show specific config file')}
1712
+
1713
+ ${chalk.cyan('🔐 Authentication Management:')}
1714
+ ${chalk.gray('$')} doc-builder auth:init ${chalk.gray('# Set up Supabase authentication')}
1715
+ ${chalk.gray('$')} doc-builder auth:add-site --domain docs.example.com --name "Company Docs"
1716
+ ${chalk.gray('$')} doc-builder auth:grant --email user@example.com --site-id xxx
1717
+ ${chalk.gray('$')} doc-builder auth:list-users --site-id xxx
1503
1718
  `);
1504
1719
 
1505
1720
  // Parse arguments
@@ -0,0 +1,15 @@
1
+ -- Grant access to test user
2
+ -- Run this in your Supabase SQL Editor
3
+
4
+ INSERT INTO docbuilder_access (user_id, site_id)
5
+ VALUES ('46cad259-9692-4df7-b19d-839e164a0390', '4d8a53bf-dcdd-48c0-98e0-cd1451518735');
6
+
7
+ -- Verify the access was granted
8
+ SELECT
9
+ u.email,
10
+ s.name as site_name,
11
+ da.created_at as access_granted
12
+ FROM docbuilder_access da
13
+ JOIN auth.users u ON u.id = da.user_id
14
+ JOIN docbuilder_sites s ON s.id = da.site_id
15
+ WHERE da.user_id = '46cad259-9692-4df7-b19d-839e164a0390';
package/html/README.html CHANGED
@@ -45,6 +45,8 @@
45
45
  <!-- Styles -->
46
46
  <link rel="stylesheet" href="/css/notion-style.css">
47
47
 
48
+
49
+
48
50
  <!-- Favicon -->
49
51
  <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>">
50
52
 
@@ -63,8 +65,8 @@
63
65
  "name": "Knowcode Ltd",
64
66
  "url": "https://knowcode.tech"
65
67
  },
66
- "datePublished": "2025-07-24T09:07:52.307Z",
67
- "dateModified": "2025-07-24T09:07:52.307Z",
68
+ "datePublished": "2025-07-25T13:49:06.502Z",
69
+ "dateModified": "2025-07-25T13:49:06.502Z",
68
70
  "mainEntityOfPage": {
69
71
  "@type": "WebPage",
70
72
  "@id": "https://doc-builder-delta.vercel.app/README.html"
@@ -97,7 +99,7 @@
97
99
 
98
100
  <div class="header-actions">
99
101
  <div class="deployment-info">
100
- <span class="deployment-date" title="Built with doc-builder v1.7.2">Last updated: Jul 24, 2025, 09:07 AM UTC</span>
102
+ <span class="deployment-date" title="Built with doc-builder v1.7.5">Last updated: Jul 25, 2025, 01:49 PM UTC</span>
101
103
  </div>
102
104
 
103
105
 
@@ -155,14 +157,22 @@
155
157
  <i class="fas fa-chevron-right collapse-icon"></i><i class="fas fa-folder"></i> Guides
156
158
  </a>
157
159
  <div class="nav-content" id="nav-guides-1">
158
- <a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="This guide explains how to configure and use the built-in authentication feature in @knowcode/doc-builder to protect your documentation with basic..."><i class="fas fa-file-alt"></i> Authentication Guide</a>
160
+ <a href="/guides/authentication-default-change.html" class="nav-item" data-tooltip="Starting from version 1.7.4, @knowcode/doc-builder now defaults to no authentication for all documentation sites."><i class="fas fa-file-alt"></i> Authentication Default Change</a>
161
+ <a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="🚨 This authentication method has been REMOVED in version 2.0.0 due to serious security flaws."><i class="fas fa-file-alt"></i> Authentication Guide</a>
162
+ <a href="/guides/cache-control-anti-pattern.html" class="nav-item" data-tooltip="Cache Control Anti-Pattern: Why Aggressive Cache-Busting is Bad for Documentation Sites."><i class="fas fa-file-alt"></i> Cache Control Anti Pattern</a>
159
163
  <a href="/guides/claude-workflow-guide.html" class="nav-item" data-tooltip="This guide demonstrates an efficient workflow for using Claude Code with a refined CLAUDE.md file to create high-quality documentation and deploy it..."><i class="fas fa-file-alt"></i> Claude Workflow Guide</a>
160
164
  <a href="/guides/documentation-standards.html" class="nav-item" data-tooltip="This document defines the documentation standards and conventions for the @knowcode/doc-builder project."><i class="fas fa-file-alt"></i> Documentation Standards</a>
165
+ <a href="/guides/next-steps-walkthrough.html" class="nav-item" data-tooltip="Now that we&#039;ve implemented Supabase authentication, let&#039;s walk through testing the implementation and preparing for deployment."><i class="fas fa-file-alt"></i> Next Steps Walkthrough</a>
161
166
  <a href="/guides/phosphor-icons-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder automatically converts Unicode emojis in your markdown files to beautiful Phosphor icons in the generated HTML."><i class="fas fa-file-alt"></i> Phosphor Icons Guide</a>
167
+ <a href="/guides/public-site-deployment.html" class="nav-item" data-tooltip="The @knowcode/doc-builder now supports deploying public documentation sites without authentication."><i class="fas fa-file-alt"></i> Public Site Deployment</a>
162
168
  <a href="/guides/search-engine-verification-guide.html" class="nav-item" data-tooltip="Search engine verification provides access to powerful webmaster tools:."><i class="fas fa-file-alt"></i> Search Engine Verification Guide</a>
163
169
  <a href="/guides/seo-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features to help your documentation rank better in search results and..."><i class="fas fa-file-alt"></i> Seo Guide</a>
164
170
  <a href="/guides/seo-optimization-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features that automatically optimize your documentation for search..."><i class="fas fa-file-alt"></i> Seo Optimization Guide</a>
171
+ <a href="/guides/supabase-auth-implementation-plan.html" class="nav-item" data-tooltip="Supabase Auth Implementation Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Implementation Plan</a>
172
+ <a href="/guides/supabase-auth-integration-plan.html" class="nav-item" data-tooltip="Supabase Authentication Integration Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Integration Plan</a>
173
+ <a href="/guides/supabase-auth-setup-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder now supports enterprise-grade authentication through Supabase, replacing the previous insecure basic authentication."><i class="fas fa-file-alt"></i> Supabase Auth Setup Guide</a>
165
174
  <a href="/guides/troubleshooting-guide.html" class="nav-item" data-tooltip="This guide helps you resolve common issues when using @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Troubleshooting Guide</a>
175
+ <a href="/guides/vercel-deployment-auth-setup.html" class="nav-item" data-tooltip="Vercel Deployment Authentication Setup Guide."><i class="fas fa-file-alt"></i> Vercel Deployment Auth Setup</a>
166
176
  <a href="/guides/windows-setup-guide.html" class="nav-item" data-tooltip="This guide helps Windows users set up the complete AI-powered documentation workflow using Claude Code, @knowcode/doc-builder, and Vercel."><i class="fas fa-file-alt"></i> Windows Setup Guide</a></div></div>
167
177
  <div class="nav-section" data-level="1">
168
178
  <a class="nav-title collapsible expanded" href="/launch/README.html" data-target="nav-launch-1" >
package/html/auth.js ADDED
@@ -0,0 +1,97 @@
1
+
2
+ /**
3
+ * Supabase Authentication for Documentation Site
4
+ * Generated by @knowcode/doc-builder
5
+ */
6
+
7
+ (function() {
8
+ 'use strict';
9
+
10
+ // Skip auth check on login and logout pages
11
+ const currentPage = window.location.pathname;
12
+ if (currentPage === '/login.html' || currentPage === '/logout.html' ||
13
+ currentPage.includes('login') || currentPage.includes('logout')) {
14
+ return;
15
+ }
16
+
17
+ // Initialize Supabase client
18
+ const { createClient } = supabase;
19
+ const supabaseClient = createClient('https://xcihhnfcitjrwbynxmka.supabase.co', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY', {
20
+ auth: {
21
+ persistSession: true,
22
+ autoRefreshToken: true,
23
+ detectSessionInUrl: true
24
+ }
25
+ });
26
+
27
+ // Check authentication and site access
28
+ async function checkAuth() {
29
+ try {
30
+ // Get current user session
31
+ const { data: { user }, error: userError } = await supabaseClient.auth.getUser();
32
+
33
+ if (userError || !user) {
34
+ redirectToLogin();
35
+ return;
36
+ }
37
+
38
+ // Check if user has access to this site
39
+ const { data: access, error: accessError } = await supabaseClient
40
+ .from('docbuilder_access')
41
+ .select('*')
42
+ .eq('user_id', user.id)
43
+ .eq('site_id', '4d8a53bf-dcdd-48c0-98e0-cd1451518735')
44
+ .single();
45
+
46
+ if (accessError || !access) {
47
+ showAccessDenied();
48
+ return;
49
+ }
50
+
51
+ // User is authenticated and has access
52
+ console.log('User authenticated and authorized');
53
+ document.body.classList.add('authenticated');
54
+
55
+ } catch (error) {
56
+ console.error('Auth check failed:', error);
57
+ redirectToLogin();
58
+ }
59
+ }
60
+
61
+ // Redirect to login page
62
+ function redirectToLogin() {
63
+ const currentUrl = window.location.pathname + window.location.search;
64
+ const loginUrl = '/login.html' + (currentUrl !== '/' ? '?redirect=' + encodeURIComponent(currentUrl) : '');
65
+ window.location.href = loginUrl;
66
+ }
67
+
68
+ // Show access denied message
69
+ function showAccessDenied() {
70
+ document.body.classList.add('authenticated'); // Show the body
71
+ document.body.innerHTML = `
72
+ <div style="display: flex; justify-content: center; align-items: center; height: 100vh; font-family: Inter, sans-serif;">
73
+ <div style="text-align: center; max-width: 400px;">
74
+ <h1 style="color: #ef4444; margin-bottom: 1rem;">Access Denied</h1>
75
+ <p style="color: #6b7280; margin-bottom: 2rem;">You don't have permission to view this documentation site.</p>
76
+ <a href="/login.html" style="background: #3b82f6; color: white; padding: 0.75rem 1.5rem; border-radius: 0.5rem; text-decoration: none;">Try Different Account</a>
77
+ </div>
78
+ </div>
79
+ `;
80
+ }
81
+
82
+ // Add logout functionality
83
+ document.addEventListener('DOMContentLoaded', function() {
84
+ const logoutLinks = document.querySelectorAll('a[href*="logout"]');
85
+ logoutLinks.forEach(link => {
86
+ link.addEventListener('click', async function(e) {
87
+ e.preventDefault();
88
+ await supabaseClient.auth.signOut();
89
+ window.location.href = '/logout.html';
90
+ });
91
+ });
92
+ });
93
+
94
+ // Run auth check
95
+ checkAuth();
96
+
97
+ })();
@@ -45,6 +45,8 @@
45
45
  <!-- Styles -->
46
46
  <link rel="stylesheet" href="/css/notion-style.css">
47
47
 
48
+
49
+
48
50
  <!-- Favicon -->
49
51
  <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>">
50
52
 
@@ -63,8 +65,8 @@
63
65
  "name": "Knowcode Ltd",
64
66
  "url": "https://knowcode.tech"
65
67
  },
66
- "datePublished": "2025-07-24T09:07:52.318Z",
67
- "dateModified": "2025-07-24T09:07:52.318Z",
68
+ "datePublished": "2025-07-25T13:49:06.512Z",
69
+ "dateModified": "2025-07-25T13:49:06.512Z",
68
70
  "mainEntityOfPage": {
69
71
  "@type": "WebPage",
70
72
  "@id": "https://doc-builder-delta.vercel.app/documentation-index.html"
@@ -97,7 +99,7 @@
97
99
 
98
100
  <div class="header-actions">
99
101
  <div class="deployment-info">
100
- <span class="deployment-date" title="Built with doc-builder v1.7.2">Last updated: Jul 24, 2025, 09:07 AM UTC</span>
102
+ <span class="deployment-date" title="Built with doc-builder v1.7.5">Last updated: Jul 25, 2025, 01:49 PM UTC</span>
101
103
  </div>
102
104
 
103
105
 
@@ -155,14 +157,22 @@
155
157
  <i class="fas fa-chevron-right collapse-icon"></i><i class="fas fa-folder"></i> Guides
156
158
  </a>
157
159
  <div class="nav-content collapsed" id="nav-guides-1">
158
- <a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="This guide explains how to configure and use the built-in authentication feature in @knowcode/doc-builder to protect your documentation with basic..."><i class="fas fa-file-alt"></i> Authentication Guide</a>
160
+ <a href="/guides/authentication-default-change.html" class="nav-item" data-tooltip="Starting from version 1.7.4, @knowcode/doc-builder now defaults to no authentication for all documentation sites."><i class="fas fa-file-alt"></i> Authentication Default Change</a>
161
+ <a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="🚨 This authentication method has been REMOVED in version 2.0.0 due to serious security flaws."><i class="fas fa-file-alt"></i> Authentication Guide</a>
162
+ <a href="/guides/cache-control-anti-pattern.html" class="nav-item" data-tooltip="Cache Control Anti-Pattern: Why Aggressive Cache-Busting is Bad for Documentation Sites."><i class="fas fa-file-alt"></i> Cache Control Anti Pattern</a>
159
163
  <a href="/guides/claude-workflow-guide.html" class="nav-item" data-tooltip="This guide demonstrates an efficient workflow for using Claude Code with a refined CLAUDE.md file to create high-quality documentation and deploy it..."><i class="fas fa-file-alt"></i> Claude Workflow Guide</a>
160
164
  <a href="/guides/documentation-standards.html" class="nav-item" data-tooltip="This document defines the documentation standards and conventions for the @knowcode/doc-builder project."><i class="fas fa-file-alt"></i> Documentation Standards</a>
165
+ <a href="/guides/next-steps-walkthrough.html" class="nav-item" data-tooltip="Now that we&#039;ve implemented Supabase authentication, let&#039;s walk through testing the implementation and preparing for deployment."><i class="fas fa-file-alt"></i> Next Steps Walkthrough</a>
161
166
  <a href="/guides/phosphor-icons-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder automatically converts Unicode emojis in your markdown files to beautiful Phosphor icons in the generated HTML."><i class="fas fa-file-alt"></i> Phosphor Icons Guide</a>
167
+ <a href="/guides/public-site-deployment.html" class="nav-item" data-tooltip="The @knowcode/doc-builder now supports deploying public documentation sites without authentication."><i class="fas fa-file-alt"></i> Public Site Deployment</a>
162
168
  <a href="/guides/search-engine-verification-guide.html" class="nav-item" data-tooltip="Search engine verification provides access to powerful webmaster tools:."><i class="fas fa-file-alt"></i> Search Engine Verification Guide</a>
163
169
  <a href="/guides/seo-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features to help your documentation rank better in search results and..."><i class="fas fa-file-alt"></i> Seo Guide</a>
164
170
  <a href="/guides/seo-optimization-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features that automatically optimize your documentation for search..."><i class="fas fa-file-alt"></i> Seo Optimization Guide</a>
171
+ <a href="/guides/supabase-auth-implementation-plan.html" class="nav-item" data-tooltip="Supabase Auth Implementation Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Implementation Plan</a>
172
+ <a href="/guides/supabase-auth-integration-plan.html" class="nav-item" data-tooltip="Supabase Authentication Integration Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Integration Plan</a>
173
+ <a href="/guides/supabase-auth-setup-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder now supports enterprise-grade authentication through Supabase, replacing the previous insecure basic authentication."><i class="fas fa-file-alt"></i> Supabase Auth Setup Guide</a>
165
174
  <a href="/guides/troubleshooting-guide.html" class="nav-item" data-tooltip="This guide helps you resolve common issues when using @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Troubleshooting Guide</a>
175
+ <a href="/guides/vercel-deployment-auth-setup.html" class="nav-item" data-tooltip="Vercel Deployment Authentication Setup Guide."><i class="fas fa-file-alt"></i> Vercel Deployment Auth Setup</a>
166
176
  <a href="/guides/windows-setup-guide.html" class="nav-item" data-tooltip="This guide helps Windows users set up the complete AI-powered documentation workflow using Claude Code, @knowcode/doc-builder, and Vercel."><i class="fas fa-file-alt"></i> Windows Setup Guide</a></div></div>
167
177
  <div class="nav-section" data-level="1">
168
178
  <a class="nav-title collapsible" href="/launch/README.html" data-target="nav-launch-1" >