@donotdev/cli 0.0.37 → 0.1.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 (119) hide show
  1. package/LICENSE.md +21 -48
  2. package/dependencies-matrix.json +108 -58
  3. package/dist/bin/commands/agent-setup.js +7196 -123
  4. package/dist/bin/commands/build.js +3341 -207
  5. package/dist/bin/commands/bump.js +268 -24
  6. package/dist/bin/commands/cacheout.js +262 -13
  7. package/dist/bin/commands/coach.js +365 -61
  8. package/dist/bin/commands/create-app.js +261 -14
  9. package/dist/bin/commands/create-project.js +270 -15
  10. package/dist/bin/commands/db.js +10743 -2346
  11. package/dist/bin/commands/deploy.js +4202 -776
  12. package/dist/bin/commands/dev.js +353 -38
  13. package/dist/bin/commands/doctor.js +412 -108
  14. package/dist/bin/commands/emu.js +392 -57
  15. package/dist/bin/commands/format.js +250 -15
  16. package/dist/bin/commands/get-demo.js +261 -14
  17. package/dist/bin/commands/make-admin.js +10022 -1552
  18. package/dist/bin/commands/preview.js +353 -38
  19. package/dist/bin/commands/seed.js +10743 -2346
  20. package/dist/bin/commands/setup-cicd.js +456 -133
  21. package/dist/bin/commands/setup.js +428 -125
  22. package/dist/bin/commands/staging.js +4202 -776
  23. package/dist/bin/commands/sync-secrets.js +250 -14
  24. package/dist/bin/commands/type-check.js +249 -13
  25. package/dist/bin/commands/wai.js +249 -13
  26. package/dist/bin/dndev.js +33 -4
  27. package/dist/bin/donotdev.js +33 -4
  28. package/dist/index.js +4278 -856
  29. package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
  30. package/package.json +3 -2
  31. package/templates/app-demo/src/themes.css.example +21 -0
  32. package/templates/app-dndev/index.html.example +0 -3
  33. package/templates/app-dndev/src/themes.css.example +21 -0
  34. package/templates/app-next/src/app/layout.tsx.example +13 -4
  35. package/templates/app-next/src/themes.css.example +21 -0
  36. package/templates/app-vite/csp.example.json +44 -0
  37. package/templates/app-vite/index.html.example +0 -3
  38. package/templates/app-vite/src/themes.css.example +21 -0
  39. package/templates/functions-supabase/supabase/functions/.env.example +12 -0
  40. package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
  41. package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
  42. package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
  43. package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
  44. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
  45. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
  46. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
  47. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
  48. package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
  49. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
  50. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
  51. package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
  52. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
  53. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
  54. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
  55. package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
  56. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
  57. package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
  58. package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
  59. package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
  60. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
  61. package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
  62. package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
  63. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
  64. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
  65. package/templates/root-consumer/.claude/hooks/framework-compliance.sh.example +56 -0
  66. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
  67. package/templates/root-consumer/.claude/hooks/guard-files.sh.example +46 -0
  68. package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +91 -0
  69. package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +67 -0
  70. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +89 -0
  71. package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
  72. package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +20 -0
  73. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
  74. package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
  75. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
  76. package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
  77. package/templates/root-consumer/.claude/rules/git.md.example +14 -0
  78. package/templates/root-consumer/.claude/rules/security.md.example +13 -0
  79. package/templates/root-consumer/.claude/settings.json.example +123 -1
  80. package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
  81. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +103 -25
  82. package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
  83. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +33 -16
  84. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
  85. package/templates/root-consumer/AI.md.example +2 -2
  86. package/templates/root-consumer/CLAUDE.md.example +33 -1
  87. package/templates/root-consumer/guides/dndev/INDEX.md.example +23 -27
  88. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +3 -2
  89. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +12 -6
  90. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +50 -3
  91. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +13 -15
  92. package/templates/app-demo/public/manifest.json.example +0 -10
  93. package/templates/app-dndev/public/manifest.json.example +0 -10
  94. package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -147
  95. package/templates/root-consumer/.claude/commands/build.md.example +0 -131
  96. package/templates/root-consumer/.claude/commands/design.md.example +0 -153
  97. package/templates/root-consumer/.claude/commands/grill.md.example +0 -108
  98. package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
  99. package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
  100. package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
  101. package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
  102. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
  103. package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
  104. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
  105. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
  106. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
  107. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
  108. package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
  109. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
  110. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
  111. package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
  112. package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
  113. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
  114. package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
  115. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
  116. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
  117. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
  118. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
  119. package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
@@ -1,132 +0,0 @@
1
- # Configuration Setup
2
-
3
- **For AI Agents:** Configure `src/config/app.ts` and `vite.config.ts`. Framework handles the rest.
4
-
5
- ---
6
-
7
- ## 1. App Configuration
8
-
9
- ```typescript
10
- // src/config/app.ts
11
- import type { AppConfig } from '@donotdev/core';
12
-
13
- export const appConfig: AppConfig = {
14
- app: {
15
- name: 'My App',
16
- shortName: 'App', // Required for PWA
17
- description: 'My app description', // Required for PWA
18
- url: 'https://myapp.com',
19
- },
20
-
21
- preset: 'landing', // landing | admin | moolti | docs | blog | game | plain
22
-
23
- features: {
24
- debug: false, // Enable debug tools
25
- requiredCookies: ['necessary'], // Cookie consent categories
26
- },
27
-
28
- auth: {
29
- authRoute: '/login',
30
- roleRoute: '/404',
31
- tierRoute: '/404',
32
- loginPath: '/login',
33
- profilePath: '/profile',
34
- },
35
-
36
- i18n: {
37
- defaultLanguage: 'en',
38
- fallbackLanguage: 'en',
39
- },
40
-
41
- theme: {
42
- defaultTheme: 'light',
43
- },
44
- };
45
- ```
46
-
47
- ---
48
-
49
- ## 2. Vite Configuration
50
-
51
- ```typescript
52
- // vite.config.ts
53
- import { defineViteConfig } from '@donotdev/core/vite';
54
- import { appConfig } from './src/config/app';
55
-
56
- export default defineViteConfig({
57
- appConfig, // Required
58
- });
59
- ```
60
-
61
- **Done.** Routes, themes, and translations are automatically detected from your `src/` directory.
62
-
63
- ---
64
-
65
- ## 3. Optional Vite Options
66
-
67
- ```typescript
68
- export default defineViteConfig({
69
- appConfig,
70
-
71
- // Debug
72
- debug: true,
73
- verbose: true,
74
-
75
- // Debug options
76
- routes: { debug: true },
77
- themes: { debug: true },
78
- i18n: { debug: true },
79
-
80
- // Server
81
- server: {
82
- port: 3000,
83
- https: true,
84
- },
85
-
86
- // Build
87
- build: {
88
- sourcemap: false,
89
- },
90
-
91
- // SEO
92
- seo: {
93
- disabled: false,
94
- generateRobotsTxt: true,
95
- generateSitemap: true,
96
- },
97
-
98
- // PWA (see SETUP_PWA.md for full guide)
99
- pwa: {
100
- enabled: false, // Enable PWA in production
101
- devEnabled: false, // Enable PWA in development (optional)
102
- },
103
- });
104
- ```
105
-
106
- ---
107
-
108
- ## 4. Environment Variables
109
-
110
- **Vite loads `.env` from the app directory only.** Not the repo root.
111
-
112
- Run `dndev coach` to see what to configure, then `dndev setup` to validate and automate. See [SETUP_FIREBASE.md](./SETUP_FIREBASE.md).
113
-
114
- ```bash
115
- # apps/<your-app>/.env — client-side variables (exposed to browser)
116
- VITE_APP_URL=http://localhost:5173
117
- VITE_DONOTDEV_LICENSE_KEY=dndev_your_key_here
118
- VITE_FIREBASE_API_KEY=... # Written by dndev setup
119
- VITE_FIREBASE_PROJECT_ID=... # Written by dndev setup
120
- VITE_AUTH_PARTNERS=github,google
121
- VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...
122
-
123
- # functions/.env — server-side secrets (never exposed to browser)
124
- STRIPE_SECRET_KEY=sk_test_...
125
- STRIPE_WEBHOOK_SECRET=whsec_...
126
- ```
127
-
128
- Push server secrets to Firebase: `dndev sync-secrets`
129
-
130
- ---
131
-
132
- **Zero config. Override when needed.**
@@ -1,280 +0,0 @@
1
- # Setup: Blog
2
-
3
- **Convention-based markdown blog.** Drop `slug_lang.md` files in `src/content/blog/`, get a fully functional blog with i18n, reading time, tags, RSS, and sitemap.
4
-
5
- ---
6
-
7
- ## Quick Start
8
-
9
- ### 1. Create the content directory
10
-
11
- ```
12
- src/content/blog/
13
- ├── my-first-post_en.md
14
- ├── my-first-post_fr.md
15
- └── another-post_en.md
16
- ```
17
-
18
- ### 2. Write a post with frontmatter
19
-
20
- ```markdown
21
- ---
22
- title: My First Post
23
- description: A short summary for listings and SEO
24
- date: 2025-06-01
25
- tags: tutorial, getting-started
26
- image: /blog/my-first-post.png
27
- ---
28
-
29
- Your markdown content here. Supports:
30
- - **Bold**, *italic*, ~~strikethrough~~
31
- - [Internal links](/faq) and [external links](https://example.com)
32
- - Images: ![alt text](/blog/my-image.png)
33
- - Code blocks with syntax highlighting
34
- ```
35
-
36
- ### 3. Create the data loader
37
-
38
- ```typescript
39
- // src/data/blog/index.ts
40
- import { createBlogLoader } from '@donotdev/templates';
41
- import type { BlogLoader } from '@donotdev/templates';
42
-
43
- const markdownFiles = import.meta.glob('../../content/blog/*.md', {
44
- query: '?raw',
45
- import: 'default',
46
- eager: true,
47
- });
48
-
49
- export function getBlogLoader(lang: string = 'en'): BlogLoader {
50
- return createBlogLoader(markdownFiles as Record<string, string>, lang);
51
- }
52
- ```
53
-
54
- ### 4. Create the listing page
55
-
56
- ```typescript
57
- // src/pages/BlogPage.tsx
58
- import { BookOpen } from 'lucide-react';
59
- import { HeroSection } from '@donotdev/components';
60
- import { useTranslation, type PageMeta } from '@donotdev/core';
61
- import { BlogList } from '@donotdev/templates';
62
- import { PageContainer } from '@donotdev/ui';
63
- import { getBlogLoader } from '../data/blog';
64
-
65
- export const NAMESPACE = 'blog';
66
- export const meta: PageMeta = { namespace: NAMESPACE, icon: <BookOpen /> };
67
-
68
- export default function BlogPage() {
69
- const { t, i18n } = useTranslation([NAMESPACE]);
70
- const posts = getBlogLoader(i18n?.language).getAllPosts();
71
-
72
- return (
73
- <PageContainer variant="docs">
74
- <HeroSection title={t('title')} subtitle={t('subtitle')} />
75
- <BlogList posts={posts} />
76
- </PageContainer>
77
- );
78
- }
79
- ```
80
-
81
- ### 5. Create the post page (dynamic route)
82
-
83
- ```typescript
84
- // src/pages/BlogPostPage.tsx
85
- import { BookOpen } from 'lucide-react';
86
- import { useTranslation, type PageMeta } from '@donotdev/core';
87
- import { BlogPostView } from '@donotdev/templates';
88
- import { PageContainer, useRouteParam } from '@donotdev/ui';
89
- import { getBlogLoader } from '../data/blog';
90
-
91
- export const NAMESPACE = 'blog';
92
- export const meta: PageMeta = {
93
- namespace: NAMESPACE,
94
- icon: <BookOpen />,
95
- route: '/blog/:slug',
96
- hideFromMenu: true,
97
- };
98
-
99
- export default function BlogPostPage() {
100
- const { i18n } = useTranslation([NAMESPACE]);
101
- const slug = useRouteParam('slug');
102
- const post = slug ? getBlogLoader(i18n?.language).getPostBySlug(slug) : null;
103
-
104
- return (
105
- <PageContainer variant="docs">
106
- <BlogPostView post={post} />
107
- </PageContainer>
108
- );
109
- }
110
- ```
111
-
112
- ### 6. Add locale files
113
-
114
- Blog UI labels (`readMore`, `backToBlog`, `publishedOn`, etc.) are provided by the framework via `blog_*.json` in `@donotdev/core`. Override any key by creating the same file in your app.
115
-
116
- Page-specific strings (title, subtitle) go in your app locale:
117
-
118
- ```json
119
- // src/pages/locales/blog_en.json
120
- {
121
- "title": "Blog",
122
- "subtitle": "Your subtitle here"
123
- }
124
- ```
125
-
126
- ---
127
-
128
- ## File Convention
129
-
130
- **Pattern:** `slug_lang.md`
131
-
132
- | File | Slug | Language |
133
- |------|------|----------|
134
- | `my-post_en.md` | `my-post` | English |
135
- | `my-post_fr.md` | `my-post` | French |
136
- | `my-post_de.md` | `my-post` | German |
137
- | `solo-post_en.md` | `solo-post` | English (no FR = falls back to EN) |
138
-
139
- **Rules:**
140
- - Slug = everything before the last `_xx` suffix
141
- - Language suffix must be 2-5 characters (ISO codes)
142
- - English (`_en`) is the fallback language
143
- - If a post only exists in `_en`, it's shown for all languages
144
-
145
- ---
146
-
147
- ## Frontmatter Fields
148
-
149
- | Field | Required | Description |
150
- |-------|----------|-------------|
151
- | `title` | Yes | Post title |
152
- | `description` | Yes | Summary for listings and SEO |
153
- | `date` | Yes | Publication date (YYYY-MM-DD) |
154
- | `tags` | No | Comma-separated tags |
155
- | `image` | No | Hero image path — must be in `public/blog/` (see Images section) |
156
-
157
- Custom fields are preserved in `meta[key]`.
158
-
159
- ---
160
-
161
- ## Images
162
-
163
- ### Hero Images (frontmatter `image` field)
164
-
165
- One image per post. Used in blog listing cards, article page, RSS feed, and OG/social sharing.
166
-
167
- **Convention:**
168
- - **Location:** `public/blog/[slug].png` (matches the post slug)
169
- - **Size:** 1200×630px minimum (standard OG ratio, sharp on retina)
170
- - **Format:** PNG or JPG
171
- - **Reference:** `image: /blog/my-post.png` in frontmatter
172
-
173
- ```
174
- public/
175
- └── blog/
176
- ├── my-first-post.png ← matches my-first-post_en.md
177
- ├── another-post.png ← matches another-post_en.md
178
- └── inline-diagram.svg ← used in markdown body
179
- ```
180
-
181
- **Where it shows:**
182
- | Context | Sizing |
183
- |---------|--------|
184
- | Blog listing (featured card) | `width: 100%`, `max-height: 360px`, `object-fit: cover` |
185
- | Blog listing (grid cards) | `width: 100%`, `max-height: 180px`, `object-fit: cover` |
186
- | Article page | `width: 100%`, `max-height: 480px`, `object-fit: cover` |
187
- | RSS feed | `<enclosure>` with full URL |
188
-
189
- ### Inline Images (in markdown body)
190
-
191
- Images referenced in markdown content also go in `public/blog/`:
192
-
193
- ```markdown
194
- ![Architecture diagram](/blog/inline-diagram.svg)
195
- ```
196
-
197
- Rendered with `loading="lazy"` and `decoding="async"`.
198
-
199
- **Co-located images (next to .md files) do NOT work** — `?raw` imports treat markdown as text strings, not processed modules.
200
-
201
- ---
202
-
203
- ## Tags & Filtering
204
-
205
- ```typescript
206
- const blog = getBlogLoader('en');
207
- const allTags = blog.getAllTags(); // ['react', 'typescript', ...]
208
- const filtered = blog.getPostsByTag('react'); // Posts tagged 'react'
209
- ```
210
-
211
- ---
212
-
213
- ## RSS & Sitemap
214
-
215
- **Fully automatic — zero configuration.** The framework handles everything:
216
-
217
- ### Build-time generation
218
-
219
- The SEO pipeline (Vite `SEOPlugin` / Next.js `SEOHandler`) automatically:
220
-
221
- 1. Discovers `src/content/blog/*_en.md` files
222
- 2. Appends blog post URLs to `sitemap.xml`
223
- 3. Generates `rss.xml` (RSS 2.0 with Atom self-link) with all posts
224
-
225
- No manual scripts needed. Just drop `.md` files and build.
226
-
227
- ### RSS auto-discovery
228
-
229
- A `<link rel="alternate" type="application/rss+xml">` tag is automatically injected in the `<head>` by `AutoMetaTags`. This lets browsers and feed readers detect the feed without users needing to know the URL.
230
-
231
- **Requires:** `VITE_APP_URL` (or `NEXT_PUBLIC_APP_URL`) set in `.env` — the RSS link uses the base URL to construct `https://yourdomain.com/rss.xml`.
232
-
233
- ### RSS feed contents
234
-
235
- Each blog post entry includes:
236
- - `<title>`, `<description>`, `<link>`, `<guid>`, `<pubDate>`
237
- - `<category>` (from frontmatter `tags`)
238
- - `<enclosure>` (from frontmatter `image`, if set)
239
-
240
- ---
241
-
242
- ## Scaling (50+ Posts)
243
-
244
- Default uses `eager: true` (all posts bundled into JS). For large blogs, switch to lazy loading:
245
-
246
- ```typescript
247
- // Lazy: posts loaded on demand, not bundled
248
- const markdownFiles = import.meta.glob('../../content/blog/*.md', {
249
- query: '?raw',
250
- import: 'default',
251
- eager: false, // ← Change this
252
- });
253
-
254
- // Now each value is () => Promise<string> instead of string
255
- // You'll need to await them before passing to createBlogLoader
256
- ```
257
-
258
- For most apps (< 50 posts), eager loading is optimal.
259
-
260
- ---
261
-
262
- ## Auto-Deploy
263
-
264
- Push a new `.md` file → CI builds → `import.meta.glob` picks it up at build time → deployed. No CMS, no API.
265
-
266
- ---
267
-
268
- ## API Reference
269
-
270
- From `@donotdev/templates`:
271
-
272
- | Export | Type | Description |
273
- |--------|------|-------------|
274
- | `createBlogLoader` | Function | Create loader from glob results + language |
275
- | `parseFrontmatter` | Function | Parse `---` frontmatter from raw markdown |
276
- | `BlogList` | Component | Renders post listing with cards |
277
- | `BlogPostView` | Component | Renders single post with MarkdownViewer |
278
- | `BlogPost` | Type | Post with slug, meta, content, readingTime, tags |
279
- | `BlogMeta` | Type | Frontmatter metadata |
280
- | `BlogLoader` | Type | Loader interface |
@@ -1,115 +0,0 @@
1
- # Setup: CI/CD
2
-
3
- **One command to set up GitHub Actions: secrets, workflows, staging.**
4
-
5
- ---
6
-
7
- ## Prerequisites
8
-
9
- 1. **GitHub CLI** installed and authenticated:
10
- ```bash
11
- gh auth login
12
- ```
13
- 2. **Git remote** pointing to your GitHub repository
14
- 3. **`.dndev.secrets`** at project root with private tokens:
15
- ```env
16
- GH_PAT=ghp_your_personal_access_token
17
- VERCEL_TOKEN=your_vercel_token # if using Vercel
18
- SUPABASE_ACCESS_TOKEN=your_token # if using Supabase
19
- ```
20
- 4. **Service account key** (Firebase projects):
21
- - `service-account-key.json` in your app directory
22
- - `service-account-key.staging.json` for staging (optional)
23
-
24
- ---
25
-
26
- ## Quick Start
27
-
28
- ```bash
29
- dndev setup-cicd
30
- ```
31
-
32
- The command will:
33
- 1. Detect your app and providers (Firebase, Vercel, Supabase)
34
- 2. Show a plan of secrets to upload and workflows to generate
35
- 3. Upload all secrets to GitHub
36
- 4. Write `.github/workflows/ci.yml`, `deploy.yml`, and optionally `deploy-staging.yml`
37
-
38
- ---
39
-
40
- ## Options
41
-
42
- ```bash
43
- dndev setup-cicd --app web # Target specific app
44
- dndev setup-cicd --dry-run # Preview without uploading or writing
45
- ```
46
-
47
- ---
48
-
49
- ## What Gets Created
50
-
51
- ### Secrets (uploaded to GitHub)
52
-
53
- | Secret | Source | When |
54
- |--------|--------|------|
55
- | `GH_PAT` | `.dndev.secrets` | Always (private dndev checkout) |
56
- | `FIREBASE_SERVICE_ACCOUNT` | `service-account-key.json` (base64) | Firebase projects |
57
- | `FIREBASE_SERVICE_ACCOUNT_STAGING` | `service-account-key.staging.json` (base64) | If staging detected |
58
- | `VERCEL_TOKEN` | `.dndev.secrets` | Vercel projects |
59
- | `VERCEL_ORG_ID` | `.env` | Vercel projects |
60
- | `VERCEL_PROJECT_ID` | `.env` | Vercel projects |
61
- | `SUPABASE_ACCESS_TOKEN` | `.dndev.secrets` | Supabase projects |
62
- | `SUPABASE_PROJECT_REF` | Extracted from `VITE_SUPABASE_URL` | Supabase projects |
63
- | `VITE_*` / `NEXT_PUBLIC_*` | `.env` | Public build vars |
64
-
65
- ### Workflows
66
-
67
- | File | Trigger | What it does |
68
- |------|---------|-------------|
69
- | `ci.yml` | Push + PR to main | Checkout, install, typecheck, test |
70
- | `deploy.yml` | Push to main | Build + deploy to detected providers |
71
- | `deploy-staging.yml` | Push to staging/develop | Same as deploy, using staging credentials |
72
-
73
- ---
74
-
75
- ## Staging Support
76
-
77
- Staging is auto-detected if:
78
- - `.firebaserc` contains a `staging` project alias
79
- - `service-account-key.staging.json` exists
80
-
81
- To enable staging manually:
82
-
83
- 1. Add staging alias to `.firebaserc`:
84
- ```json
85
- {
86
- "projects": {
87
- "default": "my-app-prod",
88
- "staging": "my-app-staging"
89
- }
90
- }
91
- ```
92
- 2. Download the staging service account key as `service-account-key.staging.json`
93
- 3. Re-run `dndev setup-cicd`
94
-
95
- ---
96
-
97
- ## Troubleshooting
98
-
99
- **"Could not detect GitHub repository"**
100
- → Ensure `git remote -v` shows a GitHub URL.
101
-
102
- **Missing secrets warning**
103
- → Add the missing values to `.dndev.secrets` or `.env` and re-run.
104
-
105
- **"gh: not found"**
106
- → Install GitHub CLI: https://cli.github.com/
107
-
108
- ---
109
-
110
- ## See Also
111
-
112
- - [SETUP_FIREBASE.md](./SETUP_FIREBASE.md) — Firebase setup
113
- - [SETUP_VERCEL.md](./SETUP_VERCEL.md) — Vercel setup
114
- - [SETUP_SUPABASE.md](./SETUP_SUPABASE.md) — Supabase setup
115
- - [ENV_SETUP.md](./ENV_SETUP.md) — Environment variables