lazyllama 0.5.2

A lightweight TUI client for Ollama with markdown support and smart scrolling.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# Release Scripts

Automation scripts for releasing LazyLlama to multiple platforms.

## 📋 Overview

Four scripts handle the complete release pipeline:

1. **`release.sh`** - Complete pipeline (recommended)
2. **`release-github.sh`** - GitHub release only
3. **`deploy-aur.sh`** - AUR deployment only
4. **`build-appimage.sh`** - Build AppImage
5. **`submit-appimagehub.sh`** - Prepare AppImageHub submission

## 🎨 Icon Workflow

LazyLlama uses a unified icon approach across all platforms:

**Source:** `icon.png` (256x256 PNG) in project root

**Automatic Conversions:**
- **Windows (.ico)**: Generated by `release-github.sh` before Windows build
  - Multi-resolution: 256, 128, 64, 48, 32, 16 pixels
  - Embedded into `.exe` via `build.rs` during compilation
  - Requires: ImageMagick (`convert` or `magick` command)
  
- **AppImage (.png)**: Used directly by `build-appimage.sh`
  - Copied to AppDir icon directory
  - Fallback: Generates blue placeholder if missing
  - Shows in application launchers and file managers

**Requirements:**
- `icon.png` must exist in project root for proper branding
- ImageMagick for `.ico` generation (Windows) and fallback (AppImage)
- Icon changes require rebuilding all distribution formats

## 🚀 Quick Start

### Complete Release (Recommended)

```bash
# 1. Update version in Cargo.toml
vim Cargo.toml

# 2. Commit changes
git add Cargo.toml
git commit -m "Bump version to 0.4.2"
git push

# 3. Run complete release pipeline
./scripts/release.sh
```

This will:
- ✅ Run tests
- ✅ Publish to crates.io
- ✅ Build release binaries (Linux x64, Windows x64)
- ✅ Create AppImage
- ✅ Create GitHub release with all assets
- ✅ Deploy to AUR (lazyllama + lazyllama-bin)

### Individual Steps

If you need more control:

```bash
# 1. Publish to crates.io
cargo publish

# 2. Create GitHub release
./scripts/release-github.sh

# 3. Deploy to AUR
./scripts/deploy-aur.sh --push

# 4. Build AppImage
./scripts/build-appimage.sh build
```

## 📖 Script Details

### release.sh - Complete Pipeline

**Complete automated release workflow.**

```bash
./scripts/release.sh              # Full pipeline with prompts
./scripts/release.sh --draft      # Create draft GitHub release
./scripts/release.sh --skip-crates # Skip crates.io (already published)
./scripts/release.sh --skip-github # Skip GitHub release
./scripts/release.sh --skip-aur   # Skip AUR deployment
```

**What it does:**
1. Runs `cargo test --all-features`
2. Publishes to crates.io (with confirmation)
3. Builds Linux x64 release binary
4. Cross-compiles Windows x64 binary (if mingw-w64 available)
5. Creates AppImage
6. Creates GitHub release with Linux tarball, Windows ZIP, and AppImage
7. Updates and pushes AUR packages (with confirmation)

**Requirements:**
- Logged in to cargo: `cargo login`
- GitHub CLI authenticated: `gh auth login`
- AUR repositories cloned (see `aur/README.md`)
- For Windows builds: `sudo pacman -S mingw-w64-gcc`
- For AppImage: `sudo pacman -S patchelf wget`

---

### release-github.sh - GitHub Release

**Creates GitHub release with pre-built binaries (Linux x64, Windows x64, AppImage).**

```bash
./scripts/release-github.sh                                    # Normal release
./scripts/release-github.sh --draft                           # Draft release
./scripts/release-github.sh --notes "Bug fixes"               # With notes
./scripts/release-github.sh --skip-build                      # Use existing binary
./scripts/release-github.sh --skip-windows                    # Skip Windows build
./scripts/release-github.sh --skip-appimage                   # Skip AppImage creation
```

**What it does:**
1. Reads version from `Cargo.toml`
2. **Generates Windows icon** (`icon.ico`) from `icon.png` using ImageMagick
   - Creates multi-resolution icon (256, 128, 64, 48, 32, 16 pixels)
   - Required for Windows executable icon embedding via `build.rs`
3. Builds Linux x64 release binary (`cargo build --release`)
4. Cross-compiles Windows x64 binary with embedded icon (`cargo build --target x86_64-pc-windows-gnu`)
5. Builds AppImage with project icon
6. Creates distribution archives:
   - Linux: `lazyllama-VERSION-x86_64.tar.gz` (binary, LICENSE, README)
   - Windows: `lazyllama-VERSION-x86_64-windows.zip` (exe, LICENSE, README)
   - AppImage: `lazyllama-VERSION-x86_64.AppImage`
7. Creates GitHub release with tag `vVERSION`
8. Uploads all assets to the release

**Output:**
- Distribution files in `target/dist/`
- `icon.ico` in project root (for Windows builds)
- GitHub release at `https://github.com/Pommersche92/lazyllama/releases`

**Requirements:**
- GitHub CLI: `sudo pacman -S github-cli`
- Authenticated: `gh auth login`
- For Windows builds: `sudo pacman -S mingw-w64-gcc`
- For icon generation: `sudo pacman -S imagemagick`
- For AppImage: `sudo pacman -S patchelf wget`

---

### build-appimage.sh - AppImage Builder

**Creates portable AppImage packages for universal Linux distribution.**

```bash
./scripts/build-appimage.sh build                 # Build AppImage (default)
./scripts/build-appimage.sh clean                 # Clean build artifacts
./scripts/build-appimage.sh --help                # Show help
```

**What it does:**
1. Reads version from `Cargo.toml`
2. Builds release binary (`cargo build --release`)
3. Creates AppDir structure with:
   - Binary in `usr/bin/`
   - Desktop file in `usr/share/applications/`
   - **Icon from project root** (`icon.png`) in `usr/share/icons/hicolor/256x256/apps/`
   - Fallback: Generates placeholder icon if `icon.png` missing (requires ImageMagick)
4. Downloads and runs `linuxdeploy` to bundle dependencies
5. Creates final AppImage: `lazyllama-VERSION-x86_64.AppImage`

**Icon Handling:**
- **Primary**: Uses `icon.png` from project root for consistent branding
- **Fallback**: Generates blue placeholder with ImageMagick if icon missing
- **Backup**: Creates empty PNG if ImageMagick unavailable
- Icon appears in application launchers and file managers

**Output:**
- AppImage in project root: `lazyllama-VERSION-x86_64.AppImage`
- Build artifacts in `target/appimage-build/`

**Requirements:**
- `patchelf` for binary patching
- `wget` for downloading linuxdeploy
- `imagemagick` (optional, for icon generation fallback)

**Cleanup:**
```bash
./scripts/build-appimage.sh clean  # Removes AppDir and linuxdeploy
```

---

### deploy-aur.sh - AUR Deployment

**Updates and deploys both AUR packages.**

```bash
./scripts/deploy-aur.sh                           # Update PKGBUILDs (dry-run)
./scripts/deploy-aur.sh --push                    # Update and push to AUR
./scripts/deploy-aur.sh --package lazyllama       # Only lazyllama
./scripts/deploy-aur.sh --package lazyllama-bin --push  # Only lazyllama-bin
```

**What it does:**
1. Reads version from `Cargo.toml`
2. Updates `pkgver=` and `pkgrel=1` in PKGBUILDs
3. Downloads and calculates SHA256 checksums:
   - `lazyllama`: from crates.io
   - `lazyllama-bin`: from GitHub releases
4. Validates PKGBUILDs with `makepkg --printsrcinfo`
5. Commits and pushes to AUR (with `--push`)

**Requirements:**
- AUR SSH key configured
- AUR repos cloned in `aur/*/aur-repo/`

**First-time setup:** See `aur/README.md`

## 🔧 Initial Setup

### 1. Cargo (crates.io)

```bash
# Get API token from https://crates.io/settings/tokens
cargo login
```

### 2. GitHub CLI

```bash
# Install
sudo pacman -S github-cli

# Authenticate
gh auth login
```

### 3. AUR

```bash
# Generate SSH key
ssh-keygen -t ed25519 -C "your-email@example.com"

# Add to AUR account: https://aur.archlinux.org/account/
cat ~/.ssh/id_ed25519.pub

# Clone AUR repositories
cd aur/lazyllama
git clone ssh://aur@aur.archlinux.org/lazyllama.git aur-repo

cd ../lazyllama-bin
git clone ssh://aur@aur.archlinux.org/lazyllama-bin.git aur-repo
```

## 📝 Release Checklist

- [ ] Update `CHANGELOG.md` (if exists)
- [ ] Update version in `Cargo.toml`
- [ ] Update version in `Cargo.lock`: `cargo update`
- [ ] Run tests: `cargo test --all-features`
- [ ] Commit changes: `git commit -am "Bump version to X.Y.Z"`
- [ ] Push to GitHub: `git push`
- [ ] Run release script: `./scripts/release.sh`
- [ ] Verify releases:
  - [ ] https://crates.io/crates/lazyllama
  - [ ] https://github.com/Pommersche92/lazyllama/releases
  - [ ] https://aur.archlinux.org/packages/lazyllama
  - [ ] https://aur.archlinux.org/packages/lazyllama-bin

## 🐛 Troubleshooting

### "Failed to download crate from crates.io"
**Cause:** Version not published yet or crates.io sync delay

**Solution:**
```bash
# Publish manually first
cargo publish

# Wait a few minutes, then retry
./scripts/deploy-aur.sh --package lazyllama --push
```

### "Failed to download release from GitHub"
**Cause:** GitHub release doesn't exist or wrong tarball name

**Solution:**
```bash
# Create GitHub release first
./scripts/release-github.sh

# Then deploy AUR
./scripts/deploy-aur.sh --package lazyllama-bin --push
```

### "Release vX.Y.Z already exists"
**Cause:** You're trying to release the same version twice

**Solution:**
```bash
# Option 1: Delete existing release
gh release delete vX.Y.Z

# Option 2: Bump version in Cargo.toml
vim Cargo.toml
```

### "PKGBUILD validation failed"
**Cause:** Syntax error in PKGBUILD

**Solution:**
```bash
cd aur/lazyllama  # or lazyllama-bin
makepkg --printsrcinfo  # See error message
vim PKGBUILD  # Fix issue
```

### "Permission denied (publickey)" (AUR)
**Cause:** SSH key not configured for AUR

**Solution:**
```bash
# Test connection
ssh -T aur@aur.archlinux.org

# Add key to AUR if failed
cat ~/.ssh/id_ed25519.pub
# Paste at https://aur.archlinux.org/account/
```

## 🎯 Common Workflows

### Full Release (Normal)

```bash
# 1. Update version
vim Cargo.toml

# 2. Commit
git add Cargo.toml
git commit -m "Release v0.4.2"
git push

# 3. Release everything
./scripts/release.sh
```

### Hotfix Release

```bash
# 1. Fix bug and bump version
vim src/lib.rs Cargo.toml
git commit -am "Fix critical bug - v0.4.2"
git push

# 2. Quick release
./scripts/release.sh
```

### Re-release AUR Only

```bash
# If crates.io and GitHub already done
./scripts/deploy-aur.sh --push
```

### Create Draft Release

```bash
# For testing
./scripts/release-github.sh --draft

# Review at https://github.com/Pommersche92/lazyllama/releases
# Publish manually when ready
```

### Update Only One AUR Package

```bash
# Update only source package
./scripts/deploy-aur.sh --package lazyllama --push

# Update only binary package
./scripts/deploy-aur.sh --package lazyllama-bin --push
```

### Build AppImage

```bash
# Build AppImage
./scripts/build-appimage.sh build

# Clean build directory
./scripts/build-appimage.sh clean
```

### Submit to AppImageHub

**Prepares files for AppImageHub submission.**

```bash
./scripts/submit-appimagehub.sh
```

**What it does:**
1. Creates AppImageHub recipe file (`lazyllama.yml`)
2. Generates AppData metadata for better presentation
3. Provides step-by-step instructions for submission

**Requirements:**
- GitHub release with AppImage must exist first
- Fork of https://github.com/AppImage/appimage.github.io

**Note:** AppImageHub uses a pull request workflow. The script prepares files and shows instructions - you need to manually create the PR.

## 📚 Resources

- [Cargo Publish Documentation]https://doc.rust-lang.org/cargo/reference/publishing.html
- [GitHub CLI Manual]https://cli.github.com/manual/
- [AUR Submission Guidelines]https://wiki.archlinux.org/title/AUR_submission_guidelines
- [PKGBUILD Reference]https://wiki.archlinux.org/title/PKGBUILD