Skip to content

Commit d6e23df

Browse files
committed
feat: add Python lint, checkpoint validation, auto-merge-deps workflow
- Python lint: auto-discovers .py files, runs ruff check + format - Checkpoint schema: validates checkpoints.yaml structure and unique IDs - auto-merge-deps.yml: reusable workflow for dependabot/renovate auto-merge Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
1 parent 81d0c71 commit d6e23df

File tree

3 files changed

+72
-3
lines changed

3 files changed

+72
-3
lines changed

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "skill-repo",
3-
"version": "1.5.1",
3+
"version": "1.6.0",
44
"description": "Guide for structuring Netresearch skill repositories",
55
"repository": "https://github.com/netresearch/skill-repo-skill",
66
"license": "MIT",

.github/workflows/auto-merge-deps.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
name: Auto-merge dependency PRs
44

55
on:
6-
pull_request_target:
7-
types: [opened, synchronize, reopened]
6+
workflow_call:
87

98
permissions:
109
contents: write

.github/workflows/validate.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,73 @@ jobs:
7676
exit 1
7777
fi
7878
echo "All $COUNT scripts passed ShellCheck"
79+
80+
- name: Python lint
81+
run: |
82+
PYFILES=$(find . -path './.skill-repo-tools' -prune -o -path './.git' -prune -o \
83+
-name '*.py' -type f -print | sort)
84+
if [[ -z "$PYFILES" ]]; then
85+
echo "No Python files found, skipping"
86+
exit 0
87+
fi
88+
COUNT=$(echo "$PYFILES" | wc -l)
89+
echo "Found $COUNT Python file(s)"
90+
# Collect directories containing .py files
91+
DIRS=$(echo "$PYFILES" | xargs -I{} dirname {} | sort -u | tr '\n' ' ')
92+
pip install ruff -q
93+
echo "=== ruff check ==="
94+
ruff check $DIRS
95+
echo "=== ruff format ==="
96+
ruff format --check $DIRS
97+
98+
- name: Validate checkpoint schemas
99+
run: |
100+
CHECKPOINT_FILES=$(find . -path './.skill-repo-tools' -prune -o -path './.git' -prune -o \
101+
-name 'checkpoints.yaml' -o -name '*-checkpoints.yaml' | grep -v '.skill-repo-tools' | sort)
102+
if [[ -z "$CHECKPOINT_FILES" ]]; then
103+
echo "No checkpoint files found, skipping"
104+
exit 0
105+
fi
106+
COUNT=$(echo "$CHECKPOINT_FILES" | wc -l)
107+
echo "Found $COUNT checkpoint file(s)"
108+
pip install pyyaml -q
109+
FAILED=0
110+
while IFS= read -r f; do
111+
[[ -z "$f" ]] && continue
112+
echo "=== Validating $f ==="
113+
python3 -c "
114+
import sys, yaml
115+
with open('$f') as fh:
116+
data = yaml.safe_load(fh)
117+
if not isinstance(data, dict):
118+
print('ERROR: not a YAML mapping')
119+
sys.exit(1)
120+
has_mechanical = 'mechanical' in data
121+
has_llm = 'llm_reviews' in data
122+
if not has_mechanical and not has_llm:
123+
print('ERROR: must have mechanical and/or llm_reviews section')
124+
sys.exit(1)
125+
all_ids = []
126+
for section in ('mechanical', 'llm_reviews'):
127+
items = data.get(section, [])
128+
if items is None:
129+
continue
130+
for item in items:
131+
if 'id' not in item:
132+
print(f'ERROR: entry in {section} missing id field')
133+
sys.exit(1)
134+
all_ids.append(item['id'])
135+
dupes = [x for x in all_ids if all_ids.count(x) > 1]
136+
if dupes:
137+
print(f'ERROR: duplicate checkpoint IDs: {set(dupes)}')
138+
sys.exit(1)
139+
m = len(data.get('mechanical', []) or [])
140+
l = len(data.get('llm_reviews', []) or [])
141+
print(f'Valid: {m} mechanical + {l} LLM review checkpoints')
142+
" || FAILED=1
143+
done <<< "$CHECKPOINT_FILES"
144+
if [[ $FAILED -eq 1 ]]; then
145+
echo "::error::Checkpoint validation failed"
146+
exit 1
147+
fi
148+
echo "All $COUNT checkpoint file(s) valid"

0 commit comments

Comments
 (0)