MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / _wait_for_ready

Function _wait_for_ready

core/peer_shell.py:418–438  ·  view source on GitHub ↗

Wait for the CLI to show its ready/welcome state before we type. Handles per-CLI quirks (e.g. Claude's trust dialog, Gemini's keychain init).

(child, cli_name: str, pexpect_mod)

Source from the content-addressed store, hash-verified

416
417
418def _wait_for_ready(child, cli_name: str, pexpect_mod) -> None:
419 """
420 Wait for the CLI to show its ready/welcome state before we type.
421 Handles per-CLI quirks (e.g. Claude's trust dialog, Gemini's keychain init).
422 """
423 if cli_name == "claude":
424 _wait_for_claude(child, pexpect_mod)
425 elif cli_name == "gemini":
426 _wait_for_gemini(child, pexpect_mod)
427 else:
428 patterns_map = {
429 "qwen": [r">\s*$", r"\$\s*$"],
430 }
431 patterns = patterns_map.get(cli_name, [])
432 patterns.append(pexpect_mod.TIMEOUT)
433 try:
434 child.expect(patterns, timeout=CLI_READY_TIMEOUT)
435 except (pexpect_mod.TIMEOUT, pexpect_mod.EOF):
436 pass
437
438 time.sleep(0.5)
439
440
441def _wait_for_claude(child, pexpect_mod) -> None:

Callers 1

run_peerFunction · 0.85

Calls 4

_wait_for_claudeFunction · 0.85
_wait_for_geminiFunction · 0.85
appendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected