run-spaceapp 0.1.22 → 0.1.24

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.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/package.json +3 -3
  3. package/src/cli.mjs +41 -8
package/README.md CHANGED
@@ -35,7 +35,10 @@ open. SpaceApp waits for up to ten minutes and continues automatically when
35
35
  Docker is ready. If WSL2 requires one restart, SpaceApp registers a one-time
36
36
  resume and asks before scheduling it. Sign back in after Windows restarts; the
37
37
  same install continues automatically in Command Prompt without entering a
38
- second command.
38
+ second command. Headless Windows sessions (SSH, CI services, session 0) also
39
+ work: during image pulls the launcher switches Docker to a temporary
40
+ credential-free config so Docker Desktop's graphical credential helper is never
41
+ invoked outside an interactive logon.
39
42
 
40
43
  The launcher defaults to the `light` profile on every system. Run
41
44
  `npx --yes run-spaceapp@latest install --profile standard` explicitly when
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "run-spaceapp",
3
- "version": "0.1.22",
4
- "spaceappRuntimeVersion": "0.1.22",
3
+ "version": "0.1.24",
4
+ "spaceappRuntimeVersion": "0.1.24",
5
5
  "spaceappHostRootRuntimeCompatible": true,
6
6
  "description": "Cross-platform Docker launcher for the SpaceApp self-hosted agent workspace",
7
7
  "license": "Apache-2.0",
@@ -52,5 +52,5 @@
52
52
  "access": "public",
53
53
  "provenance": true
54
54
  },
55
- "gitHead": "d8e038d53859c257f6b82cafaca2e8802b79883e"
55
+ "gitHead": "1d6601cc265e2ab16c4e029d898eb7736998f81e"
56
56
  }
package/src/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { randomBytes } from "node:crypto";
3
- import { mkdtemp, readFile, rm } from "node:fs/promises";
3
+ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import process from "node:process";
@@ -68,6 +68,26 @@ const trustedEnvironmentNames = new Set([
68
68
  "SPACEAPP_RESUME_SCRIPT_PATH"
69
69
  ]);
70
70
 
71
+ export async function withHeadlessDockerConfig(platform, spec, run) {
72
+ if (platform !== "win32") {
73
+ return run(spec);
74
+ }
75
+ const configDir = await mkdtemp(join(tmpdir(), "spaceapp-docker-config-"));
76
+ await writeFile(
77
+ join(configDir, "config.json"),
78
+ JSON.stringify({ auths: {} }),
79
+ { mode: 0o600 }
80
+ );
81
+ try {
82
+ return await run({
83
+ ...spec,
84
+ args: ["--config", configDir, ...spec.args]
85
+ });
86
+ } finally {
87
+ await rm(configDir, { recursive: true, force: true });
88
+ }
89
+ }
90
+
71
91
  export async function run(argv, {
72
92
  env = process.env,
73
93
  platform = process.platform,
@@ -180,6 +200,7 @@ export async function run(argv, {
180
200
  root,
181
201
  config,
182
202
  version: runtimeVersion,
203
+ platform,
183
204
  stdin,
184
205
  stdout,
185
206
  stderr,
@@ -197,7 +218,11 @@ export async function run(argv, {
197
218
  previousVersion: config.version
198
219
  };
199
220
  await writeRuntimeFiles(root, rollback);
200
- const pullCode = await runtimeExecute(composeCommand("pull", root, { profile: rollback.profile, companionsEnabled: rollback.companionsEnabled }), { stdin, stdout, stderr });
221
+ const pullCode = await withHeadlessDockerConfig(
222
+ platform,
223
+ composeCommand("pull", root, { profile: rollback.profile, companionsEnabled: rollback.companionsEnabled }),
224
+ (pullSpec) => runtimeExecute(pullSpec, { stdin, stdout, stderr })
225
+ );
201
226
  if (pullCode !== 0) {
202
227
  await writeRuntimeFiles(root, config);
203
228
  return pullCode;
@@ -442,11 +467,15 @@ async function installCommand(args, {
442
467
  companionsEnabled,
443
468
  ...options
444
469
  });
445
- const pullCode = await executeWithDockerDiagnostics(
446
- execute,
470
+ const pullCode = await withHeadlessDockerConfig(
471
+ platform,
447
472
  stagedComposeCommand("pull"),
448
- { stdin, stdout, stderr },
449
- { platform, stderr }
473
+ (pullSpec) => executeWithDockerDiagnostics(
474
+ execute,
475
+ pullSpec,
476
+ { stdin, stdout, stderr },
477
+ { platform, stderr }
478
+ )
450
479
  );
451
480
  if (pullCode !== 0) return pullCode;
452
481
  runtimeMutationAttempted = true;
@@ -905,7 +934,7 @@ async function ownerCommand(args, { root, config, stdin, stdout, stderr, execute
905
934
  });
906
935
  }
907
936
 
908
- async function updateCommand(args, { root, config, version, stdin, stdout, stderr, execute }) {
937
+ async function updateCommand(args, { root, config, version, platform, stdin, stdout, stderr, execute }) {
909
938
  if (args.length > 1) {
910
939
  throw new Error(`Usage: ${UNIVERSAL_COMMAND} update [version]`);
911
940
  }
@@ -918,7 +947,11 @@ async function updateCommand(args, { root, config, version, stdin, stdout, stder
918
947
  previousVersion: config.version
919
948
  };
920
949
  await writeRuntimeFiles(root, updated);
921
- const pullCode = await execute(composeCommand("pull", root, { profile: updated.profile, companionsEnabled: updated.companionsEnabled }), { stdin, stdout, stderr });
950
+ const pullCode = await withHeadlessDockerConfig(
951
+ platform,
952
+ composeCommand("pull", root, { profile: updated.profile, companionsEnabled: updated.companionsEnabled }),
953
+ (pullSpec) => execute(pullSpec, { stdin, stdout, stderr })
954
+ );
922
955
  if (pullCode !== 0) {
923
956
  await writeRuntimeFiles(root, config);
924
957
  return pullCode;