@knowcode/doc-builder 1.7.6 → 1.8.1

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 (50) hide show
  1. package/.claude/settings.local.json +6 -1
  2. package/CHANGELOG.md +29 -0
  3. package/assets/css/notion-style.css +9 -1
  4. package/assets/js/main.js +10 -6
  5. package/html/README.html +44 -20
  6. package/html/auth.js +62 -13
  7. package/html/css/notion-style.css +9 -1
  8. package/html/documentation-index.html +44 -20
  9. package/html/guides/authentication-default-change.html +44 -20
  10. package/html/guides/authentication-guide.html +228 -263
  11. package/html/guides/claude-workflow-guide.html +44 -20
  12. package/html/guides/documentation-standards.html +44 -20
  13. package/html/guides/phosphor-icons-guide.html +44 -20
  14. package/html/guides/private-directory-authentication.html +472 -0
  15. package/html/guides/public-site-deployment.html +50 -25
  16. package/html/guides/search-engine-verification-guide.html +44 -20
  17. package/html/guides/seo-guide.html +44 -20
  18. package/html/guides/seo-optimization-guide.html +44 -20
  19. package/html/guides/troubleshooting-guide.html +44 -20
  20. package/html/guides/windows-setup-guide.html +44 -20
  21. package/html/index.html +44 -20
  22. package/html/js/auth.js +118 -39
  23. package/html/js/main.js +10 -6
  24. package/html/login.html +4 -4
  25. package/html/logout.html +2 -2
  26. package/html/private/cache-control-anti-pattern.html +408 -0
  27. package/html/private/launch/README.html +350 -0
  28. package/html/private/launch/auth-cleanup-summary.html +340 -0
  29. package/html/private/launch/bubble-plugin-specification.html +986 -0
  30. package/html/private/launch/go-to-market-strategy.html +716 -0
  31. package/html/private/launch/launch-announcements.html +646 -0
  32. package/html/private/launch/vercel-deployment-auth-setup.html +390 -0
  33. package/html/private/next-steps-walkthrough.html +685 -0
  34. package/html/private/supabase-auth-implementation-completed.html +433 -0
  35. package/html/private/supabase-auth-implementation-plan.html +590 -0
  36. package/html/private/supabase-auth-integration-plan.html +718 -0
  37. package/html/private/supabase-auth-setup-guide.html +545 -0
  38. package/html/private/test-private-doc.html +281 -0
  39. package/html/robots.txt +4 -0
  40. package/html/sitemap.xml +113 -29
  41. package/html/vercel-cli-setup-guide.html +44 -20
  42. package/html/vercel-first-time-setup-guide.html +44 -20
  43. package/lib/config.js +21 -3
  44. package/lib/core-builder.js +49 -7
  45. package/lib/supabase-auth.js +80 -25
  46. package/package.json +1 -1
  47. package/user-management/README.md +306 -0
  48. package/user-management/add-users.sh +730 -0
  49. package/user-management/create-user.js +65 -0
  50. package/user-management/users.txt +15 -0
package/html/index.html CHANGED
@@ -46,6 +46,39 @@
46
46
  <link rel="stylesheet" href="/css/notion-style.css">
47
47
 
48
48
 
49
+ <!-- Hide content until auth check -->
50
+ <style>
51
+ body {
52
+ visibility: hidden;
53
+ opacity: 0;
54
+ transition: opacity 0.3s ease;
55
+ }
56
+ body.authenticated {
57
+ visibility: visible;
58
+ opacity: 1;
59
+ }
60
+ /* Show login/logout pages immediately */
61
+ body.auth-page {
62
+ visibility: visible;
63
+ opacity: 1;
64
+ }
65
+ /* Style auth button consistently */
66
+ .auth-btn {
67
+ background: none;
68
+ border: none;
69
+ color: var(--text-secondary);
70
+ cursor: pointer;
71
+ padding: 0.5rem;
72
+ border-radius: 0.5rem;
73
+ transition: all 0.2s;
74
+ font-size: 1.1rem;
75
+ }
76
+ .auth-btn:hover {
77
+ background: var(--bg-secondary);
78
+ color: var(--text-primary);
79
+ }
80
+ </style>
81
+
49
82
 
50
83
  <!-- Favicon -->
51
84
  <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>">
@@ -65,8 +98,8 @@
65
98
  "name": "Knowcode Ltd",
66
99
  "url": "https://knowcode.tech"
67
100
  },
68
- "datePublished": "2025-07-25T13:49:06.502Z",
69
- "dateModified": "2025-07-25T13:49:06.502Z",
101
+ "datePublished": "2025-07-26T10:20:52.365Z",
102
+ "dateModified": "2025-07-26T10:20:52.365Z",
70
103
  "mainEntityOfPage": {
71
104
  "@type": "WebPage",
72
105
  "@id": "https://doc-builder-delta.vercel.app/README.html"
@@ -99,10 +132,14 @@
99
132
 
100
133
  <div class="header-actions">
101
134
  <div class="deployment-info">
102
- <span class="deployment-date" title="Built with doc-builder v1.7.5">Last updated: Jul 25, 2025, 01:49 PM UTC</span>
135
+ <span class="deployment-date" title="Built with doc-builder v1.8.0">Last updated: Jul 26, 2025, 10:20 AM UTC</span>
103
136
  </div>
104
137
 
105
138
 
139
+ <a href="../login.html" class="auth-btn" title="Login/Logout">
140
+ <i class="fas fa-sign-in-alt"></i>
141
+ </a>
142
+
106
143
 
107
144
  <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
108
145
  <i class="fas fa-moon"></i>
@@ -158,31 +195,17 @@
158
195
  </a>
159
196
  <div class="nav-content" id="nav-guides-1">
160
197
  <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>
198
+ <a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder supports enterprise-grade authentication through Supabase - a secure, scalable authentication platform."><i class="fas fa-file-alt"></i> Authentication Guide</a>
163
199
  <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>
164
200
  <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>
166
201
  <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>
202
+ <a href="/guides/private-directory-authentication.html" class="nav-item" data-tooltip="The @knowcode/doc-builder provides flexible authentication options to protect your documentation."><i class="fas fa-file-alt"></i> Private Directory Authentication</a>
167
203
  <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>
168
204
  <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>
169
205
  <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>
170
206
  <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>
174
207
  <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>
176
208
  <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>
177
- <div class="nav-section" data-level="1">
178
- <a class="nav-title collapsible expanded" href="/launch/README.html" data-target="nav-launch-1" >
179
- <i class="fas fa-chevron-right collapse-icon"></i><i class="fas fa-folder"></i> Launch
180
- </a>
181
- <div class="nav-content" id="nav-launch-1">
182
- <a href="/launch/README.html" class="nav-item" data-tooltip="This directory contains all documentation related to the commercial launch of @knowcode/doc-builder, including go-to-market strategy, platform..."><i class="fas fa-file-alt"></i> Launch Overview</a>
183
- <a href="/launch/bubble-plugin-specification.html" class="nav-item" data-tooltip="This document outlines the technical specification for creating a Bubble.io plugin that integrates @knowcode/doc-builder, enabling Bubble developers..."><i class="fas fa-file-alt"></i> Bubble Plugin Specification</a>
184
- <a href="/launch/go-to-market-strategy.html" class="nav-item" data-tooltip="Go-to-Market Strategy &amp; Product Launch Plan."><i class="fas fa-file-alt"></i> Go To Market Strategy</a>
185
- <a href="/launch/launch-announcements.html" class="nav-item" data-tooltip="This document contains ready-to-use announcement templates for launching @knowcode/doc-builder across various platforms and channels."><i class="fas fa-file-alt"></i> Launch Announcements</a></div></div>
186
209
  </nav>
187
210
  <div class="resize-handle"></div>
188
211
  </aside>
@@ -442,6 +465,7 @@ docBuilder.build({
442
465
  };
443
466
  </script>
444
467
  <script src="/js/main.js"></script>
445
-
468
+ <script src="https://unpkg.com/@supabase/supabase-js@2"></script>
469
+ <script src="/js/auth.js"></script>
446
470
  </body>
447
471
  </html>
package/html/js/auth.js CHANGED
@@ -1,10 +1,7 @@
1
+
1
2
  /**
2
- * Simple Client-Side Authentication for Documentation
3
- * This runs on every page load to check authentication
4
- *
5
- * IMPORTANT: This is a basic authentication system suitable for
6
- * protecting documentation from casual access. For production
7
- * use with sensitive data, implement server-side authentication.
3
+ * Supabase Authentication for Documentation Site
4
+ * Generated by @knowcode/doc-builder
8
5
  */
9
6
 
10
7
  (function() {
@@ -12,56 +9,138 @@
12
9
 
13
10
  // Skip auth check on login and logout pages
14
11
  const currentPage = window.location.pathname;
15
- if (currentPage === '/login.html' || currentPage === '/logout.html' || currentPage.includes('login') || currentPage.includes('logout')) {
12
+ if (currentPage === '/login.html' || currentPage === '/logout.html' ||
13
+ currentPage.includes('login') || currentPage.includes('logout')) {
16
14
  return;
17
15
  }
18
16
 
19
- // Check if user is authenticated
20
- function isAuthenticated() {
21
- const authToken = getCookie('doc-auth');
22
- if (!authToken) return false;
23
-
17
+ // Initialize Supabase client
18
+ const { createClient } = supabase;
19
+ const supabaseClient = createClient('https://placeholder.supabase.co', 'placeholder-key', {
20
+ auth: {
21
+ persistSession: true,
22
+ autoRefreshToken: true,
23
+ detectSessionInUrl: true
24
+ }
25
+ });
26
+
27
+ // Check authentication and site access
28
+ async function checkAuth() {
24
29
  try {
25
- // Simple token validation - just check if it exists and has expected format
26
- // The actual validation happens server-side (or in login page for static sites)
27
- const decoded = atob(authToken);
28
- return decoded && decoded.includes(':');
30
+ // Check if current page is in private directory
31
+ const currentPath = window.location.pathname;
32
+ const isPrivatePage = currentPath.includes('/private/');
33
+
34
+ // Get current user session
35
+ const { data: { user }, error: userError } = await supabaseClient.auth.getUser();
36
+
37
+ if (userError || !user) {
38
+ // Only redirect if we're on a private page
39
+ if (isPrivatePage) {
40
+ redirectToLogin();
41
+ } else {
42
+ // Public page, just show it
43
+ document.body.classList.add('authenticated'); // Use same class to show body
44
+ updateAuthButton(false);
45
+ }
46
+ return;
47
+ }
48
+
49
+ // Check if user has access to this site
50
+ const { data: access, error: accessError } = await supabaseClient
51
+ .from('docbuilder_access')
52
+ .select('*')
53
+ .eq('user_id', user.id)
54
+ .eq('site_id', 'placeholder-site-id')
55
+ .single();
56
+
57
+ if (accessError || !access) {
58
+ if (isPrivatePage) {
59
+ showAccessDenied();
60
+ } else {
61
+ // Public page, just show it
62
+ document.body.classList.add('authenticated');
63
+ updateAuthButton(false);
64
+ }
65
+ return;
66
+ }
67
+
68
+ // User is authenticated and has access
69
+ console.log('User authenticated and authorized');
70
+ document.body.classList.add('authenticated');
71
+ updateAuthButton(true);
72
+
29
73
  } catch (error) {
30
- return false;
74
+ console.error('Auth check failed:', error);
75
+ if (window.location.pathname.includes('/private/')) {
76
+ redirectToLogin();
77
+ } else {
78
+ // Public page, show it anyway
79
+ document.body.classList.add('authenticated');
80
+ updateAuthButton(false);
81
+ }
31
82
  }
32
83
  }
33
84
 
34
- // Get cookie value
35
- function getCookie(name) {
36
- const value = `; ${document.cookie}`;
37
- const parts = value.split(`; ${name}=`);
38
- if (parts.length === 2) return parts.pop().split(';').shift();
39
- return null;
40
- }
41
-
42
- // Redirect to login if not authenticated
85
+ // Redirect to login page
43
86
  function redirectToLogin() {
44
87
  const currentUrl = window.location.pathname + window.location.search;
45
88
  const loginUrl = '/login.html' + (currentUrl !== '/' ? '?redirect=' + encodeURIComponent(currentUrl) : '');
46
89
  window.location.href = loginUrl;
47
90
  }
48
91
 
49
- // Check authentication on page load
50
- if (!isAuthenticated()) {
51
- redirectToLogin();
92
+ // Show access denied message
93
+ function showAccessDenied() {
94
+ document.body.classList.add('authenticated'); // Show the body
95
+ document.body.innerHTML = `
96
+ <div style="display: flex; justify-content: center; align-items: center; height: 100vh; font-family: Inter, sans-serif;">
97
+ <div style="text-align: center; max-width: 400px;">
98
+ <h1 style="color: #ef4444; margin-bottom: 1rem;">Access Denied</h1>
99
+ <p style="color: #6b7280; margin-bottom: 2rem;">You don't have permission to view this documentation site.</p>
100
+ <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>
101
+ </div>
102
+ </div>
103
+ `;
52
104
  }
53
105
 
54
- // Add logout functionality to logout buttons
106
+ // Function to update auth button
107
+ function updateAuthButton(isAuthenticated) {
108
+ const authBtn = document.querySelector('.auth-btn');
109
+ if (authBtn) {
110
+ const icon = authBtn.querySelector('i');
111
+ if (icon) {
112
+ if (isAuthenticated) {
113
+ icon.className = 'fas fa-sign-out-alt';
114
+ authBtn.title = 'Logout';
115
+ authBtn.href = '/logout.html';
116
+ } else {
117
+ icon.className = 'fas fa-sign-in-alt';
118
+ authBtn.title = 'Login';
119
+ authBtn.href = '/login.html';
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ // Add auth button functionality
55
126
  document.addEventListener('DOMContentLoaded', function() {
56
- const logoutLinks = document.querySelectorAll('a[href*="logout"]');
57
- logoutLinks.forEach(link => {
58
- link.addEventListener('click', function(e) {
59
- e.preventDefault();
60
- // Clear auth cookie
61
- document.cookie = 'doc-auth=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
62
- window.location.href = '/logout.html';
127
+ const authBtn = document.querySelector('.auth-btn');
128
+ if (authBtn) {
129
+ authBtn.addEventListener('click', async function(e) {
130
+ // Check if we're logged in
131
+ const { data: { user } } = await supabaseClient.auth.getUser();
132
+ if (user) {
133
+ // Logged in - sign out
134
+ e.preventDefault();
135
+ await supabaseClient.auth.signOut();
136
+ window.location.href = '/logout.html';
137
+ }
138
+ // If not logged in, normal navigation to login page will occur
63
139
  });
64
- });
140
+ }
65
141
  });
66
142
 
67
- })();
143
+ // Run auth check
144
+ checkAuth();
145
+
146
+ })();
package/html/js/main.js CHANGED
@@ -665,12 +665,16 @@ document.addEventListener('click', (e) => {
665
665
  document.querySelectorAll('a[href^="#"]').forEach(anchor => {
666
666
  anchor.addEventListener('click', function (e) {
667
667
  e.preventDefault();
668
- const target = document.querySelector(this.getAttribute('href'));
669
- if (target) {
670
- target.scrollIntoView({
671
- behavior: 'smooth',
672
- block: 'start'
673
- });
668
+ const href = this.getAttribute('href');
669
+ // Skip if href is just '#' (prevents querySelector error)
670
+ if (href && href !== '#') {
671
+ const target = document.querySelector(href);
672
+ if (target) {
673
+ target.scrollIntoView({
674
+ behavior: 'smooth',
675
+ block: 'start'
676
+ });
677
+ }
674
678
  }
675
679
  });
676
680
  });
package/html/login.html CHANGED
@@ -3,14 +3,14 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Login - Test Documentation</title>
6
+ <title>Login - @knowcode/doc-builder</title>
7
7
  <link rel="stylesheet" href="css/notion-style.css">
8
8
  <script src="https://unpkg.com/@supabase/supabase-js@2"></script>
9
9
  </head>
10
10
  <body class="auth-page">
11
11
  <div class="auth-container">
12
12
  <div class="auth-box">
13
- <h1>Login to Test Documentation</h1>
13
+ <h1>Login to @knowcode/doc-builder</h1>
14
14
  <form id="login-form">
15
15
  <div class="form-group">
16
16
  <label for="email">Email</label>
@@ -32,7 +32,7 @@
32
32
  <script>
33
33
  // Initialize Supabase
34
34
  const { createClient } = supabase;
35
- const supabaseClient = createClient('https://xcihhnfcitjrwbynxmka.supabase.co', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY');
35
+ const supabaseClient = createClient('https://placeholder.supabase.co', 'placeholder-key');
36
36
 
37
37
  // Handle login form
38
38
  document.getElementById('login-form').addEventListener('submit', async function(e) {
@@ -56,7 +56,7 @@
56
56
  .from('docbuilder_access')
57
57
  .select('*')
58
58
  .eq('user_id', data.user.id)
59
- .eq('site_id', '4d8a53bf-dcdd-48c0-98e0-cd1451518735')
59
+ .eq('site_id', 'placeholder-site-id')
60
60
  .single();
61
61
 
62
62
  if (accessError || !access) {
package/html/logout.html CHANGED
@@ -3,14 +3,14 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Logged Out - Test Documentation</title>
6
+ <title>Logged Out - @knowcode/doc-builder</title>
7
7
  <link rel="stylesheet" href="css/notion-style.css">
8
8
  </head>
9
9
  <body class="auth-page">
10
10
  <div class="auth-container">
11
11
  <div class="auth-box">
12
12
  <h1>You have been logged out</h1>
13
- <p>Thank you for using Test Documentation.</p>
13
+ <p>Thank you for using @knowcode/doc-builder.</p>
14
14
  <a href="login.html" class="auth-button">Login Again</a>
15
15
  </div>
16
16
  </div>