@getmonoceros/workbench 1.19.2 → 1.20.1
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 +213 -467
- 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(),
|
|
@@ -4913,8 +4913,13 @@ function generateAgentsMd(input) {
|
|
|
4913
4913
|
lines.push("## Conventions and pitfalls");
|
|
4914
4914
|
lines.push("");
|
|
4915
4915
|
lines.push(
|
|
4916
|
-
`-
|
|
4917
|
-
"
|
|
4916
|
+
`- **Build everything under \`/workspaces/${input.containerName}/projects/\`.**`,
|
|
4917
|
+
" That is the project workspace \u2014 create new apps and scaffolding there",
|
|
4918
|
+
" (e.g. `projects/<app>/`), and `cd` into it before generating files. Do",
|
|
4919
|
+
` **not** put project files at the workspace root \`/workspaces/${input.containerName}\`:`,
|
|
4920
|
+
" it holds Monoceros-managed directories (`.devcontainer/`, `home/`,",
|
|
4921
|
+
" `data/`, `logs/`), not your code. Cloned repos already live at",
|
|
4922
|
+
" `projects/<repo>/` and are git repositories \u2014 commit normally.",
|
|
4918
4923
|
"- You run as the `node` user. `sudo` is available but its effects do",
|
|
4919
4924
|
" not persist across rebuilds.",
|
|
4920
4925
|
"- A bare `EXPOSE` directive has no effect on host reachability. Ports",
|
|
@@ -6407,7 +6412,7 @@ var CLI_VERSION;
|
|
|
6407
6412
|
var init_version = __esm({
|
|
6408
6413
|
"src/version.ts"() {
|
|
6409
6414
|
"use strict";
|
|
6410
|
-
CLI_VERSION = true ? "1.
|
|
6415
|
+
CLI_VERSION = true ? "1.20.1" : "dev";
|
|
6411
6416
|
}
|
|
6412
6417
|
});
|
|
6413
6418
|
|
|
@@ -6596,43 +6601,6 @@ var init_completion = __esm({
|
|
|
6596
6601
|
}
|
|
6597
6602
|
});
|
|
6598
6603
|
|
|
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
6604
|
// src/completion/resolve.ts
|
|
6637
6605
|
import { existsSync as existsSync8, promises as fs13 } from "fs";
|
|
6638
6606
|
import path16 from "path";
|
|
@@ -6789,20 +6757,6 @@ async function listContainerNames(ctx) {
|
|
|
6789
6757
|
const entries = await fs13.readdir(dir);
|
|
6790
6758
|
return entries.filter((e) => e.endsWith(".yml")).map((e) => e.slice(0, -".yml".length)).sort();
|
|
6791
6759
|
}
|
|
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
6760
|
async function listFeatureComponents() {
|
|
6807
6761
|
const catalog = await loadComponentCatalog();
|
|
6808
6762
|
return [...catalog.values()].filter((c) => c.file.category === "feature").map((c) => c.name).sort();
|
|
@@ -6870,18 +6824,15 @@ var init_resolve = __esm({
|
|
|
6870
6824
|
"src/completion/resolve.ts"() {
|
|
6871
6825
|
"use strict";
|
|
6872
6826
|
init_paths();
|
|
6873
|
-
init_io();
|
|
6874
6827
|
init_components();
|
|
6875
6828
|
init_manifest();
|
|
6876
6829
|
init_catalog();
|
|
6877
|
-
init_services();
|
|
6878
6830
|
init_schema();
|
|
6879
6831
|
ALL_COMMANDS = [
|
|
6880
6832
|
"init",
|
|
6881
6833
|
"list-components",
|
|
6882
6834
|
"shell",
|
|
6883
6835
|
"run",
|
|
6884
|
-
"login",
|
|
6885
6836
|
"logs",
|
|
6886
6837
|
"start",
|
|
6887
6838
|
"stop",
|
|
@@ -6950,7 +6901,6 @@ var init_resolve = __esm({
|
|
|
6950
6901
|
positionals: [containerName],
|
|
6951
6902
|
flags: { "--in": { type: "value" } }
|
|
6952
6903
|
},
|
|
6953
|
-
login: { positionals: [containerName, (ctx) => listLoginServices(ctx)] },
|
|
6954
6904
|
logs: { positionals: [containerName] },
|
|
6955
6905
|
start: { positionals: [containerName] },
|
|
6956
6906
|
stop: { positionals: [containerName] },
|
|
@@ -7923,270 +7873,15 @@ var init_list_components = __esm({
|
|
|
7923
7873
|
}
|
|
7924
7874
|
});
|
|
7925
7875
|
|
|
7926
|
-
// src/
|
|
7876
|
+
// src/commands/logs.ts
|
|
7877
|
+
import { spawn as spawn8 } from "child_process";
|
|
7927
7878
|
import { existsSync as existsSync10 } from "fs";
|
|
7928
7879
|
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
7880
|
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
7881
|
function tailLogFile(file, follow) {
|
|
8187
7882
|
const [cmd, args] = follow ? ["tail", ["-F", file]] : ["cat", [file]];
|
|
8188
7883
|
return new Promise((resolve, reject) => {
|
|
8189
|
-
const child =
|
|
7884
|
+
const child = spawn8(cmd, args, { stdio: "inherit" });
|
|
8190
7885
|
child.on("error", reject);
|
|
8191
7886
|
child.on("exit", (code) => resolve(code ?? 0));
|
|
8192
7887
|
});
|
|
@@ -8198,7 +7893,7 @@ var init_logs = __esm({
|
|
|
8198
7893
|
init_paths();
|
|
8199
7894
|
init_compose();
|
|
8200
7895
|
init_dispatch();
|
|
8201
|
-
logsCommand =
|
|
7896
|
+
logsCommand = defineCommand13({
|
|
8202
7897
|
meta: {
|
|
8203
7898
|
name: "logs",
|
|
8204
7899
|
group: "run",
|
|
@@ -8224,8 +7919,8 @@ var init_logs = __esm({
|
|
|
8224
7919
|
run({ args }) {
|
|
8225
7920
|
const service = typeof args.service === "string" ? args.service : void 0;
|
|
8226
7921
|
if (service) {
|
|
8227
|
-
const logFile =
|
|
8228
|
-
if (
|
|
7922
|
+
const logFile = path18.join(containerLogsDir(args.name), `${service}.log`);
|
|
7923
|
+
if (existsSync10(logFile)) {
|
|
8229
7924
|
return dispatch(() => tailLogFile(logFile, args.follow));
|
|
8230
7925
|
}
|
|
8231
7926
|
}
|
|
@@ -8242,11 +7937,11 @@ var init_logs = __esm({
|
|
|
8242
7937
|
});
|
|
8243
7938
|
|
|
8244
7939
|
// src/commands/port.ts
|
|
8245
|
-
import { defineCommand as
|
|
8246
|
-
import { consola as
|
|
7940
|
+
import { defineCommand as defineCommand14 } from "citty";
|
|
7941
|
+
import { consola as consola16 } from "consola";
|
|
8247
7942
|
async function runPortListing(opts) {
|
|
8248
7943
|
const out = opts.out ?? process.stdout;
|
|
8249
|
-
const info = opts.info ?? ((m) =>
|
|
7944
|
+
const info = opts.info ?? ((m) => consola16.info(m));
|
|
8250
7945
|
const parsed = await readConfig(
|
|
8251
7946
|
containerConfigPath(opts.name, opts.monocerosHome)
|
|
8252
7947
|
);
|
|
@@ -8304,7 +7999,7 @@ var init_port = __esm({
|
|
|
8304
7999
|
init_schema();
|
|
8305
8000
|
init_dynamic();
|
|
8306
8001
|
init_format();
|
|
8307
|
-
portCommand =
|
|
8002
|
+
portCommand = defineCommand14({
|
|
8308
8003
|
meta: {
|
|
8309
8004
|
name: "port",
|
|
8310
8005
|
group: "discovery",
|
|
@@ -8322,7 +8017,7 @@ var init_port = __esm({
|
|
|
8322
8017
|
const code = await runPortListing({ name: args.name });
|
|
8323
8018
|
process.exit(code);
|
|
8324
8019
|
} catch (err) {
|
|
8325
|
-
|
|
8020
|
+
consola16.error(err instanceof Error ? err.message : String(err));
|
|
8326
8021
|
process.exit(1);
|
|
8327
8022
|
}
|
|
8328
8023
|
}
|
|
@@ -8331,15 +8026,15 @@ var init_port = __esm({
|
|
|
8331
8026
|
});
|
|
8332
8027
|
|
|
8333
8028
|
// src/commands/remove-apt-packages.ts
|
|
8334
|
-
import { defineCommand as
|
|
8335
|
-
import { consola as
|
|
8029
|
+
import { defineCommand as defineCommand15 } from "citty";
|
|
8030
|
+
import { consola as consola17 } from "consola";
|
|
8336
8031
|
var removeAptPackagesCommand;
|
|
8337
8032
|
var init_remove_apt_packages = __esm({
|
|
8338
8033
|
"src/commands/remove-apt-packages.ts"() {
|
|
8339
8034
|
"use strict";
|
|
8340
8035
|
init_inner_args();
|
|
8341
8036
|
init_modify();
|
|
8342
|
-
removeAptPackagesCommand =
|
|
8037
|
+
removeAptPackagesCommand = defineCommand15({
|
|
8343
8038
|
meta: {
|
|
8344
8039
|
name: "remove-apt-packages",
|
|
8345
8040
|
group: "edit",
|
|
@@ -8361,7 +8056,7 @@ var init_remove_apt_packages = __esm({
|
|
|
8361
8056
|
async run({ args }) {
|
|
8362
8057
|
const packages = [...getInnerArgs()];
|
|
8363
8058
|
if (packages.length === 0) {
|
|
8364
|
-
|
|
8059
|
+
consola17.error(
|
|
8365
8060
|
"No package names given. Usage: `monoceros remove-apt-packages <containername> [--yes] -- <pkg> [<pkg> \u2026]`."
|
|
8366
8061
|
);
|
|
8367
8062
|
process.exit(1);
|
|
@@ -8374,7 +8069,7 @@ var init_remove_apt_packages = __esm({
|
|
|
8374
8069
|
});
|
|
8375
8070
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8376
8071
|
} catch (err) {
|
|
8377
|
-
|
|
8072
|
+
consola17.error(err instanceof Error ? err.message : String(err));
|
|
8378
8073
|
process.exit(1);
|
|
8379
8074
|
}
|
|
8380
8075
|
}
|
|
@@ -8383,14 +8078,14 @@ var init_remove_apt_packages = __esm({
|
|
|
8383
8078
|
});
|
|
8384
8079
|
|
|
8385
8080
|
// src/commands/remove-feature.ts
|
|
8386
|
-
import { defineCommand as
|
|
8387
|
-
import { consola as
|
|
8081
|
+
import { defineCommand as defineCommand16 } from "citty";
|
|
8082
|
+
import { consola as consola18 } from "consola";
|
|
8388
8083
|
var removeFeatureCommand;
|
|
8389
8084
|
var init_remove_feature = __esm({
|
|
8390
8085
|
"src/commands/remove-feature.ts"() {
|
|
8391
8086
|
"use strict";
|
|
8392
8087
|
init_modify();
|
|
8393
|
-
removeFeatureCommand =
|
|
8088
|
+
removeFeatureCommand = defineCommand16({
|
|
8394
8089
|
meta: {
|
|
8395
8090
|
name: "remove-feature",
|
|
8396
8091
|
group: "edit",
|
|
@@ -8423,7 +8118,7 @@ var init_remove_feature = __esm({
|
|
|
8423
8118
|
});
|
|
8424
8119
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8425
8120
|
} catch (err) {
|
|
8426
|
-
|
|
8121
|
+
consola18.error(err instanceof Error ? err.message : String(err));
|
|
8427
8122
|
process.exit(1);
|
|
8428
8123
|
}
|
|
8429
8124
|
}
|
|
@@ -8432,15 +8127,15 @@ var init_remove_feature = __esm({
|
|
|
8432
8127
|
});
|
|
8433
8128
|
|
|
8434
8129
|
// src/remove/index.ts
|
|
8435
|
-
import { existsSync as
|
|
8436
|
-
import
|
|
8437
|
-
import { consola as
|
|
8130
|
+
import { existsSync as existsSync11, promises as fs15 } from "fs";
|
|
8131
|
+
import path19 from "path";
|
|
8132
|
+
import { consola as consola19 } from "consola";
|
|
8438
8133
|
async function runRemove(opts) {
|
|
8439
8134
|
const home = opts.monocerosHome ?? monocerosHome();
|
|
8440
8135
|
const logger = opts.logger ?? {
|
|
8441
|
-
info: (msg) =>
|
|
8442
|
-
success: (msg) =>
|
|
8443
|
-
warn: (msg) =>
|
|
8136
|
+
info: (msg) => consola19.info(msg),
|
|
8137
|
+
success: (msg) => consola19.success(msg),
|
|
8138
|
+
warn: (msg) => consola19.warn(msg)
|
|
8444
8139
|
};
|
|
8445
8140
|
if (!REGEX.solutionName.test(opts.name)) {
|
|
8446
8141
|
throw new Error(
|
|
@@ -8450,9 +8145,9 @@ async function runRemove(opts) {
|
|
|
8450
8145
|
const ymlPath = containerConfigPath(opts.name, home);
|
|
8451
8146
|
const envPath = containerEnvPath(opts.name, home);
|
|
8452
8147
|
const containerPath = containerDir(opts.name, home);
|
|
8453
|
-
const hasYml =
|
|
8454
|
-
const hasEnv =
|
|
8455
|
-
const hasContainer =
|
|
8148
|
+
const hasYml = existsSync11(ymlPath);
|
|
8149
|
+
const hasEnv = existsSync11(envPath);
|
|
8150
|
+
const hasContainer = existsSync11(containerPath);
|
|
8456
8151
|
if (!hasYml && !hasContainer) {
|
|
8457
8152
|
throw new Error(
|
|
8458
8153
|
`Nothing to remove for '${opts.name}': neither ${ymlPath} nor ${containerPath} exists.`
|
|
@@ -8478,16 +8173,16 @@ async function runRemove(opts) {
|
|
|
8478
8173
|
let backupPath = null;
|
|
8479
8174
|
if (!opts.noBackup && (hasYml || hasContainer)) {
|
|
8480
8175
|
const ts = (opts.now ?? /* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8481
|
-
backupPath =
|
|
8176
|
+
backupPath = path19.join(home, "container-backups", `${opts.name}-${ts}`);
|
|
8482
8177
|
await fs15.mkdir(backupPath, { recursive: true });
|
|
8483
8178
|
if (hasYml) {
|
|
8484
|
-
await fs15.copyFile(ymlPath,
|
|
8179
|
+
await fs15.copyFile(ymlPath, path19.join(backupPath, `${opts.name}.yml`));
|
|
8485
8180
|
}
|
|
8486
8181
|
if (hasEnv) {
|
|
8487
|
-
await fs15.copyFile(envPath,
|
|
8182
|
+
await fs15.copyFile(envPath, path19.join(backupPath, `${opts.name}.env`));
|
|
8488
8183
|
}
|
|
8489
8184
|
if (hasContainer) {
|
|
8490
|
-
await fs15.cp(containerPath,
|
|
8185
|
+
await fs15.cp(containerPath, path19.join(backupPath, "container"), {
|
|
8491
8186
|
recursive: true
|
|
8492
8187
|
});
|
|
8493
8188
|
}
|
|
@@ -8576,15 +8271,15 @@ var init_remove = __esm({
|
|
|
8576
8271
|
});
|
|
8577
8272
|
|
|
8578
8273
|
// src/commands/remove.ts
|
|
8579
|
-
import { defineCommand as
|
|
8580
|
-
import { consola as
|
|
8274
|
+
import { defineCommand as defineCommand17 } from "citty";
|
|
8275
|
+
import { consola as consola20 } from "consola";
|
|
8581
8276
|
import { createInterface } from "readline/promises";
|
|
8582
8277
|
var removeCommand;
|
|
8583
8278
|
var init_remove2 = __esm({
|
|
8584
8279
|
"src/commands/remove.ts"() {
|
|
8585
8280
|
"use strict";
|
|
8586
8281
|
init_remove();
|
|
8587
|
-
removeCommand =
|
|
8282
|
+
removeCommand = defineCommand17({
|
|
8588
8283
|
meta: {
|
|
8589
8284
|
name: "remove",
|
|
8590
8285
|
group: "lifecycle",
|
|
@@ -8621,7 +8316,7 @@ var init_remove2 = __esm({
|
|
|
8621
8316
|
const skipPrompt = args.yes === true;
|
|
8622
8317
|
if (!skipPrompt) {
|
|
8623
8318
|
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
|
-
|
|
8319
|
+
consola20.warn(warning);
|
|
8625
8320
|
const rl = createInterface({
|
|
8626
8321
|
input: process.stdin,
|
|
8627
8322
|
output: process.stdout
|
|
@@ -8629,7 +8324,7 @@ var init_remove2 = __esm({
|
|
|
8629
8324
|
const answer = await rl.question("Continue? [y/N] ");
|
|
8630
8325
|
rl.close();
|
|
8631
8326
|
if (!/^y(es)?$/i.test(answer.trim())) {
|
|
8632
|
-
|
|
8327
|
+
consola20.info("Aborted. Nothing changed.");
|
|
8633
8328
|
process.exit(0);
|
|
8634
8329
|
}
|
|
8635
8330
|
}
|
|
@@ -8638,7 +8333,7 @@ var init_remove2 = __esm({
|
|
|
8638
8333
|
...noBackup ? { noBackup: true } : {}
|
|
8639
8334
|
});
|
|
8640
8335
|
} catch (err) {
|
|
8641
|
-
|
|
8336
|
+
consola20.error(err instanceof Error ? err.message : String(err));
|
|
8642
8337
|
process.exit(1);
|
|
8643
8338
|
}
|
|
8644
8339
|
}
|
|
@@ -8647,17 +8342,17 @@ var init_remove2 = __esm({
|
|
|
8647
8342
|
});
|
|
8648
8343
|
|
|
8649
8344
|
// src/restore/index.ts
|
|
8650
|
-
import { existsSync as
|
|
8651
|
-
import
|
|
8652
|
-
import { consola as
|
|
8345
|
+
import { existsSync as existsSync12, promises as fs16 } from "fs";
|
|
8346
|
+
import path20 from "path";
|
|
8347
|
+
import { consola as consola21 } from "consola";
|
|
8653
8348
|
async function runRestore(opts) {
|
|
8654
8349
|
const home = opts.monocerosHome ?? monocerosHome();
|
|
8655
8350
|
const logger = opts.logger ?? {
|
|
8656
|
-
info: (msg) =>
|
|
8657
|
-
success: (msg) =>
|
|
8351
|
+
info: (msg) => consola21.info(msg),
|
|
8352
|
+
success: (msg) => consola21.success(msg)
|
|
8658
8353
|
};
|
|
8659
|
-
const backup =
|
|
8660
|
-
if (!
|
|
8354
|
+
const backup = path20.resolve(opts.backupPath);
|
|
8355
|
+
if (!existsSync12(backup)) {
|
|
8661
8356
|
throw new Error(`Backup not found: ${backup}.`);
|
|
8662
8357
|
}
|
|
8663
8358
|
const stat = await fs16.stat(backup);
|
|
@@ -8678,24 +8373,24 @@ async function runRestore(opts) {
|
|
|
8678
8373
|
}
|
|
8679
8374
|
const ymlFile = ymlFiles[0];
|
|
8680
8375
|
const name = ymlFile.replace(/\.yml$/, "");
|
|
8681
|
-
const containerInBackup =
|
|
8682
|
-
const hasContainer =
|
|
8683
|
-
const envInBackup =
|
|
8684
|
-
const hasEnv =
|
|
8376
|
+
const containerInBackup = path20.join(backup, "container");
|
|
8377
|
+
const hasContainer = existsSync12(containerInBackup);
|
|
8378
|
+
const envInBackup = path20.join(backup, `${name}.env`);
|
|
8379
|
+
const hasEnv = existsSync12(envInBackup);
|
|
8685
8380
|
const destYml = containerConfigPath(name, home);
|
|
8686
8381
|
const destContainer = containerDir(name, home);
|
|
8687
|
-
if (
|
|
8382
|
+
if (existsSync12(destYml)) {
|
|
8688
8383
|
throw new Error(
|
|
8689
8384
|
`Refusing to restore: ${destYml} already exists. Remove the current container first (\`monoceros remove ${name}\`) or rename the existing config.`
|
|
8690
8385
|
);
|
|
8691
8386
|
}
|
|
8692
|
-
if (hasContainer &&
|
|
8387
|
+
if (hasContainer && existsSync12(destContainer)) {
|
|
8693
8388
|
throw new Error(
|
|
8694
8389
|
`Refusing to restore: ${destContainer} already exists. Remove the current container first (\`monoceros remove ${name}\`).`
|
|
8695
8390
|
);
|
|
8696
8391
|
}
|
|
8697
8392
|
await fs16.mkdir(containerConfigsDir(home), { recursive: true });
|
|
8698
|
-
await fs16.copyFile(
|
|
8393
|
+
await fs16.copyFile(path20.join(backup, ymlFile), destYml);
|
|
8699
8394
|
if (hasEnv) {
|
|
8700
8395
|
await fs16.copyFile(envInBackup, containerEnvPath(name, home));
|
|
8701
8396
|
}
|
|
@@ -8720,14 +8415,14 @@ var init_restore = __esm({
|
|
|
8720
8415
|
});
|
|
8721
8416
|
|
|
8722
8417
|
// src/commands/restore.ts
|
|
8723
|
-
import { defineCommand as
|
|
8724
|
-
import { consola as
|
|
8418
|
+
import { defineCommand as defineCommand18 } from "citty";
|
|
8419
|
+
import { consola as consola22 } from "consola";
|
|
8725
8420
|
var restoreCommand;
|
|
8726
8421
|
var init_restore2 = __esm({
|
|
8727
8422
|
"src/commands/restore.ts"() {
|
|
8728
8423
|
"use strict";
|
|
8729
8424
|
init_restore();
|
|
8730
|
-
restoreCommand =
|
|
8425
|
+
restoreCommand = defineCommand18({
|
|
8731
8426
|
meta: {
|
|
8732
8427
|
name: "restore",
|
|
8733
8428
|
group: "lifecycle",
|
|
@@ -8744,7 +8439,7 @@ var init_restore2 = __esm({
|
|
|
8744
8439
|
try {
|
|
8745
8440
|
await runRestore({ backupPath: args["backup-path"] });
|
|
8746
8441
|
} catch (err) {
|
|
8747
|
-
|
|
8442
|
+
consola22.error(err instanceof Error ? err.message : String(err));
|
|
8748
8443
|
process.exit(1);
|
|
8749
8444
|
}
|
|
8750
8445
|
}
|
|
@@ -8753,14 +8448,14 @@ var init_restore2 = __esm({
|
|
|
8753
8448
|
});
|
|
8754
8449
|
|
|
8755
8450
|
// src/commands/remove-from-url.ts
|
|
8756
|
-
import { defineCommand as
|
|
8757
|
-
import { consola as
|
|
8451
|
+
import { defineCommand as defineCommand19 } from "citty";
|
|
8452
|
+
import { consola as consola23 } from "consola";
|
|
8758
8453
|
var removeFromUrlCommand;
|
|
8759
8454
|
var init_remove_from_url = __esm({
|
|
8760
8455
|
"src/commands/remove-from-url.ts"() {
|
|
8761
8456
|
"use strict";
|
|
8762
8457
|
init_modify();
|
|
8763
|
-
removeFromUrlCommand =
|
|
8458
|
+
removeFromUrlCommand = defineCommand19({
|
|
8764
8459
|
meta: {
|
|
8765
8460
|
name: "remove-from-url",
|
|
8766
8461
|
group: "edit",
|
|
@@ -8793,7 +8488,7 @@ var init_remove_from_url = __esm({
|
|
|
8793
8488
|
});
|
|
8794
8489
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8795
8490
|
} catch (err) {
|
|
8796
|
-
|
|
8491
|
+
consola23.error(err instanceof Error ? err.message : String(err));
|
|
8797
8492
|
process.exit(1);
|
|
8798
8493
|
}
|
|
8799
8494
|
}
|
|
@@ -8802,14 +8497,14 @@ var init_remove_from_url = __esm({
|
|
|
8802
8497
|
});
|
|
8803
8498
|
|
|
8804
8499
|
// src/commands/remove-language.ts
|
|
8805
|
-
import { defineCommand as
|
|
8806
|
-
import { consola as
|
|
8500
|
+
import { defineCommand as defineCommand20 } from "citty";
|
|
8501
|
+
import { consola as consola24 } from "consola";
|
|
8807
8502
|
var removeLanguageCommand;
|
|
8808
8503
|
var init_remove_language = __esm({
|
|
8809
8504
|
"src/commands/remove-language.ts"() {
|
|
8810
8505
|
"use strict";
|
|
8811
8506
|
init_modify();
|
|
8812
|
-
removeLanguageCommand =
|
|
8507
|
+
removeLanguageCommand = defineCommand20({
|
|
8813
8508
|
meta: {
|
|
8814
8509
|
name: "remove-language",
|
|
8815
8510
|
group: "edit",
|
|
@@ -8842,7 +8537,7 @@ var init_remove_language = __esm({
|
|
|
8842
8537
|
});
|
|
8843
8538
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8844
8539
|
} catch (err) {
|
|
8845
|
-
|
|
8540
|
+
consola24.error(err instanceof Error ? err.message : String(err));
|
|
8846
8541
|
process.exit(1);
|
|
8847
8542
|
}
|
|
8848
8543
|
}
|
|
@@ -8851,8 +8546,8 @@ var init_remove_language = __esm({
|
|
|
8851
8546
|
});
|
|
8852
8547
|
|
|
8853
8548
|
// src/commands/remove-port.ts
|
|
8854
|
-
import { defineCommand as
|
|
8855
|
-
import { consola as
|
|
8549
|
+
import { defineCommand as defineCommand21 } from "citty";
|
|
8550
|
+
import { consola as consola25 } from "consola";
|
|
8856
8551
|
function coerceToken2(raw) {
|
|
8857
8552
|
const n = Number(raw);
|
|
8858
8553
|
return Number.isFinite(n) ? n : raw;
|
|
@@ -8863,7 +8558,7 @@ var init_remove_port = __esm({
|
|
|
8863
8558
|
"use strict";
|
|
8864
8559
|
init_inner_args();
|
|
8865
8560
|
init_modify();
|
|
8866
|
-
removePortCommand =
|
|
8561
|
+
removePortCommand = defineCommand21({
|
|
8867
8562
|
meta: {
|
|
8868
8563
|
name: "remove-port",
|
|
8869
8564
|
group: "edit",
|
|
@@ -8885,7 +8580,7 @@ var init_remove_port = __esm({
|
|
|
8885
8580
|
async run({ args }) {
|
|
8886
8581
|
const tokens = [...getInnerArgs()];
|
|
8887
8582
|
if (tokens.length === 0) {
|
|
8888
|
-
|
|
8583
|
+
consola25.error(
|
|
8889
8584
|
"No ports given. Usage: `monoceros remove-port <containername> [--yes] -- <port> [<port> \u2026]`."
|
|
8890
8585
|
);
|
|
8891
8586
|
process.exit(1);
|
|
@@ -8898,7 +8593,7 @@ var init_remove_port = __esm({
|
|
|
8898
8593
|
});
|
|
8899
8594
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8900
8595
|
} catch (err) {
|
|
8901
|
-
|
|
8596
|
+
consola25.error(err instanceof Error ? err.message : String(err));
|
|
8902
8597
|
process.exit(1);
|
|
8903
8598
|
}
|
|
8904
8599
|
}
|
|
@@ -8907,14 +8602,14 @@ var init_remove_port = __esm({
|
|
|
8907
8602
|
});
|
|
8908
8603
|
|
|
8909
8604
|
// src/commands/remove-repo.ts
|
|
8910
|
-
import { defineCommand as
|
|
8911
|
-
import { consola as
|
|
8605
|
+
import { defineCommand as defineCommand22 } from "citty";
|
|
8606
|
+
import { consola as consola26 } from "consola";
|
|
8912
8607
|
var removeRepoCommand;
|
|
8913
8608
|
var init_remove_repo = __esm({
|
|
8914
8609
|
"src/commands/remove-repo.ts"() {
|
|
8915
8610
|
"use strict";
|
|
8916
8611
|
init_modify();
|
|
8917
|
-
removeRepoCommand =
|
|
8612
|
+
removeRepoCommand = defineCommand22({
|
|
8918
8613
|
meta: {
|
|
8919
8614
|
name: "remove-repo",
|
|
8920
8615
|
group: "edit",
|
|
@@ -8947,7 +8642,7 @@ var init_remove_repo = __esm({
|
|
|
8947
8642
|
});
|
|
8948
8643
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8949
8644
|
} catch (err) {
|
|
8950
|
-
|
|
8645
|
+
consola26.error(err instanceof Error ? err.message : String(err));
|
|
8951
8646
|
process.exit(1);
|
|
8952
8647
|
}
|
|
8953
8648
|
}
|
|
@@ -8956,14 +8651,14 @@ var init_remove_repo = __esm({
|
|
|
8956
8651
|
});
|
|
8957
8652
|
|
|
8958
8653
|
// src/commands/remove-service.ts
|
|
8959
|
-
import { defineCommand as
|
|
8960
|
-
import { consola as
|
|
8654
|
+
import { defineCommand as defineCommand23 } from "citty";
|
|
8655
|
+
import { consola as consola27 } from "consola";
|
|
8961
8656
|
var removeServiceCommand;
|
|
8962
8657
|
var init_remove_service = __esm({
|
|
8963
8658
|
"src/commands/remove-service.ts"() {
|
|
8964
8659
|
"use strict";
|
|
8965
8660
|
init_modify();
|
|
8966
|
-
removeServiceCommand =
|
|
8661
|
+
removeServiceCommand = defineCommand23({
|
|
8967
8662
|
meta: {
|
|
8968
8663
|
name: "remove-service",
|
|
8969
8664
|
group: "edit",
|
|
@@ -8996,7 +8691,7 @@ var init_remove_service = __esm({
|
|
|
8996
8691
|
});
|
|
8997
8692
|
process.exit(result.status === "aborted" ? 1 : 0);
|
|
8998
8693
|
} catch (err) {
|
|
8999
|
-
|
|
8694
|
+
consola27.error(err instanceof Error ? err.message : String(err));
|
|
9000
8695
|
process.exit(1);
|
|
9001
8696
|
}
|
|
9002
8697
|
}
|
|
@@ -9005,15 +8700,29 @@ var init_remove_service = __esm({
|
|
|
9005
8700
|
});
|
|
9006
8701
|
|
|
9007
8702
|
// src/devcontainer/browser-bridge.ts
|
|
9008
|
-
import { spawn as
|
|
9009
|
-
import { existsSync as
|
|
9010
|
-
import
|
|
9011
|
-
import
|
|
9012
|
-
function
|
|
8703
|
+
import { spawn as spawn9 } from "child_process";
|
|
8704
|
+
import { existsSync as existsSync13, promises as fsp2, readFileSync as readFileSync6 } from "fs";
|
|
8705
|
+
import http from "http";
|
|
8706
|
+
import path21 from "path";
|
|
8707
|
+
function parseCallbackTarget(authUrl) {
|
|
8708
|
+
try {
|
|
8709
|
+
const u = new URL(authUrl);
|
|
8710
|
+
const redirect = u.searchParams.get("redirect_uri");
|
|
8711
|
+
if (!redirect) return null;
|
|
8712
|
+
const r = new URL(redirect);
|
|
8713
|
+
if (r.hostname !== "localhost" && r.hostname !== "127.0.0.1") return null;
|
|
8714
|
+
const port = Number(r.port);
|
|
8715
|
+
if (!Number.isInteger(port) || port <= 0) return null;
|
|
8716
|
+
return { port, pathname: r.pathname };
|
|
8717
|
+
} catch {
|
|
8718
|
+
return null;
|
|
8719
|
+
}
|
|
8720
|
+
}
|
|
8721
|
+
function openInBrowser(url) {
|
|
9013
8722
|
const platform = process.platform;
|
|
9014
8723
|
const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
9015
8724
|
try {
|
|
9016
|
-
const child =
|
|
8725
|
+
const child = spawn9(cmd, args, {
|
|
9017
8726
|
stdio: "ignore",
|
|
9018
8727
|
detached: true
|
|
9019
8728
|
});
|
|
@@ -9024,12 +8733,12 @@ function openInBrowser2(url) {
|
|
|
9024
8733
|
}
|
|
9025
8734
|
}
|
|
9026
8735
|
async function startBrowserBridge(opts) {
|
|
9027
|
-
const relayDir =
|
|
9028
|
-
const relayScript =
|
|
9029
|
-
const urlFile =
|
|
9030
|
-
await
|
|
9031
|
-
await
|
|
9032
|
-
await
|
|
8736
|
+
const relayDir = path21.join(opts.root, RELAY_DIRNAME);
|
|
8737
|
+
const relayScript = path21.join(relayDir, "xdg-open");
|
|
8738
|
+
const urlFile = path21.join(relayDir, "url");
|
|
8739
|
+
await fsp2.mkdir(relayDir, { recursive: true });
|
|
8740
|
+
await fsp2.rm(urlFile, { force: true });
|
|
8741
|
+
await fsp2.writeFile(
|
|
9033
8742
|
relayScript,
|
|
9034
8743
|
`#!/bin/sh
|
|
9035
8744
|
printf '%s\\n' "$1" > "$(dirname "$0")/url"
|
|
@@ -9037,14 +8746,14 @@ exit 0
|
|
|
9037
8746
|
`,
|
|
9038
8747
|
{ mode: 493 }
|
|
9039
8748
|
);
|
|
9040
|
-
await
|
|
8749
|
+
await fsp2.chmod(relayScript, 493);
|
|
9041
8750
|
const servers = [];
|
|
9042
8751
|
let handled = false;
|
|
9043
8752
|
const onUrl = (url) => {
|
|
9044
|
-
|
|
8753
|
+
openInBrowser(url);
|
|
9045
8754
|
const target = parseCallbackTarget(url);
|
|
9046
8755
|
if (!target) return;
|
|
9047
|
-
const server =
|
|
8756
|
+
const server = http.createServer((req, res) => {
|
|
9048
8757
|
const reqUrl = req.url ?? target.pathname;
|
|
9049
8758
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
9050
8759
|
res.end(
|
|
@@ -9070,10 +8779,10 @@ exit 0
|
|
|
9070
8779
|
servers.push(server);
|
|
9071
8780
|
};
|
|
9072
8781
|
const poll = setInterval(() => {
|
|
9073
|
-
if (handled || !
|
|
8782
|
+
if (handled || !existsSync13(urlFile)) return;
|
|
9074
8783
|
let content = "";
|
|
9075
8784
|
try {
|
|
9076
|
-
content =
|
|
8785
|
+
content = readFileSync6(urlFile, "utf8");
|
|
9077
8786
|
} catch {
|
|
9078
8787
|
return;
|
|
9079
8788
|
}
|
|
@@ -9082,20 +8791,57 @@ exit 0
|
|
|
9082
8791
|
onUrl(content.trim());
|
|
9083
8792
|
}, 250);
|
|
9084
8793
|
return {
|
|
9085
|
-
relayDirInContainer: `/workspaces/${opts.name}/${
|
|
8794
|
+
relayDirInContainer: `/workspaces/${opts.name}/${RELAY_DIRNAME}`,
|
|
9086
8795
|
async dispose() {
|
|
9087
8796
|
clearInterval(poll);
|
|
9088
8797
|
for (const s of servers) s.close();
|
|
9089
|
-
await
|
|
8798
|
+
await fsp2.rm(relayDir, { recursive: true, force: true });
|
|
9090
8799
|
}
|
|
9091
8800
|
};
|
|
9092
8801
|
}
|
|
9093
|
-
var
|
|
8802
|
+
var RELAY_DIRNAME;
|
|
9094
8803
|
var init_browser_bridge = __esm({
|
|
9095
8804
|
"src/devcontainer/browser-bridge.ts"() {
|
|
9096
8805
|
"use strict";
|
|
9097
|
-
|
|
9098
|
-
|
|
8806
|
+
RELAY_DIRNAME = ".monoceros-bridge";
|
|
8807
|
+
}
|
|
8808
|
+
});
|
|
8809
|
+
|
|
8810
|
+
// src/devcontainer/shell.ts
|
|
8811
|
+
import { existsSync as existsSync14 } from "fs";
|
|
8812
|
+
import path22 from "path";
|
|
8813
|
+
async function runShell(opts) {
|
|
8814
|
+
assertContainerExists(opts.root);
|
|
8815
|
+
const spawnFn = opts.spawn ?? spawnDevcontainer;
|
|
8816
|
+
const upCode = await spawnFn(
|
|
8817
|
+
["up", "--workspace-folder", opts.root, "--mount-workspace-git-root=false"],
|
|
8818
|
+
opts.root,
|
|
8819
|
+
{ quiet: true }
|
|
8820
|
+
);
|
|
8821
|
+
if (upCode !== 0) return upCode;
|
|
8822
|
+
return spawnFn(
|
|
8823
|
+
[
|
|
8824
|
+
"exec",
|
|
8825
|
+
"--workspace-folder",
|
|
8826
|
+
opts.root,
|
|
8827
|
+
"--mount-workspace-git-root=false",
|
|
8828
|
+
"bash"
|
|
8829
|
+
],
|
|
8830
|
+
opts.root,
|
|
8831
|
+
{ interactive: true }
|
|
8832
|
+
);
|
|
8833
|
+
}
|
|
8834
|
+
function assertContainerExists(root) {
|
|
8835
|
+
if (!existsSync14(path22.join(root, ".devcontainer"))) {
|
|
8836
|
+
throw new Error(
|
|
8837
|
+
`No .devcontainer/ at ${root}. Run \`monoceros apply <name>\` first.`
|
|
8838
|
+
);
|
|
8839
|
+
}
|
|
8840
|
+
}
|
|
8841
|
+
var init_shell = __esm({
|
|
8842
|
+
"src/devcontainer/shell.ts"() {
|
|
8843
|
+
"use strict";
|
|
8844
|
+
init_cli();
|
|
9099
8845
|
}
|
|
9100
8846
|
});
|
|
9101
8847
|
|
|
@@ -9105,7 +8851,9 @@ function wrapExec(command, opts) {
|
|
|
9105
8851
|
const stmts = [];
|
|
9106
8852
|
if (opts.pathPrepend) {
|
|
9107
8853
|
leading.push(opts.pathPrepend);
|
|
9108
|
-
|
|
8854
|
+
const i = leading.length;
|
|
8855
|
+
stmts.push(`export PATH="$${i}:$PATH"`);
|
|
8856
|
+
stmts.push(`export BROWSER="$${i}/xdg-open"`);
|
|
9109
8857
|
}
|
|
9110
8858
|
if (opts.cwd) {
|
|
9111
8859
|
leading.push(opts.cwd);
|
|
@@ -9165,8 +8913,8 @@ var init_run = __esm({
|
|
|
9165
8913
|
});
|
|
9166
8914
|
|
|
9167
8915
|
// src/commands/run.ts
|
|
9168
|
-
import { defineCommand as
|
|
9169
|
-
import { consola as
|
|
8916
|
+
import { defineCommand as defineCommand24 } from "citty";
|
|
8917
|
+
import { consola as consola28 } from "consola";
|
|
9170
8918
|
var runCommand;
|
|
9171
8919
|
var init_run2 = __esm({
|
|
9172
8920
|
"src/commands/run.ts"() {
|
|
@@ -9174,7 +8922,7 @@ var init_run2 = __esm({
|
|
|
9174
8922
|
init_paths();
|
|
9175
8923
|
init_run();
|
|
9176
8924
|
init_inner_args();
|
|
9177
|
-
runCommand =
|
|
8925
|
+
runCommand = defineCommand24({
|
|
9178
8926
|
meta: {
|
|
9179
8927
|
name: "run",
|
|
9180
8928
|
group: "run",
|
|
@@ -9194,7 +8942,7 @@ var init_run2 = __esm({
|
|
|
9194
8942
|
async run({ args }) {
|
|
9195
8943
|
const command = [...getInnerArgs()];
|
|
9196
8944
|
if (command.length === 0) {
|
|
9197
|
-
|
|
8945
|
+
consola28.error(
|
|
9198
8946
|
"No command provided. Usage: `monoceros run <containername> -- <cmd> [args\u2026]`."
|
|
9199
8947
|
);
|
|
9200
8948
|
process.exit(1);
|
|
@@ -9208,7 +8956,7 @@ var init_run2 = __esm({
|
|
|
9208
8956
|
});
|
|
9209
8957
|
process.exit(exitCode);
|
|
9210
8958
|
} catch (err) {
|
|
9211
|
-
|
|
8959
|
+
consola28.error(err instanceof Error ? err.message : String(err));
|
|
9212
8960
|
process.exit(1);
|
|
9213
8961
|
}
|
|
9214
8962
|
}
|
|
@@ -9217,15 +8965,15 @@ var init_run2 = __esm({
|
|
|
9217
8965
|
});
|
|
9218
8966
|
|
|
9219
8967
|
// src/commands/shell.ts
|
|
9220
|
-
import { defineCommand as
|
|
9221
|
-
import { consola as
|
|
8968
|
+
import { defineCommand as defineCommand25 } from "citty";
|
|
8969
|
+
import { consola as consola29 } from "consola";
|
|
9222
8970
|
var shellCommand;
|
|
9223
8971
|
var init_shell2 = __esm({
|
|
9224
8972
|
"src/commands/shell.ts"() {
|
|
9225
8973
|
"use strict";
|
|
9226
8974
|
init_paths();
|
|
9227
8975
|
init_shell();
|
|
9228
|
-
shellCommand =
|
|
8976
|
+
shellCommand = defineCommand25({
|
|
9229
8977
|
meta: {
|
|
9230
8978
|
name: "shell",
|
|
9231
8979
|
group: "run",
|
|
@@ -9243,7 +8991,7 @@ var init_shell2 = __esm({
|
|
|
9243
8991
|
const exitCode = await runShell({ root: containerDir(args.name) });
|
|
9244
8992
|
process.exit(exitCode);
|
|
9245
8993
|
} catch (err) {
|
|
9246
|
-
|
|
8994
|
+
consola29.error(err instanceof Error ? err.message : String(err));
|
|
9247
8995
|
process.exit(1);
|
|
9248
8996
|
}
|
|
9249
8997
|
}
|
|
@@ -9252,8 +9000,8 @@ var init_shell2 = __esm({
|
|
|
9252
9000
|
});
|
|
9253
9001
|
|
|
9254
9002
|
// src/commands/start.ts
|
|
9255
|
-
import { defineCommand as
|
|
9256
|
-
import { consola as
|
|
9003
|
+
import { defineCommand as defineCommand26 } from "citty";
|
|
9004
|
+
import { consola as consola30 } from "consola";
|
|
9257
9005
|
var startCommand;
|
|
9258
9006
|
var init_start = __esm({
|
|
9259
9007
|
"src/commands/start.ts"() {
|
|
@@ -9265,7 +9013,7 @@ var init_start = __esm({
|
|
|
9265
9013
|
init_proxy();
|
|
9266
9014
|
init_port_check();
|
|
9267
9015
|
init_dispatch();
|
|
9268
|
-
startCommand =
|
|
9016
|
+
startCommand = defineCommand26({
|
|
9269
9017
|
meta: {
|
|
9270
9018
|
name: "start",
|
|
9271
9019
|
group: "run",
|
|
@@ -9290,7 +9038,7 @@ var init_start = __esm({
|
|
|
9290
9038
|
hostPort = proxyHostPort(global);
|
|
9291
9039
|
}
|
|
9292
9040
|
} catch (err) {
|
|
9293
|
-
|
|
9041
|
+
consola30.warn(
|
|
9294
9042
|
`Could not read container yml ahead of start: ${err instanceof Error ? err.message : String(err)}. Skipping Traefik pre-flight.`
|
|
9295
9043
|
);
|
|
9296
9044
|
}
|
|
@@ -9306,7 +9054,7 @@ var init_start = __esm({
|
|
|
9306
9054
|
});
|
|
9307
9055
|
|
|
9308
9056
|
// src/commands/status.ts
|
|
9309
|
-
import { defineCommand as
|
|
9057
|
+
import { defineCommand as defineCommand27 } from "citty";
|
|
9310
9058
|
var statusCommand;
|
|
9311
9059
|
var init_status = __esm({
|
|
9312
9060
|
"src/commands/status.ts"() {
|
|
@@ -9314,7 +9062,7 @@ var init_status = __esm({
|
|
|
9314
9062
|
init_paths();
|
|
9315
9063
|
init_compose();
|
|
9316
9064
|
init_dispatch();
|
|
9317
|
-
statusCommand =
|
|
9065
|
+
statusCommand = defineCommand27({
|
|
9318
9066
|
meta: {
|
|
9319
9067
|
name: "status",
|
|
9320
9068
|
group: "run",
|
|
@@ -9344,8 +9092,8 @@ var init_status = __esm({
|
|
|
9344
9092
|
});
|
|
9345
9093
|
|
|
9346
9094
|
// src/commands/stop.ts
|
|
9347
|
-
import { defineCommand as
|
|
9348
|
-
import { consola as
|
|
9095
|
+
import { defineCommand as defineCommand28 } from "citty";
|
|
9096
|
+
import { consola as consola31 } from "consola";
|
|
9349
9097
|
var stopCommand;
|
|
9350
9098
|
var init_stop = __esm({
|
|
9351
9099
|
"src/commands/stop.ts"() {
|
|
@@ -9354,7 +9102,7 @@ var init_stop = __esm({
|
|
|
9354
9102
|
init_compose();
|
|
9355
9103
|
init_proxy();
|
|
9356
9104
|
init_dispatch();
|
|
9357
|
-
stopCommand =
|
|
9105
|
+
stopCommand = defineCommand28({
|
|
9358
9106
|
meta: {
|
|
9359
9107
|
name: "stop",
|
|
9360
9108
|
group: "run",
|
|
@@ -9379,10 +9127,10 @@ var init_stop = __esm({
|
|
|
9379
9127
|
});
|
|
9380
9128
|
try {
|
|
9381
9129
|
await maybeStopProxy({
|
|
9382
|
-
logger: { info: (msg) =>
|
|
9130
|
+
logger: { info: (msg) => consola31.info(msg) }
|
|
9383
9131
|
});
|
|
9384
9132
|
} catch (err) {
|
|
9385
|
-
|
|
9133
|
+
consola31.warn(
|
|
9386
9134
|
`Could not tear down the Traefik proxy: ${err instanceof Error ? err.message : String(err)}. Ignored.`
|
|
9387
9135
|
);
|
|
9388
9136
|
}
|
|
@@ -9394,11 +9142,11 @@ var init_stop = __esm({
|
|
|
9394
9142
|
});
|
|
9395
9143
|
|
|
9396
9144
|
// src/tunnel/resolve.ts
|
|
9397
|
-
import { existsSync as
|
|
9398
|
-
import
|
|
9145
|
+
import { existsSync as existsSync15 } from "fs";
|
|
9146
|
+
import path23 from "path";
|
|
9399
9147
|
async function resolveTunnelTarget(opts) {
|
|
9400
9148
|
const ymlPath = containerConfigPath(opts.name, opts.monocerosHome);
|
|
9401
|
-
if (!
|
|
9149
|
+
if (!existsSync15(ymlPath)) {
|
|
9402
9150
|
throw new Error(
|
|
9403
9151
|
`No yml profile for '${opts.name}' at ${ymlPath}. Run \`monoceros init ${opts.name}\` first.`
|
|
9404
9152
|
);
|
|
@@ -9406,13 +9154,13 @@ async function resolveTunnelTarget(opts) {
|
|
|
9406
9154
|
const parsed = await readConfig(ymlPath);
|
|
9407
9155
|
const config = parsed.config;
|
|
9408
9156
|
const containerRoot = containerDir(opts.name, opts.monocerosHome);
|
|
9409
|
-
if (!
|
|
9157
|
+
if (!existsSync15(containerRoot)) {
|
|
9410
9158
|
throw new Error(
|
|
9411
9159
|
`Container '${opts.name}' is not materialised at ${containerRoot}. Run \`monoceros apply ${opts.name}\` first.`
|
|
9412
9160
|
);
|
|
9413
9161
|
}
|
|
9414
|
-
const composePath =
|
|
9415
|
-
const isCompose =
|
|
9162
|
+
const composePath = path23.join(containerRoot, ".devcontainer", "compose.yaml");
|
|
9163
|
+
const isCompose = existsSync15(composePath);
|
|
9416
9164
|
const parsedTarget = parseTargetArg(opts.target, config);
|
|
9417
9165
|
const docker = opts.docker ?? defaultDockerExec;
|
|
9418
9166
|
if (isCompose) {
|
|
@@ -9647,8 +9395,8 @@ var init_port_check2 = __esm({
|
|
|
9647
9395
|
});
|
|
9648
9396
|
|
|
9649
9397
|
// src/tunnel/run.ts
|
|
9650
|
-
import { spawn as
|
|
9651
|
-
import { consola as
|
|
9398
|
+
import { spawn as spawn10 } from "child_process";
|
|
9399
|
+
import { consola as consola32 } from "consola";
|
|
9652
9400
|
function signalNumber(signal) {
|
|
9653
9401
|
switch (signal) {
|
|
9654
9402
|
case "SIGINT":
|
|
@@ -9661,8 +9409,8 @@ function signalNumber(signal) {
|
|
|
9661
9409
|
}
|
|
9662
9410
|
async function runTunnel(opts) {
|
|
9663
9411
|
const log = opts.logger ?? {
|
|
9664
|
-
info: (m) =>
|
|
9665
|
-
warn: (m) =>
|
|
9412
|
+
info: (m) => consola32.info(m),
|
|
9413
|
+
warn: (m) => consola32.warn(m)
|
|
9666
9414
|
};
|
|
9667
9415
|
const resolve = opts.resolve ?? resolveTunnelTarget;
|
|
9668
9416
|
const resolveArgs3 = {
|
|
@@ -9737,7 +9485,7 @@ var init_run3 = __esm({
|
|
|
9737
9485
|
init_port_check2();
|
|
9738
9486
|
SOCAT_IMAGE = "alpine/socat:1.8.0.3";
|
|
9739
9487
|
defaultDockerSpawn = (args) => {
|
|
9740
|
-
const child =
|
|
9488
|
+
const child = spawn10("docker", args, {
|
|
9741
9489
|
stdio: "inherit"
|
|
9742
9490
|
});
|
|
9743
9491
|
const exited = new Promise((resolve, reject) => {
|
|
@@ -9768,8 +9516,8 @@ var init_run3 = __esm({
|
|
|
9768
9516
|
});
|
|
9769
9517
|
|
|
9770
9518
|
// src/commands/tunnel.ts
|
|
9771
|
-
import { defineCommand as
|
|
9772
|
-
import { consola as
|
|
9519
|
+
import { defineCommand as defineCommand29 } from "citty";
|
|
9520
|
+
import { consola as consola33 } from "consola";
|
|
9773
9521
|
function parseLocalPort(raw) {
|
|
9774
9522
|
if (raw === void 0) return void 0;
|
|
9775
9523
|
const n = Number(raw);
|
|
@@ -9785,7 +9533,7 @@ var init_tunnel = __esm({
|
|
|
9785
9533
|
"src/commands/tunnel.ts"() {
|
|
9786
9534
|
"use strict";
|
|
9787
9535
|
init_run3();
|
|
9788
|
-
tunnelCommand =
|
|
9536
|
+
tunnelCommand = defineCommand29({
|
|
9789
9537
|
meta: {
|
|
9790
9538
|
name: "tunnel",
|
|
9791
9539
|
group: "discovery",
|
|
@@ -9822,7 +9570,7 @@ var init_tunnel = __esm({
|
|
|
9822
9570
|
});
|
|
9823
9571
|
process.exit(exitCode);
|
|
9824
9572
|
} catch (err) {
|
|
9825
|
-
|
|
9573
|
+
consola33.error(err instanceof Error ? err.message : String(err));
|
|
9826
9574
|
process.exit(1);
|
|
9827
9575
|
}
|
|
9828
9576
|
}
|
|
@@ -9831,8 +9579,8 @@ var init_tunnel = __esm({
|
|
|
9831
9579
|
});
|
|
9832
9580
|
|
|
9833
9581
|
// src/upgrade/index.ts
|
|
9834
|
-
import { existsSync as
|
|
9835
|
-
import { consola as
|
|
9582
|
+
import { existsSync as existsSync16, promises as fs17 } from "fs";
|
|
9583
|
+
import { consola as consola34 } from "consola";
|
|
9836
9584
|
async function fetchRuntimeVersions() {
|
|
9837
9585
|
const tokenUrl = `https://ghcr.io/token?service=ghcr.io&scope=repository:${RUNTIME_REPO}:pull`;
|
|
9838
9586
|
const tokenRes = await fetch(tokenUrl);
|
|
@@ -9870,7 +9618,7 @@ ${yml}`;
|
|
|
9870
9618
|
}
|
|
9871
9619
|
async function runUpgrade(opts) {
|
|
9872
9620
|
const home = opts.monocerosHome ?? monocerosHome();
|
|
9873
|
-
const logger = opts.logger ??
|
|
9621
|
+
const logger = opts.logger ?? consola34;
|
|
9874
9622
|
const fetchVersions = opts.fetchVersions ?? fetchRuntimeVersions;
|
|
9875
9623
|
if (opts.list) {
|
|
9876
9624
|
const versions = await fetchVersions();
|
|
@@ -9890,7 +9638,7 @@ async function runUpgrade(opts) {
|
|
|
9890
9638
|
);
|
|
9891
9639
|
}
|
|
9892
9640
|
const ymlPath = containerConfigPath(opts.name, home);
|
|
9893
|
-
if (!
|
|
9641
|
+
if (!existsSync16(ymlPath)) {
|
|
9894
9642
|
throw new Error(
|
|
9895
9643
|
`No such config: ${ymlPath}. Run \`monoceros init <template> ${opts.name}\` first.`
|
|
9896
9644
|
);
|
|
@@ -9938,7 +9686,7 @@ var init_upgrade = __esm({
|
|
|
9938
9686
|
});
|
|
9939
9687
|
|
|
9940
9688
|
// src/commands/upgrade.ts
|
|
9941
|
-
import { defineCommand as
|
|
9689
|
+
import { defineCommand as defineCommand30 } from "citty";
|
|
9942
9690
|
var upgradeCommand;
|
|
9943
9691
|
var init_upgrade2 = __esm({
|
|
9944
9692
|
"src/commands/upgrade.ts"() {
|
|
@@ -9946,7 +9694,7 @@ var init_upgrade2 = __esm({
|
|
|
9946
9694
|
init_upgrade();
|
|
9947
9695
|
init_version();
|
|
9948
9696
|
init_dispatch();
|
|
9949
|
-
upgradeCommand =
|
|
9697
|
+
upgradeCommand = defineCommand30({
|
|
9950
9698
|
meta: {
|
|
9951
9699
|
name: "upgrade",
|
|
9952
9700
|
group: "lifecycle",
|
|
@@ -9988,7 +9736,7 @@ var main_exports = {};
|
|
|
9988
9736
|
__export(main_exports, {
|
|
9989
9737
|
main: () => main
|
|
9990
9738
|
});
|
|
9991
|
-
import { defineCommand as
|
|
9739
|
+
import { defineCommand as defineCommand31 } from "citty";
|
|
9992
9740
|
var main;
|
|
9993
9741
|
var init_main = __esm({
|
|
9994
9742
|
"src/main.ts"() {
|
|
@@ -10005,7 +9753,6 @@ var init_main = __esm({
|
|
|
10005
9753
|
init_complete();
|
|
10006
9754
|
init_init2();
|
|
10007
9755
|
init_list_components();
|
|
10008
|
-
init_login2();
|
|
10009
9756
|
init_logs();
|
|
10010
9757
|
init_port();
|
|
10011
9758
|
init_remove_apt_packages();
|
|
@@ -10025,7 +9772,7 @@ var init_main = __esm({
|
|
|
10025
9772
|
init_tunnel();
|
|
10026
9773
|
init_upgrade2();
|
|
10027
9774
|
init_version();
|
|
10028
|
-
main =
|
|
9775
|
+
main = defineCommand31({
|
|
10029
9776
|
meta: {
|
|
10030
9777
|
name: "monoceros",
|
|
10031
9778
|
version: CLI_VERSION,
|
|
@@ -10036,7 +9783,6 @@ var init_main = __esm({
|
|
|
10036
9783
|
"list-components": listComponentsCommand,
|
|
10037
9784
|
shell: shellCommand,
|
|
10038
9785
|
run: runCommand,
|
|
10039
|
-
login: loginCommand,
|
|
10040
9786
|
logs: logsCommand,
|
|
10041
9787
|
start: startCommand,
|
|
10042
9788
|
stop: stopCommand,
|
|
@@ -10322,25 +10068,25 @@ function detectHelpRequest(argv, main2) {
|
|
|
10322
10068
|
const separatorIdx = argv.indexOf("--");
|
|
10323
10069
|
if (helpIdx === -1) return null;
|
|
10324
10070
|
if (separatorIdx !== -1 && separatorIdx < helpIdx) return null;
|
|
10325
|
-
const
|
|
10071
|
+
const path24 = [];
|
|
10326
10072
|
const tokens = argv.slice(
|
|
10327
10073
|
0,
|
|
10328
10074
|
separatorIdx === -1 ? argv.length : separatorIdx
|
|
10329
10075
|
);
|
|
10330
10076
|
let cursor = main2;
|
|
10331
10077
|
const mainName = (main2.meta ?? {}).name ?? "monoceros";
|
|
10332
|
-
|
|
10078
|
+
path24.push(mainName);
|
|
10333
10079
|
for (const tok of tokens) {
|
|
10334
10080
|
if (tok.startsWith("-")) continue;
|
|
10335
10081
|
const subs = cursor.subCommands ?? {};
|
|
10336
10082
|
if (tok in subs) {
|
|
10337
10083
|
cursor = subs[tok];
|
|
10338
|
-
|
|
10084
|
+
path24.push(tok);
|
|
10339
10085
|
continue;
|
|
10340
10086
|
}
|
|
10341
10087
|
break;
|
|
10342
10088
|
}
|
|
10343
|
-
return { path:
|
|
10089
|
+
return { path: path24, cmd: cursor };
|
|
10344
10090
|
}
|
|
10345
10091
|
async function maybeRenderHelp(argv, main2) {
|
|
10346
10092
|
const hit = detectHelpRequest(argv, main2);
|