Files
sysconfig/agents/syncAgentRule.mjs
jtl959 372f304025 fix
2026-08-20 11:31:33 +08:00

21 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 功能:从 https://git.tic.cc/opx/sysconfig/ 同步 agents/AGENTS.md 和 agents/CLAUDE.md
// 到本项目根目录(覆盖现有文件)。
// 使用 Node 内置 fetch跨 Windows / Linux / macOS 平台,无需额外工具。
// 调用:在 package.json 的 scripts 里添加 "syncAgentRule": "node -e \"fetch('https://git.tic.cc/opx/sysconfig/raw/branch/main/agents/syncAgentRule.mjs').then(r=>{if(!r.ok)throw new Error('HTTP '+r.status);return r.text()}).then(async t=>{await import('data:text/javascript;base64,'+Buffer.from(t).toString('base64'))})\""
import { writeFile } from 'node:fs/promises';
const BASE_URL = 'https://git.tic.cc/opx/sysconfig/raw/branch/main/agents/';
const FILES = ['AGENTS.md', 'CLAUDE.md'];
for (const name of FILES) {
const response = await fetch(BASE_URL + name);
if (!response.ok) {
throw new Error(`下载 ${name} 失败: HTTP ${response.status}`);
}
await writeFile(name, await response.text());
console.log(`已同步 ${name}`);
}
console.log('agents 文件同步完成');