Skip to content

Validate that GAP directories only contain allowed files#35

Merged
magicmark merged 18 commits into
graphql:mainfrom
magicmark:validate-allowed-files
Jul 9, 2026
Merged

Validate that GAP directories only contain allowed files#35
magicmark merged 18 commits into
graphql:mainfrom
magicmark:validate-allowed-files

Conversation

@magicmark

@magicmark magicmark commented May 19, 2026

Copy link
Copy Markdown
Contributor

Adds a file allowlist check to validate-structure.js — GAP directories may now only contain *.md files and metadata.yml. Rejects unexpected files or subdirectories with a message pointing contributors to @graphql/gaps-editors.

Motivation: prevent files like .nvmrc from being merged that could inadvertently affect developer environments.

Restrict files in GAP directories to *.md and metadata.yml to prevent
files that could poison developer environments (e.g. .nvmrc) from being
merged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Comment thread scripts/validate-structure.js Outdated
magicmark and others added 6 commits June 2, 2026 11:22
Address review feedback: skip dotfiles (e.g. .gitkeep) from the
allowlist check, and permit metadata.json alongside metadata.yml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Dotfiles like .nvmrc should still be rejected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Catches cases like .foo.md that would otherwise pass the .md check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two plain functions, no abstractions. Validates YYYY-MM.md and
YYYY-MM.yml in versions/, rejects dotfiles at both levels.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@magicmark
magicmark marked this pull request as ready for review June 3, 2026 15:17
@benjie

benjie commented Jul 9, 2026

Copy link
Copy Markdown
Member

Oops I meant to send this as a pull request... accidentally pushed to your branch. Oh well...

  • Converted from .js to .ts
  • Added types
  • Made the script collect together errors so it doesn't just exit on first one
  • Made the script run in parallel rather than series
  • Made the script process all gaps/* directories (unless one is specified) so there's no need for shell scripting in package.json
  • Entire script completes in ~0.1s for me now

@benjie

benjie commented Jul 9, 2026

Copy link
Copy Markdown
Member

Figured I might as well switch the other script to TS too.

@magicmark
magicmark merged commit b84e8c5 into graphql:main Jul 9, 2026
2 checks passed
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.

2 participants