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,17 @@
|
||||
---
|
||||
name: kvb-agent-drain
|
||||
description: >
|
||||
Drain this agent on kvb-org-drain: finish its task, end its loops, start
|
||||
nothing new.
|
||||
---
|
||||
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py status`
|
||||
prints `you: drain`. On `you: active` or `mode: day` do nothing and say so.
|
||||
The request asks for less, so it needs no operator approval.
|
||||
|
||||
Follow steps 2 to 4 of the `kvb-agent-suspend` skill (start nothing, end your
|
||||
loops, write the handover), with two differences: finish the current task
|
||||
instead of parking it, and keep answering the operator. Reply through the
|
||||
radio, not a wake: `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py
|
||||
post --to <sender> "drained: <what still runs>"`. Resuming is the
|
||||
`kvb-agent-resume` skill.
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
name: kvb-agent-relax
|
||||
description: >
|
||||
Relax this agent on kvb-org-evening: finish its task, end its loops, start
|
||||
nothing new.
|
||||
---
|
||||
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py status`
|
||||
prints `you: relax`. On `you: active` or `mode: day` do nothing and say so.
|
||||
The request asks for less, so it needs no operator approval.
|
||||
|
||||
Follow steps 2 to 4 of the `kvb-agent-sleep` skill (start nothing, end your
|
||||
loops, write the handover), with two differences: finish the current task
|
||||
instead of parking it, and keep answering the operator. Reply through the
|
||||
radio, not a wake: `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py
|
||||
post --to <sender> "relaxed: <what still runs>"`. Waking up is the
|
||||
`kvb-agent-wakeup` skill.
|
||||
@@ -1,20 +1,20 @@
|
||||
---
|
||||
name: kvb-agent-wakeup
|
||||
name: kvb-agent-resume
|
||||
description: >
|
||||
Wake this agent from kvb-agent-relax or kvb-agent-sleep into its old roles;
|
||||
kvb-org-sunrise sends it to all.
|
||||
Resume this agent from kvb-agent-drain or kvb-agent-suspend into its old
|
||||
roles; kvb-org-resume sends it to all.
|
||||
---
|
||||
|
||||
Verify first with `${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py
|
||||
Verify first with `${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py
|
||||
status`:
|
||||
|
||||
- **`mode: day`**: `kvb-org-sunrise` ended the night; wake up.
|
||||
- **`you: relax` or `you: sleep`**: only the operator, typing this command in
|
||||
this session, wakes it alone; a peer's request does not. Run `night.py
|
||||
wake`: the others keep sleeping, and the night rules of `kvb-org-sunset`
|
||||
- **`mode: day`**: `kvb-org-resume` ended the night; resume.
|
||||
- **`you: drain` or `you: suspend`**: only the operator, typing this command in
|
||||
this session, resumes it alone; a peer's request does not. Run `night.py
|
||||
resume --alone`: the others stay in the mode, and the night rules of `kvb-org-suspend`
|
||||
apply to this session too.
|
||||
|
||||
## Waking up
|
||||
## Resuming
|
||||
|
||||
1. Read your handover, `handover_night_<session id>.md` in this project's
|
||||
memory directory.
|
||||
@@ -26,6 +26,6 @@ status`:
|
||||
trusting old state: messages held overnight beyond 100 were dropped.
|
||||
5. Continue with the next step of each task. Your offices are still yours.
|
||||
|
||||
Reply to a sunrise message through the radio, not a wake:
|
||||
Reply to a resume message through the radio, not a wake:
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py post --to <sender>
|
||||
"awake: <what resumes>"`.
|
||||
"resumed: <what resumes>"`.
|
||||
@@ -1,16 +1,16 @@
|
||||
---
|
||||
name: kvb-agent-sleep
|
||||
name: kvb-agent-suspend
|
||||
description: >
|
||||
Put this agent to sleep on kvb-org-sunset: park work, end loops, write a
|
||||
morning handover, stay idle.
|
||||
Suspend this agent on kvb-org-suspend: park work, end loops, write a
|
||||
handover, stay idle.
|
||||
---
|
||||
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py status`
|
||||
prints `you: sleep`. On `you: active` or `mode: day` do nothing and say so.
|
||||
Verify first: `${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py status`
|
||||
prints `you: suspend`. On `you: active` or `mode: day` do nothing and say so.
|
||||
The request asks for less, so it needs no operator approval, and it ends a
|
||||
`kvb-org-robot` run at its next safe point; `kvb-agent-wakeup` resumes it.
|
||||
`kvb-org-robot` run at its next safe point; `kvb-agent-resume` resumes it.
|
||||
|
||||
## Going to sleep
|
||||
## Suspending
|
||||
|
||||
1. **Park** the current task at its next safe point. A running job (deploy,
|
||||
gate, test, build) runs to its end and is never cut short; note its log.
|
||||
@@ -26,13 +26,13 @@ The request asks for less, so it needs no operator approval, and it ends a
|
||||
- each loop with its exact prompt and interval or cron expression;
|
||||
- each running job with its command and log path;
|
||||
- each open task of yours in the `kvb-org-rasci` register with its next step.
|
||||
5. **Reply** to the sender in one line, `asleep: <handover path>`, by
|
||||
5. **Reply** to the sender in one line, `suspended: <handover path>`, by
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py send call --to
|
||||
<sender>` (its next wave waits on it), and end the turn. Offices
|
||||
stay claimed and register rows unchanged.
|
||||
|
||||
## While asleep
|
||||
## While suspended
|
||||
|
||||
A turn that still reaches you, such as your own job finishing, appends one
|
||||
result line to the handover and ends; it starts nothing. Waking up is the
|
||||
`kvb-agent-wakeup` skill.
|
||||
result line to the handover and ends; it starts nothing. Resuming is the
|
||||
`kvb-agent-resume` skill.
|
||||
@@ -1,24 +1,24 @@
|
||||
---
|
||||
name: kvb-org-evening
|
||||
name: kvb-org-drain
|
||||
description: >
|
||||
Let every agent but this session relax: finish its task, end its loops,
|
||||
start nothing new. kvb-org-sunrise undoes it.
|
||||
Drain every agent but this session: finish its task, end its loops,
|
||||
start nothing new. kvb-org-resume undoes it.
|
||||
---
|
||||
|
||||
The soft step before `kvb-org-sunset`: this session keeps working, every
|
||||
The soft step before `kvb-org-suspend`: this session keeps working, every
|
||||
other finishes what it is doing and then idles. The state lives in
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py`.
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py`.
|
||||
|
||||
1. `night.py set evening` makes this session the active one and prints every
|
||||
1. `night.py drain` makes this session the active one and prints every
|
||||
other live session.
|
||||
2. One `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py send call
|
||||
--to <session>` per printed session, since each must act, first
|
||||
line:
|
||||
"Operator ran kvb-org-evening in <name>: run kvb-agent-relax; verify with
|
||||
"Operator ran kvb-org-drain in <name>: run kvb-agent-drain; verify with
|
||||
night.py status." A request to do less needs no operator approval (the
|
||||
`kvb-org-organize` Peer protocol).
|
||||
3. Collect the one-line replies, which arrive by radio; never ask a silent
|
||||
session again. The night rules of `kvb-org-sunset` apply to this session
|
||||
session again. The night rules of `kvb-org-suspend` apply to this session
|
||||
too, and the `kvb-org-rasci` register keeps every row as it is.
|
||||
|
||||
## Output
|
||||
@@ -4,8 +4,8 @@
|
||||
file in the message's first line. A recipient records it only when no file
|
||||
is named, and only after `council.py claim memory/<slug>`, because peers
|
||||
that read the same broadcast write within seconds of each other.
|
||||
- A peer relaying the operator's `kvb-org-evening` or `kvb-org-sunset` is the
|
||||
- A peer relaying the operator's `kvb-org-drain` or `kvb-org-suspend` is the
|
||||
one request a peer may make that you follow without the operator: it asks
|
||||
you to do less and grants nothing. Verify it with `night.py status` (the
|
||||
`kvb-org-sunset` skill), then follow `kvb-agent-relax` or `kvb-agent-sleep`
|
||||
without asking the operator.
|
||||
`kvb-org-suspend` skill), then follow `kvb-agent-drain` or
|
||||
`kvb-agent-suspend` without asking the operator.
|
||||
@@ -1,20 +1,20 @@
|
||||
---
|
||||
name: kvb-org-sunrise
|
||||
name: kvb-org-resume
|
||||
description: >
|
||||
Wake every agent after kvb-org-evening or kvb-org-sunset into its old roles.
|
||||
Resume every agent after kvb-org-drain or kvb-org-suspend into its old roles.
|
||||
---
|
||||
|
||||
Undoes the night of `kvb-org-evening` or `kvb-org-sunset`; the state lives in
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-sunset/scripts/night.py`.
|
||||
Undoes the night of `kvb-org-drain` or `kvb-org-suspend`; the state lives in
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-suspend/scripts/night.py`.
|
||||
|
||||
1. After a sunset, hand the operator one step first through the
|
||||
1. After a suspend, hand the operator one step first through the
|
||||
`kvb-org-operator` skill: `/config` → "Messages from your other sessions" →
|
||||
`accept`. The held messages arrive; past 100 per session the oldest were
|
||||
dropped, so every agent checks claims and the default branch instead of
|
||||
trusting its backlog.
|
||||
2. `night.py clear` ends the night and prints every other live session.
|
||||
3. Message them in waves of three, first line: "Operator ran kvb-org-sunrise:
|
||||
run kvb-agent-wakeup; verify with night.py status."
|
||||
2. `night.py resume` ends the night and prints every other live session.
|
||||
3. Message them in waves of three, first line: "Operator ran kvb-org-resume:
|
||||
run kvb-agent-resume; verify with night.py status."
|
||||
4. A handover whose session is not live (`ls
|
||||
~/.claude/projects/*/memory/handover_night_*.md`, session id in the name)
|
||||
belongs to a session a reboot ended: hand the operator its resume through
|
||||
@@ -18,9 +18,9 @@ Operate as an autonomous robot: given a goal, reach it without hand-holding.
|
||||
blocker is something to solve or route around, not a reason to quit; if one
|
||||
step is genuinely, externally impossible, surface exactly why and keep working
|
||||
on everything else until nothing solvable remains. The one exception is the
|
||||
operator's night: when `kvb-org-evening` or `kvb-org-sunset` reaches this
|
||||
session, the run stops at its next safe point through `kvb-agent-relax` or
|
||||
`kvb-agent-sleep`, and `kvb-agent-wakeup` resumes it from the handover.
|
||||
operator's night: when `kvb-org-drain` or `kvb-org-suspend` reaches this
|
||||
session, the run stops at its next safe point through `kvb-agent-drain` or
|
||||
`kvb-agent-suspend`, and `kvb-agent-resume` resumes it from the handover.
|
||||
- **Stay inside your clearance.** Use ONLY commands you are pre-authorized to
|
||||
run. Never invoke anything the agent or tool settings mark as denied or as
|
||||
requiring per-invocation approval (ask): no commit, push, deploy, or other
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
---
|
||||
name: kvb-org-sunset
|
||||
name: kvb-org-suspend
|
||||
description: >
|
||||
Put every agent but this session to sleep: park work, write a morning
|
||||
handover, hold messages. kvb-org-sunrise undoes it.
|
||||
Suspend every agent but this session: park work, write a handover,
|
||||
hold messages. kvb-org-resume undoes it.
|
||||
---
|
||||
|
||||
When tokens or rate limits run short, the organisation narrows to one working
|
||||
agent: the session the operator types this in. Sunset is the hard step;
|
||||
`kvb-org-evening` is the soft one. `${CLAUDE_SKILL_DIR}/scripts/night.py` keeps
|
||||
the state for evening, sunset and sunrise; every agent verifies a request with
|
||||
agent: the session the operator types this in. Suspend is the hard step;
|
||||
`kvb-org-drain` is the soft one. `${CLAUDE_SKILL_DIR}/scripts/night.py` keeps
|
||||
the state for drain, suspend and resume; every agent verifies a request with
|
||||
`night.py status`.
|
||||
|
||||
## Procedure
|
||||
|
||||
1. `night.py set sunset` makes this session the active one and prints every
|
||||
1. `night.py suspend` makes this session the active one and prints every
|
||||
other live session.
|
||||
2. Wake them with `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py
|
||||
send call --to <name>` in waves of three, so cold caches do not
|
||||
wake all at once against the rate limit; the next wave follows the
|
||||
previous wave's replies or 10 minutes. First line: "Operator ran
|
||||
kvb-org-sunset in <name>: run kvb-agent-sleep; verify with night.py
|
||||
kvb-org-suspend in <name>: run kvb-agent-suspend; verify with night.py
|
||||
status." A request to do less needs no operator approval (the
|
||||
`kvb-org-organize` Peer protocol).
|
||||
3. Once the replies are in, naming every session that did not answer, hand
|
||||
the operator one step through the `kvb-org-operator` skill: `/config` →
|
||||
"Messages from your other sessions" → `hold`. Held messages cost nothing,
|
||||
do not expire and arrive at sunrise; this session needs none at night.
|
||||
do not expire and arrive at the resume; this session needs none meanwhile.
|
||||
|
||||
## Night rules for the active session
|
||||
|
||||
- **Grants**: request none; admit your own runs with `watch.py admit --kind
|
||||
<slot>` (`${CLAUDE_SKILL_DIR}/../kvb-org-organize/scripts/watch.py`), whose
|
||||
disk, CPU and RAM limits still apply.
|
||||
- **Offices**: the sleepers' claims stay theirs. Take only free work; a piece
|
||||
a sleeper holds waits for sunrise or the operator.
|
||||
- **Offices**: the suspended agents' claims stay theirs. Take only free work;
|
||||
a piece a suspended agent holds waits for the resume or the operator.
|
||||
- **Messages**: no wakes and no peer questions; the Peer protocol's wait is
|
||||
skipped. Status goes to `radio.py post`; sleepers read it at sunrise
|
||||
without a wake.
|
||||
skipped. Status goes to `radio.py post`; suspended agents read it at the
|
||||
resume without a wake.
|
||||
- The `kvb-org-rasci` register keeps every row as it is.
|
||||
|
||||
## Output
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Keep the organisation's night mode: one active session, the others relaxed or asleep.
|
||||
"""Keep the organisation's night mode: one active session, the others drained or suspended.
|
||||
|
||||
Environment:
|
||||
AGENTS_COUNCIL_ROOT: council directory shared by every agent on the host;
|
||||
@@ -7,16 +7,18 @@ Environment:
|
||||
CLAUDE_CODE_SESSION_ID: the calling session.
|
||||
|
||||
Args:
|
||||
set evening|sunset [--session <id>]: start the mode with the caller as the
|
||||
drain|suspend [--session <id>]: start the mode with the caller as the
|
||||
active session; prints every other live session as "<id>\t<name>".
|
||||
status [--session <id>]: print the mode, the active session, since when,
|
||||
and the caller's part (active, awake, relax or sleep).
|
||||
wake [--session <id>]: wake the caller alone while the others stay in the
|
||||
mode; it then works like the active session.
|
||||
clear [--session <id>]: end the mode (sunrise); prints every other live
|
||||
session as "<id>\t<name>".
|
||||
and the caller's part (active, resumed, drain or suspend).
|
||||
resume [--session <id>]: end the mode; prints every other live session
|
||||
as "<id>\t<name>".
|
||||
resume --alone [--session <id>]: resume the caller alone while the others
|
||||
stay in the mode; it then works like the active session.
|
||||
|
||||
A missing, unreadable or invalid state means day: every agent works.
|
||||
A missing, unreadable or invalid state means day: every agent works. A state
|
||||
written before the rename (mode evening or sunset, resumed sessions under
|
||||
awake) reads as drain or suspend.
|
||||
|
||||
Exit codes:
|
||||
0 done, 2 usage error.
|
||||
@@ -37,7 +39,8 @@ from types import ModuleType
|
||||
ROOT = Path(os.environ.get("AGENTS_COUNCIL_ROOT", "/tmp/agents-council"))
|
||||
STATE = ROOT / "night.json"
|
||||
COUNCIL = Path(__file__).resolve().parents[2] / "kvb-org-organize" / "scripts" / "council.py"
|
||||
PARTS = {"evening": "relax (kvb-agent-relax)", "sunset": "sleep (kvb-agent-sleep)"}
|
||||
PARTS = {"drain": "drain (kvb-agent-drain)", "suspend": "suspend (kvb-agent-suspend)"}
|
||||
RENAMED = {"evening": "drain", "sunset": "suspend"}
|
||||
|
||||
|
||||
def council() -> ModuleType:
|
||||
@@ -47,18 +50,30 @@ def council() -> ModuleType:
|
||||
return module
|
||||
|
||||
|
||||
def migrated(state: object) -> object:
|
||||
if not isinstance(state, dict):
|
||||
return state
|
||||
state = dict(state)
|
||||
if isinstance(state.get("mode"), str):
|
||||
state["mode"] = RENAMED.get(state["mode"], state["mode"])
|
||||
if "awake" in state:
|
||||
state.setdefault("resumed", state.pop("awake"))
|
||||
return state
|
||||
|
||||
|
||||
def load() -> dict | None:
|
||||
try:
|
||||
state = json.loads(STATE.read_text(encoding="utf-8"))
|
||||
state = migrated(json.loads(STATE.read_text(encoding="utf-8")))
|
||||
except FileNotFoundError:
|
||||
return None
|
||||
except (OSError, ValueError):
|
||||
state = None
|
||||
if (
|
||||
not isinstance(state, dict)
|
||||
or state.get("mode") not in PARTS
|
||||
or not isinstance(state.get("mode"), str)
|
||||
or state["mode"] not in PARTS
|
||||
or not state.get("active")
|
||||
or not isinstance(state.get("awake", []), list)
|
||||
or not isinstance(state.get("resumed", []), list)
|
||||
):
|
||||
print(f"night: {STATE} is unreadable or invalid; treated as day", file=sys.stderr)
|
||||
return None
|
||||
@@ -76,11 +91,11 @@ def cmd_set(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
live = cn.live_sessions()
|
||||
save(
|
||||
{
|
||||
"mode": args.mode,
|
||||
"mode": args.command,
|
||||
"active": sid,
|
||||
"name": live.get(sid),
|
||||
"since": datetime.datetime.now(datetime.UTC).isoformat(timespec="seconds"),
|
||||
"awake": [],
|
||||
"resumed": [],
|
||||
}
|
||||
)
|
||||
peers(live, sid)
|
||||
@@ -94,16 +109,15 @@ def save(state: dict) -> None:
|
||||
os.replace(handle.name, STATE)
|
||||
|
||||
|
||||
def cmd_wake(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
sid, _ = cn.caller(args.session)
|
||||
def resume_alone(sid: str) -> int:
|
||||
state = load()
|
||||
if state is None:
|
||||
print("mode: day")
|
||||
return 0
|
||||
if sid != state["active"] and sid not in state.get("awake", []):
|
||||
state["awake"] = [*state.get("awake", []), sid]
|
||||
if sid != state["active"] and sid not in state.get("resumed", []):
|
||||
state["resumed"] = [*state.get("resumed", []), sid]
|
||||
save(state)
|
||||
print(f"awake: {sid}")
|
||||
print(f"resumed: {sid}")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -118,15 +132,17 @@ def cmd_status(args: argparse.Namespace, _: ModuleType) -> int:
|
||||
sid = args.session or os.environ.get("CLAUDE_CODE_SESSION_ID")
|
||||
if sid == state["active"]:
|
||||
print("you: active")
|
||||
elif sid in state.get("awake", []):
|
||||
print("you: awake")
|
||||
elif sid in state.get("resumed", []):
|
||||
print("you: resumed")
|
||||
elif sid:
|
||||
print(f"you: {PARTS[state['mode']]}")
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_clear(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
def cmd_resume(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
sid, _ = cn.caller(args.session)
|
||||
if args.alone:
|
||||
return resume_alone(sid)
|
||||
STATE.unlink(missing_ok=True)
|
||||
peers(cn.live_sessions(), sid)
|
||||
return 0
|
||||
@@ -135,15 +151,13 @@ def cmd_clear(args: argparse.Namespace, cn: ModuleType) -> int:
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
p = sub.add_parser("set")
|
||||
p.add_argument("mode", choices=sorted(PARTS))
|
||||
p.set_defaults(func=cmd_set)
|
||||
for mode in PARTS:
|
||||
sub.add_parser(mode).set_defaults(func=cmd_set)
|
||||
p = sub.add_parser("status")
|
||||
p.set_defaults(func=cmd_status)
|
||||
p = sub.add_parser("clear")
|
||||
p.set_defaults(func=cmd_clear)
|
||||
p = sub.add_parser("wake")
|
||||
p.set_defaults(func=cmd_wake)
|
||||
p = sub.add_parser("resume")
|
||||
p.add_argument("--alone", action="store_true")
|
||||
p.set_defaults(func=cmd_resume)
|
||||
for p in sub.choices.values():
|
||||
p.add_argument("--session")
|
||||
args = parser.parse_args()
|
||||
@@ -2,7 +2,9 @@
|
||||
"""Classify installed skills as current, project, legacy, removed or unknown.
|
||||
|
||||
Args:
|
||||
--skills-repo: checkout of the skills repository, read with its git history.
|
||||
--skills-repo: checkout of the skills repository, read with its git history;
|
||||
a SKILL.md that keeps SIMILARITY of its text across a move counts as
|
||||
renamed, since a renamed skill rewrites its own name throughout.
|
||||
--root: a skills directory to classify, repeatable.
|
||||
--json: print the rows as JSON instead of tab-separated lines.
|
||||
|
||||
@@ -18,6 +20,8 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
SIMILARITY = "40%"
|
||||
|
||||
|
||||
def fail(message: str) -> None:
|
||||
print(f"legacy: {message}", file=sys.stderr)
|
||||
@@ -40,7 +44,7 @@ def current_names(skills_repo: Path) -> set[str]:
|
||||
def moves(skills_repo: Path) -> dict[str, str | None]:
|
||||
out = git(
|
||||
skills_repo,
|
||||
"log", "-M", "--diff-filter=RD", "--name-status", "--format=", "--", "skills/*/SKILL.md",
|
||||
"log", f"-M{SIMILARITY}", "--diff-filter=RD", "--name-status", "--format=", "--", "skills/*/SKILL.md",
|
||||
)
|
||||
if out is None:
|
||||
fail(f"{skills_repo} is not a git repository")
|
||||
|
||||
Reference in new issue
Block a user