agent-rules
Version:
Rules and instructions for agentic coding tools like Cursor, Claude CLI, Gemini CLI, Qodo, Cline and more
40 lines (36 loc) • 1.25 kB
text/typescript
import { BaseAdapter } from './base-adapter.js'
import { GitHubCopilotAdapter } from './github-copilot-adapter.js'
import { CursorAdapter } from './cursor-adapter.js'
import { ClaudeCodeAdapter } from './claude-code-adapter.js'
import { GeminiAdapter } from './gemini-adapter.js'
/**
* Registry of AI app adapters
*/
export class AdapterRegistry {
private static readonly adapters = new Map<string, () => BaseAdapter>([
['github-copilot', () => new GitHubCopilotAdapter()],
['cursor', () => new CursorAdapter()],
['claude-code', () => new ClaudeCodeAdapter()],
['gemini', () => new GeminiAdapter()]
])
/**
* Get an adapter instance for the specified AI app
* @param aiApp - The AI app identifier
* @returns The adapter instance
* @throws Error if the AI app is not supported
*/
static getAdapter (aiApp: string): BaseAdapter {
const adapterFactory = this.adapters.get(aiApp)
if (!adapterFactory) {
throw new Error(`AI App "${aiApp}" is not supported.`)
}
return adapterFactory()
}
/**
* Get the list of supported AI apps
* @returns Array of supported AI app identifiers
*/
static getSupportedAiApps (): string[] {
return Array.from(this.adapters.keys())
}
}