@getmonoceros/workbench 1.19.2 → 1.20.0
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/bin.js +206 -465
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -3259,8 +3259,8 @@ function removeRepoFromDoc(doc, urlOrPath) {
|
|
|
3259
3259
|
if (!isMap2(item)) return false;
|
|
3260
3260
|
const url = item.get("url");
|
|
3261
3261
|
if (url === urlOrPath) return true;
|
|
3262
|
-
const
|
|
3263
|
-
const effectivePath = typeof
|
|
3262
|
+
const path24 = item.get("path");
|
|
3263
|
+
const effectivePath = typeof path24 === "string" ? path24 : typeof url === "string" ? deriveRepoName(url) : void 0;
|
|
3264
3264
|
return effectivePath === urlOrPath;
|
|
3265
3265
|
});
|
|
3266
3266
|
if (idx < 0) return false;
|
|
@@ -3372,7 +3372,7 @@ async function runAddRepo(input) {
|
|
|
3372
3372
|
"Missing repo URL. Usage: monoceros add-repo <containername> <url>."
|
|
3373
3373
|
);
|
|
3374
3374
|
}
|
|
3375
|
-
const
|
|
3375
|
+
const path24 = (input.path ?? deriveRepoName(url)).trim();
|
|
3376
3376
|
const hasName = typeof input.gitName === "string" && input.gitName.trim().length > 0;
|
|
3377
3377
|
const hasEmail = typeof input.gitEmail === "string" && input.gitEmail.trim().length > 0;
|
|
3378
3378
|
if (hasName !== hasEmail) {
|
|
@@ -3409,7 +3409,7 @@ async function runAddRepo(input) {
|
|
|
3409
3409
|
const providerToWrite = !canonical && explicitProvider ? explicitProvider : void 0;
|
|
3410
3410
|
const entry2 = {
|
|
3411
3411
|
url,
|
|
3412
|
-
path:
|
|
3412
|
+
path: path24,
|
|
3413
3413
|
...hasName && hasEmail ? {
|
|
3414
3414
|
gitUser: {
|
|
3415
3415
|
name: input.gitName.trim(),
|
|
@@ -6407,7 +6407,7 @@ var CLI_VERSION;
|
|
|
6407
6407
|
var init_version = __esm({
|
|
6408
6408
|
"src/version.ts"() {
|
|
6409
6409
|
"use strict";
|
|
6410
|
-
CLI_VERSION = true ? "1.
|
|
6410
|
+
CLI_VERSION = true ? "1.20.0" : "dev";
|
|
6411
6411
|
}
|
|
6412
6412
|
});
|
|
6413
6413
|
|
|
@@ -6596,43 +6596,6 @@ var init_completion = __esm({
|
|
|
6596
6596
|
}
|
|
6597
6597
|
});
|
|
6598
6598
|
|
|
6599
|
-
// src/login/services.ts
|
|
6600
|
-
function featureLeaf(ref) {
|
|
6601
|
-
const noTag = ref.replace(/:[^/:]*$/, "");
|
|
6602
|
-
return noTag.slice(noTag.lastIndexOf("/") + 1);
|
|
6603
|
-
}
|
|
6604
|
-
function loginCapableServices(refs) {
|
|
6605
|
-
const out = [];
|
|
6606
|
-
for (const ref of refs) {
|
|
6607
|
-
const service = LOGIN_SERVICE_BY_LEAF[featureLeaf(ref)];
|
|
6608
|
-
if (service && !out.includes(service)) out.push(service);
|
|
6609
|
-
}
|
|
6610
|
-
return out;
|
|
6611
|
-
}
|
|
6612
|
-
function parseCallbackTarget(authUrl) {
|
|
6613
|
-
try {
|
|
6614
|
-
const u = new URL(authUrl);
|
|
6615
|
-
const redirect = u.searchParams.get("redirect_uri");
|
|
6616
|
-
if (!redirect) return null;
|
|
6617
|
-
const r = new URL(redirect);
|
|
6618
|
-
if (r.hostname !== "localhost" && r.hostname !== "127.0.0.1") return null;
|
|
6619
|
-
const port = Number(r.port);
|
|
6620
|
-
if (!Number.isInteger(port) || port <= 0) return null;
|
|
6621
|
-
return { port, pathname: r.pathname };
|
|
6622
|
-
} catch {
|
|
6623
|
-
return null;
|
|
6624
|
-
}
|
|
6625
|
-
}
|
|
6626
|
-
var LOGIN_SERVICE_BY_LEAF;
|
|
6627
|
-
var init_services = __esm({
|
|
6628
|
-
"src/login/services.ts"() {
|
|
6629
|
-
"use strict";
|
|
6630
|
-
LOGIN_SERVICE_BY_LEAF = {
|
|
6631
|
-
"claude-code": "claude"
|
|
6632
|
-
};
|
|
6633
|
-
}
|
|
6634
|
-
});
|
|
6635
|
-
|
|
6636
6599
|
// src/completion/resolve.ts
|
|
6637
6600
|
import { existsSync as existsSync8, promises as fs13 } from "fs";
|
|
6638
6601
|
import path16 from "path";
|
|
@@ -6789,20 +6752,6 @@ async function listContainerNames(ctx) {
|
|
|
6789
6752
|
const entries = await fs13.readdir(dir);
|
|
6790
6753
|
return entries.filter((e) => e.endsWith(".yml")).map((e) => e.slice(0, -".yml".length)).sort();
|
|
6791
6754
|
}
|
|
6792
|
-
async function listLoginServices(ctx) {
|
|
6793
|
-
const after = ctx.prev.slice(2);
|
|
6794
|
-
const name = after.find((t) => !t.startsWith("-"));
|
|
6795
|
-
if (!name) return [];
|
|
6796
|
-
const home = ctx.opts.monocerosHome ?? monocerosHome();
|
|
6797
|
-
const cfgPath = path16.join(home, "container-configs", `${name}.yml`);
|
|
6798
|
-
if (!existsSync8(cfgPath)) return [];
|
|
6799
|
-
try {
|
|
6800
|
-
const { config } = await readConfig(cfgPath);
|
|
6801
|
-
return loginCapableServices(config.features.map((f) => f.ref));
|
|
6802
|
-
} catch {
|
|
6803
|
-
return [];
|
|
6804
|
-
}
|
|
6805
|
-
}
|
|
6806
6755
|
async function listFeatureComponents() {
|
|
6807
6756
|
const catalog = await loadComponentCatalog();
|
|
6808
6757
|
return [...catalog.values()].filter((c) => c.file.category === "feature").map((c) => c.name).sort();
|
|
@@ -6870,18 +6819,15 @@ var init_resolve = __esm({
|
|
|
6870
6819
|
"src/completion/resolve.ts"() {
|
|
6871
6820
|
"use strict";
|
|
6872
6821
|
init_paths();
|
|
6873
|
-
init_io();
|
|
6874
6822
|
init_components();
|
|
6875
6823
|
init_manifest();
|
|
6876
6824
|
init_catalog();
|
|
6877
|
-
init_services();
|
|
6878
6825
|
init_schema();
|
|
6879
6826
|
ALL_COMMANDS = [
|
|
6880
6827
|
"init",
|
|
6881
6828
|
"list-components",
|
|
6882
6829
|
"shell",
|
|
6883
6830
|
"run",
|
|
6884
|
-
"login",
|
|
6885
6831
|
"logs",
|
|
6886
6832
|
"start",
|
|
6887
6833
|
"stop",
|
|
@@ -6950,7 +6896,6 @@ var init_resolve = __esm({
|
|
|
6950
6896
|
positionals: [containerName],
|
|
6951
6897
|
flags: { "--in": { type: "value" } }
|
|
6952
6898
|
},
|
|
6953
|
-
login: { positionals: [containerName, (ctx) => listLoginServices(ctx)] },
|
|
6954
6899
|
logs: { positionals: [containerName] },
|
|
6955
6900
|
start: { positionals: [containerName] },
|
|
6956
6901
|
stop: { positionals: [containerName] },
|
|
@@ -7923,270 +7868,15 @@ var init_list_components = __esm({
|
|
|
7923
7868
|
}
|
|
7924
7869
|
});
|
|
7925
7870
|
|
|
7926
|
-
// src/
|
|
7871
|
+
// src/commands/logs.ts
|
|
7872
|
+
import { spawn as spawn8 } from "child_process";
|
|
7927
7873
|
import { existsSync as existsSync10 } from "fs";
|
|
7928
7874
|
import path18 from "path";
|
|
7929
|
-
async function runShell(opts) {
|
|
7930
|
-
assertContainerExists(opts.root);
|
|
7931
|
-
const spawnFn = opts.spawn ?? spawnDevcontainer;
|
|
7932
|
-
const upCode = await spawnFn(
|
|
7933
|
-
["up", "--workspace-folder", opts.root, "--mount-workspace-git-root=false"],
|
|
7934
|
-
opts.root,
|
|
7935
|
-
{ quiet: true }
|
|
7936
|
-
);
|
|
7937
|
-
if (upCode !== 0) return upCode;
|
|
7938
|
-
return spawnFn(
|
|
7939
|
-
[
|
|
7940
|
-
"exec",
|
|
7941
|
-
"--workspace-folder",
|
|
7942
|
-
opts.root,
|
|
7943
|
-
"--mount-workspace-git-root=false",
|
|
7944
|
-
"bash"
|
|
7945
|
-
],
|
|
7946
|
-
opts.root,
|
|
7947
|
-
{ interactive: true }
|
|
7948
|
-
);
|
|
7949
|
-
}
|
|
7950
|
-
function assertContainerExists(root) {
|
|
7951
|
-
if (!existsSync10(path18.join(root, ".devcontainer"))) {
|
|
7952
|
-
throw new Error(
|
|
7953
|
-
`No .devcontainer/ at ${root}. Run \`monoceros apply <name>\` first.`
|
|
7954
|
-
);
|
|
7955
|
-
}
|
|
7956
|
-
}
|
|
7957
|
-
var init_shell = __esm({
|
|
7958
|
-
"src/devcontainer/shell.ts"() {
|
|
7959
|
-
"use strict";
|
|
7960
|
-
init_cli();
|
|
7961
|
-
}
|
|
7962
|
-
});
|
|
7963
|
-
|
|
7964
|
-
// src/login/index.ts
|
|
7965
|
-
import { spawn as spawn8 } from "child_process";
|
|
7966
|
-
import { existsSync as existsSync11, promises as fsp2, readFileSync as readFileSync6 } from "fs";
|
|
7967
|
-
import http from "http";
|
|
7968
|
-
import path19 from "path";
|
|
7969
|
-
import { consola as consola16 } from "consola";
|
|
7970
|
-
function openInBrowser(url) {
|
|
7971
|
-
const platform = process.platform;
|
|
7972
|
-
const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
7973
|
-
try {
|
|
7974
|
-
const child = spawn8(cmd, args, {
|
|
7975
|
-
stdio: "ignore",
|
|
7976
|
-
detached: true
|
|
7977
|
-
});
|
|
7978
|
-
child.on("error", () => {
|
|
7979
|
-
});
|
|
7980
|
-
child.unref();
|
|
7981
|
-
} catch {
|
|
7982
|
-
}
|
|
7983
|
-
}
|
|
7984
|
-
async function runLogin(opts) {
|
|
7985
|
-
const root = containerDir(opts.name);
|
|
7986
|
-
assertContainerExists(root);
|
|
7987
|
-
const { config } = await readConfig(containerConfigPath(opts.name));
|
|
7988
|
-
const capable = loginCapableServices(config.features.map((f) => f.ref));
|
|
7989
|
-
if (capable.length === 0) {
|
|
7990
|
-
consola16.error(
|
|
7991
|
-
`Container "${opts.name}" has no tool with a Monoceros login. (Supported today: claude.)`
|
|
7992
|
-
);
|
|
7993
|
-
return 1;
|
|
7994
|
-
}
|
|
7995
|
-
if (!opts.feature) {
|
|
7996
|
-
consola16.info(
|
|
7997
|
-
`Login-capable tools in "${opts.name}": ${capable.join(", ")}.`
|
|
7998
|
-
);
|
|
7999
|
-
consola16.info(`Log one in with: monoceros login ${opts.name} <tool>`);
|
|
8000
|
-
return 0;
|
|
8001
|
-
}
|
|
8002
|
-
const service = opts.feature;
|
|
8003
|
-
if (!capable.includes(service)) {
|
|
8004
|
-
consola16.error(
|
|
8005
|
-
`"${service}" is not a login-capable tool in "${opts.name}". Available: ${capable.join(", ")}.`
|
|
8006
|
-
);
|
|
8007
|
-
return 1;
|
|
8008
|
-
}
|
|
8009
|
-
if (service !== "claude") {
|
|
8010
|
-
consola16.error(
|
|
8011
|
-
`Login for "${service}" is not implemented yet (only claude).`
|
|
8012
|
-
);
|
|
8013
|
-
return 1;
|
|
8014
|
-
}
|
|
8015
|
-
return runClaudeLogin(opts.name, root, opts.spawn ?? spawnDevcontainer);
|
|
8016
|
-
}
|
|
8017
|
-
async function runClaudeLogin(name, root, spawnFn) {
|
|
8018
|
-
const credFile = path19.join(root, "home", ".claude", ".credentials.json");
|
|
8019
|
-
if (existsSync11(credFile)) {
|
|
8020
|
-
consola16.success(
|
|
8021
|
-
`Claude is already logged in for "${name}". Re-apply or remove the credential to log in again.`
|
|
8022
|
-
);
|
|
8023
|
-
return 0;
|
|
8024
|
-
}
|
|
8025
|
-
const upCode = await spawnFn(
|
|
8026
|
-
["up", "--workspace-folder", root, "--mount-workspace-git-root=false"],
|
|
8027
|
-
root,
|
|
8028
|
-
{ quiet: true }
|
|
8029
|
-
);
|
|
8030
|
-
if (upCode !== 0) return upCode;
|
|
8031
|
-
const relayDir = path19.join(root, RELAY_DIRNAME);
|
|
8032
|
-
const relayScript = path19.join(relayDir, "xdg-open");
|
|
8033
|
-
const urlFile = path19.join(relayDir, "url");
|
|
8034
|
-
await fsp2.mkdir(relayDir, { recursive: true });
|
|
8035
|
-
await fsp2.rm(urlFile, { force: true });
|
|
8036
|
-
await fsp2.writeFile(
|
|
8037
|
-
relayScript,
|
|
8038
|
-
`#!/bin/sh
|
|
8039
|
-
printf '%s\\n' "$1" > "$(dirname "$0")/url"
|
|
8040
|
-
exit 0
|
|
8041
|
-
`,
|
|
8042
|
-
{ mode: 493 }
|
|
8043
|
-
);
|
|
8044
|
-
await fsp2.chmod(relayScript, 493);
|
|
8045
|
-
const servers = [];
|
|
8046
|
-
let handledUrl = false;
|
|
8047
|
-
const onAuthUrl = (authUrl) => {
|
|
8048
|
-
openInBrowser(authUrl);
|
|
8049
|
-
const target = parseCallbackTarget(authUrl);
|
|
8050
|
-
if (!target) {
|
|
8051
|
-
return;
|
|
8052
|
-
}
|
|
8053
|
-
const server = http.createServer((req, res) => {
|
|
8054
|
-
const reqUrl = req.url ?? target.pathname;
|
|
8055
|
-
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
8056
|
-
res.end(
|
|
8057
|
-
'<html><body style="font-family:sans-serif;padding:3rem">You are signed in. You can close this tab and return to the terminal.</body></html>'
|
|
8058
|
-
);
|
|
8059
|
-
void spawnFn(
|
|
8060
|
-
[
|
|
8061
|
-
"exec",
|
|
8062
|
-
"--workspace-folder",
|
|
8063
|
-
root,
|
|
8064
|
-
"--mount-workspace-git-root=false",
|
|
8065
|
-
"curl",
|
|
8066
|
-
"-fsS",
|
|
8067
|
-
`http://localhost:${target.port}${reqUrl}`
|
|
8068
|
-
],
|
|
8069
|
-
root,
|
|
8070
|
-
{ quiet: true }
|
|
8071
|
-
);
|
|
8072
|
-
});
|
|
8073
|
-
server.on("error", (err) => {
|
|
8074
|
-
consola16.warn(
|
|
8075
|
-
`Could not start the local callback helper on port ${target.port} (${err.message}). If the browser shows a code, paste it into the terminal instead.`
|
|
8076
|
-
);
|
|
8077
|
-
});
|
|
8078
|
-
server.listen(target.port, "127.0.0.1");
|
|
8079
|
-
servers.push(server);
|
|
8080
|
-
};
|
|
8081
|
-
const poll = setInterval(() => {
|
|
8082
|
-
if (handledUrl || !existsSync11(urlFile)) return;
|
|
8083
|
-
let content = "";
|
|
8084
|
-
try {
|
|
8085
|
-
content = readFileSync6(urlFile, "utf8");
|
|
8086
|
-
} catch {
|
|
8087
|
-
return;
|
|
8088
|
-
}
|
|
8089
|
-
if (!content.trim()) return;
|
|
8090
|
-
handledUrl = true;
|
|
8091
|
-
onAuthUrl(content.trim());
|
|
8092
|
-
}, 250);
|
|
8093
|
-
consola16.info("Logging in to Claude \u2014 a browser window will open for you.");
|
|
8094
|
-
const child = spawn8(
|
|
8095
|
-
process.execPath,
|
|
8096
|
-
[
|
|
8097
|
-
devcontainerCliPath(),
|
|
8098
|
-
"exec",
|
|
8099
|
-
"--workspace-folder",
|
|
8100
|
-
root,
|
|
8101
|
-
"--mount-workspace-git-root=false",
|
|
8102
|
-
"bash",
|
|
8103
|
-
"-lc",
|
|
8104
|
-
`export PATH="/workspaces/${name}/${RELAY_DIRNAME}:$PATH"; exec claude auth login`
|
|
8105
|
-
],
|
|
8106
|
-
{
|
|
8107
|
-
cwd: root,
|
|
8108
|
-
env: { ...process.env, DOCKER_CLI_HINTS: "false" },
|
|
8109
|
-
stdio: "inherit"
|
|
8110
|
-
}
|
|
8111
|
-
);
|
|
8112
|
-
const code = await new Promise((resolve) => {
|
|
8113
|
-
child.on("error", () => resolve(1));
|
|
8114
|
-
child.on("exit", (c) => resolve(c ?? 0));
|
|
8115
|
-
});
|
|
8116
|
-
clearInterval(poll);
|
|
8117
|
-
for (const s of servers) s.close();
|
|
8118
|
-
await fsp2.rm(relayDir, { recursive: true, force: true });
|
|
8119
|
-
if (existsSync11(credFile)) {
|
|
8120
|
-
consola16.success(
|
|
8121
|
-
`Claude is logged in for "${name}". The credential persists across rebuilds.`
|
|
8122
|
-
);
|
|
8123
|
-
}
|
|
8124
|
-
return code;
|
|
8125
|
-
}
|
|
8126
|
-
var RELAY_DIRNAME;
|
|
8127
|
-
var init_login = __esm({
|
|
8128
|
-
"src/login/index.ts"() {
|
|
8129
|
-
"use strict";
|
|
8130
|
-
init_io();
|
|
8131
|
-
init_paths();
|
|
8132
|
-
init_cli();
|
|
8133
|
-
init_shell();
|
|
8134
|
-
init_services();
|
|
8135
|
-
RELAY_DIRNAME = ".monoceros-login";
|
|
8136
|
-
}
|
|
8137
|
-
});
|
|
8138
|
-
|
|
8139
|
-
// src/commands/login.ts
|
|
8140
7875
|
import { defineCommand as defineCommand13 } from "citty";
|
|
8141
|
-
import { consola as consola17 } from "consola";
|
|
8142
|
-
var loginCommand;
|
|
8143
|
-
var init_login2 = __esm({
|
|
8144
|
-
"src/commands/login.ts"() {
|
|
8145
|
-
"use strict";
|
|
8146
|
-
init_login();
|
|
8147
|
-
loginCommand = defineCommand13({
|
|
8148
|
-
meta: {
|
|
8149
|
-
name: "login",
|
|
8150
|
-
group: "lifecycle",
|
|
8151
|
-
description: "Log a curated tool in inside the container. Opens the sign-in page in your browser for you \u2014 no copying URLs. Today: Claude."
|
|
8152
|
-
},
|
|
8153
|
-
args: {
|
|
8154
|
-
name: {
|
|
8155
|
-
type: "positional",
|
|
8156
|
-
description: "Container name.",
|
|
8157
|
-
required: true
|
|
8158
|
-
},
|
|
8159
|
-
feature: {
|
|
8160
|
-
type: "positional",
|
|
8161
|
-
description: "Which tool to log in (e.g. `claude`). Optional when the container has only one login-capable tool.",
|
|
8162
|
-
required: false
|
|
8163
|
-
}
|
|
8164
|
-
},
|
|
8165
|
-
async run({ args }) {
|
|
8166
|
-
try {
|
|
8167
|
-
const code = await runLogin({
|
|
8168
|
-
name: args.name,
|
|
8169
|
-
...args.feature ? { feature: args.feature } : {}
|
|
8170
|
-
});
|
|
8171
|
-
process.exit(code);
|
|
8172
|
-
} catch (err) {
|
|
8173
|
-
consola17.error(err instanceof Error ? err.message : String(err));
|
|
8174
|
-
process.exit(1);
|
|
8175
|
-
}
|
|
8176
|
-
}
|
|
8177
|
-
});
|
|
8178
|
-
}
|
|
8179
|
-
});
|
|
8180
|
-
|
|
8181
|
-
// src/commands/logs.ts
|
|
8182
|
-
import { spawn as spawn9 } from "child_process";
|
|
8183
|
-
import { existsSync as existsSync12 } from "fs";
|
|
8184
|
-
import path20 from "path";
|
|
8185
|
-
import { defineCommand as defineCommand14 } from "citty";
|
|
8186
7876
|
function tailLogFile(file, follow) {
|
|
8187
7877
|
const [cmd, args] = follow ? ["tail", ["-F", file]] : ["cat", [file]];
|
|
8188
7878
|
return new Promise((resolve, reject) => {
|
|
8189
|
-
const child =
|
|
7879
|
+
const child = spawn8(cmd, args, { stdio: "inherit" });
|
|
8190
7880
|
child.on("error", reject);
|
|
8191
7881
|
child.on("exit", (code) => resolve(code ?? 0));
|
|
8192
7882
|
});
|
|
@@ -8198,7 +7888,7 @@ var init_logs = __esm({
|
|
|
8198
7888
|
init_paths();
|
|
8199
7889
|
init_compose();
|
|
8200
7890
|
init_dispatch();
|
|
8201
|
-
logsCommand =
|
|
7891
|
+
logsCommand = defineCommand13({
|
|
8202
7892
|
meta: {
|
|
8203
7893
|
name: "logs",
|
|
8204
7894
|
group: "run",
|
|
@@ -8224,8 +7914,8 @@ var init_logs = __esm({
|
|
|
8224
7914
|
run({ args }) {
|
|
8225
7915
|
const service = typeof args.service === "string" ? args.service : void 0;
|
|
8226
7916
|
if (service) {
|
|
8227
|
-
const logFile =
|
|
8228
|
-
if (
|
|
7917
|
+
const logFile = path18.join(containerLogsDir(args.name), `${service}.log`);
|
|
7918
|
+
if (existsSync10(logFile)) {
|
|
8229
7919
|
return dispatch(() => tailLogFile(logFile, args.follow));
|
|
8230
7920
|
}
|
|
8231
7921
|
}
|
|
@@ -8242,11 +7932,11 @@ var init_logs = __esm({
|
|
|
8242
7932
|
});
|
|
8243
7933
|
|
|
8244
7934
|
// src/commands/port.ts
|
|
8245
|
-
import { defineCommand as
|
|
8246
|
-
import { consola as
|
|
7935
|
+
import { defineCommand as defineCommand14 } from "citty";
|
|
7936
|
+
import { consola as consola16 } from "consola";
|
|
8247
7937
|
async function runPortListing(opts) {
|
|
8248
7938
|
const out = opts.out ?? process.stdout;
|
|
8249
|
-
const info = opts.info ?? ((m) =>
|
|
7939
|
+
const info = opts.info ?? ((m) => consola16.info(m));
|
|
8250
7940
|
const parsed = await readConfig(
|
|
8251
7941
|
containerConfigPath(opts.name, opts.monocerosHome)
|
|
8252
7942
|
);
|
|
@@ -8304,7 +7994,7 @@ var init_port = __esm({
|
|
|
8304
7994
|
init_schema();
|
|
8305
7995
|
init_dynamic();
|
|
8306
7996
|
init_format();
|
|
8307
|
-
portCommand =
|
|
7997
|
+
portCommand = defineCommand14({
|
|
8308
7998
|
meta: {
|
|
8309
7999
|
name: "port",
|
|
8310
8000
|
group: "discovery",
|
|
@@ -8322,7 +8012,7 @@ var init_port = __esm({
|
|
|
8322
8012
|
const code = await runPortListing({ name: args.name });
|
|
8323
8013
|
process.exit(code);
|
|
8324
8014
|
} catch (err) {
|
|
8325
|
-
|
|
8015
|
+
consola16.error(err instanceof Error ? err.message : String(err));
|
|
8326
8016
|
process.exit(1);
|
|
8327
8017
|
}
|
|
8328
8018
|
}
|
|
@@ -8331,15 +8021,15 @@ var init_port = __esm({
|
|
|
8331
8021
|
});
|
|
8332
8022
|
|
|
8333
8023
|
// src/commands/remove-apt-packages.ts
|
|
8334
|
-
import { defineCommand as
|
|
8335
|
-
import { consola as
|
|
8024
|
+
import { defineCommand as defineCommand15 } from "citty";
|
|
8025
|
+
import { consola as consola17 } from "consola";
|
|
8336
8026
|
var removeAptPackagesCommand;
|
|
8337
8027
|
var init_remove_apt_packages = __esm({
|
|
8338
8028
|
"src/commands/remove-apt-packages.ts"() {
|
|
8339
8029
|
"use strict";
|
|
8340
8030
|
init_inner_args();
|
|
8341
8031
|
init_modify();
|
|
8342
|
-
removeAptPackagesCommand =
|
|
8032
|
+
removeAptPackagesCommand = defineCommand15({
|
|
8343
8033
|
meta: {
|
|
8344
8034
|
name: "remove-apt-packages",
|
|
8345
8035
|
group: "edit",
|
|
@@ -8361,7 +8051,7 @@ var init_remove_apt_packages = __esm({
|
|
|
8361
8051
|
async run({ args }) {
|
|
8362
8052
|
const packages = [...getInnerArgs()];
|
|
8363
8053
|
if (packages.length === 0) {
|
|
8364
|
-
|
|
8054
|
+
consola17.error(
|
|
8365
8055
|
"No package names given. Usage: `monoceros remove-apt-packages <containername> [--yes] -- <pkg> [<pkg> \u2026]`."
|
|
8366
8056
|
);
|
|
8367
8057
|
process.exit(1);
|
|
@@ -8374,7 +8064,7 @@ var init_remove_apt_packages = __esm({
|
|
|
8374
8064
|
});
|
|
8375
8065
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8376
8066
|
} catch (err) {
|
|
8377
|
-
|
|
8067
|
+
consola17.error(err instanceof Error ? err.message : String(err));
|
|
8378
8068
|
process.exit(1);
|
|
8379
8069
|
}
|
|
8380
8070
|
}
|
|
@@ -8383,14 +8073,14 @@ var init_remove_apt_packages = __esm({
|
|
|
8383
8073
|
});
|
|
8384
8074
|
|
|
8385
8075
|
// src/commands/remove-feature.ts
|
|
8386
|
-
import { defineCommand as
|
|
8387
|
-
import { consola as
|
|
8076
|
+
import { defineCommand as defineCommand16 } from "citty";
|
|
8077
|
+
import { consola as consola18 } from "consola";
|
|
8388
8078
|
var removeFeatureCommand;
|
|
8389
8079
|
var init_remove_feature = __esm({
|
|
8390
8080
|
"src/commands/remove-feature.ts"() {
|
|
8391
8081
|
"use strict";
|
|
8392
8082
|
init_modify();
|
|
8393
|
-
removeFeatureCommand =
|
|
8083
|
+
removeFeatureCommand = defineCommand16({
|
|
8394
8084
|
meta: {
|
|
8395
8085
|
name: "remove-feature",
|
|
8396
8086
|
group: "edit",
|
|
@@ -8423,7 +8113,7 @@ var init_remove_feature = __esm({
|
|
|
8423
8113
|
});
|
|
8424
8114
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8425
8115
|
} catch (err) {
|
|
8426
|
-
|
|
8116
|
+
consola18.error(err instanceof Error ? err.message : String(err));
|
|
8427
8117
|
process.exit(1);
|
|
8428
8118
|
}
|
|
8429
8119
|
}
|
|
@@ -8432,15 +8122,15 @@ var init_remove_feature = __esm({
|
|
|
8432
8122
|
});
|
|
8433
8123
|
|
|
8434
8124
|
// src/remove/index.ts
|
|
8435
|
-
import { existsSync as
|
|
8436
|
-
import
|
|
8437
|
-
import { consola as
|
|
8125
|
+
import { existsSync as existsSync11, promises as fs15 } from "fs";
|
|
8126
|
+
import path19 from "path";
|
|
8127
|
+
import { consola as consola19 } from "consola";
|
|
8438
8128
|
async function runRemove(opts) {
|
|
8439
8129
|
const home = opts.monocerosHome ?? monocerosHome();
|
|
8440
8130
|
const logger = opts.logger ?? {
|
|
8441
|
-
info: (msg) =>
|
|
8442
|
-
success: (msg) =>
|
|
8443
|
-
warn: (msg) =>
|
|
8131
|
+
info: (msg) => consola19.info(msg),
|
|
8132
|
+
success: (msg) => consola19.success(msg),
|
|
8133
|
+
warn: (msg) => consola19.warn(msg)
|
|
8444
8134
|
};
|
|
8445
8135
|
if (!REGEX.solutionName.test(opts.name)) {
|
|
8446
8136
|
throw new Error(
|
|
@@ -8450,9 +8140,9 @@ async function runRemove(opts) {
|
|
|
8450
8140
|
const ymlPath = containerConfigPath(opts.name, home);
|
|
8451
8141
|
const envPath = containerEnvPath(opts.name, home);
|
|
8452
8142
|
const containerPath = containerDir(opts.name, home);
|
|
8453
|
-
const hasYml =
|
|
8454
|
-
const hasEnv =
|
|
8455
|
-
const hasContainer =
|
|
8143
|
+
const hasYml = existsSync11(ymlPath);
|
|
8144
|
+
const hasEnv = existsSync11(envPath);
|
|
8145
|
+
const hasContainer = existsSync11(containerPath);
|
|
8456
8146
|
if (!hasYml && !hasContainer) {
|
|
8457
8147
|
throw new Error(
|
|
8458
8148
|
`Nothing to remove for '${opts.name}': neither ${ymlPath} nor ${containerPath} exists.`
|
|
@@ -8478,16 +8168,16 @@ async function runRemove(opts) {
|
|
|
8478
8168
|
let backupPath = null;
|
|
8479
8169
|
if (!opts.noBackup && (hasYml || hasContainer)) {
|
|
8480
8170
|
const ts = (opts.now ?? /* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8481
|
-
backupPath =
|
|
8171
|
+
backupPath = path19.join(home, "container-backups", `${opts.name}-${ts}`);
|
|
8482
8172
|
await fs15.mkdir(backupPath, { recursive: true });
|
|
8483
8173
|
if (hasYml) {
|
|
8484
|
-
await fs15.copyFile(ymlPath,
|
|
8174
|
+
await fs15.copyFile(ymlPath, path19.join(backupPath, `${opts.name}.yml`));
|
|
8485
8175
|
}
|
|
8486
8176
|
if (hasEnv) {
|
|
8487
|
-
await fs15.copyFile(envPath,
|
|
8177
|
+
await fs15.copyFile(envPath, path19.join(backupPath, `${opts.name}.env`));
|
|
8488
8178
|
}
|
|
8489
8179
|
if (hasContainer) {
|
|
8490
|
-
await fs15.cp(containerPath,
|
|
8180
|
+
await fs15.cp(containerPath, path19.join(backupPath, "container"), {
|
|
8491
8181
|
recursive: true
|
|
8492
8182
|
});
|
|
8493
8183
|
}
|
|
@@ -8576,15 +8266,15 @@ var init_remove = __esm({
|
|
|
8576
8266
|
});
|
|
8577
8267
|
|
|
8578
8268
|
// src/commands/remove.ts
|
|
8579
|
-
import { defineCommand as
|
|
8580
|
-
import { consola as
|
|
8269
|
+
import { defineCommand as defineCommand17 } from "citty";
|
|
8270
|
+
import { consola as consola20 } from "consola";
|
|
8581
8271
|
import { createInterface } from "readline/promises";
|
|
8582
8272
|
var removeCommand;
|
|
8583
8273
|
var init_remove2 = __esm({
|
|
8584
8274
|
"src/commands/remove.ts"() {
|
|
8585
8275
|
"use strict";
|
|
8586
8276
|
init_remove();
|
|
8587
|
-
removeCommand =
|
|
8277
|
+
removeCommand = defineCommand17({
|
|
8588
8278
|
meta: {
|
|
8589
8279
|
name: "remove",
|
|
8590
8280
|
group: "lifecycle",
|
|
@@ -8621,7 +8311,7 @@ var init_remove2 = __esm({
|
|
|
8621
8311
|
const skipPrompt = args.yes === true;
|
|
8622
8312
|
if (!skipPrompt) {
|
|
8623
8313
|
const warning = noBackup ? `About to remove '${args.name}' WITHOUT a backup. Docker objects, container-configs entry, and container directory will all be deleted.` : `About to remove '${args.name}'. A backup will be written to container-backups/ first, then docker objects, container-configs entry, and container directory will all be deleted.`;
|
|
8624
|
-
|
|
8314
|
+
consola20.warn(warning);
|
|
8625
8315
|
const rl = createInterface({
|
|
8626
8316
|
input: process.stdin,
|
|
8627
8317
|
output: process.stdout
|
|
@@ -8629,7 +8319,7 @@ var init_remove2 = __esm({
|
|
|
8629
8319
|
const answer = await rl.question("Continue? [y/N] ");
|
|
8630
8320
|
rl.close();
|
|
8631
8321
|
if (!/^y(es)?$/i.test(answer.trim())) {
|
|
8632
|
-
|
|
8322
|
+
consola20.info("Aborted. Nothing changed.");
|
|
8633
8323
|
process.exit(0);
|
|
8634
8324
|
}
|
|
8635
8325
|
}
|
|
@@ -8638,7 +8328,7 @@ var init_remove2 = __esm({
|
|
|
8638
8328
|
...noBackup ? { noBackup: true } : {}
|
|
8639
8329
|
});
|
|
8640
8330
|
} catch (err) {
|
|
8641
|
-
|
|
8331
|
+
consola20.error(err instanceof Error ? err.message : String(err));
|
|
8642
8332
|
process.exit(1);
|
|
8643
8333
|
}
|
|
8644
8334
|
}
|
|
@@ -8647,17 +8337,17 @@ var init_remove2 = __esm({
|
|
|
8647
8337
|
});
|
|
8648
8338
|
|
|
8649
8339
|
// src/restore/index.ts
|
|
8650
|
-
import { existsSync as
|
|
8651
|
-
import
|
|
8652
|
-
import { consola as
|
|
8340
|
+
import { existsSync as existsSync12, promises as fs16 } from "fs";
|
|
8341
|
+
import path20 from "path";
|
|
8342
|
+
import { consola as consola21 } from "consola";
|
|
8653
8343
|
async function runRestore(opts) {
|
|
8654
8344
|
const home = opts.monocerosHome ?? monocerosHome();
|
|
8655
8345
|
const logger = opts.logger ?? {
|
|
8656
|
-
info: (msg) =>
|
|
8657
|
-
success: (msg) =>
|
|
8346
|
+
info: (msg) => consola21.info(msg),
|
|
8347
|
+
success: (msg) => consola21.success(msg)
|
|
8658
8348
|
};
|
|
8659
|
-
const backup =
|
|
8660
|
-
if (!
|
|
8349
|
+
const backup = path20.resolve(opts.backupPath);
|
|
8350
|
+
if (!existsSync12(backup)) {
|
|
8661
8351
|
throw new Error(`Backup not found: ${backup}.`);
|
|
8662
8352
|
}
|
|
8663
8353
|
const stat = await fs16.stat(backup);
|
|
@@ -8678,24 +8368,24 @@ async function runRestore(opts) {
|
|
|
8678
8368
|
}
|
|
8679
8369
|
const ymlFile = ymlFiles[0];
|
|
8680
8370
|
const name = ymlFile.replace(/\.yml$/, "");
|
|
8681
|
-
const containerInBackup =
|
|
8682
|
-
const hasContainer =
|
|
8683
|
-
const envInBackup =
|
|
8684
|
-
const hasEnv =
|
|
8371
|
+
const containerInBackup = path20.join(backup, "container");
|
|
8372
|
+
const hasContainer = existsSync12(containerInBackup);
|
|
8373
|
+
const envInBackup = path20.join(backup, `${name}.env`);
|
|
8374
|
+
const hasEnv = existsSync12(envInBackup);
|
|
8685
8375
|
const destYml = containerConfigPath(name, home);
|
|
8686
8376
|
const destContainer = containerDir(name, home);
|
|
8687
|
-
if (
|
|
8377
|
+
if (existsSync12(destYml)) {
|
|
8688
8378
|
throw new Error(
|
|
8689
8379
|
`Refusing to restore: ${destYml} already exists. Remove the current container first (\`monoceros remove ${name}\`) or rename the existing config.`
|
|
8690
8380
|
);
|
|
8691
8381
|
}
|
|
8692
|
-
if (hasContainer &&
|
|
8382
|
+
if (hasContainer && existsSync12(destContainer)) {
|
|
8693
8383
|
throw new Error(
|
|
8694
8384
|
`Refusing to restore: ${destContainer} already exists. Remove the current container first (\`monoceros remove ${name}\`).`
|
|
8695
8385
|
);
|
|
8696
8386
|
}
|
|
8697
8387
|
await fs16.mkdir(containerConfigsDir(home), { recursive: true });
|
|
8698
|
-
await fs16.copyFile(
|
|
8388
|
+
await fs16.copyFile(path20.join(backup, ymlFile), destYml);
|
|
8699
8389
|
if (hasEnv) {
|
|
8700
8390
|
await fs16.copyFile(envInBackup, containerEnvPath(name, home));
|
|
8701
8391
|
}
|
|
@@ -8720,14 +8410,14 @@ var init_restore = __esm({
|
|
|
8720
8410
|
});
|
|
8721
8411
|
|
|
8722
8412
|
// src/commands/restore.ts
|
|
8723
|
-
import { defineCommand as
|
|
8724
|
-
import { consola as
|
|
8413
|
+
import { defineCommand as defineCommand18 } from "citty";
|
|
8414
|
+
import { consola as consola22 } from "consola";
|
|
8725
8415
|
var restoreCommand;
|
|
8726
8416
|
var init_restore2 = __esm({
|
|
8727
8417
|
"src/commands/restore.ts"() {
|
|
8728
8418
|
"use strict";
|
|
8729
8419
|
init_restore();
|
|
8730
|
-
restoreCommand =
|
|
8420
|
+
restoreCommand = defineCommand18({
|
|
8731
8421
|
meta: {
|
|
8732
8422
|
name: "restore",
|
|
8733
8423
|
group: "lifecycle",
|
|
@@ -8744,7 +8434,7 @@ var init_restore2 = __esm({
|
|
|
8744
8434
|
try {
|
|
8745
8435
|
await runRestore({ backupPath: args["backup-path"] });
|
|
8746
8436
|
} catch (err) {
|
|
8747
|
-
|
|
8437
|
+
consola22.error(err instanceof Error ? err.message : String(err));
|
|
8748
8438
|
process.exit(1);
|
|
8749
8439
|
}
|
|
8750
8440
|
}
|
|
@@ -8753,14 +8443,14 @@ var init_restore2 = __esm({
|
|
|
8753
8443
|
});
|
|
8754
8444
|
|
|
8755
8445
|
// src/commands/remove-from-url.ts
|
|
8756
|
-
import { defineCommand as
|
|
8757
|
-
import { consola as
|
|
8446
|
+
import { defineCommand as defineCommand19 } from "citty";
|
|
8447
|
+
import { consola as consola23 } from "consola";
|
|
8758
8448
|
var removeFromUrlCommand;
|
|
8759
8449
|
var init_remove_from_url = __esm({
|
|
8760
8450
|
"src/commands/remove-from-url.ts"() {
|
|
8761
8451
|
"use strict";
|
|
8762
8452
|
init_modify();
|
|
8763
|
-
removeFromUrlCommand =
|
|
8453
|
+
removeFromUrlCommand = defineCommand19({
|
|
8764
8454
|
meta: {
|
|
8765
8455
|
name: "remove-from-url",
|
|
8766
8456
|
group: "edit",
|
|
@@ -8793,7 +8483,7 @@ var init_remove_from_url = __esm({
|
|
|
8793
8483
|
});
|
|
8794
8484
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8795
8485
|
} catch (err) {
|
|
8796
|
-
|
|
8486
|
+
consola23.error(err instanceof Error ? err.message : String(err));
|
|
8797
8487
|
process.exit(1);
|
|
8798
8488
|
}
|
|
8799
8489
|
}
|
|
@@ -8802,14 +8492,14 @@ var init_remove_from_url = __esm({
|
|
|
8802
8492
|
});
|
|
8803
8493
|
|
|
8804
8494
|
// src/commands/remove-language.ts
|
|
8805
|
-
import { defineCommand as
|
|
8806
|
-
import { consola as
|
|
8495
|
+
import { defineCommand as defineCommand20 } from "citty";
|
|
8496
|
+
import { consola as consola24 } from "consola";
|
|
8807
8497
|
var removeLanguageCommand;
|
|
8808
8498
|
var init_remove_language = __esm({
|
|
8809
8499
|
"src/commands/remove-language.ts"() {
|
|
8810
8500
|
"use strict";
|
|
8811
8501
|
init_modify();
|
|
8812
|
-
removeLanguageCommand =
|
|
8502
|
+
removeLanguageCommand = defineCommand20({
|
|
8813
8503
|
meta: {
|
|
8814
8504
|
name: "remove-language",
|
|
8815
8505
|
group: "edit",
|
|
@@ -8842,7 +8532,7 @@ var init_remove_language = __esm({
|
|
|
8842
8532
|
});
|
|
8843
8533
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8844
8534
|
} catch (err) {
|
|
8845
|
-
|
|
8535
|
+
consola24.error(err instanceof Error ? err.message : String(err));
|
|
8846
8536
|
process.exit(1);
|
|
8847
8537
|
}
|
|
8848
8538
|
}
|
|
@@ -8851,8 +8541,8 @@ var init_remove_language = __esm({
|
|
|
8851
8541
|
});
|
|
8852
8542
|
|
|
8853
8543
|
// src/commands/remove-port.ts
|
|
8854
|
-
import { defineCommand as
|
|
8855
|
-
import { consola as
|
|
8544
|
+
import { defineCommand as defineCommand21 } from "citty";
|
|
8545
|
+
import { consola as consola25 } from "consola";
|
|
8856
8546
|
function coerceToken2(raw) {
|
|
8857
8547
|
const n = Number(raw);
|
|
8858
8548
|
return Number.isFinite(n) ? n : raw;
|
|
@@ -8863,7 +8553,7 @@ var init_remove_port = __esm({
|
|
|
8863
8553
|
"use strict";
|
|
8864
8554
|
init_inner_args();
|
|
8865
8555
|
init_modify();
|
|
8866
|
-
removePortCommand =
|
|
8556
|
+
removePortCommand = defineCommand21({
|
|
8867
8557
|
meta: {
|
|
8868
8558
|
name: "remove-port",
|
|
8869
8559
|
group: "edit",
|
|
@@ -8885,7 +8575,7 @@ var init_remove_port = __esm({
|
|
|
8885
8575
|
async run({ args }) {
|
|
8886
8576
|
const tokens = [...getInnerArgs()];
|
|
8887
8577
|
if (tokens.length === 0) {
|
|
8888
|
-
|
|
8578
|
+
consola25.error(
|
|
8889
8579
|
"No ports given. Usage: `monoceros remove-port <containername> [--yes] -- <port> [<port> \u2026]`."
|
|
8890
8580
|
);
|
|
8891
8581
|
process.exit(1);
|
|
@@ -8898,7 +8588,7 @@ var init_remove_port = __esm({
|
|
|
8898
8588
|
});
|
|
8899
8589
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8900
8590
|
} catch (err) {
|
|
8901
|
-
|
|
8591
|
+
consola25.error(err instanceof Error ? err.message : String(err));
|
|
8902
8592
|
process.exit(1);
|
|
8903
8593
|
}
|
|
8904
8594
|
}
|
|
@@ -8907,14 +8597,14 @@ var init_remove_port = __esm({
|
|
|
8907
8597
|
});
|
|
8908
8598
|
|
|
8909
8599
|
// src/commands/remove-repo.ts
|
|
8910
|
-
import { defineCommand as
|
|
8911
|
-
import { consola as
|
|
8600
|
+
import { defineCommand as defineCommand22 } from "citty";
|
|
8601
|
+
import { consola as consola26 } from "consola";
|
|
8912
8602
|
var removeRepoCommand;
|
|
8913
8603
|
var init_remove_repo = __esm({
|
|
8914
8604
|
"src/commands/remove-repo.ts"() {
|
|
8915
8605
|
"use strict";
|
|
8916
8606
|
init_modify();
|
|
8917
|
-
removeRepoCommand =
|
|
8607
|
+
removeRepoCommand = defineCommand22({
|
|
8918
8608
|
meta: {
|
|
8919
8609
|
name: "remove-repo",
|
|
8920
8610
|
group: "edit",
|
|
@@ -8947,7 +8637,7 @@ var init_remove_repo = __esm({
|
|
|
8947
8637
|
});
|
|
8948
8638
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8949
8639
|
} catch (err) {
|
|
8950
|
-
|
|
8640
|
+
consola26.error(err instanceof Error ? err.message : String(err));
|
|
8951
8641
|
process.exit(1);
|
|
8952
8642
|
}
|
|
8953
8643
|
}
|
|
@@ -8956,14 +8646,14 @@ var init_remove_repo = __esm({
|
|
|
8956
8646
|
});
|
|
8957
8647
|
|
|
8958
8648
|
// src/commands/remove-service.ts
|
|
8959
|
-
import { defineCommand as
|
|
8960
|
-
import { consola as
|
|
8649
|
+
import { defineCommand as defineCommand23 } from "citty";
|
|
8650
|
+
import { consola as consola27 } from "consola";
|
|
8961
8651
|
var removeServiceCommand;
|
|
8962
8652
|
var init_remove_service = __esm({
|
|
8963
8653
|
"src/commands/remove-service.ts"() {
|
|
8964
8654
|
"use strict";
|
|
8965
8655
|
init_modify();
|
|
8966
|
-
removeServiceCommand =
|
|
8656
|
+
removeServiceCommand = defineCommand23({
|
|
8967
8657
|
meta: {
|
|
8968
8658
|
name: "remove-service",
|
|
8969
8659
|
group: "edit",
|
|
@@ -8996,7 +8686,7 @@ var init_remove_service = __esm({
|
|
|
8996
8686
|
});
|
|
8997
8687
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8998
8688
|
} catch (err) {
|
|
8999
|
-
|
|
8689
|
+
consola27.error(err instanceof Error ? err.message : String(err));
|
|
9000
8690
|
process.exit(1);
|
|
9001
8691
|
}
|
|
9002
8692
|
}
|
|
@@ -9005,15 +8695,29 @@ var init_remove_service = __esm({
|
|
|
9005
8695
|
});
|
|
9006
8696
|
|
|
9007
8697
|
// src/devcontainer/browser-bridge.ts
|
|
9008
|
-
import { spawn as
|
|
9009
|
-
import { existsSync as
|
|
9010
|
-
import
|
|
9011
|
-
import
|
|
9012
|
-
function
|
|
8698
|
+
import { spawn as spawn9 } from "child_process";
|
|
8699
|
+
import { existsSync as existsSync13, promises as fsp2, readFileSync as readFileSync6 } from "fs";
|
|
8700
|
+
import http from "http";
|
|
8701
|
+
import path21 from "path";
|
|
8702
|
+
function parseCallbackTarget(authUrl) {
|
|
8703
|
+
try {
|
|
8704
|
+
const u = new URL(authUrl);
|
|
8705
|
+
const redirect = u.searchParams.get("redirect_uri");
|
|
8706
|
+
if (!redirect) return null;
|
|
8707
|
+
const r = new URL(redirect);
|
|
8708
|
+
if (r.hostname !== "localhost" && r.hostname !== "127.0.0.1") return null;
|
|
8709
|
+
const port = Number(r.port);
|
|
8710
|
+
if (!Number.isInteger(port) || port <= 0) return null;
|
|
8711
|
+
return { port, pathname: r.pathname };
|
|
8712
|
+
} catch {
|
|
8713
|
+
return null;
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
function openInBrowser(url) {
|
|
9013
8717
|
const platform = process.platform;
|
|
9014
8718
|
const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
9015
8719
|
try {
|
|
9016
|
-
const child =
|
|
8720
|
+
const child = spawn9(cmd, args, {
|
|
9017
8721
|
stdio: "ignore",
|
|
9018
8722
|
detached: true
|
|
9019
8723
|
});
|
|
@@ -9024,12 +8728,12 @@ function openInBrowser2(url) {
|
|
|
9024
8728
|
}
|
|
9025
8729
|
}
|
|
9026
8730
|
async function startBrowserBridge(opts) {
|
|
9027
|
-
const relayDir =
|
|
9028
|
-
const relayScript =
|
|
9029
|
-
const urlFile =
|
|
9030
|
-
await
|
|
9031
|
-
await
|
|
9032
|
-
await
|
|
8731
|
+
const relayDir = path21.join(opts.root, RELAY_DIRNAME);
|
|
8732
|
+
const relayScript = path21.join(relayDir, "xdg-open");
|
|
8733
|
+
const urlFile = path21.join(relayDir, "url");
|
|
8734
|
+
await fsp2.mkdir(relayDir, { recursive: true });
|
|
8735
|
+
await fsp2.rm(urlFile, { force: true });
|
|
8736
|
+
await fsp2.writeFile(
|
|
9033
8737
|
relayScript,
|
|
9034
8738
|
`#!/bin/sh
|
|
9035
8739
|
printf '%s\\n' "$1" > "$(dirname "$0")/url"
|
|
@@ -9037,14 +8741,14 @@ exit 0
|
|
|
9037
8741
|
`,
|
|
9038
8742
|
{ mode: 493 }
|
|
9039
8743
|
);
|
|
9040
|
-
await
|
|
8744
|
+
await fsp2.chmod(relayScript, 493);
|
|
9041
8745
|
const servers = [];
|
|
9042
8746
|
let handled = false;
|
|
9043
8747
|
const onUrl = (url) => {
|
|
9044
|
-
|
|
8748
|
+
openInBrowser(url);
|
|
9045
8749
|
const target = parseCallbackTarget(url);
|
|
9046
8750
|
if (!target) return;
|
|
9047
|
-
const server =
|
|
8751
|
+
const server = http.createServer((req, res) => {
|
|
9048
8752
|
const reqUrl = req.url ?? target.pathname;
|
|
9049
8753
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
9050
8754
|
res.end(
|
|
@@ -9070,10 +8774,10 @@ exit 0
|
|
|
9070
8774
|
servers.push(server);
|
|
9071
8775
|
};
|
|
9072
8776
|
const poll = setInterval(() => {
|
|
9073
|
-
if (handled || !
|
|
8777
|
+
if (handled || !existsSync13(urlFile)) return;
|
|
9074
8778
|
let content = "";
|
|
9075
8779
|
try {
|
|
9076
|
-
content =
|
|
8780
|
+
content = readFileSync6(urlFile, "utf8");
|
|
9077
8781
|
} catch {
|
|
9078
8782
|
return;
|
|
9079
8783
|
}
|
|
@@ -9082,20 +8786,57 @@ exit 0
|
|
|
9082
8786
|
onUrl(content.trim());
|
|
9083
8787
|
}, 250);
|
|
9084
8788
|
return {
|
|
9085
|
-
relayDirInContainer: `/workspaces/${opts.name}/${
|
|
8789
|
+
relayDirInContainer: `/workspaces/${opts.name}/${RELAY_DIRNAME}`,
|
|
9086
8790
|
async dispose() {
|
|
9087
8791
|
clearInterval(poll);
|
|
9088
8792
|
for (const s of servers) s.close();
|
|
9089
|
-
await
|
|
8793
|
+
await fsp2.rm(relayDir, { recursive: true, force: true });
|
|
9090
8794
|
}
|
|
9091
8795
|
};
|
|
9092
8796
|
}
|
|
9093
|
-
var
|
|
8797
|
+
var RELAY_DIRNAME;
|
|
9094
8798
|
var init_browser_bridge = __esm({
|
|
9095
8799
|
"src/devcontainer/browser-bridge.ts"() {
|
|
9096
8800
|
"use strict";
|
|
9097
|
-
|
|
9098
|
-
|
|
8801
|
+
RELAY_DIRNAME = ".monoceros-bridge";
|
|
8802
|
+
}
|
|
8803
|
+
});
|
|
8804
|
+
|
|
8805
|
+
// src/devcontainer/shell.ts
|
|
8806
|
+
import { existsSync as existsSync14 } from "fs";
|
|
8807
|
+
import path22 from "path";
|
|
8808
|
+
async function runShell(opts) {
|
|
8809
|
+
assertContainerExists(opts.root);
|
|
8810
|
+
const spawnFn = opts.spawn ?? spawnDevcontainer;
|
|
8811
|
+
const upCode = await spawnFn(
|
|
8812
|
+
["up", "--workspace-folder", opts.root, "--mount-workspace-git-root=false"],
|
|
8813
|
+
opts.root,
|
|
8814
|
+
{ quiet: true }
|
|
8815
|
+
);
|
|
8816
|
+
if (upCode !== 0) return upCode;
|
|
8817
|
+
return spawnFn(
|
|
8818
|
+
[
|
|
8819
|
+
"exec",
|
|
8820
|
+
"--workspace-folder",
|
|
8821
|
+
opts.root,
|
|
8822
|
+
"--mount-workspace-git-root=false",
|
|
8823
|
+
"bash"
|
|
8824
|
+
],
|
|
8825
|
+
opts.root,
|
|
8826
|
+
{ interactive: true }
|
|
8827
|
+
);
|
|
8828
|
+
}
|
|
8829
|
+
function assertContainerExists(root) {
|
|
8830
|
+
if (!existsSync14(path22.join(root, ".devcontainer"))) {
|
|
8831
|
+
throw new Error(
|
|
8832
|
+
`No .devcontainer/ at ${root}. Run \`monoceros apply <name>\` first.`
|
|
8833
|
+
);
|
|
8834
|
+
}
|
|
8835
|
+
}
|
|
8836
|
+
var init_shell = __esm({
|
|
8837
|
+
"src/devcontainer/shell.ts"() {
|
|
8838
|
+
"use strict";
|
|
8839
|
+
init_cli();
|
|
9099
8840
|
}
|
|
9100
8841
|
});
|
|
9101
8842
|
|
|
@@ -9105,7 +8846,9 @@ function wrapExec(command, opts) {
|
|
|
9105
8846
|
const stmts = [];
|
|
9106
8847
|
if (opts.pathPrepend) {
|
|
9107
8848
|
leading.push(opts.pathPrepend);
|
|
9108
|
-
|
|
8849
|
+
const i = leading.length;
|
|
8850
|
+
stmts.push(`export PATH="$${i}:$PATH"`);
|
|
8851
|
+
stmts.push(`export BROWSER="$${i}/xdg-open"`);
|
|
9109
8852
|
}
|
|
9110
8853
|
if (opts.cwd) {
|
|
9111
8854
|
leading.push(opts.cwd);
|
|
@@ -9165,8 +8908,8 @@ var init_run = __esm({
|
|
|
9165
8908
|
});
|
|
9166
8909
|
|
|
9167
8910
|
// src/commands/run.ts
|
|
9168
|
-
import { defineCommand as
|
|
9169
|
-
import { consola as
|
|
8911
|
+
import { defineCommand as defineCommand24 } from "citty";
|
|
8912
|
+
import { consola as consola28 } from "consola";
|
|
9170
8913
|
var runCommand;
|
|
9171
8914
|
var init_run2 = __esm({
|
|
9172
8915
|
"src/commands/run.ts"() {
|
|
@@ -9174,7 +8917,7 @@ var init_run2 = __esm({
|
|
|
9174
8917
|
init_paths();
|
|
9175
8918
|
init_run();
|
|
9176
8919
|
init_inner_args();
|
|
9177
|
-
runCommand =
|
|
8920
|
+
runCommand = defineCommand24({
|
|
9178
8921
|
meta: {
|
|
9179
8922
|
name: "run",
|
|
9180
8923
|
group: "run",
|
|
@@ -9194,7 +8937,7 @@ var init_run2 = __esm({
|
|
|
9194
8937
|
async run({ args }) {
|
|
9195
8938
|
const command = [...getInnerArgs()];
|
|
9196
8939
|
if (command.length === 0) {
|
|
9197
|
-
|
|
8940
|
+
consola28.error(
|
|
9198
8941
|
"No command provided. Usage: `monoceros run <containername> -- <cmd> [args\u2026]`."
|
|
9199
8942
|
);
|
|
9200
8943
|
process.exit(1);
|
|
@@ -9208,7 +8951,7 @@ var init_run2 = __esm({
|
|
|
9208
8951
|
});
|
|
9209
8952
|
process.exit(exitCode);
|
|
9210
8953
|
} catch (err) {
|
|
9211
|
-
|
|
8954
|
+
consola28.error(err instanceof Error ? err.message : String(err));
|
|
9212
8955
|
process.exit(1);
|
|
9213
8956
|
}
|
|
9214
8957
|
}
|
|
@@ -9217,15 +8960,15 @@ var init_run2 = __esm({
|
|
|
9217
8960
|
});
|
|
9218
8961
|
|
|
9219
8962
|
// src/commands/shell.ts
|
|
9220
|
-
import { defineCommand as
|
|
9221
|
-
import { consola as
|
|
8963
|
+
import { defineCommand as defineCommand25 } from "citty";
|
|
8964
|
+
import { consola as consola29 } from "consola";
|
|
9222
8965
|
var shellCommand;
|
|
9223
8966
|
var init_shell2 = __esm({
|
|
9224
8967
|
"src/commands/shell.ts"() {
|
|
9225
8968
|
"use strict";
|
|
9226
8969
|
init_paths();
|
|
9227
8970
|
init_shell();
|
|
9228
|
-
shellCommand =
|
|
8971
|
+
shellCommand = defineCommand25({
|
|
9229
8972
|
meta: {
|
|
9230
8973
|
name: "shell",
|
|
9231
8974
|
group: "run",
|
|
@@ -9243,7 +8986,7 @@ var init_shell2 = __esm({
|
|
|
9243
8986
|
const exitCode = await runShell({ root: containerDir(args.name) });
|
|
9244
8987
|
process.exit(exitCode);
|
|
9245
8988
|
} catch (err) {
|
|
9246
|
-
|
|
8989
|
+
consola29.error(err instanceof Error ? err.message : String(err));
|
|
9247
8990
|
process.exit(1);
|
|
9248
8991
|
}
|
|
9249
8992
|
}
|
|
@@ -9252,8 +8995,8 @@ var init_shell2 = __esm({
|
|
|
9252
8995
|
});
|
|
9253
8996
|
|
|
9254
8997
|
// src/commands/start.ts
|
|
9255
|
-
import { defineCommand as
|
|
9256
|
-
import { consola as
|
|
8998
|
+
import { defineCommand as defineCommand26 } from "citty";
|
|
8999
|
+
import { consola as consola30 } from "consola";
|
|
9257
9000
|
var startCommand;
|
|
9258
9001
|
var init_start = __esm({
|
|
9259
9002
|
"src/commands/start.ts"() {
|
|
@@ -9265,7 +9008,7 @@ var init_start = __esm({
|
|
|
9265
9008
|
init_proxy();
|
|
9266
9009
|
init_port_check();
|
|
9267
9010
|
init_dispatch();
|
|
9268
|
-
startCommand =
|
|
9011
|
+
startCommand = defineCommand26({
|
|
9269
9012
|
meta: {
|
|
9270
9013
|
name: "start",
|
|
9271
9014
|
group: "run",
|
|
@@ -9290,7 +9033,7 @@ var init_start = __esm({
|
|
|
9290
9033
|
hostPort = proxyHostPort(global);
|
|
9291
9034
|
}
|
|
9292
9035
|
} catch (err) {
|
|
9293
|
-
|
|
9036
|
+
consola30.warn(
|
|
9294
9037
|
`Could not read container yml ahead of start: ${err instanceof Error ? err.message : String(err)}. Skipping Traefik pre-flight.`
|
|
9295
9038
|
);
|
|
9296
9039
|
}
|
|
@@ -9306,7 +9049,7 @@ var init_start = __esm({
|
|
|
9306
9049
|
});
|
|
9307
9050
|
|
|
9308
9051
|
// src/commands/status.ts
|
|
9309
|
-
import { defineCommand as
|
|
9052
|
+
import { defineCommand as defineCommand27 } from "citty";
|
|
9310
9053
|
var statusCommand;
|
|
9311
9054
|
var init_status = __esm({
|
|
9312
9055
|
"src/commands/status.ts"() {
|
|
@@ -9314,7 +9057,7 @@ var init_status = __esm({
|
|
|
9314
9057
|
init_paths();
|
|
9315
9058
|
init_compose();
|
|
9316
9059
|
init_dispatch();
|
|
9317
|
-
statusCommand =
|
|
9060
|
+
statusCommand = defineCommand27({
|
|
9318
9061
|
meta: {
|
|
9319
9062
|
name: "status",
|
|
9320
9063
|
group: "run",
|
|
@@ -9344,8 +9087,8 @@ var init_status = __esm({
|
|
|
9344
9087
|
});
|
|
9345
9088
|
|
|
9346
9089
|
// src/commands/stop.ts
|
|
9347
|
-
import { defineCommand as
|
|
9348
|
-
import { consola as
|
|
9090
|
+
import { defineCommand as defineCommand28 } from "citty";
|
|
9091
|
+
import { consola as consola31 } from "consola";
|
|
9349
9092
|
var stopCommand;
|
|
9350
9093
|
var init_stop = __esm({
|
|
9351
9094
|
"src/commands/stop.ts"() {
|
|
@@ -9354,7 +9097,7 @@ var init_stop = __esm({
|
|
|
9354
9097
|
init_compose();
|
|
9355
9098
|
init_proxy();
|
|
9356
9099
|
init_dispatch();
|
|
9357
|
-
stopCommand =
|
|
9100
|
+
stopCommand = defineCommand28({
|
|
9358
9101
|
meta: {
|
|
9359
9102
|
name: "stop",
|
|
9360
9103
|
group: "run",
|
|
@@ -9379,10 +9122,10 @@ var init_stop = __esm({
|
|
|
9379
9122
|
});
|
|
9380
9123
|
try {
|
|
9381
9124
|
await maybeStopProxy({
|
|
9382
|
-
logger: { info: (msg) =>
|
|
9125
|
+
logger: { info: (msg) => consola31.info(msg) }
|
|
9383
9126
|
});
|
|
9384
9127
|
} catch (err) {
|
|
9385
|
-
|
|
9128
|
+
consola31.warn(
|
|
9386
9129
|
`Could not tear down the Traefik proxy: ${err instanceof Error ? err.message : String(err)}. Ignored.`
|
|
9387
9130
|
);
|
|
9388
9131
|
}
|
|
@@ -9394,11 +9137,11 @@ var init_stop = __esm({
|
|
|
9394
9137
|
});
|
|
9395
9138
|
|
|
9396
9139
|
// src/tunnel/resolve.ts
|
|
9397
|
-
import { existsSync as
|
|
9398
|
-
import
|
|
9140
|
+
import { existsSync as existsSync15 } from "fs";
|
|
9141
|
+
import path23 from "path";
|
|
9399
9142
|
async function resolveTunnelTarget(opts) {
|
|
9400
9143
|
const ymlPath = containerConfigPath(opts.name, opts.monocerosHome);
|
|
9401
|
-
if (!
|
|
9144
|
+
if (!existsSync15(ymlPath)) {
|
|
9402
9145
|
throw new Error(
|
|
9403
9146
|
`No yml profile for '${opts.name}' at ${ymlPath}. Run \`monoceros init ${opts.name}\` first.`
|
|
9404
9147
|
);
|
|
@@ -9406,13 +9149,13 @@ async function resolveTunnelTarget(opts) {
|
|
|
9406
9149
|
const parsed = await readConfig(ymlPath);
|
|
9407
9150
|
const config = parsed.config;
|
|
9408
9151
|
const containerRoot = containerDir(opts.name, opts.monocerosHome);
|
|
9409
|
-
if (!
|
|
9152
|
+
if (!existsSync15(containerRoot)) {
|
|
9410
9153
|
throw new Error(
|
|
9411
9154
|
`Container '${opts.name}' is not materialised at ${containerRoot}. Run \`monoceros apply ${opts.name}\` first.`
|
|
9412
9155
|
);
|
|
9413
9156
|
}
|
|
9414
|
-
const composePath =
|
|
9415
|
-
const isCompose =
|
|
9157
|
+
const composePath = path23.join(containerRoot, ".devcontainer", "compose.yaml");
|
|
9158
|
+
const isCompose = existsSync15(composePath);
|
|
9416
9159
|
const parsedTarget = parseTargetArg(opts.target, config);
|
|
9417
9160
|
const docker = opts.docker ?? defaultDockerExec;
|
|
9418
9161
|
if (isCompose) {
|
|
@@ -9647,8 +9390,8 @@ var init_port_check2 = __esm({
|
|
|
9647
9390
|
});
|
|
9648
9391
|
|
|
9649
9392
|
// src/tunnel/run.ts
|
|
9650
|
-
import { spawn as
|
|
9651
|
-
import { consola as
|
|
9393
|
+
import { spawn as spawn10 } from "child_process";
|
|
9394
|
+
import { consola as consola32 } from "consola";
|
|
9652
9395
|
function signalNumber(signal) {
|
|
9653
9396
|
switch (signal) {
|
|
9654
9397
|
case "SIGINT":
|
|
@@ -9661,8 +9404,8 @@ function signalNumber(signal) {
|
|
|
9661
9404
|
}
|
|
9662
9405
|
async function runTunnel(opts) {
|
|
9663
9406
|
const log = opts.logger ?? {
|
|
9664
|
-
info: (m) =>
|
|
9665
|
-
warn: (m) =>
|
|
9407
|
+
info: (m) => consola32.info(m),
|
|
9408
|
+
warn: (m) => consola32.warn(m)
|
|
9666
9409
|
};
|
|
9667
9410
|
const resolve = opts.resolve ?? resolveTunnelTarget;
|
|
9668
9411
|
const resolveArgs3 = {
|
|
@@ -9737,7 +9480,7 @@ var init_run3 = __esm({
|
|
|
9737
9480
|
init_port_check2();
|
|
9738
9481
|
SOCAT_IMAGE = "alpine/socat:1.8.0.3";
|
|
9739
9482
|
defaultDockerSpawn = (args) => {
|
|
9740
|
-
const child =
|
|
9483
|
+
const child = spawn10("docker", args, {
|
|
9741
9484
|
stdio: "inherit"
|
|
9742
9485
|
});
|
|
9743
9486
|
const exited = new Promise((resolve, reject) => {
|
|
@@ -9768,8 +9511,8 @@ var init_run3 = __esm({
|
|
|
9768
9511
|
});
|
|
9769
9512
|
|
|
9770
9513
|
// src/commands/tunnel.ts
|
|
9771
|
-
import { defineCommand as
|
|
9772
|
-
import { consola as
|
|
9514
|
+
import { defineCommand as defineCommand29 } from "citty";
|
|
9515
|
+
import { consola as consola33 } from "consola";
|
|
9773
9516
|
function parseLocalPort(raw) {
|
|
9774
9517
|
if (raw === void 0) return void 0;
|
|
9775
9518
|
const n = Number(raw);
|
|
@@ -9785,7 +9528,7 @@ var init_tunnel = __esm({
|
|
|
9785
9528
|
"src/commands/tunnel.ts"() {
|
|
9786
9529
|
"use strict";
|
|
9787
9530
|
init_run3();
|
|
9788
|
-
tunnelCommand =
|
|
9531
|
+
tunnelCommand = defineCommand29({
|
|
9789
9532
|
meta: {
|
|
9790
9533
|
name: "tunnel",
|
|
9791
9534
|
group: "discovery",
|
|
@@ -9822,7 +9565,7 @@ var init_tunnel = __esm({
|
|
|
9822
9565
|
});
|
|
9823
9566
|
process.exit(exitCode);
|
|
9824
9567
|
} catch (err) {
|
|
9825
|
-
|
|
9568
|
+
consola33.error(err instanceof Error ? err.message : String(err));
|
|
9826
9569
|
process.exit(1);
|
|
9827
9570
|
}
|
|
9828
9571
|
}
|
|
@@ -9831,8 +9574,8 @@ var init_tunnel = __esm({
|
|
|
9831
9574
|
});
|
|
9832
9575
|
|
|
9833
9576
|
// src/upgrade/index.ts
|
|
9834
|
-
import { existsSync as
|
|
9835
|
-
import { consola as
|
|
9577
|
+
import { existsSync as existsSync16, promises as fs17 } from "fs";
|
|
9578
|
+
import { consola as consola34 } from "consola";
|
|
9836
9579
|
async function fetchRuntimeVersions() {
|
|
9837
9580
|
const tokenUrl = `https://ghcr.io/token?service=ghcr.io&scope=repository:${RUNTIME_REPO}:pull`;
|
|
9838
9581
|
const tokenRes = await fetch(tokenUrl);
|
|
@@ -9870,7 +9613,7 @@ ${yml}`;
|
|
|
9870
9613
|
}
|
|
9871
9614
|
async function runUpgrade(opts) {
|
|
9872
9615
|
const home = opts.monocerosHome ?? monocerosHome();
|
|
9873
|
-
const logger = opts.logger ??
|
|
9616
|
+
const logger = opts.logger ?? consola34;
|
|
9874
9617
|
const fetchVersions = opts.fetchVersions ?? fetchRuntimeVersions;
|
|
9875
9618
|
if (opts.list) {
|
|
9876
9619
|
const versions = await fetchVersions();
|
|
@@ -9890,7 +9633,7 @@ async function runUpgrade(opts) {
|
|
|
9890
9633
|
);
|
|
9891
9634
|
}
|
|
9892
9635
|
const ymlPath = containerConfigPath(opts.name, home);
|
|
9893
|
-
if (!
|
|
9636
|
+
if (!existsSync16(ymlPath)) {
|
|
9894
9637
|
throw new Error(
|
|
9895
9638
|
`No such config: ${ymlPath}. Run \`monoceros init <template> ${opts.name}\` first.`
|
|
9896
9639
|
);
|
|
@@ -9938,7 +9681,7 @@ var init_upgrade = __esm({
|
|
|
9938
9681
|
});
|
|
9939
9682
|
|
|
9940
9683
|
// src/commands/upgrade.ts
|
|
9941
|
-
import { defineCommand as
|
|
9684
|
+
import { defineCommand as defineCommand30 } from "citty";
|
|
9942
9685
|
var upgradeCommand;
|
|
9943
9686
|
var init_upgrade2 = __esm({
|
|
9944
9687
|
"src/commands/upgrade.ts"() {
|
|
@@ -9946,7 +9689,7 @@ var init_upgrade2 = __esm({
|
|
|
9946
9689
|
init_upgrade();
|
|
9947
9690
|
init_version();
|
|
9948
9691
|
init_dispatch();
|
|
9949
|
-
upgradeCommand =
|
|
9692
|
+
upgradeCommand = defineCommand30({
|
|
9950
9693
|
meta: {
|
|
9951
9694
|
name: "upgrade",
|
|
9952
9695
|
group: "lifecycle",
|
|
@@ -9988,7 +9731,7 @@ var main_exports = {};
|
|
|
9988
9731
|
__export(main_exports, {
|
|
9989
9732
|
main: () => main
|
|
9990
9733
|
});
|
|
9991
|
-
import { defineCommand as
|
|
9734
|
+
import { defineCommand as defineCommand31 } from "citty";
|
|
9992
9735
|
var main;
|
|
9993
9736
|
var init_main = __esm({
|
|
9994
9737
|
"src/main.ts"() {
|
|
@@ -10005,7 +9748,6 @@ var init_main = __esm({
|
|
|
10005
9748
|
init_complete();
|
|
10006
9749
|
init_init2();
|
|
10007
9750
|
init_list_components();
|
|
10008
|
-
init_login2();
|
|
10009
9751
|
init_logs();
|
|
10010
9752
|
init_port();
|
|
10011
9753
|
init_remove_apt_packages();
|
|
@@ -10025,7 +9767,7 @@ var init_main = __esm({
|
|
|
10025
9767
|
init_tunnel();
|
|
10026
9768
|
init_upgrade2();
|
|
10027
9769
|
init_version();
|
|
10028
|
-
main =
|
|
9770
|
+
main = defineCommand31({
|
|
10029
9771
|
meta: {
|
|
10030
9772
|
name: "monoceros",
|
|
10031
9773
|
version: CLI_VERSION,
|
|
@@ -10036,7 +9778,6 @@ var init_main = __esm({
|
|
|
10036
9778
|
"list-components": listComponentsCommand,
|
|
10037
9779
|
shell: shellCommand,
|
|
10038
9780
|
run: runCommand,
|
|
10039
|
-
login: loginCommand,
|
|
10040
9781
|
logs: logsCommand,
|
|
10041
9782
|
start: startCommand,
|
|
10042
9783
|
stop: stopCommand,
|
|
@@ -10322,25 +10063,25 @@ function detectHelpRequest(argv, main2) {
|
|
|
10322
10063
|
const separatorIdx = argv.indexOf("--");
|
|
10323
10064
|
if (helpIdx === -1) return null;
|
|
10324
10065
|
if (separatorIdx !== -1 && separatorIdx < helpIdx) return null;
|
|
10325
|
-
const
|
|
10066
|
+
const path24 = [];
|
|
10326
10067
|
const tokens = argv.slice(
|
|
10327
10068
|
0,
|
|
10328
10069
|
separatorIdx === -1 ? argv.length : separatorIdx
|
|
10329
10070
|
);
|
|
10330
10071
|
let cursor = main2;
|
|
10331
10072
|
const mainName = (main2.meta ?? {}).name ?? "monoceros";
|
|
10332
|
-
|
|
10073
|
+
path24.push(mainName);
|
|
10333
10074
|
for (const tok of tokens) {
|
|
10334
10075
|
if (tok.startsWith("-")) continue;
|
|
10335
10076
|
const subs = cursor.subCommands ?? {};
|
|
10336
10077
|
if (tok in subs) {
|
|
10337
10078
|
cursor = subs[tok];
|
|
10338
|
-
|
|
10079
|
+
path24.push(tok);
|
|
10339
10080
|
continue;
|
|
10340
10081
|
}
|
|
10341
10082
|
break;
|
|
10342
10083
|
}
|
|
10343
|
-
return { path:
|
|
10084
|
+
return { path: path24, cmd: cursor };
|
|
10344
10085
|
}
|
|
10345
10086
|
async function maybeRenderHelp(argv, main2) {
|
|
10346
10087
|
const hit = detectHelpRequest(argv, main2);
|