Merge feature/spec-05-auth-fallback-chain: add auth fallback config flags to completion tree

This commit is contained in:
fluzzi32 committed 2026-11-17 12:13:37 -03:00
commit d2da49221f
2 files changed
+33 -1

No files matched your search

+18 -1
View File
@@ -248,9 +248,26 @@ def _build_tree(nodes, folders, profiles, plugins, configdir):
"--fzf-wrapper": ["bash", "zsh"],
"--service-mode": ["local", "remote"],
"--sync-remote": ["true", "false"],
"--disable-fallback-on-insecure-hostkey": ["true", "false"],
"--help": None, "-h": None,
}
for opt in ["--keepalive", "--engineer-model", "--engineer-api-key", "--architect-model", "--architect-api-key", "--theme", "--remote", "--trusted-commands", "--shell-command", "--shell-prompt", "--shell-os"]:
for opt in [
"--keepalive",
"--engineer-model",
"--engineer-api-key",
"--architect-model",
"--architect-api-key",
"--theme",
"--remote",
"--trusted-commands",
"--shell-command",
"--shell-prompt",
"--shell-os",
"--max-auth-prompts",
"--max-total-auth-attempts",
"--max-hop-host-attempts",
"--max-global-user-attempts",
]:
config_dict[opt] = {"*": config_dict}
config_dict["--configfolder"] = {"__extra__": lambda w: get_cwd(w, "--configfolder", True), "*": config_dict}
config_dict["--engineer-auth"] = {"__extra__": lambda w: get_cwd(w, "--engineer-auth"), "*": config_dict}
+15
View File
@@ -80,11 +80,22 @@ class TestTreeCompletions:
assert "--shell-command" in config_completions
assert "--shell-prompt" in config_completions
assert "--shell-os" in config_completions
assert "--max-auth-prompts" in config_completions
assert "--max-total-auth-attempts" in config_completions
assert "--max-hop-host-attempts" in config_completions
assert "--max-global-user-attempts" in config_completions
assert "--disable-fallback-on-insecure-hostkey" in config_completions
# Resolve when --engineer-auth is chosen in config
auth_comp = resolve_completion(["config", "--engineer-auth", ""], tree)
assert isinstance(auth_comp, list)
# Resolve boolean values for --disable-fallback-on-insecure-hostkey
assert resolve_completion(
["config", "--disable-fallback-on-insecure-hostkey", ""],
tree,
) == ["true", "false"]
# Loop back check:
# e.g., connpy config --engineer-auth some_val
# should loop back and resolve to config options
@@ -93,6 +104,10 @@ class TestTreeCompletions:
assert "--engineer-auth" in loop_back_comp
assert "--shell-command" in loop_back_comp
auth_budget_loop_back = resolve_completion(["config", "--max-auth-prompts", "3", ""], tree)
assert "--max-total-auth-attempts" in auth_budget_loop_back
assert "--disable-fallback-on-insecure-hostkey" in auth_budget_loop_back
def test_shell_completions(self):
from connpy.completion import _build_tree, resolve_completion
tree = _build_tree([], [], [], {}, "/tmp")