clichess-cli 0.9.0__2-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,184 @@
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?logo=pypi&logoColor=white)](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
+ pip install clichess-cli
39
+ ```
40
+
41
+ Then run `clichess`. The first start offers to download Stockfish (~80 MB);
42
+ accept it and the eval, the move filter and opponent 0 all work. Any other
43
+ time: `clichess --install-engine`.
44
+
45
+ Prefer an isolated install? `uv tool install clichess-cli` or
46
+ `pipx install clichess-cli` do the same without touching your global
47
+ site-packages.
48
+
49
+ No Python at all? `install.sh` (Linux/macOS) or `install.ps1` (Windows) in the
50
+ repository brings uv, a private Python, clichess and Stockfish.
51
+
52
+ ## Play
53
+
54
+ `clichess` opens the welcome page: a banner, a short intro, and `type help`.
55
+ `start` lists the opponents; a number starts one, `q` quits. The prompt also
56
+ takes `new`, `delete NAME|N`, `opponent NAME|N`, `continue` and `author`.
57
+ Numbers renumber themselves: remove opponent 2 and the old 3 becomes 2.
58
+
59
+ Opponent `0` is Stockfish: it asks how strong it should be, `1) beginner` at
60
+ about 1320 Elo through `6) maximum`, which lifts the limit entirely. The eval
61
+ keeps running at full strength, so the score stays honest even when the
62
+ opponent is playing badly on purpose.
63
+
64
+ ## Opponents
65
+
66
+ ```bash
67
+ clichess --new # provider, key, model: three choices, nothing to type
68
+ clichess --list
69
+ clichess --delete NAME # or a number from `start`; 0 is Stockfish, never deletable
70
+ clichess --opponent NAME # skip the welcome page; --opponent 0 is Stockfish
71
+ clichess --continue # resume the last game, same opponent and plan
72
+ ```
73
+
74
+ `--new` offers ChatGPT, Claude, DeepSeek, Gemini, Alibaba and **Custom** (any
75
+ OpenAI compatible endpoint: Ollama, LM Studio, vLLM, a gateway). It fills the
76
+ endpoint itself, then asks the provider which models the key can use and lets
77
+ you pick one. The last question is a **nickname** — the name you will pick it by, default
78
+ being the provider; a name already in use is refused. Custom endpoints may
79
+ leave the key empty, and if the server cannot list models you type it once.
80
+
81
+ One JSON file per opponent in `~/.config/clichess/opponents/`, mode 600
82
+ because it holds the key:
83
+
84
+ ```json
85
+ { "name": "DeepSeek", "model": "deepseek-chat", "base_url": "https://api.deepseek.com",
86
+ "api_key": "sk-...", "temperature": 0.4, "created": "2026-11-27" }
87
+ ```
88
+
89
+ | Provider | model | base_url |
90
+ |---|---|---|
91
+ | DeepSeek | `deepseek-chat` | `https://api.deepseek.com` |
92
+ | OpenAI | `gpt-4o-mini` | `https://api.openai.com/v1` |
93
+ | Alibaba Cloud | `qwen-plus`, `qwen-max` | `https://dashscope.aliyuncs.com/compatible-mode/v1` |
94
+ | OpenRouter | any `vendor/model` | `https://openrouter.ai/api/v1` |
95
+
96
+ Other flags: `--as black`, `--brief "an Italian"` (skip the prompt),
97
+ `--engine PATH`, `--version`.
98
+
99
+ ## In a game
100
+
101
+ ```
102
+ you > e4 a move, SAN or UCI
103
+ hint ask Stockfish for a suggestion
104
+ chat [text] say something to the opponent, no board reload
105
+ undo take back your move and its reply
106
+ fen show the position
107
+ coords toggle the a-h / 1-8 labels
108
+ say toggle the opponent's commentary column
109
+ eval toggle the eval / last / move panel
110
+ (all three are remembered for next time)
111
+ new start a new game
112
+ debug toggle raw model output
113
+ help the command list
114
+ quit leave, the game is saved
115
+ ```
116
+
117
+ Moves: `e4`, `Nf3`, `exd5`, `O-O`, `e8=Q`, or UCI like `e2e4`.
118
+
119
+ ## The plan
120
+
121
+ Against an LLM, each game starts with one line from you:
122
+
123
+ ```
124
+ brief > let us play the Italian, both sides develop normally
125
+
126
+ agreeing a plan...
127
+ plan: Italian: e4/e5, Nf3/Nc6, Bc4/Bc5; White builds c3/d3 and Nbd2, Black
128
+ answers ...d6/...a6, both castle short.
129
+ ```
130
+
131
+ The plan rides in the system prompt for the whole game; the model is told to
132
+ follow it and to admit it when a move breaks it.
133
+
134
+ ## The eval
135
+
136
+ Stockfish over UCI, depth 15, centipawns from white's point of view. The right
137
+ column shows the score and what the last move of *each side* was worth to the
138
+ side that played it - the two lines are coloured like the pieces, white and
139
+ red, so no labels are needed:
140
+
141
+ ![clichess in a game](docs/game.png)
142
+
143
+ The rightmost column is the opponent talking, prefixed with its nickname: one
144
+ short line per turn - a taunt, a joke or a real thought - produced in the same
145
+ request as the move, so it costs nothing extra. Every reply is capped: the say
146
+ line at 12 words, a chat answer at about 180 characters, the pre-game plan at
147
+ 240. `chat` lets you talk back - `chat why not c5` or just `chat` to be asked.
148
+
149
+ Stockfish has nothing to say, so that column stays empty against it.
150
+
151
+ `hint` always asks the full-strength engine, never the handicapped opponent.
152
+
153
+ Each turn the model is asked for five candidate moves; Stockfish drops any that
154
+ lose more than 0.8 pawns against the best option, and one survivor is picked at
155
+ random. If the model fails three times in a row, Stockfish plays that move
156
+ instead of the game dying.
157
+
158
+ ## Files
159
+
160
+ - `clichess.py` — the whole program
161
+ - `install.sh` / `install.ps1` — the zero-dependency bootstraps
162
+ - `~/.config/clichess/opponents/*.json` — opponents
163
+ - `~/.local/state/clichess/last.json` — saved game
164
+
165
+ ## Tests
166
+
167
+ ```bash
168
+ pip install -e .[dev] # or: uv sync --extra dev
169
+ pytest -q # 24 tests, no network, no engine needed
170
+ ```
171
+
172
+ The suite covers move parsing, the candidate filter, the side panel, rendering
173
+ toggles and the opponent store; `m.ENGINE` stays `None` throughout, so nothing
174
+ is spawned. CI runs it on 3.10-3.13 (`.github/workflows/tests.yml`).
175
+
176
+ ## Notes
177
+
178
+ An LLM without search plays around 1000–1500 Elo: fine openings, tactical
179
+ blunders later. It cannot play an illegal move — every legal move is enumerated
180
+ locally and the reply is validated — but it can play badly.
181
+
182
+ ## License
183
+
184
+ MIT — see [LICENSE](LICENSE). Built by [Jude](https://github.com/Helios1919).
@@ -0,0 +1,7 @@
1
+ clichess.py,sha256=akuKVFwRBPM_sARDTR_m8ECm99SRdgVExt7tTcqH9TM,60643
2
+ clichess_cli-0.9.0.dist-info/licenses/LICENSE,sha256=NfshqVxiL3mLxs6QOeGJheRCTMtMxMx01P7zXI9DWhw,1061
3
+ clichess_cli-0.9.0.dist-info/METADATA,sha256=dp9S_q4ANZ5ncKeqOsK2DBH8eZfTrk4wSG9itF4hVvo,7265
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