mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
core/cli: YOLO mode on|off|once for soft destructive confirms
Session /yolo and --yes skip classify_danger prompts; once expires after the next user turn. Hard path/command denylists unchanged.
This commit is contained in:
@@ -56,4 +56,14 @@ async def test_confirm_deny() -> None:
|
||||
|
||||
async def test_no_hooks_skips_confirm() -> None:
|
||||
registry = ToolRegistry([delete_path])
|
||||
assert registry.soft_confirm is False
|
||||
assert await registry.execute("delete_path", '{"path": "a.txt"}') == "deleted a.txt"
|
||||
|
||||
|
||||
async def test_soft_confirm_property() -> None:
|
||||
def on_confirm(name: str, args: Mapping[str, object], reason: str) -> bool:
|
||||
del name, args, reason
|
||||
return True
|
||||
|
||||
gated = ToolRegistry([delete_path], danger=classify_danger, on_confirm=on_confirm)
|
||||
assert gated.soft_confirm is True
|
||||
|
||||
Reference in New Issue
Block a user