@base44-preview/cli 0.0.1-pr.4.8a5da99 → 0.0.1-pr.5.2dd0b1b

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 (51) hide show
  1. package/dist/cli/commands/auth/login.d.ts.map +1 -1
  2. package/dist/cli/commands/auth/login.js +57 -15
  3. package/dist/cli/commands/auth/login.js.map +1 -1
  4. package/dist/cli/commands/auth/logout.d.ts.map +1 -1
  5. package/dist/cli/commands/auth/logout.js +2 -12
  6. package/dist/cli/commands/auth/logout.js.map +1 -1
  7. package/dist/cli/commands/auth/whoami.d.ts.map +1 -1
  8. package/dist/cli/commands/auth/whoami.js +2 -12
  9. package/dist/cli/commands/auth/whoami.js.map +1 -1
  10. package/dist/cli/index.js +1 -1
  11. package/dist/cli/index.js.map +1 -1
  12. package/dist/cli/utils/index.d.ts +1 -0
  13. package/dist/cli/utils/index.d.ts.map +1 -1
  14. package/dist/cli/utils/index.js +1 -0
  15. package/dist/cli/utils/index.js.map +1 -1
  16. package/dist/cli/utils/runCommand.d.ts.map +1 -1
  17. package/dist/cli/utils/runCommand.js +21 -2
  18. package/dist/cli/utils/runCommand.js.map +1 -1
  19. package/dist/cli/utils/runTask.d.ts +14 -0
  20. package/dist/cli/utils/runTask.d.ts.map +1 -0
  21. package/dist/cli/utils/runTask.js +24 -0
  22. package/dist/cli/utils/runTask.js.map +1 -0
  23. package/dist/core/api/auth/client.d.ts +4 -0
  24. package/dist/core/api/auth/client.d.ts.map +1 -0
  25. package/dist/core/api/auth/client.js +70 -0
  26. package/dist/core/api/auth/client.js.map +1 -0
  27. package/dist/core/api/auth/index.d.ts +4 -0
  28. package/dist/core/api/auth/index.d.ts.map +1 -0
  29. package/dist/core/api/auth/index.js +4 -0
  30. package/dist/core/api/auth/index.js.map +1 -0
  31. package/dist/core/api/auth/schema.d.ts +15 -0
  32. package/dist/core/api/auth/schema.d.ts.map +1 -0
  33. package/dist/core/api/auth/schema.js +13 -0
  34. package/dist/core/api/auth/schema.js.map +1 -0
  35. package/dist/core/api/index.d.ts +2 -0
  36. package/dist/core/api/index.d.ts.map +1 -0
  37. package/dist/core/api/index.js +2 -0
  38. package/dist/core/api/index.js.map +1 -0
  39. package/dist/core/errors/errors.d.ts +15 -0
  40. package/dist/core/errors/errors.d.ts.map +1 -0
  41. package/dist/core/errors/errors.js +17 -0
  42. package/dist/core/errors/errors.js.map +1 -0
  43. package/dist/core/errors/index.d.ts +2 -0
  44. package/dist/core/errors/index.d.ts.map +1 -0
  45. package/dist/core/errors/index.js +2 -0
  46. package/dist/core/errors/index.js.map +1 -0
  47. package/dist/core/index.d.ts +2 -0
  48. package/dist/core/index.d.ts.map +1 -1
  49. package/dist/core/index.js +2 -0
  50. package/dist/core/index.js.map +1 -1
  51. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBpC,eAAO,MAAM,YAAY,SAIrB,CAAC"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiGpC,eAAO,MAAM,YAAY,SAIrB,CAAC"}
@@ -1,21 +1,63 @@
1
1
  import { Command } from "commander";
2
- import { tasks } from "@clack/prompts";
2
+ import { log } from "@clack/prompts";
3
+ import pWaitFor from "p-wait-for";
3
4
  import { writeAuth } from "../../../core/config/auth.js";
4
- import { runCommand } from "../../utils/index.js";
5
+ import { generateDeviceCode, getTokenFromDeviceCode, } from "../../../core/api/auth";
6
+ import { runCommand, runTask } from "../../utils/index.js";
7
+ async function generateAndDisplayDeviceCode() {
8
+ const deviceCodeResponse = await runTask("Generating device code...", async () => {
9
+ return await generateDeviceCode();
10
+ }, {
11
+ successMessage: "Device code generated",
12
+ errorMessage: "Failed to generate device code",
13
+ });
14
+ log.info(`Please visit: ${deviceCodeResponse.verificationUrl}\n` +
15
+ `Enter your device code: ${deviceCodeResponse.userCode}`);
16
+ return deviceCodeResponse;
17
+ }
18
+ async function waitForAuthentication(deviceCode, expiresIn) {
19
+ let tokenResponse = null;
20
+ try {
21
+ await runTask("Waiting for you to complete authentication...", async () => {
22
+ await pWaitFor(async () => {
23
+ const result = await getTokenFromDeviceCode(deviceCode);
24
+ if (result !== null) {
25
+ tokenResponse = result;
26
+ return true;
27
+ }
28
+ return false;
29
+ }, {
30
+ interval: 2000,
31
+ timeout: expiresIn * 1000,
32
+ });
33
+ }, {
34
+ successMessage: "Authentication completed!",
35
+ errorMessage: "Authentication failed",
36
+ });
37
+ }
38
+ catch (error) {
39
+ if (error instanceof Error && error.message.includes("timed out")) {
40
+ throw new Error("Authentication timed out. Please try again.");
41
+ }
42
+ throw error;
43
+ }
44
+ if (!tokenResponse) {
45
+ throw new Error("Failed to retrieve authentication token.");
46
+ }
47
+ return tokenResponse;
48
+ }
49
+ async function saveAuthData(token) {
50
+ await writeAuth({
51
+ token: token.token,
52
+ email: token.email,
53
+ name: token.name,
54
+ });
55
+ }
5
56
  async function login() {
6
- await tasks([
7
- {
8
- title: "Logging you in",
9
- task: async () => {
10
- await writeAuth({
11
- token: "stub-token-12345",
12
- email: "valid@email.com",
13
- name: "KfirStri",
14
- });
15
- return "Logged in as KfirStri";
16
- },
17
- },
18
- ]);
57
+ const deviceCodeResponse = await generateAndDisplayDeviceCode();
58
+ const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn);
59
+ await saveAuthData(token);
60
+ log.success(`Logged in as ${token.name}`);
19
61
  }
20
62
  export const loginCommand = new Command("login")
21
63
  .description("Authenticate with Base44")
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,M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M,SAAS,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,KAAK;IAClB,MAAM,kBAAkB,GAAG,MAAM,4BAA4B,EAAE,CAAC;IAEhE,MAAM,KAAK,GAAG,MAAM,qBAAqB,CACvC,kBAAkB,CAAC,UAAU,EAC7B,kBAAkB,CAAC,SAAS,CAC7B,CAAC;IAEF,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC;IAE1B,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
@@ -3,18 +3,8 @@ import { log } from "@clack/prompts";
3
3
  import { deleteAuth } from "../../../core/config/auth.js";
4
4
  import { runCommand } from "../../utils/index.js";
5
5
  async function logout() {
6
- try {
7
- await deleteAuth();
8
- log.info("Logged out successfully");
9
- }
10
- catch (error) {
11
- if (error instanceof Error) {
12
- log.error(error.message);
13
- }
14
- else {
15
- log.error("Failed to logout");
16
- }
17
- }
6
+ await deleteAuth();
7
+ log.info("Logged out successfully");
18
8
  }
19
9
  export const logoutCommand = new Command("logout")
20
10
  .description("Logout from current device")
@@ -1 +1 @@
1
- {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,IAAI,CAAC;QACH,MAAM,UAAU,EAAE,CAAC;QACnB,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,MAAM,UAAU,EAAE,CAAC;IACnB,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,aAAa,SAItB,CAAC"}
@@ -3,18 +3,8 @@ import { log } from "@clack/prompts";
3
3
  import { readAuth } from "../../../core/config/auth.js";
4
4
  import { runCommand } from "../../utils/index.js";
5
5
  async function whoami() {
6
- try {
7
- const auth = await readAuth();
8
- log.info(`Logged in as: ${auth.name} (${auth.email})`);
9
- }
10
- catch (error) {
11
- if (error instanceof Error) {
12
- log.error(error.message);
13
- }
14
- else {
15
- log.error("Failed to read authentication data");
16
- }
17
- }
6
+ const auth = await readAuth();
7
+ log.info(`Logged in as: ${auth.name} (${auth.email})`);
18
8
  }
19
9
  export const whoamiCommand = new Command("whoami")
20
10
  .description("Display current authenticated user")
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,oCAAoC,CAAC;KACjD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"}
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import { logoutCommand } from './commands/auth/logout.js';
7
7
  const program = new Command();
8
8
  program
9
9
  .name('base44')
10
- .description('Base44 CLI 2 - Unified interface for managing Base44 applications')
10
+ .description('Base44 CLI - Unified interface for managing Base44 applications')
11
11
  .version(getPackageVersion());
12
12
  // Register authentication commands
13
13
  program.addCommand(loginCommand);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,mEAAmE,CAAC;KAChF,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAEhC,mCAAmC;AACnC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAElC,+BAA+B;AAC/B,OAAO,CAAC,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,iEAAiE,CAAC;KAC9E,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAEhC,mCAAmC;AACnC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAElC,+BAA+B;AAC/B,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./packageVersion.js";
2
2
  export * from "./runCommand.js";
3
+ export * from "./runTask.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./packageVersion.js";
2
2
  export * from "./runCommand.js";
3
+ export * from "./runTask.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E"}
1
+ {"version":3,"file":"runCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC,CAkBf"}
@@ -1,5 +1,6 @@
1
- import { intro } from "@clack/prompts";
1
+ import { intro, log } from "@clack/prompts";
2
2
  import chalk from "chalk";
3
+ import { AuthApiError, AuthValidationError } from "../../core/errors/index.js";
3
4
  const base44Color = chalk.bgHex("#E86B3C");
4
5
  /**
5
6
  * Wraps a command function with the Base44 intro banner.
@@ -9,6 +10,24 @@ const base44Color = chalk.bgHex("#E86B3C");
9
10
  */
10
11
  export async function runCommand(commandFn) {
11
12
  intro(base44Color(" Base 44 "));
12
- await commandFn();
13
+ try {
14
+ await commandFn();
15
+ }
16
+ catch (e) {
17
+ if (e instanceof AuthValidationError) {
18
+ const issues = e.issues.map((i) => i.message).join(", ");
19
+ log.error(`Invalid response from server: ${issues}`);
20
+ }
21
+ else if (e instanceof AuthApiError) {
22
+ log.error(e.message);
23
+ }
24
+ else if (e instanceof Error) {
25
+ log.error(e.message);
26
+ }
27
+ else {
28
+ log.error(String(e));
29
+ }
30
+ process.exit(1);
31
+ }
13
32
  }
14
33
  //# sourceMappingURL=runCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,SAA8B;IAC7D,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IAChC,MAAM,SAAS,EAAE,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/cli/utils/runCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE1E,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,SAA8B;IAE9B,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,SAAS,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,mBAAmB,EAAE,CAAC;YACrC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,GAAG,CAAC,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;aAAM,IAAI,CAAC,YAAY,YAAY,EAAE,CAAC;YACrC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YAC9B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Wraps an async operation with automatic spinner management.
3
+ * The spinner is automatically started, and stopped on both success and error.
4
+ *
5
+ * @param startMessage - Message to show when spinner starts
6
+ * @param operation - The async operation to execute
7
+ * @param options - Optional configuration
8
+ * @returns The result of the operation
9
+ */
10
+ export declare function runTask<T>(startMessage: string, operation: () => Promise<T>, options?: {
11
+ successMessage?: string;
12
+ errorMessage?: string;
13
+ }): Promise<T>;
14
+ //# sourceMappingURL=runTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runTask.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/runTask.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACA,OAAO,CAAC,CAAC,CAAC,CAYZ"}
@@ -0,0 +1,24 @@
1
+ import { spinner } from "@clack/prompts";
2
+ /**
3
+ * Wraps an async operation with automatic spinner management.
4
+ * The spinner is automatically started, and stopped on both success and error.
5
+ *
6
+ * @param startMessage - Message to show when spinner starts
7
+ * @param operation - The async operation to execute
8
+ * @param options - Optional configuration
9
+ * @returns The result of the operation
10
+ */
11
+ export async function runTask(startMessage, operation, options) {
12
+ const s = spinner();
13
+ s.start(startMessage);
14
+ try {
15
+ const result = await operation();
16
+ s.stop(options?.successMessage || startMessage);
17
+ return result;
18
+ }
19
+ catch (error) {
20
+ s.stop(options?.errorMessage || "Failed");
21
+ throw error;
22
+ }
23
+ }
24
+ //# sourceMappingURL=runTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runTask.js","sourceRoot":"","sources":["../../../src/cli/utils/runTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,YAAoB,EACpB,SAA2B,EAC3B,OAGC;IAED,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEtB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,YAAY,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,IAAI,QAAQ,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type DeviceCodeResponse, type TokenResponse } from "./schema.js";
2
+ export declare function generateDeviceCode(): Promise<DeviceCodeResponse>;
3
+ export declare function getTokenFromDeviceCode(deviceCode: string): Promise<TokenResponse | null>;
4
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAYrB,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAuCtE;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA4C/B"}
@@ -0,0 +1,70 @@
1
+ import { DeviceCodeResponseSchema, TokenResponseSchema, } from "./schema.js";
2
+ import { AuthApiError, AuthValidationError } from "../../errors/index.js";
3
+ async function delay(ms) {
4
+ return new Promise((resolve) => setTimeout(resolve, ms));
5
+ }
6
+ const deviceCodeToTokenMap = new Map();
7
+ export async function generateDeviceCode() {
8
+ try {
9
+ await delay(1000);
10
+ const deviceCode = `device-code-${Date.now()}`;
11
+ deviceCodeToTokenMap.set(deviceCode, {
12
+ startTime: Date.now(),
13
+ readyAfter: 5000,
14
+ });
15
+ const mockResponse = {
16
+ deviceCode,
17
+ userCode: "ABCD-1234",
18
+ verificationUrl: "https://app.base44.com/verify",
19
+ expiresIn: 600,
20
+ };
21
+ const result = DeviceCodeResponseSchema.safeParse(mockResponse);
22
+ if (!result.success) {
23
+ throw new AuthValidationError("Invalid device code response from server", result.error.issues.map((issue) => ({
24
+ message: issue.message,
25
+ path: issue.path.map(String),
26
+ })));
27
+ }
28
+ return result.data;
29
+ }
30
+ catch (error) {
31
+ if (error instanceof AuthValidationError) {
32
+ throw error;
33
+ }
34
+ throw new AuthApiError("Failed to generate device code", error instanceof Error ? error : new Error(String(error)));
35
+ }
36
+ }
37
+ export async function getTokenFromDeviceCode(deviceCode) {
38
+ try {
39
+ await delay(1000);
40
+ const deviceInfo = deviceCodeToTokenMap.get(deviceCode);
41
+ if (!deviceInfo) {
42
+ return null;
43
+ }
44
+ const elapsed = Date.now() - deviceInfo.startTime;
45
+ if (elapsed < deviceInfo.readyAfter) {
46
+ return null;
47
+ }
48
+ const mockResponse = {
49
+ token: "mock-token-" + Date.now(),
50
+ email: "stam@lala.com",
51
+ name: "Test User",
52
+ };
53
+ const result = TokenResponseSchema.safeParse(mockResponse);
54
+ if (!result.success) {
55
+ throw new AuthValidationError("Invalid token response from server", result.error.issues.map((issue) => ({
56
+ message: issue.message,
57
+ path: issue.path.map(String),
58
+ })));
59
+ }
60
+ deviceCodeToTokenMap.delete(deviceCode);
61
+ return result.data;
62
+ }
63
+ catch (error) {
64
+ if (error instanceof AuthValidationError || error instanceof AuthApiError) {
65
+ throw error;
66
+ }
67
+ throw new AuthApiError("Failed to retrieve token from device code", error instanceof Error ? error : new Error(String(error)));
68
+ }
69
+ }
70
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/core/api/auth/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAExB,mBAAmB,GAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE1E,KAAK,UAAU,KAAK,CAAC,EAAU;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAGjC,CAAC;AAEJ,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAElB,MAAM,UAAU,GAAG,eAAe,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAE/C,oBAAoB,CAAC,GAAG,CAAC,UAAU,EAAE;YACnC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,MAAM,YAAY,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,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,YAAY,GAAkB;YAClC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE;YACjC,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,WAAW;SAClB,CAAC;QAEF,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,mBAAmB,CAC3B,oCAAoC,EACpC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAClC,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;aAC7B,CAAC,CAAC,CACJ,CAAC;QACJ,CAAC;QAED,oBAAoB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,mBAAmB,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;YAC1E,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,IAAI,YAAY,CACpB,2CAA2C,EAC3C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './client.js';
2
+ export * from './schema.js';
3
+ export { AuthApiError, AuthValidationError } from '../../errors/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './client.js';
2
+ export * from './schema.js';
3
+ export { AuthApiError, AuthValidationError } from '../../errors/index.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/api/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export declare const DeviceCodeResponseSchema: z.ZodObject<{
3
+ deviceCode: z.ZodString;
4
+ userCode: z.ZodString;
5
+ verificationUrl: z.ZodURL;
6
+ expiresIn: z.ZodNumber;
7
+ }, z.core.$strip>;
8
+ export type DeviceCodeResponse = z.infer<typeof DeviceCodeResponseSchema>;
9
+ export declare const TokenResponseSchema: z.ZodObject<{
10
+ token: z.ZodString;
11
+ email: z.ZodEmail;
12
+ name: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export type TokenResponse = z.infer<typeof TokenResponseSchema>;
15
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/core/api/auth/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB;;;;;iBAKnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export const DeviceCodeResponseSchema = z.object({
3
+ deviceCode: z.string().min(1, 'Device code cannot be empty'),
4
+ userCode: z.string().min(1, 'User code cannot be empty'),
5
+ verificationUrl: z.url('Invalid verification URL'),
6
+ expiresIn: z.number().int().positive('Expires in must be a positive integer'),
7
+ });
8
+ export const TokenResponseSchema = z.object({
9
+ token: z.string().min(1, 'Token cannot be empty'),
10
+ email: z.email('Invalid email address'),
11
+ name: z.string().min(1, 'Name cannot be empty'),
12
+ });
13
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/core/api/auth/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;IAC5D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC;IACxD,eAAe,EAAE,CAAC,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAClD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CAC9E,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;CAChD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './auth/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './auth/index.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare class AuthApiError extends Error {
2
+ readonly cause?: unknown | undefined;
3
+ constructor(message: string, cause?: unknown | undefined);
4
+ }
5
+ export declare class AuthValidationError extends Error {
6
+ readonly issues: Array<{
7
+ message: string;
8
+ path: string[];
9
+ }>;
10
+ constructor(message: string, issues: Array<{
11
+ message: string;
12
+ path: string[];
13
+ }>);
14
+ }
15
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;aAGnB,KAAK,CAAC,EAAE,OAAO;gBAD/B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,OAAO,YAAA;CAKlC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAG1B,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;gBADlE,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAKrE"}
@@ -0,0 +1,17 @@
1
+ export class AuthApiError extends Error {
2
+ cause;
3
+ constructor(message, cause) {
4
+ super(message);
5
+ this.cause = cause;
6
+ this.name = 'AuthApiError';
7
+ }
8
+ }
9
+ export class AuthValidationError extends Error {
10
+ issues;
11
+ constructor(message, issues) {
12
+ super(message);
13
+ this.issues = issues;
14
+ this.name = 'AuthValidationError';
15
+ }
16
+ }
17
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/core/errors/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAGnB;IAFlB,YACE,OAAe,EACC,KAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,UAAK,GAAL,KAAK,CAAU;QAG/B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAG1B;IAFlB,YACE,OAAe,EACC,MAAkD;QAElE,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,WAAM,GAAN,MAAM,CAA4C;QAGlE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from './errors.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './errors.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from './schemas/index.js';
2
2
  export * from './config/index.js';
3
3
  export * from './utils/index.js';
4
+ export * from './api/index.js';
5
+ export * from './errors/index.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from './schemas/index.js';
2
2
  export * from './config/index.js';
3
3
  export * from './utils/index.js';
4
+ export * from './api/index.js';
5
+ export * from './errors/index.js';
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.1-pr.4.8a5da99",
3
+ "version": "0.0.1-pr.5.2dd0b1b",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",
@@ -16,7 +16,7 @@
16
16
  "dist"
17
17
  ],
18
18
  "scripts": {
19
- "build": "tsc",
19
+ "build": "tsc && tsc-alias",
20
20
  "dev": "tsx src/cli/index.ts",
21
21
  "start": "node dist/cli/index.js",
22
22
  "clean": "rm -rf dist",
@@ -37,6 +37,7 @@
37
37
  "@clack/prompts": "^0.11.0",
38
38
  "chalk": "^5.6.2",
39
39
  "commander": "^12.1.0",
40
+ "p-wait-for": "^6.0.0",
40
41
  "zod": "^4.3.5"
41
42
  },
42
43
  "devDependencies": {
@@ -45,10 +46,11 @@
45
46
  "@typescript-eslint/parser": "^8.51.0",
46
47
  "eslint": "^9.39.2",
47
48
  "eslint-plugin-import": "^2.32.0",
49
+ "tsc-alias": "^1.8.16",
48
50
  "tsx": "^4.19.2",
49
51
  "typescript": "^5.7.2"
50
52
  },
51
53
  "engines": {
52
- "node": ">=18.0.0"
54
+ "node": ">=20.0.0"
53
55
  }
54
56
  }