fix: expose capability imports in the market projection #13

Merged
cflmy merged 1 commits from fix/market-imports-projection into main 2026-11-29 11:12:16 +08:00
7 changed files with 17 additions and 4 deletions

No files matched your search

+1 -1
View File
@@ -126,7 +126,7 @@
| CAT-04 真实浏览器与主题回归 | PASS(市场工作台) | Playwright Chromium 149 真实打开 `/mqdh`:无 page/console error、无外部请求、键盘焦点与 Enter 打开详情、420px 窄窗口、明/暗主题截图;证据见 [市场证据](evidence/2026-11-29-market.md#6-真实浏览器与主题回归)。完整五组目录的浏览器遍历仍属 CAT-01。 |
| CAT-05 动态市场来源、缓存/变更探测、离线目录 | PASS | `market.test.ts` 覆盖默认来源、目录发现、new/changed/stale、TTL、来源隔离、摘要/链接拒绝;真实 Gitea 通过 topic 发现 knowledge/lint/view,prove 无资产如实 warning;离线刷新保留官方旧条目并标记 `offline`,目录来源仍 `ok`。见 [市场证据](evidence/2026-11-29-market.md)。 |
| CAT-06 用户级能力存储、安装/激活、启用/撤销与模型可见性 | PASS | 能力载荷写入 `MQDH_HOME/capabilities/store`;Tool 注册到当前 Runtime 隔离 Tool home;未启用时 `visible=[]`,全局启用后出现,撤销后立即消失;安装/激活/导入/锁/卸载写审计。真实 rc.6 + view 0.3.0 已跑通。 |
| CAT-07 安装→项目导入门禁与 CLI 锁 | PASS | 未安装返回 `extension.not_installed`;已安装 ext 复制到 `marqdo-vendor/<alias>` 后由 CLI `add` 写声明、CLI `lock` 生成锁、`sync --locked` 通过;应用不写锁。 |
| CAT-07 安装→项目导入门禁与 CLI 锁 | PASS | 未安装返回 `extension.not_installed`;已安装 ext 复制到 `marqdo-vendor/<alias>` 后由 CLI `add` 写声明、CLI `lock` 生成锁、`sync --locked` 通过;应用不写锁。真实浏览器完成启用项目→导入→生成锁→卸载被引用拒绝。 |
| CAT-08 更新/卸载与项目引用 | PASS | 新版本安装后 `pending_activation=true`、旧版本保持激活,显式 `activate` 才切换;被 `marqdo.yaml`/`marqdo.lock` 引用时卸载返回 `extension.project_referenced`,强制卸载需显式 `force`;运行证据绑定锁摘要,重新锁后旧证据 stale。 |
| CAT-09 市场浏览器/键盘/窄窗口/暗色回归 | PASS | Playwright Chromium 149:刷新、详情、安装、启用当前项目、撤销、搜索无网络副作用;`market-refresh` 聚焦、行 Enter 打开详情;420px 窄窗口与 dark 媒体截图;0 external request、0 page error。 |
| READER-01 文稿/知识复用 Marqdo View 只读阅读 | UNVERIFIED(上游阻塞) | 等待 `marqdo-view#16` 公开只读嵌入与主题身份、`marqdo-view#15` 结果绑定;应用不实现第二套 Markdown/主题。 |
+6 -2
View File
@@ -68,7 +68,10 @@
"install",
"enable project scope",
"local search",
"disable all"
"disable all",
"with real Runtime: import via CLI add",
"lock via CLI lock",
"uninstall refused by project reference"
],
"page_errors": 0,
"console_errors": 0,
@@ -85,7 +88,8 @@
"screenshots": [
"2026-11-29-market-wide-light.png",
"2026-11-29-market-narrow-light.png",
"2026-11-29-market-narrow-dark.png"
"2026-11-29-market-narrow-dark.png",
"2026-11-29-market-import-refusal.png"
],
"status": "PASS"
},
Binary file not shown.

After

Width:  |  Height:  |  Size: 658 KiB

+4
View File
@@ -92,6 +92,10 @@ Playwright Chromium `149.0.7827.55`(Playwright `1.61.1`)在 `http://127.0.0.
![市场窄屏暗色](2026-11-29-market-narrow-dark.png)
带真实 Runtime 的第二轮浏览器流程:在“已安装”启用当前项目 → “导入项目(CLI add)”写入 `marqdo.yaml` 的 `./marqdo-vendor/demo` → “当前项目”点击“生成项目锁(CLI lock)”生成 `marqdo.lock` → 点击卸载返回 `extension.project_referenced`,能力保持安装。项目内副本、锁文件与拒绝结果均从页面按钮触发并落盘。
![项目导入与卸载拒绝](2026-11-29-market-import-refusal.png)
## 7. 未验证
- 真实浏览器、键盘遍历、窄窗口、亮/暗主题截图与回归;
@@ -62,6 +62,7 @@ export interface CapabilityView {
readonly tool_registered: boolean
}[]
readonly enabled: readonly CapabilityScope[]
readonly imports: readonly CapabilityImport[]
readonly project_references: readonly string[]
readonly update_available: boolean
readonly latest_version: string | null
@@ -335,6 +336,7 @@ export class CapabilityStore {
tool_registered: item.tool_registered,
})),
enabled: record.enabled,
imports: record.imports,
project_references: this.#references(record, texts),
update_available: isNewer(active?.version ?? null, latest),
latest_version: latest,
+1 -1
View File
@@ -902,7 +902,7 @@ function renderMarketProject() {
host.append(el('p', { text: 'marqdo.lock:' + (project.lock.present ? project.lock.digest : '缺失') }));
const imports = [];
for (const capability of data.capabilities) {
for (const item of capability.imports) imports.push(capability.name + ' -> ' + item.alias + ' (' + item.path + ')');
for (const item of capability.imports || []) imports.push(capability.name + ' -> ' + item.alias + ' (' + item.path + ')');
}
host.append(el('p', { class: 'muted', text: imports.length === 0 ? '尚无应用记录的导入。' : '应用记录的导入:' + imports.join(';') }));
host.append(el('p', { class: 'muted', text: '锁由 CLI 生成与校验;应用不解析第二套依赖图,也不把锁当作运行授权。' }));
@@ -342,6 +342,9 @@ test('project import materializes a project-local copy and delegates add to the
assert.equal(imported.next, 'marqdo lock')
assert.match(await readFile(join(f.workspace, 'marqdo-vendor', 'demo', 'index.mq.md'), 'utf8'), /return 1/)
assert.match(await readFile(join(f.workspace, 'marqdo.yaml'), 'utf8'), /demo/)
const view = await store.capability(key)
assert.equal(view?.imports.length, 1)
assert.equal(view?.imports[0]?.project_path, 'marqdo-vendor/demo')
} finally {
await cleanup(join(f.home, '..'))
}