@donotdev/cli 0.0.17 → 0.0.18
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.
- package/dependencies-matrix.json +166 -58
- package/dist/bin/commands/create-app.js +89 -140
- package/dist/bin/commands/create-project.js +90 -144
- package/dist/bin/dndev.js +9 -6
- package/dist/bin/donotdev.js +9 -6
- package/dist/index.js +97 -148
- package/package.json +1 -1
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +15 -1
- package/templates/root-consumer/.claude/commands/build.md.example +24 -2
- package/templates/root-consumer/.claude/commands/design.md.example +17 -0
- package/templates/root-consumer/.claude/commands/polish.md.example +17 -0
- package/templates/root-consumer/AI.md.example +50 -18
- package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +64 -0
- package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +1 -1
- package/templates/functions-firebase/functions-firebase/README.md.example +0 -123
- package/templates/functions-firebase/functions-firebase/build.mjs.example +0 -5
- package/templates/functions-firebase/functions-firebase/src/auth/getCustomClaims.ts.example +0 -19
- package/templates/functions-firebase/functions-firebase/src/auth/getUserAuthStatus.ts.example +0 -21
- package/templates/functions-firebase/functions-firebase/src/auth/index.ts.example +0 -11
- package/templates/functions-firebase/functions-firebase/src/auth/removeCustomClaims.ts.example +0 -21
- package/templates/functions-firebase/functions-firebase/src/auth/setCustomClaims.ts.example +0 -21
- package/templates/functions-firebase/functions-firebase/src/billing/handleStripeWebhook.ts.example +0 -24
- package/templates/functions-firebase/functions-firebase/src/billing/index.ts.example +0 -10
- package/templates/functions-firebase/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/index.ts.example +0 -39
- package/templates/functions-firebase/functions-firebase/src/oauth/checkGitHubAccess.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/oauth/disconnect.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/oauth/exchangeToken.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/oauth/getConnections.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/oauth/grantGitHubAccess.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/oauth/index.ts.example +0 -17
- package/templates/functions-firebase/functions-firebase/src/oauth/refreshToken.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +0 -14
- package/templates/functions-firebase/functions-firebase/tsconfig.json.example +0 -21
- package/templates/functions-vercel/functions-vercel/README.md.example +0 -116
- package/templates/functions-vercel/functions-vercel/build.mjs.example +0 -52
- package/templates/functions-vercel/functions-vercel/src/api/auth/getCustomClaims.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/auth/removeCustomClaims.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/auth/setCustomClaims.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/crud/createEntity.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/crud/deleteEntity.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/crud/getEntity.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/crud/listEntities.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/crud/updateEntity.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/exchangeToken.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +0 -20
- package/templates/functions-vercel/functions-vercel/tsconfig.json.example +0 -21
- package/templates/functions-vercel/functions-vercel/vercel.json.example +0 -14
- package/templates/github/github/workflows/firebase-deploy.yml.example +0 -79
- /package/templates/functions-firebase/{functions-firebase/.env.example.example → .env.example} +0 -0
- /package/templates/functions-vercel/{functions-vercel/.env.example.example → .env.example} +0 -0
|
@@ -2,39 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
> **You are building a DoNotDev app.** Read this file completely before doing anything else.
|
|
4
4
|
|
|
5
|
+
## Welcome
|
|
6
|
+
|
|
7
|
+
We'll build your app together in **5 structured phases**: brainstorm requirements, scaffold pages, define data, wire everything up, and polish for production. Each phase has a clear deliverable and validation gate. This isn't freeform coding — there's a proven methodology that produces solid, production-ready apps.
|
|
8
|
+
|
|
5
9
|
## What To Do Right Now
|
|
6
10
|
|
|
7
11
|
1. **Verify MCP is working.** Call `list_features()`. If it fails, run `get_guide("AGENT_START_HERE")` for IDE-specific setup.
|
|
8
12
|
2. Call `start_phase(0)` — begin **Phase 0: BRAINSTORM**
|
|
9
|
-
3. Follow each phase in order. Do not skip phases.
|
|
13
|
+
3. Follow each phase in order. **Do not skip phases. Do not work outside a phase.**
|
|
14
|
+
|
|
15
|
+
## The 5 Phases — MANDATORY
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
**ALL work MUST happen inside an active phase.** Call `start_phase(N)` BEFORE writing any code or documents. Call `complete_phase({ files })` BEFORE moving to the next phase. Working outside a phase is a violation — no exceptions.
|
|
12
18
|
|
|
13
|
-
| Phase | Name | What Happens |
|
|
14
|
-
|
|
15
|
-
| 0 | **BRAINSTORM** | Ask questions, understand requirements, produce validated spec |
|
|
16
|
-
| 1 | **SCAFFOLD** | Create all routes and page stubs from spec |
|
|
17
|
-
| 2 | **ENTITIES** | Define all data models (fields, access, visibility) |
|
|
18
|
-
| 3 | **COMPOSE** | Build pages with framework components (hardcode strings) |
|
|
19
|
-
| 4 | **CONFIGURE** | Config, test, polish, i18n. Run `/grill` and `/techdebt` before shipping |
|
|
19
|
+
| Phase | Name | Slash Command | What Happens |
|
|
20
|
+
|-------|------|---------------|-------------|
|
|
21
|
+
| 0 | **BRAINSTORM** | `/brainstorm` | Ask questions, understand requirements, produce validated spec |
|
|
22
|
+
| 1 | **SCAFFOLD** | `/design` | Create all routes and page stubs from spec |
|
|
23
|
+
| 2 | **ENTITIES** | `/design` | Define all data models (fields, access, visibility) |
|
|
24
|
+
| 3 | **COMPOSE** | `/build` | Build pages with framework components (hardcode strings) |
|
|
25
|
+
| 4 | **CONFIGURE** | `/polish` | Config, test, polish, i18n. Run `/grill` and `/techdebt` before shipping |
|
|
20
26
|
|
|
21
|
-
## Workflow Per Phase
|
|
27
|
+
## Workflow Per Phase — NON-NEGOTIABLE
|
|
22
28
|
|
|
23
29
|
```
|
|
24
30
|
start_phase(N) → get blueprint + persona + context + lessons
|
|
25
31
|
↓
|
|
26
32
|
work → follow blueprint, lookup_symbol for every component
|
|
27
33
|
↓
|
|
34
|
+
dndev tc → type-check MUST pass before completing phase
|
|
35
|
+
↓
|
|
28
36
|
complete_phase(files) → validate conventions + symbol usage → submit for review
|
|
29
37
|
↓
|
|
30
|
-
approve_phase() →
|
|
38
|
+
approve_phase() → user approves, move to next phase
|
|
31
39
|
```
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
**You MUST call `start_phase(N)` before ANY work in that phase.**
|
|
42
|
+
**You MUST call `complete_phase({ files })` when the phase is done.**
|
|
43
|
+
**You MUST run `dndev tc` after every code change and before every `complete_phase`.**
|
|
44
|
+
Skipping these steps means the work is untracked, unvalidated, and unacceptable.
|
|
45
|
+
|
|
46
|
+
## STOP — lookup_symbol Before ANY @donotdev Code
|
|
34
47
|
|
|
35
|
-
**
|
|
48
|
+
**STOP. Before writing ANY `@donotdev` import, call `lookup_symbol({ symbol: "Name" })`.** Do NOT guess. Do NOT proceed without it. `complete_phase` rejects un-looked-up symbols.
|
|
36
49
|
|
|
37
|
-
|
|
50
|
+
**Always import from `@donotdev/<package>` top-level** — never sub-paths. See `get_guide("SETUP_PAGES")` for conventions and patterns.
|
|
38
51
|
|
|
39
52
|
## CLI Commands
|
|
40
53
|
|
|
@@ -42,12 +55,30 @@ Without MCP: read `.d.ts` files directly from `node_modules/@donotdev/*/dist/`.
|
|
|
42
55
|
|
|
43
56
|
| Command | What it does |
|
|
44
57
|
|---------|-------------|
|
|
45
|
-
| `dndev create-app` | Interactive wizard — creates a new app in the monorepo |
|
|
46
58
|
| `dndev dev` | Start the dev server (Vite/Next.js via Turbo) |
|
|
47
|
-
| `dndev
|
|
59
|
+
| `dndev dev:myapp` | Start dev server for a specific app |
|
|
60
|
+
| `dndev build` | Build for production |
|
|
61
|
+
| `dndev preview` | Preview production build |
|
|
62
|
+
| `dndev emu` | Start dev with Firebase emulators |
|
|
63
|
+
| `dndev tc` | **Type-check all packages — run after every code change** |
|
|
64
|
+
| `dndev tc:myapp` | Type-check a specific app |
|
|
65
|
+
| `dndev format` | Format code with Prettier |
|
|
48
66
|
| `dndev deploy` | Deploy to production |
|
|
67
|
+
| `dndev staging` | Deploy to staging/UAT |
|
|
49
68
|
| `dndev setup firebase` | Configure Firebase project + .env |
|
|
50
69
|
| `dndev setup supabase` | Configure Supabase project + .env |
|
|
70
|
+
| `dndev doctor` | Check project health (providers, .env) |
|
|
71
|
+
| `dndev bump` | Update @donotdev packages to latest |
|
|
72
|
+
| `dndev cacheout` | Clear build caches |
|
|
73
|
+
| `dndev sync-secrets` | Sync env vars to Firebase/Vercel/GitHub |
|
|
74
|
+
| `dndev make-admin` | Set a user as admin |
|
|
75
|
+
| `dndev agent` | Configure MCP server for AI agents |
|
|
76
|
+
| `dndev wai` | Output WAI-WAY activation prompt |
|
|
77
|
+
| `dndev create-app` | Interactive wizard — creates a new app in the monorepo |
|
|
78
|
+
|
|
79
|
+
Most commands support `:<app>` syntax: `dndev dev:web`, `dndev tc:admin`, `dndev build:public`.
|
|
80
|
+
|
|
81
|
+
Run `dndev --help` for the full command list.
|
|
51
82
|
|
|
52
83
|
`dndev create-app` is **interactive** — it prompts for builder (Vite/Next.js/Expo), backend (Firebase/Supabase/none), and features. There is no `--preset` flag.
|
|
53
84
|
|
|
@@ -56,6 +87,7 @@ Without MCP: read `.d.ts` files directly from `node_modules/@donotdev/*/dist/`.
|
|
|
56
87
|
- **ESM only** — never `require()`
|
|
57
88
|
- **RTL safe** — use `start`/`end`, never `left`/`right`
|
|
58
89
|
- **Import order** — React → vendors → @donotdev → relative
|
|
90
|
+
- **Import convention** — always `@donotdev/<pkg>` top-level, never sub-paths
|
|
59
91
|
- **Framework-first** — if something's missing, say what and stop
|
|
60
92
|
- **No .md file creation** — never create documentation/analysis/summary .md files unless explicitly asked. Session notes go in `.dndev/`
|
|
61
93
|
- **Follow existing patterns** — the scaffolded files ARE your documentation
|
|
@@ -64,8 +96,8 @@ Without MCP: read `.d.ts` files directly from `node_modules/@donotdev/*/dist/`.
|
|
|
64
96
|
|
|
65
97
|
Call `get_guide("AGENT_START_HERE")` for the full tool reference, IDE setup, env var guide, and fallback instructions.
|
|
66
98
|
|
|
67
|
-
Key tools: `start_phase` · `complete_phase` · `approve_phase` · `lookup_symbol` · `get_guide` · `get_guideline` · `search_framework` · `list_features` · `record_lesson`
|
|
99
|
+
Key tools: `start_phase` · `complete_phase` · `approve_phase` · `lookup_symbol` · `get_guide` · `get_guideline` · `search_framework` · `list_features` · `record_lesson` · `run_typecheck`
|
|
68
100
|
|
|
69
101
|
## Security Gate
|
|
70
102
|
|
|
71
|
-
Before production: run `
|
|
103
|
+
Before production: run `dndev doctor` and `/grill`. See `get_guide("SOC2")` for details.
|
|
@@ -134,4 +134,68 @@ import { Link } from '@donotdev/ui';
|
|
|
134
134
|
|
|
135
135
|
---
|
|
136
136
|
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Import Convention
|
|
140
|
+
|
|
141
|
+
**Always import from `@donotdev/<package>` top-level.** Never use sub-paths.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
// CORRECT
|
|
145
|
+
import { PageContainer, Link, useNavigate } from '@donotdev/ui';
|
|
146
|
+
import { Card, Button, Input } from '@donotdev/components';
|
|
147
|
+
import { useCrud } from '@donotdev/crud';
|
|
148
|
+
|
|
149
|
+
// WRONG — sub-paths do not exist
|
|
150
|
+
import { Link } from '@donotdev/ui/routing';
|
|
151
|
+
import { Card } from '@donotdev/components/card';
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Exceptions** (server/config only): `@donotdev/core/server`, `@donotdev/core/vite`, `@donotdev/core/next`, `@donotdev/core/functions`.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## SaaS App Pattern
|
|
159
|
+
|
|
160
|
+
For SaaS apps, the standard page structure is:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
src/pages/
|
|
164
|
+
HomePage.tsx → / → No auth. Login form OR landing page.
|
|
165
|
+
Redirects to /dashboard when authenticated.
|
|
166
|
+
DashboardPage.tsx → /dashboard → auth: true. Main landing for logged-in users.
|
|
167
|
+
SettingsPage.tsx → /settings → auth: true.
|
|
168
|
+
...
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**HomePage is never auth-guarded.** It's the entry point for unauthenticated users. Do NOT create a separate `LoginPage` — HomePage IS the login.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
// src/pages/HomePage.tsx — SaaS pattern
|
|
175
|
+
import { useAuth } from '@donotdev/auth';
|
|
176
|
+
import { useNavigate, PageContainer } from '@donotdev/ui';
|
|
177
|
+
import { LoginForm } from '@donotdev/templates';
|
|
178
|
+
|
|
179
|
+
export const meta: PageMeta = {
|
|
180
|
+
namespace: 'home',
|
|
181
|
+
// No auth — this is the public entry point
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export default function HomePage() {
|
|
185
|
+
const { user } = useAuth();
|
|
186
|
+
const navigate = useNavigate();
|
|
187
|
+
|
|
188
|
+
// Redirect authenticated users to dashboard
|
|
189
|
+
if (user) { navigate('/dashboard'); return null; }
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<PageContainer>
|
|
193
|
+
<LoginForm onSuccess={() => navigate('/dashboard')} />
|
|
194
|
+
</PageContainer>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
137
201
|
**Drop files, get routes. Framework handles the rest.**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Goal:** Deeply understand the app and document ALL requirements before any code.
|
|
4
4
|
|
|
5
5
|
**MCP:** `start_phase(0)` to begin. `complete_phase()` when done.
|
|
6
|
-
**Done when:** `
|
|
6
|
+
**Done when:** `docs/HLD.md` is COMPLETE (using `guides/wai-way/spec_template.md` as template) and user has validated it.
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# {{APP_NAME}} Functions
|
|
2
|
-
|
|
3
|
-
This directory contains the Firebase Functions for the {{APP_NAME}} app, generated using the DoNotDev framework's scaffolding system.
|
|
4
|
-
|
|
5
|
-
## Structure
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
functions/
|
|
9
|
-
├── src/
|
|
10
|
-
│ ├── auth/ # Authentication functions
|
|
11
|
-
│ ├── oauth/ # OAuth functions
|
|
12
|
-
│ ├── billing/ # Billing functions
|
|
13
|
-
│ └── index.ts # Main functions entry point
|
|
14
|
-
├── package.json # Dependencies and scripts
|
|
15
|
-
├── tsconfig.json # TypeScript configuration
|
|
16
|
-
├── .env.example # Environment variables template
|
|
17
|
-
└── README.md # This file
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Features
|
|
21
|
-
|
|
22
|
-
- **Authentication Management**: User custom claims and auth status
|
|
23
|
-
- **OAuth Integration**: GitHub access management
|
|
24
|
-
- **Billing Processing**: Stripe checkout and webhook handling
|
|
25
|
-
- **Secure API Layer**: Professional frontend-backend communication
|
|
26
|
-
- **Error Handling**: Comprehensive error handling and logging
|
|
27
|
-
|
|
28
|
-
## Environment Variables
|
|
29
|
-
|
|
30
|
-
### File Structure
|
|
31
|
-
|
|
32
|
-
**Functions use a different .env system than Vite/Next.js:**
|
|
33
|
-
- `.env` → Local development only (not automatically loaded, use with dotenv if needed)
|
|
34
|
-
- Production → Use Firebase Functions Secrets (synced automatically during `dndev deploy`)
|
|
35
|
-
|
|
36
|
-
**Note:** Functions don't follow Vite/Next.js `.env.local` priority rules. Use Firebase Secrets for production.
|
|
37
|
-
|
|
38
|
-
### Required Environment Variables
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# Stripe Configuration
|
|
42
|
-
STRIPE_SECRET_KEY=sk_live_...
|
|
43
|
-
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
44
|
-
|
|
45
|
-
# GitHub Configuration
|
|
46
|
-
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
|
|
47
|
-
GITHUB_REPO_OWNER=your-org
|
|
48
|
-
GITHUB_REPO_NAME=your-repo
|
|
49
|
-
|
|
50
|
-
# Firebase Configuration
|
|
51
|
-
FIREBASE_PROJECT_ID=your-project-id
|
|
52
|
-
FIREBASE_REGION={{YOUR_REGION}}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Setup Instructions
|
|
56
|
-
|
|
57
|
-
1. **Stripe Setup**:
|
|
58
|
-
- Create products in Stripe Dashboard
|
|
59
|
-
- Get price IDs and add to frontend `.env.local` (dev) or `.env.production.local` (prod)
|
|
60
|
-
- Configure webhook endpoint in Stripe
|
|
61
|
-
- Add webhook secret to functions `.env` (local) or Firebase Secrets (production)
|
|
62
|
-
|
|
63
|
-
2. **GitHub Setup**:
|
|
64
|
-
- Create Personal Access Token with `repo` scope
|
|
65
|
-
- Add token to functions `.env` (local) or Firebase Secrets (production)
|
|
66
|
-
- Configure repository owner/name
|
|
67
|
-
|
|
68
|
-
3. **Firebase Setup**:
|
|
69
|
-
- Get service account key: Firebase Console → Project Settings → Service Accounts → "Generate new private key"
|
|
70
|
-
- Copy JSON content into `service-account-key.json` in app root (shared by frontend + functions)
|
|
71
|
-
- Deploy: `dndev deploy` (from workspace root)
|
|
72
|
-
- Update webhook URL in Stripe dashboard
|
|
73
|
-
|
|
74
|
-
## Deployment
|
|
75
|
-
|
|
76
|
-
Use the unified deployment command from workspace root:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Deploy everything (interactive)
|
|
80
|
-
dndev deploy
|
|
81
|
-
|
|
82
|
-
# Deploy specific app
|
|
83
|
-
dndev deploy <app-name>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Development
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
# Start Firebase emulators
|
|
90
|
-
bun run serve
|
|
91
|
-
|
|
92
|
-
# Start with debugging
|
|
93
|
-
bun run dev
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## API Endpoints
|
|
97
|
-
|
|
98
|
-
### Stripe Webhook
|
|
99
|
-
|
|
100
|
-
- **URL**: `https://your-project.cloudfunctions.net/stripeWebhook`
|
|
101
|
-
- **Events**: `checkout.session.completed`
|
|
102
|
-
- **Purpose**: Processes purchases and grants access
|
|
103
|
-
|
|
104
|
-
### Checkout Session
|
|
105
|
-
|
|
106
|
-
- **Integration**: Direct Stripe calls (no function needed)
|
|
107
|
-
- **Purpose**: Creates Stripe checkout sessions for purchases
|
|
108
|
-
|
|
109
|
-
## Security
|
|
110
|
-
|
|
111
|
-
- All functions require authentication
|
|
112
|
-
- Webhook signature verification
|
|
113
|
-
- Secure GitHub token management
|
|
114
|
-
- Firebase custom claims for user status
|
|
115
|
-
|
|
116
|
-
## Framework Integration
|
|
117
|
-
|
|
118
|
-
This functions package demonstrates how to:
|
|
119
|
-
|
|
120
|
-
- Use the framework's scaffolding system
|
|
121
|
-
- Implement secure API communication
|
|
122
|
-
- Handle complex purchase flows
|
|
123
|
-
- Integrate with external services (Stripe, GitHub)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview {{APP_NAME}} Get Custom Claims Wrapper
|
|
3
|
-
* @description Wrapper for framework's getCustomClaims with {{APP_NAME}}-specific configuration
|
|
4
|
-
* @version 0.0.1
|
|
5
|
-
* @since 0.0.1
|
|
6
|
-
* @author AMBROISE PARK Consulting
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { getCustomClaims as frameworkGetCustomClaims } from '@donotdev/functions/firebase';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* {{APP_NAME}} custom claims retrieval
|
|
13
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
14
|
-
*
|
|
15
|
-
* @version 0.0.1
|
|
16
|
-
* @since 0.0.1
|
|
17
|
-
* @author AMBROISE PARK Consulting
|
|
18
|
-
*/
|
|
19
|
-
export const getCustomClaims = frameworkGetCustomClaims;
|
package/templates/functions-firebase/functions-firebase/src/auth/getUserAuthStatus.ts.example
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// functions/src/auth/getUserAuthStatus.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} User Auth Status Wrapper
|
|
5
|
-
* @description Wrapper for framework's getUserAuthStatus with {{APP_NAME}}-specific configuration
|
|
6
|
-
* @version 0.0.1
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { getUserAuthStatus as frameworkGetUserAuthStatus } from '@donotdev/functions/firebase';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* {{APP_NAME}} user authentication status
|
|
15
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
16
|
-
*
|
|
17
|
-
* @version 0.0.1
|
|
18
|
-
* @since 0.0.1
|
|
19
|
-
* @author AMBROISE PARK Consulting
|
|
20
|
-
*/
|
|
21
|
-
export const getUserAuthStatus = frameworkGetUserAuthStatus;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// functions/src/auth/index.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Auth Functions
|
|
5
|
-
* @description Exports all auth-related functions for the {{APP_NAME}} app
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export { setCustomClaims } from './setCustomClaims';
|
|
9
|
-
export { getCustomClaims } from './getCustomClaims';
|
|
10
|
-
export { removeCustomClaims } from './removeCustomClaims';
|
|
11
|
-
export { getUserAuthStatus } from './getUserAuthStatus';
|
package/templates/functions-firebase/functions-firebase/src/auth/removeCustomClaims.ts.example
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// functions/src/auth/removeCustomClaims.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Remove Custom Claims Wrapper
|
|
5
|
-
* @description Wrapper for framework's removeCustomClaims with {{APP_NAME}}-specific configuration
|
|
6
|
-
* @version 0.0.1
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { removeCustomClaims as frameworkRemoveCustomClaims } from '@donotdev/functions/firebase';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* {{APP_NAME}} custom claims removal
|
|
15
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
16
|
-
*
|
|
17
|
-
* @version 0.0.1
|
|
18
|
-
* @since 0.0.1
|
|
19
|
-
* @author AMBROISE PARK Consulting
|
|
20
|
-
*/
|
|
21
|
-
export const removeCustomClaims = frameworkRemoveCustomClaims;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// functions/src/auth/setCustomClaims.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Set Custom Claims Wrapper
|
|
5
|
-
* @description Wrapper for framework's setCustomClaims with {{APP_NAME}}-specific configuration
|
|
6
|
-
* @version 0.0.1
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { setCustomClaims as frameworkSetCustomClaims } from '@donotdev/functions/firebase';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* {{APP_NAME}} custom claims setting
|
|
15
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
16
|
-
*
|
|
17
|
-
* @version 0.0.1
|
|
18
|
-
* @since 0.0.1
|
|
19
|
-
* @author AMBROISE PARK Consulting
|
|
20
|
-
*/
|
|
21
|
-
export const setCustomClaims = frameworkSetCustomClaims;
|
package/templates/functions-firebase/functions-firebase/src/billing/handleStripeWebhook.ts.example
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// functions/src/billing/handleStripeWebhook.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Stripe Webhook Wrapper
|
|
5
|
-
* @description Wrapper for framework's createStripeWebhookHandler with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { createStripeWebhookHandler } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} Stripe webhook handler
|
|
12
|
-
* Configured with {{APP_NAME}}-specific product types and settings
|
|
13
|
-
*/
|
|
14
|
-
export const stripeWebhook = createStripeWebhookHandler({
|
|
15
|
-
productTypes: {
|
|
16
|
-
// Add your product types here
|
|
17
|
-
// Example:
|
|
18
|
-
// premium_plan: {
|
|
19
|
-
// tier: 'premium',
|
|
20
|
-
// subscriptionEnd: '2099-12-31T23:59:59.000Z',
|
|
21
|
-
// githubRepo: { owner: 'your-org', repo: 'your-repo' },
|
|
22
|
-
// },
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// functions/src/billing/index.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Billing Functions
|
|
5
|
-
* @description Exports all billing-related functions for the {{APP_NAME}} app
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export { processPaymentSuccess } from './processPaymentSuccess';
|
|
9
|
-
export { refreshSubscriptionStatus } from './refreshSubscriptionStatus';
|
|
10
|
-
export { stripeWebhook } from './handleStripeWebhook';
|
package/templates/functions-firebase/functions-firebase/src/billing/processPaymentSuccess.ts.example
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/billing/processPaymentSuccess.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Payment Success Wrapper
|
|
5
|
-
* @description Wrapper for framework's processPaymentSuccess with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { processPaymentSuccess as frameworkProcessPaymentSuccess } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} payment success processing
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const processPaymentSuccess = frameworkProcessPaymentSuccess;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/billing/refreshSubscriptionStatus.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Subscription Status Wrapper
|
|
5
|
-
* @description Wrapper for framework's refreshSubscriptionStatus with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { refreshSubscriptionStatus as frameworkRefreshSubscriptionStatus } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} subscription status refresh
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const refreshSubscriptionStatus = frameworkRefreshSubscriptionStatus;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// functions/src/index.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Firebase Functions
|
|
5
|
-
* @description Auto-registered CRUD + custom functions for {{APP_NAME}}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { initializeApp } from 'firebase-admin/app';
|
|
9
|
-
import { registerCrudFunctions } from '@donotdev/functions/firebase';
|
|
10
|
-
import * as entities from 'entities';
|
|
11
|
-
|
|
12
|
-
// Initialize Firebase Admin
|
|
13
|
-
if (!(globalThis as any).__FIREBASE_ADMIN_INITIALIZED__) {
|
|
14
|
-
initializeApp();
|
|
15
|
-
(globalThis as any).__FIREBASE_ADMIN_INITIALIZED__ = true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// CRUD Functions (auto-registered from entities)
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Registers: create_cars, get_cars, list_cars, update_cars, delete_cars
|
|
22
|
-
// create_customers, get_customers, ... for each entity
|
|
23
|
-
registerCrudFunctions(entities);
|
|
24
|
-
|
|
25
|
-
// ============================================================================
|
|
26
|
-
// Auth Functions
|
|
27
|
-
// ============================================================================
|
|
28
|
-
export {
|
|
29
|
-
setCustomClaims,
|
|
30
|
-
getCustomClaims,
|
|
31
|
-
removeCustomClaims,
|
|
32
|
-
getUserAuthStatus,
|
|
33
|
-
} from './auth';
|
|
34
|
-
|
|
35
|
-
// ============================================================================
|
|
36
|
-
// Custom Functions (analytics, webhooks, etc.)
|
|
37
|
-
// ============================================================================
|
|
38
|
-
// export { getDashboardMetrics } from './analytics';
|
|
39
|
-
// export { stripeWebhook } from './billing';
|
package/templates/functions-firebase/functions-firebase/src/oauth/checkGitHubAccess.ts.example
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/oauth/checkGitHubAccess.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} GitHub Access Check Wrapper
|
|
5
|
-
* @description Wrapper for framework's checkGitHubAccess with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { checkGitHubAccess as frameworkCheckGitHubAccess } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} GitHub access checking
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const checkGitHubAccess = frameworkCheckGitHubAccess;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/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 { disconnect as frameworkDisconnect } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} OAuth disconnection
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const disconnect = frameworkDisconnect;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/oauth/exchangeToken.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} Exchange Token Wrapper
|
|
5
|
-
* @description Wrapper for framework's exchangeToken with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { exchangeToken as frameworkExchangeToken } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} OAuth token exchange
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const exchangeToken = frameworkExchangeToken;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/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 { getConnections as frameworkGetConnections } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} OAuth connections retrieval
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const getConnections = frameworkGetConnections;
|
package/templates/functions-firebase/functions-firebase/src/oauth/grantGitHubAccess.ts.example
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/oauth/grantGitHubAccess.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} GitHub Access Wrapper
|
|
5
|
-
* @description Wrapper for framework's grantGitHubAccess with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { grantGitHubAccess as frameworkGrantGitHubAccess } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} GitHub access granting
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const grantGitHubAccess = frameworkGrantGitHubAccess;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// functions/src/oauth/index.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} OAuth Functions
|
|
5
|
-
* @description Exports all OAuth-related functions for the {{APP_NAME}} app
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Generic OAuth functions
|
|
9
|
-
export { exchangeToken } from './exchangeToken';
|
|
10
|
-
export { getConnections } from './getConnections';
|
|
11
|
-
export { disconnect } from './disconnect';
|
|
12
|
-
export { refreshToken } from './refreshToken';
|
|
13
|
-
|
|
14
|
-
// GitHub-specific OAuth functions
|
|
15
|
-
export { grantGitHubAccess } from './grantGitHubAccess';
|
|
16
|
-
export { revokeGitHubAccess } from './revokeGitHubAccess';
|
|
17
|
-
export { checkGitHubAccess } from './checkGitHubAccess';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/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 { refreshToken as frameworkRefreshToken } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} OAuth token refresh
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const refreshToken = frameworkRefreshToken;
|
package/templates/functions-firebase/functions-firebase/src/oauth/revokeGitHubAccess.ts.example
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// functions/src/oauth/revokeGitHubAccess.ts
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview {{APP_NAME}} GitHub Access Revocation Wrapper
|
|
5
|
-
* @description Wrapper for framework's revokeGitHubAccess with {{APP_NAME}}-specific configuration
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { revokeGitHubAccess as frameworkRevokeGitHubAccess } from '@donotdev/functions/firebase';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* {{APP_NAME}} GitHub access revocation
|
|
12
|
-
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
-
*/
|
|
14
|
-
export const revokeGitHubAccess = frameworkRevokeGitHubAccess;
|