browse-code 0.1.3__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- browse_code-0.2.1/PKG-INFO +124 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/README.md +4 -0
- browse_code-0.2.1/browse_code/__init__.py +1 -0
- browse_code-0.2.1/browse_code/cli.py +198 -0
- browse_code-0.2.1/browse_code/extension/icon128.png +0 -0
- browse_code-0.2.1/browse_code/extension/icon16.png +0 -0
- browse_code-0.2.1/browse_code/extension/icon48.png +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code/extension/manifest.json +11 -1
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code/server.py +0 -1
- browse_code-0.2.1/browse_code.egg-info/PKG-INFO +124 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code.egg-info/SOURCES.txt +3 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code.egg-info/requires.txt +1 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/setup.py +6 -3
- browse_code-0.1.3/PKG-INFO +0 -9
- browse_code-0.1.3/browse_code/__init__.py +0 -1
- browse_code-0.1.3/browse_code/cli.py +0 -133
- browse_code-0.1.3/browse_code.egg-info/PKG-INFO +0 -9
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code/extension/content.js +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code/extension/popup.html +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code/extension/popup.js +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code/extension/spoof.js +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code.egg-info/dependency_links.txt +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code.egg-info/entry_points.txt +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/browse_code.egg-info/top_level.txt +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/pyproject.toml +0 -0
- {browse_code-0.1.3 → browse_code-0.2.1}/setup.cfg +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: browse_code
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Turn any AI chatbot into an autonomous coding agent
|
|
5
|
+
Description-Content-Type: text/markdown
|
|
6
|
+
Requires-Dist: fastapi
|
|
7
|
+
Requires-Dist: uvicorn
|
|
8
|
+
Requires-Dist: pydantic
|
|
9
|
+
Requires-Dist: rich
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: requires-dist
|
|
13
|
+
Dynamic: summary
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="logo.png" alt="Browse Code" width="200">
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
# Browse Code
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
**Browse Code** is a CLI tool that turns any AI chatbot (ChatGPT, Gemini, Claude, HuggingFace) into an autonomous coding agent. It bridges your browser and local terminal, letting AI read/write files, run commands, and manage processes on your machine.
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
Browse Code has two parts:
|
|
30
|
+
|
|
31
|
+
1. **A local server** that exposes your file system and terminal to the AI via a secure API.
|
|
32
|
+
2. **A Chrome extension** that injects agent capabilities into AI chat interfaces.
|
|
33
|
+
|
|
34
|
+
When connected, you can ask ChatGPT/Gemini/Claude to edit files, run scripts, search code, and more — all executed locally on your machine.
|
|
35
|
+
|
|
36
|
+
## Setup
|
|
37
|
+
|
|
38
|
+
### Step 1: Install the package
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install browse-code
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Run the CLI
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bc
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> If `bc` is not found, add your Python Scripts folder to PATH:
|
|
51
|
+
> ```bash
|
|
52
|
+
> # Windows (PowerShell)
|
|
53
|
+
> $env:Path += ";$env:APPDATA\Python\Python312\Scripts"
|
|
54
|
+
>
|
|
55
|
+
> # Or run directly
|
|
56
|
+
> python -m browse_code.cli
|
|
57
|
+
> ```
|
|
58
|
+
|
|
59
|
+
### Step 3: First-run extension setup
|
|
60
|
+
|
|
61
|
+
On the first run, `bc` will guide you through a one-time Chrome extension setup:
|
|
62
|
+
|
|
63
|
+
1. It asks for your permission to extract the extension files.
|
|
64
|
+
2. It copies the extension to `~/.browse_code/extension/` and copies the path to your clipboard.
|
|
65
|
+
3. It opens `chrome://extensions/` in your browser automatically.
|
|
66
|
+
4. You enable **Developer mode** (top-right toggle), click **Load unpacked**, and paste the path.
|
|
67
|
+
5. Press Enter in the terminal and the server starts.
|
|
68
|
+
|
|
69
|
+
**You only do this once.** The extension stays loaded in Chrome across sessions.
|
|
70
|
+
|
|
71
|
+
### Step 4: Start an AI session
|
|
72
|
+
|
|
73
|
+
1. Open any supported AI chat (ChatGPT, Gemini, Claude, or HuggingFace Chat).
|
|
74
|
+
2. Click the Browse Code Bridge extension icon and set your workspace directory.
|
|
75
|
+
3. Click "Initialize Agent in Chat".
|
|
76
|
+
4. Start coding with AI — it now has full access to your local environment.
|
|
77
|
+
|
|
78
|
+
## Subsequent Usage
|
|
79
|
+
|
|
80
|
+
After the first-time setup, just run:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
bc
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The server starts immediately. Open your AI chat tab and you're ready to go. The server terminal will show:
|
|
87
|
+
- A startup banner with your workspace and endpoint
|
|
88
|
+
- `[+] Extension connected` when the browser extension connects
|
|
89
|
+
- Real-time logs of every file read, write, command execution, and diff
|
|
90
|
+
|
|
91
|
+
## Features
|
|
92
|
+
|
|
93
|
+
- **File Operations:** Read, write, and patch files with inline terminal diffs
|
|
94
|
+
- **Code Search:** Search across your entire codebase by keyword
|
|
95
|
+
- **Terminal Commands:** Run shell commands with full stdout/stderr capture
|
|
96
|
+
- **Background Processes:** Start, monitor, and kill long-running processes
|
|
97
|
+
- **Multi-Platform AI:** Works with ChatGPT, Gemini, Claude, and HuggingFace Chat
|
|
98
|
+
- **Extension Heartbeat:** Server detects when the browser extension connects/disconnects
|
|
99
|
+
|
|
100
|
+
## For Developers
|
|
101
|
+
|
|
102
|
+
1. Clone the repository:
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/Dedeep007/browse_code.git
|
|
105
|
+
cd browse_code
|
|
106
|
+
```
|
|
107
|
+
2. Install in editable mode:
|
|
108
|
+
```bash
|
|
109
|
+
pip install -e .
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Contributing
|
|
113
|
+
|
|
114
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
115
|
+
|
|
116
|
+
1. Fork the repository.
|
|
117
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`).
|
|
118
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
|
|
119
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`).
|
|
120
|
+
5. Open a Pull Request.
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Distributed under the MIT License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.1"
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import shutil
|
|
4
|
+
import platform
|
|
5
|
+
import subprocess
|
|
6
|
+
import webbrowser
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
# ── Rich TUI imports ──────────────────────────────────────
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
from rich.panel import Panel
|
|
12
|
+
from rich.text import Text
|
|
13
|
+
from rich.table import Table
|
|
14
|
+
from rich.prompt import Prompt, Confirm
|
|
15
|
+
from rich import box
|
|
16
|
+
|
|
17
|
+
console = Console()
|
|
18
|
+
|
|
19
|
+
PORT = 5505
|
|
20
|
+
HOST = "127.0.0.1"
|
|
21
|
+
|
|
22
|
+
ASCII_BANNER = r"""
|
|
23
|
+
██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗███████╗ ██████╗ ██████╗ ██████╗ ███████╗
|
|
24
|
+
██╔══██╗██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔════╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
|
25
|
+
██████╔╝██████╔╝██║ ██║██║ █╗ ██║███████╗█████╗ ██║ ██║ ██║██║ ██║█████╗
|
|
26
|
+
██╔══██╗██╔══██╗██║ ██║██║███╗██║╚════██║██╔══╝ ██║ ██║ ██║██║ ██║██╔══╝
|
|
27
|
+
██████╔╝██║ ██║╚██████╔╝╚███╔███╔╝███████║███████╗██╗╚██████╗╚██████╔╝██████╔╝███████╗
|
|
28
|
+
╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def get_data_dir():
|
|
33
|
+
"""Return ~/.browse_code, creating it if needed."""
|
|
34
|
+
data_dir = Path.home() / ".browse_code"
|
|
35
|
+
data_dir.mkdir(exist_ok=True)
|
|
36
|
+
return data_dir
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def copy_to_clipboard(text):
|
|
40
|
+
"""Copy text to the system clipboard (cross-platform)."""
|
|
41
|
+
try:
|
|
42
|
+
system = platform.system()
|
|
43
|
+
if system == "Windows":
|
|
44
|
+
subprocess.run("clip", input=text.encode("utf-8"), check=True)
|
|
45
|
+
elif system == "Darwin":
|
|
46
|
+
subprocess.run("pbcopy", input=text.encode("utf-8"), check=True)
|
|
47
|
+
else:
|
|
48
|
+
try:
|
|
49
|
+
subprocess.run(
|
|
50
|
+
["xclip", "-selection", "clipboard"],
|
|
51
|
+
input=text.encode("utf-8"),
|
|
52
|
+
check=True,
|
|
53
|
+
)
|
|
54
|
+
except FileNotFoundError:
|
|
55
|
+
subprocess.run(
|
|
56
|
+
["xsel", "--clipboard", "--input"],
|
|
57
|
+
input=text.encode("utf-8"),
|
|
58
|
+
check=True,
|
|
59
|
+
)
|
|
60
|
+
return True
|
|
61
|
+
except Exception:
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def print_banner():
|
|
66
|
+
"""Print the Browse Code ASCII art banner."""
|
|
67
|
+
console.print(f"[bold green]{ASCII_BANNER}[/bold green]")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def setup_extension():
|
|
71
|
+
"""First-time setup: extract extension, open Chrome, guide the user."""
|
|
72
|
+
data_dir = get_data_dir()
|
|
73
|
+
ext_dest = data_dir / "extension"
|
|
74
|
+
pkg_ext_dir = Path(__file__).parent / "extension"
|
|
75
|
+
|
|
76
|
+
print_banner()
|
|
77
|
+
console.print(
|
|
78
|
+
Panel(
|
|
79
|
+
"[bold]First Time Setup[/bold]\n\n"
|
|
80
|
+
"Browse Code needs a Chrome extension to connect\n"
|
|
81
|
+
"your browser to the local server.",
|
|
82
|
+
border_style="green",
|
|
83
|
+
box=box.ROUNDED,
|
|
84
|
+
padding=(1, 2),
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
if not Confirm.ask("\n Do you want to set up the extension now?", default=True):
|
|
89
|
+
console.print(" [dim]Skipped. Re-run 'bc' anytime to set it up.[/dim]")
|
|
90
|
+
return False
|
|
91
|
+
|
|
92
|
+
# Extract extension files
|
|
93
|
+
console.print()
|
|
94
|
+
with console.status("[green]Extracting extension files...[/green]", spinner="dots"):
|
|
95
|
+
if ext_dest.exists():
|
|
96
|
+
shutil.rmtree(ext_dest)
|
|
97
|
+
shutil.copytree(pkg_ext_dir, ext_dest)
|
|
98
|
+
|
|
99
|
+
ext_path_str = str(ext_dest)
|
|
100
|
+
console.print(f" [green]Extracted to:[/green] [bold]{ext_path_str}[/bold]")
|
|
101
|
+
console.print()
|
|
102
|
+
|
|
103
|
+
# Copy path to clipboard
|
|
104
|
+
copied = copy_to_clipboard(ext_path_str)
|
|
105
|
+
|
|
106
|
+
# Open chrome://extensions
|
|
107
|
+
console.print(" [green]Opening Chrome extensions page...[/green]")
|
|
108
|
+
webbrowser.open("chrome://extensions/")
|
|
109
|
+
|
|
110
|
+
# Setup instructions
|
|
111
|
+
steps = Table(
|
|
112
|
+
show_header=False,
|
|
113
|
+
box=box.SIMPLE,
|
|
114
|
+
padding=(0, 2),
|
|
115
|
+
show_edge=False,
|
|
116
|
+
)
|
|
117
|
+
steps.add_column("step", style="bold green", width=4)
|
|
118
|
+
steps.add_column("instruction")
|
|
119
|
+
|
|
120
|
+
steps.add_row("1.", 'Enable [bold]"Developer mode"[/bold] toggle (top-right corner)')
|
|
121
|
+
steps.add_row("2.", 'Click [bold]"Load unpacked"[/bold]')
|
|
122
|
+
if copied:
|
|
123
|
+
steps.add_row("3.", "Paste the path [green](already copied to your clipboard)[/green]")
|
|
124
|
+
else:
|
|
125
|
+
steps.add_row("3.", f"Select this folder: [bold]{ext_path_str}[/bold]")
|
|
126
|
+
|
|
127
|
+
console.print()
|
|
128
|
+
console.print(
|
|
129
|
+
Panel(
|
|
130
|
+
steps,
|
|
131
|
+
title="[bold green]Quick Setup[/bold green]",
|
|
132
|
+
title_align="left",
|
|
133
|
+
border_style="green",
|
|
134
|
+
box=box.ROUNDED,
|
|
135
|
+
padding=(1, 1),
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
console.print()
|
|
139
|
+
|
|
140
|
+
Prompt.ask(" Press [bold]Enter[/bold] after you've loaded the extension")
|
|
141
|
+
|
|
142
|
+
# Mark as installed
|
|
143
|
+
marker = data_dir / ".installed"
|
|
144
|
+
marker.touch()
|
|
145
|
+
|
|
146
|
+
console.print(" [bold green]Extension setup complete![/bold green]")
|
|
147
|
+
return True
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def print_server_header():
|
|
151
|
+
"""Print the server status panel before starting."""
|
|
152
|
+
info = Table(show_header=False, box=None, padding=(0, 1), show_edge=False)
|
|
153
|
+
info.add_column("key", style="dim", width=12)
|
|
154
|
+
info.add_column("value")
|
|
155
|
+
|
|
156
|
+
info.add_row("Endpoint", f"[bold]http://{HOST}:{PORT}[/bold]")
|
|
157
|
+
info.add_row("Extension", "[yellow]Waiting for connection...[/yellow]")
|
|
158
|
+
info.add_row("Status", "[bold green]Running[/bold green]")
|
|
159
|
+
|
|
160
|
+
console.print(
|
|
161
|
+
Panel(
|
|
162
|
+
info,
|
|
163
|
+
title="[bold green]Browse Code[/bold green]",
|
|
164
|
+
title_align="left",
|
|
165
|
+
subtitle="[dim]Press Ctrl+C to stop[/dim]",
|
|
166
|
+
subtitle_align="right",
|
|
167
|
+
border_style="green",
|
|
168
|
+
box=box.ROUNDED,
|
|
169
|
+
padding=(1, 2),
|
|
170
|
+
)
|
|
171
|
+
)
|
|
172
|
+
console.print()
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def main():
|
|
176
|
+
data_dir = get_data_dir()
|
|
177
|
+
marker = data_dir / ".installed"
|
|
178
|
+
|
|
179
|
+
if not marker.exists():
|
|
180
|
+
result = setup_extension()
|
|
181
|
+
if not result:
|
|
182
|
+
return
|
|
183
|
+
else:
|
|
184
|
+
print_banner()
|
|
185
|
+
|
|
186
|
+
print_server_header()
|
|
187
|
+
|
|
188
|
+
try:
|
|
189
|
+
from .server import app
|
|
190
|
+
except ImportError:
|
|
191
|
+
from server import app
|
|
192
|
+
|
|
193
|
+
import uvicorn
|
|
194
|
+
uvicorn.run(app, host=HOST, port=PORT, access_log=False)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
if __name__ == "__main__":
|
|
198
|
+
main()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
"name": "Browse Code Bridge",
|
|
4
4
|
"version": "2.0",
|
|
5
5
|
"description": "Autonomous AI Code Execution Bridge",
|
|
6
|
+
"icons": {
|
|
7
|
+
"16": "icon16.png",
|
|
8
|
+
"48": "icon48.png",
|
|
9
|
+
"128": "icon128.png"
|
|
10
|
+
},
|
|
6
11
|
"permissions": [
|
|
7
12
|
"activeTab",
|
|
8
13
|
"storage"
|
|
@@ -19,7 +24,12 @@
|
|
|
19
24
|
}
|
|
20
25
|
],
|
|
21
26
|
"action": {
|
|
22
|
-
"default_popup": "popup.html"
|
|
27
|
+
"default_popup": "popup.html",
|
|
28
|
+
"default_icon": {
|
|
29
|
+
"16": "icon16.png",
|
|
30
|
+
"48": "icon48.png",
|
|
31
|
+
"128": "icon128.png"
|
|
32
|
+
}
|
|
23
33
|
},
|
|
24
34
|
"web_accessible_resources": [
|
|
25
35
|
{
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: browse_code
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Turn any AI chatbot into an autonomous coding agent
|
|
5
|
+
Description-Content-Type: text/markdown
|
|
6
|
+
Requires-Dist: fastapi
|
|
7
|
+
Requires-Dist: uvicorn
|
|
8
|
+
Requires-Dist: pydantic
|
|
9
|
+
Requires-Dist: rich
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: requires-dist
|
|
13
|
+
Dynamic: summary
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="logo.png" alt="Browse Code" width="200">
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
# Browse Code
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
**Browse Code** is a CLI tool that turns any AI chatbot (ChatGPT, Gemini, Claude, HuggingFace) into an autonomous coding agent. It bridges your browser and local terminal, letting AI read/write files, run commands, and manage processes on your machine.
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
Browse Code has two parts:
|
|
30
|
+
|
|
31
|
+
1. **A local server** that exposes your file system and terminal to the AI via a secure API.
|
|
32
|
+
2. **A Chrome extension** that injects agent capabilities into AI chat interfaces.
|
|
33
|
+
|
|
34
|
+
When connected, you can ask ChatGPT/Gemini/Claude to edit files, run scripts, search code, and more — all executed locally on your machine.
|
|
35
|
+
|
|
36
|
+
## Setup
|
|
37
|
+
|
|
38
|
+
### Step 1: Install the package
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install browse-code
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Run the CLI
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bc
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> If `bc` is not found, add your Python Scripts folder to PATH:
|
|
51
|
+
> ```bash
|
|
52
|
+
> # Windows (PowerShell)
|
|
53
|
+
> $env:Path += ";$env:APPDATA\Python\Python312\Scripts"
|
|
54
|
+
>
|
|
55
|
+
> # Or run directly
|
|
56
|
+
> python -m browse_code.cli
|
|
57
|
+
> ```
|
|
58
|
+
|
|
59
|
+
### Step 3: First-run extension setup
|
|
60
|
+
|
|
61
|
+
On the first run, `bc` will guide you through a one-time Chrome extension setup:
|
|
62
|
+
|
|
63
|
+
1. It asks for your permission to extract the extension files.
|
|
64
|
+
2. It copies the extension to `~/.browse_code/extension/` and copies the path to your clipboard.
|
|
65
|
+
3. It opens `chrome://extensions/` in your browser automatically.
|
|
66
|
+
4. You enable **Developer mode** (top-right toggle), click **Load unpacked**, and paste the path.
|
|
67
|
+
5. Press Enter in the terminal and the server starts.
|
|
68
|
+
|
|
69
|
+
**You only do this once.** The extension stays loaded in Chrome across sessions.
|
|
70
|
+
|
|
71
|
+
### Step 4: Start an AI session
|
|
72
|
+
|
|
73
|
+
1. Open any supported AI chat (ChatGPT, Gemini, Claude, or HuggingFace Chat).
|
|
74
|
+
2. Click the Browse Code Bridge extension icon and set your workspace directory.
|
|
75
|
+
3. Click "Initialize Agent in Chat".
|
|
76
|
+
4. Start coding with AI — it now has full access to your local environment.
|
|
77
|
+
|
|
78
|
+
## Subsequent Usage
|
|
79
|
+
|
|
80
|
+
After the first-time setup, just run:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
bc
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The server starts immediately. Open your AI chat tab and you're ready to go. The server terminal will show:
|
|
87
|
+
- A startup banner with your workspace and endpoint
|
|
88
|
+
- `[+] Extension connected` when the browser extension connects
|
|
89
|
+
- Real-time logs of every file read, write, command execution, and diff
|
|
90
|
+
|
|
91
|
+
## Features
|
|
92
|
+
|
|
93
|
+
- **File Operations:** Read, write, and patch files with inline terminal diffs
|
|
94
|
+
- **Code Search:** Search across your entire codebase by keyword
|
|
95
|
+
- **Terminal Commands:** Run shell commands with full stdout/stderr capture
|
|
96
|
+
- **Background Processes:** Start, monitor, and kill long-running processes
|
|
97
|
+
- **Multi-Platform AI:** Works with ChatGPT, Gemini, Claude, and HuggingFace Chat
|
|
98
|
+
- **Extension Heartbeat:** Server detects when the browser extension connects/disconnects
|
|
99
|
+
|
|
100
|
+
## For Developers
|
|
101
|
+
|
|
102
|
+
1. Clone the repository:
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/Dedeep007/browse_code.git
|
|
105
|
+
cd browse_code
|
|
106
|
+
```
|
|
107
|
+
2. Install in editable mode:
|
|
108
|
+
```bash
|
|
109
|
+
pip install -e .
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Contributing
|
|
113
|
+
|
|
114
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
115
|
+
|
|
116
|
+
1. Fork the repository.
|
|
117
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`).
|
|
118
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
|
|
119
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`).
|
|
120
|
+
5. Open a Pull Request.
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
Distributed under the MIT License.
|
|
@@ -11,6 +11,9 @@ browse_code.egg-info/entry_points.txt
|
|
|
11
11
|
browse_code.egg-info/requires.txt
|
|
12
12
|
browse_code.egg-info/top_level.txt
|
|
13
13
|
browse_code/extension/content.js
|
|
14
|
+
browse_code/extension/icon128.png
|
|
15
|
+
browse_code/extension/icon16.png
|
|
16
|
+
browse_code/extension/icon48.png
|
|
14
17
|
browse_code/extension/manifest.json
|
|
15
18
|
browse_code/extension/popup.html
|
|
16
19
|
browse_code/extension/popup.js
|
|
@@ -2,8 +2,10 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="browse_code",
|
|
5
|
-
version="0.1
|
|
6
|
-
description="
|
|
5
|
+
version="0.2.1",
|
|
6
|
+
description="Turn any AI chatbot into an autonomous coding agent",
|
|
7
|
+
long_description=open("README.md").read(),
|
|
8
|
+
long_description_content_type="text/markdown",
|
|
7
9
|
packages=find_packages(),
|
|
8
10
|
include_package_data=True,
|
|
9
11
|
package_data={
|
|
@@ -12,7 +14,8 @@ setup(
|
|
|
12
14
|
install_requires=[
|
|
13
15
|
"fastapi",
|
|
14
16
|
"uvicorn",
|
|
15
|
-
"pydantic"
|
|
17
|
+
"pydantic",
|
|
18
|
+
"rich",
|
|
16
19
|
],
|
|
17
20
|
entry_points={
|
|
18
21
|
"console_scripts": [
|
browse_code-0.1.3/PKG-INFO
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.3"
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import sys
|
|
3
|
-
import shutil
|
|
4
|
-
import platform
|
|
5
|
-
import subprocess
|
|
6
|
-
import webbrowser
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def get_data_dir():
|
|
11
|
-
"""Return ~/.browse_code, creating it if needed."""
|
|
12
|
-
data_dir = Path.home() / ".browse_code"
|
|
13
|
-
data_dir.mkdir(exist_ok=True)
|
|
14
|
-
return data_dir
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def copy_to_clipboard(text):
|
|
18
|
-
"""Copy text to the system clipboard (cross-platform)."""
|
|
19
|
-
try:
|
|
20
|
-
system = platform.system()
|
|
21
|
-
if system == "Windows":
|
|
22
|
-
subprocess.run("clip", input=text.encode("utf-8"), check=True)
|
|
23
|
-
elif system == "Darwin":
|
|
24
|
-
subprocess.run("pbcopy", input=text.encode("utf-8"), check=True)
|
|
25
|
-
else:
|
|
26
|
-
# Linux — try xclip, fall back to xsel
|
|
27
|
-
try:
|
|
28
|
-
subprocess.run(
|
|
29
|
-
["xclip", "-selection", "clipboard"],
|
|
30
|
-
input=text.encode("utf-8"),
|
|
31
|
-
check=True,
|
|
32
|
-
)
|
|
33
|
-
except FileNotFoundError:
|
|
34
|
-
subprocess.run(
|
|
35
|
-
["xsel", "--clipboard", "--input"],
|
|
36
|
-
input=text.encode("utf-8"),
|
|
37
|
-
check=True,
|
|
38
|
-
)
|
|
39
|
-
return True
|
|
40
|
-
except Exception:
|
|
41
|
-
return False
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def setup_extension():
|
|
45
|
-
"""First-time setup: extract extension, open Chrome, guide the user."""
|
|
46
|
-
data_dir = get_data_dir()
|
|
47
|
-
ext_dest = data_dir / "extension"
|
|
48
|
-
pkg_ext_dir = Path(__file__).parent / "extension"
|
|
49
|
-
|
|
50
|
-
print()
|
|
51
|
-
print("=" * 60)
|
|
52
|
-
print(" Browse Code - First Time Setup")
|
|
53
|
-
print("=" * 60)
|
|
54
|
-
print()
|
|
55
|
-
print("Browse Code needs a Chrome extension to connect your")
|
|
56
|
-
print("browser to the local server.")
|
|
57
|
-
print()
|
|
58
|
-
|
|
59
|
-
ans = input("Do you want to set up the extension now? (y/n): ")
|
|
60
|
-
if ans.strip().lower() != "y":
|
|
61
|
-
print("Skipped. You can re-run 'bc' anytime to set it up.")
|
|
62
|
-
return False
|
|
63
|
-
|
|
64
|
-
# Extract extension files
|
|
65
|
-
print()
|
|
66
|
-
print("Extracting extension files...")
|
|
67
|
-
if ext_dest.exists():
|
|
68
|
-
shutil.rmtree(ext_dest)
|
|
69
|
-
shutil.copytree(pkg_ext_dir, ext_dest)
|
|
70
|
-
|
|
71
|
-
ext_path_str = str(ext_dest)
|
|
72
|
-
print(f" Extension extracted to: {ext_path_str}")
|
|
73
|
-
print()
|
|
74
|
-
|
|
75
|
-
# Copy path to clipboard
|
|
76
|
-
copied = copy_to_clipboard(ext_path_str)
|
|
77
|
-
|
|
78
|
-
# Open chrome://extensions
|
|
79
|
-
print("Opening Chrome extensions page...")
|
|
80
|
-
webbrowser.open("chrome://extensions/")
|
|
81
|
-
|
|
82
|
-
print()
|
|
83
|
-
print("-" * 60)
|
|
84
|
-
print(" QUICK SETUP (one-time, takes 30 seconds):")
|
|
85
|
-
print("-" * 60)
|
|
86
|
-
print(' 1. Enable "Developer mode" toggle (top-right corner)')
|
|
87
|
-
print(' 2. Click "Load unpacked"')
|
|
88
|
-
if copied:
|
|
89
|
-
print(" 3. Paste the path (already copied to your clipboard)")
|
|
90
|
-
else:
|
|
91
|
-
print(f" 3. Select this folder: {ext_path_str}")
|
|
92
|
-
print("-" * 60)
|
|
93
|
-
print()
|
|
94
|
-
|
|
95
|
-
input("Press Enter after you've loaded the extension...")
|
|
96
|
-
|
|
97
|
-
# Mark as installed
|
|
98
|
-
marker = data_dir / ".installed"
|
|
99
|
-
marker.touch()
|
|
100
|
-
|
|
101
|
-
print()
|
|
102
|
-
print("Extension setup complete!")
|
|
103
|
-
return True
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def main():
|
|
107
|
-
data_dir = get_data_dir()
|
|
108
|
-
marker = data_dir / ".installed"
|
|
109
|
-
|
|
110
|
-
if not marker.exists():
|
|
111
|
-
result = setup_extension()
|
|
112
|
-
if not result:
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
print()
|
|
116
|
-
print("=" * 60)
|
|
117
|
-
print(" Browse Code")
|
|
118
|
-
print("=" * 60)
|
|
119
|
-
print()
|
|
120
|
-
print("Starting server...")
|
|
121
|
-
print()
|
|
122
|
-
|
|
123
|
-
try:
|
|
124
|
-
from .server import app
|
|
125
|
-
except ImportError:
|
|
126
|
-
from server import app
|
|
127
|
-
|
|
128
|
-
import uvicorn
|
|
129
|
-
uvicorn.run(app, host="127.0.0.1", port=5505, access_log=False)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if __name__ == "__main__":
|
|
133
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|