clichess-cli 0.9.0__py3-none-any.whl

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 clichess-cli might be problematic. Click here for more details.

@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: clichess-cli
3
+ Version: 0.9.0
4
+ Summary: Play chess in your terminal against an LLM or Stockfish
5
+ Author: Jude
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Helios1919/clichess
8
+ Project-URL: Source, https://github.com/Helios1919/clichess
9
+ Project-URL: PyPI, https://pypi.org/project/clichess-cli/
10
+ Keywords: chess,llm,terminal,tui,stockfish,ai
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Games/Entertainment :: Board Games
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: chess>=1.10
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7; extra == "dev"
22
+ Requires-Dist: ruff>=0.6; extra == "dev"
23
+ Dynamic: license-file
24
+
25
+ # clichess
26
+
27
+ [![tests](https://github.com/Helios1919/clichess/actions/workflows/tests.yml/badge.svg)](https://github.com/Helios1919/clichess/actions/workflows/tests.yml)
28
+ [![PyPI](https://img.shields.io/pypi/v/clichess-cli.svg)](https://pypi.org/project/clichess-cli/)
29
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
30
+
31
+ Play chess in the terminal against an LLM or against Stockfish.
32
+
33
+ ![clichess welcome screen](docs/welcome.png)
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ uv tool install clichess-cli # or: pipx install clichess-cli / pip install clichess-cli
39
+ ```
40
+
41
+ That is it - `clichess` lands on your PATH. Python 3.10+; the eval and the
42
+ built-in Stockfish opponent need an engine as well:
43
+
44
+ ```bash
45
+ sudo apt install stockfish # Linux; on macOS: brew install stockfish
46
+ ```
47
+
48
+ **Nothing installed at all?** No uv, no Python, no engine - this bootstrap does
49
+ all three, without administrator rights, into `~/.local/bin`:
50
+
51
+ ```bash
52
+ # Linux / macOS
53
+ curl -LsSf https://raw.githubusercontent.com/Helios1919/clichess/main/install.sh | sh
54
+ ```
55
+
56
+ ```powershell
57
+ # Windows (PowerShell)
58
+ irm https://raw.githubusercontent.com/Helios1919/clichess/main/install.ps1 | iex
59
+ ```
60
+
61
+ The engine is ~80 MB of that download; `CLICHESS_SKIP_ENGINE=1` skips it, and
62
+ `CLICHESS_INDEX=<url>` pulls the Python package from a mirror.
63
+
64
+ From a clone, without installing: `python clichess.py`, or `python -m clichess`.
65
+
66
+ ## Play
67
+
68
+ `clichess` opens the welcome page: a banner, a short intro, and `type help`.
69
+ `start` lists the opponents; a number starts one, `q` quits. The prompt also
70
+ takes `new`, `delete NAME|N`, `opponent NAME|N`, `continue` and `author`.
71
+ Numbers renumber themselves: remove opponent 2 and the old 3 becomes 2.
72
+
73
+ Opponent `0` is Stockfish. It asks how strong it should be:
74
+
75
+ ```
76
+ 1) beginner about 1320
77
+ 2) casual about 1600
78
+ 3) club about 1900
79
+ 4) strong about 2200
80
+ 5) expert about 2500
81
+ 6) maximum full strength
82
+ level [3]:
83
+ ```
84
+
85
+ Stockfish is asked to limit itself to that rating (`UCI_Elo`, 1320–3190); the
86
+ last option turns the limit off entirely.
87
+
88
+ The eval keeps running at full strength, so the score you see is honest even
89
+ when the opponent is playing badly on purpose.
90
+
91
+ ## Opponents
92
+
93
+ ```bash
94
+ clichess --new # provider, key, model: three choices, nothing to type
95
+ clichess --list
96
+ clichess --delete NAME # or a number from `start`; 0 is Stockfish, never deletable
97
+ clichess --opponent NAME # skip the welcome page; --opponent 0 is Stockfish
98
+ clichess --continue # resume the last game, same opponent and plan
99
+ ```
100
+
101
+ `--new` offers ChatGPT, Claude, DeepSeek, Gemini, Alibaba and **Custom** (any
102
+ OpenAI compatible endpoint: Ollama, LM Studio, vLLM, a gateway). It fills the
103
+ endpoint itself, then asks the provider which models the key can use and lets
104
+ you pick one. The last question is a **nickname** — the name you will pick it by, default
105
+ being the provider; a name already in use is refused. Custom endpoints may
106
+ leave the key empty, and if the server cannot list models you type it once.
107
+
108
+ One JSON file per opponent in `~/.config/clichess/opponents/`, mode 600
109
+ because it holds the key:
110
+
111
+ ```json
112
+ { "name": "DeepSeek", "model": "deepseek-chat", "base_url": "https://api.deepseek.com",
113
+ "api_key": "sk-...", "temperature": 0.4, "created": "2026-11-27" }
114
+ ```
115
+
116
+ | Provider | model | base_url |
117
+ |---|---|---|
118
+ | DeepSeek | `deepseek-chat` | `https://api.deepseek.com` |
119
+ | OpenAI | `gpt-4o-mini` | `https://api.openai.com/v1` |
120
+ | Alibaba Cloud | `qwen-plus`, `qwen-max` | `https://dashscope.aliyuncs.com/compatible-mode/v1` |
121
+ | OpenRouter | any `vendor/model` | `https://openrouter.ai/api/v1` |
122
+
123
+ Other flags: `--as black`, `--brief "an Italian"` (skip the prompt),
124
+ `--engine PATH`, `--version`.
125
+
126
+ ## In a game
127
+
128
+ ```
129
+ you > e4 a move, SAN or UCI
130
+ hint ask Stockfish for a suggestion
131
+ chat [text] say something to the opponent, no board reload
132
+ undo take back your move and its reply
133
+ fen show the position
134
+ coords toggle the a-h / 1-8 labels
135
+ say toggle the opponent's commentary column
136
+ eval toggle the eval / last / move panel
137
+ (all three are remembered for next time)
138
+ new start a new game
139
+ debug toggle raw model output
140
+ help the command list
141
+ quit leave, the game is saved
142
+ ```
143
+
144
+ Moves: `e4`, `Nf3`, `exd5`, `O-O`, `e8=Q`, or UCI like `e2e4`.
145
+
146
+ ## The plan
147
+
148
+ Against an LLM, each game starts with one line from you:
149
+
150
+ ```
151
+ brief > let us play the Italian, both sides develop normally
152
+
153
+ agreeing a plan...
154
+ plan: Italian: e4/e5, Nf3/Nc6, Bc4/Bc5; White builds c3/d3 and Nbd2, Black
155
+ answers ...d6/...a6, both castle short.
156
+ ```
157
+
158
+ The plan rides in the system prompt for the whole game; the model is told to
159
+ follow it and to admit it when a move breaks it.
160
+
161
+ ## The eval
162
+
163
+ Stockfish over UCI, depth 15, centipawns from white's point of view. The right
164
+ column shows the score and what the last move of *each side* was worth to the
165
+ side that played it - the two lines are coloured like the pieces, white and
166
+ red, so no labels are needed:
167
+
168
+ ![clichess in a game](docs/game.png)
169
+
170
+ The rightmost column is the opponent talking, prefixed with its nickname: one
171
+ short line per turn - a taunt, a joke or a real thought - produced in the same
172
+ request as the move, so it costs nothing extra. Every reply is capped: the say
173
+ line at 12 words, a chat answer at about 180 characters, the pre-game plan at
174
+ 240. `chat` lets you talk back - `chat why not c5` or just `chat` to be asked.
175
+
176
+ Stockfish has nothing to say, so that column stays empty against it.
177
+
178
+ `hint` always asks the full-strength engine, never the handicapped opponent.
179
+
180
+ Each turn the model is asked for five candidate moves; Stockfish drops any that
181
+ lose more than 0.8 pawns against the best option, and one survivor is picked at
182
+ random. If the model fails three times in a row, Stockfish plays that move
183
+ instead of the game dying.
184
+
185
+ ## Files
186
+
187
+ - `clichess.py` — the whole program
188
+ - `install.sh` / `install.ps1` — the zero-dependency bootstraps
189
+ - `~/.config/clichess/opponents/*.json` — opponents
190
+ - `~/.local/state/clichess/last.json` — saved game
191
+
192
+ ## Tests
193
+
194
+ ```bash
195
+ pip install -e .[dev] # or: uv sync --extra dev
196
+ pytest -q # 24 tests, no network, no engine needed
197
+ ```
198
+
199
+ The suite covers move parsing, the candidate filter, the side panel, rendering
200
+ toggles and the opponent store; `m.ENGINE` stays `None` throughout, so nothing
201
+ is spawned. CI runs it on 3.10-3.13 (`.github/workflows/tests.yml`).
202
+
203
+ ## Notes
204
+
205
+ An LLM without search plays around 1000–1500 Elo: fine openings, tactical
206
+ blunders later. It cannot play an illegal move — every legal move is enumerated
207
+ locally and the reply is validated — but it can play badly.
208
+
209
+ ## License
210
+
211
+ MIT — see [LICENSE](LICENSE). Built by [Jude](https://github.com/Helios1919).
@@ -0,0 +1,7 @@
1
+ clichess.py,sha256=69UeX1s5kEHoabR7y7mo-TTWcl25AUPk6PjFmMI2KnE,56372
2
+ clichess_cli-0.9.0.dist-info/licenses/LICENSE,sha256=NfshqVxiL3mLxs6QOeGJheRCTMtMxMx01P7zXI9DWhw,1061
3
+ clichess_cli-0.9.0.dist-info/METADATA,sha256=SSispeFVCxQIJd27u9W1-gC6YsZexJSlateG7keF4Uo,7877
4
+ clichess_cli-0.9.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ clichess_cli-0.9.0.dist-info/entry_points.txt,sha256=vciaDEWoYH63eW-veKn-YJ_cpm52SUK99-MSkI1lBY8,43
6
+ clichess_cli-0.9.0.dist-info/top_level.txt,sha256=Sb13_0xJ0bdNSyGoaM-QteeMQ2j1hk1sO9Npbf9iaf0,9
7
+ clichess_cli-0.9.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ clichess = clichess:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jude
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 @@
1
+ clichess