Skip to content

Conversation

@rayruizhiliao
Copy link
Contributor

@rayruizhiliao rayruizhiliao commented Nov 17, 2025

Overview

Restructures web-hacker to make it PyPI publishable. The package is now publicly available on TestPyPI.

To test the TestPyPI installation, run

uv venv web-hacker-env
source web-hacker-env/bin/activate  # On Windows: web-hacker-env\Scripts\activate
uv pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ web-hacker

Once this PR is merged to main, I will make it available via pip install web-hacker and create a github release.

High-Level SDK

from web_hacker import WebHacker

hacker = WebHacker(openai_api_key="sk-...")
with hacker.monitor_browser(output_dir="./captures"):
    pass

routine = hacker.discover_routine(task="Search for flights", cdp_captures_dir="./captures")
result = hacker.execute_routine(routine, parameters={"origin": "NYC", "destination": "LAX"})

CLI Commands

  • web-hacker-monitor - Monitor browser activity
  • web-hacker-discover - Discover routines
  • web-hacker-execute - Execute routines

Changes

Import paths changed:

# Before
from src.config import Config

# After
from web_hacker.config import Config

Script execution:

# Before
python scripts/browser_monitor.py --output-dir ./captures

# After
web-hacker-monitor --output-dir ./captures
  • Renamed src/web_hacker/ (proper Python package)
  • Moved scripts/web_hacker/scripts/
  • Added web_hacker/sdk/ with wrapper classes (WebHacker, BrowserMonitor, etc.)
  • Updated all imports
  • Updated pyproject.toml with package metadata and CLI entry points
  • Version bumped to 1.1.0

Note: Core functionality unchanged. Only import paths changed. The SDK is a wrapper around existing functionality.

@rayruizhiliao rayruizhiliao changed the title v1.1.0: Restructuring as pip-installable sdk v1.1.0: Restructure package as pip-installable SDK Nov 17, 2025
@rayruizhiliao rayruizhiliao marked this pull request as ready for review November 17, 2025 21:31
@alex-w-99
Copy link
Contributor

Re: "pip-installable" -- my understanding is that python package installers like pip, uv, etc. default use PyPI under the hood. Assuming that this PR is actually about PyPI and nothing specific to do with pip?

@dimavrem22
Copy link
Contributor

Screenshot 2025-11-18 at 11 17 15 AM

add instructions for making this executable if it remains a bash script? But i also prefer python script as Alex suggested ^^

@dimavrem22
Copy link
Contributor

Screenshot 2025-11-18 at 11 18 40 AM

format issue with the box

@dimavrem22
Copy link
Contributor

dimavrem22 commented Nov 18, 2025

Screenshot 2025-11-18 at 11 21 07 AM

why not start monitoring right away? I feel like it might be a bit confusing since the instructions say ...

  1. Navigate to your target website
  2. Perform the actions you want to automate (search, login, etc.)

before the enter to start

@rayruizhiliao rayruizhiliao changed the title v1.1.0: Restructure package as pip-installable SDK v1.1.0: Restructure package and make it PyPI publishable Nov 18, 2025
@rayruizhiliao
Copy link
Contributor Author

Re: "pip-installable" -- my understanding is that python package installers like pip, uv, etc. default use PyPI under the hood. Assuming that this PR is actually about PyPI and nothing specific to do with pip?

Renamed the PR title to make it more accurate

@rayruizhiliao
Copy link
Contributor Author

Screenshot 2025-11-18 at 11 17 15 AM add instructions for making this executable if it remains a bash script? But i also prefer python script as Alex suggested ^^

Changed to python script in commits 50b8e4d and f4ba5c2

@rayruizhiliao
Copy link
Contributor Author

fix: box alignment

Resolved in commit fe5ed52

@rayruizhiliao
Copy link
Contributor Author

Screenshot 2025-11-18 at 11 21 07 AM why not start monitoring right away? I feel like it might be a bit confusing since the instructions say ...
  1. Navigate to your target website
  2. Perform the actions you want to automate (search, login, etc.)

before the enter to start

Does this update (#45 (comment)) address your question?

Copy link
Contributor

@dimavrem22 dimavrem22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-11-19 at 12 21 59 PM

when closing the monitoring tab using x and not command C, the monitoring does not gracefully stop.. it fails to generate the condesed_transactions.json.

this should be another way to end the monitoring. this issue is not introduced by this PR. I can address this in a latter patch, if you prefer.

But at least, if a step fails, the whole pipeline should exit. In this case, from previous web-hacker run, i already had a routine.json so this is why the pipeline continued:

# Step 4: Execute (optional)
    routine_file = ROUTINE_OUTPUT / "routine.json"
    if not routine_file.exists():
        print_colored(f"⚠️  Routine not found at {routine_file}", YELLOW)
        return
    
    print_colored("Step 4: Ready to execute routine!", GREEN)

the suggestion below would address this
#45 (comment)

@rayruizhiliao
Copy link
Contributor Author

Screenshot 2025-11-19 at 12 21 59 PM when closing the monitoring tab using `x` and not command C, the monitoring does not gracefully stop.. it fails to generate the condesed_transactions.json.

this should be another way to end the monitoring. this issue is not introduced by this PR. I can address this in a latter patch, if you prefer.

But at least, if a step fails, the whole pipeline should exit. In this case, from previous web-hacker run, i already had a routine.json so this is why the pipeline continued:

# Step 4: Execute (optional)
    routine_file = ROUTINE_OUTPUT / "routine.json"
    if not routine_file.exists():
        print_colored(f"⚠️  Routine not found at {routine_file}", YELLOW)
        return
    
    print_colored("Step 4: Ready to execute routine!", GREEN)

the suggestion below would address this #45 (comment)

Enabled graceful exit when the user closes the monitored tab in commit: b5dfdf1

@dimavrem22
Copy link
Contributor

optional: if this script launched chrome in debug mode, should this also be responsible for closing it?

@dimavrem22
Copy link
Contributor

dimavrem22 commented Nov 19, 2025

Screenshot 2025-11-19 at 3 52 35 PM

feels a bit out of context

Lets print a high level overview of what is happening... (something like this)

Web-hakcer Pipeline: 
Step 1: Launch chrome in debug mode
Step 2: monitor
Step 3: discover
Step 4 (optional): test

Press Enter to start: 

then we see

Step 1: Launching Chrome in debug mode...

@rayruizhiliao
Copy link
Contributor Author

optional: if this script launched chrome in debug mode, should this also be responsible for closing it?

quickstart will close chrome now, updated in commit 14b5d78

@rayruizhiliao
Copy link
Contributor Author

Screenshot 2025-11-19 at 3 52 35 PM feels a bit out of context

Lets print a high level overview of what is happening... (something like this)

Web-hakcer Pipeline: 
Step 1: Launch chrome in debug mode
Step 2: monitor
Step 3: discover
Step 4 (optional): test

Press Enter to start: 

then we see

Step 1: Launching Chrome in debug mode...

added high-level context in commit da0522e

Copy link
Contributor

@dimavrem22 dimavrem22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@rayruizhiliao rayruizhiliao merged commit 8d57c49 into main Nov 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants