@knowcode/doc-builder 1.9.30 → 1.9.31
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.
- package/package.json +12 -2
- package/.claude/settings.local.json +0 -56
- package/CACHE-BUSTING-GUIDE.md +0 -82
- package/CLAUDE.md +0 -86
- package/CONTRIBUTING.md +0 -148
- package/GITHUB_SETUP.md +0 -203
- package/RELEASE-NOTES-1.7.5.md +0 -64
- package/Screenshot 2025-07-22 at 19.51.21.png +0 -0
- package/Screenshot 2025-07-26 at 17.06.49.png +0 -0
- package/add-user-clive.sql +0 -35
- package/add-user-lindsay-fixed.sql +0 -85
- package/add-user-lindsay.sql +0 -68
- package/add-user-pmorgan.sql +0 -35
- package/add-user-robbie.sql +0 -35
- package/add-wru-users.sql +0 -105
- package/debug-login.sql +0 -30
- package/doc-builder.config.js +0 -126
- package/doc-builder.config.js.backup.1753793768283 +0 -47
- package/doc-builder.config.js.backup.1753803964423 +0 -114
- package/doc-builder.config.js.backup.1753945707032 +0 -115
- package/doc-builder.config.js.backup.1754059241330 +0 -115
- package/doc-builder.config.js.backup.1754119567787 +0 -123
- package/doc-builder.config.js.backup.1754120048862 +0 -124
- package/doc-builder.config.js.backup.1754120529913 +0 -124
- package/doc-builder.config.js.backup.1754218469785 +0 -124
- package/doc-builder.config.js.backup.1754384764054 +0 -124
- package/doc-builder.config.js.backup.1754567425847 +0 -124
- package/doc-builder.config.js.backup.1754568137859 +0 -126
- package/doc-builder.config.js.backup.1754569388252 +0 -126
- package/doc-builder.config.js.backup.1754576694123 +0 -126
- package/doc-builder.config.js.backup.1755031374829 +0 -126
- package/doc-builder.config.js.backup.1755034500990 +0 -126
- package/doc-builder.config.js.backup.1755034809236 +0 -126
- package/grant-access.sql +0 -15
- package/html/11.png +0 -0
- package/html/404.html +0 -115
- package/html/README.html +0 -522
- package/html/Screenshot 2025-08-12 at 21.35.07.png +0 -0
- package/html/about-doc-builder.html +0 -491
- package/html/auth.js +0 -157
- package/html/claude-workflow-guide.html +0 -525
- package/html/css/notion-style.css +0 -2502
- package/html/documentation-index.html +0 -471
- package/html/guides/authentication-default-change.html +0 -370
- package/html/guides/authentication-guide.html +0 -509
- package/html/guides/cache-control-anti-pattern.html +0 -361
- package/html/guides/claude-workflow-guide.html +0 -1074
- package/html/guides/configuration-guide.html +0 -472
- package/html/guides/document-standards.html +0 -518
- package/html/guides/documentation-standards.html +0 -694
- package/html/guides/html-embedding-guide.html +0 -461
- package/html/guides/image-modal-guide.html +0 -515
- package/html/guides/next-steps-walkthrough.html +0 -638
- package/html/guides/phosphor-icons-guide.html +0 -584
- package/html/guides/private-directory-authentication-troubleshooting.html +0 -555
- package/html/guides/private-directory-authentication.html +0 -541
- package/html/guides/public-site-deployment.html +0 -431
- package/html/guides/search-engine-verification-guide.html +0 -542
- package/html/guides/seo-guide.html +0 -661
- package/html/guides/seo-optimization-guide.html +0 -887
- package/html/guides/supabase-auth-implementation-plan.html +0 -543
- package/html/guides/supabase-auth-integration-plan.html +0 -671
- package/html/guides/supabase-auth-setup-guide.html +0 -498
- package/html/guides/supabase-authentication-complete-guide.html +0 -866
- package/html/guides/troubleshooting-guide.html +0 -633
- package/html/guides/vercel-deployment-auth-setup.html +0 -337
- package/html/guides/windows-setup-guide.html +0 -859
- package/html/image-modal-test.html +0 -318
- package/html/index.html +0 -522
- package/html/js/auth.js +0 -157
- package/html/js/main.js +0 -1754
- package/html/launch/README.html +0 -297
- package/html/launch/bubble-plugin-specification.html +0 -933
- package/html/launch/go-to-market-strategy.html +0 -663
- package/html/launch/launch-announcements.html +0 -593
- package/html/login.html +0 -102
- package/html/logout.html +0 -18
- package/html/private/cache-control-anti-pattern.html +0 -429
- package/html/private/launch/README.html +0 -371
- package/html/private/launch/auth-cleanup-summary.html +0 -361
- package/html/private/launch/bubble-plugin-specification.html +0 -1007
- package/html/private/launch/go-to-market-strategy.html +0 -737
- package/html/private/launch/launch-announcements.html +0 -667
- package/html/private/launch/vercel-deployment-auth-setup.html +0 -417
- package/html/private/next-steps-walkthrough.html +0 -679
- package/html/private/supabase-auth-implementation-completed.html +0 -454
- package/html/private/supabase-auth-implementation-plan.html +0 -594
- package/html/private/supabase-auth-integration-plan.html +0 -704
- package/html/private/supabase-auth-setup-guide.html +0 -555
- package/html/private/test-private-doc.html +0 -302
- package/html/private/user-management-tooling.html +0 -601
- package/html/prompts/Screenshot 2025-08-02 at 08.49.55.png +0 -0
- package/html/prompts/beautiful-documentation-design.html +0 -784
- package/html/prompts/markdown-document-standards.html +0 -422
- package/html/prompts/project-rename-strategy-sasha-publish.html +0 -530
- package/html/robots.txt +0 -9
- package/html/sitemap.xml +0 -357
- package/html/test-questions/how-does-it-work%3F.html +0 -294
- package/html/test-questions/step-1%3A%20getting-started.html +0 -289
- package/html/test-questions/what-is-the-purpose.html +0 -293
- package/html/test-status.html +0 -281
- package/html/vercel-cli-setup-guide.html +0 -495
- package/html/vercel-first-time-setup-guide.html +0 -454
- package/html/vercel.json +0 -29
- package/html-static/11.png +0 -0
- package/html-static/404.html +0 -115
- package/html-static/README.html +0 -609
- package/html-static/Screenshot 2025-08-12 at 21.35.07.png +0 -0
- package/html-static/about-doc-builder.html +0 -578
- package/html-static/css/notion-style.css +0 -2502
- package/html-static/documentation-index.html +0 -558
- package/html-static/guides/authentication-default-change.html +0 -457
- package/html-static/guides/authentication-guide.html +0 -596
- package/html-static/guides/claude-workflow-guide.html +0 -1161
- package/html-static/guides/configuration-guide.html +0 -559
- package/html-static/guides/documentation-standards.html +0 -781
- package/html-static/guides/html-embedding-guide.html +0 -548
- package/html-static/guides/image-modal-guide.html +0 -602
- package/html-static/guides/phosphor-icons-guide.html +0 -671
- package/html-static/guides/private-directory-authentication-troubleshooting.html +0 -642
- package/html-static/guides/private-directory-authentication.html +0 -628
- package/html-static/guides/public-site-deployment.html +0 -518
- package/html-static/guides/search-engine-verification-guide.html +0 -629
- package/html-static/guides/seo-guide.html +0 -748
- package/html-static/guides/seo-optimization-guide.html +0 -974
- package/html-static/guides/supabase-authentication-complete-guide.html +0 -953
- package/html-static/guides/troubleshooting-guide.html +0 -720
- package/html-static/guides/windows-setup-guide.html +0 -946
- package/html-static/image-modal-test.html +0 -405
- package/html-static/index.html +0 -609
- package/html-static/js/main.js +0 -1754
- package/html-static/prompts/Screenshot 2025-08-02 at 08.49.55.png +0 -0
- package/html-static/prompts/beautiful-documentation-design.html +0 -871
- package/html-static/prompts/markdown-document-standards.html +0 -509
- package/html-static/prompts/project-rename-strategy-sasha-publish.html +0 -617
- package/html-static/robots.txt +0 -5
- package/html-static/sitemap.xml +0 -195
- package/html-static/test-questions/how-does-it-work%3F.html +0 -381
- package/html-static/test-questions/step-1%3A%20getting-started.html +0 -376
- package/html-static/test-questions/what-is-the-purpose.html +0 -380
- package/html-static/vercel-cli-setup-guide.html +0 -582
- package/html-static/vercel-first-time-setup-guide.html +0 -541
- package/manage-users.sql +0 -191
- package/migrate-to-domain-auth.sql +0 -47
- package/package/CACHE-BUSTING-GUIDE.md +0 -82
- package/package/CHANGELOG.md +0 -902
- package/package/README.md +0 -248
- package/package/assets/css/notion-style.css +0 -2211
- package/package/assets/js/auth.js +0 -67
- package/package/assets/js/main.js +0 -1565
- package/package/cli.js +0 -764
- package/package/index.js +0 -38
- package/package/knowcode-doc-builder-1.3.15.tgz +0 -0
- package/package/lib/builder.js +0 -32
- package/package/lib/config.js +0 -278
- package/package/lib/core-builder.js +0 -957
- package/package/lib/deploy.js +0 -497
- package/package/lib/dev-server.js +0 -96
- package/package/package.json +0 -34
- package/package/scripts/npx-runner.js +0 -27
- package/package/scripts/setup.js +0 -56
- package/package/test-cache-bust.sh +0 -43
- package/public-config.js +0 -22
- package/public-html/404.html +0 -115
- package/public-html/README.html +0 -149
- package/public-html/css/notion-style.css +0 -2036
- package/public-html/index.html +0 -149
- package/public-html/js/auth.js +0 -67
- package/public-html/js/main.js +0 -1485
- package/quick-test-commands.md +0 -40
- package/recordings/Screenshot 2025-07-24 at 18.22.01.png +0 -0
- package/recordings/mh-ls-22jul.txt +0 -2305
- package/screenshot.png +0 -0
- package/scripts/Screenshot 2025-07-23 at 15.39.41.png +0 -0
- package/setup-database-v2.sql +0 -53
- package/setup-database.sql +0 -41
- package/test-auth-config.js +0 -17
- package/test-cache-bust.sh +0 -43
- package/test-docs/README.md +0 -39
- package/test-html/404.html +0 -115
- package/test-html/README.html +0 -172
- package/test-html/auth.js +0 -97
- package/test-html/css/notion-style.css +0 -2036
- package/test-html/index.html +0 -172
- package/test-html/js/auth.js +0 -97
- package/test-html/js/main.js +0 -1485
- package/test-html/login.html +0 -102
- package/test-html/logout.html +0 -18
- package/update-domain.sql +0 -9
- package/user-access-view.sql +0 -49
- package/user-management/README.md +0 -301
- package/user-management/add-users.sh +0 -776
- package/user-management/create-user.js +0 -65
- package/user-management/users.txt +0 -15
- package/view-all-users.sql +0 -40
- package/wru-auth-config.js +0 -17
package/test-html/login.html
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Login - Test Documentation</title>
|
|
7
|
-
<link rel="stylesheet" href="css/notion-style.css">
|
|
8
|
-
<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
|
|
9
|
-
</head>
|
|
10
|
-
<body class="auth-page">
|
|
11
|
-
<div class="auth-container">
|
|
12
|
-
<div class="auth-box">
|
|
13
|
-
<h1>Login to Test Documentation</h1>
|
|
14
|
-
<form id="login-form">
|
|
15
|
-
<div class="form-group">
|
|
16
|
-
<label for="email">Email</label>
|
|
17
|
-
<input type="email" id="email" name="email" required>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="form-group">
|
|
20
|
-
<label for="password">Password</label>
|
|
21
|
-
<input type="password" id="password" name="password" required>
|
|
22
|
-
</div>
|
|
23
|
-
<button type="submit" class="auth-button">Login</button>
|
|
24
|
-
</form>
|
|
25
|
-
<div id="error-message" class="error-message"></div>
|
|
26
|
-
<div class="auth-links">
|
|
27
|
-
<a href="#" id="forgot-password">Forgot Password?</a>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<script>
|
|
33
|
-
// Initialize Supabase
|
|
34
|
-
const { createClient } = supabase;
|
|
35
|
-
const supabaseClient = createClient('https://xcihhnfcitjrwbynxmka.supabase.co', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY');
|
|
36
|
-
|
|
37
|
-
// Handle login form
|
|
38
|
-
document.getElementById('login-form').addEventListener('submit', async function(e) {
|
|
39
|
-
e.preventDefault();
|
|
40
|
-
|
|
41
|
-
const email = document.getElementById('email').value;
|
|
42
|
-
const password = document.getElementById('password').value;
|
|
43
|
-
const errorDiv = document.getElementById('error-message');
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
// Sign in with Supabase
|
|
47
|
-
const { data, error } = await supabaseClient.auth.signInWithPassword({
|
|
48
|
-
email: email,
|
|
49
|
-
password: password
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (error) throw error;
|
|
53
|
-
|
|
54
|
-
// Check if user has access to this site
|
|
55
|
-
const { data: access, error: accessError } = await supabaseClient
|
|
56
|
-
.from('docbuilder_access')
|
|
57
|
-
.select('*')
|
|
58
|
-
.eq('user_id', data.user.id)
|
|
59
|
-
.eq('site_id', '4d8a53bf-dcdd-48c0-98e0-cd1451518735')
|
|
60
|
-
.single();
|
|
61
|
-
|
|
62
|
-
if (accessError || !access) {
|
|
63
|
-
await supabaseClient.auth.signOut();
|
|
64
|
-
throw new Error('You do not have access to this documentation site');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Redirect to requested page
|
|
68
|
-
const params = new URLSearchParams(window.location.search);
|
|
69
|
-
const redirect = params.get('redirect') || '/';
|
|
70
|
-
window.location.href = redirect;
|
|
71
|
-
|
|
72
|
-
} catch (error) {
|
|
73
|
-
errorDiv.textContent = error.message;
|
|
74
|
-
errorDiv.style.display = 'block';
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Handle forgot password
|
|
79
|
-
document.getElementById('forgot-password').addEventListener('click', async function(e) {
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
|
|
82
|
-
const email = document.getElementById('email').value;
|
|
83
|
-
if (!email) {
|
|
84
|
-
alert('Please enter your email address first');
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
const { error } = await supabaseClient.auth.resetPasswordForEmail(email, {
|
|
90
|
-
redirectTo: window.location.origin + '/login.html'
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
if (error) throw error;
|
|
94
|
-
|
|
95
|
-
alert('Password reset email sent! Check your inbox.');
|
|
96
|
-
} catch (error) {
|
|
97
|
-
alert('Error sending reset email: ' + error.message);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
</script>
|
|
101
|
-
</body>
|
|
102
|
-
</html>
|
package/test-html/logout.html
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Logged Out - Test Documentation</title>
|
|
7
|
-
<link rel="stylesheet" href="css/notion-style.css">
|
|
8
|
-
</head>
|
|
9
|
-
<body class="auth-page">
|
|
10
|
-
<div class="auth-container">
|
|
11
|
-
<div class="auth-box">
|
|
12
|
-
<h1>You have been logged out</h1>
|
|
13
|
-
<p>Thank you for using Test Documentation.</p>
|
|
14
|
-
<a href="login.html" class="auth-button">Login Again</a>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
package/update-domain.sql
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
-- Update domain for Vercel deployment
|
|
2
|
-
UPDATE docbuilder_sites
|
|
3
|
-
SET domain = 'doc-builder-2znroyb5z-lindsay-1340s-projects.vercel.app'
|
|
4
|
-
WHERE id = '4d8a53bf-dcdd-48c0-98e0-cd1451518735';
|
|
5
|
-
|
|
6
|
-
-- Verify the update
|
|
7
|
-
SELECT id, domain, name
|
|
8
|
-
FROM docbuilder_sites
|
|
9
|
-
WHERE id = '4d8a53bf-dcdd-48c0-98e0-cd1451518735';
|
package/user-access-view.sql
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
-- Create a view to easily see user access with email addresses
|
|
2
|
-
-- This makes it much easier to manage user access
|
|
3
|
-
|
|
4
|
-
-- Drop the view if it exists (to recreate with latest schema)
|
|
5
|
-
DROP VIEW IF EXISTS user_access_view;
|
|
6
|
-
|
|
7
|
-
-- Create the view joining docbuilder_access with auth.users
|
|
8
|
-
CREATE VIEW user_access_view AS
|
|
9
|
-
SELECT
|
|
10
|
-
u.email,
|
|
11
|
-
da.domain,
|
|
12
|
-
da.created_at as access_granted,
|
|
13
|
-
u.created_at as user_created,
|
|
14
|
-
u.last_sign_in_at,
|
|
15
|
-
u.id as user_id
|
|
16
|
-
FROM
|
|
17
|
-
docbuilder_access da
|
|
18
|
-
JOIN auth.users u ON da.user_id = u.id
|
|
19
|
-
ORDER BY
|
|
20
|
-
da.domain,
|
|
21
|
-
u.email;
|
|
22
|
-
|
|
23
|
-
-- Grant permissions to authenticated users to view their own records
|
|
24
|
-
GRANT SELECT ON user_access_view TO authenticated;
|
|
25
|
-
|
|
26
|
-
-- Example queries using the view:
|
|
27
|
-
|
|
28
|
-
-- 1. See all users for a specific domain
|
|
29
|
-
-- SELECT * FROM user_access_view WHERE domain = 'docs.example.com';
|
|
30
|
-
|
|
31
|
-
-- 2. See all domains a user has access to
|
|
32
|
-
-- SELECT * FROM user_access_view WHERE email = 'user@example.com';
|
|
33
|
-
|
|
34
|
-
-- 3. Count users per domain
|
|
35
|
-
-- SELECT domain, COUNT(*) as user_count
|
|
36
|
-
-- FROM user_access_view
|
|
37
|
-
-- GROUP BY domain
|
|
38
|
-
-- ORDER BY user_count DESC;
|
|
39
|
-
|
|
40
|
-
-- 4. Find users who haven't logged in recently
|
|
41
|
-
-- SELECT email, domain, last_sign_in_at
|
|
42
|
-
-- FROM user_access_view
|
|
43
|
-
-- WHERE last_sign_in_at < NOW() - INTERVAL '30 days'
|
|
44
|
-
-- OR last_sign_in_at IS NULL;
|
|
45
|
-
|
|
46
|
-
-- 5. Export all access for documentation
|
|
47
|
-
-- SELECT email, domain, access_granted
|
|
48
|
-
-- FROM user_access_view
|
|
49
|
-
-- ORDER BY domain, email;
|
|
@@ -1,301 +0,0 @@
|
|
|
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
|
-
1. **User Creation**: The Supabase CLI doesn't support direct user creation. The script offers two workarounds:
|
|
179
|
-
- **Manual Creation** (Recommended): Opens the Supabase dashboard where you can invite users
|
|
180
|
-
- **Programmatic Creation** (Advanced): If you provide your service_role key, the script can create users using the Admin API
|
|
181
|
-
|
|
182
|
-
2. **SQL Execution**: Older versions of Supabase CLI (< 2.7) don't support `db execute`. The script will:
|
|
183
|
-
- Try to use `psql` if you have `DATABASE_URL` set
|
|
184
|
-
- Fall back to showing SQL for manual execution in the dashboard
|
|
185
|
-
- Consider updating: `npm update -g supabase`
|
|
186
|
-
|
|
187
|
-
## 🔐 Security Notes
|
|
188
|
-
|
|
189
|
-
1. **User Creation**: When users are created, they receive a password reset email to set their own password
|
|
190
|
-
2. **Access Control**: Users only see sites they have explicit access to
|
|
191
|
-
3. **Audit Trail**: All access grants are timestamped in the database
|
|
192
|
-
4. **No Passwords**: The system never handles or stores passwords directly
|
|
193
|
-
5. **Service Role Key**: If using programmatic creation, your service_role key is never stored
|
|
194
|
-
|
|
195
|
-
## 🛠️ Troubleshooting
|
|
196
|
-
|
|
197
|
-
### "Supabase CLI not found"
|
|
198
|
-
|
|
199
|
-
Install the Supabase CLI:
|
|
200
|
-
```bash
|
|
201
|
-
npm install -g supabase
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### "Not logged in to Supabase"
|
|
205
|
-
|
|
206
|
-
Login to your Supabase account:
|
|
207
|
-
```bash
|
|
208
|
-
supabase login
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### "Project not linked"
|
|
212
|
-
|
|
213
|
-
Run the setup command:
|
|
214
|
-
```bash
|
|
215
|
-
./add-users.sh setup
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### "Site not found"
|
|
219
|
-
|
|
220
|
-
With the new domain-based system, sites no longer need to be registered. Just use the domain directly when granting access.
|
|
221
|
-
|
|
222
|
-
### "User already exists"
|
|
223
|
-
|
|
224
|
-
This is fine - the script will continue and grant access to the site.
|
|
225
|
-
|
|
226
|
-
### "Access already granted"
|
|
227
|
-
|
|
228
|
-
The user already has access to this site. No action needed.
|
|
229
|
-
|
|
230
|
-
## 📊 Database Schema
|
|
231
|
-
|
|
232
|
-
The system uses a single table with domain-based access:
|
|
233
|
-
|
|
234
|
-
### docbuilder_access
|
|
235
|
-
- `user_id` (UUID) - References auth.users
|
|
236
|
-
- `domain` (TEXT) - Site domain (e.g., docs.example.com)
|
|
237
|
-
- `created_at` (TIMESTAMP)
|
|
238
|
-
- Primary key on (user_id, domain)
|
|
239
|
-
|
|
240
|
-
## 🎯 Common Workflows
|
|
241
|
-
|
|
242
|
-
### Setting up a new documentation site
|
|
243
|
-
|
|
244
|
-
No site registration needed! Just add users with domain access:
|
|
245
|
-
```bash
|
|
246
|
-
./add-users.sh add my-docs.vercel.app user1@example.com
|
|
247
|
-
./add-users.sh add my-docs.vercel.app user2@example.com
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Onboarding multiple team members
|
|
251
|
-
|
|
252
|
-
1. Create a users.txt file with all email addresses
|
|
253
|
-
2. Run bulk add:
|
|
254
|
-
```bash
|
|
255
|
-
./add-users.sh bulk my-docs.vercel.app users.txt
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Auditing access
|
|
259
|
-
|
|
260
|
-
Check who has access to a site:
|
|
261
|
-
```bash
|
|
262
|
-
./add-users.sh list my-docs.vercel.app
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
Check what sites a user can access:
|
|
266
|
-
```bash
|
|
267
|
-
./add-users.sh check user@example.com
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Offboarding a user
|
|
271
|
-
|
|
272
|
-
Remove from specific site:
|
|
273
|
-
```bash
|
|
274
|
-
./add-users.sh remove my-docs.vercel.app former-employee@example.com
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Or remove completely:
|
|
278
|
-
```bash
|
|
279
|
-
./add-users.sh delete-user former-employee@example.com
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
## 🔧 Configuration
|
|
283
|
-
|
|
284
|
-
The script stores its configuration in `.supabase-config` after setup. You can also set environment variables:
|
|
285
|
-
|
|
286
|
-
- `SUPABASE_PROJECT_ID` - Your project ID
|
|
287
|
-
- `SUPABASE_DB_URL` - Database connection URL (optional)
|
|
288
|
-
|
|
289
|
-
## 📝 Notes
|
|
290
|
-
|
|
291
|
-
- Site URLs should be entered without `https://` prefix
|
|
292
|
-
- Users receive password reset emails when created
|
|
293
|
-
- The script uses the Supabase CLI for all operations
|
|
294
|
-
- All actions are logged with colored output for clarity
|
|
295
|
-
- Destructive operations require confirmation
|
|
296
|
-
|
|
297
|
-
## 🆘 Support
|
|
298
|
-
|
|
299
|
-
- GitHub: https://github.com/wapdat/doc-builder
|
|
300
|
-
- Documentation: https://doc-builder-delta.vercel.app
|
|
301
|
-
- Supabase Dashboard: https://supabase.com/dashboard
|