x-context
v0.1.0
Published
AI-powered CLI command that converts AI coding tool context files between different formats
Readme
x-context
x-context is an AI-powered CLI command that converts AI coding tool context files between different formats.
[!IMPORTANT] This package is experimental and should be used with caution. The AI-powered conversion may not always produce perfect results, and you should review the generated files before using them.
The proliferation of AI coding tools like Claude Code, OpenAI Codex, Gemini CLI, etc. presents a common challenge: each tool uses different context file formats, making migration and tool switching cumbersome. Facing this challenge, I found myself wishing for a Pandoc-like command that could convert context files between different formats. This led me to build x-context, which enables seamless migration of AI tool context files and allows teams to maintain a single source of truth for project context while supporting multiple AI development tools.
Usage
You don't need to install anything, just run npx or pnpm dlx to use x-context:
npx x-context@latest [options] <files...>Specify the source (--from) and target (--to) tools, and either an AI provider (--provider) or a specific model (--model):
# Convert CLAUDE.md to Cursor rules using Anthropic model
npx x-context --from claude-code --to cursor --provider anthropic CLAUDE.md
# Convert Copilot instructions to Gemini CLI context file using Gemini model
npx x-context --from copilot --to gemini-cli --provider gemini .github/copilot-instructions.md
# Use specific model (OpenAI gpt-4o)
npx x-context --from claude-code --to gemini-cli --model gpt-4o CLAUDE.md
# Convert multiple files at once (useful when a context file references other files)
npx x-context --from claude-code --to cursor --provider anthropic CLAUDE.md README.md docs/git-instructions.mdNote: You need to set the appropriate environment variable for your chosen AI provider. See the Supported Providers section for details on required API keys.
Supported Tools
| Tool | Value |
| --- | --- |
| Claude Code | claude-code |
| OpenAI Codex | codex |
| GitHub Copilot | copilot |
| Cursor | cursor |
| Gemini CLI | gemini-cli |
Supported Providers
| Provider | Value | Environment Variable |
| --- | --- | --- |
| Anthropic | anthropic | ANTHROPIC_API_KEY |
| Gemini | gemini | GOOGLE_GENERATIVE_AI_API_KEY |
| OpenAI | openai | OPENAI_API_KEY |
Supported Models
The following model IDs are sourced from Vercel's AI SDK:
Anthropic
claude-4-opus-20250514claude-4-sonnet-20250514(default)claude-3-7-sonnet-20250219claude-3-5-sonnet-latestclaude-3-5-sonnet-20241022claude-3-5-sonnet-20240620claude-3-5-haiku-latestclaude-3-5-haiku-20241022claude-3-opus-latestclaude-3-opus-20240229claude-3-sonnet-20240229claude-3-haiku-20240307
Gemini
gemini-1.5-flashgemini-1.5-flash-latestgemini-1.5-flash-001gemini-1.5-flash-002gemini-1.5-flash-8bgemini-1.5-flash-8b-latestgemini-1.5-flash-8b-001gemini-1.5-progemini-1.5-pro-latestgemini-1.5-pro-001gemini-1.5-pro-002gemini-2.0-flashgemini-2.0-flash-001gemini-2.0-flash-live-001gemini-2.0-flash-litegemini-2.0-pro-exp-02-05gemini-2.0-flash-thinking-exp-01-21gemini-2.0-flash-expgemini-2.5-pro-exp-03-25gemini-2.5-pro-preview-05-06gemini-2.5-flash-preview-04-17(default)gemini-exp-1206gemma-3-27b-itlearnlm-1.5-pro-experimental
OpenAI
o1o1-2024-12-17o1-minio1-mini-2024-09-12o1-previewo1-preview-2024-09-12o3-minio3-mini-2025-01-31o3o3-2025-04-16o4-mini(default)o4-mini-2025-04-16gpt-4.1gpt-4.1-2025-04-14gpt-4.1-minigpt-4.1-mini-2025-04-14gpt-4.1-nanogpt-4.1-nano-2025-04-14gpt-4ogpt-4o-2024-05-13gpt-4o-2024-08-06gpt-4o-2024-11-20gpt-4o-audio-previewgpt-4o-audio-preview-2024-10-01gpt-4o-audio-preview-2024-12-17gpt-4o-search-previewgpt-4o-search-preview-2025-03-11gpt-4o-mini-search-previewgpt-4o-mini-search-preview-2025-03-11gpt-4o-minigpt-4o-mini-2024-07-18gpt-4-turbogpt-4-turbo-2024-04-09gpt-4-turbo-previewgpt-4-0125-previewgpt-4-1106-previewgpt-4gpt-4-0613gpt-4.5-previewgpt-4.5-preview-2025-02-27gpt-3.5-turbo-0125gpt-3.5-turbogpt-3.5-turbo-1106chatgpt-4o-latest
