docs: Update exit codes, add config precedence and shell completions

Exit code tables (README + AGENTS.md):
- Add codes 14-16 (Ollama unavailable, model not found, embedding failed)
- Add code 20 (Config not found, remapped from 2)
- Clarify code 1 (now includes health check failed + not implemented)
- Clarify code 2 (now exclusively usage/parsing errors from clap)

New sections:
- Configuration Precedence: CLI flags > env vars > config file > defaults
- Shell Completions: bash, zsh, fish, powershell installation instructions

Co-Authored-By: Claude (us.anthropic.claude-opus-4-5-20251101-v1:0) <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-01-30 16:55:02 -05:00
parent 03ea51513d
commit 7b7d781a19
2 changed files with 46 additions and 4 deletions

View File

@@ -98,8 +98,8 @@ Errors return structured JSON to stderr:
| Code | Meaning | | Code | Meaning |
|------|---------| |------|---------|
| 0 | Success | | 0 | Success |
| 1 | Internal error | | 1 | Internal error / health check failed / not implemented |
| 2 | Config not found | | 2 | Usage error (invalid flags or arguments) |
| 3 | Config invalid | | 3 | Config invalid |
| 4 | Token not set | | 4 | Token not set |
| 5 | GitLab auth failed | | 5 | GitLab auth failed |
@@ -111,6 +111,17 @@ Errors return structured JSON to stderr:
| 11 | Migration failed | | 11 | Migration failed |
| 12 | I/O error | | 12 | I/O error |
| 13 | Transform error | | 13 | Transform error |
| 14 | Ollama unavailable |
| 15 | Ollama model not found |
| 16 | Embedding failed |
| 20 | Config not found |
### Configuration Precedence
1. CLI flags (highest priority)
2. Environment variables (`LORE_ROBOT`, `GITLAB_TOKEN`, `LORE_CONFIG_PATH`)
3. Config file (`~/.config/lore/config.json`)
4. Built-in defaults (lowest priority)
### Best Practices ### Best Practices

View File

@@ -406,8 +406,8 @@ Errors return structured JSON to stderr:
| Code | Meaning | | Code | Meaning |
|------|---------| |------|---------|
| 0 | Success | | 0 | Success |
| 1 | Internal error | | 1 | Internal error / health check failed / not implemented |
| 2 | Config not found | | 2 | Usage error (invalid flags or arguments) |
| 3 | Config invalid | | 3 | Config invalid |
| 4 | Token not set | | 4 | Token not set |
| 5 | GitLab auth failed | | 5 | GitLab auth failed |
@@ -419,6 +419,19 @@ Errors return structured JSON to stderr:
| 11 | Migration failed | | 11 | Migration failed |
| 12 | I/O error | | 12 | I/O error |
| 13 | Transform error | | 13 | Transform error |
| 14 | Ollama unavailable |
| 15 | Ollama model not found |
| 16 | Embedding failed |
| 20 | Config not found |
## Configuration Precedence
Settings are resolved in this order (highest to lowest priority):
1. CLI flags (`--robot`, `--config`, `--color`)
2. Environment variables (`LORE_ROBOT`, `GITLAB_TOKEN`, `LORE_CONFIG_PATH`)
3. Config file (`~/.config/lore/config.json`)
4. Built-in defaults
## Global Options ## Global Options
@@ -428,6 +441,24 @@ lore --robot <command> # Machine-readable JSON
lore -J <command> # JSON shorthand lore -J <command> # JSON shorthand
``` ```
## Shell Completions
Generate shell completions for tab-completion support:
```bash
# Bash (add to ~/.bashrc)
lore completions bash > ~/.local/share/bash-completion/completions/lore
# Zsh (add to ~/.zshrc: fpath=(~/.zfunc $fpath))
lore completions zsh > ~/.zfunc/_lore
# Fish
lore completions fish > ~/.config/fish/completions/lore.fish
# PowerShell (add to $PROFILE)
lore completions powershell >> $PROFILE
```
## Database Schema ## Database Schema
Data is stored in SQLite with WAL mode and foreign keys enabled. Main tables: Data is stored in SQLite with WAL mode and foreign keys enabled. Main tables: