@base44-preview/cli 0.0.36-pr.355.fd88cd2 → 0.0.37-pr.357.020ced4
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/dist/cli/index.js +141 -50
- package/dist/cli/index.js.map +9 -8
- package/dist/deno-runtime/exec.js +28 -0
- package/dist/deno-runtime/exec.js.map +10 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -210244,7 +210244,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
210244
210244
|
});
|
|
210245
210245
|
module.exports = __toCommonJS(src_exports);
|
|
210246
210246
|
var import_promises19 = __require("node:fs/promises");
|
|
210247
|
-
var
|
|
210247
|
+
var import_node_fs20 = __require("node:fs");
|
|
210248
210248
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
210249
210249
|
var CURSOR2 = "cursor";
|
|
210250
210250
|
var CURSOR_CLI = "cursor-cli";
|
|
@@ -210301,7 +210301,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
210301
210301
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
210302
210302
|
}
|
|
210303
210303
|
try {
|
|
210304
|
-
await (0, import_promises19.access)(DEVIN_LOCAL_PATH,
|
|
210304
|
+
await (0, import_promises19.access)(DEVIN_LOCAL_PATH, import_node_fs20.constants.F_OK);
|
|
210305
210305
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
210306
210306
|
} catch (error48) {}
|
|
210307
210307
|
return { isAgent: false, agent: undefined };
|
|
@@ -225896,47 +225896,34 @@ function getTestOverrides() {
|
|
|
225896
225896
|
}
|
|
225897
225897
|
|
|
225898
225898
|
// src/core/clients/schemas.ts
|
|
225899
|
-
var ApiErrorResponseSchema = exports_external.
|
|
225900
|
-
|
|
225901
|
-
|
|
225902
|
-
detail: exports_external.union([
|
|
225903
|
-
exports_external.string(),
|
|
225904
|
-
exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
225905
|
-
exports_external.array(exports_external.unknown())
|
|
225906
|
-
]).nullable().optional(),
|
|
225907
|
-
traceback: exports_external.string().nullable().optional(),
|
|
225899
|
+
var ApiErrorResponseSchema = exports_external.looseObject({
|
|
225900
|
+
message: exports_external.unknown().optional(),
|
|
225901
|
+
detail: exports_external.unknown().optional(),
|
|
225908
225902
|
extra_data: exports_external.looseObject({
|
|
225909
|
-
reason: exports_external.string().optional(),
|
|
225910
|
-
errors: exports_external.array(exports_external.
|
|
225911
|
-
|
|
225912
|
-
exports_external.string()
|
|
225913
|
-
])).optional()
|
|
225914
|
-
}).optional().nullable()
|
|
225903
|
+
reason: exports_external.string().optional().catch(undefined),
|
|
225904
|
+
errors: exports_external.array(exports_external.looseObject({ name: exports_external.string(), message: exports_external.string() })).optional().catch(undefined)
|
|
225905
|
+
}).optional().nullable().catch(undefined)
|
|
225915
225906
|
});
|
|
225916
225907
|
|
|
225917
225908
|
// src/core/errors.ts
|
|
225918
|
-
function formatApiError(errorBody) {
|
|
225919
|
-
const
|
|
225920
|
-
if (
|
|
225921
|
-
const
|
|
225922
|
-
|
|
225923
|
-
if (typeof content === "string") {
|
|
225909
|
+
function formatApiError(errorBody, parsed) {
|
|
225910
|
+
const data = parsed ?? ApiErrorResponseSchema.safeParse(errorBody).data;
|
|
225911
|
+
if (data) {
|
|
225912
|
+
const content = data.message ?? data.detail;
|
|
225913
|
+
if (typeof content === "string")
|
|
225924
225914
|
return content;
|
|
225925
|
-
|
|
225926
|
-
if (content !== undefined) {
|
|
225915
|
+
if (content !== undefined)
|
|
225927
225916
|
return JSON.stringify(content, null, 2);
|
|
225928
|
-
}
|
|
225929
225917
|
}
|
|
225930
|
-
if (typeof errorBody === "string")
|
|
225918
|
+
if (typeof errorBody === "string")
|
|
225931
225919
|
return errorBody;
|
|
225932
|
-
}
|
|
225933
225920
|
return JSON.stringify(errorBody, null, 2);
|
|
225934
225921
|
}
|
|
225935
225922
|
function parseErrorDetails(extraData) {
|
|
225936
225923
|
const errors3 = extraData?.errors;
|
|
225937
225924
|
if (!errors3 || errors3.length === 0)
|
|
225938
225925
|
return;
|
|
225939
|
-
return errors3.map((
|
|
225926
|
+
return errors3.map((e2) => `${e2.name}: ${e2.message}`);
|
|
225940
225927
|
}
|
|
225941
225928
|
|
|
225942
225929
|
class CLIError extends Error {
|
|
@@ -226057,11 +226044,12 @@ class ApiError extends SystemError {
|
|
|
226057
226044
|
let details;
|
|
226058
226045
|
try {
|
|
226059
226046
|
responseBody = await error48.response.clone().json();
|
|
226060
|
-
message = formatApiError(responseBody);
|
|
226061
226047
|
const parsed = ApiErrorResponseSchema.safeParse(responseBody);
|
|
226062
|
-
|
|
226063
|
-
|
|
226064
|
-
|
|
226048
|
+
const parsedData = parsed.success ? parsed.data : undefined;
|
|
226049
|
+
message = formatApiError(responseBody, parsedData);
|
|
226050
|
+
if (parsedData) {
|
|
226051
|
+
hints = ApiError.getReasonHints(parsedData);
|
|
226052
|
+
details = parseErrorDetails(parsedData.extra_data);
|
|
226065
226053
|
}
|
|
226066
226054
|
} catch {
|
|
226067
226055
|
message = error48.message;
|
|
@@ -226132,7 +226120,7 @@ class ApiError extends SystemError {
|
|
|
226132
226120
|
}
|
|
226133
226121
|
]
|
|
226134
226122
|
};
|
|
226135
|
-
const reason = parsedResponse
|
|
226123
|
+
const reason = parsedResponse.extra_data?.reason;
|
|
226136
226124
|
if (typeof reason !== "string")
|
|
226137
226125
|
return;
|
|
226138
226126
|
return REASON_HINTS[reason];
|
|
@@ -233661,9 +233649,7 @@ async function readFunction(configPath) {
|
|
|
233661
233649
|
const entryPath = join5(functionDir, config5.entry);
|
|
233662
233650
|
if (!await pathExists(entryPath)) {
|
|
233663
233651
|
throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
|
|
233664
|
-
hints: [
|
|
233665
|
-
{ message: "Check the 'entry' field in your function config" }
|
|
233666
|
-
]
|
|
233652
|
+
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
233667
233653
|
});
|
|
233668
233654
|
}
|
|
233669
233655
|
const filePaths = await globby("*.{js,ts,json}", {
|
|
@@ -241548,7 +241534,7 @@ var {
|
|
|
241548
241534
|
// package.json
|
|
241549
241535
|
var package_default = {
|
|
241550
241536
|
name: "base44",
|
|
241551
|
-
version: "0.0.
|
|
241537
|
+
version: "0.0.37",
|
|
241552
241538
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
241553
241539
|
type: "module",
|
|
241554
241540
|
bin: {
|
|
@@ -241723,7 +241709,7 @@ function displayError(error48) {
|
|
|
241723
241709
|
R2.error(errorMessage);
|
|
241724
241710
|
if (isCLIError(error48)) {
|
|
241725
241711
|
if (error48.details.length > 0) {
|
|
241726
|
-
R2.
|
|
241712
|
+
R2.info(theme.format.details(error48.details));
|
|
241727
241713
|
}
|
|
241728
241714
|
const hints = theme.format.agentHints(error48.hints);
|
|
241729
241715
|
if (hints) {
|
|
@@ -244366,8 +244352,112 @@ function getDevCommand(context) {
|
|
|
244366
244352
|
});
|
|
244367
244353
|
}
|
|
244368
244354
|
|
|
244355
|
+
// src/cli/commands/exec.ts
|
|
244356
|
+
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
244357
|
+
import { unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
244358
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
244359
|
+
import { dirname as dirname12, join as join16, resolve as resolve6 } from "node:path";
|
|
244360
|
+
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
244361
|
+
var __dirname6 = dirname12(fileURLToPath8(import.meta.url));
|
|
244362
|
+
var EXEC_WRAPPER_PATH = join16(__dirname6, "../deno-runtime/exec.js");
|
|
244363
|
+
function verifyDenoIsInstalled() {
|
|
244364
|
+
const result = spawnSync3("deno", ["--version"]);
|
|
244365
|
+
if (result.error) {
|
|
244366
|
+
throw new DependencyNotFoundError("Deno is required to run scripts with exec", {
|
|
244367
|
+
hints: [
|
|
244368
|
+
{
|
|
244369
|
+
message: "Install Deno: https://docs.deno.com/runtime/getting-started/installation/"
|
|
244370
|
+
}
|
|
244371
|
+
]
|
|
244372
|
+
});
|
|
244373
|
+
}
|
|
244374
|
+
}
|
|
244375
|
+
function readStdin() {
|
|
244376
|
+
return new Promise((resolve7, reject) => {
|
|
244377
|
+
let data = "";
|
|
244378
|
+
process.stdin.setEncoding("utf-8");
|
|
244379
|
+
process.stdin.on("data", (chunk) => {
|
|
244380
|
+
data += chunk;
|
|
244381
|
+
});
|
|
244382
|
+
process.stdin.on("end", () => resolve7(data));
|
|
244383
|
+
process.stdin.on("error", reject);
|
|
244384
|
+
});
|
|
244385
|
+
}
|
|
244386
|
+
async function execAction(scriptArg, options8, extraArgs) {
|
|
244387
|
+
verifyDenoIsInstalled();
|
|
244388
|
+
let scriptPath;
|
|
244389
|
+
let tempFile = null;
|
|
244390
|
+
const isStdinPipe = !process.stdin.isTTY;
|
|
244391
|
+
const hasFile = scriptArg !== undefined;
|
|
244392
|
+
const hasEval = options8.eval !== undefined;
|
|
244393
|
+
const modeCount = [hasFile, hasEval, isStdinPipe].filter(Boolean).length;
|
|
244394
|
+
if (modeCount === 0) {
|
|
244395
|
+
throw new InvalidInputError("No script provided. Pass a file path, use -e for inline code, or pipe from stdin.", {
|
|
244396
|
+
hints: [
|
|
244397
|
+
{ message: "File: base44 exec ./script.ts" },
|
|
244398
|
+
{ message: 'Eval: base44 exec -e "console.log(1)"' },
|
|
244399
|
+
{ message: "Stdin: echo 'code' | base44 exec" }
|
|
244400
|
+
]
|
|
244401
|
+
});
|
|
244402
|
+
}
|
|
244403
|
+
if (modeCount > 1) {
|
|
244404
|
+
throw new InvalidInputError("Multiple input modes detected. Provide only one of: file path, -e flag, or stdin.");
|
|
244405
|
+
}
|
|
244406
|
+
if (hasFile) {
|
|
244407
|
+
scriptPath = `file://${resolve6(scriptArg)}`;
|
|
244408
|
+
} else {
|
|
244409
|
+
const code2 = hasEval ? options8.eval : await readStdin();
|
|
244410
|
+
tempFile = join16(tmpdir2(), `base44-exec-${Date.now()}.ts`);
|
|
244411
|
+
writeFileSync2(tempFile, code2, "utf-8");
|
|
244412
|
+
scriptPath = `file://${tempFile}`;
|
|
244413
|
+
}
|
|
244414
|
+
const appConfig = getAppConfig();
|
|
244415
|
+
let appUserToken;
|
|
244416
|
+
try {
|
|
244417
|
+
const response = await getAppClient().get("auth/token").json();
|
|
244418
|
+
appUserToken = response.token;
|
|
244419
|
+
} catch (error48) {
|
|
244420
|
+
throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
|
|
244421
|
+
}
|
|
244422
|
+
try {
|
|
244423
|
+
const exitCode = await new Promise((resolvePromise) => {
|
|
244424
|
+
const child = spawn3("deno", ["run", "--allow-all", EXEC_WRAPPER_PATH, ...extraArgs], {
|
|
244425
|
+
env: {
|
|
244426
|
+
...process.env,
|
|
244427
|
+
SCRIPT_PATH: scriptPath,
|
|
244428
|
+
BASE44_APP_ID: appConfig.id,
|
|
244429
|
+
BASE44_ACCESS_TOKEN: appUserToken,
|
|
244430
|
+
BASE44_API_URL: getBase44ApiUrl()
|
|
244431
|
+
},
|
|
244432
|
+
stdio: "inherit"
|
|
244433
|
+
});
|
|
244434
|
+
child.on("close", (code2) => {
|
|
244435
|
+
resolvePromise(code2 ?? 1);
|
|
244436
|
+
});
|
|
244437
|
+
});
|
|
244438
|
+
if (exitCode !== 0) {
|
|
244439
|
+
process.exitCode = exitCode;
|
|
244440
|
+
}
|
|
244441
|
+
} finally {
|
|
244442
|
+
if (tempFile) {
|
|
244443
|
+
try {
|
|
244444
|
+
unlinkSync(tempFile);
|
|
244445
|
+
} catch {}
|
|
244446
|
+
}
|
|
244447
|
+
}
|
|
244448
|
+
return {};
|
|
244449
|
+
}
|
|
244450
|
+
function getExecCommand(context) {
|
|
244451
|
+
const cmd = new Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").argument("[script]", "Path to a .ts or .js script file").option("-e, --eval <code>", "Evaluate inline code").allowUnknownOption(true).action(async (script, options8) => {
|
|
244452
|
+
const dashIndex = process.argv.indexOf("--");
|
|
244453
|
+
const extraArgs = dashIndex !== -1 ? process.argv.slice(dashIndex + 1) : [];
|
|
244454
|
+
await runCommand(() => execAction(script, options8, extraArgs), { requireAuth: true }, context);
|
|
244455
|
+
});
|
|
244456
|
+
return cmd;
|
|
244457
|
+
}
|
|
244458
|
+
|
|
244369
244459
|
// src/cli/commands/project/eject.ts
|
|
244370
|
-
import { resolve as
|
|
244460
|
+
import { resolve as resolve7 } from "node:path";
|
|
244371
244461
|
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
244372
244462
|
async function eject(options8) {
|
|
244373
244463
|
const projects = await listProjects();
|
|
@@ -244416,7 +244506,7 @@ async function eject(options8) {
|
|
|
244416
244506
|
Ne("Operation cancelled.");
|
|
244417
244507
|
throw new CLIExitError(0);
|
|
244418
244508
|
}
|
|
244419
|
-
const resolvedPath =
|
|
244509
|
+
const resolvedPath = resolve7(selectedPath);
|
|
244420
244510
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
244421
244511
|
await createProjectFilesForExistingProject({
|
|
244422
244512
|
projectId,
|
|
@@ -244479,9 +244569,10 @@ function createProgram(context) {
|
|
|
244479
244569
|
program2.addCommand(getAgentsCommand(context));
|
|
244480
244570
|
program2.addCommand(getConnectorsCommand(context));
|
|
244481
244571
|
program2.addCommand(getFunctionsDeployCommand(context));
|
|
244482
|
-
program2.addCommand(getSecretsCommand(context)
|
|
244572
|
+
program2.addCommand(getSecretsCommand(context));
|
|
244483
244573
|
program2.addCommand(getSiteCommand(context));
|
|
244484
244574
|
program2.addCommand(getTypesCommand(context));
|
|
244575
|
+
program2.addCommand(getExecCommand(context));
|
|
244485
244576
|
program2.addCommand(getDevCommand(context), { hidden: true });
|
|
244486
244577
|
program2.addCommand(getLogsCommand(context), { hidden: true });
|
|
244487
244578
|
return program2;
|
|
@@ -244492,7 +244583,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
244492
244583
|
import { release, type } from "node:os";
|
|
244493
244584
|
|
|
244494
244585
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
244495
|
-
import { dirname as
|
|
244586
|
+
import { dirname as dirname13, posix, sep } from "path";
|
|
244496
244587
|
function createModulerModifier() {
|
|
244497
244588
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
244498
244589
|
return async (frames) => {
|
|
@@ -244501,7 +244592,7 @@ function createModulerModifier() {
|
|
|
244501
244592
|
return frames;
|
|
244502
244593
|
};
|
|
244503
244594
|
}
|
|
244504
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
244595
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname13(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
244505
244596
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
244506
244597
|
return (filename) => {
|
|
244507
244598
|
if (!filename)
|
|
@@ -246779,14 +246870,14 @@ async function addSourceContext(frames) {
|
|
|
246779
246870
|
return frames;
|
|
246780
246871
|
}
|
|
246781
246872
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
246782
|
-
return new Promise((
|
|
246873
|
+
return new Promise((resolve8) => {
|
|
246783
246874
|
const stream = createReadStream2(path19);
|
|
246784
246875
|
const lineReaded = createInterface2({
|
|
246785
246876
|
input: stream
|
|
246786
246877
|
});
|
|
246787
246878
|
function destroyStreamAndResolve() {
|
|
246788
246879
|
stream.destroy();
|
|
246789
|
-
|
|
246880
|
+
resolve8();
|
|
246790
246881
|
}
|
|
246791
246882
|
let lineNumber = 0;
|
|
246792
246883
|
let currentRangeIndex = 0;
|
|
@@ -247898,15 +247989,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
247898
247989
|
return true;
|
|
247899
247990
|
if (this.featureFlagsPoller === undefined)
|
|
247900
247991
|
return false;
|
|
247901
|
-
return new Promise((
|
|
247992
|
+
return new Promise((resolve8) => {
|
|
247902
247993
|
const timeout3 = setTimeout(() => {
|
|
247903
247994
|
cleanup();
|
|
247904
|
-
|
|
247995
|
+
resolve8(false);
|
|
247905
247996
|
}, timeoutMs);
|
|
247906
247997
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
247907
247998
|
clearTimeout(timeout3);
|
|
247908
247999
|
cleanup();
|
|
247909
|
-
|
|
248000
|
+
resolve8(count2 > 0);
|
|
247910
248001
|
});
|
|
247911
248002
|
});
|
|
247912
248003
|
}
|
|
@@ -248719,4 +248810,4 @@ export {
|
|
|
248719
248810
|
CLIExitError
|
|
248720
248811
|
};
|
|
248721
248812
|
|
|
248722
|
-
//# debugId=
|
|
248813
|
+
//# debugId=2C074684B8F8F66564756E2164756E21
|