@hunter-harness/workflow-harness 0.2.73 → 0.2.75
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/harness/bundles/general/claude-code/.harness-build.json +1 -1
- package/harness/bundles/general/claude-code/harness-archive/SKILL.md +26 -1
- package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/claude-code/harness-pull/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-push/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-review/SKILL.md +2 -1
- package/harness/bundles/general/claude-code/harness-run/SKILL.md +3 -2
- package/harness/bundles/general/claude-code/harness-submit/SKILL.md +4 -2
- package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-test/SKILL.md +3 -2
- package/harness/bundles/general/claude-code/harness-test/checklist.md +2 -0
- package/harness/bundles/general/claude-code/scripts/harness_archive.py +149 -6
- package/harness/bundles/general/claude-code/scripts/harness_change.py +95 -0
- package/harness/bundles/general/claude-code/scripts/harness_ledger.py +25 -4
- package/harness/bundles/general/claude-code/scripts/harness_profile.py +45 -0
- package/harness/bundles/general/claude-code/scripts/harness_runtime.py +101 -1
- package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +26 -1
- package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/codebuddy/harness-pull/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-push/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-review/SKILL.md +2 -1
- package/harness/bundles/general/codebuddy/harness-run/SKILL.md +3 -2
- package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +4 -2
- package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-test/SKILL.md +3 -2
- package/harness/bundles/general/codebuddy/harness-test/checklist.md +2 -0
- package/harness/bundles/general/codebuddy/scripts/harness_archive.py +149 -6
- package/harness/bundles/general/codebuddy/scripts/harness_change.py +95 -0
- package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +25 -4
- package/harness/bundles/general/codebuddy/scripts/harness_profile.py +45 -0
- package/harness/bundles/general/codebuddy/scripts/harness_runtime.py +101 -1
- package/harness/bundles/general/codex/.harness-build.json +1 -1
- package/harness/bundles/general/codex/harness-archive/SKILL.md +26 -1
- package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/codex/harness-pull/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-push/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-review/SKILL.md +2 -1
- package/harness/bundles/general/codex/harness-run/SKILL.md +3 -2
- package/harness/bundles/general/codex/harness-submit/SKILL.md +4 -2
- package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-test/SKILL.md +3 -2
- package/harness/bundles/general/codex/harness-test/checklist.md +2 -0
- package/harness/bundles/general/codex/scripts/harness_archive.py +149 -6
- package/harness/bundles/general/codex/scripts/harness_change.py +95 -0
- package/harness/bundles/general/codex/scripts/harness_ledger.py +25 -4
- package/harness/bundles/general/codex/scripts/harness_profile.py +45 -0
- package/harness/bundles/general/codex/scripts/harness_runtime.py +101 -1
- package/harness/bundles/general/cursor/.harness-build.json +1 -1
- package/harness/bundles/general/cursor/harness-archive/SKILL.md +26 -1
- package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/cursor/harness-pull/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-push/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-review/SKILL.md +2 -1
- package/harness/bundles/general/cursor/harness-run/SKILL.md +3 -2
- package/harness/bundles/general/cursor/harness-submit/SKILL.md +4 -2
- package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-test/SKILL.md +3 -2
- package/harness/bundles/general/cursor/harness-test/checklist.md +2 -0
- package/harness/bundles/general/cursor/scripts/harness_archive.py +149 -6
- package/harness/bundles/general/cursor/scripts/harness_change.py +95 -0
- package/harness/bundles/general/cursor/scripts/harness_ledger.py +25 -4
- package/harness/bundles/general/cursor/scripts/harness_profile.py +45 -0
- package/harness/bundles/general/cursor/scripts/harness_runtime.py +101 -1
- package/harness/bundles/java/claude-code/.harness-build.json +1 -1
- package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +2 -1
- package/harness/bundles/java/claude-code/harness-archive/SKILL.md +26 -1
- package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-package/SKILL.md +2 -1
- package/harness/bundles/java/claude-code/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/claude-code/harness-pull/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-push/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-review/SKILL.md +2 -1
- package/harness/bundles/java/claude-code/harness-run/SKILL.md +3 -2
- package/harness/bundles/java/claude-code/harness-run/reference.md +348 -348
- package/harness/bundles/java/claude-code/harness-submit/SKILL.md +4 -2
- package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-test/SKILL.md +3 -2
- package/harness/bundles/java/claude-code/scripts/harness_archive.py +149 -6
- package/harness/bundles/java/claude-code/scripts/harness_change.py +95 -0
- package/harness/bundles/java/claude-code/scripts/harness_ledger.py +25 -4
- package/harness/bundles/java/claude-code/scripts/harness_profile.py +45 -0
- package/harness/bundles/java/claude-code/scripts/harness_runtime.py +101 -1
- package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +2 -1
- package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +26 -1
- package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-package/SKILL.md +2 -1
- package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/codebuddy/harness-pull/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-push/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-review/SKILL.md +2 -1
- package/harness/bundles/java/codebuddy/harness-run/SKILL.md +3 -2
- package/harness/bundles/java/codebuddy/harness-run/reference.md +348 -348
- package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +4 -2
- package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-test/SKILL.md +3 -2
- package/harness/bundles/java/codebuddy/scripts/harness_archive.py +149 -6
- package/harness/bundles/java/codebuddy/scripts/harness_change.py +95 -0
- package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +25 -4
- package/harness/bundles/java/codebuddy/scripts/harness_profile.py +45 -0
- package/harness/bundles/java/codebuddy/scripts/harness_runtime.py +101 -1
- package/harness/bundles/java/codex/.harness-build.json +1 -1
- package/harness/bundles/java/codex/harness-apidoc/SKILL.md +2 -1
- package/harness/bundles/java/codex/harness-archive/SKILL.md +26 -1
- package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-package/SKILL.md +2 -1
- package/harness/bundles/java/codex/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/codex/harness-pull/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-push/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-review/SKILL.md +2 -1
- package/harness/bundles/java/codex/harness-run/SKILL.md +3 -2
- package/harness/bundles/java/codex/harness-run/reference.md +348 -348
- package/harness/bundles/java/codex/harness-submit/SKILL.md +4 -2
- package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-test/SKILL.md +3 -2
- package/harness/bundles/java/codex/scripts/harness_archive.py +149 -6
- package/harness/bundles/java/codex/scripts/harness_change.py +95 -0
- package/harness/bundles/java/codex/scripts/harness_ledger.py +25 -4
- package/harness/bundles/java/codex/scripts/harness_profile.py +45 -0
- package/harness/bundles/java/codex/scripts/harness_runtime.py +101 -1
- package/harness/bundles/java/cursor/.harness-build.json +1 -1
- package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +2 -1
- package/harness/bundles/java/cursor/harness-archive/SKILL.md +26 -1
- package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-package/SKILL.md +2 -1
- package/harness/bundles/java/cursor/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/cursor/harness-pull/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-push/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-review/SKILL.md +2 -1
- package/harness/bundles/java/cursor/harness-run/SKILL.md +3 -2
- package/harness/bundles/java/cursor/harness-run/reference.md +348 -348
- package/harness/bundles/java/cursor/harness-submit/SKILL.md +4 -2
- package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-test/SKILL.md +3 -2
- package/harness/bundles/java/cursor/scripts/harness_archive.py +149 -6
- package/harness/bundles/java/cursor/scripts/harness_change.py +95 -0
- package/harness/bundles/java/cursor/scripts/harness_ledger.py +25 -4
- package/harness/bundles/java/cursor/scripts/harness_profile.py +45 -0
- package/harness/bundles/java/cursor/scripts/harness_runtime.py +101 -1
- package/harness/manifests/general/claude-code.json +20 -20
- package/harness/manifests/general/codebuddy.json +20 -20
- package/harness/manifests/general/codex.json +20 -20
- package/harness/manifests/general/cursor.json +20 -20
- package/harness/manifests/java/claude-code.json +22 -22
- package/harness/manifests/java/codebuddy.json +22 -22
- package/harness/manifests/java/codex.json +22 -22
- package/harness/manifests/java/cursor.json +22 -22
- package/hunter-workflow-family.json +3 -3
- package/package.json +1 -1
|
@@ -1081,6 +1081,90 @@ def cmd_resolve(args: argparse.Namespace) -> int:
|
|
|
1081
1081
|
)
|
|
1082
1082
|
|
|
1083
1083
|
|
|
1084
|
+
def declare_product_ownership(
|
|
1085
|
+
project_root: Path, change_id: str, *, product_paths: list[str]
|
|
1086
|
+
) -> dict[str, Any]:
|
|
1087
|
+
"""把 `ownership.productPaths` 写进 change 契约。
|
|
1088
|
+
|
|
1089
|
+
这个字段此前没有任何写入方:plan 的 validate_product_ownership 只校验、缺失时
|
|
1090
|
+
软放行,而归档的 compute_ownership_diff 会把全部改动判成 foreignPaths,
|
|
1091
|
+
filesChanged=0 直接触发 DIFF_ZERO_WITH_NONEMPTY_COMMIT。两端口径不一致,中间
|
|
1092
|
+
没工具能补——只能手改契约。这里给出正规入口。
|
|
1093
|
+
|
|
1094
|
+
规则与 plan 校验一致:只收精确文件或目录前缀,不接受通配。
|
|
1095
|
+
"""
|
|
1096
|
+
resolved = resolve_change(project_root, change_id)
|
|
1097
|
+
if not resolved.get("ok"):
|
|
1098
|
+
return resolved
|
|
1099
|
+
change_dir = Path(resolved["changeDir"])
|
|
1100
|
+
normalized = sorted({
|
|
1101
|
+
str(item).strip().replace("\\", "/").removeprefix("./")
|
|
1102
|
+
for item in product_paths
|
|
1103
|
+
if isinstance(item, str) and item.strip()
|
|
1104
|
+
})
|
|
1105
|
+
if not normalized:
|
|
1106
|
+
return {
|
|
1107
|
+
"ok": False,
|
|
1108
|
+
"code": "PLAN_PRODUCT_PATHS_REQUIRED",
|
|
1109
|
+
"message": "至少声明一条 productPaths(精确文件或目录前缀)",
|
|
1110
|
+
}
|
|
1111
|
+
unsupported = sorted(p for p in normalized if any(ch in p for ch in "*?[]"))
|
|
1112
|
+
if unsupported:
|
|
1113
|
+
return {
|
|
1114
|
+
"ok": False,
|
|
1115
|
+
"code": "PLAN_PRODUCT_PATHS_GLOB_UNSUPPORTED",
|
|
1116
|
+
"message": "productPaths 只接受精确文件或目录前缀,不支持通配:" + ", ".join(unsupported),
|
|
1117
|
+
"unsupportedPaths": unsupported,
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
context_path = change_dir / CHANGE_CONTEXT_REL
|
|
1121
|
+
try:
|
|
1122
|
+
context = _read_json(context_path)
|
|
1123
|
+
except (OSError, json.JSONDecodeError) as exc:
|
|
1124
|
+
return {"ok": False, "code": "CHANGE_CONTEXT_INVALID", "message": str(exc)}
|
|
1125
|
+
if not isinstance(context, dict):
|
|
1126
|
+
return {"ok": False, "code": "CHANGE_CONTEXT_INVALID", "message": "change-context.json 不是对象"}
|
|
1127
|
+
|
|
1128
|
+
ownership = context.get("ownership")
|
|
1129
|
+
ownership = dict(ownership) if isinstance(ownership, dict) else {}
|
|
1130
|
+
if ownership.get("productPaths") == normalized:
|
|
1131
|
+
return {
|
|
1132
|
+
"ok": True,
|
|
1133
|
+
"code": "PRODUCT_OWNERSHIP_DECLARED",
|
|
1134
|
+
"idempotent": True,
|
|
1135
|
+
"changeId": change_id,
|
|
1136
|
+
"productPaths": normalized,
|
|
1137
|
+
"path": str(context_path),
|
|
1138
|
+
}
|
|
1139
|
+
ownership["productPaths"] = normalized
|
|
1140
|
+
context["ownership"] = ownership
|
|
1141
|
+
_write_json(context_path, context)
|
|
1142
|
+
return {
|
|
1143
|
+
"ok": True,
|
|
1144
|
+
"code": "PRODUCT_OWNERSHIP_DECLARED",
|
|
1145
|
+
"idempotent": False,
|
|
1146
|
+
"changeId": change_id,
|
|
1147
|
+
"productPaths": normalized,
|
|
1148
|
+
"path": str(context_path),
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
def cmd_declare_ownership(args: argparse.Namespace) -> int:
|
|
1153
|
+
project = resolve_main_project_root()
|
|
1154
|
+
payload = declare_product_ownership(
|
|
1155
|
+
project, args.change, product_paths=list(args.product_path)
|
|
1156
|
+
)
|
|
1157
|
+
if payload.get("ok"):
|
|
1158
|
+
emit(payload, as_json=bool(args.json))
|
|
1159
|
+
return 0
|
|
1160
|
+
return emit_error(
|
|
1161
|
+
str(payload.get("code", "PRODUCT_OWNERSHIP_FAILED")),
|
|
1162
|
+
str(payload.get("message", "declare ownership failed")),
|
|
1163
|
+
as_json=bool(args.json),
|
|
1164
|
+
extra={k: v for k, v in payload.items() if k not in {"ok", "message"}},
|
|
1165
|
+
)
|
|
1166
|
+
|
|
1167
|
+
|
|
1084
1168
|
def cmd_migrate(args: argparse.Namespace) -> int:
|
|
1085
1169
|
project = resolve_main_project_root()
|
|
1086
1170
|
if not args.change:
|
|
@@ -1451,6 +1535,17 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1451
1535
|
p_migrate.add_argument("--change", required=True)
|
|
1452
1536
|
p_migrate.set_defaults(func=cmd_migrate)
|
|
1453
1537
|
|
|
1538
|
+
p_ownership = sub.add_parser(
|
|
1539
|
+
"declare-ownership", parents=[shared],
|
|
1540
|
+
help="declare ownership.productPaths so archive can project the real diff",
|
|
1541
|
+
)
|
|
1542
|
+
p_ownership.add_argument("--change", required=True)
|
|
1543
|
+
p_ownership.add_argument(
|
|
1544
|
+
"--product-path", required=True, action="append",
|
|
1545
|
+
help="exact file or directory prefix (no globs); repeatable",
|
|
1546
|
+
)
|
|
1547
|
+
p_ownership.set_defaults(func=cmd_declare_ownership)
|
|
1548
|
+
|
|
1454
1549
|
p_claim = sub.add_parser("claim", parents=[shared])
|
|
1455
1550
|
p_claim.add_argument("--change", required=True)
|
|
1456
1551
|
p_claim.add_argument("--phase", required=True)
|
|
@@ -304,12 +304,23 @@ def _compact_record_payload(payload: dict[str, Any]) -> dict[str, Any]:
|
|
|
304
304
|
|
|
305
305
|
|
|
306
306
|
def _compact_can_reuse_payload(payload: dict[str, Any]) -> dict[str, Any]:
|
|
307
|
-
"""C5: can-reuse compact — ok/reuse/code
|
|
308
|
-
|
|
307
|
+
"""C5: can-reuse compact — ok/reuse/code;拒绝复用时附带可执行的原因。
|
|
308
|
+
|
|
309
|
+
只回 ok/reuse/code 时,调用方拿到裸 `{"reuse": false}` 无从判断该怎么办,
|
|
310
|
+
只能再跑一次 `--verbose`——原因(profile 缺 verificationInputs、证据不完整等)
|
|
311
|
+
是单行短文本,值得留在默认输出里。允许复用时保持原样精简。
|
|
312
|
+
"""
|
|
313
|
+
compact = {
|
|
309
314
|
"ok": payload.get("ok", True),
|
|
310
315
|
"reuse": payload.get("reuse"),
|
|
311
316
|
"code": payload.get("code"),
|
|
312
317
|
}
|
|
318
|
+
if payload.get("reuse") is not True:
|
|
319
|
+
for key in ("reason", "executionNeed", "detail"):
|
|
320
|
+
value = payload.get(key)
|
|
321
|
+
if value not in (None, "", [], {}):
|
|
322
|
+
compact[key] = value
|
|
323
|
+
return compact
|
|
313
324
|
|
|
314
325
|
|
|
315
326
|
def emit_compact_or_verbose(
|
|
@@ -2581,9 +2592,19 @@ def cmd_record(args: argparse.Namespace) -> int:
|
|
|
2581
2592
|
error_code="PROFILE_INPUT_FILES_CONFLICT",
|
|
2582
2593
|
)
|
|
2583
2594
|
files = profile_files
|
|
2584
|
-
|
|
2595
|
+
# NOT_APPLICABLE 的 validation 没有输入文件可言。门禁 close 又要求
|
|
2596
|
+
# requiredValidations 每项都有 entry——两条规则叠加会逼调用方拿无关文件凑数,
|
|
2597
|
+
# ledger 从此声称该 validation 的输入是那些文件,是假证据。
|
|
2598
|
+
not_applicable = str(getattr(args, "applicability", "") or "") == "NOT_APPLICABLE"
|
|
2599
|
+
if not files and not not_applicable:
|
|
2600
|
+
return emit_error(
|
|
2601
|
+
"record requires --files or a non-empty --profile-input file set; "
|
|
2602
|
+
"unless --applicability NOT_APPLICABLE (then --applicability-reason is required)",
|
|
2603
|
+
as_json=as_json,
|
|
2604
|
+
)
|
|
2605
|
+
if not_applicable and not _nonempty_str(getattr(args, "applicability_reason", None)):
|
|
2585
2606
|
return emit_error(
|
|
2586
|
-
"
|
|
2607
|
+
"NOT_APPLICABLE requires --applicability-reason",
|
|
2587
2608
|
as_json=as_json,
|
|
2588
2609
|
)
|
|
2589
2610
|
|
|
@@ -1101,6 +1101,43 @@ def _derive_verification_graph(profile: dict[str, Any]) -> None:
|
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
1103
|
|
|
1104
|
+
def manual_profile_template(
|
|
1105
|
+
excluded: tuple[str, ...] | list[str], components: list[str]
|
|
1106
|
+
) -> dict[str, Any]:
|
|
1107
|
+
"""歧义时交给调用方的可填骨架。
|
|
1108
|
+
|
|
1109
|
+
骨架本身就是 `empty_profile_skeleton`——defaultsFingerprint、excludedRoots
|
|
1110
|
+
默认集、commands/verificationInputs/verificationGraph 的键都已就位;这里只是
|
|
1111
|
+
补上 commands 的条目形状与 requiredCoverage 取值,省掉调用方去源码里翻。
|
|
1112
|
+
占位值用 `<...>` 包裹,便于替换后 grep 自检。
|
|
1113
|
+
"""
|
|
1114
|
+
template = empty_profile_skeleton(excluded)
|
|
1115
|
+
template["projectType"] = (
|
|
1116
|
+
f"<从 detectedComponents 选定:{'|'.join(components)}>" if components else "<项目类型>"
|
|
1117
|
+
)
|
|
1118
|
+
template["commands"] = {
|
|
1119
|
+
"unitTest": {
|
|
1120
|
+
"command": "<在项目根可直接执行的增量测试命令>",
|
|
1121
|
+
"scope": "incremental",
|
|
1122
|
+
"inputs": ["<相对项目根的 glob,如 <component>/test/**>"],
|
|
1123
|
+
"coverage": "unitTest",
|
|
1124
|
+
"requiredCoverage": "incremental",
|
|
1125
|
+
"dependsOn": [],
|
|
1126
|
+
"source": "user",
|
|
1127
|
+
},
|
|
1128
|
+
"unitTestFull": {
|
|
1129
|
+
"command": "<在项目根可直接执行的全量测试命令>",
|
|
1130
|
+
"scope": "full",
|
|
1131
|
+
"inputs": ["<相对项目根的 glob,如 <component>/**>"],
|
|
1132
|
+
"coverage": "unitTestFull",
|
|
1133
|
+
"requiredCoverage": "module",
|
|
1134
|
+
"dependsOn": [],
|
|
1135
|
+
"source": "user",
|
|
1136
|
+
},
|
|
1137
|
+
}
|
|
1138
|
+
return template
|
|
1139
|
+
|
|
1140
|
+
|
|
1104
1141
|
def detect(project: Path) -> dict[str, Any]:
|
|
1105
1142
|
project = project.resolve()
|
|
1106
1143
|
existing = load_profile(project)
|
|
@@ -1120,6 +1157,14 @@ def detect(project: Path) -> dict[str, Any]:
|
|
|
1120
1157
|
"applied": False,
|
|
1121
1158
|
"detectedComponents": components,
|
|
1122
1159
|
"message": "multiple or nested project components require an explicit profile",
|
|
1160
|
+
# 拒绝生成可以,但不能连结构都不给:调用方否则只能反读本文件源码去凑
|
|
1161
|
+
# v3 形状。骨架不落盘——一份占位 profile 看起来"已配好"比没有更糟。
|
|
1162
|
+
"profileTemplate": manual_profile_template(excluded, components),
|
|
1163
|
+
"hint": (
|
|
1164
|
+
"手工声明一份 profile:以 profileTemplate 为骨架,按 detectedComponents "
|
|
1165
|
+
"选定产品包,commands 里的 inputs 用相对项目根的 glob(如 "
|
|
1166
|
+
f"'<component>/test/**'),填好后写入 {project / PROFILE_REL}"
|
|
1167
|
+
),
|
|
1123
1168
|
}
|
|
1124
1169
|
if project_type == "unknown" and existing:
|
|
1125
1170
|
return {
|
|
@@ -157,6 +157,35 @@ def _private_evidence_root(explicit: Path | None = None) -> Path:
|
|
|
157
157
|
Path.home() / ".harness" / "private-evidence").expanduser().resolve()
|
|
158
158
|
|
|
159
159
|
|
|
160
|
+
def private_evidence_root_for(source: Path, explicit: Path | None = None) -> Path:
|
|
161
|
+
"""私有隔离根:必须与源同一驱动器。
|
|
162
|
+
|
|
163
|
+
`os.replace` 跨驱动器会直接失败(Windows 上是 WinError 17)。默认根
|
|
164
|
+
`~/.harness/private-evidence` 在 Windows 落 C 盘,项目在别的盘时隔离必然失败
|
|
165
|
+
——而隔离是归档的硬前置,等于整条归档路被堵死。同盘时沿用配置/默认值;不同盘
|
|
166
|
+
时退到源所在驱动器根下的 `.harness-private-evidence`(天然在任何项目根之外)。
|
|
167
|
+
POSIX 上 drive 恒为空串,行为不变。
|
|
168
|
+
"""
|
|
169
|
+
source = source.expanduser().resolve()
|
|
170
|
+
preferred = _private_evidence_root(explicit)
|
|
171
|
+
if preferred.drive.lower() == source.drive.lower():
|
|
172
|
+
return preferred
|
|
173
|
+
return (Path(source.anchor) / ".harness-private-evidence").resolve()
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _infer_project_root(change_root: Path) -> Path | None:
|
|
177
|
+
"""change 目录形如 `<project>/.harness/changes/<name>`:取路径里 `.harness` 段的父目录。
|
|
178
|
+
|
|
179
|
+
不做"向上找存在 .harness 的目录"式搜索——用户 HOME 下通常也有 `.harness`,
|
|
180
|
+
那样会把 HOME 误判成项目根,把合法的临时隔离位置一并拒掉。
|
|
181
|
+
"""
|
|
182
|
+
parts = change_root.parts
|
|
183
|
+
for index in range(len(parts) - 1, 0, -1):
|
|
184
|
+
if parts[index] == ".harness":
|
|
185
|
+
return Path(*parts[:index])
|
|
186
|
+
return None
|
|
187
|
+
|
|
188
|
+
|
|
160
189
|
def _secure_private_path(path: Path, *, directory: bool) -> str:
|
|
161
190
|
"""Best-effort owner-only permissions, with an explicit ACL result on Windows."""
|
|
162
191
|
mode = 0o700 if directory else 0o600
|
|
@@ -288,11 +317,12 @@ def quarantine_sensitive_evidence(
|
|
|
288
317
|
change_root: Path,
|
|
289
318
|
reason: str = "sensitive evidence",
|
|
290
319
|
private_root: Path | None = None,
|
|
320
|
+
project_root: Path | None = None,
|
|
291
321
|
) -> dict[str, Any]:
|
|
292
322
|
"""Atomically move legacy plaintext evidence outside any publishable tree."""
|
|
293
323
|
source = source.expanduser().resolve()
|
|
294
324
|
change_root = change_root.expanduser().resolve()
|
|
295
|
-
private =
|
|
325
|
+
private = private_evidence_root_for(source, private_root)
|
|
296
326
|
if not source.is_file():
|
|
297
327
|
return {"ok": False, "reasonCode": "SENSITIVE_EVIDENCE_SOURCE_MISSING", "sourcePath": str(source)}
|
|
298
328
|
if private == change_root or private.is_relative_to(change_root):
|
|
@@ -301,6 +331,25 @@ def quarantine_sensitive_evidence(
|
|
|
301
331
|
"reasonCode": "SENSITIVE_EVIDENCE_QUARANTINE_FAILED",
|
|
302
332
|
"error": "private quarantine root must be outside the publishable change root",
|
|
303
333
|
}
|
|
334
|
+
# 归档的密钥扫描门禁按**项目根**判定(SECRET_SCAN_PRIVATE_PATH_IN_COPY_ROOT)。
|
|
335
|
+
# 这里此前只看 change_root,比门禁宽——于是隔离"成功"了,门禁再拒一次,调用方
|
|
336
|
+
# 得多试一轮才找到合法位置。对齐到同一条边界,错就错在当场。
|
|
337
|
+
resolved_project = (
|
|
338
|
+
project_root.expanduser().resolve()
|
|
339
|
+
if project_root is not None
|
|
340
|
+
else _infer_project_root(change_root)
|
|
341
|
+
)
|
|
342
|
+
if resolved_project is not None and (
|
|
343
|
+
private == resolved_project or private.is_relative_to(resolved_project)
|
|
344
|
+
):
|
|
345
|
+
return {
|
|
346
|
+
"ok": False,
|
|
347
|
+
"reasonCode": "SENSITIVE_EVIDENCE_QUARANTINE_FAILED",
|
|
348
|
+
"error": (
|
|
349
|
+
"private quarantine root must be outside the project root "
|
|
350
|
+
f"({resolved_project}); archive's secret scan rejects paths inside it"
|
|
351
|
+
),
|
|
352
|
+
}
|
|
304
353
|
try:
|
|
305
354
|
raw_digest = "sha256:" + hashlib.sha256(source.read_bytes()).hexdigest()
|
|
306
355
|
quarantine_dir = private / uuid.uuid4().hex
|
|
@@ -1850,6 +1899,37 @@ def doctor(project: Path, change_dir: Path, *, agent: str) -> dict[str, Any]:
|
|
|
1850
1899
|
return {"ok": True, "action": "doctor", **payload}
|
|
1851
1900
|
|
|
1852
1901
|
|
|
1902
|
+
def cmd_quarantine_evidence(args: argparse.Namespace) -> dict[str, Any]:
|
|
1903
|
+
"""隔离命令:把明文敏感证据原子移出可发布树,逐条返回结果。
|
|
1904
|
+
|
|
1905
|
+
单条失败不吞掉其余条目——归档阻断项常常一次报多个文件,逐条报告才能一轮修完。
|
|
1906
|
+
"""
|
|
1907
|
+
project = Path(args.project).expanduser().resolve()
|
|
1908
|
+
change_root = Path(args.change_dir).expanduser().resolve()
|
|
1909
|
+
private_root = Path(args.private_root) if args.private_root else None
|
|
1910
|
+
entries: list[dict[str, Any]] = []
|
|
1911
|
+
for raw in args.file:
|
|
1912
|
+
candidate = Path(raw)
|
|
1913
|
+
source = candidate if candidate.is_absolute() else change_root / candidate
|
|
1914
|
+
outcome = quarantine_sensitive_evidence(
|
|
1915
|
+
source,
|
|
1916
|
+
change_root=change_root,
|
|
1917
|
+
reason=args.reason,
|
|
1918
|
+
private_root=private_root,
|
|
1919
|
+
project_root=project,
|
|
1920
|
+
)
|
|
1921
|
+
entries.append({"file": raw, **outcome})
|
|
1922
|
+
failed = [item for item in entries if not item.get("ok")]
|
|
1923
|
+
return {
|
|
1924
|
+
"ok": not failed,
|
|
1925
|
+
"action": "quarantine-evidence",
|
|
1926
|
+
"code": "SENSITIVE_EVIDENCE_QUARANTINED" if not failed else "SENSITIVE_EVIDENCE_QUARANTINE_FAILED",
|
|
1927
|
+
"quarantined": len(entries) - len(failed),
|
|
1928
|
+
"failed": len(failed),
|
|
1929
|
+
"entries": entries,
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
|
|
1853
1933
|
def build_parser() -> argparse.ArgumentParser:
|
|
1854
1934
|
parser = argparse.ArgumentParser(prog="harness_runtime.py")
|
|
1855
1935
|
sub = parser.add_subparsers(dest="command", required=True)
|
|
@@ -1858,6 +1938,24 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1858
1938
|
p_doctor.add_argument("--change-dir", required=True)
|
|
1859
1939
|
p_doctor.add_argument("--agent", choices=sorted(_ADAPTERS), required=True)
|
|
1860
1940
|
p_doctor.add_argument("--json", action="store_true")
|
|
1941
|
+
# 归档的 SENSITIVE_EVIDENCE_UNQUARANTINED 是硬阻断,此前却没有任何命令行入口
|
|
1942
|
+
# ——调用方只能写 python -c + sys.path hack 去调内部函数。
|
|
1943
|
+
p_quarantine = sub.add_parser(
|
|
1944
|
+
"quarantine-evidence",
|
|
1945
|
+
help="move plaintext sensitive evidence outside the publishable tree",
|
|
1946
|
+
)
|
|
1947
|
+
p_quarantine.add_argument("--project", required=True)
|
|
1948
|
+
p_quarantine.add_argument("--change-dir", required=True)
|
|
1949
|
+
p_quarantine.add_argument(
|
|
1950
|
+
"--file", required=True, action="append",
|
|
1951
|
+
help="path to quarantine, relative to --change-dir or absolute; repeatable",
|
|
1952
|
+
)
|
|
1953
|
+
p_quarantine.add_argument("--reason", default="sensitive evidence")
|
|
1954
|
+
p_quarantine.add_argument(
|
|
1955
|
+
"--private-root", default=None,
|
|
1956
|
+
help="override the private root; must be outside the project root and on its drive",
|
|
1957
|
+
)
|
|
1958
|
+
p_quarantine.add_argument("--json", action="store_true")
|
|
1861
1959
|
p_adapter = sub.add_parser("adapter")
|
|
1862
1960
|
p_adapter.add_argument("--agent", choices=sorted(_ADAPTERS), required=True)
|
|
1863
1961
|
p_adapter.add_argument("--change", required=True)
|
|
@@ -1899,6 +1997,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
1899
1997
|
try:
|
|
1900
1998
|
if args.command == "doctor":
|
|
1901
1999
|
result = doctor(Path(args.project), Path(args.change_dir), agent=args.agent)
|
|
2000
|
+
elif args.command == "quarantine-evidence":
|
|
2001
|
+
result = cmd_quarantine_evidence(args)
|
|
1902
2002
|
elif args.command == "adapter":
|
|
1903
2003
|
result = {"ok": True, "action": "adapter", **adapter_worktree(args.agent, args.change)}
|
|
1904
2004
|
elif args.command == "_worker":
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(awk *)
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-apidoc — 前端接口文档(Java overlay)
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -35,6 +35,7 @@ disallowed-tools:
|
|
|
35
35
|
|
|
36
36
|
## 统一读取协议
|
|
37
37
|
|
|
38
|
+
0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
|
|
38
39
|
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
39
40
|
2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
40
41
|
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(awk *)
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-archive — 变更归档
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -56,6 +56,7 @@ disallowed-tools:
|
|
|
56
56
|
|
|
57
57
|
## 统一读取协议
|
|
58
58
|
|
|
59
|
+
0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
|
|
59
60
|
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
60
61
|
2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
61
62
|
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
@@ -143,6 +144,13 @@ disallowed-tools:
|
|
|
143
144
|
|
|
144
145
|
`execute` 内部运行自动门禁。实际计划最后阶段已终态、边界快照存在且 `status.archivable=true` 时直接执行;未满足时返回阻断且不移动原目录。用户取消后不得重跑。
|
|
145
146
|
|
|
147
|
+
### 二·A、两个常见阻断的正规出路(不要自己拼 python -c)
|
|
148
|
+
|
|
149
|
+
| 阻断 | 出路 |
|
|
150
|
+
|------|------|
|
|
151
|
+
| `SENSITIVE_EVIDENCE_UNQUARANTINED` | `python <skills-root>/scripts/harness_runtime.py quarantine-evidence --project . --change-dir ".harness/changes/<cn>" --file "<相对 change-dir 的路径>" --reason "<为什么是敏感证据>" --json`(`--file` 可重复)。私有根默认已与项目同盘、且在项目根之外——**不要**手工指定项目内的路径,归档的密钥扫描会以 `SECRET_SCAN_PRIVATE_PATH_IN_COPY_ROOT` 拒绝 |
|
|
152
|
+
| `DIFF_ZERO_WITH_NONEMPTY_COMMIT`(提交范围非空但 filesChanged=0) | 契约缺 `ownership.productPaths`,全部改动被判为 `foreignPaths`。用 `python <skills-root>/scripts/harness_change.py declare-ownership --change <cn> --product-path "<目录前缀或精确文件>" --json` 按计划的实际改动范围声明(可重复;只收精确路径,不支持通配)。**不要**手改 `change-context.json` |
|
|
153
|
+
|
|
146
154
|
### 三、文件移动只用内置工具或 PowerShell
|
|
147
155
|
|
|
148
156
|
移动用 Read+Write+验证 或 PowerShell;**禁止 Bash mv/cp/rm**。移动失败时不删除原目录,报错退出让用户手动处理。
|
|
@@ -204,6 +212,23 @@ git 命令通过 `powershell.exe -Command "..."` 执行;archive-meta.md 和 su
|
|
|
204
212
|
- `.harness/archive/YYYY-MM-DD-<change-name>/events.ndjson` — 结构化事件层(新流程推荐;旧 archive 可缺失)
|
|
205
213
|
- `.harness/archive/YYYY-MM-DD-<change-name>/reports/final/summary-data.json` — 最终报告数据源
|
|
206
214
|
- `.harness/archive/YYYY-MM-DD-<change-name>/evidence/archive-manifest-before.json` / `archive-manifest-after.json` — 归档前后 manifest/checksum
|
|
215
|
+
- `.harness/state/local/archive-packages/<change-name>.remote.json` — 远端上传回执(`archiveId`/`archiveStatus`/`knowledgeStatus`/`uploadStatus`/`fileCount`)
|
|
216
|
+
|
|
217
|
+
### 结束报告必须回显两条上传结果 ⚠️
|
|
218
|
+
|
|
219
|
+
归档会做**两次**独立上传,二者成败无关,必须分别如实回显:
|
|
220
|
+
|
|
221
|
+
| 上传 | 载什么 | 结果在哪 |
|
|
222
|
+
|------|--------|---------|
|
|
223
|
+
| `steps.archive_push` | 归档 ZIP(核心产物) | `archiveId`/`archiveStatus`/`uploadStatus`/`knowledgeStatus`,同时落盘 `state/local/archive-packages/<cn>.remote.json` |
|
|
224
|
+
| `steps.managed_snapshot_push` | **plan/spec 文档、`.harness/codebase` 架构地图、`.harness/rules`**(push 会 walk 每个归档目录的 `spec/` 与 `plans/`) | `ok`/`reasonCode`/`exitCode`/`cliCode`/`detail` |
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
远端归档:arc_3ff325bb…(archiveStatus=durable,uploadStatus=ready,knowledgeStatus=ready,8 文件)
|
|
228
|
+
受管快照:❌ MANAGED_SNAPSHOT_UPLOAD_FAILED(exitCode=1,detail=…)→ plan/spec 与规则/架构地图未上平台,需 npx hunter-harness push --yes --non-interactive 重试
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**第二条尤其不能省**:它是 best-effort,失败不阻断归档,于是最容易被淹没成一句警告——而平台上"分支文件里没有 plan/spec"正是它失败的后果。成功时也要写明 `submitted` 数量;`ok=false` 时必须带上 `reasonCode` 与 `detail`,不得省略或写成"已完成"。
|
|
207
232
|
|
|
208
233
|
## 渐进披露
|
|
209
234
|
|
|
@@ -20,7 +20,7 @@ disallowed-tools:
|
|
|
20
20
|
- Bash(awk *)
|
|
21
21
|
- Bash(curl *)
|
|
22
22
|
---
|
|
23
|
-
<!-- generated by harness_deploy.py; core=
|
|
23
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-codebase-map — 代码库地图
|
|
25
25
|
|
|
26
26
|
## Purpose
|
|
@@ -8,7 +8,7 @@ disallowed-tools:
|
|
|
8
8
|
- Bash(git *)
|
|
9
9
|
- Bash(curl *)
|
|
10
10
|
---
|
|
11
|
-
<!-- generated by harness_deploy.py; core=
|
|
11
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
12
12
|
# harness-knowledge-ingest
|
|
13
13
|
|
|
14
14
|
知识 ingest 完全由 Hunter Platform 负责。归档完成时,客户端生成一个确定性 ZIP;
|
|
@@ -8,7 +8,7 @@ disallowed-tools:
|
|
|
8
8
|
- Bash(git *)
|
|
9
9
|
- Bash(curl *)
|
|
10
10
|
---
|
|
11
|
-
<!-- generated by harness_deploy.py; core=
|
|
11
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
12
12
|
# harness-knowledge-query
|
|
13
13
|
|
|
14
14
|
项目知识以 Hunter Platform 的服务端索引为唯一真源。客户端只提交查询并消费结果:
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(awk *)
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-package — 增量模块打包(Java overlay)
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -42,6 +42,7 @@ disallowed-tools:
|
|
|
42
42
|
|
|
43
43
|
## 统一读取协议
|
|
44
44
|
|
|
45
|
+
0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
|
|
45
46
|
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
46
47
|
2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
47
48
|
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(awk *)
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-plan — 需求规划
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -38,6 +38,7 @@ disallowed-tools:
|
|
|
38
38
|
|
|
39
39
|
## 统一读取协议
|
|
40
40
|
|
|
41
|
+
0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
|
|
41
42
|
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
42
43
|
2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
43
44
|
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(awk *)
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-pull — 从 Hunter Platform 下拉与恢复
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(awk *)
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-push — 上传到 Hunter Platform
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -22,7 +22,7 @@ disallowed-tools:
|
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
- Bash(codegraph *)
|
|
24
24
|
---
|
|
25
|
-
<!-- generated by harness_deploy.py; core=
|
|
25
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
26
26
|
# harness-review — 代码审查
|
|
27
27
|
|
|
28
28
|
## Purpose
|
|
@@ -48,6 +48,7 @@ disallowed-tools:
|
|
|
48
48
|
|
|
49
49
|
## 统一读取协议
|
|
50
50
|
|
|
51
|
+
0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
|
|
51
52
|
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
52
53
|
2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
53
54
|
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
@@ -22,7 +22,7 @@ disallowed-tools:
|
|
|
22
22
|
- Bash(curl *)
|
|
23
23
|
- Bash(codegraph *)
|
|
24
24
|
---
|
|
25
|
-
<!-- generated by harness_deploy.py; core=
|
|
25
|
+
<!-- generated by harness_deploy.py; core=4f3a290efefe6a68; overlay=java; agent=claude-code; do not edit -->
|
|
26
26
|
# harness-run — 需求编码
|
|
27
27
|
|
|
28
28
|
## Purpose
|
|
@@ -59,6 +59,7 @@ disallowed-tools:
|
|
|
59
59
|
|
|
60
60
|
## 统一读取协议
|
|
61
61
|
|
|
62
|
+
0. **脚本在 `<skills-root>/scripts/` 共享,不在每个 skill 子目录下** — 实际形态是 `.codebuddy/skills/scripts/harness_*.py`(`.claude`/`.cursor`/`.codex` 同理),**没有** `.../skills/harness-<phase>/scripts/`。plan、run/test、archive 三份执行日志里都先猜成后者、报 `No such file` 再靠 Search 找回来;照第一种写法直接用
|
|
62
63
|
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
63
64
|
2. **change-name 优先从 frontmatter 读取** — `plans/*-design.md`、`spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
64
65
|
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
@@ -81,7 +82,7 @@ disallowed-tools:
|
|
|
81
82
|
0. 加载上下文:普通 Run 先 `harness_context.py prepare --project . --change <id> --phase run --executor <tool> --json`(`--project` 必填,漏了直接 argparse 报错),再 **`harness_context.py begin --project . --change <id> --phase run --executor <tool> --json`** 校验交接,最后运行 **`harness_gate.py begin --phase run --change <id>`**。<br>**交接凭证不必手工补**:v2 计划的 `plan finalize` 不写 context 事务,`prepare` 会在检测到 committed 的 `meta/publication-journals/*.json` 时自动补录 `plan → run` 凭证(凭证带 `bootstrapSource=plan_publication_journal` 留痕)。仍报 `HANDOFF_REQUIRED`/`LEGACY_BOOTSTRAP_REQUIRED` 说明**没有**这份发布证据——回到 plan 阶段确认发布是否真的完成,**不得**自己拼 `classify + configure-plan + close` 造凭证。`harness_gate.py` 会从当前已安装适配器自动识别 skills root;只有执行复制到别处的脚本时才显式传 `--skills-root`。`--fixback` 不得拼装这些底层步骤,必须只调用一次 `harness_fixback.py launch-review --project . --change <id> --change-dir <change-dir> --executor <tool> --skills-root <skills-root> --product-identity <当前产品身份> --json`:该命令会先筛选结构化评审项,再原子选择 Fixback 分支、确认上下文、取得 Run 门禁并创建已填充批次。返回 `FIXBACK_NOTHING_TO_APPLY` 时直接报告“本轮评审没有需要执行的代码修复”并停止;返回阻塞码时按 `recoveryAction` 停止,不搜索实现、不试探其他参数、不创建空批次。禁止手写 `events.ndjson` / `phase.end`。已连接平台时 begin 会 best-effort 补传事件,失败只告警。
|
|
82
83
|
0.5. **测试基础设施探测**(先写 `CHECKING`,四项证据齐备后再结论)→ `reference.md` Step 0.5;测试基线已由上一步 gate begin 内部建立,不得再次执行 guard begin
|
|
83
84
|
1. **变更簇 TDD** — `protocols.md` `run-tdd-protocol`;批量 RED/GREEN;按需 `change-cluster-review-protocol`(高风险 + reviewer 预检可用)
|
|
84
|
-
2. 构建验证 + **仅**通过 `harness_ledger.py record` 写 ledger(禁止 Write/Edit `verification-ledger.json`);若本阶段创建/删除了清单、锁文件、源码根或改变技术栈,最后一次产品编辑后、写账本与关门前必须执行 `harness_preflight.py detect --project . --json` 刷新 build profile。`record --project . --profile-input <key>` 会对缺失/陈旧 profile 自动检测并从同一 target 推导 scope、coverage
|
|
85
|
+
2. 构建验证 + **仅**通过 `harness_ledger.py record` 写 ledger(禁止 Write/Edit `verification-ledger.json`);若本阶段创建/删除了清单、锁文件、源码根或改变技术栈,最后一次产品编辑后、写账本与关门前必须执行 `harness_preflight.py detect --project . --json` 刷新 build profile。`record --project . --profile-input <key>` 会对缺失/陈旧 profile 自动检测并从同一 target 推导 scope、coverage、规范命令和输入闭包;不得再手填另一套身份。detect 在嵌套/多组件仓库返回 `DETECTION_AMBIGUOUS` 时,响应里的 `profileTemplate` 就是可填骨架(已含 defaultsFingerprint、excludedRoots 默认集与 commands 条目形状),按 `hint` 填好写入 `.harness/config/build-profile.json` 即可,**不要去反读 `harness_profile.py` 源码凑结构**。`diff-hash --change-dir` 纳入 ignored tests → `reference.md` Step 2c
|
|
85
86
|
3. **场景覆盖检查**(场景表映射,禁止用用例数冒充场景数)
|
|
86
87
|
4. **关门检查**(10 项)→ 只执行一次 `harness_gate.py close`;`--to-phase` 必须取返回的 `nextPhases` 或 `plannedPhases` 中 run 的真实后继,禁止写死 test。该命令内部关闭 test guard、写 `phase.end`、释放租约、写 handoff 并补传事件;不得再单独调用 test-guard/context close。失败时按结构化 `recoveryAction` 原样重试,已完成步骤幂等复用。
|
|
87
88
|
|