sky-prompt 0.2.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SkyPrompt contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,371 @@
1
+ Metadata-Version: 2.4
2
+ Name: sky-prompt
3
+ Version: 0.2.0
4
+ Summary: Minimal terminal CLI to prompt browser chat UIs through a local browser or Sky MCP.
5
+ Author: SkyPrompt contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/protostatis/sky_prompt
8
+ Project-URL: Repository, https://github.com/protostatis/sky_prompt
9
+ Project-URL: Issues, https://github.com/protostatis/sky_prompt/issues
10
+ Keywords: cli,browser,chatgpt,automation,terminal
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Topic :: Software Development :: User Interfaces
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: unchainedsky-cli
26
+ Requires-Dist: pyreplab
27
+ Dynamic: license-file
28
+
29
+ # SkyPrompt
30
+
31
+ Minimal terminal CLI to send prompts into a real browser tab such as `https://chatgpt.com`.
32
+ Released under the MIT License. See [`LICENSE`](./LICENSE).
33
+
34
+ `sky` now defaults to a local `unchainedsky-cli` transport, so the normal path does not require a Sky API key or Sky agent. If you can open ChatGPT in Chrome and log in with your OpenAI account, `sky` can drive that browser session from the terminal.
35
+
36
+ ## What It Does
37
+
38
+ - Drives a local Chrome session through `unchainedsky-cli`
39
+ - Navigates your connected browser to a URL
40
+ - Injects prompt text into visible chat input and optionally submits
41
+ - Supports one-shot mode and interactive shell mode
42
+ - Falls back to native browser actions if JS submit is not confirmed
43
+ - Shows a terminal thinking indicator and waits for render completion before final response capture
44
+ - Still supports the legacy Sky MCP transport with `--transport sky-mcp`
45
+
46
+ ## Install
47
+
48
+ Requires Python 3.10+.
49
+
50
+ ```bash
51
+ pip install sky-prompt
52
+ sky --setup
53
+ ```
54
+
55
+ `sky --setup` will:
56
+
57
+ - install `unchainedsky-cli` and `pyreplab` if they are missing
58
+ - install a `sky` launcher in `~/.local/bin` when possible
59
+ - launch Chrome to `https://chatgpt.com`
60
+ - tell you the next `sky` command to run
61
+
62
+ If `pyreplab` install fails, setup still completes and interactive `/run` falls back to `local` until `pyreplab` is installed.
63
+
64
+ If you want to run from a git checkout instead of PyPI:
65
+
66
+ ```bash
67
+ git clone https://github.com/protostatis/sky_prompt.git
68
+ cd sky_prompt
69
+ ./sky --setup
70
+ ```
71
+
72
+ Optional manual dependency installs:
73
+
74
+ ```bash
75
+ pip install unchainedsky-cli pyreplab
76
+ ```
77
+
78
+ Optional repo-local development install with `uv`:
79
+
80
+ ```bash
81
+ uv sync
82
+ ```
83
+
84
+ Custom alias setup if you want a second command name such as `sk`:
85
+
86
+ ```bash
87
+ ./sky --setup-alias sk
88
+ sk --help
89
+ ```
90
+
91
+ ## Quickstart
92
+
93
+ 1. Run setup:
94
+
95
+ ```bash
96
+ sky --setup
97
+ ```
98
+
99
+ 2. If ChatGPT is not already logged in for that browser session, finish the login in the opened browser tab.
100
+
101
+ 3. Run a one-shot prompt:
102
+
103
+ ```bash
104
+ sky -p "Explain MCP in one paragraph"
105
+ ```
106
+
107
+ 4. Run interactive mode:
108
+
109
+ ```bash
110
+ sky -i
111
+ ```
112
+
113
+ ## Local Browser Flow
114
+
115
+ The default transport is:
116
+
117
+ ```bash
118
+ sky --transport unchained
119
+ ```
120
+
121
+ The simplest path is:
122
+
123
+ ```bash
124
+ sky --setup
125
+ ```
126
+
127
+ Manual flow if you want more control:
128
+
129
+ 1. `unchained` is installed and available in `PATH`, or you pass `--unchained-cmd`.
130
+ 2. `sky` will auto-launch Chrome on `--unchained-port` (default `9222`) if nothing is already listening there.
131
+ 3. In the default profile mode, the selected Chrome profile is logged into the target site.
132
+
133
+ Useful flags:
134
+
135
+ ```bash
136
+ sky --setup --chrome-profile "Profile 3"
137
+ sky --setup --incognito
138
+ sky --setup --guest
139
+ sky --setup --unchained-port 9333
140
+ sky --unchained-port 9333 "hello"
141
+ sky --browser-tab auto "hello"
142
+ sky --unchained-cmd "uvx unchainedsky-cli" "hello"
143
+ ```
144
+
145
+ `--incognito` and `--guest` auto-launch a fresh Chrome session instead of reusing a named profile. Those modes usually require logging into ChatGPT again in that window.
146
+
147
+ If `~/.local/bin` is not on `PATH`, `sky --setup` will still work but your shell may not see the installed `sky` launcher until you add that directory to `PATH`.
148
+
149
+ ## Legacy Sky MCP Flow
150
+
151
+ If you still want to use the hosted Sky MCP path:
152
+
153
+ ```bash
154
+ sky --transport sky-mcp -p "Explain MCP in one paragraph"
155
+ ```
156
+
157
+ Credentials are read from `~/sky-agent/.env` or the environment:
158
+
159
+ ```bash
160
+ export SKY_API_KEY="uc_live_..."
161
+ export SKY_AGENT_ID="claude-xxxxxxxx"
162
+ ```
163
+
164
+ `sky` still supports the first-run setup/import flow for that legacy transport.
165
+
166
+ ## Demo
167
+
168
+ One-shot on ChatGPT:
169
+
170
+ ```bash
171
+ sky --url https://chatgpt.com -p "Write a 5-line Python script for a Poisson PMF"
172
+ ```
173
+
174
+ Interactive demo with format switching:
175
+
176
+ ```bash
177
+ sky -i
178
+ # then inside shell:
179
+ /format markdown
180
+ show me a numpy ascii chart for poisson(lambda=4)
181
+ /format plain
182
+ now summarize in 3 bullets
183
+ ```
184
+
185
+ ## Quick Usage (Claude-Like)
186
+
187
+ One-shot prompt:
188
+
189
+ ```bash
190
+ sky "Summarize MCP in one paragraph"
191
+ ```
192
+
193
+ Interactive shell mode (default when no prompt is passed):
194
+
195
+ ```bash
196
+ sky
197
+ ```
198
+
199
+ Inside `-i`, Up/Down arrows recall your previous prompts (saved in `~/.sky_prompt_history`).
200
+
201
+ Explicit flags:
202
+
203
+ ```bash
204
+ sky -prompt "Hello from prompt mode"
205
+ sky -chat
206
+ ```
207
+
208
+ Read prompt from stdin:
209
+
210
+ ```bash
211
+ echo "Write a haiku about browser automation" | \
212
+ sky
213
+ ```
214
+
215
+ Fill only, do not submit:
216
+
217
+ ```bash
218
+ sky --no-submit "Draft text only"
219
+ ```
220
+
221
+ Tune response waiting:
222
+
223
+ ```bash
224
+ sky --wait-timeout 240 --poll-interval 1.0 "Long response request"
225
+ ```
226
+
227
+ Use another website:
228
+
229
+ ```bash
230
+ sky --url https://chatgpt.com "What is MCP?"
231
+ ```
232
+
233
+ Choose output formatting:
234
+
235
+ ```bash
236
+ sky --output-format markdown "Explain MCP"
237
+ sky --output-format plain "Explain MCP"
238
+ sky --output-format json "Explain MCP"
239
+ ```
240
+
241
+ `json` mode includes structured artifacts for automation:
242
+ - `artifacts.code_blocks` detected scripts
243
+ - `artifacts.command_blocks` runnable shell command groups
244
+ - `artifacts.output_blocks` detected output/result sections
245
+ - `artifacts.copy_items` copy-ready chunks
246
+ - `artifacts.tool_hints` suggested runner commands
247
+
248
+ Run built-in closed-loop self-tests:
249
+
250
+ ```bash
251
+ ./sky --self-test
252
+ ```
253
+
254
+ Developer test loop (recommended while iterating):
255
+
256
+ ```bash
257
+ ./scripts/test_loop.sh
258
+ ./scripts/test_loop.sh --watch
259
+ ```
260
+
261
+ ## Custom Alias Setup
262
+
263
+ `sky --setup` already tries to install `sky` into `~/.local/bin`.
264
+ Use this when you want a second command name instead, for example `sk`:
265
+
266
+ ```bash
267
+ sky --setup-alias sk
268
+ ```
269
+
270
+ Optional flags:
271
+
272
+ ```bash
273
+ sky --setup-alias sk --alias-dir ~/.local/bin
274
+ sky --setup-alias sk --force-alias
275
+ ```
276
+
277
+ Then run:
278
+
279
+ ```bash
280
+ sk -p "something short"
281
+ ```
282
+
283
+ ## Interactive Commands
284
+
285
+ Inside interactive mode:
286
+
287
+ - `/help` show commands
288
+ - `/url <url>` navigate to another site
289
+ - `/submit on|off` toggle auto-submit
290
+ - `/format markdown|plain|json` change response rendering format
291
+ - `/backend [local|pyreplab]` choose `/run` execution backend (default: pyreplab, falls back to local if unavailable)
292
+ - `/py <code>` passthrough inline Python directly into pyreplab session
293
+ - `/pyfile <path.py>` passthrough a local setup script into pyreplab session
294
+ - `/history [n]` show recent turns (default last 10)
295
+ - `/last` reprint the latest turn using current format mode
296
+ - `/cells [n|all]` list detected runnable code cells (`*` marks the current cell)
297
+ - `/show [cell_id]` print cell content (defaults to the current cell)
298
+ - `/run [cell_id] [timeout_seconds]` execute a cell with the active backend (defaults to the current cell and prints the source first)
299
+ - `/fork <source_cell_id> [new_cell_id]` clone a cell for mutation
300
+ - `/edit <cell_id>` open cell in `$EDITOR`/`$VISUAL`
301
+ - `/save <cell_id> <path>` save a cell to disk
302
+ - `/diff <cell_a> <cell_b>` show unified diff between cells
303
+ - `/ddm` run ddm read
304
+ - `/exit` quit
305
+
306
+ Press `Ctrl-C` during `/run` to cancel the active execution and stay inside `-i`.
307
+
308
+ Playground loop example:
309
+
310
+ ```bash
311
+ sky -i
312
+ # ask for code, then:
313
+ /cells
314
+ /py import pandas as pd
315
+ /pyfile ./setup_lab.py
316
+ /run
317
+ /fork py1 py2
318
+ /edit py2
319
+ /diff py1 py2
320
+ /run py2
321
+ ```
322
+
323
+ `pyreplab` is the default `/run` backend when it is available, and `sky` falls back to `local` if it is not.
324
+ `local` still handles bash and other non-Python cells directly in the current workspace, and shell cells get `python`/`python3`/`pip` shims that point at the same interpreter `sky` is using.
325
+ `/py`, `/pyfile`, and `/run` share the same pyreplab session, so pre-imports persist for later cell runs.
326
+ Each `-i` session uses its own isolated pyreplab session directory to avoid cross-project leakage.
327
+
328
+ Use an explicit `pyreplab` command path:
329
+
330
+ ```bash
331
+ sky -i --run-backend pyreplab --pyreplab-cmd /path/to/pyreplab
332
+ # or set PYREPLAB_CMD and use /backend pyreplab inside -i
333
+ ```
334
+
335
+ Fast launch shortcut:
336
+
337
+ ```bash
338
+ sky -i --pyreplab
339
+ ```
340
+
341
+ ## Add To PATH
342
+
343
+ If `sky --setup` reported that `~/.local/bin` is missing from `PATH`, add it:
344
+
345
+ ```bash
346
+ export PATH="$HOME/.local/bin:$PATH"
347
+ ```
348
+
349
+ Then run:
350
+
351
+ ```bash
352
+ sky "Explain what an MCP session id is"
353
+ ```
354
+
355
+ ## Notes
356
+
357
+ - For the default `unchained` transport, profile mode reuses the Chrome profile you launched. `--incognito` and `--guest` create a fresh browser session instead.
358
+ - `SKY_API_KEY`, `SKY_AGENT_ID`, and `~/sky-agent/.env` only matter when you opt into `--transport sky-mcp`.
359
+ - `sky` talks to a browser tab, not the OpenAI API directly. For ChatGPT usage, the only account dependency is your normal web login session.
360
+ - The main CLI is intended to work on macOS and Linux anywhere `unchainedsky-cli`, Chrome, and Python are available.
361
+ - Browser foregrounding and window parking are macOS-only conveniences. On Linux and other non-macOS platforms, `sky` now skips that focus management and leaves the browser/window state alone.
362
+ - On macOS, `SKY_FOREGROUND_BROWSER=submit` (the default) brings Chrome to the foreground for the submit sequence once and then returns focus to the terminal. Set `SKY_FOREGROUND_BROWSER=poll` for aggressive background-safe polling, `SKY_FOREGROUND_BROWSER=0` to disable, or `SKY_BROWSER_APP` to override the browser app name.
363
+ - `scripts/test_install_terminal.sh` is macOS-only because it drives Terminal through `osascript`; it is not the cross-platform install test path.
364
+ - Different sites use different input DOM patterns; this script targets common chat UIs and may need selector tweaks for edge cases.
365
+ - Use `--debug` to print tool and transport diagnostics.
366
+ - Interactive mode clears stale draft text on startup.
367
+ - Tool-path tags like `[js_eval]` / `[fallback]` are hidden by default and shown only with `--debug`.
368
+
369
+ ## License
370
+
371
+ SkyPrompt is available under the MIT License. See [`LICENSE`](./LICENSE).