feat(skills)!: S4 night commands become drain, suspend and resume
Requirement 001 phase 6, S4 (decision 29): - Skills renamed: kvb-org-evening -> kvb-org-drain, kvb-org-sunset -> kvb-org-suspend, kvb-org-sunrise -> kvb-org-resume, kvb-agent-relax -> kvb-agent-drain, kvb-agent-sleep -> kvb-agent-suspend, kvb-agent-wakeup -> kvb-agent-resume; their text uses the new verbs and every reference in skills, README, orchestrator and tests follows. - night.py takes drain, suspend, resume, resume --alone and status. A state file written before the rename keeps working: mode evening reads as drain, sunset as suspend, the awake list as resumed and is rewritten on the next save; the hub's council.night_mode maps the same values. mode: day and handover_night_<session>.md keep their names. - Orchestrator: the Day/Night menu shows Drain, Suspend and Resume, each confirmed, signed through /api/board/sign with the passkey and run as the existing argv job; the old action names are refused. - kvb-skill-cleanup: git rates two renames at 44 and 50 % similarity, under its default threshold, so legacy.py detects renames from 40 %. - tests/test_night_names.py fails on any old name in the tree outside a rename record "old ->". BREAKING CHANGE: the six old skill names and night.py's clear and wake are gone. Run make install (it reinstalls the orchestrator too), then kvb-skill-cleanup to remove the old installed copies; until the install, the running hub calls the old night.py path. Evidence: make test 679 OK, ruff and markdownlint clean (/tmp/s4-make-test-1.log); e2e 22 OK in Chromium and Firefox (/tmp/s4-e2e-3.log); MEDUSA 23 files, the 2 findings are the byte-identical atomic state write that moved with night.py, already accepted after a skeptic at its old path, rescan 0 open. 🎯 Fix: 93 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 89 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d88296e47
commit
5c8b69d53d
24 files changed
+420
-176
No files matched your search
@@ -0,0 +1,65 @@
|
||||
"""Pin decision 29: the six night skills renamed to drain, suspend and resume leave their old names nowhere but in a rename record."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
RENAMED = {
|
||||
"kvb-org-evening": "kvb-org-drain",
|
||||
"kvb-org-sunset": "kvb-org-suspend",
|
||||
"kvb-org-sunrise": "kvb-org-resume",
|
||||
"kvb-agent-relax": "kvb-agent-drain",
|
||||
"kvb-agent-sleep": "kvb-agent-suspend",
|
||||
"kvb-agent-wakeup": "kvb-agent-resume",
|
||||
}
|
||||
OLD = re.compile(r"(?<![\w-])(?:" + "|".join(map(re.escape, RENAMED)) + r")(?![\w-])")
|
||||
RECORD = re.compile(r"`(?:" + "|".join(map(re.escape, RENAMED)) + r")` →")
|
||||
SELF = Path(__file__).resolve().relative_to(REPO_ROOT).as_posix()
|
||||
|
||||
|
||||
def old_name_lines() -> list[str]:
|
||||
"""Returns:
|
||||
Every `path:line` of a tracked or new, not ignored text file that names
|
||||
an old night skill outside a rename record (`old` → `new`, as decision
|
||||
29 of docs/requirements/001-agent-orchestrator.md writes it).
|
||||
"""
|
||||
listed = subprocess.run(
|
||||
["git", "ls-files", "-z", "--cached", "--others", "--exclude-standard"],
|
||||
cwd=REPO_ROOT, capture_output=True, text=True, check=True,
|
||||
).stdout
|
||||
hits = []
|
||||
for name in sorted(set(listed.split("\0")) - {"", SELF}):
|
||||
try:
|
||||
text = (REPO_ROOT / name).read_text(encoding="utf-8")
|
||||
except (UnicodeDecodeError, IsADirectoryError, FileNotFoundError):
|
||||
continue
|
||||
for number, line in enumerate(text.splitlines(), 1):
|
||||
if OLD.search(RECORD.sub("", line)):
|
||||
hits.append(f"{name}:{number}")
|
||||
return hits
|
||||
|
||||
|
||||
class TestNightNames(unittest.TestCase):
|
||||
def test_the_six_new_skills_exist_and_the_old_ones_do_not(self):
|
||||
for old, new in RENAMED.items():
|
||||
with self.subTest(skill=new):
|
||||
self.assertTrue((REPO_ROOT / "skills" / new / "SKILL.md").is_file())
|
||||
self.assertFalse((REPO_ROOT / "skills" / old).exists())
|
||||
|
||||
def test_old_names_live_only_in_rename_records(self):
|
||||
self.assertEqual(old_name_lines(), [], "write a rename as `old` → `new`; any other mention goes")
|
||||
|
||||
def test_a_rename_record_is_the_only_exemption(self):
|
||||
self.assertIsNone(OLD.search(RECORD.sub("", "`kvb-org-sunset` → `kvb-org-suspend`")))
|
||||
for line in ("run kvb-agent-sleep now", "`kvb-org-sunset`", "kvb-org-sunset → kvb-org-suspend", "skills/kvb-org-sunrise/SKILL.md"):
|
||||
with self.subTest(line=line):
|
||||
self.assertIsNotNone(OLD.search(RECORD.sub("", line)))
|
||||
self.assertIsNone(OLD.search("kvb-org-sunsets kvb-agent-sleeper my-kvb-org-evening"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("\n".join(old_name_lines()))
|
||||
Reference in new issue
Block a user