@getmonoceros/workbench 1.21.1 → 1.21.3
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 +50 -11
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -4967,6 +4967,13 @@ function generateAgentsMd(input) {
|
|
|
4967
4967
|
}
|
|
4968
4968
|
}
|
|
4969
4969
|
lines.push("");
|
|
4970
|
+
lines.push(
|
|
4971
|
+
"To show the user a running app, open it in their host browser with",
|
|
4972
|
+
`\`xdg-open http://${input.containerName}.localhost\` \u2014 Monoceros relays`,
|
|
4973
|
+
"browser-opens from the container to the host machine. Also tell the user",
|
|
4974
|
+
"the URL, so they can open it themselves if no bridge is active."
|
|
4975
|
+
);
|
|
4976
|
+
lines.push("");
|
|
4970
4977
|
}
|
|
4971
4978
|
lines.push("## How to extend this container");
|
|
4972
4979
|
lines.push("");
|
|
@@ -5649,6 +5656,15 @@ async function findContainerIds(filters, exec = spawnDocker) {
|
|
|
5649
5656
|
}
|
|
5650
5657
|
return [...ids];
|
|
5651
5658
|
}
|
|
5659
|
+
async function isWorkspaceRunning(root, exec = spawnDocker) {
|
|
5660
|
+
const result = await exec([
|
|
5661
|
+
"ps",
|
|
5662
|
+
"-q",
|
|
5663
|
+
"--filter",
|
|
5664
|
+
`label=devcontainer.local_folder=${root}`
|
|
5665
|
+
]);
|
|
5666
|
+
return result.exitCode === 0 && result.stdout.trim().length > 0;
|
|
5667
|
+
}
|
|
5652
5668
|
async function cleanupDockerObjects(opts) {
|
|
5653
5669
|
const exec = opts.exec ?? spawnDocker;
|
|
5654
5670
|
const tag = opts.logTag ?? "cleanup";
|
|
@@ -6690,7 +6706,7 @@ var CLI_VERSION;
|
|
|
6690
6706
|
var init_version = __esm({
|
|
6691
6707
|
"src/version.ts"() {
|
|
6692
6708
|
"use strict";
|
|
6693
|
-
CLI_VERSION = true ? "1.21.
|
|
6709
|
+
CLI_VERSION = true ? "1.21.3" : "dev";
|
|
6694
6710
|
}
|
|
6695
6711
|
});
|
|
6696
6712
|
|
|
@@ -9002,6 +9018,10 @@ function parseCallbackTarget(authUrl) {
|
|
|
9002
9018
|
return null;
|
|
9003
9019
|
}
|
|
9004
9020
|
}
|
|
9021
|
+
function nextRelayUrl(content, lastOpened) {
|
|
9022
|
+
const url = content.trim();
|
|
9023
|
+
return url && url !== lastOpened ? url : null;
|
|
9024
|
+
}
|
|
9005
9025
|
function openInBrowser(url) {
|
|
9006
9026
|
const platform = process.platform;
|
|
9007
9027
|
const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
@@ -9032,7 +9052,7 @@ exit 0
|
|
|
9032
9052
|
);
|
|
9033
9053
|
await fsp4.chmod(relayScript, 493);
|
|
9034
9054
|
const servers = [];
|
|
9035
|
-
let
|
|
9055
|
+
let lastOpened = null;
|
|
9036
9056
|
const onUrl = (url) => {
|
|
9037
9057
|
openInBrowser(url);
|
|
9038
9058
|
const target = parseCallbackTarget(url);
|
|
@@ -9063,16 +9083,17 @@ exit 0
|
|
|
9063
9083
|
servers.push(server);
|
|
9064
9084
|
};
|
|
9065
9085
|
const poll = setInterval(() => {
|
|
9066
|
-
if (
|
|
9086
|
+
if (!existsSync14(urlFile)) return;
|
|
9067
9087
|
let content = "";
|
|
9068
9088
|
try {
|
|
9069
9089
|
content = readFileSync6(urlFile, "utf8");
|
|
9070
9090
|
} catch {
|
|
9071
9091
|
return;
|
|
9072
9092
|
}
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9093
|
+
const url = nextRelayUrl(content, lastOpened);
|
|
9094
|
+
if (!url) return;
|
|
9095
|
+
lastOpened = url;
|
|
9096
|
+
onUrl(url);
|
|
9076
9097
|
}, 250);
|
|
9077
9098
|
return {
|
|
9078
9099
|
relayDirInContainer: `/workspaces/${opts.name}/${RELAY_DIRNAME}`,
|
|
@@ -10045,20 +10066,36 @@ async function runUpgrade(opts) {
|
|
|
10045
10066
|
`No such config: ${containerConfigPath(opts.name, home)}. Run \`monoceros init <template> ${opts.name}\` first.`
|
|
10046
10067
|
);
|
|
10047
10068
|
}
|
|
10048
|
-
const targets = opts.name ? [opts.name] : await listContainerNames2(home);
|
|
10049
10069
|
const apply = opts.applyRunner ?? runApply;
|
|
10070
|
+
const exec = opts.dockerExec ?? spawnDocker;
|
|
10050
10071
|
const now = opts.now ?? /* @__PURE__ */ new Date();
|
|
10072
|
+
let targets;
|
|
10073
|
+
const skipped = [];
|
|
10074
|
+
if (opts.name) {
|
|
10075
|
+
targets = [opts.name];
|
|
10076
|
+
} else {
|
|
10077
|
+
targets = [];
|
|
10078
|
+
for (const name of await listContainerNames2(home)) {
|
|
10079
|
+
if (await isWorkspaceRunning(containerDir(name, home), exec)) {
|
|
10080
|
+
targets.push(name);
|
|
10081
|
+
} else {
|
|
10082
|
+
skipped.push(name);
|
|
10083
|
+
}
|
|
10084
|
+
}
|
|
10085
|
+
}
|
|
10051
10086
|
const pruneAndStamp = async () => {
|
|
10052
10087
|
const result = await pruneStaleImages({
|
|
10053
10088
|
home,
|
|
10054
10089
|
currentContainerNames: new Set(await listContainerNames2(home)),
|
|
10055
|
-
|
|
10090
|
+
exec
|
|
10056
10091
|
});
|
|
10057
10092
|
await markUpgraded(now.toISOString(), home);
|
|
10058
10093
|
return result;
|
|
10059
10094
|
};
|
|
10060
10095
|
if (targets.length === 0) {
|
|
10061
|
-
logger.info(
|
|
10096
|
+
logger.info(
|
|
10097
|
+
opts.name ? "Nothing to upgrade." : skipped.length > 0 ? `No running containers to refresh (${skipped.length} not running: ${skipped.join(", ")}). Start one, or refresh it with \`monoceros upgrade <name>\`.` : "No running containers to refresh."
|
|
10098
|
+
);
|
|
10062
10099
|
await pruneAndStamp();
|
|
10063
10100
|
return 0;
|
|
10064
10101
|
}
|
|
@@ -10100,11 +10137,12 @@ async function runUpgrade(opts) {
|
|
|
10100
10137
|
if (worstExit === 0) {
|
|
10101
10138
|
const prune = await pruneAndStamp();
|
|
10102
10139
|
logger.success(
|
|
10103
|
-
`Upgraded ${opts.name ? `'${opts.name}'` : `${targets.length} container${targets.length === 1 ? "" : "s"}`}
|
|
10140
|
+
`Upgraded ${opts.name ? `'${opts.name}'` : `${targets.length} running container${targets.length === 1 ? "" : "s"}`}
|
|
10104
10141
|
tools rebuilt \u2014 latest pulled
|
|
10105
10142
|
base ${pinVersion} ${bumped > 0 ? `(${bumped} bumped)` : "(already latest)"}
|
|
10106
10143
|
pruned ${formatPruneLine(prune)}
|
|
10107
|
-
|
|
10144
|
+
` + (skipped.length > 0 ? ` skipped ${skipped.length} not running (${skipped.join(", ")})
|
|
10145
|
+
` : "") + ` recorded ${now.toISOString().slice(0, 16).replace("T", " ")} UTC`
|
|
10108
10146
|
);
|
|
10109
10147
|
}
|
|
10110
10148
|
return worstExit;
|
|
@@ -10133,6 +10171,7 @@ var init_upgrade = __esm({
|
|
|
10133
10171
|
init_paths();
|
|
10134
10172
|
init_machine_state();
|
|
10135
10173
|
init_catalog();
|
|
10174
|
+
init_compose();
|
|
10136
10175
|
init_proxy();
|
|
10137
10176
|
init_prune();
|
|
10138
10177
|
init_apply();
|