lemonpie-cli 0.3.0__tar.gz → 0.3.2__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.2/.agents/kb/INDEX.md +52 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/architecture/_topic.md +6 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/architecture/project-structure.md +59 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/backend/_topic.md +5 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/backend/client.md +53 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/cicd/_topic.md +6 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/cicd/ci-workflow.md +45 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/cicd/release-workflow.md +50 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/cli/_topic.md +5 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/cli/cli-commands.md +87 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/config/_topic.md +6 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/config/config-format.md +55 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/config/config-paths.md +43 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/sessions/_topic.md +5 -0
- lemonpie_cli-0.3.2/.agents/kb/topics/sessions/session-storage.md +45 -0
- lemonpie_cli-0.3.2/.github/release.yml +32 -0
- lemonpie_cli-0.3.2/.github/workflows/pr-labler.yml +16 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/.gitignore +1 -0
- lemonpie_cli-0.3.2/.release-please/config.json +30 -0
- lemonpie_cli-0.3.2/.release-please/manifest.json +3 -0
- lemonpie_cli-0.3.2/AGENTS.md +142 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/CHANGELOG.md +44 -9
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/PKG-INFO +71 -29
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/README.md +69 -27
- lemonpie_cli-0.3.2/SECURITY.md +35 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/docs/ROADMAP.md +12 -8
- lemonpie_cli-0.3.2/docs/design/code-completion.md +158 -0
- lemonpie_cli-0.3.2/docs/design/feature-ideas.md +187 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/docs/design/model-verification.md +21 -6
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/docs/design/packaging.md +27 -21
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/docs/usage/command-index.md +14 -5
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/pyproject.toml +5 -2
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/_version.py +2 -2
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/cli/config_cmd.py +5 -5
- lemonpie_cli-0.3.2/src/lemonpie/cli/parser.py +39 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/client.py +19 -14
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/config.py +2 -2
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/main.py +51 -7
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/models.py +5 -3
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/time_utils.py +1 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/tests/test_cli.py +3 -1
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/tests/test_client.py +39 -28
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/tests/test_config_cmd.py +193 -157
- lemonpie_cli-0.3.2/tests/test_dry_run.py +233 -0
- lemonpie_cli-0.3.2/uv.lock +216 -0
- lemonpie_cli-0.3.0/.release-please/config.json +0 -14
- lemonpie_cli-0.3.0/.release-please/manifest.json +0 -3
- lemonpie_cli-0.3.0/docs/design/code-completion.md +0 -108
- lemonpie_cli-0.3.0/src/lemonpie/cli/parser.py +0 -22
- lemonpie_cli-0.3.0/uv.lock +0 -172
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/.github/workflows/ci.yml +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/.github/workflows/release.yml +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/LICENSE +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/docs/config.example.json +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/__init__.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/cli/__init__.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/cli/ui.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/paths.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/sessions/__init__.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/src/lemonpie/sessions/storage.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/tests/conftest.py +0 -0
- {lemonpie_cli-0.3.0 → lemonpie_cli-0.3.2}/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,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 20261117-project-structure
|
|
3
|
+
title: Project structure
|
|
4
|
+
tags: [architecture]
|
|
5
|
+
created: 2026-11-17
|
|
6
|
+
updated: 2026-11-24
|
|
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 schema
|
|
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` and `paths.py`
|
|
47
|
+
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,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 20261117-http-client
|
|
3
|
+
title: HTTP backend client
|
|
4
|
+
tags: [backend]
|
|
5
|
+
created: 2026-11-17
|
|
6
|
+
updated: 2026-11-24
|
|
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 |
|
|
38
|
+
| `backend` | Backend name (identification only; set by `lmConfig --init`) |
|
|
39
|
+
|
|
40
|
+
## Streaming
|
|
41
|
+
|
|
42
|
+
LemonPie uses streaming responses for real-time terminal output. Each token is printed
|
|
43
|
+
as it arrives rather than waiting for the full completion.
|
|
44
|
+
|
|
45
|
+
## Model resolution
|
|
46
|
+
|
|
47
|
+
Before calling the backend, `models.py` resolves any alias to its canonical model name.
|
|
48
|
+
This is a pure lookup against the `models` list in config — no network call.
|
|
49
|
+
|
|
50
|
+
## Related
|
|
51
|
+
|
|
52
|
+
- [Project structure](../architecture/project-structure.md) — see-also: `main.py` orchestrates calls into this module.
|
|
53
|
+
- [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,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 20261117-cli-commands
|
|
3
|
+
title: CLI commands
|
|
4
|
+
tags: [cli]
|
|
5
|
+
created: 2026-11-17
|
|
6
|
+
updated: 2026-11-24
|
|
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 |
|
|
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
|
+
| `--show` | Print the full `config.json` |
|
|
37
|
+
| `--force` | Force overwrite on alias conflict; skip server verification when used with `--init` |
|
|
38
|
+
|
|
39
|
+
### Examples
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
lmConfig --init
|
|
43
|
+
lmConfig --add-model qwen qwen2.5-coder:3b
|
|
44
|
+
lmConfig --list-models
|
|
45
|
+
lmConfig --remove-model qwen
|
|
46
|
+
lmConfig --host http://192.168.1.10:11434
|
|
47
|
+
lmConfig --default-model qwen
|
|
48
|
+
lmConfig --show
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## lm / lemonpie
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
lm [FLAGS] [PROMPT]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Flag | Description |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `-v, --version` | Show version |
|
|
62
|
+
| `-m, --model <name>` | Model alias or full name |
|
|
63
|
+
| `-n, --new` | Start a new chat session |
|
|
64
|
+
| `-s, --session <id>` | Load an existing session by ID |
|
|
65
|
+
| `-l, --list` | List all chat sessions |
|
|
66
|
+
| `-d, --delete <id>` | Delete a session by ID |
|
|
67
|
+
| `-t, --title <text>` | Set or update the current session title |
|
|
68
|
+
| `-c, --close` | Close the current session |
|
|
69
|
+
| `-p, --print` | Print current session history |
|
|
70
|
+
| `--delete-all` | Delete all stored sessions |
|
|
71
|
+
| `--dry-run` | Print the HTTP payload without sending it (debugging) |
|
|
72
|
+
| `prompt` | Prompt text (positional) |
|
|
73
|
+
|
|
74
|
+
### Notes
|
|
75
|
+
|
|
76
|
+
- `--dry-run` prints the full `/v1/chat/completions` JSON body and exits with code 0.
|
|
77
|
+
- `--force` on `lmConfig --add-model` overwrites alias conflicts; on `--init` skips server verification.
|
|
78
|
+
- Flags can be combined: `lm -m smollm:360m -n "Hello world"`
|
|
79
|
+
- Ctrl-C is handled gracefully in both entry points.
|
|
80
|
+
- Model switching mid-session prompts for confirmation via `cli/ui.py`.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Related
|
|
85
|
+
|
|
86
|
+
- [Config file format](../config/config-format.md) — prerequisite: `lmConfig` reads and writes this file.
|
|
87
|
+
- [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,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: 20261117-config-format
|
|
3
|
+
title: Config file format
|
|
4
|
+
tags: [config]
|
|
5
|
+
created: 2026-11-17
|
|
6
|
+
updated: 2026-11-20
|
|
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 |
|
|
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.
|
|
49
|
+
- `lmConfig --init` guides through backend selection, server setup, and model listing interactively.
|
|
50
|
+
|
|
51
|
+
## Related
|
|
52
|
+
|
|
53
|
+
- [Config and data paths](config-paths.md) — prerequisite: where this file lives on each OS.
|
|
54
|
+
- [CLI commands](../cli/cli-commands.md) — see-also: `lmConfig` is the primary way to modify this file.
|
|
55
|
+
- [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-17
|
|
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_SESSIONS_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,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
|
+
}
|