@christang/keel 5.227.0 → 5.229.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +40 -7
- package/README.zh-CN.md +36 -4
- package/assets/bootstrap/AGENTS.md +1 -1
- package/bin/keel.js +43 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/plugins/keel/hooks/codex.json +1 -1
- package/plugins/keel/scripts/pretooluse-guard.js +77 -2
- package/plugins/keel/scripts/session-start.js +7 -0
- package/scripts/bump_version.js +2 -0
- package/scripts/test_codex_host.js +102 -0
- package/scripts/validation/baseline.py +3 -0
- package/scripts/validation/codexhost.py +13 -0
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/docs.py +1 -1
- package/scripts/validation/guard.py +34 -0
- package/scripts/validation/registry.py +29 -0
- package/scripts/validation/shift.py +6 -6
- package/scripts/validation/sync.py +1608 -0
- package/src/core/capabilities.js +10 -0
- package/src/core/chat/archive.js +6 -2
- package/src/core/chat/notice.js +6 -1
- package/src/core/codex-host.js +276 -0
- package/src/core/config.js +39 -0
- package/src/core/context.js +62 -0
- package/src/core/gates.js +13 -0
- package/src/core/lock.js +514 -8
- package/src/core/patrol.js +1 -0
- package/src/core/shift.js +184 -11
- package/src/core/sync.js +374 -0
- package/src/core/tick.js +14 -6
- package/src/core/worktrees.js +8 -3
|
@@ -308,6 +308,9 @@ def validate_paths(errors: list[str]) -> None:
|
|
|
308
308
|
relative = marker_file.relative_to(ROOT).as_posix()
|
|
309
309
|
if relative.startswith(("node_modules/", "openspec/changes/archive/", "keel/archive/")):
|
|
310
310
|
continue
|
|
311
|
+
# Nested clones and linked worktrees are independent checkouts.
|
|
312
|
+
if any((parent / ".git").exists() for parent in marker_file.parents if parent != ROOT and ROOT in parent.parents):
|
|
313
|
+
continue
|
|
311
314
|
try:
|
|
312
315
|
text = marker_file.read_text(encoding="utf-8")
|
|
313
316
|
except (UnicodeDecodeError, OSError):
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Public Codex CLI against an isolated WebSocket stand-in, not a real model host."""
|
|
2
|
+
import subprocess
|
|
3
|
+
from validation.common import ROOT, report
|
|
4
|
+
|
|
5
|
+
CODEX_HOST_EVIDENCE = {"hook_event_name": "PreToolUse", "transport": "stand-in WebSocket"}
|
|
6
|
+
|
|
7
|
+
def validate_codex_managed_host_scenario() -> int:
|
|
8
|
+
result = subprocess.run(["node", "--test", str(ROOT / "scripts/test_codex_host.js")], cwd=ROOT, capture_output=True, text=True, timeout=45)
|
|
9
|
+
if result.returncode:
|
|
10
|
+
report(result.stdout + result.stderr)
|
|
11
|
+
return 1
|
|
12
|
+
report("codex-managed-host scenario passed (" + CODEX_HOST_EVIDENCE["transport"] + "; native hook payload policy).")
|
|
13
|
+
return 0
|
|
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
|
|
|
35
35
|
os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
PACKAGE_VERSION = "5.
|
|
38
|
+
PACKAGE_VERSION = "5.229.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.229.0"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -641,7 +641,7 @@ def validate_continuation_docs_scenario() -> int:
|
|
|
641
641
|
# to spell all of it: a reader copies from the list they are shown.
|
|
642
642
|
for needle in (
|
|
643
643
|
f"accepted names: {ACCEPTED_AUTHORIZE_NAMES}",
|
|
644
|
-
"The
|
|
644
|
+
"The sixteen names above are the whole vocabulary.",
|
|
645
645
|
"`protocol-refresh`, the seventh name",
|
|
646
646
|
):
|
|
647
647
|
if needle not in readme:
|
|
@@ -5884,3 +5884,37 @@ def validate_external_agent_exit_status_scenario() -> int:
|
|
|
5884
5884
|
|
|
5885
5885
|
report("external-agent-exit-status scenario passed.")
|
|
5886
5886
|
return 0
|
|
5887
|
+
|
|
5888
|
+
|
|
5889
|
+
def validate_guard_refuses_push_to_held_branch_scenario() -> int:
|
|
5890
|
+
from validation.sync import _Devices, _declare_in
|
|
5891
|
+
label = "guard-refuses-push-to-held-branch:"
|
|
5892
|
+
with tempfile.TemporaryDirectory(prefix="keel-guard-lock-") as raw:
|
|
5893
|
+
d = _Devices(Path(raw), "authorize:\n - device-sync\nsync:\n lock: true\n")
|
|
5894
|
+
mine = {**d.env(d.a), "KEEL_DEVICE": "dev-a"}
|
|
5895
|
+
other = {**mine, "KEEL_DEVICE": "dev-b"}
|
|
5896
|
+
d.keel(d.a, "lock", "acquire", "--branch", "feat", env=mine)
|
|
5897
|
+
def decide(command: str, env: dict) -> dict | None:
|
|
5898
|
+
event = {"tool_name": "Bash", "tool_input": {"command": command}, "cwd": str(d.a)}
|
|
5899
|
+
ran = subprocess.run(["node", str(ROOT / PLUGIN_ROOT / "scripts/pretooluse-guard.js")],
|
|
5900
|
+
cwd=d.a, env=env, input=json.dumps(event), text=True, capture_output=True)
|
|
5901
|
+
return pretooluse_decision(ran)
|
|
5902
|
+
denied = decide("git push origin feat", other)
|
|
5903
|
+
if not denied or denied.get("permissionDecision") != "deny":
|
|
5904
|
+
report(f"{label} must deny naming keel lock acquire --branch feat: {denied}")
|
|
5905
|
+
return 1
|
|
5906
|
+
reason = denied.get("permissionDecisionReason", "")
|
|
5907
|
+
for expected in ("pm@dev-a", "keel lock acquire --branch feat"):
|
|
5908
|
+
if expected not in reason:
|
|
5909
|
+
report(f"{label} denial missing {expected}: {denied}")
|
|
5910
|
+
return 1
|
|
5911
|
+
for command, env in (("git push origin feat", mine), ("git push --all origin", other), ('git push origin "$BRANCH"', other)):
|
|
5912
|
+
if decide(command, env):
|
|
5913
|
+
report(f"{label} existing rule must allow {command} here")
|
|
5914
|
+
return 1
|
|
5915
|
+
_declare_in(d, d.a, "authorize:\n - device-sync\n")
|
|
5916
|
+
if decide("git push origin feat", other):
|
|
5917
|
+
report(f"{label} no sync declaration must preserve the old verdict")
|
|
5918
|
+
return 1
|
|
5919
|
+
report("guard-refuses-push-to-held-branch scenario passed.")
|
|
5920
|
+
return 0
|
|
@@ -12,11 +12,14 @@ from validation import chatwake
|
|
|
12
12
|
from validation import dsh
|
|
13
13
|
from validation import skipspecs
|
|
14
14
|
from validation import feedback
|
|
15
|
+
from validation import sync
|
|
16
|
+
from validation import codexhost
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
SCENARIOS: tuple = (
|
|
22
|
+
("codex-managed-host", codexhost.validate_codex_managed_host_scenario),
|
|
20
23
|
("stateless-continuity", shift.validate_stateless_continuity_scenario),
|
|
21
24
|
("context-per-worktree", shift.validate_context_per_worktree_scenario),
|
|
22
25
|
("read-only-role", shift.validate_read_only_role_scenario),
|
|
@@ -531,11 +534,37 @@ SCENARIOS: tuple = (
|
|
|
531
534
|
("chat-no-wake-dm", chat.validate_chat_no_wake_dm_scenario),
|
|
532
535
|
("chat-wakes-without-no-wake", chat.validate_chat_wakes_without_no_wake_scenario),
|
|
533
536
|
("worktree-overview", shift.validate_worktree_overview_scenario),
|
|
537
|
+
("sync-status-lists-local-only", sync.validate_sync_status_lists_local_only_scenario),
|
|
538
|
+
("sync-status-read-only-exit-codes", sync.validate_sync_status_read_only_exit_codes_scenario),
|
|
539
|
+
("sync-status-verify-classifies", sync.validate_sync_status_verify_classifies_scenario),
|
|
540
|
+
("sync-status-verify-failure", sync.validate_sync_status_verify_failure_scenario),
|
|
541
|
+
("sync-status-push-guidance", sync.validate_sync_status_push_guidance_scenario),
|
|
542
|
+
("device-sync-authorization-name", sync.validate_device_sync_authorization_name_scenario),
|
|
543
|
+
("sync-declaration-read", sync.validate_sync_declaration_read_scenario),
|
|
544
|
+
("branch-lock-race", sync.validate_branch_lock_race_scenario),
|
|
545
|
+
("branch-lock-head-and-expiry", sync.validate_branch_lock_head_and_expiry_scenario),
|
|
546
|
+
("branch-lock-release", sync.validate_branch_lock_release_scenario),
|
|
547
|
+
("branch-lock-push-authorization", sync.validate_branch_lock_push_authorization_scenario),
|
|
548
|
+
("archive-carries-shift-notes", sync.validate_archive_carries_shift_notes_scenario),
|
|
549
|
+
("sync-gates-lock", sync.validate_sync_gates_lock_scenario),
|
|
550
|
+
("sync-gates-without-declaration", sync.validate_sync_gates_without_declaration_scenario),
|
|
551
|
+
("context-warns-local-only", sync.validate_context_warns_local_only_scenario),
|
|
552
|
+
("context-lock-next-action", sync.validate_context_lock_next_action_scenario),
|
|
553
|
+
("shift-check-stash-and-notes", sync.validate_shift_check_stash_and_notes_scenario),
|
|
554
|
+
("shift-ready-releases-lock", sync.validate_shift_ready_releases_lock_scenario),
|
|
555
|
+
("shift-resume-takes-over", sync.validate_shift_resume_takes_over_scenario),
|
|
556
|
+
("handover-waits-for-lock", sync.validate_handover_waits_for_lock_scenario),
|
|
557
|
+
("tick-renews-and-pushes", sync.validate_tick_renews_and_pushes_scenario),
|
|
558
|
+
("prompt-hook-renews-when-due", sync.validate_prompt_hook_renews_when_due_scenario),
|
|
559
|
+
("patrol-old-local-only-risk", sync.validate_patrol_old_local_only_risk_scenario),
|
|
560
|
+
("doctor-reports-branch-locks", sync.validate_doctor_reports_branch_locks_scenario),
|
|
561
|
+
("release-skips-nested-worktrees", sync.validate_release_skips_nested_worktrees_scenario),
|
|
534
562
|
("init-never-downgrades-openspec", install.validate_init_never_downgrades_openspec_scenario),
|
|
535
563
|
("native-plugin-marketplaces", hosts.validate_native_plugin_marketplaces_scenario),
|
|
536
564
|
("native-plugin-install-matrix", hosts.validate_native_plugin_install_matrix_scenario),
|
|
537
565
|
("touch-write-guard", guard.validate_touch_write_guard_scenario),
|
|
538
566
|
("push-branch-guard", guard.validate_push_branch_guard_scenario),
|
|
567
|
+
("guard-refuses-push-to-held-branch", guard.validate_guard_refuses_push_to_held_branch_scenario),
|
|
539
568
|
("push-guard-cd-before-push", guard.validate_push_guard_cd_before_push_scenario),
|
|
540
569
|
("push-guard-redirects", guard.validate_push_guard_redirects_scenario),
|
|
541
570
|
("push-guard-follow-tags", guard.validate_push_guard_follow_tags_scenario),
|
|
@@ -812,8 +812,8 @@ def validate_tick_task_names_main_checkout_scenario() -> int:
|
|
|
812
812
|
if from_a.returncode != 0:
|
|
813
813
|
report(f"{label} keel tick task failed in a worktree: {from_a.stderr!r}")
|
|
814
814
|
return 1
|
|
815
|
-
if repo_of(from_a.stdout) != main or directory_of(from_a.stdout) !=
|
|
816
|
-
report(f"{label} the job printed from a worktree does not name the main checkout {main!r}: "
|
|
815
|
+
if repo_of(from_a.stdout) != main or directory_of(from_a.stdout) != "/":
|
|
816
|
+
report(f"{label} the job printed from a worktree does not name the main checkout {main!r} after --repo and / as WorkingDirectory: "
|
|
817
817
|
f"--repo {repo_of(from_a.stdout)!r}, WorkingDirectory {directory_of(from_a.stdout)!r}")
|
|
818
818
|
return 1
|
|
819
819
|
for tree in (wa, wb):
|
|
@@ -824,8 +824,8 @@ def validate_tick_task_names_main_checkout_scenario() -> int:
|
|
|
824
824
|
if from_main.returncode != 0:
|
|
825
825
|
report(f"{label} keel tick task failed in the main checkout: {from_main.stderr!r}")
|
|
826
826
|
return 1
|
|
827
|
-
if repo_of(from_main.stdout) != main or directory_of(from_main.stdout) !=
|
|
828
|
-
report(f"{label} the job printed from the main checkout does not name
|
|
827
|
+
if repo_of(from_main.stdout) != main or directory_of(from_main.stdout) != "/":
|
|
828
|
+
report(f"{label} the job printed from the main checkout does not name the main checkout {main!r} after --repo and / as WorkingDirectory: {from_main.stdout!r}")
|
|
829
829
|
return 1
|
|
830
830
|
for needle in ("<integer>300</integer>", "<string>tick</string>", "launchctl bootstrap", "Keel creates nothing"):
|
|
831
831
|
if needle not in from_main.stdout:
|
|
@@ -904,8 +904,8 @@ def validate_tick_task_without_patrol_scenario() -> int:
|
|
|
904
904
|
return 1
|
|
905
905
|
repo = named(printed.stdout, r"<string>--repo</string>\s*<string>(.*?)</string>")
|
|
906
906
|
directory = named(printed.stdout, r"<key>WorkingDirectory</key>\s*<string>(.*?)</string>")
|
|
907
|
-
if repo != main or directory !=
|
|
908
|
-
report(f"{label} the job printed in {where} does not name the main checkout {main!r}: --repo {repo!r}, WorkingDirectory {directory!r}")
|
|
907
|
+
if repo != main or directory != "/":
|
|
908
|
+
report(f"{label} the job printed in {where} does not name the main checkout {main!r} after --repo and / as WorkingDirectory: --repo {repo!r}, WorkingDirectory {directory!r}")
|
|
909
909
|
return 1
|
|
910
910
|
if os.path.realpath(wa) in printed.stdout:
|
|
911
911
|
report(f"{label} the job printed in {where} names the worktree {os.path.realpath(wa)!r}: {printed.stdout!r}")
|