rnx-kit / fork-sync
CLAUDE.md1.7k starsChanged 9 months agoMITView on GitHub
MANDATORY RULES 1. DISCUSS before implementing - Answer questions first, code after agreement 2. Use node directly for TypeScript - NOT tsx, ts-node, or tsc 3. Check the platform - Claude Code knows the OS (Platform: in system prompt). Follow the platform-specific rules below. Sync forked/vendored dependencies with upstream using Git 3-way merge with AI-assisted conflict resolution. Note: Claude/Copilot integration tests are slow (invoke external CLIs) and are skipped by default. Use yarn test:all or set RUN_INTEGRATION=1 to include them.
- Deletes or force-pushes
Trending
More talk lately.about the whole repository
Who's talking about microsoft/rnx-kit
- microsoft/react-native-windows“Expo support”GitHub · Aug 3, 2024 · 27 reactions
- react-native-linear-gradient/react-native-linear-gradient“This package is unmaintained and causes significant degradation in app start up time.”GitHub · Aug 4, 2022 · 13 reactions
- nrwl/nx“16.4: Failed to process the project graph with "nx-js-graph-plugin"”GitHub · Jul 6, 2023 · 6 reactions
- react/react-native“fix: limit diagnostics width output by `hermesc`”GitHub · May 23, 2023 · 3 reactions
- @githubfeed.bsky.social“🚀 GitHub Intelligence Drop fabric8 (Unknown • 🟡) ⭐ 1.8K → https://github.com/fabric8io/fabric8 rnx-kit …”Bluesky · May 11, 2026 · 2 likes
The biggest 5 of 26 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 26
Talked about on GitHub and Bluesky (26 times).
On GitHub · 25
- Aug 3, 2024Expo support — microsoft/react-native-windows27 reactions · 9 comments
- Aug 4, 2022This package is unmaintained and causes significant degradation in app start up time. — react-native-linear-gradient/react-native-linear-gradient13 reactions · 4 comments
- Jul 6, 202316.4: Failed to process the project graph with "nx-js-graph-plugin" — nrwl/nx6 reactions · 25 comments
- May 23, 2023fix: limit diagnostics width output by `hermesc` — react/react-native3 reactions · 2 comments
- Feb 5, 2025Add support for `react-native` 0.79 — microsoft/react-native-test-app2 reactions
20 more on GitHub
- Nov 7, 2023Migrate to @rnx-kit/chromium-edge-launcher for Windows fix — react/react-native2 reactions · 12 comments
- Dec 2, 2022fix(internal, dangerfile): fix changelog entries for dangerfiles and PR template — react/react-native2 reactions · 3 comments
- Jul 22, 2022esbuild: Moving to @rnx-kit/metro-serializer-esbuild — infinitered/ignite2 reactions · 5 comments
- Apr 1, 2022feat: add "clean" command — react-native-community/cli2 reactions · 3 comments
- Feb 1, 2022[Releases] Add path-specified filters to `rn-changelog-generator` — react/react-native2 reactions · 4 comments
- Feb 1, 2022[Releases] Add `--output` flag to `rn-changelog-generator` — react/react-native2 reactions
- Jan 25, 2024feat: add support for bridgeless mode — microsoft/react-native-test-app1 reaction · 1 comment
- Oct 18, 2023Add support for `react-native` 0.74 — microsoft/react-native-test-app1 reaction · 1 comment
- Oct 10, 2023Add support for `react-native` 0.73 — microsoft/react-native-test-app1 reaction
- Dec 2, 2022fix changelog entries — react/react-native-website1 reaction · 1 comment
- May 28, 2022feat: add `require.context` support — react/metro1 reaction · 10 comments
- May 25, 2022[snackager] correct output with package type: module — expo/snack1 reaction · 3 comments
- Oct 1, 2026📦 Bump the all-dependencies group across 1 directory with 10 updates — microsoft/react-native-windows0 reactions · 1 comment
- Sep 28, 2026Bump @rnx-kit/align-deps from 3.4.8 to 4.2.0 — SimonAdrell/Dicy0 reactions · 1 comment
- Sep 10, 2026Add support for `react-native` 0.88 — microsoft/react-native-test-app0 reactions
- Jun 19, 2026chore(deps-dev): bump @rnx-kit/metro-config from 2.1.1 to 2.2.4 — react-native-menu/menu0 reactions
- Jul 25, 2024Bump the rnx-kit group across 1 directory with 3 updates — samuelfreiberg/fluentui-react-native0 reactions · 1 comment
- Jul 4, 2024📦 Bump the rnx-kit group across 1 directory with 3 updates — tudorms/react-native-windows0 reactions · 1 comment
- Jun 27, 2024Bump the rnx-kit group with 2 updates — rurikoaraki/fluentui-react-native0 reactions · 1 comment
- Jun 7, 2024Bump the rnx-kit group across 1 directory with 3 updates — FalseLobster/fluentui-react-native0 reactions · 1 comment
On Bluesky · 1
- May 11, 2026🚀 GitHub Intelligence Drop fabric8 (Unknown • 🟡) ⭐ 1.8K → https://github.com/fabric8io/fabric8 rnx-kit (TypeScript • 🟢) ⭐ 1.7K →… — @githubfeed.bsky.social2 likes and reposts
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 2
STOP! READ THESE RULES BEFORE DOING ANYTHING ============================================================ -->
- Distinctive: line 45
Check it and follow the appropriate rules below.
- Very specific: line 82
DO NOT: use mkdir -p (use New-Item -ItemType Directory -Force)
- Very specific: line 84
DO NOT: use cat, grep, sed, awk (use PowerShell equivalents or Claude Code's Read/Grep tools)
- Very specific: line 86
DO NOT: use Unix path separators in shell commands (use \ or let Node.js handle paths)
- Very specific: line 200
When merge conflicts occur, ai-merge resolves them hunk-by-hunk with confidence-based validation:
- Distinctive: line 210
Apply or retry: If confidence >= threshold (default: MEDIUM), apply the resolved hunk.
- Distinctive: line 250
When creating new files, always check existing files in the same directory first to match conventions:
- Distinctive: line 253
File headers: All modules have a Microsoft copyright header followed by a JSDoc module comment
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- ============================================================
STOP! READ THESE RULES BEFORE DOING ANYTHING
============================================================ -->MANDATORY RULES
- DISCUSS before implementing - Answer questions first, code after agreement
- Use
nodedirectly for TypeScript - NOT tsx, ts-node, or tsc- Check the platform - Claude Code knows the OS (
Platform:in system prompt). Follow the platform-specific rules below.
fork-sync Development Guide
Sync forked/vendored dependencies with upstream using Git 3-way merge with AI-assisted conflict resolution.
Quick Reference
yarn build # Compile TypeScript to lib/
yarn test # Run all tests (fast: skips slow integration tests)
yarn test:all # Run all tests including slow integration tests
yarn lint # Check linting (ESLint)
yarn format # Check formatting (oxfmt)
yarn fix # Fix everything: typecheck + format + lint:fixNote: Claude/Copilot integration tests are slow (invoke external CLIs) and
are skipped by default. Use yarn test:all or set RUN_INTEGRATION=1 to
include them.
Important: Discuss Before Implementing
When the user asks a question, ANSWER the question and DISCUSS solutions with them. Do not immediately jump to writing code or creating files. Have a conversation first to understand what approach they prefer, then implement only after getting agreement.
Platform-Specific Rules
Claude Code reports the current platform in the system prompt as Platform:.
Check it and follow the appropriate rules below.
Windows (Platform: win32)
Claude Code's Bash tool runs bash even on Windows. Bash does not understand
Windows paths or .cmd files natively. Wrap commands in powershell -Command:
# CORRECT:
powershell -Command "cd 'e:\GitHub\microsoft\rnx-kit\incubator\fork-sync'; yarn test"
powershell -Command "cd 'e:\GitHub\microsoft\rnx-kit\incubator\fork-sync'; yarn fix"
# WRONG - bash doesn't understand Windows paths:
cd e:\path; command # FAILS
cd /d "e:\path" && command # FAILSKey pattern: powershell -Command "cd 'FULL_PATH'; command"
The "nul" File Problem
On Windows, nul is a reserved device name. NEVER redirect to nul — it
creates an undeletable file:
# NEVER DO THIS on Windows:
command 2>nul # Creates undeletable "nul" file!
command 2>/dev/null # Same problem!
some_command > nul # Same problem!
# CORRECT:
powershell -Command "command 2>`$null"
command 2>&1 # Or just merge streamsForbidden Shell Commands on Windows
- DO NOT use
mkdir -p(useNew-Item -ItemType Directory -Force) - DO NOT use
rm -rf(useRemove-Item -Recurse -Force) - DO NOT use
cat,grep,sed,awk(use PowerShell equivalents or Claude Code's Read/Grep tools) - DO NOT use Unix path separators in shell commands (use
\or let Node.js handle paths)
macOS / Linux (Platform: darwin or Platform: linux)
Standard bash commands work natively. No PowerShell wrapping needed:
cd /path/to/rnx-kit/incubator/fork-sync && yarn test
yarn fixStill avoid destructive commands (rm -rf, git clean -f, etc.) without
user confirmation — these are dangerous on any platform.
Running TypeScript Scripts
Node.js 22.6+ runs TypeScript files directly via built-in "type stripping" - it removes type annotations and runs the resulting JavaScript. No compilation step, no external tools needed.
# CORRECT - use node directly:
node src/sync.ts --help
# WRONG - do NOT use these:
# node --experimental-strip-types ... # WRONG - flag not needed in Node 23.6+/22.18+
# npx tsx src/sync.ts # WRONG - external tool not needed
# npx ts-node src/sync.ts # WRONG - external tool not needed
# tsc src/sync.ts # WRONG - compilation not neededLimitations
Type stripping only works with "erasable" TypeScript syntax. The following
features require --experimental-transform-types:
enumdeclarations (useconstobjects or union types instead)- Constructor parameter properties (
constructor(public x: number)) namespacedeclarationsconst enum
Project Structure
incubator/fork-sync/
src/
sync.ts # Main sync CLI
ai-merge.ts # AI-powered merge conflict resolver CLI
modules/ # Reusable modules
test/ # Unit tests (Node.js test runner)
harness/ # Manual test harnesses
ai-merge-prompt.md # Merge conflict resolution prompt template
lib/ # Build output (gitignored)Main Scripts
src/sync.ts- Dependency sync tool (published asfork-syncCLI)src/ai-merge.ts- Hunk-based merge conflict resolver (published asai-mergeCLI)ai-merge-prompt.md- Prompt template for AI conflict resolution
Modules (src/modules/)
Reusable modules imported by the main scripts:
merge-hunks.ts- Hunk parsing and coalescing logicjob-ui.ts- Concurrent task scheduler with progress UIclaude.ts- Claude CLI integrationcopilot.ts- GitHub Copilot CLI integrationai-prompt-template.ts- Prompt template parsingtty-ui.ts- TTY colors, icons, and progress UIlog.ts- Logging module (console + file logging)parallel.ts- Async iterator utilities for parallel processingproc.ts- Async wrapper around child_process.spawnqueue.ts- Generic FIFO queue with O(1) amortized operationsfs.ts- File system utilitiesgit.ts- Git command wrapperscommon.ts- Shared types and constants
Tests (test/)
Unit tests using Node.js test runner:
yarn test # Run fast tests (skips integration)
yarn test:all # Run all tests including integration
node --test test/merge-hunks.test.ts # Run specific test fileIntegration tests (claude.test.ts, copilot.test.ts) call external CLIs and
are slow. They are skipped by default and only run when RUN_INTEGRATION=1 is
set.
Harness (harness/)
Manual test harnesses for development:
harness/ai-merge-harness.ts- Test harness for merge conflictsharness/job-harness.ts- Job/task UI demoharness/progress-harness.ts- Progress UI demo
How Sync Works
- Clones upstream repo to
.sync/<dep>/ - Creates a branch with local changes from the vendored directory
- Performs Git 3-way merge with target upstream commit
- AI resolves conflicts automatically (if configured)
- Copies merged result back to the vendored directory
- Updates
sync-manifest.tswith new commit hash
AI-Assisted Conflict Resolution
When merge conflicts occur, ai-merge resolves them hunk-by-hunk with
confidence-based validation:
- Parse: Extract conflict hunks from KDiff3/diff3 markers, reconstruct local/base/remote file versions
- Coalesce: Merge nearby hunks (< 3 lines apart) to reduce AI calls
- Resolve per-hunk: Send each hunk (with ±5 lines of context) to AI for resolution
- Validate: A separate AI call scores each resolution as HIGH, MEDIUM, or LOW confidence
- Apply or retry: If confidence >= threshold (default: MEDIUM), apply the resolved hunk; otherwise retry up to the retry limit, then skip
- Reconstruct: Rebuild the file with resolved hunks; unresolved hunks keep their conflict markers
Two modes of operation:
- Single-file mode (default): Processes one file, called by Git's mergetool
system (
--base,--local,--remote,--merged) - Batch mode (
--merge-all): Discovers all conflicted files viagit diff --diff-filter=U, processes all hunks across all files in a single parallel pool, auto-stages fully resolved files
Binary files are skipped. Unresolved files can optionally launch a fallback merge tool (e.g., meld, vimdiff).
Logging
Both sync.ts and ai-merge.ts support logging via src/modules/log.ts.
Log Flags
--log-dir <path> # Log file directory (default: .logs/ at repo root)
--log-level <level> # Log level: none, error, default, debugLog Levels
| Level | Console Output | File Output |
none | info, warn, error | (no file) |
error | info, warn, error | error only |
default | info, warn, error | info, warn, error |
debug | info, warn, error | all (including debug) |
Console always shows info/warn/error. Debug messages only go to file.
Creating New Files
When creating new files, always check existing files in the same directory first to match conventions:
- File headers: All modules have a Microsoft copyright header followed by a JSDoc module comment
- Module documentation: Include a comprehensive JSDoc block with:
- One-line description
- "This module provides:" section listing the API with
**bold**names - Implementation notes (if relevant)
@exampleblock with realistic usage@moduletag
- Code style: Match existing patterns for exports, naming, and organization
See src/modules/tty-ui.ts or src/modules/queue.ts for examples of
well-documented modules.
Build
This package is part of the rnx-kit monorepo. It uses:
- Build:
rnx-kit-scripts build(runstsc --outDir lib) - Lint:
rnx-kit-scripts lint(ESLint with@rnx-kit/eslint-config) - Format:
rnx-kit-scripts format(oxfmt with monorepo config) - Test:
rnx-kit-scripts test(Node.js test runner, globstest/**/*.test.ts) - tsconfig: extends
@rnx-kit/tsconfig/tsconfig.esm.node.json
Output goes to lib/ (gitignored). Source is ESM ("type": "module").
Zero runtime dependencies - only uses Node.js builtins.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

