feat(core): clone commands and actions when binding runtimes
Add clone support across Action types and Command so commands can be safely registered or runner-bound without mutating the original instances. - clone BaseAction implementations across simple, composite, IO, prompt, file, HTTP, process, and signal actions - bind cloned commands in Falyx.add_command_from_command() and CommandRunner - preserve local never_prompt settings when cloning actions - rename shared runtime state from options to options_manager for consistency - seed root and execution option namespaces consistently - apply scoped root and namespace option overrides during routing and dispatch - improve namespace completion by delegating option suggestions to FalyxParser - enrich missing-value errors and error hints
This commit is contained in:
21
tests/test_falyx/test_prompt_contract.py
Normal file
21
tests/test_falyx/test_prompt_contract.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from falyx.action import Action
|
||||
from falyx.command import Command
|
||||
|
||||
|
||||
async def test_action_local_never_prompt_bypasses_command_confirmation(monkeypatch):
|
||||
called = False
|
||||
|
||||
async def fake_confirm(*args, **kwargs):
|
||||
nonlocal called
|
||||
called = True
|
||||
return True
|
||||
|
||||
monkeypatch.setattr("falyx.command.confirm_async", fake_confirm)
|
||||
|
||||
action = Action("Do Thing", lambda: "ok", never_prompt=True)
|
||||
command = Command.build("D", "Do Thing", action=action, confirm=True)
|
||||
|
||||
result = await command()
|
||||
|
||||
assert result == "ok"
|
||||
assert called is False
|
||||
Reference in New Issue
Block a user