@base44-preview/cli 0.0.15-pr.95.fef9307 → 0.0.15-pr.97.dfea5ba
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 +125 -37
- 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
|
+
has_source_code: boolean()
|
|
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.has_source_code);
|
|
16805
|
+
}
|
|
16756
16806
|
|
|
16757
16807
|
//#endregion
|
|
16758
16808
|
//#region node_modules/ejs/lib/utils.js
|
|
@@ -38042,7 +38092,6 @@ async function createInteractive(options) {
|
|
|
38042
38092
|
description: result.description || void 0,
|
|
38043
38093
|
projectPath: result.projectPath,
|
|
38044
38094
|
deploy: options.deploy,
|
|
38045
|
-
skills: options.skills,
|
|
38046
38095
|
isInteractive: true
|
|
38047
38096
|
});
|
|
38048
38097
|
}
|
|
@@ -38053,11 +38102,10 @@ async function createNonInteractive(options) {
|
|
|
38053
38102
|
description: options.description,
|
|
38054
38103
|
projectPath: options.path,
|
|
38055
38104
|
deploy: options.deploy,
|
|
38056
|
-
skills: options.skills,
|
|
38057
38105
|
isInteractive: false
|
|
38058
38106
|
});
|
|
38059
38107
|
}
|
|
38060
|
-
async function executeCreate({ template, name: rawName, description, projectPath, deploy,
|
|
38108
|
+
async function executeCreate({ template, name: rawName, description, projectPath, deploy, isInteractive }) {
|
|
38061
38109
|
const name$1 = rawName.trim();
|
|
38062
38110
|
const resolvedPath = resolve(projectPath);
|
|
38063
38111
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
@@ -38075,28 +38123,6 @@ async function executeCreate({ template, name: rawName, description, projectPath
|
|
|
38075
38123
|
id: projectId,
|
|
38076
38124
|
projectRoot: resolvedPath
|
|
38077
38125
|
});
|
|
38078
|
-
let shouldAddSkills;
|
|
38079
|
-
if (isInteractive) {
|
|
38080
|
-
const result = await ye({ message: "Add AI agent skills? (Helps AI assistants like Cursor, Claude Code work with Base44)" });
|
|
38081
|
-
shouldAddSkills = !pD(result) && result;
|
|
38082
|
-
} else shouldAddSkills = !!skills;
|
|
38083
|
-
if (shouldAddSkills) if (isInteractive) {
|
|
38084
|
-
M.message("Installing AI agent skills...");
|
|
38085
|
-
await execa({
|
|
38086
|
-
cwd: resolvedPath,
|
|
38087
|
-
shell: true,
|
|
38088
|
-
stdio: "inherit"
|
|
38089
|
-
})`npx add-skill base44/skills`;
|
|
38090
|
-
M.message(theme.colors.base44Orange("AI agent skills added successfully"));
|
|
38091
|
-
} else await runTask("Adding AI agent skills...", async () => {
|
|
38092
|
-
await execa({
|
|
38093
|
-
cwd: resolvedPath,
|
|
38094
|
-
shell: true
|
|
38095
|
-
})`npx -y add-skill base44/skills`;
|
|
38096
|
-
}, {
|
|
38097
|
-
successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
|
|
38098
|
-
errorMessage: "Failed to add AI agent skills"
|
|
38099
|
-
});
|
|
38100
38126
|
const { project, entities } = await readProjectConfig(resolvedPath);
|
|
38101
38127
|
let finalAppUrl;
|
|
38102
38128
|
if (entities.length > 0) {
|
|
@@ -38144,7 +38170,7 @@ async function executeCreate({ template, name: rawName, description, projectPath
|
|
|
38144
38170
|
if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
38145
38171
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
38146
38172
|
}
|
|
38147
|
-
const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").
|
|
38173
|
+
const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
|
|
38148
38174
|
await chooseCreate(options);
|
|
38149
38175
|
});
|
|
38150
38176
|
|
|
@@ -38730,20 +38756,33 @@ const deployCommand = new Command("deploy").description("Deploy all project reso
|
|
|
38730
38756
|
//#endregion
|
|
38731
38757
|
//#region src/cli/commands/project/link.ts
|
|
38732
38758
|
function validateNonInteractiveFlags(command) {
|
|
38733
|
-
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");
|
|
38734
38761
|
if (create$1 && !name$1) command.error("--name is required when using --create");
|
|
38735
38762
|
}
|
|
38736
|
-
async function
|
|
38763
|
+
async function promptForLinkAction(linkableApps) {
|
|
38737
38764
|
const actionOptions = [{
|
|
38738
38765
|
value: "create",
|
|
38739
38766
|
label: "Create a new project",
|
|
38740
38767
|
hint: "Create a new Base44 project and link it"
|
|
38741
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() {
|
|
38742
38785
|
const result = await Ce({
|
|
38743
|
-
action: () => ve({
|
|
38744
|
-
message: "How would you like to link this project?",
|
|
38745
|
-
options: actionOptions
|
|
38746
|
-
}),
|
|
38747
38786
|
name: () => {
|
|
38748
38787
|
return he({
|
|
38749
38788
|
message: "What is the name of your project?",
|
|
@@ -38763,14 +38802,63 @@ async function promptForProjectDetails() {
|
|
|
38763
38802
|
description: result.description ? result.description.trim() : void 0
|
|
38764
38803
|
};
|
|
38765
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
|
+
}
|
|
38766
38819
|
async function link(options) {
|
|
38767
38820
|
const projectRoot = await findProjectRoot();
|
|
38768
38821
|
if (!projectRoot) throw new Error("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
38769
38822
|
if (await appConfigExists(projectRoot.root)) throw new Error("Project is already linked. An .app.jsonc file with the appId already exists.");
|
|
38770
|
-
|
|
38771
|
-
|
|
38772
|
-
|
|
38773
|
-
|
|
38823
|
+
if (options.existing) {
|
|
38824
|
+
await writeAppConfig(projectRoot.root, options.existing);
|
|
38825
|
+
setAppConfig({
|
|
38826
|
+
id: options.existing,
|
|
38827
|
+
projectRoot: projectRoot.root
|
|
38828
|
+
});
|
|
38829
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(options.existing))}`);
|
|
38830
|
+
return { outroMessage: "Project linked" };
|
|
38831
|
+
}
|
|
38832
|
+
if (options.create) {
|
|
38833
|
+
const { projectId: projectId$1 } = await runTask("Creating project on Base44...", async () => {
|
|
38834
|
+
return await createProject(options.name.trim(), options.description?.trim());
|
|
38835
|
+
}, {
|
|
38836
|
+
successMessage: "Project created successfully",
|
|
38837
|
+
errorMessage: "Failed to create project"
|
|
38838
|
+
});
|
|
38839
|
+
await writeAppConfig(projectRoot.root, projectId$1);
|
|
38840
|
+
setAppConfig({
|
|
38841
|
+
id: projectId$1,
|
|
38842
|
+
projectRoot: projectRoot.root
|
|
38843
|
+
});
|
|
38844
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId$1))}`);
|
|
38845
|
+
return { outroMessage: "Project linked" };
|
|
38846
|
+
}
|
|
38847
|
+
const linkableApps = await runTask("Fetching your projects...", async () => fetchLinkableApps(), {
|
|
38848
|
+
successMessage: `Found ${theme.colors.base44Orange("projects")} available for linking`,
|
|
38849
|
+
errorMessage: "Failed to fetch projects"
|
|
38850
|
+
});
|
|
38851
|
+
if (await promptForLinkAction(linkableApps) === "choose") {
|
|
38852
|
+
const selectedApp = await promptForExistingApp(linkableApps);
|
|
38853
|
+
await writeAppConfig(projectRoot.root, selectedApp.id);
|
|
38854
|
+
setAppConfig({
|
|
38855
|
+
id: selectedApp.id,
|
|
38856
|
+
projectRoot: projectRoot.root
|
|
38857
|
+
});
|
|
38858
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(selectedApp.id))}`);
|
|
38859
|
+
return { outroMessage: "Project linked" };
|
|
38860
|
+
}
|
|
38861
|
+
const { name: name$1, description } = await promptForNewProjectDetails();
|
|
38774
38862
|
const { projectId } = await runTask("Creating project on Base44...", async () => {
|
|
38775
38863
|
return await createProject(name$1, description);
|
|
38776
38864
|
}, {
|
|
@@ -38785,7 +38873,7 @@ async function link(options) {
|
|
|
38785
38873
|
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38786
38874
|
return { outroMessage: "Project linked" };
|
|
38787
38875
|
}
|
|
38788
|
-
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) => {
|
|
38876
|
+
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("-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) => {
|
|
38789
38877
|
await runCommand(() => link(options), {
|
|
38790
38878
|
requireAuth: true,
|
|
38791
38879
|
requireAppConfig: false
|
package/package.json
CHANGED