From 1226741a148f9482c3e8d8ddac6ff84bc81a4fd6 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Aug 2026 05:28:56 +0000 Subject: [PATCH] Keep a root node_modules out of the vault `.gitignore` ignores `**/node_modules/**`, then re-includes markdown at any depth with `!*.md` -- a pattern with no slash, so it matches everywhere. Git takes the last matching rule, so the re-include wins and every README.md inside node_modules is stageable. That is CORRECT for THE-GEMSTONE/node_modules, which is vendored content this vault tracks on purpose: 49 .md files, preserved deliberately in #939. It is wrong for a root node_modules, which npm regenerates from package-lock.json and which nobody should commit. Measured with `git add --dry-run node_modules/`: 2 files leak with main's dependencies today (prettier only) 466 files leak with the eight devDependencies #950 adds Both are vendored README files. One `git add -A` after an `npm install` puts them in the repo. The new rule is last in the file and must stay last -- it only beats the markdown re-include by coming after it. The leading slash anchors it to the repo root. Verified, all four cases: root node_modules markdown -> now ignored (was: !*.md at line 159) `git add --dry-run node_modules/` -> 0 files (was: 2 here, 466 with #950) THE-GEMSTONE/.../lib.md -> still tracked, unchanged CONSTITUTION.md -> unaffected tracked file count -> 38,424, unchanged This is a shared surface, so it is a proposal rather than something folded into another PR: it stands alone and changes nothing until merged. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01EBV6TkrwsZhcwkh1b6NUHs --- .gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index 56c8688948..1f7477290e 100644 --- a/.gitignore +++ b/.gitignore @@ -159,3 +159,19 @@ desktop.ini !*.md # ESTO PERPETUA! + +# === ROOT node_modules IS A BUILD ARTIFACT ================================= +# Last rule in the file, and it must stay last: git takes the LAST matching +# pattern, so this has to come after the markdown re-include above to beat it. +# +# The markdown rule is right for THE-GEMSTONE/node_modules, which is vendored +# CONTENT this vault tracks on purpose (49 .md files). It is wrong for a root +# node_modules, which npm regenerates from package-lock.json and which nobody +# should ever commit. +# +# Measured with `git add --dry-run node_modules/`: 2 files leak with main's +# dependencies today (prettier only), 466 with the eight devDependencies #950 +# adds. Both are vendored README files nobody wants in the vault. +# +# Leading slash = root only. THE-GEMSTONE/node_modules is untouched. +/node_modules/**