@donotdev/cli 0.3.0 → 0.3.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 (104) hide show
  1. package/dependencies-matrix.json +51 -27
  2. package/dist/bin/commands/agent-setup.js +28 -18
  3. package/dist/bin/commands/build.js +1086 -58
  4. package/dist/bin/commands/bump.js +337 -53
  5. package/dist/bin/commands/cacheout.js +28 -18
  6. package/dist/bin/commands/coach.js +33 -25
  7. package/dist/bin/commands/create-app.js +597 -244
  8. package/dist/bin/commands/create-project.js +607 -254
  9. package/dist/bin/commands/db-check.js +37 -28
  10. package/dist/bin/commands/db.js +37 -28
  11. package/dist/bin/commands/deploy.js +13758 -11807
  12. package/dist/bin/commands/dev.js +50 -34
  13. package/dist/bin/commands/doctor.js +33 -25
  14. package/dist/bin/commands/emu.js +65 -43
  15. package/dist/bin/commands/format.js +28 -18
  16. package/dist/bin/commands/get-demo.js +81 -46
  17. package/dist/bin/commands/make-admin.js +966 -896
  18. package/dist/bin/commands/preview.js +50 -34
  19. package/dist/bin/commands/seed.js +37 -28
  20. package/dist/bin/commands/setup-cicd.js +1286 -87
  21. package/dist/bin/commands/setup.js +152 -138
  22. package/dist/bin/commands/staging.js +13758 -11807
  23. package/dist/bin/commands/sync-secrets.js +152 -132
  24. package/dist/bin/commands/type-check.js +1086 -39
  25. package/dist/bin/commands/wai.js +28 -18
  26. package/dist/bin/dndev.js +513 -30
  27. package/dist/bin/donotdev.js +33 -8
  28. package/dist/index.js +14568 -12497
  29. package/package.json +1 -1
  30. package/templates/app-demo/index.html.example +0 -1
  31. package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
  32. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
  33. package/templates/app-demo/tsconfig.json.example +1 -1
  34. package/templates/app-dndev/index.html.example +1 -3
  35. package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +1 -0
  36. package/templates/app-expo/app/_layout.tsx.example +1 -1
  37. package/templates/app-expo/app/form.tsx.example +10 -3
  38. package/templates/app-expo/app/index.tsx.example +3 -3
  39. package/templates/app-expo/app/list.tsx.example +2 -2
  40. package/templates/app-expo/app/profile.tsx.example +4 -3
  41. package/templates/app-expo/app/signin.tsx.example +2 -2
  42. package/templates/app-expo/babel.config.js.example +23 -6
  43. package/templates/app-expo/metro.config.js.example +7 -17
  44. package/templates/app-expo/tsconfig.json.example +2 -1
  45. package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
  46. package/templates/app-vite/index.html.example +1 -3
  47. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  48. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
  49. package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
  50. package/templates/app-vite/src/pages/NotFoundPage.tsx.example +1 -0
  51. package/templates/deploy-config/firebase.json.example +6 -5
  52. package/templates/deploy-config/tsconfig.functions.json.example +2 -7
  53. package/templates/deploy-config/vercel.json.example +6 -420
  54. package/templates/functions-firebase/README.md.example +8 -8
  55. package/templates/functions-firebase/functions.config.js.example +2 -1
  56. package/templates/functions-firebase/src/index.ts.example +4 -3
  57. package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
  58. package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
  59. package/templates/functions-firebase/tsconfig.json.example +3 -5
  60. package/templates/functions-supabase/supabase/config.toml.example +2 -1
  61. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
  62. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
  63. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
  64. package/templates/functions-vercel/README.md.example +15 -25
  65. package/templates/functions-vercel/build.mjs.example +4 -46
  66. package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
  67. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
  68. package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
  69. package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
  70. package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
  71. package/templates/functions-vercel/tsconfig.json.example +5 -6
  72. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  73. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
  74. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
  75. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
  76. package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
  77. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
  78. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
  79. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
  80. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
  81. package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
  82. package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
  83. package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
  84. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
  85. package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
  86. package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
  87. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
  88. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
  89. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
  90. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  91. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  92. package/templates/root-consumer/.claude/settings.json.example +0 -11
  93. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  94. package/templates/root-consumer/.dndev/args.json.example +2 -2
  95. package/templates/root-consumer/.env.example +1 -1
  96. package/templates/root-consumer/.gitignore.example +2 -0
  97. package/templates/root-consumer/AGENTS.md.example +3 -3
  98. package/templates/root-consumer/README.md.example +1 -1
  99. package/templates/app-vite/csp.example.json +0 -44
  100. package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
  101. package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
  102. package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
  103. package/templates/functions-vercel/vercel.json.example +0 -14
  104. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -18
@@ -14,5 +14,5 @@
14
14
  # apps/<your-app>/.env → VITE_FIREBASE_API_KEY=...
15
15
  #
16
16
  # For server-side secrets (Stripe, OAuth):
17
- # functions/.env → STRIPE_SECRET_KEY=sk_...
17
+ # .dndev.secrets (project root) → STRIPE_SECRET_KEY=sk_...
18
18
  # Then run: dndev sync-secrets
@@ -62,6 +62,8 @@ Desktop.ini
62
62
  *.generated.ts
63
63
  *.generated.log
64
64
  apps/*/public/route-manifest.json
65
+ # Rewritten by `next dev` / `next build` (differs between them): never committed
66
+ next-env.d.ts
65
67
 
66
68
  # Cache
67
69
  .cache/
@@ -15,7 +15,7 @@ Architecture and API contracts: **`get_guideline(...)`** and **`lookup_symbol(..
15
15
 
16
16
  ## The 5 phases
17
17
 
18
- Work inside an active phase: **`start_phase(N)`** before work, **`complete_phase({ files })`** before moving on, **`dn tc`** before completing a phase when you changed code.
18
+ Work inside an active phase: **`start_phase(N)`** before work, **`complete_phase({ files })`** before moving on, **`dn tc`** once at the end of the work batch (before commit / deploy), never after each change or feature.
19
19
 
20
20
  | Phase | Name | Skill (slash) | Focus |
21
21
  |-------|------|---------------|--------|
@@ -52,7 +52,7 @@ Last resort: after **`lookup_symbol`** + **`search_framework`**. If you must add
52
52
  | Command | Purpose |
53
53
  |---------|---------|
54
54
  | `dndev dev` / `dndev dev:app` | Dev server |
55
- | `dn tc` / `dn tc --package <name>` | Type-check (use after code changes) |
55
+ | `dn tc` / `dn tc --package <name>` | Type-check, once at the end of the work batch (before commit / deploy), never after each change or feature |
56
56
  | `dndev build` | Production build |
57
57
  | `dndev coach` / `dndev setup` / `dndev doctor` | Env and health |
58
58
 
@@ -63,7 +63,7 @@ Run **`dndev --help`** for the full list. **`dndev create-app`** is interactive
63
63
  - **No local database.** The app runs locally against the live Supabase database. Never `--local`, never `supabase start` / `supabase db reset`.
64
64
  - **Live data:** reads OK. Live writes and migrations only on the owner's order.
65
65
  - **Framework changes** arrive via `dn pack --install` run from the framework repo (unpublished build). A `bun install` reverts them: re-run `dn pack`.
66
- - **Test** by running the app locally on the live database. Typecheck with `dn tc`.
66
+ - **Test** by running the app locally on the live database. Typecheck with `dn tc` once at the end of the work batch (before commit / deploy), never after each change or feature.
67
67
  - **Deploy** only on the owner's order.
68
68
 
69
69
  ## Docs and markdown
@@ -46,7 +46,7 @@ dndev emu start # Start Firebase emulators (Auth, Firestore, Functi
46
46
  # Deployment
47
47
  dndev deploy # Deploy to Firebase (hosting + functions + rules)
48
48
  dndev staging # Deploy to staging environment
49
- dndev sync-secrets # Push functions/.env secrets to Firebase Secret Manager
49
+ dndev sync-secrets # Push .dndev.secrets values to Firebase Secret Manager
50
50
 
51
51
  # Quality
52
52
  dn tc # Type-check (preferred)
@@ -1,44 +0,0 @@
1
- {
2
- "_comment": "Content Security Policy baseline for DoNotDev apps. Copy the relevant directives into your hosting config (vercel.json headers, netlify _headers, etc.).",
3
-
4
- "default-src": "'self'",
5
- "script-src": "'self'",
6
- "style-src": "'self' 'unsafe-inline'",
7
- "img-src": "'self' data: blob: https:",
8
- "font-src": "'self'",
9
- "object-src": "'none'",
10
- "base-uri": "'self'",
11
- "form-action": "'self'",
12
-
13
- "_supabase": {
14
- "_comment": "Add these if your app uses Supabase",
15
- "connect-src": "'self' https://*.supabase.co wss://*.supabase.co",
16
- "frame-src": "https://*.supabase.co"
17
- },
18
-
19
- "_firebase": {
20
- "_comment": "Add these if your app uses Firebase",
21
- "connect-src": "'self' https://*.firebaseio.com https://*.googleapis.com wss://*.firebaseio.com",
22
- "frame-src": "https://*.firebaseapp.com"
23
- },
24
-
25
- "_google_maps": {
26
- "_comment": "Add these if your app uses Google Maps (AddressField)",
27
- "script-src": "'self' https://maps.googleapis.com",
28
- "connect-src": "'self' https://maps.googleapis.com",
29
- "img-src": "'self' data: blob: https: https://*.googleapis.com https://*.gstatic.com"
30
- },
31
-
32
- "_google_oauth": {
33
- "_comment": "Add these if your app uses Google OAuth",
34
- "connect-src": "'self' https://accounts.google.com https://oauth2.googleapis.com https://www.googleapis.com",
35
- "frame-src": "https://accounts.google.com"
36
- },
37
-
38
- "_rules": [
39
- "NEVER mix 'none' with URLs in the same directive (e.g., frame-src 'none' https://... is invalid)",
40
- "NEVER use 'unsafe-eval' — Vite HMR works without it in dev, production never needs it",
41
- "Merge connect-src values from all providers you use into a single directive",
42
- "credentials: 'omit' is set by the framework on cross-origin fetches — CSP does not need to allow cookies for these"
43
- ]
44
- }
@@ -1,20 +0,0 @@
1
- // functions/src/api/oauth/disconnect.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Disconnect OAuth Wrapper
5
- * @description Wrapper for framework's disconnect with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import type { NextApiRequest, NextApiResponse } from 'next';
9
- import { disconnect as frameworkDisconnect } from '@donotdev/functions/vercel';
10
-
11
- /**
12
- * {{APP_NAME}} OAuth disconnection
13
- * Wraps the framework function with {{APP_NAME}}-specific configuration
14
- */
15
- export default async function handler(
16
- req: NextApiRequest,
17
- res: NextApiResponse
18
- ) {
19
- return frameworkDisconnect(req, res);
20
- }
@@ -1,20 +0,0 @@
1
- // functions/src/api/oauth/getConnections.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Get Connections Wrapper
5
- * @description Wrapper for framework's getConnections with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import type { NextApiRequest, NextApiResponse } from 'next';
9
- import { getConnections as frameworkGetConnections } from '@donotdev/functions/vercel';
10
-
11
- /**
12
- * {{APP_NAME}} OAuth connections retrieval
13
- * Wraps the framework function with {{APP_NAME}}-specific configuration
14
- */
15
- export default async function handler(
16
- req: NextApiRequest,
17
- res: NextApiResponse
18
- ) {
19
- return frameworkGetConnections(req, res);
20
- }
@@ -1,20 +0,0 @@
1
- // functions/src/api/oauth/refreshToken.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Refresh Token Wrapper
5
- * @description Wrapper for framework's refreshToken with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import type { NextApiRequest, NextApiResponse } from 'next';
9
- import { refreshToken as frameworkRefreshToken } from '@donotdev/functions/vercel';
10
-
11
- /**
12
- * {{APP_NAME}} OAuth token refresh
13
- * Wraps the framework function with {{APP_NAME}}-specific configuration
14
- */
15
- export default async function handler(
16
- req: NextApiRequest,
17
- res: NextApiResponse
18
- ) {
19
- return frameworkRefreshToken(req, res);
20
- }
@@ -1,14 +0,0 @@
1
- {
2
- "functions": {
3
- "src/api/**/*.ts": {
4
- "runtime": "nodejs22.x"
5
- }
6
- },
7
- "env": {
8
- "STRIPE_SECRET_KEY": "@stripe-secret-key",
9
- "STRIPE_WEBHOOK_SECRET": "@stripe-webhook-secret",
10
- "GITHUB_PERSONAL_ACCESS_TOKEN": "@github-token",
11
- "GITHUB_REPO_OWNER": "@github-repo-owner",
12
- "GITHUB_REPO_NAME": "@github-repo-name"
13
- }
14
- }
@@ -1,18 +0,0 @@
1
- #!/bin/bash
2
- # .claude/hooks/typecheck-stop.sh
3
- # Stop hook: run dn tc before declaring done.
4
- # Ensures type safety before any work is considered complete.
5
-
6
- set -euo pipefail
7
-
8
- # Only run if there are uncommitted changes (something was written)
9
- DIRTY=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
10
- [ "$DIRTY" -eq 0 ] && exit 0
11
-
12
- echo "Running typecheck before completion..." >&2
13
- if ! dn tc 2>&1; then
14
- echo '{"decision":"block","reason":"Typecheck failed. Fix type errors before completing."}'
15
- exit 0
16
- fi
17
-
18
- exit 0