Skip to content

chore: add commit guard for brownfield-navigation#380

Merged
hurali97 merged 2 commits into
mainfrom
chore/commit-guard-for-navigation
Jun 17, 2026
Merged

chore: add commit guard for brownfield-navigation#380
hurali97 merged 2 commits into
mainfrom
chore/commit-guard-for-navigation

Conversation

@hurali97

Copy link
Copy Markdown
Member

Summary

Each time we run brownfield:package:* we see diff in the git tree for brownfield-navigation. While this is the desired behavior for the end user as these files will be inside node_modules, for us maintainers is a bit different as the brownfield-navigation is 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 unstaged
Navigation files are staged - Error staged
Navigation files are staged with bypass - Success staged-bypass

@artus9033 artus9033 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great DX enhancement, thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-navigation files are staged (with an env-var bypass).
  • Hooks the guard into lefthook’s pre-commit pipeline.
  • Documents the guard and bypass mechanism in CONTRIBUTING.md (plus includes an iOS Podfile.lock update).

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.

Comment thread scripts/check-brownfield-navigation-drift.ts
Comment thread CONTRIBUTING.md Outdated
@hurali97
hurali97 merged commit e8ab481 into main Jun 17, 2026
14 checks passed
@hurali97
hurali97 deleted the chore/commit-guard-for-navigation branch June 17, 2026 09:46
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.

3 participants