-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add cli support linux proton issue #128 (draft) #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6b117d9
f08f2bf
a2aef59
c0f2945
f3cf71a
f29bf95
06c2958
2508942
5f11d73
19c8b8a
ceeaabf
ea511a8
bfe9a18
09e91ff
1ba49d0
3f2a163
c1878b5
6a29ef8
1645dcf
d407b2e
ca55228
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,6 +255,7 @@ __marimo__/ | |
|
|
||
| # Lua Language Server | ||
| .luarc.json | ||
| .lua-lsp/ | ||
|
|
||
| # Compiled Lua sources | ||
| luac.out | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,74 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| # /// script | ||||||||||||||||||||||||||||||||||||||||||||||
| # requires-python = ">=3.11" | ||||||||||||||||||||||||||||||||||||||||||||||
| # dependencies = [ | ||||||||||||||||||||||||||||||||||||||||||||||
| # "requests", | ||||||||||||||||||||||||||||||||||||||||||||||
| # ] | ||||||||||||||||||||||||||||||||||||||||||||||
| # /// | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import requests | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # BalatroBot API endpoint | ||||||||||||||||||||||||||||||||||||||||||||||
| URL = "http://127.0.0.1:12346" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| def rpc(method: str, params: dict = {}) -> dict: | ||||||||||||||||||||||||||||||||||||||||||||||
| """Send a JSON-RPC 2.0 request to the BalatroBot API.""" | ||||||||||||||||||||||||||||||||||||||||||||||
| response = requests.post( | ||||||||||||||||||||||||||||||||||||||||||||||
| URL, | ||||||||||||||||||||||||||||||||||||||||||||||
| json={ | ||||||||||||||||||||||||||||||||||||||||||||||
| "jsonrpc": "2.0", | ||||||||||||||||||||||||||||||||||||||||||||||
| "method": method, | ||||||||||||||||||||||||||||||||||||||||||||||
| "params": params, | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+21
|
||||||||||||||||||||||||||||||||||||||||||||||
| def rpc(method: str, params: dict = {}) -> dict: | |
| """Send a JSON-RPC 2.0 request to the BalatroBot API.""" | |
| response = requests.post( | |
| URL, | |
| json={ | |
| "jsonrpc": "2.0", | |
| "method": method, | |
| "params": params, | |
| def rpc(method: str, params: dict | None = None) -> dict: | |
| """Send a JSON-RPC 2.0 request to the BalatroBot API.""" | |
| response = requests.post( | |
| URL, | |
| json={ | |
| "jsonrpc": "2.0", | |
| "method": method, | |
| "params": params or {}, |
Copilot
AI
Mar 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example bot’s requests.post(...) call has no timeout. If the local API is unreachable, this can hang indefinitely and make the example look broken. Consider adding a reasonable timeout (and optionally a clearer exception message for connection errors).
| response = requests.post( | |
| URL, | |
| json={ | |
| "jsonrpc": "2.0", | |
| "method": method, | |
| "params": params, | |
| "id": 1, | |
| }, | |
| ) | |
| try: | |
| response = requests.post( | |
| URL, | |
| json={ | |
| "jsonrpc": "2.0", | |
| "method": method, | |
| "params": params, | |
| "id": 1, | |
| }, | |
| timeout=5, | |
| ) | |
| except requests.exceptions.RequestException as exc: | |
| raise RuntimeError(f"Failed to connect to BalatroBot API at {URL}") from exc |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,132 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| # dev.sh — Make-compatible dev task runner for environments without make (e.g. Steam Deck). | ||||||
| # Usage: ./scripts/dev.sh <target> | ||||||
| # Mirrors the targets in the project Makefile. | ||||||
|
|
||||||
| set -euo pipefail | ||||||
|
|
||||||
| YELLOW='\033[33m' | ||||||
| GREEN='\033[32m' | ||||||
| BLUE='\033[34m' | ||||||
| RED='\033[31m' | ||||||
| RESET='\033[0m' | ||||||
|
|
||||||
| MAX_XDIST="${MAX_XDIST:-6}" | ||||||
| CLI_XDIST_WORKERS="${CLI_XDIST_WORKERS:-2}" | ||||||
| XDIST_WORKERS=$(python -c "import multiprocessing as mp; print(min(mp.cpu_count(), $MAX_XDIST))") | ||||||
| LUA_XDIST_WORKERS="${LUA_XDIST_WORKERS:-2}" | ||||||
|
|
||||||
| print_msg() { printf "%b\n" "$1"; } | ||||||
|
|
||||||
| cmd_help() { | ||||||
| print_msg "${BLUE}BalatroBot Development Tasks${RESET}" | ||||||
| print_msg "" | ||||||
| print_msg "${YELLOW}Available targets:${RESET}" | ||||||
| printf " ${GREEN}%-18s${RESET} %s\n" "help" "Show this help message" | ||||||
| printf " ${GREEN}%-18s${RESET} %s\n" "install" "Install balatrobot and all dependencies (including dev)" | ||||||
| printf " ${GREEN}%-18s${RESET} %s\n" "lint" "Run ruff linter (check only)" | ||||||
|
||||||
| printf " ${GREEN}%-18s${RESET} %s\n" "lint" "Run ruff linter (check only)" | |
| printf " ${GREEN}%-18s${RESET} %s\n" "lint" "Run ruff linter (apply fixes)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link target
cli.md#linux-steamproton-platformlikely doesn’t match the actual heading slug indocs/cli.md(### Linux (Steam/Proton) Platform (Experimental)typically slugs to#linux-steamproton-platform-experimentalin MkDocs/Material). This will produce a broken in-page link; adjust the fragment or add an explicit anchor to the CLI heading.