Skip to content

Commit 184f01b

Browse files
author
nik
committed
Initial commit
0 parents  commit 184f01b

18 files changed

+60537
-0
lines changed

.eslintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"env": {
3+
"es2022": true,
4+
"node": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended"
9+
],
10+
"parser": "@typescript-eslint/parser",
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"sourceType": "module"
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
"indent": ["error", 2],
20+
"linebreak-style": ["error", "unix"],
21+
"quotes": ["error", "single", { "avoidEscape": true }],
22+
"semi": ["error", "always"],
23+
"no-unused-vars": "off",
24+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
25+
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
26+
"@typescript-eslint/no-explicit-any": "error"
27+
}
28+
}

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18.x, 20.x]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
cache: 'npm'
23+
- run: npm ci
24+
- run: npm run build
25+
- run: npm run lint
26+
- run: npm test
27+
28+
publish:
29+
needs: build
30+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release:')
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-node@v3
35+
with:
36+
node-version: '18.x'
37+
registry-url: 'https://registry.npmjs.org'
38+
- run: npm ci
39+
- run: npm run build
40+
- run: npm publish
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Dependencies
2+
node_modules/
3+
.pnp/
4+
.pnp.js
5+
6+
# Build output
7+
lib/
8+
dist/
9+
build/
10+
coverage/
11+
12+
# Logs
13+
logs
14+
*.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
lerna-debug.log*
19+
20+
# Environment variables
21+
.env
22+
.env.local
23+
.env.development.local
24+
.env.test.local
25+
.env.production.local
26+
27+
# Editor directories and files
28+
.idea/
29+
.vscode/
30+
*.suo
31+
*.ntvs*
32+
*.njsproj
33+
*.sln
34+
*.sw?
35+
.DS_Store
36+
37+
# Testing
38+
.nyc_output/
39+
40+
# Temporary project output
41+
*-output/
42+
*.rules.mdc
43+
repomix-output.md

.npmignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Source
2+
src/
3+
tests/
4+
5+
# CI/CD
6+
.github/
7+
.travis.yml
8+
.gitlab-ci.yml
9+
.circleci/
10+
11+
# Config files
12+
.eslintrc
13+
.eslintignore
14+
tsconfig.json
15+
.prettierrc
16+
vitest.config.ts
17+
jest.config.js
18+
19+
# Git files
20+
.git/
21+
.gitignore
22+
23+
# Development
24+
coverage/
25+
.vscode/
26+
.idea/
27+
*.log
28+
.DS_Store
29+
30+
# Testing
31+
tests/
32+
**/*.test.ts
33+
**/*.spec.ts
34+
*-output/
35+
36+
# Temporary files
37+
tmp/
38+
temp/

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2025-03-23
9+
10+
### Added
11+
12+
- Initial release
13+
- Support for transforming GitHub repositories into cursor rules
14+
- Integration with Claude Sonnet 3.5
15+
- Support for custom guidelines files
16+
- Command-line interface with basic options

CONTRIBUTING.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Contributing to Rulefy
2+
3+
Thank you for considering contributing to Rulefy! This document provides guidelines and instructions for contributing.
4+
5+
## Code of Conduct
6+
7+
By participating in this project, you agree to abide by its Code of Conduct.
8+
9+
## How Can I Contribute?
10+
11+
### Reporting Bugs
12+
13+
- Check if the bug has already been reported in the Issues section
14+
- Use the bug report template to create a new issue
15+
- Include detailed steps to reproduce the bug
16+
- Include your environment details (OS, Node.js version, etc.)
17+
18+
### Suggesting Enhancements
19+
20+
- Check if the enhancement has already been suggested in the Issues section
21+
- Use the feature request template to create a new issue
22+
- Describe the enhancement in detail and explain why it would be useful
23+
24+
### Pull Requests
25+
26+
1. Fork the repository
27+
2. Create a new branch (`git checkout -b feature/amazing-feature`)
28+
3. Make your changes
29+
4. Run tests and linting (`npm test && npm run lint`)
30+
5. Commit your changes (`git commit -m 'Add some amazing feature'`)
31+
6. Push to the branch (`git push origin feature/amazing-feature`)
32+
7. Open a Pull Request
33+
34+
## Development Setup
35+
36+
1. Clone the repository
37+
2. Install dependencies:
38+
```
39+
npm install
40+
```
41+
3. Build the project:
42+
```
43+
npm run build
44+
```
45+
4. Run tests:
46+
```
47+
npm test
48+
```
49+
50+
## Styleguides
51+
52+
### Git Commit Messages
53+
54+
- Use the present tense ("Add feature" not "Added feature")
55+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
56+
- Limit the first line to 72 characters or less
57+
- Reference issues and pull requests liberally after the first line
58+
59+
### JavaScript/TypeScript Styleguide
60+
61+
- Use 2 spaces for indentation
62+
- Use semicolons
63+
- Follow the ESLint configuration
64+
65+
### Documentation Styleguide
66+
67+
- Use Markdown for documentation
68+
- Reference examples when possible
69+
70+
## License
71+
72+
By contributing, you agree that your contributions will be licensed under the project's MIT License.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Nik
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Rulefy
2+
3+
[![npm version](https://img.shields.io/npm/v/rulefy.svg)](https://www.npmjs.com/package/rulefy)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5+
[![Node.js Version](https://img.shields.io/node/v/rulefy.svg)](https://nodejs.org/)
6+
7+
Rulefy is a Node.js tool that transforms GitHub repositories into [Cursor](https://cursor.sh/) rules instructions in a markdown file. It leverages [repomix](https://github.com/yamadashy/repomix) for repository-to-text conversion and integrates with cursor rules guidelines to guide LLM generation.
8+
9+
## Features
10+
11+
- 🚀 Analyze GitHub repositories or local codebases
12+
- 🧩 Convert codebase structure to LLM-friendly format
13+
- 🤖 Generate tailored Cursor rules using Claude AI
14+
- 📝 Create customized .rules.mdc files for Cursor editor
15+
- 🔧 Easily configurable through CLI options
16+
17+
## Installation
18+
19+
```bash
20+
# Install globally
21+
npm install -g rulefy
22+
23+
# Or use with npx (no installation required)
24+
npx rulefy
25+
```
26+
27+
## Prerequisites
28+
29+
- Node.js 18 or higher
30+
- ANTHROPIC_API_KEY environment variable set with your Anthropic API key
31+
32+
```bash
33+
export ANTHROPIC_API_KEY='your-anthropic-api-key'
34+
```
35+
36+
## Usage
37+
38+
The basic command structure is:
39+
40+
```bash
41+
rulefy <repo-url-or-path>
42+
```
43+
44+
Examples:
45+
46+
```bash
47+
# Using GitHub URL
48+
rulefy https://github.com/fastapi/fastapi
49+
50+
# Using GitHub shorthand
51+
rulefy fastapi/fastapi
52+
53+
# Using local repository path
54+
rulefy ./my-local-project
55+
```
56+
57+
This will:
58+
1. Fetch the repository content using repomix
59+
2. Read the cursor rules guidelines
60+
3. Generate cursor rules using Claude Sonnet 3.5
61+
4. Save the output to a `<repo-name>.rules.mdc` file
62+
63+
### Options
64+
65+
```
66+
Options:
67+
--provider <provider> LLM provider to use (default: "claude-sonnet-3.5-latest")
68+
-o, --output <file> Output file name (defaults to <repo-name>.rules.mdc)
69+
--guidelines <file> Path to cursor rules guidelines file (default: "./cursorrules-guidelines.md")
70+
--include <patterns> Include patterns for files (glob pattern, e.g., "**/*.py")
71+
-h, --help display help for command
72+
```
73+
74+
## How It Works
75+
76+
1. **Repository Conversion**: Uses repomix to convert GitHub repositories into a textual representation
77+
2. **Guidelines Integration**: Reads cursor rules guidelines from the specified file
78+
3. **LLM Generation**: Passes the repository content and guidelines to Claude Sonnet 3.5
79+
4. **Output**: Saves the generated cursor rules to a markdown file
80+
81+
## Example Output
82+
83+
The generated `.rules.mdc` file will contain structured guidelines for Cursor AI when working with your codebase:
84+
85+
```markdown
86+
# .cursorrules for my-project
87+
88+
## Project Overview
89+
This project is a TypeScript application that...
90+
91+
## Coding Standards
92+
- Follow TypeScript best practices with strict typing
93+
- Use async/await for asynchronous operations
94+
...
95+
96+
## File Structure Guidelines
97+
- Place core logic in the `src/` directory
98+
...
99+
```
100+
101+
## Contributing
102+
103+
Contributions are welcome! Please feel free to submit a Pull Request.
104+
105+
## License
106+
107+
MIT

0 commit comments

Comments
 (0)