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