🔧 chore(sync_standards): create AGENTS.md on sync
This commit is contained in:
parent
283d311d4f
commit
3fe8bd7585
21
README.md
21
README.md
|
|
@ -100,6 +100,8 @@ Playbook:TSL(`.tsl`/`.tsf`)+ C++ + Python 工程规范与代理规则合
|
||||||
sh docs/standards/playbook/scripts/sync_standards.sh tsl cpp
|
sh docs/standards/playbook/scripts/sync_standards.sh tsl cpp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> 说明:若项目根目录没有 `AGENTS.md`,`sync_standards.*` 会自动生成最小版;已存在则不会覆盖。
|
||||||
|
|
||||||
3. 验收(任意满足其一即可):
|
3. 验收(任意满足其一即可):
|
||||||
|
|
||||||
- 目录存在:`.agents/tsl/`
|
- 目录存在:`.agents/tsl/`
|
||||||
|
|
@ -112,6 +114,25 @@ Playbook:TSL(`.tsl`/`.tsf`)+ C++ + Python 工程规范与代理规则合
|
||||||
- `docs/standards/playbook/`(标准快照)
|
- `docs/standards/playbook/`(标准快照)
|
||||||
- `.agents/tsl/`(落地规则集)
|
- `.agents/tsl/`(落地规则集)
|
||||||
- `.gitattributes`(managed block 更新)
|
- `.gitattributes`(managed block 更新)
|
||||||
|
- `AGENTS.md`(若本次自动生成)
|
||||||
|
|
||||||
|
#### 新项目 / 旧项目(命令示例)
|
||||||
|
|
||||||
|
新项目(无 `.agents/` 与 `AGENTS.md`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git subtree add --prefix docs/standards/playbook https://git.mytsl.cn/csh/playbook.git main --squash
|
||||||
|
sh docs/standards/playbook/scripts/sync_standards.sh tsl
|
||||||
|
```
|
||||||
|
|
||||||
|
旧项目(已有 `AGENTS.md`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git subtree pull --prefix docs/standards/playbook https://git.mytsl.cn/csh/playbook.git main --squash
|
||||||
|
sh docs/standards/playbook/scripts/sync_standards.sh tsl
|
||||||
|
```
|
||||||
|
|
||||||
|
旧项目的 `AGENTS.md` 不会被覆盖;如需指向 `.agents/`,请手动对齐内容。
|
||||||
|
|
||||||
#### 可选:项目包装脚本(多 playbook 串联)
|
#### 可选:项目包装脚本(多 playbook 串联)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,16 @@ if not exist "%AGENTS_ROOT%\index.md" (
|
||||||
echo Created .agents\index.md
|
echo Created .agents\index.md
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not exist "%ROOT%\AGENTS.md" (
|
||||||
|
> "%ROOT%\AGENTS.md" echo # Agent Instructions
|
||||||
|
>> "%ROOT%\AGENTS.md" echo.
|
||||||
|
>> "%ROOT%\AGENTS.md" echo 请以 `.agents/` 下的规则为准:
|
||||||
|
>> "%ROOT%\AGENTS.md" echo.
|
||||||
|
>> "%ROOT%\AGENTS.md" echo - 入口:`.agents/index.md`
|
||||||
|
>> "%ROOT%\AGENTS.md" echo - 语言规则:`.agents/tsl/index.md`、`.agents/cpp/index.md`、`.agents/python/index.md`
|
||||||
|
echo Created AGENTS.md
|
||||||
|
)
|
||||||
|
|
||||||
:SyncGitAttr
|
:SyncGitAttr
|
||||||
if exist "%GITATTR_SRC%" (
|
if exist "%GITATTR_SRC%" (
|
||||||
if /I "%SYNC_GITATTR_MODE%"=="skip" (
|
if /I "%SYNC_GITATTR_MODE%"=="skip" (
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,19 @@ if (-not (Test-Path $AgentsIndex)) {
|
||||||
Write-Host "Created .agents/index.md"
|
Write-Host "Created .agents/index.md"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$AgentsMd = Join-Path $Root "AGENTS.md"
|
||||||
|
if (-not (Test-Path $AgentsMd)) {
|
||||||
|
@'
|
||||||
|
# Agent Instructions
|
||||||
|
|
||||||
|
请以 `.agents/` 下的规则为准:
|
||||||
|
|
||||||
|
- 入口:`.agents/index.md`
|
||||||
|
- 语言规则:`.agents/tsl/index.md`、`.agents/cpp/index.md`、`.agents/python/index.md`
|
||||||
|
'@ | Set-Content -Path $AgentsMd -Encoding UTF8
|
||||||
|
Write-Host "Created AGENTS.md"
|
||||||
|
}
|
||||||
|
|
||||||
$GitAttrDst = Join-Path $Root ".gitattributes"
|
$GitAttrDst = Join-Path $Root ".gitattributes"
|
||||||
if (Test-Path $GitAttrSrc) {
|
if (Test-Path $GitAttrSrc) {
|
||||||
$mode = $env:SYNC_GITATTR_MODE
|
$mode = $env:SYNC_GITATTR_MODE
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,19 @@ EOF
|
||||||
echo "Created .agents/index.md"
|
echo "Created .agents/index.md"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AGENTS_MD="$ROOT/AGENTS.md"
|
||||||
|
if [ ! -f "$AGENTS_MD" ]; then
|
||||||
|
cat >"$AGENTS_MD" <<'EOF'
|
||||||
|
# Agent Instructions
|
||||||
|
|
||||||
|
请以 `.agents/` 下的规则为准:
|
||||||
|
|
||||||
|
- 入口:`.agents/index.md`
|
||||||
|
- 语言规则:`.agents/tsl/index.md`、`.agents/cpp/index.md`、`.agents/python/index.md`
|
||||||
|
EOF
|
||||||
|
echo "Created AGENTS.md"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Synced agents ruleset to $AGENTS_DST."
|
echo "Synced agents ruleset to $AGENTS_DST."
|
||||||
|
|
||||||
GITATTR_DST="$ROOT/.gitattributes"
|
GITATTR_DST="$ROOT/.gitattributes"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue