Pulsar agent setup guide ======================== You are a coding agent (Claude Code, Codex or similar) adding Pulsar over-the-air updates to a React Native app. Pulsar speaks the CodePush protocol. The person you work for owns the project and the Pulsar account; you act only with their go-ahead. Rules ----- 1. Inspect before you change anything, and preserve existing work. Run `git status` first and never discard or rewrite changes you did not make. 2. Don't guess project decisions. Ask the person for anything you can't read from the project: the Pulsar app name, the platform, the deployment key, the server URL, which component is the app's root, and where an "app is ready" point is. 3. Never ask for, accept or write down passwords, two-factor codes, recovery codes, API tokens, private signing keys or private bundle keys. When the Pulsar CLI needs to sign in, ask the person to run `pulsar login ` in their own terminal and continue once they say it's done. Deployment keys are not secret (they ship inside the app), so they may be pasted to you. If the person needs release keys (signing key, bundle key), send them to the app's "Release keys and setup" section in Pulsar Settings, which has the steps and a separate prompt for that job. Never put those keys in a .env file or a shell profile; `pulsar release-keys save` keeps them in the system's secure store (CLI 1.13.1+). Apps that require post-quantum signatures need CLI 1.14.0+ and a signing key that holds both the RSA and ML-DSA-65 keys. 4. Don't release, promote, enable, disable, roll back or change the rollout of any update, and don't upload to an app store, unless the person tells you to in this conversation. 5. Mark every line you add for Pulsar so it can be found and removed later: // BEGIN PULSAR ... // END PULSAR (JS, Swift, Objective-C, Kotlin, Java) ... (plist, XML) Never put existing app code inside these markers. 6. If Pulsar or the npm registry can't be reached, stop and report it. Don't switch to another server, mirror or package. Defaults -------- - SDK package: @novacraft-engineering/pulsar-code-push (import name: codePush) - CLI package: @novacraft-engineering/pulsar-cli (command: pulsar) - Hosted server URL: https://api.usepulsar.dev (self-hosted teams use their own URL; ask) - Docs: https://usepulsar.dev/docs Step 1. Inspect --------------- - Package manager: yarn.lock, package-lock.json, pnpm-lock.yaml or bun.lockb. Use that one. - React Native version (0.70 or newer is supported, New Architecture included). - Expo: a managed Expo app needs `expo prebuild` or a development build first; ask before running it. - An existing updater (react-native-code-push, @revopush/react-native-code-push, expo-updates). Ask whether Pulsar replaces it; don't run two updaters. - iOS: the AppDelegate file and language (AppDelegate.swift or AppDelegate.mm) and Info.plist. - Android: MainApplication (Kotlin or Java), and whether it uses ReactHost (getDefaultReactHost) or an older ReactNativeHost; android/app/src/main/res/values/strings.xml. Step 2. Install the SDK ----------------------- Add @novacraft-engineering/pulsar-code-push with the project's package manager, then run `pod install` in ios/. Autolinking registers the native module on both platforms. Step 3. Point the app at Pulsar ------------------------------- Use the deployment key the person gives you. Staging is normally used for the first test build. Shortcut for steps 3 and 4: with @novacraft-engineering/pulsar-cli 1.7 or later, run pulsar init --ios-key IOS_KEY --android-key ANDROID_KEY --server SERVER_URL from the project root to preview the native changes, then add --write to make them. It edits only files that match the React Native templates, marks every change, and lists anything it couldn't do so you can do that part by hand as described below. `pulsar doctor` checks the result. iOS, ios//Info.plist: CodePushDeploymentKey DEPLOYMENT_KEY CodePushServerURL SERVER_URL Android, android/app/src/main/res/values/strings.xml (inside ): DEPLOYMENT_KEY SERVER_URL Step 4. Load the installed update at startup (native) ----------------------------------------------------- Without this the app downloads updates but keeps running the bundle it shipped with. Debug builds keep loading from Metro. iOS, Swift (AppDelegate.swift): // BEGIN PULSAR import CodePush // END PULSAR ... override func bundleURL() -> URL? { #if DEBUG return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") #else // BEGIN PULSAR return CodePush.bundleURL() // END PULSAR #endif } iOS, Objective-C (AppDelegate.mm): // BEGIN PULSAR #import // END PULSAR ... - (NSURL *)bundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else // BEGIN PULSAR return [CodePush bundleURL]; // END PULSAR #endif } Android, Kotlin with ReactHost (React Native 0.76 and newer): // BEGIN PULSAR import com.microsoft.codepush.react.CodePush // END PULSAR ... getDefaultReactHost( context = applicationContext, packageList = PackageList(this).packages, // BEGIN PULSAR jsBundleFilePath = CodePush.getJSBundleFile(), // END PULSAR ) Android, older ReactNativeHost (inside the DefaultReactNativeHost object): Kotlin: // BEGIN PULSAR override fun getJSBundleFile(): String = CodePush.getJSBundleFile() // END PULSAR Java: // BEGIN PULSAR @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } // END PULSAR Keep whatever the app already does for debug builds (for example a custom Metro port). Step 5. Wrap the root component (JavaScript) -------------------------------------------- // BEGIN PULSAR import codePush from '@novacraft-engineering/pulsar-code-push'; // END PULSAR function App() { /* existing app */ } // BEGIN PULSAR export default codePush({ installMode: codePush.InstallMode.ON_NEXT_RESTART, })(App); // END PULSAR Keep the app's existing export logic; only wrap it. If the app checks for updates itself, use codePush.sync() there instead of the wrapper. Once the app has started successfully (first screen rendered, or the app's own "ready" point), call codePush.notifyAppReady() so an installed update is kept; otherwise it rolls back on the next launch. Only time the app spends open on screen counts, so background launches (push notifications, background tasks) never roll an update back. Development builds (__DEV__) never check for or download updates. That's expected. Step 6. Check your work ----------------------- - Run the project's own lint, type check and tests. - Run `pod install` and, if available, a release build of each platform (for example `npx react-native run-android --mode release`). Don't upload anything. - Search for "BEGIN PULSAR" and confirm every change you made is inside markers and nothing else is. Step 7. Releasing (only when the person says so) ------------------------------------------------ npm i -g @novacraft-engineering/pulsar-cli pulsar login SERVER_URL (the person runs this in their own terminal) pulsar release APP_NAME Staging --platform ios|android --target --target is the native version already in the store (or in the test build). Test on Staging, then promote the same bundle to Production from the dashboard or the CLI. Report ------ Finish with two lists: what you completed (files changed, checks run and their results), and what the person still has to do: build and install a new native app (the native code changed, so an OTA alone can't deliver this), sign in to the CLI, release to Staging, test on a device, then promote. Removing Pulsar later --------------------- `pulsar uninstall --dry-run` lists what would be removed; `pulsar uninstall` removes it. By hand: delete every BEGIN PULSAR ... END PULSAR block, remove the Info.plist and strings.xml entries, uninstall @novacraft-engineering/pulsar-code-push and run `pod install`. Restore the original export where the root component was wrapped.