@vaiftech/cli 1.1.0 → 1.2.0
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/README.md +154 -74
- package/dist/chunk-VD3KS4ZK.js +1156 -0
- package/dist/cli.cjs +1131 -42
- package/dist/cli.js +19 -19
- package/dist/index.cjs +1119 -30
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7YZZOG47.js +0 -67
package/README.md
CHANGED
|
@@ -1,120 +1,200 @@
|
|
|
1
1
|
# @vaiftech/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@vaiftech/cli)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Command-line tools for [VAIF Studio](https://vaif.studio) - scaffold projects from templates, manage schemas, deploy functions, generate TypeScript types, and more.
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
8
|
-
npm install -
|
|
9
|
-
# or
|
|
10
|
-
|
|
11
|
-
# or
|
|
12
|
-
yarn add -D @vaiftech/cli
|
|
11
|
+
npm install -g @vaiftech/cli
|
|
12
|
+
# or use directly with npx
|
|
13
|
+
npx @vaiftech/cli init --template react-spa
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## Quick Start
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
```bash
|
|
19
|
+
# Scaffold a new project from a template
|
|
20
|
+
npx @vaiftech/cli init --template nextjs-fullstack
|
|
21
|
+
|
|
22
|
+
# Or initialize a plain config
|
|
23
|
+
vaif init
|
|
24
|
+
|
|
25
|
+
# Authenticate with your VAIF account
|
|
26
|
+
vaif login
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
# Pull your database schema and generate types
|
|
29
|
+
vaif pull
|
|
30
|
+
vaif generate
|
|
31
|
+
|
|
32
|
+
# Deploy functions
|
|
33
|
+
vaif functions deploy
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Templates
|
|
37
|
+
|
|
38
|
+
Scaffold a fully configured VAIF Studio project with one command:
|
|
20
39
|
|
|
21
40
|
```bash
|
|
22
|
-
|
|
41
|
+
vaif init --template <name>
|
|
23
42
|
```
|
|
24
43
|
|
|
25
|
-
|
|
44
|
+
Each template creates `vaif.config.json` plus platform-specific integration files (client setup, auth helpers, environment config).
|
|
45
|
+
|
|
46
|
+
### Available Templates
|
|
26
47
|
|
|
27
|
-
|
|
|
28
|
-
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
48
|
+
| Template | Description | Ecosystem |
|
|
49
|
+
|----------|-------------|-----------|
|
|
50
|
+
| `nextjs-fullstack` | Next.js app with server/client VAIF client, auth middleware, and React hooks | Next.js |
|
|
51
|
+
| `react-spa` | React SPA with VaifProvider, hooks for queries/mutations, and env setup | React / Vite |
|
|
52
|
+
| `ios-swift-app` | iOS app with VaifManager singleton, SwiftUI auth, and database helpers | Swift / iOS |
|
|
53
|
+
| `expo-mobile-app` | React Native / Expo with realtime hooks, storage uploads, and push notifications | Expo |
|
|
54
|
+
| `flutter-app` | Flutter app with VaifClient, auth flows, and typed database queries | Flutter / Dart |
|
|
55
|
+
| `python-fastapi-backend` | FastAPI server with VAIF auth middleware, database queries, and storage uploads | Python |
|
|
56
|
+
| `go-backend-api` | Go HTTP server with VAIF client, auth verification, and webhook handling | Go |
|
|
57
|
+
| `todo-app` | Minimal React + VAIF starter for learning the basics | React |
|
|
58
|
+
| `realtime-chat` | Real-time messaging app with presence tracking and live subscriptions | React |
|
|
59
|
+
| `saas-starter` | SaaS foundation with teams, org management, auth, and billing hooks | React / Node.js |
|
|
60
|
+
| `ecommerce-api` | E-commerce backend with products, orders, Stripe webhooks, and inventory | Node.js |
|
|
32
61
|
|
|
33
|
-
|
|
62
|
+
```bash
|
|
63
|
+
# List all templates
|
|
64
|
+
vaif templates
|
|
34
65
|
|
|
35
|
-
|
|
36
|
-
|
|
66
|
+
# Scaffold and overwrite existing files
|
|
67
|
+
vaif init --template expo-mobile-app --force
|
|
68
|
+
```
|
|
37
69
|
|
|
38
|
-
|
|
39
|
-
id: string;
|
|
40
|
-
email: string;
|
|
41
|
-
name: string | null;
|
|
42
|
-
avatar_url: string | null;
|
|
43
|
-
created_at: string;
|
|
44
|
-
updated_at: string;
|
|
45
|
-
}
|
|
70
|
+
### What Templates Create
|
|
46
71
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
created_at: string;
|
|
54
|
-
updated_at: string;
|
|
55
|
-
}
|
|
72
|
+
**JavaScript/TypeScript templates** (nextjs-fullstack, react-spa, etc.):
|
|
73
|
+
- `vaif.config.json` - Project configuration
|
|
74
|
+
- `lib/vaif.ts` or `src/lib/vaif.ts` - Client initialization
|
|
75
|
+
- `.env.example` or `.env.local.example` - Environment variables
|
|
76
|
+
- Platform-specific files (middleware, providers, hooks)
|
|
77
|
+
- Prints `npm install` command with required dependencies
|
|
56
78
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
**Native/Backend templates** (ios-swift-app, flutter-app, python-fastapi-backend, go-backend-api):
|
|
80
|
+
- `vaif.config.json` - Project configuration
|
|
81
|
+
- Platform integration files (VaifManager.swift, vaif_client.py, etc.)
|
|
82
|
+
- `.env.example` - Environment variables
|
|
83
|
+
- `requirements.txt` / `README-VAIF.md` with setup instructions
|
|
84
|
+
|
|
85
|
+
## Commands
|
|
86
|
+
|
|
87
|
+
### Authentication
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
vaif login # Interactive login
|
|
91
|
+
vaif login --token <api-token> # Login with token
|
|
92
|
+
vaif whoami # Show current user
|
|
93
|
+
vaif logout # Log out
|
|
61
94
|
```
|
|
62
95
|
|
|
63
|
-
###
|
|
96
|
+
### Project Setup
|
|
64
97
|
|
|
65
|
-
```
|
|
66
|
-
|
|
98
|
+
```bash
|
|
99
|
+
vaif init # Create vaif.config.json
|
|
100
|
+
vaif init --template react-spa # Scaffold from template
|
|
101
|
+
vaif init --typescript # Setup for TypeScript
|
|
102
|
+
vaif init --force # Overwrite existing config
|
|
103
|
+
```
|
|
67
104
|
|
|
68
|
-
|
|
69
|
-
projectId: 'proj-123',
|
|
70
|
-
apiKey: 'vaif_sk_xxx',
|
|
71
|
-
baseUrl: 'https://api.vaif.io',
|
|
72
|
-
});
|
|
105
|
+
### Project Info
|
|
73
106
|
|
|
74
|
-
|
|
75
|
-
|
|
107
|
+
```bash
|
|
108
|
+
vaif info # Project details (name, region, URLs)
|
|
109
|
+
vaif status # Tables, functions, storage, connections
|
|
76
110
|
```
|
|
77
111
|
|
|
78
|
-
|
|
112
|
+
### Schema Management
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
vaif pull # Pull database schema from remote
|
|
116
|
+
vaif push # Push local schema changes
|
|
117
|
+
vaif push --dry-run # Preview changes without applying
|
|
118
|
+
```
|
|
79
119
|
|
|
80
|
-
|
|
120
|
+
### Type Generation
|
|
81
121
|
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
122
|
+
```bash
|
|
123
|
+
vaif generate # Generate TypeScript types
|
|
124
|
+
vaif generate --output ./types.ts # Custom output path
|
|
125
|
+
vaif generate --dry-run # Preview without writing
|
|
126
|
+
vaif gen # Alias
|
|
87
127
|
```
|
|
88
128
|
|
|
89
|
-
|
|
129
|
+
### Functions
|
|
90
130
|
|
|
91
131
|
```bash
|
|
92
|
-
|
|
132
|
+
vaif functions deploy # Deploy all functions
|
|
133
|
+
vaif functions deploy --name myFunc # Deploy specific function
|
|
134
|
+
vaif functions list # List deployed functions
|
|
135
|
+
vaif fn ls # Alias
|
|
93
136
|
```
|
|
94
137
|
|
|
95
|
-
|
|
138
|
+
### Database
|
|
96
139
|
|
|
97
|
-
|
|
140
|
+
```bash
|
|
141
|
+
vaif db push # Push Drizzle migrations
|
|
142
|
+
vaif db pull # Pull remote schema
|
|
143
|
+
vaif db seed # Seed with test data
|
|
144
|
+
vaif db seed --truncate # Truncate before seeding
|
|
145
|
+
vaif db reset --force # Reset database (destructive)
|
|
146
|
+
```
|
|
98
147
|
|
|
99
|
-
|
|
100
|
-
import { createVaifClient } from '@vaiftech/client';
|
|
101
|
-
import type { User, Post, Database } from './types/vaif';
|
|
148
|
+
### API Keys
|
|
102
149
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
150
|
+
```bash
|
|
151
|
+
vaif keys generate # Generate new API key
|
|
152
|
+
vaif keys generate --name "Prod" # Named key
|
|
153
|
+
vaif keys list # List all keys
|
|
154
|
+
```
|
|
107
155
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
156
|
+
## Configuration
|
|
157
|
+
|
|
158
|
+
`vaif.config.json` (created by `vaif init`):
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"$schema": "https://vaif.studio/schemas/config.json",
|
|
163
|
+
"projectId": "your-project-id",
|
|
164
|
+
"database": {
|
|
165
|
+
"url": "${DATABASE_URL}",
|
|
166
|
+
"schema": "public"
|
|
167
|
+
},
|
|
168
|
+
"types": {
|
|
169
|
+
"output": "./src/types/database.ts"
|
|
170
|
+
},
|
|
171
|
+
"api": {
|
|
172
|
+
"baseUrl": "https://api.vaif.studio"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
111
175
|
```
|
|
112
176
|
|
|
177
|
+
## Environment Variables
|
|
178
|
+
|
|
179
|
+
| Variable | Description |
|
|
180
|
+
|----------|-------------|
|
|
181
|
+
| `VAIF_API_URL` | API base URL (default: `https://api.vaif.studio`) |
|
|
182
|
+
| `VAIF_TOKEN` | API token (alternative to `vaif login`) |
|
|
183
|
+
| `VAIF_PROJECT_ID` | Default project ID |
|
|
184
|
+
|
|
113
185
|
## Related Packages
|
|
114
186
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
187
|
+
| Package | Description |
|
|
188
|
+
|---------|-------------|
|
|
189
|
+
| [@vaiftech/client](https://www.npmjs.com/package/@vaiftech/client) | TypeScript SDK - database, auth, realtime, storage, functions |
|
|
190
|
+
| [@vaiftech/auth](https://www.npmjs.com/package/@vaiftech/auth) | Standalone auth SDK - OAuth, MFA, sessions |
|
|
191
|
+
| [@vaiftech/react](https://www.npmjs.com/package/@vaiftech/react) | React hooks - useAuth, useQuery, useRealtime |
|
|
192
|
+
| [@vaiftech/sdk-expo](https://www.npmjs.com/package/@vaiftech/sdk-expo) | React Native / Expo SDK |
|
|
193
|
+
| [@vaiftechnologies/vaif-client](https://www.npmjs.com/package/@vaiftechnologies/vaif-client) | JavaScript SDK |
|
|
194
|
+
|
|
195
|
+
## Documentation
|
|
196
|
+
|
|
197
|
+
Full documentation at [docs.vaif.studio](https://docs.vaif.studio).
|
|
118
198
|
|
|
119
199
|
## License
|
|
120
200
|
|