Skip to content

feat(MSDK-3095): Added cursor AI rules#187

Open
uc-christiansousa wants to merge 1 commit intomasterfrom
feat/MSDK-3095/create-cursor-ai-rules
Open

feat(MSDK-3095): Added cursor AI rules#187
uc-christiansousa wants to merge 1 commit intomasterfrom
feat/MSDK-3095/create-cursor-ai-rules

Conversation

@uc-christiansousa
Copy link

@uc-christiansousa uc-christiansousa commented Mar 2, 2026

User description

Created multiple cursor rules for them to be used as a first basis


CodeAnt-AI Description

Add repository conventions, CI guidance, and editor indexing ignores for contributors

What Changed

  • Added a set of contributor-facing convention files describing project structure, TypeScript/react-native patterns, native iOS/Android module expectations, testing, CI workflows, and security guidance so contributors see required practices in one place
  • Added .cursorignore and .cursorindexingignore to prevent IDE/automation from indexing build artifacts, lockfiles, generated native code, and secrets (reduces noisy results and accidental commits)
  • Added sample/.ruby-version to pin the Ruby version used for CocoaPods in CI and local macOS development

Impact

✅ Clearer native contribution guidelines
✅ Fewer CI surprises from mismatched local setups
✅ Fewer accidental commits of build artifacts and secrets

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive development guidelines and configuration files covering project standards, native module conventions, React Native integration, TypeScript practices, testing strategies, and CI/CD workflows.

@codeant-ai
Copy link

codeant-ai bot commented Mar 2, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review
Copy link

Review Summary by Qodo

Add Cursor AI rules and configuration for project guidance

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Added comprehensive Cursor AI rules for project guidance
• Created platform-specific rules for Android, iOS, and React Native
• Established CI/CD, testing, and security best practices documentation
• Added Cursor ignore configuration files for optimal indexing
Diagram
flowchart LR
  A["Cursor Rules"] --> B["Project Overview"]
  A --> C["Platform Rules"]
  C --> D["Android Native"]
  C --> E["iOS Native"]
  C --> F["React Native"]
  A --> G["Development Guides"]
  G --> H["TypeScript Conventions"]
  G --> I["Testing"]
  G --> J["CI/CD & Security"]
  A --> K["Cursor Config"]
  K --> L[".cursorignore"]
  K --> M[".cursorindexingignore"]
Loading

Grey Divider

File Changes

1. .cursor/rules/project-overview.mdc 📝 Documentation +31/-0

Project architecture and key conventions overview

.cursor/rules/project-overview.mdc


2. .cursor/rules/android-native.mdc 📝 Documentation +27/-0

Android native module structure and build conventions

.cursor/rules/android-native.mdc


3. .cursor/rules/ios-native.mdc 📝 Documentation +28/-0

iOS native module structure and build conventions

.cursor/rules/ios-native.mdc


View more (8)
4. .cursor/rules/react-native.mdc 📝 Documentation +30/-0

React Native SDK and sample app patterns

.cursor/rules/react-native.mdc


5. .cursor/rules/typescript-conventions.mdc 📝 Documentation +36/-0

TypeScript style and export requirements

.cursor/rules/typescript-conventions.mdc


6. .cursor/rules/testing.mdc 📝 Documentation +33/-0

Testing conventions across JavaScript, iOS, Android

.cursor/rules/testing.mdc


7. .cursor/rules/ci-github-actions.mdc 📝 Documentation +34/-0

GitHub Actions CI/CD workflow and job specifications

.cursor/rules/ci-github-actions.mdc


8. .cursor/rules/security-snyk.mdc 📝 Documentation +57/-0

Security best practices and Snyk compliance rules

.cursor/rules/security-snyk.mdc


9. .cursorignore ⚙️ Configuration changes +113/-0

Cursor ignore patterns for dependencies and artifacts

.cursorignore


10. .cursorindexingignore ⚙️ Configuration changes +48/-0

Cursor indexing ignore patterns for large files

.cursorindexingignore


11. sample/.ruby-version ⚙️ Configuration changes +1/-0

Ruby version specification for sample app

sample/.ruby-version


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 2, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Android minSdk wrong 🐞 Bug ✓ Correctness
Description
The new Android Cursor rule claims Min SDK 26, but the actual Android library module is configured
with minSdk 24 (and legacy gradle uses 21). This mismatch can mislead contributors/AI into using
APIs unavailable on supported devices or proposing unnecessary minSdk bumps.
Code

.cursor/rules/android-native.mdc[24]

+- Min SDK: 26 (Android 8.0).
Evidence
The Cursor rule states Min SDK 26, while the Android module’s build config sets minSdk to 24 (and
legacy config to 21), so the rule is factually incorrect relative to the repo configuration.

.cursor/rules/android-native.mdc[22-27]
android/build.gradle.kts[21-29]
android/build-legacy.gradle[42-46]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Cursor rule `.cursor/rules/android-native.mdc` documents an Android Min SDK of 26, but the repository’s Android library module currently uses `minSdk = 24`. This mismatch can cause AI-assisted changes (or contributors following the rule) to use APIs not available on supported devices or propose unnecessary breaking minSdk increases.

## Issue Context
Source of truth is the Gradle configuration in `android/build.gradle.kts`.

## Fix Focus Areas
- .cursor/rules/android-native.mdc[22-27]
- android/build.gradle.kts[21-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. iOS target wrong 🐞 Bug ✓ Correctness
Description
The new iOS Cursor rule claims a minimum iOS deployment target of 16.0, but the podspec and Xcode
project are configured for iOS 11.0. This can lead to AI/contributor changes using iOS APIs
unavailable on supported OS versions.
Code

.cursor/rules/ios-native.mdc[26]

+- Minimum iOS deployment target: 16.0.
Evidence
The Cursor rule’s stated minimum iOS version (16.0) contradicts the podspec and the native Xcode
project deployment target (11.0), making the rule incorrect for this repo.

.cursor/rules/ios-native.mdc[24-28]
react-native-usercentrics.podspec[11-14]
ios/RNUsercentricsModule.xcodeproj/project.pbxproj[275-286]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Cursor rule `.cursor/rules/ios-native.mdc` states the minimum iOS deployment target is 16.0, but the repo’s podspec and Xcode project are configured for iOS 11.0. This mismatch can mislead AI-assisted edits to use APIs unavailable on supported targets.

## Issue Context
Source of truth is `react-native-usercentrics.podspec` (`s.platform = :ios, "11.0"`).

## Fix Focus Areas
- .cursor/rules/ios-native.mdc[24-28]
- react-native-usercentrics.podspec[11-14]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Gradle files not indexed 🐞 Bug ⛯ Reliability
Description
.cursorindexingignore excludes android/build.gradle.kts, android/settings.gradle.kts, and
android/gradle.properties as “Android generated”, but these are hand-maintained build
configuration. Excluding them reduces Cursor’s context for correct Android build/dependency/minSdk
changes and can reinforce wrong assumptions.
Code

.cursorindexingignore[R46-48]

+android/build.gradle.kts
+android/settings.gradle.kts
+android/gradle.properties
Evidence
The ignore list explicitly excludes core Android Gradle configuration files, and those files contain
real (non-generated) settings like Kotlin plugin version, repositories, and AndroidX
flags—indicating they should likely remain indexable for accurate assistance.

.cursorindexingignore[45-48]
android/settings.gradle.kts[1-10]
android/gradle.properties[1-5]
android/build.gradle.kts[21-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.cursorindexingignore` excludes core Android Gradle config files (`android/build.gradle.kts`, `android/settings.gradle.kts`, `android/gradle.properties`) under the label “Android generated”, but they contain hand-maintained configuration. Excluding them reduces Cursor’s ability to understand the Android build setup (minSdk, Kotlin plugin, repositories, AndroidX flags), increasing the likelihood of incorrect suggestions/edits.

## Issue Context
These files are part of the source-of-truth build configuration and are referenced when changing Android dependencies, minSdk/targetSdk, Kotlin plugin versions, and build behavior.

## Fix Focus Areas
- .cursorindexingignore[45-48]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

📝 Walkthrough

Walkthrough

This pull request introduces comprehensive Cursor AI rule documentation and configuration files for the @usercentrics/react-native-sdk project. It adds conventions for native modules (Android/iOS), TypeScript, testing, security/Snyk compliance, CI/CD workflows, and project structure, along with indexing and ignore pattern configurations. A Ruby version pin is also specified for the sample app.

Changes

Cohort / File(s) Summary
Cursor Rules Documentation
.cursor/rules/android-native.mdc, .cursor/rules/ios-native.mdc, .cursor/rules/react-native.mdc, .cursor/rules/typescript-conventions.mdc
Defines platform and language-specific conventions: Android native Kotlin modules with JNI bindings (auto-generated), iOS native Swift/ObjC++ modules with bridging headers, React Native SDK bridge layer with native communication patterns, and TypeScript strict mode with strict exports enforcement via scripts.
Cursor Rules: Cross-Platform Guidance
.cursor/rules/project-overview.mdc, .cursor/rules/testing.mdc, .cursor/rules/security-snyk.mdc, .cursor/rules/ci-github-actions.mdc
Outlines project structure (src/, android/, ios/, sample/), testing strategies (Jest, XCTest, JUnit) with test locations and commands, security/Snyk compliance policies (dependency versioning, secret handling, license compliance), and CI/CD workflows (test-rn, test-ios, test-android jobs with environment pinning).
Cursor Configuration
.cursorignore, .cursorindexingignore
Defines patterns to exclude from Cursor indexing and discovery: dependencies, build outputs, IDE artifacts, generated files (codegen/JNI), lock files, legacy samples, and OS/environment files.
Sample Configuration
sample/.ruby-version
Pins Ruby version to 3.2.0 for the sample app.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Whiskers twitching with delight,
Rules and docs now shining bright,
Cursor knows where code should play—
Native paths and TypeScript's way,
Testing strategies set right,
This SDK hops to new height! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding cursor AI rules as documentation/configuration files for the project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/MSDK-3095/create-cursor-ai-rules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pantoaibot
Copy link

pantoaibot bot commented Mar 2, 2026

PR Summary:

Adds sample/.ruby-version specifying Ruby 3.2.0; no cursor AI rules or other code changes included.

  • Added file: sample/.ruby-version with content "3.2.0"
  • No structural, functional, logic, dependency, or performance changes in the diff
  • No breaking changes
  • Note: PR title mentions "cursor AI rules" but those changes are not present in this diff.

Reviewed by Panto AI

@codeant-ai codeant-ai bot added the size:L This PR changes 100-499 lines, ignoring generated files label Mar 2, 2026
@@ -0,0 +1 @@
3.2.0
Copy link

Choose a reason for hiding this comment

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

[NITPICK] Remove the leading whitespace so the file contains the Ruby version token exactly (e.g. "3.2.0"). Many Ruby version managers (rbenv, chruby, asdf) expect the file to contain the version string without surrounding spaces.

3.2.0

@pantoaibot
Copy link

pantoaibot bot commented Mar 2, 2026

Reviewed up to commit:01567a06cef9181c86bc191a938b7190794992f7

Additional Suggestion
Others - Confirm this Ruby version is compatible with the sample project's native tooling (CocoaPods, fastlane, bundler) and with CI images. If you rely on a Gemfile/Gemfile.lock, ensure the Ruby version here matches any Ruby version specified there or document how contributors should select the Ruby version (rbenv/chruby/asdf). Consider adding the same .ruby-version at the repository root if CI and other parts of the repo need the same Ruby runtime.

Reviewed by Panto AI


## Build

- Minimum iOS deployment target: 16.0.
Copy link

Choose a reason for hiding this comment

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

Suggestion: The documented minimum iOS deployment target (16.0) conflicts with the actual podspec configuration, which declares iOS 11.0; this mismatch can mislead tools and developers (including Cursor itself) into using APIs that only exist on iOS 16+, causing runtime crashes or build failures for consumers targeting iOS 11–15. [logic error]

Severity Level: Major ⚠️
- ⚠️ Cursor rules misstate supported iOS version for native modules.
- ⚠️ Developers may introduce iOS16-only APIs into iOS11 projects.
Suggested change
- Minimum iOS deployment target: 16.0.
- Minimum iOS deployment target: 11.0.
Steps of Reproduction ✅
1. Open the podspec at `react-native-usercentrics.podspec:13` (in
`/workspace/react-native-sdk/react-native-usercentrics.podspec`) and observe `s.platform =
:ios, "11.0"`, which declares the library's minimum iOS version as 11.0.

2. Open the Cursor rules file at `.cursor/rules/ios-native.mdc:26` and observe the
documentation line `- Minimum iOS deployment target: 16.0.` indicating a minimum iOS
version of 16.0 for the same native module.

3. Compare these two configuration sources and note the direct contradiction: tooling and
developers reading `.cursor/rules/ios-native.mdc` will believe the minimum supported iOS
version is 16.0, while the actual build configuration via CocoaPods allows iOS 11.0.

4. In a real development workflow, a developer or AI assistant (Cursor) relying on
`.cursor/rules/ios-native.mdc` to guide native code changes for `ios/**/*.swift` and
`ios/**/*.mm` files can reasonably assume iOS 16.0 APIs are safe to use, even though
consumers building against the podspec's iOS 11.0 target would encounter compile-time or
runtime issues when those newer APIs are used on older devices.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .cursor/rules/ios-native.mdc
**Line:** 26:26
**Comment:**
	*Logic Error: The documented minimum iOS deployment target (16.0) conflicts with the actual podspec configuration, which declares iOS 11.0; this mismatch can mislead tools and developers (including Cursor itself) into using APIs that only exist on iOS 16+, causing runtime crashes or build failures for consumers targeting iOS 11–15.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

@codeant-ai
Copy link

codeant-ai bot commented Mar 2, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Allowed keystore
    The rule explicitly allows debug.keystore (!debug.keystore). Verify that allowing this file in indexing is intended, since keystore files can contain sensitive keys.

  • Sensitive files
    This ignore list includes environment and credential patterns (.env, google-services.json, *.jks, *.keystore) — confirm these are intentionally excluded from the cursor index and that no alternate filenames (e.g., google-services-.json) will be missed or accidentally indexed.

  • Codegen script path
    The rule states JNI/C++ files are generated by scripts/generate-codegen-jni.js. Ensure the script path and name are correct and available in the repository (or clarify the location) so contributors don't look in the wrong place.

  • Default Branch
    The workflow description explicitly references master as the branch for PRs. Many repositories use main (or another branch). Confirm the repository's default branch and align documentation and workflow triggers to avoid confusion and incorrect CI triggers.

  • Platform Mismatch
    The "test-android" job is documented as running on macOS 14. Android native tests typically run on Linux runners (Ubuntu). Verify the actual runner used in workflows and ensure documentation correctly reflects the OS and any hardware/emulator constraints.

@codeant-ai
Copy link

codeant-ai bot commented Mar 2, 2026

CodeAnt AI finished reviewing your PR.


## Build

- Min SDK: 26 (Android 8.0).

Choose a reason for hiding this comment

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

Action required

1. Android minsdk wrong 🐞 Bug ✓ Correctness

The new Android Cursor rule claims Min SDK 26, but the actual Android library module is configured
with minSdk 24 (and legacy gradle uses 21). This mismatch can mislead contributors/AI into using
APIs unavailable on supported devices or proposing unnecessary minSdk bumps.
Agent Prompt
## Issue description
The Cursor rule `.cursor/rules/android-native.mdc` documents an Android Min SDK of 26, but the repository’s Android library module currently uses `minSdk = 24`. This mismatch can cause AI-assisted changes (or contributors following the rule) to use APIs not available on supported devices or propose unnecessary breaking minSdk increases.

## Issue Context
Source of truth is the Gradle configuration in `android/build.gradle.kts`.

## Fix Focus Areas
- .cursor/rules/android-native.mdc[22-27]
- android/build.gradle.kts[21-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


## Build

- Minimum iOS deployment target: 16.0.

Choose a reason for hiding this comment

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

Action required

2. Ios target wrong 🐞 Bug ✓ Correctness

The new iOS Cursor rule claims a minimum iOS deployment target of 16.0, but the podspec and Xcode
project are configured for iOS 11.0. This can lead to AI/contributor changes using iOS APIs
unavailable on supported OS versions.
Agent Prompt
## Issue description
The Cursor rule `.cursor/rules/ios-native.mdc` states the minimum iOS deployment target is 16.0, but the repo’s podspec and Xcode project are configured for iOS 11.0. This mismatch can mislead AI-assisted edits to use APIs unavailable on supported targets.

## Issue Context
Source of truth is `react-native-usercentrics.podspec` (`s.platform = :ios, "11.0"`).

## Fix Focus Areas
- .cursor/rules/ios-native.mdc[24-28]
- react-native-usercentrics.podspec[11-14]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
.cursorindexingignore (1)

35-37: Narrow indexing exclusions for core build/tooling files.

scripts/ and Android Gradle config files are core project inputs, not generated artifacts. Ignoring them can reduce rule quality and produce weaker AI suggestions around build/test workflows.

Suggested diff
 # === Script files (utility, not core logic) ===
-scripts/
-sample/scripts/
+# Keep scripts indexable (used by CI/conventions)
+# scripts/
+# sample/scripts/

 # === Android generated ===
-android/build.gradle.kts
-android/settings.gradle.kts
-android/gradle.properties
+# Keep root Android Gradle config indexable
+# android/build.gradle.kts
+# android/settings.gradle.kts
+# android/gradle.properties

Also applies to: 46-48

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.cursorindexingignore around lines 35 - 37, The .cursorindexingignore
currently excludes broad directories "scripts/" and "sample/scripts/" which
hides core build/tooling files; update the ignore rules to narrow the scope (for
example replace "scripts/" and "sample/scripts/" with more specific
generated-artifact patterns such as "scripts/generated/" or
"sample/scripts/generated/" or explicit filenames that are truly generated) or
remove those lines entirely so Android Gradle config and other build scripts
remain indexed; search for the exact strings "scripts/" and "sample/scripts/" in
the .cursorindexingignore and apply the narrower patterns or deletion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.cursor/rules/ci-github-actions.mdc:
- Line 31: The guidance text currently conflates major-version tags with
immutable pins; update the wording around the `@v1`, `@v2`, `@v4` examples to
state that these are mutable tags (they can be moved by maintainers) and
therefore are not equivalent to commit SHA pins, and explicitly recommend using
full commit SHAs for security-critical actions while noting that major-version
tags are acceptable for convenience/non-critical uses; reference the
`@v1/@v2/@v4` tokens and recommend “use full commit SHA (immutable) for
security-sensitive actions” as the replacement phrasing.

In @.cursor/rules/security-snyk.mdc:
- Line 13: Update the guidance text that currently states "Prefer `^` ranges in
`package.json` to allow patch updates" to correctly describe semver: explain
that `^` allows minor and patch updates within the same major version (e.g.,
`^1.2.3` => >=1.2.3 <2.0.0) and that `~` allows patch-only updates within the
same minor version (e.g., `~1.2.3` => >=1.2.3 <1.3.0`), replacing the incorrect
sentence referencing the `^` operator; ensure the revised line mentions both `^`
and `~` operators and their respective update scopes.

In @.cursor/rules/testing.mdc:
- Around line 24-27: The documentation lists unit and instrumented tests but
only provides the unit test command; add an explicit instrumented-test command
for clarity by appending the connected Android instrumentation command (e.g.,
./gradlew :react-native-usercentrics:connectedAndroidTest) alongside the
existing unit test command (./gradlew :react-native-usercentrics:test), and
optionally mention assembleAndroidTest or installDebug and connectedAndroidTest
for CI/use cases so readers can run instrumented tests reliably.

In @.cursor/rules/typescript-conventions.mdc:
- Around line 28-30: The documentation incorrectly states that the TurboModule
spec uses codegenNativeComponent; update the sentence that currently lists both
TurboModuleRegistry and codegenNativeComponent to remove codegenNativeComponent
so it only references TurboModuleRegistry (keep reference to the TurboModule
spec file NativeUsercentricsModule.ts for context).

---

Nitpick comments:
In @.cursorindexingignore:
- Around line 35-37: The .cursorindexingignore currently excludes broad
directories "scripts/" and "sample/scripts/" which hides core build/tooling
files; update the ignore rules to narrow the scope (for example replace
"scripts/" and "sample/scripts/" with more specific generated-artifact patterns
such as "scripts/generated/" or "sample/scripts/generated/" or explicit
filenames that are truly generated) or remove those lines entirely so Android
Gradle config and other build scripts remain indexed; search for the exact
strings "scripts/" and "sample/scripts/" in the .cursorindexingignore and apply
the narrower patterns or deletion.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe03af4 and 01567a0.

⛔ Files ignored due to path filters (1)
  • sample/Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .cursor/rules/android-native.mdc
  • .cursor/rules/ci-github-actions.mdc
  • .cursor/rules/ios-native.mdc
  • .cursor/rules/project-overview.mdc
  • .cursor/rules/react-native.mdc
  • .cursor/rules/security-snyk.mdc
  • .cursor/rules/testing.mdc
  • .cursor/rules/typescript-conventions.mdc
  • .cursorignore
  • .cursorindexingignore
  • sample/.ruby-version

## Conventions

- Always use `--frozen-lockfile` (yarn) or `npm ci` (npm) for deterministic installs.
- Use pinned action versions (`@v1`, `@v2`, `@v4`) — prefer SHA pinning for security-critical actions.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

GitHub Actions @v1 @v2 major version tags mutable pinning security

💡 Result:

uses: owner/action@v1 / @v2 are Git tags (major-version “floating” tags). Tags are mutable in Git: the action maintainer (or an attacker who compromises the repo) can move v1 to a different commit (e.g., via force-updating the tag), so your workflow may run different code later without any change in your repo—a supply-chain risk. [1], [2]

Safer pinning options (recommended order):

  1. Pin to a full commit SHA (immutable): uses: actions/checkout@<40-char-sha> # vX.Y.Z—this ensures you always run exactly the reviewed code. GitHub’s guidance explicitly recommends SHA pinning to reduce the impact of compromised tags/branches. [3]
  2. Use an “immutable release/tag” only if the publisher has enabled immutable releases: GitHub supports making releases immutable (so the release’s Git tag/assets can’t be changed), but this depends on the action repository’s configuration. [1], [4]

Org/enterprise enforcement: GitHub Actions policies can enforce SHA pinning (workflows fail if an action isn’t pinned to a full SHA) and can also block specific actions/versions. [5]

Why major tags are popular anyway: @v1/@v2 are convenient for automatically receiving compatible updates, but that convenience is exactly what makes them risky if the tag is ever retargeted maliciously. [2], [3]

Sources

  1. GitHub Docs – “Using immutable releases and tags…” (explains major tags like v1 and how tags can be force-moved) [1]
  2. Mozilla GitHub workflow security guidance (recommends avoiding mutable tags like @v1) [2]
  3. GitHub Well-Architected – Actions security: pin to immutable refs (commit SHA recommended; “immutable tags” may be optional/disable-able) [3]
  4. GitHub Docs – immutable releases concept for unchangeable versions [1]
  5. GitHub Changelog (Aug 15, 2025) – policy supports blocking and enforcing SHA pinning [5]

🌐 Web query:

GitHub Actions official recommendation secure pinning third-party actions commit SHA

💡 Result:

GitHub’s official guidance for securing third-party GitHub Actions is to pin actions to a full-length commit SHA (instead of a moving tag like @v1/@v4). GitHub notes this is currently the only way to use an action as an immutable release, and recommends verifying the SHA comes from the action’s official repository (not a fork). [1]

GitHub has also reiterated this recommendation in policy/governance updates: GitHub recommends SHA pinning to reduce supply-chain risk, and admins can enforce “full commit SHA” pinning so workflows fail if an action isn’t pinned. [2]

Example:

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

[1]

Sources:
[1] GitHub Docs (Actions security guide: “Using third-party actions”)
[2] GitHub Changelog (Allowed actions policy: “Enforce SHA pinning”, Aug 15, 2025)


@vX tags are mutable, not immutable pins.

Line 31 conflates two distinct concepts: major version tags like @v4 are mutable Git references that can be force-updated by maintainers or attackers. Only commit SHAs provide immutability. Clarify the guidance to distinguish them.

Proposed wording
- Use pinned action versions (`@v1`, `@v2`, `@v4`) — prefer SHA pinning for security-critical actions.
+ Use major version tags (`@v1`, `@v2`, `@v4`) for readability, but pin to full commit SHAs for security-critical actions (or all actions when possible).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Use pinned action versions (`@v1`, `@v2`, `@v4`) — prefer SHA pinning for security-critical actions.
- Use major version tags (`@v1`, `@v2`, `@v4`) for readability, but pin to full commit SHAs for security-critical actions (or all actions when possible).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.cursor/rules/ci-github-actions.mdc at line 31, The guidance text currently
conflates major-version tags with immutable pins; update the wording around the
`@v1`, `@v2`, `@v4` examples to state that these are mutable tags (they can be
moved by maintainers) and therefore are not equivalent to commit SHA pins, and
explicitly recommend using full commit SHAs for security-critical actions while
noting that major-version tags are acceptable for convenience/non-critical uses;
reference the `@v1/@v2/@v4` tokens and recommend “use full commit SHA
(immutable) for security-sensitive actions” as the replacement phrasing.

## Dependency Security

- **Never** pin exact versions of transitive dependencies to work around vulnerabilities — fix at the source.
- Keep dependencies up to date. Prefer `^` ranges in `package.json` to allow patch updates.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

npm semver caret ^ tilde ~ version ranges documentation what updates allowed

💡 Result:

Tilde ~ ranges (npm)

~ lets npm install newer patch versions within the same minor (if a minor is specified). Examples:

  • ~1.2.3>=1.2.3 <1.3.0 (patch updates only within 1.2.x) [1]
  • ~1.2>=1.2.0 <1.3.0 (same as 1.2.x) [1]
  • ~1>=1.0.0 <2.0.0 (same as 1.x) [1]

Caret ^ ranges (npm)

^ lets npm install changes that don’t modify the left-most non-zero digit. Examples:

  • ^1.2.3>=1.2.3 <2.0.0 (minor + patch updates within major 1) [1]
  • ^0.2.3>=0.2.3 <0.3.0 (only patch updates within minor 0.2) [1]
  • ^0.0.3>=0.0.3 <0.0.4 (effectively pinned to that patch line) [1]

Rule of thumb

  • Use ~ when you want patch-only updates (stay on the same x.y.*). [1]
  • Use ^ when you want minor+patch updates for 1.0.0+, but more restrictive behavior in 0.x (since 0 is treated specially). [1]

Sources: npm semver range docs [1].


Correct semver guidance: ^ allows minor and patch updates, not patch-only.

Line 13 is misleading. In npm semver, ^ allows minor and patch updates within the same major version (e.g., ^1.2.3>=1.2.3 <2.0.0), not only patch updates. For patch-only updates, use ~ (e.g., ~1.2.3>=1.2.3 <1.3.0).

Update the text to clarify which operator allows which update types.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.cursor/rules/security-snyk.mdc at line 13, Update the guidance text that
currently states "Prefer `^` ranges in `package.json` to allow patch updates" to
correctly describe semver: explain that `^` allows minor and patch updates
within the same major version (e.g., `^1.2.3` => >=1.2.3 <2.0.0) and that `~`
allows patch-only updates within the same minor version (e.g., `~1.2.3` =>
>=1.2.3 <1.3.0`), replacing the incorrect sentence referencing the `^` operator;
ensure the revised line mentions both `^` and `~` operators and their respective
update scopes.

Comment on lines +24 to +27
- Unit tests: `android/src/test/`.
- Instrumented tests: `android/src/androidTest/`.
- Run via `./gradlew :react-native-usercentrics:test` from `sample/android/`.

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Android test commands are incomplete for stated scope.

You document both unit and instrumented tests, but only provide the unit-test command. Add an explicit instrumented-test command to avoid false confidence in coverage.

Suggested diff
 - Unit tests: `android/src/test/`.
 - Instrumented tests: `android/src/androidTest/`.
 - Run via `./gradlew :react-native-usercentrics:test` from `sample/android/`.
+- Run instrumented tests via `./gradlew :react-native-usercentrics:connectedAndroidTest` (or your CI equivalent) from `sample/android/`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Unit tests: `android/src/test/`.
- Instrumented tests: `android/src/androidTest/`.
- Run via `./gradlew :react-native-usercentrics:test` from `sample/android/`.
- Unit tests: `android/src/test/`.
- Instrumented tests: `android/src/androidTest/`.
- Run via `./gradlew :react-native-usercentrics:test` from `sample/android/`.
- Run instrumented tests via `./gradlew :react-native-usercentrics:connectedAndroidTest` (or your CI equivalent) from `sample/android/`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.cursor/rules/testing.mdc around lines 24 - 27, The documentation lists unit
and instrumented tests but only provides the unit test command; add an explicit
instrumented-test command for clarity by appending the connected Android
instrumentation command (e.g., ./gradlew
:react-native-usercentrics:connectedAndroidTest) alongside the existing unit
test command (./gradlew :react-native-usercentrics:test), and optionally mention
assembleAndroidTest or installDebug and connectedAndroidTest for CI/use cases so
readers can run instrumented tests reliably.

Comment on lines +28 to +30
- The TurboModule spec lives in `src/fabric/NativeUsercentricsModule.ts`.
- It uses `TurboModuleRegistry` and `codegenNativeComponent`.
- Codegen config is in `package.json` under `codegenConfig`.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .cursor/rules/typescript-conventions.mdc | head -40

Repository: Usercentrics/react-native-sdk

Length of output: 1530


🏁 Script executed:

rg -n 'TurboModuleRegistry|codegenNativeComponent|codegenNativeCommands' --type-list | head -5

Repository: Usercentrics/react-native-sdk

Length of output: 462


🏁 Script executed:

fd -e ts -e tsx | xargs rg -l 'TurboModuleRegistry|codegenNativeComponent' | head -10

Repository: Usercentrics/react-native-sdk

Length of output: 137


🌐 Web query:

React Native TurboModule codegenNativeComponent API difference official documentation

💡 Result:

  • What they are for

    • TurboModules are for exposing imperative native APIs to JS (functions/constants) as a native module (e.g., storage, sensors). (reactnative.dev)
    • codegenNativeComponent is for exposing native UI views to JS as a Fabric native component (props + events mapped to a native ViewManager/component view). (reactnative.dev)
  • JS “spec” shape / API surface

    • TurboModule spec: you define an interface that extends TurboModule and you typically export it via TurboModuleRegistry.getEnforcing<Spec>(...). (reactnative.dev)
    • Native component spec: you define a props interface (usually extending ViewProps), and export codegenNativeComponent<Props>('NativeName') (often cast to HostComponent<Props>). (reactnative.dev)
  • Codegen detection conventions (important “difference” people hit)

    • TurboModule spec files must be prefixed with Native (example: NativeLocalStorage.ts). (reactnative.dev)
    • Fabric native component spec files must be suffixed with NativeComponent (example: WebViewNativeComponent.ts). (reactnative.dev)
  • Codegen configuration difference

    • In codegenConfig, you generally set type: "modules" for TurboModules and type: "components" for Fabric components (or "all" for both). (reactnative.dev)

Citations:


🏁 Script executed:

cat -n src/fabric/NativeUsercentricsModule.ts

Repository: Usercentrics/react-native-sdk

Length of output: 2195


🏁 Script executed:

cat -n package.json | grep -A 20 'codegenConfig'

Repository: Usercentrics/react-native-sdk

Length of output: 329


Line 29 incorrectly lists codegenNativeComponent as part of TurboModule setup.

codegenNativeComponent is a Fabric Native Component API for UI views. The actual implementation uses only TurboModuleRegistry. Remove codegenNativeComponent from this line to prevent misleading developers on correct TurboModule patterns.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.cursor/rules/typescript-conventions.mdc around lines 28 - 30, The
documentation incorrectly states that the TurboModule spec uses
codegenNativeComponent; update the sentence that currently lists both
TurboModuleRegistry and codegenNativeComponent to remove codegenNativeComponent
so it only references TurboModuleRegistry (keep reference to the TurboModule
spec file NativeUsercentricsModule.ts for context).


## Build

- Min SDK: 26 (Android 8.0).
Copy link
Collaborator

Choose a reason for hiding this comment

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

our min sdk is 24 or 21 in legace, I guess we need to modify this


## Build

- Minimum iOS deployment target: 16.0.
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, our deployment target is on iOS 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants