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

Function repl

main.py:1074–1238  ·  view source on GitHub ↗
(initial_prompt=None, yolo=False, one_shot=False, preload=None, plan=False, no_plan=False, session_path=None, no_resume=False)

Source from the content-addressed store, hash-verified

1072 return False, history
1073
1074def repl(initial_prompt=None, yolo=False, one_shot=False, preload=None, plan=False, no_plan=False, session_path=None, no_resume=False):
1075 console.print(BANNER)
1076 separator()
1077
1078 # Start system monitor (background thread — also updates terminal title)
1079 monitor = get_monitor()
1080 monitor.start()
1081
1082 # v2: Use loader_v2 to ensure model is available (skip for remote backends)
1083 from utils.config import is_remote_backend
1084 if not is_remote_backend():
1085 loader = get_loader()
1086 loader.load_primary()
1087
1088 from core.project import detect_project
1089 from core.codeymd import find_codeymd
1090 proj = detect_project()
1091 if proj["type"] != "unknown":
1092 info(f"Project: [bold]{proj['type']}[/bold] · {os.getcwd()}")
1093 if find_codeymd():
1094 info("Memory: [bold]CODEY.md[/bold] found")
1095 else:
1096 info("No CODEY.md — run [bold]/init[/bold] to create project memory")
1097
1098 if preload:
1099 for f in preload:
1100 ctx.load_file(f)
1101
1102 # Load saved session
1103 from core.sessions import load_session, save_session
1104 history = []
1105 if not no_resume:
1106 if session_path:
1107 history = load_session(path=session_path)
1108 else:
1109 history = load_session() # auto-resume from cwd-based session file
1110
1111 if initial_prompt and one_shot:
1112 try:
1113 response, history = _run_with_plan(initial_prompt, history, yolo, False, no_plan)
1114 # Display the response for one-shot mode
1115 if response and not response.startswith("["):
1116 if was_last_streamed():
1117 separator()
1118 else:
1119 separator()
1120 console.print(f"\n[bold green]Codey-v2:[/bold green] {response}")
1121 separator()
1122 save_session(history)
1123 except KeyboardInterrupt:
1124 pass
1125 finally:
1126 shutdown()
1127 return
1128
1129 info("Type your task. /help for commands.")
1130 separator()
1131

Callers 1

mainFunction · 0.85

Calls 15

separatorFunction · 0.90
get_monitorFunction · 0.90
is_remote_backendFunction · 0.90
get_loaderFunction · 0.90
detect_projectFunction · 0.90
infoFunction · 0.90
find_codeymdFunction · 0.90
load_sessionFunction · 0.90
was_last_streamedFunction · 0.90
save_sessionFunction · 0.90
errorFunction · 0.90
_run_with_planFunction · 0.85

Tested by

no test coverage detected