@glash/cli 0.2.14 → 0.2.16

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.
@@ -178,12 +178,13 @@ export async function deploy({ flags }) {
178
178
  const seen = new Set();
179
179
  let lastStatus = '';
180
180
  const start = Date.now();
181
+ const timeoutMs = deployTimeoutMs(flags);
181
182
  let pollDelayMs = 5000;
182
183
  let lastProgressAt = Date.now();
183
184
  let currentPhase = 'queued';
184
185
  const indicator = createDeployIndicator({ start, getPhase: () => currentPhase });
185
186
  indicator.start();
186
- while (Date.now() - start < 15 * 60 * 1000) {
187
+ while (Date.now() - start < timeoutMs) {
187
188
  let pipe;
188
189
  try {
189
190
  pipe = await apiGet(`/deployments/${dep.id}/pipeline`);
@@ -224,14 +225,16 @@ export async function deploy({ flags }) {
224
225
  }
225
226
  if (['error', 'failed'].includes(status)) {
226
227
  indicator.stop();
227
- return fail(`Deployment failed (${status}). Run \`glash logs ${dep.id}\` for details.`);
228
+ const lastError = [...(pipe.events ?? [])].reverse().find((ev) => ev.status === 'error' || ev.status === 'failed');
229
+ const detail = lastError?.message ? `: ${lastError.message}` : '';
230
+ return fail(`Deployment failed (${status})${detail}. Run \`glash logs ${dep.id}\` for details.`);
228
231
  }
229
232
  currentPhase = phaseFromPipeline(pipe, currentPhase);
230
233
  pollDelayMs = nextPollDelay(pipe);
231
234
  await indicator.wait(pollDelayMs);
232
235
  }
233
236
  indicator.stop();
234
- warn('Timed out waiting for deployment. Check `glash status <id>`.');
237
+ warn(`Timed out after ${formatDuration(timeoutMs)} waiting for deployment. Check \`glash status ${dep.id}\`.`);
235
238
  }
236
239
 
237
240
  async function syncEnvBeforeDeploy(projectId, target, flags) {
@@ -310,6 +313,23 @@ function nextPollDelay(pipe) {
310
313
  return 5000;
311
314
  }
312
315
 
316
+ function deployTimeoutMs(flags) {
317
+ const raw = flags['wait-timeout'] ?? flags.timeout ?? process.env.GLASH_DEPLOY_TIMEOUT_MS;
318
+ if (raw !== undefined && raw !== null && raw !== '') {
319
+ const parsed = Number(raw);
320
+ if (Number.isFinite(parsed) && parsed > 0) {
321
+ return parsed < 1000 ? parsed * 60_000 : parsed;
322
+ }
323
+ }
324
+ return 45 * 60_000;
325
+ }
326
+
327
+ function formatDuration(ms) {
328
+ const seconds = Math.round(ms / 1000);
329
+ if (seconds < 90) return `${seconds}s`;
330
+ return `${Math.round(seconds / 60)}m`;
331
+ }
332
+
313
333
  function phaseFromEvent(ev) {
314
334
  if (ev.step === 'detect') return 'detecting';
315
335
  if (ev.step === 'host') return 'assigning host';
package/lib/version.mjs CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.14';
1
+ export const VERSION = '0.2.16';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glash/cli",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "glashDB command-line interface — deploy projects, pull source + env, manage env vars.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://glashdb.com",