lemonpie-cli 0.1.0__tar.gz → 0.2.0a1__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 (25) hide show
  1. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/.github/workflows/release.yml +10 -0
  2. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/.gitignore +2 -5
  3. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/PKG-INFO +39 -22
  4. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/README.md +144 -129
  5. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/pyproject.toml +11 -6
  6. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/_version.py +2 -2
  7. lemonpie_cli-0.2.0a1/src/lemonpie/cli/__init__.py +0 -0
  8. lemonpie_cli-0.1.0/lemonpie/lm.py → lemonpie_cli-0.2.0a1/src/lemonpie/main.py +1 -0
  9. lemonpie_cli-0.2.0a1/src/lemonpie/paths.py +26 -0
  10. lemonpie_cli-0.2.0a1/uv.lock +256 -0
  11. lemonpie_cli-0.1.0/lemonpie/paths.py +0 -20
  12. lemonpie_cli-0.1.0/sessions/.gitkeep +0 -1
  13. lemonpie_cli-0.1.0/uv.lock +0 -548
  14. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/.github/workflows/publish.yml +0 -0
  15. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/LICENSE +0 -0
  16. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/config.example.json +0 -0
  17. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1}/docs/design/state-machine.md +0 -0
  18. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/__init__.py +0 -0
  19. /lemonpie_cli-0.1.0/lemonpie/lm_config.py → /lemonpie_cli-0.2.0a1/src/lemonpie/cli/config_cmd.py +0 -0
  20. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/cli_utils.py +0 -0
  21. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/config.py +0 -0
  22. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/model_utils.py +0 -0
  23. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/session_utils.py +0 -0
  24. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/spinner.py +0 -0
  25. {lemonpie_cli-0.1.0 → lemonpie_cli-0.2.0a1/src}/lemonpie/time_utils.py +0 -0
@@ -18,6 +18,16 @@ jobs:
18
18
  with:
19
19
  fetch-depth: 0
20
20
 
21
+ - name: Verify tag is reachable from main
22
+ run: |
23
+ git fetch origin main
24
+ if git merge-base --is-ancestor "${{ github.sha }}" origin/main; then
25
+ echo "Tag ${{ github.ref_name }} (commit ${{ github.sha }}) is on main. Proceeding."
26
+ else
27
+ echo "::error::Tag ${{ github.ref_name }} (commit ${{ github.sha }}) is not reachable from origin/main. Refusing to publish — merge to main before tagging."
28
+ exit 1
29
+ fi
30
+
21
31
  - name: Install uv
22
32
  uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
23
33
  with:
@@ -12,13 +12,10 @@ __pycache__/
12
12
  # Packaging output
13
13
  dist/
14
14
  build/
15
- lemonpie/_version.py
15
+ src/lemonpie/_version.py
16
16
  *.egg-info/
17
17
 
18
- # Runtime artifacts
19
- config.json
20
- sessions/*
21
- !sessions/.gitkeep
18
+ # Runtime logs/temp
22
19
  *.log
23
20
  *.tmp
24
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lemonpie-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0a1
4
4
  Summary: LemonPie — A lightweight Ollama client for terminal users
5
5
  Project-URL: homepage, https://versicode.com/lemonpie
6
6
  Project-URL: repository, https://github.com/famousStratum/LemonPie
@@ -8,8 +8,10 @@ Project-URL: issues, https://github.com/famousStratum/LemonPie/issues
8
8
  Author-email: famousStratum <info@versicode.com>
9
9
  License-Expression: GPL-3.0-or-later
10
10
  License-File: LICENSE
11
- Requires-Python: >=3.8
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: httpx
12
13
  Requires-Dist: ollama
14
+ Requires-Dist: platformdirs
13
15
  Description-Content-Type: text/markdown
14
16
 
15
17
  # LemonPie
@@ -25,8 +27,8 @@ LemonPie is a compact CLI for interacting with an Ollama server. It manages chat
25
27
 
26
28
  ## ✨ Features
27
29
  - Start and manage chat sessions with Ollama models
28
- - Persist session history locally under `sessions/`
29
- - Configure host, default model, and aliases via `config.json`
30
+ - Persist session history in your OS's standard user data directory
31
+ - Configure host, default model, and aliases via a config file in your OS's standard user config directory
30
32
  - Add, remove, and list models with aliases (`lmConfig`)
31
33
  - Switch models mid‑session with confirmation
32
34
  - Atomic writes for safety (tmp + replace)
@@ -38,25 +40,41 @@ LemonPie is a compact CLI for interacting with an Ollama server. It manages chat
38
40
  ## 📂 Project Structure
39
41
 
40
42
  ```text
41
- lemonpie/
42
- ├── lemonpie/ # Core package namespace
43
- │ ├── lm.py # CLI session manager
44
- │ ├── lm_config.py # Config manager
45
- │ ├── config.py # Configuration logic & I/O
46
- │ ├── model_utils.py # Model finding & resolution
47
- │ ├── cli_utils.py # Terminal helpers & confirmation
48
- │ └── ... # Other shared modules
49
- ├── config.example.json# Configuration template
50
- ├── sessions/ # Session files (created at runtime)
51
- ├── pyproject.toml # Package & build configuration
52
- ├── README.md # Project overview
53
- ├── LICENSE # GPLv3 license
54
- └── .gitignore # Ignore venv, sessions, local config
43
+ LemonPie/
44
+ ├── src/
45
+ │ └── lemonpie/ # Core package namespace
46
+ │ ├── main.py # CLI session manager (entrypoints: lm, lemonpie)
47
+ │ ├── config.py # Configuration logic & I/O
48
+ │ ├── paths.py # OS-appropriate config/data directory resolution
49
+ │ ├── model_utils.py # Model finding & resolution
50
+ │ ├── cli_utils.py # Terminal helpers & confirmation
51
+ │ ├── session_utils.py # Session persistence
52
+ │ ├── spinner.py # Status spinner
53
+ │ ├── time_utils.py # Timestamp helpers
54
+ │ └── cli/
55
+ │ └── config_cmd.py # Config manager (entrypoint: lmConfig)
56
+ ├── config.example.json # Configuration template
57
+ ├── pyproject.toml # Package & build configuration
58
+ ├── README.md # Project overview
59
+ ├── LICENSE # GPLv3 license
60
+ └── .gitignore
55
61
  ```
56
62
 
57
63
  ---
58
64
 
59
- ## ⚙️ Configuration (`config.json`)
65
+ ## ⚙️ Configuration
66
+
67
+ 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:
68
+
69
+ | | Linux | macOS | Windows |
70
+ |------------|---------------------------------|----------------------------------------------|------------------------------|
71
+ | Config | `~/.config/lemonpie/` | `~/Library/Application Support/lemonpie/` | `%LOCALAPPDATA%\lemonpie\` |
72
+ | Sessions | `~/.local/share/lemonpie/sessions/` | `~/Library/Application Support/lemonpie/sessions/` | `%LOCALAPPDATA%\lemonpie\sessions\` |
73
+
74
+ Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LEMONPIE_SESSIONS_DIR` — useful for testing or running in a container.
75
+
76
+ `config.example.json` at the repo root is a template. `lmConfig` will create your real config file on first use if one doesn't exist yet.
77
+
60
78
  ### Example structure:
61
79
  ```json
62
80
  {
@@ -77,7 +95,7 @@ models: list of objects with alias (nullable) and name
77
95
 
78
96
  ## 🚀 Usage
79
97
 
80
- ### lm.py
98
+ ### `lm` / `lemonpie`
81
99
  - Start a new session \
82
100
  `lm -n "Hello"`
83
101
 
@@ -96,7 +114,7 @@ models: list of objects with alias (nullable) and name
96
114
  - Switch model in current session\
97
115
  `lm -m qwen2.5-coder:3b`
98
116
 
99
- ### lmConfig.py
117
+ ### `lmConfig`
100
118
  - Manage models with lmConfig\
101
119
  `lmConfig --add-model qwen qwen2.5-coder:3b`\
102
120
  `lmConfig --list-models`\
@@ -140,4 +158,3 @@ This project is licensed under the **GNU General Public License v3.0** (**GPLv3*
140
158
 
141
159
 
142
160
  ---
143
-
@@ -1,129 +1,144 @@
1
- # LemonPie
2
-
3
- **The ultra‑lightweight Ollama session manager for terminal workflows**
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
- ![GitHub License](https://img.shields.io/github/license/famousstratum/lemonpie)
7
-
8
- 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.
9
-
10
- ---
11
-
12
- ## ✨ Features
13
- - Start and manage chat sessions with Ollama models
14
- - Persist session history locally under `sessions/`
15
- - Configure host, default model, and aliases via `config.json`
16
- - Add, remove, and list models with aliases (`lmConfig`)
17
- - Switch models mid‑session with confirmation
18
- - Atomic writes for safety (tmp + replace)
19
- - Streaming responses from Ollama for real‑time output
20
- - Graceful handling of Ctrl‑C interrupts
21
-
22
- ---
23
-
24
- ## 📂 Project Structure
25
-
26
- ```text
27
- lemonpie/
28
- ├── lemonpie/ # Core package namespace
29
- │ ├── lm.py # CLI session manager
30
- │ ├── lm_config.py # Config manager
31
- │ ├── config.py # Configuration logic & I/O
32
- │ ├── model_utils.py # Model finding & resolution
33
- │ ├── cli_utils.py # Terminal helpers & confirmation
34
- │ └── ... # Other shared modules
35
- ├── config.example.json# Configuration template
36
- ├── sessions/ # Session files (created at runtime)
37
- ├── pyproject.toml # Package & build configuration
38
- ├── README.md # Project overview
39
- ├── LICENSE # GPLv3 license
40
- └── .gitignore # Ignore venv, sessions, local config
41
- ```
42
-
43
- ---
44
-
45
- ## ⚙️ Configuration (`config.json`)
46
- ### Example structure:
47
- ```json
48
- {
49
- "server": "http://127.0.0.1:11434",
50
- "default": "qwen2.5-coder:3b",
51
- "models": [
52
- { "alias": "qwen", "name": "qwen2.5-coder:3b" },
53
- { "alias": null, "name": "qwen2.5-coder:1.5b-base" }
54
- ]
55
- }
56
- ```
57
- server: Ollama host URL\
58
- default: canonical model name (full identifier)\
59
- models: list of objects with alias (nullable) and name
60
-
61
-
62
- ---
63
-
64
- ## 🚀 Usage
65
-
66
- ### lm.py
67
- - Start a new session \
68
- `lm -n "Hello"`
69
-
70
- - Start with a specific model\
71
- `lm -n -m qwen "Hello"`
72
-
73
- - Send a prompt to the current session\
74
- `lm "Tell me about git add"`
75
-
76
- - List sessions\
77
- `lm -l`
78
-
79
- - Print current session history\
80
- `lm -p`
81
-
82
- - Switch model in current session\
83
- `lm -m qwen2.5-coder:3b`
84
-
85
- ### lmConfig.py
86
- - Manage models with lmConfig\
87
- `lmConfig --add-model qwen qwen2.5-coder:3b`\
88
- `lmConfig --list-models`\
89
- `lmConfig --remove-model qwen`
90
-
91
-
92
- ## 🗺 Roadmap
93
-
94
- Planned features and improvements:
95
-
96
- - `lmConfig --init`
97
- Interactive setup command that:
98
- - Prompts for Ollama server IP:port
99
- - Verifies server reachability
100
- - Lists available models if server responds
101
- - Allows user to select models to add
102
- - Handles cases where no models are found (with guidance to Ollama docs)
103
- - Supports `--force` to override verification or alias conflicts
104
-
105
- - Model verification state machine
106
- Planned logic for `lmConfig --add-model`:
107
- - Check server reachability
108
- - Verify if model is installed
109
- - Offer to pull missing models
110
- - Handle pull success/failure and user choice
111
- - Respect `--force` for overriding conflicts or skipping checks
112
- *(See docs/design/state-machine.md for full diagram once published)*
113
-
114
- - Enhanced error handling and user feedback
115
- - Graceful handling of server errors (HTTP codes, non‑JSON responses)
116
-
117
- - Packaging for Debian (`.deb` via apt)
118
- - Future schema validation for config/session files
119
-
120
-
121
- ---
122
-
123
- ## 📜 License
124
-
125
- 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.
126
-
127
-
128
- ---
129
-
1
+ # LemonPie
2
+
3
+ **The ultra‑lightweight Ollama session manager for terminal workflows**
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
+ ![GitHub License](https://img.shields.io/github/license/famousstratum/lemonpie)
7
+
8
+ 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.
9
+
10
+ ---
11
+
12
+ ## ✨ Features
13
+ - Start and manage chat sessions with Ollama models
14
+ - Persist session history in your OS's standard user data directory
15
+ - Configure host, default model, and aliases via a config file in your OS's standard user config directory
16
+ - Add, remove, and list models with aliases (`lmConfig`)
17
+ - Switch models mid‑session with confirmation
18
+ - Atomic writes for safety (tmp + replace)
19
+ - Streaming responses from Ollama for real‑time output
20
+ - Graceful handling of Ctrl‑C interrupts
21
+
22
+ ---
23
+
24
+ ## 📂 Project Structure
25
+
26
+ ```text
27
+ LemonPie/
28
+ ├── src/
29
+ │ └── lemonpie/ # Core package namespace
30
+ │ ├── main.py # CLI session manager (entrypoints: lm, lemonpie)
31
+ │ ├── config.py # Configuration logic & I/O
32
+ │ ├── paths.py # OS-appropriate config/data directory resolution
33
+ │ ├── model_utils.py # Model finding & resolution
34
+ │ ├── cli_utils.py # Terminal helpers & confirmation
35
+ │ ├── session_utils.py # Session persistence
36
+ │ ├── spinner.py # Status spinner
37
+ │ ├── time_utils.py # Timestamp helpers
38
+ │ └── cli/
39
+ │ └── config_cmd.py # Config manager (entrypoint: lmConfig)
40
+ ├── config.example.json # Configuration template
41
+ ├── pyproject.toml # Package & build configuration
42
+ ├── README.md # Project overview
43
+ ├── LICENSE # GPLv3 license
44
+ └── .gitignore
45
+ ```
46
+
47
+ ---
48
+
49
+ ## ⚙️ Configuration
50
+
51
+ 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:
52
+
53
+ | | Linux | macOS | Windows |
54
+ |------------|---------------------------------|----------------------------------------------|------------------------------|
55
+ | Config | `~/.config/lemonpie/` | `~/Library/Application Support/lemonpie/` | `%LOCALAPPDATA%\lemonpie\` |
56
+ | Sessions | `~/.local/share/lemonpie/sessions/` | `~/Library/Application Support/lemonpie/sessions/` | `%LOCALAPPDATA%\lemonpie\sessions\` |
57
+
58
+ Both are overridable via environment variables — `LEMONPIE_CONFIG_DIR` and `LEMONPIE_SESSIONS_DIR` — useful for testing or running in a container.
59
+
60
+ `config.example.json` at the repo root is a template. `lmConfig` will create your real config file on first use if one doesn't exist yet.
61
+
62
+ ### Example structure:
63
+ ```json
64
+ {
65
+ "server": "http://127.0.0.1:11434",
66
+ "default": "qwen2.5-coder:3b",
67
+ "models": [
68
+ { "alias": "qwen", "name": "qwen2.5-coder:3b" },
69
+ { "alias": null, "name": "qwen2.5-coder:1.5b-base" }
70
+ ]
71
+ }
72
+ ```
73
+ server: Ollama host URL\
74
+ default: canonical model name (full identifier)\
75
+ models: list of objects with alias (nullable) and name
76
+
77
+
78
+ ---
79
+
80
+ ## 🚀 Usage
81
+
82
+ ### `lm` / `lemonpie`
83
+ - Start a new session \
84
+ `lm -n "Hello"`
85
+
86
+ - Start with a specific model\
87
+ `lm -n -m qwen "Hello"`
88
+
89
+ - Send a prompt to the current session\
90
+ `lm "Tell me about git add"`
91
+
92
+ - List sessions\
93
+ `lm -l`
94
+
95
+ - Print current session history\
96
+ `lm -p`
97
+
98
+ - Switch model in current session\
99
+ `lm -m qwen2.5-coder:3b`
100
+
101
+ ### `lmConfig`
102
+ - Manage models with lmConfig\
103
+ `lmConfig --add-model qwen qwen2.5-coder:3b`\
104
+ `lmConfig --list-models`\
105
+ `lmConfig --remove-model qwen`
106
+
107
+
108
+ ## 🗺 Roadmap
109
+
110
+ Planned features and improvements:
111
+
112
+ - `lmConfig --init`
113
+ Interactive setup command that:
114
+ - Prompts for Ollama server IP:port
115
+ - Verifies server reachability
116
+ - Lists available models if server responds
117
+ - Allows user to select models to add
118
+ - Handles cases where no models are found (with guidance to Ollama docs)
119
+ - Supports `--force` to override verification or alias conflicts
120
+
121
+ - Model verification state machine
122
+ Planned logic for `lmConfig --add-model`:
123
+ - Check server reachability
124
+ - Verify if model is installed
125
+ - Offer to pull missing models
126
+ - Handle pull success/failure and user choice
127
+ - Respect `--force` for overriding conflicts or skipping checks
128
+ *(See docs/design/state-machine.md for full diagram once published)*
129
+
130
+ - Enhanced error handling and user feedback
131
+ - Graceful handling of server errors (HTTP codes, non‑JSON responses)
132
+
133
+ - Packaging for Debian (`.deb` via apt)
134
+ - Future schema validation for config/session files
135
+
136
+
137
+ ---
138
+
139
+ ## 📜 License
140
+
141
+ 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.
142
+
143
+
144
+ ---
@@ -11,10 +11,12 @@ authors = [
11
11
  ]
12
12
  readme = "README.md"
13
13
  license = "GPL-3.0-or-later"
14
- requires-python = ">=3.8"
14
+ requires-python = ">=3.11"
15
15
 
16
16
  dependencies = [
17
- "ollama"
17
+ "ollama",
18
+ "httpx",
19
+ "platformdirs"
18
20
  ]
19
21
 
20
22
  [project.urls]
@@ -23,12 +25,15 @@ repository = "https://github.com/famousStratum/LemonPie"
23
25
  issues = "https://github.com/famousStratum/LemonPie/issues"
24
26
 
25
27
  [project.scripts]
26
- lm = "lemonpie.lm:main"
27
- lemonpie = "lemonpie.lm:main"
28
- lmConfig = "lemonpie.lm_config:main"
28
+ lm = "lemonpie.main:main"
29
+ lemonpie = "lemonpie.main:main"
30
+ lmConfig = "lemonpie.cli.config_cmd:main"
29
31
 
30
32
  [tool.hatch.version]
31
33
  source = "vcs"
32
34
 
33
35
  [tool.hatch.build.hooks.vcs]
34
- version-file = "lemonpie/_version.py"
36
+ version-file = "src/lemonpie/_version.py"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["src/lemonpie"]
@@ -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.1.0'
22
- __version_tuple__ = version_tuple = (0, 1, 0)
21
+ __version__ = version = '0.2.0a1'
22
+ __version_tuple__ = version_tuple = (0, 2, 0, 'a1')
23
23
 
24
24
  __commit_id__ = commit_id = None
File without changes
@@ -48,6 +48,7 @@ from lemonpie.session_utils import (
48
48
  load_session_by_id,
49
49
  delete_session_by_id,
50
50
  delete_all_sessions,
51
+ resolve_session,
51
52
  close_session,
52
53
  load_session,
53
54
  save_session,
@@ -0,0 +1,26 @@
1
+ import os
2
+ from platformdirs import user_config_dir, user_data_dir
3
+
4
+ APP_NAME = "lemonpie"
5
+
6
+ # Config directory: OS-appropriate user config location
7
+ # (~/.config/lemonpie, %LOCALAPPDATA%\lemonpie, ~/Library/Application Support/lemonpie).
8
+ # Override with $LEMONPIE_CONFIG_DIR.
9
+ CONFIG_DIR = os.environ.get(
10
+ "LEMONPIE_CONFIG_DIR",
11
+ user_config_dir(APP_NAME, appauthor=False)
12
+ )
13
+ os.makedirs(CONFIG_DIR, exist_ok=True)
14
+
15
+ CONFIG_FILE = os.path.join(CONFIG_DIR, "config.json")
16
+
17
+ # Sessions directory: OS-appropriate user data location, with precedence given
18
+ # to $LEMONPIE_SESSIONS_DIR for backward compatibility / testing / containers.
19
+ DATA_DIR = user_data_dir(APP_NAME, appauthor=False)
20
+ SESSIONS_DIR = os.environ.get(
21
+ "LEMONPIE_SESSIONS_DIR",
22
+ os.path.join(DATA_DIR, "sessions")
23
+ )
24
+ os.makedirs(SESSIONS_DIR, exist_ok=True)
25
+
26
+ CURRENT_FILE = os.path.join(SESSIONS_DIR, ".current")