const ClaudeCodeCloudAdapter = require('./claude-code-cloud');
const GitHubActionsAdapter = require('./github-actions');
const CronAdapter = require('./cron');

const REGISTRY = {
  'claude-code-cloud': ClaudeCodeCloudAdapter,
  'github-actions':     GitHubActionsAdapter,
  'cron':               CronAdapter
};

function listAdapters() {
  return Object.keys(REGISTRY);
}

function getAdapter(name, cwd) {
  const Cls = REGISTRY[name];
  if (!Cls) throw new Error(`Unknown adapter: ${name}. Available: ${listAdapters().join(', ')}`);
  return new Cls(cwd);
}

module.exports = { listAdapters, getAdapter, REGISTRY };
