@getmonoceros/workbench 1.19.1 → 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 CHANGED
@@ -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.19.1" : "dev";
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/devcontainer/shell.ts
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 = spawn9(cmd, args, { stdio: "inherit" });
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 = defineCommand14({
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 = path20.join(containerLogsDir(args.name), `${service}.log`);
8228
- if (existsSync12(logFile)) {
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 defineCommand15 } from "citty";
8246
- import { consola as consola18 } from "consola";
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) => consola18.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 = defineCommand15({
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
- consola18.error(err instanceof Error ? err.message : String(err));
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 defineCommand16 } from "citty";
8335
- import { consola as consola19 } from "consola";
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 = defineCommand16({
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
- consola19.error(
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
- consola19.error(err instanceof Error ? err.message : String(err));
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 defineCommand17 } from "citty";
8387
- import { consola as consola20 } from "consola";
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 = defineCommand17({
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
- consola20.error(err instanceof Error ? err.message : String(err));
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 existsSync13, promises as fs15 } from "fs";
8436
- import path21 from "path";
8437
- import { consola as consola21 } from "consola";
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) => consola21.info(msg),
8442
- success: (msg) => consola21.success(msg),
8443
- warn: (msg) => consola21.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 = existsSync13(ymlPath);
8454
- const hasEnv = existsSync13(envPath);
8455
- const hasContainer = existsSync13(containerPath);
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 = path21.join(home, "container-backups", `${opts.name}-${ts}`);
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, path21.join(backupPath, `${opts.name}.yml`));
8174
+ await fs15.copyFile(ymlPath, path19.join(backupPath, `${opts.name}.yml`));
8485
8175
  }
8486
8176
  if (hasEnv) {
8487
- await fs15.copyFile(envPath, path21.join(backupPath, `${opts.name}.env`));
8177
+ await fs15.copyFile(envPath, path19.join(backupPath, `${opts.name}.env`));
8488
8178
  }
8489
8179
  if (hasContainer) {
8490
- await fs15.cp(containerPath, path21.join(backupPath, "container"), {
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 defineCommand18 } from "citty";
8580
- import { consola as consola22 } from "consola";
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 = defineCommand18({
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
- consola22.warn(warning);
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
- consola22.info("Aborted. Nothing changed.");
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
- consola22.error(err instanceof Error ? err.message : String(err));
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 existsSync14, promises as fs16 } from "fs";
8651
- import path22 from "path";
8652
- import { consola as consola23 } from "consola";
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) => consola23.info(msg),
8657
- success: (msg) => consola23.success(msg)
8346
+ info: (msg) => consola21.info(msg),
8347
+ success: (msg) => consola21.success(msg)
8658
8348
  };
8659
- const backup = path22.resolve(opts.backupPath);
8660
- if (!existsSync14(backup)) {
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 = path22.join(backup, "container");
8682
- const hasContainer = existsSync14(containerInBackup);
8683
- const envInBackup = path22.join(backup, `${name}.env`);
8684
- const hasEnv = existsSync14(envInBackup);
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 (existsSync14(destYml)) {
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 && existsSync14(destContainer)) {
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(path22.join(backup, ymlFile), destYml);
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 defineCommand19 } from "citty";
8724
- import { consola as consola24 } from "consola";
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 = defineCommand19({
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
- consola24.error(err instanceof Error ? err.message : String(err));
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 defineCommand20 } from "citty";
8757
- import { consola as consola25 } from "consola";
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 = defineCommand20({
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
- consola25.error(err instanceof Error ? err.message : String(err));
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 defineCommand21 } from "citty";
8806
- import { consola as consola26 } from "consola";
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 = defineCommand21({
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
- consola26.error(err instanceof Error ? err.message : String(err));
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 defineCommand22 } from "citty";
8855
- import { consola as consola27 } from "consola";
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 = defineCommand22({
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
- consola27.error(
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
- consola27.error(err instanceof Error ? err.message : String(err));
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 defineCommand23 } from "citty";
8911
- import { consola as consola28 } from "consola";
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 = defineCommand23({
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
- consola28.error(err instanceof Error ? err.message : String(err));
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 defineCommand24 } from "citty";
8960
- import { consola as consola29 } from "consola";
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 = defineCommand24({
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
- consola29.error(err instanceof Error ? err.message : String(err));
8689
+ consola27.error(err instanceof Error ? err.message : String(err));
9000
8690
  process.exit(1);
9001
8691
  }
9002
8692
  }
@@ -9004,13 +8694,118 @@ var init_remove_service = __esm({
9004
8694
  }
9005
8695
  });
9006
8696
 
9007
- // src/devcontainer/run.ts
9008
- async function runInContainer(opts) {
9009
- if (opts.command.length === 0) {
9010
- throw new Error(
9011
- "No command provided. Usage: `monoceros run <containername> -- <cmd> [args\u2026]`."
9012
- );
8697
+ // src/devcontainer/browser-bridge.ts
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) {
8717
+ const platform = process.platform;
8718
+ const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
8719
+ try {
8720
+ const child = spawn9(cmd, args, {
8721
+ stdio: "ignore",
8722
+ detached: true
8723
+ });
8724
+ child.on("error", () => {
8725
+ });
8726
+ child.unref();
8727
+ } catch {
8728
+ }
8729
+ }
8730
+ async function startBrowserBridge(opts) {
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(
8737
+ relayScript,
8738
+ `#!/bin/sh
8739
+ printf '%s\\n' "$1" > "$(dirname "$0")/url"
8740
+ exit 0
8741
+ `,
8742
+ { mode: 493 }
8743
+ );
8744
+ await fsp2.chmod(relayScript, 493);
8745
+ const servers = [];
8746
+ let handled = false;
8747
+ const onUrl = (url) => {
8748
+ openInBrowser(url);
8749
+ const target = parseCallbackTarget(url);
8750
+ if (!target) return;
8751
+ const server = http.createServer((req, res) => {
8752
+ const reqUrl = req.url ?? target.pathname;
8753
+ res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
8754
+ res.end(
8755
+ '<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>'
8756
+ );
8757
+ void opts.spawn(
8758
+ [
8759
+ "exec",
8760
+ "--workspace-folder",
8761
+ opts.root,
8762
+ "--mount-workspace-git-root=false",
8763
+ "curl",
8764
+ "-fsS",
8765
+ `http://localhost:${target.port}${reqUrl}`
8766
+ ],
8767
+ opts.root,
8768
+ { quiet: true }
8769
+ );
8770
+ });
8771
+ server.on("error", () => {
8772
+ });
8773
+ server.listen(target.port, "127.0.0.1");
8774
+ servers.push(server);
8775
+ };
8776
+ const poll = setInterval(() => {
8777
+ if (handled || !existsSync13(urlFile)) return;
8778
+ let content = "";
8779
+ try {
8780
+ content = readFileSync6(urlFile, "utf8");
8781
+ } catch {
8782
+ return;
8783
+ }
8784
+ if (!content.trim()) return;
8785
+ handled = true;
8786
+ onUrl(content.trim());
8787
+ }, 250);
8788
+ return {
8789
+ relayDirInContainer: `/workspaces/${opts.name}/${RELAY_DIRNAME}`,
8790
+ async dispose() {
8791
+ clearInterval(poll);
8792
+ for (const s of servers) s.close();
8793
+ await fsp2.rm(relayDir, { recursive: true, force: true });
8794
+ }
8795
+ };
8796
+ }
8797
+ var RELAY_DIRNAME;
8798
+ var init_browser_bridge = __esm({
8799
+ "src/devcontainer/browser-bridge.ts"() {
8800
+ "use strict";
8801
+ RELAY_DIRNAME = ".monoceros-bridge";
9013
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) {
9014
8809
  assertContainerExists(opts.root);
9015
8810
  const spawnFn = opts.spawn ?? spawnDevcontainer;
9016
8811
  const upCode = await spawnFn(
@@ -9019,37 +8814,102 @@ async function runInContainer(opts) {
9019
8814
  { quiet: true }
9020
8815
  );
9021
8816
  if (upCode !== 0) return upCode;
9022
- const innerExec = opts.cwd ? [
9023
- "bash",
9024
- "-lc",
9025
- 'cd -- "$1" && shift && exec "$@"',
9026
- "bash",
9027
- opts.cwd,
9028
- ...opts.command
9029
- ] : opts.command;
9030
8817
  return spawnFn(
9031
8818
  [
9032
8819
  "exec",
9033
8820
  "--workspace-folder",
9034
8821
  opts.root,
9035
8822
  "--mount-workspace-git-root=false",
9036
- ...innerExec
8823
+ "bash"
9037
8824
  ],
9038
8825
  opts.root,
9039
8826
  { interactive: true }
9040
8827
  );
9041
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();
8840
+ }
8841
+ });
8842
+
8843
+ // src/devcontainer/run.ts
8844
+ function wrapExec(command, opts) {
8845
+ const leading = [];
8846
+ const stmts = [];
8847
+ if (opts.pathPrepend) {
8848
+ leading.push(opts.pathPrepend);
8849
+ const i = leading.length;
8850
+ stmts.push(`export PATH="$${i}:$PATH"`);
8851
+ stmts.push(`export BROWSER="$${i}/xdg-open"`);
8852
+ }
8853
+ if (opts.cwd) {
8854
+ leading.push(opts.cwd);
8855
+ stmts.push(`cd -- "$${leading.length}"`);
8856
+ }
8857
+ if (leading.length === 0) return command;
8858
+ const shift = leading.length === 1 ? "shift" : `shift ${leading.length}`;
8859
+ const script = `${stmts.join(" && ")} && ${shift} && exec "$@"`;
8860
+ return ["bash", "-lc", script, "bash", ...leading, ...command];
8861
+ }
8862
+ async function runInContainer(opts) {
8863
+ if (opts.command.length === 0) {
8864
+ throw new Error(
8865
+ "No command provided. Usage: `monoceros run <containername> -- <cmd> [args\u2026]`."
8866
+ );
8867
+ }
8868
+ assertContainerExists(opts.root);
8869
+ const spawnFn = opts.spawn ?? spawnDevcontainer;
8870
+ const upCode = await spawnFn(
8871
+ ["up", "--workspace-folder", opts.root, "--mount-workspace-git-root=false"],
8872
+ opts.root,
8873
+ { quiet: true }
8874
+ );
8875
+ if (upCode !== 0) return upCode;
8876
+ const bridge = opts.name && process.stdout.isTTY ? await startBrowserBridge({
8877
+ name: opts.name,
8878
+ root: opts.root,
8879
+ spawn: spawnFn
8880
+ }) : null;
8881
+ try {
8882
+ const innerExec = wrapExec(opts.command, {
8883
+ ...bridge ? { pathPrepend: bridge.relayDirInContainer } : {},
8884
+ ...opts.cwd ? { cwd: opts.cwd } : {}
8885
+ });
8886
+ return await spawnFn(
8887
+ [
8888
+ "exec",
8889
+ "--workspace-folder",
8890
+ opts.root,
8891
+ "--mount-workspace-git-root=false",
8892
+ ...innerExec
8893
+ ],
8894
+ opts.root,
8895
+ { interactive: true }
8896
+ );
8897
+ } finally {
8898
+ if (bridge) await bridge.dispose();
8899
+ }
8900
+ }
9042
8901
  var init_run = __esm({
9043
8902
  "src/devcontainer/run.ts"() {
9044
8903
  "use strict";
8904
+ init_browser_bridge();
9045
8905
  init_cli();
9046
8906
  init_shell();
9047
8907
  }
9048
8908
  });
9049
8909
 
9050
8910
  // src/commands/run.ts
9051
- import { defineCommand as defineCommand25 } from "citty";
9052
- import { consola as consola30 } from "consola";
8911
+ import { defineCommand as defineCommand24 } from "citty";
8912
+ import { consola as consola28 } from "consola";
9053
8913
  var runCommand;
9054
8914
  var init_run2 = __esm({
9055
8915
  "src/commands/run.ts"() {
@@ -9057,7 +8917,7 @@ var init_run2 = __esm({
9057
8917
  init_paths();
9058
8918
  init_run();
9059
8919
  init_inner_args();
9060
- runCommand = defineCommand25({
8920
+ runCommand = defineCommand24({
9061
8921
  meta: {
9062
8922
  name: "run",
9063
8923
  group: "run",
@@ -9077,7 +8937,7 @@ var init_run2 = __esm({
9077
8937
  async run({ args }) {
9078
8938
  const command = [...getInnerArgs()];
9079
8939
  if (command.length === 0) {
9080
- consola30.error(
8940
+ consola28.error(
9081
8941
  "No command provided. Usage: `monoceros run <containername> -- <cmd> [args\u2026]`."
9082
8942
  );
9083
8943
  process.exit(1);
@@ -9085,12 +8945,13 @@ var init_run2 = __esm({
9085
8945
  try {
9086
8946
  const exitCode = await runInContainer({
9087
8947
  root: containerDir(args.name),
8948
+ name: args.name,
9088
8949
  command,
9089
8950
  ...args.in ? { cwd: args.in } : {}
9090
8951
  });
9091
8952
  process.exit(exitCode);
9092
8953
  } catch (err) {
9093
- consola30.error(err instanceof Error ? err.message : String(err));
8954
+ consola28.error(err instanceof Error ? err.message : String(err));
9094
8955
  process.exit(1);
9095
8956
  }
9096
8957
  }
@@ -9099,15 +8960,15 @@ var init_run2 = __esm({
9099
8960
  });
9100
8961
 
9101
8962
  // src/commands/shell.ts
9102
- import { defineCommand as defineCommand26 } from "citty";
9103
- import { consola as consola31 } from "consola";
8963
+ import { defineCommand as defineCommand25 } from "citty";
8964
+ import { consola as consola29 } from "consola";
9104
8965
  var shellCommand;
9105
8966
  var init_shell2 = __esm({
9106
8967
  "src/commands/shell.ts"() {
9107
8968
  "use strict";
9108
8969
  init_paths();
9109
8970
  init_shell();
9110
- shellCommand = defineCommand26({
8971
+ shellCommand = defineCommand25({
9111
8972
  meta: {
9112
8973
  name: "shell",
9113
8974
  group: "run",
@@ -9125,7 +8986,7 @@ var init_shell2 = __esm({
9125
8986
  const exitCode = await runShell({ root: containerDir(args.name) });
9126
8987
  process.exit(exitCode);
9127
8988
  } catch (err) {
9128
- consola31.error(err instanceof Error ? err.message : String(err));
8989
+ consola29.error(err instanceof Error ? err.message : String(err));
9129
8990
  process.exit(1);
9130
8991
  }
9131
8992
  }
@@ -9134,8 +8995,8 @@ var init_shell2 = __esm({
9134
8995
  });
9135
8996
 
9136
8997
  // src/commands/start.ts
9137
- import { defineCommand as defineCommand27 } from "citty";
9138
- import { consola as consola32 } from "consola";
8998
+ import { defineCommand as defineCommand26 } from "citty";
8999
+ import { consola as consola30 } from "consola";
9139
9000
  var startCommand;
9140
9001
  var init_start = __esm({
9141
9002
  "src/commands/start.ts"() {
@@ -9147,7 +9008,7 @@ var init_start = __esm({
9147
9008
  init_proxy();
9148
9009
  init_port_check();
9149
9010
  init_dispatch();
9150
- startCommand = defineCommand27({
9011
+ startCommand = defineCommand26({
9151
9012
  meta: {
9152
9013
  name: "start",
9153
9014
  group: "run",
@@ -9172,7 +9033,7 @@ var init_start = __esm({
9172
9033
  hostPort = proxyHostPort(global);
9173
9034
  }
9174
9035
  } catch (err) {
9175
- consola32.warn(
9036
+ consola30.warn(
9176
9037
  `Could not read container yml ahead of start: ${err instanceof Error ? err.message : String(err)}. Skipping Traefik pre-flight.`
9177
9038
  );
9178
9039
  }
@@ -9188,7 +9049,7 @@ var init_start = __esm({
9188
9049
  });
9189
9050
 
9190
9051
  // src/commands/status.ts
9191
- import { defineCommand as defineCommand28 } from "citty";
9052
+ import { defineCommand as defineCommand27 } from "citty";
9192
9053
  var statusCommand;
9193
9054
  var init_status = __esm({
9194
9055
  "src/commands/status.ts"() {
@@ -9196,7 +9057,7 @@ var init_status = __esm({
9196
9057
  init_paths();
9197
9058
  init_compose();
9198
9059
  init_dispatch();
9199
- statusCommand = defineCommand28({
9060
+ statusCommand = defineCommand27({
9200
9061
  meta: {
9201
9062
  name: "status",
9202
9063
  group: "run",
@@ -9226,8 +9087,8 @@ var init_status = __esm({
9226
9087
  });
9227
9088
 
9228
9089
  // src/commands/stop.ts
9229
- import { defineCommand as defineCommand29 } from "citty";
9230
- import { consola as consola33 } from "consola";
9090
+ import { defineCommand as defineCommand28 } from "citty";
9091
+ import { consola as consola31 } from "consola";
9231
9092
  var stopCommand;
9232
9093
  var init_stop = __esm({
9233
9094
  "src/commands/stop.ts"() {
@@ -9236,7 +9097,7 @@ var init_stop = __esm({
9236
9097
  init_compose();
9237
9098
  init_proxy();
9238
9099
  init_dispatch();
9239
- stopCommand = defineCommand29({
9100
+ stopCommand = defineCommand28({
9240
9101
  meta: {
9241
9102
  name: "stop",
9242
9103
  group: "run",
@@ -9261,10 +9122,10 @@ var init_stop = __esm({
9261
9122
  });
9262
9123
  try {
9263
9124
  await maybeStopProxy({
9264
- logger: { info: (msg) => consola33.info(msg) }
9125
+ logger: { info: (msg) => consola31.info(msg) }
9265
9126
  });
9266
9127
  } catch (err) {
9267
- consola33.warn(
9128
+ consola31.warn(
9268
9129
  `Could not tear down the Traefik proxy: ${err instanceof Error ? err.message : String(err)}. Ignored.`
9269
9130
  );
9270
9131
  }
@@ -9530,7 +9391,7 @@ var init_port_check2 = __esm({
9530
9391
 
9531
9392
  // src/tunnel/run.ts
9532
9393
  import { spawn as spawn10 } from "child_process";
9533
- import { consola as consola34 } from "consola";
9394
+ import { consola as consola32 } from "consola";
9534
9395
  function signalNumber(signal) {
9535
9396
  switch (signal) {
9536
9397
  case "SIGINT":
@@ -9543,8 +9404,8 @@ function signalNumber(signal) {
9543
9404
  }
9544
9405
  async function runTunnel(opts) {
9545
9406
  const log = opts.logger ?? {
9546
- info: (m) => consola34.info(m),
9547
- warn: (m) => consola34.warn(m)
9407
+ info: (m) => consola32.info(m),
9408
+ warn: (m) => consola32.warn(m)
9548
9409
  };
9549
9410
  const resolve = opts.resolve ?? resolveTunnelTarget;
9550
9411
  const resolveArgs3 = {
@@ -9650,8 +9511,8 @@ var init_run3 = __esm({
9650
9511
  });
9651
9512
 
9652
9513
  // src/commands/tunnel.ts
9653
- import { defineCommand as defineCommand30 } from "citty";
9654
- import { consola as consola35 } from "consola";
9514
+ import { defineCommand as defineCommand29 } from "citty";
9515
+ import { consola as consola33 } from "consola";
9655
9516
  function parseLocalPort(raw) {
9656
9517
  if (raw === void 0) return void 0;
9657
9518
  const n = Number(raw);
@@ -9667,7 +9528,7 @@ var init_tunnel = __esm({
9667
9528
  "src/commands/tunnel.ts"() {
9668
9529
  "use strict";
9669
9530
  init_run3();
9670
- tunnelCommand = defineCommand30({
9531
+ tunnelCommand = defineCommand29({
9671
9532
  meta: {
9672
9533
  name: "tunnel",
9673
9534
  group: "discovery",
@@ -9704,7 +9565,7 @@ var init_tunnel = __esm({
9704
9565
  });
9705
9566
  process.exit(exitCode);
9706
9567
  } catch (err) {
9707
- consola35.error(err instanceof Error ? err.message : String(err));
9568
+ consola33.error(err instanceof Error ? err.message : String(err));
9708
9569
  process.exit(1);
9709
9570
  }
9710
9571
  }
@@ -9714,7 +9575,7 @@ var init_tunnel = __esm({
9714
9575
 
9715
9576
  // src/upgrade/index.ts
9716
9577
  import { existsSync as existsSync16, promises as fs17 } from "fs";
9717
- import { consola as consola36 } from "consola";
9578
+ import { consola as consola34 } from "consola";
9718
9579
  async function fetchRuntimeVersions() {
9719
9580
  const tokenUrl = `https://ghcr.io/token?service=ghcr.io&scope=repository:${RUNTIME_REPO}:pull`;
9720
9581
  const tokenRes = await fetch(tokenUrl);
@@ -9752,7 +9613,7 @@ ${yml}`;
9752
9613
  }
9753
9614
  async function runUpgrade(opts) {
9754
9615
  const home = opts.monocerosHome ?? monocerosHome();
9755
- const logger = opts.logger ?? consola36;
9616
+ const logger = opts.logger ?? consola34;
9756
9617
  const fetchVersions = opts.fetchVersions ?? fetchRuntimeVersions;
9757
9618
  if (opts.list) {
9758
9619
  const versions = await fetchVersions();
@@ -9820,7 +9681,7 @@ var init_upgrade = __esm({
9820
9681
  });
9821
9682
 
9822
9683
  // src/commands/upgrade.ts
9823
- import { defineCommand as defineCommand31 } from "citty";
9684
+ import { defineCommand as defineCommand30 } from "citty";
9824
9685
  var upgradeCommand;
9825
9686
  var init_upgrade2 = __esm({
9826
9687
  "src/commands/upgrade.ts"() {
@@ -9828,7 +9689,7 @@ var init_upgrade2 = __esm({
9828
9689
  init_upgrade();
9829
9690
  init_version();
9830
9691
  init_dispatch();
9831
- upgradeCommand = defineCommand31({
9692
+ upgradeCommand = defineCommand30({
9832
9693
  meta: {
9833
9694
  name: "upgrade",
9834
9695
  group: "lifecycle",
@@ -9870,7 +9731,7 @@ var main_exports = {};
9870
9731
  __export(main_exports, {
9871
9732
  main: () => main
9872
9733
  });
9873
- import { defineCommand as defineCommand32 } from "citty";
9734
+ import { defineCommand as defineCommand31 } from "citty";
9874
9735
  var main;
9875
9736
  var init_main = __esm({
9876
9737
  "src/main.ts"() {
@@ -9887,7 +9748,6 @@ var init_main = __esm({
9887
9748
  init_complete();
9888
9749
  init_init2();
9889
9750
  init_list_components();
9890
- init_login2();
9891
9751
  init_logs();
9892
9752
  init_port();
9893
9753
  init_remove_apt_packages();
@@ -9907,7 +9767,7 @@ var init_main = __esm({
9907
9767
  init_tunnel();
9908
9768
  init_upgrade2();
9909
9769
  init_version();
9910
- main = defineCommand32({
9770
+ main = defineCommand31({
9911
9771
  meta: {
9912
9772
  name: "monoceros",
9913
9773
  version: CLI_VERSION,
@@ -9918,7 +9778,6 @@ var init_main = __esm({
9918
9778
  "list-components": listComponentsCommand,
9919
9779
  shell: shellCommand,
9920
9780
  run: runCommand,
9921
- login: loginCommand,
9922
9781
  logs: logsCommand,
9923
9782
  start: startCommand,
9924
9783
  stop: stopCommand,