busa-cli 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # busa-cli
2
+
3
+ Short-name alias for [`busabase-cli`](https://www.npmjs.com/package/busabase-cli).
4
+
5
+ ```sh
6
+ npx busa-cli --help
7
+ ```
8
+
9
+ The package contains the same built CLI artifact as `busabase-cli`, exposed through the
10
+ `busa-cli` binary. Use `busabase-cli` for canonical docs and examples.
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const here = dirname(fileURLToPath(import.meta.url));
7
+ const pkgRoot = resolve(here, "..");
8
+ const builtCli = resolve(pkgRoot, "dist/cli.js");
9
+ const delegatedArgvJson = process.env.BUSABASE_CLI_DELEGATED_ARGV;
10
+
11
+ if (!existsSync(builtCli)) {
12
+ console.error(
13
+ "busabase-cli: built CLI entry is missing.\n" +
14
+ "If you are running from source, build it first:\n" +
15
+ " pnpm --filter busabase-cli build\n\n" +
16
+ "For one-off npm usage, prefer:\n" +
17
+ " npm exec -y --package busabase-cli@latest -- busabase-cli <command>\n",
18
+ );
19
+ process.exit(1);
20
+ }
21
+
22
+ try {
23
+ if (delegatedArgvJson) {
24
+ delete process.env.BUSABASE_CLI_DELEGATED_ARGV;
25
+ const { runCli } = await import(resolve(pkgRoot, "dist/index.js"));
26
+ const delegatedArgv = JSON.parse(delegatedArgvJson);
27
+ if (!Array.isArray(delegatedArgv) || delegatedArgv.some((arg) => typeof arg !== "string")) {
28
+ throw new Error("BUSABASE_CLI_DELEGATED_ARGV must be a JSON string array.");
29
+ }
30
+ process.exit(await runCli(delegatedArgv));
31
+ }
32
+ await import(builtCli);
33
+ } catch (error) {
34
+ const message = error instanceof Error ? error.message : String(error);
35
+ if (message.includes("busabase-sdk") && message.includes("dist/index.js")) {
36
+ console.error(
37
+ "busabase-cli: busabase-sdk is not built.\n" +
38
+ "If you are running from source, build the SDK first:\n" +
39
+ " pnpm --filter busabase-sdk build\n\n" +
40
+ "For one-off npm usage, prefer:\n" +
41
+ " npm exec -y --package busabase-cli@latest -- busabase-cli <command>\n",
42
+ );
43
+ process.exit(1);
44
+ }
45
+ throw error;
46
+ }