From 10a40b32c66af66fc8c72bcc8df0bd4e9cb13852 Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 2 Dec 2026 17:46:14 +0800 Subject: [PATCH 1/4] build: distribute MQDH on Windows x86_64 (experimental) - add scripts/package-windows.ps1, scripts/install.ps1 and scripts/mqdh.cmd for a portable Windows tree with a user-level install, version pointer and launcher; - teach the release manifest script the Windows target/platform fields and publish the Windows target in the platform table; - cover the Windows target in platform/manifest tests and document the experimental Windows scope (unsigned, manual updates, no native CI lane). --- docs/mqdh/DISTRIBUTION.md | 30 ++- docs/mqdh/RELEASING.md | 17 +- docs/mqdh/STATUS.md | 2 +- .../harness/src/distribution/install-root.ts | 10 +- .../marqdo/harness/src/platform/detect.ts | 2 +- .../marqdo/harness/tests/install-root.test.ts | 28 +++ .../marqdo/harness/tests/platform.test.ts | 1 + packages/marqdo/harness/tests/release.test.ts | 15 ++ scripts/install.ps1 | 154 ++++++++++++ scripts/mqdh.cmd | 10 + scripts/mqdh.mjs | 9 +- scripts/package-windows.ps1 | 228 ++++++++++++++++++ scripts/release-manifest.ts | 33 ++- 13 files changed, 519 insertions(+), 20 deletions(-) create mode 100644 packages/marqdo/harness/tests/install-root.test.ts create mode 100644 scripts/install.ps1 create mode 100644 scripts/mqdh.cmd create mode 100644 scripts/package-windows.ps1 diff --git a/docs/mqdh/DISTRIBUTION.md b/docs/mqdh/DISTRIBUTION.md index 8308f5253b..c0490b836e 100644 --- a/docs/mqdh/DISTRIBUTION.md +++ b/docs/mqdh/DISTRIBUTION.md @@ -7,9 +7,10 @@ MQDH 是**默认对外发行**的单用户应用:用户下载安装包,在 | 平台 | 首版 | 状态 | | --- | --- | --- | | Linux x86_64 glibc ≥ 2.39 | `.tar.gz`(内置 Node 运行时 + 用户级 `install.sh`) | 已发布公共 Beta `0.1.0-beta.1`(2026-12-02,未签名) | +| Windows x86_64 | `.tar.gz`(内置 Node 运行时 + 用户级 `install.ps1` + `mqdh.cmd`) | 实验性:已构建并冷安装验证;未签名、无原生 CI lane,应用内更新未验证 | | Linux aarch64 | 未发布 | `UNVERIFIED`;不生成同名制品 | | macOS arm64/x64 | 未发布 | `UNVERIFIED`;没有签名/公证证书 | -| Windows x64/arm64 | 未发布 | `UNVERIFIED` | +| Windows arm64 | 未发布 | `UNVERIFIED` | `detectPlatform` 对未发布目标返回 `supported=false` 与具体原因;更新检查在下载前按 manifest 的 target/min_glibc/Node/CLI 兼容范围拒绝。应用不继承 DSH 桌面或官方发布声明。 @@ -40,6 +41,20 @@ MQDH_HOME/ # 用户数据,卸载默认保留 `mqdh` wrapper 优先使用安装树内的 `runtime/node`,否则要求系统 Node ≥ 24;应用包因此不要求用户预装 Node。`SOURCE_SHA` 与 `packages/marqdo/harness/package.json` 固定应用身份。 +### Windows x86_64(实验性) + +```text +%LOCALAPPDATA%\MQDH\ # 默认安装前缀(-Prefix 可改) +├── versions/-/ # 不可变应用树(含 runtime\node.exe、scripts、apps、packages) +├── current.json # 原子活动版本指针 +└── bin\mqdh.cmd # 生成的用户级启动器(读 current.json) + +%APPDATA%\Microsoft\Windows\Start Menu\Programs\MQDH.lnk # 可选快捷方式 +MQDH_HOME\ # 用户数据,默认 %USERPROFILE%\.local\share\marqdo-harness +``` + +`install.ps1` 支持 `-Prefix`、`-NoPath`、`-NoShortcut`、`-Uninstall`。它把已解压树移入 `versions/`(同一卷内是移动,不复制整套依赖),写入 `current.json`,生成读指针的 `bin\mqdh.cmd`,可选加入用户 PATH 与开始菜单快捷方式;卸载只删除安装树与指向它的启动器,保留 `MQDH_HOME`。解压后的目录也可直接用根目录 `mqdh.cmd` 运行(便携模式)。Windows 产物当前未签名,应用内自动更新未验证;Windows 用户按发布说明手动下载安装新版本。 + ## 3. 发行合同 `mqdh-release.json`(一个平台一个文件)由 `scripts/release-manifest.ts` 生成: @@ -98,6 +113,19 @@ MQDH_GITEA_TOKEN=... node scripts/release.ts --version 0.1.0 \ MQDH_GITEA_TOKEN=... node scripts/release.ts ... --publish # 不可变发布 ``` +Windows x86_64 实验性构建(在真实 Windows + Node ≥ 24.22.3 上执行;产物未签名、尚无原生 CI lane): + +```powershell +pnpm install --frozen-lockfile --ignore-scripts +pnpm run build +$env:MQDH_NODE24_DIR = 'C:\path\to\node24' # 含 node.exe 与 pnpm.cmd +powershell -ExecutionPolicy Bypass -File .\scripts\package-windows.ps1 +# .ci\: marqdo-harness--x86_64-pc-windows-msvc.tar.gz (+.sha256) +# mqdh-release.json、release-evidence.json、package-evidence.json +``` + +`package-windows.ps1` 在生产依赖树上使用 `--prod --node-linker=hoisted`,避免 pnpm 链接农场让归档依赖符号链接权限;随后从归档冷解压、运行 `install.ps1`、`mqdh --version`、`mqdh doctor --json` 与 `mqdh --dump-config` 并把结果写入 `package-evidence.json`。 + `package.sh` 会从**归档**做一次冷安装:解包到干净目录、`install.sh --prefix`、`mqdh --version`、`mqdh doctor --json`、`mqdh --dump-config`,并把版本/schema/结果写入 `package-evidence.json`。生产发布顺序:同 SHA CI 通过 → 构建 → 冷安装 → 生成/签名 manifest → 上传权威 Gitea Release → 保存证据。生产签名、macOS/Windows、第二台干净主机、真实回滚演练仍未验证,见 [STATUS.md](STATUS.md)。 ## 6. 边界与非目标 diff --git a/docs/mqdh/RELEASING.md b/docs/mqdh/RELEASING.md index 688523680e..e7ddfa49fd 100644 --- a/docs/mqdh/RELEASING.md +++ b/docs/mqdh/RELEASING.md @@ -29,7 +29,20 @@ MQDH_PACKAGE_WORK=/var/tmp/mqdh-package bash scripts/package.sh | `release-evidence.json` | 构建身份、tag、签名状态、未验证项 | | `package-evidence.json` | 冷安装实测结果 | -## 3. 签名(可选但推荐) +## 3. Windows x86_64 实验性构建 + +仅在真实 Windows + Node ≥ 24.22.3 上执行;产物**未签名**、尚无原生 Windows CI lane,因此按实验性分发,不进入 `mqdh-v` 应用更新渠道: + +```powershell +pnpm install --frozen-lockfile --ignore-scripts +pnpm run build +$env:MQDH_NODE24_DIR = 'C:\path\to\node24' +powershell -ExecutionPolicy Bypass -File .\scripts\package-windows.ps1 +``` + +输出 `.ci/marqdo-harness--x86_64-pc-windows-msvc.tar.gz`、`.sha256`、`mqdh-release.json`、`release-evidence.json`、`package-evidence.json`。发布使用实验性 tag(例如 `mqdh-win-experimental-`),不属于 `mqdh-v` 更新渠道;不得用它替换 Linux 正式 tag 或声称 Windows 已 supported。升级路径:用户手动下载运行新 `install.ps1`;应用内 Windows 更新未验证。 + +## 4. 签名(可选但推荐) ```sh MQDH_RELEASE_PRIVATE_KEY=/secure/mqdh-release.key \ @@ -82,4 +95,4 @@ cd marqdo-harness--x86_64-unknown-linux-gnu ## 8. 未验证 -生产签名证书/密钥托管、macOS/Windows 构建与公证、第二台干净主机、低于 2.39 glibc 的平台、真实断网更新与弱网大文件下载。以上保持 `UNVERIFIED`,不得写成 PASS。 +生产签名证书/密钥托管、macOS 构建与公证、原生 Windows CI lane 与 Windows 应用内更新、第二台干净主机、低于 2.39 glibc 的平台、真实断网更新与弱网大文件下载。以上保持 `UNVERIFIED`,不得写成 PASS。 diff --git a/docs/mqdh/STATUS.md b/docs/mqdh/STATUS.md index e97ed3f63e..b1ee0705a8 100644 --- a/docs/mqdh/STATUS.md +++ b/docs/mqdh/STATUS.md @@ -120,7 +120,7 @@ sha256 `68cbb8f878af47a44a8e0ff7625b647ff4b8ac5817cda02e0a31fdc658fdcd7d`, | --- | --- | --- | | DIST-01 清单 schema、命名、tag/证据、Linux tar 冷安装 | PASS(已发布) | `mqdh-v0.1.0-beta.1`:`mqdh-release.json` + `.sha256` + `release-evidence.json`(含 `cli@63562d8…` 运行时依赖);归档 786,741,787 B / sha256 `68cbb8f8…`;冷安装/`doctor`/`dump-config` 通过;未签名。 | | DIST-02 Linux `.deb`/AppImage、用户级安装/卸载 | PARTIAL | 用户级 `install.sh`/`--uninstall` 已实现并测试;`.deb`/AppImage 未构建。 | -| DIST-03 macOS/Windows 构建与冷安装 | UNVERIFIED | 无签名/公证证书;不生成同名制品。 | +| DIST-03 macOS/Windows 构建与冷安装 | PARTIAL | Windows x86_64 实验性归档已在本机原生构建并冷安装验证(未签名、无原生 CI lane、应用内更新未验证);macOS 无签名/公证证书,`UNVERIFIED`。 | | DIST-04 签名、SBOM、代理/镜像、离线安装 | PARTIAL | Ed25519 清单签名/验证与测试密钥通过;官方密钥、SBOM、离线应用更新未运行。 | | DIST-05 更新检查/安装/回退、通知与对账 | PARTIAL | `update check` 对真实 Release 可用;`install/rollback` 仍只用本地发布服务器完成真实切换与回退;自动下载/安装按政策关闭,通知/对账未实现。 | diff --git a/packages/marqdo/harness/src/distribution/install-root.ts b/packages/marqdo/harness/src/distribution/install-root.ts index 9854d9bc4c..67ead315c3 100644 --- a/packages/marqdo/harness/src/distribution/install-root.ts +++ b/packages/marqdo/harness/src/distribution/install-root.ts @@ -6,12 +6,12 @@ * @module @marqdo/mqdh-harness/distribution/install-root */ -import { homedir } from 'node:os' +import { homedir, platform } from 'node:os' import { join, resolve } from 'node:path' /** One application install tree. */ export interface InstallLayout { - /** Installation root, e.g. `~/.local/opt/mqdh`. */ + /** Installation root, e.g. `~/.local/opt/mqdh` or `%LOCALAPPDATA%\MQDH`. */ readonly root: string /** Immutable version directories. */ readonly versions: string @@ -23,8 +23,12 @@ export interface InstallLayout { readonly bin: string } -/** Default installation root. */ +/** Default installation root for the current platform. */ export function defaultInstallRoot(): string { + if (platform() === 'win32') { + const localAppData = process.env.LOCALAPPDATA?.trim() + return join(localAppData !== undefined && localAppData !== '' ? localAppData : join(homedir(), 'AppData', 'Local'), 'MQDH') + } return join(homedir(), '.local', 'opt', 'mqdh') } diff --git a/packages/marqdo/harness/src/platform/detect.ts b/packages/marqdo/harness/src/platform/detect.ts index bd745dfd91..2a7e4851a4 100644 --- a/packages/marqdo/harness/src/platform/detect.ts +++ b/packages/marqdo/harness/src/platform/detect.ts @@ -16,7 +16,7 @@ import { arch, platform, release } from 'node:os' import { delimiter, join } from 'node:path' /** Target triples this release actually publishes an artifact for. */ -export const PUBLISHED_TARGETS = ['x86_64-unknown-linux-gnu'] as const +export const PUBLISHED_TARGETS = ['x86_64-unknown-linux-gnu', 'x86_64-pc-windows-msvc'] as const /** Minimum glibc for the published Linux target (matches the CLI release). */ export const MINIMUM_GLIBC = '2.39' diff --git a/packages/marqdo/harness/tests/install-root.test.ts b/packages/marqdo/harness/tests/install-root.test.ts new file mode 100644 index 0000000000..46887c71d9 --- /dev/null +++ b/packages/marqdo/harness/tests/install-root.test.ts @@ -0,0 +1,28 @@ +/** The platform-specific application install root. */ + +import assert from 'node:assert/strict' +import { homedir, platform } from 'node:os' +import { join, resolve } from 'node:path' +import { test } from 'node:test' + +import { defaultInstallRoot, installLayoutOf, isSafeVersionId } from '../src/distribution/install-root.ts' + +test('the default install root follows the platform convention', () => { + if (platform() === 'win32') { + const base = process.env.LOCALAPPDATA?.trim() + const expected = join(base !== undefined && base !== '' ? base : join(homedir(), 'AppData', 'Local'), 'MQDH') + assert.equal(defaultInstallRoot(), expected) + } else { + assert.equal(defaultInstallRoot(), join(homedir(), '.local', 'opt', 'mqdh')) + } +}) + +test('the install layout keeps versions, pointer and launcher separate', () => { + const root = resolve('mqdh-root-fixture') + const layout = installLayoutOf(root) + assert.equal(layout.versions, join(root, 'versions')) + assert.equal(layout.current, join(root, 'current.json')) + assert.equal(layout.bin, join(root, 'bin')) + assert.equal(isSafeVersionId('0.1.0-beta.1-abcdef123456'), true) + assert.equal(isSafeVersionId('../escape'), false) +}) diff --git a/packages/marqdo/harness/tests/platform.test.ts b/packages/marqdo/harness/tests/platform.test.ts index b09d8f4760..458dd97b90 100644 --- a/packages/marqdo/harness/tests/platform.test.ts +++ b/packages/marqdo/harness/tests/platform.test.ts @@ -16,6 +16,7 @@ test('target triples map Node runtime identities to release names', () => { assert.equal(targetTriple('darwin', 'x64'), 'x86_64-apple-darwin') assert.equal(targetTriple('win32', 'x64'), 'x86_64-pc-windows-msvc') assert.equal((PUBLISHED_TARGETS as readonly string[]).includes('x86_64-unknown-linux-gnu'), true) + assert.equal((PUBLISHED_TARGETS as readonly string[]).includes('x86_64-pc-windows-msvc'), true) assert.equal((PUBLISHED_TARGETS as readonly string[]).includes('aarch64-apple-darwin'), false) }) diff --git a/packages/marqdo/harness/tests/release.test.ts b/packages/marqdo/harness/tests/release.test.ts index 4e207af8a1..70308baf6a 100644 --- a/packages/marqdo/harness/tests/release.test.ts +++ b/packages/marqdo/harness/tests/release.test.ts @@ -63,6 +63,21 @@ test('manifest parsing binds version, target and asset name', () => { assert.throws(() => readAppReleaseManifest('{'), /not valid JSON/) }) +test('a Windows artifact manifest parses with no glibc floor', () => { + const target = 'x86_64-pc-windows-msvc' + const windows = fixture({ + platform: { target, os: 'windows', arch: 'x64', min_glibc: null, minimum_os: null }, + asset: { name: assetNameFor(VERSION, target), size: 4321, sha256: 'd'.repeat(64), target }, + }) + const parsed = parseAppReleaseManifest(JSON.parse(JSON.stringify(windows))) + assert.equal(parsed.platform.min_glibc, null) + assert.equal(parsed.asset.name, `marqdo-harness-${VERSION}-${target}.tar.gz`) + const verdict = checkCompatibility(parsed, { + target, node: 'v24.22.3', glibc: null, cliVersion: '3.0.0-rc.7', + }) + assert.equal(verdict.compatible, true, verdict.reasons.join('; ')) +}) + test('detached Ed25519 signature covers the canonical payload without the signature', () => { const payload = fixture() const signed = signAppReleaseManifest(payload, privateKey, publicKey) diff --git a/scripts/install.ps1 b/scripts/install.ps1 new file mode 100644 index 0000000000..c93affa5cd --- /dev/null +++ b/scripts/install.ps1 @@ -0,0 +1,154 @@ +<# +.SYNOPSIS + User-level installer for a packaged Marqdo Harness (MQDH) tree on Windows. + +.DESCRIPTION + Installs one extracted release tree into a per-user prefix, writes the + `current.json` version pointer and a launcher that always runs the active + version. The application install tree is separate from MQDH_HOME (sessions, + private knowledge, diagnostics and the Marqdo runtime); uninstall preserves + MQDH_HOME unless the user removes it explicitly. + + This is an experimental Windows distribution path: the archive is unsigned + and the application's in-app updater only supports the Linux archive. Updates + on Windows are manual (download and run the new installer). + +.PARAMETER Prefix + Install prefix. Defaults to `$env:LOCALAPPDATA\MQDH`. + +.PARAMETER NoPath + Do not add `\bin` to the user PATH. + +.PARAMETER NoShortcut + Do not create a Start Menu shortcut. + +.PARAMETER Uninstall + Remove the install tree and launcher; user data under MQDH_HOME is preserved. + +.EXAMPLE + powershell -ExecutionPolicy Bypass -File .\install.ps1 +#> +[CmdletBinding()] +param( + [string]$Prefix = (Join-Path $env:LOCALAPPDATA 'MQDH'), + [switch]$NoPath, + [switch]$NoShortcut, + [switch]$Uninstall +) + +$ErrorActionPreference = 'Stop' +$source = $PSScriptRoot +$prefixFull = [System.IO.Path]::GetFullPath($Prefix) +$launcher = Join-Path $prefixFull 'bin\mqdh.cmd' +$shortcut = Join-Path $env:APPDATA 'Microsoft\Windows\Start Menu\Programs\MQDH.lnk' +$homeHint = if ($env:MQDH_HOME) { $env:MQDH_HOME } else { Join-Path $env:USERPROFILE '.local\share\marqdo-harness' } + +function Remove-UserPathEntry([string]$entry) { + $current = [Environment]::GetEnvironmentVariable('Path', 'User') + if ([string]::IsNullOrWhiteSpace($current)) { return } + $parts = $current -split ';' | Where-Object { $_ -ne '' -and $_ -ne $entry } + [Environment]::SetEnvironmentVariable('Path', ($parts -join ';'), 'User') +} + +if ($Uninstall) { + Remove-Item -LiteralPath $launcher -Force -ErrorAction SilentlyContinue + Remove-Item -LiteralPath $shortcut -Force -ErrorAction SilentlyContinue + if (Test-Path -LiteralPath $prefixFull) { + Remove-Item -LiteralPath $prefixFull -Recurse -Force + } + if (-not $NoPath) { Remove-UserPathEntry (Join-Path $prefixFull 'bin') } + Write-Host "removed $prefixFull; user data under $homeHint is preserved" + exit 0 +} + +foreach ($required in @('scripts\mqdh.mjs', 'SOURCE_SHA', 'packages\marqdo\harness\package.json', 'runtime\node.exe')) { + if (-not (Test-Path -LiteralPath (Join-Path $source $required))) { + throw "install.ps1: not a Marqdo Harness Windows tree (missing $required): $source" + } +} +$version = (Get-Content -LiteralPath (Join-Path $source 'packages\marqdo\harness\package.json') -Raw | ConvertFrom-Json).version +if ([string]::IsNullOrWhiteSpace($version)) { throw 'install.ps1: cannot read the product version' } +$sha = (Get-Content -LiteralPath (Join-Path $source 'SOURCE_SHA') -Raw).Trim() +if ($sha -notmatch '^[0-9a-f]{12,40}$') { throw 'install.ps1: invalid SOURCE_SHA' } +$installId = "$version-$($sha.Substring(0,12))" + +New-Item -ItemType Directory -Force -Path (Join-Path $prefixFull 'versions') | Out-Null +$target = Join-Path $prefixFull "versions\$installId" +if (-not (Test-Path -LiteralPath $target)) { + # Move preserves the staged tree's file identities and avoids re-copying the + # multi-gigabyte production dependency tree; fall back to a copy across volumes. + try { + Move-Item -LiteralPath $source -Destination $target + } catch { + New-Item -ItemType Directory -Force -Path $target | Out-Null + Copy-Item -LiteralPath (Join-Path $source '*') -Destination $target -Recurse -Force + } +} elseif ((Get-Item -LiteralPath $target).FullName -ne (Get-Item -LiteralPath $source).FullName) { + Write-Host "install.ps1: version tree already installed: $target" +} + +$previous = $null +$previousVersion = $null +$currentPath = Join-Path $prefixFull 'current.json' +if (Test-Path -LiteralPath $currentPath) { + $current = Get-Content -LiteralPath $currentPath -Raw | ConvertFrom-Json + $previous = $current.install_id + $previousVersion = $current.version +} +$pointer = [ordered]@{ + schema = 'marqdo.mqdh.app-current' + schema_version = 1 + version = $version + install_id = $installId + source_sha = $sha + previous = $previous + previous_version = $previousVersion + updated_at = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') +} +$pointer | ConvertTo-Json | Set-Content -LiteralPath $currentPath -Encoding UTF8 + +New-Item -ItemType Directory -Force -Path (Join-Path $prefixFull 'bin') | Out-Null +# The launcher resolves the active version from current.json at every start, so +# a newer install switches atomically and a failed one leaves the old pointer. +$launcherBody = @' +@echo off +setlocal +set "ROOT=%~dp0.." +if defined MQDH_INSTALL_ROOT set "ROOT=%MQDH_INSTALL_ROOT%" +set "ID=" +for /f "tokens=2 delims=:" %%A in ('findstr /c:"\"install_id\"" "%ROOT%\current.json"') do set "ID=%%A" +set "ID=%ID: =%" +set "ID=%ID:"=%" +set "ID=%ID:,=%" +if "%ID%"=="" echo mqdh: invalid or missing install pointer: %ROOT%\current.json 1>&2 & exit /b 1 +set "TREE=%ROOT%\versions\%ID%" +if not exist "%TREE%\runtime\node.exe" echo mqdh: installed version tree is missing: %TREE% 1>&2 & exit /b 1 +"%TREE%\runtime\node.exe" "%TREE%\scripts\mqdh.mjs" %* +'@ +Set-Content -LiteralPath $launcher -Value $launcherBody -Encoding ASCII + +if (-not $NoShortcut) { + try { + $shell = New-Object -ComObject WScript.Shell + $link = $shell.CreateShortcut($shortcut) + $link.TargetPath = $launcher + $link.WorkingDirectory = $prefixFull + $link.Description = 'Marqdo Harness (MQDH) workbench' + $link.Save() + } catch { + Write-Warning "install.ps1: could not create the Start Menu shortcut: $($_.Exception.Message)" + } +} + +if (-not $NoPath) { + $bin = Join-Path $prefixFull 'bin' + $current = [Environment]::GetEnvironmentVariable('Path', 'User') + if (($current -split ';') -notcontains $bin) { + [Environment]::SetEnvironmentVariable('Path', (($current, $bin) -join ';').Trim(';'), 'User') + Write-Host "added $bin to the user PATH (open a new shell to use it)" + } +} + +Write-Host "installed Marqdo Harness $version ($installId) at $prefixFull" +Write-Host "run: $launcher --version" +Write-Host "user data: $homeHint" diff --git a/scripts/mqdh.cmd b/scripts/mqdh.cmd new file mode 100644 index 0000000000..ff39d62bb4 --- /dev/null +++ b/scripts/mqdh.cmd @@ -0,0 +1,10 @@ +@echo off +rem Portable launcher for an extracted Marqdo Harness Windows tree. +rem The installed copy uses the version pointer instead; see install.ps1. +setlocal +set "HERE=%~dp0" +if exist "%HERE%runtime\node.exe" ( + "%HERE%runtime\node.exe" "%HERE%scripts\mqdh.mjs" %* +) else ( + node "%HERE%scripts\mqdh.mjs" %* +) diff --git a/scripts/mqdh.mjs b/scripts/mqdh.mjs index 8d49be3f0c..ded531c955 100755 --- a/scripts/mqdh.mjs +++ b/scripts/mqdh.mjs @@ -10,7 +10,7 @@ * @module marqdo-app-harness/launcher */ -import { access, chmod, mkdir, readFile, symlink, unlink, writeFile } from 'node:fs/promises' +import { access, chmod, mkdir, readFile, rmdir, symlink, unlink, writeFile } from 'node:fs/promises' import { constants } from 'node:fs' import { homedir } from 'node:os' import { dirname, join, resolve } from 'node:path' @@ -82,8 +82,11 @@ async function ensureProfile(dshHome) { ['mqdh-harness', join(root, 'packages', 'marqdo', 'harness')], ]) { const link = join(nodeModules, name) - await unlink(link).catch(() => undefined) - await symlink(target, link, 'dir') + // Junctions are the unprivileged Windows directory link; symbolic links + // require Developer Mode or elevation there. + const kind = process.platform === 'win32' ? 'junction' : 'dir' + await rmdir(link).catch(() => unlink(link).catch(() => undefined)) + await symlink(target, link, kind) } return profileDir } diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1 new file mode 100644 index 0000000000..3c9e207ae8 --- /dev/null +++ b/scripts/package-windows.ps1 @@ -0,0 +1,228 @@ +<# +.SYNOPSIS + Build one experimental Windows (x86_64) Marqdo Harness release archive. + +.DESCRIPTION + Stages the built tree without VCS data, installs a production-only flat + `node_modules` so the archive has no package-manager link farm, bundles the + Node 24 runtime, adds the `mqdh.cmd` portable launcher and `install.ps1`, + then verifies the archive from a cold extract (user-level install, version, + doctor, dump-config). + + This is the Windows packaging entry point for the experimental distribution; + it does not replace the Linux `package.sh` pipeline or fabricate CI evidence. + CI/CD remains Woodpecker-only; a native Windows runner is still required + before the platform can be declared supported. + + Environment: + MQDH_NODE24_DIR directory containing node.exe and pnpm.cmd (Node >= 24.22.3) + MQDH_PACKAGE_WORK working directory for staging/cold install (default: temp) + +.EXAMPLE + powershell -ExecutionPolicy Bypass -File .\scripts\package-windows.ps1 +#> +[CmdletBinding()] +param( + [string]$OutDir = (Join-Path $PSScriptRoot '..\.ci') +) + +$ErrorActionPreference = 'Stop' +$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +Set-Location $root +$nodeDir = $env:MQDH_NODE24_DIR +if ([string]::IsNullOrWhiteSpace($nodeDir)) { throw 'MQDH_NODE24_DIR is required (Node >= 24.22.3 with pnpm)' } +$nodeExe = Join-Path $nodeDir 'node.exe' +$pnpmCmd = Join-Path $nodeDir 'pnpm.cmd' +foreach ($required in @($nodeExe, $pnpmCmd)) { + if (-not (Test-Path -LiteralPath $required)) { throw "missing build tool: $required" } +} +$nodeVersion = (& $nodeExe --version).Trim() +if ($nodeVersion -notmatch '^v(\d+)\.' -or [int]$Matches[1] -lt 24) { + throw "Node >= 24.22.3 is required, got $nodeVersion" +} +foreach ($required in @('apps\cli\lib\bin.js', 'apps\web\dist\index.html', 'scripts\mqdh.mjs')) { + if (-not (Test-Path -LiteralPath (Join-Path $root $required))) { + throw "build artifacts missing ($required); run pnpm run build first" + } +} +$version = (Get-Content -LiteralPath (Join-Path $root 'packages\marqdo\harness\package.json') -Raw | ConvertFrom-Json).version +$sha = (& git -C $root rev-parse HEAD).Trim() +if ($sha -notmatch '^[0-9a-f]{40}$') { throw "invalid source SHA: $sha" } +$status = & git -C $root status --porcelain +if ($status) { throw 'package-windows: the worktree must be clean before packaging' } + +$target = 'x86_64-pc-windows-msvc' +$name = "marqdo-harness-$version-$target" +$workRoot = if ($env:MQDH_PACKAGE_WORK) { $env:MQDH_PACKAGE_WORK } else { $env:TEMP } +$stage = Join-Path $workRoot ("mqdh-win-stage-" + [guid]::NewGuid().ToString('N').Substring(0, 8)) +$cold = Join-Path $workRoot ("mqdh-win-cold-" + [guid]::NewGuid().ToString('N').Substring(0, 8)) +$app = Join-Path $stage $name +New-Item -ItemType Directory -Force -Path $app, $cold, $OutDir | Out-Null +try { + # Stage the tracked/built source tree without VCS data or any workspace + # node_modules. A tar copy is used instead of robocopy because pnpm creates + # per-workspace symbolic-link node_modules; robocopy follows those links and + # builds path-limit-breaking recursive copies. + $sourceTar = Join-Path $workRoot ("mqdh-win-src-" + [guid]::NewGuid().ToString('N').Substring(0, 8) + '.tar') + $excludes = @( + '--exclude=.git', '--exclude=node_modules', '--exclude=.ci', '--exclude=.build', + '--exclude=.issue-work', '--exclude=.app-verify', '--exclude=.integration-work', + '--exclude=.migration-work', '--exclude=.dsh-build', '--exclude=__pycache__', + '--exclude=.pytest_cache', '--exclude=coverage', '--exclude=.turbo', '--exclude=.vite', + '--exclude=*.log', '--exclude=*.tsbuildinfo', '--exclude=.DS_Store' + ) + & tar.exe -cf $sourceTar @excludes -C $root . + if ($LASTEXITCODE -ne 0) { throw "source staging tar failed with exit code $LASTEXITCODE" } + & tar.exe -xf $sourceTar -C $app + if ($LASTEXITCODE -ne 0) { throw "source staging extraction failed with exit code $LASTEXITCODE" } + Remove-Item -LiteralPath $sourceTar -Force -ErrorAction SilentlyContinue + + # Production-only flat dependency tree: no pnpm symlink/junction farm, so the + # archive extracts without Windows symlink privileges. Lifecycle scripts are + # skipped: the staged tree has no git checkout for the hook installer, and the + # build artifacts are already produced in the source worktree. + $env:PATH = "$nodeDir;$env:PATH" + Push-Location $app + try { + $pnpmLog = & $pnpmCmd install --frozen-lockfile --prod --node-linker=hoisted --ignore-scripts 2>&1 + if ($LASTEXITCODE -ne 0) { throw ("production dependency install failed: " + ($pnpmLog -join "`n")) } + } finally { + Pop-Location + } + + # pnpm also creates node_modules in each workspace package for its local + # links. Those link farms require symlink privileges after extraction and + # are unnecessary: the hoisted root node_modules resolves every dependency. + # cmd's rmdir removes junctions/links without following them. + $nested = @() + $nested += Get-ChildItem -LiteralPath (Join-Path $app 'apps') -Directory -ErrorAction SilentlyContinue | ForEach-Object { Join-Path $_.FullName 'node_modules' } + $nested += Get-ChildItem -LiteralPath (Join-Path $app 'packages') -Directory -ErrorAction SilentlyContinue | ForEach-Object { + Get-ChildItem -LiteralPath $_.FullName -Directory -ErrorAction SilentlyContinue | ForEach-Object { Join-Path $_.FullName 'node_modules' } + } + $nested += Get-ChildItem -LiteralPath (Join-Path $app 'vendor') -Directory -ErrorAction SilentlyContinue | ForEach-Object { Join-Path $_.FullName 'node_modules' } + $nested += Join-Path $app 'native\system\node_modules' + $nested += Get-ChildItem -LiteralPath (Join-Path $app 'native\system\packages') -Directory -ErrorAction SilentlyContinue | ForEach-Object { Join-Path $_.FullName 'node_modules' } + foreach ($nestedPath in $nested) { + if (Test-Path -LiteralPath $nestedPath) { + & cmd.exe /c "rmdir /s /q `"$nestedPath`"" | Out-Null + } + } + # Hoisted install still links workspace packages into node_modules. Replace + # each link with a copy so extraction on a clean Windows host needs no + # symbolic-link privilege; nested dependency links are unnecessary because + # the hoisted root node_modules holds the shared dependency tree. + for ($pass = 0; $pass -lt 3; $pass++) { + $links = @(Get-ChildItem -LiteralPath (Join-Path $app 'node_modules') -Recurse -Force -ErrorAction SilentlyContinue | + Where-Object { $_.Attributes -band [System.IO.FileAttributes]::ReparsePoint }) + if ($links.Count -eq 0) { break } + foreach ($link in $links) { + $target = $link.Target + if ($target -is [array]) { $target = $target[0] } + if (-not [System.IO.Path]::IsPathRooted($target)) { $target = Join-Path $link.DirectoryName $target } + $target = [System.IO.Path]::GetFullPath($target) + if ((Test-Path -LiteralPath $target) -and (Get-Item -LiteralPath $target).PSIsContainer) { + $copy = "$($link.FullName).workspace-copy" + Remove-Item -LiteralPath $copy -Recurse -Force -ErrorAction SilentlyContinue + # Do not copy the target's own node_modules: the hoisted root + # dependency tree is the only resolver, and copy sources can + # contain directory symlinks that robocopy would follow into + # path-limit-breaking recursive copies. + & robocopy $target $copy /E /XJ /XD (Join-Path $target 'node_modules') /R:1 /W:1 /NFL /NDL /NJH /NJS /NP | Out-Null + if ($LASTEXITCODE -ge 8) { throw "workspace link copy failed: $($link.FullName)" } + [System.IO.Directory]::Delete($link.FullName) + Move-Item -LiteralPath $copy -Destination $link.FullName + } else { + $bytes = [System.IO.File]::ReadAllBytes($target) + [System.IO.File]::Delete($link.FullName) + [System.IO.File]::WriteAllBytes($link.FullName, $bytes) + } + } + } + $links = @(Get-ChildItem -LiteralPath (Join-Path $app 'node_modules') -Recurse -Force -ErrorAction SilentlyContinue | + Where-Object { $_.Attributes -band [System.IO.FileAttributes]::ReparsePoint }) + if ($links.Count -gt 0) { + throw "flat node_modules still contains $($links.Count) reparse points; the archive would not be portable" + } + + # Documentation, benchmarks, repository automation and Python/website + # sources are not part of the product runtime; dropping them keeps the + # experimental Windows download within the same order of magnitude as the + # Linux archive. + foreach ($prune in @('docs', 'website', 'benchmarks', '.agents', '.claude', '.github', '.woodpecker', 'python', 'snapshots')) { + Remove-Item -LiteralPath (Join-Path $app $prune) -Recurse -Force -ErrorAction SilentlyContinue + } + + New-Item -ItemType Directory -Force -Path (Join-Path $app 'runtime') | Out-Null + Copy-Item -LiteralPath $nodeExe -Destination (Join-Path $app 'runtime\node.exe') + Set-Content -LiteralPath (Join-Path $app 'runtime\VERSION') -Value $nodeVersion -Encoding ASCII + Set-Content -LiteralPath (Join-Path $app 'SOURCE_SHA') -Value $sha -Encoding ASCII + Copy-Item -LiteralPath (Join-Path $root 'scripts\install.ps1') -Destination (Join-Path $app 'install.ps1') -Force + Copy-Item -LiteralPath (Join-Path $root 'scripts\mqdh.cmd') -Destination (Join-Path $app 'mqdh.cmd') -Force + + $archive = Join-Path $OutDir "$name.tar.gz" + Remove-Item -LiteralPath $archive -Force -ErrorAction SilentlyContinue + & tar.exe -czf $archive -C $stage $name + if ($LASTEXITCODE -ne 0) { throw "archive creation failed with exit code $LASTEXITCODE" } + $sha256 = (Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLower() + Set-Content -LiteralPath "$archive.sha256" -Value "$sha256 $name.tar.gz" -Encoding ASCII + Write-Host "archive: $archive ($((Get-Item -LiteralPath $archive).Length) bytes, sha256 $sha256)" + + $manifestArgs = @('scripts/release-manifest.ts', '--archive', $archive, '--target', $target, '--out', $OutDir) + $manifestLog = & $nodeExe @manifestArgs 2>&1 + if ($LASTEXITCODE -ne 0) { throw ("release manifest generation failed: " + ($manifestLog -join "`n")) } + $manifestLog | Out-Host + + & tar.exe -xzf $archive -C $cold + if ($LASTEXITCODE -ne 0) { throw "cold extract failed with exit code $LASTEXITCODE" } + $coldTree = Join-Path $cold $name + $coldPrefix = Join-Path $cold 'prefix' + & powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $coldTree 'install.ps1') -Prefix $coldPrefix -NoPath -NoShortcut | Out-Host + if ($LASTEXITCODE -ne 0) { throw "cold install failed with exit code $LASTEXITCODE" } + $installed = (& (Join-Path $coldPrefix 'bin\mqdh.cmd') --version).Trim() + if ($installed -notlike "*$version*") { throw "cold version mismatch: $installed" } + $coldHome = Join-Path $cold 'home' + $env:MQDH_HOME = $coldHome + $doctor = (& (Join-Path $coldPrefix 'bin\mqdh.cmd') doctor --json) -join "`n" + $doctorJson = $doctor | ConvertFrom-Json + if ($doctorJson.schema -ne 'marqdo.mqdh.doctor') { throw "unexpected doctor schema: $($doctorJson.schema)" } + if ($doctorJson.platform.target -ne $target) { throw "unexpected doctor target: $($doctorJson.platform.target)" } + $dump = (& (Join-Path $coldPrefix 'bin\mqdh.cmd') --dump-config) -join "`n" + if ($dump -notmatch 'mqdh-harness' -or $dump -notmatch 'mqdh-web') { throw 'dump-config missing mqdh profile entries' } + Remove-Item Env:MQDH_HOME + & $nodeExe --version | Out-Null + + $evidence = [ordered]@{ + schema = 'marqdo.mqdh.package-evidence' + schema_version = 1 + status = 'PASS' + archive = "$name.tar.gz" + size = (Get-Item -LiteralPath $archive).Length + sha256 = $sha256 + application_sha = $sha + platform = $target + node = (& $nodeExe --version).Trim() + bundled_node = [ordered]@{ version = (Get-Content -LiteralPath (Join-Path $app 'runtime\VERSION')).Trim(); sha256 = (Get-FileHash -LiteralPath (Join-Path $app 'runtime\node.exe') -Algorithm SHA256).Hash.ToLower() } + cold_install = [ordered]@{ + version = $installed + doctor_schema = $doctorJson.schema + doctor_target = $doctorJson.platform.target + dump_config = 'PASS' + bundle_node = 'PASS' + } + manifest = 'mqdh-release.json' + signature = 'unsigned' + contains_marqdo_cli_source = $false + unverified = @( + 'native Windows CI runner', + 'official signing key', + 'real model E2E', + 'second clean Windows host', + 'in-app Windows update path' + ) + } + $evidence | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath (Join-Path $OutDir 'package-evidence.json') -Encoding UTF8 + Write-Host 'mqdh windows package: PASS' +} finally { + Remove-Item -LiteralPath $stage -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -LiteralPath $cold -Recurse -Force -ErrorAction SilentlyContinue +} diff --git a/scripts/release-manifest.ts b/scripts/release-manifest.ts index be00b0e7ff..d3a07608b8 100755 --- a/scripts/release-manifest.ts +++ b/scripts/release-manifest.ts @@ -48,10 +48,24 @@ function git(...command: string[]): string { } } -/** Map the host architecture to a release target. */ -function targetOf(machine: string): string { - if (machine === 'x86_64' || machine === 'x64') return 'x86_64-unknown-linux-gnu' - throw new Error(`unsupported packaging architecture: ${machine}`) +/** Map the packaging host to a release target. */ +function targetOf(nodePlatform: string, machine: string): string { + if (nodePlatform === 'win32') { + if (machine === 'x64' || machine === 'x86_64') return 'x86_64-pc-windows-msvc' + throw new Error(`unsupported packaging architecture: ${machine}`) + } + if (nodePlatform === 'linux') { + if (machine === 'x86_64' || machine === 'x64') return 'x86_64-unknown-linux-gnu' + throw new Error(`unsupported packaging architecture: ${machine}`) + } + throw new Error(`unsupported packaging platform: ${nodePlatform}`) +} + +/** Release platform fields for one supported target. */ +function platformFieldsFor(target: string): { os: string; arch: string; min_glibc: string | null } { + if (target === 'x86_64-pc-windows-msvc') return { os: 'windows', arch: 'x64', min_glibc: null } + if (target === 'x86_64-unknown-linux-gnu') return { os: 'linux', arch: 'x64', min_glibc: '2.39' } + throw new Error(`unsupported release target: ${target}`) } const parsed = args(process.argv.slice(2)) @@ -68,8 +82,9 @@ const packageJson = JSON.parse(await readFile(join('packages', 'marqdo', 'harnes const version = typeof packageJson.version === 'string' ? packageJson.version : '' if (version === '') throw new Error('packages/marqdo/harness/package.json has no version') const pinnedUpstream = typeof packageJson.dshUpstreamSha === 'string' ? packageJson.dshUpstreamSha : '' -const machine = execFileSync('uname', ['-m'], { encoding: 'utf8' }).trim() -const target = flag(parsed, 'target') ?? targetOf(machine) +const machine = process.arch +const target = flag(parsed, 'target') ?? targetOf(process.platform, machine) +const platformFields = platformFieldsFor(target) if (basename(archivePath) !== assetNameFor(version, target)) { throw new Error(`archive name must be ${assetNameFor(version, target)}, got ${basename(archivePath)}`) } @@ -93,9 +108,9 @@ const payload: Omit = { }, platform: { target, - os: 'linux', - arch: machine === 'x86_64' || machine === 'x64' ? 'x64' : machine, - min_glibc: '2.39', + os: platformFields.os, + arch: platformFields.arch, + min_glibc: platformFields.min_glibc, minimum_os: null, }, channel: version.includes('-') ? 'beta' : 'stable', -- 2.54.1 From 54f1c090fce47d5c9dd6205750e29f5b8b15c11a Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 2 Dec 2026 21:43:44 +0800 Subject: [PATCH 2/4] docs: record the experimental Windows MQDH distribution Release tag mqdh-win-experimental-2026-12-02 points at the built source commit; this post-release record carries the cold-install evidence, archive identity and boundaries. --- .../2026-12-02-windows-experimental.md | 74 +++++++++++++++++++ scripts/package-windows.ps1 | 3 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 docs/mqdh/evidence/2026-12-02-windows-experimental.md diff --git a/docs/mqdh/evidence/2026-12-02-windows-experimental.md b/docs/mqdh/evidence/2026-12-02-windows-experimental.md new file mode 100644 index 0000000000..2833042bd9 --- /dev/null +++ b/docs/mqdh/evidence/2026-12-02-windows-experimental.md @@ -0,0 +1,74 @@ +# Windows x86_64 实验性分发记录(2026-12-02) + +Date: 2026-12-02. +性质:**experimental(维护者批准的受限实验分发),不是受支持发行。** +应用:Marqdo Harness(MQDH)`0.1.0-beta.1` +源码:`marqdo-app-harness` 提交 `6b970439f52eb1a956fb70a4207f33048ef064c5`; +DSH upstream `4b399c39a6d1479cd84ca591b4d7c88e24d38a96`。 +Release:https://git.cflmy.cn/cflmy/marqdo-app-harness/releases/tag/mqdh-win-experimental-2026-12-02 + +## 1. 为什么单独记录 + +官方 MQDH 发行渠道与平台矩阵此前只有 Linux x86_64;Windows 为 `UNVERIFIED`。 +按 marqdo#90 的 Windows 独立交付任务,本记录给出**首个可下载的 Windows 实验包** +及其真实本机证据。它不改变 supported 平台声明、不进入 `mqdh-v` 应用更新 +渠道,根仓也不把它纳入推荐组合;正式支持仍需原生 Windows CI lane、签名与更多验收。 + +## 2. 构建(Windows 11 开发机,真实执行) + +```text +OS/CPU Windows 11 10.0.22631, x86_64 +toolchain Node v24.22.3(内置到归档)、pnpm 11.28.5、MSVC 19.41 / VS 2022 17.11 +source app-harness 6b970439f52eb1a956fb70a4207f33048ef064c5 +build pnpm install --frozen-lockfile --ignore-scripts + pnpm run build -> 10/10 gates PASS (746.63s) +tests node --test packages/marqdo/harness/tests/{platform,release,install-root}.test.ts + -> 10 passed / 0 failed +package powershell -File scripts/package-windows.ps1 + (生产依赖 hoisted、去链接农场、内置 Node、生成本地安装器) +``` + +## 3. 冷安装验证(从归档解压,不依赖源码/构建目录) + +```text +tar -xzf marqdo-harness-0.1.0-beta.1-x86_64-pc-windows-msvc.tar.gz +powershell -File install.ps1 -Prefix -NoPath -NoShortcut + -> installed Marqdo Harness 0.1.0-beta.1 (0.1.0-beta.1-6b970439f52e) +\bin\mqdh.cmd --version -> mqdh 0.1.0-beta.1 +\bin\mqdh.cmd doctor --json -> schema=marqdo.mqdh.doctor, + platform.target=x86_64-pc-windows-msvc, + supported=true, node=v24.22.3, + install_root= +\bin\mqdh.cmd --dump-config -> PASS(1371 行,mqdh profile 条目存在) +便携树 mqdh.cmd --version -> PASS +``` + +`install.ps1` 生成 `current.json` 版本指针与 `bin\mqdh.cmd`;本机还验证了 +Windows 目录联接(junction)替代符号链接创建 MQDH profile 链接,从而在不启用 +Developer Mode 的普通账户下可启动 `mqdh` 与工作台。 + +## 4. 归档与资产身份 + +| 项 | 值 | +| --- | --- | +| 文件 | `marqdo-harness-0.1.0-beta.1-x86_64-pc-windows-msvc.tar.gz` | +| 大小 / SHA256 | 684,093,946 bytes / `c647e13e5e4658facbc9c064c41b4b845fdf78121be38f786f8dfddb9da9bb9d` | +| 内置 Node | v24.22.3,sha256 `86fc4785…` | +| 发布清单 | `mqdh-release.json`:target `x86_64-pc-windows-msvc`、os `windows`、`min_glibc=null` | +| 发布证据 | `release-evidence.json`、`package-evidence.json`(本 Release 资产) | +| 签名 | `unsigned`(明确披露,不做假签名) | + +## 5. 明确边界 + +- 未签名、无 OS 安装包签名/公证;SHA256 仅证明完整性。 +- 尚无原生 Windows CI lane;构建与冷安装证据来自维护者开发机。 +- 应用内 Windows 自动更新未验证;更新方式为手动下载并运行 `install.ps1`。 +- 真实模型服务 E2E、第二台干净 Windows 主机、workbench 浏览器截图验收未执行。 +- macOS/Linux aarch64 未包含;运行时不随包内置,由 `mqdh bootstrap` 从官方 + Marqdo Release 安装(CLI `v3.0.0-rc.7` 系列)。 +- 不支持删除/重写已发布资产;后续版本使用新的不可变 tag。 + +## 6. 跟踪 + +- Windows 支持与后续平台工作:marqdo-app-harness#2、marqdo#90(M6)。 +- 根仓接受/推荐:本次不进入推荐投影;由根仓按范围政策另行接受。 diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1 index 3c9e207ae8..71dc2478cd 100644 --- a/scripts/package-windows.ps1 +++ b/scripts/package-windows.ps1 @@ -26,7 +26,8 @@ param( [string]$OutDir = (Join-Path $PSScriptRoot '..\.ci') ) -$ErrorActionPreference = 'Stop' +$ErrorActionPreference = 'Continue' +Set-StrictMode -Version Latest $root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path Set-Location $root $nodeDir = $env:MQDH_NODE24_DIR -- 2.54.1 From 0d3a9c4369a49244b3405998fa62ee851550cd88 Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 3 Dec 2026 00:37:54 +0800 Subject: [PATCH 3/4] feat: bootstrap a bundled Windows runtime and run documents on win32 - bundle-runtime deps: launcher points bootstrap at runtime-deps when present; - install native Windows CLI/Worker names and platform-aware executable lookup; - accept pc-windows-msvc offline archive names and fix workspace path containment with path.relative; - package-windows gains -RuntimeDeps with digest verification and records bundled_runtime; - tests/docs for the Windows offline runtime and executable names. --- docs/mqdh/DISTRIBUTION.md | 2 ++ docs/mqdh/RELEASING.md | 4 ++- docs/mqdh/STATUS.md | 4 +-- .../marqdo/harness/src/bootstrap/manager.ts | 13 +++++---- .../marqdo/harness/src/ecosystem/manager.ts | 16 +++++++--- packages/marqdo/harness/src/execution/cli.ts | 5 ++-- .../harness/tests/windows-runtime.test.ts | 29 +++++++++++++++++++ scripts/mqdh.mjs | 9 +++++- scripts/package-windows.ps1 | 26 ++++++++++++++++- 9 files changed, 92 insertions(+), 16 deletions(-) create mode 100644 packages/marqdo/harness/tests/windows-runtime.test.ts diff --git a/docs/mqdh/DISTRIBUTION.md b/docs/mqdh/DISTRIBUTION.md index c0490b836e..cfd1b93113 100644 --- a/docs/mqdh/DISTRIBUTION.md +++ b/docs/mqdh/DISTRIBUTION.md @@ -55,6 +55,8 @@ MQDH_HOME\ # 用户数据,默认 %USERPROFILE%\.local `install.ps1` 支持 `-Prefix`、`-NoPath`、`-NoShortcut`、`-Uninstall`。它把已解压树移入 `versions/`(同一卷内是移动,不复制整套依赖),写入 `current.json`,生成读指针的 `bin\mqdh.cmd`,可选加入用户 PATH 与开始菜单快捷方式;卸载只删除安装树与指向它的启动器,保留 `MQDH_HOME`。解压后的目录也可直接用根目录 `mqdh.cmd` 运行(便携模式)。Windows 产物当前未签名,应用内自动更新未验证;Windows 用户按发布说明手动下载安装新版本。 +Windows 实验包内置离线运行时目录 `runtime-deps/`:一个 `marqdo-3.0.0-rc.7-x86_64-pc-windows-msvc.tar.gz` 及其 `.sha256`,内含 CLI、Provider Worker 与 `marqdo-stdlib 0.3.0` Bundle。`scripts/mqdh.mjs` 在未显式设置 `MQDH_BOOTSTRAP_OFFLINE` 时把 bootstrap 指向该目录,因此首次启动可在无网络时完成运行时安装与校验;`mqdh bootstrap --offline ` 可覆盖。该离线包只提供运行时,默认 Knowledge/View Tool 在没有 Windows 归档时以 `bootstrap.offline_tool_missing` 显式跳过,不伪造安装。运行时归档、Bundle 摘要、平台 target 与二进制摘要由 `RELEASE_INFO.json` 声明并在安装前校验。 + ## 3. 发行合同 `mqdh-release.json`(一个平台一个文件)由 `scripts/release-manifest.ts` 生成: diff --git a/docs/mqdh/RELEASING.md b/docs/mqdh/RELEASING.md index e7ddfa49fd..23d87e7a6e 100644 --- a/docs/mqdh/RELEASING.md +++ b/docs/mqdh/RELEASING.md @@ -37,9 +37,11 @@ MQDH_PACKAGE_WORK=/var/tmp/mqdh-package bash scripts/package.sh pnpm install --frozen-lockfile --ignore-scripts pnpm run build $env:MQDH_NODE24_DIR = 'C:\path\to\node24' -powershell -ExecutionPolicy Bypass -File .\scripts\package-windows.ps1 +powershell -ExecutionPolicy Bypass -File .\scripts\package-windows.ps1 -RuntimeDeps C:\path\to\runtime-deps ``` +`-RuntimeDeps` 是一个受控离线运行时目录:其中 `marqdo--x86_64-pc-windows-msvc.tar.gz` 与 `.sha256` 必须来自组件仓的 Windows 运行时构建,包含 CLI、Provider Worker、`RELEASE_INFO.json`、`SOURCE_SHA` 与 Bundle;打包脚本会逐字节校验摘要并把该目录放进应用树的 `runtime-deps/`,由启动器在首次 bootstrap 时使用。 + 输出 `.ci/marqdo-harness--x86_64-pc-windows-msvc.tar.gz`、`.sha256`、`mqdh-release.json`、`release-evidence.json`、`package-evidence.json`。发布使用实验性 tag(例如 `mqdh-win-experimental-`),不属于 `mqdh-v` 更新渠道;不得用它替换 Linux 正式 tag 或声称 Windows 已 supported。升级路径:用户手动下载运行新 `install.ps1`;应用内 Windows 更新未验证。 ## 4. 签名(可选但推荐) diff --git a/docs/mqdh/STATUS.md b/docs/mqdh/STATUS.md index b1ee0705a8..547ec898c3 100644 --- a/docs/mqdh/STATUS.md +++ b/docs/mqdh/STATUS.md @@ -102,7 +102,7 @@ sha256 `68cbb8f878af47a44a8e0ff7625b647ff4b8ac5817cda02e0a31fdc658fdcd7d`, | BOOT-02 首次启动 Web 向导、真实进度、CLI bootstrap | PASS | `/mqdh/api/bootstrap` 与 `/mqdh` 页面实测;真实下载字节进度与步骤状态。 | | BOOT-03 断点/恢复/并发锁、失败回滚、离线包 | PARTIAL | staging 清理 + 单实例锁 + 失败不切换已实现并测试;离线目录安装已实现;真实弱网/断网与续传演练未运行。 | | BOOT-04 Knowledge/View 默认 Tool 安装与真实 smoke | PASS | knowledge v0.1.0-beta.3、view v0.3.0 安装成功;知识 compile/query hits=3;view 工具能力仍受上游接口限制(P09)。 | -| BOOT-05 跨平台验证、repair、发布候选 | PARTIAL | `repair` 已实现并测试;macOS/Windows 引导未验证。 | +| BOOT-05 跨平台验证、repair、发布候选 | PARTIAL | `repair` 已实现并测试;Windows 离线 bootstrap 已在本机真机验证(内置 `runtime-deps`,真实 check/call smoke=120),macOS 引导未验证。 | ## 诊断(DIAG) @@ -120,7 +120,7 @@ sha256 `68cbb8f878af47a44a8e0ff7625b647ff4b8ac5817cda02e0a31fdc658fdcd7d`, | --- | --- | --- | | DIST-01 清单 schema、命名、tag/证据、Linux tar 冷安装 | PASS(已发布) | `mqdh-v0.1.0-beta.1`:`mqdh-release.json` + `.sha256` + `release-evidence.json`(含 `cli@63562d8…` 运行时依赖);归档 786,741,787 B / sha256 `68cbb8f8…`;冷安装/`doctor`/`dump-config` 通过;未签名。 | | DIST-02 Linux `.deb`/AppImage、用户级安装/卸载 | PARTIAL | 用户级 `install.sh`/`--uninstall` 已实现并测试;`.deb`/AppImage 未构建。 | -| DIST-03 macOS/Windows 构建与冷安装 | PARTIAL | Windows x86_64 实验性归档已在本机原生构建并冷安装验证(未签名、无原生 CI lane、应用内更新未验证);macOS 无签名/公证证书,`UNVERIFIED`。 | +| DIST-03 macOS/Windows 构建与冷安装 | PARTIAL | Windows x86_64 实验性归档已在本机原生构建并冷安装验证,内置离线运行时可在无网络下完成 bootstrap(CLI rc.7 Windows + Bundle 0.3.0,check/call smoke=120);未签名、无原生 CI lane、应用内更新未验证;macOS 无签名/公证证书,`UNVERIFIED`。 | | DIST-04 签名、SBOM、代理/镜像、离线安装 | PARTIAL | Ed25519 清单签名/验证与测试密钥通过;官方密钥、SBOM、离线应用更新未运行。 | | DIST-05 更新检查/安装/回退、通知与对账 | PARTIAL | `update check` 对真实 Release 可用;`install/rollback` 仍只用本地发布服务器完成真实切换与回退;自动下载/安装按政策关闭,通知/对账未实现。 | diff --git a/packages/marqdo/harness/src/bootstrap/manager.ts b/packages/marqdo/harness/src/bootstrap/manager.ts index 03a001e466..e5a8318135 100644 --- a/packages/marqdo/harness/src/bootstrap/manager.ts +++ b/packages/marqdo/harness/src/bootstrap/manager.ts @@ -289,9 +289,12 @@ function envOffline(): string | undefined { } /** Extract kind/version/target from a component archive name. */ -function archiveIdentity(name: string): { kind: ArchiveKind; version: string; target: string } | null { - const match = /^marqdo(?:-(knowledge|view|lint|prove))?-(\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?)-([a-z0-9_]+-unknown-[a-z0-9-]+)\.tar\.gz$/ - .exec(name) +export function parseArchiveIdentity(name: string): { kind: ArchiveKind; version: string; target: string } | null { + const pattern = new RegExp( + '^marqdo(?:-(knowledge|view|lint|prove))?-(\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.]+)?)-' + + '([a-z0-9_]+-(?:unknown|pc)-[a-z0-9-]+)\\.tar\\.gz$', + ) + const match = pattern.exec(name) if (!match) return null const kind = (match[1] ?? 'cli') as ArchiveKind return { kind, version: match[2] ?? '', target: match[3] ?? '' } @@ -660,7 +663,7 @@ export class BootstrapManager { if (entries === undefined) throw new BootstrapError('bootstrap.offline_missing', `offline directory is not readable: ${directory}`) const match = entries .flatMap((name) => { - const identity = archiveIdentity(name) + const identity = parseArchiveIdentity(name) return identity !== null && identity.kind === 'cli' && identity.target === target ? [{ name, ...identity }] : [] }) .sort((left, right) => compareVersions(right.version, left.version))[0] @@ -699,7 +702,7 @@ export class BootstrapManager { const entries = await readdir(directory).catch(() => [] as string[]) const match = entries .flatMap((name) => { - const identity = archiveIdentity(name) + const identity = parseArchiveIdentity(name) return identity !== null && identity.kind === component && identity.target === target ? [{ name, ...identity }] : [] }) .sort((left, right) => compareVersions(right.version, left.version))[0] diff --git a/packages/marqdo/harness/src/ecosystem/manager.ts b/packages/marqdo/harness/src/ecosystem/manager.ts index 29062a8476..d967e095f6 100644 --- a/packages/marqdo/harness/src/ecosystem/manager.ts +++ b/packages/marqdo/harness/src/ecosystem/manager.ts @@ -110,6 +110,14 @@ export class EcosystemError extends Error { override name = 'EcosystemError' } +/** Filename of one shipped runtime binary for a Node platform. */ +export function runtimeBinaryName( + base: 'marqdo' | 'marqdo-provider-worker', + nodePlatform: string = process.platform, +): string { + return nodePlatform === 'win32' ? `${base}.exe` : base +} + /** Recompute the bundle digest from the extracted stdlib directory. */ async function bundleDigest(directory: string): Promise { const manifest = await readJson<{ digest?: string }>(join(directory, 'stdlib.json')) @@ -335,7 +343,7 @@ export class EcosystemManager { throw new EcosystemError(`release version mismatch: manifest=${info.product_version}, tag=${candidate.tag}`) } // A real invocation, not a file-existence check. - const smoke = await runProcess(join(root, 'marqdo'), ['--version'], { + const smoke = await runProcess(join(root, runtimeBinaryName('marqdo')), ['--version'], { cwd: root, limits: { timeoutMs: 30_000, @@ -348,7 +356,7 @@ export class EcosystemManager { } await options.smoke?.({ root, - cli: join(root, 'marqdo'), + cli: join(root, runtimeBinaryName('marqdo')), version: info.product_version, sourceSha: info.source_sha ?? null, bundleDigest: stdlib.tree_digest, @@ -383,8 +391,8 @@ export class EcosystemManager { tree_digest: stdlib.tree_digest, aliases_digest: stdlib.aliases_digest ?? null, }, - cli_path: 'marqdo', - worker_path: 'marqdo-provider-worker', + cli_path: runtimeBinaryName('marqdo'), + worker_path: runtimeBinaryName('marqdo-provider-worker'), tool_home: 'tool-home', previous: previous?.id ?? null, ci: candidate.ci, diff --git a/packages/marqdo/harness/src/execution/cli.ts b/packages/marqdo/harness/src/execution/cli.ts index d740e66ca6..74a2bffda4 100644 --- a/packages/marqdo/harness/src/execution/cli.ts +++ b/packages/marqdo/harness/src/execution/cli.ts @@ -10,7 +10,7 @@ import { randomBytes } from 'node:crypto' import { mkdir, readFile, unlink } from 'node:fs/promises' -import { isAbsolute, join, resolve } from 'node:path' +import { isAbsolute, join, relative, resolve } from 'node:path' import { digestBytes, digestFile, readText } from '../core/fsx.ts' import { runProcess } from '../core/process.ts' import type { RunLimits, RunResult } from '../core/process.ts' @@ -132,7 +132,8 @@ export function documentPath(workspace: string, relativePath: string): string { } const absolute = resolve(workspace, relativePath) const root = resolve(workspace) - if (!absolute.startsWith(`${root}/`) || absolute.split('/').includes('..')) { + const within = relative(root, absolute) + if (within === '' || within.startsWith('..') || isAbsolute(within)) { throw new ExecutionRejectedError(`document path escapes the workspace: ${relativePath}`) } return absolute diff --git a/packages/marqdo/harness/tests/windows-runtime.test.ts b/packages/marqdo/harness/tests/windows-runtime.test.ts new file mode 100644 index 0000000000..07d69bd0c4 --- /dev/null +++ b/packages/marqdo/harness/tests/windows-runtime.test.ts @@ -0,0 +1,29 @@ +/** Native Windows runtime identity and offline-pack parsing. */ + +import assert from 'node:assert/strict' +import { test } from 'node:test' + +import { parseArchiveIdentity } from '../src/bootstrap/manager.ts' +import { runtimeBinaryName } from '../src/ecosystem/manager.ts' + +test('offline archive identity accepts native Windows targets', () => { + assert.deepEqual(parseArchiveIdentity('marqdo-3.0.0-rc.7-x86_64-pc-windows-msvc.tar.gz'), { + kind: 'cli', + version: '3.0.0-rc.7', + target: 'x86_64-pc-windows-msvc', + }) + assert.deepEqual(parseArchiveIdentity('marqdo-3.0.0-rc.7-x86_64-unknown-linux-gnu.tar.gz'), { + kind: 'cli', + version: '3.0.0-rc.7', + target: 'x86_64-unknown-linux-gnu', + }) + assert.deepEqual(parseArchiveIdentity('marqdo-knowledge-0.2.0-aarch64-apple-darwin.tar.gz'), null) + assert.equal(parseArchiveIdentity('marqdo-3.0.0-rc.7-x86_64-pc-windows-msvc.zip'), null) +}) + +test('runtime binary names carry the Windows executable suffix', () => { + assert.equal(runtimeBinaryName('marqdo', 'win32'), 'marqdo.exe') + assert.equal(runtimeBinaryName('marqdo-provider-worker', 'win32'), 'marqdo-provider-worker.exe') + assert.equal(runtimeBinaryName('marqdo', 'linux'), 'marqdo') + assert.equal(runtimeBinaryName('marqdo-provider-worker', 'darwin'), 'marqdo-provider-worker') +}) diff --git a/scripts/mqdh.mjs b/scripts/mqdh.mjs index ded531c955..4e6c792187 100755 --- a/scripts/mqdh.mjs +++ b/scripts/mqdh.mjs @@ -11,7 +11,7 @@ */ import { access, chmod, mkdir, readFile, rmdir, symlink, unlink, writeFile } from 'node:fs/promises' -import { constants } from 'node:fs' +import { constants, existsSync } from 'node:fs' import { homedir } from 'node:os' import { dirname, join, resolve } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' @@ -21,6 +21,13 @@ const here = dirname(fileURLToPath(import.meta.url)) const root = resolve(here, '..') const productCommands = new Set(['bootstrap', 'status', 'doctor', 'repair', 'report', 'update', 'network', 'uninstall', 'help']) +// A packaged offline runtime pack makes first-run bootstrap usable without a +// network round trip; an explicit environment value still wins. +const bundledRuntimeDeps = join(root, 'runtime-deps') +if (!process.env.MQDH_BOOTSTRAP_OFFLINE && existsSync(bundledRuntimeDeps)) { + process.env.MQDH_BOOTSTRAP_OFFLINE = bundledRuntimeDeps +} + /** Resolve the application home without touching the user's `~/.dsh`. */ function resolveHome() { const configured = process.env.MQDH_HOME?.trim() diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1 index 71dc2478cd..8c600ae0c0 100644 --- a/scripts/package-windows.ps1 +++ b/scripts/package-windows.ps1 @@ -23,7 +23,8 @@ #> [CmdletBinding()] param( - [string]$OutDir = (Join-Path $PSScriptRoot '..\.ci') + [string]$OutDir = (Join-Path $PSScriptRoot '..\.ci'), + [string]$RuntimeDeps = '' ) $ErrorActionPreference = 'Continue' @@ -160,6 +161,28 @@ try { Copy-Item -LiteralPath (Join-Path $root 'scripts\install.ps1') -Destination (Join-Path $app 'install.ps1') -Force Copy-Item -LiteralPath (Join-Path $root 'scripts\mqdh.cmd') -Destination (Join-Path $app 'mqdh.cmd') -Force + # Optional bundled offline runtime pack: the launcher points bootstrap at it, + # so a fresh Windows install can install CLI/Worker/Bundle without network. + $bundledRuntime = @() + if ($RuntimeDeps -ne '') { + $deps = (Resolve-Path -LiteralPath $RuntimeDeps).Path + if (-not (Test-Path -LiteralPath $deps)) { throw "runtime deps directory is missing: $RuntimeDeps" } + $targetDeps = Join-Path $app 'runtime-deps' + New-Item -ItemType Directory -Force -Path $targetDeps | Out-Null + foreach ($file in Get-ChildItem -LiteralPath $deps -File) { + Copy-Item -LiteralPath $file.FullName -Destination (Join-Path $targetDeps $file.Name) + if ($file.Name -like '*.tar.gz') { + $sidecar = Join-Path $deps ($file.Name + '.sha256') + if (-not (Test-Path -LiteralPath $sidecar)) { throw "runtime deps archive has no .sha256 sidecar: $($file.Name)" } + $digest = (Get-FileHash -LiteralPath $file.FullName -Algorithm SHA256).Hash.ToLower() + $declared = (Get-Content -LiteralPath $sidecar -Raw).Trim().Split(' ')[0].ToLower() + if ($digest -ne $declared) { throw "runtime deps digest mismatch: $($file.Name)" } + $bundledRuntime += [ordered]@{ name = $file.Name; size = $file.Length; sha256 = $digest } + } + } + if ($bundledRuntime.Count -eq 0) { throw 'runtime deps directory has no component archive' } + } + $archive = Join-Path $OutDir "$name.tar.gz" Remove-Item -LiteralPath $archive -Force -ErrorAction SilentlyContinue & tar.exe -czf $archive -C $stage $name @@ -212,6 +235,7 @@ try { } manifest = 'mqdh-release.json' signature = 'unsigned' + bundled_runtime = $bundledRuntime contains_marqdo_cli_source = $false unverified = @( 'native Windows CI runner', -- 2.54.1 From 57a9e0332f5677176efa83b5b7f7707c399c01a2 Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 3 Dec 2026 01:37:06 +0800 Subject: [PATCH 4/4] docs: record the usable Windows MQDH build Offline runtime pack bootstrap, real check/call smoke and cold-install evidence for the 2026-12-03 Windows experimental build; also fix the package script variable shadowing found during packaging. --- .../evidence/2026-12-03-windows-usable.md | 74 +++++++++++++++++++ scripts/package-windows.ps1 | 14 ++-- 2 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 docs/mqdh/evidence/2026-12-03-windows-usable.md diff --git a/docs/mqdh/evidence/2026-12-03-windows-usable.md b/docs/mqdh/evidence/2026-12-03-windows-usable.md new file mode 100644 index 0000000000..ee86e587c1 --- /dev/null +++ b/docs/mqdh/evidence/2026-12-03-windows-usable.md @@ -0,0 +1,74 @@ +# Windows x86_64 可用实验版记录(2026-12-03) + +Date: 2026-12-03. +性质:**experimental(维护者批准的受限实验分发),不是受支持发行。** +应用:Marqdo Harness(MQDH)`0.1.0-beta.1` +源码:`marqdo-app-harness` 提交 `0d3a9c4369a49244b3405998fa62ee851550cd88`; +DSH upstream `4b399c39a6d1479cd84ca591b4d7c88e24d38a96`。 +Release:https://git.cflmy.cn/cflmy/marqdo-app-harness/releases/tag/mqdh-win-experimental-2026-12-03 + +## 1. 本次目标与结果 + +上一版 Windows 实验包只能启动壳:`mqdh bootstrap` 需要从 CLI Release 发现 +`marqdo--x86_64-pc-windows-msvc.tar.gz` 运行时资产,而 CLI 只有 Linux +正式发行。本版改为**应用自带离线运行时包**(`runtime-deps/`,组件构建产物), +首次启动在无网络时完成运行时安装,并在 Windows 上真实执行文稿: + +```text +安装 -> mqdh bootstrap --json -> status=ready + environment cli-3.0.0-rc.7-182a07c798ef + source_sha 63562d8…, bundle sha256:4e47b0ff… + platform x86_64-pc-windows-msvc + smoke: 真实 check + call 阶乘(n=5) = 120 +doctor --json -> runtime installed +``` + +## 2. 构建与打包(Windows 11 开发机) + +```text +toolchain Node v24.22.3、pnpm 11.28.5、MSVC 19.41 / VS 2022 17.11 +build pnpm install --frozen-lockfile --ignore-scripts + pnpm run build -> 10/10 gates PASS (337.44s) +tests node --test .../windows-runtime|execution|platform|install-root +package powershell -File scripts/package-windows.ps1 \ + -RuntimeDeps # 内置 CLI Windows 运行时 +``` + +离线运行时包:`marqdo-3.0.0-rc.7-x86_64-pc-windows-msvc.tar.gz` +(4,060,223 bytes,sha256 `182a07c7…`,源 `63562d8`,CLI + Worker + Bundle 0.3.0, +含 `RELEASE_INFO.json`/`SOURCE_SHA`)。 + +## 3. 归档与冷安装证据 + +| 项 | 值 | +| --- | --- | +| 应用归档 | `marqdo-harness-0.1.0-beta.1-x86_64-pc-windows-msvc.tar.gz` | +| 大小 / SHA256 | 688,136,852 bytes / `6bb1580c259563a6d791f9ae526ac3172463716e82a95d6c4b9507748cf58e34` | +| 分卷 | `*.tar.gz.part1`–`part4`;合并后摘要一致 | +| 冷安装 | `install.ps1` 用户级安装成功;`current.json` = `0.1.0-beta.1-0d3a9c4369a4` | +| 便携启动器 | 解压树 `mqdh.cmd --version` = `mqdh 0.1.0-beta.1` | +| bootstrap | `ready`;环境 `cli-3.0.0-rc.7-182a07c798ef`;`cli_path=marqdo.exe`、`worker_path=marqdo-provider-worker.exe`;smoke=120 | +| doctor | `overall=warn`(knowledge/view Tool 缺 Windows 归档);runtime installed | +| dump-config | PASS(1371 行,mqdh profile 条目存在) | + +## 4. 代码修复点 + +- 应用树存在 `runtime-deps/` 时 `scripts/mqdh.mjs` 自动设置 + `MQDH_BOOTSTRAP_OFFLINE`(显式环境变量优先)。 +- 运行时安装使用平台化可执行名:Windows 为 `marqdo.exe` / + `marqdo-provider-worker.exe`,并写入 `cli_path`/`worker_path`。 +- 离线归档名解析支持 `pc-windows-msvc` target(原正则只接受 `unknown` 中缀)。 +- 执行层文档路径包含判断改用 `path.relative`(Windows 分隔符下原 + `startsWith(root + '/')` 恒失败)。 +- `package-windows.ps1` 增加 `-RuntimeDeps`:逐字节校验运行时归档摘要并写入 + `package-evidence.json` 的 `bundled_runtime`。 + +## 5. 明确边界 + +- 未签名;无原生 Windows CI lane;应用内 Windows 更新未验证。 +- Knowledge/View Tool 无 Windows 归档,bootstrap 显式 `skipped`;工作台知识编译 + 与 View 阅读能力暂不可用(locator 模式除外)。 +- 真实模型 E2E、第二台干净 Windows 主机、浏览器工作台截图验收未执行。 +- 不进入根推荐组合;Linux 平台正式预发布另行接受;扩展库仍为 planned,未随包分发。 +- 发行边界按 marqdo#96/#102:只在 app-harness 本仓构建,未重编译 CLI/Worker/ + Stdlib/Ext,不触发根仓或其它组件构建。 diff --git a/scripts/package-windows.ps1 b/scripts/package-windows.ps1 index 8c600ae0c0..63981ec2ad 100644 --- a/scripts/package-windows.ps1 +++ b/scripts/package-windows.ps1 @@ -118,23 +118,23 @@ try { Where-Object { $_.Attributes -band [System.IO.FileAttributes]::ReparsePoint }) if ($links.Count -eq 0) { break } foreach ($link in $links) { - $target = $link.Target - if ($target -is [array]) { $target = $target[0] } - if (-not [System.IO.Path]::IsPathRooted($target)) { $target = Join-Path $link.DirectoryName $target } - $target = [System.IO.Path]::GetFullPath($target) - if ((Test-Path -LiteralPath $target) -and (Get-Item -LiteralPath $target).PSIsContainer) { + $linkTarget = $link.Target + if ($linkTarget -is [array]) { $linkTarget = $linkTarget[0] } + if (-not [System.IO.Path]::IsPathRooted($linkTarget)) { $linkTarget = Join-Path $link.DirectoryName $linkTarget } + $linkTarget = [System.IO.Path]::GetFullPath($linkTarget) + if ((Test-Path -LiteralPath $linkTarget) -and (Get-Item -LiteralPath $linkTarget).PSIsContainer) { $copy = "$($link.FullName).workspace-copy" Remove-Item -LiteralPath $copy -Recurse -Force -ErrorAction SilentlyContinue # Do not copy the target's own node_modules: the hoisted root # dependency tree is the only resolver, and copy sources can # contain directory symlinks that robocopy would follow into # path-limit-breaking recursive copies. - & robocopy $target $copy /E /XJ /XD (Join-Path $target 'node_modules') /R:1 /W:1 /NFL /NDL /NJH /NJS /NP | Out-Null + & robocopy $linkTarget $copy /E /XJ /XD (Join-Path $linkTarget 'node_modules') /R:1 /W:1 /NFL /NDL /NJH /NJS /NP | Out-Null if ($LASTEXITCODE -ge 8) { throw "workspace link copy failed: $($link.FullName)" } [System.IO.Directory]::Delete($link.FullName) Move-Item -LiteralPath $copy -Destination $link.FullName } else { - $bytes = [System.IO.File]::ReadAllBytes($target) + $bytes = [System.IO.File]::ReadAllBytes($linkTarget) [System.IO.File]::Delete($link.FullName) [System.IO.File]::WriteAllBytes($link.FullName, $bytes) } -- 2.54.1