@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
@@ -0,0 +1,306 @@
1
+ # Doc-Builder User Management System
2
+
3
+ A comprehensive user management solution for Supabase-authenticated documentation sites using the Supabase CLI.
4
+
5
+ ## 🚀 Quick Start
6
+
7
+ ```bash
8
+ # Initial setup
9
+ ./add-users.sh setup
10
+
11
+ # Add a user
12
+ ./add-users.sh add wru-bid-analysis.vercel.app user@email.com
13
+
14
+ # List all users for a site
15
+ ./add-users.sh list wru-bid-analysis.vercel.app
16
+ ```
17
+
18
+ ## 📋 Prerequisites
19
+
20
+ 1. **Install Supabase CLI**:
21
+ ```bash
22
+ npm install -g supabase
23
+ ```
24
+
25
+ 2. **Login to Supabase**:
26
+ ```bash
27
+ supabase login
28
+ ```
29
+
30
+ 3. **Link your project** (or use the setup command):
31
+ ```bash
32
+ ./add-users.sh setup
33
+ ```
34
+
35
+ ## 🔧 Installation
36
+
37
+ The user management system is self-contained in this folder:
38
+
39
+ ```
40
+ user-management/
41
+ ├── add-users.sh # Main script
42
+ ├── users.txt # Example bulk user file
43
+ ├── README.md # This documentation
44
+ └── .env.example # Environment variables template
45
+ ```
46
+
47
+ ## 📖 Commands
48
+
49
+ ### Setup
50
+
51
+ Initialize and link your Supabase project:
52
+
53
+ ```bash
54
+ ./add-users.sh setup
55
+ ```
56
+
57
+ This will:
58
+ - Check if Supabase CLI is installed
59
+ - Verify you're logged in
60
+ - Link your project (prompts for project ID)
61
+ - Test the database connection
62
+ - Save configuration for future use
63
+
64
+ ### Add User
65
+
66
+ Create a user and grant them access to a specific site:
67
+
68
+ ```bash
69
+ ./add-users.sh add <site-url> <email>
70
+
71
+ # Example
72
+ ./add-users.sh add docs.example.com john@company.com
73
+ ```
74
+
75
+ This will:
76
+ - Create the user account if it doesn't exist
77
+ - Send them a password reset email
78
+ - Grant access to the specified site
79
+ - Show confirmation of access granted
80
+
81
+ ### Bulk Add Users
82
+
83
+ Add multiple users from a file:
84
+
85
+ ```bash
86
+ ./add-users.sh bulk <site-url> <file>
87
+
88
+ # Example
89
+ ./add-users.sh bulk docs.example.com users.txt
90
+ ```
91
+
92
+ File format (users.txt):
93
+ ```
94
+ # Comments start with #
95
+ # One email per line
96
+ john@example.com
97
+ jane@example.com
98
+ admin@company.com
99
+ ```
100
+
101
+ ### List Users
102
+
103
+ Show all users with access to a site:
104
+
105
+ ```bash
106
+ ./add-users.sh list <site-url>
107
+
108
+ # Example
109
+ ./add-users.sh list wru-bid-analysis.vercel.app
110
+ ```
111
+
112
+ Output includes:
113
+ - Email address
114
+ - When user was created
115
+ - When access was granted
116
+ - Last login time
117
+ - Total user count
118
+
119
+ ### Check User
120
+
121
+ Check a user's status across all sites:
122
+
123
+ ```bash
124
+ ./add-users.sh check <email>
125
+
126
+ # Example
127
+ ./add-users.sh check user@example.com
128
+ ```
129
+
130
+ Shows:
131
+ - If user exists
132
+ - All sites they have access to
133
+ - Last login information
134
+
135
+ ### Remove Access
136
+
137
+ Remove a user's access to a specific site:
138
+
139
+ ```bash
140
+ ./add-users.sh remove <site-url> <email>
141
+
142
+ # Example
143
+ ./add-users.sh remove docs.example.com user@example.com
144
+ ```
145
+
146
+ Note: This only removes access, it doesn't delete the user account.
147
+
148
+ ### List Sites
149
+
150
+ Show all documentation sites in the system:
151
+
152
+ ```bash
153
+ ./add-users.sh sites
154
+ ```
155
+
156
+ Shows:
157
+ - Site ID
158
+ - Domain
159
+ - Site name
160
+ - Creation date
161
+ - Number of users
162
+
163
+ ### Delete User
164
+
165
+ Permanently delete a user (removes from ALL sites):
166
+
167
+ ```bash
168
+ ./add-users.sh delete-user <email>
169
+
170
+ # Example
171
+ ./add-users.sh delete-user user@example.com
172
+ ```
173
+
174
+ ⚠️ **Warning**: This is permanent and cannot be undone!
175
+
176
+ ## ⚠️ Important Limitations
177
+
178
+ The Supabase CLI doesn't support direct user creation. The script offers two workarounds:
179
+
180
+ 1. **Manual Creation** (Recommended): Opens the Supabase dashboard where you can invite users
181
+ 2. **Programmatic Creation** (Advanced): If you provide your service_role key, the script can create users using the Admin API
182
+
183
+ ## 🔐 Security Notes
184
+
185
+ 1. **User Creation**: When users are created, they receive a password reset email to set their own password
186
+ 2. **Access Control**: Users only see sites they have explicit access to
187
+ 3. **Audit Trail**: All access grants are timestamped in the database
188
+ 4. **No Passwords**: The system never handles or stores passwords directly
189
+ 5. **Service Role Key**: If using programmatic creation, your service_role key is never stored
190
+
191
+ ## 🛠️ Troubleshooting
192
+
193
+ ### "Supabase CLI not found"
194
+
195
+ Install the Supabase CLI:
196
+ ```bash
197
+ npm install -g supabase
198
+ ```
199
+
200
+ ### "Not logged in to Supabase"
201
+
202
+ Login to your Supabase account:
203
+ ```bash
204
+ supabase login
205
+ ```
206
+
207
+ ### "Project not linked"
208
+
209
+ Run the setup command:
210
+ ```bash
211
+ ./add-users.sh setup
212
+ ```
213
+
214
+ ### "Site not found"
215
+
216
+ Make sure the site exists in the `docbuilder_sites` table. You can check with:
217
+ ```bash
218
+ ./add-users.sh sites
219
+ ```
220
+
221
+ ### "User already exists"
222
+
223
+ This is fine - the script will continue and grant access to the site.
224
+
225
+ ### "Access already granted"
226
+
227
+ The user already has access to this site. No action needed.
228
+
229
+ ## 📊 Database Schema
230
+
231
+ The system uses two main tables:
232
+
233
+ ### docbuilder_sites
234
+ - `id` (UUID) - Primary key
235
+ - `domain` (TEXT) - Site URL without https://
236
+ - `name` (TEXT) - Display name
237
+ - `created_at` (TIMESTAMP)
238
+
239
+ ### docbuilder_access
240
+ - `user_id` (UUID) - References auth.users
241
+ - `site_id` (UUID) - References docbuilder_sites
242
+ - `created_at` (TIMESTAMP)
243
+
244
+ ## 🎯 Common Workflows
245
+
246
+ ### Setting up a new documentation site
247
+
248
+ 1. Add the site to the database (manually or via SQL)
249
+ 2. Add users who should have access:
250
+ ```bash
251
+ ./add-users.sh add my-docs.vercel.app user1@example.com
252
+ ./add-users.sh add my-docs.vercel.app user2@example.com
253
+ ```
254
+
255
+ ### Onboarding multiple team members
256
+
257
+ 1. Create a users.txt file with all email addresses
258
+ 2. Run bulk add:
259
+ ```bash
260
+ ./add-users.sh bulk my-docs.vercel.app users.txt
261
+ ```
262
+
263
+ ### Auditing access
264
+
265
+ Check who has access to a site:
266
+ ```bash
267
+ ./add-users.sh list my-docs.vercel.app
268
+ ```
269
+
270
+ Check what sites a user can access:
271
+ ```bash
272
+ ./add-users.sh check user@example.com
273
+ ```
274
+
275
+ ### Offboarding a user
276
+
277
+ Remove from specific site:
278
+ ```bash
279
+ ./add-users.sh remove my-docs.vercel.app former-employee@example.com
280
+ ```
281
+
282
+ Or remove completely:
283
+ ```bash
284
+ ./add-users.sh delete-user former-employee@example.com
285
+ ```
286
+
287
+ ## 🔧 Configuration
288
+
289
+ The script stores its configuration in `.supabase-config` after setup. You can also set environment variables:
290
+
291
+ - `SUPABASE_PROJECT_ID` - Your project ID
292
+ - `SUPABASE_DB_URL` - Database connection URL (optional)
293
+
294
+ ## 📝 Notes
295
+
296
+ - Site URLs should be entered without `https://` prefix
297
+ - Users receive password reset emails when created
298
+ - The script uses the Supabase CLI for all operations
299
+ - All actions are logged with colored output for clarity
300
+ - Destructive operations require confirmation
301
+
302
+ ## 🆘 Support
303
+
304
+ - GitHub: https://github.com/wapdat/doc-builder
305
+ - Documentation: https://doc-builder-delta.vercel.app
306
+ - Supabase Dashboard: https://supabase.com/dashboard