#!/usr/bin/env node import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const SKILL_PATH = path.resolve(__dirname, "../SKILL.md"); const args = process.argv.slice(2); if (args.length < 2) { console.error("Usage: add-guild "); process.exit(1); } const guildId = args[0]; const description = args.slice(1).join(" "); if (!/^\d+$/.test(guildId)) { console.error("Error: guild-id must be numeric (Discord snowflake)"); process.exit(1); } let content = fs.readFileSync(SKILL_PATH, "utf8"); const newRow = `| ${guildId} | ${description} |`; // Find separator line and insert after it const lines = content.split("\n"); let insertIndex = -1; for (let i = 0; i < lines.length; i++) { if (/^\|[-\s|]+\|$/.test(lines[i]) && i > 0 && lines[i-1].includes("guild-id")) { insertIndex = i; break; } } if (insertIndex === -1) { console.error("Error: Could not find guild table in SKILL.md"); process.exit(1); } lines.splice(insertIndex + 1, 0, newRow); fs.writeFileSync(SKILL_PATH, lines.join("\n"), "utf8"); console.log(`✓ Added guild: ${guildId} - ${description}`);