🐛 fix(scripts): repair windows script parsing
fix powershell here-strings and help alias conflicts\nadd windows script lint test and run it in CI
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Alias('h', 'help', '?')]
|
||||
[Alias('h', '?')]
|
||||
[switch]$Help,
|
||||
|
||||
[switch]$Local,
|
||||
|
||||
+16
-15
@@ -35,21 +35,6 @@ set "GITATTR_DST=%ROOT%\.gitattributes"
|
||||
set "SYNC_GITATTR_MODE=%SYNC_GITATTR_MODE%"
|
||||
if "%SYNC_GITATTR_MODE%"=="" set "SYNC_GITATTR_MODE=append"
|
||||
|
||||
:show_help
|
||||
echo Usage:
|
||||
echo sync_standards.bat
|
||||
echo sync_standards.bat -langs tsl,cpp
|
||||
echo.
|
||||
echo Options:
|
||||
echo -langs Comma/space-separated list of languages ^(required^).
|
||||
echo -h, -help Show this help.
|
||||
echo.
|
||||
echo Env:
|
||||
echo SYNC_ROOT Target project root ^(default: git root^).
|
||||
echo AGENTS_NS Single ruleset name ^(default: tsl^).
|
||||
echo SYNC_GITATTR_MODE append^|overwrite^|block^|skip ^(default: append^).
|
||||
exit /b 0
|
||||
|
||||
set "LANG_LIST="
|
||||
:parse_args
|
||||
if "%~1"=="" goto args_done
|
||||
@@ -417,3 +402,19 @@ if exist "%GITATTR_SRC%" (
|
||||
:AfterGitAttr
|
||||
echo Done.
|
||||
endlocal
|
||||
exit /b 0
|
||||
|
||||
:show_help
|
||||
echo Usage:
|
||||
echo sync_standards.bat
|
||||
echo sync_standards.bat -langs tsl,cpp
|
||||
echo.
|
||||
echo Options:
|
||||
echo -langs Comma/space-separated list of languages ^(required^).
|
||||
echo -h, -help Show this help.
|
||||
echo.
|
||||
echo Env:
|
||||
echo SYNC_ROOT Target project root ^(default: git root^).
|
||||
echo AGENTS_NS Single ruleset name ^(default: tsl^).
|
||||
echo SYNC_GITATTR_MODE append^|overwrite^|block^|skip ^(default: append^).
|
||||
exit /b 0
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[Alias('h', 'help', '?')]
|
||||
[Alias('h', '?')]
|
||||
[switch]$Help,
|
||||
|
||||
# Sync multiple rulesets in one run:
|
||||
@@ -143,7 +143,7 @@ if ($relSnapshot) {
|
||||
|
||||
$AgentsIndex = Join-Path $AgentsRoot "index.md"
|
||||
if (-not (Test-Path $AgentsIndex)) {
|
||||
@'
|
||||
$agentsIndexContent = @'
|
||||
# .agents(多语言)
|
||||
|
||||
本目录用于存放仓库级/语言级的代理规则集。
|
||||
@@ -163,7 +163,8 @@ if (-not (Test-Path $AgentsIndex)) {
|
||||
- `.agents/cpp/index.md`(C++ 规则集入口)
|
||||
- `.agents/markdown/index.md`(Markdown 规则集入口)
|
||||
- `docs/standards/playbook/docs/`(人类开发规范快照:`tsl/`、`cpp/`、`python/`、`common/`)
|
||||
'@ | Set-Content -Path $AgentsIndex -Encoding UTF8
|
||||
'@
|
||||
Set-Content -Path $AgentsIndex -Encoding UTF8 -Value $agentsIndexContent
|
||||
Write-Host "Created .agents/index.md"
|
||||
}
|
||||
|
||||
@@ -192,11 +193,12 @@ $agentsBlock = @"
|
||||
"@
|
||||
|
||||
if (-not (Test-Path $AgentsMd)) {
|
||||
@"
|
||||
$agentsMdContent = @"
|
||||
# Agent Instructions
|
||||
|
||||
$agentsBlock
|
||||
"@ | Set-Content -Path $AgentsMd -Encoding UTF8
|
||||
"@
|
||||
Set-Content -Path $AgentsMd -Encoding UTF8 -Value $agentsMdContent
|
||||
Write-Host "Created AGENTS.md"
|
||||
} else {
|
||||
$content = Get-Content -Raw -Path $AgentsMd
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[Alias('h', 'help', '?')]
|
||||
[Alias('h', '?')]
|
||||
[switch]$Help,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[Alias('h', 'help', '?')]
|
||||
[Alias('h', '?')]
|
||||
[switch]$Help,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
|
||||
Reference in New Issue
Block a user