@base44-preview/cli 0.0.15-pr.96.cd454a5 → 0.0.15-pr.97.3ad42c9
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 +140 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4547,6 +4547,7 @@ const string$1 = (params) => {
|
|
|
4547
4547
|
};
|
|
4548
4548
|
const integer = /^-?\d+$/;
|
|
4549
4549
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
4550
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
4550
4551
|
const lowercase = /^[^A-Z]*$/;
|
|
4551
4552
|
const uppercase = /^[^a-z]*$/;
|
|
4552
4553
|
|
|
@@ -5325,6 +5326,24 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
|
|
|
5325
5326
|
$ZodCheckNumberFormat.init(inst, def);
|
|
5326
5327
|
$ZodNumber.init(inst, def);
|
|
5327
5328
|
});
|
|
5329
|
+
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
5330
|
+
$ZodType.init(inst, def);
|
|
5331
|
+
inst._zod.pattern = boolean$1;
|
|
5332
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
5333
|
+
if (def.coerce) try {
|
|
5334
|
+
payload.value = Boolean(payload.value);
|
|
5335
|
+
} catch (_$2) {}
|
|
5336
|
+
const input = payload.value;
|
|
5337
|
+
if (typeof input === "boolean") return payload;
|
|
5338
|
+
payload.issues.push({
|
|
5339
|
+
expected: "boolean",
|
|
5340
|
+
code: "invalid_type",
|
|
5341
|
+
input,
|
|
5342
|
+
inst
|
|
5343
|
+
});
|
|
5344
|
+
return payload;
|
|
5345
|
+
};
|
|
5346
|
+
});
|
|
5328
5347
|
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
5329
5348
|
$ZodType.init(inst, def);
|
|
5330
5349
|
inst._zod.parse = (payload) => payload;
|
|
@@ -6379,6 +6398,13 @@ function _int(Class, params) {
|
|
|
6379
6398
|
});
|
|
6380
6399
|
}
|
|
6381
6400
|
/* @__NO_SIDE_EFFECTS__ */
|
|
6401
|
+
function _boolean(Class, params) {
|
|
6402
|
+
return new Class({
|
|
6403
|
+
type: "boolean",
|
|
6404
|
+
...normalizeParams(params)
|
|
6405
|
+
});
|
|
6406
|
+
}
|
|
6407
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6382
6408
|
function _unknown(Class) {
|
|
6383
6409
|
return new Class({ type: "unknown" });
|
|
6384
6410
|
}
|
|
@@ -6949,6 +6975,9 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
6949
6975
|
}
|
|
6950
6976
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
6951
6977
|
};
|
|
6978
|
+
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
6979
|
+
json.type = "boolean";
|
|
6980
|
+
};
|
|
6952
6981
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
6953
6982
|
json.not = {};
|
|
6954
6983
|
};
|
|
@@ -7472,6 +7501,14 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
|
|
|
7472
7501
|
function int(params) {
|
|
7473
7502
|
return _int(ZodNumberFormat, params);
|
|
7474
7503
|
}
|
|
7504
|
+
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
7505
|
+
$ZodBoolean.init(inst, def);
|
|
7506
|
+
ZodType.init(inst, def);
|
|
7507
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
7508
|
+
});
|
|
7509
|
+
function boolean(params) {
|
|
7510
|
+
return _boolean(ZodBoolean, params);
|
|
7511
|
+
}
|
|
7475
7512
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7476
7513
|
$ZodUnknown.init(inst, def);
|
|
7477
7514
|
ZodType.init(inst, def);
|
|
@@ -16669,6 +16706,12 @@ const ProjectConfigSchema = object({
|
|
|
16669
16706
|
});
|
|
16670
16707
|
const AppConfigSchema = object({ id: string().min(1, "id cannot be empty") });
|
|
16671
16708
|
const CreateProjectResponseSchema = looseObject({ id: string() });
|
|
16709
|
+
const AppSchema = looseObject({
|
|
16710
|
+
id: string(),
|
|
16711
|
+
name: string(),
|
|
16712
|
+
is_managed_source_code: boolean().optional()
|
|
16713
|
+
});
|
|
16714
|
+
const AppsResponseSchema = array(AppSchema);
|
|
16672
16715
|
|
|
16673
16716
|
//#endregion
|
|
16674
16717
|
//#region src/core/project/config.ts
|
|
@@ -16753,6 +16796,13 @@ async function createProject(projectName, description) {
|
|
|
16753
16796
|
} });
|
|
16754
16797
|
return { projectId: CreateProjectResponseSchema.parse(await response.json()).id };
|
|
16755
16798
|
}
|
|
16799
|
+
async function fetchApps() {
|
|
16800
|
+
const response = await base44Client.get("api/apps");
|
|
16801
|
+
return AppsResponseSchema.parse(await response.json());
|
|
16802
|
+
}
|
|
16803
|
+
async function fetchLinkableApps() {
|
|
16804
|
+
return (await fetchApps()).filter((app) => app.is_managed_source_code === false);
|
|
16805
|
+
}
|
|
16756
16806
|
|
|
16757
16807
|
//#endregion
|
|
16758
16808
|
//#region node_modules/ejs/lib/utils.js
|
|
@@ -38706,20 +38756,33 @@ const deployCommand = new Command("deploy").description("Deploy all project reso
|
|
|
38706
38756
|
//#endregion
|
|
38707
38757
|
//#region src/cli/commands/project/link.ts
|
|
38708
38758
|
function validateNonInteractiveFlags(command) {
|
|
38709
|
-
const { create: create$1, name: name$1 } = command.opts();
|
|
38759
|
+
const { create: create$1, existing, name: name$1 } = command.opts();
|
|
38760
|
+
if (create$1 && existing) command.error("--create and --existing cannot be used together");
|
|
38710
38761
|
if (create$1 && !name$1) command.error("--name is required when using --create");
|
|
38711
38762
|
}
|
|
38712
|
-
async function
|
|
38763
|
+
async function promptForLinkAction(linkableApps) {
|
|
38713
38764
|
const actionOptions = [{
|
|
38714
38765
|
value: "create",
|
|
38715
38766
|
label: "Create a new project",
|
|
38716
38767
|
hint: "Create a new Base44 project and link it"
|
|
38717
38768
|
}];
|
|
38769
|
+
if (linkableApps.length > 0) actionOptions.push({
|
|
38770
|
+
value: "choose",
|
|
38771
|
+
label: "Link an existing project",
|
|
38772
|
+
hint: `Choose from ${linkableApps.length} available project${linkableApps.length === 1 ? "" : "s"}`
|
|
38773
|
+
});
|
|
38774
|
+
const action = await ve({
|
|
38775
|
+
message: "How would you like to link this project?",
|
|
38776
|
+
options: actionOptions
|
|
38777
|
+
});
|
|
38778
|
+
if (pD(action)) {
|
|
38779
|
+
xe("Operation cancelled.");
|
|
38780
|
+
process.exit(0);
|
|
38781
|
+
}
|
|
38782
|
+
return action;
|
|
38783
|
+
}
|
|
38784
|
+
async function promptForNewProjectDetails() {
|
|
38718
38785
|
const result = await Ce({
|
|
38719
|
-
action: () => ve({
|
|
38720
|
-
message: "How would you like to link this project?",
|
|
38721
|
-
options: actionOptions
|
|
38722
|
-
}),
|
|
38723
38786
|
name: () => {
|
|
38724
38787
|
return he({
|
|
38725
38788
|
message: "What is the name of your project?",
|
|
@@ -38739,14 +38802,80 @@ async function promptForProjectDetails() {
|
|
|
38739
38802
|
description: result.description ? result.description.trim() : void 0
|
|
38740
38803
|
};
|
|
38741
38804
|
}
|
|
38805
|
+
async function promptForExistingApp(linkableApps) {
|
|
38806
|
+
const selectedApp = await ve({
|
|
38807
|
+
message: "Choose a project to link",
|
|
38808
|
+
options: linkableApps.map((app) => ({
|
|
38809
|
+
value: app,
|
|
38810
|
+
label: app.name
|
|
38811
|
+
}))
|
|
38812
|
+
});
|
|
38813
|
+
if (pD(selectedApp)) {
|
|
38814
|
+
xe("Operation cancelled.");
|
|
38815
|
+
process.exit(0);
|
|
38816
|
+
}
|
|
38817
|
+
return selectedApp;
|
|
38818
|
+
}
|
|
38742
38819
|
async function link(options) {
|
|
38743
38820
|
const projectRoot = await findProjectRoot();
|
|
38744
38821
|
if (!projectRoot) throw new Error("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
38745
38822
|
if (await appConfigExists(projectRoot.root)) throw new Error("Project is already linked. An .app.jsonc file with the appId already exists.");
|
|
38746
|
-
|
|
38747
|
-
|
|
38748
|
-
|
|
38749
|
-
|
|
38823
|
+
if (options.existing) {
|
|
38824
|
+
const app = (await runTask("Validating project...", async () => fetchApps(), {
|
|
38825
|
+
successMessage: "Project validated",
|
|
38826
|
+
errorMessage: "Failed to validate project"
|
|
38827
|
+
})).find((a$1) => a$1.id === options.existing);
|
|
38828
|
+
if (!app) throw new Error(`Project with ID "${options.existing}" not found. Please check the ID and try again.`);
|
|
38829
|
+
if (app.is_managed_source_code === true) throw new Error(`Project "${app.name}" is managed by Base44 AI and cannot be linked to external source code.`);
|
|
38830
|
+
await runTask("Linking project...", async () => {
|
|
38831
|
+
await writeAppConfig(projectRoot.root, options.existing);
|
|
38832
|
+
setAppConfig({
|
|
38833
|
+
id: options.existing,
|
|
38834
|
+
projectRoot: projectRoot.root
|
|
38835
|
+
});
|
|
38836
|
+
}, {
|
|
38837
|
+
successMessage: "Project linked successfully",
|
|
38838
|
+
errorMessage: "Failed to link project"
|
|
38839
|
+
});
|
|
38840
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(options.existing))}`);
|
|
38841
|
+
return { outroMessage: "Project linked" };
|
|
38842
|
+
}
|
|
38843
|
+
if (options.create) {
|
|
38844
|
+
const { projectId: projectId$1 } = await runTask("Creating project on Base44...", async () => {
|
|
38845
|
+
return await createProject(options.name.trim(), options.description?.trim());
|
|
38846
|
+
}, {
|
|
38847
|
+
successMessage: "Project created successfully",
|
|
38848
|
+
errorMessage: "Failed to create project"
|
|
38849
|
+
});
|
|
38850
|
+
await writeAppConfig(projectRoot.root, projectId$1);
|
|
38851
|
+
setAppConfig({
|
|
38852
|
+
id: projectId$1,
|
|
38853
|
+
projectRoot: projectRoot.root
|
|
38854
|
+
});
|
|
38855
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId$1))}`);
|
|
38856
|
+
return { outroMessage: "Project linked" };
|
|
38857
|
+
}
|
|
38858
|
+
const linkableApps = await runTask("Fetching your projects...", async () => fetchLinkableApps(), {
|
|
38859
|
+
successMessage: "Fetched projects",
|
|
38860
|
+
errorMessage: "Failed to fetch projects"
|
|
38861
|
+
});
|
|
38862
|
+
if (linkableApps.length > 0) M.info(`Found ${theme.colors.base44Orange(String(linkableApps.length))} project${linkableApps.length === 1 ? "" : "s"} available for linking`);
|
|
38863
|
+
if (await promptForLinkAction(linkableApps) === "choose") {
|
|
38864
|
+
const selectedApp = await promptForExistingApp(linkableApps);
|
|
38865
|
+
await runTask("Linking project...", async () => {
|
|
38866
|
+
await writeAppConfig(projectRoot.root, selectedApp.id);
|
|
38867
|
+
setAppConfig({
|
|
38868
|
+
id: selectedApp.id,
|
|
38869
|
+
projectRoot: projectRoot.root
|
|
38870
|
+
});
|
|
38871
|
+
}, {
|
|
38872
|
+
successMessage: "Project linked successfully",
|
|
38873
|
+
errorMessage: "Failed to link project"
|
|
38874
|
+
});
|
|
38875
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(selectedApp.id))}`);
|
|
38876
|
+
return { outroMessage: "Project linked" };
|
|
38877
|
+
}
|
|
38878
|
+
const { name: name$1, description } = await promptForNewProjectDetails();
|
|
38750
38879
|
const { projectId } = await runTask("Creating project on Base44...", async () => {
|
|
38751
38880
|
return await createProject(name$1, description);
|
|
38752
38881
|
}, {
|
|
@@ -38761,7 +38890,7 @@ async function link(options) {
|
|
|
38761
38890
|
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38762
38891
|
return { outroMessage: "Project linked" };
|
|
38763
38892
|
}
|
|
38764
|
-
const linkCommand = new Command("link").description("Link a local project to a Base44 project").option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").hook("preAction", validateNonInteractiveFlags).action(async (options) => {
|
|
38893
|
+
const linkCommand = new Command("link").description("Link a local project to a Base44 project (create new or link existing)").option("-c, --create", "Create a new project (skip selection prompt)").option("-e, --existing <id>", "Link to an existing project by ID (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").hook("preAction", validateNonInteractiveFlags).action(async (options) => {
|
|
38765
38894
|
await runCommand(() => link(options), {
|
|
38766
38895
|
requireAuth: true,
|
|
38767
38896
|
requireAppConfig: false
|
package/package.json
CHANGED