Skip to content

refactor(validate): extract a side-effect-free repository validation function - #106

Merged
wab merged 2 commits into
mainfrom
claude/pure-validation-31c503
Oct 21, 2026
Merged

wab merged 2 commits into
mainfrom
claude/pure-validation-31c503

Conversation

@wab

@wab wab commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Closes #93

What

  • New scripts/validate-repository.js exports validateRepository(repoRoot). It returns { failures, assetErrors, assetWarnings }; each failure carries file, schemaErrors and crossRefErrors. It reads files but never prints and never exits.
  • scripts/validate-content.js is now a thin CLI: it calls the function, prints and sets the exit code.
  • Cross-reference errors now use the same { path, message } shape as schema errors. The CLI formats both with the same function, so the printed lines do not change.
  • New scripts/__tests__/validate-repository.test.js builds a fixture repository on disk and covers: all valid, one schema error, one dangling author, one client asset error.

Behaviour check

pnpm validate output compared byte for byte, stdout and stderr, before and after:

  • current repository: identical, exit 0;
  • a broken copy (missing team fields, dangling author, featuredTool and hiringContact, a .jpeg client asset, a missing story avatar): identical, exit 1.

Why

Test seam 2 of the spec #91. #94 (enjeu schema and validation) and #95 (Team member expert fields) add their rules and tests through this function.

pnpm test: 193 passed.

wab added 2 commits October 21, 2026 12:02
…function

validate-content ran at import time and called process.exit, so nothing
could test it. validateRepository(repoRoot) now returns per-file schema
and cross-reference errors plus client asset errors and warnings, and
never prints or exits. The CLI is a thin wrapper with the same output
and exit codes.

Cross-reference errors now share the { path, message } shape of schema
errors, so later rules return data instead of preformatted strings.

Refs #93
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Preview: https://website-7jkx0o9jj-ocobo-22231b32.vercel.app

Built from website main with content from this PR's branch.

@wab
wab merged commit a1f1cca into main Oct 21, 2026
2 checks passed
@wab
wab deleted the claude/pure-validation-31c503 branch October 21, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract a pure repository validation function

1 participant