Prepare wordcraft-mcp and gridcraft-mcp 0.2.0: ASCII display_name, ArtCraft docs, UTF-8 fixes.
This commit is contained in:
1 parent
73a6d3e9d0
commit
debdf92877
15 files changed
+130
-67
No files matched your search
@@ -54,9 +54,11 @@ Erwarteter Pfad: $src
|
||||
"@
|
||||
}
|
||||
|
||||
$verOut = & $src --version 2>&1 | Out-String
|
||||
if ($LASTEXITCODE -ne 0 -and $Name -eq 'gridcraft-mcp') {
|
||||
$verOut = & $src version 2>&1 | Out-String
|
||||
$verResult = Get-ProcessOutputUtf8 $src '--version'
|
||||
$verOut = $verResult.Output
|
||||
if ($verResult.ExitCode -ne 0 -and $Name -eq 'gridcraft-mcp') {
|
||||
$verResult = Get-ProcessOutputUtf8 $src 'version'
|
||||
$verOut = $verResult.Output
|
||||
}
|
||||
$ver = ''
|
||||
if ($verOut -match '(\d+\.\d+\.\d+)') { $ver = $Matches[1] }
|
||||
|
||||
+13
-2
@@ -53,9 +53,20 @@ if [[ ! -f "$ext/server/README.txt" ]]; then
|
||||
"Erwarteter Pfad: $src" > "$ext/server/README.txt"
|
||||
fi
|
||||
|
||||
ver_out="$("$src" --version 2>&1 || true)"
|
||||
# CLI-Ausgabe als UTF-8 lesen (kein Locale-Default wie Windows-1252).
|
||||
ver_out="$(PYTHONIOENCODING=utf-8 python3 -c '
|
||||
import subprocess, sys
|
||||
r = subprocess.run(sys.argv[1:], capture_output=True)
|
||||
sys.stdout.buffer.write(r.stdout)
|
||||
sys.stdout.buffer.write(r.stderr)
|
||||
' "$src" --version || true)"
|
||||
if [[ ! "$ver_out" =~ [0-9]+\.[0-9]+\.[0-9]+ ]] && [[ "$name" == gridcraft-mcp ]]; then
|
||||
ver_out="$("$src" version 2>&1 || true)"
|
||||
ver_out="$(PYTHONIOENCODING=utf-8 python3 -c '
|
||||
import subprocess, sys
|
||||
r = subprocess.run(sys.argv[1:], capture_output=True)
|
||||
sys.stdout.buffer.write(r.stdout)
|
||||
sys.stdout.buffer.write(r.stderr)
|
||||
' "$src" version || true)"
|
||||
fi
|
||||
if [[ ! "$ver_out" =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
|
||||
echo "Version der CLI nicht lesbar: $ver_out" >&2
|
||||
|
||||
+25
-3
@@ -5,16 +5,38 @@ $ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent $PSScriptRoot
|
||||
$SkillsDir = Join-Path $Root 'skills'
|
||||
$DistDir = Join-Path $Root 'dist'
|
||||
$Utf8NoBom = New-Object System.Text.UTF8Encoding $false
|
||||
$Utf8NoBom = [System.Text.UTF8Encoding]::new($false)
|
||||
|
||||
# Datei als UTF-8 lesen, Zeilenenden auf LF vereinheitlichen.
|
||||
function Read-Text([string]$Path) {
|
||||
return ([IO.File]::ReadAllText($Path, [Text.Encoding]::UTF8) -replace "`r", '')
|
||||
return ([System.IO.File]::ReadAllText($Path, [System.Text.Encoding]::UTF8) -replace "`r", '')
|
||||
}
|
||||
|
||||
# Datei als UTF-8 ohne BOM mit LF schreiben (Set-Content wuerde in 5.1 ein BOM schreiben).
|
||||
function Write-Text([string]$Path, [string]$Text) {
|
||||
[IO.File]::WriteAllText($Path, $Text, $Utf8NoBom)
|
||||
[System.IO.File]::WriteAllText($Path, $Text, $Utf8NoBom)
|
||||
}
|
||||
|
||||
# Prozess starten und stdout+stderr als UTF-8 ohne BOM lesen (kein Out-String / Default-Encoding).
|
||||
# $Arguments ist die Argumentzeile (PS 5.1 hat kein ProcessStartInfo.ArgumentList).
|
||||
function Get-ProcessOutputUtf8([string]$FileName, [string]$Arguments) {
|
||||
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$psi.FileName = $FileName
|
||||
$psi.Arguments = $Arguments
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$psi.CreateNoWindow = $true
|
||||
$psi.StandardOutputEncoding = $Utf8NoBom
|
||||
$psi.StandardErrorEncoding = $Utf8NoBom
|
||||
$p = [System.Diagnostics.Process]::Start($psi)
|
||||
$stdout = $p.StandardOutput.ReadToEnd()
|
||||
$stderr = $p.StandardError.ReadToEnd()
|
||||
$p.WaitForExit()
|
||||
return @{
|
||||
ExitCode = $p.ExitCode
|
||||
Output = ($stdout + $stderr)
|
||||
}
|
||||
}
|
||||
|
||||
function Test-Bom([string]$Path) {
|
||||
|
||||
@@ -51,6 +51,7 @@ if [[ $check -eq 1 ]]; then
|
||||
fi
|
||||
echo "README.md ist aktuell."
|
||||
else
|
||||
printf '%s\n' "$new" > "$readme"
|
||||
# Explizit UTF-8 schreiben (Locale kann sonst die README verfaelschen).
|
||||
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8",newline="\n").write(sys.stdin.read())' "$readme" <<< "$new"
|
||||
echo "README.md aktualisiert."
|
||||
fi
|
||||
Reference in new issue
Block a user