create-chaaskit 0.1.0 → 0.1.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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/dist/commands/init.js +5 -0
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/templates/app/root.tsx +26 -14
  6. package/dist/templates/app/routes/chat.admin.promo-codes.tsx +10 -0
  7. package/dist/templates/app/routes/chat.admin.waitlist.tsx +10 -0
  8. package/dist/templates/app/routes.ts +2 -0
  9. package/dist/templates/app/styles/app.css +9 -0
  10. package/dist/templates/config/app.config.ts +29 -80
  11. package/dist/templates/package.json +8 -5
  12. package/dist/templates/postcss.config.js +6 -0
  13. package/dist/templates/server.js +40 -10
  14. package/dist/templates/tailwind.config.ts +76 -0
  15. package/package.json +19 -10
  16. package/dist/cli.d.ts +0 -3
  17. package/dist/cli.d.ts.map +0 -1
  18. package/dist/cli.js +0 -25
  19. package/dist/cli.js.map +0 -1
  20. package/dist/templates/app/components/AcceptInviteClient.tsx +0 -10
  21. package/dist/templates/app/components/AdminDashboardClient.tsx +0 -10
  22. package/dist/templates/app/components/AdminTeamClient.tsx +0 -10
  23. package/dist/templates/app/components/AdminTeamsClient.tsx +0 -10
  24. package/dist/templates/app/components/AdminUsersClient.tsx +0 -10
  25. package/dist/templates/app/components/ApiKeysClient.tsx +0 -10
  26. package/dist/templates/app/components/AutomationsClient.tsx +0 -10
  27. package/dist/templates/app/components/ChatClient.tsx +0 -13
  28. package/dist/templates/app/components/DocumentsClient.tsx +0 -10
  29. package/dist/templates/app/components/OAuthConsentClient.tsx +0 -10
  30. package/dist/templates/app/components/PricingClient.tsx +0 -10
  31. package/dist/templates/app/components/TeamSettingsClient.tsx +0 -10
  32. package/dist/templates/app/components/VerifyEmailClient.tsx +0 -10
  33. package/dist/templates/app/routes/admin._index.tsx +0 -57
  34. package/dist/templates/app/routes/admin.teams.$teamId.tsx +0 -57
  35. package/dist/templates/app/routes/admin.teams._index.tsx +0 -57
  36. package/dist/templates/app/routes/admin.users.tsx +0 -57
  37. package/dist/templates/app/routes/api-keys.tsx +0 -57
  38. package/dist/templates/app/routes/automations.tsx +0 -57
  39. package/dist/templates/app/routes/documents.tsx +0 -57
  40. package/dist/templates/app/routes/team.$teamId.settings.tsx +0 -57
  41. package/dist/templates/app/routes/thread.$threadId.tsx +0 -102
  42. package/dist/templates/docs/admin.md +0 -257
  43. package/dist/templates/docs/api-keys.md +0 -403
  44. package/dist/templates/docs/authentication.md +0 -247
  45. package/dist/templates/docs/configuration.md +0 -1212
  46. package/dist/templates/docs/custom-pages.md +0 -466
  47. package/dist/templates/docs/deployment.md +0 -362
  48. package/dist/templates/docs/development.md +0 -411
  49. package/dist/templates/docs/documents.md +0 -293
  50. package/dist/templates/docs/extensions.md +0 -639
  51. package/dist/templates/docs/index.md +0 -139
  52. package/dist/templates/docs/installation.md +0 -286
  53. package/dist/templates/docs/mcp.md +0 -952
  54. package/dist/templates/docs/native-tools.md +0 -688
  55. package/dist/templates/docs/queue.md +0 -514
  56. package/dist/templates/docs/scheduled-prompts.md +0 -279
  57. package/dist/templates/docs/settings.md +0 -415
  58. package/dist/templates/docs/slack.md +0 -318
  59. package/dist/templates/docs/styling.md +0 -288
  60. package/dist/templates/index.html +0 -16
  61. package/dist/templates/prisma/schema.prisma +0 -271
  62. package/dist/templates/src/main.tsx +0 -8
@@ -1,102 +0,0 @@
1
- import type { Route } from './+types/thread.$threadId';
2
- import { lazy, Suspense } from 'react';
3
- import { ClientOnly } from '../components/ClientOnly';
4
-
5
- // Lazy load the client-only component
6
- const ChatClient = lazy(() => import('../components/ChatClient'));
7
-
8
- export function meta({}: Route.MetaArgs) {
9
- return [{ title: 'Chat' }];
10
- }
11
-
12
- // Styles are loaded via link tag in root.tsx to avoid SSR import issues
13
- export function links() {
14
- return [{ rel: 'stylesheet', href: '/node_modules/@chaaskit/client/dist/lib/styles.css' }];
15
- }
16
-
17
- /**
18
- * Thread view route - shows a specific chat thread.
19
- * Uses the same ChatClient component as the main chat route.
20
- */
21
- export default function Thread() {
22
- return (
23
- <ClientOnly fallback={<ThreadLoadingSkeleton />}>
24
- {() => (
25
- <Suspense fallback={<ThreadLoadingSkeleton />}>
26
- <ChatClient />
27
- </Suspense>
28
- )}
29
- </ClientOnly>
30
- );
31
- }
32
-
33
- function ThreadLoadingSkeleton() {
34
- return (
35
- <div style={{ display: 'flex', height: '100vh' }}>
36
- {/* Sidebar skeleton */}
37
- <div
38
- style={{
39
- width: '256px',
40
- backgroundColor: 'rgb(var(--color-sidebar))',
41
- borderRight: '1px solid rgb(var(--color-border))',
42
- padding: '1rem',
43
- }}
44
- >
45
- <div
46
- style={{
47
- height: '2rem',
48
- backgroundColor: 'rgb(var(--color-background-secondary))',
49
- borderRadius: '0.5rem',
50
- marginBottom: '1rem',
51
- }}
52
- />
53
- <div
54
- style={{
55
- height: '1rem',
56
- backgroundColor: 'rgb(var(--color-background-secondary))',
57
- borderRadius: '0.25rem',
58
- width: '80%',
59
- }}
60
- />
61
- </div>
62
- {/* Main content skeleton */}
63
- <div
64
- style={{
65
- flex: 1,
66
- display: 'flex',
67
- alignItems: 'center',
68
- justifyContent: 'center',
69
- backgroundColor: 'rgb(var(--color-background))',
70
- }}
71
- >
72
- <div
73
- style={{
74
- display: 'flex',
75
- flexDirection: 'column',
76
- alignItems: 'center',
77
- gap: '1rem',
78
- }}
79
- >
80
- <div
81
- style={{
82
- width: '2rem',
83
- height: '2rem',
84
- border: '2px solid rgb(var(--color-primary))',
85
- borderTopColor: 'transparent',
86
- borderRadius: '50%',
87
- animation: 'spin 1s linear infinite',
88
- }}
89
- />
90
- <p style={{ color: 'rgb(var(--color-text-muted))' }}>Loading...</p>
91
- </div>
92
- </div>
93
- <style>
94
- {`
95
- @keyframes spin {
96
- to { transform: rotate(360deg); }
97
- }
98
- `}
99
- </style>
100
- </div>
101
- );
102
- }
@@ -1,257 +0,0 @@
1
- # Admin Dashboard
2
-
3
- The Admin Dashboard provides site-wide administration capabilities for managing users, teams, and viewing usage analytics.
4
-
5
- ## Configuration
6
-
7
- Site administrators are configured via the `admin` section in `config/app.config.ts`:
8
-
9
- ```typescript
10
- admin: {
11
- emails: [
12
- 'admin@example.com',
13
- 'another-admin@example.com',
14
- ],
15
- }
16
- ```
17
-
18
- Users whose email addresses are in this list will see the "Admin" link in the sidebar and have access to all admin features.
19
-
20
- ### Admin Access
21
-
22
- Admin access is granted if the user meets either condition:
23
- - Their email is listed in `config.admin.emails` (case-insensitive)
24
- - They have `isAdmin: true` in the database (legacy support)
25
-
26
- ## Admin Pages
27
-
28
- ### Dashboard (`/admin`)
29
-
30
- The main admin dashboard displays:
31
-
32
- - **Stats Cards**: Total users, teams, threads, messages, and recent activity
33
- - **Usage Chart**: Visual chart showing messages and token usage over time
34
- - Period selector: 7, 30, or 90 days
35
- - Metric selector: Messages, Input Tokens, Output Tokens, Total Tokens
36
- - Summary row with total, daily average, and peak day
37
- - **Plan Distribution**: Breakdown of users by subscription plan
38
- - **Recent Feedback**: Latest user feedback on AI responses
39
-
40
- Navigation links to Manage Users and Manage Teams (if teams enabled).
41
-
42
- ### User Management (`/admin/users`)
43
-
44
- Lists all users in the system with:
45
-
46
- | Column | Description |
47
- |--------|-------------|
48
- | User | Name, email, avatar, OAuth provider |
49
- | Plan | Dropdown to change user's subscription plan |
50
- | Messages | Message count this month |
51
- | Teams | Clickable pills showing team memberships with roles |
52
- | Admin | Toggle button to grant/revoke database admin flag |
53
- | Joined | Account creation date |
54
-
55
- Features:
56
- - **Search**: Filter users by email or name
57
- - **Pagination**: Navigate through large user lists
58
- - **Team Links**: Click a team pill to view that team's details
59
-
60
- ### Team Management (`/admin/teams`)
61
-
62
- Lists all teams in the system (only visible if teams are enabled):
63
-
64
- | Column | Description |
65
- |--------|-------------|
66
- | Team | Team name and avatar |
67
- | Members | Number of team members |
68
- | Threads | Number of team threads |
69
- | Created | Team creation date |
70
-
71
- Features:
72
- - **Search**: Filter teams by name
73
- - **Pagination**: Navigate through large team lists
74
- - **Click to View**: Click any team row to see team details
75
-
76
- ### Team Details (`/admin/teams/:teamId`)
77
-
78
- Displays detailed information about a specific team:
79
-
80
- - **Stats**: Member count, thread count, creation date
81
- - **Team Context**: The AI context configured for team conversations
82
- - **Members List**: All team members with:
83
- - Name and email (clickable to search in user management)
84
- - Role badge (owner, admin, member, viewer)
85
- - Join date
86
-
87
- ## API Endpoints
88
-
89
- All admin endpoints require authentication and admin access.
90
-
91
- ### Stats & Analytics
92
-
93
- | Method | Endpoint | Description |
94
- |--------|----------|-------------|
95
- | `GET` | `/api/admin/stats` | Dashboard statistics |
96
- | `GET` | `/api/admin/usage` | Usage data over time |
97
- | `GET` | `/api/admin/feedback` | Feedback statistics and recent items |
98
-
99
- **Usage Query Parameters:**
100
-
101
- | Parameter | Type | Default | Description |
102
- |-----------|------|---------|-------------|
103
- | `days` | number | 30 | Number of days of data (1-365) |
104
-
105
- ### User Management
106
-
107
- | Method | Endpoint | Description |
108
- |--------|----------|-------------|
109
- | `GET` | `/api/admin/users` | Paginated user list |
110
- | `PATCH` | `/api/admin/users/:userId` | Update user (plan, isAdmin) |
111
-
112
- **User List Query Parameters:**
113
-
114
- | Parameter | Type | Default | Description |
115
- |-----------|------|---------|-------------|
116
- | `page` | number | 1 | Page number |
117
- | `pageSize` | number | 20 | Users per page (max 100) |
118
- | `search` | string | - | Filter by email or name |
119
-
120
- **User Update Body:**
121
-
122
- ```typescript
123
- {
124
- isAdmin?: boolean; // Grant or revoke admin status
125
- plan?: string; // Change subscription plan
126
- }
127
- ```
128
-
129
- ### Team Management
130
-
131
- | Method | Endpoint | Description |
132
- |--------|----------|-------------|
133
- | `GET` | `/api/admin/teams` | Paginated team list |
134
- | `GET` | `/api/admin/teams/:teamId` | Team details with members |
135
-
136
- **Team List Query Parameters:**
137
-
138
- | Parameter | Type | Default | Description |
139
- |-----------|------|---------|-------------|
140
- | `page` | number | 1 | Page number |
141
- | `pageSize` | number | 20 | Teams per page (max 100) |
142
- | `search` | string | - | Filter by team name |
143
- | `includeArchived` | boolean | false | Include archived teams |
144
-
145
- ## Response Types
146
-
147
- ### AdminStats
148
-
149
- ```typescript
150
- interface AdminStats {
151
- totalUsers: number;
152
- totalTeams: number;
153
- totalThreads: number;
154
- totalMessages: number;
155
- planDistribution: Record<string, number>;
156
- newUsersLast30Days: number;
157
- messagesLast30Days: number;
158
- }
159
- ```
160
-
161
- ### UsageDataPoint
162
-
163
- ```typescript
164
- interface UsageDataPoint {
165
- date: string; // "2024-01-15"
166
- messages: number; // Count of messages
167
- inputTokens: number; // Total input tokens
168
- outputTokens: number;// Total output tokens
169
- }
170
- ```
171
-
172
- ### AdminUser
173
-
174
- ```typescript
175
- interface AdminUser {
176
- id: string;
177
- email: string;
178
- name?: string | null;
179
- avatarUrl?: string | null;
180
- isAdmin: boolean;
181
- plan: string;
182
- messagesThisMonth: number;
183
- credits: number;
184
- emailVerified: boolean;
185
- oauthProvider?: string | null;
186
- createdAt: Date;
187
- threadCount: number;
188
- teamCount: number;
189
- teams: AdminUserTeam[];
190
- }
191
-
192
- interface AdminUserTeam {
193
- id: string;
194
- name: string;
195
- role: string;
196
- }
197
- ```
198
-
199
- ### AdminTeam / AdminTeamDetails
200
-
201
- ```typescript
202
- interface AdminTeam {
203
- id: string;
204
- name: string;
205
- memberCount: number;
206
- threadCount: number;
207
- createdAt: Date;
208
- archivedAt?: Date | null;
209
- }
210
-
211
- interface AdminTeamDetails extends AdminTeam {
212
- context?: string | null;
213
- members: AdminTeamMember[];
214
- }
215
-
216
- interface AdminTeamMember {
217
- id: string;
218
- email: string;
219
- name?: string | null;
220
- avatarUrl?: string | null;
221
- role: string;
222
- joinedAt: Date;
223
- }
224
- ```
225
-
226
- ## Security Considerations
227
-
228
- 1. **Config-based access**: Admin emails are defined in server configuration, not user-editable
229
- 2. **Case-insensitive matching**: Email comparison is case-insensitive
230
- 3. **Self-protection**: Users cannot remove their own admin status
231
- 4. **Audit trail**: All user changes are logged with timestamps
232
- 5. **No destructive actions**: Admin can modify users but cannot delete accounts (preserves data integrity)
233
-
234
- ## Extending Admin Features
235
-
236
- To add custom admin functionality:
237
-
238
- 1. **Add API endpoints** in `packages/server/src/api/admin.ts`
239
- 2. **Add types** in `packages/shared/src/types/admin.ts`
240
- 3. **Create pages** in `packages/client/src/pages/Admin*.tsx`
241
- 4. **Add routes** in `packages/client/src/App.tsx` wrapped with `<AdminRoute>`
242
-
243
- Example adding a new admin page:
244
-
245
- ```tsx
246
- // App.tsx
247
- <Route
248
- path="/admin/custom"
249
- element={
250
- <AdminRoute>
251
- <AdminCustomPage />
252
- </AdminRoute>
253
- }
254
- />
255
- ```
256
-
257
- The `AdminRoute` component handles authentication and admin access verification.