|
| 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) |
0 commit comments