@revstackhq/cli 0.0.0-dev-20260226063200 → 0.0.0-dev-20260227092523

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 (42) hide show
  1. package/.turbo/turbo-build.log +42 -30
  2. package/CHANGELOG.md +18 -0
  3. package/README.md +58 -38
  4. package/dist/cli.js +314 -43
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/init.js +279 -42
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/login.js.map +1 -1
  9. package/dist/commands/logout.js +3 -1
  10. package/dist/commands/logout.js.map +1 -1
  11. package/dist/commands/pull.js.map +1 -1
  12. package/dist/commands/push.js +32 -0
  13. package/dist/commands/push.js.map +1 -1
  14. package/dist/commands/templates/b2b-saas.d.ts +5 -0
  15. package/dist/commands/templates/b2b-saas.js +104 -0
  16. package/dist/commands/templates/b2b-saas.js.map +1 -0
  17. package/dist/commands/templates/index.d.ts +5 -0
  18. package/dist/commands/templates/index.js +264 -0
  19. package/dist/commands/templates/index.js.map +1 -0
  20. package/dist/commands/templates/starter.d.ts +10 -0
  21. package/dist/commands/templates/starter.js +88 -0
  22. package/dist/commands/templates/starter.js.map +1 -0
  23. package/dist/commands/templates/usage-based.d.ts +5 -0
  24. package/dist/commands/templates/usage-based.js +75 -0
  25. package/dist/commands/templates/usage-based.js.map +1 -0
  26. package/dist/utils/auth.js.map +1 -1
  27. package/dist/utils/config-loader.js.map +1 -1
  28. package/package.json +3 -2
  29. package/src/cli.ts +32 -32
  30. package/src/commands/init.ts +187 -210
  31. package/src/commands/login.ts +39 -39
  32. package/src/commands/logout.ts +27 -25
  33. package/src/commands/pull.ts +280 -280
  34. package/src/commands/push.ts +244 -206
  35. package/src/commands/templates/b2b-saas.ts +99 -0
  36. package/src/commands/templates/index.ts +12 -0
  37. package/src/commands/templates/starter.ts +89 -0
  38. package/src/commands/templates/usage-based.ts +70 -0
  39. package/src/utils/auth.ts +59 -59
  40. package/src/utils/config-loader.ts +57 -57
  41. package/tests/integration/init.test.ts +12 -2
  42. package/tests/integration/push.test.ts +20 -4
@@ -0,0 +1,264 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/templates/starter.ts
4
+ var starter = {
5
+ features: `import { defineFeature } from "@revstackhq/core";
6
+
7
+ export const features = {
8
+ seats: defineFeature({ name: "Seats", type: "static", unit_type: "count" }),
9
+ priority_support: defineFeature({ name: "Priority Support", type: "boolean", unit_type: "custom" }),
10
+ };
11
+ `,
12
+ addons: `import { defineAddon } from "@revstackhq/core";
13
+ import { features } from "./features";
14
+
15
+ export const addons = {
16
+ extra_seats: defineAddon<typeof features>({
17
+ name: "5 Extra Seats",
18
+ description: "Add 5 more team members to your workspace.",
19
+ type: "recurring",
20
+ prices: [
21
+ { amount: 1500, currency: "USD", billing_interval: "monthly" }
22
+ ],
23
+ features: {
24
+ seats: { value_limit: 5, type: "increment", is_hard_limit: false },
25
+ }
26
+ }),
27
+ vip_support: defineAddon<typeof features>({
28
+ name: "Priority Support",
29
+ description: "24/7 Slack channel support.",
30
+ type: "recurring",
31
+ prices: [
32
+ { amount: 9900, currency: "USD", billing_interval: "monthly" }
33
+ ],
34
+ features: {
35
+ priority_support: { has_access: true },
36
+ }
37
+ })
38
+ };
39
+ `,
40
+ plans: `import { definePlan } from "@revstackhq/core";
41
+ import { features } from "./features";
42
+
43
+ export const plans = {
44
+ // DO NOT DELETE: Automatically created default plan for guests.
45
+ default: definePlan<typeof features>({
46
+ name: "Default",
47
+ description: "Automatically created default plan for guests.",
48
+ is_default: true,
49
+ is_public: false,
50
+ type: "free",
51
+ features: {},
52
+ }),
53
+ pro: definePlan<typeof features>({
54
+ name: "Pro",
55
+ description: "For professional teams.",
56
+ is_default: false,
57
+ is_public: true,
58
+ type: "paid",
59
+ available_addons: ["extra_seats", "vip_support"],
60
+ prices: [
61
+ { amount: 2900, currency: "USD", billing_interval: "monthly", trial_period_days: 14 }
62
+ ],
63
+ features: {
64
+ seats: { value_limit: 5, is_hard_limit: true },
65
+ },
66
+ }),
67
+ };
68
+ `,
69
+ index: `import { defineConfig } from "@revstackhq/core";
70
+ import { features } from "./features";
71
+ import { addons } from "./addons";
72
+ import { plans } from "./plans";
73
+
74
+ export default defineConfig({
75
+ features,
76
+ addons,
77
+ plans,
78
+ });
79
+ `,
80
+ root: `import config from "./revstack";
81
+
82
+ export default config;
83
+ `
84
+ };
85
+
86
+ // src/commands/templates/b2b-saas.ts
87
+ var b2bSaas = {
88
+ features: `import { defineFeature } from "@revstackhq/core";
89
+
90
+ export const features = {
91
+ active_users: defineFeature({ name: "Active Users", type: "static", unit_type: "count" }),
92
+ api_access: defineFeature({ name: "API Access", type: "boolean", unit_type: "custom" }),
93
+ custom_domain: defineFeature({ name: "Custom Domain", type: "boolean", unit_type: "custom" }),
94
+ };
95
+ `,
96
+ addons: `import { defineAddon } from "@revstackhq/core";
97
+ import { features } from "./features";
98
+
99
+ export const addons = {
100
+ extra_users: defineAddon<typeof features>({
101
+ name: "10 Extra Users",
102
+ description: "Add 10 more active users to your workspace.",
103
+ type: "recurring",
104
+ prices: [
105
+ { amount: 5000, currency: "USD", billing_interval: "monthly" }
106
+ ],
107
+ features: {
108
+ active_users: { value_limit: 10, type: "increment", is_hard_limit: true },
109
+ }
110
+ }),
111
+ dedicated_support: defineAddon<typeof features>({
112
+ name: "Dedicated Support",
113
+ description: "Enterprise SLA with 1-hour response time.",
114
+ type: "recurring",
115
+ prices: [
116
+ { amount: 49900, currency: "USD", billing_interval: "monthly" }
117
+ ],
118
+ features: {}
119
+ })
120
+ };
121
+ `,
122
+ plans: `import { definePlan } from "@revstackhq/core";
123
+ import { features } from "./features";
124
+
125
+ export const plans = {
126
+ default: definePlan<typeof features>({
127
+ name: "Default",
128
+ description: "Automatically created default plan for guests.",
129
+ is_default: true,
130
+ is_public: false,
131
+ type: "free",
132
+ features: {},
133
+ }),
134
+ startup: definePlan<typeof features>({
135
+ name: "Startup",
136
+ description: "For small teams getting started.",
137
+ is_default: false,
138
+ is_public: true,
139
+ type: "paid",
140
+ available_addons: ["extra_users"],
141
+ prices: [
142
+ { amount: 9900, currency: "USD", billing_interval: "monthly" }
143
+ ],
144
+ features: {
145
+ active_users: { value_limit: 10, is_hard_limit: true },
146
+ api_access: { value_bool: false },
147
+ custom_domain: { value_bool: false },
148
+ },
149
+ }),
150
+ enterprise: definePlan<typeof features>({
151
+ name: "Enterprise",
152
+ description: "Advanced features for scale.",
153
+ is_default: false,
154
+ is_public: true,
155
+ type: "paid",
156
+ available_addons: ["extra_users", "dedicated_support"],
157
+ prices: [
158
+ { amount: 49900, currency: "USD", billing_interval: "monthly" }
159
+ ],
160
+ features: {
161
+ active_users: { value_limit: 100, is_hard_limit: false },
162
+ api_access: { value_bool: true },
163
+ custom_domain: { value_bool: true },
164
+ },
165
+ }),
166
+ };
167
+ `,
168
+ index: `import { defineConfig } from "@revstackhq/core";
169
+ import { features } from "./features";
170
+ import { addons } from "./addons";
171
+ import { plans } from "./plans";
172
+
173
+ export default defineConfig({
174
+ features,
175
+ addons,
176
+ plans,
177
+ });
178
+ `,
179
+ root: `import config from "./revstack";
180
+
181
+ export default config;
182
+ `
183
+ };
184
+
185
+ // src/commands/templates/usage-based.ts
186
+ var usageBased = {
187
+ features: `import { defineFeature } from "@revstackhq/core";
188
+
189
+ export const features = {
190
+ api_requests: defineFeature({ name: "API Requests", type: "metered", unit_type: "requests" }),
191
+ storage_gb: defineFeature({ name: "Storage (GB)", type: "metered", unit_type: "custom" }),
192
+ };
193
+ `,
194
+ addons: `import { defineAddon } from "@revstackhq/core";
195
+ import { features } from "./features";
196
+
197
+ export const addons = {
198
+ premium_support: defineAddon<typeof features>({
199
+ name: "Premium Support",
200
+ description: "24/7 dedicated support.",
201
+ type: "recurring",
202
+ prices: [
203
+ { amount: 20000, currency: "USD", billing_interval: "monthly" }
204
+ ],
205
+ features: {}
206
+ })
207
+ };
208
+ `,
209
+ plans: `import { definePlan } from "@revstackhq/core";
210
+ import { features } from "./features";
211
+
212
+ export const plans = {
213
+ default: definePlan<typeof features>({
214
+ name: "Default",
215
+ description: "Automatically created default plan for guests.",
216
+ is_default: true,
217
+ is_public: false,
218
+ type: "free",
219
+ features: {},
220
+ }),
221
+ pay_as_you_go: definePlan<typeof features>({
222
+ name: "Pay As You Go",
223
+ description: "Flexible usage-based pricing.",
224
+ is_default: false,
225
+ is_public: true,
226
+ type: "paid",
227
+ available_addons: ["premium_support"],
228
+ prices: [
229
+ { amount: 0, currency: "USD", billing_interval: "monthly" } // Base platform fee
230
+ ],
231
+ features: {
232
+ api_requests: { value_limit: 10000, is_hard_limit: false, reset_period: "monthly" }, // 10k free requests per month
233
+ storage_gb: { value_limit: 5, is_hard_limit: false, reset_period: "never" }, // 5GB free storage lifetime
234
+ },
235
+ }),
236
+ };
237
+ `,
238
+ index: `import { defineConfig } from "@revstackhq/core";
239
+ import { features } from "./features";
240
+ import { addons } from "./addons";
241
+ import { plans } from "./plans";
242
+
243
+ export default defineConfig({
244
+ features,
245
+ addons,
246
+ plans,
247
+ });
248
+ `,
249
+ root: `import config from "./revstack";
250
+
251
+ export default config;
252
+ `
253
+ };
254
+
255
+ // src/commands/templates/index.ts
256
+ var TEMPLATES = {
257
+ starter,
258
+ "b2b-saas": b2bSaas,
259
+ "usage-based": usageBased
260
+ };
261
+ export {
262
+ TEMPLATES
263
+ };
264
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/commands/templates/starter.ts","../../../src/commands/templates/b2b-saas.ts","../../../src/commands/templates/usage-based.ts","../../../src/commands/templates/index.ts"],"sourcesContent":["export interface TemplateConfig {\r\n features: string;\r\n addons: string;\r\n plans: string;\r\n index: string;\r\n root: string;\r\n}\r\n\r\nexport const starter: TemplateConfig = {\r\n features: `import { defineFeature } from \"@revstackhq/core\";\r\n\r\nexport const features = {\r\n seats: defineFeature({ name: \"Seats\", type: \"static\", unit_type: \"count\" }),\r\n priority_support: defineFeature({ name: \"Priority Support\", type: \"boolean\", unit_type: \"custom\" }),\r\n};\r\n`,\r\n addons: `import { defineAddon } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const addons = {\r\n extra_seats: defineAddon<typeof features>({\r\n name: \"5 Extra Seats\",\r\n description: \"Add 5 more team members to your workspace.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 1500, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n seats: { value_limit: 5, type: \"increment\", is_hard_limit: false },\r\n }\r\n }),\r\n vip_support: defineAddon<typeof features>({\r\n name: \"Priority Support\",\r\n description: \"24/7 Slack channel support.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 9900, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n priority_support: { has_access: true },\r\n }\r\n })\r\n};\r\n`,\r\n plans: `import { definePlan } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const plans = {\r\n // DO NOT DELETE: Automatically created default plan for guests.\r\n default: definePlan<typeof features>({\r\n name: \"Default\",\r\n description: \"Automatically created default plan for guests.\",\r\n is_default: true,\r\n is_public: false,\r\n type: \"free\",\r\n features: {},\r\n }),\r\n pro: definePlan<typeof features>({\r\n name: \"Pro\",\r\n description: \"For professional teams.\",\r\n is_default: false,\r\n is_public: true,\r\n type: \"paid\",\r\n available_addons: [\"extra_seats\", \"vip_support\"],\r\n prices: [\r\n { amount: 2900, currency: \"USD\", billing_interval: \"monthly\", trial_period_days: 14 }\r\n ],\r\n features: {\r\n seats: { value_limit: 5, is_hard_limit: true },\r\n },\r\n }),\r\n};\r\n`,\r\n index: `import { defineConfig } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\nimport { addons } from \"./addons\";\r\nimport { plans } from \"./plans\";\r\n\r\nexport default defineConfig({\r\n features,\r\n addons,\r\n plans,\r\n});\r\n`,\r\n root: `import config from \"./revstack\";\r\n\r\nexport default config;\r\n`,\r\n};\r\n","import { TemplateConfig } from \"./starter\";\r\n\r\nexport const b2bSaas: TemplateConfig = {\r\n features: `import { defineFeature } from \"@revstackhq/core\";\r\n\r\nexport const features = {\r\n active_users: defineFeature({ name: \"Active Users\", type: \"static\", unit_type: \"count\" }),\r\n api_access: defineFeature({ name: \"API Access\", type: \"boolean\", unit_type: \"custom\" }),\r\n custom_domain: defineFeature({ name: \"Custom Domain\", type: \"boolean\", unit_type: \"custom\" }),\r\n};\r\n`,\r\n addons: `import { defineAddon } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const addons = {\r\n extra_users: defineAddon<typeof features>({\r\n name: \"10 Extra Users\",\r\n description: \"Add 10 more active users to your workspace.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 5000, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n active_users: { value_limit: 10, type: \"increment\", is_hard_limit: true },\r\n }\r\n }),\r\n dedicated_support: defineAddon<typeof features>({\r\n name: \"Dedicated Support\",\r\n description: \"Enterprise SLA with 1-hour response time.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 49900, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {}\r\n })\r\n};\r\n`,\r\n plans: `import { definePlan } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const plans = {\r\n default: definePlan<typeof features>({\r\n name: \"Default\",\r\n description: \"Automatically created default plan for guests.\",\r\n is_default: true,\r\n is_public: false,\r\n type: \"free\",\r\n features: {},\r\n }),\r\n startup: definePlan<typeof features>({\r\n name: \"Startup\",\r\n description: \"For small teams getting started.\",\r\n is_default: false,\r\n is_public: true,\r\n type: \"paid\",\r\n available_addons: [\"extra_users\"],\r\n prices: [\r\n { amount: 9900, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n active_users: { value_limit: 10, is_hard_limit: true },\r\n api_access: { value_bool: false },\r\n custom_domain: { value_bool: false },\r\n },\r\n }),\r\n enterprise: definePlan<typeof features>({\r\n name: \"Enterprise\",\r\n description: \"Advanced features for scale.\",\r\n is_default: false,\r\n is_public: true,\r\n type: \"paid\",\r\n available_addons: [\"extra_users\", \"dedicated_support\"],\r\n prices: [\r\n { amount: 49900, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n active_users: { value_limit: 100, is_hard_limit: false },\r\n api_access: { value_bool: true },\r\n custom_domain: { value_bool: true },\r\n },\r\n }),\r\n};\r\n`,\r\n index: `import { defineConfig } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\nimport { addons } from \"./addons\";\r\nimport { plans } from \"./plans\";\r\n\r\nexport default defineConfig({\r\n features,\r\n addons,\r\n plans,\r\n});\r\n`,\r\n root: `import config from \"./revstack\";\r\n\r\nexport default config;\r\n`,\r\n};\r\n","import { TemplateConfig } from \"./starter\";\r\n\r\nexport const usageBased: TemplateConfig = {\r\n features: `import { defineFeature } from \"@revstackhq/core\";\r\n\r\nexport const features = {\r\n api_requests: defineFeature({ name: \"API Requests\", type: \"metered\", unit_type: \"requests\" }),\r\n storage_gb: defineFeature({ name: \"Storage (GB)\", type: \"metered\", unit_type: \"custom\" }),\r\n};\r\n`,\r\n addons: `import { defineAddon } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const addons = {\r\n premium_support: defineAddon<typeof features>({\r\n name: \"Premium Support\",\r\n description: \"24/7 dedicated support.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 20000, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {}\r\n })\r\n};\r\n`,\r\n plans: `import { definePlan } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const plans = {\r\n default: definePlan<typeof features>({\r\n name: \"Default\",\r\n description: \"Automatically created default plan for guests.\",\r\n is_default: true,\r\n is_public: false,\r\n type: \"free\",\r\n features: {},\r\n }),\r\n pay_as_you_go: definePlan<typeof features>({\r\n name: \"Pay As You Go\",\r\n description: \"Flexible usage-based pricing.\",\r\n is_default: false,\r\n is_public: true,\r\n type: \"paid\",\r\n available_addons: [\"premium_support\"],\r\n prices: [\r\n { amount: 0, currency: \"USD\", billing_interval: \"monthly\" } // Base platform fee\r\n ],\r\n features: {\r\n api_requests: { value_limit: 10000, is_hard_limit: false, reset_period: \"monthly\" }, // 10k free requests per month\r\n storage_gb: { value_limit: 5, is_hard_limit: false, reset_period: \"never\" }, // 5GB free storage lifetime\r\n },\r\n }),\r\n};\r\n`,\r\n index: `import { defineConfig } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\nimport { addons } from \"./addons\";\r\nimport { plans } from \"./plans\";\r\n\r\nexport default defineConfig({\r\n features,\r\n addons,\r\n plans,\r\n});\r\n`,\r\n root: `import config from \"./revstack\";\r\n\r\nexport default config;\r\n`,\r\n};\r\n","import { starter } from \"./starter\";\r\nimport { b2bSaas } from \"./b2b-saas\";\r\nimport { usageBased } from \"./usage-based\";\r\nimport type { TemplateConfig } from \"./starter\";\r\n\r\nexport const TEMPLATES: Record<string, TemplateConfig> = {\r\n starter: starter,\r\n \"b2b-saas\": b2bSaas,\r\n \"usage-based\": usageBased,\r\n};\r\n\r\nexport type { TemplateConfig };\r\n"],"mappings":";;;AAQO,IAAM,UAA0B;AAAA,EACrC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4BR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWP,MAAM;AAAA;AAAA;AAAA;AAIR;;;ACtFO,IAAM,UAA0B;AAAA,EACrC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQV,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8CP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWP,MAAM;AAAA;AAAA;AAAA;AAIR;;;AChGO,IAAM,aAA6B;AAAA,EACxC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWP,MAAM;AAAA;AAAA;AAAA;AAIR;;;AChEO,IAAM,YAA4C;AAAA,EACvD;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AACjB;","names":[]}
@@ -0,0 +1,10 @@
1
+ interface TemplateConfig {
2
+ features: string;
3
+ addons: string;
4
+ plans: string;
5
+ index: string;
6
+ root: string;
7
+ }
8
+ declare const starter: TemplateConfig;
9
+
10
+ export { type TemplateConfig, starter };
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/templates/starter.ts
4
+ var starter = {
5
+ features: `import { defineFeature } from "@revstackhq/core";
6
+
7
+ export const features = {
8
+ seats: defineFeature({ name: "Seats", type: "static", unit_type: "count" }),
9
+ priority_support: defineFeature({ name: "Priority Support", type: "boolean", unit_type: "custom" }),
10
+ };
11
+ `,
12
+ addons: `import { defineAddon } from "@revstackhq/core";
13
+ import { features } from "./features";
14
+
15
+ export const addons = {
16
+ extra_seats: defineAddon<typeof features>({
17
+ name: "5 Extra Seats",
18
+ description: "Add 5 more team members to your workspace.",
19
+ type: "recurring",
20
+ prices: [
21
+ { amount: 1500, currency: "USD", billing_interval: "monthly" }
22
+ ],
23
+ features: {
24
+ seats: { value_limit: 5, type: "increment", is_hard_limit: false },
25
+ }
26
+ }),
27
+ vip_support: defineAddon<typeof features>({
28
+ name: "Priority Support",
29
+ description: "24/7 Slack channel support.",
30
+ type: "recurring",
31
+ prices: [
32
+ { amount: 9900, currency: "USD", billing_interval: "monthly" }
33
+ ],
34
+ features: {
35
+ priority_support: { has_access: true },
36
+ }
37
+ })
38
+ };
39
+ `,
40
+ plans: `import { definePlan } from "@revstackhq/core";
41
+ import { features } from "./features";
42
+
43
+ export const plans = {
44
+ // DO NOT DELETE: Automatically created default plan for guests.
45
+ default: definePlan<typeof features>({
46
+ name: "Default",
47
+ description: "Automatically created default plan for guests.",
48
+ is_default: true,
49
+ is_public: false,
50
+ type: "free",
51
+ features: {},
52
+ }),
53
+ pro: definePlan<typeof features>({
54
+ name: "Pro",
55
+ description: "For professional teams.",
56
+ is_default: false,
57
+ is_public: true,
58
+ type: "paid",
59
+ available_addons: ["extra_seats", "vip_support"],
60
+ prices: [
61
+ { amount: 2900, currency: "USD", billing_interval: "monthly", trial_period_days: 14 }
62
+ ],
63
+ features: {
64
+ seats: { value_limit: 5, is_hard_limit: true },
65
+ },
66
+ }),
67
+ };
68
+ `,
69
+ index: `import { defineConfig } from "@revstackhq/core";
70
+ import { features } from "./features";
71
+ import { addons } from "./addons";
72
+ import { plans } from "./plans";
73
+
74
+ export default defineConfig({
75
+ features,
76
+ addons,
77
+ plans,
78
+ });
79
+ `,
80
+ root: `import config from "./revstack";
81
+
82
+ export default config;
83
+ `
84
+ };
85
+ export {
86
+ starter
87
+ };
88
+ //# sourceMappingURL=starter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/commands/templates/starter.ts"],"sourcesContent":["export interface TemplateConfig {\r\n features: string;\r\n addons: string;\r\n plans: string;\r\n index: string;\r\n root: string;\r\n}\r\n\r\nexport const starter: TemplateConfig = {\r\n features: `import { defineFeature } from \"@revstackhq/core\";\r\n\r\nexport const features = {\r\n seats: defineFeature({ name: \"Seats\", type: \"static\", unit_type: \"count\" }),\r\n priority_support: defineFeature({ name: \"Priority Support\", type: \"boolean\", unit_type: \"custom\" }),\r\n};\r\n`,\r\n addons: `import { defineAddon } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const addons = {\r\n extra_seats: defineAddon<typeof features>({\r\n name: \"5 Extra Seats\",\r\n description: \"Add 5 more team members to your workspace.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 1500, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n seats: { value_limit: 5, type: \"increment\", is_hard_limit: false },\r\n }\r\n }),\r\n vip_support: defineAddon<typeof features>({\r\n name: \"Priority Support\",\r\n description: \"24/7 Slack channel support.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 9900, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {\r\n priority_support: { has_access: true },\r\n }\r\n })\r\n};\r\n`,\r\n plans: `import { definePlan } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const plans = {\r\n // DO NOT DELETE: Automatically created default plan for guests.\r\n default: definePlan<typeof features>({\r\n name: \"Default\",\r\n description: \"Automatically created default plan for guests.\",\r\n is_default: true,\r\n is_public: false,\r\n type: \"free\",\r\n features: {},\r\n }),\r\n pro: definePlan<typeof features>({\r\n name: \"Pro\",\r\n description: \"For professional teams.\",\r\n is_default: false,\r\n is_public: true,\r\n type: \"paid\",\r\n available_addons: [\"extra_seats\", \"vip_support\"],\r\n prices: [\r\n { amount: 2900, currency: \"USD\", billing_interval: \"monthly\", trial_period_days: 14 }\r\n ],\r\n features: {\r\n seats: { value_limit: 5, is_hard_limit: true },\r\n },\r\n }),\r\n};\r\n`,\r\n index: `import { defineConfig } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\nimport { addons } from \"./addons\";\r\nimport { plans } from \"./plans\";\r\n\r\nexport default defineConfig({\r\n features,\r\n addons,\r\n plans,\r\n});\r\n`,\r\n root: `import config from \"./revstack\";\r\n\r\nexport default config;\r\n`,\r\n};\r\n"],"mappings":";;;AAQO,IAAM,UAA0B;AAAA,EACrC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4BR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWP,MAAM;AAAA;AAAA;AAAA;AAIR;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { TemplateConfig } from './starter.js';
2
+
3
+ declare const usageBased: TemplateConfig;
4
+
5
+ export { usageBased };
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/templates/usage-based.ts
4
+ var usageBased = {
5
+ features: `import { defineFeature } from "@revstackhq/core";
6
+
7
+ export const features = {
8
+ api_requests: defineFeature({ name: "API Requests", type: "metered", unit_type: "requests" }),
9
+ storage_gb: defineFeature({ name: "Storage (GB)", type: "metered", unit_type: "custom" }),
10
+ };
11
+ `,
12
+ addons: `import { defineAddon } from "@revstackhq/core";
13
+ import { features } from "./features";
14
+
15
+ export const addons = {
16
+ premium_support: defineAddon<typeof features>({
17
+ name: "Premium Support",
18
+ description: "24/7 dedicated support.",
19
+ type: "recurring",
20
+ prices: [
21
+ { amount: 20000, currency: "USD", billing_interval: "monthly" }
22
+ ],
23
+ features: {}
24
+ })
25
+ };
26
+ `,
27
+ plans: `import { definePlan } from "@revstackhq/core";
28
+ import { features } from "./features";
29
+
30
+ export const plans = {
31
+ default: definePlan<typeof features>({
32
+ name: "Default",
33
+ description: "Automatically created default plan for guests.",
34
+ is_default: true,
35
+ is_public: false,
36
+ type: "free",
37
+ features: {},
38
+ }),
39
+ pay_as_you_go: definePlan<typeof features>({
40
+ name: "Pay As You Go",
41
+ description: "Flexible usage-based pricing.",
42
+ is_default: false,
43
+ is_public: true,
44
+ type: "paid",
45
+ available_addons: ["premium_support"],
46
+ prices: [
47
+ { amount: 0, currency: "USD", billing_interval: "monthly" } // Base platform fee
48
+ ],
49
+ features: {
50
+ api_requests: { value_limit: 10000, is_hard_limit: false, reset_period: "monthly" }, // 10k free requests per month
51
+ storage_gb: { value_limit: 5, is_hard_limit: false, reset_period: "never" }, // 5GB free storage lifetime
52
+ },
53
+ }),
54
+ };
55
+ `,
56
+ index: `import { defineConfig } from "@revstackhq/core";
57
+ import { features } from "./features";
58
+ import { addons } from "./addons";
59
+ import { plans } from "./plans";
60
+
61
+ export default defineConfig({
62
+ features,
63
+ addons,
64
+ plans,
65
+ });
66
+ `,
67
+ root: `import config from "./revstack";
68
+
69
+ export default config;
70
+ `
71
+ };
72
+ export {
73
+ usageBased
74
+ };
75
+ //# sourceMappingURL=usage-based.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/commands/templates/usage-based.ts"],"sourcesContent":["import { TemplateConfig } from \"./starter\";\r\n\r\nexport const usageBased: TemplateConfig = {\r\n features: `import { defineFeature } from \"@revstackhq/core\";\r\n\r\nexport const features = {\r\n api_requests: defineFeature({ name: \"API Requests\", type: \"metered\", unit_type: \"requests\" }),\r\n storage_gb: defineFeature({ name: \"Storage (GB)\", type: \"metered\", unit_type: \"custom\" }),\r\n};\r\n`,\r\n addons: `import { defineAddon } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const addons = {\r\n premium_support: defineAddon<typeof features>({\r\n name: \"Premium Support\",\r\n description: \"24/7 dedicated support.\",\r\n type: \"recurring\",\r\n prices: [\r\n { amount: 20000, currency: \"USD\", billing_interval: \"monthly\" }\r\n ],\r\n features: {}\r\n })\r\n};\r\n`,\r\n plans: `import { definePlan } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\n\r\nexport const plans = {\r\n default: definePlan<typeof features>({\r\n name: \"Default\",\r\n description: \"Automatically created default plan for guests.\",\r\n is_default: true,\r\n is_public: false,\r\n type: \"free\",\r\n features: {},\r\n }),\r\n pay_as_you_go: definePlan<typeof features>({\r\n name: \"Pay As You Go\",\r\n description: \"Flexible usage-based pricing.\",\r\n is_default: false,\r\n is_public: true,\r\n type: \"paid\",\r\n available_addons: [\"premium_support\"],\r\n prices: [\r\n { amount: 0, currency: \"USD\", billing_interval: \"monthly\" } // Base platform fee\r\n ],\r\n features: {\r\n api_requests: { value_limit: 10000, is_hard_limit: false, reset_period: \"monthly\" }, // 10k free requests per month\r\n storage_gb: { value_limit: 5, is_hard_limit: false, reset_period: \"never\" }, // 5GB free storage lifetime\r\n },\r\n }),\r\n};\r\n`,\r\n index: `import { defineConfig } from \"@revstackhq/core\";\r\nimport { features } from \"./features\";\r\nimport { addons } from \"./addons\";\r\nimport { plans } from \"./plans\";\r\n\r\nexport default defineConfig({\r\n features,\r\n addons,\r\n plans,\r\n});\r\n`,\r\n root: `import config from \"./revstack\";\r\n\r\nexport default config;\r\n`,\r\n};\r\n"],"mappings":";;;AAEO,IAAM,aAA6B;AAAA,EACxC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWP,MAAM;AAAA;AAAA;AAAA;AAIR;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/auth.ts"],"sourcesContent":["/**\r\n * @file utils/auth.ts\r\n * @description Manages global Revstack credentials stored at ~/.revstack/credentials.json.\r\n * Provides simple get/set helpers for the API key used by all authenticated commands.\r\n */\r\n\r\nimport fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport os from \"node:os\";\r\n\r\nconst CREDENTIALS_DIR = path.join(os.homedir(), \".revstack\");\r\nconst CREDENTIALS_FILE = path.join(CREDENTIALS_DIR, \"credentials.json\");\r\n\r\ninterface Credentials {\r\n apiKey: string;\r\n}\r\n\r\n/**\r\n * Persist an API key to the global credentials file.\r\n * Creates `~/.revstack/` if it doesn't exist.\r\n */\r\nexport function setApiKey(key: string): void {\r\n if (!fs.existsSync(CREDENTIALS_DIR)) {\r\n fs.mkdirSync(CREDENTIALS_DIR, { recursive: true });\r\n }\r\n\r\n const credentials: Credentials = { apiKey: key };\r\n fs.writeFileSync(\r\n CREDENTIALS_FILE,\r\n JSON.stringify(credentials, null, 2),\r\n \"utf-8\"\r\n );\r\n}\r\n\r\n/**\r\n * Read the stored API key, or return `null` if none is configured.\r\n */\r\nexport function getApiKey(): string | null {\r\n if (!fs.existsSync(CREDENTIALS_FILE)) {\r\n return null;\r\n }\r\n\r\n try {\r\n const raw = fs.readFileSync(CREDENTIALS_FILE, \"utf-8\");\r\n const credentials: Credentials = JSON.parse(raw);\r\n return credentials.apiKey ?? null;\r\n } catch {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Remove stored credentials. Used by `revstack logout`.\r\n */\r\nexport function clearApiKey(): void {\r\n if (fs.existsSync(CREDENTIALS_FILE)) {\r\n fs.unlinkSync(CREDENTIALS_FILE);\r\n }\r\n}\r\n"],"mappings":";;;AAMA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AAEf,IAAM,kBAAkB,KAAK,KAAK,GAAG,QAAQ,GAAG,WAAW;AAC3D,IAAM,mBAAmB,KAAK,KAAK,iBAAiB,kBAAkB;AAU/D,SAAS,UAAU,KAAmB;AAC3C,MAAI,CAAC,GAAG,WAAW,eAAe,GAAG;AACnC,OAAG,UAAU,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAAA,EACnD;AAEA,QAAM,cAA2B,EAAE,QAAQ,IAAI;AAC/C,KAAG;AAAA,IACD;AAAA,IACA,KAAK,UAAU,aAAa,MAAM,CAAC;AAAA,IACnC;AAAA,EACF;AACF;AAKO,SAAS,YAA2B;AACzC,MAAI,CAAC,GAAG,WAAW,gBAAgB,GAAG;AACpC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,MAAM,GAAG,aAAa,kBAAkB,OAAO;AACrD,UAAM,cAA2B,KAAK,MAAM,GAAG;AAC/C,WAAO,YAAY,UAAU;AAAA,EAC/B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKO,SAAS,cAAoB;AAClC,MAAI,GAAG,WAAW,gBAAgB,GAAG;AACnC,OAAG,WAAW,gBAAgB;AAAA,EAChC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/auth.ts"],"sourcesContent":["/**\n * @file utils/auth.ts\n * @description Manages global Revstack credentials stored at ~/.revstack/credentials.json.\n * Provides simple get/set helpers for the API key used by all authenticated commands.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport os from \"node:os\";\n\nconst CREDENTIALS_DIR = path.join(os.homedir(), \".revstack\");\nconst CREDENTIALS_FILE = path.join(CREDENTIALS_DIR, \"credentials.json\");\n\ninterface Credentials {\n apiKey: string;\n}\n\n/**\n * Persist an API key to the global credentials file.\n * Creates `~/.revstack/` if it doesn't exist.\n */\nexport function setApiKey(key: string): void {\n if (!fs.existsSync(CREDENTIALS_DIR)) {\n fs.mkdirSync(CREDENTIALS_DIR, { recursive: true });\n }\n\n const credentials: Credentials = { apiKey: key };\n fs.writeFileSync(\n CREDENTIALS_FILE,\n JSON.stringify(credentials, null, 2),\n \"utf-8\",\n );\n}\n\n/**\n * Read the stored API key, or return `null` if none is configured.\n */\nexport function getApiKey(): string | null {\n if (!fs.existsSync(CREDENTIALS_FILE)) {\n return null;\n }\n\n try {\n const raw = fs.readFileSync(CREDENTIALS_FILE, \"utf-8\");\n const credentials: Credentials = JSON.parse(raw);\n return credentials.apiKey ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Remove stored credentials. Used by `revstack logout`.\n */\nexport function clearApiKey(): void {\n if (fs.existsSync(CREDENTIALS_FILE)) {\n fs.unlinkSync(CREDENTIALS_FILE);\n }\n}\n"],"mappings":";;;AAMA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AAEf,IAAM,kBAAkB,KAAK,KAAK,GAAG,QAAQ,GAAG,WAAW;AAC3D,IAAM,mBAAmB,KAAK,KAAK,iBAAiB,kBAAkB;AAU/D,SAAS,UAAU,KAAmB;AAC3C,MAAI,CAAC,GAAG,WAAW,eAAe,GAAG;AACnC,OAAG,UAAU,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAAA,EACnD;AAEA,QAAM,cAA2B,EAAE,QAAQ,IAAI;AAC/C,KAAG;AAAA,IACD;AAAA,IACA,KAAK,UAAU,aAAa,MAAM,CAAC;AAAA,IACnC;AAAA,EACF;AACF;AAKO,SAAS,YAA2B;AACzC,MAAI,CAAC,GAAG,WAAW,gBAAgB,GAAG;AACpC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,MAAM,GAAG,aAAa,kBAAkB,OAAO;AACrD,UAAM,cAA2B,KAAK,MAAM,GAAG;AAC/C,WAAO,YAAY,UAAU;AAAA,EAC/B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKO,SAAS,cAAoB;AAClC,MAAI,GAAG,WAAW,gBAAgB,GAAG;AACnC,OAAG,WAAW,gBAAgB;AAAA,EAChC;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/config-loader.ts"],"sourcesContent":["/**\r\n * @file utils/config-loader.ts\r\n * @description Loads and evaluates the user's `revstack.config.ts` at runtime\r\n * using jiti (just-in-time TypeScript compilation). Returns a sanitized,\r\n * JSON-safe representation of the config for network transmission.\r\n */\r\n\r\nimport { createJiti } from \"jiti\";\r\nimport path from \"node:path\";\r\nimport chalk from \"chalk\";\r\n\r\n/**\r\n * Load the `revstack.config.ts` from the given directory.\r\n *\r\n * @param cwd - The directory to search for `revstack.config.ts`.\r\n * @returns The parsed and sanitized configuration object.\r\n */\r\nexport async function loadLocalConfig(\r\n cwd: string\r\n): Promise<Record<string, unknown>> {\r\n const configPath = path.resolve(cwd, \"revstack.config.ts\");\r\n\r\n try {\r\n const jiti = createJiti(cwd);\r\n const module = (await jiti.import(configPath)) as Record<string, unknown>;\r\n const config = (module.default ?? module) as Record<string, unknown>;\r\n\r\n // Sanitize: strip functions, class instances, and non-serializable data.\r\n // This ensures we only send plain JSON to the Revstack Cloud API.\r\n return JSON.parse(JSON.stringify(config));\r\n } catch (error: unknown) {\r\n const err = error as NodeJS.ErrnoException;\r\n\r\n if (\r\n err.code === \"ERR_MODULE_NOT_FOUND\" ||\r\n err.code === \"ENOENT\" ||\r\n err.code === \"MODULE_NOT_FOUND\"\r\n ) {\r\n console.error(\r\n chalk.red(\r\n \"\\n ✖ Could not find revstack.config.ts in the current directory.\\n\"\r\n ) +\r\n chalk.dim(\" Run \") +\r\n chalk.bold(\"revstack init\") +\r\n chalk.dim(\" to create one.\\n\")\r\n );\r\n } else {\r\n console.error(\r\n chalk.red(\"\\n ✖ Failed to parse revstack.config.ts\\n\") +\r\n chalk.dim(\" \" + (err.message ?? String(error))) +\r\n \"\\n\"\r\n );\r\n }\r\n\r\n process.exit(1);\r\n }\r\n}\r\n"],"mappings":";;;AAOA,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,OAAO,WAAW;AAQlB,eAAsB,gBACpB,KACkC;AAClC,QAAM,aAAa,KAAK,QAAQ,KAAK,oBAAoB;AAEzD,MAAI;AACF,UAAM,OAAO,WAAW,GAAG;AAC3B,UAAM,SAAU,MAAM,KAAK,OAAO,UAAU;AAC5C,UAAM,SAAU,OAAO,WAAW;AAIlC,WAAO,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;AAAA,EAC1C,SAAS,OAAgB;AACvB,UAAM,MAAM;AAEZ,QACE,IAAI,SAAS,0BACb,IAAI,SAAS,YACb,IAAI,SAAS,oBACb;AACA,cAAQ;AAAA,QACN,MAAM;AAAA,UACJ;AAAA,QACF,IACE,MAAM,IAAI,UAAU,IACpB,MAAM,KAAK,eAAe,IAC1B,MAAM,IAAI,mBAAmB;AAAA,MACjC;AAAA,IACF,OAAO;AACL,cAAQ;AAAA,QACN,MAAM,IAAI,iDAA4C,IACpD,MAAM,IAAI,UAAU,IAAI,WAAW,OAAO,KAAK,EAAE,IACjD;AAAA,MACJ;AAAA,IACF;AAEA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/config-loader.ts"],"sourcesContent":["/**\n * @file utils/config-loader.ts\n * @description Loads and evaluates the user's `revstack.config.ts` at runtime\n * using jiti (just-in-time TypeScript compilation). Returns a sanitized,\n * JSON-safe representation of the config for network transmission.\n */\n\nimport { createJiti } from \"jiti\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\n\n/**\n * Load the `revstack.config.ts` from the given directory.\n *\n * @param cwd - The directory to search for `revstack.config.ts`.\n * @returns The parsed and sanitized configuration object.\n */\nexport async function loadLocalConfig(\n cwd: string,\n): Promise<Record<string, unknown>> {\n const configPath = path.resolve(cwd, \"revstack.config.ts\");\n\n try {\n const jiti = createJiti(cwd);\n const module = (await jiti.import(configPath)) as Record<string, unknown>;\n const config = (module.default ?? module) as Record<string, unknown>;\n\n // Sanitize: strip functions, class instances, and non-serializable data.\n // This ensures we only send plain JSON to the Revstack Cloud API.\n return JSON.parse(JSON.stringify(config));\n } catch (error: unknown) {\n const err = error as NodeJS.ErrnoException;\n\n if (\n err.code === \"ERR_MODULE_NOT_FOUND\" ||\n err.code === \"ENOENT\" ||\n err.code === \"MODULE_NOT_FOUND\"\n ) {\n console.error(\n chalk.red(\n \"\\n ✖ Could not find revstack.config.ts in the current directory.\\n\",\n ) +\n chalk.dim(\" Run \") +\n chalk.bold(\"revstack init\") +\n chalk.dim(\" to create one.\\n\"),\n );\n } else {\n console.error(\n chalk.red(\"\\n ✖ Failed to parse revstack.config.ts\\n\") +\n chalk.dim(\" \" + (err.message ?? String(error))) +\n \"\\n\",\n );\n }\n\n process.exit(1);\n }\n}\n"],"mappings":";;;AAOA,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,OAAO,WAAW;AAQlB,eAAsB,gBACpB,KACkC;AAClC,QAAM,aAAa,KAAK,QAAQ,KAAK,oBAAoB;AAEzD,MAAI;AACF,UAAM,OAAO,WAAW,GAAG;AAC3B,UAAM,SAAU,MAAM,KAAK,OAAO,UAAU;AAC5C,UAAM,SAAU,OAAO,WAAW;AAIlC,WAAO,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;AAAA,EAC1C,SAAS,OAAgB;AACvB,UAAM,MAAM;AAEZ,QACE,IAAI,SAAS,0BACb,IAAI,SAAS,YACb,IAAI,SAAS,oBACb;AACA,cAAQ;AAAA,QACN,MAAM;AAAA,UACJ;AAAA,QACF,IACE,MAAM,IAAI,UAAU,IACpB,MAAM,KAAK,eAAe,IAC1B,MAAM,IAAI,mBAAmB;AAAA,MACjC;AAAA,IACF,OAAO;AACL,cAAQ;AAAA,QACN,MAAM,IAAI,iDAA4C,IACpD,MAAM,IAAI,UAAU,IAAI,WAAW,OAAO,KAAK,EAAE,IACjD;AAAA,MACJ;AAAA,IACF;AAEA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revstackhq/cli",
3
- "version": "0.0.0-dev-20260226063200",
3
+ "version": "0.0.0-dev-20260227092523",
4
4
  "description": "The official CLI for Revstack — Billing as Code",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,8 @@
14
14
  "execa": "^9.6.1",
15
15
  "jiti": "^2.4.2",
16
16
  "ora": "^8.2.0",
17
- "prompts": "^2.4.2"
17
+ "prompts": "^2.4.2",
18
+ "@revstackhq/core": "0.0.0-dev-20260226062415"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@types/node": "^20.11.0",
package/src/cli.ts CHANGED
@@ -1,32 +1,32 @@
1
- /**
2
- * @file cli.ts
3
- * @description Entry point for the Revstack CLI.
4
- * Registers all commands and parses process.argv.
5
- */
6
-
7
- import { Command } from "commander";
8
- import { createRequire } from "node:module";
9
-
10
- import { loginCommand } from "@/commands/login.js";
11
- import { logoutCommand } from "@/commands/logout.js";
12
- import { initCommand } from "@/commands/init.js";
13
- import { pushCommand } from "@/commands/push.js";
14
- import { pullCommand } from "@/commands/pull.js";
15
-
16
- const require = createRequire(import.meta.url);
17
- const packageJson = require("../package.json") as { version: string };
18
-
19
- const program = new Command();
20
-
21
- program
22
- .name("revstack")
23
- .description("The official CLI for Revstack — Billing as Code")
24
- .version(packageJson.version);
25
-
26
- program.addCommand(loginCommand);
27
- program.addCommand(logoutCommand);
28
- program.addCommand(initCommand);
29
- program.addCommand(pushCommand);
30
- program.addCommand(pullCommand);
31
-
32
- program.parse(process.argv);
1
+ /**
2
+ * @file cli.ts
3
+ * @description Entry point for the Revstack CLI.
4
+ * Registers all commands and parses process.argv.
5
+ */
6
+
7
+ import { Command } from "commander";
8
+ import { createRequire } from "node:module";
9
+
10
+ import { loginCommand } from "@/commands/login.js";
11
+ import { logoutCommand } from "@/commands/logout.js";
12
+ import { initCommand } from "@/commands/init.js";
13
+ import { pushCommand } from "@/commands/push.js";
14
+ import { pullCommand } from "@/commands/pull.js";
15
+
16
+ const require = createRequire(import.meta.url);
17
+ const packageJson = require("../package.json") as { version: string };
18
+
19
+ const program = new Command();
20
+
21
+ program
22
+ .name("revstack")
23
+ .description("The official CLI for Revstack — Billing as Code")
24
+ .version(packageJson.version);
25
+
26
+ program.addCommand(loginCommand);
27
+ program.addCommand(logoutCommand);
28
+ program.addCommand(initCommand);
29
+ program.addCommand(pushCommand);
30
+ program.addCommand(pullCommand);
31
+
32
+ program.parse(process.argv);