Repository navigation
Add automatic updates for the StyleKit Skill #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| *.md text eol=lf | ||
| *.py text eol=lf | ||
| *.json text eol=lf | ||
| *.yaml text eol=lf | ||
| *.yml text eol=lf | ||
| *.toml text eol=lf | ||
| *.sh text eol=lf | ||
| *.txt text eol=lf | ||
| *.css text eol=lf | ||
| *.tsx text eol=lf | ||
| *.ts text eol=lf | ||
| *.svg text eol=lf | ||
| *.xml text eol=lf |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,121 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Generate or check the published StyleKit Skill payload manifest.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from __future__ import annotations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import argparse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hashlib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import subprocess | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import sys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REPOSITORY = "AnxForever/stylekit-skill" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BRANCH = "main" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RELEASE_VERSION = "0.7.0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MANIFEST = Path(__file__).resolve().with_name("release-manifest.json") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ROOT = MANIFEST.parents[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PAYLOAD_FILES = (Path("SKILL.md"),) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PAYLOAD_DIRS = (Path("scripts"), Path("references"), Path("agents"), Path("assets")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EXCLUDED_NAMES = {"__pycache__", ".DS_Store"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def payload_paths() -> list[Path]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| found = list(PAYLOAD_FILES) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for directory in PAYLOAD_DIRS: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| absolute = ROOT / directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if absolute.exists(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| found.extend(path.relative_to(ROOT) for path in absolute.rglob("*") if path.is_file()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result: list[Path] = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| folded: set[str] = set() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for relative in found: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if any(part in EXCLUDED_NAMES or part.endswith(".pyc") for part in relative.parts): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| absolute = ROOT / relative | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if absolute.is_symlink(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError("refusing a symbolic link in the Skill payload: " + relative.as_posix()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| normalized = relative.as_posix() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if normalized == "scripts/release-manifest.json": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if normalized.casefold() in folded: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError("case-colliding Skill payload path: " + normalized) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| folded.add(normalized.casefold()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if absolute.is_file(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.append(relative) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return sorted(result, key=lambda path: path.as_posix()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def render() -> bytes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| files = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for relative in payload_paths(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data = (ROOT / relative).read_bytes() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| files[relative.as_posix()] = {"sha256": hashlib.sha256(data).hexdigest(), "size": len(data)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| document = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "schemaVersion": 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "repository": REPOSITORY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "branch": BRANCH, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "version": RELEASE_VERSION, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "files": files, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return (json.dumps(document, ensure_ascii=False, sort_keys=True, indent=2) + "\n").encode("utf-8") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def check_version_against(reference: str) -> int: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exists = subprocess.run(["git", "cat-file", "-e", reference + "^{commit}"], cwd=ROOT, capture_output=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if exists.returncode: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("cannot resolve comparison commit " + reference, file=sys.stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| old = subprocess.run( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ["git", "show", reference + ":scripts/release-manifest.json"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cwd=ROOT, capture_output=True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if old.returncode: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # The first release manifest has no prior version to compare. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message = old.stderr.decode("utf-8", "replace") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if "does not exist in" in message or "exists on disk, but not in" in message: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("cannot read the base release manifest: " + message.strip(), file=sys.stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+64
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '64,121p' scripts/generate-release-manifest.py
sed -n '19,44p' .github/workflows/regression-gate.ymlRepository: AnxForever/stylekit-skill Length of output: 4170 🏁 Script executed: set -eu
printf '%s\n' '--- workflow triggers and version-check step ---'
sed -n '1,75p' .github/workflows/regression-gate.yml
printf '%s\n' '--- CLI call sites ---'
rg -n --glob '!node_modules' --glob '!dist' -- '--check-version-against|generate-release-manifest.py' .
printf '%s\n' '--- base and head source excerpts ---'
git show a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/generate-release-manifest.py 2>/dev/null | sed -n '55,95p' || true
git show 09180f070864cfc9be04a4fbed075693adb93b88:scripts/generate-release-manifest.py | sed -n '55,95p'
printf '%s\n' '--- manifest presence at base and head ---'
for rev in a5e42c8700cf71fc783653c0906e4689cdff0b1f 09180f070864cfc9be04a4fbed075693adb93b88; do
printf '%s: ' "$rev"
git cat-file -e "$rev:scripts/release-manifest.json" 2>/dev/null && echo present || echo absent-or-error
done
printf '%s\n' '--- locale-independent Git status probes ---'
git ls-tree --exit-code --name-only a5e42c8700cf71fc783653c0906e4689cdff0b1f -- scripts/release-manifest.json >/tmp/ls-tree-present.out 2>/tmp/ls-tree-present.err; printf 'existing path rc=%s stdout=%s stderr=%s\n' "$?" "$(cat /tmp/ls-tree-present.out)" "$(cat /tmp/ls-tree-present.err)"
git ls-tree --exit-code --name-only a5e42c8700cf71fc783653c0906e4689cdff0b1f -- scripts/no-such-release-manifest.json >/tmp/ls-tree-missing.out 2>/tmp/ls-tree-missing.err; rc=$?; printf 'missing path rc=%s stdout=%s stderr=%s\n' "$rc" "$(cat /tmp/ls-tree-missing.out)" "$(cat /tmp/ls-tree-missing.err)"
git cat-file --batch-check='%(objecttype)' <<'EOF' >/tmp/cat-file-batch.out 2>/tmp/cat-file-batch.err
a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/release-manifest.json
a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/no-such-release-manifest.json
EOF
printf 'batch stdout:\n'; cat /tmp/cat-file-batch.out
printf 'batch stderr:\n'; cat /tmp/cat-file-batch.errRepository: AnxForever/stylekit-skill Length of output: 6059 🏁 Script executed: set +e
printf '%s\n' '--- workflow triggers and version-check step ---'
sed -n '1,75p' .github/workflows/regression-gate.yml
printf '%s\n' '--- CLI call sites ---'
rg -n --glob '!node_modules' --glob '!dist' -- '--check-version-against|generate-release-manifest.py' .
printf '%s\n' '--- base and head source excerpts ---'
git show a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/generate-release-manifest.py 2>/dev/null | sed -n '55,95p'
printf 'base source rc=%s\n' "$?"
git show 09180f070864cfc9be04a4fbed075693adb93b88:scripts/generate-release-manifest.py | sed -n '55,95p'
printf '%s\n' '--- manifest presence at base and head ---'
for rev in a5e42c8700cf71fc783653c0906e4689cdff0b1f 09180f070864cfc9be04a4fbed075693adb93b88; do
printf '%s: ' "$rev"
git cat-file -e "$rev:scripts/release-manifest.json" 2>/dev/null
rc=$?
if [ "$rc" -eq 0 ]; then echo present; else echo absent-or-error rc="$rc"; fi
done
printf '%s\n' '--- locale-independent Git status probes ---'
git ls-tree --exit-code --name-only a5e42c8700cf71fc783653c0906e4689cdff0b1f -- scripts/release-manifest.json >/tmp/ls-tree-present.out 2>/tmp/ls-tree-present.err
rc=$?
printf 'existing path rc=%s stdout=%s stderr=%s\n' "$rc" "$(cat /tmp/ls-tree-present.out)" "$(cat /tmp/ls-tree-present.err)"
git ls-tree --exit-code --name-only a5e42c8700cf71fc783653c0906e4689cdff0b1f -- scripts/no-such-release-manifest.json >/tmp/ls-tree-missing.out 2>/tmp/ls-tree-missing.err
rc=$?
printf 'missing path rc=%s stdout=%s stderr=%s\n' "$rc" "$(cat /tmp/ls-tree-missing.out)" "$(cat /tmp/ls-tree-missing.err)"
git cat-file --batch-check='%(objecttype)' <<'EOF' >/tmp/cat-file-batch.out 2>/tmp/cat-file-batch.err
a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/release-manifest.json
a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/no-such-release-manifest.json
EOF
rc=$?
printf 'batch rc=%s stdout:\n' "$rc"
cat /tmp/cat-file-batch.out
printf 'batch stderr:\n'
cat /tmp/cat-file-batch.errRepository: AnxForever/stylekit-skill Length of output: 7809 🏁 Script executed: set +e
printf '%s\n' '--- workflow triggers and version-check step ---'
sed -n '1,75p' .github/workflows/regression-gate.yml
printf '%s\n' '--- CLI call sites ---'
rg -n --glob '!node_modules' --glob '!dist' -- '--check-version-against|generate-release-manifest.py' .
printf '%s\n' '--- base and head source excerpts ---'
git show a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/generate-release-manifest.py 2>/dev/null | sed -n '55,95p'
printf 'base source rc=%s\n' "$?"
git show 09180f070864cfc9be04a4fbed075693adb93b88:scripts/generate-release-manifest.py | sed -n '55,95p'
printf '%s\n' '--- manifest presence at base and head ---'
for rev in a5e42c8700cf71fc783653c0906e4689cdff0b1f 09180f070864cfc71fc783653c0906e4689cdff0b1f 09180f070864cfc9be04a4fbed075693adb93b88; do
printf '%s: ' "$rev"
git cat-file -e "$rev:scripts/release-manifest.json" 2>/dev/null
rc=$?
if [ "$rc" -eq 0 ]; then echo present; else echo absent-or-error rc="$rc"; fi
done
printf '%s\n' '--- locale-independent Git status probes ---'
git ls-tree --exit-code --name-only a5e42c8700cf71fc783653c0906e4689cdff0b1f -- scripts/release-manifest.json >/tmp/ls-tree-present.out 2>/tmp/ls-tree-present.err
rc=$?
printf 'existing path rc=%s stdout=%s stderr=%s\n' "$rc" "$(cat /tmp/ls-tree-present.out)" "$(cat /tmp/ls-tree-present.err)"
git ls-tree --exit-code --name-only a5e42c8700cf71fc783653c0906e4689cdff0b1f -- scripts/no-such-release-manifest.json >/tmp/ls-tree-missing.out 2>/tmp/ls-tree-missing.err
rc=$?
printf 'missing path rc=%s stdout=%s stderr=%s\n' "$rc" "$(cat /tmp/ls-tree-missing.out)" "$(cat /tmp/ls-tree-missing.err)"
git cat-file --batch-check='%(objecttype)' <<'EOF' >/tmp/cat-file-batch.out 2>/tmp/cat-file-batch.err
a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/release-manifest.json
a5e42c8700cf71fc783653c0906e4689cdff0b1f:scripts/no-such-release-manifest.json
EOF
rc=$?
printf 'batch rc=%s stdout:\n' "$rc"
cat /tmp/cat-file-batch.out
printf 'batch stderr:\n'
cat /tmp/cat-file-batch.errRepository: AnxForever/stylekit-skill Length of output: 7877 🏁 Script executed: set +e
base=a5e42c8700cf71fc783653c0906e4689cdff0b1f
head=09180f070864cfc9be04a4fbed075693adb93b88
for label in base-missing head-present invalid-reference; do
case "$label" in
base-missing) ref="$base"; path=scripts/release-manifest.json ;;
head-present) ref="$head"; path=scripts/release-manifest.json ;;
invalid-reference) ref=0000000000000000000000000000000000000000; path=scripts/release-manifest.json ;;
esac
out=$(git ls-tree --name-only "$ref" -- "$path" 2>/tmp/ls-tree.err)
rc=$?
printf '%s rc=%s stdout=%s stderr=%s\n' "$label" "$rc" "$out" "$(cat /tmp/ls-tree.err)"
doneRepository: AnxForever/stylekit-skill Length of output: 325 Do not rely on English Git error text to detect a missing base manifest. The version check runs for pull requests and pushes to The proposed Suggested fix+ present = subprocess.run(
+ ["git", "ls-tree", "--name-only", reference, "--", "scripts/release-manifest.json"],
+ cwd=ROOT, capture_output=True,
+ )
+ if present.returncode:
+ message = present.stderr.decode("utf-8", "replace")
+ print("cannot read the base release manifest: " + message.strip(), file=sys.stderr)
+ return 1
+ if not present.stdout:
+ return 0
old = subprocess.run(📝 Committable suggestion
Suggested change
🧰 Tools🪛 ast-grep (0.45.3)[error] 64-64: Command coming from incoming request (subprocess-from-request) [error] 68-71: Command coming from incoming request (subprocess-from-request) 🪛 Ruff (0.16.7)[error] 65-65: (S603) [error] 65-65: Starting a process with a partial executable path (S607) [error] 69-69: (S603) [error] 70-70: Starting a process with a partial executable path (S607) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| previous = json.loads(old.stdout.decode("utf-8")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current = json.loads(render().decode("utf-8")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| previous_version = previous["version"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_version = current["version"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| version_pattern = re.compile(r"^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not version_pattern.fullmatch(previous_version) or not version_pattern.fullmatch(current_version): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError("invalid semantic version") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| previous_files = previous["files"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if previous_files != current["files"]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| previous_tuple = tuple(int(part) for part in previous_version.split(".")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_tuple = tuple(int(part) for part in current_version.split(".")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if current_tuple <= previous_tuple: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("bump RELEASE_VERSION when changing a managed Skill payload", file=sys.stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| except (KeyError, TypeError, ValueError, json.JSONDecodeError) as exc: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("cannot compare release versions: " + str(exc), file=sys.stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def main() -> int: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parser = argparse.ArgumentParser(description=__doc__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parser.add_argument("--check", action="store_true", help="fail if the committed manifest is stale") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parser.add_argument("--check-version-against", metavar="GIT_REF", help="require a higher release version if managed files changed") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args = parser.parse_args() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if args.check_version_against: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return check_version_against(args.check_version_against) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expected = render() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if args.check: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not MANIFEST.is_file() or MANIFEST.read_bytes() != expected: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("release manifest is stale; run python3 scripts/generate-release-manifest.py", file=sys.stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("release manifest matches Skill payload " + RELEASE_VERSION) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MANIFEST.write_bytes(expected) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print("wrote scripts/release-manifest.json for Skill payload " + RELEASE_VERSION) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if __name__ == "__main__": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise SystemExit(main()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| { | ||
| "branch": "main", | ||
| "files": { | ||
| "SKILL.md": { | ||
| "sha256": "ce446da826199ba26a7c756e5db6fb637d2100bcae8b63b007e5138dc8688898", | ||
| "size": 8316 | ||
| }, | ||
| "references/assets.md": { | ||
| "sha256": "6ce907c99d270fad80d6f1755f169c1ab24c5de9de0588bbb8a890acdf7641d8", | ||
| "size": 5568 | ||
| }, | ||
| "references/design-principles.md": { | ||
| "sha256": "7f09fe585281299934f16ae59d96fb3302d19051845e1da08a46d1d414e1be03", | ||
| "size": 3367 | ||
| }, | ||
| "references/forward-test.md": { | ||
| "sha256": "39e5222da8f9247a11746d6585bcc790eb7fca3c1bb4f5c731e71e6c6454b6fd", | ||
| "size": 1906 | ||
| }, | ||
| "references/style-signatures.md": { | ||
| "sha256": "68abe03fef25448f26d1f07fb9e5e049267fc811d4141443da6b97ad07715f24", | ||
| "size": 2841 | ||
| }, | ||
| "scripts/benchmark.py": { | ||
| "sha256": "c50eeffd4838a0ee6d588dcdd39ceb80c96a8e6da6021a7d1db25ff36ec4565b", | ||
| "size": 9476 | ||
| }, | ||
| "scripts/detect-project.py": { | ||
| "sha256": "bbc9d17e3dfa560a2c101d898d16e2bef8d9782811cac7f087ff78f7f399db82", | ||
| "size": 5555 | ||
| }, | ||
| "scripts/eval-check.py": { | ||
| "sha256": "90a0a16562135b7008521498c77a07589366cfa5457ead83014f7a8cb78489b0", | ||
| "size": 13411 | ||
| }, | ||
| "scripts/fetch-asset.py": { | ||
| "sha256": "84b716abf6219f720f87f365c43c5ac69a5de56d8c064d6d4b53f35aff0a1872", | ||
| "size": 29814 | ||
| }, | ||
| "scripts/fetch-style.py": { | ||
| "sha256": "3ffa55e12a8922e484c6e58f7e1da9c406f152a719859a5aa64a236b8a11005b", | ||
| "size": 7077 | ||
| }, | ||
| "scripts/generate-release-manifest.py": { | ||
| "sha256": "f4f76fbe37f38f9de291bb8528a42d97cd495845c416a12a8ee79763ed458dbd", | ||
| "size": 5005 | ||
| }, | ||
| "scripts/spec_input.py": { | ||
| "sha256": "9f4cf453f633c6bdf2a2227ccee5c2c861204f1fa3c379a7309fbc86734b06c8", | ||
| "size": 17205 | ||
| }, | ||
| "scripts/update-skill.py": { | ||
| "sha256": "a18babd0da0b8365200eb2663aab5c392334fb6e996ad69d24c26cae0632afb3", | ||
| "size": 37561 | ||
| }, | ||
| "scripts/verify-spec.py": { | ||
| "sha256": "62490b2868f4ce070ec04f5a820de058cbeb88864e4e169752558bf07d3871c6", | ||
| "size": 5753 | ||
| } | ||
| }, | ||
| "repository": "AnxForever/stylekit-skill", | ||
| "schemaVersion": 1, | ||
| "version": "0.7.0" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Detected with Advanced Tier | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: AnxForever/stylekit-skill
Length of output: 42483
Reachability: External
Exploitability: Difficult
CWE: CWE-345
Authenticate the update before rereading fetched instructions.
_run_autovalidates the archive payload against a manifest from that same archive, then applies it. No independent signature or trust-root check protects the manifest orSKILL.md. A compromise of themainbranch or archive publication can therefore replace both and execute new instructions in the current invocation.Add release authentication against an independently trusted key before
_apply_payload, and reject the update when verification fails.🧰 Tools
🪛 SkillSpector (2.11.2)
[error] 16: [AE1] null: Referenced artifact was not completely inspected
Remediation: Make the referenced artifact locally available and fully analyzable, or remove the reference.
(analysis-evasion (AE1))
[error] 39: [AE1] null: Referenced artifact was not completely inspected
Remediation: Make the referenced artifact locally available and fully analyzable, or remove the reference.
(analysis-evasion (AE1))
[error] 27: [RA1] Self-Modification: Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
Remediation: Prevent the skill from modifying its own code, SKILL.md, or configuration files. Treat skill files as read-only at runtime.
(Rogue Agent (RA1))
[warning] 27: [RP1] null: npx commands without a version suffix (e.g.
@1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.Remediation: Pin the version: npx
@scope/server``@1.2.3(MCP Rug Pull (RP1))
View in Security blast radius
🤖 Prompt for AI Agents