feat: make the site database authoritative for documents and catalog
Verify database-backed documents / verify (pull_request) Failing after 6m6s
Verify database-backed documents / verify (pull_request) Failing after 6m6s
This commit is contained in:
@@ -9,7 +9,8 @@ from urllib.parse import urlsplit
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DATA = json.loads((ROOT / 'content/research/ai-companies.seed.json').read_text())
|
||||
AUDIT = json.loads((ROOT / 'content/research/ai-companies.coverage.json').read_text())
|
||||
TARGET = ROOT / 'content/docs/ai-company-research/02-coverage-and-gaps.md'
|
||||
TARGET = ROOT / '.artifacts/reports/02-coverage-and-gaps.md'
|
||||
SOURCE_SLUG = 'ai-company-research/02-coverage-and-gaps'
|
||||
BASE = '/docs/other-research/ai-company-research/overview'
|
||||
|
||||
|
||||
@@ -95,13 +96,17 @@ def render():
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--check', action='store_true')
|
||||
parser.add_argument('--document-export', type=Path, default=ROOT / '.artifacts/documents-migration.json')
|
||||
args = parser.parse_args()
|
||||
content = render()
|
||||
if args.check:
|
||||
if not TARGET.exists() or TARGET.read_text() != content:
|
||||
bundle = json.loads(args.document_export.read_text())
|
||||
stored = next((d['content'] for d in bundle['documents'] if d['sourceSlug'] == SOURCE_SLUG), None)
|
||||
if stored != content:
|
||||
sys.exit('Research coverage report differs; review and regenerate')
|
||||
print('Research coverage accounting and report are consistent')
|
||||
else:
|
||||
TARGET.parent.mkdir(parents=True, exist_ok=True)
|
||||
TARGET.write_text(content)
|
||||
print(TARGET.relative_to(ROOT))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user