@hunter-harness/workflow-harness 0.2.18 → 0.2.20
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 +7 -1
- package/harness/bundles/general/claude-code/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/general/claude-code/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/claude-code/harness-submit/checklist.md +20 -2
- package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/general/claude-code/scripts/harness_archive.py +199 -30
- package/harness/bundles/general/claude-code/scripts/harness_events.py +5 -18
- package/harness/bundles/general/claude-code/scripts/harness_integration.py +153 -0
- package/harness/bundles/general/claude-code/scripts/harness_ledger.py +37 -11
- package/harness/bundles/general/claude-code/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +7 -1
- package/harness/bundles/general/codebuddy/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/general/codebuddy/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/codebuddy/harness-submit/checklist.md +20 -2
- package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/general/codebuddy/scripts/harness_archive.py +199 -30
- package/harness/bundles/general/codebuddy/scripts/harness_events.py +5 -18
- package/harness/bundles/general/codebuddy/scripts/harness_integration.py +153 -0
- package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +37 -11
- package/harness/bundles/general/codebuddy/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/codex/.harness-build.json +1 -1
- package/harness/bundles/general/codex/harness-archive/SKILL.md +7 -1
- package/harness/bundles/general/codex/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/codex/harness-submit/checklist.md +20 -2
- package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/codex/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/general/codex/scripts/harness_archive.py +199 -30
- package/harness/bundles/general/codex/scripts/harness_events.py +5 -18
- package/harness/bundles/general/codex/scripts/harness_integration.py +153 -0
- package/harness/bundles/general/codex/scripts/harness_ledger.py +37 -11
- package/harness/bundles/general/codex/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/cursor/.harness-build.json +1 -1
- package/harness/bundles/general/cursor/harness-archive/SKILL.md +7 -1
- package/harness/bundles/general/cursor/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/cursor/harness-submit/checklist.md +20 -2
- package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/cursor/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/general/cursor/scripts/harness_archive.py +199 -30
- package/harness/bundles/general/cursor/scripts/harness_events.py +5 -18
- package/harness/bundles/general/cursor/scripts/harness_integration.py +153 -0
- package/harness/bundles/general/cursor/scripts/harness_ledger.py +37 -11
- package/harness/bundles/general/cursor/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/claude-code/.harness-build.json +1 -1
- package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-archive/SKILL.md +7 -1
- package/harness/bundles/java/claude-code/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/claude-code/harness-submit/checklist.md +20 -2
- package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/java/claude-code/scripts/harness_archive.py +199 -30
- package/harness/bundles/java/claude-code/scripts/harness_events.py +5 -18
- package/harness/bundles/java/claude-code/scripts/harness_integration.py +153 -0
- package/harness/bundles/java/claude-code/scripts/harness_ledger.py +37 -11
- package/harness/bundles/java/claude-code/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +7 -1
- package/harness/bundles/java/codebuddy/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/codebuddy/harness-submit/checklist.md +20 -2
- package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/java/codebuddy/scripts/harness_archive.py +199 -30
- package/harness/bundles/java/codebuddy/scripts/harness_events.py +5 -18
- package/harness/bundles/java/codebuddy/scripts/harness_integration.py +153 -0
- package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +37 -11
- package/harness/bundles/java/codebuddy/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/codex/.harness-build.json +1 -1
- package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-archive/SKILL.md +7 -1
- package/harness/bundles/java/codex/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/codex/harness-submit/checklist.md +20 -2
- package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/codex/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/java/codex/scripts/harness_archive.py +199 -30
- package/harness/bundles/java/codex/scripts/harness_events.py +5 -18
- package/harness/bundles/java/codex/scripts/harness_integration.py +153 -0
- package/harness/bundles/java/codex/scripts/harness_ledger.py +37 -11
- package/harness/bundles/java/codex/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/cursor/.harness-build.json +1 -1
- package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-archive/SKILL.md +7 -1
- package/harness/bundles/java/cursor/harness-archive/checklist.md +6 -0
- 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 +1 -1
- package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/cursor/harness-submit/checklist.md +20 -2
- package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/cursor/protocols/report-pipeline-protocol.md +2 -0
- package/harness/bundles/java/cursor/scripts/harness_archive.py +199 -30
- package/harness/bundles/java/cursor/scripts/harness_events.py +5 -18
- package/harness/bundles/java/cursor/scripts/harness_integration.py +153 -0
- package/harness/bundles/java/cursor/scripts/harness_ledger.py +37 -11
- package/harness/bundles/java/cursor/scripts/harness_paths.py +170 -1
- package/harness/manifests/general/claude-code.json +19 -19
- package/harness/manifests/general/codebuddy.json +19 -19
- package/harness/manifests/general/codex.json +19 -19
- package/harness/manifests/general/cursor.json +19 -19
- package/harness/manifests/java/claude-code.json +21 -21
- package/harness/manifests/java/codebuddy.json +21 -21
- package/harness/manifests/java/codex.json +21 -21
- package/harness/manifests/java/cursor.json +21 -21
- package/hunter-workflow-family.json +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ import re
|
|
|
20
20
|
import subprocess
|
|
21
21
|
import sys
|
|
22
22
|
from pathlib import Path
|
|
23
|
-
from typing import Any
|
|
23
|
+
from typing import Any, Sequence
|
|
24
24
|
|
|
25
25
|
SCRIPTS_DIR = Path(__file__).resolve().parent
|
|
26
26
|
if str(SCRIPTS_DIR) not in sys.path:
|
|
@@ -289,6 +289,175 @@ def assert_path_within(
|
|
|
289
289
|
return resolved
|
|
290
290
|
|
|
291
291
|
|
|
292
|
+
class CleanupTopologyError(ValueError):
|
|
293
|
+
"""Raised when cleanup would delete or traverse into state/archive roots."""
|
|
294
|
+
|
|
295
|
+
code = "CLEANUP_TOPOLOGY_REFUSED"
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# Skip descending into these when scanning for junction/symlink escapes.
|
|
299
|
+
# Matches integration HEAVY_WORKTREE_ROOTS plus .git (topology scan only).
|
|
300
|
+
CLEANUP_WALK_SKIP_DIRS = frozenset(
|
|
301
|
+
{
|
|
302
|
+
"node_modules",
|
|
303
|
+
".venv",
|
|
304
|
+
"venv",
|
|
305
|
+
"build",
|
|
306
|
+
"dist",
|
|
307
|
+
"target",
|
|
308
|
+
".cache",
|
|
309
|
+
"__pycache__",
|
|
310
|
+
".git",
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def assert_cleanup_safe(
|
|
316
|
+
cleanup_root: Path,
|
|
317
|
+
state_roots: Sequence[Path] | None = None,
|
|
318
|
+
archive_roots: Sequence[Path] | None = None,
|
|
319
|
+
) -> Path:
|
|
320
|
+
"""Refuse cleanup when state/archive roots resolve inside the cleanup tree.
|
|
321
|
+
|
|
322
|
+
Also refuses when a junction/symlink under ``cleanup_root`` resolves into a
|
|
323
|
+
protected state/archive root (Windows junction / symlink escape).
|
|
324
|
+
"""
|
|
325
|
+
cleanup = Path(cleanup_root).resolve()
|
|
326
|
+
protected: list[Path] = []
|
|
327
|
+
for raw in [*(state_roots or ()), *(archive_roots or ())]:
|
|
328
|
+
try:
|
|
329
|
+
protected.append(Path(raw).resolve())
|
|
330
|
+
except OSError as exc:
|
|
331
|
+
raise CleanupTopologyError(
|
|
332
|
+
f"CLEANUP_TOPOLOGY_REFUSED: cannot resolve protected path {raw}: {exc}"
|
|
333
|
+
) from exc
|
|
334
|
+
|
|
335
|
+
for prot in protected:
|
|
336
|
+
if prot == cleanup or prot.is_relative_to(cleanup):
|
|
337
|
+
raise CleanupTopologyError(
|
|
338
|
+
"CLEANUP_TOPOLOGY_REFUSED: protected path "
|
|
339
|
+
f"{prot} is inside cleanup root {cleanup}"
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
if cleanup.is_dir():
|
|
343
|
+
for dirpath, dirnames, filenames in os.walk(cleanup, followlinks=False):
|
|
344
|
+
# Inspect this level (including heavy names) for link escapes, then
|
|
345
|
+
# prune descent so we do not walk install/cache trees.
|
|
346
|
+
entries = [*dirnames, *filenames]
|
|
347
|
+
dirnames[:] = [d for d in dirnames if d not in CLEANUP_WALK_SKIP_DIRS]
|
|
348
|
+
for name in entries:
|
|
349
|
+
child = Path(dirpath) / name
|
|
350
|
+
try:
|
|
351
|
+
is_link = child.is_symlink()
|
|
352
|
+
except OSError:
|
|
353
|
+
continue
|
|
354
|
+
# Junctions often report as directories; resolve and compare.
|
|
355
|
+
try:
|
|
356
|
+
resolved_child = child.resolve()
|
|
357
|
+
except OSError:
|
|
358
|
+
continue
|
|
359
|
+
escaped = not (
|
|
360
|
+
resolved_child == cleanup or resolved_child.is_relative_to(cleanup)
|
|
361
|
+
)
|
|
362
|
+
if not (is_link or escaped):
|
|
363
|
+
continue
|
|
364
|
+
for prot in protected:
|
|
365
|
+
if (
|
|
366
|
+
resolved_child == prot
|
|
367
|
+
or resolved_child.is_relative_to(prot)
|
|
368
|
+
or prot.is_relative_to(resolved_child)
|
|
369
|
+
):
|
|
370
|
+
raise CleanupTopologyError(
|
|
371
|
+
"CLEANUP_TOPOLOGY_REFUSED: cleanup path "
|
|
372
|
+
f"{child} resolves to protected {resolved_child}"
|
|
373
|
+
)
|
|
374
|
+
return cleanup
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
_FORMAL_SNAPSHOT_DIRS = ("plans", "spec", "evidence", "reports", "meta")
|
|
378
|
+
_FORMAL_SNAPSHOT_FILES = ("events.ndjson",)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def snapshot_change_formal_layer(
|
|
382
|
+
project_root: Path,
|
|
383
|
+
change_id: str,
|
|
384
|
+
*,
|
|
385
|
+
change_dir: Path | None = None,
|
|
386
|
+
) -> dict[str, Any]:
|
|
387
|
+
"""Copy change formal layer into ``.harness/cache/change-snapshots/<change>/``.
|
|
388
|
+
|
|
389
|
+
Destination is always under the main project / common harness root — never
|
|
390
|
+
under a feature worktree path alone.
|
|
391
|
+
"""
|
|
392
|
+
import shutil
|
|
393
|
+
|
|
394
|
+
project = resolve_main_project_root(Path(project_root))
|
|
395
|
+
src = Path(change_dir).resolve() if change_dir is not None else (
|
|
396
|
+
project / ".harness" / "changes" / change_id
|
|
397
|
+
).resolve()
|
|
398
|
+
if not src.is_dir():
|
|
399
|
+
raise FileNotFoundError(f"change dir not found for snapshot: {src}")
|
|
400
|
+
|
|
401
|
+
dest = (project / ".harness" / "cache" / "change-snapshots" / change_id).resolve()
|
|
402
|
+
# Hard guard: never write the snapshot inside the source tree itself.
|
|
403
|
+
if dest == src or dest.is_relative_to(src):
|
|
404
|
+
raise ValueError(
|
|
405
|
+
f"snapshot destination must not be inside change dir: {dest}"
|
|
406
|
+
)
|
|
407
|
+
dest.mkdir(parents=True, exist_ok=True)
|
|
408
|
+
|
|
409
|
+
copied: list[str] = []
|
|
410
|
+
for name in _FORMAL_SNAPSHOT_DIRS:
|
|
411
|
+
source_dir = src / name
|
|
412
|
+
if not source_dir.is_dir():
|
|
413
|
+
continue
|
|
414
|
+
target_dir = dest / name
|
|
415
|
+
shutil.copytree(source_dir, target_dir, dirs_exist_ok=True)
|
|
416
|
+
copied.append(name + "/")
|
|
417
|
+
for name in _FORMAL_SNAPSHOT_FILES:
|
|
418
|
+
source_file = src / name
|
|
419
|
+
if not source_file.is_file():
|
|
420
|
+
continue
|
|
421
|
+
shutil.copy2(source_file, dest / name)
|
|
422
|
+
copied.append(name)
|
|
423
|
+
|
|
424
|
+
file_hashes: dict[str, str] = {}
|
|
425
|
+
for path in sorted(dest.rglob("*")):
|
|
426
|
+
if not path.is_file():
|
|
427
|
+
continue
|
|
428
|
+
rel = path.relative_to(dest).as_posix()
|
|
429
|
+
if rel == "manifest.json":
|
|
430
|
+
continue
|
|
431
|
+
digest = hashlib.sha256(path.read_bytes()).hexdigest()
|
|
432
|
+
file_hashes[rel] = "sha256:" + digest
|
|
433
|
+
|
|
434
|
+
manifest = {
|
|
435
|
+
"schemaVersion": 1,
|
|
436
|
+
"changeId": change_id,
|
|
437
|
+
"source": str(src),
|
|
438
|
+
"destination": str(dest),
|
|
439
|
+
"projectRoot": str(project),
|
|
440
|
+
"copied": copied,
|
|
441
|
+
"files": file_hashes,
|
|
442
|
+
"fileCount": len(file_hashes),
|
|
443
|
+
}
|
|
444
|
+
manifest_path = dest / "manifest.json"
|
|
445
|
+
manifest_path.write_text(
|
|
446
|
+
json.dumps(manifest, ensure_ascii=False, indent=2) + "\n",
|
|
447
|
+
encoding="utf-8",
|
|
448
|
+
newline="\n",
|
|
449
|
+
)
|
|
450
|
+
return {
|
|
451
|
+
"ok": True,
|
|
452
|
+
"code": "CHANGE_SNAPSHOT_WRITTEN",
|
|
453
|
+
"changeId": change_id,
|
|
454
|
+
"destination": str(dest),
|
|
455
|
+
"fileCount": len(file_hashes),
|
|
456
|
+
"copied": copied,
|
|
457
|
+
"manifestPath": str(manifest_path),
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
|
|
292
461
|
def cmd_resolve_layout(args: argparse.Namespace) -> int:
|
|
293
462
|
layout = resolve_change_layout(Path.cwd(), args.change)
|
|
294
463
|
sys.stdout.write(json.dumps(layout, ensure_ascii=False, indent=2) + "\n")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-apidoc
|
|
3
3
|
description: 从 Java 后端代码生成结构化前端 API 文档(Controller/VO/ErrorCode)。使用场景:接口文档、前端接口文档、API 文档生成
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-apidoc — 前端接口文档(Java overlay)
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-archive
|
|
|
3
3
|
description: 归档所有变更产出(计划/测试报告/审查/SQL/API文档)到
|
|
4
4
|
.harness/archive/,含归档元数据和可视化最终总结。使用场景:归档、完成归档、收尾、打包产出物
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-archive — 变更归档
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -33,6 +33,12 @@ description: 归档所有变更产出(计划/测试报告/审查/SQL/API文档
|
|
|
33
33
|
- commit 已 push(`git log @{u}..HEAD` 输出为空)
|
|
34
34
|
- **最终 hash 来源**:worktree 模式(`meta/worktree.json` requested=true)下读 ledger 的 `mergeFinalHash`(由 `/harness-submit` 合并段写入);主目录模式读 submit 的 `final pushed hash`。当前 `git rev-parse HEAD` 须一致
|
|
35
35
|
- test 报告存在或标记"跳过";review 报告存在或标记"未运行 review"(review 不阻塞归档)
|
|
36
|
+
- **最小必备集(H-4 / `harness_archive.py status` blockers)**:
|
|
37
|
+
- `plans/*-plan.md`
|
|
38
|
+
- 非空 `events.ndjson`
|
|
39
|
+
- `evidence/verification-ledger.json`
|
|
40
|
+
- 至少一个 test 或 review 报告/证据
|
|
41
|
+
- 缺失任一项 → `archivable=false`;可从 `.harness/cache/change-snapshots/<change>/` 恢复正式层后再重试
|
|
36
42
|
|
|
37
43
|
## Inputs
|
|
38
44
|
|
|
@@ -20,6 +20,12 @@ description: harness-archive 的归档前检查项和归档后验证项。仅在
|
|
|
20
20
|
|
|
21
21
|
- [ ] 未在调用 finalize 前手工追加 archive 阶段边界
|
|
22
22
|
- [ ] 只有一个未归档变更目录(多个时终止或让用户选择)
|
|
23
|
+
- [ ] **最小必备集 blockers**(`harness_archive.py status`):
|
|
24
|
+
- [ ] `plans/*-plan.md` 存在
|
|
25
|
+
- [ ] `events.ndjson` 存在且非空
|
|
26
|
+
- [ ] `evidence/verification-ledger.json` 存在
|
|
27
|
+
- [ ] 至少一个 test 或 review 报告/证据
|
|
28
|
+
- [ ] 若缺失:优先从 `.harness/cache/change-snapshots/<change>/` 恢复,禁止空壳归档
|
|
23
29
|
- [ ] 变更目录下有 plans/ 子目录(至少有计划文件)
|
|
24
30
|
- [ ] `events.ndjson` 存在;执行日志允许由 finalize 从事件流重新渲染(旧 archive 才兼容根目录 `execution-log.md`)
|
|
25
31
|
- [ ] 准备生成 `archive-manifest-before.json`(path/size/sha256)
|
|
@@ -3,7 +3,7 @@ name: harness-codebase-map
|
|
|
3
3
|
description: 分析现有代码库并生成 .harness/codebase/map/
|
|
4
4
|
下的结构化代码库地图。用于陌生项目理解、重大改造前梳理、harness-sync 提示 map 过期后的人工刷新。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-codebase-map — 代码库地图
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-knowledge-ingest
|
|
|
3
3
|
description: 从 .harness/archive 归档整理、同步和维护项目知识索引。适用场景:ingest knowledge、sync
|
|
4
4
|
knowledge、rebuild knowledge index、promote knowledge、确认知识条目、检查知识库是否过期。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-knowledge-ingest
|
|
8
8
|
|
|
9
9
|
从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
|
|
@@ -3,7 +3,7 @@ name: harness-knowledge-query
|
|
|
3
3
|
description: 根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge
|
|
4
4
|
历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-knowledge-query
|
|
8
8
|
|
|
9
9
|
并行 change 中查询必须传 `--change <change-id>`;成功后以该 change 的 `meta/knowledge-context.json` 为稳定指针。全局 `context-packs/latest.json` 仅向后兼容,不得用于判断多个 active change 的上下文归属。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-package
|
|
3
3
|
description: 增量模块打包:拉取最新→编译验证→mvn package→汇总 jar/war。使用场景:打包、package、发版准备
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-package — 增量模块打包(Java overlay)
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-plan
|
|
3
3
|
description: 将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-plan — 需求规划
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-review
|
|
|
3
3
|
description: 6维度代码审查(架构/安全/规范/兼容/测试/性能),对照项目规则(见
|
|
4
4
|
.harness/context-index.json)和测试场景表,在隔离上下文运行。使用场景:代码审查、提交前检查、合并评审
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-review — 代码审查
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-run
|
|
3
3
|
description: 按变更簇执行 TDD 编码循环(RED→GREEN→REFACTOR→编译验证),逐变更簇实现计划中的任务。使用场景:开始编码、实现功能、写代码、TDD 编码
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-run — 需求编码
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-submit
|
|
|
3
3
|
description: 最终提交封装:验证→中文 commit→提交/推送;worktree 模式含 --no-ff
|
|
4
4
|
合并回主分支。使用场景:提交代码、commit、push、合并分支、merge to main、完成开发
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-submit — 最终提交(含 worktree 合并)
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -79,12 +79,17 @@ M3. **merge** — `--no-ff` 合并 feature 分支;merge diff 出现其他 Chan
|
|
|
79
79
|
M4. **verify** — 在 integration worktree 内执行组合态验证;他人提交引入或 ledger 不可复用时必跑
|
|
80
80
|
M5. **push** — 仅在验证身份与远端基线仍匹配时 push;远端漂移 → `TARGET_MOVED` 结构化失败,不继续
|
|
81
81
|
M6. **cleanup** — `git worktree remove --force` 精确路径 + 临时分支 + (push 成功后)保护 ref;释放 integration lock;失败保留 journal 与诊断证据;更新 `worktree.json`(`created=false` + removedAt)
|
|
82
|
+
M6.5. **formal snapshot** — mergeFinalHash 写入后调用 `harness_paths.snapshot_change_formal_layer(projectRoot, changeId)`,备份到主仓 `.harness/cache/change-snapshots/<change>/`(不得写在 feature worktree 内)
|
|
82
83
|
M7. **ledger + 收尾** — 经 `harness_ledger.py record` 写入 `mergeFinalHash`(= journal `pushedHead`);**`harness_gate.py close --phase merge`**(禁止手工 phase.end);提示 `/harness-archive`
|
|
83
84
|
|
|
84
|
-
> Ledger v3(v2 契约 / split-v1 布局起):`record` 强制顶层身份(`schemaVersion=3/repositoryId/baseCommit/currentHead/diffHash/ownershipHash
|
|
85
|
+
> Ledger v3(v2 契约 / split-v1 布局起):`record` 强制顶层身份(`schemaVersion=3/repositoryId/baseCommit/currentHead/diffHash/ownershipHash`,缺失非零退出、`LEDGER_IDENTITY_INVALID`,不写账本)与 typed metrics;legacy 契约行为不变。详见 `../protocols/ledger-protocol.md` 第十节。
|
|
85
86
|
|
|
86
87
|
正常路径**禁止创建、应用或删除仓库级 stash**。中断恢复:`harness_integration.py status` 读 journal,`recover` 从首个未完成步骤续跑;protection refs 只在 push 成功后的 cleanup 删除。
|
|
87
88
|
|
|
89
|
+
**失败 txn 回收(abandon)**:verify/push 未成功且 remote 不含 mergeCommit 时,运行 `harness_integration.py abandon --change … --run-id …`:清理 integrationRoot / temp branch / protection refs / lock;**绝不删除 feature worktree**。push 已成功或 remote 已含 merge → `ABANDON_REFUSED`,改走 cleanup。
|
|
90
|
+
|
|
91
|
+
**清 feature worktree 迁根硬门槛(H-1/H-2)**:删除 feature worktree 前,若 Agent root / cwd 落在待删路径内,必须先 `move_agent_to_root(projectRoot)`(目标为主仓已存在的 `main`/`master`;**禁止**为迁根去 fetch 已删除的 feature 分支)。迁根失败 → **拒绝删除**。清理前调用 `harness_paths.assert_cleanup_safe(cleanupRoot, stateRoots, archiveRoots)`;state/archive(含 junction/symlink 解析后)落在 cleanup 内 → `CLEANUP_TOPOLOGY_REFUSED`。
|
|
92
|
+
|
|
88
93
|
### Java 提交前验证补充
|
|
89
94
|
|
|
90
95
|
通用 `harness-submit` 的最终门禁已统一为 `unitTestFull`(见通用 SKILL.md 步骤 2 / checklist 步骤 2)。Java overlay **不重复定义门禁规则**,只补两点:
|
|
@@ -123,6 +128,10 @@ test-tracking manifest 是 ignored test 的唯一强制暂存授权:只允许
|
|
|
123
128
|
- **`git merge --no-ff` 固定**;禁止 fast-forward
|
|
124
129
|
- **冲突不自动解** → 停下 → 用户手动解 → 确认后继续
|
|
125
130
|
- **`mergeFinalHash`** = 主分支 push 后 HEAD;archive 优先读此字段
|
|
131
|
+
- **迁根后再删 feature WT**:Agent 仍在待删 root 内则拒绝删除;目标分支已删时切主仓 `main`/`master`,禁止强行 fetch
|
|
132
|
+
- **snapshot 后再清**:正式层已写入 `.harness/cache/change-snapshots/<change>/`
|
|
133
|
+
- **拓扑安全**:`assert_cleanup_safe` 拒绝 state/archive ⊆ cleanup(含 junction)
|
|
134
|
+
- **abandon ≠ cleanup**:仅失败 txn;永不删 feature worktree
|
|
126
135
|
|
|
127
136
|
### 五、Shell 安全 / 敏感信息 / 证据化
|
|
128
137
|
|
|
@@ -369,6 +369,8 @@ powershell.exe -Command "python harness/scripts/harness_check_gate.py --write"
|
|
|
369
369
|
|
|
370
370
|
### 步骤 M5:push
|
|
371
371
|
|
|
372
|
+
**硬门槛(eslint × feature worktree)**:integration / 主仓 `pre-push` 跑 `npm run check` 时,eslint 不得把 sibling `.worktrees/<change>/` 当成第二工程根(双 `tsconfigRootDir`)。本仓以 `eslint.config.mjs` 的 `.worktrees/**` ignore 为准;若自定义 eslint 未 ignore,须先 `move_agent_to_root(<projectRoot>)` 再清 feature worktree,再 push。
|
|
373
|
+
|
|
372
374
|
```powershell
|
|
373
375
|
python harness/scripts/harness_integration.py push --change <change-name> --run-id <run-id> --feature-branch harness/<change-name> --target-branch <主分支> --temp-root <task-temp>
|
|
374
376
|
```
|
|
@@ -386,11 +388,26 @@ python harness/scripts/harness_integration.py cleanup --change <change-name> --r
|
|
|
386
388
|
- 失败保留 journal 与诊断证据,状态 🟡WARN,不得宣称清理完成
|
|
387
389
|
- 若存在 test-tracking manifest,确认其路径已由合并后的目标分支跟踪(`git ls-files --error-unmatch -- <exact-path>`),缺失即停止
|
|
388
390
|
|
|
391
|
+
**失败 txn 改走 abandon(勿强行 cleanup)**:
|
|
392
|
+
|
|
393
|
+
```powershell
|
|
394
|
+
python harness/scripts/harness_integration.py abandon --change <change-name> --run-id <run-id> --feature-branch harness/<change-name> --target-branch <主分支> --temp-root <task-temp>
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
仅当 push ≠ DONE 且 remote 不含 mergeCommit;清理 integration 产物后可换新 run-id 重开。push 成功 → `ABANDON_REFUSED`。
|
|
398
|
+
|
|
389
399
|
更新 `meta/worktree.json`:`created=false` + `removedAt`/`removedBy`/`removalNote`。
|
|
390
400
|
|
|
401
|
+
**删除 feature worktree 前(硬门槛)**:
|
|
402
|
+
|
|
403
|
+
1. 若 Agent root / cwd 落在待删 worktree → 先 `move_agent_to_root(<projectRoot>)`;目标为主仓,feature 分支已删则切 `main`/`master`,禁止 fetch 已不存在分支
|
|
404
|
+
2. 迁根失败 → **停止删除**
|
|
405
|
+
3. `assert_cleanup_safe(cleanupRoot, [.harness/changes/<id>, .harness/state/...], [.harness/archive])`;`CLEANUP_TOPOLOGY_REFUSED` → 停止
|
|
406
|
+
4. mergeFinalHash 已写后先 `snapshot_change_formal_layer`,再清 feature WT
|
|
407
|
+
|
|
391
408
|
### 步骤 M7:更新 ledger + 收尾
|
|
392
409
|
|
|
393
|
-
ledger 顶层写入 `"mergeFinalHash": "<journal pushedHead>"`;经 `harness_gate.py close --phase merge` 关闭(禁止手工 phase.end
|
|
410
|
+
ledger 顶层写入 `"mergeFinalHash": "<journal pushedHead>"`;经 `harness_gate.py close --phase merge` 关闭(禁止手工 phase.end)。正式层快照确认存在于 `.harness/cache/change-snapshots/<change-name>/`。
|
|
394
411
|
|
|
395
412
|
```markdown
|
|
396
413
|
## 合并完成 — <change-name>
|
|
@@ -399,6 +416,7 @@ ledger 顶层写入 `"mergeFinalHash": "<journal pushedHead>"`;经 `harness_ga
|
|
|
399
416
|
- 主分支 push: ✅(<old>..<new> → origin/<主分支>)
|
|
400
417
|
- mergeFinalHash: `<merge-final-hash>`
|
|
401
418
|
- 验证策略: 🔁REUSED / 🔄已重跑
|
|
402
|
-
-
|
|
419
|
+
- snapshot: `.harness/cache/change-snapshots/<change-name>/`
|
|
420
|
+
- worktree: 已清理(迁根后)
|
|
403
421
|
- 下一步: `/harness-archive`
|
|
404
422
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-sync
|
|
3
3
|
description: 检查并更新项目AI元数据(CodeGraph索引、harness-codebase-map分析、CLAUDE.md、AGENTS.md、.harness/完整性),确保Claude对代码库的理解与最新代码一致。当用户说'同步/更新索引/刷新元数据/检查一致性'时使用
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-sync — 元数据同步
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-test
|
|
3
3
|
description: 测试执行:读取场景表,执行单元测试+API接口测试+数据兼容验证,输出测试报告。当用户说'跑测试/验证/跑用例/接口测试/单元测试'时使用
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=832c96441cf34e47; overlay=java; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-test — 测试执行
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -43,6 +43,8 @@ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/cha
|
|
|
43
43
|
|
|
44
44
|
`append` 写入契约(Task 4 §6.1):普通 append = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex`);仅 `--type phase.end` append 成功后渲染一次 `logs/execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。人类可读摘要(触发指令、降级原因、阶段结论)写入事件的 `note` 字段;阶段开始/结束、命令、验证、artifact、问题、决策各写对应 `type` 事件。旧 archive 缺少 events 可回放兼容;新变更不得以 execution-log 已存在为理由跳过 events。
|
|
45
45
|
|
|
46
|
+
**artifact 硬门禁(H-8)**:`--type artifact` **必须**带非空 `--path`(change 相对路径)。知识探索/预览类说明改用 `--type issue` 或 `--type decision`,禁止再用 `--kind informational` 伪装无 path 的 artifact。
|
|
47
|
+
|
|
46
48
|
基础事件结构(schema_version 3;兼容读取 v1/v2):
|
|
47
49
|
|
|
48
50
|
```json
|