mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
feat(curator): add hermes curator list-archived command (#21236)
Lists the skills sitting in ~/.hermes/skills/.archive/ so users have something to pass to `hermes curator restore`. `curator status` already shows counts; this fills the name-discovery gap. Archive layout is flat (`archive_skill` writes to `.archive/<skill>/`), so the directory name IS the skill name — no frontmatter parsing needed. Timestamped collision directories (`<skill>-<ts>`) are listed literally; user can still pass them to `restore`. Reshape of @EvilDrag0n's #20651, simplified: drop the frontmatter rglob + preamble/trailer output + duplicate subcommand registration. Co-authored-by: EvilDrag0n <lxl694522264@gmail.com>
This commit is contained in:
parent
47bf5d7ecb
commit
ae1f058b3c
4 changed files with 31 additions and 2 deletions
|
|
@ -157,9 +157,9 @@ COMMAND_REGISTRY: list[CommandDef] = [
|
|||
CommandDef("cron", "Manage scheduled tasks", "Tools & Skills",
|
||||
cli_only=True, args_hint="[subcommand]",
|
||||
subcommands=("list", "add", "create", "edit", "pause", "resume", "run", "remove")),
|
||||
CommandDef("curator", "Background skill maintenance (status, run, pin, archive)",
|
||||
CommandDef("curator", "Background skill maintenance (status, run, pin, archive, list-archived)",
|
||||
"Tools & Skills", args_hint="[subcommand]",
|
||||
subcommands=("status", "run", "pause", "resume", "pin", "unpin", "restore")),
|
||||
subcommands=("status", "run", "pause", "resume", "pin", "unpin", "restore", "list-archived")),
|
||||
CommandDef("kanban", "Multi-profile collaboration board (tasks, links, comments)",
|
||||
"Tools & Skills", args_hint="[subcommand]",
|
||||
subcommands=("list", "ls", "show", "create", "assign", "link", "unlink",
|
||||
|
|
|
|||
|
|
@ -452,6 +452,18 @@ def _cmd_rollback(args) -> int:
|
|||
return 1
|
||||
|
||||
|
||||
def _cmd_list_archived(args) -> int:
|
||||
"""List archived (recoverable) skills."""
|
||||
from tools import skill_usage
|
||||
names = skill_usage.list_archived_skill_names()
|
||||
if not names:
|
||||
print("curator: no archived skills")
|
||||
return 0
|
||||
for name in names:
|
||||
print(name)
|
||||
return 0
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# argparse wiring (called from hermes_cli.main)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -502,6 +514,9 @@ def register_cli(parent: argparse.ArgumentParser) -> None:
|
|||
p_restore.add_argument("skill", help="Skill name")
|
||||
p_restore.set_defaults(func=_cmd_restore)
|
||||
|
||||
subs.add_parser("list-archived", help="List archived skills") \
|
||||
.set_defaults(func=_cmd_list_archived)
|
||||
|
||||
p_archive = subs.add_parser(
|
||||
"archive",
|
||||
help="Manually archive a skill (move to .archive/, excluded from prompt)",
|
||||
|
|
|
|||
|
|
@ -870,6 +870,7 @@ AUTHOR_MAP = {
|
|||
"leosma@gmail.com": "leon7609", # PR #19069
|
||||
"nouseman666@gmail.com": "nouseman666", # PR #19088
|
||||
"ginwu05@gmail.com": "GinWU05", # PR #19093
|
||||
"lxl694522264@gmail.com": "EvilDrag0n", # PR #20651
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -205,6 +205,19 @@ def list_agent_created_skill_names() -> List[str]:
|
|||
return sorted(set(names))
|
||||
|
||||
|
||||
def list_archived_skill_names() -> List[str]:
|
||||
"""Enumerate skills in ``~/.hermes/skills/.archive/``.
|
||||
|
||||
Archive layout is flat (``.archive/<skill>/``) as set by ``archive_skill``,
|
||||
so the directory name is the skill name. Used by ``hermes curator
|
||||
list-archived`` to help users pass a name to ``hermes curator restore``.
|
||||
"""
|
||||
archive_root = _archive_dir()
|
||||
if not archive_root.exists():
|
||||
return []
|
||||
return sorted({p.name for p in archive_root.iterdir() if p.is_dir()})
|
||||
|
||||
|
||||
def _read_skill_name(skill_md: Path, fallback: str) -> str:
|
||||
"""Parse the `name:` field from a SKILL.md YAML frontmatter."""
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue