@donotdev/cli 0.0.12 → 0.0.14

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 (85) hide show
  1. package/dependencies-matrix.json +32 -118
  2. package/dist/bin/commands/agent-setup.d.ts +6 -0
  3. package/dist/bin/commands/agent-setup.d.ts.map +1 -0
  4. package/dist/bin/commands/agent-setup.js +623 -0
  5. package/dist/bin/commands/agent-setup.js.map +1 -0
  6. package/dist/bin/commands/build.js +13 -12
  7. package/dist/bin/commands/bump.js +103 -35
  8. package/dist/bin/commands/cacheout.js +13 -12
  9. package/dist/bin/commands/create-app.js +53 -151
  10. package/dist/bin/commands/create-project.js +109 -167
  11. package/dist/bin/commands/deploy.js +7620 -30
  12. package/dist/bin/commands/dev.js +13 -12
  13. package/dist/bin/commands/emu.js +13 -12
  14. package/dist/bin/commands/firebase-setup.d.ts +6 -0
  15. package/dist/bin/commands/firebase-setup.d.ts.map +1 -0
  16. package/dist/bin/commands/firebase-setup.js +7 -0
  17. package/dist/bin/commands/firebase-setup.js.map +1 -0
  18. package/dist/bin/commands/format.js +13 -12
  19. package/dist/bin/commands/lint.js +13 -12
  20. package/dist/bin/commands/preview.js +13 -12
  21. package/dist/bin/commands/staging.d.ts +11 -0
  22. package/dist/bin/commands/staging.d.ts.map +1 -0
  23. package/dist/bin/commands/staging.js +12 -0
  24. package/dist/bin/commands/staging.js.map +1 -0
  25. package/dist/bin/commands/sync-secrets.js +13 -12
  26. package/dist/bin/commands/wai.js +7397 -11
  27. package/dist/bin/dndev.js +28 -3
  28. package/dist/bin/donotdev.js +28 -3
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +7760 -109
  32. package/dist/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/templates/app-demo/src/pages/DetailPage.tsx.example +1 -1
  35. package/templates/app-demo/src/pages/FullPage.tsx.example +3 -3
  36. package/templates/app-demo/src/pages/HomePage.tsx.example +1 -1
  37. package/templates/app-demo/src/pages/components/ComponentRenderer.tsx.example +5 -5
  38. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +3 -3
  39. package/templates/app-next/.env.example +2 -0
  40. package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
  41. package/templates/app-vite/.env.example +2 -0
  42. package/templates/app-vite/src/pages/HomePage.tsx.example +163 -73
  43. package/templates/functions-firebase/build.mjs.example +26 -10
  44. package/templates/functions-firebase/functions-firebase/build.mjs.example +26 -10
  45. package/templates/functions-firebase/functions.config.js.example +11 -15
  46. package/templates/github-consumer/.github/workflows/ci.yml.example +36 -0
  47. package/templates/root-consumer/.claude/agents/architect.md.example +2 -2
  48. package/templates/root-consumer/.claude/agents/builder.md.example +2 -2
  49. package/templates/root-consumer/.claude/agents/coder.md.example +2 -2
  50. package/templates/root-consumer/.claude/agents/extractor.md.example +2 -3
  51. package/templates/root-consumer/.claude/agents/polisher.md.example +67 -291
  52. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +4 -4
  53. package/templates/root-consumer/.claude/commands/brainstorm.md.example +1 -1
  54. package/templates/root-consumer/.claude/commands/build.md.example +3 -3
  55. package/templates/root-consumer/.claude/commands/design.md.example +1 -1
  56. package/templates/root-consumer/.claude/commands/polish.md.example +66 -82
  57. package/templates/root-consumer/.dndev/args.json.example +6 -0
  58. package/templates/root-consumer/.env.example +13 -13
  59. package/templates/root-consumer/.gemini/settings.json.example +9 -0
  60. package/templates/root-consumer/.gitignore.example +3 -1
  61. package/templates/root-consumer/AI.md.example +150 -0
  62. package/templates/root-consumer/CLAUDE.md.example +19 -104
  63. package/templates/root-consumer/README.md.example +81 -255
  64. package/templates/root-consumer/entities/Contact.ts.example +126 -0
  65. package/templates/root-consumer/entities/index.ts.example +6 -3
  66. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +59 -326
  67. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +2 -1
  68. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +144 -9
  69. package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +186 -0
  70. package/templates/root-consumer/guides/dndev/INDEX.md.example +10 -0
  71. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +13 -16
  72. package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +263 -0
  73. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +1 -1
  74. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +168 -0
  75. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +17 -19
  76. package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +184 -0
  77. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +134 -69
  78. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +66 -44
  79. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +18 -1
  80. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +1 -0
  81. package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +2 -1
  82. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +2 -1
  83. package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +180 -108
  84. package/templates/root-consumer/guides/wai-way/context_map.json.example +8 -7
  85. package/templates/root-consumer/guides/wai-way/page_patterns.md.example +4 -4
@@ -2,294 +2,120 @@
2
2
 
3
3
  **Built with [DoNotDev Framework](https://donotdev.com)**
4
4
 
5
- ## 🚀 Quick Start
5
+ ## Setup
6
+
7
+ **Start the app first — the homepage walks you through everything:**
6
8
 
7
9
  ```bash
8
- # Install dependencies
9
10
  bun install
10
-
11
- # Start development server
12
- bun run dev
13
-
14
- # Build for production
15
- bun run build
11
+ bun dev
16
12
  ```
17
13
 
18
- ## 📦 What's Included
14
+ Open the app and follow the setup steps on the homepage (Git, Firebase, Stripe, etc.).
19
15
 
20
- This project is scaffolded with:
16
+ ## Environment Variables
21
17
 
22
- - **DoNotDev Framework** - Modern React framework with auth, billing, i18n
23
- - ✅ **Vite** - Lightning-fast development
24
- - ✅ **TypeScript** - Type-safe throughout
25
- - ✅ **Firebase** - Authentication & database ready
26
- - ✅ **Stripe** - Billing integration ready (optional)
27
- - ✅ **i18n** - Multi-language support (8 languages)
28
- - ✅ **Themes** - Dark mode & custom themes
29
-
30
- ## 📁 Project Structure
18
+ **Each app has its own `.env` file.** Vite loads from the app directory only.
31
19
 
32
20
  ```
33
21
  {{projectName}}/
34
- ├── src/
35
- ├── pages/ # Auto-discovered routes
36
- └── HomePage.tsx # Your landing page
37
- ├── components/ # Your components
38
- ├── App.tsx # App entry point
39
- └── main.tsx # Vite entry
40
- ├── public/
41
- └── assets/
42
- │ ├── themes/ # Custom theme files
43
- │ └── locales/ # Translation files
44
- ├── CLAUDE.md # Guide for AI agents
45
- └── package.json
46
- ```
47
-
48
- ## 🔧 Configuration
49
-
50
- ### License Key
51
-
52
- This project uses `@donotdev` packages from npm. To remove the watermark, add your license key:
53
-
54
- 1. Get your license key from [donotdev.com/pricing](https://donotdev.com/pricing)
55
- 2. Add to `.env` file:
56
- ```env
57
- VITE_DONOTDEV_LICENSE_KEY=dndev_your_key_here
58
- ```
59
- Or for Next.js:
60
- ```env
61
- NEXT_PUBLIC_DONOTDEV_LICENSE_KEY=dndev_your_key_here
62
- ```
63
-
64
- ### Environment Variables
65
-
66
- 1. Copy `.env.example` to `.env`:
67
- ```bash
68
- cp .env.example .env
69
- ```
70
-
71
- 2. Update the values:
72
- ```env
73
- VITE_FIREBASE_API_KEY=your-api-key
74
- VITE_FIREBASE_PROJECT_ID=your-project-id
75
- VITE_FIREBASE_AUTH_DOMAIN=your-auth-domain
76
- ```
77
-
78
- ### Features Configuration
79
-
80
- Edit `vite.config.ts` to enable/disable features:
81
-
82
- ```typescript
83
- export default defineConfig({
84
- plugins: [
85
- doNotDevPlugin({
86
- features: {
87
- enabled: ['auth', 'billing', 'oauth'],
88
- },
89
- }),
90
- ],
91
- });
92
- ```
93
-
94
- ## 🎨 Customization
95
-
96
- ### Adding Your Logo
97
-
98
- Add your `logo.svg` to `public/`:
99
-
100
- - Framework will prompt during build if missing: "Do you want us to provide one from the framework?"
101
- - Or manually copy from `node_modules/@donotdev/ui/assets/logo.svg`
102
- - Framework automatically generates favicon, app icons, and PWA assets from your logo
103
-
104
- ### Add a New Page
105
-
106
- Create a file in `src/pages/`:
107
-
108
- ```tsx
109
- // src/pages/AboutPage.tsx
110
- import { PageContainer } from '@donotdev/ui';
111
- import { Info } from 'lucide-react';
112
- import type { PageMeta } from '@donotdev/core';
113
-
114
- export const meta: PageMeta = {
115
- namespace: 'about',
116
- icon: <Info />,
117
- };
118
-
119
- export default function AboutPage() {
120
- return (
121
- <PageContainer variant="standard">
122
- <h1>About Us</h1>
123
- </PageContainer>
124
- );
125
- }
126
- ```
127
-
128
- Route auto-discovered as `/about` ✨
129
-
130
- ### Add Translations
131
-
132
- Create/edit `public/assets/locales/about_en.json`:
133
-
134
- ```json
135
- {
136
- "title": "About Us",
137
- "description": "Learn more about our mission"
138
- }
139
- ```
140
-
141
- ### Add Custom Theme
142
-
143
- Edit `src/themes.css`:
144
-
145
- ```css
146
- .ocean {
147
- --theme-icon: 'Waves';
148
- --theme-label: 'Ocean';
149
- --primary: #0ea5e9;
150
- --background: #0a1929;
151
- }
22
+ ├── .env.example ← NOT loaded by Vite (reference only)
23
+ ├── apps/
24
+ │ └── my-app/
25
+ ├── .env ← Vite reads THIS one
26
+ ├── .env.local ← Overrides .env (gitignored)
27
+ ├── .env.production ← Production overrides
28
+ │ └── .env.staging ← Staging overrides (used by dndev staging)
29
+ └── functions/
30
+ └── .env ← Server-side secrets (Stripe, OAuth, etc.)
152
31
  ```
153
32
 
154
- ## 🔐 Authentication
155
-
156
- Enable Firebase Auth:
157
-
158
- 1. Set up Firebase project
159
- 2. Enable authentication methods
160
- 3. Update `.env` with Firebase credentials
161
- 4. Use in your pages:
162
-
163
- ```tsx
164
- import { useAuth } from '@donotdev/auth';
165
-
166
- export default function ProfilePage() {
167
- const { user, signOut } = useAuth();
168
- return <div>Hello, {user?.displayName}!</div>;
169
- }
170
- ```
171
-
172
- ## 💳 Billing (Optional)
173
-
174
- Enable Stripe:
175
-
176
- 1. Create Stripe account
177
- 2. Add Stripe keys to `.env`
178
- 3. Enable in `vite.config.ts`
179
- 4. Use in your pages:
180
-
181
- ```tsx
182
- import { useStripeBilling } from '@donotdev/billing';
183
-
184
- export default function PricingPage() {
185
- const { createCheckoutSession } = useStripeBilling();
186
- return <button onClick={() => createCheckoutSession('pro')}>
187
- Upgrade to Pro
188
- </button>;
189
- }
190
- ```
191
-
192
- ## 🚢 Deployment
193
-
194
- ### Firebase Hosting
33
+ **To set up:** Copy `.env.example` to `.env` in your app directory and fill in the values.
195
34
 
196
35
  ```bash
197
- # Install Firebase CLI
198
- npm install -g firebase-tools
199
-
200
- # Login and init
201
- firebase login
202
- firebase init hosting
203
-
204
- # Deploy
205
- bun run build
206
- firebase deploy
36
+ cp apps/my-app/.env.example apps/my-app/.env
207
37
  ```
208
38
 
209
- ### Vercel
39
+ ## CLI Commands
210
40
 
211
41
  ```bash
212
- # Install Vercel CLI
213
- npm install -g vercel
214
-
215
- # Deploy
216
- vercel
42
+ # Development
43
+ bun dev # Start dev server
44
+ dndev emu start # Start Firebase emulators (Auth, Firestore, Functions)
45
+
46
+ # Deployment
47
+ dndev deploy # Deploy to Firebase (hosting + functions + rules)
48
+ dndev staging # Deploy to staging environment
49
+ dndev sync-secrets # Push functions/.env secrets to Firebase Secret Manager
50
+
51
+ # Quality
52
+ bun run type-check # TypeScript validation
53
+ bun test # Run tests
54
+ bun run build # Build for production
217
55
  ```
218
56
 
219
- ## 🤖 Working with AI Agents
220
-
221
- This project includes `CLAUDE.md` - a guide for AI agents like Claude, ChatGPT, etc.
57
+ ## Project Structure
222
58
 
223
- When working with an AI:
224
- 1. The AI will automatically read `CLAUDE.md`
225
- 2. The AI will understand the framework conventions
226
- 3. Ask the AI to create pages, add features, fix bugs, etc.
227
-
228
- **Example prompts:**
229
- - "Create a blog page with post listing"
230
- - "Add French translations for the home page"
231
- - "Create a protected dashboard page that requires authentication"
232
- - "Add a pricing page with Stripe integration"
233
-
234
- ## 📚 Documentation
235
-
236
- - **Framework Docs**: [docs.donotdev.com](https://docs.donotdev.com)
237
- - **CLAUDE.md**: AI agent guide (in this project)
238
- - **Component Library**: [donotdev.com/components](https://donotdev.com/components)
239
-
240
- ## 🆘 Troubleshooting
241
-
242
- ### Build Errors
243
-
244
- ```bash
245
- # Clear cache and reinstall
246
- rm -rf node_modules bun.lock
247
- bun install
59
+ ```
60
+ {{projectName}}/
61
+ ├── apps/
62
+ │ └── my-app/
63
+ │ ├── src/
64
+ │ │ ├── pages/ # Auto-discovered routes (*Page.tsx)
65
+ │ │ ├── config/ # App config (app.ts, legal.ts)
66
+ │ │ └── locales/ # Translations (optional)
67
+ │ ├── .env # App environment variables
68
+ │ └── vite.config.ts # Vite config
69
+ ├── entities/ # Entity definitions (shared across apps)
70
+ ├── functions/ # Firebase Cloud Functions
71
+ │ └── .env # Server-side secrets
72
+ ├── guides/ # WAI-WAY blueprints + framework guides
73
+ ├── AI.md # AI agent instructions
74
+ ├── CLAUDE.md # Claude-specific instructions
75
+ ├── firebase.json # Firebase config
76
+ ├── firestore.rules # Firestore security rules (generated by Phase 4)
77
+ └── .firebaserc # Firebase project aliases
248
78
  ```
249
79
 
250
- ### Firebase Connection Issues
251
-
252
- - Verify `.env` has correct Firebase credentials
253
- - Check Firebase console for project status
254
- - Ensure authentication is enabled
255
-
256
- ### Hot Reload Not Working
257
-
258
- - Check Vite config port (default: 5173)
259
- - Ensure no other process is using the port
80
+ ## Building With AI
260
81
 
261
- ## 📝 Scripts
82
+ This project is configured for AI-assisted development via WAI-WAY:
262
83
 
263
- ```bash
264
- bun run dev # Start development server
265
- bun run build # Build for production
266
- bun run preview # Preview production build
267
- bun run lint # Lint code
268
- bun run type-check # TypeScript validation
269
- dndev format # Format code with Prettier
270
- ```
84
+ 1. Open in **Cursor**, **Claude Code**, **Windsurf**, or **AntiGravity**
85
+ 2. The AI reads `AI.md` automatically and follows the WAI-WAY protocol
86
+ 3. MCP tools are pre-configured — the AI looks up real TypeScript types instead of guessing
271
87
 
272
- ### Code Formatting
88
+ **The 5 phases:**
89
+ - Phase 0: Brainstorm — describe your app, produce a validated spec
90
+ - Phase 1: Scaffold — create all pages and routes from spec
91
+ - Phase 2: Entities — define data models with fields, access rules, visibility
92
+ - Phase 3: Compose — build pages with framework components
93
+ - Phase 4: Configure — generate tests, firestore rules, CI/CD
273
94
 
274
- The project includes `.prettierrc.cjs` which extends the framework's Prettier configuration. Run `dndev format` to format all TypeScript files according to the project's Prettier rules.
95
+ Read `guides/wai-way/WAI_WAY_CLI.md` for the full workflow.
275
96
 
276
- ## 🙏 Built With
97
+ ## Key Files
277
98
 
278
- - [DoNotDev Framework](https://donotdev.com) - Application framework
279
- - [React 19](https://react.dev) - UI library
280
- - [Vite](https://vitejs.dev) - Build tool
281
- - [TypeScript](https://www.typescriptlang.org) - Type safety
282
- - [Firebase](https://firebase.google.com) - Backend services
283
- - [Stripe](https://stripe.com) - Payment processing
99
+ | File | Purpose |
100
+ |------|---------|
101
+ | `entities/*.ts` | Data model definitions — CRUD, forms, lists auto-generated |
102
+ | `src/pages/*Page.tsx` | Pages — auto-discovered as routes by filename |
103
+ | `src/config/app.ts` | App name, preset, features |
104
+ | `src/config/legal.ts` | Company info, legal compliance |
105
+ | `guides/dndev/` | Framework setup guides (Auth, CRUD, Billing, etc.) |
106
+ | `guides/wai-way/` | WAI-WAY blueprints and agent personas |
284
107
 
285
- ## 📄 License
108
+ ## License Key
286
109
 
287
- Your project license here (MIT, Apache, proprietary, etc.)
110
+ Add your license key to your **app's** `.env` (not the root):
288
111
 
289
- ## 🤝 Contributing
112
+ ```env
113
+ # apps/my-app/.env
114
+ VITE_DONOTDEV_LICENSE_KEY=dndev_your_key_here
115
+ ```
290
116
 
291
- [Add your contribution guidelines here]
117
+ Get your key from [donotdev.com/pricing](https://donotdev.com/pricing).
292
118
 
293
119
  ---
294
120
 
295
- **Need help?** Check [DoNotDev Documentation](https://docs.donotdev.com) or open an issue.
121
+ **Need help?** Check the homepage setup guide or read `guides/dndev/` for detailed instructions.
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @fileoverview Contact Entity — Guest-Created, Admin-Managed
3
+ *
4
+ * This entity demonstrates the PUBLIC FORM pattern:
5
+ * - Guests (unauthenticated) can CREATE (contact form submission)
6
+ * - Only admins can READ, UPDATE, DELETE (CRM inbox)
7
+ *
8
+ * COMMON USE CASES:
9
+ * - Contact forms, inquiry forms, support requests
10
+ * - Lead capture, newsletter signups
11
+ * - Any public submission that admins manage
12
+ *
13
+ * FIRESTORE PATH: `contacts/{contactId}`
14
+ */
15
+
16
+ import { defineEntity } from '@donotdev/core';
17
+
18
+ export const contactEntity = defineEntity({
19
+ name: 'Contact',
20
+ collection: 'contacts',
21
+ listFields: ['name', 'email', 'subject', 'status'],
22
+
23
+ // Guest can create (public form), only admins manage
24
+ access: {
25
+ create: 'guest',
26
+ read: 'admin',
27
+ update: 'admin',
28
+ delete: 'admin',
29
+ },
30
+
31
+ fields: {
32
+ // Public form fields — guests fill these on submission
33
+ name: {
34
+ name: 'name',
35
+ label: 'name',
36
+ type: 'text',
37
+ visibility: 'admin',
38
+ editable: 'admin',
39
+ validation: { required: true },
40
+ },
41
+
42
+ email: {
43
+ name: 'email',
44
+ label: 'email',
45
+ type: 'email',
46
+ visibility: 'admin',
47
+ editable: 'admin',
48
+ validation: { required: true },
49
+ },
50
+
51
+ phone: {
52
+ name: 'phone',
53
+ label: 'phone',
54
+ type: 'tel',
55
+ visibility: 'admin',
56
+ editable: 'admin',
57
+ validation: { required: false },
58
+ },
59
+
60
+ subject: {
61
+ name: 'subject',
62
+ label: 'subject',
63
+ type: 'select',
64
+ visibility: 'admin',
65
+ editable: 'create-only',
66
+ validation: {
67
+ required: true,
68
+ options: [
69
+ { value: 'general', label: 'subject.general' },
70
+ { value: 'support', label: 'subject.support' },
71
+ { value: 'sales', label: 'subject.sales' },
72
+ ],
73
+ },
74
+ },
75
+
76
+ message: {
77
+ name: 'message',
78
+ label: 'message',
79
+ type: 'textarea',
80
+ visibility: 'admin',
81
+ editable: 'create-only',
82
+ validation: { required: true },
83
+ },
84
+
85
+ // GDPR consent — required on public forms in EU
86
+ gdprConsent: {
87
+ name: 'gdprConsent',
88
+ label: 'consent',
89
+ type: 'gdprConsent',
90
+ visibility: 'guest',
91
+ editable: 'create-only',
92
+ validation: { required: true },
93
+ options: {
94
+ fieldSpecific: {
95
+ privacyPolicyPath: '/legal/privacy',
96
+ termsPath: '/legal/terms',
97
+ },
98
+ },
99
+ },
100
+
101
+ // Admin-only fields for managing submissions
102
+ notes: {
103
+ name: 'notes',
104
+ label: 'notes',
105
+ type: 'textarea',
106
+ visibility: 'admin',
107
+ editable: 'admin',
108
+ validation: { required: false },
109
+ },
110
+
111
+ status: {
112
+ name: 'status',
113
+ label: 'status',
114
+ type: 'select',
115
+ visibility: 'admin',
116
+ editable: 'admin',
117
+ validation: {
118
+ options: [
119
+ // Framework adds: draft, available, deleted
120
+ // Custom statuses:
121
+ { value: 'responded', label: 'status.responded' },
122
+ ],
123
+ },
124
+ },
125
+ },
126
+ });
@@ -5,11 +5,14 @@
5
5
  *
6
6
  * USAGE:
7
7
  * ```tsx
8
- * import { productEntity, customerEntity } from '../entities';
8
+ * import { contactEntity, productEntity } from '../entities';
9
9
  * ```
10
10
  */
11
11
 
12
- // Export your entities here:
13
- // export { productEntity } from './Product';
12
+ // Scaffolded examples — rename or replace with your own entities:
13
+ export { contactEntity } from './Contact';
14
+ export { productEntity } from './ExampleEntity';
15
+
16
+ // Add your entities:
14
17
  // export { customerEntity } from './Customer';
15
18
  // export { orderEntity } from './Order';