ld-vibe-harness 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +16 -0
- package/.codex-plugin/plugin.json +36 -0
- package/.mcp.json +17 -0
- package/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.en.md +104 -0
- package/README.md +144 -2
- package/adapters/_contract.js +39 -0
- package/adapters/_fs.js +59 -0
- package/adapters/antigravity/installer.js +153 -0
- package/adapters/codex/installer.js +126 -0
- package/adapters/dsh/cordis.patch.yml +10 -0
- package/adapters/dsh/index.js +240 -0
- package/adapters/dsh/installer.js +59 -0
- package/adapters/dsh/package.json +29 -0
- package/agents/ldvh-experience-recorder.md +33 -0
- package/agents/ldvh-friction-recorder.md +27 -0
- package/agents/ldvh-post-work-reviewer.md +38 -0
- package/agents/ldvh-pre-action-reviewer.md +38 -0
- package/agents/ldvh-researcher.md +41 -0
- package/assets/ldvh-plugin-icon-128.png +0 -0
- package/cli/ldvh.mjs +174 -0
- package/cordis.patch.yml +4 -0
- package/docs/ARCHITECTURE.md +112 -0
- package/docs/PRIVACY.md +23 -0
- package/hooks/_client.mjs +91 -0
- package/hooks/hook-engine.js +1219 -0
- package/hooks/post-tool-use.mjs +3 -0
- package/hooks/pre-invocation.mjs +3 -0
- package/hooks/pre-tool-use.mjs +3 -0
- package/hooks/session-start.mjs +3 -0
- package/hooks/stop.mjs +3 -0
- package/hooks.json +50 -0
- package/lib/after-integrity.js +124 -0
- package/lib/agent-lifecycle.js +127 -0
- package/lib/archived-lineage.js +58 -0
- package/lib/ask-text-guard.js +60 -0
- package/lib/assurance-registry.js +14 -0
- package/lib/atomic-write.js +85 -0
- package/lib/aux-task-registry.js +129 -0
- package/lib/capture-notice.js +43 -0
- package/lib/carrier-ref.js +11 -0
- package/lib/carrier-scan.js +104 -0
- package/lib/child-session-record.js +130 -0
- package/lib/coherence-report.js +21 -0
- package/lib/commit-validation.js +619 -0
- package/lib/concurrent-write-guard.js +27 -0
- package/lib/data-paths.js +68 -0
- package/lib/define-tool.js +106 -0
- package/lib/directory-picker.js +326 -0
- package/lib/event-stream.js +36 -0
- package/lib/experience-arming.js +175 -0
- package/lib/friction-discovery.js +383 -0
- package/lib/friction-failure-registration.js +56 -0
- package/lib/friction-observation-buffer.js +889 -0
- package/lib/friction-promotion-lock.js +124 -0
- package/lib/friction-review-promotion.js +193 -0
- package/lib/friction-tools.js +829 -0
- package/lib/friction-writer.js +1123 -0
- package/lib/gate-events.js +84 -0
- package/lib/git-gate-runner.js +442 -0
- package/lib/goal-anchor.js +100 -0
- package/lib/goal-tools.js +349 -0
- package/lib/goal-writer.js +452 -0
- package/lib/governance-scope.js +60 -0
- package/lib/governed-projects.js +560 -0
- package/lib/guidance-budget.js +138 -0
- package/lib/guidance-text.js +71 -0
- package/lib/guidance.js +257 -0
- package/lib/hook-manager.js +459 -0
- package/lib/hook-repair.js +54 -0
- package/lib/host-api.js +76 -0
- package/lib/host-seams.js +870 -0
- package/lib/idle-runlog.js +120 -0
- package/lib/idle-settings.js +63 -0
- package/lib/intent-tools.js +867 -0
- package/lib/intent-writer.js +1011 -0
- package/lib/ldvh-tools.js +1130 -0
- package/lib/markdown-structure.js +85 -0
- package/lib/membership-evidence.js +166 -0
- package/lib/milestone-tools.js +684 -0
- package/lib/milestone-writer.js +707 -0
- package/lib/mutation-coverage.js +41 -0
- package/lib/norm-assurance.js +56 -0
- package/lib/norm-directory.js +84 -0
- package/lib/norm-positioning.js +100 -0
- package/lib/norm-tools.js +758 -0
- package/lib/norm-writer.js +565 -0
- package/lib/object-identifier.js +140 -0
- package/lib/object-reference.js +37 -0
- package/lib/operation-declarations.bundle.json +313 -0
- package/lib/parameter-spec-adapter.js +160 -0
- package/lib/pitfall-tools.js +664 -0
- package/lib/pitfall-writer.js +535 -0
- package/lib/precheck-record.js +1357 -0
- package/lib/progressive-read.js +250 -0
- package/lib/quotation-text.js +13 -0
- package/lib/read-body-render.js +58 -0
- package/lib/recall-criteria.bundle.json +209 -0
- package/lib/recall-criteria.js +786 -0
- package/lib/recall-injection.js +845 -0
- package/lib/recall-synonyms.js +99 -0
- package/lib/report-tools.js +1042 -0
- package/lib/report-writer.js +1030 -0
- package/lib/research-consult-tools.js +424 -0
- package/lib/research-consult.js +203 -0
- package/lib/research-session.js +452 -0
- package/lib/review-ask-tool.js +437 -0
- package/lib/review-ask.js +317 -0
- package/lib/review-dispatch-template.js +162 -0
- package/lib/runtime-carrier-reader.js +811 -0
- package/lib/runtime-carrier-validator.js +948 -0
- package/lib/runtime-config.js +27 -0
- package/lib/session-scopes.js +22 -0
- package/lib/session-signature.js +299 -0
- package/lib/signature-channel.js +61 -0
- package/lib/source-recall.js +2032 -0
- package/lib/spec-registry.js +428 -0
- package/lib/summary-limit.js +16 -0
- package/lib/test-run-report.js +128 -0
- package/lib/triggers.js +171 -0
- package/lib/turn-accumulator.js +130 -0
- package/lib/verification-run.js +195 -0
- package/lib/web-mount.js +488 -0
- package/lib/web-preferences.js +103 -0
- package/lib/write-diagnostics.js +8 -0
- package/lib/zstd-compat.js +140 -0
- package/mcp_config.json +11 -0
- package/package.json +99 -4
- package/plugin-specs/controlled-commit.yaml +233 -0
- package/plugin-specs/experience-accumulation-system-foundation.yaml +308 -0
- package/plugin-specs/fact-model-common.yaml +313 -0
- package/plugin-specs/friction-fact-type.yaml +333 -0
- package/plugin-specs/friction-settlement-system-foundation.yaml +334 -0
- package/plugin-specs/gate-consult-system-foundation.yaml +337 -0
- package/plugin-specs/goal-fact-type.yaml +205 -0
- package/plugin-specs/goal-planning-system-foundation.yaml +296 -0
- package/plugin-specs/intent-fact-type.yaml +243 -0
- package/plugin-specs/intent-record-system-foundation.yaml +281 -0
- package/plugin-specs/ldvh-root.yaml +251 -0
- package/plugin-specs/milestone-fact-type.yaml +212 -0
- package/plugin-specs/norm-fact-type.yaml +172 -0
- package/plugin-specs/pitfall-fact-type.yaml +292 -0
- package/plugin-specs/report-fact-type.yaml +152 -0
- package/plugin-specs/research-system-foundation.yaml +306 -0
- package/plugin-specs/rule-compliance-recall.yaml +250 -0
- package/plugin-specs/rule-compliance-verification.yaml +207 -0
- package/plugin-specs/service-contract.yaml +218 -0
- package/plugin.json +19 -0
- package/rules/AGENTS.md +16 -0
- package/server/local-daemon.js +491 -0
- package/server/mcp-app-html.js +576 -0
- package/server/mcp-server.js +515 -0
- package/server/tool-registry.js +114 -0
- package/skills/ldvh-controlled-commit/SKILL.md +44 -0
- package/skills/ldvh-governance-flow/SKILL.md +51 -0
- package/skills/ldvh-onboarding/SKILL.md +30 -0
- package/web/package.json +67 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ldvh",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "把项目目标、里程碑、意图、规范、报告、踩坑经验与摩擦账本落盘为随 Git 演进的结构化事实(ldvh-base/);每轮动手前按预算只注入轻量候选索引(不灌全文、按需精读),高风险写入强制 Human 确认,支持零上下文子代理审方案、核结果与联网取证,提交由 Git Gate 校验并附会话签名,配本地/远程 Web 看板。",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "LaoDing",
|
|
7
|
+
"url": "https://github.com/dingminhua"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/dingminhua/ld-vibe-harness",
|
|
10
|
+
"repository": "https://github.com/dingminhua/ld-vibe-harness",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": ["ldvh", "governance", "mcp", "ai-coding", "memory", "git-gate"],
|
|
13
|
+
"mcpServers": "./.mcp.json",
|
|
14
|
+
"skills": "./skills/",
|
|
15
|
+
"agents": "./agents/"
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"name": "ldvh",
|
|
4
|
+
"description": "把项目目标、里程碑、意图、规范、报告、踩坑经验与摩擦账本落盘为随 Git 演进的结构化事实(ldvh-base/);每轮动手前按预算只注入轻量候选索引(不灌全文、按需精读),高风险写入强制 Human 确认,支持零上下文子代理审方案、核结果与联网取证,提交由 Git Gate 校验并附会话签名,配本地/远程 Web 看板。",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "LaoDing",
|
|
7
|
+
"url": "https://github.com/dingminhua"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/dingminhua/ld-vibe-harness",
|
|
10
|
+
"repository": "https://github.com/dingminhua/ld-vibe-harness",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": ["ldvh", "governance", "mcp", "ai-coding", "memory", "git-gate"],
|
|
13
|
+
"mcpServers": "./.mcp.json",
|
|
14
|
+
"skills": "./skills/",
|
|
15
|
+
"interface": {
|
|
16
|
+
"displayName": "LDVH",
|
|
17
|
+
"shortDescription": "随 Git 演进的 AI 协作事实源与工程护栏:自动召回、人工门禁、独立复核与 Git Gate",
|
|
18
|
+
"longDescription": "AI 编程的根本矛盾在于:模型推理是概率性的、对话上下文会遗忘和稀释,而长期软件项目需要确定性的依据、边界与接续。LD Vibe Harness(LDVH)在项目仓库的 ldvh-base/ 中沉淀 Goal、Milestone、Intent、Norm、Report、Pitfall、Friction 七类结构化事实,并在执行链上挂接四项机械保障:动手前按预算仅注入轻量候选索引(不灌全文、按需精读)、高风险写入强制 Human 确认、可选零上下文子代理行动前审查与收口前复核、以及带会话签名的 Git Gate 终闸,同时提供本地与远程 Web 看板,且在 Antigravity、Codex、DSH 与 Claude Code 间共享 ~/.ldvh 数据目录。",
|
|
19
|
+
"developerName": "LaoDing",
|
|
20
|
+
"category": "Engineering",
|
|
21
|
+
"capabilities": ["Interactive", "Read", "Write"],
|
|
22
|
+
"websiteURL": "https://github.com/dingminhua/ld-vibe-harness",
|
|
23
|
+
"defaultPrompt": [
|
|
24
|
+
"检查当前项目是否受 LDVH 管辖,并展示项目目标与待决定事项"
|
|
25
|
+
],
|
|
26
|
+
"brandColor": "#10B981",
|
|
27
|
+
"composerIcon": "./assets/ldvh-plugin-icon-128.png",
|
|
28
|
+
"logo": "./assets/ldvh-plugin-icon-128.png",
|
|
29
|
+
"screenshots": [
|
|
30
|
+
"./docs/screenshots/01-focus.png",
|
|
31
|
+
"./docs/screenshots/02-facts.png",
|
|
32
|
+
"./docs/screenshots/03-diagnostics.png",
|
|
33
|
+
"./docs/screenshots/04-help.png"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
package/.mcp.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"ldvh": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["./server/mcp-server.js"],
|
|
6
|
+
"startup_timeout_sec": 20,
|
|
7
|
+
"tool_timeout_sec": 600,
|
|
8
|
+
"default_tools_approval_mode": "approve",
|
|
9
|
+
"tools": {
|
|
10
|
+
"ldvh_register_governed_project": { "approval_mode": "prompt" },
|
|
11
|
+
"ldvh_unregister_governed_project": { "approval_mode": "prompt" },
|
|
12
|
+
"ldvh_intent_write": { "approval_mode": "prompt" },
|
|
13
|
+
"ldvh_norm_write": { "approval_mode": "prompt" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# 变更日志
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-11-30
|
|
4
|
+
|
|
5
|
+
面向外部开箱可用性的关键修复与核心能力升级:运行时规范打包解耦、Hook 注入与远程 MCP App 修复、双源召回优先级与零向量同义词/路径增量补强、7 类事实对象渐进式精读以及经验/摩擦独立子代理全权落盘。
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- **随包精简运行时规范载体**:将运行期规范收口为 19 份 `plugin-specs/*.yaml` 与构建期生成的 `lib/*.bundle.json`(`specs/` 仅留存仓库作开发设计参考,不再打入 npm 包)。
|
|
10
|
+
- **确定性零向量同义词补漏**:新增 `lib/recall-synonyms.js`(21 组封闭工程与 LDVH 领域词组,兼容中文 bigram 粒度、排除泛词),接入事实源与载体召回,在原生弱命中/未命中时低权补漏并标注 `原词→扩展词`。
|
|
11
|
+
- **工具后路径上下文增量提醒**:`PostToolUse` 在受管辖仓库通过独立 `turn-paths/<hash>.json` 记录刚触及的源码相对路径(Windows realpath 归一化、排除 `ldvh-base/`),同回合后续 `PreInvocation` 按路径定向提醒 `active Norm` 与 `active Pitfall`(回合级去重、纯读取回合排除、`Stop` 自动清理)。
|
|
12
|
+
- **全系 7 类事实对象渐进式精读**:新增 `lib/progressive-read.js` 并重构 `lib/read-body-render.js`,统一接入 `ldvh_{goal,milestone,intent,norm,pitfall,friction,report}_read`,支持磁盘 1-based `headings` 目录、`include_body: false` 仅读大纲与 `sections` 按 H2 节选(显式披露 `missing_sections`、`outcome: "partial"` 与 CAS 写前全量回读警示)。
|
|
13
|
+
- **运行时载体条款级行号定位**:`lib/runtime-carrier-reader.js` 使用 `yaml` `LineCounter` 剥离尾空行精确提取 `requirements` 起止行号,`lib/recall-injection.js` 在预算允许时附带缩进式条款行号子行并透出实际送达的 `renderedFactUids`。
|
|
14
|
+
- **经验与摩擦独立子代理落盘**:新增 `agents/ldvh-friction-recorder.md` 与 `lib/capture-notice.js`;确立主控只发现可回指材料并后台派发子代理(经验由 `ldvh-experience-recorder` 授权直写,摩擦由 `ldvh-friction-recorder` 写观察缓冲并在同源满 3 次时由工具以子代理会话签名自动晋升),同时升级 `Stop` Hook 收口防死循环护栏。
|
|
15
|
+
- **双源召回高优锚点与基准评测**:新增 `lib/goal-anchor.js` 常驻目标与活跃里程碑锚点及 `scripts/eval-recall.mjs` 7 场景召回基准评测脚本。
|
|
16
|
+
|
|
17
|
+
### 变更
|
|
18
|
+
|
|
19
|
+
- **双源召回优先级重构**:确立高优先权重(目标/里程碑/事实规范居首、踩坑经验次之,`FACT_TYPE_PRIORITY`),支持标识符子词拆解(`expandIdentifierSubtokens`)、显式路径上下文提权、运行时载体泛词停用治理及跨进程 `hook-turn-state.json` 同回合去重。
|
|
20
|
+
- **34 个模型可见 MCP 工具**:下线旧规范全文读取工具 `ldvh_read_specification_candidates` 与 `ldvh_read_specification_content`(运行时改走轻量载体定位 + 按行号按需读取)。
|
|
21
|
+
- **术语与把关点位统一**:清理 `plugin-specs/*.yaml` 中残留中文旧术语(`火花` → `意图`、`子目标` → `里程碑`);`ldvh_review_ask` 对齐 `pre-action`(`candidate_summary`)、`post-work`(`conclusion_summary`)摘要校验与 `point="research"` 统一请示点位;Git Gate 强拦范围扩展覆盖 `plugin-specs/`。
|
|
22
|
+
|
|
23
|
+
### 修复
|
|
24
|
+
|
|
25
|
+
- **独立发布依赖与 Windows CRLF 兼容**:补齐 `web/api-js` 运行时依赖(`compression`、`cors`、`dotenv`、`express`、`js-yaml`)至根 `package.json`;修复 `lib/spec-registry.js` 在 Windows CRLF 换行下的解析失败。
|
|
26
|
+
- **Antigravity Hook 注入静默丢失与陈旧 daemon 淘汰**:移除 `PreInvocation` / `SessionStart` 中触发宿主静默丢弃的 `metadata.user_markdown`;在 `server/local-daemon.js` 与 `hooks/_client.mjs` 增加 `codeFingerprint` 与 `POST /admin/shutdown` 自动优雅淘汰陈旧常驻服务。
|
|
27
|
+
- **远程 MCP App 2 MiB 超限 500 故障**:`ObjectDetail.tsx` 改用 `PrismLight`(18 种语言)、仅开发环境启用 `react-dev-locator`、`server/mcp-app-html.js` 增设 1.4 MiB 自动 gzip + `DecompressionStream` 自解压兜底,将单文件序列化体积压至约 1.14 MiB(守卫阈值 `< 1.5 MiB`)。
|
|
28
|
+
- **事实源直写拦截与多宿主 Human Gate 闭环**:`hooks/hook-engine.js` 拦截受管辖项目 `write_file` / `edit_file` 直写 `ldvh-base/`(使用 `realpathSync.native` 兼容 Windows 8.3 短路径);非 Hook 宿主(Codex / Claude Code)支持 `human_confirmed: true` 闭环(Antigravity 下仍强制 `force_ask` 不可绕过);拦截子代理直调 `ldvh_friction_write`。
|
|
29
|
+
- **DSH 适配器补全与泛目录线索过滤**:`adapters/dsh/index.js` 补全 `/ldvh/api/plugin-settings` GET/POST 接口与 `systemPrompt` 注册;修复 `git status --porcelain` 对未跟踪目录产出纯目录线索导致路径召回误命中的缺陷。
|
|
30
|
+
|
|
31
|
+
### 移除
|
|
32
|
+
|
|
33
|
+
- 模型可见工具 `ldvh_read_specification_candidates`、`ldvh_read_specification_content`。
|
|
34
|
+
- npm 发布包中的 `specs/` 目录(仍保留于仓库用于开发参考)。
|
|
35
|
+
|
|
36
|
+
## [0.1.0] - 2026-11-30
|
|
37
|
+
|
|
38
|
+
多宿主「单核多壳」架构重构后的首个正式发布版本(旧版代码归档在分支 `backup/main-legacy`)。
|
|
39
|
+
|
|
40
|
+
### 新增
|
|
41
|
+
|
|
42
|
+
- **多宿主行业清单**:`plugin.json`(Antigravity)、`.codex-plugin/plugin.json` 与 `.mcp.json`(Codex / Claude Code)、`.claude-plugin/plugin.json`(Claude Code)、根包 `cordis.patch.yml` 与 `adapters/dsh`(DSH Cordis 插件)。
|
|
43
|
+
- **统一数据目录与 `ldvh host` CLI**:三宿主默认共享 `~/.ldvh`(可用 `LDVH_DATA_DIR` 覆盖,刻意忽略 `PLUGIN_DATA` 以防 Hook 与 MCP 分库);新增 `ldvh host <list|inspect|setup>` 检查与安装命令。
|
|
44
|
+
- **36 个模型可见 MCP 工具 + 隧道代理**:含只读签名自查工具 `ldvh_session_signature` 及 app-only 代理 `ldvh_app_api_proxy`。
|
|
45
|
+
- **可观测事件账**:`~/.ldvh/ldvh/gate-events.jsonl`(环形保留最近 500 条),记录 `SessionStart`、`PreInvocation`、Hook 拦截与 MCP 工具调用,诊断页直接读取。
|
|
46
|
+
- **把关与积累协同**:`ldvh_review_ask` 新增 `record_decision` 显式留痕;召回命中附用户可见回显;经验积累与摩擦发现开关状态随会话注入。
|
|
47
|
+
- **全新 Web 看板体验**:监听 `0.0.0.0:3299` 支持本机与局域网访问;提供预编译后端产物(`web/api-js`、`web/shared-js`)、聚焦页项目/分支两级条、跨平台原生目录选择框、全新 5 章节帮助手册(`/help`)以及单文件自包含 MCP App(支持远程 `antigravity.google.com` 直接访问)。
|
|
48
|
+
- **通用中文 Skills 与子代理**:`ldvh-onboarding`、`ldvh-controlled-commit`、`ldvh-governance-flow` 及 4 个独立子代理(`ldvh-pre-action-reviewer`、`ldvh-post-work-reviewer`、`ldvh-researcher`、`ldvh-experience-recorder`)。
|
|
49
|
+
- **发布基建**:`package.json` `files` 白名单与 `prepack`、`scripts/check-pii.mjs` 隐私扫描门禁、`docs/PRIVACY.md`、`RELEASING.md` 与 GitHub Actions 双平台 CI(`.github/workflows/ci.yml`)。
|
|
50
|
+
|
|
51
|
+
### 变更
|
|
52
|
+
|
|
53
|
+
- **核心术语彻底统一**(不保留旧名别名):
|
|
54
|
+
- `Spark(火花)` → `Intent(意图)`:类型键 `intent`,载体 `ldvh-base/intents/intent-<uid>.md`,工具 `ldvh_intent_{read,list,precheck_create,write}`,规范 `specs/22-Intent-意图.md`,原 `intent` 字段改名为 `purpose`。
|
|
55
|
+
- `SubGoal(子目标)` → `Milestone(里程碑)`:类型键 `milestone`,载体 `ldvh-base/milestones/milestone-<uid>.md`,工具 `ldvh_milestone_{read,list,precheck_create,write}`,规范 `specs/21-Milestone-里程碑.md`。
|
|
56
|
+
- 业务系统「火花记录」→「意图记录」(`specs/31-意图记录系统规范.md`);`goal.md` 里的历史 `## 子目标` 段仍按旧规则只读识别。
|
|
57
|
+
- **温和统一署名引导**:AI 发起 `git commit` 时统一先查 `ldvh_session_signature` 并附带 `LDVH-Provider` / `LDVH-Model` 签名;Git Gate 仅对触及 `ldvh-base/` 或 `specs/` 的提交强拦,不阻碍人类手工提交与 `git merge`。
|
|
58
|
+
|
|
59
|
+
### 修复
|
|
60
|
+
|
|
61
|
+
- **懒加载 MCP 工具 Hook 适配**:扩展 `hooks.json` matcher 与 `hooks/hook-engine.js`(`unwrapLdvhToolCall`),兼容 `call_mcp_tool` / `mcp_tool` 包装解包与 `_ldvh_context` 注入。
|
|
62
|
+
- **文件版本守卫误拦**:连续 `write_file` / `edit_file` 成功后刷新版本基线。
|
|
63
|
+
- **摩擦晋升与 Git Gate**:修复 `ldvh_friction_record_observation` 在 Antigravity 下的会话上下文解析;Git Gate 去除 `--binary` diff 防止大二进制文件 `ENOBUFS`;修复 Codex JSON Schema `title` 关键字冲突并取消 `ask-text` 200 字符截断;修复 MCP App 内嵌 iframe 跨站误拦。
|
|
64
|
+
|
|
65
|
+
### 移除
|
|
66
|
+
|
|
67
|
+
- 工具 `ldvh_probe_host_automation`、`ldvh_inspect_loaded_modules`、`ldvh_collect_subagent_results`。
|
|
68
|
+
- 倒计时自动放行设置 `reviewAskTimeoutEnabled`、`reviewAskTimeoutSeconds`。
|
|
69
|
+
- Web 诊断页对旧宿主压缩日志与 `zstd` 的依赖。
|
|
70
|
+
|
|
71
|
+
### 升级提示
|
|
72
|
+
|
|
73
|
+
- 旧版 `ldvh-base/sparks/` 与 `ldvh-base/subgoals/` 下的存量对象不会被自动识别,需迁至 `intents/` 与 `milestones/` 并更新 `fact_type_key` 及 `purpose` 字段。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LaoDing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/ldvh-plugin-icon-128.png" width="88" alt="LDVH Icon" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">LDVH · LD Vibe Harness</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><b>Persist goals, norms, intents, and pitfalls as Git-tracked structured facts, and constrain AI coding with lightweight index recall, Human Gates, and a Git Gate.</b></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="README.md">简体中文</a> ·
|
|
11
|
+
<a href="#supported-hosts">Supported Hosts</a> ·
|
|
12
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
13
|
+
<a href="#web-dashboard">Web Dashboard</a> ·
|
|
14
|
+
<a href="CHANGELOG.md">Changelog</a> ·
|
|
15
|
+
<a href="RELEASING.md">Releasing</a> ·
|
|
16
|
+
<a href="https://github.com/dingminhua/ld-vibe-harness/issues">Issues</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://www.npmjs.com/package/ld-vibe-harness"><img src="https://img.shields.io/npm/v/ld-vibe-harness?style=flat-square&label=npm&color=cb3837" alt="npm version"></a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/ld-vibe-harness"><img src="https://img.shields.io/npm/d18m/ld-vibe-harness?style=flat-square&label=downloads&color=cb3837" alt="npm downloads"></a>
|
|
22
|
+
<a href="https://github.com/dingminhua/ld-vibe-harness/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/dingminhua/ld-vibe-harness/ci.yml?branch=main&style=flat-square&label=tests" alt="test status"></a>
|
|
23
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/dingminhua/ld-vibe-harness?style=flat-square" alt="MIT license"></a>
|
|
24
|
+
<a href="https://github.com/dingminhua/ld-vibe-harness/stargazers"><img src="https://img.shields.io/github/stars/dingminhua/ld-vibe-harness?style=flat-square" alt="GitHub stars"></a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
**LD Vibe Harness** (**LDVH**) is an exploration by LaoDing grounded in long-term AI-assisted software development. It provides clear boundaries, reliable grounds, and reusable experience, rules, and capabilities for Humans and AI working together on long-running projects—keeping work continuous and helping projects grow steadily more stable, controllable, and efficient through real accumulation.
|
|
28
|
+
|
|
29
|
+
Two chronic problems with AI coding:
|
|
30
|
+
|
|
31
|
+
- **Vibe drift** — over a long session, or a new one, the AI forgets the project's goals, agreed rules and open ideas, and starts coding on a hunch.
|
|
32
|
+
- **Coding out of control** — the AI writes and declares "done" itself; yesterday's pitfalls get stepped on again; recurring blockers go unrecorded; key conventions get changed in passing.
|
|
33
|
+
|
|
34
|
+
LDVH puts a harness on the AI. Goals, ideas, norms, lessons and frictions become **structured facts**, recalled automatically before each action. High-risk writes need a human's explicit approval, and a Git Gate checks commits mechanically.
|
|
35
|
+
|
|
36
|
+
## Supported hosts
|
|
37
|
+
|
|
38
|
+
| Host | Integration | MCP tools | Hook injection | Human Gate | Sub-agent review | Embedded dashboard |
|
|
39
|
+
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
|
|
40
|
+
| Antigravity | `plugin.json` + `mcp_config.json` + `hooks.json` | ✅ | ✅ (direct & `call_mcp_tool`) | Hook `force_ask` | ✅ | ✅ (local + remote self-contained MCP App) |
|
|
41
|
+
| Codex | `.codex-plugin/plugin.json` + `.mcp.json` | ✅ | — | `human_confirmed` / Web / CLI | — | browser |
|
|
42
|
+
| DSH | `adapters/dsh` (Cordis plugin) | ✅ | — | Embedded UI | ✅ | ✅ |
|
|
43
|
+
| Claude Code | `.claude-plugin/plugin.json` (reserved) | ✅ | — | `human_confirmed` / Web / CLI | — | browser |
|
|
44
|
+
|
|
45
|
+
"—" means the host has no equivalent interface yet; that capability falls back to the model following the guidance in `skills/`. The fact store, tools and Git Gate are unaffected.
|
|
46
|
+
|
|
47
|
+
All hosts share one data directory, **`~/.ldvh`** by default, so a goal recorded in Antigravity is recalled in Codex or DSH too. Set `LDVH_DATA_DIR` to isolate.
|
|
48
|
+
|
|
49
|
+
## Seven business systems
|
|
50
|
+
|
|
51
|
+
Goal planning · Intent capture · Dual-source recall · Gate consultation (pre-action review, post-work review, internal lookup before asking to search the web) · Research absorption · Experience accumulation · Friction write-off.
|
|
52
|
+
|
|
53
|
+
Four lines of defence: self-check → mechanical verification (controlled writes, read-back, Git Gate) → optional agent review → optional agent re-check.
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
Requires Node.js ≥ 22.15.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/dingminhua/ld-vibe-harness.git
|
|
61
|
+
cd ld-vibe-harness
|
|
62
|
+
npm install
|
|
63
|
+
(cd web && pnpm install && pnpm run build:dsh) # build the dashboard (web/dist is not committed)
|
|
64
|
+
|
|
65
|
+
node cli/ldvh.mjs host list
|
|
66
|
+
node cli/ldvh.mjs host setup --host antigravity --apply # -> ~/.gemini/config/plugins/ldvh
|
|
67
|
+
node cli/ldvh.mjs host setup --host codex --apply # -> ~/.codex/config.toml + skills
|
|
68
|
+
dsh plugin --profile <profile> add ./adapters/dsh # DSH
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Without `--apply`, `host setup` is a dry run.
|
|
72
|
+
|
|
73
|
+
## Web dashboard
|
|
74
|
+
|
|
75
|
+
- **Local, LAN & Remote**: The daemon listens on `0.0.0.0:3299` by default (random free port on conflict): `http://127.0.0.1:3299/ldvh/`. The Antigravity MCP App (`ui://ldvh/app.html`) is bundled as a self-contained single HTML file tunneling API calls via `ldvh_app_api_proxy`, so it works cleanly even on remote `antigravity.google.com`.
|
|
76
|
+
- **Pages**: Focus (project/branch switcher), 7 fact-type views, Directory, Changes, Commits, Diagnostics (`~/.ldvh/ldvh/gate-events.jsonl` & friction counters), Settings (native OS folder picker & review/assist toggles), and a redesigned 5-chapter Help guide (`/help`).
|
|
77
|
+
- **Prebuilt API**: `pnpm run build:dsh` outputs precompiled `web/api-js` and `web/shared-js` for instant startup.
|
|
78
|
+
|
|
79
|
+
| Focus Overview (Goal / Milestones / Recent Activity) | Structured Facts Board (7 Fact Types) |
|
|
80
|
+
| :---: | :---: |
|
|
81
|
+
|  |  |
|
|
82
|
+
| **Diagnostics & Gate Events** | **5-Chapter Interactive Help Guide** |
|
|
83
|
+
|  |  |
|
|
84
|
+
|
|
85
|
+
## Controlled commits & unified signing
|
|
86
|
+
|
|
87
|
+
- Exposes **34 model-visible MCP tools** (including read-only `ldvh_session_signature`) plus app-only `ldvh_app_api_proxy`. Runtime recall uses bundled `plugin-specs/*.yaml` (`specs/` stays in the git repo only and is excluded from the npm tarball).
|
|
88
|
+
- In governed repos, AI-initiated commits query `ldvh_session_signature` and attach `LDVH-Provider` / `LDVH-Model` trailers, while Git Gate only enforces strict checks when `ldvh-base/`, `specs/`, or `plugin-specs/` are staged (leaving manual human commits and `git merge` unhindered).
|
|
89
|
+
- **Terminology**: v2 standardized `Intent` (replacing `Spark`) and `Milestone` (replacing `SubGoal`); see the Help page's Verify & FAQ chapter for legacy repo migration steps.
|
|
90
|
+
|
|
91
|
+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) (Chinese) and [CHANGELOG.md](CHANGELOG.md). Legacy code lives on the `backup/main-legacy` branch.
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm run lint
|
|
97
|
+
npm test
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Privacy, Releasing & License
|
|
101
|
+
|
|
102
|
+
- **Privacy**: Local-first with zero telemetry — see [docs/PRIVACY.md](docs/PRIVACY.md).
|
|
103
|
+
- **Release Flow**: See [RELEASING.md](RELEASING.md) (Chinese).
|
|
104
|
+
- **License**: [MIT](LICENSE) (Copyright (c) 2026 LaoDing). Legacy code lives on `backup/main-legacy`.
|
package/README.md
CHANGED
|
@@ -1,3 +1,145 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/ldvh-plugin-icon-128.png" width="88" alt="LDVH 图标" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">LDVH · LD Vibe Harness</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><b>把目标、规范、意图与踩坑经验落成随 Git 演进的结构化事实,用轻量索引召回、人工门禁与 Git Gate 约束 AI 协作。</b></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="README.en.md">English</a> ·
|
|
11
|
+
<a href="#支持的宿主">支持的宿主</a> ·
|
|
12
|
+
<a href="#快速开始">快速开始</a> ·
|
|
13
|
+
<a href="#web-看板">Web 看板</a> ·
|
|
14
|
+
<a href="CHANGELOG.md">更新日志</a> ·
|
|
15
|
+
<a href="RELEASING.md">发布流程</a> ·
|
|
16
|
+
<a href="https://github.com/dingminhua/ld-vibe-harness/issues">问题反馈</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://www.npmjs.com/package/ld-vibe-harness"><img src="https://img.shields.io/npm/v/ld-vibe-harness?style=flat-square&label=npm&color=cb3837" alt="npm version"></a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/ld-vibe-harness"><img src="https://img.shields.io/npm/d18m/ld-vibe-harness?style=flat-square&label=downloads&color=cb3837" alt="npm downloads"></a>
|
|
22
|
+
<a href="https://github.com/dingminhua/ld-vibe-harness/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/dingminhua/ld-vibe-harness/ci.yml?branch=main&style=flat-square&label=tests" alt="test status"></a>
|
|
23
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/dingminhua/ld-vibe-harness?style=flat-square" alt="MIT license"></a>
|
|
24
|
+
<a href="https://github.com/dingminhua/ld-vibe-harness/stargazers"><img src="https://img.shields.io/github/stars/dingminhua/ld-vibe-harness?style=flat-square" alt="GitHub stars"></a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
**LD Vibe Harness** 是 LaoDing 基于长期 AI 协作开发经验所作的一种探索,为 Human 与 AI 协同推进长期项目提供清晰边界、可靠依据和可复用的经验、规则与能力,帮助工作持续接续,并为项目在实际积累中逐步变得更稳定、更可控、更高效创造条件,简称为 **LDVH**。
|
|
28
|
+
|
|
29
|
+
AI 编程的两个老问题:
|
|
30
|
+
|
|
31
|
+
- **Vibe 漂移**:会话一长或换会话,AI 就忘了项目目标、既定规矩与未决想法,开始凭感觉改代码。
|
|
32
|
+
- **Coding 失控**:AI 自己写、自己说“改好了”;踩过的坑下周重踩;反复卡壳的毛病没人记账;关键约定被顺手改掉也没人拦。
|
|
33
|
+
|
|
34
|
+
LDVH 给 AI 套一副工程缰绳:把目标、想法、规范、经验、摩擦沉淀成**结构化事实**,每轮动手前自动召回,高风险写入必须人工点头,提交前由 Git Gate 机械把关。
|
|
35
|
+
|
|
36
|
+
## 支持的宿主
|
|
37
|
+
|
|
38
|
+
| 宿主 | 接入方式 | MCP 工具 | Hook 自动注入 | 人工门禁 | 子代理把关 | 内嵌看板 |
|
|
39
|
+
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
|
|
40
|
+
| Antigravity | `plugin.json` + `mcp_config.json` + `hooks.json` | ✅ | ✅(兼容直连与 `call_mcp_tool`) | Hook `force_ask` | ✅ | ✅(本地 + 远程自包含 MCP App) |
|
|
41
|
+
| Codex | `.codex-plugin/plugin.json` + `.mcp.json` | ✅ | — | `human_confirmed` / Web / CLI | — | 浏览器 |
|
|
42
|
+
| DSH | `adapters/dsh`(Cordis 插件) | ✅ | — | 内嵌交互 | ✅ | ✅ |
|
|
43
|
+
| Claude Code | `.claude-plugin/plugin.json`(预留) | ✅ | — | `human_confirmed` / Web / CLI | — | 浏览器 |
|
|
44
|
+
|
|
45
|
+
“—”表示该宿主暂无等价接口,对应能力退化为按 `skills/` 指引由主控自觉执行;事实源、工具与 Git Gate 不受影响。
|
|
46
|
+
|
|
47
|
+
四个宿主默认**共享同一个数据目录 `~/.ldvh`**:在 Antigravity 里记下的目标与经验,换到 Codex 或 DSH 照样能召回。需要隔离时设置环境变量 `LDVH_DATA_DIR`。
|
|
48
|
+
|
|
49
|
+
## 七个业务系统
|
|
50
|
+
|
|
51
|
+
| 价值 | 业务系统 | 作用 |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
| 对齐 Vibe | 目标规划 | Goal / Milestone 承载长期意图与可核对的达成条件 |
|
|
54
|
+
| 对齐 Vibe | 意图记录 | Intent 承接值得跨行动推进的想法与未决问题 |
|
|
55
|
+
| 对齐 Vibe | 双源召回 | 每轮动手前从规范源与事实源召回相关候选 |
|
|
56
|
+
| 协调 Coding | 把关请示 | 行动前审方案、收口前复核结果、不掌握时先内查再请示联网 |
|
|
57
|
+
| 协调 Coding | 调研吸收 | 零上下文调研子代理联网取证并沉淀报告 |
|
|
58
|
+
| 协调 Coding | 经验积累 | 踩坑沉淀为 Pitfall,由后台代理异步记录 |
|
|
59
|
+
| 协调 Coding | 摩擦销账 | 系统性阻碍先进缓冲,累计到阈值自动晋升为待修 Friction |
|
|
60
|
+
|
|
61
|
+
四层防线:主控自查 → 机械校验(受控写入、回读、Git Gate)→ 可选代理审核 → 可选代理复核。登记/取消管辖、Intent/Norm 创建与终态等高风险写入始终走人工门禁。
|
|
62
|
+
|
|
63
|
+
## 快速开始
|
|
64
|
+
|
|
65
|
+
需要 Node.js ≥ 22.15。
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/dingminhua/ld-vibe-harness.git
|
|
69
|
+
cd ld-vibe-harness
|
|
70
|
+
npm install
|
|
71
|
+
(cd web && pnpm install && pnpm run build:dsh) # 构建 Web 看板(web/dist 不入库)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
查看支持的宿主与接入状态:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
node cli/ldvh.mjs host list
|
|
78
|
+
node cli/ldvh.mjs host inspect --host antigravity
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
各宿主接入(不加 `--apply` 只演练、不写盘):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Antigravity:同步到 ~/.gemini/config/plugins/ldvh
|
|
85
|
+
node cli/ldvh.mjs host setup --host antigravity --apply
|
|
86
|
+
|
|
87
|
+
# Codex:写入 ~/.codex/config.toml 的 [mcp_servers.ldvh] 并同步 skills
|
|
88
|
+
node cli/ldvh.mjs host setup --host codex --apply
|
|
89
|
+
|
|
90
|
+
# DSH:用 DSH 自带命令登记
|
|
91
|
+
dsh plugin --profile <profile> add ./adapters/dsh
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
登记一个受管辖项目(需要你明确确认):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
node cli/ldvh.mjs governed-project install --project /abs/path/to/repo --id my-repo --human-confirmed
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Web 看板
|
|
101
|
+
|
|
102
|
+
- **多端访问**:本地守护服务默认监听 `0.0.0.0:3299`(端口冲突自动顺延),本机与局域网设备均可访问 `http://127.0.0.1:3299/ldvh/`。Antigravity 面板内的 MCP App(`ui://ldvh/app.html`)采用单文件自包含打包并通过 `ldvh_app_api_proxy` 隧道代理请求,在远程 `antigravity.google.com` 同样全功能直连可用。
|
|
103
|
+
- **核心页面**:聚焦(项目/分支两级视角)、七类事实对象看板、目录、变更、提交、诊断(直读 `~/.ldvh/ldvh/gate-events.jsonl` 与摩擦观察进度)、设置(支持跨平台系统原生目录选择框与把关/积累开关)以及全新 5 章节帮助手册(`/help`)。
|
|
104
|
+
- **预编译直跑**:前端构建产物包含 `web/api-js` 与 `web/shared-js` 预编译后端,免实时转译启动。
|
|
105
|
+
|
|
106
|
+
| 聚焦总览(Goal / Milestone / 事实概览) | 结构化事实看板(七类对象管理) |
|
|
107
|
+
| :---: | :---: |
|
|
108
|
+
|  |  |
|
|
109
|
+
| **诊断与事件账(Hook / Gate Events)** | **五章节交互式帮助手册** |
|
|
110
|
+
|  |  |
|
|
111
|
+
|
|
112
|
+
## 受控提交与统一署名
|
|
113
|
+
|
|
114
|
+
- 仓库提供 **34 个模型可见 MCP 工具**(含只读路由自查工具 `ldvh_session_signature`)及 app-only 隧道工具 `ldvh_app_api_proxy`。
|
|
115
|
+
- 在受管辖仓库中,AI 发起任何 `git commit` 均统一先查询 `ldvh_session_signature`,使用中文标题、`关键变更:` 以及 `LDVH-Provider` / `LDVH-Model` trailer 署名;Git Gate 仅在暂存区触及 `ldvh-base/`、`specs/` 或 `plugin-specs/` 时强拦,不阻碍人类手工提交与 `git merge`。
|
|
116
|
+
- **术语提示**:v2 已将 `Spark → Intent`(`ldvh-base/intents/`)、`SubGoal → Milestone`(`ldvh-base/milestones/`)彻底统一;旧仓迁移指引见看板帮助页「自检与排错」。
|
|
117
|
+
|
|
118
|
+
## 目录结构
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
plugin.json mcp_config.json hooks.json Antigravity 清单
|
|
122
|
+
.codex-plugin/plugin.json .mcp.json Codex 清单(.mcp.json 同时供 Claude Code 使用)
|
|
123
|
+
.claude-plugin/plugin.json Claude Code 清单
|
|
124
|
+
lib/ server/ hooks/ cli/ 宿主无关核心:事实源、MCP 服务、Hook 引擎、命令行
|
|
125
|
+
adapters/ 多宿主薄适配层与安装器
|
|
126
|
+
skills/ agents/ rules/ 操作指引、子代理与治理锚点
|
|
127
|
+
plugin-specs/ 随包内置的运行时结构化规范(19 份 YAML)
|
|
128
|
+
web/ React 看板与 Express 接口
|
|
129
|
+
specs/ 开发期完整中文规范原文(不随 npm 包分发)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
更多设计见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md),版本变化见 [CHANGELOG.md](CHANGELOG.md)。
|
|
133
|
+
|
|
134
|
+
## 开发
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm run lint
|
|
138
|
+
npm test
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 隐私、发布与许可
|
|
142
|
+
|
|
143
|
+
- **隐私与数据边界**:全本地运行、零遥测,详见 [docs/PRIVACY.md](docs/PRIVACY.md)。
|
|
144
|
+
- **发布流程**:详见 [RELEASING.md](RELEASING.md)。
|
|
145
|
+
- **开源许可**:[MIT](LICENSE)(Copyright (c) 2026 LaoDing)。旧版代码归档在分支 `backup/main-legacy`。
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import antigravity from "./antigravity/installer.js";
|
|
2
|
+
import codex from "./codex/installer.js";
|
|
3
|
+
import dsh from "./dsh/installer.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 宿主适配器契约:新增宿主只需实现这几个字段并登记到 ADAPTERS。
|
|
7
|
+
*/
|
|
8
|
+
export const SUPPORTED_HOSTS = Object.freeze(["antigravity", "codex", "dsh"]);
|
|
9
|
+
|
|
10
|
+
const ADAPTERS = Object.freeze({ antigravity, codex, dsh });
|
|
11
|
+
|
|
12
|
+
const REQUIRED_CAPABILITIES = Object.freeze(["mcp", "hooks", "subagents", "embeddedUi", "webDashboard", "gitGate"]);
|
|
13
|
+
|
|
14
|
+
export function validateAdapterContract(adapter) {
|
|
15
|
+
const problems = [];
|
|
16
|
+
if (adapter === null || typeof adapter !== "object") return { ok: false, problems: ["适配器不是对象"] };
|
|
17
|
+
if (typeof adapter.host !== "string" || adapter.host.length === 0) problems.push("缺少 host");
|
|
18
|
+
if (typeof adapter.displayName !== "string" || adapter.displayName.length === 0) problems.push("缺少 displayName");
|
|
19
|
+
if (!Array.isArray(adapter.manifestPaths) || adapter.manifestPaths.length === 0) problems.push("manifestPaths 须为非空数组");
|
|
20
|
+
if (adapter.capabilities === null || typeof adapter.capabilities !== "object") {
|
|
21
|
+
problems.push("缺少 capabilities");
|
|
22
|
+
} else {
|
|
23
|
+
for (const key of REQUIRED_CAPABILITIES) {
|
|
24
|
+
if (typeof adapter.capabilities[key] !== "boolean") problems.push(`capabilities.${key} 须为布尔值`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
for (const fn of ["inspect", "install", "describeSetup"]) {
|
|
28
|
+
if (typeof adapter[fn] !== "function") problems.push(`缺少方法 ${fn}`);
|
|
29
|
+
}
|
|
30
|
+
return { ok: problems.length === 0, problems };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getHostAdapter(host) {
|
|
34
|
+
return Object.prototype.hasOwnProperty.call(ADAPTERS, host) ? ADAPTERS[host] : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function listHostAdapters() {
|
|
38
|
+
return SUPPORTED_HOSTS.map((host) => ADAPTERS[host]);
|
|
39
|
+
}
|
package/adapters/_fs.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cp, lstat, mkdir, readFile, realpath, rm, symlink, unlink } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 适配器共用的文件工具:只做幂等的复制、镜像与依赖联接,不含任何宿主逻辑。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export async function pathKind(path) {
|
|
9
|
+
try {
|
|
10
|
+
const info = await lstat(path);
|
|
11
|
+
if (info.isSymbolicLink()) return "symlink";
|
|
12
|
+
if (info.isDirectory()) return "dir";
|
|
13
|
+
if (info.isFile()) return "file";
|
|
14
|
+
return "other";
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error?.code === "ENOENT") return "missing";
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function readJsonIfExists(path) {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(await readFile(path, "utf8"));
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** 镜像目录:先清掉目标再整体复制,保证不残留源里已删除的文件。 */
|
|
30
|
+
export async function mirrorDir(from, to, { filter } = {}) {
|
|
31
|
+
await rm(to, { recursive: true, force: true });
|
|
32
|
+
await mkdir(dirname(to), { recursive: true });
|
|
33
|
+
await cp(from, to, { recursive: true, force: true, filter });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function copyFileTo(from, to) {
|
|
37
|
+
await mkdir(dirname(to), { recursive: true });
|
|
38
|
+
await cp(from, to, { force: true });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** 在目标处联接一个依赖目录(Windows 用 junction,其余平台用 dir 符号链接);已指向同一源则不动,指向别处则改指。 */
|
|
42
|
+
export async function linkDependencyDir(source, target) {
|
|
43
|
+
if (await pathKind(source) !== "dir") return { linked: false, reason: "source_missing" };
|
|
44
|
+
const existing = await pathKind(target);
|
|
45
|
+
if (existing === "symlink") {
|
|
46
|
+
const [wanted, current] = await Promise.all([realpath(source), realpath(target).catch(() => null)]);
|
|
47
|
+
if (current === wanted) return { linked: false, reason: "already_present", kind: existing };
|
|
48
|
+
await unlink(target);
|
|
49
|
+
} else if (existing !== "missing") {
|
|
50
|
+
return { linked: false, reason: "already_present", kind: existing };
|
|
51
|
+
}
|
|
52
|
+
await mkdir(dirname(target), { recursive: true });
|
|
53
|
+
await symlink(source, target, process.platform === "win32" ? "junction" : "dir");
|
|
54
|
+
return { linked: true, repointed: existing === "symlink" };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function joinAll(root, segments) {
|
|
58
|
+
return segments.map((segment) => join(root, segment));
|
|
59
|
+
}
|