Skip to content

Universal-AI-Rules/ai-rules-adapters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

AI Rules Adapters

Tool-specific adapters for Universal AI Rules 🔌

License: MIT Project Status: Concept

Overview

This package contains adapters that convert Universal AI Rules (.ai/ai-rules.yaml) into the specific formats required by different AI coding assistants. Each adapter handles the unique requirements, file formats, and conventions of its target tool.

Planned Adapters

⚠️ Note: These adapters don't exist yet - we need contributors to help build them!

AI Tool Status Output Format Adapter
GitHub Copilot 📋 Planned .github/copilot-instructions.md CopilotAdapter
Claude (Anthropic) 📋 Planned CLAUDE.md, CLAUDE.local.md ClaudeAdapter
Cursor 📋 Planned .cursor/rules/*.md CursorAdapter
Windsurf 📋 Planned .windsurf/rules/*.md WindsurfAdapter
Cline 📋 Planned .clinerules/*.md ClineAdapter
OpenAI Codex 📋 Planned AGENTS.md CodexAdapter
Google Jules 📋 Planned AGENTS.md JulesAdapter
Aider 📋 Planned CONVENTIONS.md AiderAdapter
Sourcegraph Cody 📋 Planned .sourcegraph/memory.md CodyAdapter
JetBrains AI 📋 Planned .junie/instructions.md JetBrainsAdapter

Architecture

Base Adapter Interface

interface AIRulesAdapter {
  name: string;
  version: string;
  outputPath: string;
  
  // Convert unified rules to tool-specific format
  convert(rules: UniversalAIRules): Promise<AdapterOutput>;
  
  // Validate tool-specific requirements
  validate(output: AdapterOutput): Promise<ValidationResult>;
  
  // Import existing tool config to unified format
  import(configPath: string): Promise<UniversalAIRules>;
}

interface AdapterOutput {
  files: Array<{
    path: string;
    content: string;
    encoding?: string;
  }>;
  metadata: {
    generatedAt: Date;
    sourceVersion: string;
    warnings?: string[];
  };
}

Example Adapter Usage

import { CursorAdapter, ClaudeAdapter } from '@universal-ai-rules/adapters';

const rules = await loadUniversalRules('.ai/ai-rules.yaml');

// Generate Cursor rules
const cursorAdapter = new CursorAdapter();
const cursorOutput = await cursorAdapter.convert(rules);
await writeFiles(cursorOutput.files);

// Generate Claude rules  
const claudeAdapter = new ClaudeAdapter();
const claudeOutput = await claudeAdapter.convert(rules);
await writeFiles(claudeOutput.files);

Adapter Development

Creating a New Adapter

Each adapter should:

  1. Extend BaseAdapter - Use common functionality
  2. Handle Tool Specifics - Respect tool's format requirements
  3. Support Import - Convert existing configs back to unified format
  4. Validate Output - Ensure generated files are valid
  5. Add Metadata - Include generation info and warnings

Example Adapter Structure

src/adapters/
├── base/
│   ├── BaseAdapter.ts
│   ├── types.ts
│   └── utils.ts
├── cursor/
│   ├── CursorAdapter.ts
│   ├── templates/
│   └── tests/
├── claude/
│   ├── ClaudeAdapter.ts
│   ├── templates/
│   └── tests/
└── index.ts

Tool-Specific Considerations

GitHub Copilot

  • Single markdown file format
  • GitHub-specific context awareness
  • Repository-level instructions

Claude (Anthropic)

  • Support for both CLAUDE.md and CLAUDE.local.md
  • Personal vs team rules separation
  • Markdown with specific formatting preferences

Cursor

  • Multiple files in .cursor/rules/ directory
  • Support for rule categories (architecture, style, etc.)
  • Integration with Cursor's rule system

Windsurf

  • Similar to Cursor but with Windsurf-specific features
  • Directory-based organization
  • Support for Windsurf's rule priorities

Get Involved

We need developers to build these adapters:

  • 🔧 TypeScript developers - implement adapter logic
  • 🧪 Tool experts - contribute knowledge about specific AI tools
  • 📝 Template creators - design output templates
  • 🔍 Testers - validate adapter outputs with real tools
  • 📚 Documentation writers - document adapter behaviors

Contributing an Adapter

  1. Choose a tool - pick an AI assistant you use regularly
  2. Study the format - understand how the tool expects rules
  3. Implement the adapter - follow our adapter interface
  4. Add tests - ensure your adapter works correctly
  5. Submit PR - contribute back to the community

Testing

Each adapter should include:

  • Unit tests for conversion logic
  • Integration tests with sample rule files
  • Validation tests for output format
  • Import/export round-trip tests

Contributing

Adapters are crucial for Universal AI Rules success. Each tool you help support makes the ecosystem more valuable for everyone. Check out our main project for contribution guidelines.

License

MIT License - see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published