@revstackhq/cli 0.0.0-dev-20260227103607 → 0.0.0-dev-20260228060138

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 (56) hide show
  1. package/.turbo/turbo-build.log +51 -42
  2. package/CHANGELOG.md +11 -0
  3. package/dist/cli.js +622 -49
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/init.d.ts +0 -7
  6. package/dist/commands/init.js +443 -24
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/login.d.ts +0 -6
  9. package/dist/commands/login.js.map +1 -1
  10. package/dist/commands/logout.d.ts +0 -5
  11. package/dist/commands/logout.js.map +1 -1
  12. package/dist/commands/pull.d.ts +0 -7
  13. package/dist/commands/pull.js +120 -11
  14. package/dist/commands/pull.js.map +1 -1
  15. package/dist/commands/push.js +59 -14
  16. package/dist/commands/push.js.map +1 -1
  17. package/dist/commands/templates/ai-agent-platform.d.ts +5 -0
  18. package/dist/commands/templates/ai-agent-platform.js +119 -0
  19. package/dist/commands/templates/ai-agent-platform.js.map +1 -0
  20. package/dist/commands/templates/b2b-saas.js +23 -10
  21. package/dist/commands/templates/b2b-saas.js.map +1 -1
  22. package/dist/commands/templates/developer-tools.d.ts +5 -0
  23. package/dist/commands/templates/developer-tools.js +131 -0
  24. package/dist/commands/templates/developer-tools.js.map +1 -0
  25. package/dist/commands/templates/ecommerce-platform.d.ts +5 -0
  26. package/dist/commands/templates/ecommerce-platform.js +144 -0
  27. package/dist/commands/templates/ecommerce-platform.js.map +1 -0
  28. package/dist/commands/templates/index.js +437 -23
  29. package/dist/commands/templates/index.js.map +1 -1
  30. package/dist/commands/templates/starter.d.ts +1 -0
  31. package/dist/commands/templates/starter.js +13 -8
  32. package/dist/commands/templates/starter.js.map +1 -1
  33. package/dist/commands/templates/usage-based.js +18 -4
  34. package/dist/commands/templates/usage-based.js.map +1 -1
  35. package/dist/utils/auth.d.ts +0 -5
  36. package/dist/utils/auth.js.map +1 -1
  37. package/dist/utils/config-loader.d.ts +0 -6
  38. package/dist/utils/config-loader.js +4 -0
  39. package/dist/utils/config-loader.js.map +1 -1
  40. package/package.json +2 -2
  41. package/src/commands/init.ts +6 -8
  42. package/src/commands/login.ts +0 -6
  43. package/src/commands/logout.ts +0 -5
  44. package/src/commands/pull.ts +148 -60
  45. package/src/commands/push.ts +67 -16
  46. package/src/commands/templates/ai-agent-platform.ts +114 -0
  47. package/src/commands/templates/b2b-saas.ts +23 -10
  48. package/src/commands/templates/developer-tools.ts +126 -0
  49. package/src/commands/templates/ecommerce-platform.ts +139 -0
  50. package/src/commands/templates/index.ts +6 -0
  51. package/src/commands/templates/starter.ts +14 -8
  52. package/src/commands/templates/usage-based.ts +18 -4
  53. package/src/utils/auth.ts +0 -6
  54. package/src/utils/config-loader.ts +6 -7
  55. package/tests/integration/pull.test.ts +6 -0
  56. package/tests/integration/push.test.ts +3 -0
@@ -16,12 +16,24 @@ export const addons = {
16
16
  name: "Premium Support",
17
17
  description: "24/7 dedicated support.",
18
18
  type: "recurring",
19
- prices: [
20
- { amount: 20000, currency: "USD", billing_interval: "monthly" }
21
- ],
19
+ amount: 20000,
20
+ currency: "USD",
21
+ billing_interval: "monthly",
22
22
  features: {}
23
23
  })
24
24
  };
25
+ `,
26
+ coupons: `import type { DiscountDef } from "@revstackhq/core";
27
+
28
+ export const coupons: DiscountDef[] = [
29
+ {
30
+ code: "STARTUP_ACCELERATOR",
31
+ name: "Startup Program Credits",
32
+ type: "amount",
33
+ value: 500000, // $5,000 credit
34
+ duration: "forever",
35
+ }
36
+ ];
25
37
  `,
26
38
  plans: `import { definePlan } from "@revstackhq/core";
27
39
  import { features } from "./features";
@@ -41,12 +53,12 @@ export const plans = {
41
53
  is_default: false,
42
54
  is_public: true,
43
55
  type: "paid",
44
- available_addons: ["premium_support"],
45
56
  prices: [
46
57
  {
47
58
  amount: 0,
48
59
  currency: "USD",
49
60
  billing_interval: "monthly",
61
+ available_addons: ["premium_support"],
50
62
  overage_configuration: {
51
63
  api_requests: { overage_amount: 15, overage_unit: 1000 }, // $0.15 per 1k extra requests
52
64
  storage_gb: { overage_amount: 50, overage_unit: 1 }, // $0.50 per extra GB
@@ -64,11 +76,13 @@ export const plans = {
64
76
  import { features } from "./features";
65
77
  import { addons } from "./addons";
66
78
  import { plans } from "./plans";
79
+ import { coupons } from "./coupons";
67
80
 
68
81
  export default defineConfig({
69
82
  features,
70
83
  addons,
71
84
  plans,
85
+ coupons,
72
86
  });
73
87
  `,
74
88
  root: `import config from "./revstack";
package/src/utils/auth.ts CHANGED
@@ -1,9 +1,3 @@
1
- /**
2
- * @file utils/auth.ts
3
- * @description Manages global Revstack credentials stored at ~/.revstack/credentials.json.
4
- * Provides simple get/set helpers for the API key used by all authenticated commands.
5
- */
6
-
7
1
  import fs from "node:fs";
8
2
  import path from "node:path";
9
3
  import os from "node:os";
@@ -1,10 +1,3 @@
1
- /**
2
- * @file utils/config-loader.ts
3
- * @description Loads and evaluates the user's `revstack.config.ts` at runtime
4
- * using jiti (just-in-time TypeScript compilation). Returns a sanitized,
5
- * JSON-safe representation of the config for network transmission.
6
- */
7
-
8
1
  import { createJiti } from "jiti";
9
2
  import path from "node:path";
10
3
  import chalk from "chalk";
@@ -44,6 +37,12 @@ export async function loadLocalConfig(
44
37
  chalk.bold("revstack init") +
45
38
  chalk.dim(" to create one.\n"),
46
39
  );
40
+ } else if (err.name === "SyntaxError" || error instanceof SyntaxError) {
41
+ console.error(
42
+ chalk.red("\n ✖ Syntax Error in revstack.config.ts\n") +
43
+ chalk.dim(" " + (err.message ?? String(error))) +
44
+ "\n",
45
+ );
47
46
  } else {
48
47
  console.error(
49
48
  chalk.red("\n ✖ Failed to parse revstack.config.ts\n") +
@@ -16,6 +16,7 @@ const mockSpinner = {
16
16
  start: vi.fn().mockReturnThis(),
17
17
  succeed: vi.fn().mockReturnThis(),
18
18
  fail: vi.fn().mockReturnThis(),
19
+ info: vi.fn().mockReturnThis(),
19
20
  };
20
21
 
21
22
  vi.mock("ora", () => ({
@@ -44,6 +45,11 @@ vi.mock("node:fs", () => ({
44
45
  mkdirSync: vi.fn(),
45
46
  }));
46
47
 
48
+ // ── Mock execa ───────────────────────────────────────────────
49
+ vi.mock("execa", () => ({
50
+ execa: vi.fn().mockResolvedValue({}),
51
+ }));
52
+
47
53
  // ── Imports (after mocks) ────────────────────────────────────
48
54
  import { getApiKey } from "../../src/utils/auth";
49
55
  import prompts from "prompts";
@@ -28,6 +28,9 @@ vi.mock("@revstackhq/core", () => {
28
28
  }
29
29
  return {
30
30
  validateConfig: vi.fn(),
31
+ RevstackConfigSchema: {
32
+ parse: vi.fn().mockImplementation((config) => config),
33
+ },
31
34
  RevstackValidationError,
32
35
  };
33
36
  });