@team-semicolon/semo-cli 4.0.0 → 4.0.1

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.
@@ -345,4 +345,38 @@ function registerBotsCommands(program) {
345
345
  await (0, database_1.closeConnection)();
346
346
  }
347
347
  });
348
+ // ── semo bots set-status ─────────────────────────────────────
349
+ botsCmd
350
+ .command("set-status <bot_id> <status>")
351
+ .description("봇 온라인 상태 수동 설정 (online|offline)")
352
+ .action(async (botId, status) => {
353
+ if (status !== "online" && status !== "offline") {
354
+ console.log(chalk_1.default.red("❌ status는 'online' 또는 'offline'만 가능합니다."));
355
+ process.exit(1);
356
+ }
357
+ const connected = await (0, database_1.isDbConnected)();
358
+ if (!connected) {
359
+ console.log(chalk_1.default.red("❌ DB 연결 실패"));
360
+ await (0, database_1.closeConnection)();
361
+ process.exit(1);
362
+ }
363
+ try {
364
+ const pool = (0, database_1.getPool)();
365
+ const client = await pool.connect();
366
+ await client.query(`INSERT INTO semo.bot_status (bot_id, status, synced_at)
367
+ VALUES ($1, $2, NOW())
368
+ ON CONFLICT (bot_id) DO UPDATE SET
369
+ status = EXCLUDED.status,
370
+ synced_at = NOW()`, [botId, status]);
371
+ client.release();
372
+ console.log(chalk_1.default.green(`✔ ${botId} → ${status}`));
373
+ }
374
+ catch (err) {
375
+ console.log(chalk_1.default.red(`❌ 실패: ${err}`));
376
+ process.exit(1);
377
+ }
378
+ finally {
379
+ await (0, database_1.closeConnection)();
380
+ }
381
+ });
348
382
  }
package/dist/database.js CHANGED
@@ -31,11 +31,14 @@ function buildDbConfig() {
31
31
  idleTimeoutMillis: 30000,
32
32
  };
33
33
  }
34
+ if (!process.env.SEMO_DB_HOST && !process.env.DATABASE_URL) {
35
+ throw new Error("DB 연결 정보가 없습니다. DATABASE_URL 또는 SEMO_DB_HOST 환경변수를 설정하세요.");
36
+ }
34
37
  return {
35
- host: process.env.SEMO_DB_HOST || "3.38.162.21",
38
+ host: process.env.SEMO_DB_HOST,
36
39
  port: parseInt(process.env.SEMO_DB_PORT || "5432"),
37
40
  user: process.env.SEMO_DB_USER || "app",
38
- password: process.env.SEMO_DB_PASSWORD || "ProductionPassword2024!@#",
41
+ password: process.env.SEMO_DB_PASSWORD,
39
42
  database: process.env.SEMO_DB_NAME || "appdb",
40
43
  ssl: false,
41
44
  connectionTimeoutMillis: 5000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-semicolon/semo-cli",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "SEMO CLI - AI Agent Orchestration Framework Installer",
5
5
  "main": "dist/index.js",
6
6
  "bin": {