chore: add commit guard for brownfield-navigation#380
Merged
Conversation
artus9033
approved these changes
Jun 17, 2026
artus9033
left a comment
Collaborator
There was a problem hiding this comment.
That's a great DX enhancement, thanks!
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a local pre-commit safeguard intended to prevent accidental commits of auto-generated @callstack/brownfield-navigation artifacts in this monorepo setup (where the package is symlinked during development).
Changes:
- Introduces a new TypeScript script that blocks commits when specific generated
brownfield-navigationfiles are staged (with an env-var bypass). - Hooks the guard into
lefthook’spre-commitpipeline. - Documents the guard and bypass mechanism in
CONTRIBUTING.md(plus includes an iOSPodfile.lockupdate).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/check-brownfield-navigation-drift.ts | New commit guard script that inspects staged files and blocks commits for protected generated artifacts. |
| lefthook.yml | Wires the new guard into the pre-commit hook. |
| CONTRIBUTING.md | Documents the guard and how to bypass it intentionally. |
| apps/RNApp/ios/Podfile.lock | Updates CocoaPods lockfile entries (BrownfieldNavigation/Brownie/ReactBrownfield versions + checksums). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each time we run
brownfield:package:*we see diff in the git tree forbrownfield-navigation. While this is the desired behavior for the end user as these files will be insidenode_modules, for us maintainers is a bit different as thebrownfield-navigationis sym-linked and we see the diff.We raised a PR to add output directory and use it only for maintainers as part of #362 - However we hit a roadblock as we can define a generated folder and correctly link the native files but the JS files for react codegen can not be safely linked.
Hence, this PR is raised to add a local guard to catch accidental commit of these files. If we strictly need to commit some changes from these files, due to bug fixes or others, we can use
SKIP_BROWNFIELD_NAVIGATION_CHECK=1 git commit -m "...."Test plan
Navigation files are not staged - Success
Navigation files are staged - Error
Navigation files are staged with bypass - Success