lemonpie-cli 0.2.0rc1__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.
Files changed (42) hide show
  1. lemonpie_cli-0.3.0/.release-please/manifest.json +3 -0
  2. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/CHANGELOG.md +31 -0
  3. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/PKG-INFO +45 -61
  4. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/README.md +42 -57
  5. lemonpie_cli-0.3.0/docs/ROADMAP.md +41 -0
  6. lemonpie_cli-0.3.0/docs/config.example.json +10 -0
  7. lemonpie_cli-0.3.0/docs/design/code-completion.md +108 -0
  8. lemonpie_cli-0.2.0rc1/docs/design/state-machine.md → lemonpie_cli-0.3.0/docs/design/model-verification.md +4 -2
  9. lemonpie_cli-0.3.0/docs/design/packaging.md +88 -0
  10. lemonpie_cli-0.3.0/docs/usage/command-index.md +44 -0
  11. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/pyproject.toml +2 -3
  12. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/_version.py +2 -2
  13. lemonpie_cli-0.3.0/src/lemonpie/cli/config_cmd.py +601 -0
  14. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/cli/ui.py +1 -1
  15. lemonpie_cli-0.3.0/src/lemonpie/client.py +120 -0
  16. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/config.py +35 -5
  17. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/main.py +68 -42
  18. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/paths.py +6 -10
  19. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/sessions/storage.py +72 -22
  20. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/time_utils.py +4 -3
  21. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/tests/conftest.py +15 -14
  22. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/tests/test_cli.py +10 -0
  23. lemonpie_cli-0.3.0/tests/test_client.py +207 -0
  24. lemonpie_cli-0.3.0/tests/test_config_cmd.py +478 -0
  25. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/tests/test_sessions.py +27 -12
  26. lemonpie_cli-0.3.0/uv.lock +172 -0
  27. lemonpie_cli-0.2.0rc1/.release-please/manifest.json +0 -3
  28. lemonpie_cli-0.2.0rc1/docs/config.example.json +0 -5
  29. lemonpie_cli-0.2.0rc1/src/lemonpie/cli/config_cmd.py +0 -246
  30. lemonpie_cli-0.2.0rc1/src/lemonpie/engine/ollama.py +0 -49
  31. lemonpie_cli-0.2.0rc1/src/lemonpie/sessions/__init__.py +0 -0
  32. lemonpie_cli-0.2.0rc1/uv.lock +0 -325
  33. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/.github/workflows/ci.yml +0 -0
  34. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/.github/workflows/release.yml +0 -0
  35. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/.gitignore +0 -0
  36. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/.release-please/config.json +0 -0
  37. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/LICENSE +0 -0
  38. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/__init__.py +0 -0
  39. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/cli/__init__.py +0 -0
  40. {lemonpie_cli-0.2.0rc1 → lemonpie_cli-0.3.0}/src/lemonpie/cli/parser.py +0 -0
  41. {lemonpie_cli-0.2.0rc1/src/lemonpie/engine → lemonpie_cli-0.3.0/src/lemonpie}/models.py +0 -0
  42. {lemonpie_cli-0.2.0rc1/src/lemonpie/engine → lemonpie_cli-0.3.0/src/lemonpie/sessions}/__init__.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.3.0"
3
+ }
@@ -1,5 +1,36 @@
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
+
21
+ ## [0.2.0-rc2](https://github.com/famousStratum/LemonPie/compare/v0.2.0-rc1...v0.2.0-rc2) (2026-11-01)
22
+
23
+
24
+ ### Features
25
+
26
+ * lmConfig --init — interactive setup wizard ([#37](https://github.com/famousStratum/LemonPie/issues/37)) ([a9cc56d](https://github.com/famousStratum/LemonPie/commit/a9cc56db38ee17735fbdd6d607a34cd06e352372))
27
+
28
+
29
+ ### Documentation
30
+
31
+ * reflect lmConfig --init in README and /docs ([#38](https://github.com/famousStratum/LemonPie/issues/38)) ([b1d0bd9](https://github.com/famousStratum/LemonPie/commit/b1d0bd95f1e96be12a4dea24ef79a5711deebdf1))
32
+ * split roadmap into design docs and add command reference ([#34](https://github.com/famousStratum/LemonPie/issues/34)) ([a382aac](https://github.com/famousStratum/LemonPie/commit/a382aac6d480963fce7f4486926e315a51741aaf))
33
+
3
34
  ## [0.2.0-rc1](https://github.com/famousStratum/LemonPie/compare/v0.2.0-beta.1...v0.2.0-rc1) (2026-09-22)
4
35
 
5
36
 
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lemonpie-cli
3
- Version: 0.2.0rc1
4
- Summary: LemonPie — A lightweight Ollama client for terminal users
5
- Project-URL: homepage, https://versicode.com/lemonpie
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,33 +14,34 @@ 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
 
21
20
  # LemonPie
22
21
 
23
- **LemonPie — A lightweight Ollama client for terminal users**
24
-
25
- ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FfamousStratum%2FLemonPie%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)
26
22
  ![PyPI Version](https://img.shields.io/pypi/v/lemonpie-cli)
27
23
  ![GitHub License](https://img.shields.io/github/license/famousstratum/lemonpie)
24
+ ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FfamousStratum%2FLemonPie%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)
25
+
26
+ **LemonPie — A lightweight CLI for LLM inference servers**
27
+
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.
28
29
 
29
- LemonPie is a compact CLI for interacting with an Ollama server. 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
30
 
31
- ---
32
31
 
33
32
  ## ✨ Features
34
- - Start and manage chat sessions with Ollama models
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
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
37
38
  - Add, remove, and list models with aliases (`lmConfig`)
38
39
  - Switch models mid‑session with confirmation
39
40
  - Atomic writes for safety (tmp + replace)
40
- - Streaming responses from Ollama for real‑time output
41
+ - Streaming responses for real‑time output
41
42
  - Graceful handling of Ctrl‑C interrupts
42
43
 
43
- ---
44
+
44
45
 
45
46
  ## 📂 Project Structure
46
47
 
@@ -52,19 +53,18 @@ LemonPie/
52
53
  │ ├── config.py # Configuration logic & I/O
53
54
  │ ├── paths.py # OS-appropriate config/data directory resolution
54
55
  │ ├── time_utils.py # Timestamp helpers
56
+ │ ├── client.py # HTTP client & error handling
57
+ │ ├── models.py # Model finding & resolution
55
58
  │ ├── cli/
56
59
  │ │ ├── parser.py # Argument parsing (lm)
57
60
  │ │ ├── ui.py # Terminal helpers & confirmation
58
61
  │ │ └── config_cmd.py # Config manager (entrypoint: lmConfig)
59
- │ ├── engine/
60
- │ │ ├── models.py # Model finding & resolution
61
- │ │ └── ollama.py # Ollama client interaction
62
62
  │ └── sessions/
63
63
  │ └── storage.py # Session persistence
64
64
  ├── tests/ # pytest suite
65
65
  ├── docs/
66
66
  │ ├── config.example.json # Configuration template
67
- │ └── design/ # Design docs (state-machine.md, etc.)
67
+ │ └── design/ # Design docs (model-verification.md, etc.)
68
68
  ├── .github/workflows/ # CI & release pipelines
69
69
  ├── pyproject.toml # Package & build configuration
70
70
  ├── README.md # Project overview
@@ -72,25 +72,27 @@ LemonPie/
72
72
  └── .gitignore
73
73
  ```
74
74
 
75
- ---
76
-
77
75
  ## ⚙️ Configuration
78
76
 
79
77
  LemonPie keeps its config file and session history in your OS's standard user directories (via [`platformdirs`](https://pypi.org/project/platformdirs/)) — not in the project folder:
80
78
 
81
- | | Linux | macOS | Windows |
82
- |------------|---------------------------------|----------------------------------------------|------------------------------|
83
- | Config | `~/.config/lemonpie/` | `~/Library/Application Support/lemonpie/` | `%LOCALAPPDATA%\lemonpie\` |
84
- | Sessions | `~/.local/share/lemonpie/sessions/` | `~/Library/Application Support/lemonpie/sessions/` | `%LOCALAPPDATA%\lemonpie\sessions\` |
79
+ | OS | Config Path | Sessions Path |
80
+ |----------|--------------------------------------------|-----------------------------------------------------------|
81
+ | Linux | `~/.config/lemonpie/` | `~/.local/share/lemonpie/sessions/` |
82
+ | macOS | `~/Library/Application Support/lemonpie/` | `~/Library/Application Support/lemonpie/sessions/` |
83
+ | Windows | `%LOCALAPPDATA%\lemonpie\` | `%LOCALAPPDATA%\lemonpie\sessions\` |
84
+
85
85
 
86
- Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LEMONPIE_SESSIONS_DIR` — useful for testing or running in a container.
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.
87
87
 
88
- `docs/config.example.json` is a template. `lmConfig` will create your real config file on first use if one doesn't exist yet.
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.
89
89
 
90
90
  ### Example structure:
91
91
  ```json
92
92
  {
93
- "server": "http://127.0.0.1:11434",
93
+ "backend": "ollama",
94
+ "server": "http://localhost:11434",
95
+ "api_key": null,
94
96
  "default": "qwen2.5-coder:3b",
95
97
  "models": [
96
98
  { "alias": "qwen", "name": "qwen2.5-coder:3b" },
@@ -98,15 +100,13 @@ Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LE
98
100
  ]
99
101
  }
100
102
  ```
101
- server: Ollama host URL\
102
- default: canonical model name (full identifier)\
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) \
103
107
  models: list of objects with alias (nullable) and name
104
108
 
105
-
106
- ---
107
-
108
109
  ## 🚀 Usage
109
-
110
110
  ### `lm` / `lemonpie`
111
111
  - Start a new session \
112
112
  `lm -n "Hello"`
@@ -127,46 +127,30 @@ models: list of objects with alias (nullable) and name
127
127
  `lm -m qwen2.5-coder:3b`
128
128
 
129
129
  ### `lmConfig`
130
- - Manage models with lmConfig\
130
+ - First-time setup\
131
+ `lmConfig --init`
132
+
133
+ - First-time setup (skip server verification)\
134
+ `lmConfig --init --force`
135
+
136
+ - Manage models\
131
137
  `lmConfig --add-model qwen qwen2.5-coder:3b`\
132
138
  `lmConfig --list-models`\
133
139
  `lmConfig --remove-model qwen`
134
140
 
141
+ 👉 Full [command reference](https://github.com/famousStratum/LemonPie/blob/main/docs/usage/command-index.md).
135
142
 
136
143
  ## 🗺 Roadmap
137
144
 
138
145
  Planned features and improvements:
139
146
 
140
- - `lmConfig --init`
141
- Interactive setup command that:
142
- - Prompts for Ollama server IP:port
143
- - Verifies server reachability
144
- - Lists available models if server responds
145
- - Allows user to select models to add
146
- - Handles cases where no models are found (with guidance to Ollama docs)
147
- - Supports `--force` to override verification or alias conflicts
148
-
149
- - Model verification state machine
150
- Planned logic for `lmConfig --add-model`:
151
- - Check server reachability
152
- - Verify if model is installed
153
- - Offer to pull missing models
154
- - Handle pull success/failure and user choice
155
- - Respect `--force` for overriding conflicts or skipping checks
156
- *(See docs/design/state-machine.md for full diagram once published)*
157
-
158
- - Enhanced error handling and user feedback
159
- - Graceful handling of server errors (HTTP codes, non‑JSON responses)
160
-
161
- - Packaging for Debian (`.deb` via apt)
147
+ - Code completion (autocomplete)
148
+ - Model verification state machine
149
+ - Cross‑platform packaging (apt, winget, Homebrew)
162
150
  - Future schema validation for config/session files
163
151
 
164
-
165
- ---
152
+ 👉 See the full [roadmap](https://github.com/famousStratum/LemonPie/blob/main/docs/ROADMAP.md) for details.
166
153
 
167
154
  ## 📜 License
168
155
 
169
- 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.
170
-
171
-
172
- ---
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.
@@ -1,26 +1,28 @@
1
1
  # LemonPie
2
2
 
3
- **LemonPie — A lightweight Ollama client for terminal users**
4
-
5
- ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FfamousStratum%2FLemonPie%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)
6
3
  ![PyPI Version](https://img.shields.io/pypi/v/lemonpie-cli)
7
4
  ![GitHub License](https://img.shields.io/github/license/famousstratum/lemonpie)
5
+ ![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FfamousStratum%2FLemonPie%2Frefs%2Fheads%2Fmain%2Fpyproject.toml)
6
+
7
+ **LemonPie — A lightweight CLI for LLM inference servers**
8
+
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.
8
10
 
9
- LemonPie is a compact CLI for interacting with an Ollama server. 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
11
 
11
- ---
12
12
 
13
13
  ## ✨ Features
14
- - Start and manage chat sessions with Ollama models
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
+ - 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
17
19
  - Add, remove, and list models with aliases (`lmConfig`)
18
20
  - Switch models mid‑session with confirmation
19
21
  - Atomic writes for safety (tmp + replace)
20
- - Streaming responses from Ollama for real‑time output
22
+ - Streaming responses for real‑time output
21
23
  - Graceful handling of Ctrl‑C interrupts
22
24
 
23
- ---
25
+
24
26
 
25
27
  ## 📂 Project Structure
26
28
 
@@ -32,19 +34,18 @@ LemonPie/
32
34
  │ ├── config.py # Configuration logic & I/O
33
35
  │ ├── paths.py # OS-appropriate config/data directory resolution
34
36
  │ ├── time_utils.py # Timestamp helpers
37
+ │ ├── client.py # HTTP client & error handling
38
+ │ ├── models.py # Model finding & resolution
35
39
  │ ├── cli/
36
40
  │ │ ├── parser.py # Argument parsing (lm)
37
41
  │ │ ├── ui.py # Terminal helpers & confirmation
38
42
  │ │ └── config_cmd.py # Config manager (entrypoint: lmConfig)
39
- │ ├── engine/
40
- │ │ ├── models.py # Model finding & resolution
41
- │ │ └── ollama.py # Ollama client interaction
42
43
  │ └── sessions/
43
44
  │ └── storage.py # Session persistence
44
45
  ├── tests/ # pytest suite
45
46
  ├── docs/
46
47
  │ ├── config.example.json # Configuration template
47
- │ └── design/ # Design docs (state-machine.md, etc.)
48
+ │ └── design/ # Design docs (model-verification.md, etc.)
48
49
  ├── .github/workflows/ # CI & release pipelines
49
50
  ├── pyproject.toml # Package & build configuration
50
51
  ├── README.md # Project overview
@@ -52,25 +53,27 @@ LemonPie/
52
53
  └── .gitignore
53
54
  ```
54
55
 
55
- ---
56
-
57
56
  ## ⚙️ Configuration
58
57
 
59
58
  LemonPie keeps its config file and session history in your OS's standard user directories (via [`platformdirs`](https://pypi.org/project/platformdirs/)) — not in the project folder:
60
59
 
61
- | | Linux | macOS | Windows |
62
- |------------|---------------------------------|----------------------------------------------|------------------------------|
63
- | Config | `~/.config/lemonpie/` | `~/Library/Application Support/lemonpie/` | `%LOCALAPPDATA%\lemonpie\` |
64
- | Sessions | `~/.local/share/lemonpie/sessions/` | `~/Library/Application Support/lemonpie/sessions/` | `%LOCALAPPDATA%\lemonpie\sessions\` |
60
+ | OS | Config Path | Sessions Path |
61
+ |----------|--------------------------------------------|-----------------------------------------------------------|
62
+ | Linux | `~/.config/lemonpie/` | `~/.local/share/lemonpie/sessions/` |
63
+ | macOS | `~/Library/Application Support/lemonpie/` | `~/Library/Application Support/lemonpie/sessions/` |
64
+ | Windows | `%LOCALAPPDATA%\lemonpie\` | `%LOCALAPPDATA%\lemonpie\sessions\` |
65
+
65
66
 
66
- Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LEMONPIE_SESSIONS_DIR` — useful for testing or running in a container.
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.
67
68
 
68
- `docs/config.example.json` is a template. `lmConfig` will create your real config file on first use if one doesn't exist yet.
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.
69
70
 
70
71
  ### Example structure:
71
72
  ```json
72
73
  {
73
- "server": "http://127.0.0.1:11434",
74
+ "backend": "ollama",
75
+ "server": "http://localhost:11434",
76
+ "api_key": null,
74
77
  "default": "qwen2.5-coder:3b",
75
78
  "models": [
76
79
  { "alias": "qwen", "name": "qwen2.5-coder:3b" },
@@ -78,15 +81,13 @@ Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LE
78
81
  ]
79
82
  }
80
83
  ```
81
- server: Ollama host URL\
82
- default: canonical model name (full identifier)\
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) \
83
88
  models: list of objects with alias (nullable) and name
84
89
 
85
-
86
- ---
87
-
88
90
  ## 🚀 Usage
89
-
90
91
  ### `lm` / `lemonpie`
91
92
  - Start a new session \
92
93
  `lm -n "Hello"`
@@ -107,46 +108,30 @@ models: list of objects with alias (nullable) and name
107
108
  `lm -m qwen2.5-coder:3b`
108
109
 
109
110
  ### `lmConfig`
110
- - Manage models with lmConfig\
111
+ - First-time setup\
112
+ `lmConfig --init`
113
+
114
+ - First-time setup (skip server verification)\
115
+ `lmConfig --init --force`
116
+
117
+ - Manage models\
111
118
  `lmConfig --add-model qwen qwen2.5-coder:3b`\
112
119
  `lmConfig --list-models`\
113
120
  `lmConfig --remove-model qwen`
114
121
 
122
+ 👉 Full [command reference](https://github.com/famousStratum/LemonPie/blob/main/docs/usage/command-index.md).
115
123
 
116
124
  ## 🗺 Roadmap
117
125
 
118
126
  Planned features and improvements:
119
127
 
120
- - `lmConfig --init`
121
- Interactive setup command that:
122
- - Prompts for Ollama server IP:port
123
- - Verifies server reachability
124
- - Lists available models if server responds
125
- - Allows user to select models to add
126
- - Handles cases where no models are found (with guidance to Ollama docs)
127
- - Supports `--force` to override verification or alias conflicts
128
-
129
- - Model verification state machine
130
- Planned logic for `lmConfig --add-model`:
131
- - Check server reachability
132
- - Verify if model is installed
133
- - Offer to pull missing models
134
- - Handle pull success/failure and user choice
135
- - Respect `--force` for overriding conflicts or skipping checks
136
- *(See docs/design/state-machine.md for full diagram once published)*
137
-
138
- - Enhanced error handling and user feedback
139
- - Graceful handling of server errors (HTTP codes, non‑JSON responses)
140
-
141
- - Packaging for Debian (`.deb` via apt)
128
+ - Code completion (autocomplete)
129
+ - Model verification state machine
130
+ - Cross‑platform packaging (apt, winget, Homebrew)
142
131
  - Future schema validation for config/session files
143
132
 
144
-
145
- ---
133
+ 👉 See the full [roadmap](https://github.com/famousStratum/LemonPie/blob/main/docs/ROADMAP.md) for details.
146
134
 
147
135
  ## 📜 License
148
136
 
149
- 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.
150
-
151
-
152
- ---
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.
@@ -0,0 +1,41 @@
1
+ # 🗺 Roadmap
2
+
3
+ Planned features and improvements
4
+
5
+ ## Model verification state machine
6
+ Planned logic for `lmConfig --add-model`:
7
+ - Check server reachability
8
+ - Verify if model is installed
9
+ - Offer to pull missing models
10
+ - Handle pull success/failure and user choice
11
+ - Respect `--force` for overriding conflicts or skipping checks
12
+
13
+ <sub>*See* docs/design/[model-verification.md](design/model-verification.md) *for full diagram once published*</sub>
14
+
15
+ ## Cross‑platform packaging
16
+ - **Debian/Ubuntu**: `.deb` builds distributed via `apt` repository.
17
+ - **Windows**: package published to **winget** (Windows Package Manager).
18
+ - **macOS**: formula for **Homebrew** (brew install lemonpie).
19
+ - Ensure versioning consistency across all package managers.
20
+ - Automate builds with CI/CD pipelines (GitHub Actions, etc.).
21
+ - Provide signed binaries for security and trust.
22
+
23
+ ## Code completion (autocomplete)
24
+ - **Native CLI code completion** that behaves like an IDE autocomplete but works from the LemonPie CLI:
25
+ `lm -n "<prefix>" --autocomplete` or an interactive REPL mode.
26
+ - The system must be able to **force the model to return only code** when autocomplete is selected and let users set a default autocomplete model via `lmConfig`.
27
+
28
+ <sub>*See* docs/design/[code-completion.md](design/code-completion.md) *for brainstorming and design notes.* </sub>
29
+
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
39
+
40
+ ## Future schema validation
41
+ - Config/session file validation
@@ -0,0 +1,10 @@
1
+ {
2
+ "backend": "ollama",
3
+ "server": "http://localhost:11434",
4
+ "api_key": null,
5
+ "default": "qwen2.5-coder:3b",
6
+ "models": [
7
+ { "alias": "qwen", "name": "qwen2.5-coder:3b" },
8
+ { "alias": null, "name": "qwen2.5-coder:1.5b-base" }
9
+ ]
10
+ }
@@ -0,0 +1,108 @@
1
+ **Status:** Draft
2
+
3
+ ### Implementation plan (high level)
4
+
5
+ #### Goal
6
+ **Native CLI code completion** that behaves like an IDE autocomplete but works from the LemonPie CLI:
7
+ `lm -n "<prefix>" --autocomplete` or an interactive REPL mode.
8
+ The system must be able to **force the model to return only code** when autocomplete is selected and let users set a default autocomplete model via `lmConfig`.
9
+
10
+ ---
11
+
12
+ #### Prompt and role enforcement
13
+ - **Define an autocomplete role** in config (system instruction) that explicitly instructs the model to output only code and no explanations.
14
+
15
+ **Example system instruction (store in config roles):**
16
+ ```
17
+ You are a code autocomplete engine.
18
+ Only output valid code tokens that continue the given prefix.
19
+ Do not include explanations, commentary, or markdown.
20
+ If you cannot produce code, output an empty string.
21
+ ```
22
+
23
+
24
+ - When `--autocomplete` is used, LemonPie selects this role automatically and sends it as the system message so the model is constrained.
25
+
26
+ ---
27
+
28
+ #### Model selection and config
29
+ - **Add a `default_autocomplete_model`** field to `config.json` or `config.yaml`.
30
+
31
+ **lmConfig commands:**
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 server.
34
+
35
+ **Behavior:** If `--model` is passed on the CLI it overrides the default; otherwise use `default_autocomplete_model`.
36
+
37
+ **Example config snippet**
38
+ ```json
39
+ {
40
+ "default_autocomplete_model": "smollm:360m",
41
+ "roles": {
42
+ "autocomplete": {
43
+ "system": "You are a code autocomplete engine. Only output valid code tokens..."
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ #### CLI UX and examples
50
+ - **One-shot completion**
51
+
52
+ lm -n "def build_client(server_host, timeout):\n return " --autocomplete
53
+
54
+ Output: code continuation only.
55
+
56
+ - **REPL mode**
57
+
58
+ lm --repl --autocomplete
59
+
60
+ Press Enter to request completion for the current line or selection.
61
+
62
+ - **Flags**
63
+ - `--autocomplete` selects role and output filtering.
64
+ - `--model <name>` overrides default autocomplete model.
65
+ - `--stream` enables token streaming for low-latency incremental display.
66
+
67
+ #### Output filtering and validation
68
+ - **Primary enforcement**: rely on the system role to make the model return code-only.
69
+ - **Secondary enforcement**: post-process model output:
70
+ - **Syntactic sanity checks**: quick heuristics (starts with `def`, `class`, `{`, `[` or valid indentation for Python).
71
+ - **Strip leading natural language**: if output begins with non-code tokens, discard or retry.
72
+ - **Retry policy**: up to N retries with a stricter system prompt or different temperature.
73
+ - **Fail-safe**: if model repeatedly returns non-code, return an empty completion and a short machine-readable error code (not a human explanation) so callers can handle it.
74
+
75
+ #### Streaming, latency, and model sizing
76
+ - **Tradeoffs**:
77
+ - **Small models**: low latency, good for interactive typing; may be less accurate.
78
+ - **Large models**: better completions, higher latency.
79
+
80
+ - **Suggested defaults**:
81
+ - Use a small/medium autocomplete model for interactive mode (e.g., `smollm:360m`).
82
+ - Allow power users to set a larger model for batch completions.
83
+
84
+ **Table of tradeoffs**
85
+
86
+ | **Model Class** | **Latency** | **Accuracy** | **Use Case** |
87
+ |-----------------|-------------|--------------|--------------|
88
+ | Small (<=500M) | Low | Medium | Interactive REPL, quick suggestions |
89
+ | Medium (500M–3B)| Medium | Good | Most users, balanced |
90
+ | Large (>3B) | High | High | Offline batch completions, complex code |
91
+
92
+ #### State machine and retries
93
+ - Reuse the state-machine style from [model-verification.md](docs/design/model-verification.md) and add a small state machine for completion requests:
94
+ - **Start** → model reachable? → yes: send request; no: fallback to local cache or error.
95
+ - **Receive output** → passes code filter? → yes: return; no: retry with stricter prompt or different model → if still fail, return empty completion with error code.
96
+ - Document retry limits and backoff in `code-completion.md`.
97
+
98
+ #### Testing and rollout
99
+ - **Unit tests** for:
100
+ - Role selection when `--autocomplete` is used.
101
+ - Output filtering heuristics.
102
+ - `lmConfig` default model setting and verification.
103
+
104
+ - **Integration tests**:
105
+ - Simulate streaming completions.
106
+ - Measure latency and retry behavior.
107
+
108
+ - **Beta flag**: ship behind `--experimental-autocomplete` initially to gather feedback.
@@ -1,4 +1,6 @@
1
- # Model Verification State Machine
1
+ # Model Verification
2
+
3
+ **Status:** Ready
2
4
 
3
5
  This document outlines the planned state machine for `lmConfig --add-model`.
4
6
  It defines how LemonPie should handle server reachability, model installation, and user choices when adding models.
@@ -6,7 +8,7 @@ It defines how LemonPie should handle server reachability, model installation, a
6
8
  ---
7
9
 
8
10
  ## 🎯 Goals
9
- - Ensure models are verified against the Ollama server before being added.
11
+ - Ensure models are verified against the server before being added.
10
12
  - Provide clear user feedback for success/failure cases.
11
13
  - Support `--force` as a broad override mechanism (alias conflicts, skipping verification).
12
14
  - Keep logic predictable and extensible for future improvements.