Autonomous AI sales agent powered by Claude Code or Codex. Finds prospects, writes cold emails, sends campaigns, handles replies, books meetings. No API keys needed — runs on your Claude or Codex subscriptions.
Add CLI with harvey install/setup/run/train/status commands
Ethanf4740d3d5cd2
diff --git a/README.md b/README.mdindex 1cae7f2..a012755 100644--- a/README.md+++ b/README.md@@ -139,17 +139,31 @@ Quiet hours are also configurable. Harvey won't run between 10pm and 7am (or wha```bashgit clone https://github.com/ethanplusai/harvey.gitcd harvey-pip install -r requirements.txt-playwright install chromium+pip install -e .+harvey install```-### 2. Run Harvey+### 2. Set Up Harvey```bash-python -m harvey+harvey setup```-That's it. On first run, Harvey detects it's not configured and launches an interactive setup wizard. Harvey walks you through everything — you don't need to manually edit any config files.+Harvey launches an interactive setup wizard that walks you through everything — you don't need to manually edit any config files.++### 3. Start Closing++```bash+harvey run+```++Other commands:++```bash+harvey status # Show pipeline summary+harvey train <url> # Re-train on a new product website+harvey train <url> 500 # Crawl more pages for larger sites+``````╔══════════════════════════════════════════════════════════╗@@ -216,9 +230,11 @@ If you don't have a website (or prefer to do it manually), Harvey asks you the q**Step 6 — Behavior Settings.** Harvey asks how much of your daily Claude quota it can use, how often to check for work, quiet hours, send limits, and timezone.-After setup, Harvey writes all config files for you and starts its heartbeat loop automatically on the next run. To re-run setup anytime: `python -m harvey.setup`+After setup, Harvey writes all config files for you. Just run `harvey run` to start closing.++To re-run setup anytime: `harvey setup`-### 3. Deploy (VPS)+### 4. Deploy (VPS)For always-on operation, deploy with Docker:@@ -238,13 +254,13 @@ docker compose logs -f harveyYou can re-train Harvey anytime by pointing it at a new website:```bash-python -m harvey.trainer https://newproduct.com+harvey train https://newproduct.com```Or crawl more pages for larger sites:```bash-python -m harvey.trainer https://yourcompany.com 500+harvey train https://yourcompany.com 500```#### Deep Crawling with Cloudflarediff --git a/harvey/__main__.py b/harvey/__main__.pyindex 8019895..e8e094e 100644--- a/harvey/__main__.py+++ b/harvey/__main__.py@@ -1,5 +1,5 @@"""Allow running Harvey with `python -m harvey`."""-from harvey.main import main+from harvey.cli import mainmain()diff --git a/harvey/cli.py b/harvey/cli.pynew file mode 100644index 0000000..a9aee97--- /dev/null+++ b/harvey/cli.py@@ -0,0 +1,135 @@+"""Harvey CLI — simple commands to install, setup, run, and manage Harvey."""++import argparse+import asyncio+import subprocess+import sys+++def cmd_install(args):+ """Install all dependencies including Playwright browsers."""+ print("\n Installing Harvey dependencies...\n")++ # Install Python packages+ print(" [1/2] Installing Python packages...")+ result = subprocess.run(+ [sys.executable, "-m", "pip", "install", "-r", "requirements.txt"],+ cwd=args._project_root,+ )+ if result.returncode != 0:+ print("\n Failed to install Python packages.")+ sys.exit(1)+ print(" ✓ Python packages installed.\n")++ # Install Playwright browsers+ print(" [2/2] Installing Playwright browsers...")+ result = subprocess.run(+ [sys.executable, "-m", "playwright", "install", "chromium"],+ )+ if result.returncode != 0:+ print("\n Playwright browser install failed (optional — needed for LinkedIn).")+ else:+ print(" ✓ Playwright browsers installed.\n")++ print(" Harvey is installed. Run 'harvey setup' next.\n")+++def cmd_setup(args):+ """Run the interactive setup wizard."""+ from harvey.setup import run_setup++ asyncio.run(run_setup())+++def cmd_run(args):+ """Start Harvey's heartbeat loop."""+ from harvey.main import main++ main()+++def cmd_train(args):+ """Train Harvey on a website."""+ from harvey.trainer import Trainer++ trainer = Trainer()+ asyncio.run(trainer.train_from_url(args.url, max_pages=args.max_pages))+++def cmd_status(args):+ """Show current pipeline status."""+ from harvey.state import StateManager++ async def _status():+ state = StateManager()+ await state.init_db()+ summary = await state.get_state_summary()++ print("\n Harvey Pipeline Status")+ print(" " + "=" * 40)+ print(f" Prospects: {summary['prospects']}")+ print(f" Draft campaigns: {summary['draft_campaigns']}")+ print(f" Active campaigns: {summary['active_campaigns']}")+ print(f" Open conversations: {summary['open_conversations']}")+ print(f" Claude calls today: {summary['usage_today']}")+ print()++ asyncio.run(_status())+++def main():+ from pathlib import Path++ project_root = str(Path(__file__).parent.parent)++ parser = argparse.ArgumentParser(+ prog="harvey",+ description="Harvey — Autonomous AI Sales Agent. Always Be Closing.",+ )+ subparsers = parser.add_subparsers(dest="command")++ # harvey install+ sub = subparsers.add_parser("install", help="Install dependencies")+ sub.set_defaults(func=cmd_install)++ # harvey setup+ sub = subparsers.add_parser("setup", help="Run the interactive setup wizard")+ sub.set_defaults(func=cmd_setup)++ # harvey run+ sub = subparsers.add_parser("run", help="Start Harvey's heartbeat loop")+ sub.set_defaults(func=cmd_run)++ # harvey train <url>+ sub = subparsers.add_parser("train", help="Train Harvey on a website")+ sub.add_argument("url", help="Website URL to crawl and learn from")+ sub.add_argument(+ "max_pages",+ nargs="?",+ type=int,+ default=100,+ help="Max pages to crawl (default: 100)",+ )+ sub.set_defaults(func=cmd_train)++ # harvey status+ sub = subparsers.add_parser("status", help="Show pipeline status")+ sub.set_defaults(func=cmd_status)++ args = parser.parse_args()+ args._project_root = project_root++ if args.command is None:+ parser.print_help()+ print("\n Quick start:")+ print(" harvey install — Install dependencies")+ print(" harvey setup — Configure Harvey (first time)")+ print(" harvey run — Start closing deals")+ print()+ sys.exit(0)++ args.func(args)+++if __name__ == "__main__":+ main()diff --git a/pyproject.toml b/pyproject.tomlnew file mode 100644index 0000000..46f3d95--- /dev/null+++ b/pyproject.toml@@ -0,0 +1,29 @@+[build-system]+requires = ["setuptools>=68.0"]+build-backend = "setuptools.build_meta"++[project]+name = "harvey"+version = "0.1.0"+description = "Autonomous AI sales agent. Always Be Closing."+readme = "README.md"+requires-python = ">=3.11"+license = "MIT"+dependencies = [+ "pyyaml>=6.0",+ "python-dotenv>=1.0",+ "httpx>=0.27",+ "playwright>=1.40",+ "beautifulsoup4>=4.12",+ "dnspython>=2.4",+ "aiosmtplib>=3.0",+ "aiosqlite>=0.19",+ "pydantic>=2.5",+ "pytz>=2024.1",+]++[project.scripts]+harvey = "harvey.cli:main"++[tool.setuptools.packages.find]+include = ["harvey*"]