Skip to main content

Minimal terminal CLI to prompt browser chat UIs through a local browser or Sky MCP.

Project description

SkyPrompt

Minimal terminal CLI to send prompts into a real browser tab such as https://chatgpt.com. Released under the MIT License. See LICENSE.

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.

What It Does

  • Drives a local Chrome session through unchainedsky-cli
  • Navigates your connected browser to a URL
  • Injects prompt text into visible chat input and optionally submits
  • Supports one-shot mode and interactive shell mode
  • Falls back to native browser actions if JS submit is not confirmed
  • Shows a terminal thinking indicator and waits for render completion before final response capture
  • Still supports the legacy Sky MCP transport with --transport sky-mcp

Install

Requires Python 3.10+.

pip install sky-prompt
sky --setup

sky --setup will:

  • install unchainedsky-cli and pyreplab if they are missing
  • install a sky launcher in ~/.local/bin when possible
  • launch Chrome to https://chatgpt.com
  • tell you the next sky command to run

If pyreplab install fails, setup still completes and interactive /run falls back to local until pyreplab is installed.

If you want to run from a git checkout instead of PyPI:

git clone https://github.com/protostatis/sky_prompt.git
cd sky_prompt
./sky --setup

Optional manual dependency installs:

pip install unchainedsky-cli pyreplab

Optional repo-local development install with uv:

uv sync

Custom alias setup if you want a second command name such as sk:

./sky --setup-alias sk
sk --help

Quickstart

  1. Run setup:
sky --setup
  1. If ChatGPT is not already logged in for that browser session, finish the login in the opened browser tab.

  2. Run a one-shot prompt:

sky -p "Explain MCP in one paragraph"
  1. Run interactive mode:
sky -i

Tab-Isolated Orchestrator

Use scripts/orchestrator.py when ChatGPT should stay on one tab while browser tools execute on another. The script prepares two aliases on the same unchained port:

  • sky-chat for sky -p
  • sky-tools for mcporter tool calls

Prepare or refresh the aliases only:

python3 scripts/orchestrator.py --prepare-tabs-only

Run the full loop:

python3 scripts/orchestrator.py "find the cheapest laptop under 1000 on Amazon"

Useful flags:

python3 scripts/orchestrator.py --incognito "compare hotel prices in Chicago"
python3 scripts/orchestrator.py --chat-tab-alias agent-chat --tool-tab-alias agent-tools "audit signup flow"
python3 scripts/orchestrator.py --skip-tab-setup "reuse existing aliases"

Local Browser Flow

The default transport is:

sky --transport unchained

The simplest path is:

sky --setup

Manual flow if you want more control:

  1. unchained is installed and available in PATH, or you pass --unchained-cmd.
  2. sky will auto-launch Chrome on --unchained-port (default 9222) if nothing is already listening there.
  3. In the default profile mode, the selected Chrome profile is logged into the target site.

Useful flags:

sky --setup --chrome-profile "Profile 3"
sky --setup --incognito
sky --setup --guest
sky --setup --unchained-port 9333
sky --unchained-port 9333 "hello"
sky --browser-tab auto "hello"
sky --unchained-cmd "uvx unchainedsky-cli" "hello"

--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.

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.

Legacy Sky MCP Flow

If you still want to use the hosted Sky MCP path:

sky --transport sky-mcp -p "Explain MCP in one paragraph"

Credentials are read from ~/sky-agent/.env or the environment:

export SKY_API_KEY="uc_live_..."
export SKY_AGENT_ID="claude-xxxxxxxx"

sky still supports the first-run setup/import flow for that legacy transport.

Demo

One-shot on ChatGPT:

sky --url https://chatgpt.com -p "Write a 5-line Python script for a Poisson PMF"

Interactive demo with format switching:

sky -i
# then inside shell:
/format markdown
show me a numpy ascii chart for poisson(lambda=4)
/format plain
now summarize in 3 bullets

Quick Usage (Claude-Like)

One-shot prompt:

sky "Summarize MCP in one paragraph"

Interactive shell mode (default when no prompt is passed):

sky

Inside -i, Up/Down arrows recall your previous prompts (saved in ~/.sky_prompt_history).

Explicit flags:

sky -prompt "Hello from prompt mode"
sky -chat

Read prompt from stdin:

echo "Write a haiku about browser automation" | \
sky

Fill only, do not submit:

sky --no-submit "Draft text only"

Tune response waiting:

sky --wait-timeout 240 --poll-interval 1.0 "Long response request"

Use another website:

sky --url https://chatgpt.com "What is MCP?"

Choose output formatting:

sky --output-format markdown "Explain MCP"
sky --output-format plain "Explain MCP"
sky --output-format json "Explain MCP"

json mode includes structured artifacts for automation:

  • artifacts.code_blocks detected scripts
  • artifacts.command_blocks runnable shell command groups
  • artifacts.output_blocks detected output/result sections
  • artifacts.copy_items copy-ready chunks
  • artifacts.tool_hints suggested runner commands

Run built-in closed-loop self-tests:

./sky --self-test

Developer test loop (recommended while iterating):

./scripts/test_loop.sh
./scripts/test_loop.sh --watch

Custom Alias Setup

sky --setup already tries to install sky into ~/.local/bin. Use this when you want a second command name instead, for example sk:

sky --setup-alias sk

Optional flags:

sky --setup-alias sk --alias-dir ~/.local/bin
sky --setup-alias sk --force-alias

Then run:

sk -p "something short"

Interactive Commands

Inside interactive mode:

  • /help show commands
  • /url <url> navigate to another site
  • /submit on|off toggle auto-submit
  • /format markdown|plain|json change response rendering format
  • /backend [local|pyreplab] choose /run execution backend (default: pyreplab, falls back to local if unavailable)
  • /py <code> passthrough inline Python directly into pyreplab session
  • /pyfile <path.py> passthrough a local setup script into pyreplab session
  • /history [n] show recent turns (default last 10)
  • /last reprint the latest turn using current format mode
  • /cells [n|all] list detected runnable code cells (* marks the current cell)
  • /show [cell_id] print cell content (defaults to the current cell)
  • /run [cell_id] [timeout_seconds] execute a cell with the active backend (defaults to the current cell and prints the source first)
  • /fork <source_cell_id> [new_cell_id] clone a cell for mutation
  • /edit <cell_id> open cell in $EDITOR/$VISUAL
  • /save <cell_id> <path> save a cell to disk
  • /diff <cell_a> <cell_b> show unified diff between cells
  • /ddm run ddm read
  • /exit quit

Press Ctrl-C during /run to cancel the active execution and stay inside -i.

Playground loop example:

sky -i
# ask for code, then:
/cells
/py import pandas as pd
/pyfile ./setup_lab.py
/run
/fork py1 py2
/edit py2
/diff py1 py2
/run py2

pyreplab is the default /run backend when it is available, and sky falls back to local if it is not. 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. /py, /pyfile, and /run share the same pyreplab session, so pre-imports persist for later cell runs. Each -i session uses its own isolated pyreplab session directory to avoid cross-project leakage.

Use an explicit pyreplab command path:

sky -i --run-backend pyreplab --pyreplab-cmd /path/to/pyreplab
# or set PYREPLAB_CMD and use /backend pyreplab inside -i

Fast launch shortcut:

sky -i --pyreplab

Add To PATH

If sky --setup reported that ~/.local/bin is missing from PATH, add it:

export PATH="$HOME/.local/bin:$PATH"

Then run:

sky "Explain what an MCP session id is"

Notes

  • For the default unchained transport, profile mode reuses the Chrome profile you launched. --incognito and --guest create a fresh browser session instead.
  • SKY_API_KEY, SKY_AGENT_ID, and ~/sky-agent/.env only matter when you opt into --transport sky-mcp.
  • sky talks to a browser tab, not the OpenAI API directly. For ChatGPT usage, the only account dependency is your normal web login session.
  • The main CLI is intended to work on macOS and Linux anywhere unchainedsky-cli, Chrome, and Python are available.
  • 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.
  • 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.
  • scripts/test_install_terminal.sh is macOS-only because it drives Terminal through osascript; it is not the cross-platform install test path.
  • Different sites use different input DOM patterns; this script targets common chat UIs and may need selector tweaks for edge cases.
  • Use --debug to print tool and transport diagnostics.
  • Interactive mode clears stale draft text on startup.
  • Tool-path tags like [js_eval] / [fallback] are hidden by default and shown only with --debug.

License

SkyPrompt is available under the MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sky_prompt-0.2.2.tar.gz (86.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sky_prompt-0.2.2-py3-none-any.whl (88.2 kB view details)

Uploaded Python 3

File details

Details for the file sky_prompt-0.2.2.tar.gz.

File metadata

  • Download URL: sky_prompt-0.2.2.tar.gz
  • Upload date:
  • Size: 86.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sky_prompt-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f5f10349f28b504a24e9064d162b546c30fab377c45b6b012fc6171272211b6c
MD5 1e8e7a4a1c257233668c99ae50b1a121
BLAKE2b-256 cc599cca7a82e8596dd8bc1f519b2475ef8bf5ca177a32ff6926c724698ce9a4

See more details on using hashes here.

File details

Details for the file sky_prompt-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sky_prompt-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 88.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sky_prompt-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 21dfb1bac64437e66279983018e82606f290606e45be7edeae6d0bcb4b67ef1e
MD5 80e3a222a1cc39cb99a63fafbda3dd04
BLAKE2b-256 4fd991b66d98cac1242a1056bc66b6d513a71cf6d7a91ed69321db7ba6931914

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page