lemonpie-cli 0.2.0rc2__tar.gz → 0.3.0__tar.gz
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.
- lemonpie_cli-0.3.0/.release-please/manifest.json +3 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/CHANGELOG.md +18 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/PKG-INFO +23 -21
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/README.md +20 -17
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/docs/ROADMAP.md +9 -2
- lemonpie_cli-0.3.0/docs/config.example.json +10 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/docs/design/code-completion.md +1 -1
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/docs/design/model-verification.md +1 -1
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/docs/design/packaging.md +0 -2
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/docs/usage/command-index.md +2 -2
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/pyproject.toml +2 -3
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/_version.py +2 -2
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/cli/config_cmd.py +119 -45
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/cli/ui.py +1 -1
- lemonpie_cli-0.3.0/src/lemonpie/client.py +120 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/config.py +6 -2
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/main.py +57 -26
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/paths.py +5 -10
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/sessions/storage.py +65 -19
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/tests/conftest.py +13 -11
- lemonpie_cli-0.3.0/tests/test_client.py +207 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/tests/test_config_cmd.py +184 -145
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/tests/test_sessions.py +27 -11
- lemonpie_cli-0.3.0/uv.lock +172 -0
- lemonpie_cli-0.2.0rc2/.release-please/manifest.json +0 -3
- lemonpie_cli-0.2.0rc2/docs/config.example.json +0 -5
- lemonpie_cli-0.2.0rc2/src/lemonpie/engine/ollama.py +0 -49
- lemonpie_cli-0.2.0rc2/src/lemonpie/sessions/__init__.py +0 -0
- lemonpie_cli-0.2.0rc2/uv.lock +0 -325
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/.github/workflows/ci.yml +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/.github/workflows/release.yml +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/.gitignore +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/.release-please/config.json +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/LICENSE +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/__init__.py +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/cli/__init__.py +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/cli/parser.py +0 -0
- {lemonpie_cli-0.2.0rc2/src/lemonpie/engine → lemonpie_cli-0.3.0/src/lemonpie}/models.py +0 -0
- {lemonpie_cli-0.2.0rc2/src/lemonpie/engine → lemonpie_cli-0.3.0/src/lemonpie/sessions}/__init__.py +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/src/lemonpie/time_utils.py +0 -0
- {lemonpie_cli-0.2.0rc2 → lemonpie_cli-0.3.0}/tests/test_cli.py +0 -0
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0](https://github.com/famousStratum/LemonPie/compare/v0.2.0...v0.3.0) (2026-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* add multi-backend support for OpenAI-compatible inference servers ([#42](https://github.com/famousStratum/LemonPie/issues/42))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add multi-backend support for OpenAI-compatible inference servers ([#42](https://github.com/famousStratum/LemonPie/issues/42)) ([f1cadb6](https://github.com/famousStratum/LemonPie/commit/f1cadb622fdacf4c1e48074e094f27cb62aa79b8))
|
|
13
|
+
|
|
14
|
+
## [0.2.0](https://github.com/famousStratum/LemonPie/compare/v0.2.0-rc2...v0.2.0) (2026-11-11)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Documentation
|
|
18
|
+
|
|
19
|
+
* Make all links absolute in README.md ([#40](https://github.com/famousStratum/LemonPie/issues/40)) ([3ec603e](https://github.com/famousStratum/LemonPie/commit/3ec603e4861008303ccdedc6736dbb178fe52c8c))
|
|
20
|
+
|
|
3
21
|
## [0.2.0-rc2](https://github.com/famousStratum/LemonPie/compare/v0.2.0-rc1...v0.2.0-rc2) (2026-11-01)
|
|
4
22
|
|
|
5
23
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: lemonpie-cli
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: LemonPie — A lightweight
|
|
5
|
-
Project-URL: homepage, https://versicode.com/
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: LemonPie — A lightweight CLI for LLM inference servers
|
|
5
|
+
Project-URL: homepage, https://versicode.com/projects/lemon-pie
|
|
6
6
|
Project-URL: repository, https://github.com/famousStratum/LemonPie
|
|
7
7
|
Project-URL: issues, https://github.com/famousStratum/LemonPie/issues
|
|
8
8
|
Author-email: famousStratum <info@versicode.com>
|
|
@@ -14,7 +14,6 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Requires-Python: >=3.11
|
|
16
16
|
Requires-Dist: httpx
|
|
17
|
-
Requires-Dist: ollama
|
|
18
17
|
Requires-Dist: platformdirs
|
|
19
18
|
Description-Content-Type: text/markdown
|
|
20
19
|
|
|
@@ -24,21 +23,22 @@ Description-Content-Type: text/markdown
|
|
|
24
23
|

|
|
25
24
|

|
|
26
25
|
|
|
27
|
-
**LemonPie — A lightweight
|
|
26
|
+
**LemonPie — A lightweight CLI for LLM inference servers**
|
|
28
27
|
|
|
29
|
-
LemonPie is a compact CLI for
|
|
28
|
+
LemonPie is a compact CLI for chatting with any OpenAI-compatible inference server — Ollama, llama.cpp, LM Studio, vLLM, and others. It manages chat sessions and persists history locally, designed to be tiny and portable — ideal for lightweight systems and terminal users, but usable anywhere with Python and network access.
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
## ✨ Features
|
|
34
|
-
-
|
|
33
|
+
- Works with any OpenAI-compatible backend — Ollama, llama.cpp, LM Studio, vLLM, and more
|
|
34
|
+
- Start and manage chat sessions with any configured model
|
|
35
35
|
- Persist session history in your OS's standard user data directory
|
|
36
|
-
- Configure host, default model, and aliases via a config file in your OS's standard user config directory
|
|
37
|
-
- Interactive setup wizard (`lmConfig --init`)
|
|
36
|
+
- Configure host, backend, API key, default model, and aliases via a config file in your OS's standard user config directory
|
|
37
|
+
- Interactive setup wizard (`lmConfig --init`) — select backend, configure server, verify reachability, and register models
|
|
38
38
|
- Add, remove, and list models with aliases (`lmConfig`)
|
|
39
39
|
- Switch models mid‑session with confirmation
|
|
40
40
|
- Atomic writes for safety (tmp + replace)
|
|
41
|
-
- Streaming responses
|
|
41
|
+
- Streaming responses for real‑time output
|
|
42
42
|
- Graceful handling of Ctrl‑C interrupts
|
|
43
43
|
|
|
44
44
|
|
|
@@ -53,13 +53,12 @@ LemonPie/
|
|
|
53
53
|
│ ├── config.py # Configuration logic & I/O
|
|
54
54
|
│ ├── paths.py # OS-appropriate config/data directory resolution
|
|
55
55
|
│ ├── time_utils.py # Timestamp helpers
|
|
56
|
+
│ ├── client.py # HTTP client & error handling
|
|
57
|
+
│ ├── models.py # Model finding & resolution
|
|
56
58
|
│ ├── cli/
|
|
57
59
|
│ │ ├── parser.py # Argument parsing (lm)
|
|
58
60
|
│ │ ├── ui.py # Terminal helpers & confirmation
|
|
59
61
|
│ │ └── config_cmd.py # Config manager (entrypoint: lmConfig)
|
|
60
|
-
│ ├── engine/
|
|
61
|
-
│ │ ├── models.py # Model finding & resolution
|
|
62
|
-
│ │ └── ollama.py # Ollama client interaction
|
|
63
62
|
│ └── sessions/
|
|
64
63
|
│ └── storage.py # Session persistence
|
|
65
64
|
├── tests/ # pytest suite
|
|
@@ -84,14 +83,16 @@ LemonPie keeps its config file and session history in your OS's standard user di
|
|
|
84
83
|
| Windows | `%LOCALAPPDATA%\lemonpie\` | `%LOCALAPPDATA%\lemonpie\sessions\` |
|
|
85
84
|
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
All three are overridable via environment variables — `LEMONPIE_HOST`, `LEMONPIE_CONFIG_DIR`, and `LEMONPIE_SESSION_DIR` — useful for testing or running in a container.
|
|
88
87
|
|
|
89
88
|
`docs/config.example.json` is a template. Run `lmConfig --init` to set up your config interactively — it verifies server reachability, lists installed models for selection, and writes the file for you. `lmConfig` also auto-creates a minimal config on first use if you prefer to configure manually.
|
|
90
89
|
|
|
91
90
|
### Example structure:
|
|
92
91
|
```json
|
|
93
92
|
{
|
|
94
|
-
"
|
|
93
|
+
"backend": "ollama",
|
|
94
|
+
"server": "http://localhost:11434",
|
|
95
|
+
"api_key": null,
|
|
95
96
|
"default": "qwen2.5-coder:3b",
|
|
96
97
|
"models": [
|
|
97
98
|
{ "alias": "qwen", "name": "qwen2.5-coder:3b" },
|
|
@@ -99,8 +100,10 @@ Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LE
|
|
|
99
100
|
]
|
|
100
101
|
}
|
|
101
102
|
```
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
backend: which inference server you're using (e.g. `ollama`, `llamacpp`, `lmstudio`) \
|
|
104
|
+
server: base URL of your inference server \
|
|
105
|
+
api_key: optional API key for hosted backends (e.g. OpenAI) \
|
|
106
|
+
default: canonical model name (full identifier) \
|
|
104
107
|
models: list of objects with alias (nullable) and name
|
|
105
108
|
|
|
106
109
|
## 🚀 Usage
|
|
@@ -135,7 +138,7 @@ models: list of objects with alias (nullable) and name
|
|
|
135
138
|
`lmConfig --list-models`\
|
|
136
139
|
`lmConfig --remove-model qwen`
|
|
137
140
|
|
|
138
|
-
👉 Full [command reference](docs/usage/command-index.md).
|
|
141
|
+
👉 Full [command reference](https://github.com/famousStratum/LemonPie/blob/main/docs/usage/command-index.md).
|
|
139
142
|
|
|
140
143
|
## 🗺 Roadmap
|
|
141
144
|
|
|
@@ -143,12 +146,11 @@ Planned features and improvements:
|
|
|
143
146
|
|
|
144
147
|
- Code completion (autocomplete)
|
|
145
148
|
- Model verification state machine
|
|
146
|
-
- Enhanced error handling and user feedback
|
|
147
149
|
- Cross‑platform packaging (apt, winget, Homebrew)
|
|
148
150
|
- Future schema validation for config/session files
|
|
149
151
|
|
|
150
|
-
👉 See the full [roadmap](docs/ROADMAP.md) for details.
|
|
152
|
+
👉 See the full [roadmap](https://github.com/famousStratum/LemonPie/blob/main/docs/ROADMAP.md) for details.
|
|
151
153
|
|
|
152
154
|
## 📜 License
|
|
153
155
|
|
|
154
|
-
This project is licensed under the **GNU General Public License v3.0** (**GPLv3**).You may redistribute and/or modify it under the terms of the GPL as published by the Free Software Foundation.See the [**license**](LICENSE) file for details.
|
|
156
|
+
This project is licensed under the **GNU General Public License v3.0** (**GPLv3**).You may redistribute and/or modify it under the terms of the GPL as published by the Free Software Foundation.See the [**license**](https://github.com/famousStratum/LemonPie/blob/main/LICENSE) file for details.
|
|
@@ -4,21 +4,22 @@
|
|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
**LemonPie — A lightweight
|
|
7
|
+
**LemonPie — A lightweight CLI for LLM inference servers**
|
|
8
8
|
|
|
9
|
-
LemonPie is a compact CLI for
|
|
9
|
+
LemonPie is a compact CLI for chatting with any OpenAI-compatible inference server — Ollama, llama.cpp, LM Studio, vLLM, and others. It manages chat sessions and persists history locally, designed to be tiny and portable — ideal for lightweight systems and terminal users, but usable anywhere with Python and network access.
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
## ✨ Features
|
|
14
|
-
-
|
|
14
|
+
- Works with any OpenAI-compatible backend — Ollama, llama.cpp, LM Studio, vLLM, and more
|
|
15
|
+
- Start and manage chat sessions with any configured model
|
|
15
16
|
- Persist session history in your OS's standard user data directory
|
|
16
|
-
- Configure host, default model, and aliases via a config file in your OS's standard user config directory
|
|
17
|
-
- Interactive setup wizard (`lmConfig --init`)
|
|
17
|
+
- Configure host, backend, API key, default model, and aliases via a config file in your OS's standard user config directory
|
|
18
|
+
- Interactive setup wizard (`lmConfig --init`) — select backend, configure server, verify reachability, and register models
|
|
18
19
|
- Add, remove, and list models with aliases (`lmConfig`)
|
|
19
20
|
- Switch models mid‑session with confirmation
|
|
20
21
|
- Atomic writes for safety (tmp + replace)
|
|
21
|
-
- Streaming responses
|
|
22
|
+
- Streaming responses for real‑time output
|
|
22
23
|
- Graceful handling of Ctrl‑C interrupts
|
|
23
24
|
|
|
24
25
|
|
|
@@ -33,13 +34,12 @@ LemonPie/
|
|
|
33
34
|
│ ├── config.py # Configuration logic & I/O
|
|
34
35
|
│ ├── paths.py # OS-appropriate config/data directory resolution
|
|
35
36
|
│ ├── time_utils.py # Timestamp helpers
|
|
37
|
+
│ ├── client.py # HTTP client & error handling
|
|
38
|
+
│ ├── models.py # Model finding & resolution
|
|
36
39
|
│ ├── cli/
|
|
37
40
|
│ │ ├── parser.py # Argument parsing (lm)
|
|
38
41
|
│ │ ├── ui.py # Terminal helpers & confirmation
|
|
39
42
|
│ │ └── config_cmd.py # Config manager (entrypoint: lmConfig)
|
|
40
|
-
│ ├── engine/
|
|
41
|
-
│ │ ├── models.py # Model finding & resolution
|
|
42
|
-
│ │ └── ollama.py # Ollama client interaction
|
|
43
43
|
│ └── sessions/
|
|
44
44
|
│ └── storage.py # Session persistence
|
|
45
45
|
├── tests/ # pytest suite
|
|
@@ -64,14 +64,16 @@ LemonPie keeps its config file and session history in your OS's standard user di
|
|
|
64
64
|
| Windows | `%LOCALAPPDATA%\lemonpie\` | `%LOCALAPPDATA%\lemonpie\sessions\` |
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
All three are overridable via environment variables — `LEMONPIE_HOST`, `LEMONPIE_CONFIG_DIR`, and `LEMONPIE_SESSION_DIR` — useful for testing or running in a container.
|
|
68
68
|
|
|
69
69
|
`docs/config.example.json` is a template. Run `lmConfig --init` to set up your config interactively — it verifies server reachability, lists installed models for selection, and writes the file for you. `lmConfig` also auto-creates a minimal config on first use if you prefer to configure manually.
|
|
70
70
|
|
|
71
71
|
### Example structure:
|
|
72
72
|
```json
|
|
73
73
|
{
|
|
74
|
-
"
|
|
74
|
+
"backend": "ollama",
|
|
75
|
+
"server": "http://localhost:11434",
|
|
76
|
+
"api_key": null,
|
|
75
77
|
"default": "qwen2.5-coder:3b",
|
|
76
78
|
"models": [
|
|
77
79
|
{ "alias": "qwen", "name": "qwen2.5-coder:3b" },
|
|
@@ -79,8 +81,10 @@ Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LE
|
|
|
79
81
|
]
|
|
80
82
|
}
|
|
81
83
|
```
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
backend: which inference server you're using (e.g. `ollama`, `llamacpp`, `lmstudio`) \
|
|
85
|
+
server: base URL of your inference server \
|
|
86
|
+
api_key: optional API key for hosted backends (e.g. OpenAI) \
|
|
87
|
+
default: canonical model name (full identifier) \
|
|
84
88
|
models: list of objects with alias (nullable) and name
|
|
85
89
|
|
|
86
90
|
## 🚀 Usage
|
|
@@ -115,7 +119,7 @@ models: list of objects with alias (nullable) and name
|
|
|
115
119
|
`lmConfig --list-models`\
|
|
116
120
|
`lmConfig --remove-model qwen`
|
|
117
121
|
|
|
118
|
-
👉 Full [command reference](docs/usage/command-index.md).
|
|
122
|
+
👉 Full [command reference](https://github.com/famousStratum/LemonPie/blob/main/docs/usage/command-index.md).
|
|
119
123
|
|
|
120
124
|
## 🗺 Roadmap
|
|
121
125
|
|
|
@@ -123,12 +127,11 @@ Planned features and improvements:
|
|
|
123
127
|
|
|
124
128
|
- Code completion (autocomplete)
|
|
125
129
|
- Model verification state machine
|
|
126
|
-
- Enhanced error handling and user feedback
|
|
127
130
|
- Cross‑platform packaging (apt, winget, Homebrew)
|
|
128
131
|
- Future schema validation for config/session files
|
|
129
132
|
|
|
130
|
-
👉 See the full [roadmap](docs/ROADMAP.md) for details.
|
|
133
|
+
👉 See the full [roadmap](https://github.com/famousStratum/LemonPie/blob/main/docs/ROADMAP.md) for details.
|
|
131
134
|
|
|
132
135
|
## 📜 License
|
|
133
136
|
|
|
134
|
-
This project is licensed under the **GNU General Public License v3.0** (**GPLv3**).You may redistribute and/or modify it under the terms of the GPL as published by the Free Software Foundation.See the [**license**](LICENSE) file for details.
|
|
137
|
+
This project is licensed under the **GNU General Public License v3.0** (**GPLv3**).You may redistribute and/or modify it under the terms of the GPL as published by the Free Software Foundation.See the [**license**](https://github.com/famousStratum/LemonPie/blob/main/LICENSE) file for details.
|
|
@@ -27,8 +27,15 @@ Planned logic for `lmConfig --add-model`:
|
|
|
27
27
|
|
|
28
28
|
<sub>*See* docs/design/[code-completion.md](design/code-completion.md) *for brainstorming and design notes.* </sub>
|
|
29
29
|
|
|
30
|
-
## Enhanced error handling and user feedback
|
|
31
|
-
-
|
|
30
|
+
## ~~Enhanced error handling and user feedback~~ ✅ Done
|
|
31
|
+
- Connection refused, timeout, DNS, and protocol errors with actionable hints
|
|
32
|
+
- Tightened exception handling throughout
|
|
33
|
+
|
|
34
|
+
## Multi-backend support ✅ Done
|
|
35
|
+
- Unified OpenAI-compatible HTTP client (`/v1/chat/completions`) works with Ollama, llama.cpp, LM Studio, vLLM, and any compatible server
|
|
36
|
+
- `backend` field in config for identification and hints
|
|
37
|
+
- Optional `api_key` support for hosted APIs
|
|
38
|
+
- `lmConfig --init` guides users through backend selection and server setup
|
|
32
39
|
|
|
33
40
|
## Future schema validation
|
|
34
41
|
- Config/session file validation
|
|
@@ -30,7 +30,7 @@ If you cannot produce code, output an empty string.
|
|
|
30
30
|
|
|
31
31
|
**lmConfig commands:**
|
|
32
32
|
- `lmConfig --set-default-autocomplete <model>` to set the default.
|
|
33
|
-
- `lmConfig --add-model` and the existing state machine should verify the model is available on the
|
|
33
|
+
- `lmConfig --add-model` and the existing state machine should verify the model is available on the server.
|
|
34
34
|
|
|
35
35
|
**Behavior:** If `--model` is passed on the CLI it overrides the default; otherwise use `default_autocomplete_model`.
|
|
36
36
|
|
|
@@ -8,7 +8,7 @@ It defines how LemonPie should handle server reachability, model installation, a
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
## 🎯 Goals
|
|
11
|
-
- Ensure models are verified against the
|
|
11
|
+
- Ensure models are verified against the server before being added.
|
|
12
12
|
- Provide clear user feedback for success/failure cases.
|
|
13
13
|
- Support `--force` as a broad override mechanism (alias conflicts, skipping verification).
|
|
14
14
|
- Keep logic predictable and extensible for future improvements.
|
|
@@ -18,7 +18,6 @@ It is intended as a **whiteboard for brainstorming** CI/CD flows, signing, and r
|
|
|
18
18
|
- Build `.deb` packages using `dpkg-buildpackage` or `debhelper`.
|
|
19
19
|
- Host packages in a PPA or custom apt repository.
|
|
20
20
|
- Automate publishing with GitHub Actions.
|
|
21
|
-
- Consider dependency handling (Python, Ollama client).
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
## 🪟 Windows (winget)
|
|
@@ -31,7 +30,6 @@ It is intended as a **whiteboard for brainstorming** CI/CD flows, signing, and r
|
|
|
31
30
|
## 🍎 macOS (Homebrew)
|
|
32
31
|
- Write a Homebrew formula pointing to GitHub releases.
|
|
33
32
|
- Support `brew install lemonpie`.
|
|
34
|
-
- Handle dependencies (Python, Ollama client).
|
|
35
33
|
- Automate formula updates via CI/CD.
|
|
36
34
|
|
|
37
35
|
|
|
@@ -8,9 +8,9 @@ Useful for both **users** (cheat sheet) and **developers** (tracking CLI surface
|
|
|
8
8
|
## lmConfig
|
|
9
9
|
Manage LemonPie configuration (`config.json`).
|
|
10
10
|
|
|
11
|
-
- `--init` — Interactive setup wizard:
|
|
11
|
+
- `--init` — Interactive setup wizard: select backend, configure server URL (local default or custom), verify reachability, list and select installed models, optionally set a default
|
|
12
12
|
- `--init --force` — Same as `--init` but skip server verification
|
|
13
|
-
- `--host <url>` — Set
|
|
13
|
+
- `--host <url>` — Set server host URL (`http(s)://host:port`)
|
|
14
14
|
- `--default-model <name>` — Set default model using alias or full name (must exist in models)
|
|
15
15
|
- `--add-model <alias> <model>` — Add model mapping: alias → model_full_name
|
|
16
16
|
- `--remove-model <identifier>` — Remove a model mapping by alias or full name
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "lemonpie-cli"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
description = "LemonPie — A lightweight
|
|
8
|
+
description = "LemonPie — A lightweight CLI for LLM inference servers"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "famousStratum", email = "info@versicode.com" }
|
|
11
11
|
]
|
|
@@ -20,13 +20,12 @@ classifiers = [
|
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
dependencies = [
|
|
23
|
-
"ollama",
|
|
24
23
|
"httpx",
|
|
25
24
|
"platformdirs"
|
|
26
25
|
]
|
|
27
26
|
|
|
28
27
|
[project.urls]
|
|
29
|
-
homepage = "https://versicode.com/
|
|
28
|
+
homepage = "https://versicode.com/projects/lemon-pie"
|
|
30
29
|
repository = "https://github.com/famousStratum/LemonPie"
|
|
31
30
|
issues = "https://github.com/famousStratum/LemonPie/issues"
|
|
32
31
|
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0,
|
|
21
|
+
__version__ = version = '0.3.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 3, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -4,7 +4,7 @@ config_cmd.py (alias: lmConfig) — CLI for managing LemonPie configuration.
|
|
|
4
4
|
|
|
5
5
|
Usage examples:
|
|
6
6
|
lmConfig --init # Interactive setup wizard
|
|
7
|
-
lmConfig --host http://127.0.0.1:11434 # Set
|
|
7
|
+
lmConfig --host http://127.0.0.1:11434 # Set server URL
|
|
8
8
|
lmConfig --add-model qwen qwen2.5-coder:3b # Map an alias to a model
|
|
9
9
|
lmConfig --add-model qwen qwen2.5:1.5b --force # Reassign an existing alias
|
|
10
10
|
lmConfig --default-model qwen # Set default by alias or name
|
|
@@ -27,7 +27,7 @@ from lemonpie.config import (
|
|
|
27
27
|
load_config,
|
|
28
28
|
save_config,
|
|
29
29
|
)
|
|
30
|
-
from lemonpie.
|
|
30
|
+
from lemonpie.models import (
|
|
31
31
|
find_by_alias,
|
|
32
32
|
find_by_name,
|
|
33
33
|
)
|
|
@@ -36,26 +36,70 @@ from lemonpie.engine.models import (
|
|
|
36
36
|
# lmConfig --init helpers
|
|
37
37
|
# ---------------------------------------------------------------------------
|
|
38
38
|
|
|
39
|
+
KNOWN_BACKENDS = [
|
|
40
|
+
{"name": "llamacpp", "label": "llama.cpp", "port": 9931},
|
|
41
|
+
{"name": "ollama", "label": "Ollama", "port": 11434},
|
|
42
|
+
{"name": "lmstudio", "label": "LM Studio", "port": 1234},
|
|
43
|
+
{"name": None, "label": "Other", "port": None},
|
|
44
|
+
]
|
|
39
45
|
|
|
40
|
-
def fetch_ollama_models(server):
|
|
41
|
-
"""GET /api/tags and return (list_of_name_strings, error_str_or_None).
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
def _prompt_backend():
|
|
48
|
+
"""Ask which backend the user is using.
|
|
49
|
+
|
|
50
|
+
Returns (backend_name, default_port). Both are None for 'Other'.
|
|
45
51
|
"""
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
print("Which backend are you using?")
|
|
53
|
+
for i, b in enumerate(KNOWN_BACKENDS, 1):
|
|
54
|
+
print(f" {i}. {b['label']}")
|
|
55
|
+
|
|
56
|
+
while True:
|
|
57
|
+
raw = input(f" Enter number (1-{len(KNOWN_BACKENDS)}): ").strip()
|
|
58
|
+
try:
|
|
59
|
+
idx = int(raw) - 1
|
|
60
|
+
if 0 <= idx < len(KNOWN_BACKENDS):
|
|
61
|
+
b = KNOWN_BACKENDS[idx]
|
|
62
|
+
return b["name"], b["port"]
|
|
63
|
+
except ValueError:
|
|
64
|
+
pass
|
|
65
|
+
print(f" Invalid choice, enter 1-{len(KNOWN_BACKENDS)}.")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _prompt_custom_url(hint=None):
|
|
69
|
+
"""Prompt for a custom server URL with an optional example hint."""
|
|
70
|
+
prompt = f" Server URL ({hint}): " if hint else " Server URL: "
|
|
71
|
+
while True:
|
|
72
|
+
raw = input(prompt).strip()
|
|
73
|
+
if is_valid_url(raw):
|
|
74
|
+
return raw
|
|
75
|
+
print(" Invalid URL. Must start with http:// or https://.")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _prompt_server(default_port):
|
|
79
|
+
"""Ask if the server is local or remote, return server URL."""
|
|
80
|
+
is_local = confirm("Is your server running on this machine?")
|
|
81
|
+
|
|
82
|
+
if is_local:
|
|
83
|
+
if default_port:
|
|
84
|
+
default_url = f"http://localhost:{default_port}"
|
|
85
|
+
print(f"\n 1. Default ({default_url})")
|
|
86
|
+
print(" 2. Custom")
|
|
87
|
+
while True:
|
|
88
|
+
raw = input(" Enter number (1-2): ").strip()
|
|
89
|
+
if raw == "1":
|
|
90
|
+
return default_url
|
|
91
|
+
if raw == "2":
|
|
92
|
+
return _prompt_custom_url()
|
|
93
|
+
print(" Invalid choice, enter 1 or 2.")
|
|
94
|
+
else:
|
|
95
|
+
return _prompt_custom_url()
|
|
96
|
+
else:
|
|
97
|
+
hint = (
|
|
98
|
+
f"e.g. http://192.168.1.1:{default_port}"
|
|
99
|
+
if default_port
|
|
100
|
+
else "e.g. http://192.168.1.1:<port>"
|
|
101
|
+
)
|
|
102
|
+
return _prompt_custom_url(hint=hint)
|
|
59
103
|
|
|
60
104
|
|
|
61
105
|
def _prompt_model_selection(available_models):
|
|
@@ -143,6 +187,32 @@ def _prompt_default(models):
|
|
|
143
187
|
print(f" Invalid choice, enter 1-{len(models)}.")
|
|
144
188
|
|
|
145
189
|
|
|
190
|
+
# ---------------------------------------------------------------------------
|
|
191
|
+
# Server discovery
|
|
192
|
+
# ---------------------------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def fetch_available_models(server):
|
|
196
|
+
"""GET /v1/models and return (list_of_name_strings, error_str_or_None).
|
|
197
|
+
|
|
198
|
+
Used by cmd_init to verify server reachability and discover installed
|
|
199
|
+
models in a single round-trip.
|
|
200
|
+
"""
|
|
201
|
+
try:
|
|
202
|
+
resp = httpx.get(f"{server.rstrip('/')}/v1/models", timeout=5.0)
|
|
203
|
+
resp.raise_for_status()
|
|
204
|
+
data = resp.json()
|
|
205
|
+
return [m["id"] for m in data.get("data", [])], None
|
|
206
|
+
except httpx.ConnectError:
|
|
207
|
+
return [], "Connection refused"
|
|
208
|
+
except httpx.TimeoutException:
|
|
209
|
+
return [], "Connection timed out"
|
|
210
|
+
except httpx.HTTPError as exc:
|
|
211
|
+
return [], f"HTTP error: {exc}"
|
|
212
|
+
except (json.JSONDecodeError, KeyError, TypeError) as exc:
|
|
213
|
+
return [], f"Invalid response format from server, {exc}"
|
|
214
|
+
|
|
215
|
+
|
|
146
216
|
# ---------------------------------------------------------------------------
|
|
147
217
|
# lmConfig --init
|
|
148
218
|
# ---------------------------------------------------------------------------
|
|
@@ -154,16 +224,17 @@ def cmd_init(force=False):
|
|
|
154
224
|
Steps
|
|
155
225
|
-----
|
|
156
226
|
1. Warn if a config already exists; ask for confirmation to overwrite.
|
|
157
|
-
2. Prompt for
|
|
158
|
-
3.
|
|
227
|
+
2. Prompt for backend selection.
|
|
228
|
+
3. Prompt for server URL — local (default or custom) or remote.
|
|
229
|
+
4. Unless ``--force``, verify server reachability via ``GET /v1/models``.
|
|
159
230
|
- If reachable: present the installed-model list for selection.
|
|
160
231
|
- If unreachable: offer to continue without verification.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
232
|
+
5. If no server models are available, offer manual model entry.
|
|
233
|
+
6. Optionally set a default model.
|
|
234
|
+
7. Save and print a summary.
|
|
164
235
|
|
|
165
|
-
``--force`` skips step
|
|
166
|
-
during setup
|
|
236
|
+
``--force`` skips step 4 entirely (useful when the server is offline
|
|
237
|
+
during setup).
|
|
167
238
|
"""
|
|
168
239
|
path = config_file_path()
|
|
169
240
|
if os.path.exists(path):
|
|
@@ -175,18 +246,18 @@ def cmd_init(force=False):
|
|
|
175
246
|
print("\nLemonPie setup\n")
|
|
176
247
|
|
|
177
248
|
# ------------------------------------------------------------------
|
|
178
|
-
# Step 1:
|
|
249
|
+
# Step 1: Backend
|
|
179
250
|
# ------------------------------------------------------------------
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
251
|
+
backend, default_port = _prompt_backend()
|
|
252
|
+
|
|
253
|
+
# ------------------------------------------------------------------
|
|
254
|
+
# Step 2: Server URL
|
|
255
|
+
# ------------------------------------------------------------------
|
|
256
|
+
print()
|
|
257
|
+
server = _prompt_server(default_port)
|
|
187
258
|
|
|
188
259
|
# ------------------------------------------------------------------
|
|
189
|
-
# Step
|
|
260
|
+
# Step 3: Verify server & discover models
|
|
190
261
|
# ------------------------------------------------------------------
|
|
191
262
|
available_models: list[str] = []
|
|
192
263
|
server_ok = False
|
|
@@ -195,7 +266,7 @@ def cmd_init(force=False):
|
|
|
195
266
|
print(" Skipping server verification (--force).")
|
|
196
267
|
else:
|
|
197
268
|
print(f" Connecting to {server} ...", end="", flush=True)
|
|
198
|
-
available_models, err =
|
|
269
|
+
available_models, err = fetch_available_models(server)
|
|
199
270
|
if err:
|
|
200
271
|
print(f" failed.\n {err}")
|
|
201
272
|
if not confirm(" Continue without verification?"):
|
|
@@ -208,7 +279,7 @@ def cmd_init(force=False):
|
|
|
208
279
|
print(f" OK ({label})")
|
|
209
280
|
|
|
210
281
|
# ------------------------------------------------------------------
|
|
211
|
-
# Step
|
|
282
|
+
# Step 4: Select / add models
|
|
212
283
|
# ------------------------------------------------------------------
|
|
213
284
|
models: list[dict] = []
|
|
214
285
|
|
|
@@ -216,26 +287,29 @@ def cmd_init(force=False):
|
|
|
216
287
|
models = _prompt_model_selection(available_models)
|
|
217
288
|
else:
|
|
218
289
|
if server_ok:
|
|
219
|
-
# Reachable but empty — give actionable guidance.
|
|
220
290
|
print(" No models are installed on this server.")
|
|
221
|
-
print(" Run `ollama pull <model>` to install one, then")
|
|
222
|
-
print(" use `lmConfig --add-model <alias> <name>` to register it.")
|
|
223
|
-
|
|
224
291
|
if confirm(" Add a model manually?"):
|
|
225
292
|
models = _prompt_model_manual()
|
|
226
293
|
|
|
227
294
|
# ------------------------------------------------------------------
|
|
228
|
-
# Step
|
|
295
|
+
# Step 5: Default model
|
|
229
296
|
# ------------------------------------------------------------------
|
|
230
297
|
default = _prompt_default(models)
|
|
231
298
|
|
|
232
299
|
# ------------------------------------------------------------------
|
|
233
|
-
# Step
|
|
300
|
+
# Step 6: Save & summarise
|
|
234
301
|
# ------------------------------------------------------------------
|
|
235
|
-
cfg = {
|
|
302
|
+
cfg = {
|
|
303
|
+
"backend": backend,
|
|
304
|
+
"server": server,
|
|
305
|
+
"api_key": None,
|
|
306
|
+
"default": default,
|
|
307
|
+
"models": models,
|
|
308
|
+
}
|
|
236
309
|
save_config(cfg)
|
|
237
310
|
|
|
238
311
|
print("\nConfig saved.")
|
|
312
|
+
print(f" Backend: {backend or 'other'}")
|
|
239
313
|
print(f" Server : {server}")
|
|
240
314
|
print(f" Default: {default or '<none>'}")
|
|
241
315
|
if models:
|
|
@@ -454,7 +528,7 @@ def build_parser():
|
|
|
454
528
|
action="store_true",
|
|
455
529
|
help="Interactive setup wizard: create or reinitialize config.json",
|
|
456
530
|
)
|
|
457
|
-
parser.add_argument("--host", help="Set
|
|
531
|
+
parser.add_argument("--host", help="Set server host URL (http(s)://host:port)")
|
|
458
532
|
parser.add_argument(
|
|
459
533
|
"--default-model",
|
|
460
534
|
help="Set default model using alias or full name (must exist in models)",
|