ld-vibe-harness 0.2.0 → 0.3.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 +2 -2
- package/.codex-plugin/plugin.json +4 -4
- package/CHANGELOG.md +32 -0
- package/README.en.md +13 -12
- package/README.md +20 -20
- package/adapters/antigravity/installer.js +26 -8
- package/adapters/dsh/index.js +0 -3
- package/adapters/dsh/package.json +2 -2
- package/agents/ldvh-experience-recorder.md +2 -3
- package/agents/ldvh-post-work-reviewer.md +0 -1
- package/agents/ldvh-pre-action-reviewer.md +0 -1
- package/agents/ldvh-researcher.md +1 -2
- package/cli/ldvh.mjs +137 -5
- package/docs/ARCHITECTURE.md +37 -37
- package/docs/PRIVACY.md +7 -6
- package/hooks/_client.mjs +1 -12
- package/hooks/hook-engine.js +684 -84
- package/lib/capture-notice.js +8 -22
- package/lib/commit-validation.js +0 -59
- package/lib/data-paths.js +0 -1
- package/lib/experience-arming.js +10 -4
- package/lib/gate-events.js +27 -2
- package/lib/git-gate-runner.js +83 -34
- package/lib/goal-anchor.js +17 -45
- package/lib/goal-tools.js +4 -26
- package/lib/goal-writer.js +5 -18
- package/lib/governed-projects.js +18 -7
- package/lib/guidance-budget.js +2 -2
- package/lib/guidance-text.js +7 -7
- package/lib/hook-manager.js +40 -14
- package/lib/hook-repair.js +77 -13
- package/lib/host-api.js +7 -3
- package/lib/host-seams.js +78 -57
- package/lib/idle-settings.js +1 -4
- package/lib/intent-tools.js +6 -14
- package/lib/intent-writer.js +12 -45
- package/lib/ldvh-tools.js +26 -61
- package/lib/object-identifier.js +0 -2
- package/lib/object-reference.js +0 -2
- package/lib/operation-declarations.bundle.json +1 -64
- package/lib/recall-criteria.bundle.json +2 -67
- package/lib/recall-criteria.js +0 -2
- package/lib/recall-injection.js +1 -5
- package/lib/recall-synonyms.js +1 -3
- package/lib/research-consult-tools.js +201 -19
- package/lib/research-consult.js +49 -27
- package/lib/review-ask-tool.js +75 -11
- package/lib/review-ask.js +12 -9
- package/lib/source-recall.js +6 -16
- package/lib/web-preferences.js +2 -2
- package/package.json +2 -2
- package/plugin-specs/experience-accumulation-system-foundation.yaml +5 -25
- package/plugin-specs/fact-model-common.yaml +3 -14
- package/plugin-specs/gate-consult-system-foundation.yaml +39 -29
- package/plugin-specs/goal-fact-type.yaml +20 -67
- package/plugin-specs/goal-planning-system-foundation.yaml +27 -98
- package/plugin-specs/intent-fact-type.yaml +13 -22
- package/plugin-specs/intent-record-system-foundation.yaml +1 -2
- package/plugin-specs/ldvh-root.yaml +6 -6
- package/plugin-specs/norm-fact-type.yaml +1 -1
- package/plugin-specs/pitfall-fact-type.yaml +5 -49
- package/plugin-specs/report-fact-type.yaml +1 -1
- package/plugin-specs/research-system-foundation.yaml +12 -9
- package/plugin.json +4 -4
- package/rules/AGENTS.md +3 -3
- package/server/local-daemon.js +86 -28
- package/server/mcp-server.js +211 -53
- package/server/tool-registry.js +0 -23
- package/skills/ldvh-governance-flow/SKILL.md +10 -19
- package/skills/ldvh-onboarding/SKILL.md +2 -2
- package/agents/ldvh-friction-recorder.md +0 -27
- package/lib/aux-task-registry.js +0 -129
- package/lib/friction-discovery.js +0 -383
- package/lib/friction-failure-registration.js +0 -56
- package/lib/friction-observation-buffer.js +0 -889
- package/lib/friction-promotion-lock.js +0 -124
- package/lib/friction-review-promotion.js +0 -193
- package/lib/friction-tools.js +0 -829
- package/lib/friction-writer.js +0 -1123
- package/lib/milestone-tools.js +0 -684
- package/lib/milestone-writer.js +0 -707
- package/lib/verification-run.js +0 -195
- package/plugin-specs/friction-fact-type.yaml +0 -333
- package/plugin-specs/friction-settlement-system-foundation.yaml +0 -334
- package/plugin-specs/milestone-fact-type.yaml +0 -212
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldvh",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "把项目目标、意图、规范、报告与踩坑经验落盘为随 Git 演进的结构化事实(ldvh-base/);每轮动手前按预算只注入轻量候选索引(不灌全文、按需精读),高风险写入强制 Human 确认,支持零上下文子代理审方案、核结果与异步沉淀经验,遇外部难题先内查再请示联网取证,提交由 Git Gate 校验并附会话签名,配本地/远程 Web 看板。",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "LaoDing",
|
|
7
7
|
"url": "https://github.com/dingminhua"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.3.0",
|
|
3
3
|
"name": "ldvh",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "把项目目标、意图、规范、报告与踩坑经验落盘为随 Git 演进的结构化事实(ldvh-base/);每轮动手前按预算只注入轻量候选索引(不灌全文、按需精读),高风险写入强制 Human 确认,支持零上下文子代理审方案、核结果与异步沉淀经验,遇外部难题先内查再请示联网取证,提交由 Git Gate 校验并附会话签名,配本地/远程 Web 看板。",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "LaoDing",
|
|
7
7
|
"url": "https://github.com/dingminhua"
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"interface": {
|
|
16
16
|
"displayName": "LDVH",
|
|
17
17
|
"shortDescription": "随 Git 演进的 AI 协作事实源与工程护栏:自动召回、人工门禁、独立复核与 Git Gate",
|
|
18
|
-
"longDescription": "AI 编程的根本矛盾在于:模型推理是概率性的、对话上下文会遗忘和稀释,而长期软件项目需要确定性的依据、边界与接续。LD Vibe Harness(LDVH)在项目仓库的 ldvh-base/ 中沉淀 Goal、
|
|
18
|
+
"longDescription": "AI 编程的根本矛盾在于:模型推理是概率性的、对话上下文会遗忘和稀释,而长期软件项目需要确定性的依据、边界与接续。LD Vibe Harness(LDVH)在项目仓库的 ldvh-base/ 中沉淀 Goal、Intent、Norm、Report、Pitfall 五类结构化事实,并在执行链上挂接四项机械保障:动手前按预算仅注入轻量候选索引(不灌全文、按需精读)、高风险写入强制 Human 确认、可选零上下文子代理行动前审查与收口前复核、以及带会话签名的 Git Gate 终闸,同时提供本地与远程 Web 看板,且在 Antigravity、Codex、DSH 与 Claude Code 间共享 ~/.ldvh 数据目录。",
|
|
19
19
|
"developerName": "LaoDing",
|
|
20
20
|
"category": "Engineering",
|
|
21
21
|
"capabilities": ["Interactive", "Read", "Write"],
|
|
22
22
|
"websiteURL": "https://github.com/dingminhua/ld-vibe-harness",
|
|
23
23
|
"defaultPrompt": [
|
|
24
|
-
"检查当前项目是否受 LDVH
|
|
24
|
+
"检查当前项目是否受 LDVH 管辖,并展示项目目标与待推进意图"
|
|
25
25
|
],
|
|
26
26
|
"brandColor": "#10B981",
|
|
27
27
|
"composerIcon": "./assets/ldvh-plugin-icon-128.png",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## [0.3.0] - 2026-12-02
|
|
4
|
+
|
|
5
|
+
收敛五类事实模型与 26 个模型可见 MCP 工具,升级两选项中文 Human Gate 与全产品统一提请题面格式,改版联网调查为主控二选一与亲自调研闭环,并完善单页四渠道诊断、内嵌看板热重载/自愈与设置页独立卡片体验。
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- **单页四渠道诊断面板**:诊断页取消旧分页标签,扩展采集并聚合 `MCP`、`Hook`、`CLI`、`Git Gate` 四渠道事件账,区分「实际异常/拦截」与「待确认/半程流转」。
|
|
10
|
+
- **内嵌看板热重载与并发自愈**:新增 `POST /admin/reload-web` 热重载端点(`host setup --apply` 自动触发,不再误杀守护进程),支持 `/admin/shutdown` 后并发代理自动拉起自愈。
|
|
11
|
+
- **实战踩坑经验沉淀**:在 `ldvh-base/pitfalls/` 沉淀 4 条排障经验(Git Hook 迁移路径比对、Windows 尾反斜杠解析、内嵌 daemon 被 shutdown 失联、`webApiProcess.dispose` 不可逆 503)。
|
|
12
|
+
|
|
13
|
+
### 变更
|
|
14
|
+
|
|
15
|
+
- **五类事实模型与 26 工具收敛**:统一收敛为 `Goal`、`Intent`、`Norm`、`Report`、`Pitfall` 五类结构化事实与 26 个模型可见 MCP 工具(另含 app-only `ldvh_app_api_proxy`);随包运行期规范收口为 16 份 `plugin-specs/*.yaml`。
|
|
16
|
+
- **Human Gate 与全产品提请题面统一**:升级高风险写入门禁为 Hook 验签两选项中文审批(`确认执行` / `拒绝取消`)并自动补全对象标题;统一全产品 Human Gate、行动前/收口前把关与联网调查提请题面为 `LDVH <类别> - 是否<动作>:<对象>?`。
|
|
17
|
+
- **联网调查闭环改版**:遇复杂外部难题时由主控先检索内部事实源,仍缺再以二选一请示「联网调查 / 不调查」(人主动要求时不重复请示),获准后由主控亲自执行完整调研工序(`ldvh-researcher` 作为可选局部辅助)。
|
|
18
|
+
- **设置页卡片拆分与窄宽修复**:将「自主召回预算」与「经验积累」拆分为独立控制卡片,修复受管辖项目卡片在窄宽度下的挤压折行异常。
|
|
19
|
+
- **文档、帮助手册与截图同步**:全面更新 `README.md`、`README.en.md`、`RELEASING.md`、`docs/ARCHITECTURE.md`、`docs/PRIVACY.md`、多宿主清单描述、看板 5 章节帮助页及 4 张看板截图。
|
|
20
|
+
|
|
21
|
+
### 修复
|
|
22
|
+
|
|
23
|
+
- **Hook 门禁与冷启动状态修复**:修复 `ask_question` 识别 `questions: [...]` 与 `A1: 确认执行` 时触发的死循环,同步修复同类 `PostToolUse` 与冷启动状态判定问题。
|
|
24
|
+
- **本地看板 `fetch failed` 与 503 根治**:修复陈旧指纹淘汰、`webApiProcess.dispose` 不可逆与守护进程同步关停导致的看板失联。
|
|
25
|
+
- **Git Hook 迁移路径误判**:修复插件安装目录迁移或升级且旧目录仍留在磁盘时 `hook-manager` 误判 `managed` 跳过升级的问题。
|
|
26
|
+
|
|
27
|
+
### 移除
|
|
28
|
+
|
|
29
|
+
- **移除 `Friction` 业务系统与 `Milestone` 层级**:全产品彻底清除摩擦账本与里程碑层级,待推进事项收敛至 `Intent`,反复卡点有效临时规避沉淀为 `Pitfall`。
|
|
30
|
+
|
|
31
|
+
### 升级提示
|
|
32
|
+
|
|
33
|
+
- **旧仓目录兼容与插件刷新**:旧仓库内残留的 `ldvh-base/milestones/` 与 `ldvh-base/frictions/` 目录会自动忽略不报错(建议清理或将未完事项迁入 `Intent`);同步插件(`host setup --host antigravity --apply`)后请在宿主管理页刷新 MCP 服务。
|
|
34
|
+
|
|
3
35
|
## [0.2.0] - 2026-11-30
|
|
4
36
|
|
|
5
37
|
面向外部开箱可用性的关键修复与核心能力升级:运行时规范打包解耦、Hook 注入与远程 MCP App 修复、双源召回优先级与零向量同义词/路径增量补强、7 类事实对象渐进式精读以及经验/摩擦独立子代理全权落盘。
|
package/README.en.md
CHANGED
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
Two chronic problems with AI coding:
|
|
30
30
|
|
|
31
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;
|
|
32
|
+
- **Coding out of control** — the AI writes and declares "done" itself; yesterday's pitfalls and tooling snags get stepped on again; key conventions get changed in passing.
|
|
33
33
|
|
|
34
|
-
LDVH puts a harness on the AI. Goals, ideas, norms,
|
|
34
|
+
LDVH puts a harness on the AI. Goals, ideas, norms, and lessons 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
35
|
|
|
36
36
|
## Supported hosts
|
|
37
37
|
|
|
38
38
|
| Host | Integration | MCP tools | Hook injection | Human Gate | Sub-agent review | Embedded dashboard |
|
|
39
39
|
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
|
|
40
|
-
| Antigravity | `plugin.json` + `mcp_config.json` + `hooks.json` | ✅ | ✅ (direct & `call_mcp_tool`) | Hook `
|
|
40
|
+
| Antigravity | `plugin.json` + `mcp_config.json` + `hooks.json` | ✅ | ✅ (direct & `call_mcp_tool`) | Hook-verified 2-option Human Gate (`ask_question`) | ✅ | ✅ (local + remote self-contained MCP App) |
|
|
41
41
|
| Codex | `.codex-plugin/plugin.json` + `.mcp.json` | ✅ | — | `human_confirmed` / Web / CLI | — | browser |
|
|
42
42
|
| DSH | `adapters/dsh` (Cordis plugin) | ✅ | — | Embedded UI | ✅ | ✅ |
|
|
43
43
|
| Claude Code | `.claude-plugin/plugin.json` (reserved) | ✅ | — | `human_confirmed` / Web / CLI | — | browser |
|
|
@@ -46,15 +46,15 @@ LDVH puts a harness on the AI. Goals, ideas, norms, lessons and frictions become
|
|
|
46
46
|
|
|
47
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
48
|
|
|
49
|
-
##
|
|
49
|
+
## Six business systems
|
|
50
50
|
|
|
51
|
-
Goal planning · Intent capture · Dual-source recall · Gate consultation (pre-action
|
|
51
|
+
Goal planning (Goal) · Intent capture (Intent) · Dual-source recall (lightweight candidate index within budget, always-on Goal anchor, in-turn path-context reminders, progressive section read) · Gate consultation (unified prompt titles: 3-option pre-action/post-work review, 2-option web research consult after internal lookup) · Research absorption (controller-led verification & three-state Report, with optional `ldvh-researcher` helper) · Experience accumulation (verified pitfalls & recurring workarounds recorded asynchronously as `Pitfall`).
|
|
52
52
|
|
|
53
53
|
Four lines of defence: self-check → mechanical verification (controlled writes, read-back, Git Gate) → optional agent review → optional agent re-check.
|
|
54
54
|
|
|
55
55
|
## Quick start
|
|
56
56
|
|
|
57
|
-
Requires Node.js ≥ 22.15.
|
|
57
|
+
Requires Node.js ≥ 22.15 (npm tarball already ships prebuilt `web/dist`, `web/api-js`, `web/shared-js`, and `lib/*.bundle.json`; running from a git clone builds the dashboard first).
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
git clone https://github.com/dingminhua/ld-vibe-harness.git
|
|
@@ -72,27 +72,28 @@ Without `--apply`, `host setup` is a dry run.
|
|
|
72
72
|
|
|
73
73
|
## Web dashboard
|
|
74
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),
|
|
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`, with hot-reload and self-healing on sync/shutdown.
|
|
76
|
+
- **Pages**: Focus (project/branch switcher, Goal, Intent health, recent activity), 5 fact-type views, Directory, Changes, Commits, Diagnostics (single unified ledger view reading `~/.ldvh/ldvh/gate-events.jsonl` across MCP / Hook / CLI / Git Gate, separating errors from pending gates), Settings (separate Recall Budget `10–50 KB` and Experience Accumulation cards, review gate switches, native OS folder picker, narrow-width responsive project cards), and a 5-chapter Help guide (`/help`).
|
|
77
77
|
- **Prebuilt API**: `pnpm run build:dsh` outputs precompiled `web/api-js` and `web/shared-js` for instant startup.
|
|
78
78
|
|
|
79
|
-
| Focus Overview (Goal /
|
|
79
|
+
| Focus Overview (Goal / Intent Health / Recent Activity) | Structured Facts Board (5 Fact Types) |
|
|
80
80
|
| :---: | :---: |
|
|
81
81
|
|  |  |
|
|
82
|
-
| **Diagnostics &
|
|
82
|
+
| **Diagnostics & 4-Channel Event Ledger** | **5-Chapter Interactive Help Guide** |
|
|
83
83
|
|  |  |
|
|
84
84
|
|
|
85
85
|
## Controlled commits & unified signing
|
|
86
86
|
|
|
87
|
-
- Exposes **
|
|
87
|
+
- Exposes **26 model-visible MCP tools** (including read-only `ldvh_session_signature`) plus app-only `ldvh_app_api_proxy`. Runtime recall uses **16 bundled `plugin-specs/*.yaml`** (`specs/` stays in the git repo only and is excluded from the npm tarball).
|
|
88
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` (
|
|
89
|
+
- **Terminology**: v2 standardized `Intent` (replacing `Spark`) and removed both `Milestone` and `Friction` (legacy folders are ignored harmlessly; ongoing work converges into `Intent` and recurring workarounds are persisted as `Pitfall`); see the Help page's Verify & FAQ chapter for legacy repo migration steps.
|
|
90
90
|
|
|
91
91
|
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) (Chinese) and [CHANGELOG.md](CHANGELOG.md). Legacy code lives on the `backup/main-legacy` branch.
|
|
92
92
|
|
|
93
93
|
## Development
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
|
+
npm run check # runs build:bundles + lint + build:web + check:pii + test
|
|
96
97
|
npm run lint
|
|
97
98
|
npm test
|
|
98
99
|
```
|
package/README.md
CHANGED
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
AI 编程的两个老问题:
|
|
30
30
|
|
|
31
31
|
- **Vibe 漂移**:会话一长或换会话,AI 就忘了项目目标、既定规矩与未决想法,开始凭感觉改代码。
|
|
32
|
-
- **Coding 失控**:AI
|
|
32
|
+
- **Coding 失控**:AI 自己写、自己说“改好了”;踩过的坑和工具卡点下周重踩;关键约定被顺手改掉也没人拦。
|
|
33
33
|
|
|
34
|
-
LDVH 给 AI
|
|
34
|
+
LDVH 给 AI 套一副工程缰绳:把目标、想法、规范、经验沉淀成**结构化事实**,每轮动手前自动召回,高风险写入必须人工点头,提交前由 Git Gate 机械把关。
|
|
35
35
|
|
|
36
36
|
## 支持的宿主
|
|
37
37
|
|
|
38
38
|
| 宿主 | 接入方式 | MCP 工具 | Hook 自动注入 | 人工门禁 | 子代理把关 | 内嵌看板 |
|
|
39
39
|
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
|
|
40
|
-
| Antigravity | `plugin.json` + `mcp_config.json` + `hooks.json` | ✅ | ✅(兼容直连与 `call_mcp_tool`) | Hook `
|
|
40
|
+
| Antigravity | `plugin.json` + `mcp_config.json` + `hooks.json` | ✅ | ✅(兼容直连与 `call_mcp_tool`) | Hook 验签 Human Gate(2 选项 `ask_question` 统一题面审批) | ✅ | ✅(本地 + 远程自包含 MCP App) |
|
|
41
41
|
| Codex | `.codex-plugin/plugin.json` + `.mcp.json` | ✅ | — | `human_confirmed` / Web / CLI | — | 浏览器 |
|
|
42
42
|
| DSH | `adapters/dsh`(Cordis 插件) | ✅ | — | 内嵌交互 | ✅ | ✅ |
|
|
43
43
|
| Claude Code | `.claude-plugin/plugin.json`(预留) | ✅ | — | `human_confirmed` / Web / CLI | — | 浏览器 |
|
|
@@ -46,23 +46,22 @@ LDVH 给 AI 套一副工程缰绳:把目标、想法、规范、经验、摩
|
|
|
46
46
|
|
|
47
47
|
四个宿主默认**共享同一个数据目录 `~/.ldvh`**:在 Antigravity 里记下的目标与经验,换到 Codex 或 DSH 照样能召回。需要隔离时设置环境变量 `LDVH_DATA_DIR`。
|
|
48
48
|
|
|
49
|
-
##
|
|
49
|
+
## 六个业务系统
|
|
50
50
|
|
|
51
51
|
| 价值 | 业务系统 | 作用 |
|
|
52
52
|
| :--- | :--- | :--- |
|
|
53
|
-
| 对齐 Vibe | 目标规划 | Goal
|
|
54
|
-
| 对齐 Vibe | 意图记录 | Intent
|
|
55
|
-
| 对齐 Vibe | 双源召回 |
|
|
56
|
-
| 协调 Coding | 把关请示 |
|
|
57
|
-
| 协调 Coding | 调研吸收 |
|
|
58
|
-
| 协调 Coding | 经验积累 |
|
|
59
|
-
| 协调 Coding | 摩擦销账 | 系统性阻碍先进缓冲,累计到阈值自动晋升为待修 Friction |
|
|
53
|
+
| 对齐 Vibe | 目标规划 | Goal 承载项目长期目标陈述与达成边界 |
|
|
54
|
+
| 对齐 Vibe | 意图记录 | Intent 承接项目跨行动要推进的事情与待决方向线 |
|
|
55
|
+
| 对齐 Vibe | 双源召回 | 每轮动手前按预算从规范源与事实源注入轻量候选索引、常驻 Goal 锚点与同回合路径上下文提醒,支持按节渐进式精读 |
|
|
56
|
+
| 协调 Coding | 把关请示 | 统一三类提请题面:行动前审方案、收口前复核结果(三选一),遇复杂外部难题先内查再二选一请示是否联网(人主动提出不重复请示) |
|
|
57
|
+
| 协调 Coding | 调研吸收 | 主控先内查再亲自联网取证(可选派发 `ldvh-researcher` 局部辅助),输出三态证据与逐字引证并按需沉淀 Report |
|
|
58
|
+
| 协调 Coding | 经验积累 | 已验证失败机制与反复卡点有效临时规避统一沉淀为 Pitfall,由后台代理异步查重创建 |
|
|
60
59
|
|
|
61
|
-
四层防线:主控自查 →
|
|
60
|
+
四层防线:主控自查 → 机械校验(受控写入、写后回读、Git Gate)→ 可选代理审核 → 可选代理复核。登记/取消管辖、Intent/Norm 创建与终态等高风险写入始终走人工门禁。
|
|
62
61
|
|
|
63
62
|
## 快速开始
|
|
64
63
|
|
|
65
|
-
需要 Node.js ≥ 22.15
|
|
64
|
+
需要 Node.js ≥ 22.15(通过 npm 包安装已预含 `web/dist`、`web/api-js`、`web/shared-js` 与 `lib/*.bundle.json`;从源码仓库直接运行需先构建前端看板)。
|
|
66
65
|
|
|
67
66
|
```bash
|
|
68
67
|
git clone https://github.com/dingminhua/ld-vibe-harness.git
|
|
@@ -99,21 +98,21 @@ node cli/ldvh.mjs governed-project install --project /abs/path/to/repo --id my-r
|
|
|
99
98
|
|
|
100
99
|
## Web 看板
|
|
101
100
|
|
|
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
|
-
-
|
|
101
|
+
- **多端访问**:本地守护服务默认监听 `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` 同样全功能直连可用;插件同步或异常关闭时支持热重载与并发自愈。
|
|
102
|
+
- **核心页面**:聚焦(项目/分支两级视角、Goal 目标陈述、Intent 健康度与近期动态)、五类事实对象看板、目录、变更、提交、诊断(单页统一观测面板,直读 `~/.ldvh/ldvh/gate-events.jsonl`,聚合 `MCP` / `Hook` / `CLI` / `Git Gate` 四渠道并区分异常拦截与待确认流程中)、设置(独立的「自主召回预算」`10–50 KB`、「经验积累」、「把关请示与审查开关」与「管辖项目与 Git Gate 管理」,支持系统原生目录选择框及窄宽自适应)以及 5 章节帮助手册(`/help`)。
|
|
104
103
|
- **预编译直跑**:前端构建产物包含 `web/api-js` 与 `web/shared-js` 预编译后端,免实时转译启动。
|
|
105
104
|
|
|
106
|
-
| 聚焦总览(Goal /
|
|
105
|
+
| 聚焦总览(Goal / 意图健康度 / 近期动态) | 结构化事实看板(五类对象管理) |
|
|
107
106
|
| :---: | :---: |
|
|
108
107
|
|  |  |
|
|
109
|
-
|
|
|
108
|
+
| **诊断与四渠道事件账(MCP / Hook / CLI / Git Gate)** | **五章节交互式帮助手册** |
|
|
110
109
|
|  |  |
|
|
111
110
|
|
|
112
111
|
## 受控提交与统一署名
|
|
113
112
|
|
|
114
|
-
- 仓库提供 **
|
|
113
|
+
- 仓库提供 **26 个模型可见 MCP 工具**(含只读路由自查工具 `ldvh_session_signature`)及 app-only 隧道工具 `ldvh_app_api_proxy`。
|
|
115
114
|
- 在受管辖仓库中,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
|
|
115
|
+
- **术语提示**:v2 已将 `Spark → Intent`(`ldvh-base/intents/`),并移除 `Milestone` 与 `Friction` 层级(旧仓残留目录自动忽略,推进事项统一收敛至 `Intent`,反复卡点有效临时规避沉淀为 `Pitfall`);旧仓迁移指引见看板帮助页「自检与排错」。
|
|
117
116
|
|
|
118
117
|
## 目录结构
|
|
119
118
|
|
|
@@ -124,7 +123,7 @@ plugin.json mcp_config.json hooks.json Antigravity 清单
|
|
|
124
123
|
lib/ server/ hooks/ cli/ 宿主无关核心:事实源、MCP 服务、Hook 引擎、命令行
|
|
125
124
|
adapters/ 多宿主薄适配层与安装器
|
|
126
125
|
skills/ agents/ rules/ 操作指引、子代理与治理锚点
|
|
127
|
-
plugin-specs/ 随包内置的运行时结构化规范(
|
|
126
|
+
plugin-specs/ 随包内置的运行时结构化规范(16 份 YAML)
|
|
128
127
|
web/ React 看板与 Express 接口
|
|
129
128
|
specs/ 开发期完整中文规范原文(不随 npm 包分发)
|
|
130
129
|
```
|
|
@@ -134,6 +133,7 @@ specs/ 开发期完整中文规范原
|
|
|
134
133
|
## 开发
|
|
135
134
|
|
|
136
135
|
```bash
|
|
136
|
+
npm run check # 依次执行 build:bundles + lint + build:web + check:pii + test
|
|
137
137
|
npm run lint
|
|
138
138
|
npm test
|
|
139
139
|
```
|
|
@@ -64,38 +64,56 @@ function plan() {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
async function
|
|
67
|
+
async function reloadRunningDaemonWeb(dataDir) {
|
|
68
68
|
const dataPath = createDataPathResolver(dataDir);
|
|
69
69
|
const runtimeFile = dataPath("ldvh", "runtime.json");
|
|
70
70
|
let runtime;
|
|
71
71
|
try {
|
|
72
72
|
runtime = JSON.parse(await readFile(runtimeFile, "utf8"));
|
|
73
73
|
} catch {
|
|
74
|
-
return { attempted: false, restarted: false, reason: "no_runtime_file" };
|
|
74
|
+
return { attempted: false, reloaded: false, restarted: false, reason: "no_runtime_file" };
|
|
75
75
|
}
|
|
76
76
|
if (!runtime || typeof runtime.port !== "number" || typeof runtime.token !== "string") {
|
|
77
|
-
return { attempted: false, restarted: false, reason: "invalid_runtime_file" };
|
|
77
|
+
return { attempted: false, reloaded: false, restarted: false, reason: "invalid_runtime_file" };
|
|
78
78
|
}
|
|
79
79
|
const hostAddr = typeof runtime.host === "string" && runtime.host.length > 0 ? runtime.host : "127.0.0.1";
|
|
80
80
|
const controller = new AbortController();
|
|
81
81
|
const timer = setTimeout(() => controller.abort(), 1500);
|
|
82
82
|
try {
|
|
83
|
-
const res = await fetch(`http://${hostAddr}:${runtime.port}/admin/
|
|
83
|
+
const res = await fetch(`http://${hostAddr}:${runtime.port}/admin/reload-web`, {
|
|
84
84
|
method: "POST",
|
|
85
85
|
headers: { "x-ldvh-token": runtime.token },
|
|
86
86
|
signal: controller.signal,
|
|
87
87
|
});
|
|
88
88
|
if (res.ok) {
|
|
89
|
-
return {
|
|
89
|
+
return {
|
|
90
|
+
attempted: true,
|
|
91
|
+
reloaded: true,
|
|
92
|
+
restarted: false,
|
|
93
|
+
reason: "web_reloaded",
|
|
94
|
+
pid: runtime.pid ?? null,
|
|
95
|
+
note: "已热重载看板 Web API 子进程;若改动了 server/lib/hooks,请在 Antigravity 插件管理页刷新 MCP 服务",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (res.status === 404) {
|
|
99
|
+
return {
|
|
100
|
+
attempted: true,
|
|
101
|
+
reloaded: false,
|
|
102
|
+
restarted: false,
|
|
103
|
+
reason: "legacy_daemon_no_reload_endpoint",
|
|
104
|
+
pid: runtime.pid ?? null,
|
|
105
|
+
note: "运行中的旧版 daemon 不支持热重载端点,未关停看板;请在 Antigravity 插件管理页刷新 MCP 服务",
|
|
106
|
+
};
|
|
90
107
|
}
|
|
91
108
|
return {
|
|
92
109
|
attempted: true,
|
|
110
|
+
reloaded: false,
|
|
93
111
|
restarted: false,
|
|
94
|
-
reason:
|
|
112
|
+
reason: `http_${res.status}`,
|
|
95
113
|
pid: runtime.pid ?? null,
|
|
96
114
|
};
|
|
97
115
|
} catch {
|
|
98
|
-
return { attempted: true, restarted: false, reason: "daemon_unreachable", pid: runtime.pid ?? null };
|
|
116
|
+
return { attempted: true, reloaded: false, restarted: false, reason: "daemon_unreachable", pid: runtime.pid ?? null };
|
|
99
117
|
} finally {
|
|
100
118
|
clearTimeout(timer);
|
|
101
119
|
}
|
|
@@ -135,7 +153,7 @@ export async function install({ repoRoot, targetDir = defaultTargetDir(), apply
|
|
|
135
153
|
nodeModules: await linkDependencyDir(join(root, "node_modules"), join(target, "node_modules")),
|
|
136
154
|
webNodeModules: await linkDependencyDir(join(root, "web", "node_modules"), join(target, "web", "node_modules")),
|
|
137
155
|
};
|
|
138
|
-
const daemon = restartDaemon ? await
|
|
156
|
+
const daemon = restartDaemon ? await reloadRunningDaemonWeb(dataDir) : { attempted: false, reloaded: false, restarted: false, reason: "skipped" };
|
|
139
157
|
const after = await inspect({ repoRoot: root, targetDir: target });
|
|
140
158
|
return { ok: after.realDirectory && after.upToDate, host, applied: true, targetDir: target, removed, links, daemon, state: after };
|
|
141
159
|
}
|
package/adapters/dsh/index.js
CHANGED
|
@@ -34,7 +34,6 @@ const DEFAULT_CONFIG = Object.freeze({
|
|
|
34
34
|
researchConsultAskEnabled: false,
|
|
35
35
|
reviewAskSilentRunEnabled: false,
|
|
36
36
|
experienceAccumulationEnabled: true,
|
|
37
|
-
frictionDiscoveryEnabled: true,
|
|
38
37
|
});
|
|
39
38
|
|
|
40
39
|
/** 配置面:装有 schemastery 时返回带校验的 Schema,否则降级为纯对象默认值。 */
|
|
@@ -51,7 +50,6 @@ export async function createConfigSchema() {
|
|
|
51
50
|
researchConsultAskEnabled: volatile(z.boolean().default(false)),
|
|
52
51
|
reviewAskSilentRunEnabled: volatile(z.boolean().default(false)),
|
|
53
52
|
experienceAccumulationEnabled: volatile(z.boolean().default(true)),
|
|
54
|
-
frictionDiscoveryEnabled: volatile(z.boolean().default(true)),
|
|
55
53
|
});
|
|
56
54
|
} catch {
|
|
57
55
|
return { ...DEFAULT_CONFIG };
|
|
@@ -79,7 +77,6 @@ const BOOLEAN_SETTING_KEYS = new Set([
|
|
|
79
77
|
"researchConsultAskEnabled",
|
|
80
78
|
"reviewAskSilentRunEnabled",
|
|
81
79
|
"experienceAccumulationEnabled",
|
|
82
|
-
"frictionDiscoveryEnabled",
|
|
83
80
|
]);
|
|
84
81
|
|
|
85
82
|
async function readJsonBody(req) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldvh-dsh-adapter",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "LDVH 的 DSH Cordis
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "LDVH 的 DSH Cordis 适配层:把仓库内五类结构化事实源工具(Goal、Intent、Norm、Report、Pitfall)、受控写入守卫与本地 Web 看板接入 DSH,并与 Antigravity / Codex 共享 ~/.ldvh 数据目录。",
|
|
5
5
|
"private": true,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ldvh-experience-recorder
|
|
3
|
-
description: LDVH
|
|
3
|
+
description: LDVH 经验记录代理。主控授权后,把已验证的失败机制或反复卡点有效临时规避起草并创建为一条结构化 Pitfall;先查重,只允许创建,禁止改动或终态既有经验。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# LDVH 经验记录者
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
你负责把一个**已验证的失败机制或反复卡点有效临时规避**沉淀为项目经验(Pitfall)。你只有一次授权窗口,且只能创建。
|
|
9
9
|
|
|
10
10
|
## 前提
|
|
11
11
|
|
|
@@ -30,4 +30,3 @@ description: LDVH 经验记录代理。主控授权后,把已验证的失败
|
|
|
30
30
|
|
|
31
31
|
- 只允许 `ldvh_pitfall_write(action="create")`;禁止更新、勘误、转终态,也不触碰其他类型事实对象的写入入口。
|
|
32
32
|
- 不调用 `ldvh_pitfall_arm_delegate`(仅主控可授权)。
|
|
33
|
-
- 若在整理材料时发现规则冲突或反复出现的卡点,可调用 `ldvh_friction_record_observation` 记一条摩擦观察。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ldvh-researcher
|
|
3
|
-
description: LDVH
|
|
3
|
+
description: LDVH 可选零上下文联网调研辅助代理(常规联网调查由主控亲自执行完整工序;仅在主控按需拆分局部有界检索子任务时委派)。围绕主控给定的 need、scope 与子问题做外部取证,每个子问题给出“已证实 / 存在冲突或不确定 / 未查到”三态结论与逐字引证。只调研,不写库。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# LDVH 零上下文调研者
|
|
@@ -38,4 +38,3 @@ description: LDVH 零上下文联网调研代理。围绕主控给定的 need、
|
|
|
38
38
|
|
|
39
39
|
- 不写入任何事实源。需要沉淀为报告,交还主控,由主控通过 `ldvh_report_session` / `ldvh_report_write` 走审核与受控写入。
|
|
40
40
|
- 你的结论只是证据,不是决定;采纳与否由主控与 Human 决定。
|
|
41
|
-
- 若发现规则与实现互相冲突、工具缺陷或反复出现的卡点,可顺手调用 `ldvh_friction_record_observation` 记一条摩擦观察。
|
package/cli/ldvh.mjs
CHANGED
|
@@ -9,13 +9,31 @@ import {
|
|
|
9
9
|
unregisterProject,
|
|
10
10
|
uninstallHook,
|
|
11
11
|
} from "../lib/governed-projects.js";
|
|
12
|
+
import { repairGovernedProjectHooks } from "../lib/hook-repair.js";
|
|
12
13
|
import { createDataPathResolver } from "../lib/data-paths.js";
|
|
14
|
+
import { appendGateEvent } from "../lib/gate-events.js";
|
|
13
15
|
import { SUPPORTED_HOSTS, getHostAdapter, listHostAdapters } from "../adapters/_contract.js";
|
|
14
16
|
|
|
15
17
|
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
16
18
|
const runnerPath = fileURLToPath(new URL("../lib/git-gate-runner.js", import.meta.url));
|
|
17
19
|
const dataPath = createDataPathResolver();
|
|
18
20
|
|
|
21
|
+
async function recordCliEvent({ command, status, codes = [], detail = "", cwd = process.cwd(), durationMs }) {
|
|
22
|
+
try {
|
|
23
|
+
await appendGateEvent(dataPath, {
|
|
24
|
+
tool: `cli:${command}`,
|
|
25
|
+
status,
|
|
26
|
+
codes,
|
|
27
|
+
detail,
|
|
28
|
+
cwd,
|
|
29
|
+
durationMs,
|
|
30
|
+
source: "cli",
|
|
31
|
+
});
|
|
32
|
+
} catch {
|
|
33
|
+
// 诊断落账失败不得影响 CLI 主流程与退出码
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
19
37
|
function valueAfter(args, flag) {
|
|
20
38
|
const index = args.indexOf(flag);
|
|
21
39
|
if (index === -1 || index + 1 >= args.length) return void 0;
|
|
@@ -37,7 +55,7 @@ function usage() {
|
|
|
37
55
|
process.stderr.write(
|
|
38
56
|
[
|
|
39
57
|
"用法:",
|
|
40
|
-
" ldvh governed-project <list|inspect|install|uninstall-hook|register|unregister> [--project ABSOLUTE_GIT_ROOT] [--id PROJECT_ID] [--human-confirmed]",
|
|
58
|
+
" ldvh governed-project <list|inspect|install|uninstall-hook|repair-hooks|register|unregister> [--project ABSOLUTE_GIT_ROOT] [--id PROJECT_ID] [--human-confirmed]",
|
|
41
59
|
" ldvh host list",
|
|
42
60
|
" ldvh host inspect --host <antigravity|codex|dsh> [--target PATH]",
|
|
43
61
|
" ldvh host setup --host <antigravity|codex|dsh> [--apply] [--target PATH]",
|
|
@@ -80,35 +98,101 @@ async function runHostCommand(argv) {
|
|
|
80
98
|
}
|
|
81
99
|
|
|
82
100
|
async function main(argv) {
|
|
101
|
+
const startedAt = Date.now();
|
|
83
102
|
if (argv[0] === "host") {
|
|
103
|
+
const subcmd = argv[1];
|
|
84
104
|
const result = await runHostCommand(argv);
|
|
85
105
|
if (result === null) {
|
|
86
106
|
usage();
|
|
107
|
+
await recordCliEvent({
|
|
108
|
+
command: "host/usage",
|
|
109
|
+
status: "invalid_request",
|
|
110
|
+
codes: ["cli_usage"],
|
|
111
|
+
detail: argv.join(" "),
|
|
112
|
+
durationMs: Date.now() - startedAt,
|
|
113
|
+
});
|
|
87
114
|
return 2;
|
|
88
115
|
}
|
|
116
|
+
const target = valueAfter(argv, "--target");
|
|
117
|
+
await recordCliEvent({
|
|
118
|
+
command: `host/${subcmd}`,
|
|
119
|
+
status: result.ok
|
|
120
|
+
? "completed"
|
|
121
|
+
: (result.error?.code === "unknown_host" ? "invalid_request" : "rejected"),
|
|
122
|
+
codes: result.ok ? [] : [result.error?.code || "cli_error"],
|
|
123
|
+
detail: result.ok ? "" : (result.error?.message || ""),
|
|
124
|
+
cwd: target ?? process.cwd(),
|
|
125
|
+
durationMs: Date.now() - startedAt,
|
|
126
|
+
});
|
|
89
127
|
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
90
128
|
return result.ok ? 0 : 1;
|
|
91
129
|
}
|
|
92
130
|
if (argv[0] !== "governed-project") {
|
|
93
131
|
usage();
|
|
132
|
+
await recordCliEvent({
|
|
133
|
+
command: "usage",
|
|
134
|
+
status: "invalid_request",
|
|
135
|
+
codes: ["cli_usage"],
|
|
136
|
+
detail: argv.join(" "),
|
|
137
|
+
durationMs: Date.now() - startedAt,
|
|
138
|
+
});
|
|
94
139
|
return 2;
|
|
95
140
|
}
|
|
96
141
|
const command = argv[1];
|
|
142
|
+
const projectArg = valueAfter(argv, "--project");
|
|
143
|
+
const eventCwd = projectArg ?? process.cwd();
|
|
144
|
+
const inspectOptions = { expectedRunnerPath: runnerPath, expectedWorkspaceRoot: packageRoot };
|
|
97
145
|
let result;
|
|
98
146
|
if (command === "list") {
|
|
99
|
-
result = await readGovernedProjects(dataPath);
|
|
147
|
+
result = await readGovernedProjects(dataPath, inspectOptions);
|
|
148
|
+
} else if (command === "repair-hooks") {
|
|
149
|
+
const project = projectArg;
|
|
150
|
+
if (argv.includes("--project") && project === void 0) {
|
|
151
|
+
usage();
|
|
152
|
+
await recordCliEvent({
|
|
153
|
+
command: "governed-project/repair-hooks",
|
|
154
|
+
status: "invalid_request",
|
|
155
|
+
codes: ["cli_usage"],
|
|
156
|
+
detail: "missing --project value",
|
|
157
|
+
cwd: eventCwd,
|
|
158
|
+
durationMs: Date.now() - startedAt,
|
|
159
|
+
});
|
|
160
|
+
return 2;
|
|
161
|
+
}
|
|
162
|
+
result = await repairGovernedProjectHooks({
|
|
163
|
+
dshHomePath: dataPath,
|
|
164
|
+
runnerPath,
|
|
165
|
+
workspaceRoot: packageRoot,
|
|
166
|
+
projectRoot: project,
|
|
167
|
+
});
|
|
100
168
|
} else {
|
|
101
|
-
const project =
|
|
169
|
+
const project = projectArg;
|
|
102
170
|
if (project === void 0) {
|
|
103
171
|
usage();
|
|
172
|
+
await recordCliEvent({
|
|
173
|
+
command: `governed-project/${command || "usage"}`,
|
|
174
|
+
status: "invalid_request",
|
|
175
|
+
codes: ["cli_usage"],
|
|
176
|
+
detail: argv.join(" "),
|
|
177
|
+
cwd: eventCwd,
|
|
178
|
+
durationMs: Date.now() - startedAt,
|
|
179
|
+
});
|
|
104
180
|
return 2;
|
|
105
181
|
}
|
|
106
182
|
if (command === "inspect") {
|
|
107
|
-
result = await inspectCandidate(project);
|
|
183
|
+
result = await inspectCandidate(project, inspectOptions);
|
|
108
184
|
} else if (command === "install") {
|
|
109
185
|
const id = valueAfter(argv, "--id");
|
|
110
186
|
if (id === void 0) {
|
|
111
187
|
process.stderr.write("install requires --id PROJECT_ID\n");
|
|
188
|
+
await recordCliEvent({
|
|
189
|
+
command: "governed-project/install",
|
|
190
|
+
status: "invalid_request",
|
|
191
|
+
codes: ["cli_usage"],
|
|
192
|
+
detail: "install requires --id PROJECT_ID",
|
|
193
|
+
cwd: eventCwd,
|
|
194
|
+
durationMs: Date.now() - startedAt,
|
|
195
|
+
});
|
|
112
196
|
return 2;
|
|
113
197
|
}
|
|
114
198
|
if (!argv.includes("--human-confirmed")) {
|
|
@@ -135,6 +219,14 @@ async function main(argv) {
|
|
|
135
219
|
const id = valueAfter(argv, "--id");
|
|
136
220
|
if (id === void 0) {
|
|
137
221
|
process.stderr.write("register requires --id PROJECT_ID\n");
|
|
222
|
+
await recordCliEvent({
|
|
223
|
+
command: "governed-project/register",
|
|
224
|
+
status: "invalid_request",
|
|
225
|
+
codes: ["cli_usage"],
|
|
226
|
+
detail: "register requires --id PROJECT_ID",
|
|
227
|
+
cwd: eventCwd,
|
|
228
|
+
durationMs: Date.now() - startedAt,
|
|
229
|
+
});
|
|
138
230
|
return 2;
|
|
139
231
|
}
|
|
140
232
|
if (!argv.includes("--human-confirmed")) {
|
|
@@ -151,6 +243,14 @@ async function main(argv) {
|
|
|
151
243
|
const id = valueAfter(argv, "--id");
|
|
152
244
|
if (id === void 0) {
|
|
153
245
|
process.stderr.write("unregister requires --id PROJECT_ID\n");
|
|
246
|
+
await recordCliEvent({
|
|
247
|
+
command: "governed-project/unregister",
|
|
248
|
+
status: "invalid_request",
|
|
249
|
+
codes: ["cli_usage"],
|
|
250
|
+
detail: "unregister requires --id PROJECT_ID",
|
|
251
|
+
cwd: eventCwd,
|
|
252
|
+
durationMs: Date.now() - startedAt,
|
|
253
|
+
});
|
|
154
254
|
return 2;
|
|
155
255
|
}
|
|
156
256
|
if (!argv.includes("--human-confirmed")) {
|
|
@@ -164,11 +264,43 @@ async function main(argv) {
|
|
|
164
264
|
}
|
|
165
265
|
} else {
|
|
166
266
|
usage();
|
|
267
|
+
await recordCliEvent({
|
|
268
|
+
command: `governed-project/${command || "usage"}`,
|
|
269
|
+
status: "invalid_request",
|
|
270
|
+
codes: ["cli_usage"],
|
|
271
|
+
detail: argv.join(" "),
|
|
272
|
+
cwd: eventCwd,
|
|
273
|
+
durationMs: Date.now() - startedAt,
|
|
274
|
+
});
|
|
167
275
|
return 2;
|
|
168
276
|
}
|
|
169
277
|
}
|
|
278
|
+
const errorCode = result?.error?.code;
|
|
279
|
+
await recordCliEvent({
|
|
280
|
+
command: `governed-project/${command}`,
|
|
281
|
+
status: result.ok
|
|
282
|
+
? "completed"
|
|
283
|
+
: (errorCode === "human_intent_required" ? "needs_human_gate" : "rejected"),
|
|
284
|
+
codes: result.ok ? [] : [errorCode || "cli_error"],
|
|
285
|
+
detail: result.ok ? "" : (result.error?.message || ""),
|
|
286
|
+
cwd: eventCwd,
|
|
287
|
+
durationMs: Date.now() - startedAt,
|
|
288
|
+
});
|
|
170
289
|
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
171
290
|
return result.ok ? 0 : 1;
|
|
172
291
|
}
|
|
173
292
|
|
|
174
|
-
|
|
293
|
+
try {
|
|
294
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
295
|
+
} catch (error) {
|
|
296
|
+
const argv = process.argv.slice(2);
|
|
297
|
+
await recordCliEvent({
|
|
298
|
+
command: argv.slice(0, 2).join("/") || "cli",
|
|
299
|
+
status: "execution_error",
|
|
300
|
+
codes: ["execution_error"],
|
|
301
|
+
detail: String(error?.message ?? error),
|
|
302
|
+
cwd: valueAfter(argv, "--project") ?? process.cwd(),
|
|
303
|
+
});
|
|
304
|
+
process.stderr.write(`${String(error?.stack || error)}\n`);
|
|
305
|
+
process.exitCode = 1;
|
|
306
|
+
}
|