SuperAPI AI Directory

doc-sync-tool

Office & productivity

View repository

Updated 10-25 16:16

About this skill

Doc Sync Tool

Feature Description

This tool is used to automatically sync the AI Agent configuration documents in a project, ensuring that Agents.md、claude.md and gemini.md three files stay consistent in content.

Core Features

  1. Auto-discovery: Recursively scan all folders under the current directory to find these three documents
  2. Smart sync: When any one document is found, automatically create/update the other two
  3. File watching: Watch file changes in real time and automatically sync the latest content
  4. Manual trigger: Supports manual sync execution from the command line

Use Cases

  • Share the same project configuration across multiple AI Agents
  • Automatically keep the work instructions of different AIs consistent
  • Avoid the hassle of manually maintaining multiple identical documents

Usage

Install dependencies

cd /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool
pnpm install

Manual sync (single run)

# 在项目根目录执行
node /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool/sync.js

# 或者使用 npm script
pnpm run sync

Automatic watching (continuous run)

# 启动文件监听服务
node /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool/watch.js

# 或者使用 npm script
pnpm run watch

Run in background (recommended)

# 使用 PM2 在后台运行
pm2 start /Users/ben/Downloads/go\ to\ wild/auto-website-system/_skills/doc-sync-tool/watch.js --name doc-sync

# 查看状态
pm2 status

# 停止服务
pm2 stop doc-sync

How It Works

  1. Scan phase: Recursively traverse the specified directory to find Agents.md、claude.md、gemini.md files
  2. Grouping phase: Group these three files in the same folder into one group
  3. Sync phase:
    • If a group has only one file, copy its content to create the other two
    • If a group has multiple files, select the most recently modified one as the source and sync it to the other files
  4. Watch phase (watch mode): Continuously watch file changes and trigger sync

Configuration Options

You can modify the following configurations in sync.js :

const CONFIG = {
  targetFiles: ['Agents.md', 'claude.md', 'gemini.md'],  // 目标文件列表
  scanPath: process.cwd(),                                // 扫描路径(默认当前目录)
  excludeDirs: ['node_modules', '.git', '.next', 'dist'] // 排除目录
};

Notes

  • The tool automatically skips directories such as node_modules、.git、.next、dist Wait for the directory
  • The original format and content of files are preserved during sync
  • It is recommended to use it in a Git repository to make file changes easy to track
  • Watch mode runs continuously; using PM2 to manage the process is recommended

Troubleshooting

Permission issues

chmod +x sync.js watch.js

Node.js version requirement

Requires Node.js 14+

Dependency installation fails

rm -rf node_modules package-lock.json
pnpm install