"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.loadEnv = loadEnv; exports.loadDisclawConfig = loadDisclawConfig; const fs = __importStar(require("fs")); const path = __importStar(require("path")); const dotenv = __importStar(require("dotenv")); const YAML = __importStar(require("yaml")); function loadEnv(rootDir) { dotenv.config({ path: path.join(rootDir, ".env") }); const token = process.env.DISCORD_BOT_TOKEN; if (!token) { throw new Error("DISCORD_BOT_TOKEN is not set in .env"); } return { DISCORD_BOT_TOKEN: token, DISCORD_GUILD_ID: process.env.DISCORD_GUILD_ID, CLAUDE_PATH: process.env.CLAUDE_PATH, }; } function loadDisclawConfig(rootDir) { const configPath = path.join(rootDir, "disclaw.yaml"); if (!fs.existsSync(configPath)) { throw new Error(`disclaw.yaml not found at ${configPath}`); } const raw = fs.readFileSync(configPath, "utf-8"); const parsed = YAML.parse(raw); // Apply defaults const config = { workspaces_root: parsed.workspaces_root ?? "./workspaces", management_channel: parsed.management_channel ?? "disclaw", claude_command: parsed.claude_command ?? "claude", claude_timeout_seconds: parsed.claude_timeout_seconds ?? 120, }; // Resolve workspaces_root to absolute path relative to project root if (!path.isAbsolute(config.workspaces_root)) { config.workspaces_root = path.resolve(rootDir, config.workspaces_root); } return config; } //# sourceMappingURL=loader.js.map