@donotdev/cli 0.1.0 → 0.1.42

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 (390) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +0 -0
  3. package/dependencies-matrix.json +175 -72
  4. package/dist/bin/commands/agent-setup.js +936 -428
  5. package/dist/bin/commands/build.js +4363 -883
  6. package/dist/bin/commands/bump.js +1296 -780
  7. package/dist/bin/commands/cacheout.js +494 -363
  8. package/dist/bin/commands/coach.js +632 -431
  9. package/dist/bin/commands/create-app.js +1316 -799
  10. package/dist/bin/commands/create-project.js +1355 -827
  11. package/dist/bin/commands/db.js +26158 -18868
  12. package/dist/bin/commands/deploy.js +5983 -1971
  13. package/dist/bin/commands/dev.js +1223 -657
  14. package/dist/bin/commands/doctor.js +1100 -528
  15. package/dist/bin/commands/emu.js +1380 -757
  16. package/dist/bin/commands/format.js +494 -363
  17. package/dist/bin/commands/get-demo.js +1210 -715
  18. package/dist/bin/commands/make-admin.js +16073 -8700
  19. package/dist/bin/commands/preview.js +1227 -658
  20. package/dist/bin/commands/seed.js +26171 -18881
  21. package/dist/bin/commands/setup-cicd.js +1475 -880
  22. package/dist/bin/commands/setup.js +1574 -956
  23. package/dist/bin/commands/staging.js +5984 -1972
  24. package/dist/bin/commands/sync-secrets.js +1423 -676
  25. package/dist/bin/commands/type-check.js +976 -469
  26. package/dist/bin/commands/wai.js +499 -368
  27. package/dist/bin/dndev.js +43 -19
  28. package/dist/bin/donotdev.js +43 -19
  29. package/dist/index.js +6166 -2133
  30. package/guidelines/DEPENDENCIES.md +155 -0
  31. package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
  32. package/package.json +2 -1
  33. package/templates/app-demo/.env.example +1 -1
  34. package/templates/app-demo/entities/Contact.ts.example +0 -0
  35. package/templates/app-demo/entities/ExampleEntity.ts.example +0 -0
  36. package/templates/app-demo/entities/demo.ts.example +0 -0
  37. package/templates/app-demo/index.html.example +0 -0
  38. package/templates/app-demo/public/apple-touch-icon.png.example +0 -0
  39. package/templates/app-demo/public/fonts/fonts.css.example +0 -0
  40. package/templates/app-demo/public/icon-192x192.png.example +0 -0
  41. package/templates/app-demo/public/icon-512x512.png.example +0 -0
  42. package/templates/app-demo/src/App.tsx.example +0 -0
  43. package/templates/app-demo/src/config/app.ts.example +0 -0
  44. package/templates/app-demo/src/entities/booking.ts.example +0 -0
  45. package/templates/app-demo/src/entities/onboarding.ts.example +0 -0
  46. package/templates/app-demo/src/entities/product.ts.example +0 -0
  47. package/templates/app-demo/src/entities/quote.ts.example +0 -0
  48. package/templates/app-demo/src/globals.css.example +0 -0
  49. package/templates/app-demo/src/main.tsx.example +0 -0
  50. package/templates/app-demo/src/pages/ChangelogPage.tsx.example +0 -0
  51. package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +0 -0
  52. package/templates/app-demo/src/pages/DashboardPage.tsx.example +0 -0
  53. package/templates/app-demo/src/pages/HomePage.tsx.example +0 -0
  54. package/templates/app-demo/src/pages/OnboardingPage.tsx.example +0 -0
  55. package/templates/app-demo/src/pages/PricingPage.tsx.example +0 -0
  56. package/templates/app-demo/src/pages/ProductsPage.tsx.example +0 -0
  57. package/templates/app-demo/src/pages/ProfilePage.tsx.example +0 -0
  58. package/templates/app-demo/src/pages/SettingsPage.tsx.example +0 -0
  59. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +0 -0
  60. package/templates/app-demo/src/pages/ShowcasePage.tsx.example +0 -0
  61. package/templates/app-demo/src/pages/components/ComponentRenderer.tsx.example +0 -0
  62. package/templates/app-demo/src/pages/components/ComponentsData.tsx.example +0 -0
  63. package/templates/app-demo/src/pages/components/componentConfig.ts.example +0 -0
  64. package/templates/app-demo/src/pages/legal/LegalPage.tsx.example +0 -0
  65. package/templates/app-demo/src/pages/legal/PrivacyPage.tsx.example +0 -0
  66. package/templates/app-demo/src/pages/legal/TermsPage.tsx.example +0 -0
  67. package/templates/app-demo/src/themes.css.example +27 -0
  68. package/templates/app-demo/tsconfig.json.example +0 -0
  69. package/templates/app-demo/vite.config.ts.example +0 -0
  70. package/templates/app-dndev/index.html.example +0 -3
  71. package/templates/app-dndev/src/App.tsx.example +0 -0
  72. package/templates/app-dndev/src/components/CockpitLayout.css.example +0 -0
  73. package/templates/app-dndev/src/components/CockpitLayout.tsx.example +0 -0
  74. package/templates/app-dndev/src/components/Kanban.css.example +0 -0
  75. package/templates/app-dndev/src/components/ModeToggle.tsx.example +0 -0
  76. package/templates/app-dndev/src/components/OverlaySlot.tsx.example +0 -0
  77. package/templates/app-dndev/src/components/TerminalPanel.css.example +0 -0
  78. package/templates/app-dndev/src/components/TerminalPanel.tsx.example +0 -0
  79. package/templates/app-dndev/src/components/markdown-prose.css.example +0 -0
  80. package/templates/app-dndev/src/components/phases/CaptainLog.tsx.example +0 -0
  81. package/templates/app-dndev/src/components/phases/ContextTabs.tsx.example +0 -0
  82. package/templates/app-dndev/src/components/phases/PhaseCard.tsx.example +0 -0
  83. package/templates/app-dndev/src/components/phases/PhaseDetail.tsx.example +0 -0
  84. package/templates/app-dndev/src/components/phases/ReviewPanel.tsx.example +0 -0
  85. package/templates/app-dndev/src/components/phases/phaseData.ts.example +0 -0
  86. package/templates/app-dndev/src/config/app.ts.example +0 -0
  87. package/templates/app-dndev/src/config/commands.ts.example +0 -0
  88. package/templates/app-dndev/src/config/legal.ts.example +0 -0
  89. package/templates/app-dndev/src/config/providers.ts.example +1 -1
  90. package/templates/app-dndev/src/globals.css.example +0 -0
  91. package/templates/app-dndev/src/hooks/useDndevFile.ts.example +0 -0
  92. package/templates/app-dndev/src/main.tsx.example +0 -0
  93. package/templates/app-dndev/src/pages/BoardPage.tsx.example +0 -0
  94. package/templates/app-dndev/src/pages/GrillPage.tsx.example +0 -0
  95. package/templates/app-dndev/src/pages/HomePage.tsx.example +0 -0
  96. package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +0 -0
  97. package/templates/app-dndev/src/pages/PhasesPage.tsx.example +0 -0
  98. package/templates/app-dndev/src/pages/SettingsPage.tsx.example +0 -0
  99. package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +0 -0
  100. package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +0 -0
  101. package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +0 -0
  102. package/templates/app-dndev/src/stores/dndevStore.ts.example +0 -0
  103. package/templates/app-dndev/src/themes.css.example +26 -0
  104. package/templates/app-dndev/terminal-sidecar.cjs.example +0 -0
  105. package/templates/app-dndev/vite.config.ts.example +0 -0
  106. package/templates/app-expo/.env.example +0 -32
  107. package/templates/app-expo/.expo/README.md.example +0 -0
  108. package/templates/app-expo/.gitignore.example +0 -0
  109. package/templates/app-expo/README.md.example +1 -1
  110. package/templates/app-expo/app/.gitkeep +0 -0
  111. package/templates/app-expo/app/_layout.tsx.example +0 -0
  112. package/templates/app-expo/app/form.tsx.example +0 -0
  113. package/templates/app-expo/app/index.tsx.example +0 -0
  114. package/templates/app-expo/app/list.tsx.example +0 -0
  115. package/templates/app-expo/app/profile.tsx.example +0 -0
  116. package/templates/app-expo/app/signin.tsx.example +0 -0
  117. package/templates/app-expo/app.json.example +0 -0
  118. package/templates/app-expo/assets/adaptive-icon.png +0 -0
  119. package/templates/app-expo/assets/favicon.png +0 -0
  120. package/templates/app-expo/assets/icon.png +0 -0
  121. package/templates/app-expo/assets/splash.png +0 -0
  122. package/templates/app-expo/babel.config.js.example +0 -0
  123. package/templates/app-expo/eas.json.example +0 -0
  124. package/templates/app-expo/expo-env.d.ts.example +0 -0
  125. package/templates/app-expo/metro.config.js.example +0 -0
  126. package/templates/app-expo/service-account-key.json.example +1 -1
  127. package/templates/app-expo/src/config/app.ts.example +0 -0
  128. package/templates/app-expo/src/config/providers.ts.example +1 -1
  129. package/templates/app-expo/tsconfig.json.example +0 -0
  130. package/templates/app-next/.env.example +0 -33
  131. package/templates/app-next/next.config.ts.example +0 -2
  132. package/templates/app-next/postcss.config.js.example +0 -0
  133. package/templates/app-next/service-account-key.json.example +0 -0
  134. package/templates/app-next/src/app/ClientLayout.tsx.example +0 -0
  135. package/templates/app-next/src/app/layout.tsx.example +13 -4
  136. package/templates/app-next/src/app/not-found.tsx.example +0 -0
  137. package/templates/app-next/src/config/app.ts.example +0 -0
  138. package/templates/app-next/src/config/legal.ts.example +0 -0
  139. package/templates/app-next/src/config/providers.ts.example +1 -1
  140. package/templates/app-next/src/globals.css.example +0 -0
  141. package/templates/app-next/src/locales/dndev_en.json.example +0 -0
  142. package/templates/app-next/src/locales/home_en.json.example +6 -6
  143. package/templates/app-next/src/pages/HomePage.tsx.example +0 -0
  144. package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +0 -0
  145. package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +0 -0
  146. package/templates/app-next/src/pages/legal/TermsPage.tsx.example +0 -0
  147. package/templates/app-next/src/pages/locales/example_en.json.example +0 -0
  148. package/templates/app-next/src/themes.css.example +28 -1
  149. package/templates/app-vite/.env.example +0 -33
  150. package/templates/app-vite/csp.example.json +44 -0
  151. package/templates/app-vite/index.html.example +0 -3
  152. package/templates/app-vite/service-account-key.json.example +0 -0
  153. package/templates/app-vite/src/App.tsx.example +0 -0
  154. package/templates/app-vite/src/config/app.ts.example +0 -0
  155. package/templates/app-vite/src/config/legal.ts.example +0 -0
  156. package/templates/app-vite/src/config/providers.ts.example +1 -1
  157. package/templates/app-vite/src/globals.css.example +0 -0
  158. package/templates/app-vite/src/locales/dndev_en.json.example +0 -0
  159. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  160. package/templates/app-vite/src/main.tsx.example +0 -0
  161. package/templates/app-vite/src/pages/FormPageExample.tsx.example +0 -0
  162. package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
  163. package/templates/app-vite/src/pages/ListPageExample.tsx.example +0 -0
  164. package/templates/app-vite/src/pages/NotFoundPage.tsx.example +0 -0
  165. package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +0 -0
  166. package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +0 -0
  167. package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +0 -0
  168. package/templates/app-vite/src/pages/locales/example_en.json.example +0 -0
  169. package/templates/app-vite/src/themes.css.example +26 -0
  170. package/templates/deploy-config/.firebaserc.example +0 -0
  171. package/templates/deploy-config/firestore.indexes.json.example +0 -0
  172. package/templates/deploy-config/firestore.rules.example +0 -0
  173. package/templates/deploy-config/storage.rules.example +0 -0
  174. package/templates/deploy-config/tsconfig.functions.json.example +0 -0
  175. package/templates/deploy-config/vercel.json.example +2 -2
  176. package/templates/functions-firebase/.env.example +2 -2
  177. package/templates/functions-firebase/README.md.example +3 -3
  178. package/templates/functions-firebase/build.mjs.example +0 -0
  179. package/templates/functions-firebase/functions.config.js.example +0 -0
  180. package/templates/functions-firebase/functions.yaml.example +0 -0
  181. package/templates/functions-firebase/src/auth/getCustomClaims.ts.example +0 -0
  182. package/templates/functions-firebase/src/auth/getUserAuthStatus.ts.example +0 -0
  183. package/templates/functions-firebase/src/auth/index.ts.example +0 -0
  184. package/templates/functions-firebase/src/auth/removeCustomClaims.ts.example +0 -0
  185. package/templates/functions-firebase/src/auth/setCustomClaims.ts.example +0 -0
  186. package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +0 -0
  187. package/templates/functions-firebase/src/billing/index.ts.example +0 -0
  188. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -0
  189. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +0 -0
  190. package/templates/functions-firebase/src/crud/createEntity.ts.example +0 -0
  191. package/templates/functions-firebase/src/crud/deleteEntity.ts.example +0 -0
  192. package/templates/functions-firebase/src/crud/getEntity.ts.example +0 -0
  193. package/templates/functions-firebase/src/crud/index.ts.example +0 -0
  194. package/templates/functions-firebase/src/crud/listEntities.ts.example +0 -0
  195. package/templates/functions-firebase/src/crud/updateEntity.ts.example +0 -0
  196. package/templates/functions-firebase/src/index.ts.example +0 -0
  197. package/templates/functions-firebase/src/oauth/checkGitHubAccess.ts.example +0 -0
  198. package/templates/functions-firebase/src/oauth/disconnect.ts.example +0 -0
  199. package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +0 -0
  200. package/templates/functions-firebase/src/oauth/getConnections.ts.example +0 -0
  201. package/templates/functions-firebase/src/oauth/grantGitHubAccess.ts.example +0 -0
  202. package/templates/functions-firebase/src/oauth/index.ts.example +0 -0
  203. package/templates/functions-firebase/src/oauth/refreshToken.ts.example +0 -0
  204. package/templates/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +0 -0
  205. package/templates/functions-firebase/tsconfig.json.example +0 -0
  206. package/templates/functions-supabase/supabase/config.toml.example +0 -0
  207. package/templates/functions-supabase/supabase/functions/.env.example +0 -0
  208. package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +0 -0
  209. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +0 -0
  210. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +0 -0
  211. package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +0 -0
  212. package/templates/functions-supabase/supabase/functions/crud/index.ts.example +0 -0
  213. package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +0 -0
  214. package/templates/functions-supabase/supabase/functions/deno.json.example +0 -0
  215. package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +0 -0
  216. package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +0 -0
  217. package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +0 -0
  218. package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +0 -0
  219. package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +0 -0
  220. package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +0 -0
  221. package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +0 -0
  222. package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +0 -0
  223. package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +0 -0
  224. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
  225. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
  226. package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +0 -0
  227. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
  228. package/templates/functions-supabase/supabase/migrations/20250101000004_crud_bulk.sql +192 -0
  229. package/templates/functions-vercel/.env.example +3 -3
  230. package/templates/functions-vercel/README.md.example +2 -2
  231. package/templates/functions-vercel/build.mjs.example +0 -0
  232. package/templates/functions-vercel/src/api/auth/getCustomClaims.ts.example +0 -0
  233. package/templates/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +0 -0
  234. package/templates/functions-vercel/src/api/auth/removeCustomClaims.ts.example +0 -0
  235. package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +0 -0
  236. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +0 -0
  237. package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -0
  238. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +0 -0
  239. package/templates/functions-vercel/src/api/crud/createEntity.ts.example +0 -0
  240. package/templates/functions-vercel/src/api/crud/deleteEntity.ts.example +0 -0
  241. package/templates/functions-vercel/src/api/crud/getEntity.ts.example +0 -0
  242. package/templates/functions-vercel/src/api/crud/listEntities.ts.example +0 -0
  243. package/templates/functions-vercel/src/api/crud/updateEntity.ts.example +0 -0
  244. package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +0 -0
  245. package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -0
  246. package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +0 -0
  247. package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -0
  248. package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +0 -0
  249. package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -0
  250. package/templates/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +0 -0
  251. package/templates/functions-vercel/tsconfig.json.example +0 -0
  252. package/templates/functions-vercel/vercel.json.example +0 -0
  253. package/templates/github-consumer/.github/workflows/ci.yml.example +0 -0
  254. package/templates/overlay-firebase/env.fragment.example +0 -0
  255. package/templates/overlay-firebase/env.fragment.expo.example +0 -0
  256. package/templates/overlay-firebase/env.fragment.nextjs.example +0 -0
  257. package/templates/overlay-firebase/src/config/providers.expo.ts.example +0 -0
  258. package/templates/overlay-firebase/src/config/providers.ts.example +0 -0
  259. package/templates/overlay-supabase/env.fragment.example +0 -0
  260. package/templates/overlay-supabase/env.fragment.expo.example +0 -0
  261. package/templates/overlay-supabase/env.fragment.nextjs.example +0 -0
  262. package/templates/overlay-supabase/src/config/providers.expo.ts.example +1 -1
  263. package/templates/overlay-supabase/src/config/providers.ts.example +1 -1
  264. package/templates/overlay-vercel/env.fragment.example +0 -0
  265. package/templates/overlay-vercel/env.fragment.nextjs.example +0 -0
  266. package/templates/overlay-vercel/src/config/providers.ts.example +0 -0
  267. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +0 -0
  268. package/templates/preset-admin/src/pages/EntityPage.tsx.example +0 -0
  269. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +0 -0
  270. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +0 -0
  271. package/templates/preset-admin/src/pages/UsersPage.tsx.example +0 -0
  272. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +0 -0
  273. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +0 -0
  274. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +0 -0
  275. package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +0 -0
  276. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +0 -0
  277. package/templates/preset-landing/src/pages/AboutPage.tsx.example +0 -0
  278. package/templates/preset-landing/src/pages/ContactPage.tsx.example +0 -0
  279. package/templates/preset-landing/src/pages/HomePage.tsx.example +0 -0
  280. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +0 -0
  281. package/templates/preset-saas/src/pages/HomePage.tsx.example +0 -0
  282. package/templates/preset-saas/src/pages/PricingPage.tsx.example +0 -0
  283. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +0 -0
  284. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +0 -0
  285. package/templates/root-consumer/.claude/agents/architect.md.example +0 -0
  286. package/templates/root-consumer/.claude/agents/builder.md.example +0 -0
  287. package/templates/root-consumer/.claude/agents/coder.md.example +0 -0
  288. package/templates/root-consumer/.claude/agents/extractor.md.example +0 -0
  289. package/templates/root-consumer/.claude/agents/polisher.md.example +0 -0
  290. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +0 -0
  291. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
  292. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +56 -0
  293. package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
  294. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
  295. package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
  296. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
  297. package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
  298. package/templates/root-consumer/.claude/rules/git.md.example +14 -0
  299. package/templates/root-consumer/.claude/rules/security.md.example +13 -0
  300. package/templates/root-consumer/.claude/settings.json.example +100 -4
  301. package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +0 -0
  302. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +22 -27
  303. package/templates/root-consumer/.claude/skills/design/SKILL.md.example +0 -0
  304. package/templates/root-consumer/.claude/skills/design/output-template.md +0 -0
  305. package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +26 -15
  306. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
  307. package/templates/root-consumer/.claude/skills/techdebt/SKILL.md.example +0 -0
  308. package/templates/root-consumer/.cursor/mcp.json.example +0 -0
  309. package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +5 -1
  310. package/templates/root-consumer/.dndev/args.json.example +0 -0
  311. package/templates/root-consumer/.dndev.secrets.example +0 -0
  312. package/templates/root-consumer/.env.example +0 -1
  313. package/templates/root-consumer/.gemini/settings.json.example +0 -0
  314. package/templates/root-consumer/.gitignore.example +1 -0
  315. package/templates/root-consumer/.mcp.json.example +0 -0
  316. package/templates/root-consumer/.prettierrc.cjs.example +0 -0
  317. package/templates/root-consumer/AGENTS.md.example +63 -0
  318. package/templates/root-consumer/CLAUDE.md.example +1 -1
  319. package/templates/root-consumer/README.md.example +11 -33
  320. package/templates/root-consumer/entities/index.ts.example +0 -0
  321. package/templates/root-consumer/eslint.config.js.example +0 -0
  322. package/templates/root-consumer/tsconfig.json.example +0 -0
  323. package/templates/app-demo/public/manifest.json.example +0 -10
  324. package/templates/app-dndev/public/manifest.json.example +0 -10
  325. package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -175
  326. package/templates/root-consumer/.claude/commands/build.md.example +0 -131
  327. package/templates/root-consumer/.claude/commands/design.md.example +0 -184
  328. package/templates/root-consumer/.claude/commands/grill.md.example +0 -135
  329. package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
  330. package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
  331. package/templates/root-consumer/.claude/statusline.py.example +0 -79
  332. package/templates/root-consumer/.clinerules.example +0 -1
  333. package/templates/root-consumer/.cursorrules.example +0 -1
  334. package/templates/root-consumer/.github/copilot-instructions.md.example +0 -1
  335. package/templates/root-consumer/.windsurfrules.example +0 -1
  336. package/templates/root-consumer/AI.md.example +0 -108
  337. package/templates/root-consumer/CONVENTIONS.md.example +0 -1
  338. package/templates/root-consumer/GEMINI.md.example +0 -1
  339. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +0 -135
  340. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -276
  341. package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
  342. package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
  343. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
  344. package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
  345. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
  346. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
  347. package/templates/root-consumer/guides/dndev/INDEX.md.example +0 -60
  348. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
  349. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +0 -133
  350. package/templates/root-consumer/guides/dndev/SETUP_BILLING.md.example +0 -114
  351. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
  352. package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
  353. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
  354. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +0 -231
  355. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
  356. package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
  357. package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
  358. package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +0 -54
  359. package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +0 -60
  360. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
  361. package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
  362. package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +0 -234
  363. package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +0 -62
  364. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +0 -215
  365. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
  366. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
  367. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
  368. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
  369. package/templates/root-consumer/guides/dndev/advanced/APP_CHECK.md.example +0 -111
  370. package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +0 -252
  371. package/templates/root-consumer/guides/dndev/advanced/EMULATORS.md.example +0 -48
  372. package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
  373. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +0 -402
  374. package/templates/root-consumer/guides/wai-way/agents/architect.md.example +0 -78
  375. package/templates/root-consumer/guides/wai-way/agents/builder.md.example +0 -97
  376. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +0 -363
  377. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +0 -133
  378. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +0 -315
  379. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +0 -133
  380. package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +0 -111
  381. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +0 -150
  382. package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +0 -238
  383. package/templates/root-consumer/guides/wai-way/context_map.json.example +0 -127
  384. package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +0 -839
  385. package/templates/root-consumer/guides/wai-way/hld_template.md.example +0 -138
  386. package/templates/root-consumer/guides/wai-way/lld_template.md.example +0 -103
  387. package/templates/root-consumer/guides/wai-way/page_patterns.md.example +0 -722
  388. package/templates/root-consumer/guides/wai-way/prd_template.md.example +0 -140
  389. package/templates/root-consumer/guides/wai-way/presets_guide.md.example +0 -217
  390. package/templates/root-consumer/guides/wai-way/spec_template.md.example +0 -313
@@ -1,205 +0,0 @@
1
- # Setup: Pages & Routing
2
-
3
- **Most is pre-configured.** Drop `*Page.tsx` files. Routes auto-discovered, navigation auto-generated, sitemap auto-built.
4
-
5
- ---
6
-
7
- ## File Routing Rule
8
-
9
- **CRITICAL: Only files ending in `Page.tsx` inside `src/pages` become routes.**
10
-
11
- Files must be named `*Page.tsx` (e.g., `HomePage.tsx`, `AboutPage.tsx`, `BlogPostPage.tsx`). Files without the `Page.tsx` suffix are ignored by the routing system.
12
-
13
- ---
14
-
15
- ## Standard Use
16
-
17
- **Pattern:** `src/pages/**/*Page.tsx` → routes
18
-
19
- **Basic page structure:**
20
- ```tsx
21
- // src/pages/AboutPage.tsx
22
- import { PageContainer } from '@donotdev/ui';
23
-
24
- export const NAMESPACE = 'about';
25
-
26
- export const meta: PageMeta = {
27
- namespace: NAMESPACE,
28
- };
29
-
30
- export default function AboutPage() {
31
- return <PageContainer><h1>About</h1></PageContainer>;
32
- }
33
- ```
34
-
35
- **Cookie-cutter pattern (Landing page):**
36
- ```tsx
37
- import { PageContainer } from '@donotdev/ui';
38
- import { HeroSection, Section, Card, CallToAction } from '@donotdev/components';
39
-
40
- export default function HomePage() {
41
- return (
42
- <PageContainer>
43
- <HeroSection title="Welcome" subtitle="Build fast" variant="primary" />
44
- <Section title="Features" gridCols={3}>
45
- <Card title="Fast" />
46
- <Card title="Simple" />
47
- <Card title="Powerful" />
48
- </Section>
49
- <CallToAction title="Get Started" primaryAction={<Button>Sign Up</Button>} />
50
- </PageContainer>
51
- );
52
- }
53
- ```
54
-
55
- **Drop files, get routes. No config needed.**
56
-
57
- **Component reference:** See [COMPONENTS_ATOMIC.md](./COMPONENTS_ATOMIC.md) for atomic components, [COMPONENTS_UI.md](./COMPONENTS_UI.md) for layout components.
58
-
59
- ---
60
-
61
- ## Advanced: All PageMeta Props
62
-
63
- ```tsx
64
- export const meta: PageMeta = {
65
- // Translation/SEO namespace
66
- namespace: NAMESPACE,
67
-
68
- // Route configuration
69
- route: '/custom-url', // Override auto-generated path
70
- route: { params: ['slug'] }, // Dynamic: /blog/:slug
71
-
72
- // Page title (optional - auto-extracted from filename)
73
- title: 'Custom Title',
74
-
75
- // Navigation icon (lucide-react JSX only)
76
- icon: <Rocket />, // Menu icon (default: Link)
77
-
78
- // Hide from navigation menu
79
- hideFromMenu: false, // Default: false (shows in nav)
80
-
81
- // Layout preset override (per-route)
82
- preset: 'admin', // Override app default for this route
83
-
84
- // Authentication
85
- auth: true, // Simple: auth required
86
- auth: { required: true }, // Explicit: auth required
87
- auth: { required: true, role: 'admin' }, // Role-based access
88
- auth: { required: true, tier: 'pro' }, // Tier-based access
89
- auth: {
90
- required: true,
91
- validate: (role, tier) => role === 'admin' && tier === 'pro'
92
- }, // Custom validation
93
- };
94
- ```
95
-
96
- **Reference implementation:** The demo app (`packages/cli/templates/app-demo/`) shows all these patterns working together — landing, admin, docs presets, auth, showcase, CRUD, legal pages.
97
-
98
- ---
99
-
100
- ## Advanced: Dynamic Routes & Navigation
101
-
102
- ```tsx
103
- // Dynamic route
104
- export const meta: PageMeta = {
105
- namespace: 'blog',
106
- route: { params: ['slug'] }, // → /blog/:slug
107
- };
108
-
109
- export default function BlogPostPage() {
110
- const { slug } = useParams<{ slug: string }>();
111
- return <PageContainer><h1>{slug}</h1></PageContainer>;
112
- }
113
-
114
- // Manual navigation
115
- import { useNavigate, Link } from '@donotdev/ui';
116
- const navigate = useNavigate();
117
- navigate('/about');
118
- <Link path="/about">About</Link>
119
-
120
- // Card with navigation (supports middle-click)
121
- import { Card } from '@donotdev/components';
122
- import { Link } from '@donotdev/ui';
123
-
124
- <Link
125
- path="/about"
126
- style={{ display: 'block', textDecoration: 'none', height: '100%' }}
127
- aria-label="Learn more about About"
128
- >
129
- <Card title="About" subtitle="Learn more" />
130
- </Link>
131
- ```
132
-
133
- **Navigation patterns:**
134
- - **Link component:** Use for text links, buttons, or wrapping other components
135
- - **Card navigation:** Wrap Card in Link for clickable cards with middle-click support
136
- - **onClick only:** Use `onClick={() => navigate()}` for actions that don't need middle-click
137
-
138
- **Pre-configured:** Navigation menu auto-generated, sitemap auto-built (if `generateSitemap: true`).
139
-
140
- ---
141
-
142
- ---
143
-
144
- ## Import Convention
145
-
146
- **Always import from `@donotdev/<package>` top-level.** Never use sub-paths.
147
-
148
- ```tsx
149
- import { PageContainer, Link, useNavigate } from '@donotdev/ui';
150
- import { Card, Button, Input } from '@donotdev/components';
151
- import { useCrud } from '@donotdev/crud';
152
- ```
153
-
154
- **Sub-path exceptions** (server, config, and provider-specific):
155
- - **Server:** `@donotdev/core/server`, `@donotdev/firebase/server`, `@donotdev/security/server`
156
- - **Config:** `@donotdev/core/vite`, `@donotdev/core/next`, `@donotdev/core/functions`
157
- - **Functions:** `@donotdev/functions/firebase`, `@donotdev/functions/vercel`, `@donotdev/functions/supabase`
158
-
159
- ---
160
-
161
- ## SaaS App Pattern
162
-
163
- For SaaS apps, the standard page structure is:
164
-
165
- ```
166
- src/pages/
167
- HomePage.tsx → / → No auth. Login form OR landing page.
168
- Redirects to /dashboard when authenticated.
169
- DashboardPage.tsx → /dashboard → auth: true. Main landing for logged-in users.
170
- SettingsPage.tsx → /settings → auth: true.
171
- ...
172
- ```
173
-
174
- **HomePage is never auth-guarded.** It's the entry point for unauthenticated users. Do NOT create a separate `LoginPage` — HomePage IS the login.
175
-
176
- ```tsx
177
- // src/pages/HomePage.tsx — SaaS pattern
178
- import { useAuthSafe, useNavigate, PageContainer } from '@donotdev/ui';
179
- import { LoginForm } from '@donotdev/templates';
180
-
181
- export const meta: PageMeta = {
182
- namespace: 'home',
183
- // No auth — this is the public entry point
184
- };
185
-
186
- export default function HomePage() {
187
- const user = useAuthSafe('user');
188
- const navigate = useNavigate();
189
-
190
- // Redirect authenticated users to dashboard
191
- if (user) { navigate('/dashboard'); return null; }
192
-
193
- return (
194
- <PageContainer>
195
- <LoginForm onSuccess={() => navigate('/dashboard')} />
196
- </PageContainer>
197
- );
198
- }
199
- ```
200
-
201
- > **Why `useAuthSafe` instead of `useAuth`?** HomePage is public — it renders before auth is guaranteed to be initialized. `useAuthSafe` (from `@donotdev/ui`) gracefully degrades if `@donotdev/auth` isn't installed or still initializing. `useAuth` (from `@donotdev/auth`) throws if auth isn't available. Use `useAuthSafe` on any page without `auth: true` in its meta.
202
-
203
- ---
204
-
205
- **Drop files, get routes. Framework handles the rest.**
@@ -1,213 +0,0 @@
1
- # PWA Setup
2
-
3
- **For AI Agents:** Enable PWA in config, add required app metadata. Framework handles service worker, manifest, and caching.
4
-
5
- ---
6
-
7
- ## Quick Start
8
-
9
- ### 1. Add Required App Metadata
10
-
11
- PWA requires `name`, `shortName`, and `description` in your app config:
12
-
13
- ```typescript
14
- // src/config/app.ts
15
- import type { AppConfig } from '@donotdev/core';
16
-
17
- export const appConfig: AppConfig = {
18
- app: {
19
- name: 'My App', // Full app name (required for PWA)
20
- shortName: 'App', // Short name for home screen (required for PWA)
21
- description: 'My app description', // App description (required for PWA)
22
- url: 'https://myapp.com',
23
- },
24
- // ... rest of config
25
- };
26
- ```
27
-
28
- ### 2. Enable PWA in Build Config
29
-
30
- **For Vite apps:**
31
-
32
- ```typescript
33
- // vite.config.ts
34
- import { defineViteConfig } from '@donotdev/core/vite';
35
- import { appConfig } from './src/config/app';
36
-
37
- export default defineViteConfig({
38
- appConfig,
39
- pwa: {
40
- enabled: true, // Enable PWA in production builds
41
- devEnabled: false, // Enable PWA in development (optional)
42
- },
43
- });
44
- ```
45
-
46
- **For Next.js apps:**
47
-
48
- ```typescript
49
- // next.config.ts
50
- import { defineNextConfig } from '@donotdev/core/next';
51
- import { appConfig } from './src/config/app';
52
-
53
- export default defineNextConfig({
54
- appConfig,
55
- pwa: {
56
- enabled: true, // Enable PWA in production builds
57
- devEnabled: false, // Enable PWA in development (optional)
58
- },
59
- });
60
- ```
61
-
62
- **Done.** Framework automatically:
63
- - Generates `manifest.json` from app metadata
64
- - Creates service worker with Workbox
65
- - Discovers and precaches app icons
66
- - Sets up offline caching strategies
67
-
68
- ---
69
-
70
- ## What Gets Auto-Generated
71
-
72
- ### Manifest (`manifest.json`)
73
- - **Name & description:** From `appConfig.app.name`, `shortName`, `description`
74
- - **Icons:** Auto-discovered from `public/` folder (favicon, apple-touch-icon, etc.)
75
- - **Theme colors:** Defaults to white background, black theme (customizable)
76
- - **Display mode:** `standalone` (app-like experience)
77
-
78
- ### Service Worker (`sw.js`)
79
- - **Precaching:** All JS, CSS, HTML, icons, and fonts
80
- - **Runtime caching:** Smart defaults for API calls and images
81
- - **Offline support:** Navigation fallback to `/`
82
- - **Update strategy:** Prompts user to update when new version available
83
-
84
- ### Icons
85
- Framework discovers icons from:
86
- - `public/favicon.svg` or `public/favicon.ico`
87
- - `public/apple-touch-icon.png`
88
- - Any icons generated by AssetPlugin
89
-
90
- ---
91
-
92
- ## Optional Configuration
93
-
94
- ### Custom Manifest Values
95
-
96
- ```typescript
97
- // vite.config.ts or next.config.ts
98
- export default defineViteConfig({
99
- appConfig,
100
- pwa: {
101
- enabled: true,
102
- manifest: {
103
- // Override any manifest values
104
- theme_color: '#667eea',
105
- background_color: '#ffffff',
106
- display: 'standalone',
107
- orientation: 'portrait',
108
- },
109
- },
110
- });
111
- ```
112
-
113
- ### Custom Workbox Configuration
114
-
115
- ```typescript
116
- pwa: {
117
- enabled: true,
118
- workbox: {
119
- // Maximum file size to cache (default: 5MB)
120
- maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
121
-
122
- // Custom precache patterns
123
- globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
124
- globIgnores: ['**/node_modules/**'],
125
-
126
- // Runtime caching strategies
127
- runtimeCaching: [
128
- {
129
- urlPattern: /^https:\/\/api\.example\.com\/.*/i,
130
- handler: 'NetworkFirst',
131
- options: {
132
- cacheName: 'api-cache',
133
- expiration: {
134
- maxEntries: 50,
135
- maxAgeSeconds: 60 * 60, // 1 hour
136
- },
137
- },
138
- },
139
- ],
140
- },
141
- },
142
- ```
143
-
144
- ### Development Mode
145
-
146
- Enable PWA in development for testing:
147
-
148
- ```typescript
149
- pwa: {
150
- enabled: true,
151
- devEnabled: true, // Enable service worker in dev mode
152
- debug: true, // Enable debug logging
153
- },
154
- ```
155
-
156
- **Note:** Service workers require HTTPS (or localhost). Use `server: { https: true }` in Vite config for local HTTPS.
157
-
158
- ---
159
-
160
- ## Testing PWA
161
-
162
- 1. **Build for production:**
163
- ```bash
164
- bun run build
165
- ```
166
-
167
- 2. **Serve production build:**
168
- ```bash
169
- bun run preview # Vite
170
- # or
171
- bun run start # Next.js
172
- ```
173
-
174
- 3. **Test in browser:**
175
- - Open DevTools → Application → Service Workers
176
- - Check "Offline" checkbox to test offline mode
177
- - Verify manifest in Application → Manifest
178
- - Test "Add to Home Screen" prompt
179
-
180
- ---
181
-
182
- ## Requirements Checklist
183
-
184
- - [ ] `appConfig.app.name` defined
185
- - [ ] `appConfig.app.shortName` defined
186
- - [ ] `appConfig.app.description` defined
187
- - [ ] `pwa.enabled: true` in build config
188
- - [ ] Icons in `public/` folder (auto-discovered)
189
- - [ ] HTTPS in production (required for service workers)
190
-
191
- ---
192
-
193
- ## Troubleshooting
194
-
195
- **PWA not working:**
196
- - Check browser console for service worker errors
197
- - Verify HTTPS (required except localhost)
198
- - Check manifest.json exists in build output
199
- - Verify app metadata is complete
200
-
201
- **Icons not showing:**
202
- - Ensure icons exist in `public/` folder
203
- - Check icon formats (SVG, PNG, ICO supported)
204
- - Verify AssetPlugin discovered icons (check build logs)
205
-
206
- **Service worker not registering:**
207
- - Check browser console for registration errors
208
- - Verify HTTPS (service workers require secure context)
209
- - Clear browser cache and hard refresh
210
-
211
- ---
212
-
213
- **Zero config. Override when needed.**
@@ -1,234 +0,0 @@
1
- # Setup: SOC2 Readiness
2
-
3
- **DoNotDev auto-enforces SOC2 baseline controls.** Zero config needed for the MVP. This guide covers advanced controls and audit verification.
4
-
5
- ---
6
-
7
- ## Zero-Config Baseline (Always On)
8
-
9
- When you wire `DndevSecurity` into your app, these controls activate automatically:
10
-
11
- | Control | Default | SOC2 Criteria |
12
- |---------|---------|---------------|
13
- | Structured audit logging (all CRUD + auth) | ✅ Automatic | CC7.1 |
14
- | Rate limiting (100 writes/min, 500 reads/min) | ✅ Automatic | CC6.6 |
15
- | Brute-force lockout (5 attempts → 15 min) | ✅ Automatic | CC6.1 |
16
- | Session timeout (8h idle) | ✅ Automatic | CC6.1 |
17
- | Field-level RBAC + visibility | ✅ Always on (entity config) | CC6.3 |
18
- | Supabase RLS / Firestore default-deny | ✅ By convention | CC6.3 |
19
-
20
- ---
21
-
22
- ## 1. Wire `DndevSecurity` (Required Once)
23
-
24
- ```typescript
25
- // src/security.ts
26
- import { DndevSecurity } from '@donotdev/security/server';
27
-
28
- export const security = new DndevSecurity({
29
- // Optional: override defaults
30
- // rateLimit: { writesPerMin: 50, readsPerMin: 200 },
31
- // lockout: { maxAttempts: 3, lockoutMs: 30 * 60 * 1000 },
32
- // sessionTimeoutMs: 4 * 60 * 60 * 1000,
33
-
34
- // Required for PII encryption (see § PII Encryption below)
35
- // piiSecret: process.env.PII_SECRET,
36
-
37
- // Optional: send anomaly alerts to your SIEM/Slack
38
- // anomalyHandler: async (alert) => { await fetch(process.env.SIEM_WEBHOOK!, { method: 'POST', body: JSON.stringify(alert) }); },
39
- });
40
- ```
41
-
42
- ```typescript
43
- // src/main.ts (or app entry point)
44
- import { security } from './security';
45
- import { crudService } from './crud'; // your CrudService instance
46
- import { auth } from './auth'; // your SupabaseAuth or FirebaseSDK instance
47
-
48
- crudService.setSecurity(security);
49
- auth.setSecurity(security);
50
- ```
51
-
52
- ---
53
-
54
- ## 2. PII Encryption (Opt-In — C1 Confidentiality)
55
-
56
- Required only for entities storing personal data (email, phone, SSN, health data, etc.).
57
-
58
- ```typescript
59
- // entities/user.ts
60
- export const userEntity = defineEntity({
61
- name: 'User',
62
- collection: 'users',
63
- security: {
64
- piiFields: ['email', 'phone', 'dateOfBirth'], // Encrypted at rest with AES-256-GCM
65
- },
66
- fields: { /* ... */ },
67
- });
68
- ```
69
-
70
- ```bash
71
- # Add to .env (min 32 chars, generate with: openssl rand -hex 32)
72
- PII_SECRET=your-secret-key-min-32-chars-here
73
- ```
74
-
75
- Pass to security:
76
- ```typescript
77
- export const security = new DndevSecurity({
78
- piiSecret: process.env.PII_SECRET,
79
- });
80
- ```
81
-
82
- ---
83
-
84
- ## 3. MFA Enforcement (Opt-In — CC6.1)
85
-
86
- Enforce MFA for specific roles on sensitive entities:
87
-
88
- ```typescript
89
- export const paymentEntity = defineEntity({
90
- name: 'Payment',
91
- collection: 'payments',
92
- security: {
93
- requireMfa: 'admin', // 'admin' | 'manager' | 'user'
94
- },
95
- fields: { /* ... */ },
96
- });
97
- ```
98
-
99
- Enable MFA in your provider:
100
- - **Supabase:** Dashboard → Auth → Multi Factor Authentication → Enable TOTP
101
- - **Firebase:** Firebase Console → Authentication → Multi-factor Auth → Enable
102
-
103
- ---
104
-
105
- ## 4. Data Retention (Opt-In — P6 Privacy)
106
-
107
- ```typescript
108
- export const auditLogEntity = defineEntity({
109
- name: 'AuditLog',
110
- collection: 'audit_logs',
111
- security: {
112
- retention: { days: 365 }, // Auto-flag records for purge after 1 year
113
- },
114
- fields: { /* ... */ },
115
- });
116
- ```
117
-
118
- Run retention purge (e.g., in a scheduled Cloud Function):
119
- ```typescript
120
- import { privacyManager } from '@donotdev/security/server';
121
- // privacyManager.shouldPurge(record.createdAt, retentionDays) → boolean
122
- ```
123
-
124
- ---
125
-
126
- ## 5. Right to Erasure (GDPR Art. 17 / P8)
127
-
128
- ```typescript
129
- import { DndevSecurity } from '@donotdev/security/server';
130
-
131
- // In your account deletion handler:
132
- await security.privacyManager.eraseUser(userId, async (uid) => {
133
- // Your custom erasure logic per collection
134
- await db.from('orders').update({ userId: null }).eq('userId', uid);
135
- await db.from('profiles').delete().eq('id', uid);
136
- });
137
- ```
138
-
139
- ---
140
-
141
- ## 6. Health Monitoring (Opt-In — A1 Availability)
142
-
143
- ```typescript
144
- // src/client/health.ts
145
- import { HealthMonitor } from '@donotdev/security';
146
-
147
- const dbMonitor = new HealthMonitor({ failureThreshold: 3, successThreshold: 2, timeoutMs: 5000 });
148
-
149
- // Wrap all downstream DB calls through the circuit breaker
150
- export const safeQuery = (fn: () => Promise<unknown>) => dbMonitor.protect(fn);
151
-
152
- // Expose a health endpoint (Next.js example)
153
- // app/api/health/route.ts
154
- export async function GET() {
155
- return Response.json({ status: dbMonitor.checkLiveness() });
156
- }
157
- ```
158
-
159
- ---
160
-
161
- ## 7. Anomaly Detection (Opt-In — CC7.2)
162
-
163
- Triggered automatically when brute-force or bulk-delete thresholds are exceeded. Wire a handler to send alerts:
164
-
165
- ```typescript
166
- export const security = new DndevSecurity({
167
- anomalyHandler: async (alert) => {
168
- // Send to Slack, PagerDuty, Datadog, etc.
169
- await fetch(process.env.SLACK_WEBHOOK!, {
170
- method: 'POST',
171
- body: JSON.stringify({ text: `🚨 SOC2 Anomaly: ${alert.type} — ${alert.details}` }),
172
- });
173
- },
174
- });
175
- ```
176
-
177
- ---
178
-
179
- ## 8. Audit Log Output
180
-
181
- Audit events write to `process.stdout` as NDJSON — pipe to your SIEM:
182
-
183
- ```json
184
- {"timestamp":"2025-01-15T10:23:00.000Z","type":"crud.create","userId":"u_123","resource":"products","resourceId":"p_456","ip":"192.168.1.1"}
185
- {"timestamp":"2025-01-15T10:23:01.000Z","type":"auth.login.failure","userId":"unknown","resource":"auth","ip":"10.0.0.5","details":"brute_force_lockout"}
186
- ```
187
-
188
- **Cloud Logging (Firebase / GCP):** Stdout is captured automatically.
189
- **Datadog:** Set `DD_LOGS_INJECTION=true` and pipe stdout to the Datadog agent.
190
- **Supabase:** Export `process.stderr` anomaly alerts to Logflare.
191
-
192
- ---
193
-
194
- ## SOC2 Readiness Check
195
-
196
- Run before any audit:
197
-
198
- ```bash
199
- dn soc2 # Scan current app
200
- dn soc2 --app my-app # Scan specific app
201
- dn soc2 --json # Machine-readable JSON output (CI/CD)
202
- dn soc2 --verbose # Show details for passing checks too
203
- ```
204
-
205
- **Exit codes:** `0` = all checks pass, `1` = one or more checks failed (CI-friendly).
206
-
207
- **Checks run:**
208
-
209
- | Check | Criteria | What It Looks For |
210
- |-------|----------|--------------------|
211
- | SecurityContext wired | CC6.1 | `DndevSecurity` in source |
212
- | PII encryption secret | C1 | `PII_SECRET` in env when `piiFields` defined |
213
- | Firestore default-deny | CC6.3 | `allow read, write: if false` in `firestore.rules` |
214
- | Supabase RLS | CC6.3 | `ENABLE ROW LEVEL SECURITY` in SQL migrations |
215
- | Audit logging | CC7.1 | `.audit()` / `AuditLogger` usage |
216
- | Rate limiting | CC6.6 | `rateLimit` / `DndevRateLimiter` usage |
217
- | Retention policies | P6 | `retention.days` in entity config |
218
- | Health monitoring | A1 | `HealthMonitor` or `/api/health` endpoint |
219
- | MFA enforcement | CC6.1 | `requireMfa` in sensitive entities |
220
-
221
- ---
222
-
223
- ## Coverage After Full Setup
224
-
225
- | SOC2 Criteria | Control | Status |
226
- |---------------|---------|--------|
227
- | CC6.1 Auth hardening | Lockout + session timeout + MFA | Framework-enforced |
228
- | CC6.3 Authorization | RBAC + field visibility + RLS/Firestore rules | Framework-enforced |
229
- | CC6.6 Rate limiting | Per-user sliding window | Framework-enforced |
230
- | CC7.1 Audit logging | All CRUD + auth events as NDJSON | Framework-enforced |
231
- | CC7.2 Anomaly detection | Auth failures + bulk ops threshold alerts | Opt-in handler |
232
- | A1 Availability | Circuit breaker + liveness probes | Opt-in `HealthMonitor` |
233
- | C1 Confidentiality | AES-256-GCM field encryption | Opt-in `piiFields` |
234
- | P1–P8 Privacy | Retention policies + right-to-erasure | Opt-in `retention` |