diff --git a/.github/readme-source.json b/.github/readme-source.json deleted file mode 100644 index fd84e14..0000000 --- a/.github/readme-source.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 1, - "sha256": "fded3f18b290aa29d4d317358c5296e9477be3c5b785449f0b0066a6e3d3f08c", - "history": { - "forbidden_commits": [ - "3cbdabb71650fbca119b17e89ceed577f6bf81cd" - ] - } -} diff --git a/.github/readme-source.toml b/.github/readme-source.toml new file mode 100644 index 0000000..f5e45e3 --- /dev/null +++ b/.github/readme-source.toml @@ -0,0 +1,5 @@ +version = 1 +sha256 = "fded3f18b290aa29d4d317358c5296e9477be3c5b785449f0b0066a6e3d3f08c" + +[history] +forbidden_commits = ["3cbdabb71650fbca119b17e89ceed577f6bf81cd"] diff --git a/.github/runtime-sources.json b/.github/runtime-sources.json deleted file mode 100644 index 84722de..0000000 --- a/.github/runtime-sources.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "source": "SKILL.prompt", - "target": "SKILL.md" - } -] diff --git a/.github/runtime-sources.toml b/.github/runtime-sources.toml new file mode 100644 index 0000000..505549a --- /dev/null +++ b/.github/runtime-sources.toml @@ -0,0 +1,3 @@ +[[sources]] +source = "SKILL.prompt" +target = "SKILL.md" diff --git a/.github/scripts/check-documentation.py b/.github/scripts/check-documentation.py index ae3dbd9..e2a7c19 100644 --- a/.github/scripts/check-documentation.py +++ b/.github/scripts/check-documentation.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 """Check tracked documentation layout and the reviewed usage README digest.""" import hashlib -import json import os from pathlib import Path, PurePosixPath import subprocess import sys +import tomllib MARKDOWN = {'.md', '.markdown', '.mdown', '.mkd', '.mkdn', '.mdwn', '.mdx', '.rmd', '.qmd'} OTHER_DOCS = {'.rst', '.adoc', '.asciidoc'} @@ -39,10 +39,10 @@ def check(root, include_history=True, history_required=False): body = readme.read_bytes() if not any(line.startswith('# ') for line in body.decode('utf-8').splitlines()): errors.append('root README.md needs a product heading') - policy_path = root / '.github/readme-source.json' + policy_path = root / '.github/readme-source.toml' if policy_path.is_symlink(): raise ValueError('README source policy cannot be a symlink') - policy = json.loads(policy_path.read_text()) + policy = tomllib.loads(policy_path.read_text()) if policy.get('version') != 1: raise ValueError('unsupported README source policy') if hashlib.sha256(body).hexdigest() != policy.get('sha256'): diff --git a/scripts/prepare-runtime.py b/scripts/prepare-runtime.py index 2d6a957..5dc2473 100644 --- a/scripts/prepare-runtime.py +++ b/scripts/prepare-runtime.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Materialize native runtime filenames from tracked functional inputs.""" -import json +import tomllib from pathlib import Path import os import sys @@ -8,7 +8,13 @@ ROOT = Path(__file__).resolve().parents[1] def prepare(): - records = json.loads((ROOT / '.github/runtime-sources.json').read_text()) + manifest = ROOT / '.github/runtime-sources.toml' + if manifest.is_symlink() or not manifest.is_file() or manifest.stat().st_size > 262144: + raise ValueError('runtime manifest must be a bounded regular TOML source') + declaration = tomllib.loads(manifest.read_text(encoding='utf-8')) + if set(declaration) != {'sources'} or not isinstance(declaration['sources'], list) or len(declaration['sources']) > 128: + raise ValueError('runtime manifest requires one bounded sources array') + records = declaration['sources'] for row in records: source, target = ROOT / row['source'], ROOT / row['target'] if not source.resolve().is_relative_to(ROOT.resolve()) or not target.parent.resolve().is_relative_to(ROOT.resolve()):