@prisma/cli 8.0.0-rc.1 → 8.0.0-rc.2-dev.49
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.js +15410 -16
- package/dist/deploy-framework-C7bQM00A.js +23 -0
- package/dist/{v8/sender.js → sender.js} +2 -2
- package/package.json +11 -15
- package/dist/adapters/git.js +0 -54
- package/dist/adapters/local-state.js +0 -155
- package/dist/auth/client.js +0 -30
- package/dist/auth/errors.js +0 -50
- package/dist/auth/guard.js +0 -39
- package/dist/auth/login.js +0 -471
- package/dist/auth/operations.js +0 -208
- package/dist/auth/recipient.js +0 -42
- package/dist/auth/token-storage.js +0 -439
- package/dist/auth/workspaces.js +0 -171
- package/dist/cli-command.js +0 -14
- package/dist/cli-name.js +0 -12
- package/dist/cli2.js +0 -136
- package/dist/command-arguments.js +0 -12
- package/dist/commands/agent/index.js +0 -60
- package/dist/commands/app/index.js +0 -350
- package/dist/commands/auth/index.js +0 -95
- package/dist/commands/branch/index.js +0 -27
- package/dist/commands/bucket/index.js +0 -123
- package/dist/commands/build/index.js +0 -29
- package/dist/commands/database/index.js +0 -249
- package/dist/commands/env.js +0 -99
- package/dist/commands/feedback/index.js +0 -20
- package/dist/commands/git/index.js +0 -36
- package/dist/commands/init/index.js +0 -33
- package/dist/commands/project/index.js +0 -118
- package/dist/commands/version/index.js +0 -18
- package/dist/controllers/agent-setup.js +0 -52
- package/dist/controllers/agent.js +0 -228
- package/dist/controllers/app-env-api.js +0 -55
- package/dist/controllers/app-env-file.js +0 -181
- package/dist/controllers/app-env.js +0 -502
- package/dist/controllers/app.js +0 -2508
- package/dist/controllers/auth.js +0 -124
- package/dist/controllers/branch.js +0 -92
- package/dist/controllers/bucket.js +0 -184
- package/dist/controllers/build.js +0 -88
- package/dist/controllers/database.js +0 -463
- package/dist/controllers/feedback.js +0 -90
- package/dist/controllers/init.js +0 -814
- package/dist/controllers/project.js +0 -892
- package/dist/controllers/select-prompt-port.js +0 -13
- package/dist/controllers/version.js +0 -12
- package/dist/errors.js +0 -102
- package/dist/lib/agent/cli-command.js +0 -20
- package/dist/lib/agent/constants.js +0 -12
- package/dist/lib/agent/package-manager.js +0 -99
- package/dist/lib/agent/setup-status.js +0 -83
- package/dist/lib/app/app-provider.js +0 -617
- package/dist/lib/app/branch-database-api.js +0 -102
- package/dist/lib/app/branch-database-deploy.js +0 -353
- package/dist/lib/app/branch-database.js +0 -234
- package/dist/lib/app/build-settings.js +0 -98
- package/dist/lib/app/build.js +0 -82
- package/dist/lib/app/bun-project.js +0 -45
- package/dist/lib/app/compute-config.js +0 -145
- package/dist/lib/app/deploy-output.js +0 -24
- package/dist/lib/app/deploy-plan.js +0 -59
- package/dist/lib/app/deploy-progress.js +0 -100
- package/dist/lib/app/domain-guidance.js +0 -14
- package/dist/lib/app/env-config.js +0 -67
- package/dist/lib/app/env-file.js +0 -82
- package/dist/lib/app/env-vars.js +0 -50
- package/dist/lib/app/local-dev.js +0 -109
- package/dist/lib/app/production-deploy-gate.js +0 -162
- package/dist/lib/app/read-branch.js +0 -30
- package/dist/lib/bucket/provider.js +0 -139
- package/dist/lib/database/provider.js +0 -385
- package/dist/lib/diagnostics.js +0 -16
- package/dist/lib/feedback.js +0 -15
- package/dist/lib/fs/home-path.js +0 -24
- package/dist/lib/git/local-branch.js +0 -53
- package/dist/lib/git/local-status.js +0 -57
- package/dist/lib/project/interactive-setup.js +0 -57
- package/dist/lib/project/local-pin.js +0 -200
- package/dist/lib/project/provider.js +0 -93
- package/dist/lib/project/resolution.js +0 -389
- package/dist/lib/project/setup.js +0 -138
- package/dist/lib/version.js +0 -56
- package/dist/lib/workspace-id.js +0 -18
- package/dist/output/patterns.js +0 -90
- package/dist/presenters/agent.js +0 -74
- package/dist/presenters/app-env.js +0 -265
- package/dist/presenters/app.js +0 -672
- package/dist/presenters/auth.js +0 -184
- package/dist/presenters/branch.js +0 -46
- package/dist/presenters/bucket.js +0 -174
- package/dist/presenters/database.js +0 -462
- package/dist/presenters/feedback.js +0 -26
- package/dist/presenters/init.js +0 -30
- package/dist/presenters/project.js +0 -268
- package/dist/presenters/verbose-context.js +0 -64
- package/dist/presenters/version.js +0 -29
- package/dist/shell/cli-command.js +0 -2
- package/dist/shell/command-meta.js +0 -923
- package/dist/shell/command-runner.js +0 -119
- package/dist/shell/diagnostics-output.js +0 -57
- package/dist/shell/global-flags.js +0 -37
- package/dist/shell/help.js +0 -90
- package/dist/shell/output.js +0 -144
- package/dist/shell/prompt.js +0 -48
- package/dist/shell/runtime.js +0 -38
- package/dist/shell/ui.js +0 -116
- package/dist/state-dir.js +0 -12
- package/dist/update-check.js +0 -248
- package/dist/v8/cli.js +0 -14699
package/dist/cli2.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { CliError } from "./errors.js";
|
|
2
|
-
import { attachCommandDescriptor } from "./shell/command-meta.js";
|
|
3
|
-
import { createShellUi } from "./shell/ui.js";
|
|
4
|
-
import { addCompactGlobalFlags } from "./shell/global-flags.js";
|
|
5
|
-
import { configureRuntimeCommand, createCommandContext } from "./shell/runtime.js";
|
|
6
|
-
import { formatUnexpectedError, unexpectedErrorFeedbackCommand, writeHumanError, writeJsonError, writeJsonSuccess, writeJsonUnexpectedError } from "./shell/output.js";
|
|
7
|
-
import { createAgentCommand } from "./commands/agent/index.js";
|
|
8
|
-
import "./shell/prompt.js";
|
|
9
|
-
import { createAppCommand } from "./commands/app/index.js";
|
|
10
|
-
import { createAuthCommand } from "./commands/auth/index.js";
|
|
11
|
-
import { createBranchCommand } from "./commands/branch/index.js";
|
|
12
|
-
import { createBucketCommand } from "./commands/bucket/index.js";
|
|
13
|
-
import { createBuildCommand } from "./commands/build/index.js";
|
|
14
|
-
import { createDatabaseCommand } from "./commands/database/index.js";
|
|
15
|
-
import { getCliName, getCliVersion } from "./lib/version.js";
|
|
16
|
-
import { createFeedbackCommand } from "./commands/feedback/index.js";
|
|
17
|
-
import { createGitCommand } from "./commands/git/index.js";
|
|
18
|
-
import { createInitCommand } from "./commands/init/index.js";
|
|
19
|
-
import { createProjectCommand } from "./commands/project/index.js";
|
|
20
|
-
import { runVersion } from "./controllers/version.js";
|
|
21
|
-
import { createVersionCommand } from "./commands/version/index.js";
|
|
22
|
-
import { maybeWriteCachedUpdateNotification } from "./update-check.js";
|
|
23
|
-
import process from "node:process";
|
|
24
|
-
import { Command, CommanderError, Option } from "commander";
|
|
25
|
-
//#region src/cli.ts
|
|
26
|
-
async function runCli(options = {}) {
|
|
27
|
-
const runtime = resolveRuntime(options);
|
|
28
|
-
const program = createProgram(runtime);
|
|
29
|
-
process.exitCode = 0;
|
|
30
|
-
try {
|
|
31
|
-
await maybeWriteCachedUpdateNotification(runtime);
|
|
32
|
-
if (runtime.argv.includes("--version")) return await handleVersionFlag(runtime);
|
|
33
|
-
const bareHelpCommand = resolveBareHelpCommand(program, runtime.argv);
|
|
34
|
-
if (bareHelpCommand) {
|
|
35
|
-
runtime.stderr.write(bareHelpCommand.helpInformation());
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
await program.parseAsync(runtime.argv, { from: "user" });
|
|
39
|
-
return process.exitCode ?? 0;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
if (error instanceof CommanderError) return error.code === "commander.helpDisplayed" ? 0 : 2;
|
|
42
|
-
if (runtime.argv.includes("--json")) {
|
|
43
|
-
writeJsonUnexpectedError({
|
|
44
|
-
stdout: runtime.stdout,
|
|
45
|
-
stderr: runtime.stderr
|
|
46
|
-
}, runtime.argv, error);
|
|
47
|
-
return 1;
|
|
48
|
-
}
|
|
49
|
-
const quiet = runtime.argv.includes("--quiet") || runtime.argv.includes("-q");
|
|
50
|
-
runtime.stderr.write(formatUnexpectedError(error, runtime.argv.includes("--trace"), quiet ? void 0 : unexpectedErrorFeedbackCommand(runtime.argv, error)));
|
|
51
|
-
return 1;
|
|
52
|
-
} finally {
|
|
53
|
-
runtime.stdin;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function createProgram(runtime) {
|
|
57
|
-
const program = attachCommandDescriptor(configureRuntimeCommand(new Command(), runtime), "root");
|
|
58
|
-
addCompactGlobalFlags(program);
|
|
59
|
-
program.addOption(new Option("--version", "Print the CLI version and exit."));
|
|
60
|
-
program.name("prisma").showSuggestionAfterError();
|
|
61
|
-
program.addCommand(createVersionCommand(runtime));
|
|
62
|
-
program.addCommand(createInitCommand(runtime));
|
|
63
|
-
program.addCommand(createFeedbackCommand(runtime));
|
|
64
|
-
program.addCommand(createAgentCommand(runtime));
|
|
65
|
-
program.addCommand(createAuthCommand(runtime));
|
|
66
|
-
program.addCommand(createProjectCommand(runtime));
|
|
67
|
-
program.addCommand(createGitCommand(runtime));
|
|
68
|
-
program.addCommand(createBranchCommand(runtime));
|
|
69
|
-
program.addCommand(createBuildCommand(runtime));
|
|
70
|
-
program.addCommand(createDatabaseCommand(runtime));
|
|
71
|
-
program.addCommand(createBucketCommand(runtime));
|
|
72
|
-
program.addCommand(createAppCommand(runtime));
|
|
73
|
-
return program;
|
|
74
|
-
}
|
|
75
|
-
async function handleVersionFlag(runtime) {
|
|
76
|
-
const wantsJson = runtime.argv.includes("--json");
|
|
77
|
-
const output = {
|
|
78
|
-
stdout: runtime.stdout,
|
|
79
|
-
stderr: runtime.stderr
|
|
80
|
-
};
|
|
81
|
-
try {
|
|
82
|
-
if (wantsJson) {
|
|
83
|
-
const success = await runVersion(await createCommandContext(runtime, buildVersionFlagFlags(runtime)));
|
|
84
|
-
writeJsonSuccess(output, {
|
|
85
|
-
command: success.command,
|
|
86
|
-
result: { version: success.result.cli.version },
|
|
87
|
-
warnings: success.warnings,
|
|
88
|
-
nextSteps: success.nextSteps
|
|
89
|
-
});
|
|
90
|
-
return 0;
|
|
91
|
-
}
|
|
92
|
-
const versionLine = `${getCliName()} ${getCliVersion()}`;
|
|
93
|
-
runtime.stdout.write(`${versionLine}\n`);
|
|
94
|
-
return 0;
|
|
95
|
-
} catch (error) {
|
|
96
|
-
if (error instanceof CliError) {
|
|
97
|
-
if (wantsJson) writeJsonError(output, "version", error);
|
|
98
|
-
else writeHumanError(output, createShellUi(runtime, buildVersionFlagFlags(runtime)), error, { trace: false });
|
|
99
|
-
return error.exitCode;
|
|
100
|
-
}
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function buildVersionFlagFlags(runtime) {
|
|
105
|
-
return {
|
|
106
|
-
json: runtime.argv.includes("--json"),
|
|
107
|
-
quiet: false,
|
|
108
|
-
verbose: false,
|
|
109
|
-
trace: false,
|
|
110
|
-
yes: false,
|
|
111
|
-
interactive: void 0,
|
|
112
|
-
color: void 0
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function resolveBareHelpCommand(program, argv) {
|
|
116
|
-
if (argv.length === 0) return program;
|
|
117
|
-
if (argv.length !== 1) return null;
|
|
118
|
-
const candidate = program.commands.find((command) => command.name() === argv[0]) ?? null;
|
|
119
|
-
if (!candidate) return null;
|
|
120
|
-
if (candidate.commands.length === 0) return null;
|
|
121
|
-
return candidate;
|
|
122
|
-
}
|
|
123
|
-
function resolveRuntime(options) {
|
|
124
|
-
return {
|
|
125
|
-
argv: options.argv ?? process.argv.slice(2),
|
|
126
|
-
cwd: options.cwd ?? process.env.INIT_CWD ?? process.cwd(),
|
|
127
|
-
env: options.env ?? process.env,
|
|
128
|
-
signal: options.signal ?? new AbortController().signal,
|
|
129
|
-
stdin: options.stdin ?? process.stdin,
|
|
130
|
-
stdout: options.stdout ?? process.stdout,
|
|
131
|
-
stderr: options.stderr ?? process.stderr,
|
|
132
|
-
stateDir: options.stateDir
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
136
|
-
export { runCli };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//#region src/command-arguments.ts
|
|
2
|
-
function formatCommandArgument(value) {
|
|
3
|
-
return /^[A-Za-z0-9._/-]+$/.test(value) && !value.startsWith("-") ? value : `'${value.replace(/'/g, "'\\''")}'`;
|
|
4
|
-
}
|
|
5
|
-
function formatShellCommand(command) {
|
|
6
|
-
return command.map(formatShellCommandWord).join(" ");
|
|
7
|
-
}
|
|
8
|
-
function formatShellCommandWord(value) {
|
|
9
|
-
return /^[A-Za-z0-9_./:@=-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { formatCommandArgument, formatShellCommand };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { runAgentInstall, runAgentStatus } from "../../controllers/agent.js";
|
|
2
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
3
|
-
import { renderAgentInstall, renderAgentStatus, serializeAgentInstall, serializeAgentStatus } from "../../presenters/agent.js";
|
|
4
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
5
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
6
|
-
import { runCommand } from "../../shell/command-runner.js";
|
|
7
|
-
import { Command, Option } from "commander";
|
|
8
|
-
//#region src/commands/agent/index.ts
|
|
9
|
-
function createAgentCommand(runtime) {
|
|
10
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("agent"), runtime), "agent");
|
|
11
|
-
addCompactGlobalFlags(command);
|
|
12
|
-
command.addCommand(createAgentInstallCommand(runtime));
|
|
13
|
-
command.addCommand(createAgentUpdateCommand(runtime));
|
|
14
|
-
command.addCommand(createAgentStatusCommand(runtime));
|
|
15
|
-
return command;
|
|
16
|
-
}
|
|
17
|
-
function createAgentInstallCommand(runtime) {
|
|
18
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("install"), runtime), "agent.install");
|
|
19
|
-
addAgentInstallOptions(command);
|
|
20
|
-
addGlobalFlags(command);
|
|
21
|
-
command.action(async (options) => {
|
|
22
|
-
await runCommand(runtime, "agent.install", options, (context) => runAgentInstall(context, options, "install"), {
|
|
23
|
-
renderHuman: (context, descriptor, result) => renderAgentInstall(context, descriptor, result),
|
|
24
|
-
renderJson: (result) => serializeAgentInstall(result)
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
return command;
|
|
28
|
-
}
|
|
29
|
-
function createAgentUpdateCommand(runtime) {
|
|
30
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("update"), runtime), "agent.update");
|
|
31
|
-
addAgentInstallOptions(command);
|
|
32
|
-
addGlobalFlags(command);
|
|
33
|
-
command.action(async (options) => {
|
|
34
|
-
await runCommand(runtime, "agent.update", options, (context) => runAgentInstall(context, options, "update"), {
|
|
35
|
-
renderHuman: (context, descriptor, result) => renderAgentInstall(context, descriptor, result),
|
|
36
|
-
renderJson: (result) => serializeAgentInstall(result)
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
return command;
|
|
40
|
-
}
|
|
41
|
-
function createAgentStatusCommand(runtime) {
|
|
42
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("status"), runtime), "agent.status");
|
|
43
|
-
command.addOption(new Option("--global", "Check globally installed Prisma skills instead of project skills"));
|
|
44
|
-
addGlobalFlags(command);
|
|
45
|
-
command.action(async (options) => {
|
|
46
|
-
await runCommand(runtime, "agent.status", options, (context) => runAgentStatus(context, options), {
|
|
47
|
-
renderHuman: (context, descriptor, result) => renderAgentStatus(context, descriptor, result),
|
|
48
|
-
renderJson: (result) => serializeAgentStatus(result)
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
return command;
|
|
52
|
-
}
|
|
53
|
-
function addAgentInstallOptions(command) {
|
|
54
|
-
command.addOption(new Option("--agent <agent>", "Agent target for Prisma skills; repeat for multiple agents").argParser(collectValues)).addOption(new Option("--all-agents", "Install Prisma skills for every agent supported by the skills CLI")).addOption(new Option("--skill <skill>", "Prisma skill to install; repeat for multiple skills").argParser(collectValues)).addOption(new Option("--global", "Install skills into the user directory instead of the project")).addOption(new Option("--copy", "Ask the skills CLI to copy files instead of symlinking them")).addOption(new Option("--dry-run", "Show changes without writing files"));
|
|
55
|
-
}
|
|
56
|
-
function collectValues(value, previous) {
|
|
57
|
-
return [...previous ?? [], value];
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
export { createAgentCommand };
|
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import { usageError } from "../../errors.js";
|
|
2
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
3
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
4
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
5
|
-
import { runCommand, runStreamingCommand } from "../../shell/command-runner.js";
|
|
6
|
-
import { APP_BUILD_TYPES } from "../../lib/app/build.js";
|
|
7
|
-
import { runAppBuild, runAppDeploy, runAppDomainAdd, runAppDomainRemove, runAppDomainRetry, runAppDomainShow, runAppDomainWait, runAppListDeploys, runAppLogs, runAppOpen, runAppPromote, runAppRemove, runAppRollback, runAppRun, runAppShow, runAppShowDeploy } from "../../controllers/app.js";
|
|
8
|
-
import { isAppDeployAllResult, renderAppBuild, renderAppDeploy, renderAppDeployAll, renderAppDomainAdd, renderAppDomainRemove, renderAppDomainRetry, renderAppDomainShow, renderAppListDeploys, renderAppOpen, renderAppPromote, renderAppRemove, renderAppRollback, renderAppRun, renderAppShow, renderAppShowDeploy, serializeAppBuild, serializeAppDeploy, serializeAppDeployAll, serializeAppDomainAdd, serializeAppDomainRemove, serializeAppDomainRetry, serializeAppDomainShow, serializeAppListDeploys, serializeAppOpen, serializeAppPromote, serializeAppRemove, serializeAppRollback, serializeAppRun, serializeAppShow, serializeAppShowDeploy } from "../../presenters/app.js";
|
|
9
|
-
import { Command, Option } from "commander";
|
|
10
|
-
import { FRAMEWORK_KEYS, LOCAL_DEV_BUILD_TYPES } from "@prisma/compute-sdk/config";
|
|
11
|
-
//#region src/commands/app/index.ts
|
|
12
|
-
function createAppCommand(runtime) {
|
|
13
|
-
const app = attachCommandDescriptor(configureRuntimeCommand(new Command("app"), runtime), "app");
|
|
14
|
-
addCompactGlobalFlags(app);
|
|
15
|
-
app.addCommand(createBuildCommand(runtime));
|
|
16
|
-
app.addCommand(createRunCommand(runtime));
|
|
17
|
-
app.addCommand(createDeployCommand(runtime));
|
|
18
|
-
app.addCommand(createShowCommand(runtime));
|
|
19
|
-
app.addCommand(createOpenCommand(runtime));
|
|
20
|
-
app.addCommand(createDomainCommand(runtime));
|
|
21
|
-
app.addCommand(createLogsCommand(runtime));
|
|
22
|
-
app.addCommand(createListDeploysCommand(runtime));
|
|
23
|
-
app.addCommand(createShowDeployCommand(runtime));
|
|
24
|
-
app.addCommand(createPromoteCommand(runtime));
|
|
25
|
-
app.addCommand(createRollbackCommand(runtime));
|
|
26
|
-
app.addCommand(createRemoveCommand(runtime));
|
|
27
|
-
return app;
|
|
28
|
-
}
|
|
29
|
-
function createBuildCommand(runtime) {
|
|
30
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("build"), runtime), "app.build");
|
|
31
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto builds")).addOption(new Option("--build-type <type>", "Local build type").choices([...APP_BUILD_TYPES]).default("auto"));
|
|
32
|
-
addGlobalFlags(command);
|
|
33
|
-
command.action(async (configTarget, options) => {
|
|
34
|
-
const entry = options.entry;
|
|
35
|
-
const buildType = options.buildType;
|
|
36
|
-
await runCommand(runtime, "app.build", options, (context) => runAppBuild(context, {
|
|
37
|
-
entrypoint: entry,
|
|
38
|
-
buildType,
|
|
39
|
-
configTarget
|
|
40
|
-
}), {
|
|
41
|
-
renderHuman: (context, descriptor, result) => renderAppBuild(context, descriptor, result),
|
|
42
|
-
renderJson: (result) => serializeAppBuild(result)
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
return command;
|
|
46
|
-
}
|
|
47
|
-
function createRunCommand(runtime) {
|
|
48
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("run"), runtime), "app.run");
|
|
49
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--entry <path>", "Entrypoint path for Bun or auto runs")).addOption(new Option("--build-type <type>", "Local framework type").choices(["auto", ...LOCAL_DEV_BUILD_TYPES]).default("auto")).addOption(new Option("--port <port>", "Local port"));
|
|
50
|
-
addGlobalFlags(command);
|
|
51
|
-
command.action(async (configTarget, options) => {
|
|
52
|
-
const entry = options.entry;
|
|
53
|
-
const buildType = options.buildType;
|
|
54
|
-
const port = options.port;
|
|
55
|
-
await runCommand(runtime, "app.run", options, (context) => runAppRun(context, {
|
|
56
|
-
entrypoint: entry,
|
|
57
|
-
buildType,
|
|
58
|
-
port,
|
|
59
|
-
configTarget
|
|
60
|
-
}), {
|
|
61
|
-
renderHuman: (context, descriptor, result) => renderAppRun(context, descriptor, result),
|
|
62
|
-
renderJson: (result) => serializeAppRun(result)
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
return command;
|
|
66
|
-
}
|
|
67
|
-
function createDeployCommand(runtime) {
|
|
68
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("deploy"), runtime), "app.deploy");
|
|
69
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--create-project <name>", "Create and link a new Project before deploying")).addOption(new Option("--branch <name>", "Branch name")).addOption(new Option("--framework <name>", "Framework to deploy").choices([...FRAMEWORK_KEYS])).addOption(new Option("--entry <path>", "Entrypoint path for Bun deploys")).addOption(new Option("--http-port <port>", "HTTP port override for the deployed app")).addOption(new Option("--region <region>", "Region for a newly created app; existing apps keep their region")).addOption(new Option("--env <name=value|file>", "Environment variable assignment or dotenv file").argParser(collectRepeatableValues)).addOption(new Option("--db", "Create and wire a Prisma Postgres database for this deploy target")).addOption(new Option("--no-db", "Skip database setup")).addOption(new Option("--prod", "Confirm intent to deploy to production")).addOption(new Option("--no-promote", "Build the new deployment without promoting it to live (promote later with app promote <id>)"));
|
|
70
|
-
addGlobalFlags(command);
|
|
71
|
-
command.action(async (configTarget, options) => {
|
|
72
|
-
const appName = options.app;
|
|
73
|
-
const entry = options.entry;
|
|
74
|
-
const branchName = options.branch;
|
|
75
|
-
const framework = options.framework;
|
|
76
|
-
const httpPort = options.httpPort;
|
|
77
|
-
const region = options.region;
|
|
78
|
-
const envAssignments = options.env;
|
|
79
|
-
const projectRef = options.project;
|
|
80
|
-
const createProjectName = options.createProject;
|
|
81
|
-
const prod = options.prod;
|
|
82
|
-
const noPromote = options.promote === false;
|
|
83
|
-
const db = options.db;
|
|
84
|
-
const hasDbConflict = hasFlag(runtime.argv, "--db") && hasFlag(runtime.argv, "--no-db");
|
|
85
|
-
await runCommand(runtime, "app.deploy", options, (context) => {
|
|
86
|
-
if (hasDbConflict) throw usageError("app deploy accepts either --db or --no-db", "--db requests database setup, while --no-db disables it.", "Pass exactly one database setup flag.", ["prisma-cli app deploy --db", "prisma-cli app deploy --no-db"], "app");
|
|
87
|
-
return runAppDeploy(context, appName, {
|
|
88
|
-
projectRef,
|
|
89
|
-
createProjectName,
|
|
90
|
-
branchName,
|
|
91
|
-
entrypoint: entry,
|
|
92
|
-
framework,
|
|
93
|
-
httpPort,
|
|
94
|
-
region,
|
|
95
|
-
envAssignments,
|
|
96
|
-
prod: prod === true,
|
|
97
|
-
noPromote,
|
|
98
|
-
db,
|
|
99
|
-
configTarget
|
|
100
|
-
});
|
|
101
|
-
}, {
|
|
102
|
-
renderHuman: (context, descriptor, result) => isAppDeployAllResult(result) ? renderAppDeployAll(context, descriptor, result) : renderAppDeploy(context, descriptor, result),
|
|
103
|
-
renderJson: (result) => isAppDeployAllResult(result) ? serializeAppDeployAll(result) : serializeAppDeploy(result)
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
return command;
|
|
107
|
-
}
|
|
108
|
-
function hasFlag(argv, flag) {
|
|
109
|
-
return argv.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
110
|
-
}
|
|
111
|
-
function createShowCommand(runtime) {
|
|
112
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "app.show");
|
|
113
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
114
|
-
addGlobalFlags(command);
|
|
115
|
-
command.action(async (configTarget, options) => {
|
|
116
|
-
const appName = options.app;
|
|
117
|
-
const projectRef = options.project;
|
|
118
|
-
await runCommand(runtime, "app.show", options, (context) => runAppShow(context, appName, projectRef, configTarget), {
|
|
119
|
-
renderHuman: (context, descriptor, result) => renderAppShow(context, descriptor, result),
|
|
120
|
-
renderJson: (result) => serializeAppShow(result)
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
return command;
|
|
124
|
-
}
|
|
125
|
-
function createOpenCommand(runtime) {
|
|
126
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("open"), runtime), "app.open");
|
|
127
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
128
|
-
addGlobalFlags(command);
|
|
129
|
-
command.action(async (configTarget, options) => {
|
|
130
|
-
const appName = options.app;
|
|
131
|
-
const projectRef = options.project;
|
|
132
|
-
await runCommand(runtime, "app.open", options, (context) => runAppOpen(context, appName, projectRef, configTarget), {
|
|
133
|
-
renderHuman: (context, descriptor, result) => renderAppOpen(context, descriptor, result),
|
|
134
|
-
renderJson: (result) => serializeAppOpen(result)
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
return command;
|
|
138
|
-
}
|
|
139
|
-
function createDomainCommand(runtime) {
|
|
140
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("domain"), runtime), "app.domain");
|
|
141
|
-
addCompactGlobalFlags(command);
|
|
142
|
-
command.addCommand(createDomainAddCommand(runtime));
|
|
143
|
-
command.addCommand(createDomainShowCommand(runtime));
|
|
144
|
-
command.addCommand(createDomainRemoveCommand(runtime));
|
|
145
|
-
command.addCommand(createDomainRetryCommand(runtime));
|
|
146
|
-
command.addCommand(createDomainWaitCommand(runtime));
|
|
147
|
-
return command;
|
|
148
|
-
}
|
|
149
|
-
function addDomainTargetOptions(command) {
|
|
150
|
-
return command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--branch <name>", "Branch name"));
|
|
151
|
-
}
|
|
152
|
-
function createDomainAddCommand(runtime) {
|
|
153
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("add"), runtime), "app.domain.add");
|
|
154
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
155
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
156
|
-
addDomainTargetOptions(command);
|
|
157
|
-
addGlobalFlags(command);
|
|
158
|
-
command.action(async (hostname, configTarget, options) => {
|
|
159
|
-
const appName = options.app;
|
|
160
|
-
const projectRef = options.project;
|
|
161
|
-
const branchName = options.branch;
|
|
162
|
-
await runCommand(runtime, "app.domain.add", options, (context) => runAppDomainAdd(context, hostname, {
|
|
163
|
-
appName,
|
|
164
|
-
projectRef,
|
|
165
|
-
branchName,
|
|
166
|
-
configTarget
|
|
167
|
-
}), {
|
|
168
|
-
renderHuman: (context, descriptor, result) => renderAppDomainAdd(context, descriptor, result),
|
|
169
|
-
renderJson: (result) => serializeAppDomainAdd(result)
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
return command;
|
|
173
|
-
}
|
|
174
|
-
function createDomainShowCommand(runtime) {
|
|
175
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show"), runtime), "app.domain.show");
|
|
176
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
177
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
178
|
-
addDomainTargetOptions(command);
|
|
179
|
-
addGlobalFlags(command);
|
|
180
|
-
command.action(async (hostname, configTarget, options) => {
|
|
181
|
-
const appName = options.app;
|
|
182
|
-
const projectRef = options.project;
|
|
183
|
-
const branchName = options.branch;
|
|
184
|
-
await runCommand(runtime, "app.domain.show", options, (context) => runAppDomainShow(context, hostname, {
|
|
185
|
-
appName,
|
|
186
|
-
projectRef,
|
|
187
|
-
branchName,
|
|
188
|
-
configTarget
|
|
189
|
-
}), {
|
|
190
|
-
renderHuman: (context, descriptor, result) => renderAppDomainShow(context, descriptor, result),
|
|
191
|
-
renderJson: (result) => serializeAppDomainShow(result)
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
return command;
|
|
195
|
-
}
|
|
196
|
-
function createDomainRemoveCommand(runtime) {
|
|
197
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.domain.remove");
|
|
198
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
199
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
200
|
-
addDomainTargetOptions(command);
|
|
201
|
-
addGlobalFlags(command);
|
|
202
|
-
command.action(async (hostname, configTarget, options) => {
|
|
203
|
-
const appName = options.app;
|
|
204
|
-
const projectRef = options.project;
|
|
205
|
-
const branchName = options.branch;
|
|
206
|
-
await runCommand(runtime, "app.domain.remove", options, (context) => runAppDomainRemove(context, hostname, {
|
|
207
|
-
appName,
|
|
208
|
-
projectRef,
|
|
209
|
-
branchName,
|
|
210
|
-
configTarget
|
|
211
|
-
}), {
|
|
212
|
-
renderHuman: (context, descriptor, result) => renderAppDomainRemove(context, descriptor, result),
|
|
213
|
-
renderJson: (result) => serializeAppDomainRemove(result)
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
return command;
|
|
217
|
-
}
|
|
218
|
-
function createDomainRetryCommand(runtime) {
|
|
219
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("retry"), runtime), "app.domain.retry");
|
|
220
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
221
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
222
|
-
addDomainTargetOptions(command);
|
|
223
|
-
addGlobalFlags(command);
|
|
224
|
-
command.action(async (hostname, configTarget, options) => {
|
|
225
|
-
const appName = options.app;
|
|
226
|
-
const projectRef = options.project;
|
|
227
|
-
const branchName = options.branch;
|
|
228
|
-
await runCommand(runtime, "app.domain.retry", options, (context) => runAppDomainRetry(context, hostname, {
|
|
229
|
-
appName,
|
|
230
|
-
projectRef,
|
|
231
|
-
branchName,
|
|
232
|
-
configTarget
|
|
233
|
-
}), {
|
|
234
|
-
renderHuman: (context, descriptor, result) => renderAppDomainRetry(context, descriptor, result),
|
|
235
|
-
renderJson: (result) => serializeAppDomainRetry(result)
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
return command;
|
|
239
|
-
}
|
|
240
|
-
function createDomainWaitCommand(runtime) {
|
|
241
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("wait"), runtime), "app.domain.wait");
|
|
242
|
-
command.argument("<hostname>", "Custom domain hostname");
|
|
243
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
244
|
-
addDomainTargetOptions(command);
|
|
245
|
-
command.addOption(new Option("--timeout <duration>", "Maximum time to wait").default("15m"));
|
|
246
|
-
addGlobalFlags(command);
|
|
247
|
-
command.action(async (hostname, configTarget, options) => {
|
|
248
|
-
const appName = options.app;
|
|
249
|
-
const projectRef = options.project;
|
|
250
|
-
const branchName = options.branch;
|
|
251
|
-
const timeout = options.timeout;
|
|
252
|
-
await runStreamingCommand(runtime, "app.domain.wait", options, (context) => runAppDomainWait(context, hostname, {
|
|
253
|
-
appName,
|
|
254
|
-
projectRef,
|
|
255
|
-
branchName,
|
|
256
|
-
timeout,
|
|
257
|
-
configTarget
|
|
258
|
-
}));
|
|
259
|
-
});
|
|
260
|
-
return command;
|
|
261
|
-
}
|
|
262
|
-
function createLogsCommand(runtime) {
|
|
263
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logs"), runtime), "app.logs");
|
|
264
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--deployment <id>", "Deployment id"));
|
|
265
|
-
addGlobalFlags(command);
|
|
266
|
-
command.action(async (configTarget, options) => {
|
|
267
|
-
const appName = options.app;
|
|
268
|
-
const deploymentId = options.deployment;
|
|
269
|
-
const projectRef = options.project;
|
|
270
|
-
await runStreamingCommand(runtime, "app.logs", options, (context) => runAppLogs(context, appName, deploymentId, projectRef, configTarget));
|
|
271
|
-
});
|
|
272
|
-
return command;
|
|
273
|
-
}
|
|
274
|
-
function collectRepeatableValues(value, previous) {
|
|
275
|
-
return [...previous ?? [], value];
|
|
276
|
-
}
|
|
277
|
-
function createListDeploysCommand(runtime) {
|
|
278
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list-deploys"), runtime), "app.list-deploys");
|
|
279
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
280
|
-
addGlobalFlags(command);
|
|
281
|
-
command.action(async (configTarget, options) => {
|
|
282
|
-
const appName = options.app;
|
|
283
|
-
const projectRef = options.project;
|
|
284
|
-
await runCommand(runtime, "app.list-deploys", options, (context) => runAppListDeploys(context, appName, projectRef, configTarget), {
|
|
285
|
-
renderHuman: (context, descriptor, result) => renderAppListDeploys(context, descriptor, result),
|
|
286
|
-
renderJson: (result) => serializeAppListDeploys(result)
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
return command;
|
|
290
|
-
}
|
|
291
|
-
function createShowDeployCommand(runtime) {
|
|
292
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("show-deploy"), runtime), "app.show-deploy");
|
|
293
|
-
command.argument("<deployment>", "Deployment id");
|
|
294
|
-
addGlobalFlags(command);
|
|
295
|
-
command.action(async (deploymentId, options) => {
|
|
296
|
-
await runCommand(runtime, "app.show-deploy", options, (context) => runAppShowDeploy(context, deploymentId), {
|
|
297
|
-
renderHuman: (context, descriptor, result) => renderAppShowDeploy(context, descriptor, result),
|
|
298
|
-
renderJson: (result) => serializeAppShowDeploy(result)
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
return command;
|
|
302
|
-
}
|
|
303
|
-
function createPromoteCommand(runtime) {
|
|
304
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("promote"), runtime), "app.promote");
|
|
305
|
-
command.argument("<deployment>", "Deployment id");
|
|
306
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps");
|
|
307
|
-
command.addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
|
|
308
|
-
addGlobalFlags(command);
|
|
309
|
-
command.action(async (deploymentId, configTarget, options) => {
|
|
310
|
-
const appName = options.app;
|
|
311
|
-
const projectRef = options.project;
|
|
312
|
-
await runCommand(runtime, "app.promote", options, (context) => runAppPromote(context, deploymentId, appName, projectRef, configTarget), {
|
|
313
|
-
renderHuman: (context, descriptor, result) => renderAppPromote(context, descriptor, result),
|
|
314
|
-
renderJson: (result) => serializeAppPromote(result)
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
return command;
|
|
318
|
-
}
|
|
319
|
-
function createRollbackCommand(runtime) {
|
|
320
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("rollback"), runtime), "app.rollback");
|
|
321
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--to <deployment>", "Deployment id"));
|
|
322
|
-
addGlobalFlags(command);
|
|
323
|
-
command.action(async (configTarget, options) => {
|
|
324
|
-
const appName = options.app;
|
|
325
|
-
const deploymentId = options.to;
|
|
326
|
-
const projectRef = options.project;
|
|
327
|
-
await runCommand(runtime, "app.rollback", options, (context) => runAppRollback(context, appName, deploymentId, projectRef, configTarget), {
|
|
328
|
-
renderHuman: (context, descriptor, result) => renderAppRollback(context, descriptor, result),
|
|
329
|
-
renderJson: (result) => serializeAppRollback(result)
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
return command;
|
|
333
|
-
}
|
|
334
|
-
function createRemoveCommand(runtime) {
|
|
335
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.remove");
|
|
336
|
-
command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--branch <name>", "Branch name"));
|
|
337
|
-
addGlobalFlags(command);
|
|
338
|
-
command.action(async (configTarget, options) => {
|
|
339
|
-
const appName = options.app;
|
|
340
|
-
const projectRef = options.project;
|
|
341
|
-
const branchName = options.branch;
|
|
342
|
-
await runCommand(runtime, "app.remove", options, (context) => runAppRemove(context, appName, projectRef, configTarget, branchName), {
|
|
343
|
-
renderHuman: (context, descriptor, result) => renderAppRemove(context, descriptor, result),
|
|
344
|
-
renderJson: (result) => serializeAppRemove(result)
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
return command;
|
|
348
|
-
}
|
|
349
|
-
//#endregion
|
|
350
|
-
export { createAppCommand };
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { attachCommandDescriptor } from "../../shell/command-meta.js";
|
|
2
|
-
import { addCompactGlobalFlags, addGlobalFlags } from "../../shell/global-flags.js";
|
|
3
|
-
import { configureRuntimeCommand } from "../../shell/runtime.js";
|
|
4
|
-
import { runCommand } from "../../shell/command-runner.js";
|
|
5
|
-
import { runAuthLogin, runAuthLogout, runAuthWhoAmI, runAuthWorkspaceList, runAuthWorkspaceLogout, runAuthWorkspaceUse } from "../../controllers/auth.js";
|
|
6
|
-
import { renderAuthSuccess, renderAuthWorkspaceList, renderAuthWorkspaceLogout, renderAuthWorkspaceUse, serializeAuthWorkspaceList, serializeAuthWorkspaceLogout, serializeAuthWorkspaceUse } from "../../presenters/auth.js";
|
|
7
|
-
import { Command, Option } from "commander";
|
|
8
|
-
//#region src/commands/auth/index.ts
|
|
9
|
-
function createAuthCommand(runtime) {
|
|
10
|
-
const auth = attachCommandDescriptor(configureRuntimeCommand(new Command("auth"), runtime), "auth");
|
|
11
|
-
addCompactGlobalFlags(auth);
|
|
12
|
-
auth.addCommand(createAuthLoginCommand(runtime));
|
|
13
|
-
auth.addCommand(createAuthLogoutCommand(runtime));
|
|
14
|
-
auth.addCommand(createAuthWhoAmICommand(runtime));
|
|
15
|
-
auth.addCommand(createAuthWorkspaceCommand(runtime));
|
|
16
|
-
return auth;
|
|
17
|
-
}
|
|
18
|
-
function createAuthLoginCommand(runtime) {
|
|
19
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("login"), runtime), "auth.login");
|
|
20
|
-
addGlobalFlags(command);
|
|
21
|
-
command.action(async (options) => {
|
|
22
|
-
await runCommand(runtime, "auth.login", options, (context) => runAuthLogin(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.login", result) });
|
|
23
|
-
});
|
|
24
|
-
return command;
|
|
25
|
-
}
|
|
26
|
-
function createAuthLogoutCommand(runtime) {
|
|
27
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logout"), runtime), "auth.logout");
|
|
28
|
-
command.addOption(new Option("--workspace <id-or-name>", "Remove one stored OAuth workspace session"));
|
|
29
|
-
addGlobalFlags(command);
|
|
30
|
-
command.action(async (options) => {
|
|
31
|
-
const logoutOptions = options;
|
|
32
|
-
if (logoutOptions.workspace?.trim()) {
|
|
33
|
-
await runCommand(runtime, "auth.workspace.logout", options, (context) => runAuthWorkspaceLogout(context, logoutOptions.workspace), {
|
|
34
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceLogout(context, descriptor, result),
|
|
35
|
-
renderJson: (result) => serializeAuthWorkspaceLogout(result)
|
|
36
|
-
});
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
await runCommand(runtime, "auth.logout", options, (context) => runAuthLogout(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.logout", result) });
|
|
40
|
-
});
|
|
41
|
-
return command;
|
|
42
|
-
}
|
|
43
|
-
function createAuthWhoAmICommand(runtime) {
|
|
44
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("whoami"), runtime), "auth.whoami");
|
|
45
|
-
addGlobalFlags(command);
|
|
46
|
-
command.action(async (options) => {
|
|
47
|
-
await runCommand(runtime, "auth.whoami", options, (context) => runAuthWhoAmI(context), { renderHuman: (context, descriptor, result) => renderAuthSuccess(context, descriptor, "auth.whoami", result) });
|
|
48
|
-
});
|
|
49
|
-
return command;
|
|
50
|
-
}
|
|
51
|
-
function createAuthWorkspaceCommand(runtime) {
|
|
52
|
-
const workspace = attachCommandDescriptor(configureRuntimeCommand(new Command("workspace"), runtime), "auth.workspace");
|
|
53
|
-
addCompactGlobalFlags(workspace);
|
|
54
|
-
workspace.addCommand(createAuthWorkspaceListCommand(runtime));
|
|
55
|
-
workspace.addCommand(createAuthWorkspaceUseCommand(runtime));
|
|
56
|
-
workspace.addCommand(createAuthWorkspaceLogoutCommand(runtime));
|
|
57
|
-
return workspace;
|
|
58
|
-
}
|
|
59
|
-
function createAuthWorkspaceListCommand(runtime) {
|
|
60
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("list"), runtime), "auth.workspace.list");
|
|
61
|
-
addGlobalFlags(command);
|
|
62
|
-
command.action(async (options) => {
|
|
63
|
-
await runCommand(runtime, "auth.workspace.list", options, (context) => runAuthWorkspaceList(context), {
|
|
64
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceList(context, descriptor, result),
|
|
65
|
-
renderJson: (result) => serializeAuthWorkspaceList(result)
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
return command;
|
|
69
|
-
}
|
|
70
|
-
function createAuthWorkspaceLogoutCommand(runtime) {
|
|
71
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("logout"), runtime), "auth.workspace.logout");
|
|
72
|
-
command.argument("<id-or-name>", "Workspace id or exact name");
|
|
73
|
-
addGlobalFlags(command);
|
|
74
|
-
command.action(async (workspaceRef, options) => {
|
|
75
|
-
await runCommand(runtime, "auth.workspace.logout", options, (context) => runAuthWorkspaceLogout(context, typeof workspaceRef === "string" ? workspaceRef : void 0), {
|
|
76
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceLogout(context, descriptor, result),
|
|
77
|
-
renderJson: (result) => serializeAuthWorkspaceLogout(result)
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
return command;
|
|
81
|
-
}
|
|
82
|
-
function createAuthWorkspaceUseCommand(runtime) {
|
|
83
|
-
const command = attachCommandDescriptor(configureRuntimeCommand(new Command("use"), runtime), "auth.workspace.use");
|
|
84
|
-
command.argument("[id-or-name]", "Workspace id or exact name");
|
|
85
|
-
addGlobalFlags(command);
|
|
86
|
-
command.action(async (workspaceRef, options) => {
|
|
87
|
-
await runCommand(runtime, "auth.workspace.use", options, (context) => runAuthWorkspaceUse(context, typeof workspaceRef === "string" ? workspaceRef : void 0), {
|
|
88
|
-
renderHuman: (context, descriptor, result) => renderAuthWorkspaceUse(context, descriptor, result),
|
|
89
|
-
renderJson: (result) => serializeAuthWorkspaceUse(result)
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
return command;
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
export { createAuthCommand };
|