@meetploy/cli 1.19.0 → 1.21.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 ADDED
@@ -0,0 +1,203 @@
1
+ # @meetploy/cli
2
+
3
+ The Ploy CLI for local development, type generation, and building workers.
4
+
5
+ **[Full Documentation](https://docs.meetploy.com/cli)** · [meetploy.com](https://meetploy.com)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g @meetploy/cli
11
+ # or as a dev dependency
12
+ npm install -D @meetploy/cli
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ ### `ploy dev`
18
+
19
+ Start the local development server with hot reloading. Automatically detects whether your project is a worker or a Next.js app.
20
+
21
+ ```bash
22
+ ploy dev [options]
23
+ ```
24
+
25
+ **Options:**
26
+
27
+ | Flag | Description | Default |
28
+ | --------------------------- | --------------------- | ------------- |
29
+ | `-p, --port <number>` | Server port | `3000` |
30
+ | `-h, --host <string>` | Server host | `localhost` |
31
+ | `-c, --config <path>` | Path to `ploy.yaml` | auto-detected |
32
+ | `--no-watch` | Disable file watching | watch enabled |
33
+ | `-v, --verbose` | Verbose output | `false` |
34
+ | `--dashboard-port <number>` | Dev dashboard port | `port + 1000` |
35
+
36
+ **Worker projects** — starts the local emulator with all Ploy services (database, queues, workflows, cache, etc.):
37
+
38
+ ```bash
39
+ ploy dev
40
+ # Worker running at http://localhost:3000
41
+ # Dashboard at http://localhost:4000
42
+ ```
43
+
44
+ **Next.js projects** — starts `next dev` alongside the Ploy mock server (auto-detected via `kind: nextjs` in `ploy.yaml` or the presence of `next.config.*`):
45
+
46
+ ```bash
47
+ ploy dev -p 3000
48
+ # Next.js running at http://localhost:3000
49
+ # Ploy dashboard at http://localhost:4000
50
+ ```
51
+
52
+ ---
53
+
54
+ ### `ploy types`
55
+
56
+ Generate TypeScript type definitions from your `ploy.yaml` bindings. Creates an `env.d.ts` file and updates `tsconfig.json`.
57
+
58
+ ```bash
59
+ ploy types [options]
60
+ ```
61
+
62
+ **Options:**
63
+
64
+ | Flag | Description | Default |
65
+ | --------------------- | ---------------- | ---------- |
66
+ | `-o, --output <path>` | Output file path | `env.d.ts` |
67
+
68
+ **Example output** (`env.d.ts`):
69
+
70
+ ```typescript
71
+ declare module "@meetploy/nextjs" {
72
+ interface PloyEnv {
73
+ vars: { API_URL: string };
74
+ DB: D1Database;
75
+ QUEUE: QueueBinding;
76
+ PLOY_AUTH: PloyAuth;
77
+ }
78
+ }
79
+
80
+ declare global {
81
+ interface PloyEnv {
82
+ vars: { API_URL: string };
83
+ DB: D1Database;
84
+ QUEUE: QueueBinding;
85
+ PLOY_AUTH: PloyAuth;
86
+ }
87
+ }
88
+
89
+ export {};
90
+ ```
91
+
92
+ Run it whenever you change bindings in `ploy.yaml`:
93
+
94
+ ```bash
95
+ ploy types
96
+ # or with a custom output path
97
+ ploy types -o src/env.d.ts
98
+ ```
99
+
100
+ ---
101
+
102
+ ### `ploy build`
103
+
104
+ Build your worker project using wrangler. Reads `ploy.yaml` to determine the entry point and compatibility settings.
105
+
106
+ ```bash
107
+ ploy build [options]
108
+ ```
109
+
110
+ **Options:**
111
+
112
+ | Flag | Description | Default |
113
+ | --------------------- | ------------------- | ------------- |
114
+ | `-c, --config <path>` | Path to `ploy.yaml` | auto-detected |
115
+
116
+ ---
117
+
118
+ ### `ploy auth`
119
+
120
+ Manage authentication with the Ploy API.
121
+
122
+ ```bash
123
+ ploy auth login # Browser-based OAuth login
124
+ ploy auth logout # Clear stored credentials
125
+ ```
126
+
127
+ Credentials are stored in `~/.ploy/config.json`. You can also set `PLOY_API_TOKEN` as an environment variable.
128
+
129
+ ---
130
+
131
+ ### `ploy api`
132
+
133
+ Interact with the Ploy platform API (requires `ploy auth login`).
134
+
135
+ ```bash
136
+ # Deployments
137
+ ploy api deployment list
138
+ ploy api deployment view <id>
139
+ ploy api deployment retry <id>
140
+ ploy api deployment logs <id>
141
+
142
+ # Databases
143
+ ploy api db list
144
+ ploy api db tables <database>
145
+ ploy api db analytics <database>
146
+ ```
147
+
148
+ **Deployment options:** `--project <id>` (required for list), `--branch <name>`, `--commit <sha>`, `--limit <n>`
149
+
150
+ **Database options:** `--org <id>` (required), `--project <id>`, `--period <24h|7d|30d>`, `--limit <n>`, `--schema`
151
+
152
+ ---
153
+
154
+ ## ploy.yaml Reference
155
+
156
+ The `ploy.yaml` file at the root of your project configures the Ploy runtime and CLI:
157
+
158
+ ```yaml
159
+ kind: worker # worker | nextjs | static
160
+ build: pnpm build # build command
161
+ out: dist # output directory
162
+
163
+ # Environment variables (exposed as vars: {} in PloyEnv)
164
+ env:
165
+ API_URL: https://api.example.com
166
+
167
+ # Runtime bindings — format is BINDING_NAME: resource_name
168
+ db:
169
+ DB: default
170
+
171
+ queue:
172
+ QUEUE: tasks
173
+
174
+ workflow:
175
+ FLOW: my_flow
176
+
177
+ cache:
178
+ CACHE: default
179
+
180
+ state:
181
+ STATE: default
182
+
183
+ fs:
184
+ STORAGE: default
185
+
186
+ timer:
187
+ TIMER: default
188
+
189
+ ai: true
190
+
191
+ auth:
192
+ binding: PLOY_AUTH
193
+ ```
194
+
195
+ After editing bindings, regenerate types with `ploy types`.
196
+
197
+ ## Documentation
198
+
199
+ - [CLI Reference](https://docs.meetploy.com/cli)
200
+ - [Workers](https://docs.meetploy.com/features/workers)
201
+ - [Ploy Start Framework](https://docs.meetploy.com/start)
202
+ - [Next.js Integration](https://docs.meetploy.com/nextjs)
203
+ - [Full Docs](https://docs.meetploy.com)