Skip to content

fix(gitignore): refresh managed block on upgrade#2

Merged
ReidenXerx merged 1 commit into
mainfrom
fix/gitignore-refresh-on-upgrade
Jul 8, 2026
Merged

fix(gitignore): refresh managed block on upgrade#2
ReidenXerx merged 1 commit into
mainfrom
fix/gitignore-refresh-on-upgrade

Conversation

@ReidenXerx

Copy link
Copy Markdown
Owner

Problem

appendGitignore returned early when the .gitignore marker already existed:

if (existing.includes(GITIGNORE_MARKER)) return [];

So a repo installed with an older kit version kept its stale managed block on upgrade. Ignore rules added later — .gitnexus/ (graph index), .agents/skills/, and the "distribute skills via git" scheme — were never applied to existing installs. The .gnkit/skills store distribution feature silently failed for anyone who installed before it landed.

Found while auditing whether main lost any fixes from a discarded parallel branch — this one it did.

Fix

Strip and rewrite the managed block from the current snippet on every install/update, so both additions and removals propagate. Preserves surrounding user content, stays idempotent, and removeGitignoreSnippet now shares the same block-strip helper.

Verified

  • New unit test: upgrading a stale block adds .gitnexus/ + .agents/skills/ + .claude/skills/, keeps user lines, no duplicate marker. 54/54 tests pass.
  • Real-world: updated enter-control (a v1.1.0 install) — block refreshed so the index + all IDE symlink dirs are ignored while .gnkit/skills stays trackable; the previous ?? .agents/skills/* untracked noise is gone.

🤖 Generated with Claude Code

appendGitignore returned early when the marker already existed, so an
existing install upgraded to a newer kit kept its stale managed block —
ignore rules added later (`.gitnexus/`, `.agents/skills/`, the tracked
`.gnkit/skills` store scheme) were never applied. Old installs silently
missed the "distribute skills via git" gitignore changes.

Now the managed block is stripped and rewritten from the current snippet on
every install/update (additions and removals both propagate), preserving
surrounding user content and staying idempotent. Refactor removeGitignoreSnippet
to share the same block-strip helper.

Verified on a real v1.1.0 install (enter-control): block refreshed to ignore
the index + all IDE skill symlink dirs while the .gnkit/skills store stays
trackable. Ports a fix from the discarded main-based branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ReidenXerx
ReidenXerx merged commit be4beda into main Jul 8, 2026
1 check passed
ReidenXerx added a commit that referenced this pull request Jul 16, 2026
…tion

Task-core compaction migration (intel routine #2)
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