onflyt-cli 1.0.1-beta.2 → 1.0.1-beta.3

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.

Potentially problematic release.


This version of onflyt-cli might be problematic. Click here for more details.

Files changed (67) hide show
  1. package/dist/App.d.ts +3 -0
  2. package/dist/App.js +8 -0
  3. package/dist/commands/credits.d.ts +3 -0
  4. package/dist/commands/credits.js +101 -0
  5. package/dist/commands/delete.d.ts +7 -0
  6. package/dist/commands/delete.js +220 -0
  7. package/dist/commands/deploy.d.ts +6 -0
  8. package/dist/commands/deploy.js +715 -0
  9. package/dist/commands/deployments.d.ts +6 -0
  10. package/dist/commands/deployments.js +225 -0
  11. package/dist/commands/help.d.ts +3 -0
  12. package/dist/commands/help.js +76 -0
  13. package/dist/commands/init.d.ts +11 -0
  14. package/dist/commands/init.js +422 -0
  15. package/dist/commands/login.d.ts +6 -0
  16. package/dist/commands/login.js +150 -0
  17. package/dist/commands/logout.d.ts +3 -0
  18. package/dist/commands/logout.js +19 -0
  19. package/dist/commands/logs.d.ts +7 -0
  20. package/dist/commands/logs.js +307 -0
  21. package/dist/commands/projects.d.ts +3 -0
  22. package/dist/commands/projects.js +203 -0
  23. package/dist/commands/rollback.d.ts +6 -0
  24. package/dist/commands/rollback.js +316 -0
  25. package/dist/commands/teams.d.ts +3 -0
  26. package/dist/commands/teams.js +81 -0
  27. package/dist/commands/whoami.d.ts +3 -0
  28. package/dist/commands/whoami.js +34 -0
  29. package/dist/components/Loading.d.ts +13 -0
  30. package/dist/components/Loading.js +42 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +77 -116
  33. package/dist/lib/api.d.ts +27 -0
  34. package/dist/lib/api.js +109 -0
  35. package/dist/lib/config.d.ts +32 -0
  36. package/dist/lib/config.js +52 -0
  37. package/dist/lib/deploy-api.d.ts +97 -0
  38. package/dist/lib/deploy-api.js +335 -0
  39. package/dist/lib/deploy.d.ts +36 -0
  40. package/dist/lib/deploy.js +181 -0
  41. package/dist/lib/framework.d.ts +27 -0
  42. package/dist/lib/framework.js +184 -0
  43. package/dist/lib/git.d.ts +25 -0
  44. package/dist/lib/git.js +149 -0
  45. package/dist/lib/scaffold.d.ts +21 -0
  46. package/dist/lib/scaffold.js +190 -0
  47. package/dist/shared/frameworks/registry.d.ts +21 -0
  48. package/dist/shared/frameworks/registry.js +196 -0
  49. package/dist/shared/index.d.ts +4 -0
  50. package/dist/shared/index.js +4 -0
  51. package/dist/shared/limits.d.ts +16 -0
  52. package/dist/shared/limits.js +44 -0
  53. package/dist/shared/pricing.d.ts +2 -0
  54. package/dist/shared/pricing.js +7 -0
  55. package/dist/shared/templates/registry.d.ts +9 -0
  56. package/dist/shared/templates/registry.js +47 -0
  57. package/package.json +2 -3
  58. package/src/App.tsx +1 -1
  59. package/src/commands/deploy.tsx +1 -1
  60. package/src/commands/help.tsx +1 -1
  61. package/src/commands/init.tsx +1 -1
  62. package/src/commands/projects.tsx +1 -1
  63. package/src/components/Loading.tsx +1 -1
  64. package/src/index.tsx +1 -1
  65. package/src/lib/deploy-api.ts +3 -3
  66. package/src/lib/framework.ts +2 -2
  67. package/src/lib/shared.ts +350 -0
@@ -0,0 +1,350 @@
1
+ export type PodTier = "micro" | "lite" | "standard" | "pro" | "business";
2
+
3
+ export const TIER_HOURLY_PRICE: Record<PodTier, number> = {
4
+ micro: 0,
5
+ lite: 0.015,
6
+ standard: 0.05,
7
+ pro: 0.08,
8
+ business: 0.12,
9
+ };
10
+
11
+ export type SpendTier = "free" | "low" | "medium" | "high";
12
+
13
+ export interface TeamLimits {
14
+ maxProjects: number;
15
+ maxInstancesPerProject: number;
16
+ tier: SpendTier;
17
+ tierLabel: string;
18
+ }
19
+
20
+ export const SPEND_THRESHOLDS = {
21
+ free: 0,
22
+ low: 10,
23
+ medium: 50,
24
+ high: 200,
25
+ } as const;
26
+
27
+ export const TIER_LIMITS: Record<SpendTier, TeamLimits> = {
28
+ free: {
29
+ maxProjects: 3,
30
+ maxInstancesPerProject: 1,
31
+ tier: "free",
32
+ tierLabel: "Free Usage",
33
+ },
34
+ low: {
35
+ maxProjects: 10,
36
+ maxInstancesPerProject: 2,
37
+ tier: "low",
38
+ tierLabel: "Low Spend",
39
+ },
40
+ medium: {
41
+ maxProjects: Infinity,
42
+ maxInstancesPerProject: 4,
43
+ tier: "medium",
44
+ tierLabel: "Medium Spend",
45
+ },
46
+ high: {
47
+ maxProjects: Infinity,
48
+ maxInstancesPerProject: 10,
49
+ tier: "high",
50
+ tierLabel: "High Spend",
51
+ },
52
+ };
53
+
54
+ export function getLimitsBySpend(totalSpend: number): TeamLimits {
55
+ if (totalSpend >= SPEND_THRESHOLDS.high) return TIER_LIMITS.high;
56
+ if (totalSpend >= SPEND_THRESHOLDS.medium) return TIER_LIMITS.medium;
57
+ if (totalSpend >= SPEND_THRESHOLDS.low) return TIER_LIMITS.low;
58
+ return TIER_LIMITS.free;
59
+ }
60
+
61
+ export function getTierLabel(totalSpend: number): string {
62
+ return getLimitsBySpend(totalSpend).tierLabel;
63
+ }
64
+
65
+ export type FrameworkFamily = "node" | "nixpacks";
66
+ export type DeploymentType = "static" | "container";
67
+
68
+ export interface FrameworkDefaults {
69
+ buildCommand?: string;
70
+ installCommand?: string;
71
+ outputDirectory?: string;
72
+ startCommand?: string;
73
+ }
74
+
75
+ export interface FrameworkConfig {
76
+ label: string;
77
+ family: FrameworkFamily;
78
+ deploymentType: DeploymentType;
79
+ defaults: FrameworkDefaults;
80
+ isServer: boolean;
81
+ }
82
+
83
+ export const FRAMEWORKS: Record<string, FrameworkConfig> = {
84
+ nextjs: {
85
+ label: "Next.js",
86
+ family: "node",
87
+ deploymentType: "container",
88
+ defaults: {
89
+ buildCommand: "next build",
90
+ installCommand: "bun install",
91
+ outputDirectory: ".next",
92
+ },
93
+ isServer: true,
94
+ },
95
+ remix: {
96
+ label: "Remix",
97
+ family: "node",
98
+ deploymentType: "container",
99
+ defaults: {
100
+ buildCommand: "npm run build",
101
+ installCommand: "bun install",
102
+ outputDirectory: "build",
103
+ },
104
+ isServer: true,
105
+ },
106
+ react: {
107
+ label: "React",
108
+ family: "node",
109
+ deploymentType: "static",
110
+ defaults: {
111
+ buildCommand: "npm run build",
112
+ installCommand: "bun install",
113
+ outputDirectory: "build",
114
+ },
115
+ isServer: false,
116
+ },
117
+ vite: {
118
+ label: "Vite",
119
+ family: "node",
120
+ deploymentType: "static",
121
+ defaults: {
122
+ buildCommand: "npm run build",
123
+ installCommand: "bun install",
124
+ outputDirectory: "dist",
125
+ },
126
+ isServer: false,
127
+ },
128
+ nuxt: {
129
+ label: "Nuxt",
130
+ family: "node",
131
+ deploymentType: "container",
132
+ defaults: {
133
+ buildCommand: "npm run build",
134
+ installCommand: "bun install",
135
+ outputDirectory: ".output",
136
+ },
137
+ isServer: true,
138
+ },
139
+ svelte: {
140
+ label: "Svelte",
141
+ family: "node",
142
+ deploymentType: "static",
143
+ defaults: {
144
+ buildCommand: "npm run build",
145
+ installCommand: "bun install",
146
+ outputDirectory: "build",
147
+ },
148
+ isServer: false,
149
+ },
150
+ node: {
151
+ label: "Node.js",
152
+ family: "node",
153
+ deploymentType: "container",
154
+ defaults: {
155
+ buildCommand: "npm run build",
156
+ installCommand: "bun install",
157
+ outputDirectory: "dist",
158
+ startCommand: "node dist/index.js",
159
+ },
160
+ isServer: true,
161
+ },
162
+ express: {
163
+ label: "Express",
164
+ family: "node",
165
+ deploymentType: "container",
166
+ defaults: {
167
+ buildCommand: "npm run build",
168
+ installCommand: "bun install",
169
+ outputDirectory: "dist",
170
+ startCommand: "node dist/index.js",
171
+ },
172
+ isServer: true,
173
+ },
174
+ hono: {
175
+ label: "Hono",
176
+ family: "node",
177
+ deploymentType: "container",
178
+ defaults: {
179
+ buildCommand: "npm run build",
180
+ installCommand: "bun install",
181
+ outputDirectory: "dist",
182
+ startCommand: "node dist/index.js",
183
+ },
184
+ isServer: true,
185
+ },
186
+ nestjs: {
187
+ label: "NestJS",
188
+ family: "node",
189
+ deploymentType: "container",
190
+ defaults: {
191
+ buildCommand: "npm run build",
192
+ installCommand: "bun install",
193
+ outputDirectory: "dist",
194
+ startCommand: "node dist/main.js",
195
+ },
196
+ isServer: true,
197
+ },
198
+ astro: {
199
+ label: "Astro",
200
+ family: "node",
201
+ deploymentType: "static",
202
+ defaults: {
203
+ buildCommand: "npm run build",
204
+ installCommand: "bun install",
205
+ outputDirectory: "dist",
206
+ },
207
+ isServer: false,
208
+ },
209
+ static: {
210
+ label: "Static Site",
211
+ family: "node",
212
+ deploymentType: "static",
213
+ defaults: {
214
+ buildCommand: "",
215
+ installCommand: "",
216
+ outputDirectory: ".",
217
+ },
218
+ isServer: false,
219
+ },
220
+ fastapi: {
221
+ label: "FastAPI",
222
+ family: "nixpacks",
223
+ deploymentType: "container",
224
+ defaults: {
225
+ buildCommand: "uv pip install --python 3.11 -r requirements.txt",
226
+ startCommand: "uvicorn main:app --host 0.0.0.0 --port 8080",
227
+ },
228
+ isServer: true,
229
+ },
230
+ flask: {
231
+ label: "Flask",
232
+ family: "nixpacks",
233
+ deploymentType: "container",
234
+ defaults: {
235
+ buildCommand: "uv pip install --python 3.11 -r requirements.txt",
236
+ startCommand: "flask run --host 0.0.0.0 --port 8080",
237
+ },
238
+ isServer: true,
239
+ },
240
+ django: {
241
+ label: "Django",
242
+ family: "nixpacks",
243
+ deploymentType: "container",
244
+ defaults: {
245
+ buildCommand: "uv pip install --python 3.11 -r requirements.txt",
246
+ startCommand: "python3 manage.py runserver 0.0.0.0:8080",
247
+ },
248
+ isServer: true,
249
+ },
250
+ } as const;
251
+
252
+ export function getFramework(id: string): FrameworkConfig | undefined {
253
+ return FRAMEWORKS[id.toLowerCase()];
254
+ }
255
+
256
+ export function getDefaultBuildCommand(
257
+ frameworkId: string,
258
+ ): string | undefined {
259
+ return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.buildCommand;
260
+ }
261
+
262
+ export function getDefaultOutputDirectory(
263
+ frameworkId: string,
264
+ ): string | undefined {
265
+ return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.outputDirectory;
266
+ }
267
+
268
+ export function getDefaultStartCommand(
269
+ frameworkId: string,
270
+ ): string | undefined {
271
+ return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.startCommand;
272
+ }
273
+
274
+ export function getInstallCommand(
275
+ frameworkId: string,
276
+ packageManager: string,
277
+ ): string {
278
+ const pm = packageManager.toLowerCase();
279
+ const framework = FRAMEWORKS[frameworkId.toLowerCase()];
280
+ if (pm === "pip" || pm === "poetry") {
281
+ if (pm === "poetry") return "poetry install";
282
+ return (
283
+ framework?.defaults.installCommand || "pip install -r requirements.txt"
284
+ );
285
+ }
286
+ const installCommands: Record<string, string> = {
287
+ npm: "npm install",
288
+ bun: "bun install",
289
+ yarn: "yarn install",
290
+ pnpm: "pnpm install",
291
+ };
292
+ return installCommands[pm] || `${pm} install`;
293
+ }
294
+
295
+ export interface Template {
296
+ id: string;
297
+ name: string;
298
+ description: string;
299
+ repoUrl: string;
300
+ framework: string;
301
+ }
302
+
303
+ export const TEMPLATES: Template[] = [
304
+ {
305
+ id: "blank",
306
+ name: "Blank",
307
+ description: "Minimal project setup",
308
+ repoUrl: "https://github.com/onflyt/blank",
309
+ framework: "static",
310
+ },
311
+ {
312
+ id: "nextjs",
313
+ name: "Next.js Starter",
314
+ description: "Next.js with App Router",
315
+ repoUrl: "https://github.com/onflyt/nextjs-starter",
316
+ framework: "nextjs",
317
+ },
318
+ {
319
+ id: "react-vite",
320
+ name: "React + Vite",
321
+ description: "React with Vite bundler",
322
+ repoUrl: "https://github.com/onflyt/react-vite",
323
+ framework: "react",
324
+ },
325
+ {
326
+ id: "node-api",
327
+ name: "Node.js API",
328
+ description: "Express/Fastify REST API",
329
+ repoUrl: "https://github.com/onflyt/node-api",
330
+ framework: "node",
331
+ },
332
+ {
333
+ id: "fastapi",
334
+ name: "FastAPI",
335
+ description: "Python FastAPI backend",
336
+ repoUrl: "https://github.com/onflyt/fastapi-starter",
337
+ framework: "fastapi",
338
+ },
339
+ {
340
+ id: "ai-agent",
341
+ name: "AI Agent",
342
+ description: "AI Agent starter with OpenAI",
343
+ repoUrl: "https://github.com/onflyt/ai-agent",
344
+ framework: "python",
345
+ },
346
+ ];
347
+
348
+ export function getTemplate(id: string): Template | undefined {
349
+ return TEMPLATES.find((t) => t.id === id);
350
+ }