Compare commits

...
Author SHA1 Message Date
cflmy 54f1c090fc docs: record the experimental Windows MQDH distribution
ci/woodpecker/pr/ci Pipeline is pending
ci/woodpecker/push/ci Pipeline is pending
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 21:50:22 +08:00
cflmy 10a40b32c6 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).
2026-12-02 21:50:22 +08:00
cflmy 9a975e44fb docs: record the published MQDH public beta and its release chain
ci/woodpecker/push/ci Pipeline was successful
Update the canonical product status, distribution matrix and releasing guide to
the released 0.1.0-beta.1 identity (source SHA, archive digest, managed CLI
runtime), the working real-release update discovery, and the prerequisites that
made the release verifiable: enabled public Releases, same-SHA CI, evidence
dependency identity and anonymous read-back.
2026-12-02 19:47:36 +08:00
cflmy 0f63ced004 build: record the installed CLI runtime identity in app release evidence
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/tag/ci Pipeline was canceled
2026-12-02 16:42:01 +08:00
cflmy 1bdc6cbc6f test: read the expected product version from the package manifest
ci/woodpecker/push/ci Pipeline is pending
2026-12-02 16:36:24 +08:00
cflmy 5573c7cacc release: prepare MQDH 0.1.0-beta.1 against CLI 3.0.0-rc.7
ci/woodpecker/push/ci Pipeline was canceled
Bump the product version to the public beta channel and pin the CI runtime
input to the root-accepted CLI v3.0.0-rc.7 archive digest.
2026-12-02 16:32:46 +08:00
cflmy 73e4f6e57d Merge pull request #22
ci/woodpecker/push/ci Pipeline was successful
test: real Gitea feedback submission acceptance (#16)
2026-12-01 13:43:20 +08:00
cflmy 99073e94c3 test: record a real Gitea feedback submission acceptance
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
Capture one redacted app-area diagnostic in an isolated MQDH_HOME, store a real
token through the private credential file, and submit it to the private
cflmy/mqdh-feedback-e2e fixture. Record the created issue URL, duplicate
fingerprint comment path, invalid-repository 404 failure and offline queue
result. STATUS moves DIAG-03 to PASS (real Gitea + stand-in) and keeps DIAG-05
PARTIAL because the full failure-sample/attachment/offline-recovery matrix is
not run.

Token/report content are not committed; the fixture repo is private.
2026-12-01 12:09:54 +08:00
cflmy 7e2f1ac325 Merge pull request #21 from codex/issue-16-status-update
ci/woodpecker/push/ci Pipeline was successful
feat: persisted update view in mqdh status (#16)
2026-12-01 09:43:48 +08:00
cflmy 9979411e08 feat: show the persisted update view in mqdh status
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
Continue app-harness#16: MdhStatus carries the persisted UpdateState and
mqdh status [--json] shows channel, last check time, availability, latest
candidate and the last update error without triggering a network check.
DISTRIBUTION distinguishes this read-only view from the explicit update check;
the CLI test asserts the empty-install values and text line.

Verified locally: typecheck 5/5, cli test 6 pass, all downstream node tests
77 pass/3 skipped. No release/tag; E09 notification/reconciliation and real
Gitea feedback E2E remain UNVERIFIED.
2026-12-01 09:24:55 +08:00
cflmy 28df81ee11 Merge pull request #20 from codex/issue-16-update-notes
ci/woodpecker/push/ci Pipeline was successful
feat: update check shows release notes and download (#16)
2026-11-30 22:21:47 +08:00
cflmy f89b2dd81e feat: show release notes and official download in update check
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
Continue app-harness#16 goal 4: the application update check now displays the
trusted release metadata a user needs to decide.

- release/gitea.ts reads the trusted Gitea release body (truncated to 8 KiB)
  into the candidate alongside the already-validated manifest/asset.
- UpdateCandidate gains notes and release_url; UpdateState.latest persists both.
- mqdh update check text output adds published/download/release URL/known limits
  and release notes; JSON already carries the same fields.
- DISTRIBUTION documents the fields; RELEASING names the Gitea release body as
  the single source of release notes (no second list).
- updater.test.ts fake release carries a body and asserts notes/release_url.

Verified locally: updater tests 3/3, all downstream node tests 77 pass/3
skipped, typecheck 5/5. No release/tag; full ecosystem latest-version view and
E09 notification/reconciliation remain UNVERIFIED.
2026-11-30 21:57:22 +08:00
cflmy eceb13a70a Merge pull request #19 from codex/issue-16-status-view
ci/woodpecker/push/ci Pipeline was successful
feat: read-only mqdh status ecosystem view (#16 slice)
2026-11-30 20:44:29 +08:00
cflmy fd1d129e00 feat: add a read-only mqdh status ecosystem view
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
Start the app-harness#16 version-visibility slice with `mqdh status [--json]`:
one read-only report of the application version/home/workspace, platform and
Node, ecosystem candidate/version, Bundle version/modules/digest, installed tool
versions, market/knowledge counts and the privacy constants. JSON uses the
stable schema marqdo.mqdh.status.

The launcher product-command set and HELP include status; ARCHITECTURE records
the command. The CLI test covers JSON and text output for an empty install and
asserts the honest "not installed"/false values. This is not the full latest
version/release-notes/download view from #16; that remains UNVERIFIED.

Verified locally: all downstream node tests 77 pass/3 skipped; typecheck gates
5/5 pass.
2026-11-30 20:21:33 +08:00
cflmy a1517652c2 Merge pull request #18 from codex/issue-15-entry-polish
ci/woodpecker/push/ci Pipeline was successful
docs: wrap-standard polish for the product entry (#15)
2026-11-30 20:19:26 +08:00
28 changed files with 888 additions and 43 deletions

No files matched your search

+6
View File
@@ -14,6 +14,12 @@ This repository is the **Marqdo Harness (MQDH)** downstream fork of DeepSeek Har
The upstream history, MIT license and third-party notices are retained. `origin` is `https://git.cflmy.cn/cflmy/marqdo-app-harness.git`; `upstream` is the Gitea DSH mirror. Product documentation lives under `docs/mqdh/` (ARCHITECTURE, STATUS, UPSTREAM, upstream-delta).
**Public beta:** `mqdh-v0.1.0-beta.1` (Linux x86_64) is published at
<https://git.cflmy.cn/cflmy/marqdo-app-harness/releases/tag/mqdh-v0.1.0-beta.1>
and accepted by the Marqdo root repository; download entry is
<https://marqdo.com/download/>. Release identity, limits and acceptance record
are owned by [DISTRIBUTION.md](docs/mqdh/DISTRIBUTION.md) and `docs/mqdh/STATUS.md`.
Run the product from this checkout with `node scripts/mqdh.mjs` after `pnpm install && pnpm run build`. The web workbench is served at `/mqdh` on the same loopback listener as the DSH client. The application does not bundle a Marqdo CLI, stdlib, extension or tool implementation; those are downloaded from trusted Gitea releases into an application-owned home.
Product commands (everything else is forwarded to the forked DSH launcher):
+1 -1
View File
@@ -40,7 +40,7 @@ apps/harness/ # 独立应用仓库(父仓 gitlink:apps
│ ├── src/diagnostics/ # 脱敏报告、去重、Gitea Issue 提交
│ ├── src/knowledge/ # 私人知识集合、导入、索引适配、检索
│ ├── src/execution/ # Analysis 3、CLI argv、审批、证据
│ ├── src/cli/ # 产品命令(bootstrap/doctor/repair/report/update/network)
│ ├── src/cli/ # 产品命令(bootstrap/status/doctor/repair/report/update/network)
│ ├── src/tools/ # 面向模型的六个操作
│ ├── src/web/ # /mqdh 页面与同源只读/受控写 API
│ └── tests/ # node:test 单元与真实 CLI/Release 集成
+43 -3
View File
@@ -6,13 +6,24 @@ MQDH 是**默认对外发行**的单用户应用:用户下载安装包,在
| 平台 | 首版 | 状态 |
| --- | --- | --- |
| Linux x86_64 glibc ≥ 2.39 | `.tar.gz`(内置 Node 运行时 + 用户级 `install.sh`) | 已构建并冷安装验证 |
| 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 桌面或官方发布声明。
当前公共 Beta 发行身份(唯一来源是 Gitea Release):
| 项 | 值 |
| --- | --- |
| tag / 源提交 | `mqdh-v0.1.0-beta.1` → `0f63ced004be9a9de69f897c3385558dfd753287` |
| Release | <https://git.cflmy.cn/cflmy/marqdo-app-harness/releases/tag/mqdh-v0.1.0-beta.1> |
| 归档 | `marqdo-harness-0.1.0-beta.1-x86_64-unknown-linux-gnu.tar.gz`,786,741,787 B,sha256 `68cbb8f8…cd7d` |
| 运行时 | 根已接受 `marqdo-cli v3.0.0-rc.7`(`63562d8…`)+ Bundle 0.3.0,由 `mqdh bootstrap` 安装 |
| 根接受记录 | 主仓库 `docs/release-acceptance/mqdh-linux-x86_64-0.1.0-beta.1.json` |
## 2. 安装布局
```text
@@ -30,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/<version>-<sha12>/ # 不可变应用树(含 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` 生成:
@@ -72,7 +97,9 @@ mqdh update rollback --confirm [--json]
- 运行中的进程继续使用已加载的版本;**下一次启动**由 wrapper 读取新指针。活跃任务不因更新切换环境。
- 失败关闭:摘要/平台/兼容/smoke 任一失败都不改指针,staging 清理。
- 更新不触碰 `MQDH_HOME/ecosystem`;Marqdo 运行时仍由 Bootstrap/生态中心独立管理。
- 应用仓库当前为私有开发仓时,匿名检查返回 403/404,状态显示 `update.unavailable`(不是伪造“已是最新”)。正式发行需公开仓库或显式配置凭据。
- 发行仓库必须启用 Gitea Releases(`has_releases=true`)且公开;否则匿名检查返回 403/404,状态显示 `update.unavailable`(不是伪造“已是最新”)。当前 `cflmy/marqdo-app-harness` 已公开并启用 Releases。
- `update check` 同时展示最新候选的 `published_at`、官方下载 URL(`latest.asset.url`)、Release 页面 URL(`latest.release_url`)、`known_limits` 与发布说明;发布说明来自可信 Gitea Release body(截断到 8 KiB),不是第二份清单。JSON 字段为 `latest.notes` 与 `latest.release_url`。
- `mqdh status [--json]` 只读展示已持久化的更新视图(channel、上次检查时间、是否可更新、最新候选、最后一个错误),不触发网络检查;JSON 字段为 `update`。需要最新检查时显式运行 `mqdh update check`。
## 5. 构建与发布
@@ -86,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-<version>-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. 边界与非目标
+28 -8
View File
@@ -4,10 +4,11 @@
## 1. 发布前
1. 责任提交已在 `main`,`docs/mqdh/STATUS.md` 与证据已更新。
2. 同 SHA 的应用 CI 通过:`scripts/ci.sh`(含真实 Release 安装、Bootstrap、全部测试)与父仓候选组合。
3. 版本在 `packages/marqdo/harness/package.json` 唯一维护;tag 必须是 `mqdh-v<version>`。
4. 准备 Node 24 / pnpm 11 构建环境与 ≥ 12 GiB 临时空间(归档 + 解包 + 冷安装)。
1. 责任提交已在 `main`,`docs/mqdh/STATUS.md` 与证据已更新;仓库必须已启用 Gitea Releases(`has_releases=true`)并公开。
2. 同 SHA 的应用 CI 通过:`scripts/ci.sh`(含真实 Release 安装、Bootstrap、全部测试);发行证据中的 `ci`/资产摘要必须来自该提交。tag 触发的打包流水线可被后续 push 取消,但同 SHA push 流水线必须 success。
3. 版本在 `packages/marqdo/harness/package.json` 唯一维护;tag 必须是 `mqdh-v<version>`,预发布后缀决定 `prerelease`。
4. 记录实际测试运行时:打包时设置 `MQDH_CLI_SOURCE_SHA=<40 hex>`,该值进入 `release-evidence.json.dependencies`,供根 reconcile 校验与根 gitlink 一致。
5. 准备 Node 24 / pnpm 11 构建环境与 ≥ 12 GiB 临时空间(归档 + 解包 + 冷安装)。
## 2. 构建
@@ -28,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<version>` 应用更新渠道:
```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-<version>-x86_64-pc-windows-msvc.tar.gz`、`.sha256`、`mqdh-release.json`、`release-evidence.json`、`package-evidence.json`。发布使用实验性 tag(例如 `mqdh-win-experimental-<date>`),不属于 `mqdh-v<version>` 更新渠道;不得用它替换 Linux 正式 tag 或声称 Windows 已 supported。升级路径:用户手动下载运行新 `install.ps1`;应用内 Windows 更新未验证。
## 4. 签名(可选但推荐)
```sh
MQDH_RELEASE_PRIVATE_KEY=/secure/mqdh-release.key \
@@ -50,6 +64,8 @@ MQDH_GITEA_TOKEN=... node scripts/release.ts ... --publish # 创建 tag/Release
脚本会:校验 manifest/source/版本/摘要/证据一致 → 确认 tag 尚不存在(发行不可变)→ 创建 Release(prerelease 依据版本后缀)→ 逐项上传资产。任何一步失败都不能重命名/覆盖已发布资产;修正后提升版本重新发布。
发布完成后由根仓 `scripts/reconcile-releases.py` 按应用发行契约独立核验(tag→完整 SHA、同 SHA CI、资产匿名逐字节回读、`dependencies` 与根 gitlink 一致);根接受记录与公开发行投影是另一层事实,不由应用发布自动推导。
## 5. 发布后验证
在干净用户/干净主机(无 Node/Rust/pnpm/源码)执行:
@@ -64,7 +80,7 @@ cd marqdo-harness-<version>-x86_64-unknown-linux-gnu
~/.local/opt/mqdh/bin/mqdh --dump-config
```
再验证更新/回退:用上一个已发布版本安装 → `mqdh update check --json` → `mqdh update install --confirm` → 新版本启动 → `mqdh update rollback --confirm` → 旧版本启动且 `MQDH_HOME/ecosystem` 不变。证据记录应用 SHA、tag、平台、Node、命令、退出码、size/sha256、冷安装日志与已知限制。
再验证更新/回退:用上一个已发布版本安装 → `mqdh update check --channel beta --json`(应读到本次 Release 的版本、资产摘要、发布说明与官方 URL)→ `mqdh update install --confirm` → 新版本启动 → `mqdh update rollback --confirm` → 旧版本启动且 `MQDH_HOME/ecosystem` 不变。自动安装按现行政策保持关闭;证据记录应用 SHA、tag、平台、Node、命令、退出码、size/sha256、冷安装日志与已知限制。
## 6. 失败与回滚
@@ -73,6 +89,10 @@ cd marqdo-harness-<version>-x86_64-unknown-linux-gnu
- 已发布版本有缺陷:发布更高版本;不删除或重写旧资产。用户侧可 `mqdh update rollback --confirm`。
- 签名错误:停止发布,轮换密钥并提升版本;不得重新上传同 tag。
## 7. 未验证
## 7. 发布说明
生产签名证书/密钥托管、macOS/Windows 构建与公证、第二台干净主机、低于 2.39 glibc 的平台、真实断网更新与弱网大文件下载。以上保持 `UNVERIFIED`,不得写成 PASS。
创建 Gitea Release 时填写的 body 是产品内 `mqdh update check` 展示的发布说明唯一来源(截断到 8 KiB);不要另建发布说明清单或第二份版本表。发布说明应包含用户可见变化、已知限制和升级注意项,且不得包含凭据、私有数据或未验证的 PASS 声明。
## 8. 未验证
生产签名证书/密钥托管、macOS 构建与公证、原生 Windows CI lane 与 Windows 应用内更新、第二台干净主机、低于 2.39 glibc 的平台、真实断网更新与弱网大文件下载。以上保持 `UNVERIFIED`,不得写成 PASS。
+16 -9
View File
@@ -1,6 +1,13 @@
# Marqdo Harness 状态与门禁
本文件是 MQDH 现状的唯一产品状态来源。日期:2026-11-29。应用提交以 `git rev-parse HEAD` 为准;上游基线为 DSH `4b399c39a6d1479cd84ca591b4d7c88e24d38a96`(标签 `dsh-v0.2.3-alpha.2`)。证据目录见 [evidence/](evidence/)。
本文件是 MQDH 现状的唯一产品状态来源。日期:2026-12-02。应用提交以 `git rev-parse HEAD` 为准;上游基线为 DSH `4b399c39a6d1479cd84ca591b4d7c88e24d38a96`(标签 `dsh-v0.2.3-alpha.2`)。证据目录见 [evidence/](evidence/)。
**当前公共 Beta:** `0.1.0-beta.1`(2026-12-02 发布,源 `0f63ced004be9a9de69f897c3385558dfd753287`,
归档 `marqdo-harness-0.1.0-beta.1-x86_64-unknown-linux-gnu.tar.gz`,786,741,787 B,
sha256 `68cbb8f878af47a44a8e0ff7625b647ff4b8ac5817cda02e0a31fdc658fdcd7d`,
签名状态 `unsigned`)。根接受记录见主仓库
`docs/release-acceptance/mqdh-linux-x86_64-0.1.0-beta.1.json`;下载入口 <https://marqdo.com/download/>。
发行身份以 Gitea Release 资产为准,本文件只记录门禁状态。
状态定义:**PASS** 表示本仓库或本机真实命令已通过并记录;**PARTIAL** 表示实现存在且已覆盖主要路径,但门禁要求的一部分尚未验证;**UNVERIFIED** 表示未运行或环境不具备,不能当作通过;**FAIL** 表示真实失败。
@@ -29,7 +36,7 @@
| E06 安装失败保留旧组合 | PASS | 坏版本/无候选不改变 `current.json`;下载/SHA/平台/解包失败清理 staging;`cleanup` 保护 active 与 rollback 目标。 |
| E07 更新只影响新任务 | PARTIAL | 每次运行记录环境 ID 与 CLI 身份;尚未实现“活跃任务固定原环境”的会话级绑定。 |
| E08 未知来源/扩权审批 | PASS(工具层) | `marqdo_program`/`marqdo_ecosystem` 通过 `ctx.approval.request` 一次一授权;模型不能提供 URL/argv/安装根;单位测试覆盖 argv/路径拒绝。审批 UI 的真实浏览器流程见 S06。 |
| E09 通知与对账 | UNVERIFIED | 首版只在用户显式查询/安装时发现 release;应用更新检查(30 分钟缓存)不等于发行通知/对账。 |
| E09 通知与对账 | PARTIAL | `update check` 已在真实公开 Release 上发现 `0.1.0-beta.1`(版本/资产摘要/发布说明/官方 URL 正确,`unsigned` 如实显示);后台定时通知、去重持久化与对账闭环仍未实现。 |
| E10 应用/运行时独立升级 | PARTIAL | 安装时校验 Analysis 3 / Observation 1;协议不兼容会拒绝。尚无跨大版本阻塞 UI。 |
## 执行与文稿(P)
@@ -72,8 +79,8 @@
| S05 工作区隔离 | PARTIAL | 工作区显式且路径受控;未实现每任务独立目录与跨工作区审计。 |
| S06 浏览器真实交互 | PARTIAL | 市场、View 阅读与五组生态目录已用 Playwright 真实浏览器覆盖刷新/详情/安装/启用/撤销/阅读/知识命中/键盘/窄窗口/暗色;知识导入与执行审批的完整浏览器流程仍未运行。 |
| S07 诊断脱敏 | PASS(本地/替身) | 捕获→脱敏→本地报告→显式提交全链路由 `tests/diagnostics.test.ts` 覆盖;真实公网 Gitea 权限与模板未验证,见 DIAG-03/05。 |
| S08 独立归档冷安装 | PASS(本机) | 归档内置 Node + `install.sh`;从归档冷安装后 `mqdh --version`、`doctor --json`、`--dump-config` 通过(见 m7 证据)。未在第二台干净主机验证。 |
| S09 CI/真实模型/发布 | PARTIAL | `scripts/ci.sh` 与 `.woodpecker/ci.yml` 已实现;父仓 PR#48 的 Woodpecker pipeline 已运行并暴露/修复 candidate manifest bug,最终通过证据以 PR 为准。真实模型两轮验收 UNVERIFIED。 |
| S08 独立归档冷安装 | PASS(发布审计) | 发布归档内置 Node + `install.sh`;从公开发布字节冷安装后 `mqdh --version`(0.1.0-beta.1)、`doctor --json`、`--dump-config` 通过,匿名回读 sha256 与发布证据一致。第二台干净主机仍 UNVERIFIED。 |
| S09 CI/真实模型/发布 | PARTIAL | 发行提交 `0f63ced` 的独立 Woodpecker pipeline **#50 success**(clone/install/build/test,无根仓 checkout、无 CLI 编译);应用 Release 已发布并回读。真实模型两轮验收仍 UNVERIFIED。 |
| S10 父仓组合验收 | PASS(父仓) | 父仓 Node app lane 使用同一 CLI/Bundle 候选;app optional,不阻塞 CLI 独立发行。 |
| S11 产品级 AI 可读入口 | PASS(本仓) | `docs/mqdh/index.mq.md` 为产品层唯一入口,`docs/mqdh/README.md` 指向;39 个相对链接在提交前核对存在;上游隔离/STATUS 权威声明与关键不变量在入口可见。完整 `pnpm run doc-sync` 在本下游 fork 基线不通过(既有 `docs/mqdh/` 文档缺双语/单行段落规范),文档门禁保持 UNVERIFIED,不用入口 PASS 冒充文档 gate。 |
@@ -103,19 +110,19 @@
| --- | --- | --- |
| DIAG-01 错误模型、捕获点、report schema、脱敏器 | PASS | `diagnostics.test.ts`:路径/secret/敏感键/cause chain 脱敏,写入前完成。 |
| DIAG-02 `mqdh report` + `/mqdh` 报告页 + 预览/删除 | PASS | CLI/Web 路由与页面已实现;预览返回完整 title/body。 |
| DIAG-03 Gitea Issue 提交、目标仓路由、模板、去重/限额 | PASS(替身) | 本地 Gitea 替身真实创建 Issue/评论、附件 multipart、小时限额;真实公网组织权限未验证。 |
| DIAG-03 Gitea Issue 提交、目标仓路由、模板、去重/限额 | PASS(真实 Gitea + 替身) | 真实 Gitea 私有夹具创建 Issue/去重评论/404 失败路径已验证(`docs/evidence/2026-12-01-feedback-real-gitea-e2e.md`);替身覆盖附件 multipart 与小时限额。真实组织权限矩阵仍有限。 |
| DIAG-04 离线队列、附件选择、结果回填 | PASS | `--offline` 入队;附件仅从报告目录读取;issue URL 回填索引。 |
| DIAG-05 真实失败演练、负例/安全测试、发布证据 | PARTIAL | 真实 Bootstrap/知识/CLI 失败样本与公网提交演练未全部运行;不得写成 PASS。 |
| DIAG-05 真实失败演练、负例/安全测试、发布证据 | PARTIAL | 已做真实 Gitea app-area 提交/去重/404/离线入队;真实 Bootstrap/知识/CLI 失败样本、附件真实上传与离线恢复全流程未全部运行,不得写成 PASS。 |
## 发行与更新(DIST)
| 门禁 | 状态 | 证据或限制 |
| --- | --- | --- |
| DIST-01 清单 schema、命名、tag/证据、Linux tar 冷安装 | PASS(本机) | `mqdh-release.json` + `.sha256` + `release-evidence.json`;归档 747 MB,内置 Node,冷安装/`doctor`/`dump-config` 通过;未发布。 |
| 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/install/rollback` 用本地发布服务器完成真实切换与回退;无可发布的真实 Release;通知/对账未实现。 |
| DIST-05 更新检查/安装/回退、通知与对账 | PARTIAL | `update check` 对真实 Release 可用;`install/rollback` 仍只用本地发布服务器完成真实切换与回退;自动下载/安装按政策关闭,通知/对账未实现。 |
## 生态目录、局部调用与阅读(CAT)
@@ -0,0 +1,22 @@
# `mqdh status` 生态版本视图(app-harness#16 切片)
Date: 2026-11-30. Branch: `codex/issue-16-status-view`.
Baseline: `a1517652c29ac51357275661a59e7814b596efc8`(main)。
## 交付
- 新增只读产品命令 `mqdh status [--json]`:一次输出应用版本/home/workspace、平台与 Node、运行时候选版本、生态环境 id、Bundle 版本/模块数/摘要、已安装 Tool 版本、market/knowledge 计数与 privacy 常量;JSON schema `marqdo.mqdh.status`(`schema_version: 1`)。
- `scripts/mqdh.mjs` 的产品命令集合加入 `status`(避免落到 DSH 转发);HELP 更新。
- `docs/mqdh/ARCHITECTURE.md` 产品命令列表更新。
- 测试:`packages/marqdo/harness/tests/cli.test.ts` 新增 `status` JSON/文本断言(未安装生态时如实显示 not installed/false)。
## 验证(本机,Linux x86_64 / glibc 2.43)
```text
$ node --import tsx/esm --test packages/marqdo/harness/tests/cli.test.ts
6 pass, 0 fail
```
该命令只读现有 `MdhRuntime.status()` 状态,不触发安装/网络/更新;不是 #16 的
“最新版本/发布说明/下载入口”完整生态版本检查,那部分保持 UNVERIFIED。未运行
完整组件测试,组件 CI 结果以平台为准。
@@ -0,0 +1,27 @@
# `mqdh status` 持久化更新视图(app-harness#16 切片)
Date: 2026-11-30. Branch: `codex/issue-16-status-update`.
Baseline: `28df81ee11d2dccc0a1a2606394c477ff7b09987`(main)。
## 交付
- `MdhStatus` 新增 `update: UpdateState`(读取已持久化的更新状态,不触网);
`MdhRuntime.status()` 返回它。
- `mqdh status --json` 输出 `update` 字段;文本输出新增
`update: channel=… checked=… available=… latest=… [error=…]`。
- `DISTRIBUTION.md` §4 区分只读状态视图与显式 `update check`(后者才触网)。
- 测试:`cli.test.ts` 断言空安装下 `update.schema`/`channel`/`checked_at`/
`latest` 与文本行。
## 验证(本机,Linux x86_64 / glibc 2.43)
```text
pnpm run typecheck → 5/5 PASS
node --import tsx/esm --test packages/marqdo/harness/tests/cli.test.ts → 6 pass
node --import tsx/esm --test packages/marqdo/harness/tests/*.test.ts → 77 pass / 3 skipped
```
## 边界
- 只读持久化状态;不刷新、不提示、不下载、不安装,不执行 E09 通知/对账。
- 未创建 release/tag;真实 Gitea 反馈提交与浏览器端到端仍 UNVERIFIED。
@@ -0,0 +1,28 @@
# 应用更新检查展示发布说明/官方下载/已知限制(app-harness#16 切片)
Date: 2026-11-30. Branch: `codex/issue-16-update-notes`.
Baseline: `eceb13a70a723d8623cbf7f4b1b6979bdc303680`(main)。
## 交付
- `release/gitea.ts`:可信 Gitea Release 的 `body` 进入候选(截断 8192 字节,空值 null);`AppReleaseCandidate.notes` 与 `browser_url` 明确。
- `distribution/updater.ts`:`UpdateCandidate` 新增 `notes` 与 `release_url`;持久化 `UpdateState.latest` 携带二者。
- CLI `mqdh update check` 文本输出新增 `published`/`download`(官方资产 URL)/`release`(Release 页面)/`known limits`/`release notes`;JSON 已直接包含这些字段。
- 文档:`DISTRIBUTION.md` §4 更新检查字段、`RELEASING.md` §7 发布说明唯一来源(Gitea Release body,不另建清单)。
- 测试:`updater.test.ts` 的 fake Gitea Release 带 body,断言 `latest.notes` 与 `latest.release_url`。
## 验证(本机,Linux x86_64 / glibc 2.43)
```text
node --import tsx/esm --test packages/marqdo/harness/tests/updater.test.ts
3 pass, 0 fail
node --import tsx/esm --test packages/marqdo/harness/tests/*.test.ts
77 pass, 0 fail, 3 skipped
pnpm run typecheck → 5 passed, 0 failed
```
## 边界
- 发布说明来自可信 Release body,显示为数据;不执行、不解析为指令,不冒充“更新说明已验证”。
- 仍不是完整生态(CLI/View/Tools/Bundle/Knowledge)的最新版本聚合;E09 通知/对账仍 UNVERIFIED。
- 未创建 release/tag;未运行浏览器/真实 Gitea 端到端。
@@ -0,0 +1,50 @@
# 反馈提交真实 Gitea 端到端(app-harness#16 §9)
Date: 2026-12-01. Branch: `codex/issue-16-feedback-e2e`.
环境:本机 Linux x86_64;真实 Gitea `git.cflmy.cn`;私有测试仓
`cflmy/mqdh-feedback-e2e`(仅用于验收,不是产品仓);真实 token 只在本地
git 忽略环境文件与进程环境,不写入仓库/日志/报告。
## 1. 真实链路
1. 在隔离 `MQDH_HOME` 中用产品运行时捕获一条脱敏诊断报告
(area=`app`、code=`e2e.feedback_probe`,不含凭据/私有数据)。
2. `mqdh report token --stdin` 保存 token 到私有凭据文件(0600)。
3. `mqdh report submit <id> --repo cflmy/mqdh-feedback-e2e --confirm --json`
通过真实 Gitea API 创建 Issue。
```json
{
"report_id": "2026-12-01-04-09-09-f990188d",
"status": "submitted",
"repository": "cflmy/mqdh-feedback-e2e",
"issue_url": "https://git.cflmy.cn/cflmy/mqdh-feedback-e2e/issues/1",
"comment": false,
"attachments_uploaded": [],
"attachment_errors": []
}
```
Issue #1 标题 `[app] e2e.feedback_probe: …`,正文含错误码/阶段/现象/预期、
应用/平台/Node/运行时/Bundle/Tool 身份、本地报告 id 与脱敏环境;不含凭据值。
## 2. 负例与队列
- **重复指纹**:再次提交返回 `"status":"deduplicated"`、
`issue_url` 同上、`"comment":true`,真实追加评论而非新建 Issue。
- **无效/无权限仓库**:`--repo cflmy/definitely-missing-repo` 返回
`Gitea API returned 404: not found`,退出码 1,不写回成功 URL。
- **离线队列**:`--offline --confirm` 返回 `"status":"queued"`、`issue_url:null`;
队列恢复提交仍需用户再次确认(CLI 设计),本轮未执行恢复。
## 3. 状态更新
- `DIAG-03` 从“PASS(替身)”更新为 **PASS(真实 Gitea + 替身)**:真实公网
Gitea 创建 Issue/去重评论/404 失败路径已验证;测试仓为私有夹具。
- `DIAG-05` 仍 **PARTIAL**:真实 Bootstrap/知识/CLI 失败样本与附件 multipart
真实上传、离线恢复全流程未全部演练,不写成 PASS。
## 4. 边界
- 私有测试仓 `cflmy/mqdh-feedback-e2e` 仅作验收夹具;Issue #1 保留作为证据。
- 未创建产品 tag/Release;未自动上传任何用户数据;token/报告不含凭据。
@@ -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<version>` 应用更新
渠道,根仓也不把它纳入推荐组合;正式支持仍需原生 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 <clean-prefix> -NoPath -NoShortcut
-> installed Marqdo Harness 0.1.0-beta.1 (0.1.0-beta.1-6b970439f52e)
<prefix>\bin\mqdh.cmd --version -> mqdh 0.1.0-beta.1
<prefix>\bin\mqdh.cmd doctor --json -> schema=marqdo.mqdh.doctor,
platform.target=x86_64-pc-windows-msvc,
supported=true, node=v24.22.3,
install_root=<prefix>
<prefix>\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)。
- 根仓接受/推荐:本次不进入推荐投影;由根仓按范围政策另行接受。
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@marqdo/mqdh-harness",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"description": "Marqdo Harness product services: ecosystem transactions, document-native execution, private knowledge and the /mqdh workbench",
"private": true,
"type": "module",
+53
View File
@@ -146,6 +146,7 @@ Usage: mqdh <command> [options]
Commands:
bootstrap [--channel stable|beta] [--offline <dir>] [--force] [--json]
status [--json]
doctor [--json]
repair [--json]
report list|show|export|submit|delete|token [...]
@@ -187,6 +188,8 @@ export async function runProductCli(argv: readonly string[], options: CliOptions
switch (parsed.command) {
case 'bootstrap':
return await runBootstrap(parsed, io, runtime)
case 'status':
return await runStatus(parsed, io, runtime)
case 'doctor':
return await runDoctor(parsed, io, runtime)
case 'repair':
@@ -241,6 +244,48 @@ async function runBootstrap(parsed: ParsedCommand, io: CliIO, runtime: () => Pro
return state.status === 'failed' ? 1 : 0
}
/** `mqdh status`: one read-only ecosystem/app version view. */
async function runStatus(parsed: ParsedCommand, io: CliIO, runtime: () => Promise<MdhRuntime>): Promise<number> {
expectNoSubcommand(parsed)
allowFlags(parsed, ['json'])
const app = await runtime()
const status = await app.status()
if (booleanFlag(parsed, 'json')) {
io.stdout(json({
schema: 'marqdo.mqdh.status',
schema_version: 1,
app: { version: APP_VERSION, home: status.home, workspace: status.workspace },
platform: status.platform,
node: status.node,
ecosystem: status.ecosystem,
market: status.market,
knowledge: status.knowledge,
privacy: status.privacy,
update: status.update,
}))
return 0
}
const environment = status.ecosystem.current
const version = environment ? `${environment.version} (${environment.id})` : 'not installed'
const tools = status.ecosystem.tools.length === 0
? 'none'
: status.ecosystem.tools.map(tool => `${tool.command} ${tool.version ?? 'unknown'}`).join(', ')
io.stdout([
`app: ${APP_VERSION} home: ${status.home}`,
`workspace: ${status.workspace}`,
`platform: ${status.platform} node: ${status.node}`,
`runtime: ${status.ecosystem.runtime.version ?? 'not installed'}`,
`environment: ${version}`,
`bundle: ${status.ecosystem.std.version ?? 'not installed'} modules=${status.ecosystem.std.modules.length} digest=${status.ecosystem.std.digest ?? 'n/a'}`,
`tools: ${tools}`,
`market: entries=${status.market.entries} installed=${status.market.installed} enabled=${status.market.enabled}`,
`knowledge: collections=${status.knowledge.collections} sources=${status.knowledge.sources} enabled=${status.knowledge.enabled}`,
`privacy: telemetry=${String(status.privacy.telemetry)} session_upload=${String(status.privacy.sessionUpload)} plugin_install=${String(status.privacy.pluginInstall)}`,
`update: channel=${status.update.channel} checked=${status.update.checked_at ?? 'never'} available=${String(status.update.update_available)} latest=${status.update.latest?.version ?? 'unknown'}${status.update.last_error === null ? '' : ` error=${status.update.last_error.code}`}`,
].join('\n') + '\n')
return 0
}
/** `mqdh doctor`. */
async function runDoctor(parsed: ParsedCommand, io: CliIO, runtime: () => Promise<MdhRuntime>): Promise<number> {
expectNoSubcommand(parsed)
@@ -389,6 +434,14 @@ async function runUpdate(parsed: ParsedCommand, io: CliIO, runtime: () => Promis
`channel: ${state.channel}`,
`latest: ${state.latest?.version ?? 'none'}${state.latest === null ? '' : ` (${state.latest.signature})`}`,
`update available: ${String(state.update_available)}`,
...(state.latest === null ? [] : [
`published: ${state.latest.published_at}`,
`download: ${state.latest.asset.url}`,
`release: ${state.latest.release_url}`,
...(state.latest.known_limits.length === 0 ? [] : ['known limits:']),
...state.latest.known_limits.map(limit => ` - ${limit}`),
...(state.latest.notes === null ? [] : ['release notes:', ...state.latest.notes.split('\n').map(line => ` ${line}`)]),
]),
...(state.last_error === null ? [] : [`error: ${state.last_error.code}: ${state.last_error.message}`]),
].join('\n') + '\n')
}
@@ -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')
}
@@ -52,6 +52,10 @@ export interface UpdateCandidate {
readonly node: string
readonly signature: 'verified' | 'unsigned'
readonly known_limits: readonly string[]
/** Release notes from the trusted release body, or null. */
readonly notes: string | null
/** Official browser URL of the release page. */
readonly release_url: string
}
/** Persisted update state. */
@@ -135,6 +139,8 @@ function candidateOf(candidate: AppReleaseCandidate): UpdateCandidate {
node: candidate.manifest.app.node,
signature: candidate.signature.status,
known_limits: candidate.manifest.known_limits,
notes: candidate.notes,
release_url: candidate.browser_url,
}
}
@@ -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'
@@ -38,6 +38,8 @@ export interface GiteaRelease {
readonly prerelease: boolean
readonly draft: boolean
readonly target_commitish: string | null
/** Release notes authored in the trusted Gitea release, truncated. */
readonly body: string | null
readonly assets: readonly GiteaAsset[]
}
@@ -72,11 +74,15 @@ function parseRelease(raw: unknown): GiteaRelease {
const record = raw as Record<string, unknown>
if (typeof record.tag_name !== 'string') throw new GiteaError('invalid_response', 'release has no tag_name')
const assets = Array.isArray(record.assets) ? record.assets.map(parseAsset) : []
const body = typeof record.body === 'string' && record.body.trim() !== ''
? record.body.slice(0, 8192)
: null
return {
tag_name: record.tag_name,
prerelease: record.prerelease === true,
draft: record.draft === true,
target_commitish: typeof record.target_commitish === 'string' ? record.target_commitish : null,
body,
assets,
}
}
@@ -131,6 +137,8 @@ export interface AppReleaseCandidate {
readonly asset: { readonly name: string; readonly url: string; readonly size: number; readonly sha256: string }
readonly manifest_url: string
readonly browser_url: string
/** Release notes from the release body, or null when absent. */
readonly notes: string | null
}
/** Read a detached signature asset when the release publishes one. */
@@ -258,6 +266,7 @@ async function inspectRelease(
},
manifest_url: manifestAsset.browser_download_url,
browser_url: `${authority}/${repository}/releases/tag/${release.tag_name}`,
notes: release.body,
}
}
+4
View File
@@ -35,6 +35,7 @@ import { BootstrapManager } from './bootstrap/manager.ts'
import { DiagnosticsStore } from './diagnostics/store.ts'
import type { DiagnosticIdentity } from './diagnostics/store.ts'
import { AppUpdater } from './distribution/updater.ts'
import type { UpdateState } from './distribution/updater.ts'
import { targetTriple } from './platform/detect.ts'
import { APP_VERSION } from './version.ts'
import type { KnowledgeSearchResult } from './knowledge/manager.ts'
@@ -88,6 +89,8 @@ export interface MdhStatus {
readonly privacy: { readonly telemetry: false; readonly sessionUpload: false; readonly pluginInstall: false }
readonly platform: string
readonly node: string
/** Persisted application update view (no network check on read). */
readonly update: UpdateState
}
/** Resolve one CLI path override safely. */
@@ -325,6 +328,7 @@ export class MdhRuntime {
privacy: { telemetry: false, sessionUpload: false, pluginInstall: false },
platform: `${process.platform}-${process.arch}`,
node: process.version,
update: await this.updater.state(),
}
}
+29
View File
@@ -80,3 +80,32 @@ test('a token is read from stdin and stored without appearing in output', async
assert.doesNotMatch(output.out.join(''), new RegExp(token))
assert.equal(await runtime.diagnostics.hasToken(), true)
})
test('status emits a read-only app and ecosystem version view', async () => {
const root = await mkdtemp(join(tmpdir(), 'mqdh-cli-'))
const runtime = await MdhRuntime.create({ home: join(root, 'home'), workspace: join(root, 'ws') })
const view = sink()
const code = await runProductCli(['status', '--json'], { io: view.io, runtime: async () => runtime })
assert.equal(code, 0)
const parsed = JSON.parse(view.out.join('')) as {
schema: string
app: { version: string; home: string }
ecosystem: { runtime: { installed: boolean }; std: { installed: boolean; modules: string[] } }
privacy: { telemetry: boolean; sessionUpload: boolean; pluginInstall: boolean }
update: { schema: string; channel: string; checked_at: string | null; latest: unknown }
}
assert.equal(parsed.schema, 'marqdo.mqdh.status')
assert.equal(parsed.app.version, APP_VERSION)
assert.equal(parsed.ecosystem.runtime.installed, false)
assert.equal(parsed.ecosystem.std.installed, false)
assert.deepEqual(parsed.privacy, { telemetry: false, sessionUpload: false, pluginInstall: false })
assert.equal(parsed.update.schema, 'marqdo.mqdh.update')
assert.equal(parsed.update.channel, 'stable')
assert.equal(parsed.update.checked_at, null)
assert.equal(parsed.update.latest, null)
const text = sink()
assert.equal(await runProductCli(['status'], { io: text.io, runtime: async () => runtime }), 0)
assert.match(text.out.join(''), /^app: /)
assert.match(text.out.join(''), /privacy: telemetry=false/)
assert.match(text.out.join(''), /update: channel=stable checked=never/)
})
@@ -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)
})
@@ -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)
})
@@ -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)
@@ -81,6 +81,7 @@ async function startReleaseServer(releases: readonly {
manifest: string
signature: string
size: number
body?: string
}[]): Promise<{ server: Server; authority: string; stop: () => void }> {
const server = createServer(async (req: IncomingMessage, res: ServerResponse) => {
const url = req.url ?? ''
@@ -92,6 +93,7 @@ async function startReleaseServer(releases: readonly {
prerelease: false,
draft: false,
target_commitish: null,
body: release.body ?? null,
assets: [
{ name: 'mqdh-release.json', size: Buffer.byteLength(release.manifest), browser_download_url: `${authority}/assets/${release.tag}/mqdh-release.json` },
{ name: 'mqdh-release.json.sig', size: Buffer.byteLength(release.signature), browser_download_url: `${authority}/assets/${release.tag}/mqdh-release.json.sig` },
@@ -144,21 +146,24 @@ async function makeUpdater(authority: string): Promise<{
}
test('checks, verifies, activates and rolls back a signed application release', async () => {
const productVersion = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version as string
const target = (await detectPlatform()).target
const root = await mkdtemp(join(tmpdir(), 'mqdh-release-build-'))
const v2 = await buildRelease({ root, version: '0.2.0', target })
const v3 = await buildRelease({ root, version: '0.3.0', target })
const server = await startReleaseServer([
{ tag: 'mqdh-v0.2.0', archive: v2.archive, manifest: v2.manifest, signature: v2.signature, size: v2.size },
{ tag: 'mqdh-v0.3.0', archive: v3.archive, manifest: v3.manifest, signature: v3.signature, size: v3.size },
{ tag: 'mqdh-v0.3.0', archive: v3.archive, manifest: v3.manifest, signature: v3.signature, size: v3.size, body: '修复启动问题并更新默认 Bundle。' },
])
const { updater, installRoot } = await makeUpdater(server.authority)
try {
const checked = await updater.check({ force: true })
assert.equal(checked.latest?.version, '0.3.0')
assert.equal(checked.latest?.signature, 'verified')
assert.equal(checked.latest?.notes, '修复启动问题并更新默认 Bundle。')
assert.match(checked.latest?.release_url ?? '', /releases\/tag\/mqdh-v0\.3\.0$/)
assert.equal(checked.update_available, true)
assert.equal(checked.current?.version, '0.1.0')
assert.equal(checked.current?.version, productVersion)
const installed = await updater.install({ confirm: true, version: '0.2.0' })
assert.equal(installed.current?.version, '0.2.0')
+2 -2
View File
@@ -34,10 +34,10 @@ if [ -z "$cli_sha" ] && [ -n "${MARQDO_BIN:-}" ]; then
cli_sha="$(cat "$(dirname "$MARQDO_BIN")/SOURCE_SHA" 2>/dev/null || true)"
fi
if [ -z "$cli" ]; then
version="3.0.0-rc.6"
version="3.0.0-rc.7"
archive="$work/marqdo-$version.tar.gz"
url="https://git.cflmy.cn/cflmy/marqdo-cli/releases/download/v$version/marqdo-$version-x86_64-unknown-linux-gnu.tar.gz"
expected="8dc0b006302e03c23451b8ea9f8a0fcdae8bf67c80c546bee2434bf69755bfe3"
expected="10714820c9620b1b7b0da59e8d3930fc71b769a722aa80ede6fa889659de4613"
echo "mqdh ci: downloading pinned CLI $version"
curl -fsSL --retry 3 --max-time 300 -o "$archive" "$url"
actual="$(sha256sum "$archive" | awk '{print $1}')"
+154
View File
@@ -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 `<prefix>\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"
+10
View File
@@ -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" %*
)
+7 -4
View File
@@ -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'
@@ -19,7 +19,7 @@ import { spawn } from 'node:child_process'
const here = dirname(fileURLToPath(import.meta.url))
const root = resolve(here, '..')
const productCommands = new Set(['bootstrap', 'doctor', 'repair', 'report', 'update', 'network', 'uninstall', 'help'])
const productCommands = new Set(['bootstrap', 'status', 'doctor', 'repair', 'report', 'update', 'network', 'uninstall', 'help'])
/** Resolve the application home without touching the user's `~/.dsh`. */
function resolveHome() {
@@ -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
}
+229
View File
@@ -0,0 +1,229 @@
<#
.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 = 'Continue'
Set-StrictMode -Version Latest
$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
}
+30 -9
View File
@@ -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<AppReleaseManifest, 'signature'> = {
},
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',
@@ -140,6 +155,12 @@ const evidence = {
signature: signed ? 'ed25519' : 'unsigned',
app: { source_sha: sourceSha, dsh_upstream_sha: upstreamSha, node },
compatibility: payload.compatibility,
dependencies: (() => {
const cliSha = (process.env.MQDH_CLI_SOURCE_SHA ?? '').trim()
if (cliSha === '') return []
if (!/^[0-9a-f]{40}$/.test(cliSha)) throw new Error('MQDH_CLI_SOURCE_SHA must be a full commit SHA')
return [{ id: 'cli', source_sha: cliSha }]
})(),
commands: [
`node scripts/release-manifest.ts --archive ${basename(archivePath)} --target ${target}`,
],