secureagentbase 1.4.8 → 1.4.9

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 (2) hide show
  1. package/dist/lib/auth.js +18 -4
  2. package/package.json +1 -1
package/dist/lib/auth.js CHANGED
@@ -205,10 +205,15 @@ export async function ensureAdc(options = {}) {
205
205
  throw new MissingAdcError(`${before.detail} Login was skipped.`);
206
206
  }
207
207
  // `gcloud auth application-default login` is interactive (browser flow), so
208
- // hand it the real stdio and let the user complete it.
209
- const result = spawnSync(gcloud, ['auth', 'application-default', 'login'], { stdio: 'inherit' });
208
+ // hand it the real stdio and let the user complete it. `shell` must match
209
+ // what findGcloud probed with, or Windows resolves gcloud in one call and not
210
+ // the other (the probe passes, the login then dies with ENOENT).
211
+ const result = spawnSync(gcloud, ['auth', 'application-default', 'login'], {
212
+ stdio: 'inherit',
213
+ shell: needsShell(),
214
+ });
210
215
  if (result.error) {
211
- throw new MissingAdcError(`Could not run gcloud: ${messageOf(result.error)}`);
216
+ throw new MissingAdcError(`Could not run gcloud: ${messageOf(result.error)}`, `Install the Google Cloud SDK and make sure \`gcloud\` runs in this shell (https://cloud.google.com/sdk/docs/install).`);
212
217
  }
213
218
  if (result.status !== 0) {
214
219
  throw new MissingAdcError('`gcloud auth application-default login` exited with a failure (it may have been cancelled).');
@@ -249,10 +254,19 @@ async function metadataServerAnswers(host) {
249
254
  clearTimeout(timer);
250
255
  }
251
256
  }
257
+ /**
258
+ * On Windows, `gcloud` is installed as a batch wrapper (`gcloud.cmd`), which
259
+ * spawnSync cannot execute directly — it only resolves real executables. Node
260
+ * resolves the wrapper only when `shell: true`. `git` and `npm` have the same
261
+ * shape on Windows. Everywhere we invoke a CLI, pass this flag.
262
+ */
263
+ function needsShell() {
264
+ return process.platform === 'win32';
265
+ }
252
266
  function findGcloud() {
253
267
  const probe = spawnSync('gcloud', ['version', '--format=json'], {
254
268
  stdio: 'ignore',
255
- shell: process.platform === 'win32',
269
+ shell: needsShell(),
256
270
  });
257
271
  return probe.error || probe.status !== 0 ? null : 'gcloud';
258
272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secureagentbase",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "description": "CLI tool to deploy and manage SecureAgentBase on GCP",
5
5
  "type": "module",
6
6
  "bin": {