#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const wranglerPath = path.join(__dirname, '..', 'wrangler.toml');
const content = fs.readFileSync(wranglerPath, 'utf8');
// Check if the KV namespace ID is still the placeholder (as a value, not in comments)
if (/^id\s*=\s*"YOUR_KV_NAMESPACE_ID"/m.test(content)) {
console.error('\x1b[31m✗ Error: KV namespace not configured\x1b[0m\n');
console.error('Run this command to create a KV namespace:');
console.error('\n wrangler kv namespace create TOKENS\n');
console.error('Then update wrangler.toml with the ID from the output.');
process.exit(1);
}
console.log('\x1b[32m✓ Config looks good\x1b[0m');