@cyning/harness 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/AGENTS.md +20 -0
- package/CHANGELOG.md +127 -0
- package/README.md +133 -0
- package/bin/harness.js +7 -0
- package/ci/samples/README.md +42 -0
- package/ci/samples/pytest.yml.example +49 -0
- package/ci/samples/quality.yml.example +56 -0
- package/coding_wiki/templates/README.md +11 -0
- package/coding_wiki/templates/context.md +11 -0
- package/coding_wiki/templates/stable.md +19 -0
- package/coding_wiki/templates/volatile.md +15 -0
- package/docs/ARCHITECTURE.md +71 -0
- package/docs/DESIGN_ONTOLOGY_v1_zh.md +9 -0
- package/docs/HARNESS_GRAPH_MODEL_design_v0_zh.md +6 -0
- package/docs/HARNESS_GRAPH_MODEL_dialogue_archive_v1_zh.md +8 -0
- package/docs/ONBOARDING.md +126 -0
- package/docs/P0_V0.2_GAP.md +6 -0
- package/docs/README.md +38 -0
- package/docs/methodology/AUDIT_doc_consistency_2026-06-15_zh.md +69 -0
- package/docs/methodology/DOCUMENT_MAP_v1_zh.md +122 -0
- package/docs/methodology/README.md +147 -0
- package/docs/methodology/ROADMAP_v1_zh.md +136 -0
- package/docs/methodology/execution/P0_V0.2_GAP.md +93 -0
- package/docs/methodology/execution/PILOT_EVIDENCE_B2_v1_zh.md +132 -0
- package/docs/methodology/execution/README.md +12 -0
- package/docs/methodology/graph/HARNESS_GRAPH_MODEL_design_v0_zh.md +258 -0
- package/docs/methodology/graph/HARNESS_GRAPH_MODEL_dialogue_archive_v1_zh.md +132 -0
- package/docs/methodology/graph/README.md +22 -0
- package/docs/methodology/pointers/ADOPTION_METHODOLOGY_v1_zh.md +8 -0
- package/docs/methodology/pointers/ADOPTION_TARGET_STATE_v1_zh.md +6 -0
- package/docs/methodology/pointers/ASSESSMENT_etclovg_v1_zh.md +5 -0
- package/docs/methodology/pointers/ASSESSMENT_ink_v1_zh.md +5 -0
- package/docs/methodology/pointers/GUIDANCE_distribution_v1_zh.md +6 -0
- package/docs/methodology/pointers/HARNESS_V2_PLAN_v1_zh.md +8 -0
- package/docs/methodology/pointers/PILOT_kimi_code_fork_v1_zh.md +6 -0
- package/docs/methodology/pointers/POINTER_cyning_harness_repo_v1_zh.md +6 -0
- package/docs/methodology/pointers/README.md +40 -0
- package/docs/methodology/pointers/SDD_HAT_FLOW_v1_zh.md +8 -0
- package/docs/methodology/pointers/STRATEGY_MASTER_v1_zh.md +8 -0
- package/docs/methodology/pointers/STRATEGY_ONTOLOGY_v1_zh.md +9 -0
- package/docs/methodology/product/DESIGN_ONTOLOGY_v1_zh.md +719 -0
- package/docs/methodology/product/README.md +25 -0
- package/docs/methodology/prompts/PROMPT_article_theory_roundtable_v1_zh.md +127 -0
- package/docs/methodology/prompts/PROMPT_doc_consistency_audit_v1_zh.md +131 -0
- package/docs/methodology/prompts/PROMPT_feasibility_review_b_evidence_v1_zh.md +86 -0
- package/docs/methodology/prompts/README.md +10 -0
- package/docs/methodology/reviews/PROCESS_track_b_evidence_audit_2026-06-15_v1_zh.md +101 -0
- package/docs/methodology/reviews/README.md +9 -0
- package/docs/methodology/reviews/REVIEW_B3_pilot_evidence_and_sdd_compliance_bench_v1_zh.md +154 -0
- package/docs/methodology/reviews/REVIEW_B9_agent_shell_parallel_v1_zh.md +158 -0
- package/examples/demo_checkout/ACCEPTANCE.md +80 -0
- package/examples/demo_checkout/README.md +41 -0
- package/examples/demo_checkout/task_demo_p0_golden_v1.md +101 -0
- package/examples/oss-fork/README.md +139 -0
- package/examples/oss-fork/kimi-code/00_main.ai.md +23 -0
- package/examples/oss-fork/kimi-code/00_main.md +38 -0
- package/examples/oss-fork/kimi-code/01_struct.md +39 -0
- package/examples/oss-fork/kimi-code/02_version.md +6 -0
- package/examples/oss-fork/kimi-code/10_flow_cli_session.md +22 -0
- package/examples/oss-fork/kimi-code/README.md +15 -0
- package/golden/POINTER_gold_epic_serial.md +93 -0
- package/golden/README.md +30 -0
- package/graph/stubs/README.md +6 -0
- package/graph/templates/00_main.ai.md +28 -0
- package/graph/templates/00_main.md +52 -0
- package/graph/templates/01_struct.md +38 -0
- package/graph/templates/10_flow_MAIN.ai.md +43 -0
- package/graph/templates/10_flow_MAIN.md +47 -0
- package/graph/templates/99_mermaid_protocol.md +100 -0
- package/graph/templates/README.md +34 -0
- package/harness/README.md +18 -0
- package/harness/invokes/README.md +22 -0
- package/harness/invokes/TEMPLATE_invoke.md +59 -0
- package/harness/prompts/10-requirements.md +42 -0
- package/harness/prompts/22-task-audit.md +67 -0
- package/harness/prompts/30-execute-code.md +50 -0
- package/harness/prompts/FRAGMENT_30_gate_verify_v1_zh.md +30 -0
- package/harness/prompts/FRAGMENT_30_invoke_block_v1_zh.md +27 -0
- package/harness/prompts/README.md +28 -0
- package/harness/prompts/TEMPLATE_30_gate_stop.md +34 -0
- package/harness/templates/FRAGMENT_task_domain_infer_v1_zh.md +16 -0
- package/harness/templates/README.md +48 -0
- package/harness/templates/TASK_TEMPLATE.md +111 -0
- package/harness/templates/TASK_done_README.md +75 -0
- package/harness/templates/TASK_epic.md +101 -0
- package/harness/templates/TASK_graph_bootstrap.md +113 -0
- package/harness/templates/VIEW_done_by_domain.md +66 -0
- package/harness/templates/VIEW_done_thin_pointer.md +16 -0
- package/ide/adapters/AGENTS.md.fragment.example +31 -0
- package/ide/adapters/CLAUDE.md.fragment.example +30 -0
- package/ide/adapters/README.md +46 -0
- package/ide/adapters/cursor-harness-starter.mdc.example +37 -0
- package/lib/cli.js +180 -0
- package/lib/manifest.js +38 -0
- package/lib/paths.js +36 -0
- package/lib/run.js +33 -0
- package/package.json +37 -0
- package/schema/manifest.v1.schema.json +37 -0
- package/standards/POINTER_workspace_truth_v1_zh.md +57 -0
- package/standards/README.md +35 -0
- package/standards/SOURCES_v1_zh.md +49 -0
- package/standards/TEMPLATE_CODING_BASELINE_L1_v1_zh.md +88 -0
- package/standards/TEMPLATE_CODING_BASELINE_L2_backend_v1_zh.md +75 -0
- package/standards/TEMPLATE_CODING_BASELINE_L2_frontend_v1_zh.md +76 -0
- package/wizard/ONBOARDING_wizard_v1_zh.md +112 -0
- package/wizard/README.md +213 -0
- package/wizard/adopt-existing.sh +37 -0
- package/wizard/bootstrap-oss-fork-meta.sh +177 -0
- package/wizard/gate-check.sh +118 -0
- package/wizard/harness-sync.sh +237 -0
- package/wizard/install.sh +206 -0
- package/wizard/lib/common.sh +247 -0
- package/wizard/lib/manifest.sh +110 -0
- package/wizard/profiles/fullstack-node-py.json +21 -0
- package/wizard/profiles/harness-only.json +19 -0
- package/wizard/profiles/ios-cursor.json +19 -0
- package/wizard/profiles/issue-scan-presets.json +51 -0
- package/wizard/profiles/oss-fork-meta.json +17 -0
- package/wizard/scan-upstream-issues.sh +287 -0
- package/wizard/templates/FRAGMENT_rethink_backfill_task_v1_zh.md +44 -0
- package/wizard/templates/POINTER_PILOT_adoption_workspace.md +23 -0
- package/wizard/templates/TASK_TEMPLATE_upstream_pr_v1.md +164 -0
- package/wizard/templates/task_graph_bootstrap_v1.md +53 -0
- package/wizard/uninstall.sh +218 -0
- package/wizard/upgrade.sh +164 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Task:图谱 Bootstrap · 模块表人签(D4-a)
|
|
2
|
+
|
|
3
|
+
> **状态**:`draft` / `in_progress` / `done`
|
|
4
|
+
> **类型**:存量 **首次** 接入 / 新仓图谱初始化
|
|
5
|
+
> **关联**:[`docs/_tech_graph/01_struct.md`](../../graph/templates/01_struct.md) · ONBOARDING 档位 S0~S3
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Harness 元信息
|
|
10
|
+
|
|
11
|
+
| 字段 | 值 |
|
|
12
|
+
|------|-----|
|
|
13
|
+
| **task_slug** | `graph-bootstrap` |
|
|
14
|
+
| **test_strategy** | `recommended` |
|
|
15
|
+
| **test_strategy_note** | 文档 + 文件存在性;无业务单测 |
|
|
16
|
+
| **code_quality_bar** | `not_applicable` |
|
|
17
|
+
| **orchestration** | 单 task 或 Epic 首棒 |
|
|
18
|
+
| **git_branch** | `task/graph-bootstrap` |
|
|
19
|
+
| **experience_capture** | `recommended` |
|
|
20
|
+
|
|
21
|
+
### 人工闸(本 task 核心)
|
|
22
|
+
|
|
23
|
+
| human_gate_id | status | blocks_hats | 说明 |
|
|
24
|
+
|---------------|--------|-------------|------|
|
|
25
|
+
| **HG-GRAPH-MODULES** | pending → **approved** | **30** | `01_struct` **一级模块表** 人签;**非**「全部 flow 画完」 |
|
|
26
|
+
| HG-TASK-DRAFT | pending | 22-R1 | 可选 · 小 task 可合并 |
|
|
27
|
+
| HG-AUDIT-R1 | pending | 30 | 22 R1 后允许改码 task 派发 |
|
|
28
|
+
|
|
29
|
+
> **D4-a**:「全量」= **模块登记表覆盖一级模块**;flow 按后续 task **增量**。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 背景与目标
|
|
34
|
+
|
|
35
|
+
**完成态**:
|
|
36
|
+
|
|
37
|
+
- [ ] `docs/_tech_graph/` 骨架就位(`00_main` 双轨、`99_mermaid_protocol`、`02_version` 可选)
|
|
38
|
+
- [ ] `01_struct.md` 模块表填完 **一级模块**(module_id · glob · 依赖方向)
|
|
39
|
+
- [ ] **至少 1** 条主 flow(新仓 / **S0**);S2+ 可在 `00_main` 列「待补 flow 清单」
|
|
40
|
+
- [ ] **`HG-GRAPH-MODULES` approved** — 维护者签核后,**30 执行改码** task 方可开工
|
|
41
|
+
- [ ] 本 task 关账 invoke + `### 自检结论` 回填
|
|
42
|
+
|
|
43
|
+
**不做**:
|
|
44
|
+
|
|
45
|
+
- 首次 onboarding **全仓 flow 一次画完**
|
|
46
|
+
- 全仓代码扫描自动生图
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 范围
|
|
51
|
+
|
|
52
|
+
- [ ] 从 `cyning-harness/graph/templates/` 复制骨架至 `docs/_tech_graph/`
|
|
53
|
+
- [ ] 填写 `01_struct.md` 模块表(删除模板示例行)
|
|
54
|
+
- [ ] 新仓/S0:完成 `10_flow_MAIN` 或等价主路径(替换占位锚点)
|
|
55
|
+
- [ ] 在 `01_struct.md` 或本 task 记录 **人签表**(签核人 · 日期)
|
|
56
|
+
|
|
57
|
+
## 非范围
|
|
58
|
+
|
|
59
|
+
- 业务功能代码改动(除非同 Epic 明示)
|
|
60
|
+
- L0-e `graph.json` 全量 export(随 `.ai.md` 增量即可)
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 失败路径
|
|
65
|
+
|
|
66
|
+
| 触发条件 | 系统行为 | 可重试 | 用户可见 |
|
|
67
|
+
|----------|----------|--------|----------|
|
|
68
|
+
| `HG-GRAPH-MODULES` pending 即开 30 改码 task | 执行 **拒开工** | 是 | 须先完成本 bootstrap + 人签 |
|
|
69
|
+
| 模块表空表或仅模板示例行 | 22 **打回** | 是 | 一级模块未覆盖 |
|
|
70
|
+
| 试图一次画完所有 flow | 审查 **打回** | 是 | 违反 D4-a |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 验收标准
|
|
75
|
+
|
|
76
|
+
- [ ] `docs/_tech_graph/00_main.md` + `.ai.md` 存在且语义一致
|
|
77
|
+
- [ ] `01_struct.md` ≥3 行真实模块(按仓规模;通常 3~12)
|
|
78
|
+
- [ ] `HG-GRAPH-MODULES` → **approved**(本 task 或 `01_struct` 人签表)
|
|
79
|
+
- [ ] 新仓/S0:≥1 主 flow;S2:模块表 + 待补清单即可
|
|
80
|
+
- [ ] invoke 落盘 `docs/harness/invokes/by-task/<task_slug>/`
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 给执行帽的必读列表
|
|
85
|
+
|
|
86
|
+
1. [`docs/ONBOARDING.md`](../../docs/ONBOARDING.md) §3 存量档位
|
|
87
|
+
2. `docs/_tech_graph/01_struct.md` · `99_mermaid_protocol.md`
|
|
88
|
+
3. 本 task 验收表
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 实现备忘
|
|
93
|
+
|
|
94
|
+
| 项 | 状态 | 备注 |
|
|
95
|
+
|----|------|------|
|
|
96
|
+
| 骨架复制 | ⏳ | |
|
|
97
|
+
| 模块表 | ⏳ | |
|
|
98
|
+
| HG-GRAPH-MODULES | ⏳ | pending → approved |
|
|
99
|
+
| 主 flow | ⏳ | 按档位 |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 自检结论(执行者)
|
|
104
|
+
|
|
105
|
+
(30/40 回填)
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 修订记录
|
|
110
|
+
|
|
111
|
+
| 日期 | 说明 |
|
|
112
|
+
|------|------|
|
|
113
|
+
| YYYY-MM-DD | 从 cyning-harness `TASK_graph_bootstrap.md` 嵌入 |
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Tasks 视图:已完成 · 按域分组(done_by_domain)
|
|
2
|
+
|
|
3
|
+
> **说明**:聚合索引 · **非真值**。真值:`done/` 各 task 文件 + [`../done/README.md`](../done/README.md) Hub。
|
|
4
|
+
> **维护**:关账时在对应域表追加一行;Epic 母单单独一节。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## harness
|
|
9
|
+
|
|
10
|
+
| 关账日 | 链接 | 一行摘要 |
|
|
11
|
+
|--------|------|----------|
|
|
12
|
+
| YYYY-MM-DD | [`../done/harness/task_<slug>_v1.md`](../done/harness/task_<slug>_v1.md) | … |
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## cyning-harness
|
|
17
|
+
|
|
18
|
+
| 关账日 | 链接 | 一行摘要 |
|
|
19
|
+
|--------|------|----------|
|
|
20
|
+
| YYYY-MM-DD | [`../done/cyning-harness/task_<slug>_v1.md`](../done/cyning-harness/task_<slug>_v1.md) | … |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## engineering
|
|
25
|
+
|
|
26
|
+
| 关账日 | 链接 | 一行摘要 |
|
|
27
|
+
|--------|------|----------|
|
|
28
|
+
| YYYY-MM-DD | [`../done/engineering/task_<slug>_v1.md`](../done/engineering/task_<slug>_v1.md) | … |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## governance
|
|
33
|
+
|
|
34
|
+
| 关账日 | 链接 | 一行摘要 |
|
|
35
|
+
|--------|------|----------|
|
|
36
|
+
| YYYY-MM-DD | [`../done/governance/task_<slug>_v1.md`](../done/governance/task_<slug>_v1.md) | … |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## chatbi
|
|
41
|
+
|
|
42
|
+
| 关账日 | 链接 | 一行摘要 |
|
|
43
|
+
|--------|------|----------|
|
|
44
|
+
| YYYY-MM-DD | [`../done/chatbi/task_<slug>_v1.md`](../done/chatbi/task_<slug>_v1.md) | … |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## standards
|
|
49
|
+
|
|
50
|
+
| 关账日 | 链接 | 一行摘要 |
|
|
51
|
+
|--------|------|----------|
|
|
52
|
+
| YYYY-MM-DD | [`../done/standards/task_<slug>_v1.md`](../done/standards/task_<slug>_v1.md) | … |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## epics(母单 · MANIFEST)
|
|
57
|
+
|
|
58
|
+
| 关账日 | 链接 | 子单 |
|
|
59
|
+
|--------|------|------|
|
|
60
|
+
| YYYY-MM-DD | [`../done/epics/epic_<slug>.md`](../done/epics/epic_<slug>.md) | 见母单 §编排 |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 给 Cursor
|
|
65
|
+
|
|
66
|
+
`done_by_domain`、`_views`、域分组、Epic、Hub
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Tasks 状态视图:已完成(done)
|
|
2
|
+
|
|
3
|
+
> **薄指针**:完整导航见 **[`../done/README.md`](../done/README.md)**(按域 Hub)。
|
|
4
|
+
> **分组表**:[`done_by_domain.md`](./done_by_domain.md)。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 快速入口
|
|
9
|
+
|
|
10
|
+
| 视图 | 路径 |
|
|
11
|
+
|------|------|
|
|
12
|
+
| **Hub(首选)** | [`../done/README.md`](../done/README.md) |
|
|
13
|
+
| 按域分组 | [`done_by_domain.md`](./done_by_domain.md) |
|
|
14
|
+
| 进行中 | [`in_progress.md`](./in_progress.md) |
|
|
15
|
+
|
|
16
|
+
**维护纪律**:关账时更新 Hub / `done_by_domain`;**勿**在本文件追加长列表。
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Harness Starter(业务仓 · 通用 Agent)
|
|
2
|
+
|
|
3
|
+
> **单源真值**:`docs/coding_wiki/` 读序 + `docs/standards/` + 本文件其余业务约定。
|
|
4
|
+
> **本片段**:摘要 + **POINTER**;Harness 条文真值在 `docs/harness/prompts/`。
|
|
5
|
+
|
|
6
|
+
## 执行 task 前
|
|
7
|
+
|
|
8
|
+
1. Open Folder = **本仓根**
|
|
9
|
+
2. 读 `docs/tasks/active/task_*.md`:`test_strategy` · `failure_paths` · **人工闸**表
|
|
10
|
+
3. **30 改码前** GATE_VERIFY(真值在 task **人工闸表**,**非**聊天 / invoke 字面 `approved`):
|
|
11
|
+
- 首输出闸扫描表 · 见 `docs/harness/prompts/FRAGMENT_30_gate_verify_v1_zh.md`
|
|
12
|
+
- **`HG-AUDIT-R1` pending** → **30 拒改码**(须维护者签 task 表 `approved`)
|
|
13
|
+
- **`HG-GRAPH-MODULES` pending** → **30 拒改码**(D4-a)
|
|
14
|
+
- 用户声称与 task 表冲突 → **STOP** · 以 task 表为准
|
|
15
|
+
4. 过程 invoke:`docs/harness/invokes/by-task/<task_slug>/`
|
|
16
|
+
|
|
17
|
+
## Verify(合并前)
|
|
18
|
+
|
|
19
|
+
| 栈 | 命令(与 `.github/workflows/` 一致) |
|
|
20
|
+
|----|--------------------------------------|
|
|
21
|
+
| 前端 | `pnpm lint` → `pnpm test` → `pnpm build` |
|
|
22
|
+
| 后端 | `pytest tests`(按仓 marker 裁剪) |
|
|
23
|
+
| iOS | `xcodebuild`(见 task `test_strategy_note`) |
|
|
24
|
+
|
|
25
|
+
## 关键词
|
|
26
|
+
|
|
27
|
+
`Harness`、`task`、`invoke`、`HG-AUDIT-R1`、`HG-GRAPH-MODULES`、`human_gate`、`拒开工`
|
|
28
|
+
|
|
29
|
+
## 完整库 POINTER
|
|
30
|
+
|
|
31
|
+
工作区:`docs/harness/prompts/`(22/30/TEMPLATE_30_gate_stop 等)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Harness Starter(业务仓 · Claude Code)
|
|
2
|
+
|
|
3
|
+
> **单源真值**:`docs/coding_wiki/` 读序 + `docs/standards/` + `AGENTS.md`。
|
|
4
|
+
> **本片段**:摘要 + **POINTER**;条文真值在 `docs/harness/prompts/`。
|
|
5
|
+
|
|
6
|
+
## 执行 task 前
|
|
7
|
+
|
|
8
|
+
1. Open Folder = **本仓根**
|
|
9
|
+
2. 读 `docs/tasks/active/task_*.md`:`test_strategy` · `failure_paths` · **人工闸**表
|
|
10
|
+
3. **30 改码前** GATE_VERIFY(真值在 task **人工闸表**,**非** invoke 字面 `approved`):
|
|
11
|
+
- 首输出闸扫描 · `FRAGMENT_30_gate_verify_v1_zh.md`
|
|
12
|
+
- **`HG-AUDIT-R1` pending** → **30 拒改码**
|
|
13
|
+
- 声称与 task 表冲突 → **STOP**
|
|
14
|
+
4. 过程 invoke:`docs/harness/invokes/by-task/<task_slug>/`
|
|
15
|
+
|
|
16
|
+
## Verify(合并前)
|
|
17
|
+
|
|
18
|
+
| 栈 | 命令(与 `.github/workflows/` 一致) |
|
|
19
|
+
|----|--------------------------------------|
|
|
20
|
+
| 前端 | `pnpm lint` → `pnpm test` → `pnpm build` |
|
|
21
|
+
| 后端 | `pytest tests`(按仓 marker 裁剪) |
|
|
22
|
+
| iOS | `xcodebuild`(见 task `test_strategy_note`) |
|
|
23
|
+
|
|
24
|
+
## 关键词
|
|
25
|
+
|
|
26
|
+
`Harness`、`task`、`invoke`、`HG-AUDIT-R1`、`HG-GRAPH-MODULES`、`human_gate`、`拒开工`
|
|
27
|
+
|
|
28
|
+
## 完整库 POINTER
|
|
29
|
+
|
|
30
|
+
工作区:`docs/harness/prompts/`(22/30/TEMPLATE_30_gate_stop 等)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ide/adapters
|
|
2
|
+
|
|
3
|
+
**单源 POINTER**:真值在 `docs/coding_wiki/` + `docs/standards/` + `AGENTS.md`;本目录仅 **IDE 入口片段**。
|
|
4
|
+
|
|
5
|
+
## v0.2 已交付(D3 · M2 补完)
|
|
6
|
+
|
|
7
|
+
| 文件 | 状态 | 勾选 IDE | 嵌入路径 |
|
|
8
|
+
|------|------|----------|----------|
|
|
9
|
+
| [`cursor-harness-starter.mdc.example`](./cursor-harness-starter.mdc.example) | ✅ | **Cursor**(默认推荐) | `.cursor/rules/05-harness-starter.mdc` |
|
|
10
|
+
| [`CLAUDE.md.fragment.example`](./CLAUDE.md.fragment.example) | ✅ | **Claude Code** | 仓根 `CLAUDE.md`(marker merge) |
|
|
11
|
+
| [`AGENTS.md.fragment.example`](./AGENTS.md.fragment.example) | ✅ | **通用 Agent** | 仓根 `AGENTS.md`(marker merge) |
|
|
12
|
+
|
|
13
|
+
## 安装勾选
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 三类 IDE 一次勾选(dry-run 预览)
|
|
17
|
+
/path/to/cyning-harness/wizard/install.sh \
|
|
18
|
+
--preset harness-only \
|
|
19
|
+
--ide cursor,claude,agents \
|
|
20
|
+
--dry-run --target /path/to/project
|
|
21
|
+
|
|
22
|
+
# 实装
|
|
23
|
+
/path/to/cyning-harness/wizard/install.sh \
|
|
24
|
+
--preset harness-only --ide cursor,claude,agents
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
profile 字段:`tracks.ide_cursor` · `tracks.ide_claude` · `tracks.ide_agents`(缺省:cursor=true,其余 false)。
|
|
28
|
+
|
|
29
|
+
## marker merge 纪律(D3)
|
|
30
|
+
|
|
31
|
+
- 块标记:`<!-- cyning-harness:begin -->` … `<!-- cyning-harness:end -->`
|
|
32
|
+
- **不覆盖**用户仓已有 `CLAUDE.md` / `AGENTS.md` 全文;块外手写保持不变
|
|
33
|
+
- 由 [`wizard/install.sh`](../install.sh) + [`harness-sync.sh`](../harness-sync.sh) 执行
|
|
34
|
+
|
|
35
|
+
## 手工嵌入(备查)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
mkdir -p .cursor/rules
|
|
39
|
+
cp cyning-harness/ide/adapters/cursor-harness-starter.mdc.example .cursor/rules/05-harness-starter.mdc
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 纪律(D3)
|
|
43
|
+
|
|
44
|
+
- **多入口仅 POINTER** — 不在各 IDE 文件重复 L1/L2 全文
|
|
45
|
+
- 过程轨(task、invoke、CI)**与 IDE 无关**
|
|
46
|
+
- 向导 **默认不全选** IDE;按实际编辑器勾选
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Harness Starter — 读序、task、人工闸与 Verify 纪律(嵌入业务仓 · Cursor)
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
globs:
|
|
5
|
+
- "**/*"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Harness Starter(业务仓 · Cursor)
|
|
9
|
+
|
|
10
|
+
> **单源真值**:`docs/coding_wiki/` 读序 + `docs/standards/` + `AGENTS.md`。
|
|
11
|
+
> **本规则**:摘要 + **POINTER**;条文真值在 `docs/harness/prompts/`。
|
|
12
|
+
|
|
13
|
+
## 执行 task 前
|
|
14
|
+
|
|
15
|
+
1. Open Folder = **本仓根**
|
|
16
|
+
2. 读 `docs/tasks/active/task_*.md`:`test_strategy` · `failure_paths` · **人工闸**表
|
|
17
|
+
3. **30 改码前** GATE_VERIFY(真值在 task **人工闸表**,**非** invoke 字面 `approved`):
|
|
18
|
+
- 首输出闸扫描 · `FRAGMENT_30_gate_verify_v1_zh.md`
|
|
19
|
+
- **`HG-AUDIT-R1` pending** → **30 拒改码**
|
|
20
|
+
- 声称与 task 表冲突 → **STOP**
|
|
21
|
+
4. 过程 invoke:`docs/harness/invokes/by-task/<task_slug>/`
|
|
22
|
+
|
|
23
|
+
## Verify(合并前)
|
|
24
|
+
|
|
25
|
+
| 栈 | 命令(与 `.github/workflows/` 一致) |
|
|
26
|
+
|----|--------------------------------------|
|
|
27
|
+
| 前端 | `pnpm lint` → `pnpm test` → `pnpm build` |
|
|
28
|
+
| 后端 | `pytest tests`(按仓 marker 裁剪) |
|
|
29
|
+
| iOS | `xcodebuild`(见 task `test_strategy_note`) |
|
|
30
|
+
|
|
31
|
+
## 关键词
|
|
32
|
+
|
|
33
|
+
`Harness`、`task`、`invoke`、`HG-AUDIT-R1`、`HG-GRAPH-MODULES`、`human_gate`、`拒开工`
|
|
34
|
+
|
|
35
|
+
## 完整库 POINTER
|
|
36
|
+
|
|
37
|
+
工作区:`docs/harness/prompts/`(22/30/TEMPLATE_30_gate_stop 等)
|
package/lib/cli.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { readManifest, isNewerVersion } from './manifest.js';
|
|
2
|
+
import {
|
|
3
|
+
resolveHarnessRoot,
|
|
4
|
+
resolvePackageVersion,
|
|
5
|
+
resolveTarget,
|
|
6
|
+
wizardScript,
|
|
7
|
+
} from './paths.js';
|
|
8
|
+
import { runBash } from './run.js';
|
|
9
|
+
|
|
10
|
+
function usage() {
|
|
11
|
+
console.log(`@cyning/harness · cyning-harness CLI (v0.3+)
|
|
12
|
+
|
|
13
|
+
用法:
|
|
14
|
+
npx @cyning/harness init [--preset NAME] [--ide LIST] [--target PATH] [--yes]
|
|
15
|
+
npx @cyning/harness upgrade [--target PATH] [--ide LIST] [--yes] [--force] [--gate-check]
|
|
16
|
+
npx @cyning/harness check [--target PATH]
|
|
17
|
+
|
|
18
|
+
说明:
|
|
19
|
+
init 首次接入 · 内部调用 wizard/install.sh + harness-sync.sh apply
|
|
20
|
+
upgrade 升级已接入仓 · 等价 wizard/upgrade.sh --yes
|
|
21
|
+
check 读 manifest.json · 对比当前包版本是否有可升级版本
|
|
22
|
+
|
|
23
|
+
环境:
|
|
24
|
+
CYNING_HARNESS 覆盖产品包根(维护者本地 clone 开发)
|
|
25
|
+
HARNESS_VERSION 覆盖写入 manifest 的版本号
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function takeOption(args, name) {
|
|
30
|
+
const idx = args.indexOf(name);
|
|
31
|
+
if (idx === -1 || idx + 1 >= args.length) {
|
|
32
|
+
return { value: undefined, rest: args };
|
|
33
|
+
}
|
|
34
|
+
const value = args[idx + 1];
|
|
35
|
+
const rest = args.slice(0, idx).concat(args.slice(idx + 2));
|
|
36
|
+
return { value, rest };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function runCli(argv) {
|
|
40
|
+
const harnessRoot = resolveHarnessRoot();
|
|
41
|
+
const pkgVersion = resolvePackageVersion(harnessRoot);
|
|
42
|
+
|
|
43
|
+
if (argv.length === 0 || argv.includes('-h') || argv.includes('--help')) {
|
|
44
|
+
usage();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const [cmd, ...rest] = argv;
|
|
49
|
+
|
|
50
|
+
if (cmd === 'init') {
|
|
51
|
+
await cmdInit(rest, harnessRoot, pkgVersion);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (cmd === 'upgrade') {
|
|
55
|
+
await cmdUpgrade(rest, harnessRoot, pkgVersion);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (cmd === 'check') {
|
|
59
|
+
await cmdCheck(rest, harnessRoot, pkgVersion);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const err = new Error(`未知命令: ${cmd}\n`);
|
|
64
|
+
err.exitCode = 1;
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function cmdInit(args, harnessRoot, pkgVersion) {
|
|
69
|
+
const yes = args.includes('--yes');
|
|
70
|
+
let rest = args.filter((a) => a !== '--yes');
|
|
71
|
+
const { value: preset, rest: r1 } = takeOption(rest, '--preset');
|
|
72
|
+
rest = r1;
|
|
73
|
+
const { value: ide, rest: r2 } = takeOption(rest, '--ide');
|
|
74
|
+
rest = r2;
|
|
75
|
+
const { value: targetArg, rest: r3 } = takeOption(rest, '--target');
|
|
76
|
+
rest = r3;
|
|
77
|
+
|
|
78
|
+
if (rest.length > 0) {
|
|
79
|
+
const err = new Error(`init 未知参数: ${rest.join(' ')}`);
|
|
80
|
+
err.exitCode = 1;
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const target = resolveTarget(process.cwd(), targetArg);
|
|
85
|
+
const installSh = wizardScript(harnessRoot, 'install.sh');
|
|
86
|
+
const installArgs = ['--target', target];
|
|
87
|
+
if (preset) installArgs.push('--preset', preset);
|
|
88
|
+
if (ide) installArgs.push('--ide', ide);
|
|
89
|
+
|
|
90
|
+
runBash(installSh, installArgs, {
|
|
91
|
+
env: {
|
|
92
|
+
CYNING_HARNESS: harnessRoot,
|
|
93
|
+
HARNESS_VERSION: pkgVersion,
|
|
94
|
+
},
|
|
95
|
+
inherit: true,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
console.log(`manifest: ${target}/.cyning-harness/manifest.json`);
|
|
99
|
+
if (!yes) {
|
|
100
|
+
console.log('init 完成。');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function cmdUpgrade(args, harnessRoot, pkgVersion) {
|
|
105
|
+
const checkOnly = args.includes('--check');
|
|
106
|
+
const force = args.includes('--force');
|
|
107
|
+
const gateCheck = args.includes('--gate-check');
|
|
108
|
+
const yes = args.includes('--yes') || !checkOnly;
|
|
109
|
+
let rest = args.filter(
|
|
110
|
+
(a) => !['--check', '--force', '--gate-check', '--yes'].includes(a),
|
|
111
|
+
);
|
|
112
|
+
const { value: ide, rest: r1 } = takeOption(rest, '--ide');
|
|
113
|
+
rest = r1;
|
|
114
|
+
const { value: targetArg, rest: r2 } = takeOption(rest, '--target');
|
|
115
|
+
rest = r2;
|
|
116
|
+
|
|
117
|
+
if (rest.length > 0) {
|
|
118
|
+
const err = new Error(`upgrade 未知参数: ${rest.join(' ')}`);
|
|
119
|
+
err.exitCode = 1;
|
|
120
|
+
throw err;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const target = resolveTarget(process.cwd(), targetArg);
|
|
124
|
+
|
|
125
|
+
if (checkOnly) {
|
|
126
|
+
await cmdCheck(['--target', target], harnessRoot, pkgVersion);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const upgradeSh = wizardScript(harnessRoot, 'upgrade.sh');
|
|
131
|
+
const upgradeArgs = ['--target', target];
|
|
132
|
+
if (ide) upgradeArgs.push('--ide', ide);
|
|
133
|
+
if (yes) upgradeArgs.push('--yes');
|
|
134
|
+
if (force) upgradeArgs.push('--force');
|
|
135
|
+
if (gateCheck) upgradeArgs.push('--gate-check');
|
|
136
|
+
|
|
137
|
+
runBash(upgradeSh, upgradeArgs, {
|
|
138
|
+
env: {
|
|
139
|
+
CYNING_HARNESS: harnessRoot,
|
|
140
|
+
HARNESS_VERSION: pkgVersion,
|
|
141
|
+
...(force ? { HARNESS_SYNC_FORCE: '1' } : {}),
|
|
142
|
+
},
|
|
143
|
+
inherit: true,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function cmdCheck(args, harnessRoot, pkgVersion) {
|
|
148
|
+
let rest = args;
|
|
149
|
+
const { value: targetArg, rest: r1 } = takeOption(rest, '--target');
|
|
150
|
+
rest = r1;
|
|
151
|
+
|
|
152
|
+
if (rest.length > 0) {
|
|
153
|
+
const err = new Error(`check 未知参数: ${rest.join(' ')}`);
|
|
154
|
+
err.exitCode = 1;
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const target = resolveTarget(process.cwd(), targetArg);
|
|
159
|
+
const manifest = readManifest(target);
|
|
160
|
+
|
|
161
|
+
console.log(`目标: ${target}`);
|
|
162
|
+
console.log(`包版本: ${pkgVersion}`);
|
|
163
|
+
|
|
164
|
+
if (!manifest) {
|
|
165
|
+
console.log('状态: 未接入(无 .cyning-harness/manifest.json)');
|
|
166
|
+
console.log('建议: npx @cyning/harness init --preset harness-only --ide cursor,agents');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
console.log(`manifest.version: ${manifest.version}`);
|
|
171
|
+
console.log(`manifest.preset: ${manifest.preset}`);
|
|
172
|
+
console.log(`manifest.ide: ${(manifest.ide || []).join(',')}`);
|
|
173
|
+
|
|
174
|
+
if (isNewerVersion(manifest.version, pkgVersion)) {
|
|
175
|
+
console.log('状态: 可升级');
|
|
176
|
+
console.log(`建议: npx @cyning/harness upgrade --target ${target}`);
|
|
177
|
+
} else {
|
|
178
|
+
console.log('状态: 已是最新(或版本不可 semver 比较且相同)');
|
|
179
|
+
}
|
|
180
|
+
}
|
package/lib/manifest.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
export function manifestPath(targetRoot) {
|
|
5
|
+
return path.join(targetRoot, '.cyning-harness', 'manifest.json');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function readManifest(targetRoot) {
|
|
9
|
+
const file = manifestPath(targetRoot);
|
|
10
|
+
if (!fs.existsSync(file)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 比较 semver 前缀;非 semver 时做字符串相等判断 */
|
|
17
|
+
export function normalizeVersion(version) {
|
|
18
|
+
if (!version || version === 'unknown') return version;
|
|
19
|
+
const m = String(version).match(/^v?(\d+\.\d+\.\d+)/);
|
|
20
|
+
return m ? m[1] : String(version);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function isNewerVersion(current, latest) {
|
|
24
|
+
const a = normalizeVersion(current);
|
|
25
|
+
const b = normalizeVersion(latest);
|
|
26
|
+
if (!a || !b || a === 'unknown' || b === 'unknown') {
|
|
27
|
+
return current !== latest;
|
|
28
|
+
}
|
|
29
|
+
const pa = a.split('.').map(Number);
|
|
30
|
+
const pb = b.split('.').map(Number);
|
|
31
|
+
for (let i = 0; i < 3; i += 1) {
|
|
32
|
+
const da = pa[i] || 0;
|
|
33
|
+
const db = pb[i] || 0;
|
|
34
|
+
if (db > da) return true;
|
|
35
|
+
if (db < da) return false;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
package/lib/paths.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
/** npm 包根 = cyning-harness 产品包根 */
|
|
8
|
+
export function resolveHarnessRoot() {
|
|
9
|
+
if (process.env.CYNING_HARNESS) {
|
|
10
|
+
return path.resolve(process.env.CYNING_HARNESS);
|
|
11
|
+
}
|
|
12
|
+
return path.resolve(__dirname, '..');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function resolvePackageVersion(harnessRoot) {
|
|
16
|
+
if (process.env.HARNESS_VERSION) {
|
|
17
|
+
return process.env.HARNESS_VERSION;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const pkg = JSON.parse(
|
|
21
|
+
fs.readFileSync(path.join(harnessRoot, 'package.json'), 'utf8'),
|
|
22
|
+
);
|
|
23
|
+
if (pkg.version) return pkg.version;
|
|
24
|
+
} catch {
|
|
25
|
+
// fall through
|
|
26
|
+
}
|
|
27
|
+
return 'unknown';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function resolveTarget(cwd, targetArg) {
|
|
31
|
+
return path.resolve(targetArg || cwd);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function wizardScript(harnessRoot, name) {
|
|
35
|
+
return path.join(harnessRoot, 'wizard', name);
|
|
36
|
+
}
|
package/lib/run.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 调用 wizard shell;保持 S2 写路径唯一真值在 harness-sync.sh
|
|
5
|
+
*/
|
|
6
|
+
export function runBash(scriptPath, args, options = {}) {
|
|
7
|
+
const { cwd, env = {}, inherit = false } = options;
|
|
8
|
+
const result = spawnSync('bash', [scriptPath, ...args], {
|
|
9
|
+
cwd,
|
|
10
|
+
env: { ...process.env, ...env },
|
|
11
|
+
encoding: 'utf8',
|
|
12
|
+
stdio: inherit ? 'inherit' : 'pipe',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (result.error) {
|
|
16
|
+
const err = new Error(result.error.message);
|
|
17
|
+
err.exitCode = 1;
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (result.status !== 0) {
|
|
22
|
+
const err = new Error(
|
|
23
|
+
(result.stderr || result.stdout || `命令失败: bash ${scriptPath}`).trim(),
|
|
24
|
+
);
|
|
25
|
+
err.exitCode = result.status ?? 1;
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
stdout: result.stdout || '',
|
|
31
|
+
stderr: result.stderr || '',
|
|
32
|
+
};
|
|
33
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cyning/harness",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "cyning-harness discipline package · init / upgrade / check CLI",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"harness": "bin/harness.js",
|
|
9
|
+
"cyning-harness": "bin/harness.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"lib/",
|
|
14
|
+
"schema/",
|
|
15
|
+
"wizard/",
|
|
16
|
+
"harness/",
|
|
17
|
+
"graph/",
|
|
18
|
+
"coding_wiki/",
|
|
19
|
+
"standards/",
|
|
20
|
+
"ci/",
|
|
21
|
+
"ide/",
|
|
22
|
+
"golden/",
|
|
23
|
+
"examples/",
|
|
24
|
+
"!examples/demo_checkout/_sandbox",
|
|
25
|
+
"!examples/demo_checkout/_sandbox/**",
|
|
26
|
+
"docs/",
|
|
27
|
+
"README.md",
|
|
28
|
+
"CHANGELOG.md",
|
|
29
|
+
"AGENTS.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "node --test test/*.test.js"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18"
|
|
36
|
+
}
|
|
37
|
+
}
|