From 6cea3d725244766ca7501cc240bc1c27d3e8dc8d Mon Sep 17 00:00:00 2001 From: Alex Bullitt Date: Sat, 5 Dec 2026 18:00:25 +0000 Subject: [PATCH] chore: Mark woven docs linguist-generated docs/*.md and README.md are woven from docs/src/*.src.md and README.src.md by scripts/weave.swift, which CI verifies with --check. Marking them linguist-generated in .gitattributes lets GitHub collapse the generated output in PR diffs and exclude it from language statistics so reviewers focus on the sources. Conformance baselines, interop/RESULTS.md, and Tests/MCPTests/Generated stay unmarked: the baselines and interop results are what reviews check, and no CI job reruns the fixture generators in Tests/MCPTests/Generated. CLAUDE.md documents the rule and exclusions for future generators. Co-authored-by: Jean-Matthieu Schaffhauser Assisted-by: Claude Assisted-by: Gemini --- .gitattributes | 12 ++++++++++++ CLAUDE.md | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..5050267c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +# GitHub collapses linguist-generated files in pull request diffs and leaves them out of the +# language statistics. Mark only output that CI proves matches its source; generated files +# whose changes are the point of a review (conformance baselines, interop/RESULTS.md) stay +# visible. + +# Woven by scripts/weave.swift from docs/src/*.src.md and README.src.md (`--check` in CI). +/docs/*.md linguist-generated=true +/README.md linguist-generated=true + +# Tests/MCPTests/Generated stays visible: no CI job reruns its generators +# (scripts/frontmatter-corpus.mjs, scripts/server-card-examples.mjs), and it holds the +# expected results the tests compare against. diff --git a/CLAUDE.md b/CLAUDE.md index 85075399..8ddf1643 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -99,7 +99,10 @@ that implement the "everything" reference client/server used by the **`Examples/`** — `HelloServer`, `HelloClient`, `HTTPServerExample` and the doc snippet targets (`*Snippets`, tests in `SnippetTests`). `docs/*.md` and `README.md` are generated from `docs/src/*.src.md` and `README.src.md` by `swift scripts/weave.swift` (`--check` in CI); -never edit the generated files. +never edit the generated files. `.gitattributes` marks them `linguist-generated` (collapsed in +PR diffs); a new generator adds its output there only when CI proves it matches its source, +while output reviewers need to see (conformance baselines, `interop/RESULTS.md`, and +`Tests/MCPTests/Generated/`) stays unmarked. **`Tests/MCPTests/`** — one test file per source area; most transport/client/server tests run against `InMemoryTransport` or `Helpers/MockTransport.swift` rather than real sockets/processes.