slackhive 0.1.44 → 0.1.46

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.
@@ -1,121 +0,0 @@
1
- "use strict";
2
- /**
3
- * @fileoverview Management commands — start, stop, status, logs, update.
4
- *
5
- * All commands look for docker-compose.yml in the current directory
6
- * or the `slackhive` subdirectory.
7
- *
8
- * @module cli/commands/manage
9
- */
10
- var __importDefault = (this && this.__importDefault) || function (mod) {
11
- return (mod && mod.__esModule) ? mod : { "default": mod };
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.start = start;
15
- exports.stop = stop;
16
- exports.status = status;
17
- exports.logs = logs;
18
- exports.update = update;
19
- const child_process_1 = require("child_process");
20
- const fs_1 = require("fs");
21
- const path_1 = require("path");
22
- const chalk_1 = __importDefault(require("chalk"));
23
- const ora_1 = __importDefault(require("ora"));
24
- /**
25
- * Finds the SlackHive project directory.
26
- * Checks cwd first, then ./slackhive subdirectory.
27
- *
28
- * @returns {string} Path to the project directory.
29
- */
30
- function findProjectDir() {
31
- if ((0, fs_1.existsSync)((0, path_1.join)(process.cwd(), 'docker-compose.yml'))) {
32
- return process.cwd();
33
- }
34
- const sub = (0, path_1.join)(process.cwd(), 'slackhive');
35
- if ((0, fs_1.existsSync)((0, path_1.join)(sub, 'docker-compose.yml'))) {
36
- return sub;
37
- }
38
- console.log(chalk_1.default.red(' Could not find SlackHive project.'));
39
- console.log(chalk_1.default.gray(' Run this command from the SlackHive directory, or run `slackhive init` first.'));
40
- process.exit(1);
41
- }
42
- /**
43
- * Start all SlackHive services.
44
- */
45
- async function start() {
46
- const dir = findProjectDir();
47
- const spinner = (0, ora_1.default)('Starting SlackHive services...').start();
48
- try {
49
- (0, child_process_1.execSync)('docker compose up -d', { cwd: dir, stdio: 'ignore' });
50
- spinner.succeed('All services started');
51
- console.log(chalk_1.default.gray(' Web UI: http://localhost:3001'));
52
- }
53
- catch {
54
- spinner.fail('Failed to start services');
55
- }
56
- }
57
- /**
58
- * Stop all SlackHive services.
59
- */
60
- async function stop() {
61
- const dir = findProjectDir();
62
- const spinner = (0, ora_1.default)('Stopping SlackHive services...').start();
63
- try {
64
- (0, child_process_1.execSync)('docker compose stop', { cwd: dir, stdio: 'ignore' });
65
- spinner.succeed('All services stopped');
66
- }
67
- catch {
68
- spinner.fail('Failed to stop services');
69
- }
70
- }
71
- /**
72
- * Show running SlackHive containers.
73
- */
74
- async function status() {
75
- const dir = findProjectDir();
76
- try {
77
- const output = (0, child_process_1.execSync)('docker compose ps', { cwd: dir, encoding: 'utf-8' });
78
- console.log('');
79
- console.log(chalk_1.default.bold(' SlackHive Status'));
80
- console.log('');
81
- console.log(output);
82
- }
83
- catch {
84
- console.log(chalk_1.default.red(' Failed to get status'));
85
- }
86
- }
87
- /**
88
- * Tail runner service logs.
89
- */
90
- async function logs(opts) {
91
- const dir = findProjectDir();
92
- const args = ['compose', 'logs', 'runner'];
93
- if (opts.follow !== false)
94
- args.push('-f');
95
- const proc = (0, child_process_1.spawn)('docker', args, { cwd: dir, stdio: 'inherit' });
96
- proc.on('error', () => console.log(chalk_1.default.red(' Failed to tail logs')));
97
- }
98
- /**
99
- * Pull latest changes and rebuild.
100
- */
101
- async function update() {
102
- const dir = findProjectDir();
103
- const pullSpinner = (0, ora_1.default)('Pulling latest changes...').start();
104
- try {
105
- (0, child_process_1.execSync)('git pull', { cwd: dir, stdio: 'ignore' });
106
- pullSpinner.succeed('Code updated');
107
- }
108
- catch {
109
- pullSpinner.fail('Failed to pull — do you have uncommitted changes?');
110
- return;
111
- }
112
- const buildSpinner = (0, ora_1.default)('Rebuilding services (this may take a minute)...').start();
113
- try {
114
- (0, child_process_1.execSync)('docker compose up -d --build', { cwd: dir, stdio: 'ignore', timeout: 600000 });
115
- buildSpinner.succeed('Services rebuilt and restarted');
116
- console.log(chalk_1.default.gray(' Web UI: http://localhost:3001'));
117
- }
118
- catch {
119
- buildSpinner.fail('Failed to rebuild');
120
- }
121
- }
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * @fileoverview SlackHive CLI — install, configure, and manage SlackHive.
4
- *
5
- * Commands:
6
- * slackhive init — Clone repo, configure .env, start services
7
- * slackhive start — Start all Docker Compose services
8
- * slackhive stop — Stop all services
9
- * slackhive status — Show running containers
10
- * slackhive logs — Tail runner logs
11
- * slackhive update — Pull latest changes and rebuild
12
- *
13
- * @module cli
14
- */
15
- export {};