Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rulesx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rulesx
Minimal CLI to install AI agent rules from git repositories.
English | 中文
What is rulesx?
rulesx is a lightweight CLI tool that installs .mdc rule files and agent configuration files from any git repository into your project. It supports Cursor rules (.cursor/rules/) and root-level agent files like AGENTS.md, CLAUDE.md, and more.
Install
No installation required — run directly with npx:
npx rulesx add <source>Or install globally:
npm i -g rulesxUsage
rulesx add <source> [--rule '<pattern>']Source Formats
| Format | Example |
|---|---|
| GitHub shorthand | rulesx add owner/repo |
| Full GitHub URL | rulesx add https://github.com/owner/repo |
| GitLab URL | rulesx add https://gitlab.com/org/repo |
| SSH URL | rulesx add git@github.com:owner/repo.git |
| Any git URL | rulesx add https://host.com/org/repo.git |
| Local directory | rulesx add ./my-local-rules |
Examples
# Interactive mode — select which rules to install
rulesx add owner/repo
# Install all rules
rulesx add owner/repo --rule '*'
# Install a specific rule
rulesx add owner/repo --rule 'api-docs'
# Install rules matching a glob pattern
rulesx add owner/repo --rule 'react-*'
# From a private git repo with credentials
rulesx add https://user:token@git.example.com/org/rules.git --rule '*'
# From a local directory
rulesx add ./my-rules --rule 'eslint'How It Works
- Clones the target repository (shallow,
--depth 1) - Scans for
.mdcfiles in therules/directory - Detects root-level agent files (
AGENTS.md,CLAUDE.md, etc.) - Prompts for selection (or uses
--rulepattern to filter) - Copies matched files to your project
File Placement
| File Type | Destination |
|---|---|
.mdc files (from rules/) |
.cursor/rules/ |
| Root-level agent files | Project root |
Supported Agent Files
The following root-level agent configuration files are automatically detected:
| File | Agent |
|---|---|
AGENTS.md |
OpenAI Codex, GitHub Copilot, Cursor, Windsurf, Amp, Devin, etc. |
CLAUDE.md |
Claude Code |
.cursorrules |
Cursor (legacy) |
.windsurfrules |
Windsurf / Codeium |
.clinerules |
Cline |
.roorules |
Roo Code (legacy) |
.kilocoderules |
KiloCode (legacy) |
GEMINI.md |
Gemini / OpenCode |
Rule Repository Structure
Your rule repository should follow this structure:
my-rules/
├── rules/
│ ├── api-docs.mdc
│ ├── eslint.mdc
│ └── react-hooks.mdc
├── AGENTS.md # optional
├── CLAUDE.md # optional
└── ...Each .mdc file can include YAML frontmatter with a description field, which will be displayed during interactive selection:
---
description: API documentation rules for OpenAPI integration
alwaysApply: true
---
# Your rule content hereRequirements
- Node.js >= 18
- Git