@donotdev/cli 0.0.37 → 0.1.0

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 (59) hide show
  1. package/LICENSE.md +21 -48
  2. package/dependencies-matrix.json +24 -24
  3. package/dist/bin/commands/agent-setup.js +6963 -123
  4. package/dist/bin/commands/build.js +4 -1
  5. package/dist/bin/commands/bump.js +23 -12
  6. package/dist/bin/commands/cacheout.js +17 -1
  7. package/dist/bin/commands/coach.js +4 -1
  8. package/dist/bin/commands/create-app.js +16 -2
  9. package/dist/bin/commands/create-project.js +17 -3
  10. package/dist/bin/commands/db.js +1708 -98
  11. package/dist/bin/commands/deploy.js +142 -96
  12. package/dist/bin/commands/dev.js +6 -5
  13. package/dist/bin/commands/doctor.js +4 -1
  14. package/dist/bin/commands/emu.js +6 -5
  15. package/dist/bin/commands/format.js +5 -3
  16. package/dist/bin/commands/get-demo.js +16 -2
  17. package/dist/bin/commands/make-admin.js +1717 -87
  18. package/dist/bin/commands/preview.js +6 -5
  19. package/dist/bin/commands/seed.js +1708 -98
  20. package/dist/bin/commands/setup-cicd.js +4 -1
  21. package/dist/bin/commands/setup.js +21 -18
  22. package/dist/bin/commands/staging.js +142 -96
  23. package/dist/bin/commands/sync-secrets.js +4 -1
  24. package/dist/bin/commands/type-check.js +4 -1
  25. package/dist/bin/commands/wai.js +4 -1
  26. package/dist/bin/dndev.js +21 -1
  27. package/dist/bin/donotdev.js +21 -1
  28. package/dist/index.js +170 -105
  29. package/package.json +2 -2
  30. package/templates/functions-supabase/supabase/functions/.env.example +12 -0
  31. package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
  32. package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
  33. package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
  34. package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
  35. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
  36. package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
  37. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
  38. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
  39. package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
  40. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
  41. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
  42. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
  43. package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
  44. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
  45. package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
  46. package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
  47. package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
  48. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
  49. package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
  50. package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
  51. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
  52. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
  53. package/templates/root-consumer/.claude/commands/brainstorm.md.example +28 -0
  54. package/templates/root-consumer/.claude/commands/design.md.example +31 -0
  55. package/templates/root-consumer/.claude/commands/grill.md.example +33 -6
  56. package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
  57. package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
  58. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +11 -5
  59. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +2 -1
@@ -0,0 +1,7 @@
1
+ // supabase/functions/get-connections/index.ts
2
+ // Supabase Edge Function — Get OAuth Connections
3
+ // Deploy: supabase functions deploy get-connections
4
+
5
+ import { createGetConnections } from '@donotdev/functions/supabase';
6
+
7
+ Deno.serve(createGetConnections());
@@ -0,0 +1,7 @@
1
+ // supabase/functions/refresh-token/index.ts
2
+ // Supabase Edge Function — OAuth Token Refresh
3
+ // Deploy: supabase functions deploy refresh-token
4
+
5
+ import { createRefreshToken } from '@donotdev/functions/supabase';
6
+
7
+ Deno.serve(createRefreshToken());
@@ -0,0 +1,189 @@
1
+ /**
2
+ * @fileoverview Admin Dashboard - Overview with stats, activity, and quick actions.
3
+ *
4
+ * Replace mock data with real data from your backend.
5
+ * Connect stats to useCrudList or custom hooks for live metrics.
6
+ */
7
+
8
+ import { useState } from 'react';
9
+
10
+ import {
11
+ LayoutDashboard,
12
+ Users,
13
+ DollarSign,
14
+ FolderOpen,
15
+ TrendingUp,
16
+ UserPlus,
17
+ BarChart3,
18
+ Settings,
19
+ Download,
20
+ Clock,
21
+ CheckCircle,
22
+ AlertCircle,
23
+ XCircle,
24
+ } from 'lucide-react';
25
+
26
+ import { Section, Card, Grid, Stack, Text, Badge, List } from '@donotdev/components';
27
+ import { useTranslation } from '@donotdev/core';
28
+ import type { PageMeta } from '@donotdev/core';
29
+ import { useAuth } from '@donotdev/auth';
30
+ import { PageContainer, Link } from '@donotdev/ui';
31
+
32
+ // ============================================================================
33
+ // PAGE METADATA
34
+ // ============================================================================
35
+
36
+ export const NAMESPACE = 'dashboard';
37
+
38
+ export const meta: PageMeta = {
39
+ namespace: NAMESPACE,
40
+ icon: <LayoutDashboard />,
41
+ auth: { required: true, role: 'admin' },
42
+ preset: 'admin',
43
+ };
44
+
45
+ // ============================================================================
46
+ // MOCK DATA - Replace with real data hooks
47
+ // ============================================================================
48
+
49
+ const stats = [
50
+ {
51
+ title: 'Total Users',
52
+ value: '2,847',
53
+ trend: '+12.5% from last month',
54
+ icon: <Users />,
55
+ },
56
+ {
57
+ title: 'Revenue',
58
+ value: '$48,290',
59
+ trend: '+8.2% from last month',
60
+ icon: <DollarSign />,
61
+ },
62
+ {
63
+ title: 'Active Projects',
64
+ value: '184',
65
+ trend: '+3 new this week',
66
+ icon: <FolderOpen />,
67
+ },
68
+ {
69
+ title: 'Conversion',
70
+ value: '3.24%',
71
+ trend: '+0.4% from last month',
72
+ icon: <TrendingUp />,
73
+ },
74
+ ];
75
+
76
+ const recentActivity = [
77
+ { text: 'New user registered: alice@example.com', status: 'success', time: '2 min ago' },
78
+ { text: 'Payment received: $199.00 from Acme Corp', status: 'success', time: '15 min ago' },
79
+ { text: 'Failed login attempt: bob@example.com', status: 'error', time: '32 min ago' },
80
+ { text: 'Project "Dashboard Redesign" updated', status: 'info', time: '1 hour ago' },
81
+ { text: 'Export completed: Q1 Financial Report', status: 'success', time: '2 hours ago' },
82
+ { text: 'System backup completed successfully', status: 'info', time: '3 hours ago' },
83
+ { text: 'API rate limit warning: 85% capacity', status: 'warning', time: '4 hours ago' },
84
+ ];
85
+
86
+ const quickActions = [
87
+ { title: 'Add User', icon: <UserPlus />, path: '/users/new' },
88
+ { title: 'View Reports', icon: <BarChart3 />, path: '/reports' },
89
+ { title: 'System Settings', icon: <Settings />, path: '/settings' },
90
+ { title: 'Export Data', icon: <Download />, path: '/reports' },
91
+ ];
92
+
93
+ // ============================================================================
94
+ // STATUS BADGE HELPER
95
+ // ============================================================================
96
+
97
+ function statusBadge(status: string) {
98
+ const variants: Record<string, string> = {
99
+ success: 'success',
100
+ error: 'destructive',
101
+ warning: 'warning',
102
+ info: 'default',
103
+ };
104
+ return <Badge variant={variants[status] || 'default'}>{status}</Badge>;
105
+ }
106
+
107
+ // ============================================================================
108
+ // PAGE COMPONENT
109
+ // ============================================================================
110
+
111
+ export default function DashboardPage() {
112
+ const { t } = useTranslation(NAMESPACE);
113
+ const user = useAuth('user');
114
+
115
+ return (
116
+ <PageContainer>
117
+ {/* Welcome */}
118
+ <Section title={`${t('welcome')}, ${user?.displayName || t('admin')}`}>
119
+ <Text level="body">
120
+ {t('dashboardOverview', { appName: '{{appName}}' })}
121
+ </Text>
122
+ </Section>
123
+
124
+ {/* Stats Row */}
125
+ <Section title={t('overview')}>
126
+ <Grid cols={[1, 2, 4, 4]} gap="medium">
127
+ {stats.map((stat) => (
128
+ <Card
129
+ key={stat.title}
130
+ icon={stat.icon}
131
+ title={stat.title}
132
+ content={[stat.value, stat.trend]}
133
+ elevated
134
+ />
135
+ ))}
136
+ </Grid>
137
+ </Section>
138
+
139
+ {/* Recent Activity */}
140
+ <Section title={t('recentActivity')}>
141
+ <Stack gap="tight">
142
+ {recentActivity.map((activity, index) => (
143
+ <Card
144
+ key={index}
145
+ content={
146
+ <Stack direction="row" align="center" justify="space-between">
147
+ <Stack direction="row" align="center" gap="medium">
148
+ {statusBadge(activity.status)}
149
+ <Text level="body">{activity.text}</Text>
150
+ </Stack>
151
+ <Text level="small" variant="muted">{activity.time}</Text>
152
+ </Stack>
153
+ }
154
+ />
155
+ ))}
156
+ </Stack>
157
+ </Section>
158
+
159
+ {/* Quick Actions */}
160
+ <Section title={t('quickActions')}>
161
+ <Grid cols={[2, 2, 4, 4]} gap="medium">
162
+ {quickActions.map((action) => (
163
+ <Link key={action.title} path={action.path}>
164
+ <Card
165
+ icon={action.icon}
166
+ title={action.title}
167
+ clickable
168
+ elevated
169
+ />
170
+ </Link>
171
+ ))}
172
+ </Grid>
173
+ </Section>
174
+ </PageContainer>
175
+ );
176
+ }
177
+
178
+ // ============================================================================
179
+ // i18n KEYS NEEDED (add to locales/dashboard_en.json)
180
+ // ============================================================================
181
+ //
182
+ // {
183
+ // "welcome": "Welcome back",
184
+ // "admin": "Admin",
185
+ // "dashboardOverview": "Here's what's happening with {{appName}} today.",
186
+ // "overview": "Overview",
187
+ // "recentActivity": "Recent Activity",
188
+ // "quickActions": "Quick Actions"
189
+ // }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @fileoverview Generic CRUD Entity Management Page
3
+ *
4
+ * COPY THIS FILE for each entity you want to manage in the admin panel.
5
+ * Rename the file and component to match your entity (e.g., ProductsPage, OrdersPage).
6
+ *
7
+ * HOW IT WORKS:
8
+ * 1. Import your entity definition
9
+ * 2. EntityList handles everything: data fetching, columns, search, sort,
10
+ * pagination, create/edit/delete actions, and role-based visibility
11
+ * 3. Routing is automatic: edit -> /<entity>/:id, create -> /<entity>/new
12
+ *
13
+ * For the detail/form page, see FormPageExample.tsx.example in app-vite templates.
14
+ */
15
+
16
+ import { Package } from 'lucide-react';
17
+
18
+ import { useAuth } from '@donotdev/auth';
19
+ import type { PageMeta } from '@donotdev/core';
20
+ import { PageContainer, EntityList } from '@donotdev/ui';
21
+
22
+ // ============================================================================
23
+ // ENTITY IMPORT
24
+ // ============================================================================
25
+
26
+ // Import your entity from root-level entities folder:
27
+ // import { productEntity } from 'entities/Product';
28
+
29
+ // Placeholder - replace with your entity import
30
+ const yourEntity = null as any;
31
+
32
+ // ============================================================================
33
+ // PAGE METADATA
34
+ // ============================================================================
35
+
36
+ // Change NAMESPACE to match your entity (e.g., 'products', 'orders', 'customers')
37
+ export const NAMESPACE = 'entities';
38
+
39
+ export const meta: PageMeta = {
40
+ namespace: NAMESPACE,
41
+ icon: <Package />,
42
+ route: '/entities', // Change to your entity route (e.g., '/products')
43
+ auth: { required: true, role: 'admin' },
44
+ preset: 'admin',
45
+ };
46
+
47
+ // ============================================================================
48
+ // PAGE COMPONENT
49
+ // ============================================================================
50
+
51
+ export default function EntityPage() {
52
+ const user = useAuth('user');
53
+
54
+ // EntityList provides zero-config CRUD management:
55
+ // - Fetches data using entity's listFields (optimized query)
56
+ // - Renders columns based on field definitions
57
+ // - Applies visibility rules based on user role
58
+ // - Includes search, sort, pagination
59
+ // - Add/Edit/Delete buttons with proper permissions
60
+ // - Automatic routing to detail/form pages
61
+
62
+ return (
63
+ <PageContainer>
64
+ <EntityList
65
+ entity={yourEntity}
66
+ userRole={user?.role}
67
+ />
68
+ </PageContainer>
69
+ );
70
+ }
71
+
72
+ // ============================================================================
73
+ // NEXT STEPS
74
+ // ============================================================================
75
+ //
76
+ // 1. Create your entity definition in src/entities/YourEntity.ts
77
+ // See the entity docs or use WAI-WAY Phase 2 to generate it.
78
+ //
79
+ // 2. Create a detail/form page for create/edit operations.
80
+ // Copy FormPageExample.tsx.example and adapt it.
81
+ //
82
+ // 3. Update NAMESPACE, meta.route, and meta.icon to match your entity.
83
+ //
84
+ // 4. Add i18n keys for your entity labels and field names.
@@ -0,0 +1,243 @@
1
+ /**
2
+ * @fileoverview Reports & Analytics - Stats, chart placeholders, and export history.
3
+ *
4
+ * Replace chart placeholders with your charting library (Recharts, Chart.js, etc.).
5
+ * Connect stats and export data to your backend.
6
+ */
7
+
8
+ import { useState } from 'react';
9
+
10
+ import {
11
+ BarChart3,
12
+ TrendingUp,
13
+ TrendingDown,
14
+ Users,
15
+ ShoppingCart,
16
+ Eye,
17
+ Download,
18
+ } from 'lucide-react';
19
+
20
+ import {
21
+ Section,
22
+ Card,
23
+ Grid,
24
+ Stack,
25
+ Text,
26
+ Select,
27
+ DataTable,
28
+ Badge,
29
+ } from '@donotdev/components';
30
+ import { useTranslation } from '@donotdev/core';
31
+ import type { PageMeta } from '@donotdev/core';
32
+ import { PageContainer } from '@donotdev/ui';
33
+
34
+ // ============================================================================
35
+ // PAGE METADATA
36
+ // ============================================================================
37
+
38
+ export const NAMESPACE = 'reports';
39
+
40
+ export const meta: PageMeta = {
41
+ namespace: NAMESPACE,
42
+ icon: <BarChart3 />,
43
+ auth: { required: true, role: 'admin' },
44
+ preset: 'admin',
45
+ };
46
+
47
+ // ============================================================================
48
+ // DATE RANGE OPTIONS
49
+ // ============================================================================
50
+
51
+ const dateRangeOptions = [
52
+ { value: '7d', label: 'Last 7 days' },
53
+ { value: '30d', label: 'Last 30 days' },
54
+ { value: '90d', label: 'Last 90 days' },
55
+ { value: '12m', label: 'Last 12 months' },
56
+ { value: 'ytd', label: 'Year to date' },
57
+ ];
58
+
59
+ // ============================================================================
60
+ // MOCK DATA - Replace with real analytics hooks
61
+ // ============================================================================
62
+
63
+ const stats = [
64
+ {
65
+ title: 'Page Views',
66
+ value: '124,892',
67
+ trend: '+18.2%',
68
+ positive: true,
69
+ icon: <Eye />,
70
+ },
71
+ {
72
+ title: 'Unique Visitors',
73
+ value: '32,451',
74
+ trend: '+5.7%',
75
+ positive: true,
76
+ icon: <Users />,
77
+ },
78
+ {
79
+ title: 'Orders',
80
+ value: '1,284',
81
+ trend: '-2.1%',
82
+ positive: false,
83
+ icon: <ShoppingCart />,
84
+ },
85
+ {
86
+ title: 'Revenue',
87
+ value: '$89,420',
88
+ trend: '+12.8%',
89
+ positive: true,
90
+ icon: <TrendingUp />,
91
+ },
92
+ ];
93
+
94
+ const recentExports = [
95
+ { id: '1', name: 'Q4 Revenue Report', format: 'PDF', status: 'completed', date: '2026-03-14', size: '2.4 MB' },
96
+ { id: '2', name: 'User Growth Analysis', format: 'CSV', status: 'completed', date: '2026-03-13', size: '890 KB' },
97
+ { id: '3', name: 'Monthly Active Users', format: 'XLSX', status: 'completed', date: '2026-03-12', size: '1.1 MB' },
98
+ { id: '4', name: 'Conversion Funnel', format: 'PDF', status: 'processing', date: '2026-03-14', size: '-' },
99
+ { id: '5', name: 'Product Performance', format: 'CSV', status: 'completed', date: '2026-03-10', size: '3.2 MB' },
100
+ { id: '6', name: 'Customer Segments', format: 'XLSX', status: 'failed', date: '2026-03-09', size: '-' },
101
+ ];
102
+
103
+ const exportColumns = [
104
+ { key: 'name', header: 'Report Name', sortable: true },
105
+ { key: 'format', header: 'Format', sortable: true },
106
+ {
107
+ key: 'status',
108
+ header: 'Status',
109
+ sortable: true,
110
+ render: (value: string) => {
111
+ const variants: Record<string, string> = {
112
+ completed: 'success',
113
+ processing: 'warning',
114
+ failed: 'destructive',
115
+ };
116
+ return <Badge variant={variants[value] || 'default'}>{value}</Badge>;
117
+ },
118
+ },
119
+ { key: 'date', header: 'Date', sortable: true },
120
+ { key: 'size', header: 'Size', sortable: true },
121
+ ];
122
+
123
+ // ============================================================================
124
+ // PAGE COMPONENT
125
+ // ============================================================================
126
+
127
+ export default function ReportsPage() {
128
+ const { t } = useTranslation(NAMESPACE);
129
+ const [dateRange, setDateRange] = useState('30d');
130
+
131
+ return (
132
+ <PageContainer>
133
+ {/* Date Range Selector */}
134
+ <Section title={t('reportsAnalytics')}>
135
+ <Stack direction="row" align="center" justify="space-between">
136
+ <Text level="body" variant="muted">
137
+ {t('selectPeriod')}
138
+ </Text>
139
+ <Select
140
+ options={dateRangeOptions}
141
+ value={dateRange}
142
+ onValueChange={setDateRange}
143
+ placeholder={t('selectDateRange')}
144
+ />
145
+ </Stack>
146
+ </Section>
147
+
148
+ {/* Stats Row */}
149
+ <Section title={t('keyMetrics')}>
150
+ <Grid cols={[1, 2, 4, 4]} gap="medium">
151
+ {stats.map((stat) => (
152
+ <Card
153
+ key={stat.title}
154
+ icon={stat.icon}
155
+ title={stat.title}
156
+ elevated
157
+ content={
158
+ <Stack gap="tight">
159
+ <Text level="heading" weight="bold">{stat.value}</Text>
160
+ <Stack direction="row" align="center" gap="tight">
161
+ {stat.positive ? <TrendingUp /> : <TrendingDown />}
162
+ <Text
163
+ level="small"
164
+ variant={stat.positive ? 'success' : 'error'}
165
+ >
166
+ {stat.trend}
167
+ </Text>
168
+ </Stack>
169
+ </Stack>
170
+ }
171
+ />
172
+ ))}
173
+ </Grid>
174
+ </Section>
175
+
176
+ {/* Chart Placeholders */}
177
+ <Section title={t('charts')}>
178
+ <Grid cols={[1, 1, 2, 2]} gap="medium">
179
+ <Card
180
+ title={t('revenueOverTime')}
181
+ elevated
182
+ content={
183
+ <Stack align="center" justify="center" gap="medium">
184
+ <BarChart3 />
185
+ <Text level="body" variant="muted">
186
+ {t('chartPlaceholder')}
187
+ </Text>
188
+ <Text level="small" variant="muted">
189
+ {t('revenueChartLabel')}
190
+ </Text>
191
+ </Stack>
192
+ }
193
+ />
194
+
195
+ <Card
196
+ title={t('userGrowth')}
197
+ elevated
198
+ content={
199
+ <Stack align="center" justify="center" gap="medium">
200
+ <TrendingUp />
201
+ <Text level="body" variant="muted">
202
+ {t('chartPlaceholder')}
203
+ </Text>
204
+ <Text level="small" variant="muted">
205
+ {t('userGrowthLabel')}
206
+ </Text>
207
+ </Stack>
208
+ }
209
+ />
210
+ </Grid>
211
+ </Section>
212
+
213
+ {/* Recent Exports */}
214
+ <Section title={t('recentExports')}>
215
+ <DataTable
216
+ data={recentExports}
217
+ columns={exportColumns}
218
+ sortable
219
+ searchable
220
+ pagination
221
+ />
222
+ </Section>
223
+ </PageContainer>
224
+ );
225
+ }
226
+
227
+ // ============================================================================
228
+ // i18n KEYS NEEDED (add to locales/reports_en.json)
229
+ // ============================================================================
230
+ //
231
+ // {
232
+ // "reportsAnalytics": "Reports & Analytics",
233
+ // "selectPeriod": "Select a time period to view metrics",
234
+ // "selectDateRange": "Select date range",
235
+ // "keyMetrics": "Key Metrics",
236
+ // "charts": "Charts",
237
+ // "revenueOverTime": "Revenue Over Time",
238
+ // "userGrowth": "User Growth",
239
+ // "chartPlaceholder": "Chart will render here",
240
+ // "revenueChartLabel": "Monthly revenue breakdown - Jan to Dec",
241
+ // "userGrowthLabel": "New vs returning users - weekly trend",
242
+ // "recentExports": "Recent Exports"
243
+ // }