@hunter-harness/workflow-harness 0.2.17 → 0.2.19
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-plan/reference.md +5 -5
- package/harness/bundles/general/claude-code/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-review/checklist.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/checklist.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/reference.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 +24 -8
- 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 +15 -2
- package/harness/bundles/general/claude-code/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/claude-code/scripts/harness_profile.py +1 -0
- package/harness/bundles/general/claude-code/scripts/harness_runtime.py +4 -4
- package/harness/bundles/general/claude-code/scripts/harness_service.py +1 -0
- 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-plan/reference.md +5 -5
- package/harness/bundles/general/codebuddy/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-review/checklist.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/checklist.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/reference.md +1 -1
- package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/codebuddy/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/general/codebuddy/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/codebuddy/scripts/harness_profile.py +1 -0
- package/harness/bundles/general/codebuddy/scripts/harness_runtime.py +4 -4
- package/harness/bundles/general/codebuddy/scripts/harness_service.py +1 -0
- 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-plan/reference.md +5 -5
- package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-review/checklist.md +1 -1
- package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-run/checklist.md +1 -1
- package/harness/bundles/general/codex/harness-run/reference.md +1 -1
- package/harness/bundles/general/codex/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/codex/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/general/codex/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/codex/scripts/harness_profile.py +1 -0
- package/harness/bundles/general/codex/scripts/harness_runtime.py +4 -4
- package/harness/bundles/general/codex/scripts/harness_service.py +1 -0
- 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-plan/reference.md +5 -5
- package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-review/checklist.md +1 -1
- package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-run/checklist.md +1 -1
- package/harness/bundles/general/cursor/harness-run/reference.md +1 -1
- package/harness/bundles/general/cursor/harness-submit/SKILL.md +11 -2
- package/harness/bundles/general/cursor/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/general/cursor/scripts/harness_paths.py +170 -1
- package/harness/bundles/general/cursor/scripts/harness_profile.py +1 -0
- package/harness/bundles/general/cursor/scripts/harness_runtime.py +4 -4
- package/harness/bundles/general/cursor/scripts/harness_service.py +1 -0
- 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-package/checklist.md +1 -1
- package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-plan/reference.md +5 -5
- package/harness/bundles/java/claude-code/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-review/checklist.md +1 -1
- package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-run/checklist.md +2 -2
- package/harness/bundles/java/claude-code/harness-run/reference.md +352 -352
- package/harness/bundles/java/claude-code/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/claude-code/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/java/claude-code/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/claude-code/scripts/harness_profile.py +1 -0
- package/harness/bundles/java/claude-code/scripts/harness_runtime.py +4 -4
- package/harness/bundles/java/claude-code/scripts/harness_service.py +1 -0
- 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-package/checklist.md +1 -1
- package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-plan/reference.md +5 -5
- package/harness/bundles/java/codebuddy/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-review/checklist.md +1 -1
- package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-run/checklist.md +2 -2
- package/harness/bundles/java/codebuddy/harness-run/reference.md +352 -352
- package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/codebuddy/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/java/codebuddy/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/codebuddy/scripts/harness_profile.py +1 -0
- package/harness/bundles/java/codebuddy/scripts/harness_runtime.py +4 -4
- package/harness/bundles/java/codebuddy/scripts/harness_service.py +1 -0
- 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-package/checklist.md +1 -1
- package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-plan/reference.md +5 -5
- package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-review/checklist.md +1 -1
- package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-run/checklist.md +2 -2
- package/harness/bundles/java/codex/harness-run/reference.md +352 -352
- package/harness/bundles/java/codex/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/codex/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/java/codex/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/codex/scripts/harness_profile.py +1 -0
- package/harness/bundles/java/codex/scripts/harness_runtime.py +4 -4
- package/harness/bundles/java/codex/scripts/harness_service.py +1 -0
- 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-package/checklist.md +1 -1
- package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-plan/reference.md +5 -5
- package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-review/checklist.md +1 -1
- package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-run/checklist.md +2 -2
- package/harness/bundles/java/cursor/harness-run/reference.md +352 -352
- package/harness/bundles/java/cursor/harness-submit/SKILL.md +11 -2
- package/harness/bundles/java/cursor/harness-submit/checklist.md +24 -8
- 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 +15 -2
- package/harness/bundles/java/cursor/scripts/harness_paths.py +170 -1
- package/harness/bundles/java/cursor/scripts/harness_profile.py +1 -0
- package/harness/bundles/java/cursor/scripts/harness_runtime.py +4 -4
- package/harness/bundles/java/cursor/scripts/harness_service.py +1 -0
- package/harness/manifests/general/claude-code.json +26 -26
- package/harness/manifests/general/codebuddy.json +26 -26
- package/harness/manifests/general/codex.json +26 -26
- package/harness/manifests/general/cursor.json +26 -26
- package/harness/manifests/java/claude-code.json +29 -29
- package/harness/manifests/java/codebuddy.json +29 -29
- package/harness/manifests/java/codex.json +29 -29
- package/harness/manifests/java/cursor.json +29 -29
- 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")
|
|
@@ -23,10 +23,10 @@ if hasattr(sys.stderr, "reconfigure"):
|
|
|
23
23
|
SCHEMA_VERSION = 1
|
|
24
24
|
_CHANGE_ID = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$")
|
|
25
25
|
_ADAPTERS = {
|
|
26
|
-
"claude-code": (".
|
|
27
|
-
"codex": (".
|
|
28
|
-
"cursor": (".
|
|
29
|
-
"codebuddy": (".
|
|
26
|
+
"claude-code": (".worktrees", "harness/"),
|
|
27
|
+
"codex": (".worktrees", "harness/"),
|
|
28
|
+
"cursor": (".worktrees", "harness/"),
|
|
29
|
+
"codebuddy": (".worktrees", "harness/"),
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
|
|
@@ -164,6 +164,7 @@ def get_service_start(profile: dict[str, Any]) -> dict[str, Any]:
|
|
|
164
164
|
# runtime resolve 把具体 overlay/profile 注入到 session,不写回持久 profile
|
|
165
165
|
# (spec §3.1 持久 profile 只保存模板;§3.4 修复输入端陈旧 profile)。
|
|
166
166
|
STALE_WORKTREE_MARKERS: tuple[str, ...] = (
|
|
167
|
+
".worktrees/",
|
|
167
168
|
".claude/worktrees/",
|
|
168
169
|
".cursor/worktrees/",
|
|
169
170
|
".codeium/worktrees/",
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-apidoc — 前端接口文档(Java overlay)
|
|
25
25
|
|
|
26
26
|
## Purpose
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-archive — 变更归档
|
|
25
25
|
|
|
26
26
|
## Purpose
|
|
@@ -50,6 +50,12 @@ disallowed-tools:
|
|
|
50
50
|
- commit 已 push(`git log @{u}..HEAD` 输出为空)
|
|
51
51
|
- **最终 hash 来源**:worktree 模式(`meta/worktree.json` requested=true)下读 ledger 的 `mergeFinalHash`(由 `/harness-submit` 合并段写入);主目录模式读 submit 的 `final pushed hash`。当前 `git rev-parse HEAD` 须一致
|
|
52
52
|
- test 报告存在或标记"跳过";review 报告存在或标记"未运行 review"(review 不阻塞归档)
|
|
53
|
+
- **最小必备集(H-4 / `harness_archive.py status` blockers)**:
|
|
54
|
+
- `plans/*-plan.md`
|
|
55
|
+
- 非空 `events.ndjson`
|
|
56
|
+
- `evidence/verification-ledger.json`
|
|
57
|
+
- 至少一个 test 或 review 报告/证据
|
|
58
|
+
- 缺失任一项 → `archivable=false`;可从 `.harness/cache/change-snapshots/<change>/` 恢复正式层后再重试
|
|
53
59
|
|
|
54
60
|
## Inputs
|
|
55
61
|
|
|
@@ -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)
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-codebase-map — 代码库地图
|
|
25
25
|
|
|
26
26
|
## Purpose
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-knowledge-ingest
|
|
25
25
|
|
|
26
26
|
从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-knowledge-query
|
|
25
25
|
|
|
26
26
|
并行 change 中查询必须传 `--change <change-id>`;成功后以该 change 的 `meta/knowledge-context.json` 为稳定指针。全局 `context-packs/latest.json` 仅向后兼容,不得用于判断多个 active change 的上下文归属。
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-package — 增量模块打包(Java overlay)
|
|
25
25
|
|
|
26
26
|
## Purpose
|
|
@@ -10,7 +10,7 @@ description: harness-package 的8步工作流详细步骤、模块识别方法
|
|
|
10
10
|
|
|
11
11
|
如果 `$ARGUMENTS` 非空且与检测到的变更名不一致,以 `$ARGUMENTS` 为准。
|
|
12
12
|
|
|
13
|
-
**读取 worktree 状态并切换**:读 `.harness/changes/<change-name>/meta/worktree.json`(旧路径 `worktree.json` 兼容)。`requested=true` 且 `.
|
|
13
|
+
**读取 worktree 状态并切换**:读 `.harness/changes/<change-name>/meta/worktree.json`(旧路径 `worktree.json` 兼容)。`requested=true` 且 `.worktrees/<change-name>/` 已创建 → cd 到该 worktree 目录;`requested=true` 但 worktree 不存在 → 停止,提示先修复 `harness-run`,不得静默回主目录;`requested=false` → 在主目录执行。切换后检查构建配置文件(`.mvn/maven.config`、`settings-*.xml` 等)是否完整,缺失时从主目录复制。
|
|
14
14
|
|
|
15
15
|
**强制前置检查 — harness-test(硬门禁)和 harness-review(参考性)**:
|
|
16
16
|
|
|
@@ -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=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
24
24
|
# harness-plan — 需求规划
|
|
25
25
|
|
|
26
26
|
## Purpose
|
|
@@ -15,10 +15,10 @@ description: harness-plan 的需求提取模板、任务拆分规则、测试场
|
|
|
15
15
|
"requested": true,
|
|
16
16
|
"created": false,
|
|
17
17
|
"agent": "<active-adapter>",
|
|
18
|
-
"worktreeRoot": "
|
|
19
|
-
"branchPrefix": "
|
|
20
|
-
"path": "
|
|
21
|
-
"branch": "
|
|
18
|
+
"worktreeRoot": ".worktrees",
|
|
19
|
+
"branchPrefix": "harness/",
|
|
20
|
+
"path": ".worktrees/<change-name>",
|
|
21
|
+
"branch": "harness/<change-name>",
|
|
22
22
|
"decisionBy": "user",
|
|
23
23
|
"decisionAt": "YYYY-MM-DD HH:mm",
|
|
24
24
|
"ownerSkill": "harness-run"
|
|
@@ -41,7 +41,7 @@ description: harness-plan 的需求提取模板、任务拆分规则、测试场
|
|
|
41
41
|
|
|
42
42
|
### 决策事件 note 示例
|
|
43
43
|
|
|
44
|
-
`path` 与 `branch` 必须来自 `harness_runtime.py adapter`/`meta/runtime.json
|
|
44
|
+
`path` 与 `branch` 必须来自 `harness_runtime.py adapter`/`meta/runtime.json`。所有 agent 共享统一路径 `.worktrees/<change-name>` 与统一分支前缀 `harness/`;`agent` 字段仅作创建者元数据,不再决定路径。
|
|
45
45
|
|
|
46
46
|
`用户选择使用 Worktree;决策文件为 meta/worktree.json;requested=true, created=false;创建责任为 harness-run。`
|
|
47
47
|
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(curl *)
|
|
22
22
|
- Bash(codegraph *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-review — 代码审查
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -8,7 +8,7 @@ description: harness-review 的6维度审查检查项详细列表。仅在执行
|
|
|
8
8
|
|
|
9
9
|
用 Glob 搜索 `.harness/changes/*/plans/*-plan.md`(**排除 `.harness/archive/*/`**),读取 frontmatter 提取 `change-name`。默认最多一个未归档变更;如有多个,优先取最近修改的,或询问用户。后续所有路径基于此变更名。
|
|
10
10
|
|
|
11
|
-
**读取 worktree 状态**:读 `.harness/changes/<change-name>/meta/worktree.json`。`requested=true` 且 worktree 已创建 → 后续 `git diff` 的 `<项目路径>` 用 worktree 路径(`.
|
|
11
|
+
**读取 worktree 状态**:读 `.harness/changes/<change-name>/meta/worktree.json`。`requested=true` 且 worktree 已创建 → 后续 `git diff` 的 `<项目路径>` 用 worktree 路径(`.worktrees/<change-name>`);`requested=true` 但 worktree 不存在 → 停止,提示先修复 `harness-run`,不得静默回主目录。
|
|
12
12
|
|
|
13
13
|
## 审查流程
|
|
14
14
|
|
|
@@ -21,7 +21,7 @@ disallowed-tools:
|
|
|
21
21
|
- Bash(curl *)
|
|
22
22
|
- Bash(codegraph *)
|
|
23
23
|
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
24
|
+
<!-- generated by harness_deploy.py; core=f01595d3142d34b7; overlay=java; agent=claude-code; do not edit -->
|
|
25
25
|
# harness-run — 需求编码
|
|
26
26
|
|
|
27
27
|
## Purpose
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- [ ] `requested=true` 且 worktree 存在 → 切换到 worktree 执行
|
|
13
13
|
- [ ] `requested=true` 且 worktree 不存在 → 必须创建 worktree
|
|
14
14
|
- [ ] worktree 创建命令必须使用 PowerShell:`git worktree add ...`
|
|
15
|
-
- [ ] 创建后验证 `.
|
|
15
|
+
- [ ] 创建后验证 `.worktrees/<change-name>/.git` 存在
|
|
16
16
|
- [ ] 创建成功后更新 `worktree.json` 的 `created=true/createdAt/createdBy`
|
|
17
17
|
- [ ] 创建失败 → 停止,或 blocking user confirmation 询问是否改为主目录执行
|
|
18
18
|
- [ ] 禁止 `requested=true && worktree 不存在` 时直接主目录执行
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
|
|
197
197
|
> 仅在 worktree 中执行时触发此步骤。在主目录执行时跳过(标记 ⏭️主目录跳过)。
|
|
198
198
|
|
|
199
|
-
- [ ] 确认当前 cwd 在 `.
|
|
199
|
+
- [ ] 确认当前 cwd 在 `.worktrees/<change-name>/` 下
|
|
200
200
|
- [ ] 生成变更摘要:`git diff --stat` + `git diff --stat --cached`
|
|
201
201
|
- [ ] 构建 commit message:`wip(<scope>): <change-name> 编码完成 — N任务/M文件变更`
|
|
202
202
|
- [ ] **⚠️ 强制阻断**:用 blocking user confirmation 展示变更列表 + commit message,等待用户确认
|