busa-cli 0.11.0 → 0.11.2
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/bin/busabase-cli.mjs +4 -7
- package/dist/{chunk-QJJMAA3K.js → chunk-S3KRMKDU.js} +50 -6
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/bin/busabase-cli.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
3
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const builtCli = resolve(pkgRoot, "dist/cli.js");
|
|
4
|
+
const builtCli = new URL("../dist/cli.js", import.meta.url);
|
|
5
|
+
const programmaticEntry = new URL("../dist/index.js", import.meta.url);
|
|
9
6
|
const delegatedArgvJson = process.env.BUSABASE_CLI_DELEGATED_ARGV;
|
|
10
7
|
|
|
11
8
|
if (!existsSync(builtCli)) {
|
|
@@ -22,14 +19,14 @@ if (!existsSync(builtCli)) {
|
|
|
22
19
|
try {
|
|
23
20
|
if (delegatedArgvJson) {
|
|
24
21
|
delete process.env.BUSABASE_CLI_DELEGATED_ARGV;
|
|
25
|
-
const { runCli } = await import(
|
|
22
|
+
const { runCli } = await import(programmaticEntry.href);
|
|
26
23
|
const delegatedArgv = JSON.parse(delegatedArgvJson);
|
|
27
24
|
if (!Array.isArray(delegatedArgv) || delegatedArgv.some((arg) => typeof arg !== "string")) {
|
|
28
25
|
throw new Error("BUSABASE_CLI_DELEGATED_ARGV must be a JSON string array.");
|
|
29
26
|
}
|
|
30
27
|
process.exit(await runCli(delegatedArgv));
|
|
31
28
|
}
|
|
32
|
-
await import(builtCli);
|
|
29
|
+
await import(builtCli.href);
|
|
33
30
|
} catch (error) {
|
|
34
31
|
const message = error instanceof Error ? error.message : String(error);
|
|
35
32
|
if (message.includes("busabase-sdk") && message.includes("dist/index.js")) {
|
|
@@ -1296,11 +1296,16 @@ var nodeCreateTask = {
|
|
|
1296
1296
|
|
|
1297
1297
|
// ../../packages/busabase-contract/src/tasks/record-change.ts
|
|
1298
1298
|
var OPERATIONS2 = ["update", "delete", "restore"];
|
|
1299
|
+
var mergeIntent2 = (input) => {
|
|
1300
|
+
if (input.requireReview) return { autoMerge: false };
|
|
1301
|
+
if (input.autoMerge) return { autoMerge: true };
|
|
1302
|
+
return {};
|
|
1303
|
+
};
|
|
1299
1304
|
var recordChangeTask = {
|
|
1300
1305
|
name: "record_change_request",
|
|
1301
1306
|
cliPath: ["records", "change-request"],
|
|
1302
1307
|
summary: "Propose a change to an existing record (update / delete / restore)",
|
|
1303
|
-
guidance: "
|
|
1308
|
+
guidance: "Review is permission-aware, decided server-side: `update` merges immediately when your key has write access on the Base's node and lands as a pending ChangeRequest otherwise \u2014 check the response's `materialized` field to see which happened. Pass explicit `autoMerge: false` to force review even when you could write directly. `delete` and `restore` are always review-first regardless of permission, by design. `delete` ARCHIVES the record \u2014 it is reversible with `restore`, not an erase. For update, `fields` is keyed by field slug and only needs the fields you are changing; if you set the Base's PRIMARY (first) field, keep it a short human-readable title.",
|
|
1304
1309
|
annotations: { readOnly: false, destructive: false },
|
|
1305
1310
|
params: [
|
|
1306
1311
|
{ name: "recordId", kind: "string", required: true, description: "Record to change." },
|
|
@@ -1322,10 +1327,23 @@ var recordChangeTask = {
|
|
|
1322
1327
|
kind: "string",
|
|
1323
1328
|
description: 'Explanation for the reviewer \u2014 imperative verb + what + why, e.g. "Update deal stage to qualified \u2014 demo booked".'
|
|
1324
1329
|
},
|
|
1325
|
-
{ name: "submittedBy", kind: "string", description: "Producer label recorded on the change." }
|
|
1330
|
+
{ name: "submittedBy", kind: "string", description: "Producer label recorded on the change." },
|
|
1331
|
+
{
|
|
1332
|
+
name: "autoMerge",
|
|
1333
|
+
kind: "boolean",
|
|
1334
|
+
appliesWhen: { param: "operation", values: ["update"] },
|
|
1335
|
+
description: "Skip review and apply the update immediately if you have write access. Not a permission override \u2014 a changeRequest-level key still gets a pending CR. Default is permission-aware: merge when you can, otherwise propose."
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
name: "requireReview",
|
|
1339
|
+
kind: "boolean",
|
|
1340
|
+
appliesWhen: { param: "operation", values: ["update"] },
|
|
1341
|
+
description: "Always propose a pending ChangeRequest for this update, even with write access. delete/restore are review-first regardless."
|
|
1342
|
+
}
|
|
1326
1343
|
],
|
|
1327
1344
|
examples: [
|
|
1328
1345
|
`busabase-cli records change-request --record-id rec_1 --operation update --fields-json '{"status":"published"}'`,
|
|
1346
|
+
`busabase-cli records change-request --record-id rec_1 --operation update --fields-json '{"status":"published"}' --require-review`,
|
|
1329
1347
|
"busabase-cli records change-request --record-id rec_1 --operation delete"
|
|
1330
1348
|
],
|
|
1331
1349
|
execute: async (client, input) => {
|
|
@@ -1341,7 +1359,10 @@ var recordChangeTask = {
|
|
|
1341
1359
|
return client.records.changeRequest({
|
|
1342
1360
|
...common,
|
|
1343
1361
|
operation: "update",
|
|
1344
|
-
fields: input.fields
|
|
1362
|
+
fields: input.fields,
|
|
1363
|
+
// Only `update` carries the merge intent — the endpoint's delete/restore
|
|
1364
|
+
// branches have no `autoMerge` in their schema at all, by design.
|
|
1365
|
+
...mergeIntent2(input)
|
|
1345
1366
|
});
|
|
1346
1367
|
}
|
|
1347
1368
|
if (input.operation === "delete") {
|
|
@@ -1444,7 +1465,7 @@ var recordQueryTask = {
|
|
|
1444
1465
|
|
|
1445
1466
|
// ../../packages/busabase-contract/src/tasks/view-change.ts
|
|
1446
1467
|
var ACTIONS = ["create", "update", "delete", "restore"];
|
|
1447
|
-
var
|
|
1468
|
+
var mergeIntent3 = (input) => {
|
|
1448
1469
|
if (input.requireReview) return { autoMerge: false };
|
|
1449
1470
|
if (input.autoMerge) return { autoMerge: true };
|
|
1450
1471
|
return {};
|
|
@@ -1523,7 +1544,7 @@ var viewChangeTask = {
|
|
|
1523
1544
|
...input.submittedBy ? { submittedBy: input.submittedBy } : {},
|
|
1524
1545
|
// Tri-state, like node_create's: omitted keeps the endpoint's
|
|
1525
1546
|
// permission-aware default, explicit true/false forces the branch.
|
|
1526
|
-
...
|
|
1547
|
+
...mergeIntent3(input)
|
|
1527
1548
|
};
|
|
1528
1549
|
if (input.action === "create") {
|
|
1529
1550
|
if (!input.baseId || !input.name) {
|
|
@@ -2692,9 +2713,15 @@ async function ask2(question) {
|
|
|
2692
2713
|
function openBrowser(url) {
|
|
2693
2714
|
const platform = process.platform;
|
|
2694
2715
|
const [command, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
2716
|
+
const reportFailure = () => {
|
|
2717
|
+
say2("Could not open a browser automatically. Open the URL above manually.");
|
|
2718
|
+
};
|
|
2695
2719
|
try {
|
|
2696
|
-
spawn(command, args, { stdio: "ignore", detached: true })
|
|
2720
|
+
const child = spawn(command, args, { stdio: "ignore", detached: true });
|
|
2721
|
+
child.once("error", reportFailure);
|
|
2722
|
+
child.unref();
|
|
2697
2723
|
} catch {
|
|
2724
|
+
reportFailure();
|
|
2698
2725
|
}
|
|
2699
2726
|
}
|
|
2700
2727
|
async function verifyAuth(baseUrl, token) {
|
|
@@ -3441,6 +3468,10 @@ var fieldChangeRequestInputSchema = z6.discriminatedUnion("operation", [
|
|
|
3441
3468
|
reorderFieldsChangeRequestInputSchema.extend({ operation: z6.literal("reorder"), ...withBaseId }),
|
|
3442
3469
|
restoreFieldChangeRequestInputSchema.extend({ operation: z6.literal("restore"), ...withBaseId })
|
|
3443
3470
|
]);
|
|
3471
|
+
var baseLifecycleChangeRequestInputSchema = z6.discriminatedUnion("operation", [
|
|
3472
|
+
archiveBaseInputSchema.extend({ operation: z6.literal("archive"), ...withBaseId }),
|
|
3473
|
+
restoreBaseInputSchema.extend({ operation: z6.literal("restore"), ...withBaseId })
|
|
3474
|
+
]);
|
|
3444
3475
|
|
|
3445
3476
|
// ../../packages/busabase-contract/src/domains/base/contract/view-schemas.ts
|
|
3446
3477
|
import { z as z8 } from "zod";
|
|
@@ -3875,6 +3906,19 @@ var listChangeRequestsResponseSchema = z7.object({
|
|
|
3875
3906
|
changeRequests: z7.array(changeRequestSchema),
|
|
3876
3907
|
nextCursor: z7.string().nullable()
|
|
3877
3908
|
});
|
|
3909
|
+
var listChangeRequestsPageInputSchema = z7.object({
|
|
3910
|
+
page: z7.coerce.number().int().min(1).optional().default(1),
|
|
3911
|
+
pageSize: z7.coerce.number().int().min(1).max(100).optional().default(50),
|
|
3912
|
+
status: z7.array(changeRequestStatusSchema).optional(),
|
|
3913
|
+
mine: z7.boolean().optional()
|
|
3914
|
+
}).optional().default({ page: 1, pageSize: 50 });
|
|
3915
|
+
var listChangeRequestsPageResponseSchema = z7.object({
|
|
3916
|
+
changeRequests: z7.array(changeRequestSchema),
|
|
3917
|
+
total: z7.number().int().nonnegative(),
|
|
3918
|
+
totalPages: z7.number().int().nonnegative(),
|
|
3919
|
+
page: z7.number().int().min(1),
|
|
3920
|
+
pageSize: z7.number().int().min(1).max(100)
|
|
3921
|
+
});
|
|
3878
3922
|
var changeRequestCountsSchema = z7.object({
|
|
3879
3923
|
review: z7.number().int().nonnegative(),
|
|
3880
3924
|
changes: z7.number().int().nonnegative(),
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "busa-cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Command-line client for the Busabase OpenAPI REST API. Talks to a local or remote `busabase server`. Short-name alias for busabase-cli.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/busabase/busabase/tree/main/apps/busabase-cli",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@zip.js/zip.js": "^2.8.20",
|
|
35
35
|
"busabase-package": "workspace:*",
|
|
36
|
-
"busabase-sdk": "0.11.
|
|
36
|
+
"busabase-sdk": "0.11.2",
|
|
37
37
|
"commander": "^14.0.0",
|
|
38
38
|
"tar-stream": "^3.1.7",
|
|
39
39
|
"yaml": "^2.9.0",
|