Repository navigation
115 lines (106 loc) · 4.16 KB
/
Copy pathvalidate.yml
File metadata and controls
115 lines (106 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Validate
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
skill:
name: skill integrity (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: pip install --quiet pyyaml pytest
# Read-only. Verifies SKILL.md is installable (frontmatter well-formed)
# and structurally intact (L0/L1/L4/L5 present — see NOTICE).
- name: Validate SKILL.md
run: python tools/validate_skill.py
- name: Contract tests
run: python -m pytest -q
links:
name: internal links resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Markdown links AND backticked paths such as `references/CODEX_KALAMA.md`:
# SKILL.md points to its references in backticks, and in v1.0 all six pointed
# at references/ while the folder was Reference/ -- invisible to a link check.
- name: Check relative links and referenced paths
run: |
python - <<'PY'
import pathlib, re, sys
bad = []
root = pathlib.Path('.').resolve()
def exists_exact(base, rel):
here = base
for part in pathlib.PurePosixPath(rel).parts:
if part == '..': here = here.parent; continue
if part == '.': continue
if not here.is_dir() or part not in {p.name for p in here.iterdir()}: return False
here = here / part
return True
for md in pathlib.Path('.').rglob('*.[mM][dD]'):
if {'.git', 'evals'} & set(md.parts): continue
text = md.read_text(encoding='utf-8')
for link in re.findall(r'\[[^\]]*\]\(([^)#]+)\)', text):
if link.startswith(('http://', 'https://', 'mailto:')): continue
if not exists_exact(md.parent.resolve(), link):
bad.append(f"{md}: {link}")
for path in re.findall(r'`((?:references|example|tools|tests)/[^`\s]+)`', text):
if '*' in path: continue # a glob in prose, not a file reference
if not exists_exact(root, path):
bad.append(f"{md}: `{path}`")
if bad:
print("Broken relative links:")
print("\n".join(f" {b}" for b in bad)); sys.exit(1)
print(" OK all relative links resolve")
PY
plugin:
name: claude code plugin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install Claude Code CLI (pinned)
run: npm install -g @anthropic-ai/claude-code@2.1.309
- name: Validate marketplace + plugin manifests
run: claude plugin validate . --strict
- name: Plugin skill copy matches SKILL.md + references/
run: |
cmp SKILL.md skills/first-principle-codex-os/SKILL.md
diff -r references skills/first-principle-codex-os/references
echo " OK in sync"
hygiene:
name: repo hygiene
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: No tree-glyph or extensionless filenames
run: |
python - <<'PY'
import pathlib, sys
allow = {'LICENSE', 'NOTICE', 'CODEOWNERS', 'Makefile', 'Dockerfile'}
skip = {'.git', '__pycache__', '.pytest_cache'}
probs = []
for p in pathlib.Path('.').rglob('*'):
if skip & set(p.parts) or not p.is_file(): continue
if any(c in p.name for c in '└├─│'): probs.append(f"tree glyph: {p}")
if not p.suffix and p.name not in allow and not p.name.startswith('.'):
probs.append(f"missing extension: {p}")
if probs:
print("\n".join(f" {x}" for x in probs)); sys.exit(1)
print(" OK filenames clean")
PY