refactor(skills)!: rename every skill to kvb-<category>-<name>
All 38 first-party skills move to kvb-<category>-<name> with the categories think, create, code, ci, git, check, org and skills; kvb-cleanup and kvb-help are the only uncategorized names. tests/test_naming.py pins the schema, the Agent Skills name rules and the README organigram. enable-plugins.js repoints hook commands of renamed skills in settings.local.json so a stale script path cannot block tools. BREAKING CHANGE: the old skill names and slash commands (/commit-next, /dream, /autotune, ...) are gone; use their kvb- successors listed in the README organigram. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
64403cefca
commit
624baccfc4
59 files changed
+504
-312
No files matched your search
@@ -0,0 +1,80 @@
|
||||
---
|
||||
name: kvb-git-merge-fix
|
||||
description: >
|
||||
Hunt down the commits on any branch that carry a described fix and merge it
|
||||
into the current branch. Trigger on /kvb-git-merge-fix <description> or when the
|
||||
operator asks to bring over a fix from another branch.
|
||||
---
|
||||
|
||||
The free text after `/kvb-git-merge-fix` is the fix description, exactly like `/loop`
|
||||
takes its prompt. Everything after the skill name is the search intent; there is
|
||||
no other input. If it is missing, ask for it and stop.
|
||||
|
||||
## 1. Refuse to work on a dirty tree
|
||||
|
||||
`git status --porcelain` must be empty. If it is not, stop and let the operator
|
||||
commit or open a worktree. Never stash, never `git checkout -- <file>`, never
|
||||
`git restore --staged`: those discard uncommitted work that other agents in the
|
||||
same tree may own.
|
||||
|
||||
## 2. Fetch everything
|
||||
|
||||
```bash
|
||||
git fetch --all --prune --tags
|
||||
```
|
||||
|
||||
That is the "pull all branches" step. Do not check branches out one by one; all
|
||||
searching below runs against the fetched refs.
|
||||
|
||||
## 3. Turn the description into search terms
|
||||
|
||||
Derive from the operator's text: 2-4 keywords for commit messages, plus any
|
||||
symbol, string, or path the fix must have touched. State the derived terms in
|
||||
one line so a wrong reading is visible before the search.
|
||||
|
||||
## 4. Search every ref
|
||||
|
||||
Search by keyword, by literal and by path in one call; they find different
|
||||
things, and a commit matching any one of them is a hit, so `--path` widens
|
||||
the search instead of narrowing `--grep`:
|
||||
|
||||
```bash
|
||||
${CLAUDE_SKILL_DIR}/scripts/find_fix.py --grep '<keyword>' -S '<symbol or literal>' --path '<path or glob>'
|
||||
```
|
||||
|
||||
It drops every hit already in HEAD (`in_head` counts them; all in HEAD means
|
||||
the fix is already in, say so and stop) and prints the rest with their
|
||||
branches and files. Then read the actual change: `git show --stat <sha>` and
|
||||
the diff. A matching commit subject is a lead, not evidence, and `-S` also
|
||||
matches the commit that removed the literal; the diff decides.
|
||||
|
||||
## 5. Present the candidates
|
||||
|
||||
One table: sha, branch(es), subject, files touched, one line on what the diff
|
||||
really does. Let the operator pick unless exactly one candidate survives step 4
|
||||
and its diff plainly is the described fix.
|
||||
|
||||
## 6. Bring it over
|
||||
|
||||
- One or a few commits, rest of the branch unwanted: `git cherry-pick -x <sha>…`
|
||||
(`-x` records the origin).
|
||||
- The whole branch is wanted: `git merge --no-ff <branch>`.
|
||||
- Conflicts: resolve them by reading both sides. Never `-X ours`/`-X theirs`,
|
||||
never `git checkout --ours/--theirs` wholesale — that silently drops one
|
||||
side's fix. Unresolvable → `git cherry-pick --abort` / `git merge --abort`,
|
||||
report what conflicted, change nothing else.
|
||||
|
||||
## 7. Report
|
||||
|
||||
Show `git log --oneline <base>..HEAD` and the resulting diffstat, then apply the
|
||||
kvb-check-confidence skill: what came over, what did not, what still has to be verified.
|
||||
Run the project's test or quality gate only when the operator asks for it.
|
||||
|
||||
## Rules
|
||||
|
||||
- Never push and never force anything; the merge stays local until the operator
|
||||
ships it.
|
||||
- Never rewrite history to make a cherry-pick fit (no rebase of the target
|
||||
branch, no amend of foreign commits).
|
||||
- If the search finds nothing, say so plainly and list the terms tried. Do not
|
||||
reimplement the fix under this skill — that is a different task.
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Find commits on any ref that match a fix, skipping those already in HEAD.
|
||||
|
||||
Usage:
|
||||
find_fix.py [--grep KEYWORD]... [-S LITERAL]... [--path PATH]... [--fetch]
|
||||
|
||||
Prints one line per candidate: sha, up to three branches, subject, files
|
||||
touched. -S also matches commits that removed the literal; read the diff.
|
||||
Run it inside the repository; it never checks anything out.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
LIMIT = 30
|
||||
|
||||
|
||||
def git(*args: str) -> subprocess.CompletedProcess:
|
||||
return subprocess.run(["git", *args], capture_output=True, text=True, check=False)
|
||||
|
||||
|
||||
def search(args: argparse.Namespace) -> list[str]:
|
||||
queries = [["--regexp-ignore-case", f"--grep={k}"] for k in args.grep]
|
||||
queries += [[f"-S{s}"] for s in args.S]
|
||||
queries += [["--", p] for p in args.path]
|
||||
found: list[str] = []
|
||||
for query in queries:
|
||||
for sha in git("log", "--all", "--format=%H", *query).stdout.split():
|
||||
if sha not in found:
|
||||
found.append(sha)
|
||||
return found
|
||||
|
||||
|
||||
def describe(sha: str) -> str:
|
||||
subject = git("log", "-1", "--format=%h %s", sha).stdout.strip()
|
||||
branches = git("branch", "-a", "--contains", sha, "--format=%(refname:short)").stdout.split()
|
||||
files = [f for f in git("show", "--name-only", "--format=", sha).stdout.split("\n") if f]
|
||||
shown = ",".join(branches[:3]) + (f",+{len(branches) - 3}" if len(branches) > 3 else "")
|
||||
return f"{subject}\t{shown or '-'}\t{len(files)} files: {','.join(files[:5])}"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(prog="find_fix")
|
||||
parser.add_argument("--grep", action="append", default=[])
|
||||
parser.add_argument("-S", action="append", default=[])
|
||||
parser.add_argument("--path", action="append", default=[])
|
||||
parser.add_argument("--fetch", action="store_true")
|
||||
args = parser.parse_args()
|
||||
if not (args.grep or args.S or args.path):
|
||||
parser.error("give at least one --grep, -S or --path")
|
||||
if args.fetch:
|
||||
git("fetch", "--all", "--prune", "--tags")
|
||||
hits = search(args)
|
||||
outside = [sha for sha in hits if git("merge-base", "--is-ancestor", sha, "HEAD").returncode]
|
||||
print(f"hits={len(hits)} in_head={len(hits) - len(outside)} candidates={len(outside)}")
|
||||
for sha in outside[:LIMIT]:
|
||||
print(describe(sha))
|
||||
if len(outside) > LIMIT:
|
||||
print(f"... {len(outside) - LIMIT} more, narrow the search")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user