fix(mem0-agent): bundle a launcher so hooks never depend on a global CLI
SessionStart failed with 'pyenv: mem0-agent: command not found' in any repo whose
.python-version selects a Python the console script was not installed into. A
pip entry point is the wrong dependency for a plugin.
- bin/mem0-agent: POSIX launcher that picks the first CPython >= 3.10 it can find
and runs the package from source (there are no third-party dependencies)
- hooks now invoke ${CLAUDE_PLUGIN_ROOT}/bin/mem0-agent, matching how the v1
plugin calls its own scripts; the generator enforces this
- app_id override renamed to MEM0_AGENT_APP_ID: v1 exports MEM0_PROJECT_ID, which
was silently overriding this plugin's project scope while both are installed
Verified: all six hooks exit 0 from a pyenv-3.11 repo, and app_id resolves per
repository again.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
a07756f6d7
commit
dda5f21332
@@ -134,8 +134,8 @@ def test_hook_manifest_commands_all_exist():
|
||||
for entry in entries:
|
||||
for hook in entry.get("hooks", []):
|
||||
cmd = hook["command"]
|
||||
assert "mem0-agent " in cmd
|
||||
sub = cmd.split("mem0-agent ", 1)[1].split()[0]
|
||||
assert "bin/mem0-agent " in cmd, "hooks must call the bundled launcher"
|
||||
sub = cmd.split("bin/mem0-agent ", 1)[1].split()[0]
|
||||
assert sub in known, f"manifest invokes unknown subcommand {sub!r}"
|
||||
found += 1
|
||||
assert found >= 6
|
||||
@@ -174,7 +174,7 @@ def test_every_manifest_command_parses_verbatim(monkeypatch):
|
||||
for hook in entry.get("hooks", []):
|
||||
raw = hook["command"].strip("() ").split(">/dev/null")[0]
|
||||
tokens = shlex.split(raw)
|
||||
idx = tokens.index("mem0-agent")
|
||||
idx = next(i for i, t in enumerate(tokens) if t.endswith("bin/mem0-agent"))
|
||||
argv = [t for t in tokens[idx + 1:] if t != "&"]
|
||||
# shell vars like "$CLAUDE_SESSION_ID" become a literal in the test
|
||||
argv = ["session-x" if t.startswith("$") else t for t in argv]
|
||||
|
||||
Reference in New Issue
Block a user