wcgw 0.0.10__tar.gz → 0.1.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.

Potentially problematic release.


This version of wcgw might be problematic. Click here for more details.

@@ -0,0 +1,30 @@
1
+ name: Python Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10", "3.11", "3.12"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v3
21
+ with:
22
+ python-version: "${{ matrix.python-version }}"
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install build
27
+ pip install .[dev] # Installs dependencies based on pyproject.toml
28
+ - name: Run tests
29
+ run: |
30
+ python -m unittest discover -s tests
@@ -0,0 +1 @@
1
+ 3.12
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: wcgw
3
- Version: 0.0.10
3
+ Version: 0.1.1
4
4
  Summary: What could go wrong giving full shell access to chatgpt?
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
7
- Requires-Python: <3.13,>=3.8
7
+ Requires-Python: <3.13,>=3.10
8
8
  Requires-Dist: fastapi>=0.115.0
9
9
  Requires-Dist: mypy>=1.11.2
10
10
  Requires-Dist: openai>=1.46.0
@@ -26,6 +26,9 @@ Description-Content-Type: text/markdown
26
26
  # Enable shell access on chatgpt.com
27
27
  A custom gpt on chatgpt web app to interact with your local shell.
28
28
 
29
+ [![Tests](https://github.com/rusiaaman/wcgw/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/rusiaaman/wcgw/actions/workflows/python-tests.yml)
30
+ [![Build](https://github.com/rusiaaman/wcgw/actions/workflows/python-publish.yml/badge.svg)](https://github.com/rusiaaman/wcgw/actions/workflows/python-publish.yml)
31
+
29
32
  ### 🚀 Highlights
30
33
  - ⚡ **Full Shell Access**: No restrictions, complete control.
31
34
  - ⚡ **Create, Execute, Iterate**: Ask the gpt to keep running compiler checks till all errors are fixed, or ask it to keep checking for the status of a long running command till it's done.
@@ -36,21 +39,24 @@ A custom gpt on chatgpt web app to interact with your local shell.
36
39
  2. Share the generated id with this GPT: `https://chatgpt.com/g/g-Us0AAXkRh-wcgw-giving-shell-access`
37
40
  3. The custom GPT can now run any command on your cli
38
41
 
42
+
39
43
  ## Client
44
+ You need to keep running this client for GPT to access your shell. Run it in a version controlled project's root.
40
45
 
41
- ### Option 1: using pip
42
- Supports python >=3.8 and <3.13
46
+ ### Option 1: using uv [Recommended]
43
47
  ```sh
44
- $ pip3 install wcgw
45
- $ wcgw
48
+ $ curl -LsSf https://astral.sh/uv/install.sh | sh
49
+ $ uv tool run --python 3.12 wcgw@latest
46
50
  ```
47
51
 
48
- ### Option 2: using uv
52
+ ### Option 2: using pip
53
+ Supports python >=3.10 and <3.13
49
54
  ```sh
50
- $ curl -LsSf https://astral.sh/uv/install.sh | sh
51
- $ uv tool run --python 3.12 wcgw
55
+ $ pip3 install wcgw
56
+ $ wcgw
52
57
  ```
53
58
 
59
+
54
60
  This will print a UUID that you need to share with the gpt.
55
61
 
56
62
 
@@ -67,20 +73,37 @@ NOTE: you can resume a broken connection
67
73
  # How it works
68
74
  Your commands are relayed through a server I've hosted at https://wcgw.arcfu.com. The code for that is at `src/relay/serve.py`.
69
75
 
70
- Chat gpt sends a request to the relay server using the user id that you share with it. The relay server holds a websocket with the terminal cilent against the user id and acts as a proxy to pass the request.
76
+ Chat gpt sends a request to the relay server using the user id that you share with it. The relay server holds a websocket with the terminal client against the user id and acts as a proxy to pass the request.
71
77
 
72
78
  It's secure in both the directions. Either a malicious actor or a malicious Chatgpt has to correctly guess your UUID for any security breach.
73
79
 
74
- NOTE: the relay server doesn't store any data. If you don't trust it then you may host the server on your own and create a custom gpt. Create an issue and I'll be happy to share the full instructions and schema I've given in the custom GPT configuration.
75
-
76
80
  # Showcase
77
81
 
82
+ ## Unit tests and github actions
83
+ [The first version of unit tests and github workflow to test on multiple python versions were written by the custom chatgpt](https://chatgpt.com/share/6717f922-8998-8005-b825-45d4b348b4dd)
84
+
78
85
  ## Create a todo app using react + typescript + vite
79
- https://chatgpt.com/share/6717d94d-756c-8005-98a6-d021c7b586aa
86
+ ![Screenshot](https://github.com/rusiaaman/wcgw/blob/main/static/ss1.png?raw=true)
87
+
88
+
89
+ # Privacy
90
+ The relay server doesn't store any data. I can't access any information passing through it and only secure channels are used to communicate.
91
+
92
+ You may host the server on your own and create a custom gpt using the following section.
93
+
94
+ # Creating your own custom gpt and the relay server.
95
+ I've used the following instructions and action json schema to create the custom GPT. (Replace wcgw.arcfu.com with the address to your server)
96
+
97
+ https://github.com/rusiaaman/wcgw/blob/main/gpt_instructions.txt
98
+ https://github.com/rusiaaman/wcgw/blob/main/gpt_action_json_schema.json
99
+
100
+ Run the server
101
+ `gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
80
102
 
81
- ## Write unit tests for all files in my current repo
82
- [Todo]
103
+ If you don't have public ip and domain name, you can use `ngrok` or similar services to get a https address to the api.
83
104
 
105
+ The specify the server url in the `wcgw` command like so
106
+ `wcgw --server-url https://your-url/register`
84
107
 
85
108
  # [Optional] Local shell access with openai API key
86
109
 
@@ -1,6 +1,9 @@
1
1
  # Enable shell access on chatgpt.com
2
2
  A custom gpt on chatgpt web app to interact with your local shell.
3
3
 
4
+ [![Tests](https://github.com/rusiaaman/wcgw/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/rusiaaman/wcgw/actions/workflows/python-tests.yml)
5
+ [![Build](https://github.com/rusiaaman/wcgw/actions/workflows/python-publish.yml/badge.svg)](https://github.com/rusiaaman/wcgw/actions/workflows/python-publish.yml)
6
+
4
7
  ### 🚀 Highlights
5
8
  - ⚡ **Full Shell Access**: No restrictions, complete control.
6
9
  - ⚡ **Create, Execute, Iterate**: Ask the gpt to keep running compiler checks till all errors are fixed, or ask it to keep checking for the status of a long running command till it's done.
@@ -11,21 +14,24 @@ A custom gpt on chatgpt web app to interact with your local shell.
11
14
  2. Share the generated id with this GPT: `https://chatgpt.com/g/g-Us0AAXkRh-wcgw-giving-shell-access`
12
15
  3. The custom GPT can now run any command on your cli
13
16
 
17
+
14
18
  ## Client
19
+ You need to keep running this client for GPT to access your shell. Run it in a version controlled project's root.
15
20
 
16
- ### Option 1: using pip
17
- Supports python >=3.8 and <3.13
21
+ ### Option 1: using uv [Recommended]
18
22
  ```sh
19
- $ pip3 install wcgw
20
- $ wcgw
23
+ $ curl -LsSf https://astral.sh/uv/install.sh | sh
24
+ $ uv tool run --python 3.12 wcgw@latest
21
25
  ```
22
26
 
23
- ### Option 2: using uv
27
+ ### Option 2: using pip
28
+ Supports python >=3.10 and <3.13
24
29
  ```sh
25
- $ curl -LsSf https://astral.sh/uv/install.sh | sh
26
- $ uv tool run --python 3.12 wcgw
30
+ $ pip3 install wcgw
31
+ $ wcgw
27
32
  ```
28
33
 
34
+
29
35
  This will print a UUID that you need to share with the gpt.
30
36
 
31
37
 
@@ -42,20 +48,37 @@ NOTE: you can resume a broken connection
42
48
  # How it works
43
49
  Your commands are relayed through a server I've hosted at https://wcgw.arcfu.com. The code for that is at `src/relay/serve.py`.
44
50
 
45
- Chat gpt sends a request to the relay server using the user id that you share with it. The relay server holds a websocket with the terminal cilent against the user id and acts as a proxy to pass the request.
51
+ Chat gpt sends a request to the relay server using the user id that you share with it. The relay server holds a websocket with the terminal client against the user id and acts as a proxy to pass the request.
46
52
 
47
53
  It's secure in both the directions. Either a malicious actor or a malicious Chatgpt has to correctly guess your UUID for any security breach.
48
54
 
49
- NOTE: the relay server doesn't store any data. If you don't trust it then you may host the server on your own and create a custom gpt. Create an issue and I'll be happy to share the full instructions and schema I've given in the custom GPT configuration.
50
-
51
55
  # Showcase
52
56
 
57
+ ## Unit tests and github actions
58
+ [The first version of unit tests and github workflow to test on multiple python versions were written by the custom chatgpt](https://chatgpt.com/share/6717f922-8998-8005-b825-45d4b348b4dd)
59
+
53
60
  ## Create a todo app using react + typescript + vite
54
- https://chatgpt.com/share/6717d94d-756c-8005-98a6-d021c7b586aa
61
+ ![Screenshot](https://github.com/rusiaaman/wcgw/blob/main/static/ss1.png?raw=true)
62
+
63
+
64
+ # Privacy
65
+ The relay server doesn't store any data. I can't access any information passing through it and only secure channels are used to communicate.
66
+
67
+ You may host the server on your own and create a custom gpt using the following section.
68
+
69
+ # Creating your own custom gpt and the relay server.
70
+ I've used the following instructions and action json schema to create the custom GPT. (Replace wcgw.arcfu.com with the address to your server)
71
+
72
+ https://github.com/rusiaaman/wcgw/blob/main/gpt_instructions.txt
73
+ https://github.com/rusiaaman/wcgw/blob/main/gpt_action_json_schema.json
74
+
75
+ Run the server
76
+ `gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
55
77
 
56
- ## Write unit tests for all files in my current repo
57
- [Todo]
78
+ If you don't have public ip and domain name, you can use `ngrok` or similar services to get a https address to the api.
58
79
 
80
+ The specify the server url in the `wcgw` command like so
81
+ `wcgw --server-url https://your-url/register`
59
82
 
60
83
  # [Optional] Local shell access with openai API key
61
84
 
@@ -0,0 +1,231 @@
1
+
2
+ {
3
+ "openapi": "3.1.0",
4
+ "info": {
5
+ "title": "FastAPI",
6
+ "version": "0.1.0"
7
+ },
8
+ "servers": [
9
+ {"url": "https://wcgw.arcfu.com"}
10
+ ],
11
+ "paths": {
12
+ "/write_file": {
13
+ "post": {
14
+ "x-openai-isConsequential": false,
15
+ "summary": "Write File",
16
+ "operationId": "write_file_write_file__uuid__post",
17
+ "parameters": [
18
+ {
19
+ "name": "user_id",
20
+ "in": "query",
21
+ "required": true,
22
+ "schema": {
23
+ "type": "string",
24
+ "format": "uuid",
25
+ "title": "User Id"
26
+ }
27
+ }
28
+ ],
29
+ "requestBody": {
30
+ "required": true,
31
+ "content": {
32
+ "application/json": {
33
+ "schema": {
34
+ "$ref": "#/components/schemas/Writefile"
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "responses": {
40
+ "200": {
41
+ "description": "Successful Response",
42
+ "content": {
43
+ "application/json": {
44
+ "schema": {
45
+ "type": "string",
46
+ "title": "Response Write File Write File Uuid Post"
47
+ }
48
+ }
49
+ }
50
+ },
51
+ "422": {
52
+ "description": "Validation Error",
53
+ "content": {
54
+ "application/json": {
55
+ "schema": {
56
+ "$ref": "#/components/schemas/HTTPValidationError"
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "/execute_bash": {
65
+ "post": {
66
+ "x-openai-isConsequential": false,
67
+ "summary": "Execute Bash",
68
+ "operationId": "execute_bash_execute_bash__uuid__post",
69
+ "parameters": [
70
+ {
71
+ "name": "user_id",
72
+ "in": "query",
73
+ "required": true,
74
+ "schema": {
75
+ "type": "string",
76
+ "format": "uuid",
77
+ "title": "User Id"
78
+ }
79
+ }
80
+ ],
81
+ "requestBody": {
82
+ "required": true,
83
+ "content": {
84
+ "application/json": {
85
+ "schema": {
86
+ "$ref": "#/components/schemas/ExecuteBash"
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "responses": {
92
+ "200": {
93
+ "description": "Successful Response",
94
+ "content": {
95
+ "application/json": {
96
+ "schema": {
97
+ "type": "string",
98
+ "title": "Response Execute Bash Execute Bash Uuid Post"
99
+ }
100
+ }
101
+ }
102
+ },
103
+ "422": {
104
+ "description": "Validation Error",
105
+ "content": {
106
+ "application/json": {
107
+ "schema": {
108
+ "$ref": "#/components/schemas/HTTPValidationError"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ },
117
+ "components": {
118
+ "schemas": {
119
+ "ExecuteBash": {
120
+ "properties": {
121
+ "execute_command": {
122
+ "anyOf": [
123
+ {
124
+ "type": "string"
125
+ },
126
+ {
127
+ "type": "null"
128
+ }
129
+ ],
130
+ "title": "Execute Command"
131
+ },
132
+ "send_ascii": {
133
+ "anyOf": [
134
+ {
135
+ "items": {
136
+ "anyOf": [
137
+ {
138
+ "type": "integer"
139
+ },
140
+ {
141
+ "type": "string",
142
+ "enum": [
143
+ "Key-up",
144
+ "Key-down",
145
+ "Key-left",
146
+ "Key-right",
147
+ "Enter",
148
+ "Ctrl-c"
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ "type": "array"
154
+ },
155
+ {
156
+ "type": "null"
157
+ }
158
+ ],
159
+ "title": "Send Ascii"
160
+ }
161
+ },
162
+ "type": "object",
163
+ "title": "ExecuteBash"
164
+ },
165
+ "HTTPValidationError": {
166
+ "properties": {
167
+ "detail": {
168
+ "items": {
169
+ "$ref": "#/components/schemas/ValidationError"
170
+ },
171
+ "type": "array",
172
+ "title": "Detail"
173
+ }
174
+ },
175
+ "type": "object",
176
+ "title": "HTTPValidationError"
177
+ },
178
+ "ValidationError": {
179
+ "properties": {
180
+ "loc": {
181
+ "items": {
182
+ "anyOf": [
183
+ {
184
+ "type": "string"
185
+ },
186
+ {
187
+ "type": "integer"
188
+ }
189
+ ]
190
+ },
191
+ "type": "array",
192
+ "title": "Location"
193
+ },
194
+ "msg": {
195
+ "type": "string",
196
+ "title": "Message"
197
+ },
198
+ "type": {
199
+ "type": "string",
200
+ "title": "Error Type"
201
+ }
202
+ },
203
+ "type": "object",
204
+ "required": [
205
+ "loc",
206
+ "msg",
207
+ "type"
208
+ ],
209
+ "title": "ValidationError"
210
+ },
211
+ "Writefile": {
212
+ "properties": {
213
+ "file_path": {
214
+ "type": "string",
215
+ "title": "File Path"
216
+ },
217
+ "file_content": {
218
+ "type": "string",
219
+ "title": "File Content"
220
+ }
221
+ },
222
+ "type": "object",
223
+ "required": [
224
+ "file_path",
225
+ "file_content"
226
+ ],
227
+ "title": "Writefile"
228
+ }
229
+ }
230
+ }
231
+ }
@@ -0,0 +1,31 @@
1
+ You're a cli assistant.
2
+
3
+ Instructions:
4
+
5
+ - You should use the provided bash execution tool to run script to complete objective.
6
+ - Do not use sudo. Do not use interactive commands.
7
+ - Ask user for confirmation before running anything major
8
+
9
+
10
+ To execute bash commands OR write files use the provided api `wcgw.arcfu.com`
11
+
12
+ Instructions for `Execute Bash`:
13
+ - Execute a bash script. This is stateful (beware with subsequent calls).
14
+ - Execute commands using `execute_command` attribute.
15
+ - Do not use interactive commands like nano. Prefer writing simpler commands.
16
+ - Last line will always be `(exit <int code>)` except if
17
+ - The last line is `(pending)` if the program is still running or waiting for your input. You can then send input using `send_ascii` attributes. You get status by sending new line `send_ascii: ["Enter"]` or `send_ascii: [10]`.
18
+ - Optionally the last line is `(won't exit)` in which case you need to kill the process if you want to run a new command.
19
+ - Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
20
+ - The first line might be `(...truncated)` if the output is too long.
21
+ - Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
22
+
23
+ Instructions for `Write File`
24
+ - Write content to a file. Provide file path and content. Use this instead of ExecuteBash for writing files.
25
+
26
+ ---
27
+
28
+ Always critically think and debate with yourself to solve the problem. Understand the context and the code by reading as much resources as possible before writing a single piece of code.
29
+
30
+ ---
31
+ Ask the user for the user_id `UUID` if they haven't provided in the first message.
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  authors = [{ name = "Aman Rusia", email = "gapypi@arcfu.com" }]
3
3
  name = "wcgw"
4
- version = "0.0.10"
4
+ version = "0.1.1"
5
5
  description = "What could go wrong giving full shell access to chatgpt?"
6
6
  readme = "README.md"
7
- requires-python = ">=3.8, <3.13"
7
+ requires-python = ">=3.10, <3.13"
8
8
  dependencies = [
9
9
  "openai>=1.46.0",
10
10
  "mypy>=1.11.2",
@@ -27,7 +27,6 @@ dependencies = [
27
27
  [project.urls]
28
28
  Homepage = "https://github.com/rusiaaman/wcgw"
29
29
 
30
-
31
30
  [build-system]
32
31
  requires = ["hatchling"]
33
32
  build-backend = "hatchling.build"
@@ -158,14 +158,16 @@ def loop(
158
158
  openai.pydantic_function_tool(
159
159
  ExecuteBash,
160
160
  description="""
161
- Execute a bash script. Stateful (beware with subsequent calls).
162
- Execute commands using `execute_command` attribute.
163
- Do not use interactive commands like nano. Prefer writing simpler commands.
164
- Last line will always be `(exit <int code>)` except if
165
- the last line is `(pending)` if the program is still running or waiting for user inputs. You can then send input using `send_ascii` attributes. You get status by sending `send_ascii: [10]`.
166
- Optionally the last line is `(won't exit)` in which case you need to kill the process if you want to run a new command.
167
- Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
168
- The first line might be `(...truncated)` if the output is too long.""",
161
+ - Execute a bash script. This is stateful (beware with subsequent calls).
162
+ - Execute commands using `execute_command` attribute.
163
+ - Do not use interactive commands like nano. Prefer writing simpler commands.
164
+ - Last line will always be `(exit <int code>)` except if
165
+ - The last line is `(pending)` if the program is still running or waiting for your input. You can then send input using `send_ascii` attributes. You get status by sending new line `send_ascii: ["Enter"]` or `send_ascii: [10]`.
166
+ - Optionally the last line is `(won't exit)` in which case you need to kill the process if you want to run a new command.
167
+ - Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
168
+ - The first line might be `(...truncated)` if the output is too long.
169
+ - Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
170
+ """,
169
171
  ),
170
172
  openai.pydantic_function_tool(
171
173
  Writefile,