MCPcopy
hub / github.com/granawkins/rawdog / main

Function main

src/rawdog/__main__.py:64–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62
63
64def main():
65 parser = argparse.ArgumentParser(
66 description=(
67 "A smart assistant that can execute Python code to help or hurt you."
68 )
69 )
70 parser.add_argument(
71 "prompt",
72 nargs="*",
73 help="Prompt for direct execution. If empty, enter conversation mode",
74 )
75 add_config_flags_to_argparser(parser)
76 args = parser.parse_args()
77 config = get_config(args)
78 llm_client = LLMClient(config)
79
80 if history_file.exists():
81 readline.read_history_file(history_file)
82 readline.set_history_length(1000)
83
84 if len(args.prompt) > 0:
85 rawdog(" ".join(args.prompt), config, llm_client)
86 else:
87 banner()
88 while True:
89 try:
90 print("")
91 if llm_client.session_cost > 0:
92 print(f"Session cost: ${llm_client.session_cost:.4f}")
93 print("What can I do for you? (Ctrl-C to exit)")
94 prompt = input("> ")
95 # Save history after each command to avoid losing it in case of crash
96 readline.write_history_file(history_file)
97 print("")
98 rawdog(prompt, config, llm_client)
99 except KeyboardInterrupt:
100 print("Exiting...")
101 break
102
103
104if __name__ == "__main__":

Callers 1

__main__.pyFile · 0.85

Calls 5

get_configFunction · 0.90
LLMClientClass · 0.90
rawdogFunction · 0.85
bannerFunction · 0.85

Tested by

no test coverage detected