fix(refresh-marketplace): use /reload-plugins instead of /exit + restart
Claude Code's `/reload-plugins` slash command picks up newly installed plugins into the running session without forcing the user to /exit and restart Claude Code. The hook JSON `systemMessage` and `additionalContext` both now point at it. Tests updated to pin the new hint shape.
This commit is contained in:
parent
166c1c0752
commit
3aeb0f2fbd
2 changed files with 8 additions and 10 deletions
|
|
@ -383,8 +383,8 @@ def _emit_hook_message(events: dict[str, list[str]]) -> None:
|
|||
`systemMessage` is a transient toast (often missed). `additionalContext`
|
||||
is wrapped in a system reminder Claude reads at session start, so the
|
||||
model can mention the change if it's relevant to the user's first ask.
|
||||
Plugins require a Claude Code restart — they land on disk this session
|
||||
but only load on next session start.
|
||||
Plugins land on disk during the hook; `/reload-plugins` loads them into
|
||||
the running session without a restart.
|
||||
"""
|
||||
parts: list[str] = []
|
||||
if events["installed"]:
|
||||
|
|
@ -399,8 +399,8 @@ def _emit_hook_message(events: dict[str, list[str]]) -> None:
|
|||
)
|
||||
summary = "Your Agnes stack changed: " + "; ".join(parts) + "."
|
||||
restart_hint = (
|
||||
"Run `/exit` and then `claude` again to load the changes — "
|
||||
"Claude Code only picks up new/updated plugins on session start."
|
||||
"Run `/reload-plugins` to load the changes into this session — "
|
||||
"no restart needed."
|
||||
)
|
||||
payload = {
|
||||
"systemMessage": f"{summary} {restart_hint}",
|
||||
|
|
|
|||
|
|
@ -464,17 +464,15 @@ def test_quiet_emits_hook_json_when_plugin_installed(
|
|||
assert "grpn-fin" in payload["systemMessage"]
|
||||
assert "Agnes stack" in payload["systemMessage"]
|
||||
assert "installed" in payload["systemMessage"]
|
||||
# Restart hint: plugins land on disk this session but only load on
|
||||
# next session start, so the user must /exit + restart.
|
||||
assert "/exit" in payload["systemMessage"]
|
||||
assert "session start" in payload["systemMessage"].lower()
|
||||
# Reload hint: `/reload-plugins` loads the on-disk plugins into the
|
||||
# running Claude Code session without a full restart.
|
||||
assert "/reload-plugins" in payload["systemMessage"]
|
||||
|
||||
hook_specific = payload.get("hookSpecificOutput", {})
|
||||
assert hook_specific.get("hookEventName") == "SessionStart"
|
||||
additional = hook_specific.get("additionalContext", "")
|
||||
assert "grpn-fin" in additional
|
||||
assert "/exit" in additional
|
||||
assert "session start" in additional.lower()
|
||||
assert "/reload-plugins" in additional
|
||||
|
||||
|
||||
def test_manual_mode_prints_restart_hint_when_anything_changed(
|
||||
|
|
|
|||
Loading…
Reference in a new issue