mercury-agent 0.4.19 → 0.4.21
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/package.json +1 -1
- package/src/agent/container-runner.ts +28 -2
- package/src/cli/mercury.ts +2 -0
package/package.json
CHANGED
|
@@ -394,8 +394,34 @@ function isDockerDesktop(): boolean {
|
|
|
394
394
|
timeout: 10_000,
|
|
395
395
|
stdio: ["pipe", "pipe", "pipe"],
|
|
396
396
|
});
|
|
397
|
-
const
|
|
398
|
-
|
|
397
|
+
const name = (result.stdout ?? "").trim();
|
|
398
|
+
const stderr = (result.stderr ?? "").trim();
|
|
399
|
+
if (name === "docker-desktop") {
|
|
400
|
+
_isDockerDesktop = true;
|
|
401
|
+
} else {
|
|
402
|
+
// Fallback: check Docker context or server OS for Docker Desktop indicators
|
|
403
|
+
const ctxResult = spawnSync(
|
|
404
|
+
"docker",
|
|
405
|
+
["info", "--format", "{{.OperatingSystem}}"],
|
|
406
|
+
{ encoding: "utf8", timeout: 10_000, stdio: ["pipe", "pipe", "pipe"] },
|
|
407
|
+
);
|
|
408
|
+
const os = (ctxResult.stdout ?? "").trim();
|
|
409
|
+
_isDockerDesktop =
|
|
410
|
+
os.includes("Docker Desktop") || os.includes("Docker for Windows");
|
|
411
|
+
if (_isDockerDesktop) {
|
|
412
|
+
logger.info("Docker Desktop detected via OperatingSystem field", {
|
|
413
|
+
name,
|
|
414
|
+
os,
|
|
415
|
+
});
|
|
416
|
+
} else {
|
|
417
|
+
logger.debug("Docker Desktop not detected", {
|
|
418
|
+
name,
|
|
419
|
+
os,
|
|
420
|
+
exitCode: result.status,
|
|
421
|
+
stderr: stderr.slice(0, 200),
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
399
425
|
} catch {
|
|
400
426
|
_isDockerDesktop = false;
|
|
401
427
|
}
|
package/src/cli/mercury.ts
CHANGED
|
@@ -40,6 +40,7 @@ const VALID_EXT_NAME_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
|
40
40
|
function copyDirRecursive(src: string, dest: string): void {
|
|
41
41
|
mkdirSync(dest, { recursive: true });
|
|
42
42
|
for (const entry of readdirSync(src)) {
|
|
43
|
+
if (entry === "node_modules") continue;
|
|
43
44
|
const srcPath = join(src, entry);
|
|
44
45
|
const destPath = join(dest, entry);
|
|
45
46
|
if (statSync(srcPath).isDirectory()) {
|
|
@@ -233,6 +234,7 @@ async function runAction(): Promise<void> {
|
|
|
233
234
|
function buildAction(): void {
|
|
234
235
|
// Build from package sources using a temp context — no files needed in user project
|
|
235
236
|
const tmpDir = join(CWD, ".mercury", ".build-context");
|
|
237
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
236
238
|
mkdirSync(tmpDir, { recursive: true });
|
|
237
239
|
|
|
238
240
|
try {
|