定制 jpcaparas/rulesync 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jpcaparas/rulesync

Composer 安装命令:

composer require jpcaparas/rulesync

包简介

Easily sync all of your favourite AI assistant configuration files

README 文档

README

Tests Coverage

Easily sync all of your favourite AI instruction files (e.g. .cursorrules, copilot-instructions.md, GEMINI.md, CLAUDE.md, AGENTS.md, .clinerules/project.md).

demo.mp4

Installation

Requirements: PHP 8.2+ is required for all installation options.

Choose the method that works best for your workflow:

Option 1: Standalone Executable (Recommended)

Download the pre-built executable - no Composer required!

# Download from GitHub releases
curl -L -o rulesync https://github.com/jpcaparas/rulesync/releases/latest/download/rulesync
chmod +x rulesync
./rulesync --help

# Optional: Add to PATH for global access
sudo mv rulesync /usr/local/bin/
rulesync --help

Option 2: Global Composer Binary

Install globally via Composer (adds to your $PATH automatically):

composer global require jpcaparas/rulesync
rulesync --help

Option 3: Development Dependency

Add to your project's development dependencies:

composer require --dev jpcaparas/rulesync
./vendor/bin/rulesync --help

Quick Start

  1. Create a rulesync.md file with your rules
  2. Run rulesync generate to create all AI assistant rule files
  3. Your rules are now synced across Claude, Cursor, Windsurf, Gemini CLI, GitHub Copilot, OpenAI Codex, Cline, and Junie!

Commands

  • rulesync rules:list - Show available AI assistants
  • rulesync generate - Generate rule files from rulesync.md
  • rulesync gitignore:generate - Add AI assistant rule files to .gitignore
  • rulesync config - View current configuration
  • rulesync disable <name> - Disable specific AI assistant
  • rulesync enable <name> - Enable specific AI assistant
  • rulesync base <path> - Set base rules (URL or file path)

Supported AI Assistants

  • ClaudeCLAUDE.md
  • Cline.clinerules/project.md
  • Cursor.cursorrules
  • Gemini CLIGEMINI.md
  • GitHub Copilot.github/copilot-instructions.md
  • Junie.junie/guidelines.md
  • OpenAI CodexAGENTS.md
  • Windsurf.windsurfrules

FAQ

Rule Augmentation

Q: How does local and global rule augmentation work?

A: Rulesync automatically detects whether you're in a local project (with composer.json) or global context. When both local (./rulesync.md) and global (~/.config/rulesync/rulesync.md) rule files exist, the system prompts you to:

  • Combine both files: Local rules first, then global rules separated by ---
  • Use local only: Ignore global rules entirely

Your preference is saved for future generate calls, but can be changed anytime.

Q: Can I disable certain AI assistants?

A: Yes! Use these commands:

  • rulesync disable <name> - Disable specific AI assistant (e.g., rulesync disable claude)
  • rulesync enable <name> - Re-enable a disabled assistant
  • rulesync rules:list - View all assistants and their enabled/disabled status

Disabled assistants won't have their rule files generated during rulesync generate.

Q: How does overwrite protection work?

A: By default, Rulesync protects existing rule files by:

  • Comparing content using MD5 hashing
  • Prompting for confirmation when files exist and differ
  • Skipping files that already have identical content

You can override this behaviour with:

  • --overwrite - Force overwrite existing files
  • --force - Skip all prompts and force generation

Q: Can I use base rules from external sources?

A: Yes! The base rules system allows you to:

  • Set base rules from URLs: rulesync base https://example.com/rules.md
  • Set base rules from local files: rulesync base ./shared-rules.md
  • Disable base rules: rulesync base --disable
  • View current base rules: rulesync base

Base rules are appended to your final rule files after local/global augmentation.

Building Standalone Executable

You can build Rulesync as a standalone PHAR executable that doesn't require Composer on the target system (PHP 8.2+ is still required).

Prerequisites

Install Box globally:

composer global require humbug/box

Build Commands

Basic build:

php rulesync build

Build with specific version:

php rulesync build 1.0.0

Create full release (with tests):

php rulesync release 1.0.0

Build with verbose output (for debugging):

php rulesync build 1.0.0 --verbose

Output

The standalone executable is created at builds/rulesync and includes all dependencies. You can distribute this single file without requiring users to install Composer or manage dependencies (PHP 8.2+ is still required).

Test the build:

./builds/rulesync --version
./builds/rulesync --help

Notes

  • The version argument updates the version in config/app.php before building
  • Use --verbose flag to see detailed Box compilation output for debugging
  • The build process includes all dependencies (including dev dependencies) in the final PHAR
  • The release command runs tests, builds the PHAR, but no longer creates a tarball

License

MIT

jpcaparas/rulesync 适用场景与选型建议

jpcaparas/rulesync 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 13, 最近一次更新时间为 2025 年 07 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「synchronization」 「rules」 「cursor」 「assistant」 「ai」 「Gemini」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jpcaparas/rulesync 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jpcaparas/rulesync 我们能提供哪些服务?
定制开发 / 二次开发

基于 jpcaparas/rulesync 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-05