@base44-preview/cli 0.0.45-pr.425.a892fc8 → 0.0.45-pr.425.c43f1ad
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 +207 -217
- package/dist/cli/index.js.map +35 -35
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -238804,14 +238804,14 @@ async function getUserInfo(accessToken) {
|
|
|
238804
238804
|
return result.data;
|
|
238805
238805
|
}
|
|
238806
238806
|
// src/cli/commands/auth/login-flow.ts
|
|
238807
|
-
async function generateAndDisplayDeviceCode(
|
|
238807
|
+
async function generateAndDisplayDeviceCode(log) {
|
|
238808
238808
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
238809
238809
|
return await generateDeviceCode();
|
|
238810
238810
|
}, {
|
|
238811
238811
|
successMessage: "Device code generated",
|
|
238812
238812
|
errorMessage: "Failed to generate device code"
|
|
238813
238813
|
});
|
|
238814
|
-
|
|
238814
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
238815
238815
|
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
238816
238816
|
return deviceCodeResponse;
|
|
238817
238817
|
}
|
|
@@ -238855,8 +238855,8 @@ async function saveAuthData(response, userInfo) {
|
|
|
238855
238855
|
name: userInfo.name
|
|
238856
238856
|
});
|
|
238857
238857
|
}
|
|
238858
|
-
async function login(
|
|
238859
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode(
|
|
238858
|
+
async function login({ log }) {
|
|
238859
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log);
|
|
238860
238860
|
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval);
|
|
238861
238861
|
const userInfo = await getUserInfo(token.accessToken);
|
|
238862
238862
|
await saveAuthData(token, userInfo);
|
|
@@ -238866,22 +238866,22 @@ async function login(logger) {
|
|
|
238866
238866
|
}
|
|
238867
238867
|
|
|
238868
238868
|
// src/cli/utils/command/middleware.ts
|
|
238869
|
-
async function ensureAuth(
|
|
238869
|
+
async function ensureAuth(ctx) {
|
|
238870
238870
|
const loggedIn = await isLoggedIn();
|
|
238871
238871
|
if (!loggedIn) {
|
|
238872
|
-
|
|
238873
|
-
await login(
|
|
238872
|
+
ctx.log.info("You need to login first to continue.");
|
|
238873
|
+
await login(ctx);
|
|
238874
238874
|
}
|
|
238875
238875
|
try {
|
|
238876
238876
|
const userInfo = await readAuth();
|
|
238877
|
-
errorReporter.setContext({
|
|
238877
|
+
ctx.errorReporter.setContext({
|
|
238878
238878
|
user: { email: userInfo.email, name: userInfo.name }
|
|
238879
238879
|
});
|
|
238880
238880
|
} catch {}
|
|
238881
238881
|
}
|
|
238882
|
-
async function ensureAppConfig(
|
|
238882
|
+
async function ensureAppConfig(ctx) {
|
|
238883
238883
|
const appConfig = await initAppConfig();
|
|
238884
|
-
errorReporter.setContext({ appId: appConfig.id });
|
|
238884
|
+
ctx.errorReporter.setContext({ appId: appConfig.id });
|
|
238885
238885
|
}
|
|
238886
238886
|
|
|
238887
238887
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -246611,12 +246611,6 @@ class Base44Command extends Command {
|
|
|
246611
246611
|
setContext(context) {
|
|
246612
246612
|
this._context = context;
|
|
246613
246613
|
}
|
|
246614
|
-
get isNonInteractive() {
|
|
246615
|
-
return this._context?.isNonInteractive ?? false;
|
|
246616
|
-
}
|
|
246617
|
-
get logger() {
|
|
246618
|
-
return this.context.logger;
|
|
246619
|
-
}
|
|
246620
246614
|
get context() {
|
|
246621
246615
|
if (!this._context) {
|
|
246622
246616
|
throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
|
|
@@ -246632,12 +246626,12 @@ class Base44Command extends Command {
|
|
|
246632
246626
|
const upgradeCheckPromise = startUpgradeCheck();
|
|
246633
246627
|
try {
|
|
246634
246628
|
if (this._commandOptions.requireAuth) {
|
|
246635
|
-
await ensureAuth(this.context
|
|
246629
|
+
await ensureAuth(this.context);
|
|
246636
246630
|
}
|
|
246637
246631
|
if (this._commandOptions.requireAppConfig) {
|
|
246638
|
-
await ensureAppConfig(this.context
|
|
246632
|
+
await ensureAppConfig(this.context);
|
|
246639
246633
|
}
|
|
246640
|
-
const result = await fn(...args) ?? {};
|
|
246634
|
+
const result = await fn(this.context, ...args) ?? {};
|
|
246641
246635
|
if (!quiet) {
|
|
246642
246636
|
await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
|
|
246643
246637
|
} else {
|
|
@@ -246879,7 +246873,9 @@ async function parseEnvFile(filePath) {
|
|
|
246879
246873
|
return import_dotenv.parse(content);
|
|
246880
246874
|
}
|
|
246881
246875
|
// src/cli/commands/agents/pull.ts
|
|
246882
|
-
async function pullAgentsAction(
|
|
246876
|
+
async function pullAgentsAction({
|
|
246877
|
+
log
|
|
246878
|
+
}) {
|
|
246883
246879
|
const { project: project2 } = await readProjectConfig();
|
|
246884
246880
|
const configDir = dirname7(project2.configPath);
|
|
246885
246881
|
const agentsDir = join11(configDir, project2.agentsDir);
|
|
@@ -246896,26 +246892,28 @@ async function pullAgentsAction(logger2) {
|
|
|
246896
246892
|
errorMessage: "Failed to sync agent files"
|
|
246897
246893
|
});
|
|
246898
246894
|
if (written.length > 0) {
|
|
246899
|
-
|
|
246895
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
246900
246896
|
}
|
|
246901
246897
|
if (deleted.length > 0) {
|
|
246902
|
-
|
|
246898
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
246903
246899
|
}
|
|
246904
246900
|
if (written.length === 0 && deleted.length === 0) {
|
|
246905
|
-
|
|
246901
|
+
log.info("All agents are already up to date");
|
|
246906
246902
|
}
|
|
246907
246903
|
return {
|
|
246908
246904
|
outroMessage: `Pulled ${remoteAgents.total} agents to ${agentsDir}`
|
|
246909
246905
|
};
|
|
246910
246906
|
}
|
|
246911
246907
|
function getAgentsPullCommand() {
|
|
246912
|
-
return new Base44Command("pull").description("Pull agents from Base44 to local files (replaces all local agent configs)").action(
|
|
246908
|
+
return new Base44Command("pull").description("Pull agents from Base44 to local files (replaces all local agent configs)").action(pullAgentsAction);
|
|
246913
246909
|
}
|
|
246914
246910
|
|
|
246915
246911
|
// src/cli/commands/agents/push.ts
|
|
246916
|
-
async function pushAgentsAction(
|
|
246912
|
+
async function pushAgentsAction({
|
|
246913
|
+
log
|
|
246914
|
+
}) {
|
|
246917
246915
|
const { agents } = await readProjectConfig();
|
|
246918
|
-
|
|
246916
|
+
log.info(agents.length === 0 ? "No local agents found - this will delete all remote agents" : `Found ${agents.length} agents to push`);
|
|
246919
246917
|
const result = await runTask("Pushing agents to Base44", async () => {
|
|
246920
246918
|
return await pushAgents(agents);
|
|
246921
246919
|
}, {
|
|
@@ -246923,18 +246921,18 @@ async function pushAgentsAction(logger2) {
|
|
|
246923
246921
|
errorMessage: "Failed to push agents"
|
|
246924
246922
|
});
|
|
246925
246923
|
if (result.created.length > 0) {
|
|
246926
|
-
|
|
246924
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
246927
246925
|
}
|
|
246928
246926
|
if (result.updated.length > 0) {
|
|
246929
|
-
|
|
246927
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
246930
246928
|
}
|
|
246931
246929
|
if (result.deleted.length > 0) {
|
|
246932
|
-
|
|
246930
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
246933
246931
|
}
|
|
246934
246932
|
return { outroMessage: "Agents pushed to Base44" };
|
|
246935
246933
|
}
|
|
246936
246934
|
function getAgentsPushCommand() {
|
|
246937
|
-
return new Base44Command("push").description("Push local agents to Base44 (replaces all remote agent configs)").action(
|
|
246935
|
+
return new Base44Command("push").description("Push local agents to Base44 (replaces all remote agent configs)").action(pushAgentsAction);
|
|
246938
246936
|
}
|
|
246939
246937
|
|
|
246940
246938
|
// src/cli/commands/agents/index.ts
|
|
@@ -246947,11 +246945,11 @@ function getLoginCommand() {
|
|
|
246947
246945
|
return new Base44Command("login", {
|
|
246948
246946
|
requireAuth: false,
|
|
246949
246947
|
requireAppConfig: false
|
|
246950
|
-
}).description("Authenticate with Base44").action(
|
|
246948
|
+
}).description("Authenticate with Base44").action(login);
|
|
246951
246949
|
}
|
|
246952
246950
|
|
|
246953
246951
|
// src/cli/commands/auth/logout.ts
|
|
246954
|
-
async function logout() {
|
|
246952
|
+
async function logout(_ctx) {
|
|
246955
246953
|
await deleteAuth();
|
|
246956
246954
|
return { outroMessage: "Logged out successfully" };
|
|
246957
246955
|
}
|
|
@@ -246963,7 +246961,7 @@ function getLogoutCommand() {
|
|
|
246963
246961
|
}
|
|
246964
246962
|
|
|
246965
246963
|
// src/cli/commands/auth/whoami.ts
|
|
246966
|
-
async function whoami() {
|
|
246964
|
+
async function whoami(_ctx) {
|
|
246967
246965
|
const auth2 = await readAuth();
|
|
246968
246966
|
return { outroMessage: `Logged in as: ${theme.styles.bold(auth2.email)}` };
|
|
246969
246967
|
}
|
|
@@ -246972,7 +246970,9 @@ function getWhoamiCommand() {
|
|
|
246972
246970
|
}
|
|
246973
246971
|
|
|
246974
246972
|
// src/cli/commands/connectors/list-available.ts
|
|
246975
|
-
async function listAvailableAction(
|
|
246973
|
+
async function listAvailableAction({
|
|
246974
|
+
log
|
|
246975
|
+
}) {
|
|
246976
246976
|
const { integrations } = await runTask("Fetching available integrations from Base44", async () => {
|
|
246977
246977
|
return await listAvailableIntegrations();
|
|
246978
246978
|
}, {
|
|
@@ -246985,7 +246985,7 @@ async function listAvailableAction(logger2) {
|
|
|
246985
246985
|
for (const { displayName, ...rest } of integrations) {
|
|
246986
246986
|
const yaml2 = formatYaml(rest);
|
|
246987
246987
|
const pad = " ".repeat(YAML_INDENT);
|
|
246988
|
-
|
|
246988
|
+
log.info(`${displayName}
|
|
246989
246989
|
${pad}${yaml2.replace(/\n/g, `
|
|
246990
246990
|
${pad}`)}`);
|
|
246991
246991
|
}
|
|
@@ -246994,12 +246994,14 @@ ${pad}`)}`);
|
|
|
246994
246994
|
};
|
|
246995
246995
|
}
|
|
246996
246996
|
function getConnectorsListAvailableCommand() {
|
|
246997
|
-
return new Base44Command("list-available").description("List all available integration types").action(
|
|
246997
|
+
return new Base44Command("list-available").description("List all available integration types").action(listAvailableAction);
|
|
246998
246998
|
}
|
|
246999
246999
|
|
|
247000
247000
|
// src/cli/commands/connectors/pull.ts
|
|
247001
247001
|
import { dirname as dirname8, join as join12 } from "node:path";
|
|
247002
|
-
async function pullConnectorsAction(
|
|
247002
|
+
async function pullConnectorsAction({
|
|
247003
|
+
log
|
|
247004
|
+
}) {
|
|
247003
247005
|
const { project: project2 } = await readProjectConfig();
|
|
247004
247006
|
const configDir = dirname8(project2.configPath);
|
|
247005
247007
|
const connectorsDir = join12(configDir, project2.connectorsDir);
|
|
@@ -247016,20 +247018,20 @@ async function pullConnectorsAction(logger2) {
|
|
|
247016
247018
|
errorMessage: "Failed to sync connector files"
|
|
247017
247019
|
});
|
|
247018
247020
|
if (written.length > 0) {
|
|
247019
|
-
|
|
247021
|
+
log.success(`Written: ${written.join(", ")}`);
|
|
247020
247022
|
}
|
|
247021
247023
|
if (deleted.length > 0) {
|
|
247022
|
-
|
|
247024
|
+
log.warn(`Deleted: ${deleted.join(", ")}`);
|
|
247023
247025
|
}
|
|
247024
247026
|
if (written.length === 0 && deleted.length === 0) {
|
|
247025
|
-
|
|
247027
|
+
log.info("All connectors are already up to date");
|
|
247026
247028
|
}
|
|
247027
247029
|
return {
|
|
247028
247030
|
outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`
|
|
247029
247031
|
};
|
|
247030
247032
|
}
|
|
247031
247033
|
function getConnectorsPullCommand() {
|
|
247032
|
-
return new Base44Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").action(
|
|
247034
|
+
return new Base44Command("pull").description("Pull connectors from Base44 to local files (replaces all local connector configs)").action(pullConnectorsAction);
|
|
247033
247035
|
}
|
|
247034
247036
|
|
|
247035
247037
|
// ../../node_modules/open/index.js
|
|
@@ -247691,14 +247693,14 @@ async function runOAuthFlowWithSkip(connector2) {
|
|
|
247691
247693
|
}
|
|
247692
247694
|
return finalStatus;
|
|
247693
247695
|
}
|
|
247694
|
-
async function promptOAuthFlows(pending,
|
|
247696
|
+
async function promptOAuthFlows(pending, log, options) {
|
|
247695
247697
|
const outcomes = new Map;
|
|
247696
247698
|
if (pending.length === 0) {
|
|
247697
247699
|
return outcomes;
|
|
247698
247700
|
}
|
|
247699
|
-
|
|
247701
|
+
log.warn(`${pending.length} connector(s) require authorization in your browser:`);
|
|
247700
247702
|
for (const connector2 of pending) {
|
|
247701
|
-
|
|
247703
|
+
log.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
247702
247704
|
}
|
|
247703
247705
|
if (options?.skipPrompt) {
|
|
247704
247706
|
return outcomes;
|
|
@@ -247711,11 +247713,11 @@ async function promptOAuthFlows(pending, logger2, options) {
|
|
|
247711
247713
|
}
|
|
247712
247714
|
for (const connector2 of pending) {
|
|
247713
247715
|
try {
|
|
247714
|
-
|
|
247716
|
+
log.info(`Opening browser for ${connector2.type}...`);
|
|
247715
247717
|
const status = await runOAuthFlowWithSkip(connector2);
|
|
247716
247718
|
outcomes.set(connector2.type, status);
|
|
247717
247719
|
} catch (err) {
|
|
247718
|
-
|
|
247720
|
+
log.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
|
|
247719
247721
|
outcomes.set(connector2.type, "FAILED");
|
|
247720
247722
|
}
|
|
247721
247723
|
}
|
|
@@ -247723,7 +247725,7 @@ async function promptOAuthFlows(pending, logger2, options) {
|
|
|
247723
247725
|
}
|
|
247724
247726
|
|
|
247725
247727
|
// src/cli/commands/connectors/push.ts
|
|
247726
|
-
function printSummary(results, oauthOutcomes,
|
|
247728
|
+
function printSummary(results, oauthOutcomes, log) {
|
|
247727
247729
|
const synced = [];
|
|
247728
247730
|
const added = [];
|
|
247729
247731
|
let provisioned;
|
|
@@ -247761,57 +247763,58 @@ function printSummary(results, oauthOutcomes, logger2) {
|
|
|
247761
247763
|
}
|
|
247762
247764
|
}
|
|
247763
247765
|
}
|
|
247764
|
-
|
|
247766
|
+
log.info(theme.styles.bold("Summary:"));
|
|
247765
247767
|
if (provisioned) {
|
|
247766
|
-
|
|
247768
|
+
log.success("Stripe sandbox provisioned");
|
|
247767
247769
|
if (provisioned.claimUrl) {
|
|
247768
|
-
|
|
247770
|
+
log.info(` Claim your Stripe sandbox: ${theme.colors.links(provisioned.claimUrl)}`);
|
|
247769
247771
|
}
|
|
247770
|
-
|
|
247772
|
+
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
247771
247773
|
}
|
|
247772
247774
|
if (synced.length > 0) {
|
|
247773
|
-
|
|
247775
|
+
log.success(`Synced: ${synced.join(", ")}`);
|
|
247774
247776
|
}
|
|
247775
247777
|
if (added.length > 0) {
|
|
247776
|
-
|
|
247778
|
+
log.success(`Added: ${added.join(", ")}`);
|
|
247777
247779
|
}
|
|
247778
247780
|
if (removed.length > 0) {
|
|
247779
|
-
|
|
247781
|
+
log.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
247780
247782
|
}
|
|
247781
247783
|
if (skipped.length > 0) {
|
|
247782
|
-
|
|
247784
|
+
log.warn(`Skipped: ${skipped.join(", ")}`);
|
|
247783
247785
|
}
|
|
247784
247786
|
for (const r of failed) {
|
|
247785
|
-
|
|
247787
|
+
log.error(`Failed: ${r.type} - ${r.error}`);
|
|
247786
247788
|
}
|
|
247787
247789
|
}
|
|
247788
|
-
async function pushConnectorsAction(
|
|
247790
|
+
async function pushConnectorsAction({
|
|
247791
|
+
isNonInteractive,
|
|
247792
|
+
log
|
|
247793
|
+
}) {
|
|
247789
247794
|
const { connectors } = await readProjectConfig();
|
|
247790
247795
|
if (connectors.length === 0) {
|
|
247791
|
-
|
|
247796
|
+
log.info("No local connectors found - checking for remote connectors to remove");
|
|
247792
247797
|
} else {
|
|
247793
247798
|
const connectorNames = connectors.map((c3) => c3.type).join(", ");
|
|
247794
|
-
|
|
247799
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
247795
247800
|
}
|
|
247796
247801
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
247797
247802
|
return await pushConnectors(connectors);
|
|
247798
247803
|
});
|
|
247799
247804
|
const needsOAuth = filterPendingOAuth(results);
|
|
247800
247805
|
let outroMessage = "Connectors pushed to Base44";
|
|
247801
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth,
|
|
247806
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, log, {
|
|
247802
247807
|
skipPrompt: isNonInteractive
|
|
247803
247808
|
});
|
|
247804
247809
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
247805
247810
|
if (needsOAuth.length > 0 && !allAuthorized) {
|
|
247806
247811
|
outroMessage = isNonInteractive ? "Skipped OAuth in non-interactive mode. Run 'base44 connectors push' locally or open the links above to authorize." : "Some connectors still require authorization. Run 'base44 connectors push' or open the links above to authorize.";
|
|
247807
247812
|
}
|
|
247808
|
-
printSummary(results, oauthOutcomes,
|
|
247813
|
+
printSummary(results, oauthOutcomes, log);
|
|
247809
247814
|
return { outroMessage };
|
|
247810
247815
|
}
|
|
247811
247816
|
function getConnectorsPushCommand() {
|
|
247812
|
-
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(
|
|
247813
|
-
return await pushConnectorsAction(command2.isNonInteractive, command2.logger);
|
|
247814
|
-
});
|
|
247817
|
+
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(pushConnectorsAction);
|
|
247815
247818
|
}
|
|
247816
247819
|
|
|
247817
247820
|
// src/cli/commands/connectors/index.ts
|
|
@@ -247820,7 +247823,9 @@ function getConnectorsCommand() {
|
|
|
247820
247823
|
}
|
|
247821
247824
|
|
|
247822
247825
|
// src/cli/commands/dashboard/open.ts
|
|
247823
|
-
async function openDashboard(
|
|
247826
|
+
async function openDashboard({
|
|
247827
|
+
isNonInteractive
|
|
247828
|
+
}) {
|
|
247824
247829
|
const dashboardUrl = getDashboardUrl();
|
|
247825
247830
|
if (!isNonInteractive) {
|
|
247826
247831
|
await open_default(dashboardUrl);
|
|
@@ -247828,9 +247833,7 @@ async function openDashboard(isNonInteractive) {
|
|
|
247828
247833
|
return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
|
|
247829
247834
|
}
|
|
247830
247835
|
function getDashboardOpenCommand() {
|
|
247831
|
-
return new Base44Command("open").description("Open the app dashboard in your browser").action(
|
|
247832
|
-
return await openDashboard(command2.isNonInteractive);
|
|
247833
|
-
});
|
|
247836
|
+
return new Base44Command("open").description("Open the app dashboard in your browser").action(openDashboard);
|
|
247834
247837
|
}
|
|
247835
247838
|
|
|
247836
247839
|
// src/cli/commands/dashboard/index.ts
|
|
@@ -247839,13 +247842,15 @@ function getDashboardCommand() {
|
|
|
247839
247842
|
}
|
|
247840
247843
|
|
|
247841
247844
|
// src/cli/commands/entities/push.ts
|
|
247842
|
-
async function pushEntitiesAction(
|
|
247845
|
+
async function pushEntitiesAction({
|
|
247846
|
+
log
|
|
247847
|
+
}) {
|
|
247843
247848
|
const { entities } = await readProjectConfig();
|
|
247844
247849
|
if (entities.length === 0) {
|
|
247845
247850
|
return { outroMessage: "No entities found in project" };
|
|
247846
247851
|
}
|
|
247847
247852
|
const entityNames = entities.map((e2) => e2.name).join(", ");
|
|
247848
|
-
|
|
247853
|
+
log.info(`Found ${entities.length} entities to push: ${entityNames}`);
|
|
247849
247854
|
const result = await runTask("Pushing entities to Base44", async () => {
|
|
247850
247855
|
return await pushEntities(entities);
|
|
247851
247856
|
}, {
|
|
@@ -247853,22 +247858,22 @@ async function pushEntitiesAction(logger2) {
|
|
|
247853
247858
|
errorMessage: "Failed to push entities"
|
|
247854
247859
|
});
|
|
247855
247860
|
if (result.created.length > 0) {
|
|
247856
|
-
|
|
247861
|
+
log.success(`Created: ${result.created.join(", ")}`);
|
|
247857
247862
|
}
|
|
247858
247863
|
if (result.updated.length > 0) {
|
|
247859
|
-
|
|
247864
|
+
log.success(`Updated: ${result.updated.join(", ")}`);
|
|
247860
247865
|
}
|
|
247861
247866
|
if (result.deleted.length > 0) {
|
|
247862
|
-
|
|
247867
|
+
log.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
247863
247868
|
}
|
|
247864
247869
|
return { outroMessage: "Entities pushed to Base44" };
|
|
247865
247870
|
}
|
|
247866
247871
|
function getEntitiesPushCommand() {
|
|
247867
|
-
return new Command("entities").description("Manage project entities").addCommand(new Base44Command("push").description("Push local entities to Base44").action(
|
|
247872
|
+
return new Command("entities").description("Manage project entities").addCommand(new Base44Command("push").description("Push local entities to Base44").action(pushEntitiesAction));
|
|
247868
247873
|
}
|
|
247869
247874
|
|
|
247870
247875
|
// src/cli/commands/functions/delete.ts
|
|
247871
|
-
async function deleteFunctionsAction(names) {
|
|
247876
|
+
async function deleteFunctionsAction(_ctx, names) {
|
|
247872
247877
|
let deleted = 0;
|
|
247873
247878
|
let notFound = 0;
|
|
247874
247879
|
let errors5 = 0;
|
|
@@ -247914,9 +247919,9 @@ function validateNames(command2) {
|
|
|
247914
247919
|
}
|
|
247915
247920
|
}
|
|
247916
247921
|
function getDeleteCommand() {
|
|
247917
|
-
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
|
|
247922
|
+
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
|
|
247918
247923
|
const names = parseNames(rawNames);
|
|
247919
|
-
return deleteFunctionsAction(names);
|
|
247924
|
+
return deleteFunctionsAction(ctx, names);
|
|
247920
247925
|
});
|
|
247921
247926
|
}
|
|
247922
247927
|
|
|
@@ -247924,15 +247929,15 @@ function getDeleteCommand() {
|
|
|
247924
247929
|
function formatDuration(ms) {
|
|
247925
247930
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
247926
247931
|
}
|
|
247927
|
-
function formatDeployResult(result,
|
|
247932
|
+
function formatDeployResult(result, log) {
|
|
247928
247933
|
const label = result.name.padEnd(25);
|
|
247929
247934
|
if (result.status === "deployed") {
|
|
247930
247935
|
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
247931
|
-
|
|
247936
|
+
log.success(`${label} deployed${timing}`);
|
|
247932
247937
|
} else if (result.status === "unchanged") {
|
|
247933
|
-
|
|
247938
|
+
log.success(`${label} unchanged`);
|
|
247934
247939
|
} else {
|
|
247935
|
-
|
|
247940
|
+
log.error(`${label} error: ${result.error}`);
|
|
247936
247941
|
}
|
|
247937
247942
|
}
|
|
247938
247943
|
|
|
@@ -247951,17 +247956,17 @@ function resolveFunctionsToDeploy(names, allFunctions) {
|
|
|
247951
247956
|
}
|
|
247952
247957
|
return allFunctions.filter((f) => names.includes(f.name));
|
|
247953
247958
|
}
|
|
247954
|
-
function formatPruneResult(pruneResult,
|
|
247959
|
+
function formatPruneResult(pruneResult, log) {
|
|
247955
247960
|
if (pruneResult.deleted) {
|
|
247956
|
-
|
|
247961
|
+
log.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
247957
247962
|
} else {
|
|
247958
|
-
|
|
247963
|
+
log.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
247959
247964
|
}
|
|
247960
247965
|
}
|
|
247961
|
-
function formatPruneSummary(pruneResults,
|
|
247966
|
+
function formatPruneSummary(pruneResults, log) {
|
|
247962
247967
|
if (pruneResults.length > 0) {
|
|
247963
247968
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
247964
|
-
|
|
247969
|
+
log.info(`${pruned} deleted`);
|
|
247965
247970
|
}
|
|
247966
247971
|
}
|
|
247967
247972
|
function buildDeploySummary(results) {
|
|
@@ -247977,7 +247982,7 @@ function buildDeploySummary(results) {
|
|
|
247977
247982
|
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
247978
247983
|
return parts.join(", ") || "No functions deployed";
|
|
247979
247984
|
}
|
|
247980
|
-
async function deployFunctionsAction(names, options
|
|
247985
|
+
async function deployFunctionsAction({ log }, names, options) {
|
|
247981
247986
|
if (options.force && names.length > 0) {
|
|
247982
247987
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
247983
247988
|
}
|
|
@@ -247988,17 +247993,17 @@ async function deployFunctionsAction(names, options, logger2) {
|
|
|
247988
247993
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
247989
247994
|
};
|
|
247990
247995
|
}
|
|
247991
|
-
|
|
247996
|
+
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
247992
247997
|
let completed = 0;
|
|
247993
247998
|
const total = toDeploy.length;
|
|
247994
247999
|
const results = await deployFunctionsSequentially(toDeploy, {
|
|
247995
248000
|
onStart: (startNames) => {
|
|
247996
248001
|
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
247997
|
-
|
|
248002
|
+
log.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
247998
248003
|
},
|
|
247999
248004
|
onResult: (result) => {
|
|
248000
248005
|
completed++;
|
|
248001
|
-
formatDeployResult(result,
|
|
248006
|
+
formatDeployResult(result, log);
|
|
248002
248007
|
}
|
|
248003
248008
|
});
|
|
248004
248009
|
if (options.force) {
|
|
@@ -248009,28 +248014,30 @@ async function deployFunctionsAction(names, options, logger2) {
|
|
|
248009
248014
|
onStart: (total2) => {
|
|
248010
248015
|
pruneTotal = total2;
|
|
248011
248016
|
if (total2 > 0) {
|
|
248012
|
-
|
|
248017
|
+
log.info(`Found ${total2} remote ${total2 === 1 ? "function" : "functions"} to delete`);
|
|
248013
248018
|
}
|
|
248014
248019
|
},
|
|
248015
248020
|
onBeforeDelete: (name2) => {
|
|
248016
248021
|
pruneCompleted++;
|
|
248017
|
-
|
|
248022
|
+
log.step(theme.styles.dim(`[${pruneCompleted}/${pruneTotal}] Deleting ${name2}...`));
|
|
248018
248023
|
},
|
|
248019
|
-
onResult: (r) => formatPruneResult(r,
|
|
248024
|
+
onResult: (r) => formatPruneResult(r, log)
|
|
248020
248025
|
});
|
|
248021
|
-
formatPruneSummary(pruneResults,
|
|
248026
|
+
formatPruneSummary(pruneResults, log);
|
|
248022
248027
|
}
|
|
248023
248028
|
return { outroMessage: buildDeploySummary(results) };
|
|
248024
248029
|
}
|
|
248025
248030
|
function getDeployCommand() {
|
|
248026
|
-
return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options
|
|
248031
|
+
return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (ctx, rawNames, options) => {
|
|
248027
248032
|
const names = parseNames2(rawNames);
|
|
248028
|
-
return deployFunctionsAction(names, options
|
|
248033
|
+
return deployFunctionsAction(ctx, names, options);
|
|
248029
248034
|
});
|
|
248030
248035
|
}
|
|
248031
248036
|
|
|
248032
248037
|
// src/cli/commands/functions/list.ts
|
|
248033
|
-
async function listFunctionsAction(
|
|
248038
|
+
async function listFunctionsAction({
|
|
248039
|
+
log
|
|
248040
|
+
}) {
|
|
248034
248041
|
const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
|
|
248035
248042
|
if (functions.length === 0) {
|
|
248036
248043
|
return { outroMessage: "No functions on remote" };
|
|
@@ -248038,19 +248045,19 @@ async function listFunctionsAction(logger2) {
|
|
|
248038
248045
|
for (const fn of functions) {
|
|
248039
248046
|
const automationCount = fn.automations.length;
|
|
248040
248047
|
const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
|
|
248041
|
-
|
|
248048
|
+
log.message(` ${fn.name}${automationLabel}`);
|
|
248042
248049
|
}
|
|
248043
248050
|
return {
|
|
248044
248051
|
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
248045
248052
|
};
|
|
248046
248053
|
}
|
|
248047
248054
|
function getListCommand() {
|
|
248048
|
-
return new Base44Command("list").description("List all deployed functions").action(
|
|
248055
|
+
return new Base44Command("list").description("List all deployed functions").action(listFunctionsAction);
|
|
248049
248056
|
}
|
|
248050
248057
|
|
|
248051
248058
|
// src/cli/commands/functions/pull.ts
|
|
248052
248059
|
import { dirname as dirname9, join as join13 } from "node:path";
|
|
248053
|
-
async function pullFunctionsAction(
|
|
248060
|
+
async function pullFunctionsAction({ log }, name2) {
|
|
248054
248061
|
const { project: project2 } = await readProjectConfig();
|
|
248055
248062
|
const configDir = dirname9(project2.configPath);
|
|
248056
248063
|
const functionsDir = join13(configDir, project2.functionsDir);
|
|
@@ -248077,19 +248084,17 @@ async function pullFunctionsAction(name2, logger2) {
|
|
|
248077
248084
|
errorMessage: "Failed to write function files"
|
|
248078
248085
|
});
|
|
248079
248086
|
for (const name3 of written) {
|
|
248080
|
-
|
|
248087
|
+
log.success(`${name3.padEnd(25)} written`);
|
|
248081
248088
|
}
|
|
248082
248089
|
for (const name3 of skipped) {
|
|
248083
|
-
|
|
248090
|
+
log.info(`${name3.padEnd(25)} unchanged`);
|
|
248084
248091
|
}
|
|
248085
248092
|
return {
|
|
248086
248093
|
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
248087
248094
|
};
|
|
248088
248095
|
}
|
|
248089
248096
|
function getPullCommand() {
|
|
248090
|
-
return new Base44Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Function name to pull (pulls all if omitted)").action(
|
|
248091
|
-
return pullFunctionsAction(name2, command2.logger);
|
|
248092
|
-
});
|
|
248097
|
+
return new Base44Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Function name to pull (pulls all if omitted)").action(pullFunctionsAction);
|
|
248093
248098
|
}
|
|
248094
248099
|
|
|
248095
248100
|
// src/cli/commands/functions/index.ts
|
|
@@ -248118,7 +248123,7 @@ function validateNonInteractiveFlags(command2) {
|
|
|
248118
248123
|
command2.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
|
|
248119
248124
|
}
|
|
248120
248125
|
}
|
|
248121
|
-
async function createInteractive(options,
|
|
248126
|
+
async function createInteractive(options, log) {
|
|
248122
248127
|
const templates = await listTemplates();
|
|
248123
248128
|
const templateOptions = templates.map((t) => ({
|
|
248124
248129
|
value: t,
|
|
@@ -248160,10 +248165,10 @@ async function createInteractive(options, logger2) {
|
|
|
248160
248165
|
deploy: options.deploy,
|
|
248161
248166
|
skills: options.skills,
|
|
248162
248167
|
isInteractive: true
|
|
248163
|
-
},
|
|
248168
|
+
}, log);
|
|
248164
248169
|
}
|
|
248165
|
-
async function createNonInteractive(options,
|
|
248166
|
-
|
|
248170
|
+
async function createNonInteractive(options, log) {
|
|
248171
|
+
log.info(`Creating a new project at ${resolve2(options.path)}`);
|
|
248167
248172
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
248168
248173
|
return await executeCreate({
|
|
248169
248174
|
template: template2,
|
|
@@ -248172,7 +248177,7 @@ async function createNonInteractive(options, logger2) {
|
|
|
248172
248177
|
deploy: options.deploy,
|
|
248173
248178
|
skills: options.skills,
|
|
248174
248179
|
isInteractive: false
|
|
248175
|
-
},
|
|
248180
|
+
}, log);
|
|
248176
248181
|
}
|
|
248177
248182
|
async function executeCreate({
|
|
248178
248183
|
template: template2,
|
|
@@ -248182,7 +248187,7 @@ async function executeCreate({
|
|
|
248182
248187
|
deploy: deploy5,
|
|
248183
248188
|
skills,
|
|
248184
248189
|
isInteractive
|
|
248185
|
-
},
|
|
248190
|
+
}, log) {
|
|
248186
248191
|
const name2 = rawName.trim();
|
|
248187
248192
|
const resolvedPath = resolve2(projectPath);
|
|
248188
248193
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
@@ -248257,13 +248262,32 @@ async function executeCreate({
|
|
|
248257
248262
|
});
|
|
248258
248263
|
} catch {}
|
|
248259
248264
|
}
|
|
248260
|
-
|
|
248261
|
-
|
|
248265
|
+
log.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name2)}`);
|
|
248266
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
248262
248267
|
if (finalAppUrl) {
|
|
248263
|
-
|
|
248268
|
+
log.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
248264
248269
|
}
|
|
248265
248270
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
248266
248271
|
}
|
|
248272
|
+
async function createAction({ log, isNonInteractive }, name2, options) {
|
|
248273
|
+
if (name2 && !options.path) {
|
|
248274
|
+
options.path = `./${import_kebabCase.default(name2)}`;
|
|
248275
|
+
}
|
|
248276
|
+
const skipPrompts = !!(options.name ?? name2) && !!options.path;
|
|
248277
|
+
if (!skipPrompts && isNonInteractive) {
|
|
248278
|
+
throw new InvalidInputError("Project name and --path are required in non-interactive mode", {
|
|
248279
|
+
hints: [
|
|
248280
|
+
{
|
|
248281
|
+
message: "Usage: base44 create <name> --path <path>"
|
|
248282
|
+
}
|
|
248283
|
+
]
|
|
248284
|
+
});
|
|
248285
|
+
}
|
|
248286
|
+
if (skipPrompts) {
|
|
248287
|
+
return await createNonInteractive({ name: options.name ?? name2, ...options }, log);
|
|
248288
|
+
}
|
|
248289
|
+
return await createInteractive({ name: name2, ...options }, log);
|
|
248290
|
+
}
|
|
248267
248291
|
function getCreateCommand() {
|
|
248268
248292
|
return new Base44Command("create", {
|
|
248269
248293
|
requireAppConfig: false,
|
|
@@ -248272,33 +248296,14 @@ function getCreateCommand() {
|
|
|
248272
248296
|
Examples:
|
|
248273
248297
|
$ base44 create my-app Creates a base44 project at ./my-app
|
|
248274
248298
|
$ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
|
|
248275
|
-
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(
|
|
248276
|
-
if (name2 && !options.path) {
|
|
248277
|
-
options.path = `./${import_kebabCase.default(name2)}`;
|
|
248278
|
-
}
|
|
248279
|
-
const skipPrompts = !!(options.name ?? name2) && !!options.path;
|
|
248280
|
-
if (!skipPrompts && command2.isNonInteractive) {
|
|
248281
|
-
throw new InvalidInputError("Project name and --path are required in non-interactive mode", {
|
|
248282
|
-
hints: [
|
|
248283
|
-
{
|
|
248284
|
-
message: "Usage: base44 create <name> --path <path>"
|
|
248285
|
-
}
|
|
248286
|
-
]
|
|
248287
|
-
});
|
|
248288
|
-
}
|
|
248289
|
-
if (skipPrompts) {
|
|
248290
|
-
return await createNonInteractive({
|
|
248291
|
-
name: options.name ?? name2,
|
|
248292
|
-
...options
|
|
248293
|
-
}, command2.logger);
|
|
248294
|
-
}
|
|
248295
|
-
return await createInteractive({ name: name2, ...options }, command2.logger);
|
|
248296
|
-
});
|
|
248299
|
+
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(createAction);
|
|
248297
248300
|
}
|
|
248298
248301
|
|
|
248299
248302
|
// src/cli/commands/project/deploy.ts
|
|
248300
|
-
async function deployAction(options) {
|
|
248301
|
-
|
|
248303
|
+
async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
248304
|
+
if (isNonInteractive && !options.yes) {
|
|
248305
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
248306
|
+
}
|
|
248302
248307
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
248303
248308
|
if (!hasResourcesToDeploy(projectData)) {
|
|
248304
248309
|
return {
|
|
@@ -248323,7 +248328,7 @@ async function deployAction(options) {
|
|
|
248323
248328
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
248324
248329
|
}
|
|
248325
248330
|
if (!options.yes) {
|
|
248326
|
-
|
|
248331
|
+
log.warn(`This will update your Base44 app with:
|
|
248327
248332
|
${summaryLines.join(`
|
|
248328
248333
|
`)}`);
|
|
248329
248334
|
const shouldDeploy = await Re({
|
|
@@ -248333,7 +248338,7 @@ ${summaryLines.join(`
|
|
|
248333
248338
|
return { outroMessage: "Deployment cancelled" };
|
|
248334
248339
|
}
|
|
248335
248340
|
} else {
|
|
248336
|
-
|
|
248341
|
+
log.info(`Deploying:
|
|
248337
248342
|
${summaryLines.join(`
|
|
248338
248343
|
`)}`);
|
|
248339
248344
|
}
|
|
@@ -248342,55 +248347,46 @@ ${summaryLines.join(`
|
|
|
248342
248347
|
const result = await deployAll(projectData, {
|
|
248343
248348
|
onFunctionStart: (names) => {
|
|
248344
248349
|
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
248345
|
-
|
|
248350
|
+
log.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
248346
248351
|
},
|
|
248347
248352
|
onFunctionResult: (r) => {
|
|
248348
248353
|
functionCompleted++;
|
|
248349
|
-
formatDeployResult(r,
|
|
248354
|
+
formatDeployResult(r, log);
|
|
248350
248355
|
}
|
|
248351
248356
|
});
|
|
248352
248357
|
const connectorResults = result.connectorResults ?? [];
|
|
248353
|
-
await handleOAuthConnectors(connectorResults, options,
|
|
248358
|
+
await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
|
|
248354
248359
|
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
248355
248360
|
if (stripeResult?.action === "provisioned") {
|
|
248356
|
-
printStripeResult(stripeResult,
|
|
248361
|
+
printStripeResult(stripeResult, log);
|
|
248357
248362
|
}
|
|
248358
|
-
|
|
248363
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
248359
248364
|
if (result.appUrl) {
|
|
248360
|
-
|
|
248365
|
+
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
248361
248366
|
}
|
|
248362
248367
|
return { outroMessage: "App deployed successfully" };
|
|
248363
248368
|
}
|
|
248364
248369
|
function getDeployCommand2() {
|
|
248365
|
-
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(
|
|
248366
|
-
if (command2.isNonInteractive && !options.yes) {
|
|
248367
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
248368
|
-
}
|
|
248369
|
-
return await deployAction({
|
|
248370
|
-
...options,
|
|
248371
|
-
isNonInteractive: command2.isNonInteractive,
|
|
248372
|
-
logger: command2.logger
|
|
248373
|
-
});
|
|
248374
|
-
});
|
|
248370
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
|
|
248375
248371
|
}
|
|
248376
|
-
async function handleOAuthConnectors(connectorResults, options,
|
|
248372
|
+
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
248377
248373
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
248378
248374
|
if (needsOAuth.length === 0)
|
|
248379
248375
|
return;
|
|
248380
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth,
|
|
248381
|
-
skipPrompt: options.yes ||
|
|
248376
|
+
const oauthOutcomes = await promptOAuthFlows(needsOAuth, log, {
|
|
248377
|
+
skipPrompt: options.yes || isNonInteractive
|
|
248382
248378
|
});
|
|
248383
248379
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
248384
248380
|
if (!allAuthorized) {
|
|
248385
|
-
|
|
248381
|
+
log.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
248386
248382
|
}
|
|
248387
248383
|
}
|
|
248388
|
-
function printStripeResult(r,
|
|
248389
|
-
|
|
248384
|
+
function printStripeResult(r, log) {
|
|
248385
|
+
log.success("Stripe sandbox provisioned");
|
|
248390
248386
|
if (r.claimUrl) {
|
|
248391
|
-
|
|
248387
|
+
log.info(` Claim your Stripe sandbox: ${theme.colors.links(r.claimUrl)}`);
|
|
248392
248388
|
}
|
|
248393
|
-
|
|
248389
|
+
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
248394
248390
|
}
|
|
248395
248391
|
|
|
248396
248392
|
// src/cli/commands/project/link.ts
|
|
@@ -248466,7 +248462,12 @@ async function promptForExistingProject(linkableProjects) {
|
|
|
248466
248462
|
}
|
|
248467
248463
|
return selectedProject;
|
|
248468
248464
|
}
|
|
248469
|
-
async function link(
|
|
248465
|
+
async function link(ctx, options) {
|
|
248466
|
+
const { log, isNonInteractive } = ctx;
|
|
248467
|
+
const skipPrompts = !!options.create || !!options.projectId;
|
|
248468
|
+
if (!skipPrompts && isNonInteractive) {
|
|
248469
|
+
throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
|
|
248470
|
+
}
|
|
248470
248471
|
const projectRoot = await findProjectRoot();
|
|
248471
248472
|
if (!projectRoot) {
|
|
248472
248473
|
throw new ConfigNotFoundError("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
@@ -248530,17 +248531,11 @@ async function link(options, logger2) {
|
|
|
248530
248531
|
setAppConfig({ id: projectId, projectRoot: projectRoot.root });
|
|
248531
248532
|
finalProjectId = projectId;
|
|
248532
248533
|
}
|
|
248533
|
-
|
|
248534
|
+
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalProjectId))}`);
|
|
248534
248535
|
return { outroMessage: "Project linked" };
|
|
248535
248536
|
}
|
|
248536
248537
|
function getLinkCommand() {
|
|
248537
|
-
return new Base44Command("link", { requireAppConfig: false }).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("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").option("-p, --projectId <id>", "Project ID to link to an existing project (skips selection prompt)").hook("preAction", validateNonInteractiveFlags2).action(
|
|
248538
|
-
const skipPrompts = !!options.create || !!options.projectId;
|
|
248539
|
-
if (!skipPrompts && command2.isNonInteractive) {
|
|
248540
|
-
throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
|
|
248541
|
-
}
|
|
248542
|
-
return await link(options, command2.logger);
|
|
248543
|
-
});
|
|
248538
|
+
return new Base44Command("link", { requireAppConfig: false }).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("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").option("-p, --projectId <id>", "Project ID to link to an existing project (skips selection prompt)").hook("preAction", validateNonInteractiveFlags2).action(link);
|
|
248544
248539
|
}
|
|
248545
248540
|
|
|
248546
248541
|
// src/cli/commands/project/logs.ts
|
|
@@ -248642,7 +248637,7 @@ function validateLimit(limit) {
|
|
|
248642
248637
|
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
|
|
248643
248638
|
}
|
|
248644
248639
|
}
|
|
248645
|
-
async function logsAction(options) {
|
|
248640
|
+
async function logsAction(_ctx, options) {
|
|
248646
248641
|
validateLimit(options.limit);
|
|
248647
248642
|
const specifiedFunctions = parseFunctionNames(options.function);
|
|
248648
248643
|
const allProjectFunctions = await getAllFunctionNames();
|
|
@@ -248664,7 +248659,7 @@ function getLogsCommand() {
|
|
|
248664
248659
|
}
|
|
248665
248660
|
|
|
248666
248661
|
// src/cli/commands/secrets/delete.ts
|
|
248667
|
-
async function deleteSecretAction(key) {
|
|
248662
|
+
async function deleteSecretAction(_ctx, key) {
|
|
248668
248663
|
await runTask(`Deleting secret "${key}"`, async () => {
|
|
248669
248664
|
return await deleteSecret(key);
|
|
248670
248665
|
}, {
|
|
@@ -248680,7 +248675,9 @@ function getSecretsDeleteCommand() {
|
|
|
248680
248675
|
}
|
|
248681
248676
|
|
|
248682
248677
|
// src/cli/commands/secrets/list.ts
|
|
248683
|
-
async function listSecretsAction(
|
|
248678
|
+
async function listSecretsAction({
|
|
248679
|
+
log
|
|
248680
|
+
}) {
|
|
248684
248681
|
const secrets = await runTask("Fetching secrets from Base44", async () => {
|
|
248685
248682
|
return await listSecrets();
|
|
248686
248683
|
}, {
|
|
@@ -248692,14 +248689,14 @@ async function listSecretsAction(logger2) {
|
|
|
248692
248689
|
return { outroMessage: "No secrets configured." };
|
|
248693
248690
|
}
|
|
248694
248691
|
for (const name2 of names) {
|
|
248695
|
-
|
|
248692
|
+
log.info(name2);
|
|
248696
248693
|
}
|
|
248697
248694
|
return {
|
|
248698
248695
|
outroMessage: `Found ${names.length} secrets.`
|
|
248699
248696
|
};
|
|
248700
248697
|
}
|
|
248701
248698
|
function getSecretsListCommand() {
|
|
248702
|
-
return new Base44Command("list").description("List secret names").action(
|
|
248699
|
+
return new Base44Command("list").description("List secret names").action(listSecretsAction);
|
|
248703
248700
|
}
|
|
248704
248701
|
|
|
248705
248702
|
// src/cli/commands/secrets/set.ts
|
|
@@ -248730,7 +248727,7 @@ function validateInput(entries, options) {
|
|
|
248730
248727
|
throw new InvalidInputError("Provide KEY=VALUE pairs or --env-file, but not both.");
|
|
248731
248728
|
}
|
|
248732
248729
|
}
|
|
248733
|
-
async function setSecretsAction(entries, options
|
|
248730
|
+
async function setSecretsAction({ log }, entries, options) {
|
|
248734
248731
|
validateInput(entries, options);
|
|
248735
248732
|
let secrets;
|
|
248736
248733
|
if (options.envFile) {
|
|
@@ -248748,15 +248745,13 @@ async function setSecretsAction(entries, options, logger2) {
|
|
|
248748
248745
|
successMessage: `${names.length} secrets set successfully`,
|
|
248749
248746
|
errorMessage: "Failed to set secrets"
|
|
248750
248747
|
});
|
|
248751
|
-
|
|
248748
|
+
log.info(`Set: ${names.join(", ")}`);
|
|
248752
248749
|
return {
|
|
248753
248750
|
outroMessage: "Secrets set successfully."
|
|
248754
248751
|
};
|
|
248755
248752
|
}
|
|
248756
248753
|
function getSecretsSetCommand() {
|
|
248757
|
-
return new Base44Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").action(
|
|
248758
|
-
return await setSecretsAction(entries, options, command2.logger);
|
|
248759
|
-
});
|
|
248754
|
+
return new Base44Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").action(setSecretsAction);
|
|
248760
248755
|
}
|
|
248761
248756
|
|
|
248762
248757
|
// src/cli/commands/secrets/index.ts
|
|
@@ -248766,7 +248761,10 @@ function getSecretsCommand() {
|
|
|
248766
248761
|
|
|
248767
248762
|
// src/cli/commands/site/deploy.ts
|
|
248768
248763
|
import { resolve as resolve4 } from "node:path";
|
|
248769
|
-
async function deployAction2(options) {
|
|
248764
|
+
async function deployAction2({ isNonInteractive }, options) {
|
|
248765
|
+
if (isNonInteractive && !options.yes) {
|
|
248766
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
248767
|
+
}
|
|
248770
248768
|
const { project: project2 } = await readProjectConfig();
|
|
248771
248769
|
if (!project2.site?.outputDirectory) {
|
|
248772
248770
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
@@ -248795,19 +248793,13 @@ async function deployAction2(options) {
|
|
|
248795
248793
|
return { outroMessage: `Visit your site at: ${result.appUrl}` };
|
|
248796
248794
|
}
|
|
248797
248795
|
function getSiteDeployCommand() {
|
|
248798
|
-
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(
|
|
248799
|
-
if (command2.isNonInteractive && !options.yes) {
|
|
248800
|
-
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
248801
|
-
}
|
|
248802
|
-
return await deployAction2({
|
|
248803
|
-
...options,
|
|
248804
|
-
isNonInteractive: command2.isNonInteractive
|
|
248805
|
-
});
|
|
248806
|
-
});
|
|
248796
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
|
|
248807
248797
|
}
|
|
248808
248798
|
|
|
248809
248799
|
// src/cli/commands/site/open.ts
|
|
248810
|
-
async function openAction(
|
|
248800
|
+
async function openAction({
|
|
248801
|
+
isNonInteractive
|
|
248802
|
+
}) {
|
|
248811
248803
|
const siteUrl = await getSiteUrl();
|
|
248812
248804
|
if (!isNonInteractive) {
|
|
248813
248805
|
await open_default(siteUrl);
|
|
@@ -248815,9 +248807,7 @@ async function openAction(isNonInteractive) {
|
|
|
248815
248807
|
return { outroMessage: `Site opened at ${siteUrl}` };
|
|
248816
248808
|
}
|
|
248817
248809
|
function getSiteOpenCommand() {
|
|
248818
|
-
return new Base44Command("open").description("Open the published site in your browser").action(
|
|
248819
|
-
return await openAction(command2.isNonInteractive);
|
|
248820
|
-
});
|
|
248810
|
+
return new Base44Command("open").description("Open the published site in your browser").action(openAction);
|
|
248821
248811
|
}
|
|
248822
248812
|
|
|
248823
248813
|
// src/cli/commands/site/index.ts
|
|
@@ -248935,7 +248925,7 @@ async function updateProjectConfig(projectRoot) {
|
|
|
248935
248925
|
}
|
|
248936
248926
|
// src/cli/commands/types/generate.ts
|
|
248937
248927
|
var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
248938
|
-
async function generateTypesAction() {
|
|
248928
|
+
async function generateTypesAction(_ctx) {
|
|
248939
248929
|
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
248940
248930
|
await runTask("Generating types", async () => {
|
|
248941
248931
|
await generateTypesFile({ entities, functions, agents, connectors });
|
|
@@ -248955,9 +248945,9 @@ function getTypesCommand() {
|
|
|
248955
248945
|
}
|
|
248956
248946
|
|
|
248957
248947
|
// src/cli/dev/dev-server/main.ts
|
|
248958
|
-
import { dirname as dirname14, join as join20 } from "node:path";
|
|
248959
248948
|
var import_cors = __toESM(require_lib4(), 1);
|
|
248960
248949
|
var import_express4 = __toESM(require_express(), 1);
|
|
248950
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
248961
248951
|
|
|
248962
248952
|
// ../../node_modules/get-port/index.js
|
|
248963
248953
|
import net from "node:net";
|
|
@@ -251618,12 +251608,12 @@ async function createDevServer(options8) {
|
|
|
251618
251608
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
251619
251609
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
251620
251610
|
if (functionManager.getFunctionNames().length > 0) {
|
|
251621
|
-
|
|
251611
|
+
options8.log.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
251622
251612
|
}
|
|
251623
251613
|
const db2 = new Database;
|
|
251624
251614
|
db2.load(entities);
|
|
251625
251615
|
if (db2.getCollectionNames().length > 0) {
|
|
251626
|
-
|
|
251616
|
+
options8.log.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
251627
251617
|
}
|
|
251628
251618
|
let emitEntityEvent = () => {};
|
|
251629
251619
|
const entityRoutes = createEntityRoutes(db2, devLogger, remoteProxy, (...args) => emitEntityEvent(...args));
|
|
@@ -251719,9 +251709,10 @@ async function createDevServer(options8) {
|
|
|
251719
251709
|
}
|
|
251720
251710
|
|
|
251721
251711
|
// src/cli/commands/dev.ts
|
|
251722
|
-
async function devAction(options8) {
|
|
251712
|
+
async function devAction({ log }, options8) {
|
|
251723
251713
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
251724
251714
|
const { port: resolvedPort } = await createDevServer({
|
|
251715
|
+
log,
|
|
251725
251716
|
port,
|
|
251726
251717
|
denoWrapperPath: getDenoWrapperPath(),
|
|
251727
251718
|
loadResources: async () => {
|
|
@@ -251740,7 +251731,14 @@ function getDevCommand() {
|
|
|
251740
251731
|
// src/cli/commands/project/eject.ts
|
|
251741
251732
|
import { resolve as resolve8 } from "node:path";
|
|
251742
251733
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
251743
|
-
async function eject(
|
|
251734
|
+
async function eject(ctx, options8) {
|
|
251735
|
+
const { log, isNonInteractive } = ctx;
|
|
251736
|
+
if (isNonInteractive && !options8.projectId) {
|
|
251737
|
+
throw new InvalidInputError("--project-id is required in non-interactive mode");
|
|
251738
|
+
}
|
|
251739
|
+
if (isNonInteractive && !options8.path) {
|
|
251740
|
+
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
251741
|
+
}
|
|
251744
251742
|
const projects = await listProjects();
|
|
251745
251743
|
const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
|
|
251746
251744
|
let selectedProject;
|
|
@@ -251756,7 +251754,7 @@ async function eject(options8, logger2) {
|
|
|
251756
251754
|
});
|
|
251757
251755
|
}
|
|
251758
251756
|
selectedProject = foundProject;
|
|
251759
|
-
|
|
251757
|
+
log.info(`Selected project: ${theme.styles.bold(selectedProject.name)}`);
|
|
251760
251758
|
} else {
|
|
251761
251759
|
if (ejectableProjects.length === 0) {
|
|
251762
251760
|
return { outroMessage: "No projects available to eject." };
|
|
@@ -251820,21 +251818,13 @@ async function eject(options8, logger2) {
|
|
|
251820
251818
|
successMessage: theme.colors.base44Orange("Project built successfully"),
|
|
251821
251819
|
errorMessage: "Failed to build project"
|
|
251822
251820
|
});
|
|
251823
|
-
await deployAction({ yes: true, projectRoot: resolvedPath
|
|
251821
|
+
await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
|
|
251824
251822
|
}
|
|
251825
251823
|
}
|
|
251826
251824
|
return { outroMessage: "Your new project is set and ready to use" };
|
|
251827
251825
|
}
|
|
251828
251826
|
function getEjectCommand() {
|
|
251829
|
-
return new Base44Command("eject", { requireAppConfig: false }).description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(
|
|
251830
|
-
if (command2.isNonInteractive && !options8.projectId) {
|
|
251831
|
-
throw new InvalidInputError("--project-id is required in non-interactive mode");
|
|
251832
|
-
}
|
|
251833
|
-
if (command2.isNonInteractive && !options8.path) {
|
|
251834
|
-
throw new InvalidInputError("--path is required in non-interactive mode");
|
|
251835
|
-
}
|
|
251836
|
-
return await eject({ ...options8, isNonInteractive: command2.isNonInteractive }, command2.logger);
|
|
251837
|
-
});
|
|
251827
|
+
return new Base44Command("eject", { requireAppConfig: false }).description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(eject);
|
|
251838
251828
|
}
|
|
251839
251829
|
|
|
251840
251830
|
// src/cli/program.ts
|
|
@@ -256078,12 +256068,12 @@ async function runCLI(options8) {
|
|
|
256078
256068
|
const errorReporter = new ErrorReporter;
|
|
256079
256069
|
errorReporter.registerProcessErrorHandlers();
|
|
256080
256070
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
256081
|
-
const
|
|
256071
|
+
const log = isNonInteractive ? new SimpleLogger : new ClackLogger;
|
|
256082
256072
|
const context = {
|
|
256083
256073
|
errorReporter,
|
|
256084
256074
|
isNonInteractive,
|
|
256085
256075
|
distribution: options8?.distribution ?? "npm",
|
|
256086
|
-
|
|
256076
|
+
log
|
|
256087
256077
|
};
|
|
256088
256078
|
const program2 = createProgram(context);
|
|
256089
256079
|
try {
|
|
@@ -256109,4 +256099,4 @@ export {
|
|
|
256109
256099
|
CLIExitError
|
|
256110
256100
|
};
|
|
256111
256101
|
|
|
256112
|
-
//# debugId=
|
|
256102
|
+
//# debugId=C109B5AC280C561864756E2164756E21
|