Skip to content

feat(cli): add validate.ignore config for excluding paths from validation#2

Open
pyrex41 wants to merge 1 commit into
millstonehq:mainfrom
pyrex41:feat/validate-ignore-config
Open

feat(cli): add validate.ignore config for excluding paths from validation#2
pyrex41 wants to merge 1 commit into
millstonehq:mainfrom
pyrex41:feat/validate-ignore-config

Conversation

@pyrex41
Copy link
Copy Markdown

@pyrex41 pyrex41 commented May 15, 2026

Problem

The synapse validate command discovers markdown files with fast-glob using a hard-coded ignore list:

["**/node_modules/**", "**/.git/**", "**/templates/**", "index.md"]

This list appears at both glob() call sites in validate.ts (the per-directory file set and the full vault cross-reference set). Forks have no way to opt a path out of strict body-grammar validation — the only workaround is renaming a folder to templates/, which is a misleading hack.

Solution

Add an optional validate.ignore field to SynapseConfig:

// synapse.config.json
{
  "validate": {
    "ignore": ["**/210_QA-Memory/**"]
  }
}
  • A new getValidateIgnore() helper in lib/config.ts merges the configured patterns with the built-in defaults (de-duplicated) — it does not replace them, so consumers never need to repeat node_modules/templates.
  • The validate command now resolves the ignore list once and passes it to both glob() call sites.
  • Absent or empty config behaves exactly as before.

Motivating use case

A downstream fork (FacilityGrid's fg-synapse) has a free-form documentation subsection — content/210_QA-Memory/ — that intentionally does not follow any body grammar. Today that content fails strict validation. With validate.ignore the fork can exclude it cleanly via config instead of renaming the folder to templates/.

Changes

  • packages/cli/src/lib/config.tsSynapseConfig.validate?.ignore, exported DEFAULT_VALIDATE_IGNORE, and getValidateIgnore().
  • packages/cli/src/commands/validate.ts — use getValidateIgnore() at both glob() call sites.
  • packages/cli/test/lib/config.spec.ts — unit tests for getValidateIgnore() (defaults, absent/empty config, merge, de-dup).
  • packages/cli/test/commands/validate.spec.ts — end-to-end tests proving an ignored path is skipped while non-ignored paths still validate.
  • README.md — documents the new config field.

There is no JSON schema file for synapse.config.json in the repo (the config is typed solely by the SynapseConfig TypeScript interface), so the type update is the schema update.

Verification

  • npm test — 502 passed (24 suites); coverage 88.71% statements / 80.4% branch, above the 80% threshold. config.ts at 97.95% / 100% lines.
  • npm run build and npm run check:types — clean.

🤖 Generated with Claude Code

…tion

The `synapse validate` command discovered files with a hard-coded
fast-glob ignore list (node_modules, .git, templates, index.md), giving
forks no way to opt a path out of strict body-grammar validation short
of renaming a folder to `templates/`.

Add an optional `validate.ignore` field to `SynapseConfig`. The new
`getValidateIgnore()` helper merges these patterns with the built-in
defaults (de-duplicated) and is used at both `glob()` call sites in the
validate command.

Motivating use case: a downstream fork with a free-form documentation
subsection (e.g. `content/210_QA-Memory/`) can now exclude it from
validation without folder-renaming hacks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant