mirror of
https://github.com/The-Swarm-Corporation/AutoHedge.git
synced 2026-10-02 05:24:49 +08:00
[Improve the cli]
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
AutoHedge CLI — welcome screen and interactive REPL.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -185,8 +186,42 @@ def run_repl() -> None:
|
||||
console.print(f"[red]Error: {e}[/]")
|
||||
|
||||
|
||||
def _build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="autohedge",
|
||||
description="AutoHedge — interactive REPL for running research and hedging tasks.",
|
||||
epilog="""
|
||||
Commands (when running the REPL):
|
||||
<task> Run a task (e.g. 'Analyze NVDA for 50k allocation')
|
||||
help, ?, h Show in-REPL tips
|
||||
quit, exit, q Exit the REPL
|
||||
|
||||
Examples:
|
||||
autohedge Start the interactive REPL
|
||||
autohedge help Show this help
|
||||
autohedge --help Show this help
|
||||
autohedge --version Show version
|
||||
""",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--version",
|
||||
"-v",
|
||||
action="version",
|
||||
version=f"%(prog)s {VERSION}",
|
||||
help="Show program version and exit.",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Entry point for the AutoHedge CLI."""
|
||||
parser = _build_parser()
|
||||
# Treat bare "help" as --help (e.g. "autohedge help")
|
||||
if len(sys.argv) == 2 and sys.argv[1].lower() == "help":
|
||||
parser.print_help()
|
||||
sys.exit(0)
|
||||
parser.parse_args() # exits on --help / --version
|
||||
run_repl()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -16,8 +16,12 @@ from autohedge.prompts import (
|
||||
)
|
||||
from autohedge.tools.exa_search_tool import exa_search
|
||||
|
||||
_NOW = datetime.now().isoformat()
|
||||
_SYSTEM_SUFFIX = f"\n\nCurrent date and time: {_NOW}"
|
||||
_NOW = datetime.now()
|
||||
# Exact date and time for all agent system prompts (simple, single line)
|
||||
_DATE_TIME_LINE = _NOW.strftime("%A, %B %d, %Y at %H:%M")
|
||||
if _NOW.tzinfo:
|
||||
_DATE_TIME_LINE += f" {_NOW.tzname() or ''}"
|
||||
_SYSTEM_SUFFIX = f"\n\nCurrent date and time (use this as now): {_DATE_TIME_LINE.strip()}"
|
||||
|
||||
sentiment_agent = Agent(
|
||||
agent_name="Sentiment-Agent",
|
||||
|
||||
Reference in New Issue
Block a user