memoryhub-cli 0.1.1__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.
- memoryhub_cli-0.1.1/.gitignore +36 -0
- memoryhub_cli-0.1.1/CHANGELOG.md +17 -0
- memoryhub_cli-0.1.1/PKG-INFO +83 -0
- memoryhub_cli-0.1.1/README.md +54 -0
- memoryhub_cli-0.1.1/pyproject.toml +56 -0
- memoryhub_cli-0.1.1/src/memoryhub_cli/__init__.py +3 -0
- memoryhub_cli-0.1.1/src/memoryhub_cli/config.py +41 -0
- memoryhub_cli-0.1.1/src/memoryhub_cli/main.py +479 -0
- memoryhub_cli-0.1.1/src/memoryhub_cli/project_config.py +417 -0
- memoryhub_cli-0.1.1/tests/__init__.py +0 -0
- memoryhub_cli-0.1.1/tests/test_project_config.py +387 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
venv/
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
htmlcov/
|
|
11
|
+
.coverage
|
|
12
|
+
.env
|
|
13
|
+
*.env
|
|
14
|
+
*.key
|
|
15
|
+
*.pem
|
|
16
|
+
*.p12
|
|
17
|
+
*.pfx
|
|
18
|
+
credentials.json
|
|
19
|
+
secrets.yaml
|
|
20
|
+
secrets.yml
|
|
21
|
+
|
|
22
|
+
# Per-operator files that must NOT be committed (contain real credentials)
|
|
23
|
+
# Each has a sibling `*.example.*` template that IS committed.
|
|
24
|
+
memory-hub-mcp/deploy/users-configmap.yaml
|
|
25
|
+
memory-hub-mcp/dev-users.json
|
|
26
|
+
.DS_Store
|
|
27
|
+
node_modules/
|
|
28
|
+
.build-context/
|
|
29
|
+
seed-clients.json
|
|
30
|
+
|
|
31
|
+
# Added by ggshield
|
|
32
|
+
.cache_ggshield
|
|
33
|
+
.mcp.json
|
|
34
|
+
|
|
35
|
+
NEXT_SESSION_old.md
|
|
36
|
+
NEXT_SESSION.md
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog — memoryhub-cli
|
|
2
|
+
|
|
3
|
+
All notable changes to the `memoryhub-cli` package.
|
|
4
|
+
|
|
5
|
+
## [0.1.1] — 2026-04-09
|
|
6
|
+
|
|
7
|
+
- Fix ruff lint errors (import sorting, `Optional` → `X | Y` annotations,
|
|
8
|
+
line length). No functional changes from 0.1.0.
|
|
9
|
+
|
|
10
|
+
## [0.1.0] — 2026-04-09
|
|
11
|
+
|
|
12
|
+
- Initial release. Terminal client for MemoryHub with search, read, write,
|
|
13
|
+
delete, and history commands.
|
|
14
|
+
- `memoryhub config init` — interactive wizard for generating
|
|
15
|
+
`.memoryhub.yaml` and `.claude/rules/memoryhub-loading.md`.
|
|
16
|
+
- `memoryhub config regenerate` — re-render rule file after editing YAML.
|
|
17
|
+
- `memoryhub login` — one-time credential setup.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memoryhub-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: CLI client for MemoryHub — centralized, governed memory for AI agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/redhat-ai-americas/memory-hub
|
|
6
|
+
Project-URL: Repository, https://github.com/redhat-ai-americas/memory-hub
|
|
7
|
+
Project-URL: Issues, https://github.com/redhat-ai-americas/memory-hub/issues
|
|
8
|
+
Author: Wes Jackson
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Keywords: agents,ai,cli,mcp,memory
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: memoryhub>=0.1.0
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: rich>=13.0
|
|
24
|
+
Requires-Dist: typer[all]>=0.15
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# memoryhub-cli
|
|
31
|
+
|
|
32
|
+
Command-line client for MemoryHub — centralized, governed memory for AI agents.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install memoryhub-cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Authenticate to a MemoryHub instance
|
|
44
|
+
memoryhub login
|
|
45
|
+
|
|
46
|
+
# Search for memories
|
|
47
|
+
memoryhub search "deployment patterns"
|
|
48
|
+
|
|
49
|
+
# Read a specific memory
|
|
50
|
+
memoryhub read <memory-id>
|
|
51
|
+
|
|
52
|
+
# Write a new memory
|
|
53
|
+
memoryhub write "Use Podman, not Docker" --scope user --weight 0.9
|
|
54
|
+
|
|
55
|
+
# Set up project-level memory loading
|
|
56
|
+
memoryhub config init
|
|
57
|
+
memoryhub config regenerate
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Project configuration
|
|
61
|
+
|
|
62
|
+
`memoryhub config` generates a project-local `.memoryhub.yaml` and a companion `.claude/rules/memoryhub-loading.md` rule file. Both files are meant to be committed so every contributor's agent inherits the same loading policy.
|
|
63
|
+
|
|
64
|
+
`memoryhub config init` is an interactive wizard that asks about session shape, loading pattern, focus source, and retrieval defaults, then writes both files at the project root. If a legacy `.claude/rules/memoryhub-integration.md` already exists, it is backed up to `.bak` before the new rule file is written.
|
|
65
|
+
|
|
66
|
+
`memoryhub config regenerate` re-renders the rule file from `.memoryhub.yaml` after you hand-edit the YAML. It reads the YAML and rewrites the Markdown rule file only; it does not modify `.memoryhub.yaml`.
|
|
67
|
+
|
|
68
|
+
Per-developer connection params (`url`, `auth_url`, `client_id`, `client_secret`) live separately at `~/.config/memoryhub/config.json` and are managed by `memoryhub login`. They are not stored in `.memoryhub.yaml` and are not committed.
|
|
69
|
+
|
|
70
|
+
## Further documentation
|
|
71
|
+
|
|
72
|
+
The CLI is one surface of the [memory-hub](https://github.com/redhat-ai-americas/memory-hub) monorepo. For deeper context:
|
|
73
|
+
|
|
74
|
+
- **[Architecture overview](https://github.com/redhat-ai-americas/memory-hub/blob/main/docs/ARCHITECTURE.md)** — System design, deployment topology
|
|
75
|
+
- **[MCP server tool reference](https://github.com/redhat-ai-americas/memory-hub/blob/main/docs/mcp-server.md)** — The 15 tools the CLI wraps
|
|
76
|
+
- **[Agent memory ergonomics design](https://github.com/redhat-ai-americas/memory-hub/blob/main/docs/agent-memory-ergonomics/design.md)** — Full `.memoryhub.yaml` schema, rule file templates, and session-loading patterns
|
|
77
|
+
- **[Python SDK](https://pypi.org/project/memoryhub/)** — if you'd rather call the tools from Python
|
|
78
|
+
|
|
79
|
+
## Links
|
|
80
|
+
|
|
81
|
+
- **[GitHub repository](https://github.com/redhat-ai-americas/memory-hub)**
|
|
82
|
+
- **[Issue tracker](https://github.com/redhat-ai-americas/memory-hub/issues)**
|
|
83
|
+
- **[License (Apache 2.0)](https://github.com/redhat-ai-americas/memory-hub/blob/main/LICENSE)**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# memoryhub-cli
|
|
2
|
+
|
|
3
|
+
Command-line client for MemoryHub — centralized, governed memory for AI agents.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install memoryhub-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Authenticate to a MemoryHub instance
|
|
15
|
+
memoryhub login
|
|
16
|
+
|
|
17
|
+
# Search for memories
|
|
18
|
+
memoryhub search "deployment patterns"
|
|
19
|
+
|
|
20
|
+
# Read a specific memory
|
|
21
|
+
memoryhub read <memory-id>
|
|
22
|
+
|
|
23
|
+
# Write a new memory
|
|
24
|
+
memoryhub write "Use Podman, not Docker" --scope user --weight 0.9
|
|
25
|
+
|
|
26
|
+
# Set up project-level memory loading
|
|
27
|
+
memoryhub config init
|
|
28
|
+
memoryhub config regenerate
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Project configuration
|
|
32
|
+
|
|
33
|
+
`memoryhub config` generates a project-local `.memoryhub.yaml` and a companion `.claude/rules/memoryhub-loading.md` rule file. Both files are meant to be committed so every contributor's agent inherits the same loading policy.
|
|
34
|
+
|
|
35
|
+
`memoryhub config init` is an interactive wizard that asks about session shape, loading pattern, focus source, and retrieval defaults, then writes both files at the project root. If a legacy `.claude/rules/memoryhub-integration.md` already exists, it is backed up to `.bak` before the new rule file is written.
|
|
36
|
+
|
|
37
|
+
`memoryhub config regenerate` re-renders the rule file from `.memoryhub.yaml` after you hand-edit the YAML. It reads the YAML and rewrites the Markdown rule file only; it does not modify `.memoryhub.yaml`.
|
|
38
|
+
|
|
39
|
+
Per-developer connection params (`url`, `auth_url`, `client_id`, `client_secret`) live separately at `~/.config/memoryhub/config.json` and are managed by `memoryhub login`. They are not stored in `.memoryhub.yaml` and are not committed.
|
|
40
|
+
|
|
41
|
+
## Further documentation
|
|
42
|
+
|
|
43
|
+
The CLI is one surface of the [memory-hub](https://github.com/redhat-ai-americas/memory-hub) monorepo. For deeper context:
|
|
44
|
+
|
|
45
|
+
- **[Architecture overview](https://github.com/redhat-ai-americas/memory-hub/blob/main/docs/ARCHITECTURE.md)** — System design, deployment topology
|
|
46
|
+
- **[MCP server tool reference](https://github.com/redhat-ai-americas/memory-hub/blob/main/docs/mcp-server.md)** — The 15 tools the CLI wraps
|
|
47
|
+
- **[Agent memory ergonomics design](https://github.com/redhat-ai-americas/memory-hub/blob/main/docs/agent-memory-ergonomics/design.md)** — Full `.memoryhub.yaml` schema, rule file templates, and session-loading patterns
|
|
48
|
+
- **[Python SDK](https://pypi.org/project/memoryhub/)** — if you'd rather call the tools from Python
|
|
49
|
+
|
|
50
|
+
## Links
|
|
51
|
+
|
|
52
|
+
- **[GitHub repository](https://github.com/redhat-ai-americas/memory-hub)**
|
|
53
|
+
- **[Issue tracker](https://github.com/redhat-ai-americas/memory-hub/issues)**
|
|
54
|
+
- **[License (Apache 2.0)](https://github.com/redhat-ai-americas/memory-hub/blob/main/LICENSE)**
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "memoryhub-cli"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "CLI client for MemoryHub — centralized, governed memory for AI agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Wes Jackson" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ai", "agents", "memory", "cli", "mcp"]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"memoryhub>=0.1.0",
|
|
18
|
+
"typer[all]>=0.15",
|
|
19
|
+
"rich>=13.0",
|
|
20
|
+
"pyyaml>=6.0",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 3 - Alpha",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"License :: OSI Approved :: Apache Software License",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Environment :: Console",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
memoryhub = "memoryhub_cli.main:app"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=8.0",
|
|
40
|
+
"ruff>=0.4",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://github.com/redhat-ai-americas/memory-hub"
|
|
45
|
+
Repository = "https://github.com/redhat-ai-americas/memory-hub"
|
|
46
|
+
Issues = "https://github.com/redhat-ai-americas/memory-hub/issues"
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/memoryhub_cli"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
target-version = "py310"
|
|
53
|
+
line-length = 99
|
|
54
|
+
|
|
55
|
+
[tool.ruff.lint]
|
|
56
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Configuration management for MemoryHub CLI."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
CONFIG_DIR = Path.home() / ".config" / "memoryhub"
|
|
7
|
+
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def load_config() -> dict:
|
|
11
|
+
"""Load config from disk. Returns empty dict if not found."""
|
|
12
|
+
if not CONFIG_FILE.exists():
|
|
13
|
+
return {}
|
|
14
|
+
return json.loads(CONFIG_FILE.read_text())
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def save_config(config: dict) -> None:
|
|
18
|
+
"""Save config to disk."""
|
|
19
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
20
|
+
CONFIG_FILE.write_text(json.dumps(config, indent=2) + "\n")
|
|
21
|
+
# Restrict permissions — contains secrets
|
|
22
|
+
CONFIG_FILE.chmod(0o600)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_connection_params() -> dict:
|
|
26
|
+
"""Get connection parameters, preferring env vars over config file.
|
|
27
|
+
|
|
28
|
+
Required keys: url, auth_url, client_id, client_secret.
|
|
29
|
+
Env vars: MEMORYHUB_URL, MEMORYHUB_AUTH_URL, MEMORYHUB_CLIENT_ID, MEMORYHUB_CLIENT_SECRET.
|
|
30
|
+
"""
|
|
31
|
+
import os
|
|
32
|
+
|
|
33
|
+
config = load_config()
|
|
34
|
+
return {
|
|
35
|
+
"url": os.environ.get("MEMORYHUB_URL", config.get("url", "")),
|
|
36
|
+
"auth_url": os.environ.get("MEMORYHUB_AUTH_URL", config.get("auth_url", "")),
|
|
37
|
+
"client_id": os.environ.get("MEMORYHUB_CLIENT_ID", config.get("client_id", "")),
|
|
38
|
+
"client_secret": os.environ.get(
|
|
39
|
+
"MEMORYHUB_CLIENT_SECRET", config.get("client_secret", "")
|
|
40
|
+
),
|
|
41
|
+
}
|