@base44-preview/cli 0.0.1

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 (62) hide show
  1. package/README.md +72 -0
  2. package/dist/cli/commands/auth/login.d.ts +3 -0
  3. package/dist/cli/commands/auth/login.d.ts.map +1 -0
  4. package/dist/cli/commands/auth/login.js +25 -0
  5. package/dist/cli/commands/auth/login.js.map +1 -0
  6. package/dist/cli/commands/auth/logout.d.ts +3 -0
  7. package/dist/cli/commands/auth/logout.d.ts.map +1 -0
  8. package/dist/cli/commands/auth/logout.js +24 -0
  9. package/dist/cli/commands/auth/logout.js.map +1 -0
  10. package/dist/cli/commands/auth/whoami.d.ts +3 -0
  11. package/dist/cli/commands/auth/whoami.d.ts.map +1 -0
  12. package/dist/cli/commands/auth/whoami.js +24 -0
  13. package/dist/cli/commands/auth/whoami.js.map +1 -0
  14. package/dist/cli/index.d.ts +3 -0
  15. package/dist/cli/index.d.ts.map +1 -0
  16. package/dist/cli/index.js +18 -0
  17. package/dist/cli/index.js.map +1 -0
  18. package/dist/cli/utils/index.d.ts +3 -0
  19. package/dist/cli/utils/index.d.ts.map +1 -0
  20. package/dist/cli/utils/index.js +3 -0
  21. package/dist/cli/utils/index.js.map +1 -0
  22. package/dist/cli/utils/packageVersion.d.ts +2 -0
  23. package/dist/cli/utils/packageVersion.d.ts.map +1 -0
  24. package/dist/cli/utils/packageVersion.js +12 -0
  25. package/dist/cli/utils/packageVersion.js.map +1 -0
  26. package/dist/cli/utils/runCommand.d.ts +8 -0
  27. package/dist/cli/utils/runCommand.d.ts.map +1 -0
  28. package/dist/cli/utils/runCommand.js +14 -0
  29. package/dist/cli/utils/runCommand.js.map +1 -0
  30. package/dist/core/config/auth.d.ts +5 -0
  31. package/dist/core/config/auth.d.ts.map +1 -0
  32. package/dist/core/config/auth.js +47 -0
  33. package/dist/core/config/auth.js.map +1 -0
  34. package/dist/core/config/constants.d.ts +4 -0
  35. package/dist/core/config/constants.d.ts.map +1 -0
  36. package/dist/core/config/constants.js +6 -0
  37. package/dist/core/config/constants.js.map +1 -0
  38. package/dist/core/config/index.d.ts +3 -0
  39. package/dist/core/config/index.d.ts.map +1 -0
  40. package/dist/core/config/index.js +3 -0
  41. package/dist/core/config/index.js.map +1 -0
  42. package/dist/core/index.d.ts +4 -0
  43. package/dist/core/index.d.ts.map +1 -0
  44. package/dist/core/index.js +4 -0
  45. package/dist/core/index.js.map +1 -0
  46. package/dist/core/schemas/auth.d.ts +8 -0
  47. package/dist/core/schemas/auth.d.ts.map +1 -0
  48. package/dist/core/schemas/auth.js +7 -0
  49. package/dist/core/schemas/auth.js.map +1 -0
  50. package/dist/core/schemas/index.d.ts +2 -0
  51. package/dist/core/schemas/index.d.ts.map +1 -0
  52. package/dist/core/schemas/index.js +2 -0
  53. package/dist/core/schemas/index.js.map +1 -0
  54. package/dist/core/utils/fs.d.ts +5 -0
  55. package/dist/core/utils/fs.d.ts.map +1 -0
  56. package/dist/core/utils/fs.js +46 -0
  57. package/dist/core/utils/fs.js.map +1 -0
  58. package/dist/core/utils/index.d.ts +2 -0
  59. package/dist/core/utils/index.d.ts.map +1 -0
  60. package/dist/core/utils/index.js +2 -0
  61. package/dist/core/utils/index.js.map +1 -0
  62. package/package.json +50 -0
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Base44 CLI
2
+
3
+ A unified command-line interface for managing Base44 applications, entities, functions, deployments, and related services.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Using npm
9
+ npm install
10
+
11
+ # Build the project
12
+ npm run build
13
+
14
+ # Run the CLI (multiple ways)
15
+ npm start # Using node directly
16
+ npm run base44 # Using npm (runs node_modules/.bin/base44)
17
+ ./dist/cli/index.js # Run executable directly
18
+ ```
19
+
20
+ ## Development
21
+
22
+ ```bash
23
+ # Run in development mode with watch
24
+ npm run dev
25
+
26
+ # Build the project
27
+ npm run build
28
+
29
+ # Clean build artifacts
30
+ npm run clean
31
+ ```
32
+
33
+ ## Commands
34
+
35
+ ### Authentication
36
+ - `base44 login` - Authenticate with Base44
37
+ - `base44 whoami` - Display current authenticated user
38
+ - `base44 logout` - Logout from current device
39
+
40
+ ## Project Structure
41
+
42
+ ```
43
+ cli/
44
+ ├── src/
45
+ │ ├── core/ # Core module (shared code)
46
+ │ │ ├── api/ # API client code
47
+ │ │ ├── config/ # Configuration management
48
+ │ │ ├── schemas/ # Zod schemas
49
+ │ │ ├── utils/ # Utility functions
50
+ │ │ └── index.ts # Core module exports
51
+ │ └── cli/ # CLI module (main CLI)
52
+ │ ├── commands/ # Command implementations
53
+ │ │ └── auth/ # Authentication commands
54
+ │ ├── utils/ # CLI-specific utilities
55
+ │ └── index.ts # Main CLI entry point (with shebang)
56
+ ├── dist/ # Build output (compiled JavaScript)
57
+ ├── package.json # Package configuration
58
+ ├── tsconfig.json # TypeScript configuration
59
+ └── README.md
60
+ ```
61
+
62
+ ## Technologies
63
+
64
+ - **TypeScript** - Primary language
65
+ - **Commander.js** - CLI framework
66
+ - **@clack/prompts** - Interactive user prompts
67
+ - **Zod** - Schema validation
68
+
69
+ ## License
70
+
71
+ ISC
72
+
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const loginCommand: Command;
3
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,25 @@
1
+ import { Command } from "commander";
2
+ import { tasks } from "@clack/prompts";
3
+ import { writeAuth } from "../../../core/config/auth.js";
4
+ import { runCommand } from "../../utils/index.js";
5
+ 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
+ ]);
19
+ }
20
+ export const loginCommand = new Command("login")
21
+ .description("Authenticate with Base44")
22
+ .action(async () => {
23
+ await runCommand(login);
24
+ });
25
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,KAAK;IAClB,MAAM,KAAK,CAAC;QACV;YACE,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,MAAM,SAAS,CAAC;oBACd,KAAK,EAAE,kBAAkB;oBACzB,KAAK,EAAE,iBAAiB;oBACxB,IAAI,EAAE,UAAU;iBACjB,CAAC,CAAC;gBAEH,OAAO,uBAAuB,CAAC;YACjC,CAAC;SACF;KACF,CAAC,CAAC;AACL,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"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const logoutCommand: Command;
3
+ //# sourceMappingURL=logout.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,24 @@
1
+ import { Command } from "commander";
2
+ import { log } from "@clack/prompts";
3
+ import { deleteAuth } from "../../../core/config/auth.js";
4
+ import { runCommand } from "../../utils/index.js";
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
+ }
18
+ }
19
+ export const logoutCommand = new Command("logout")
20
+ .description("Logout from current device")
21
+ .action(async () => {
22
+ await runCommand(logout);
23
+ });
24
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const whoamiCommand: Command;
3
+ //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,24 @@
1
+ import { Command } from "commander";
2
+ import { log } from "@clack/prompts";
3
+ import { readAuth } from "../../../core/config/auth.js";
4
+ import { runCommand } from "../../utils/index.js";
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
+ }
18
+ }
19
+ export const whoamiCommand = new Command("whoami")
20
+ .description("Display current authenticated user")
21
+ .action(async () => {
22
+ await runCommand(whoami);
23
+ });
24
+ //# sourceMappingURL=whoami.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../../src/cli/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,KAAK,UAAU,MAAM;IACnB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACzD,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,oCAAoC,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;AACH,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"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { getPackageVersion } from './utils/index.js';
4
+ import { loginCommand } from './commands/auth/login.js';
5
+ import { whoamiCommand } from './commands/auth/whoami.js';
6
+ import { logoutCommand } from './commands/auth/logout.js';
7
+ const program = new Command();
8
+ program
9
+ .name('base44')
10
+ .description('Base44 CLI - Unified interface for managing Base44 applications')
11
+ .version(getPackageVersion());
12
+ // Register authentication commands
13
+ program.addCommand(loginCommand);
14
+ program.addCommand(whoamiCommand);
15
+ program.addCommand(logoutCommand);
16
+ // Parse command line arguments
17
+ program.parse();
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,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"}
@@ -0,0 +1,3 @@
1
+ export * from "./packageVersion.js";
2
+ export * from "./runCommand.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ export * from "./packageVersion.js";
2
+ export * from "./runCommand.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getPackageVersion(): string;
2
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/packageVersion.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C"}
@@ -0,0 +1,12 @@
1
+ import { readFileSync } from "fs";
2
+ import { fileURLToPath } from "url";
3
+ import { dirname, join } from "path";
4
+ export function getPackageVersion() {
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+ // From dist/cli/utils -> package.json at root"
8
+ const packageJsonPath = join(__dirname, "..", "..", "..", "package.json");
9
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
10
+ return packageJson.version;
11
+ }
12
+ //# sourceMappingURL=packageVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/cli/utils/packageVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,UAAU,iBAAiB;IAC/B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEtC,+CAA+C;IAC/C,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,OAAO,WAAW,CAAC,OAAO,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Wraps a command function with the Base44 intro banner.
3
+ * All CLI commands should use this utility to ensure consistent branding.
4
+ *
5
+ * @param commandFn - The async function to execute as the command
6
+ */
7
+ export declare function runCommand(commandFn: () => Promise<void>): Promise<void>;
8
+ //# sourceMappingURL=runCommand.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,14 @@
1
+ import { intro } from "@clack/prompts";
2
+ import chalk from "chalk";
3
+ const base44Color = chalk.bgHex("#E86B3C");
4
+ /**
5
+ * Wraps a command function with the Base44 intro banner.
6
+ * All CLI commands should use this utility to ensure consistent branding.
7
+ *
8
+ * @param commandFn - The async function to execute as the command
9
+ */
10
+ export async function runCommand(commandFn) {
11
+ intro(base44Color(" Base 44 "));
12
+ await commandFn();
13
+ }
14
+ //# sourceMappingURL=runCommand.js.map
@@ -0,0 +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"}
@@ -0,0 +1,5 @@
1
+ import { type AuthData } from "../schemas/auth.js";
2
+ export declare function readAuth(): Promise<AuthData>;
3
+ export declare function writeAuth(authData: AuthData): Promise<void>;
4
+ export declare function deleteAuth(): Promise<void>;
5
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/config/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AASnE,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA2BlD;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBjE;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAUhD"}
@@ -0,0 +1,47 @@
1
+ import { AuthDataSchema } from "../schemas/auth.js";
2
+ import { AUTH_FILE_PATH } from "./constants.js";
3
+ import { readJsonFile, writeJsonFile, deleteFile, } from "../utils/fs.js";
4
+ export async function readAuth() {
5
+ try {
6
+ const parsed = await readJsonFile(AUTH_FILE_PATH);
7
+ const result = AuthDataSchema.safeParse(parsed);
8
+ if (!result.success) {
9
+ throw new Error(`Invalid authentication data: ${result.error.issues
10
+ .map((e) => e.message)
11
+ .join(", ")}`);
12
+ }
13
+ return result.data;
14
+ }
15
+ catch (error) {
16
+ if (error instanceof Error && error.message.includes("Authentication")) {
17
+ throw error;
18
+ }
19
+ if (error instanceof Error && error.message.includes("File not found")) {
20
+ throw new Error("Authentication file not found. Please login first.");
21
+ }
22
+ throw new Error(`Failed to read authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
23
+ }
24
+ }
25
+ export async function writeAuth(authData) {
26
+ const result = AuthDataSchema.safeParse(authData);
27
+ if (!result.success) {
28
+ throw new Error(`Invalid authentication data: ${result.error.issues
29
+ .map((e) => e.message)
30
+ .join(", ")}`);
31
+ }
32
+ try {
33
+ await writeJsonFile(AUTH_FILE_PATH, result.data);
34
+ }
35
+ catch (error) {
36
+ throw new Error(`Failed to write authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
37
+ }
38
+ }
39
+ export async function deleteAuth() {
40
+ try {
41
+ await deleteFile(AUTH_FILE_PATH);
42
+ }
43
+ catch (error) {
44
+ throw new Error(`Failed to delete authentication file: ${error instanceof Error ? error.message : "Unknown error"}`);
45
+ }
46
+ }
47
+ //# sourceMapp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;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAkB;IAChD,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAElD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,gCAAgC,MAAM,CAAC,KAAK,CAAC,MAAM;aAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aACrB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,wCACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,yCACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const BASE44_DIR: string;
2
+ export declare const AUTH_DIR: string;
3
+ export declare const AUTH_FILE_PATH: string;
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/config/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,QAA6B,CAAC;AACrD,eAAO,MAAM,QAAQ,QAA2B,CAAC;AACjD,eAAO,MAAM,cAAc,QAA8B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { join } from 'path';
2
+ import { homedir } from 'os';
3
+ export const BASE44_DIR = join(homedir(), '.base44');
4
+ export const AUTH_DIR = join(BASE44_DIR, 'auth');
5
+ export const AUTH_FILE_PATH = join(AUTH_DIR, 'auth.json');
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/core/config/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './constants.js';
2
+ export * from './auth.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './constants.js';
2
+ export * from './auth.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './schemas/index.js';
2
+ export * from './config/index.js';
3
+ export * from './utils/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,4 @@
1
+ export * from './schemas/index.js';
2
+ export * from './config/index.js';
3
+ export * from './utils/index.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const AuthDataSchema: z.ZodObject<{
3
+ token: z.ZodString;
4
+ email: z.ZodEmail;
5
+ name: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export type AuthData = z.infer<typeof AuthDataSchema>;
8
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;iBAIzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export const AuthDataSchema = z.object({
3
+ token: z.string().min(1, 'Token cannot be empty'),
4
+ email: z.email(),
5
+ name: z.string().min(1, 'Name cannot be empty'),
6
+ });
7
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/core/schemas/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;CAChD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './auth.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './auth.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function fileExists(filePath: string): boolean;
2
+ export declare function readJsonFile(filePath: string): Promise<unknown>;
3
+ export declare function writeJsonFile(filePath: string, data: unknown): Promise<void>;
4
+ export declare function deleteFile(filePath: string): Promise<void>;
5
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBrE;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAchE"}
@@ -0,0 +1,46 @@
1
+ import { existsSync } from "fs";
2
+ import { readFile, writeFile, mkdir, unlink } from "fs/promises";
3
+ import { dirname } from "path";
4
+ export function fileExists(filePath) {
5
+ return existsSync(filePath);
6
+ }
7
+ export async function readJsonFile(filePath) {
8
+ if (!fileExists(filePath)) {
9
+ throw new Error(`File not found: ${filePath}`);
10
+ }
11
+ try {
12
+ const fileContent = await readFile(filePath, "utf-8");
13
+ return JSON.parse(fileContent);
14
+ }
15
+ catch (error) {
16
+ if (error instanceof SyntaxError) {
17
+ throw new Error(`File contains invalid JSON: ${filePath}`);
18
+ }
19
+ throw new Error(`Failed to read file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
20
+ }
21
+ }
22
+ export async function writeJsonFile(filePath, data) {
23
+ try {
24
+ const dir = dirname(filePath);
25
+ if (!fileExists(dir)) {
26
+ await mkdir(dir, { recursive: true });
27
+ }
28
+ const jsonContent = JSON.stringify(data, null, 2);
29
+ await writeFile(filePath, jsonContent, "utf-8");
30
+ }
31
+ catch (error) {
32
+ throw new Error(`Failed to write file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
33
+ }
34
+ }
35
+ export async function deleteFile(filePath) {
36
+ if (!fileExists(filePath)) {
37
+ return;
38
+ }
39
+ try {
40
+ await unlink(filePath);
41
+ }
42
+ catch (error) {
43
+ throw new Error(`Failed to delete file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
44
+ }
45
+ }
46
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/core/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,UA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,CACb,wBAAwB,QAAQ,KAC9B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAgB;IAC/C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,yBAAyB,QAAQ,KAC/B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './fs.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './fs.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@base44-preview/cli",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "./dist/cli/index.js",
7
+ "types": "./dist/cli/index.d.ts",
8
+ "bin": "./dist/cli/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/cli/index.d.ts",
12
+ "default": "./dist/cli/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsx src/cli/index.ts",
21
+ "start": "node dist/cli/index.js",
22
+ "clean": "rm -rf dist",
23
+ "lint": "eslint src"
24
+ },
25
+ "keywords": [
26
+ "base44",
27
+ "cli",
28
+ "command-line"
29
+ ],
30
+ "author": "",
31
+ "license": "ISC",
32
+ "dependencies": {
33
+ "@clack/prompts": "^0.11.0",
34
+ "chalk": "^5.6.2",
35
+ "commander": "^12.1.0",
36
+ "zod": "^4.3.5"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.10.5",
40
+ "@typescript-eslint/eslint-plugin": "^8.51.0",
41
+ "@typescript-eslint/parser": "^8.51.0",
42
+ "eslint": "^9.39.2",
43
+ "eslint-plugin-import": "^2.32.0",
44
+ "tsx": "^4.19.2",
45
+ "typescript": "^5.7.2"
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
49
+ }
50
+ }