Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"permissions": {
"allow": [
"Bash(python scripts/verify.py)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Edit(./LICENSE)"
]
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.claude/settings.local.json
CLAUDE.local.md
__pycache__/
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Rules for AI agents

Verify: none. This repo holds only Markdown, YAML and 1 image; check YAML forms parse
(`python -c "import yaml,glob;[yaml.safe_load(open(f)) for f in glob.glob('ISSUE_TEMPLATE/*.yml')]"`).
Verify: `python scripts/verify.py` (offline, needs PyYAML; expect `verify: ok`). It parses the issue forms, starter
workflows and their `.properties.json`, and checks relative Markdown links. External links are checked only by CI.

The Solarity-AI organisation's default community files. Every repository without its own copy uses them, so a change
here changes every such repository at once.
Expand All @@ -19,6 +19,7 @@ here changes every such repository at once.
- `workflow-templates/`: org starter workflows offered on every repo's "New workflow" page (`node-ci.yml` calls the
shared Node test job in `ci-platform` at `@v1`; each template needs a matching `.properties.json`).
- `.github/workflows/links.yml`: checks the links in every Markdown file on pull requests (hosted runner, public repo).
- `scripts/verify.py`: the offline check above.
- `profile/README.md`: the public organisation profile page; it is public, so no private repo names, people or numbers.

## Rules
Expand Down
33 changes: 33 additions & 0 deletions scripts/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Offline check for the org default files: YAML and JSON parse, each starter workflow has its properties file,
and every relative Markdown link points at a file that exists. Needs PyYAML. Exit 1 on any problem."""
import glob, json, os, re, sys

import yaml

bad = []
for f in glob.glob("ISSUE_TEMPLATE/*.yml") + glob.glob("workflow-templates/*.yml") + glob.glob(".github/workflows/*.yml"):
try:
yaml.safe_load(open(f, encoding="utf-8"))
except Exception as e:
bad.append(f"{f}: invalid YAML ({e})")
for f in glob.glob("workflow-templates/*.properties.json"):
try:
json.load(open(f, encoding="utf-8"))
except Exception as e:
bad.append(f"{f}: invalid JSON ({e})")
for f in glob.glob("workflow-templates/*.yml"):
p = f[:-4] + ".properties.json"
if not os.path.exists(p):
bad.append(f"{f}: missing {p}")
for f in glob.glob("*.md") + glob.glob("profile/*.md"):
text = open(f, encoding="utf-8").read()
for m in re.findall(r'\]\(([^)\s]+)\)|src="([^"]+)"', text):
url = m[0] or m[1]
if url.startswith(("#", "mailto:", "http://", "https://")):
continue
if not os.path.exists(os.path.join(os.path.dirname(f), url.split("#")[0])):
bad.append(f"{f}: {url} -> missing file")
for b in bad:
print("FAIL", b)
print("verify: " + ("FAILED" if bad else "ok"))
sys.exit(1 if bad else 0)