@siteboon/claude-code-ui 1.8.2
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/.env.example +12 -0
- package/.nvmrc +1 -0
- package/LICENSE +675 -0
- package/README.md +275 -0
- package/index.html +48 -0
- package/package.json +84 -0
- package/postcss.config.js +6 -0
- package/public/convert-icons.md +53 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +9 -0
- package/public/generate-icons.js +49 -0
- package/public/icons/claude-ai-icon.svg +1 -0
- package/public/icons/cursor.svg +1 -0
- package/public/icons/generate-icons.md +19 -0
- package/public/icons/icon-128x128.png +0 -0
- package/public/icons/icon-128x128.svg +12 -0
- package/public/icons/icon-144x144.png +0 -0
- package/public/icons/icon-144x144.svg +12 -0
- package/public/icons/icon-152x152.png +0 -0
- package/public/icons/icon-152x152.svg +12 -0
- package/public/icons/icon-192x192.png +0 -0
- package/public/icons/icon-192x192.svg +12 -0
- package/public/icons/icon-384x384.png +0 -0
- package/public/icons/icon-384x384.svg +12 -0
- package/public/icons/icon-512x512.png +0 -0
- package/public/icons/icon-512x512.svg +12 -0
- package/public/icons/icon-72x72.png +0 -0
- package/public/icons/icon-72x72.svg +12 -0
- package/public/icons/icon-96x96.png +0 -0
- package/public/icons/icon-96x96.svg +12 -0
- package/public/icons/icon-template.svg +12 -0
- package/public/logo.svg +9 -0
- package/public/manifest.json +61 -0
- package/public/screenshots/cli-selection.png +0 -0
- package/public/screenshots/desktop-main.png +0 -0
- package/public/screenshots/mobile-chat.png +0 -0
- package/public/screenshots/tools-modal.png +0 -0
- package/public/sw.js +49 -0
- package/server/claude-cli.js +391 -0
- package/server/cursor-cli.js +250 -0
- package/server/database/db.js +86 -0
- package/server/database/init.sql +16 -0
- package/server/index.js +1167 -0
- package/server/middleware/auth.js +80 -0
- package/server/projects.js +1063 -0
- package/server/routes/auth.js +135 -0
- package/server/routes/cursor.js +794 -0
- package/server/routes/git.js +823 -0
- package/server/routes/mcp-utils.js +48 -0
- package/server/routes/mcp.js +552 -0
- package/server/routes/taskmaster.js +1971 -0
- package/server/utils/mcp-detector.js +198 -0
- package/server/utils/taskmaster-websocket.js +129 -0
- package/src/App.jsx +751 -0
- package/src/components/ChatInterface.jsx +3485 -0
- package/src/components/ClaudeLogo.jsx +11 -0
- package/src/components/ClaudeStatus.jsx +107 -0
- package/src/components/CodeEditor.jsx +422 -0
- package/src/components/CreateTaskModal.jsx +88 -0
- package/src/components/CursorLogo.jsx +9 -0
- package/src/components/DarkModeToggle.jsx +35 -0
- package/src/components/DiffViewer.jsx +41 -0
- package/src/components/ErrorBoundary.jsx +73 -0
- package/src/components/FileTree.jsx +480 -0
- package/src/components/GitPanel.jsx +1283 -0
- package/src/components/ImageViewer.jsx +54 -0
- package/src/components/LoginForm.jsx +110 -0
- package/src/components/MainContent.jsx +577 -0
- package/src/components/MicButton.jsx +272 -0
- package/src/components/MobileNav.jsx +88 -0
- package/src/components/NextTaskBanner.jsx +695 -0
- package/src/components/PRDEditor.jsx +871 -0
- package/src/components/ProtectedRoute.jsx +44 -0
- package/src/components/QuickSettingsPanel.jsx +262 -0
- package/src/components/Settings.jsx +2023 -0
- package/src/components/SetupForm.jsx +135 -0
- package/src/components/Shell.jsx +663 -0
- package/src/components/Sidebar.jsx +1665 -0
- package/src/components/StandaloneShell.jsx +106 -0
- package/src/components/TaskCard.jsx +210 -0
- package/src/components/TaskDetail.jsx +406 -0
- package/src/components/TaskIndicator.jsx +108 -0
- package/src/components/TaskList.jsx +1054 -0
- package/src/components/TaskMasterSetupWizard.jsx +603 -0
- package/src/components/TaskMasterStatus.jsx +86 -0
- package/src/components/TodoList.jsx +91 -0
- package/src/components/Tooltip.jsx +91 -0
- package/src/components/ui/badge.jsx +31 -0
- package/src/components/ui/button.jsx +46 -0
- package/src/components/ui/input.jsx +19 -0
- package/src/components/ui/scroll-area.jsx +23 -0
- package/src/contexts/AuthContext.jsx +158 -0
- package/src/contexts/TaskMasterContext.jsx +324 -0
- package/src/contexts/TasksSettingsContext.jsx +95 -0
- package/src/contexts/ThemeContext.jsx +94 -0
- package/src/contexts/WebSocketContext.jsx +29 -0
- package/src/hooks/useAudioRecorder.js +109 -0
- package/src/hooks/useVersionCheck.js +39 -0
- package/src/index.css +822 -0
- package/src/lib/utils.js +6 -0
- package/src/main.jsx +10 -0
- package/src/utils/api.js +141 -0
- package/src/utils/websocket.js +109 -0
- package/src/utils/whisper.js +37 -0
- package/tailwind.config.js +63 -0
- package/vite.config.js +29 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import bcrypt from 'bcrypt';
|
|
3
|
+
import { userDb, db } from '../database/db.js';
|
|
4
|
+
import { generateToken, authenticateToken } from '../middleware/auth.js';
|
|
5
|
+
|
|
6
|
+
const router = express.Router();
|
|
7
|
+
|
|
8
|
+
// Check auth status and setup requirements
|
|
9
|
+
router.get('/status', async (req, res) => {
|
|
10
|
+
try {
|
|
11
|
+
const hasUsers = await userDb.hasUsers();
|
|
12
|
+
res.json({
|
|
13
|
+
needsSetup: !hasUsers,
|
|
14
|
+
isAuthenticated: false // Will be overridden by frontend if token exists
|
|
15
|
+
});
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error('Auth status error:', error);
|
|
18
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// User registration (setup) - only allowed if no users exist
|
|
23
|
+
router.post('/register', async (req, res) => {
|
|
24
|
+
try {
|
|
25
|
+
const { username, password } = req.body;
|
|
26
|
+
|
|
27
|
+
// Validate input
|
|
28
|
+
if (!username || !password) {
|
|
29
|
+
return res.status(400).json({ error: 'Username and password are required' });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (username.length < 3 || password.length < 6) {
|
|
33
|
+
return res.status(400).json({ error: 'Username must be at least 3 characters, password at least 6 characters' });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Use a transaction to prevent race conditions
|
|
37
|
+
db.prepare('BEGIN').run();
|
|
38
|
+
try {
|
|
39
|
+
// Check if users already exist (only allow one user)
|
|
40
|
+
const hasUsers = userDb.hasUsers();
|
|
41
|
+
if (hasUsers) {
|
|
42
|
+
db.prepare('ROLLBACK').run();
|
|
43
|
+
return res.status(403).json({ error: 'User already exists. This is a single-user system.' });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Hash password
|
|
47
|
+
const saltRounds = 12;
|
|
48
|
+
const passwordHash = await bcrypt.hash(password, saltRounds);
|
|
49
|
+
|
|
50
|
+
// Create user
|
|
51
|
+
const user = userDb.createUser(username, passwordHash);
|
|
52
|
+
|
|
53
|
+
// Generate token
|
|
54
|
+
const token = generateToken(user);
|
|
55
|
+
|
|
56
|
+
// Update last login
|
|
57
|
+
userDb.updateLastLogin(user.id);
|
|
58
|
+
|
|
59
|
+
db.prepare('COMMIT').run();
|
|
60
|
+
|
|
61
|
+
res.json({
|
|
62
|
+
success: true,
|
|
63
|
+
user: { id: user.id, username: user.username },
|
|
64
|
+
token
|
|
65
|
+
});
|
|
66
|
+
} catch (error) {
|
|
67
|
+
db.prepare('ROLLBACK').run();
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('Registration error:', error);
|
|
73
|
+
if (error.code === 'SQLITE_CONSTRAINT_UNIQUE') {
|
|
74
|
+
res.status(409).json({ error: 'Username already exists' });
|
|
75
|
+
} else {
|
|
76
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// User login
|
|
82
|
+
router.post('/login', async (req, res) => {
|
|
83
|
+
try {
|
|
84
|
+
const { username, password } = req.body;
|
|
85
|
+
|
|
86
|
+
// Validate input
|
|
87
|
+
if (!username || !password) {
|
|
88
|
+
return res.status(400).json({ error: 'Username and password are required' });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Get user from database
|
|
92
|
+
const user = userDb.getUserByUsername(username);
|
|
93
|
+
if (!user) {
|
|
94
|
+
return res.status(401).json({ error: 'Invalid username or password' });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Verify password
|
|
98
|
+
const isValidPassword = await bcrypt.compare(password, user.password_hash);
|
|
99
|
+
if (!isValidPassword) {
|
|
100
|
+
return res.status(401).json({ error: 'Invalid username or password' });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Generate token
|
|
104
|
+
const token = generateToken(user);
|
|
105
|
+
|
|
106
|
+
// Update last login
|
|
107
|
+
userDb.updateLastLogin(user.id);
|
|
108
|
+
|
|
109
|
+
res.json({
|
|
110
|
+
success: true,
|
|
111
|
+
user: { id: user.id, username: user.username },
|
|
112
|
+
token
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error('Login error:', error);
|
|
117
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Get current user (protected route)
|
|
122
|
+
router.get('/user', authenticateToken, (req, res) => {
|
|
123
|
+
res.json({
|
|
124
|
+
user: req.user
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Logout (client-side token removal, but this endpoint can be used for logging)
|
|
129
|
+
router.post('/logout', authenticateToken, (req, res) => {
|
|
130
|
+
// In a simple JWT system, logout is mainly client-side
|
|
131
|
+
// This endpoint exists for consistency and potential future logging
|
|
132
|
+
res.json({ success: true, message: 'Logged out successfully' });
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export default router;
|