mirror of
https://github.com/alirezarezvani/claude-skills.git
synced 2026-11-27 22:48:39 +00:00
Some checks failed
Sync Codex Skills Symlinks / sync (push) Has been cancelled
* fix(plugins): bump all plugins to 2.14.1 and gate unbumped changes Claude Code caches plugins by version. 70 of 104 plugins changed between v2.12.0 and v2.14.0 without a bump, so claude plugin update reported "already at the latest version" and existing installs never received the v2.13/v2.14 fixes. Every plugin moves to 2.14.1 so stale caches refresh once. check_plugin_versions.py (G11, blocking in ci-quality-gate) fails when a plugin's payload, including symlinked vendor files, changes without a higher version, and when marketplace.json and plugin.json disagree. bump_plugin_versions.py sets both together. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(codex): stop installing all skills by default With the full library (~380 skills) Codex drops every skill description from its prompt budget, so it cannot pick skills. codex-install.sh now asks for --category (comma-separated), --skill or an explicit --all, lists categories when run without arguments, and warns when more than ~100 skills are installed. The Windows installer and install docs follow. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(gemini): link whole skill folders and drop duplicate mirror entries Each .gemini/skills entry held only a SKILL.md symlink, so the relative scripts/ and references/ a skill points to were missing. Entries are now directory symlinks (Gemini CLI 0.65 discovers them). Dual-published copies with identical SKILL.md are listed once, commands and agents that share a skill's name are skipped, fixtures under assets/ and vendor/ re-exports are excluded, discovery is sorted so reruns are stable, and stale generated entries are pruned. gemini skills list: 20 conflicts -> 1 (handoff, fixed next). GEMINI.md documents folder trust and fixes a dead example path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(handoff): rename the productivity skill to session-handoff engineering/handoff and productivity/handoff both shipped a skill named handoff. Claude Code namespaces them, but Codex, Gemini CLI, Vibe and Hermes key skills by name and silently kept one. The productivity skill is now session-handoff (handoff-productivity:session-handoff); its folder, plugin manifest, hook script paths, command paths, mirrors, harness manifest and docs page follow. /cs-handoff, /cs-handoff-setup and ~/.config/handoff are unchanged; the plugin README carries a migration note. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(convert): include plugins whose SKILL.md is at the plugin root convert.sh searched at -mindepth 4, which skipped boost-asio-pro, deepread, hivemind, loop-library, minimalist, strict-api and swedish-mentor for every converted tool (opencode, Cursor, Windsurf, Kilo, Augment, Aider, Antigravity). It now searches from depth 2 and skips assets/ fixtures. opencode conversion: 375 -> 382 skills. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(codex): keep skill-tester's sample fixture from loading as a skill Codex scans installed skill folders recursively and picked up skill-tester/assets/sample-skill/SKILL.md as 'sample-text-processor'. The installer renames SKILL.md files under assets/ in the installed copy. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(plugins): address scripts via ${CLAUDE_PLUGIN_ROOT} in commands and agents 343 script invocations in 90 command/agent files across 36 plugins used repo-relative or ../ paths. Plugin commands and agents run from the user's project, so those paths only resolved inside a clone of this repo; in the v2.14.0 evals the agent fell back to find / to locate scripts. Every one now uses ${CLAUDE_PLUGIN_ROOT}/. Two cross-plugin calls (write-a-skill -> karpathy-coder, c-level-agents cpo -> product-manager-toolkit) go through vendor/ symlinks, per the repo's install-cache lesson. check_paths.py (G1) now fails a plugin command or agent that invokes a script without ${CLAUDE_PLUGIN_ROOT}; on the v2.14.0 tree it reports 279. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(month-end-close): treat opening-balance rows as balances and pair transpositions On a bank and GL export that each begin with an 'Opening balance' row, the matcher returned RECONCILED_WITH_ITEMS and told the user to book a 25,000.00 journal entry for the opening balance, and it reported a 7,980/7,890 transposition as two unrelated items. Opening rows are now balances: a difference between them is reported as carried in from the prior period (R5, blocks sign-off, never booked). Same-date digit transpositions pair into one correcting entry. The GL file's 'memo' column is read as description. The v2.14.0 eval fixture now proves 1,405.00 = 150 opening + 90 transposition + 1,200 outstanding check - 35 bank fee. Bundled copy synced. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * fix(coding-agent-rollout): flag connection-URL passwords and production MCP servers On a committed .claude/settings.json holding env.DATABASE_URL=postgresql://admin:<password>@prod-db... and enabledMcpjsonServers: ["postgres-prod"], the linter flagged neither: the env check only matched token formats and KEY/TOKEN/SECRET names. S11 now catches a password embedded in any connection URL (BLOCKER in shared files), and new S13 warns when a shared file pre-approves an MCP server whose name marks it as production. Bundled copy synced; --sample output unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh * docs: changelog and lessons for the v2.14.0 audit fixes Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uNBQ6tRS5P1dRsgNfK4Wh --------- Co-authored-by: Claude <noreply@anthropic.com>
253 lines
10 KiB
Python
253 lines
10 KiB
Python
#!/usr/bin/env python3
|
|
"""check_paths.py — phantom-path linter for skills, agents, and commands.
|
|
|
|
Scans SKILL.md files plus *.md files under any agents/ or commands/ directory
|
|
for path-like references (scripts/, references/, assets/, skills/, templates/
|
|
tokens, `python x.py` invocations, and ../ relative paths) and verifies each
|
|
candidate resolves against (a) the owning skill/plugin root, (b) the file's
|
|
own directory, or (c) the repo root. A candidate is OK if ANY base resolves.
|
|
|
|
Known dynamic patterns (containing { < $ ~ *) and URLs are skipped.
|
|
|
|
Exit codes: 0 = all paths resolve, 1 = at least one unresolvable path.
|
|
Intended as CI gate G1.
|
|
|
|
Usage:
|
|
python3 scripts/check_paths.py --all # scan canonical dirs repo-wide
|
|
python3 scripts/check_paths.py FILE [FILE ...] # scan specific files
|
|
python3 scripts/check_paths.py --all --json # machine-readable output
|
|
"""
|
|
|
|
import argparse
|
|
import fnmatch
|
|
import json
|
|
import os
|
|
import re
|
|
import sys
|
|
|
|
EXCLUDED_DIRS = {
|
|
".git", ".codex", ".gemini", ".hermes", ".vibe", "docs", "audit",
|
|
"node_modules", ".github", ".claude", ".claude-plugin",
|
|
}
|
|
|
|
# Token-style paths anchored on a canonical content dir, with a known extension.
|
|
RE_MARKER_PATH = re.compile(
|
|
r"[A-Za-z0-9_\-./]*\b(?:scripts|references|assets|skills|templates)/"
|
|
r"[A-Za-z0-9_\-./]+\.(?:py|md|sh|json|yaml|yml)\b"
|
|
)
|
|
# Any multi-segment reference to a SKILL.md file.
|
|
RE_SKILLMD = re.compile(r"[A-Za-z0-9_\-./]+/SKILL\.md\b")
|
|
# python / python3 script invocations.
|
|
RE_PY_INVOKE = re.compile(r"\bpython3?\s+([A-Za-z0-9_\-./]+\.py)\b")
|
|
# Relative parent-dir paths.
|
|
RE_RELATIVE = re.compile(r"\.\./[A-Za-z0-9_\-./]+")
|
|
# ${CLAUDE_PLUGIN_ROOT}/... paths, which Claude Code substitutes with the installed
|
|
# plugin root. They must resolve inside the owning plugin, or the installed plugin breaks.
|
|
RE_PLUGIN_ROOT = re.compile(r"\$\{CLAUDE_PLUGIN_ROOT\}/([A-Za-z0-9_\-./]+)")
|
|
|
|
DYNAMIC_CHARS = set("{<$~*")
|
|
PLACEHOLDER_HINTS = ("path/to", "your-", "your_", "example.com", "...", "skill-name", "agent-name")
|
|
# Chars that, immediately before a match, signal a placeholder prefix was cut off
|
|
# (e.g. `{skill_path}/scripts/x.py`, `"$SKILL/scripts/x.py"`, `<plugin>/scripts/x.py`,
|
|
# `TC-001-.../tc_record.json` — a literal `.` before `../` means an `...` ellipsis).
|
|
PLACEHOLDER_PREFIX_CHARS = set("}$>*~.")
|
|
# Gitignored maintainer-local folders (see root CLAUDE.md): references into these
|
|
# are intentional dead links for cloners — not phantom paths.
|
|
MAINTAINER_LOCAL = ("megaprompts", "documentation", "eval-workspace", "tests", ".autoresearch")
|
|
|
|
|
|
def is_dynamic(token: str) -> bool:
|
|
if any(c in DYNAMIC_CHARS for c in token):
|
|
return True
|
|
if "://" in token or token.startswith("http"):
|
|
return True
|
|
low = token.lower()
|
|
return any(h in low for h in PLACEHOLDER_HINTS)
|
|
|
|
|
|
def clean(token: str) -> str:
|
|
token = token.strip().strip("`'\"()[]<>,;:")
|
|
while token.startswith("./"):
|
|
token = token[2:]
|
|
return token.rstrip(".")
|
|
|
|
|
|
def extract_candidates(text: str):
|
|
"""Yield normalized path candidates found in text."""
|
|
seen = set()
|
|
for regex, group in ((RE_MARKER_PATH, 0), (RE_SKILLMD, 0), (RE_PY_INVOKE, 1), (RE_RELATIVE, 0)):
|
|
for m in regex.finditer(text):
|
|
start = m.start(group)
|
|
if start > 0 and text[start - 1] in PLACEHOLDER_PREFIX_CHARS:
|
|
continue # truncated placeholder like {skill_path}/scripts/x.py
|
|
tok = clean(m.group(group))
|
|
if not tok or "/" not in tok:
|
|
continue
|
|
if is_dynamic(tok):
|
|
continue
|
|
parts = [p for p in tok.split("/") if p and p != ".."]
|
|
if parts and parts[0] in MAINTAINER_LOCAL:
|
|
continue # intentional gitignored maintainer-local link
|
|
if tok not in seen:
|
|
seen.add(tok)
|
|
yield tok
|
|
|
|
|
|
def skill_root(file_path: str, repo_root: str) -> str:
|
|
"""Walk up from the file's dir to the nearest skill/plugin root."""
|
|
d = os.path.dirname(os.path.abspath(file_path))
|
|
# If the file sits in an agents/ or commands/ dir, the plugin root is above it.
|
|
while True:
|
|
if (os.path.isfile(os.path.join(d, "SKILL.md"))
|
|
or os.path.isdir(os.path.join(d, ".claude-plugin"))
|
|
or os.path.isfile(os.path.join(d, "plugin.json"))):
|
|
return d
|
|
parent = os.path.dirname(d)
|
|
if parent == d or os.path.abspath(d) == os.path.abspath(repo_root):
|
|
return os.path.abspath(repo_root)
|
|
d = parent
|
|
|
|
|
|
def resolves(candidate: str, bases) -> bool:
|
|
for base in bases:
|
|
p = os.path.normpath(os.path.join(base, candidate))
|
|
if os.path.exists(p):
|
|
return True
|
|
return False
|
|
|
|
|
|
def load_allowlist(repo_root: str):
|
|
"""Read scripts/check_paths_allowlist.txt: `file-glob :: candidate-glob` per line.
|
|
|
|
Each entry whitelists a known false positive (teaching examples, hypothetical
|
|
user-project paths, example tool output). Keep entries narrow — one file glob
|
|
plus one candidate glob — so real path contracts stay checked.
|
|
"""
|
|
entries = []
|
|
path = os.path.join(repo_root, "scripts", "check_paths_allowlist.txt")
|
|
if not os.path.isfile(path):
|
|
return entries
|
|
with open(path, encoding="utf-8") as fh:
|
|
for line in fh:
|
|
line = line.split("#", 1)[0].strip()
|
|
if not line or "::" not in line:
|
|
continue
|
|
file_glob, cand_glob = (part.strip() for part in line.split("::", 1))
|
|
if file_glob and cand_glob:
|
|
entries.append((file_glob, cand_glob))
|
|
return entries
|
|
|
|
|
|
def allowlisted(rel_file: str, candidate: str, allowlist) -> bool:
|
|
return any(
|
|
fnmatch.fnmatch(rel_file, fg) and fnmatch.fnmatch(candidate, cg)
|
|
for fg, cg in allowlist
|
|
)
|
|
|
|
|
|
def scan_file(path: str, repo_root: str, allowlist=()):
|
|
"""Return list of unresolvable path candidates in file."""
|
|
try:
|
|
with open(path, encoding="utf-8", errors="replace") as fh:
|
|
text = fh.read()
|
|
except OSError as exc:
|
|
return [f"<unreadable: {exc}>"]
|
|
file_dir = os.path.dirname(os.path.abspath(path))
|
|
bases = (skill_root(path, repo_root), file_dir, os.path.abspath(repo_root))
|
|
rel_file = os.path.relpath(os.path.abspath(path), repo_root)
|
|
bad = [c for c in extract_candidates(text)
|
|
if not resolves(c, bases) and not allowlisted(rel_file, c, allowlist)]
|
|
root = plugin_root(path, repo_root)
|
|
# A plugin's commands and agents run from the user's project, not from the
|
|
# plugin, so a script they invoke must be addressed via ${CLAUDE_PLUGIN_ROOT}.
|
|
# A repo-relative path happens to work in a clone of this repo and nowhere else.
|
|
if root and os.path.dirname(os.path.dirname(os.path.abspath(path))) == root \
|
|
and os.path.basename(os.path.dirname(path)) in ("commands", "agents"):
|
|
for m in RE_PY_INVOKE.finditer(text):
|
|
start = m.start(1)
|
|
if start > 0 and text[start - 1] in PLACEHOLDER_PREFIX_CHARS:
|
|
continue
|
|
tok = clean(m.group(1))
|
|
if not tok or is_dynamic(tok) or tok.split("/")[0] in MAINTAINER_LOCAL:
|
|
continue
|
|
msg = f"{tok} (plugin command/agent: use ${{CLAUDE_PLUGIN_ROOT}}/...)"
|
|
if msg not in bad and not allowlisted(rel_file, tok, allowlist):
|
|
bad.append(msg)
|
|
for m in RE_PLUGIN_ROOT.finditer(text):
|
|
rel = clean(m.group(1))
|
|
tok = "${CLAUDE_PLUGIN_ROOT}/" + rel
|
|
if root is None or not os.path.exists(os.path.join(root, rel)):
|
|
if tok not in bad and not allowlisted(rel_file, tok, allowlist):
|
|
bad.append(tok)
|
|
return bad
|
|
|
|
|
|
def plugin_root(file_path: str, repo_root: str):
|
|
"""Nearest ancestor holding .claude-plugin/plugin.json, or None."""
|
|
d = os.path.dirname(os.path.abspath(file_path))
|
|
while True:
|
|
if os.path.isfile(os.path.join(d, ".claude-plugin", "plugin.json")):
|
|
return d
|
|
parent = os.path.dirname(d)
|
|
if parent == d or os.path.abspath(d) == os.path.abspath(repo_root):
|
|
return None
|
|
d = parent
|
|
|
|
|
|
def collect_canonical(repo_root: str):
|
|
"""All SKILL.md + *.md under any agents/ or commands/ dir, excluding sync/doc trees."""
|
|
targets = []
|
|
for dirpath, dirnames, filenames in os.walk(repo_root):
|
|
dirnames[:] = [d for d in dirnames if d not in EXCLUDED_DIRS]
|
|
parts = os.path.relpath(dirpath, repo_root).split(os.sep)
|
|
in_canonical_dir = "agents" in parts or "commands" in parts
|
|
for fn in filenames:
|
|
if fn == "SKILL.md" or (in_canonical_dir and fn.endswith(".md")):
|
|
targets.append(os.path.join(dirpath, fn))
|
|
return sorted(targets)
|
|
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser(
|
|
description="Lint SKILL.md / agents / commands files for phantom (unresolvable) path references."
|
|
)
|
|
ap.add_argument("files", nargs="*", help="Specific markdown files to scan")
|
|
ap.add_argument("--all", action="store_true",
|
|
help="Scan all SKILL.md + agents/*.md + commands/*.md in the repo")
|
|
ap.add_argument("--json", action="store_true", help="Emit JSON instead of human-readable output")
|
|
ap.add_argument("--root", default=os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
|
help="Repo root (default: parent of this script)")
|
|
args = ap.parse_args()
|
|
|
|
repo_root = os.path.abspath(args.root)
|
|
if args.all:
|
|
targets = collect_canonical(repo_root)
|
|
elif args.files:
|
|
targets = [os.path.abspath(f) for f in args.files]
|
|
else:
|
|
ap.print_help()
|
|
return 0
|
|
|
|
allowlist = load_allowlist(repo_root)
|
|
findings = {}
|
|
for f in targets:
|
|
bad = scan_file(f, repo_root, allowlist)
|
|
if bad:
|
|
findings[os.path.relpath(f, repo_root)] = bad
|
|
|
|
total = sum(len(v) for v in findings.values())
|
|
if args.json:
|
|
print(json.dumps({"files_scanned": len(targets), "files_with_findings": len(findings),
|
|
"total_unresolvable": total, "findings": findings}, indent=2))
|
|
else:
|
|
for f in sorted(findings):
|
|
print(f"{f}:")
|
|
for p in findings[f]:
|
|
print(f" UNRESOLVABLE: {p}")
|
|
print(f"\nScanned {len(targets)} files; {len(findings)} files with findings; "
|
|
f"{total} unresolvable path references.")
|
|
return 1 if total else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|