lemonpie-cli 0.3.1__tar.gz → 0.3.3__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 (63) hide show
  1. lemonpie_cli-0.3.3/.agents/kb/INDEX.md +52 -0
  2. lemonpie_cli-0.3.3/.agents/kb/topics/architecture/_topic.md +6 -0
  3. lemonpie_cli-0.3.3/.agents/kb/topics/architecture/project-structure.md +59 -0
  4. lemonpie_cli-0.3.3/.agents/kb/topics/backend/_topic.md +5 -0
  5. lemonpie_cli-0.3.3/.agents/kb/topics/backend/client.md +57 -0
  6. lemonpie_cli-0.3.3/.agents/kb/topics/cicd/_topic.md +6 -0
  7. lemonpie_cli-0.3.3/.agents/kb/topics/cicd/ci-workflow.md +45 -0
  8. lemonpie_cli-0.3.3/.agents/kb/topics/cicd/release-workflow.md +50 -0
  9. lemonpie_cli-0.3.3/.agents/kb/topics/cli/_topic.md +5 -0
  10. lemonpie_cli-0.3.3/.agents/kb/topics/cli/cli-commands.md +91 -0
  11. lemonpie_cli-0.3.3/.agents/kb/topics/config/_topic.md +6 -0
  12. lemonpie_cli-0.3.3/.agents/kb/topics/config/config-format.md +57 -0
  13. lemonpie_cli-0.3.3/.agents/kb/topics/config/config-paths.md +43 -0
  14. lemonpie_cli-0.3.3/.agents/kb/topics/sessions/_topic.md +5 -0
  15. lemonpie_cli-0.3.3/.agents/kb/topics/sessions/session-storage.md +45 -0
  16. lemonpie_cli-0.3.3/.github/release.yml +32 -0
  17. lemonpie_cli-0.3.3/.github/workflows/pr-labler.yml +16 -0
  18. lemonpie_cli-0.3.3/.release-please/config.json +30 -0
  19. lemonpie_cli-0.3.3/.release-please/manifest.json +3 -0
  20. lemonpie_cli-0.3.3/AGENTS.md +142 -0
  21. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/CHANGELOG.md +36 -9
  22. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/PKG-INFO +80 -33
  23. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/README.md +78 -31
  24. lemonpie_cli-0.3.3/SECURITY.md +35 -0
  25. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/docs/ROADMAP.md +12 -8
  26. lemonpie_cli-0.3.3/docs/design/code-completion.md +158 -0
  27. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/docs/design/model-verification.md +21 -6
  28. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/docs/design/packaging.md +27 -21
  29. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/docs/usage/command-index.md +18 -8
  30. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/pyproject.toml +5 -2
  31. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/_version.py +2 -2
  32. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/cli/config_cmd.py +133 -26
  33. lemonpie_cli-0.3.3/src/lemonpie/cli/parser.py +39 -0
  34. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/client.py +8 -8
  35. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/config.py +11 -3
  36. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/main.py +6 -6
  37. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/models.py +5 -3
  38. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/time_utils.py +1 -0
  39. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/tests/conftest.py +6 -0
  40. lemonpie_cli-0.3.3/tests/test_api_key.py +310 -0
  41. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/tests/test_cli.py +3 -1
  42. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/tests/test_client.py +17 -17
  43. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/tests/test_config_cmd.py +203 -167
  44. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/tests/test_dry_run.py +21 -9
  45. lemonpie_cli-0.3.3/uv.lock +216 -0
  46. lemonpie_cli-0.3.1/.release-please/config.json +0 -14
  47. lemonpie_cli-0.3.1/.release-please/manifest.json +0 -3
  48. lemonpie_cli-0.3.1/docs/design/code-completion.md +0 -108
  49. lemonpie_cli-0.3.1/src/lemonpie/cli/parser.py +0 -23
  50. lemonpie_cli-0.3.1/uv.lock +0 -172
  51. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/.github/workflows/ci.yml +0 -0
  52. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/.github/workflows/release.yml +0 -0
  53. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/.gitignore +0 -0
  54. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/LICENSE +0 -0
  55. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/docs/config.example.json +0 -0
  56. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/docs/design/feature-ideas.md +0 -0
  57. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/__init__.py +0 -0
  58. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/cli/__init__.py +0 -0
  59. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/cli/ui.py +0 -0
  60. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/paths.py +0 -0
  61. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/sessions/__init__.py +0 -0
  62. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/src/lemonpie/sessions/storage.py +0 -0
  63. {lemonpie_cli-0.3.1 → lemonpie_cli-0.3.3}/tests/test_sessions.py +0 -0
@@ -0,0 +1,52 @@
1
+ # LemonPie — Knowledge Base Index
2
+
3
+ ## How to use this KB (for agents)
4
+
5
+ 0. This KB records what is **implemented today**. Code and tests are the source of truth; if a note disagrees with the code, fix the note in the same change.
6
+ 1. Read this index first. Pick notes by their one-line descriptions; open only those.
7
+ 2. To answer a question, prefer opening 1–3 specific notes over scanning everything.
8
+ 3. Cite the note `id` when you use information from it.
9
+ 4. Topic maps (`_topic.md` in each folder) are convenience views — the registry here is the source of truth.
10
+
11
+ ## How to update this KB (for agents)
12
+
13
+ - New idea → create a new atomic note (`YYYYMMDD-slug`, kebab-case filename).
14
+ - Same idea, new information → edit the note in place and bump `updated`.
15
+ - Any create / rename / delete **must** update this registry and the topic's `_topic.md` in the same change.
16
+ - Use only tags from the controlled vocabulary below; add a new tag here before using it.
17
+ - Only document implemented behavior. Proposals and brainstorms belong in `docs/design/`, which is not part of the KB and is not a source of truth for existing code.
18
+ - When something is removed or replaced, delete its note outright and remove every reference to it (registry, `_topic.md`, `related:` ids, links). Do not leave tombstone or 'obsolete' notes.
19
+
20
+ ## Controlled tags
21
+
22
+ `architecture`, `config`, `cli`, `sessions`, `backend`, `cicd`, `packaging`
23
+
24
+ ---
25
+
26
+ ## Registry
27
+
28
+ ### architecture
29
+
30
+ - `20261117-project-structure` — **Project structure** — `topics/architecture/project-structure.md` — Source layout of the lemonpie package — what each module does and how they relate.
31
+
32
+ ### config
33
+
34
+ - `20261117-config-format` — **Config file format** — `topics/config/config-format.md` — JSON schema for lemonpie's config file — backend, server URL, API key, default model, and model alias list.
35
+ - `20261117-config-paths` — **Config and data paths** — `topics/config/config-paths.md` — Where lemonpie stores its config file and session data on Linux, macOS, and Windows, and how to override them.
36
+
37
+ ### cli
38
+
39
+ - `20261117-cli-commands` — **CLI commands** — `topics/cli/cli-commands.md` — Full flag reference for lm/lemonpie and lmConfig — every flag, its effect, and usage examples.
40
+
41
+ ### sessions
42
+
43
+ - `20261117-session-storage` — **Session storage** — `topics/sessions/session-storage.md` — How chat sessions are persisted locally — file location, write strategy, and history format.
44
+
45
+ ### backend
46
+
47
+ - `20261117-http-client` — **HTTP backend client** — `topics/backend/client.md` — Unified OpenAI-compatible HTTP client (client.py) supporting Ollama, llama.cpp, LM Studio, vLLM, and hosted APIs.
48
+
49
+ ### cicd
50
+
51
+ - `20261117-ci-workflow` — **CI workflow** — `topics/cicd/ci-workflow.md` — GitHub Actions CI pipeline — triggers, what it runs, and the tools it uses (uv, pytest).
52
+ - `20261117-release-workflow` — **Release workflow** — `topics/cicd/release-workflow.md` — release-please manages the PR and tag, then PyPI publish uses OIDC trusted publishing.
@@ -0,0 +1,6 @@
1
+ # Architecture
2
+
3
+ The structure and internals of the LemonPie codebase — module layout, entry points, and
4
+ the relationships between components.
5
+
6
+ - [Project structure](project-structure.md) — source layout, module responsibilities, and how components connect.
@@ -0,0 +1,59 @@
1
+ ---
2
+ id: 20261117-project-structure
3
+ title: Project structure
4
+ tags: [architecture]
5
+ created: 2026-11-17
6
+ updated: 2026-11-26
7
+ related: [20261117-http-client, 20261117-cli-commands, 20261117-session-storage]
8
+ summary: Source layout of the lemonpie package — what each module does and how they relate.
9
+ ---
10
+
11
+ # Project structure
12
+
13
+ > Summary: Source layout of the lemonpie package — what each module does and how they relate.
14
+
15
+ ## Context
16
+
17
+ LemonPie is packaged as `lemonpie-cli` on PyPI. The importable package lives under
18
+ `src/lemonpie/` and exposes three entry points: `lm`, `lemonpie` (both → `main:main`),
19
+ and `lmConfig` (→ `cli.config_cmd:main`).
20
+
21
+ ## Module map
22
+
23
+ ```
24
+ src/lemonpie/
25
+ main.py # CLI session manager — entry point for `lm` / `lemonpie`
26
+ config.py # Config load, save, and runtime env overrides (LEMONPIE_HOST, LEMONPIE_API_KEY)
27
+ paths.py # OS-appropriate config/data directory resolution (via platformdirs)
28
+ time_utils.py # Timestamp helpers
29
+ models.py # Model alias resolution
30
+ client.py # OpenAI-compatible HTTP client — streaming chat, backend ops
31
+ cli/
32
+ parser.py # Argument parsing for `lm`
33
+ ui.py # Terminal helpers — confirmation prompts, output formatting
34
+ config_cmd.py # Config manager — entry point for `lmConfig`
35
+ sessions/
36
+ storage.py # Session persistence — atomic read/write of history files
37
+ ```
38
+
39
+ ## Key relationships
40
+
41
+ - `main.py` orchestrates: it uses `cli/parser.py` for args, `config.py` for settings,
42
+ `models.py` to resolve the target model, `client.py` to stream responses,
43
+ and `sessions/storage.py` to persist history.
44
+ - `paths.py` is a pure utility — both `config.py` and `sessions/storage.py` import it
45
+ to find the right OS directory without duplicating platform logic.
46
+ - `cli/config_cmd.py` is an independent entry point; it imports `config.py`, `models.py`,
47
+ `cli/ui.py`, and `client.py` (to probe the server in `--init`) but does not depend on `main.py`.
48
+
49
+ ## Build system
50
+
51
+ Built with **hatchling** + **hatch-vcs** (version derived from git tags).
52
+ Version is written to `src/lemonpie/_version.py` at build time.
53
+ See `pyproject.toml` for the full build configuration.
54
+
55
+ ## Related
56
+
57
+ - [HTTP backend client](../backend/client.md) — supports: `main.py` calls into this for all LLM I/O.
58
+ - [CLI commands](../cli/cli-commands.md) — supports: `parser.py` and `config_cmd.py` define the user-facing API.
59
+ - [Session storage](../sessions/session-storage.md) — supports: `storage.py` handles all history persistence.
@@ -0,0 +1,5 @@
1
+ # Backend
2
+
3
+ The OpenAI-compatible HTTP client and model resolution — how LemonPie talks to local and hosted AI backends.
4
+
5
+ - [HTTP backend client](client.md) — `client.py`: unified client, streaming, backend config, supported servers.
@@ -0,0 +1,57 @@
1
+ ---
2
+ id: 20261117-http-client
3
+ title: HTTP backend client
4
+ tags: [backend]
5
+ created: 2026-11-17
6
+ updated: 2026-11-26
7
+ related: [20261117-project-structure, 20261117-config-format]
8
+ summary: How lemonpie talks to AI backends — a unified OpenAI-compatible HTTP client (client.py) supporting Ollama, llama.cpp, LM Studio, vLLM, and hosted APIs.
9
+ ---
10
+
11
+ # HTTP backend client
12
+
13
+ > Summary: How lemonpie talks to AI backends — a unified OpenAI-compatible HTTP client (`client.py`) supporting Ollama, llama.cpp, LM Studio, vLLM, and hosted APIs.
14
+
15
+ ## Context
16
+
17
+ All backend communication is encapsulated in `src/lemonpie/client.py` using `httpx2` (no vendor SDK).
18
+
19
+ ## Supported backends
20
+
21
+ Any server exposing the OpenAI-compatible `/v1/chat/completions` endpoint works:
22
+
23
+ - **Ollama** (local, default) — `http://127.0.0.1:11434`
24
+ - **llama.cpp** server
25
+ - **LM Studio**
26
+ - **vLLM**
27
+ - Hosted APIs (OpenAI, Anthropic-compatible, etc.) — requires `api_key` in config
28
+
29
+ The `backend` field in `config.json` is recorded by `lmConfig --init` for identification only;
30
+ it does not change HTTP behavior.
31
+
32
+ ## Configuration
33
+
34
+ | Config field | Used for |
35
+ |---|---|
36
+ | `server` | Base URL — the client appends `/v1/chat/completions` |
37
+ | `api_key` | Bearer token; `null` for unauthenticated local servers. `LEMONPIE_API_KEY` overrides it at runtime |
38
+ | `backend` | Backend name (identification only; set by `lmConfig --init`) |
39
+
40
+ ## Authentication
41
+
42
+ `build_client(server_host, timeout, api_key)` sends `Authorization: Bearer <api_key>` on every request when a key is set. `main.py` resolves the key with `config.resolve_api_key`, so `LEMONPIE_API_KEY` wins over the config value. `lmConfig --init` probes `GET /v1/models` through the same client; a 401/403 response triggers its API key prompt.
43
+
44
+ ## Streaming
45
+
46
+ LemonPie uses streaming responses for real-time terminal output. Each token is printed
47
+ as it arrives rather than waiting for the full completion.
48
+
49
+ ## Model resolution
50
+
51
+ Before calling the backend, `models.py` resolves any alias to its canonical model name.
52
+ This is a pure lookup against the `models` list in config — no network call.
53
+
54
+ ## Related
55
+
56
+ - [Project structure](../architecture/project-structure.md) — see-also: `main.py` orchestrates calls into this module.
57
+ - [Config file format](../config/config-format.md) — prerequisite: `server`, `api_key`, and `backend` come from config.
@@ -0,0 +1,6 @@
1
+ # CI/CD
2
+
3
+ GitHub Actions pipelines — continuous integration and release to PyPI.
4
+
5
+ - [CI workflow](ci-workflow.md) — build verification and pytest on every push/PR to main.
6
+ - [Release workflow](release-workflow.md) — release-please PR management and OIDC PyPI publish.
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: 20261117-ci-workflow
3
+ title: CI workflow
4
+ tags: [cicd]
5
+ created: 2026-11-17
6
+ updated: 2026-11-17
7
+ related: [20261117-release-workflow]
8
+ summary: GitHub Actions CI pipeline — triggers, what it runs, and the tools it uses (uv, pytest).
9
+ ---
10
+
11
+ # CI workflow
12
+
13
+ > Summary: GitHub Actions CI pipeline — triggers, what it runs, and the tools it uses (uv, pytest).
14
+
15
+ ## Context
16
+
17
+ Defined in `.github/workflows/ci.yml`. Runs on every push and pull request to `main`.
18
+
19
+ ## Triggers
20
+
21
+ ```yaml
22
+ on:
23
+ push:
24
+ branches: [main]
25
+ pull_request:
26
+ branches: [main]
27
+ ```
28
+
29
+ ## What it does
30
+
31
+ 1. Checks out the repo (full history via `fetch-depth: 0` — needed for hatch-vcs).
32
+ 2. Installs **uv** (pinned to `0.12.17` via `astral-sh/setup-uv`).
33
+ 3. Sets up Python via `uv python install`.
34
+ 4. Runs `uv build` — verifies the package builds without errors.
35
+ 5. Runs `uv run pytest` — runs the test suite under `tests/`.
36
+
37
+ ## Pinned actions
38
+
39
+ All actions are pinned to a commit SHA for supply-chain safety:
40
+ - `actions/checkout` → `3d3c42e...`
41
+ - `astral-sh/setup-uv` → `c771a70...`
42
+
43
+ ## Related
44
+
45
+ - [Release workflow](release-workflow.md) — see-also: release also runs pytest + build before publishing.
@@ -0,0 +1,50 @@
1
+ ---
2
+ id: 20261117-release-workflow
3
+ title: Release workflow
4
+ tags: [cicd, packaging]
5
+ created: 2026-11-17
6
+ updated: 2026-11-17
7
+ related: [20261117-ci-workflow]
8
+ summary: GitHub Actions release pipeline — release-please manages the PR and tag, then PyPI publish uses OIDC trusted publishing.
9
+ ---
10
+
11
+ # Release workflow
12
+
13
+ > Summary: GitHub Actions release pipeline — release-please manages the PR and tag, then PyPI publish uses OIDC trusted publishing.
14
+
15
+ ## Context
16
+
17
+ Defined in `.github/workflows/release.yml`. Runs on every push to `main`.
18
+ Two jobs: `release-please` and `pypi-publish` (the second runs only when a release is created).
19
+
20
+ ## Job 1: release-please
21
+
22
+ - Uses `googleapis/release-please-action@v4`.
23
+ - Reads config from `.release-please/config.json` and `.release-please/manifest.json`.
24
+ - Creates or updates a release PR; merging that PR creates the GitHub release and tag.
25
+ - Requires a `RELEASE_PLEASE_TOKEN` secret.
26
+
27
+ ## Job 2: pypi-publish
28
+
29
+ Runs only when `release_created == 'true'` (output from release-please).
30
+
31
+ Steps:
32
+ 1. Checkout with full history (`fetch-depth: 0`) — required for hatch-vcs to read the tag.
33
+ 2. **Tag reachability check** — verifies the commit is on `main` before publishing. Refuses if not.
34
+ 3. Install uv (pinned same as CI).
35
+ 4. Run `uv run pytest` — tests must pass before publish.
36
+ 5. `uv build` — produce wheel and sdist.
37
+ 6. `pypa/gh-action-pypi-publish@release/v1` — uploads via **Trusted Publisher** (OIDC, no API key needed).
38
+
39
+ ## Permissions
40
+
41
+ ```yaml
42
+ permissions:
43
+ contents: write # create releases
44
+ pull-requests: write # manage release PR
45
+ id-token: write # OIDC for PyPI trusted publishing
46
+ ```
47
+
48
+ ## Related
49
+
50
+ - [CI workflow](ci-workflow.md) — see-also: same test + build steps run in CI on every push.
@@ -0,0 +1,5 @@
1
+ # CLI
2
+
3
+ User-facing commands — the `lm`/`lemonpie` session manager and `lmConfig`.
4
+
5
+ - [CLI commands](cli-commands.md) — full flag reference for both entry points with examples.
@@ -0,0 +1,91 @@
1
+ ---
2
+ id: 20261117-cli-commands
3
+ title: CLI commands
4
+ tags: [cli]
5
+ created: 2026-11-17
6
+ updated: 2026-11-26
7
+ related: [20261117-config-format, 20261117-session-storage]
8
+ summary: Full flag reference for lm/lemonpie and lmConfig — every flag, its effect, and usage examples.
9
+ ---
10
+
11
+ # CLI commands
12
+
13
+ > Summary: Full flag reference for `lm`/`lemonpie` and `lmConfig` — every flag, its effect, and usage examples.
14
+
15
+ ## Context
16
+
17
+ Two entry points are exposed: `lm` / `lemonpie` for chat sessions, and `lmConfig` for
18
+ managing the config file. Both are defined in `pyproject.toml` under `[project.scripts]`.
19
+ Full source of truth: `docs/usage/command-index.md` in the repo.
20
+
21
+ ---
22
+
23
+ ## lmConfig
24
+
25
+ Manages `config.json`.
26
+
27
+ | Flag | Description |
28
+ |---|---|
29
+ | `--init` | Interactive setup wizard: select backend, configure server URL, verify reachability, list and select installed models, optionally set a default. If the server answers 401/403, prompts for an API key (hidden input) and retries; a key from `LEMONPIE_API_KEY` is tried first and never saved |
30
+ | `--init --force` | Same as `--init` but skip server verification |
31
+ | `--host <url>` | Set server host URL (`http(s)://host:port`) |
32
+ | `--default-model <name>` | Set default model using alias or full name (must exist in models list) |
33
+ | `--add-model <alias> <model>` | Add a model mapping: alias → full model name |
34
+ | `--remove-model <identifier>` | Remove a model mapping by alias or full name |
35
+ | `--list-models` | List all configured model aliases and names |
36
+ | `--api-key [<key>]` | Set or update the API key. Omit `<key>` to be prompted without echo (keeps it out of shell history) |
37
+ | `--remove-api-key` | Remove the API key from the config |
38
+ | `--show` | Print `config.json` (the API key is masked) |
39
+ | `--force` | Force overwrite on alias conflict; skip server verification when used with `--init` |
40
+
41
+ ### Examples
42
+
43
+ ```bash
44
+ lmConfig --init
45
+ lmConfig --add-model qwen qwen2.5-coder:3b
46
+ lmConfig --list-models
47
+ lmConfig --remove-model qwen
48
+ lmConfig --host http://192.168.1.10:11434
49
+ lmConfig --default-model qwen
50
+ lmConfig --api-key # prompts without echo
51
+ lmConfig --remove-api-key
52
+ lmConfig --show
53
+ ```
54
+
55
+ ---
56
+
57
+ ## lm / lemonpie
58
+
59
+ ```
60
+ lm [FLAGS] [PROMPT]
61
+ ```
62
+
63
+ | Flag | Description |
64
+ |---|---|
65
+ | `-v, --version` | Show version |
66
+ | `-m, --model <name>` | Model alias or full name |
67
+ | `-n, --new` | Start a new chat session |
68
+ | `-s, --session <id>` | Load an existing session by ID |
69
+ | `-l, --list` | List all chat sessions |
70
+ | `-d, --delete <id>` | Delete a session by ID |
71
+ | `-t, --title <text>` | Set or update the current session title |
72
+ | `-c, --close` | Close the current session |
73
+ | `-p, --print` | Print current session history |
74
+ | `--delete-all` | Delete all stored sessions |
75
+ | `--dry-run` | Print the HTTP payload without sending it (debugging) |
76
+ | `prompt` | Prompt text (positional) |
77
+
78
+ ### Notes
79
+
80
+ - `--dry-run` prints the full `/v1/chat/completions` JSON body and exits with code 0.
81
+ - `--force` on `lmConfig --add-model` overwrites alias conflicts; on `--init` skips server verification.
82
+ - Flags can be combined: `lm -m smollm:360m -n "Hello world"`
83
+ - Ctrl-C is handled gracefully in both entry points.
84
+ - Model switching mid-session prompts for confirmation via `cli/ui.py`.
85
+
86
+ ---
87
+
88
+ ## Related
89
+
90
+ - [Config file format](../config/config-format.md) — prerequisite: `lmConfig` reads and writes this file.
91
+ - [Session storage](../sessions/session-storage.md) — see-also: `-l`, `-p`, `-d`, `-c`, `-s` all interact with stored sessions.
@@ -0,0 +1,6 @@
1
+ # Config
2
+
3
+ Configuration system — the JSON config file format, OS storage paths, and env-var overrides.
4
+
5
+ - [Config file format](config-format.md) — JSON schema: server URL, default model, and alias list.
6
+ - [Config and data paths](config-paths.md) — where files live on each OS and how to override with env vars.
@@ -0,0 +1,57 @@
1
+ ---
2
+ id: 20261117-config-format
3
+ title: Config file format
4
+ tags: [config]
5
+ created: 2026-11-17
6
+ updated: 2026-11-26
7
+ related: [20261117-config-paths, 20261117-cli-commands, 20261117-http-client]
8
+ summary: JSON schema for lemonpie's config file — backend, server URL, API key, default model, and model alias list.
9
+ ---
10
+
11
+ # Config file format
12
+
13
+ > Summary: JSON schema for lemonpie's config file — backend, server URL, API key, default model, and model alias list.
14
+
15
+ ## Context
16
+
17
+ LemonPie stores its settings in a single JSON file. The file is created by `lmConfig --init`
18
+ on first use. `docs/config.example.json` in the repo is a reference template.
19
+
20
+ ## Schema
21
+
22
+ ```json
23
+ {
24
+ "backend": "ollama",
25
+ "server": "http://localhost:11434",
26
+ "api_key": null,
27
+ "default": "qwen2.5-coder:3b",
28
+ "models": [
29
+ { "alias": "qwen", "name": "qwen2.5-coder:3b" },
30
+ { "alias": null, "name": "qwen2.5-coder:1.5b-base" }
31
+ ]
32
+ }
33
+ ```
34
+
35
+ | Field | Type | Description |
36
+ |---|---|---|
37
+ | `backend` | string | Backend identifier (`"ollama"`, or any OpenAI-compatible server name) |
38
+ | `server` | string | Server URL for the OpenAI-compatible `/v1/chat/completions` endpoint |
39
+ | `api_key` | string \| null | Optional API key — `null` for local servers, required for hosted APIs. `LEMONPIE_API_KEY` overrides it at runtime |
40
+ | `default` | string | Canonical model name used when no `-m` flag is given |
41
+ | `models` | array | Registered models; each has `alias` (nullable string) and `name` (full identifier) |
42
+
43
+ ## Rules
44
+
45
+ - `default` must be the **full** model identifier (e.g. `qwen2.5-coder:3b`), not an alias.
46
+ - `alias` is optional — set to `null` to register a model without a shorthand.
47
+ - Aliases are resolved by `models.py` before any API call.
48
+ - Writes use atomic tmp-then-replace for safety. The temp file is created with mode `0600`, so the saved config is owner-only on POSIX (it may hold an API key).
49
+ - Environment overrides win at runtime and are never written to the file: `LEMONPIE_HOST` overrides `server`, `LEMONPIE_API_KEY` overrides `api_key`.
50
+ - `lmConfig --api-key` / `--remove-api-key` set or clear `api_key`; `lmConfig --show` masks it.
51
+ - `lmConfig --init` guides through backend selection, server setup, and model listing interactively. If the server answers 401/403 it prompts for an API key (hidden input) and saves the key only after it authenticates.
52
+
53
+ ## Related
54
+
55
+ - [Config and data paths](config-paths.md) — prerequisite: where this file lives on each OS.
56
+ - [CLI commands](../cli/cli-commands.md) — see-also: `lmConfig` is the primary way to modify this file.
57
+ - [HTTP backend client](../backend/client.md) — see-also: `backend` and `server` are consumed here.
@@ -0,0 +1,43 @@
1
+ ---
2
+ id: 20261117-config-paths
3
+ title: Config and data paths
4
+ tags: [config]
5
+ created: 2026-11-17
6
+ updated: 2026-11-26
7
+ related: [20261117-config-format, 20261117-session-storage]
8
+ summary: Where lemonpie stores its config file and session data on Linux, macOS, and Windows, and how to override them.
9
+ ---
10
+
11
+ # Config and data paths
12
+
13
+ > Summary: Where lemonpie stores its config file and session data on Linux, macOS, and Windows, and how to override them.
14
+
15
+ ## Context
16
+
17
+ LemonPie uses [`platformdirs`](https://pypi.org/project/platformdirs/) via `paths.py` to
18
+ resolve OS-appropriate directories. Nothing is stored in the project folder.
19
+
20
+ ## Default paths
21
+
22
+ | OS | Config dir | Sessions dir |
23
+ |---|---|---|
24
+ | Linux | `~/.config/lemonpie/` | `~/.local/share/lemonpie/sessions/` |
25
+ | macOS | `~/Library/Application Support/lemonpie/` | `~/Library/Application Support/lemonpie/sessions/` |
26
+ | Windows | `%LOCALAPPDATA%\lemonpie\` | `%LOCALAPPDATA%\lemonpie\sessions\` |
27
+
28
+ ## Environment variable overrides
29
+
30
+ Both directories can be overridden at runtime:
31
+
32
+ | Variable | Overrides |
33
+ |---|---|
34
+ | `LEMONPIE_CONFIG_DIR` | Config directory |
35
+ | `LEMONPIE_SESSION_DIR` | Sessions directory |
36
+
37
+ Useful for testing, CI runs, or containerized environments where the default OS path
38
+ isn't appropriate.
39
+
40
+ ## Related
41
+
42
+ - [Config file format](config-format.md) — see-also: what the config file at this path contains.
43
+ - [Session storage](../sessions/session-storage.md) — see-also: how session files are written under the sessions dir.
@@ -0,0 +1,5 @@
1
+ # Sessions
2
+
3
+ Chat session persistence — how history files are stored, written, and read back.
4
+
5
+ - [Session storage](session-storage.md) — file location, atomic write strategy, and history format.
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: 20261117-session-storage
3
+ title: Session storage
4
+ tags: [sessions]
5
+ created: 2026-11-17
6
+ updated: 2026-11-17
7
+ related: [20261117-config-paths, 20261117-cli-commands]
8
+ summary: How chat sessions are persisted locally — file location, write strategy, and history format.
9
+ ---
10
+
11
+ # Session storage
12
+
13
+ > Summary: How chat sessions are persisted locally — file location, write strategy, and history format.
14
+
15
+ ## Context
16
+
17
+ LemonPie keeps chat history across invocations by writing session files to the OS sessions
18
+ directory (resolved by `paths.py`). All persistence logic lives in `sessions/storage.py`.
19
+
20
+ ## Storage location
21
+
22
+ Session files are written under the sessions directory (see [Config and data paths](../config/config-paths.md)).
23
+ Overridable via `LEMONPIE_SESSIONS_DIR`.
24
+
25
+ ## Write strategy
26
+
27
+ Writes are **atomic**: the new content is written to a temporary file, then `os.replace()`
28
+ swaps it in. This prevents corruption if the process is interrupted mid-write.
29
+
30
+ ## Session history format
31
+
32
+ Session history is a list of `{role, content}` message objects — the same structure Ollama's
33
+ chat API expects. This makes it straightforward to replay a session.
34
+
35
+ ## Operations
36
+
37
+ - **List sessions** — `lm -l` enumerates session files.
38
+ - **Print history** — `lm -p` loads and displays the current session.
39
+ - **New session** — `lm -n` creates a fresh session file.
40
+ - **Continue session** — a prompt without `-n` appends to the current session.
41
+
42
+ ## Related
43
+
44
+ - [Config and data paths](../config/config-paths.md) — prerequisite: sessions dir location and override.
45
+ - [CLI commands](../cli/cli-commands.md) — see-also: `-l`, `-p`, `-n` flags interact with storage.
@@ -0,0 +1,32 @@
1
+ changelog:
2
+ exclude:
3
+ labels:
4
+ - duplicate
5
+ - invalid
6
+ - question
7
+ - wontfix
8
+ - ignore-for-release
9
+ - "autorelease: pending"
10
+ - "autorelease: tagged"
11
+ authors:
12
+ - dependabot
13
+ - github-actions
14
+ categories:
15
+ - title: Breaking Changes
16
+ labels:
17
+ - breaking
18
+ - title: New Features
19
+ labels:
20
+ - feature
21
+ - title: Bug Fixes
22
+ labels:
23
+ - fix
24
+ - title: Accessibility
25
+ labels:
26
+ - accessibility
27
+ - title: Documentation
28
+ labels:
29
+ - documentation
30
+ - title: Other Changes
31
+ labels:
32
+ - "*"
@@ -0,0 +1,16 @@
1
+ name: Auto Label PRs
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, edited]
6
+
7
+ permissions:
8
+ pull-requests: write
9
+
10
+ jobs:
11
+ label:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: bcoe/conventional-release-labels@v1
15
+ with:
16
+ ignored_types: '["chore", "ci", "style", "refactor", "test"]'
@@ -0,0 +1,30 @@
1
+ {
2
+ "release-type": "python",
3
+ "changelog-type": "github",
4
+ "pull-request-title-pattern": "chore(release): lemonpie-cli v${version}",
5
+ "pull-request-header": "### Release Summary\nReview the proposed version bump and changelog entries below. Merge this PR when ready to publish the release.",
6
+ "changelog-sections": [
7
+ { "type": "feat", "section": "Features" },
8
+ { "type": "fix", "section": "Bug Fixes" },
9
+ { "type": "perf", "section": "Performance Improvements" },
10
+ { "type": "deps", "section": "Dependencies" },
11
+ { "type": "revert", "section": "Reverts" },
12
+ { "type": "docs", "section": "Documentation", "hidden": true },
13
+ { "type": "style", "section": "Styles", "hidden": true },
14
+ { "type": "chore", "section": "Miscellaneous Chores", "hidden": true },
15
+ { "type": "refactor", "section": "Code Refactoring", "hidden": true },
16
+ { "type": "test", "section": "Tests", "hidden": true },
17
+ { "type": "build", "section": "Build System", "hidden": true },
18
+ { "type": "ci", "section": "Continuous Integration", "hidden": true }
19
+ ],
20
+ "packages": {
21
+ ".": {
22
+ "package-name": "lemonpie-cli",
23
+ "bump-minor-pre-major": true,
24
+ "bump-patch-for-minor-pre-major": true,
25
+ "prerelease": true,
26
+ "versioning": "prerelease",
27
+ "include-component-in-tag": false
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.3.3"
3
+ }