slackhive 0.1.10 → 0.1.12

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.
@@ -176,6 +176,24 @@ async function init(opts) {
176
176
  console.log(chalk_1.default.bold.hex('#D97757')(' [4/4]') + chalk_1.default.bold(' Building & starting services'));
177
177
  console.log(chalk_1.default.gray(' This takes 3–5 minutes on first run while Docker builds images.'));
178
178
  console.log('');
179
+ // Pre-flight: check Docker has enough disk space (need ~3GB)
180
+ try {
181
+ const dfOut = (0, child_process_1.execSync)('docker system df --format "{{.Size}}"', { encoding: 'utf-8' });
182
+ void dfOut; // just checking it runs without error
183
+ }
184
+ catch {
185
+ console.log(chalk_1.default.yellow(' ↳ Could not check Docker disk usage — continuing anyway'));
186
+ }
187
+ // Pre-flight: warn if low disk space on host
188
+ try {
189
+ const df = (0, child_process_1.execSync)('df -k . | tail -1', { encoding: 'utf-8' }).trim();
190
+ const available = parseInt(df.split(/\s+/)[3]);
191
+ if (!isNaN(available) && available < 3 * 1024 * 1024) {
192
+ console.log(chalk_1.default.yellow(` ↳ Warning: less than 3GB disk space available. Build may fail.`));
193
+ console.log('');
194
+ }
195
+ }
196
+ catch { /* non-fatal */ }
179
197
  await runDockerBuild(dir, opts.dir);
180
198
  // Wait for web UI
181
199
  const webSpinner = (0, ora_1.default)(' Waiting for web UI to be ready...').start();
@@ -258,6 +276,7 @@ function runDockerBuild(cwd, displayDir) {
258
276
  }, 80);
259
277
  let stdoutBuf = '';
260
278
  let stderrBuf = '';
279
+ const errorLines = [];
261
280
  proc.stdout.on('data', (chunk) => {
262
281
  stdoutBuf += chunk.toString();
263
282
  const lines = stdoutBuf.split('\n');
@@ -279,6 +298,8 @@ function runDockerBuild(cwd, displayDir) {
279
298
  const m = /\[([^\]]+)\] (.+)/.exec(line.trim());
280
299
  if (m)
281
300
  currentStep = `${m[1]} — ${m[2].slice(0, 40)}`;
301
+ if (/error/i.test(line) && line.trim())
302
+ errorLines.push(line.trim());
282
303
  });
283
304
  });
284
305
  proc.on('close', (code) => {
@@ -290,8 +311,38 @@ function runDockerBuild(cwd, displayDir) {
290
311
  }
291
312
  else {
292
313
  console.log(' ' + chalk_1.default.red('✗') + ' Failed to start services');
293
- console.log(chalk_1.default.gray(` Try manually: cd ${displayDir} && docker compose up -d --build`));
294
- reject(new Error(`docker compose exited with code ${code}`));
314
+ console.log('');
315
+ // Classify the error and give actionable guidance
316
+ const allErrors = errorLines.join('\n').toLowerCase();
317
+ if (allErrors.includes('no space left') || allErrors.includes('disk full')) {
318
+ console.log(chalk_1.default.yellow(' Cause: Docker is out of disk space.'));
319
+ console.log(chalk_1.default.gray(' Fix: Run `docker system prune -a` to free space, then retry.'));
320
+ }
321
+ else if (allErrors.includes('port is already allocated') || allErrors.includes('address already in use')) {
322
+ const portMatch = /bind for .+:(\d+)/.exec(allErrors);
323
+ const port = portMatch ? portMatch[1] : 'a required port';
324
+ console.log(chalk_1.default.yellow(` Cause: Port ${port} is already in use by another process.`));
325
+ console.log(chalk_1.default.gray(` Fix: Stop the process using port ${port}, then retry.`));
326
+ }
327
+ else if (allErrors.includes('permission denied') || allErrors.includes('unauthorized')) {
328
+ console.log(chalk_1.default.yellow(' Cause: Docker permission denied.'));
329
+ console.log(chalk_1.default.gray(' Fix: Make sure Docker Desktop is running and you are logged in.'));
330
+ }
331
+ else if (allErrors.includes('network') || allErrors.includes('timeout') || allErrors.includes('pull')) {
332
+ console.log(chalk_1.default.yellow(' Cause: Network error while pulling Docker images.'));
333
+ console.log(chalk_1.default.gray(' Fix: Check your internet connection and retry.'));
334
+ }
335
+ else if (allErrors.includes('memory') || allErrors.includes('oom')) {
336
+ console.log(chalk_1.default.yellow(' Cause: Docker ran out of memory.'));
337
+ console.log(chalk_1.default.gray(' Fix: Increase Docker Desktop memory in Settings → Resources (4GB+ recommended).'));
338
+ }
339
+ else if (errorLines.length > 0) {
340
+ console.log(chalk_1.default.gray(' Error details:'));
341
+ errorLines.slice(-5).forEach(l => console.log(chalk_1.default.red(' ' + l)));
342
+ }
343
+ console.log('');
344
+ console.log(chalk_1.default.gray(` To retry: cd ${displayDir} && docker compose up -d --build`));
345
+ resolve(); // don't reject — let init finish gracefully
295
346
  }
296
347
  });
297
348
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slackhive",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "CLI to install and manage SlackHive — AI agent teams on Slack",
5
5
  "bin": {
6
6
  "slackhive": "./dist/index.js"