feat(registry): format version 2, migrated by the writer (Issue #71)
- lib_py/registry_format.py: a pure, idempotent migrate() drops kill_command/start_command and rebuilds attach_command on every row (stopped/terminated included) and sets the top-level registry_format key. - atomic_dump_yaml migrates an older registry under its lock, before the caller's mutation, and then rewrites the YAML as well as the DB (the YAML write is otherwise skipped when only fields change). load_state_json stays read-only. New registries are written with the current version. - Entry point for #72: `python -m lib_py.registry_format --yaml <path>` runs the migration through the writer and prints `registry-format: <from> -> <to>, rows changed: <n>`. Refs #71 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
50e2998a20
commit
9c21fa4e4f
3 files changed
+117
-1
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import hashlib
|
||||
import re
|
||||
import shlex
|
||||
|
||||
def sanitize_herdr_agent_name(name: str) -> str:
|
||||
"""
|
||||
@@ -29,3 +30,14 @@ def sanitize_herdr_agent_name(name: str) -> str:
|
||||
|
||||
return s
|
||||
|
||||
|
||||
def attach_command(server, name):
|
||||
"""The registry row's attach_command (Issue #71).
|
||||
|
||||
A native herdr command, so it works from any shell: the server is always
|
||||
named (`default` too - herdr's env-free default), and the agent by the name
|
||||
herdr registered (sanitize_herdr_agent_name). create, resume and reconcile
|
||||
all write it from here.
|
||||
"""
|
||||
return "herdr --session %s agent attach %s" % (
|
||||
shlex.quote(server or "default"), shlex.quote(sanitize_herdr_agent_name(name)))
|
||||
Reference in new issue
Block a user