@base44-preview/cli 0.1.4-pr.567.6b2480e → 0.1.5-pr.568.1f028a6
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 +129 -143
- package/dist/cli/index.js.map +14 -13
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -161113,11 +161113,11 @@ var require_json4 = __commonJS((exports, module) => {
|
|
|
161113
161113
|
var debug = require_src4()("body-parser:json");
|
|
161114
161114
|
var read3 = require_read();
|
|
161115
161115
|
var { normalizeOptions: normalizeOptions5 } = require_utils8();
|
|
161116
|
-
module.exports =
|
|
161116
|
+
module.exports = json3;
|
|
161117
161117
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/;
|
|
161118
161118
|
var JSON_SYNTAX_CHAR = "#";
|
|
161119
161119
|
var JSON_SYNTAX_REGEXP = /#+/g;
|
|
161120
|
-
function
|
|
161120
|
+
function json3(options8) {
|
|
161121
161121
|
const normalizedOptions = normalizeOptions5(options8, "application/json");
|
|
161122
161122
|
var reviver = options8?.reviver;
|
|
161123
161123
|
var strict = options8?.strict !== false;
|
|
@@ -168320,7 +168320,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168320
168320
|
}
|
|
168321
168321
|
return this;
|
|
168322
168322
|
};
|
|
168323
|
-
res.json = function
|
|
168323
|
+
res.json = function json3(obj) {
|
|
168324
168324
|
var app = this.app;
|
|
168325
168325
|
var escape3 = app.get("json escape");
|
|
168326
168326
|
var replacer = app.get("json replacer");
|
|
@@ -168656,9 +168656,9 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168656
168656
|
file2.pipe(res2);
|
|
168657
168657
|
}
|
|
168658
168658
|
function stringify(value, replacer, spaces, escape3) {
|
|
168659
|
-
var
|
|
168660
|
-
if (escape3 && typeof
|
|
168661
|
-
|
|
168659
|
+
var json3 = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value);
|
|
168660
|
+
if (escape3 && typeof json3 === "string") {
|
|
168661
|
+
json3 = json3.replace(/[<>&]/g, function(c8) {
|
|
168662
168662
|
switch (c8.charCodeAt(0)) {
|
|
168663
168663
|
case 60:
|
|
168664
168664
|
return "\\u003c";
|
|
@@ -168671,7 +168671,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168671
168671
|
}
|
|
168672
168672
|
});
|
|
168673
168673
|
}
|
|
168674
|
-
return
|
|
168674
|
+
return json3;
|
|
168675
168675
|
}
|
|
168676
168676
|
});
|
|
168677
168677
|
|
|
@@ -236069,11 +236069,13 @@ var CreateProjectResponseSchema = exports_external.looseObject({
|
|
|
236069
236069
|
var AppDetailSchema = exports_external.looseObject({
|
|
236070
236070
|
id: exports_external.string(),
|
|
236071
236071
|
name: exports_external.string().optional(),
|
|
236072
|
-
organization_id: exports_external.string().nullish()
|
|
236072
|
+
organization_id: exports_external.string().nullish(),
|
|
236073
|
+
is_managed_source_code: exports_external.boolean().optional()
|
|
236073
236074
|
}).transform((data) => ({
|
|
236074
236075
|
id: data.id,
|
|
236075
236076
|
name: data.name,
|
|
236076
|
-
organizationId: data.organization_id ?? undefined
|
|
236077
|
+
organizationId: data.organization_id ?? undefined,
|
|
236078
|
+
isManagedSourceCode: data.is_managed_source_code
|
|
236077
236079
|
}));
|
|
236078
236080
|
var ProjectSchema = exports_external.object({
|
|
236079
236081
|
id: exports_external.string(),
|
|
@@ -241894,14 +241896,15 @@ async function setAppVisibility(visibility) {
|
|
|
241894
241896
|
throw await ApiError.fromHttpError(error48, "updating app visibility");
|
|
241895
241897
|
}
|
|
241896
241898
|
}
|
|
241897
|
-
async function listProjects() {
|
|
241899
|
+
async function listProjects(options = {}) {
|
|
241898
241900
|
let response;
|
|
241899
241901
|
try {
|
|
241900
241902
|
response = await base44Client.get("api/apps", {
|
|
241901
241903
|
searchParams: {
|
|
241902
241904
|
sort: "-updated_date",
|
|
241903
241905
|
fields: "id,name,user_description,is_managed_source_code",
|
|
241904
|
-
limit: 50
|
|
241906
|
+
limit: 50,
|
|
241907
|
+
...options.workspaceId ? { workspace_id: options.workspaceId } : {}
|
|
241905
241908
|
}
|
|
241906
241909
|
});
|
|
241907
241910
|
} catch (error48) {
|
|
@@ -241917,7 +241920,9 @@ async function getApp(appId) {
|
|
|
241917
241920
|
let response;
|
|
241918
241921
|
try {
|
|
241919
241922
|
response = await base44Client.get(`api/apps/${appId}`, {
|
|
241920
|
-
searchParams: {
|
|
241923
|
+
searchParams: {
|
|
241924
|
+
fields: "id,name,organization_id,is_managed_source_code"
|
|
241925
|
+
}
|
|
241921
241926
|
});
|
|
241922
241927
|
} catch (error48) {
|
|
241923
241928
|
throw await ApiError.fromHttpError(error48, "fetching app");
|
|
@@ -244011,7 +244016,7 @@ import { join as join11 } from "node:path";
|
|
|
244011
244016
|
// package.json
|
|
244012
244017
|
var package_default = {
|
|
244013
244018
|
name: "base44",
|
|
244014
|
-
version: "0.1.
|
|
244019
|
+
version: "0.1.5",
|
|
244015
244020
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
244016
244021
|
type: "module",
|
|
244017
244022
|
bin: {
|
|
@@ -251341,6 +251346,11 @@ class Base44Command extends Command {
|
|
|
251341
251346
|
});
|
|
251342
251347
|
}
|
|
251343
251348
|
}
|
|
251349
|
+
// src/cli/utils/json.ts
|
|
251350
|
+
function toJsonStdout(result) {
|
|
251351
|
+
return `${JSON.stringify(result, null, 2)}
|
|
251352
|
+
`;
|
|
251353
|
+
}
|
|
251344
251354
|
// src/cli/errors.ts
|
|
251345
251355
|
class CLIExitError extends Error {
|
|
251346
251356
|
code;
|
|
@@ -251550,10 +251560,6 @@ var MoveAppResponseSchema = exports_external.looseObject({
|
|
|
251550
251560
|
appId: data.app_id,
|
|
251551
251561
|
newWorkspaceId: data.new_workspace_id
|
|
251552
251562
|
}));
|
|
251553
|
-
var APP_EDITOR_ROLES = ["owner", "admin", "editor"];
|
|
251554
|
-
function canCreateAppsInWorkspace(role) {
|
|
251555
|
-
return role !== undefined && APP_EDITOR_ROLES.includes(role.toLowerCase());
|
|
251556
|
-
}
|
|
251557
251563
|
|
|
251558
251564
|
// src/core/workspace/api.ts
|
|
251559
251565
|
async function listWorkspaces() {
|
|
@@ -253461,44 +253467,29 @@ function fetchWorkspaces(ctx) {
|
|
|
253461
253467
|
errorMessage: "Failed to fetch workspaces"
|
|
253462
253468
|
});
|
|
253463
253469
|
}
|
|
253464
|
-
function workspaceHints(workspaces) {
|
|
253465
|
-
return [
|
|
253466
|
-
{ message: "Run 'base44 workspace list' to see available workspaces" },
|
|
253467
|
-
...workspaces.filter((w) => canCreateAppsInWorkspace(w.userRole)).map((w) => ({ message: `${w.name} — ${w.id}` }))
|
|
253468
|
-
];
|
|
253469
|
-
}
|
|
253470
253470
|
function workspaceLabel(workspace2) {
|
|
253471
253471
|
const suffix = workspace2.isPersonal ? "personal" : workspace2.userRole ?? "member";
|
|
253472
253472
|
return `${workspace2.name} (${suffix})`;
|
|
253473
253473
|
}
|
|
253474
|
-
async function resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive) {
|
|
253474
|
+
async function resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive, options = {}) {
|
|
253475
253475
|
if (flagWorkspaceId) {
|
|
253476
|
-
|
|
253477
|
-
const match = workspaces2.find((w) => w.id === flagWorkspaceId);
|
|
253478
|
-
if (!match) {
|
|
253479
|
-
throw new InvalidInputError(`Workspace "${flagWorkspaceId}" not found, or you are not a member of it.`, { hints: workspaceHints(workspaces2) });
|
|
253480
|
-
}
|
|
253481
|
-
if (!canCreateAppsInWorkspace(match.userRole)) {
|
|
253482
|
-
throw new InvalidInputError(`You don't have permission to create apps in workspace "${match.name}" (your role: ${match.userRole ?? "unknown"}).`);
|
|
253483
|
-
}
|
|
253484
|
-
return match.id;
|
|
253476
|
+
return flagWorkspaceId;
|
|
253485
253477
|
}
|
|
253486
253478
|
if (!isInteractive) {
|
|
253487
253479
|
return;
|
|
253488
253480
|
}
|
|
253489
253481
|
const workspaces = await fetchWorkspaces(ctx);
|
|
253490
|
-
|
|
253491
|
-
if (eligible.length <= 1) {
|
|
253482
|
+
if (workspaces.length <= 1) {
|
|
253492
253483
|
return;
|
|
253493
253484
|
}
|
|
253494
|
-
const
|
|
253485
|
+
const promptOptions = workspaces.map((w) => ({
|
|
253495
253486
|
value: w.id,
|
|
253496
253487
|
label: workspaceLabel(w)
|
|
253497
253488
|
}));
|
|
253498
253489
|
const selected = await Je({
|
|
253499
|
-
message: "Which workspace should this app belong to?",
|
|
253500
|
-
options,
|
|
253501
|
-
initialValue:
|
|
253490
|
+
message: options.promptMessage ?? "Which workspace should this app belong to?",
|
|
253491
|
+
options: promptOptions,
|
|
253492
|
+
initialValue: workspaces[0].id
|
|
253502
253493
|
});
|
|
253503
253494
|
if (Ct(selected)) {
|
|
253504
253495
|
onPromptCancel();
|
|
@@ -253830,6 +253821,40 @@ async function promptForExistingProject(linkableProjects) {
|
|
|
253830
253821
|
}
|
|
253831
253822
|
return selectedProject;
|
|
253832
253823
|
}
|
|
253824
|
+
async function resolveExplicitAppId(ctx, appId) {
|
|
253825
|
+
const app = await ctx.runTask("Validating app...", () => getApp(appId), {
|
|
253826
|
+
errorMessage: "Could not validate app"
|
|
253827
|
+
}).catch((error48) => {
|
|
253828
|
+
if (error48 instanceof ApiError && (error48.statusCode === 404 || error48.statusCode === 403)) {
|
|
253829
|
+
throw new InvalidInputError(`App "${appId}" not found, or you don't have access to it.`, {
|
|
253830
|
+
hints: [
|
|
253831
|
+
{ message: "Check the app ID is correct" },
|
|
253832
|
+
{
|
|
253833
|
+
message: "Run 'base44 link' without --app-id to browse apps by workspace"
|
|
253834
|
+
}
|
|
253835
|
+
]
|
|
253836
|
+
});
|
|
253837
|
+
}
|
|
253838
|
+
throw error48;
|
|
253839
|
+
});
|
|
253840
|
+
if (app.isManagedSourceCode) {
|
|
253841
|
+
throw new InvalidInputError(`App "${appId}" is a managed-source app and can't be linked with the CLI.`);
|
|
253842
|
+
}
|
|
253843
|
+
return appId;
|
|
253844
|
+
}
|
|
253845
|
+
async function chooseProjectInteractively(ctx, options) {
|
|
253846
|
+
const workspaceId = await resolveWorkspaceId(ctx, options.workspace ?? options.org, !ctx.isNonInteractive, { promptMessage: "Which workspace is the app in?" });
|
|
253847
|
+
const projects = await ctx.runTask("Fetching projects...", () => listProjects({ workspaceId }), {
|
|
253848
|
+
successMessage: "Projects fetched",
|
|
253849
|
+
errorMessage: "Failed to fetch projects"
|
|
253850
|
+
});
|
|
253851
|
+
const linkableProjects = projects.filter((p) => p.isManagedSourceCode !== true);
|
|
253852
|
+
if (!linkableProjects.length) {
|
|
253853
|
+
return;
|
|
253854
|
+
}
|
|
253855
|
+
const selectedProject = await promptForExistingProject(linkableProjects);
|
|
253856
|
+
return selectedProject.id;
|
|
253857
|
+
}
|
|
253833
253858
|
async function link(ctx, options, command2) {
|
|
253834
253859
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
253835
253860
|
const appId = readExplicitAppId(command2).value;
|
|
@@ -253853,32 +253878,10 @@ async function link(ctx, options, command2) {
|
|
|
253853
253878
|
let finalAppId;
|
|
253854
253879
|
const action = appId ? "choose" : options.create ? "create" : await promptForLinkAction();
|
|
253855
253880
|
if (action === "choose") {
|
|
253856
|
-
const
|
|
253857
|
-
|
|
253858
|
-
errorMessage: "Failed to fetch projects"
|
|
253859
|
-
});
|
|
253860
|
-
const linkableProjects = projects.filter((p) => p.isManagedSourceCode !== true);
|
|
253861
|
-
if (!linkableProjects.length) {
|
|
253881
|
+
const linkedAppId = appId ? await resolveExplicitAppId(ctx, appId) : await chooseProjectInteractively(ctx, options);
|
|
253882
|
+
if (!linkedAppId) {
|
|
253862
253883
|
return { outroMessage: "No projects available for linking" };
|
|
253863
253884
|
}
|
|
253864
|
-
let linkedAppId;
|
|
253865
|
-
if (appId) {
|
|
253866
|
-
const project2 = linkableProjects.find((p) => p.id === appId);
|
|
253867
|
-
if (!project2) {
|
|
253868
|
-
throw new InvalidInputError(`App with ID "${appId}" not found or not available for linking.`, {
|
|
253869
|
-
hints: [
|
|
253870
|
-
{ message: "Check the app ID is correct" },
|
|
253871
|
-
{
|
|
253872
|
-
message: "Use 'base44 link' without --app-id to see available projects"
|
|
253873
|
-
}
|
|
253874
|
-
]
|
|
253875
|
-
});
|
|
253876
|
-
}
|
|
253877
|
-
linkedAppId = appId;
|
|
253878
|
-
} else {
|
|
253879
|
-
const selectedProject = await promptForExistingProject(linkableProjects);
|
|
253880
|
-
linkedAppId = selectedProject.id;
|
|
253881
|
-
}
|
|
253882
253885
|
await runTask2("Linking project...", async () => {
|
|
253883
253886
|
await writeAppConfig(projectRoot.root, linkedAppId);
|
|
253884
253887
|
setAppContext({ id: linkedAppId, projectRoot: projectRoot.root });
|
|
@@ -253907,7 +253910,7 @@ async function link(ctx, options, command2) {
|
|
|
253907
253910
|
function getLinkCommand() {
|
|
253908
253911
|
return new Base44Command("link", {
|
|
253909
253912
|
requireAppContext: false
|
|
253910
|
-
}).description("Link a local project to a Base44 project (create new or link existing)").configureHelp({ showGlobalOptions: true }).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("-w, --workspace <id>", "Workspace (organization) ID to create the app in
|
|
253913
|
+
}).description("Link a local project to a Base44 project (create new or link existing)").configureHelp({ showGlobalOptions: true }).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("-w, --workspace <id>", "Workspace (organization) ID to scope the app picker to (or create the app in, with --create). Defaults to your personal workspace").addOption(new Option("--org <id>", "Alias for --workspace").hideHelp()).addOption(new Option("-p, --project-id <id>", "Project ID to link to an existing project").hideHelp()).addOption(new Option("--projectId <id>", "Project ID to link to an existing project").hideHelp()).hook("preAction", validateNonInteractiveFlags).action(link);
|
|
253911
253914
|
}
|
|
253912
253915
|
|
|
253913
253916
|
// src/cli/commands/project/logs.ts
|
|
@@ -254335,10 +254338,6 @@ async function resolveFlagOrStdin(flagValue, flagName) {
|
|
|
254335
254338
|
}
|
|
254336
254339
|
return readStdin(flagName, { trim: false });
|
|
254337
254340
|
}
|
|
254338
|
-
function toJsonStdout(result) {
|
|
254339
|
-
return `${JSON.stringify(result, null, 2)}
|
|
254340
|
-
`;
|
|
254341
|
-
}
|
|
254342
254341
|
function parsePositiveInt(value, flagName) {
|
|
254343
254342
|
if (value === undefined) {
|
|
254344
254343
|
return;
|
|
@@ -254776,10 +254775,6 @@ function getTypesCommand() {
|
|
|
254776
254775
|
}
|
|
254777
254776
|
|
|
254778
254777
|
// src/cli/commands/workspace/shared.ts
|
|
254779
|
-
function toJsonStdout2(result) {
|
|
254780
|
-
return `${JSON.stringify(result, null, 2)}
|
|
254781
|
-
`;
|
|
254782
|
-
}
|
|
254783
254778
|
function workspaceTag(workspace2) {
|
|
254784
254779
|
const role = workspace2.userRole ?? "member";
|
|
254785
254780
|
return workspace2.isPersonal ? `personal, ${role}` : role;
|
|
@@ -254798,7 +254793,7 @@ async function getWorkspaceAction({ runTask: runTask2, log, jsonMode }, workspac
|
|
|
254798
254793
|
if (jsonMode) {
|
|
254799
254794
|
return {
|
|
254800
254795
|
outroMessage: workspace2.name,
|
|
254801
|
-
stdout:
|
|
254796
|
+
stdout: toJsonStdout(workspace2)
|
|
254802
254797
|
};
|
|
254803
254798
|
}
|
|
254804
254799
|
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
@@ -254811,71 +254806,40 @@ function getWorkspaceGetCommand() {
|
|
|
254811
254806
|
}
|
|
254812
254807
|
|
|
254813
254808
|
// src/cli/commands/workspace/list.ts
|
|
254814
|
-
function pluralize2(n5) {
|
|
254815
|
-
return `${n5} workspace${n5 !== 1 ? "s" : ""}`;
|
|
254816
|
-
}
|
|
254817
254809
|
async function listWorkspacesAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
254818
254810
|
let workspaces = await runTask2("Fetching workspaces...", () => listWorkspaces(), { errorMessage: "Failed to fetch workspaces" });
|
|
254819
|
-
if (options8.canCreate) {
|
|
254820
|
-
workspaces = workspaces.filter((w8) => canCreateAppsInWorkspace(w8.userRole));
|
|
254821
|
-
}
|
|
254822
254811
|
if (options8.role) {
|
|
254823
254812
|
const role = options8.role.toLowerCase();
|
|
254824
254813
|
workspaces = workspaces.filter((w8) => w8.userRole?.toLowerCase() === role);
|
|
254825
254814
|
}
|
|
254815
|
+
const summary = `${workspaces.length} workspace${workspaces.length !== 1 ? "s" : ""}`;
|
|
254826
254816
|
if (jsonMode) {
|
|
254827
|
-
return {
|
|
254828
|
-
outroMessage: pluralize2(workspaces.length),
|
|
254829
|
-
stdout: toJsonStdout2(workspaces)
|
|
254830
|
-
};
|
|
254817
|
+
return { outroMessage: summary, stdout: toJsonStdout(workspaces) };
|
|
254831
254818
|
}
|
|
254832
254819
|
for (const workspace2 of workspaces) {
|
|
254833
254820
|
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
254834
254821
|
${theme.styles.dim(workspace2.id)}`);
|
|
254835
254822
|
}
|
|
254836
|
-
return { outroMessage:
|
|
254823
|
+
return { outroMessage: summary };
|
|
254837
254824
|
}
|
|
254838
254825
|
function getWorkspaceListCommand() {
|
|
254839
|
-
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").option("--
|
|
254826
|
+
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").option("--role <role>", "Only workspaces where your role matches (owner, admin, editor, viewer)").action(listWorkspacesAction);
|
|
254840
254827
|
}
|
|
254841
254828
|
|
|
254842
254829
|
// src/cli/commands/workspace/move.ts
|
|
254843
|
-
function
|
|
254844
|
-
|
|
254845
|
-
|
|
254846
|
-
|
|
254847
|
-
|
|
254848
|
-
|
|
254849
|
-
|
|
254850
|
-
|
|
254851
|
-
|
|
254852
|
-
|
|
254853
|
-
throw new InvalidInputError(`Workspace "${target}" not found, or you are not a member of it.`, {
|
|
254854
|
-
hints: [
|
|
254855
|
-
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254856
|
-
]
|
|
254857
|
-
});
|
|
254858
|
-
}
|
|
254859
|
-
if (target === currentWorkspaceId) {
|
|
254860
|
-
throw new InvalidInputError("The app is already in that workspace.");
|
|
254861
|
-
}
|
|
254862
|
-
if (!canCreateAppsInWorkspace(match.userRole)) {
|
|
254863
|
-
throw new InvalidInputError(`You don't have permission to move apps into workspace "${match.name}" (your role: ${match.userRole ?? "unknown"}).`);
|
|
254864
|
-
}
|
|
254865
|
-
return match.id;
|
|
254866
|
-
}
|
|
254867
|
-
if (!isInteractive) {
|
|
254868
|
-
throw new InvalidInputError("A target workspace ID is required in non-interactive mode.", {
|
|
254869
|
-
hints: [
|
|
254870
|
-
{ message: "Usage: base44 workspace move <workspace-id>" },
|
|
254871
|
-
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254872
|
-
]
|
|
254873
|
-
});
|
|
254874
|
-
}
|
|
254875
|
-
if (eligible.length === 0) {
|
|
254830
|
+
async function promptForTargetWorkspace(ctx, appId) {
|
|
254831
|
+
const { workspaces, currentWorkspaceId } = await ctx.runTask("Fetching workspaces...", async () => {
|
|
254832
|
+
const [workspaces2, app] = await Promise.all([
|
|
254833
|
+
listWorkspaces(),
|
|
254834
|
+
getApp(appId)
|
|
254835
|
+
]);
|
|
254836
|
+
return { workspaces: workspaces2, currentWorkspaceId: app.organizationId };
|
|
254837
|
+
}, { errorMessage: "Failed to fetch workspaces" });
|
|
254838
|
+
const destinations = workspaces.filter((w8) => w8.id !== currentWorkspaceId);
|
|
254839
|
+
if (destinations.length === 0) {
|
|
254876
254840
|
throw new InvalidInputError("No other workspaces available to move this app into.");
|
|
254877
254841
|
}
|
|
254878
|
-
const options8 =
|
|
254842
|
+
const options8 = destinations.map((w8) => ({
|
|
254879
254843
|
value: w8.id,
|
|
254880
254844
|
label: `${w8.name} (${w8.userRole ?? "member"})`
|
|
254881
254845
|
}));
|
|
@@ -254886,42 +254850,64 @@ async function resolveTargetWorkspace(target, workspaces, currentWorkspaceId, is
|
|
|
254886
254850
|
if (Ct(selected)) {
|
|
254887
254851
|
onPromptCancel();
|
|
254888
254852
|
}
|
|
254889
|
-
|
|
254853
|
+
const targetWorkspaceId = selected;
|
|
254854
|
+
const nameOf = (id2) => workspaces.find((w8) => w8.id === id2)?.name ?? id2 ?? "unknown workspace";
|
|
254855
|
+
return {
|
|
254856
|
+
targetWorkspaceId,
|
|
254857
|
+
fromName: nameOf(currentWorkspaceId),
|
|
254858
|
+
toName: nameOf(targetWorkspaceId)
|
|
254859
|
+
};
|
|
254890
254860
|
}
|
|
254891
254861
|
async function moveAction(ctx, target, options8) {
|
|
254892
254862
|
const { runTask: runTask2, isNonInteractive, jsonMode } = ctx;
|
|
254893
254863
|
const isInteractive = !isNonInteractive && !jsonMode;
|
|
254894
254864
|
const { id: appId } = getAppContext();
|
|
254895
|
-
|
|
254896
|
-
|
|
254897
|
-
|
|
254898
|
-
|
|
254899
|
-
|
|
254900
|
-
|
|
254901
|
-
|
|
254902
|
-
|
|
254903
|
-
|
|
254904
|
-
|
|
254905
|
-
|
|
254906
|
-
|
|
254907
|
-
|
|
254908
|
-
|
|
254865
|
+
let targetWorkspaceId;
|
|
254866
|
+
let toLabel;
|
|
254867
|
+
if (target) {
|
|
254868
|
+
targetWorkspaceId = target;
|
|
254869
|
+
toLabel = target;
|
|
254870
|
+
if (isInteractive && !options8.yes) {
|
|
254871
|
+
const proceed = await Re({
|
|
254872
|
+
message: `Move this app to workspace ${theme.styles.bold(target)}?`
|
|
254873
|
+
});
|
|
254874
|
+
if (Ct(proceed)) {
|
|
254875
|
+
onPromptCancel();
|
|
254876
|
+
}
|
|
254877
|
+
if (!proceed) {
|
|
254878
|
+
return { outroMessage: "Move cancelled" };
|
|
254879
|
+
}
|
|
254909
254880
|
}
|
|
254910
|
-
|
|
254911
|
-
|
|
254881
|
+
} else if (isInteractive) {
|
|
254882
|
+
const picked = await promptForTargetWorkspace(ctx, appId);
|
|
254883
|
+
targetWorkspaceId = picked.targetWorkspaceId;
|
|
254884
|
+
toLabel = picked.toName;
|
|
254885
|
+
if (!options8.yes) {
|
|
254886
|
+
const proceed = await Re({
|
|
254887
|
+
message: `Move this app from ${theme.styles.bold(picked.fromName)} to ${theme.styles.bold(picked.toName)}?`
|
|
254888
|
+
});
|
|
254889
|
+
if (Ct(proceed)) {
|
|
254890
|
+
onPromptCancel();
|
|
254891
|
+
}
|
|
254892
|
+
if (!proceed) {
|
|
254893
|
+
return { outroMessage: "Move cancelled" };
|
|
254894
|
+
}
|
|
254912
254895
|
}
|
|
254896
|
+
} else {
|
|
254897
|
+
throw new InvalidInputError("A target workspace ID is required in non-interactive mode.", {
|
|
254898
|
+
hints: [
|
|
254899
|
+
{ message: "Usage: base44 workspace move <workspace-id>" },
|
|
254900
|
+
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254901
|
+
]
|
|
254902
|
+
});
|
|
254913
254903
|
}
|
|
254914
254904
|
const result = await runTask2("Moving app to workspace...", () => moveAppToWorkspace(appId, targetWorkspaceId, {
|
|
254915
254905
|
disconnectIntegrations: options8.disconnectIntegrations
|
|
254916
254906
|
}), { errorMessage: "Failed to move app" });
|
|
254917
|
-
const targetName = workspaceName(workspaces, targetWorkspaceId);
|
|
254918
254907
|
if (jsonMode) {
|
|
254919
|
-
return {
|
|
254920
|
-
outroMessage: `App moved to ${targetName}`,
|
|
254921
|
-
stdout: toJsonStdout2(result)
|
|
254922
|
-
};
|
|
254908
|
+
return { outroMessage: "App moved", stdout: toJsonStdout(result) };
|
|
254923
254909
|
}
|
|
254924
|
-
return { outroMessage: `App moved to ${theme.styles.bold(
|
|
254910
|
+
return { outroMessage: `App moved to ${theme.styles.bold(toLabel)}` };
|
|
254925
254911
|
}
|
|
254926
254912
|
function getWorkspaceMoveCommand() {
|
|
254927
254913
|
return new Base44Command("move").description("Move the current app to another workspace").argument("[workspace-id]", "Target workspace (organization) ID").option("--disconnect-integrations", "Disconnect the app's OAuth integrations as part of the move").option("-y, --yes", "Skip the confirmation prompt").addHelpText("after", `
|
|
@@ -262965,4 +262951,4 @@ export {
|
|
|
262965
262951
|
CLIExitError
|
|
262966
262952
|
};
|
|
262967
262953
|
|
|
262968
|
-
//# debugId=
|
|
262954
|
+
//# debugId=66DC83EDAF91D49064756E2164756E21
|