set-prompt 0.8.1 → 0.8.2

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ---
6
6
 
7
+ ## [0.8.2] - 2026-05-02
8
+
9
+ ### Fixed
10
+ - **Hermes `register_skill` argument types** — fixed `'str' object has no attribute 'exists'` error that surfaced after enabling the plugin in Hermes. The generated `__init__.py` was passing `str(skill_path)` (the skill directory as a string), but Hermes's `ctx.register_skill(name, path)` expects:
11
+ 1. A `pathlib.Path` object (not a string)
12
+ 2. The path to `SKILL.md` itself (not the parent directory)
13
+ Verified against the official "Build a Hermes plugin" guide example. Now passes `skill_path / "SKILL.md"` as a `Path`.
14
+ - **Hermes command handler signature** — handler is now defined as `handler(raw_args: str = "") -> Optional[str]` matching the documented Hermes signature (previously `handler(_args=None)`).
15
+ - **Slash commands silent in gateway/TUI mode** — `ctx.inject_message()` is documented as **CLI-mode only** (returns `False` in gateway mode). The handler now falls back to **returning the markdown body** as the command's response when `inject_message` is unavailable, so the content is still visible to the user instead of being silently dropped.
16
+ - **`register_command` now uses keyword arguments** (`handler=`, `description=`) to match the official Hermes plugin examples (e.g. `disk-cleanup`) and stay robust if Hermes reorders positional parameters.
17
+
18
+ ### Notes
19
+ - After upgrading, re-run `set-prompt link hermes` to regenerate `__init__.py`, then restart Hermes. The plugin should now load with `✓ set-prompt v1.0` and skills become loadable via `skill_view("set-prompt:<name>")` (plugin skills are opt-in explicit loads — they do not appear in Hermes's auto-listed `available_skills` index).
20
+ - Hook callbacks remain `def runner(*args, **kwargs)` — Hermes documents that all hook callbacks should accept `**kwargs` for forward compatibility, and the bridge's role is purely to forward the payload to the user-defined hook command via stdin JSON.
21
+
22
+ ---
23
+
7
24
  ## [0.8.1] - 2026-05-02
8
25
 
9
26
  ### Changed
package/README.md CHANGED
@@ -123,7 +123,7 @@ The interactive mode shows all agents with their current state. **Check to link,
123
123
 
124
124
  > **Note on Gemini CLI**: Skills follow the standard `skills/<name>/SKILL.md` pattern. Commands use `.toml` format (not `.md`) and agents use `.md` with YAML frontmatter. Files in your repo's `commands/` must be TOML for Gemini CLI to recognize them. **Agents have strict frontmatter validation** — unknown keys (e.g. `allowed-tools`, `color`, `mode` from other platforms) cause Gemini CLI to reject the agent. See `SET_PROMPT_GUIDE.md` for the allowed keys.
125
125
 
126
- > **Note on Hermes**: Hermes plugins must register skills/commands/hooks programmatically — directory drop-ins are not auto-discovered. set-prompt generates a small Python adapter (`~/.hermes/plugins/set-prompt/__init__.py`) with the repo's absolute path baked in, so no symlinks are needed. **Restart Hermes after `link` (or after adding/removing a skill in your repo)** — `register()` runs only once at Hermes startup. Activation requires `set-prompt` listed under `plugins.enabled` in `~/.hermes/config.yaml` — set-prompt writes this entry automatically (creating the file when absent, or appending to the existing list while preserving other entries and comments via AST-based YAML editing with backup/rollback). Hooks are observation-only on the Hermes side: the same `hooks/hooks.json` is reused, but Hermes events (`pre_tool_call`, `on_session_start`, etc.) are picked up while Claude/Cursor keys are ignored. Hook scripts can reference `${SET_PROMPT_REPO}`.
126
+ > **Note on Hermes**: Hermes plugins must register skills/commands/hooks programmatically — directory drop-ins are not auto-discovered. set-prompt generates a small Python adapter (`~/.hermes/plugins/set-prompt/__init__.py`) with the repo's absolute path baked in, so no symlinks are needed. **Restart Hermes after `link` (or after adding/removing a skill in your repo)** — `register()` runs only once at Hermes startup. Activation requires `set-prompt` listed under `plugins.enabled` in `~/.hermes/config.yaml` — set-prompt writes this entry automatically (creating the file when absent, or appending to the existing list while preserving other entries and comments via AST-based YAML editing with backup/rollback). **Plugin skills are opt-in explicit loads** — they do not appear in Hermes's auto-listed `available_skills` index; load them via `skill_view("set-prompt:<name>")`. Hooks are observation-only on the Hermes side: the same `hooks/hooks.json` is reused, but Hermes events (`pre_tool_call`, `on_session_start`, etc.) are picked up while Claude/Cursor keys are ignored. Hook scripts can reference `${SET_PROMPT_REPO}`.
127
127
 
128
128
  ---
129
129
 
package/dist/index.js CHANGED
@@ -549,7 +549,7 @@ required_environment_variables:
549
549
 
550
550
  > **Gemini CLI note**: Only \`name\` and \`description\` are recognized. \`name\` must be lowercase with hyphens and match the directory name.
551
551
 
552
- > **Hermes note (set-prompt integration)**: Hermes does not auto-discover files in standard directories \u2014 plugins must register skills programmatically. set-prompt generates \`~/.hermes/plugins/set-prompt/{plugin.yaml, __init__.py}\` on \`set-prompt link hermes\`. The \`__init__.py\` reads \`<repo>/skills/<skill-name>/SKILL.md\` directly (REPO_DIR is baked in at link time) and calls \`ctx.register_skill()\` at Hermes startup. The skill directory layout is the same as other platforms \u2014 no nested category folder.
552
+ > **Hermes note (set-prompt integration)**: Hermes does not auto-discover files in standard directories \u2014 plugins must register skills programmatically. set-prompt generates \`~/.hermes/plugins/set-prompt/{plugin.yaml, __init__.py}\` on \`set-prompt link hermes\`. The \`__init__.py\` reads \`<repo>/skills/<skill-name>/SKILL.md\` directly (REPO_DIR is baked in at link time) and calls \`ctx.register_skill(name, Path(SKILL.md))\` at Hermes startup. The skill directory layout is the same as other platforms \u2014 no nested category folder. **Plugin skills are opt-in explicit loads** \u2014 they do not appear in Hermes's auto-listed \`available_skills\` index; load via \`skill_view("set-prompt:<skill-name>")\`.
553
553
 
554
554
  | Field | Required | Platform | Description |
555
555
  |-------|----------|----------|-------------|
@@ -659,7 +659,7 @@ Include: 1) Refactored code. 2) Explanation of changes.
659
659
 
660
660
  #### Hermes commands (set-prompt integration)
661
661
 
662
- Hermes commands are registered programmatically. set-prompt's generated \`__init__.py\` walks \`<repo>/commands/*.md\`, parses each file's YAML frontmatter for \`name\` / \`description\`, and calls \`ctx.register_command(name, handler, description)\`. The handler injects the markdown body as a user message via \`ctx.inject_message(body, role="user")\` when the user invokes the slash command. Hermes does **not** read \`allowed-tools\`, \`model\`, \`agent\`, or other platform-specific frontmatter \u2014 only \`name\` and \`description\` are honored.
662
+ Hermes commands are registered programmatically. set-prompt's generated \`__init__.py\` walks \`<repo>/commands/*.md\`, parses each file's YAML frontmatter for \`name\` / \`description\`, and calls \`ctx.register_command(name, handler=..., description=...)\`. The handler tries to inject the markdown body as a user message via \`ctx.inject_message(body, role="user")\` when the slash command is invoked. **\`inject_message\` is CLI-mode only** \u2014 in gateway/TUI mode it returns \`False\`, and the handler falls back to **returning the body** as the command's response so the content is still visible. Hermes does **not** read \`allowed-tools\`, \`model\`, \`agent\`, or other platform-specific frontmatter \u2014 only \`name\` and \`description\` are honored.
663
663
 
664
664
  | Field | Required | Platform | Description |
665
665
  |-------|----------|----------|-------------|
@@ -2537,8 +2537,18 @@ def _parse_frontmatter(text):
2537
2537
 
2538
2538
 
2539
2539
  def _make_command_handler(ctx, body):
2540
- def handler(_args=None):
2541
- ctx.inject_message(body, role="user")
2540
+ # Hermes calls handlers as handler(raw_args: str) -> Optional[str].
2541
+ # Primary path: inject the markdown body as a user message (CLI mode).
2542
+ # Fallback: in gateway mode inject_message returns False \u2014 return the body
2543
+ # as the handler response so the content is at least visible to the user.
2544
+ def handler(raw_args=""):
2545
+ try:
2546
+ ok = ctx.inject_message(body, role="user")
2547
+ except Exception:
2548
+ ok = False
2549
+ if not ok:
2550
+ return body
2551
+ return None
2542
2552
  return handler
2543
2553
 
2544
2554
 
@@ -2607,9 +2617,11 @@ def register(ctx):
2607
2617
  for skill_path in sorted(skills_dir.iterdir()):
2608
2618
  if not skill_path.is_dir():
2609
2619
  continue
2610
- if not (skill_path / "SKILL.md").exists():
2620
+ skill_md = skill_path / "SKILL.md"
2621
+ if not skill_md.exists():
2611
2622
  continue
2612
- ctx.register_skill(skill_path.name, str(skill_path))
2623
+ # Hermes expects (name, Path-to-SKILL.md), not (name, dir-as-str).
2624
+ ctx.register_skill(skill_path.name, skill_md)
2613
2625
 
2614
2626
  commands_dir = REPO_DIR / "commands"
2615
2627
  if commands_dir.exists():
@@ -2621,7 +2633,11 @@ def register(ctx):
2621
2633
  meta, body = _parse_frontmatter(text)
2622
2634
  name = meta.get("name") or cmd_file.stem
2623
2635
  description = meta.get("description") or ""
2624
- ctx.register_command(name, _make_command_handler(ctx, body), description)
2636
+ ctx.register_command(
2637
+ name,
2638
+ handler=_make_command_handler(ctx, body),
2639
+ description=description,
2640
+ )
2625
2641
 
2626
2642
  _register_hooks(ctx)
2627
2643
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "set-prompt",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "One repo. Every AI coding tool. Always in sync.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -31,7 +31,8 @@
31
31
  "cursor",
32
32
  "codex",
33
33
  "opencode",
34
- "gemini-cli"
34
+ "gemini-cli",
35
+ "hermes"
35
36
  ],
36
37
  "author": "juncha9 (https://github.com/juncha9)",
37
38
  "license": "MIT",