chore: switch to Low workspace and Nutstore-only publish

- build.ps1: dev build only; no copy to a fixed exe
- publish.ps1: user-run Medium publish to Nutstore
- docs: workspace stays D:\Scripts\md-preview, repo under AgentLowWorking
- .gitignore: local test/ scratch directory
This commit is contained in:
2026-11-02 01:26:49 +08:00
parent 301e042bec
commit d2b1630a35
10 changed files with 433 additions and 194 deletions

View File

@@ -1,26 +1,47 @@
#requires -Version 5.1
#requires -Version 5.1
<#
MD Preview 冒烟测试
cargo test + 关联检查 + 可选隔离启动(不污染真实 %LOCALAPPDATA%)
默认测试 Nutstore 发布版;-Dev 测试 target\release 开发版
#>
[CmdletBinding()]
param(
[string]$Exe = 'D:\Scripts\md-preview\MD-Preview-windows-x64.exe',
[switch]$Launch
[string]$Exe = 'C:\Users\wucl1\Nutstore\1\Scripts\MD-Preview-windows-x64.exe',
[switch]$Launch,
[switch]$Dev
)
$ErrorActionPreference = 'Stop'
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
Set-Location $repoRoot
$tmpRoot = Join-Path $repoRoot 'target\tmp'
New-Item -ItemType Directory -Force $tmpRoot | Out-Null
$env:TEMP = $tmpRoot
$env:TMP = $tmpRoot
$cargo = Join-Path $env:USERPROFILE '.cargo\bin\cargo.exe'
if (-not (Test-Path $cargo)) { $cargo = (Get-Command cargo -ErrorAction Stop).Source }
if (-not (Test-Path $Exe)) { throw ('missing exe: ' + $Exe + ' (先运行 agent/scripts/build.ps1)') }
if ($Dev) {
$Exe = Join-Path $repoRoot 'target\release\md-preview.exe'
if (-not $env:MD_PREVIEW_CONFIG_DIR) {
$env:MD_PREVIEW_CONFIG_DIR = Join-Path $repoRoot 'target\smoke'
New-Item -ItemType Directory -Force $env:MD_PREVIEW_CONFIG_DIR | Out-Null
}
}
if (-not (Test-Path $Exe)) {
throw ('missing exe: ' + $Exe + '(先运行 agent/scripts/build.ps1,或先发布)')
}
Write-Host '==> cargo test' -ForegroundColor Cyan
$previous = $ErrorActionPreference
$ErrorActionPreference = 'Continue'
& $cargo test
if ($LASTEXITCODE -ne 0) { throw 'cargo test failed' }
$code = $LASTEXITCODE
$ErrorActionPreference = $previous
if ($code -ne 0) { throw 'cargo test failed' }
Write-Host '==> --help' -ForegroundColor Cyan
$help = (& $Exe --help 2>&1 | Out-String)
@@ -30,20 +51,24 @@ if ($help -match 'MD Preview') {
Write-Warning '--help 无输出(GUI 子系统在部分终端下不回显,可忽略)'
}
Write-Host '==> registry association' -ForegroundColor Cyan
$reg = Get-ItemProperty 'HKCU:\Software\Classes\MDPreview.md\shell\open\command' -ErrorAction SilentlyContinue
$expected = '"' + $Exe + '" "%1"'
if ($null -eq $reg) {
Write-Warning 'ProgID 未注册(先运行一次 exe)'
} elseif ($reg.'(default)' -ne $expected) {
Write-Warning ('ProgID 指向不一致: ' + $reg.'(default)')
if ($Dev) {
Write-Host '==> registry association (skipped: Low build cannot write HKCU)' -ForegroundColor Cyan
} else {
Write-Host ' OK'
Write-Host '==> registry association' -ForegroundColor Cyan
$reg = Get-ItemProperty 'HKCU:\Software\Classes\MDPreview.md\shell\open\command' -ErrorAction SilentlyContinue
$expected = '"' + $Exe + '" "%1"'
if ($null -eq $reg) {
Write-Warning 'ProgID 未注册(先运行一次 exe)'
} elseif ($reg.'(default)' -ne $expected) {
Write-Warning ('ProgID 指向不一致: ' + $reg.'(default)')
} else {
Write-Host ' OK'
}
}
if ($Launch) {
Write-Host '==> launch with isolated config' -ForegroundColor Cyan
$config = Join-Path $env:TEMP ('mdp-smoke-' + [guid]::NewGuid().ToString('N'))
$config = Join-Path $tmpRoot ('mdp-smoke-' + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $config | Out-Null
$fixture = Join-Path $PSScriptRoot 'fixtures\long-headings.md'
$env:MD_PREVIEW_CONFIG_DIR = $config