Skip to content

Commit af65ab0

Browse files
committed
Implement CLI for Memori with commands for version, initialization, and health checks; add documentation and tests.
1 parent 36b0ff7 commit af65ab0

File tree

7 files changed

+864
-3
lines changed

7 files changed

+864
-3
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ All notable changes to Memori will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### **Added**
11+
12+
#### **Minimal CLI for Memori**
13+
- `memori --version`: Display version
14+
- `memori init [--force]`: Create starter config (`memori.json`)
15+
- `memori health [--config <path>] [--check-db]`: Validate environment and configuration
16+
- Console script automatically available after `pip install memorisdk`
17+
- Pure Python implementation using only standard library (argparse, json, pathlib, importlib.metadata)
18+
- 26 unit tests with comprehensive coverage
19+
20+
#### **Documentation**
21+
- Added CLI reference guide with examples and troubleshooting
22+
- Updated quick-start to mention CLI availability
23+
- Integrated CLI reference into navigation
24+
25+
---
26+
827
## [2.3.0] - 2025-09-29
928

1029
### 🚀 **Major Performance Improvements**
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# CLI Reference
2+
3+
Memori CLI is automatically available after `pip install memorisdk`.
4+
5+
## Quick Reference
6+
7+
| Command | Purpose |
8+
|---------|---------|
9+
| `memori --version` | Show version |
10+
| `memori init` | Create `memori.json` config |
11+
| `memori init --force` | Overwrite config |
12+
| `memori health` | Validate setup |
13+
| `memori health --check-db` | Check database connection |
14+
| `memori health --config <path>` | Validate custom config |
15+
16+
---
17+
18+
## Commands
19+
20+
### `memori --version`
21+
22+
Display installed version:
23+
```bash
24+
memori --version
25+
# Output: memori version 2.3.0
26+
```
27+
28+
### `memori init`
29+
30+
Create a starter configuration with sensible defaults:
31+
```bash
32+
memori init
33+
memori init --force # Overwrite existing config
34+
```
35+
36+
Creates `memori.json` with:
37+
- SQLite database connection
38+
- OpenAI API key placeholder
39+
- Memory namespace and retention policy
40+
- Logging configuration
41+
42+
See [Configuration Guide](../configuration/settings.md) for detailed structure.
43+
44+
### `memori health`
45+
46+
Validate environment, dependencies, and configuration:
47+
```bash
48+
memori health
49+
memori health --config custom.json # Validate custom config
50+
memori health --check-db # Include database test
51+
```
52+
53+
**Checks performed:**
54+
1. Package import
55+
2. Core dependencies (Pydantic, SQLAlchemy, OpenAI, LiteLLM, Loguru, python-dotenv)
56+
3. Configuration file validity and required sections
57+
4. Database connectivity (with `--check-db`)
58+
59+
**Exit codes:**
60+
- `0`: All checks passed
61+
- Non-zero: At least one check failed
62+
63+
---
64+
65+
## Workflow
66+
67+
```bash
68+
# 1. Create config
69+
memori init
70+
71+
# 2. Edit memori.json
72+
# Set your OpenAI API key and adjust settings as needed
73+
74+
# 3. Validate setup
75+
memori health --check-db
76+
77+
# 4. Use in Python
78+
python your_script.py
79+
```
80+
81+
## CI/CD Integration
82+
83+
```yaml
84+
# .github/workflows/test.yml
85+
- name: Install dependencies
86+
run: pip install memorisdk
87+
88+
- name: Verify memori setup
89+
run: memori health --check-db
90+
```
91+
92+
## Troubleshooting
93+
94+
| Issue | Solution |
95+
|-------|----------|
96+
| Command not found | `pip install memorisdk` |
97+
| Config not found | `memori init` |
98+
| Invalid JSON | `memori init --force` |
99+
| Missing dependencies | `pip install memorisdk[all]` |
100+
| Database connection error | Check `connection_string` in `memori.json` |
101+
102+
---
103+
104+
## Help
105+
106+
```bash
107+
memori --help # Show all commands
108+
memori init --help # Show init options
109+
memori health --help # Show health options
110+
```
111+
112+
---
113+
114+
**Next:** [Configuration Guide](../configuration/settings.md) • [Basic Usage](basic-usage.md) • [Examples](../examples/overview.md)

docs/getting-started/quick-start.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Get Memori running in less than a minute.
88
pip install memorisdk openai
99
```
1010

11+
!!! tip "CLI Available"
12+
Memori now includes a CLI! Use `memori init` to create a config file and `memori health` to check your setup. See the [CLI Reference](cli-reference.md) for details.
13+
1114
## 2. Set API Key
1215

1316
```bash

0 commit comments

Comments
 (0)