@teambit/ci 1.0.494 → 1.0.497
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ci.docs.mdx +39 -9
- package/dist/ci.docs.mdx +39 -9
- package/dist/ci.main.runtime.d.ts +6 -0
- package/dist/ci.main.runtime.js +24 -3
- package/dist/ci.main.runtime.js.map +1 -1
- package/dist/{preview-1786400681343.js → preview-1786718956243.js} +1 -1
- package/dist/sync/git-ops.d.ts +41 -0
- package/dist/sync/git-ops.js +71 -0
- package/dist/sync/git-ops.js.map +1 -1
- package/dist/sync/git-ops.spec.js +39 -0
- package/dist/sync/git-ops.spec.js.map +1 -1
- package/dist/sync/lane-sync-executor.d.ts +81 -15
- package/dist/sync/lane-sync-executor.js +315 -50
- package/dist/sync/lane-sync-executor.js.map +1 -1
- package/dist/sync/lane-sync-executor.spec.js +235 -13
- package/dist/sync/lane-sync-executor.spec.js.map +1 -1
- package/dist/sync/main-sync-executor.js +30 -6
- package/dist/sync/main-sync-executor.js.map +1 -1
- package/dist/sync/sync-planner.d.ts +10 -1
- package/dist/sync/sync-planner.js +37 -13
- package/dist/sync/sync-planner.js.map +1 -1
- package/dist/sync/sync-planner.spec.js +44 -2
- package/dist/sync/sync-planner.spec.js.map +1 -1
- package/dist/sync/sync-state.d.ts +33 -1
- package/dist/sync/sync-state.js +60 -3
- package/dist/sync/sync-state.js.map +1 -1
- package/dist/sync/sync-state.spec.js +28 -0
- package/dist/sync/sync-state.spec.js.map +1 -1
- package/package.json +20 -20
- package/sync/git-ops.spec.ts +60 -0
- package/sync/git-ops.ts +72 -0
- package/sync/lane-sync-executor.spec.ts +215 -9
- package/sync/lane-sync-executor.ts +354 -47
- package/sync/main-sync-executor.ts +37 -5
- package/sync/sync-planner.spec.ts +36 -1
- package/sync/sync-planner.ts +36 -16
- package/sync/sync-state.spec.ts +33 -0
- package/sync/sync-state.ts +62 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_harmony","data","require","_cli","_logger","_workspace","_builder","_status","_lanes","_snapping","_export","_importer","_checkout","_component","_configMerger","_dependencyResolver","_execa","_interopRequireDefault","_chalk","_ci","_ci2","_verify","_pr","_merge","_sync","_git","_componentId","_lodash","_objects","_sourceBranchDetector","_toolboxString","_toolboxPromise","_harmonyModules","_skipTasksFromMessage","_pullRequestRef","_adoptLaneNewComponents","_syncOrchestrator","_githubClient","_gitOps","_syncConfig","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","LANE_HASH_MISMATCH_MARKER","COMPONENT_DIVERGENCE_MARKER","CiMain","constructor","workspace","builder","status","lanes","snapping","exporter","importer","checkout","logger","config","gitHostProviderSlot","provider","cli","loggerAspect","createLogger","CiAspect","id","ci","registerGitHostProvider","GitHubHostProvider","message","consoleWarning","ciCmd","CiCmd","commands","CiVerifyCmd","CiPrCmd","CiMergeCmd","CiSyncCmd","register","listGitHostProviders","values","getBranchName","process","env","GITHUB_HEAD_REF","branch","git","current","isPullRequestRef","CIRCLE_BRANCH","circlePullRequestBranch","getCirclePullRequestBranchName","Error","toString","pullRequestUrl","CIRCLE_PULL_REQUEST","CIRCLE_PULL_REQUESTS","split","undefined","pathname","URL","owner","repo","pullSegment","pullNumber","headers","Accept","GITHUB_TOKEN","Authorization","controller","AbortController","timeout","setTimeout","abort","response","fetch","signal","ok","pullRequest","json","head","ref","clearTimeout","convertBranchToLaneId","branchName","sanitizedBranch","replace","toLowerCase","defaultScope","getDefaultBranchName","result","raw","local","parseOriginHeadRef","isValidGitBranchName","remote","remoteHeadBranch","probeDefaultBranchName","originalError","branches","all","includes","console","chalk","yellow","getGitCommitMessage","commit","log","maxCount","latest","body","parseVersionBumpFromCommit","commitMessage","useExplicitBumpKeywords","blue","useConventionalCommitsForVersionBump","test","getCustomCommitMessage","commitMessageScript","parts","command","args","slice","execa","cwd","path","encoding","customMessage","stdout","trim","green","verifyWorkspaceStatusInternal","strict","statusOutput","code","formatStatusOutput","warnings","failOnError","consoleSuccess","switchToLane","laneName","options","writeAdoptedFiles","switchOptions","doSwitch","switchLanes","forceOurs","workspaceOnly","skipDependencyInstallation","failure","err","red","isLaneMissingComponentError","retryErr","adoptAndRetrySwitch","reloadWorkspace","reloadWorkspaceFromDisk","switchToLaneForSync","_reloadConsumer","sync","opts","SyncOrchestrator","syncConfigFromMain","laneId","legacyScope","scope","objects","mainLaneId","getDefaultLaneId","currentLane","getCurrentLane","workspaceIds","listIds","componentsToSync","compact","Promise","components","map","laneComp","modelComponent","getModelComponentIfExist","mainHead","isEqual","toStringWithoutVersion","mainHeadIds","changeVersion","prefetchFromMainForConfigSync","componentsToMerge","pMapPool","item","divergeData","getDivergeData","sourceHead","targetHead","throws","isTargetAhead","isDiverged","concurrency","concurrentComponentsLimit","baseIds","baseSnap","commonSnapBeforeDiverge","syncedIds","laneHead","currentVersion","loadVersion","otherVersion","baseVersion","configMerger","ComponentConfigMerger","extensions","mergedConfig","merge","getSuccessfullyMergedConfig","filterDeletedDependenciesFromConfig","unmergedComponents","removeComponent","addEntry","name","fullName","join","write","clearAllComponentsCache","ids","label","importObjectsFromMainIfExist","cache","mergeConfig","policy","DependencyResolverAspect","depType","filtered","dep","version","isBranchBehindDefaultBranch","defaultBranch","defaultRefSha","revparse","headSha","mergeBase","verifyWorkspaceStatus","list","build","throwErrorsIfExist","snapPrCommit","laneIdStr","dryRun","keepLane","skipCleanup","skipTasks","noDestructiveRecovery","resolvedSkipCleanup","Boolean","messageSkipTasks","resolvedMessage","extractSkipTasksFromMessage","cliSkipTasks","task","mergedSkipTasks","Set","resolvedSkipTasks","originalLane","parseLaneId","import","installNpmPackages","writeConfigFiles","catch","snapAndExportReusingLane","snapAndExportWithTempLane","restoreWorkspaceAfterPr","targetLane","longProcessLogger","createLongProcessLogger","switchErr","skipNpmInstall","cleanupErr","end","existingLanes","getLanes","laneExists","foundErr","switchedLane","landedOnLane","errMsg","isStaleLane","staleHash","hash","recheck","currentRemoteHash","remoteChanged","removeLanes","force","msg","localLane","loadLane","moveObjectsToTrash","resetErr","afterReset","createLaneResult","createLane","forkLaneNewScope","results","snap","exitOnFirstFailedTask","snappedComponents","snapOutput","snapResultOutput","exportWithAdoptOnConflict","tempLaneName","generateRandomStr","renamedToFinalName","archiveResult","archiveLane","stillExists","verifyErr","rename","exportResults","exportWithRetryOnLaneHashMismatch","componentsIds","switchedBack","tempLaneFullName","export","isLaneHashMismatch","isComponentDivergence","cause","snappedHeads","c","Ref","from","rebaseOntoRemoteLane","exportWithBusyRetry","maxAttempts","isBusyErr","lastErr","attempt","resolve","remoteLane","fetchLaneWithItsComponents","remoteComp","find","isEqualWithoutVersion","remoteHead","load","parents","some","p","beforeParents","afterParents","add","getModelComponent","versionHistory","updateRebasedVersionHistory","updatedComponents","s","setLaneComponents","hasChanged","saveLane","saveLaneHistory","persist","consumer","setCurrentLane","bitMap","mergePr","argMessage","releaseType","autoTagReleaseType","preReleaseId","incrementBy","explicitVersionBump","verbose","versionsFile","autoMergeResolve","forceTheirs","skipPush","noBitmapCommit","initialCommitSha","laneComponents","changedIds","resetLaneComponentsToNew","changedIdsList","ComponentIdList","fromArray","removeMany","clearCache","gitStatus","hasChanges","files","stash","pull","importCurrentObjects","checkoutProps","mergeStrategy","checkoutResults","reportToString","checkoutOutput","restoreLaneConfigChanges","workspaceConfigUpdateResult","workspaceDepsConflicts","workspaceConfigConflictWriteError","bold","gray","leftUnresolvedConflicts","componentsWithConflicts","filesStatus","conflictedComponentIds","hasSoftTaggedComponents","softTaggedComponents","finalReleaseType","determineReleaseType","tagResults","tag","failFast","tagOutput","tagResultOutput","hasTaggedComponents","taggedComponents","exportResult","commitAndPushBitmapChanges","performLaneCleanup","addConfig","statusBeforeCommit","file","working_dir","index","diff","error","addAllExceptScopeAndModules","statusAfterCommit","activeComponents","isDeleted","laneVersion","laneConfig","toConfigObject","mainConfig","modelComp","getHead","mainVersion","aspectId","entries","updated","addComponentConfig","explicitLaneName","sourceBranchDetector","SourceBranchDetector","sourceBranchName","getSourceBranchName","isHashMismatchErr","archiveErr","throwOnError","lastCommit","detectedReleaseType","exports","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","BuilderAspect","StatusAspect","LanesAspect","SnappingAspect","ExportAspect","ImporterAspect","CheckoutAspect","Slot","withType","addRuntime"],"sources":["ci.main.runtime.ts"],"sourcesContent":["import type { RuntimeDefinition, SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport { CLIAspect, type CLIMain, MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, type LoggerMain, type Logger } from '@teambit/logger';\nimport { WorkspaceAspect, type Workspace } from '@teambit/workspace';\nimport { BuilderAspect, type BuilderMain } from '@teambit/builder';\nimport { StatusAspect, type StatusMain } from '@teambit/status';\nimport { LanesAspect } from '@teambit/lanes';\nimport type { SwitchLaneOptions, LanesMain } from '@teambit/lanes';\nimport { SnappingAspect, tagResultOutput, snapResultOutput } from '@teambit/snapping';\nimport type { SnapResults, SnappingMain } from '@teambit/snapping';\nimport { ExportAspect, type ExportMain } from '@teambit/export';\nimport { ImporterAspect, type ImporterMain } from '@teambit/importer';\nimport { CheckoutAspect, checkoutOutput, type CheckoutMain } from '@teambit/checkout';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { getDivergeData } from '@teambit/component.snap-distance';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport execa from 'execa';\nimport chalk from 'chalk';\nimport type { ReleaseType } from 'semver';\nimport { CiAspect } from './ci.aspect';\nimport { CiCmd } from './ci.cmd';\nimport { CiVerifyCmd } from './commands/verify.cmd';\nimport { CiPrCmd } from './commands/pr.cmd';\nimport { CiMergeCmd } from './commands/merge.cmd';\nimport { CiSyncCmd } from './commands/sync.cmd';\nimport { git } from './git';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { ComponentID } from '@teambit/component-id';\nimport { compact, isEqual } from 'lodash';\nimport type { Version, LaneComponent, Lane } from '@teambit/objects';\nimport { Ref } from '@teambit/objects';\nimport type { LaneId } from '@teambit/lane-id';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { SourceBranchDetector } from './source-branch-detector';\nimport { generateRandomStr } from '@teambit/toolbox.string.random';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentComponentsLimit } from '@teambit/harmony.modules.concurrency';\nimport { extractSkipTasksFromMessage } from './skip-tasks-from-message';\nimport { isPullRequestRef } from './pull-request-ref';\nimport { adoptAndRetrySwitch, isLaneMissingComponentError } from './sync/adopt-lane-new-components';\n\nexport type CiSwitchLaneOptions = SwitchLaneOptions & {\n /** after an adoption retry, write the adopted components' files (`checkout --reset`) */\n writeAdoptedFiles?: boolean;\n};\nimport type { CiSyncConfig } from './sync/sync-config';\nimport { SyncOrchestrator } from './sync/sync-orchestrator';\nimport type { GitHostProvider } from './sync/git-host-provider';\nimport { GitHubHostProvider } from './sync/github-client';\nimport { addAllExceptScopeAndModules, parseOriginHeadRef, remoteHeadBranch } from './sync/git-ops';\nimport { isValidGitBranchName } from './sync/sync-config';\n\n/**\n * Registered git hosts (GitHub ships built-in; others register from their own aspect).\n * @see GitHostProvider\n */\nexport type GitHostProviderSlot = SlotRegistry<GitHostProvider>;\n\n// Two distinct conflicts can surface from the remote on a concurrent `bit ci pr` race.\n// LANE_HASH_MISMATCH fires when both runners called `Lane.create` (the lane didn't exist on\n// the remote yet), so they each minted a random `sha1(v4())` hash — `sources.mergeLane` then\n// rejects the second push's lane object on hash mismatch.\n// COMPONENT_DIVERGENCE fires when the lane already exists (both runners `switchToLane`'d\n// and got the same lane hash) but they both snapped the SAME component with DIFFERENT\n// content — `mergeLane`'s per-component diverge check collects a `ComponentNeedsUpdate`\n// and throws `MergeConflictOnRemote(\"merge error occurred when exporting the component(s)…\")`.\n// Both recover through the same adopt-and-rebase path in `rebaseOntoRemoteLane`.\nconst LANE_HASH_MISMATCH_MARKER = 'a lane with the same id already exists with a different hash';\nconst COMPONENT_DIVERGENCE_MARKER = 'merge error occurred when exporting';\nexport interface CiWorkspaceConfig {\n /**\n * Path to a custom script that generates commit messages for `bit ci merge` operations.\n * The script will be executed when components are tagged and committed to the repository.\n * If not specified, falls back to the default commit message:\n * \"chore: update .bitmap and lockfiles as needed [skip ci]\"\n *\n * @example\n * ```json\n * {\n * \"teambit.git/ci\": {\n * \"commitMessageScript\": \"node scripts/generate-commit-message.js\"\n * }\n * }\n * ```\n */\n commitMessageScript?: string;\n\n /**\n * Enables automatic version bump detection from conventional commit messages.\n * When enabled, the system analyzes commit messages to determine the appropriate version bump:\n * - `feat!:` or `BREAKING CHANGE` → major version bump\n * - `feat:` → minor version bump\n * - `fix:` → patch version bump\n *\n * Only applies when no explicit version flags (--patch, --minor, --major) are provided.\n *\n * @default false\n * @example\n * ```json\n * {\n * \"teambit.git/ci\": {\n * \"useConventionalCommitsForVersionBump\": true\n * }\n * }\n * ```\n */\n useConventionalCommitsForVersionBump?: boolean;\n\n /**\n * Enables detection of explicit version bump keywords in commit messages.\n * When enabled, the system looks for these keywords in commit messages:\n * - `BIT-BUMP-MAJOR` → major version bump\n * - `BIT-BUMP-MINOR` → minor version bump\n *\n * These keywords have higher priority than conventional commits parsing.\n * Only applies when no explicit version flags are provided.\n *\n * @default true\n * @example\n * ```json\n * {\n * \"teambit.git/ci\": {\n * \"useExplicitBumpKeywords\": true\n * }\n * }\n * ```\n */\n useExplicitBumpKeywords?: boolean;\n\n /**\n * Configuration for `bit ci sync` — bi-directional lane <-> branch/PR sync.\n * See CiSyncConfig for fields. Example:\n * { \"teambit.git/ci\": { \"sync\": { \"branchPrefix\": \"lane/\", \"lanes\": [\"*\"] } } }\n */\n sync?: CiSyncConfig;\n}\n\nexport class CiMain {\n static runtime = MainRuntime as RuntimeDefinition;\n\n static dependencies: any = [\n CLIAspect,\n WorkspaceAspect,\n LoggerAspect,\n BuilderAspect,\n StatusAspect,\n LanesAspect,\n SnappingAspect,\n ExportAspect,\n ImporterAspect,\n CheckoutAspect,\n ];\n\n static slots = [Slot.withType<GitHostProvider>()];\n\n constructor(\n private workspace: Workspace,\n\n private builder: BuilderMain,\n\n private status: StatusMain,\n\n private lanes: LanesMain,\n\n private snapping: SnappingMain,\n\n private exporter: ExportMain,\n\n private importer: ImporterMain,\n\n private checkout: CheckoutMain,\n\n private logger: Logger,\n\n private config: CiWorkspaceConfig,\n\n private gitHostProviderSlot: GitHostProviderSlot\n ) {}\n\n static async provider(\n [cli, workspace, loggerAspect, builder, status, lanes, snapping, exporter, importer, checkout]: [\n CLIMain,\n Workspace,\n LoggerMain,\n BuilderMain,\n StatusMain,\n LanesMain,\n SnappingMain,\n ExportMain,\n ImporterMain,\n CheckoutMain,\n ],\n config: CiWorkspaceConfig,\n [gitHostProviderSlot]: [GitHostProviderSlot]\n ) {\n const logger = loggerAspect.createLogger(CiAspect.id);\n const ci = new CiMain(\n workspace,\n builder,\n status,\n lanes,\n snapping,\n exporter,\n importer,\n checkout,\n logger,\n config,\n gitHostProviderSlot\n );\n // GitHub ships built-in but is not privileged: registered through the same public slot any other\n // host aspect uses. Credentials resolve lazily, so registering at aspect load is always safe.\n ci.registerGitHostProvider(new GitHubHostProvider((message) => logger.consoleWarning(message)));\n const ciCmd = new CiCmd(workspace, logger);\n ciCmd.commands = [\n new CiVerifyCmd(workspace, logger, ci),\n new CiPrCmd(workspace, logger, ci),\n new CiMergeCmd(workspace, logger, ci),\n new CiSyncCmd(workspace, logger, ci),\n ];\n cli.register(ciCmd);\n\n return ci;\n }\n\n /**\n * Register a git host (GitHub, GitLab, …) that `bit ci sync` can use for its pull-request\n * operations. Exactly one provider is selected per run, by the `origin` remote (see\n * `selectGitHostProvider`); registering a provider never changes how a repository claimed by a\n * different provider is handled.\n */\n registerGitHostProvider(provider: GitHostProvider) {\n this.gitHostProviderSlot.register(provider);\n return this;\n }\n\n /** Every registered git host provider, in registration order (one provider per registration). */\n listGitHostProviders(): GitHostProvider[] {\n return this.gitHostProviderSlot.values();\n }\n\n async getBranchName() {\n try {\n // if we are running on github, use the GITHUB_HEAD_REF env var\n if (process.env.GITHUB_HEAD_REF) return process.env.GITHUB_HEAD_REF;\n\n const branch = await git.branch();\n if (branch.current && !isPullRequestRef(branch.current)) return branch.current;\n\n // CircleCI can check out GitHub PRs as refs like \"pull/10293\". In that case the real source\n // branch is the stable lane name we also use for post-merge cleanup. Do not prefer these env\n // vars over a normal git branch; e2e tests intentionally create local feature branches while\n // running under CircleCI.\n if (process.env.CIRCLE_BRANCH && !isPullRequestRef(process.env.CIRCLE_BRANCH)) {\n return process.env.CIRCLE_BRANCH;\n }\n const circlePullRequestBranch = await this.getCirclePullRequestBranchName();\n if (circlePullRequestBranch) return circlePullRequestBranch;\n\n return branch.current;\n } catch (e: any) {\n throw new Error(`Unable to read branch: ${e.toString()}`);\n }\n }\n\n private async getCirclePullRequestBranchName(): Promise<string | undefined> {\n const pullRequestUrl = process.env.CIRCLE_PULL_REQUEST || process.env.CIRCLE_PULL_REQUESTS?.split(',')[0];\n if (!pullRequestUrl) return undefined;\n\n try {\n const { pathname } = new URL(pullRequestUrl);\n const [, owner, repo, pullSegment, pullNumber] = pathname.split('/');\n if (!owner || !repo || pullSegment !== 'pull' || !pullNumber) return undefined;\n\n const headers: Record<string, string> = {\n Accept: 'application/vnd.github+json',\n 'X-GitHub-Api-Version': '2022-11-28',\n };\n if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;\n\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5_000);\n try {\n const response = await fetch(`https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}`, {\n headers,\n signal: controller.signal,\n });\n if (!response.ok) return undefined;\n\n const pullRequest = (await response.json()) as { head?: { ref?: string } };\n return pullRequest.head?.ref;\n } finally {\n clearTimeout(timeout);\n }\n } catch {\n return undefined;\n }\n }\n\n /**\n * Converts a branch name to a lane ID string using Bit's naming conventions.\n * Sanitizes branch name by replacing slashes and dots with dashes, converting to lowercase, then\n * prefixes with the workspace's default scope.\n *\n * @param branchName - The git branch name to convert\n * @returns Lane ID in format: {defaultScope}/{sanitizedBranch}\n * @example convertBranchToLaneId(\"feature/New-Component\") => \"my-scope/feature-new-component\"\n */\n convertBranchToLaneId(branchName: string): string {\n const sanitizedBranch = branchName.replace(/[/.]/g, '-').toLowerCase();\n return `${this.workspace.defaultScope}/${sanitizedBranch}`;\n }\n\n /**\n * The repository's default branch name, whole — slashes included (see `parseOriginHeadRef`).\n * Local `origin/HEAD` symref first, then the remote's own answer, then the conventional probe.\n */\n async getDefaultBranchName(): Promise<string> {\n try {\n const result = await git.raw(['symbolic-ref', 'refs/remotes/origin/HEAD']);\n const local = parseOriginHeadRef(result);\n // Every candidate is validated before it is returned: this value becomes a checkout target and a\n // push refspec, and an option-like name (\"-x\") would be read by git as a flag. An unusable answer\n // falls through to the next source rather than reaching the argv.\n if (local && isValidGitBranchName(local)) return local;\n } catch {\n // no local origin/HEAD — normal in a fresh CI clone; ask the remote itself below.\n }\n const remote = await remoteHeadBranch();\n if (remote && isValidGitBranchName(remote)) return remote;\n return this.probeDefaultBranchName();\n }\n\n /**\n * Last-resort fallback: the two conventional names among the remote branches, then `master`.\n * Deliberately only `main`/`master` — any wider guess risks protecting the wrong branch.\n */\n private async probeDefaultBranchName(originalError?: Error): Promise<string> {\n try {\n const branches = await git.branch(['-r']);\n if (branches.all.includes('origin/main')) return 'main';\n if (branches.all.includes('origin/master')) return 'master';\n return 'master';\n } catch {\n this.logger.console(\n chalk.yellow(`Unable to detect default branch, using 'master'${originalError ? `: ${originalError}` : ''}`)\n );\n return 'master';\n }\n }\n\n async getGitCommitMessage() {\n try {\n const commit = await git.log({\n maxCount: 1,\n });\n if (!commit.latest) {\n return null;\n }\n const { message, body } = commit.latest;\n return body ? `${message}\\n\\n${body}` : message;\n } catch (e: any) {\n throw new Error(`Unable to read commit message: ${e.toString()}`);\n }\n }\n\n private parseVersionBumpFromCommit(commitMessage: string): ReleaseType | null {\n // Check explicit bump keywords (highest priority after env vars)\n if (this.config.useExplicitBumpKeywords !== false) {\n // default to true\n if (commitMessage.includes('BIT-BUMP-MAJOR')) {\n this.logger.console(chalk.blue('Found BIT-BUMP-MAJOR keyword in commit message'));\n return 'major';\n }\n if (commitMessage.includes('BIT-BUMP-MINOR')) {\n this.logger.console(chalk.blue('Found BIT-BUMP-MINOR keyword in commit message'));\n return 'minor';\n }\n }\n\n // Check conventional commits if enabled\n if (this.config.useConventionalCommitsForVersionBump) {\n // Check for breaking changes (major version bump)\n if (/^feat!(\\(.+\\))?:|^fix!(\\(.+\\))?:|BREAKING CHANGE/m.test(commitMessage)) {\n this.logger.console(chalk.blue('Found breaking changes in commit message (conventional commits)'));\n return 'major';\n }\n\n // Check for features (minor version bump)\n if (/^feat(\\(.+\\))?:/m.test(commitMessage)) {\n this.logger.console(chalk.blue('Found feature commits (conventional commits)'));\n return 'minor';\n }\n\n // Check for fixes (patch version bump) - explicit patch not needed as it's default\n if (/^fix(\\(.+\\))?:/m.test(commitMessage)) {\n this.logger.console(chalk.blue('Found fix commits (conventional commits) - using default patch'));\n return 'patch';\n }\n }\n\n return null; // No specific version bump detected\n }\n\n private async getCustomCommitMessage() {\n try {\n const commitMessageScript = this.config.commitMessageScript;\n\n if (commitMessageScript) {\n this.logger.console(chalk.blue(`Running custom commit message script: ${commitMessageScript}`));\n\n // Parse the command to avoid shell injection\n const parts = commitMessageScript.split(' ');\n const command = parts[0];\n const args = parts.slice(1);\n\n const result = await execa(command, args, {\n cwd: this.workspace.path,\n encoding: 'utf8',\n });\n const customMessage = result.stdout.trim();\n\n if (customMessage) {\n this.logger.console(chalk.green(`Using custom commit message: ${customMessage}`));\n return customMessage;\n }\n }\n } catch (e: any) {\n this.logger.console(chalk.yellow(`Failed to run custom commit message script: ${e.toString()}`));\n }\n\n // Fallback to default message\n return 'chore: update .bitmap and lockfiles as needed [skip ci]';\n }\n\n private async verifyWorkspaceStatusInternal(strict: boolean = false) {\n this.logger.console('📊 Workspace Status');\n this.logger.console(chalk.blue('Verifying status of workspace'));\n\n const status = await this.status.status({ lanes: true });\n const { data: statusOutput, code } = await this.status.formatStatusOutput(\n status,\n strict\n ? { strict: true, warnings: true } // When strict=true, fail on both errors and warnings\n : { failOnError: true, warnings: false } // By default, fail only on errors (tag blockers)\n );\n\n // Log the formatted status output\n this.logger.console(statusOutput);\n\n if (code !== 0) {\n throw new Error('Workspace status verification failed');\n }\n\n this.logger.consoleSuccess(chalk.green('Workspace status is correct'));\n return { status };\n }\n\n /**\n * Returns the caught Error on failure, or undefined on success (including the \"already checked\n * out\" no-op case). Callers that need to react to a specific failure mode (e.g. stale lane) can\n * inspect the returned error; existing callers ignore it and rely on a follow-up\n * `getCurrentLane()` check.\n *\n * A switch that fails because the lane provides a component the workspace tracks as new retries\n * once after adopting the lane's version — see `adoptNewComponentsTheLaneProvides`.\n */\n private async switchToLane(laneName: string, options: CiSwitchLaneOptions = {}): Promise<Error | undefined> {\n this.logger.console(chalk.blue(`Switching to ${laneName}`));\n const { writeAdoptedFiles, ...switchOptions } = options;\n const doSwitch = () =>\n this.lanes.switchLanes(laneName, {\n forceOurs: true,\n workspaceOnly: true,\n skipDependencyInstallation: true,\n ...switchOptions,\n });\n const failure = (err: any) => {\n this.logger.console(chalk.red(`Failed switching to ${laneName}: ${err?.toString() ?? err}`));\n return err;\n };\n try {\n await doSwitch();\n } catch (e: any) {\n if (e?.toString().includes('already checked out')) {\n this.logger.console(chalk.yellow(`Lane ${laneName} already checked out, skipping checkout`));\n return undefined;\n }\n if (!isLaneMissingComponentError(e)) return failure(e);\n const retryErr = await adoptAndRetrySwitch(laneName, e, doSwitch, writeAdoptedFiles, {\n workspace: this.workspace,\n lanes: this.lanes,\n logger: this.logger,\n checkout: this.checkout,\n reloadWorkspace: () => this.reloadWorkspaceFromDisk(),\n });\n if (retryErr) return failure(retryErr);\n }\n return undefined;\n }\n\n /**\n * Public entry point onto `switchToLane` for the lane-sync executor; returns the error instead of\n * throwing. `switchToLane` spreads caller options AFTER its defaults, so `forceOurs: true` is\n * overridable — the sync import direction depends on that. Do not reorder that spread.\n */\n async switchToLaneForSync(laneName: string, options: CiSwitchLaneOptions = {}): Promise<Error | undefined> {\n return this.switchToLane(laneName, options);\n }\n\n /**\n * Re-read `.bitmap` from disk into the live workspace. `bit ci sync` moves the git checkout\n * underneath a running process, and until the reload every bit operation resolves against the\n * `.bitmap` loaded at startup — and the next write would persist that stale state.\n */\n async reloadWorkspaceFromDisk(): Promise<void> {\n await this.workspace._reloadConsumer();\n }\n\n /** `bit ci sync` — reconcile Bit lanes and the main scope with git branches and PRs (see `SyncOrchestrator`). */\n async sync(\n opts: { lane?: string; branch?: string; all?: boolean; main?: boolean; dryRun?: boolean; init?: boolean } = {}\n ): Promise<string> {\n return new SyncOrchestrator({\n ci: this,\n workspace: this.workspace,\n logger: this.logger,\n lanes: this.lanes,\n checkout: this.checkout,\n config: this.config,\n }).sync(opts);\n }\n\n /**\n * Sync *config-only* changes from main onto the lane — without a full `bit lane merge`.\n *\n * In this workflow git is the source of truth for files: the PR author merges the default branch\n * into their PR branch, so source changes arrive via git. The one thing git can't carry is\n * config that's already been *tagged into objects* on main — e.g. another PR ran `bit env set` /\n * `bit deps set`; those records lived in `.bitmap`, rode git into main, and `bit ci merge` baked\n * them into the component's Version (clearing them from `.bitmap`). A long-running PR's lane\n * would otherwise miss them.\n *\n * A full lane merge is the wrong tool here: it does a 3-way *file* merge and refuses to run while\n * the workspace has modified components — but in `bit ci pr` the workspace is always dirty (the\n * PR's changes, not yet snapped). So instead we do a per-component 3-way merge of the aspect\n * *config only* (base = common ancestor, ours = lane, theirs = main), keeping the PR's config on\n * conflict, and stash the result on an `unmergedComponents` entry's `mergedConfig`. The\n * subsequent `snap` reads it (via the aspects-merger on component load) and bakes main's config\n * into the new snap, while the snap's files still come from the workspace (git). No file\n * checkout, so no clean-workspace requirement.\n */\n private async syncConfigFromMain(laneId: LaneId) {\n const legacyScope = this.workspace.scope.legacyScope;\n const repo = legacyScope.objects;\n const mainLaneId = this.lanes.getDefaultLaneId();\n const currentLane = await this.lanes.getCurrentLane();\n if (!currentLane) return;\n const workspaceIds = this.workspace.listIds();\n\n this.logger.console(chalk.blue(`Syncing config changes from ${mainLaneId.toString()} into ${laneId.toString()}`));\n\n // Resolve each lane component's head on main once, keeping only those that are on main and whose\n // lane head differs from it (the rest have nothing to sync). This single pass feeds both the\n // pre-fetch below and the merge loop, so we never load the same ModelComponent twice.\n const componentsToSync = compact(\n await Promise.all(\n currentLane.components.map(async (laneComp) => {\n try {\n const modelComponent = await legacyScope.getModelComponentIfExist(laneComp.id);\n const mainHead = modelComponent?.head; // the component's head on main\n if (!modelComponent || !mainHead || mainHead.isEqual(laneComp.head)) return undefined;\n return { laneComp, modelComponent, mainHead };\n } catch (e: any) {\n // Best-effort per component (same contract as the merge loop below): one component's\n // load failure shouldn't reject Promise.all and abort the whole config sync.\n this.logger.console(\n chalk.yellow(\n ` ${laneComp.id.toStringWithoutVersion()}: skipping config sync from main (${e?.message || e})`\n )\n );\n return undefined;\n }\n })\n )\n );\n\n // The lane import (switchToLane) brought each component's lane history plus the lightweight\n // version-history (the parent graph) — that's enough for the diverge check below to see that\n // main is ahead — but NOT the full Version object for main's head wherever main advanced past\n // the lane's fork point. Those objects live only on main and were never fetched. Without them\n // `loadVersion(mainHead)` throws VersionNotFoundOnFS, the per-component catch swallows it as\n // \"skipping config sync from main\", and the sync silently degrades to a no-op for every\n // diverged component. Pre-fetch main's head objects in one batched remote call (mirroring the\n // lane-merge flows — see merge-status-provider / merge-lanes). Pass the *specific* main-head\n // version so `cache: true` still fetches it: the component already exists locally at its lane\n // version, so a version-less id would look satisfied and skip the remote.\n const mainHeadIds = componentsToSync.map(({ laneComp, mainHead }) =>\n laneComp.id.changeVersion(mainHead.toString())\n );\n await this.prefetchFromMainForConfigSync(mainHeadIds, 'head objects');\n\n // Resolve each component's diverge state up front — before the merge loop — so we can also\n // pre-fetch the common-ancestor objects below. getDivergeData only walks the parent graph,\n // which is already local (switchToLane brings the version-history, and the head pre-fetch above\n // reinforced it), so no full Version object is needed yet. Keep only components where main is\n // actually ahead or diverged; the rest have nothing to bring in from main. Bound the fan-out\n // (getDivergeData traverses each component's version graph) so a lane with many components\n // doesn't spawn one unbounded burst of concurrent graph walks.\n const componentsToMerge = compact(\n await pMapPool(\n componentsToSync,\n async (item) => {\n try {\n const divergeData = await getDivergeData({\n repo,\n modelComponent: item.modelComponent,\n sourceHead: item.laneComp.head,\n targetHead: item.mainHead,\n throws: false,\n });\n if (!divergeData.isTargetAhead() && !divergeData.isDiverged()) return undefined;\n return { ...item, divergeData };\n } catch (e: any) {\n // Best-effort per component (same contract as the merge loop below).\n this.logger.console(\n chalk.yellow(\n ` ${item.laneComp.id.toStringWithoutVersion()}: skipping config sync from main (${e?.message || e})`\n )\n );\n return undefined;\n }\n },\n { concurrency: concurrentComponentsLimit() }\n )\n );\n\n // The head pre-fetch above brought main's head Version plus the version-history (parent graph),\n // but NOT the full Version object of the common ancestor (the lane's fork point) for components\n // where the lane and main have BOTH snapped since the fork. The 3-way config merge below loads\n // that base Version (`baseVersion.extensions`); without it, `loadVersion(baseSnap)` throws\n // VersionNotFoundOnFS, the per-component catch swallows it as \"skipping config sync from main\",\n // and the sync silently no-ops for every diverged component. The fork point lives on main and,\n // like the head, was never fetched (includeVersionHistory carries the graph, not each ancestor's\n // Version). Batch-fetch the bases in one call — same best-effort contract as the head pre-fetch.\n const baseIds = compact(\n componentsToMerge.map(({ laneComp, divergeData }) => {\n const baseSnap = divergeData.commonSnapBeforeDiverge;\n return baseSnap ? laneComp.id.changeVersion(baseSnap.toString()) : undefined;\n })\n );\n await this.prefetchFromMainForConfigSync(baseIds, 'common-ancestor objects');\n\n const syncedIds: ComponentID[] = [];\n for (const { laneComp, modelComponent, mainHead, divergeData } of componentsToMerge) {\n try {\n const laneHead = laneComp.head;\n const currentVersion = await modelComponent.loadVersion(laneHead.toString(), repo);\n const otherVersion = await modelComponent.loadVersion(mainHead.toString(), repo);\n // base = common ancestor. When the lane is strictly behind main (no divergence) the common\n // ancestor IS the lane head, so the lane's own aspects serve as the base.\n const baseSnap = divergeData.commonSnapBeforeDiverge;\n const baseVersion = baseSnap ? await modelComponent.loadVersion(baseSnap.toString(), repo) : currentVersion;\n\n const configMerger = new ComponentConfigMerger(\n laneComp.id.toStringWithoutVersion(),\n workspaceIds,\n undefined, // merging from main (the default lane) — there's no Lane object for it\n currentVersion.extensions,\n baseVersion.extensions,\n otherVersion.extensions,\n laneId.toString(),\n mainLaneId.toString(),\n this.logger,\n 'ours' as MergeStrategy // keep the PR's config on a genuine conflict\n );\n const mergedConfig = configMerger.merge().getSuccessfullyMergedConfig();\n if (!mergedConfig || !Object.keys(mergedConfig).length) continue;\n\n // Strip dependency deletion markers (version: '-'); the aspects-merger applies mergedConfig\n // as-is, so a leftover '-' would land in the policy.\n this.filterDeletedDependenciesFromConfig(mergedConfig);\n\n // Upsert: addEntry throws if an entry for this component already exists. A prior\n // --keep-lane run that crashed mid-snap (or otherwise left unmerged.json entries behind)\n // would otherwise make every later run throw here, skip the component, and keep serving\n // stale config. Remove any existing entry first so repeated runs converge on main's latest.\n legacyScope.objects.unmergedComponents.removeComponent(laneComp.id);\n legacyScope.objects.unmergedComponents.addEntry({\n id: { scope: laneComp.id.scope, name: laneComp.id.fullName },\n head: mainHead,\n laneId: mainLaneId,\n mergedConfig,\n });\n syncedIds.push(laneComp.id);\n this.logger.console(\n chalk.blue(\n ` ${laneComp.id.toStringWithoutVersion()}: applying main's config (${Object.keys(mergedConfig).join(', ')})`\n )\n );\n } catch (e: any) {\n // Best-effort per component: one component's config-merge quirk shouldn't abort the whole\n // `bit ci pr`. Log and move on — the build just won't reflect that component's main-side\n // config this run.\n this.logger.console(\n chalk.yellow(` ${laneComp.id.toStringWithoutVersion()}: skipping config sync from main (${e?.message || e})`)\n );\n }\n }\n\n if (!syncedIds.length) {\n this.logger.console(chalk.blue('No config changes from main to sync'));\n return;\n }\n await legacyScope.objects.unmergedComponents.write();\n // The components were already loaded (and their aspects cached) earlier in this run, before the\n // unmergedComponents entries existed. Clear the cache so the upcoming `snap` reloads them and\n // the aspects-merger folds in the synced `mergedConfig`.\n this.workspace.clearAllComponentsCache();\n this.logger.console(chalk.green(`Synced config from main for ${syncedIds.length} component(s)`));\n }\n\n /**\n * Batch-fetch main-side Version objects the config merge needs (heads, then common ancestors),\n * mirroring the lane-merge flows (merge-status-provider / merge-lanes). Best-effort: a fetch\n * hiccup shouldn't abort `bit ci pr` — the merge loop still runs and any component whose object is\n * still missing just logs the existing per-component skip. `label` names which objects for the log.\n */\n private async prefetchFromMainForConfigSync(ids: ComponentID[], label: string) {\n if (!ids.length) return;\n try {\n await this.importer.importObjectsFromMainIfExist(ids, { cache: true });\n } catch (e: any) {\n this.logger.console(\n chalk.yellow(`Could not pre-fetch main's ${label} for config sync (continuing): ${e?.message || e}`)\n );\n }\n }\n\n /**\n * Copied from `merging.main.runtime` (`filterDeletedDependenciesFromConfig`): the config merge\n * can emit deletion markers (`version: '-'`) for deps removed on main. The aspects-merger applies\n * `mergedConfig` verbatim, so strip those here to avoid writing a policy entry with version '-'.\n */\n private filterDeletedDependenciesFromConfig(mergeConfig?: Record<string, any>): void {\n const policy: Record<string, Array<{ version?: string }>> | undefined =\n mergeConfig?.[DependencyResolverAspect.id]?.policy;\n if (!policy) return;\n Object.keys(policy).forEach((depType) => {\n const filtered = policy[depType].filter((dep) => dep.version !== '-');\n if (filtered.length === 0) delete policy[depType];\n else policy[depType] = filtered;\n });\n }\n\n /**\n * Best-effort, fetch-free check for whether the current (PR) branch is *behind* the default\n * branch — i.e. the default branch has commits the PR branch doesn't contain.\n *\n * We intentionally do NOT `git fetch` here (a fetch in CI can hang on an interactive SSH\n * host-key prompt — that's why `isStaleCiRun` was removed in #10300). We compare against\n * whatever `origin/<default>` ref the checkout already has, which reflects the state the default\n * branch was in when this CI run started — exactly the reference point we care about.\n *\n * Returns true only when we can *confirm* the branch is behind. If the ref can't be resolved or\n * anything else goes wrong, returns false (treat as \"not behind\" / proceed) so we never silently\n * disable the main→lane config propagation.\n */\n private async isBranchBehindDefaultBranch(): Promise<boolean> {\n try {\n const defaultBranch = await this.getDefaultBranchName();\n const defaultRefSha = (await git.revparse([`refs/remotes/origin/${defaultBranch}`])).trim();\n const headSha = (await git.revparse(['HEAD'])).trim();\n if (defaultRefSha === headSha) return false; // identical → up to date\n // We deliberately do NOT use `merge-base --is-ancestor`: it reports the answer via exit code\n // (0 = ancestor, 1 = not), but simple-git's `raw` resolves rather than rejects on exit code\n // 1, so the \"not an ancestor\" case was silently read as \"is an ancestor\" — the behind check\n // never fired. Instead compute the merge-base and compare: `merge-base(A, B) === A` iff A is\n // an ancestor of B. When origin/<default> is an ancestor of HEAD the PR already contains it\n // (not behind); otherwise the default branch has commits HEAD doesn't (behind).\n const mergeBase = (await git.raw(['merge-base', defaultRefSha, headSha])).trim();\n return mergeBase !== defaultRefSha;\n } catch (err: any) {\n this.logger.console(\n chalk.yellow(\n `Could not determine whether the PR branch is up to date with the default branch ` +\n `(proceeding as if up to date): ${err?.message || err}`\n )\n );\n return false;\n }\n }\n\n async verifyWorkspaceStatus() {\n await this.verifyWorkspaceStatusInternal();\n\n this.logger.console('🔨 Build Process');\n const components = await this.workspace.list();\n\n this.logger.console(chalk.blue(`Building ${components.length} components`));\n\n const build = await this.builder.build(components);\n\n build.throwErrorsIfExist();\n\n this.logger.console(chalk.green('Components built'));\n\n return { code: 0, data: '' };\n }\n\n async snapPrCommit({\n laneIdStr,\n message,\n build,\n strict,\n dryRun,\n keepLane,\n skipCleanup,\n skipTasks,\n noDestructiveRecovery,\n }: {\n laneIdStr: string;\n message: string;\n build: boolean | undefined;\n strict: boolean | undefined;\n dryRun?: boolean;\n keepLane?: boolean;\n skipCleanup?: boolean;\n skipTasks?: string;\n /**\n * Opt out of the `--keep-lane` stale-lane recovery that deletes the remote lane and recreates it\n * from main. That trade is fine for a PR lane (a throwaway mirror of a git branch, recreated on\n * every commit) but unacceptable for `bit ci sync`, where the lane is the *authored* artifact and\n * the branch is its mirror — deleting it would destroy the very thing being synced. When set, the\n * stale-lane case throws instead, which the sync executor surfaces as a halt for a human.\n */\n noDestructiveRecovery?: boolean;\n }) {\n // The post-export cleanup switches the workspace back to main, which re-checks-out main's HEAD\n // and re-imports every workspace component — pointless when the workspace is about to be\n // discarded. It's opt-in via `--skip-cleanup` (the `bit_pr` CI job passes it) rather than\n // auto-detected from `process.env.CI`: other CI contexts *reuse* the workspace after `bit ci pr`\n // (e.g. the e2e suite, which then tags/asserts on main), and must keep restoring it.\n const resolvedSkipCleanup = Boolean(skipCleanup);\n\n // Skipping build/publish tasks is OPT-IN per PR: the build runs the full pipeline by default, and\n // a developer adds a `[skip-tasks: <names>]` token to the commit message to trade specific tasks\n // for speed on that PR (e.g. `[skip-tasks: GeneratePreview,ExtractSchema]`) without touching CI\n // config. The token merges with any explicit `--skip-tasks` flag, and is stripped from the message\n // so it doesn't leak into the snap message.\n const { skipTasks: messageSkipTasks, message: resolvedMessage } = extractSkipTasksFromMessage(message);\n const cliSkipTasks = skipTasks\n ? skipTasks\n .split(',')\n .map((task) => task.trim())\n .filter(Boolean)\n : [];\n const mergedSkipTasks = [...new Set([...cliSkipTasks, ...messageSkipTasks])];\n const resolvedSkipTasks = mergedSkipTasks.length ? mergedSkipTasks.join(',') : undefined;\n if (messageSkipTasks.length) {\n this.logger.console(chalk.blue(`Skipping tasks from commit message: ${messageSkipTasks.join(', ')}`));\n }\n\n this.logger.console(chalk.blue(`Lane name: ${laneIdStr}`));\n\n const originalLane = await this.lanes.getCurrentLane();\n\n const laneId = await this.lanes.parseLaneId(laneIdStr);\n\n await this.verifyWorkspaceStatusInternal(strict);\n\n await this.importer\n .import({\n ids: [],\n installNpmPackages: false,\n writeConfigFiles: false,\n })\n .catch((e) => {\n throw new Error(`Failed to import components: ${e.toString()}`);\n });\n\n this.logger.console('🔄 Lane Management');\n\n // `--keep-lane` opts into reusing the same remote lane across subsequent commits to a PR, so\n // the lane's history and any lane-based UI edits on Bit Cloud survive. Without it we use the\n // default, battle-tested flow: snap onto a throwaway temp lane and delete+recreate the final\n // lane at export time (the lane is recreated on every PR commit).\n if (keepLane) {\n return this.snapAndExportReusingLane({\n laneId,\n originalLane,\n message: resolvedMessage,\n build,\n dryRun,\n skipCleanup: resolvedSkipCleanup,\n skipTasks: resolvedSkipTasks,\n noDestructiveRecovery,\n });\n }\n return this.snapAndExportWithTempLane({\n laneId,\n originalLane,\n message: resolvedMessage,\n build,\n dryRun,\n skipCleanup: resolvedSkipCleanup,\n skipTasks: resolvedSkipTasks,\n });\n }\n\n /**\n * Post-export cleanup: restore the workspace to the original lane / main so an interactive\n * `bit ci pr` leaves you where you started. `switchToLane('main')` re-checks-out main's HEAD,\n * which re-imports every workspace component — on a large monorepo that's minutes of work for a\n * workspace that, in CI, is thrown away the moment the command exits. Hence `skipCleanup`.\n * Wrapped so a restore failure only warns instead of throwing out of the caller's `finally` and\n * masking the real error from snap/export. Returns whether the switch actually ran (callers use\n * it to decide whether follow-up lane bookkeeping that assumes we left the lane is safe).\n */\n private async restoreWorkspaceAfterPr(originalLane: Lane | undefined, skipCleanup: boolean): Promise<boolean> {\n this.logger.console('🔄 Cleanup');\n if (skipCleanup) {\n this.logger.console(\n chalk.yellow('Skipping workspace restore (--skip-cleanup) — leaving the workspace on the PR lane')\n );\n return false;\n }\n const targetLane = originalLane?.name ?? 'main';\n this.logger.console(chalk.blue(`Switching back to ${targetLane}`));\n const longProcessLogger = this.logger.createLongProcessLogger(`restoring workspace to ${targetLane}`);\n try {\n const currentLane = await this.lanes.getCurrentLane();\n if (currentLane) {\n // switchToLane catches its own errors and *returns* them (never throws), so a failed switch\n // would otherwise slip through as a success. Treat a returned error as \"did not switch\" so\n // callers don't run follow-up bookkeeping (e.g. temp-lane removal) while still on the lane.\n const switchErr = await this.switchToLane(targetLane);\n if (switchErr) {\n this.logger.consoleWarning(`Cleanup after PR snap failed: ${switchErr.message}`);\n return false;\n }\n } else {\n this.logger.console(chalk.yellow('Already on main, checking out to head'));\n await this.lanes.checkout.checkout({ head: true, skipNpmInstall: true });\n }\n return true;\n } catch (cleanupErr: any) {\n this.logger.consoleWarning(`Cleanup after PR snap failed: ${cleanupErr.message}`);\n return false;\n } finally {\n longProcessLogger.end();\n }\n }\n\n /**\n * `--keep-lane` flow: reuse the existing remote lane (or create it on the first run), merge main\n * into it to pick up config changes that landed since the fork, snap, and export with\n * adopt-on-conflict recovery for concurrent CI pushes. The lane object is preserved across PR\n * commits, so its history and lane-based UI edits on Bit Cloud survive.\n */\n private async snapAndExportReusingLane({\n laneId,\n originalLane,\n message,\n build,\n dryRun,\n skipCleanup,\n skipTasks,\n noDestructiveRecovery,\n }: {\n laneId: LaneId;\n originalLane: Lane | undefined;\n message: string;\n build: boolean | undefined;\n dryRun?: boolean;\n skipCleanup: boolean;\n skipTasks?: string;\n noDestructiveRecovery?: boolean;\n }) {\n // Query the remote (by name, to avoid fetching all lanes) so we know whether to reuse or create\n const existingLanes = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name }).catch((e) => {\n if (e.toString().includes('was not found')) return [];\n throw new Error(`Failed to check lane ${laneId.toString()}: ${e.toString()}`);\n });\n const laneExists = existingLanes.length > 0;\n\n let foundErr: Error | undefined;\n try {\n if (laneExists) {\n // Reuse the existing remote lane so that the lane history, lane-based UI edits, and\n // lane-history feature on Bit Cloud all survive across subsequent commits to the same PR.\n // switchToLane fetches the latest lane head from remote.\n this.logger.console(chalk.blue(`Lane ${laneId.toString()} exists on remote, reusing it`));\n const switchErr = await this.switchToLane(laneId.toString());\n // switchToLane returns the caught error (undefined on success). Combine with a\n // current-lane-state probe — comparing BOTH name AND scope, so a same-named lane in a\n // different scope can't masquerade as a successful switch.\n const switchedLane = await this.lanes.getCurrentLane();\n const landedOnLane = switchedLane?.name === laneId.name && switchedLane?.scope === laneId.scope;\n if (landedOnLane) {\n // Sync config-only changes from main onto the lane, so config that was tagged into\n // objects on main since the lane forked (e.g. `bit deps set` / `bit env set` from\n // another PR, not visible via the workspace's git checkout) is reflected on the lane.\n // Source files are git's job — see syncConfigFromMain.\n //\n // BUT only when the PR branch is actually up to date with the default branch. If the PR\n // is behind (hasn't pulled main's latest), its git checkout still reflects the older\n // fork point, so pulling main's newer config onto the lane would desync the lane from\n // the source. The author merges the default branch into their PR in git; the next\n // `bit ci pr` then propagates it here.\n if (await this.isBranchBehindDefaultBranch()) {\n this.logger.console(\n chalk.yellow(\n `PR branch is behind the default branch — skipping config sync from main. ` +\n `Merge or rebase the default branch into your PR to pick up main's latest config.`\n )\n );\n } else {\n await this.syncConfigFromMain(laneId);\n }\n } else {\n // Switch failed even though the remote lane exists. The destructive recovery below\n // (delete the remote lane + recreate fresh) is safe only when the failure is the\n // specific \"stale lane\" pattern — the lane references a ModelComponent the PR has\n // since removed/renamed (`unable to merge lane …, the component … was not found`).\n // For any other failure (transient network blip during fetch, auth error, lane locked\n // by Cloud UI, etc.) destroying lane history would be the wrong response, so we\n // rethrow and let the caller report the real cause.\n const errMsg = switchErr?.toString() ?? '';\n const isStaleLane = errMsg.includes('unable to merge lane');\n if (!isStaleLane) {\n throw new Error(\n `Failed to switch to remote lane ${laneId.toString()}: ${errMsg || '(no error captured)'}. ` +\n `Refusing destructive recovery for this failure class — the error doesn't match the ` +\n `stale-lane marker, so deleting the lane could destroy real history. Investigate or retry.`\n );\n }\n if (noDestructiveRecovery) {\n // `bit ci sync` mirrors an authored lane onto a branch. Recovering by deleting the remote\n // lane and re-forking it from main would discard the lane's components and history — the\n // exact artifact the sync exists to preserve — and the next sync would then happily\n // mirror the now-empty lane onto the branch. Fail loudly instead; the executor turns this\n // into a halt so a human resolves the lane on bit.cloud.\n throw new Error(\n `Failed to switch to remote lane ${laneId.toString()}: ${errMsg || '(no error captured)'}. ` +\n `The stale-lane recovery (delete the remote lane and recreate it from main) is disabled ` +\n `for this caller, because the lane is an authored artifact rather than a throwaway PR ` +\n `lane. Resolve the lane on bit.cloud and re-run.`\n );\n }\n this.logger.console(\n chalk.yellow(\n `Stale remote lane ${laneId.toString()} — switching failed. ` +\n `Deleting it and creating a fresh lane to recover.`\n )\n );\n // Re-check the remote lane's hash immediately before deleting. The central-hub delete\n // API is name-based — there's no compare-and-swap — so two CI jobs racing the same\n // recovery could otherwise have job B delete job A's freshly-recreated lane. By\n // re-fetching here we shrink the TOCTOU window to milliseconds: if A's recreate landed\n // before our re-fetch, the hash changed and we skip the delete entirely. The downstream\n // export then hits the lane-hash mismatch and lands in `exportWithAdoptOnConflict`,\n // which rebases our snaps onto the winner's lane — no destroyed history.\n const staleHash = existingLanes[0]?.hash;\n const recheck = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name }).catch(() => []);\n const currentRemoteHash = recheck[0]?.hash;\n const remoteChanged = staleHash && currentRemoteHash && currentRemoteHash !== staleHash;\n if (remoteChanged) {\n this.logger.console(\n chalk.blue(\n `Remote lane ${laneId.toString()} changed since we first checked (hash ` +\n `${staleHash.slice(0, 9)} → ${currentRemoteHash.slice(0, 9)}) — another concurrent ` +\n `recovery already recreated it. Skipping the delete; export will adopt-on-conflict.`\n )\n );\n } else {\n await this.lanes.removeLanes([laneId.toString()], { remote: true, force: true }).catch((e) => {\n const msg = e?.toString() ?? '';\n // Tolerate the race where another concurrent recovery deleted the lane first — the\n // desired post-condition (lane gone from remote) is already met.\n if (msg.includes('was not found') || msg.includes('not found')) {\n this.logger.console(chalk.blue(`Remote lane ${laneId.toString()} was already gone — proceeding`));\n return;\n }\n throw new Error(`Failed to delete stale remote lane ${laneId.toString()}: ${msg || e}`);\n });\n }\n // switchToLane fetched the remote lane and persisted it into the local scope's lane\n // index (via `importLaneObject` → `legacyScope.lanes.saveLane`) BEFORE the underlying\n // merge failed. Without dropping that local copy here, the upcoming `createLane` would\n // hit the \"lane … already exists\" guard in create-lane.ts. Same trash-the-local-object\n // pattern as `rebaseOntoRemoteLane`.\n const legacyScope = this.workspace.scope.legacyScope;\n const localLane = await legacyScope.loadLane(laneId);\n if (localLane) {\n await legacyScope.objects.moveObjectsToTrash([localLane.hash()]);\n }\n // Reset the workspace's current-lane pointer to main before createLane, so the new lane\n // is forked from main with an empty component list. `createLane` populates new lanes\n // from `consumer.getCurrentLaneObject()` regardless of `forkLaneNewScope` (which only\n // suppresses the cross-scope guard) — if `originalLane` is non-default (a developer\n // running `bit ci pr` from a lane), without this reset the \"fresh\" lane would silently\n // inherit `originalLane`'s components. Check the return value: a silent failure here\n // would defeat the whole point of the reset.\n const resetErr = await this.switchToLane('main');\n const afterReset = await this.lanes.getCurrentLane();\n if (resetErr || afterReset) {\n throw new Error(\n `Failed to reset to main before recreating ${laneId.toString()}: ` +\n `${resetErr?.toString() ?? `(still on lane \"${afterReset?.name}\")`}. ` +\n `Aborting to avoid silently forking the recreated lane from the wrong source.`\n );\n }\n const createLaneResult = await this.lanes.createLane(laneId.name, {\n scope: laneId.scope,\n forkLaneNewScope: true,\n });\n this.logger.console(chalk.blue(`Recreated lane ${laneId.toString()} (hash: ${createLaneResult.hash})`));\n }\n } else {\n this.logger.console(chalk.blue(`Creating lane ${laneId.toString()}`));\n const createLaneResult = await this.lanes.createLane(laneId.name, {\n scope: laneId.scope,\n forkLaneNewScope: true,\n });\n this.logger.console(chalk.blue(`Created lane ${laneId.toString()} (hash: ${createLaneResult.hash})`));\n }\n\n const currentLane = await this.lanes.getCurrentLane();\n this.logger.console(chalk.blue(`Current lane: ${currentLane?.name ?? 'main'}`));\n if (currentLane?.name !== laneId.name) {\n throw new Error(`Expected to be on lane ${laneId.name}, but current lane is ${currentLane?.name ?? 'main'}`);\n }\n\n this.logger.console('📦 Snapping Components');\n const results = await this.snapping.snap({\n message,\n build,\n exitOnFirstFailedTask: true,\n skipTasks,\n });\n\n if (!results) {\n this.logger.console(chalk.yellow('No changes detected, nothing to snap'));\n return 'No changes detected, nothing to snap';\n }\n\n const { snappedComponents }: SnapResults = results;\n\n const snapOutput = snapResultOutput(results);\n this.logger.console(snapOutput);\n\n if (dryRun) {\n this.logger.console(chalk.yellow('🏃 Dry-run mode: skipping export'));\n this.logger.console(chalk.green(`Snapped ${snappedComponents.length} component(s) successfully`));\n return snapOutput;\n }\n\n this.logger.console(chalk.blue(`Exporting ${snappedComponents.length} components`));\n await this.exportWithAdoptOnConflict(laneId, snappedComponents);\n } catch (e: any) {\n foundErr = e;\n throw e;\n } finally {\n if (foundErr) {\n this.logger.console(chalk.red(`Found error: ${foundErr.message}`));\n }\n await this.restoreWorkspaceAfterPr(originalLane, skipCleanup);\n }\n }\n\n /**\n * Default flow: snap onto a uniquely-named temporary lane, then at export time delete any\n * existing remote lane and rename the temp lane to the final name. The temp name minimizes the\n * race window when multiple CI jobs run concurrently on the same branch. Trade-off: the final\n * lane is recreated on every PR commit, so its history and any lane-based UI edits on Bit Cloud\n * don't survive across commits — use `--keep-lane` for that.\n */\n private async snapAndExportWithTempLane({\n laneId,\n originalLane,\n message,\n build,\n dryRun,\n skipCleanup,\n skipTasks,\n }: {\n laneId: LaneId;\n originalLane: Lane | undefined;\n message: string;\n build: boolean | undefined;\n dryRun?: boolean;\n skipCleanup: boolean;\n skipTasks?: string;\n }) {\n // Use unique temp lane name to avoid race conditions when multiple CI jobs run concurrently\n const tempLaneName = `${laneId.name}-${generateRandomStr(5)}`;\n\n let foundErr: Error | undefined;\n let renamedToFinalName = false;\n try {\n const createLaneResult = await this.lanes.createLane(tempLaneName, {\n scope: laneId.scope,\n forkLaneNewScope: true,\n });\n this.logger.console(\n chalk.blue(`Created temporary lane ${laneId.scope}/${tempLaneName} (hash: ${createLaneResult.hash})`)\n );\n\n const currentLane = await this.lanes.getCurrentLane();\n\n this.logger.console(chalk.blue(`Current lane: ${currentLane?.name ?? 'main'}`));\n\n if (currentLane?.name !== tempLaneName) {\n throw new Error(\n `Expected to be on lane ${tempLaneName} after creation, but current lane is ${currentLane?.name ?? 'main'}`\n );\n }\n\n this.logger.console('📦 Snapping Components');\n const results = await this.snapping.snap({\n message,\n build,\n exitOnFirstFailedTask: true,\n skipTasks,\n });\n\n if (!results) {\n // No changes to snap - switch back to main and remove the temp lane we created\n this.logger.console(chalk.yellow('No changes detected, removing temporary lane'));\n await this.switchToLane(originalLane?.name ?? 'main');\n await this.lanes.removeLanes([tempLaneName], { remote: false, force: true });\n return 'No changes detected, nothing to snap';\n }\n\n const { snappedComponents }: SnapResults = results;\n\n const snapOutput = snapResultOutput(results);\n this.logger.console(snapOutput);\n\n if (dryRun) {\n this.logger.console(chalk.yellow('🏃 Dry-run mode: skipping export, lane deletion, and rename'));\n this.logger.console(chalk.green(`Snapped ${snappedComponents.length} component(s) successfully`));\n this.logger.console(\n chalk.blue(\n `Temporary lane \"${laneId.scope}/${tempLaneName}\" kept for debugging. Remove it with: bit lane remove ${laneId.scope}/${tempLaneName}`\n )\n );\n return snapOutput;\n }\n\n // Finalize atomically: delete existing lane, rename temp lane, export\n this.logger.console('🔄 Finalizing Lane');\n\n // Check if original lane exists on remote and delete it (query by name to avoid fetching all lanes)\n const existingLanes = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name }).catch((e) => {\n // Lane not found is expected on first run - just means nothing to delete\n if (e.toString().includes('was not found')) {\n return [];\n }\n throw new Error(`Failed to check lane ${laneId.toString()}: ${e.toString()}`);\n });\n\n if (existingLanes.length) {\n this.logger.console(chalk.blue(`Deleting existing remote lane ${laneId.toString()}`));\n const archiveResult = await this.archiveLane(laneId.toString(), true); // throwOnError: delete must succeed before export\n if (archiveResult === 'not-found') {\n // `getLanes` just reported the lane exists, but the delete API says \"not found\". Re-query\n // to confirm. If the lane still shows up, something is off on the remote (delete can't\n // see what list/export can), and retrying will never converge.\n let stillExists;\n try {\n stillExists = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name });\n } catch (verifyErr: any) {\n throw new Error(\n `failed to verify whether remote lane ${laneId.toString()} still exists after delete returned \"not found\": ${verifyErr?.message || verifyErr}`\n );\n }\n if (stillExists.length) {\n throw new Error(\n `unable to delete remote lane ${laneId.toString()}: the remote reports the lane as \"not found\" from ` +\n `the delete API but still lists it from the query API. maybe this is a remote issue on bit.cloud. ` +\n `please contact support or manually delete the lane on bit.cloud before re-running CI.`\n );\n }\n }\n }\n\n // Rename temp lane to original name\n this.logger.console(chalk.blue(`Renaming lane from ${tempLaneName} to ${laneId.name}`));\n await this.lanes.rename(laneId.name, tempLaneName);\n renamedToFinalName = true;\n\n // Export with the correct name. Retry on hash-mismatch, which indicates a concurrent CI job\n // pushed the same lane id between our pre-export delete and our merge on the hub.\n this.logger.console(chalk.blue(`Exporting ${snappedComponents.length} components`));\n const exportResults = await this.exportWithRetryOnLaneHashMismatch(laneId.toString());\n this.logger.console(chalk.green(`Exported ${exportResults.componentsIds.length} components`));\n } catch (e: any) {\n foundErr = e;\n throw e;\n } finally {\n if (foundErr) {\n this.logger.console(chalk.red(`Found error: ${foundErr.message}`));\n }\n const switchedBack = await this.restoreWorkspaceAfterPr(originalLane, skipCleanup);\n\n // Clean up orphaned temporary lane on error. Skip if the rename to the final name already\n // happened - in that case the temp name no longer exists locally, and the lane under the\n // final name may have been partially exported; leave it alone rather than wipe evidence.\n // Also requires having switched off the temp lane first — you can't remove the lane you're\n // currently on, so when the restore was skipped, leave the (local, soon-discarded) temp lane.\n if (switchedBack && foundErr && !renamedToFinalName) {\n const tempLaneFullName = `${laneId.scope}/${tempLaneName}`;\n this.logger.console(chalk.blue(`Cleaning up temporary lane ${tempLaneFullName}`));\n try {\n await this.lanes.removeLanes([tempLaneFullName], { remote: false, force: true });\n this.logger.console(chalk.green(`Removed temporary lane ${tempLaneFullName}`));\n } catch (cleanupErr: any) {\n // Ignore cleanup errors to avoid masking the original error\n this.logger.console(chalk.yellow(`Failed to clean up temporary lane: ${cleanupErr?.message || cleanupErr}`));\n }\n }\n }\n }\n\n /**\n * Export with a recovery path for the two concurrent-CI conflicts that can surface from the\n * remote (see the marker constants at the top of the file): lane-hash mismatch (both runners\n * created fresh lane objects when the lane didn't yet exist on the remote) and per-component\n * divergence (both reused the existing lane but snapped the same component with different\n * content).\n *\n * Recovery: adopt-the-winner. The remote lane (whoever pushed first) becomes canonical. We\n * drop our local lane object, fetch the remote, rebase our snapped Version objects so each\n * one's parent points to the remote head for that component, then swap those rebased Versions\n * in as the new lane heads and re-export. Build artifacts are preserved — only the parent\n * pointers on the Version objects change. Result: both runners' snaps end up chained on a\n * single lane object (last-writer-wins on content for any contested component, with the\n * winner's snap preserved in history as the parent).\n */\n private async exportWithAdoptOnConflict(laneId: LaneId, snappedComponents: ConsumerComponent[]) {\n try {\n const exportResults = await this.exporter.export();\n this.logger.console(chalk.green(`Exported ${exportResults.componentsIds.length} components`));\n return;\n } catch (e: any) {\n const msg = e?.message || e?.toString() || '';\n const isLaneHashMismatch = msg.includes(LANE_HASH_MISMATCH_MARKER);\n const isComponentDivergence = msg.includes(COMPONENT_DIVERGENCE_MARKER);\n if (!isLaneHashMismatch && !isComponentDivergence) throw e;\n const cause = isLaneHashMismatch ? 'Lane hash mismatch' : 'Per-component divergence';\n this.logger.console(\n chalk.yellow(\n `${cause} on \"${laneId.toString()}\" — likely a concurrent CI push. Adopting the remote lane and rebasing local snaps onto its heads.`\n )\n );\n }\n\n const snappedHeads = snappedComponents.map((c) => {\n // A just-snapped component always has a version; guard defensively so a missing one fails\n // with a clear message instead of `Ref.from(undefined)`'s opaque \"hash argument is empty\".\n if (!c.version) {\n throw new Error(\n `unable to recover from the lane-hash mismatch: snapped component \"${c.id.toString()}\" has no version to rebase onto the remote lane`\n );\n }\n return { id: c.id, head: Ref.from(c.version) };\n });\n\n await this.rebaseOntoRemoteLane(laneId, snappedHeads);\n\n this.logger.console(chalk.blue('Retrying export with rebased snaps'));\n const exportResults = await this.exportWithBusyRetry();\n this.logger.console(chalk.green(`Exported ${exportResults.componentsIds.length} components after rebase`));\n }\n\n /**\n * Wrap `exporter.export()` with retry on the \"server is busy\" error. The retried export's\n * pending-dir lands behind whichever concurrent client is still in the remote's queue (we\n * arrived second by definition — we're the loser of the original race). The 60s wait inside\n * `export-validate.waitIfNeeded` covers the common case, but on slow CI hosts or large pushes\n * we sometimes time out before the other client finishes its persist. A short sleep + retry\n * here just gives the queue room to drain.\n */\n private async exportWithBusyRetry(maxAttempts = 3) {\n const isBusyErr = (err: any) => (err?.message || err?.toString() || '').includes('server is busy by other exports');\n let lastErr: any;\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n try {\n return await this.exporter.export();\n } catch (e: any) {\n lastErr = e;\n if (!isBusyErr(e)) throw e;\n this.logger.console(\n chalk.yellow(\n `Export attempt ${attempt}/${maxAttempts} blocked by a busy remote queue. Waiting before retrying.`\n )\n );\n await new Promise((resolve) => setTimeout(resolve, 2000 * attempt));\n }\n }\n throw lastErr;\n }\n\n private async rebaseOntoRemoteLane(laneId: LaneId, snappedHeads: Array<{ id: ComponentID; head: Ref }>) {\n const legacyScope = this.workspace.scope.legacyScope;\n const repo = legacyScope.objects;\n\n // Our local lane object (the one we just snapped onto) shares the LaneId with the remote\n // (winning) lane but has a different, randomly-minted hash. Fetching the remote lane writes it\n // into our scope via `sources.mergeLane`, which rejects a same-id/different-hash lane (\"a lane\n // with the same id already exists with a different hash\") — so we must drop our local lane\n // object BEFORE the fetch, not after. We can't use `lanes.removeLanes` (it refuses to remove\n // the currently-checked-out lane), so we trash the lane object directly; that also removes it\n // from the scope index, so `loadLane` (the guard's lookup) no longer finds it. Only the lane\n // pointer is trashed — the Version objects we snapped stay in the scope for the rebase below,\n // and the fetch immediately re-persists a same-id lane object, satisfying the current-lane\n // workspace pointer again.\n const localLane = await legacyScope.loadLane(laneId);\n if (localLane) {\n this.logger.console(chalk.blue(`Dropping local lane object ${laneId.toString()} to adopt the remote one`));\n await repo.moveObjectsToTrash([localLane.hash()]);\n }\n\n // Fetch the remote (winning) lane and the Version objects it points at. With our local lane\n // object gone, `mergeLane` sees no conflicting same-id lane and persists the remote one.\n this.logger.console(chalk.blue(`Fetching remote lane ${laneId.toString()}`));\n const remoteLane = await this.lanes.fetchLaneWithItsComponents(laneId);\n\n // Rewrite each snapped Version's parent to point at the remote head for that component.\n // Bit's Version objects aren't content-addressed — `_hash` is set once and not derived\n // from content — so we can mutate `parents` in place. The hash stays the same, so the\n // build artifacts referenced from the Version remain valid and the lane's component head\n // doesn't need to be re-pointed. The remote receives the updated Version because our\n // first failed export attempt was rejected during the export-validate step (via\n // `sources.mergeLane`'s same-id/different-hash guard) — *before* `ExportPersist` writes any\n // files to disk — so the remote doesn't yet have this hash and won't dedupe-skip it during\n // transfer.\n for (const snap of snappedHeads) {\n const remoteComp = remoteLane.components.find((c) => c.id.isEqualWithoutVersion(snap.id));\n if (!remoteComp) continue; // component is only on our lane, not on the remote — no rebase target\n const remoteHead = remoteComp.head;\n if (snap.head.isEqual(remoteHead)) continue;\n\n const version = (await repo.load(snap.head)) as Version | undefined;\n if (!version) {\n throw new Error(\n `rebaseOntoRemoteLane: unable to load Version object for ${snap.id.toString()} hash ${snap.head.toString()}`\n );\n }\n if (version.parents.some((p) => p.isEqual(remoteHead))) continue; // already chains correctly\n\n const beforeParents = version.parents.map((p) => p.toString().slice(0, 9)).join(',');\n // Re-point only the lane-lineage parent (the first parent — the predecessor snap on the\n // lane) to the remote head, preserving any additional parents. A snap produced after\n // `syncConfigFromMain` is a merge snap whose second parent links to main's head; overwriting\n // the whole array with `[remoteHead]` would silently drop that merge edge and corrupt the\n // lane's ancestry.\n version.parents = [remoteHead, ...version.parents.slice(1)];\n const afterParents = version.parents.map((p) => p.toString().slice(0, 9)).join(',');\n this.logger.console(\n chalk.blue(\n `Rebasing ${snap.id.toString()}@${snap.head.toString().slice(0, 9)}: parents [${beforeParents}] → [${afterParents}]`\n )\n );\n repo.add(version);\n\n // Keep the local VersionHistory in sync with the rewritten parents. The first (failed)\n // export already traversed and wrote VersionHistory with this version's *original* parent;\n // without this update the re-export's diverge computation reads that stale history, never\n // sees the remote head as an ancestor, and can send the wrong version set or throw a\n // spurious \"no common snap\" error. `updateRebasedVersionHistory` only touches the entry if\n // this version already exists in the history (it does, from that first traversal).\n const modelComponent = await legacyScope.getModelComponent(snap.id);\n const versionHistory = await modelComponent.updateRebasedVersionHistory(repo, [version]);\n if (versionHistory) repo.add(versionHistory);\n }\n\n // Replace the remote lane's component heads with our snapped Versions. Anything we\n // didn't snap stays as the remote had it.\n //\n // TODO(stale-runner): if two consecutive PR commits trigger two CI runs and the older one\n // finishes last, it will rebase its (older-content) snap on top of the newer one — the\n // newer commit's snap stays in history but the lane head regresses to the older content.\n // The fix needs git-SHA-aware staleness detection (embed `git rev-parse HEAD` in the snap\n // log on creation, compare against the remote head's stored SHA on rebase, abort if our\n // commit is an ancestor of theirs). The prior `isStaleCiRun` (removed in #10300 for\n // SSH-prompt reasons) attempted this via `git fetch`; we'd want a fetch-free variant here.\n const updatedComponents: LaneComponent[] = remoteLane.components.map((c) => {\n const snap = snappedHeads.find((s) => s.id.isEqualWithoutVersion(c.id));\n return snap ? { ...c, head: snap.head } : c;\n });\n // Pick up any components we snapped that aren't on the remote lane yet (newly added on this PR).\n for (const snap of snappedHeads) {\n if (!updatedComponents.some((c) => c.id.isEqualWithoutVersion(snap.id))) {\n updatedComponents.push({ id: snap.id, head: snap.head });\n }\n }\n remoteLane.setLaneComponents(updatedComponents);\n remoteLane.hasChanged = true;\n await legacyScope.lanes.saveLane(remoteLane, { saveLaneHistory: false });\n\n await repo.persist();\n\n // Make sure the workspace's current-lane pointer points at the lane we just adopted.\n this.workspace.consumer.setCurrentLane(laneId, true);\n await this.workspace.bitMap.write();\n }\n\n async mergePr({\n message: argMessage,\n build,\n strict,\n releaseType,\n autoTagReleaseType,\n preReleaseId,\n incrementBy,\n explicitVersionBump,\n verbose,\n versionsFile,\n autoMergeResolve,\n forceTheirs,\n laneName,\n skipPush,\n noBitmapCommit,\n }: {\n message?: string;\n build?: boolean;\n strict?: boolean;\n releaseType: ReleaseType;\n autoTagReleaseType?: ReleaseType;\n preReleaseId?: string;\n incrementBy?: number;\n explicitVersionBump?: boolean;\n verbose?: boolean;\n versionsFile?: string;\n autoMergeResolve?: MergeStrategy;\n forceTheirs?: boolean;\n laneName?: string;\n skipPush?: boolean;\n noBitmapCommit?: boolean;\n }) {\n // Capture the initial commit SHA before any operations modify the repository\n const initialCommitSha = await git.revparse(['HEAD']);\n\n const message = argMessage || (await this.getGitCommitMessage());\n if (!message) {\n throw new Error('Failed to get commit message from git. Please provide a message using --message option.');\n }\n\n const currentLane = await this.lanes.getCurrentLane();\n const laneComponents = currentLane?.components;\n if (currentLane) {\n // this doesn't normally happen. we expect this mergePr to be called from the default branch, which normally checks\n // out to main lane.\n this.logger.console(chalk.blue(`Currently on lane ${currentLane.name}, switching to main`));\n await this.switchToLane('main');\n // this is needed to make sure components that were created on the lane are now available on main.\n // without this, the switch to main above, marks those components as not-available, and won't be tagged later on.\n // don't use the high-level `consumer.resetLaneNew()`, because it deletes the entire local scope.\n const changedIds = this.workspace.consumer.bitMap.resetLaneComponentsToNew();\n if (changedIds.length) {\n const changedIdsList = ComponentIdList.fromArray(changedIds);\n await this.workspace.scope.legacyScope.removeMany(changedIdsList, true);\n\n await this.workspace.clearCache();\n await this.workspace.bitMap.write('reset lane new');\n }\n\n this.logger.console(chalk.green('Switched to main lane'));\n }\n\n // Pull latest changes from remote to ensure we have the most up-to-date .bitmap\n // This prevents issues when multiple PRs are merged in sequence\n const defaultBranch = await this.getDefaultBranchName();\n this.logger.console(chalk.blue(`Pulling latest git changes from ${defaultBranch} branch`));\n\n // Check if there are any changes to stash before rebasing\n const gitStatus = await git.status();\n const hasChanges = gitStatus.files.length > 0;\n\n if (hasChanges) {\n this.logger.console(chalk.yellow('Stashing uncommitted changes before rebase'));\n await git.stash(['push', '-u', '-m', 'CI merge temporary stash']);\n }\n\n await git.pull('origin', defaultBranch, { '--rebase': 'true' });\n\n if (hasChanges) {\n this.logger.console(chalk.yellow('Restoring stashed changes after rebase'));\n await git.stash(['pop']);\n }\n\n this.logger.console(chalk.green('Pulled latest git changes'));\n\n this.logger.console('🔄 Checking out to main head');\n await this.importer.importCurrentObjects();\n\n const checkoutProps = {\n forceOurs: !forceTheirs && !autoMergeResolve, // only force ours if neither forceTheirs nor autoMergeResolve is specified\n head: true,\n skipNpmInstall: true,\n ...(forceTheirs && { forceTheirs }),\n ...(autoMergeResolve && { mergeStrategy: autoMergeResolve }),\n };\n const checkoutResults = await this.checkout.checkout(checkoutProps);\n\n await this.workspace.bitMap.write('checkout head');\n this.logger.console(reportToString(checkoutOutput(checkoutResults, checkoutProps)));\n\n if (laneComponents?.length) {\n await this.restoreLaneConfigChanges(laneComponents);\n }\n\n // Check for workspace.jsonc conflicts\n if (\n checkoutResults.workspaceConfigUpdateResult?.workspaceDepsConflicts ||\n checkoutResults.workspaceConfigUpdateResult?.workspaceConfigConflictWriteError\n ) {\n this.logger.console(chalk.red('❌ workspace.jsonc conflicts detected during checkout'));\n this.logger.console(chalk.blue('\\nTo resolve these conflicts, please run:'));\n this.logger.console(chalk.bold(' bit checkout head'));\n this.logger.console(chalk.gray('\\nThis will allow you to manually resolve the conflicts in workspace.jsonc.'));\n\n throw new Error(\n 'Cannot complete CI merge due to workspace.jsonc conflicts. Please run \"bit checkout head\" and fix the conflicts manually.'\n );\n }\n\n // Check for conflicts when using manual merge strategy\n if (autoMergeResolve === 'manual' && checkoutResults.leftUnresolvedConflicts) {\n const componentsWithConflicts =\n checkoutResults.components?.filter(\n (c) => c.filesStatus && Object.values(c.filesStatus).some((status) => status === 'manual')\n ) || [];\n\n const conflictedComponentIds = componentsWithConflicts.map((c) => c.id.toString());\n\n this.logger.console(chalk.red('❌ Merge conflicts detected during checkout'));\n this.logger.console(chalk.yellow('The following components have conflicts:'));\n conflictedComponentIds.forEach((id) => {\n this.logger.console(chalk.yellow(` - ${id}`));\n });\n this.logger.console(chalk.blue('\\nTo resolve these conflicts, please run:'));\n this.logger.console(chalk.bold(' bit checkout head'));\n this.logger.console(chalk.gray('\\nThis will allow you to manually resolve the conflicts.'));\n\n throw new Error(\n 'Cannot complete CI merge due to unresolved conflicts. Please resolve conflicts manually and try again.'\n );\n }\n\n const { status } = await this.verifyWorkspaceStatusInternal(strict);\n\n const hasSoftTaggedComponents = status.softTaggedComponents.length > 0;\n\n this.logger.console('📦 Component Operations');\n this.logger.console(chalk.blue('Tagging components'));\n const finalReleaseType = await this.determineReleaseType(releaseType, explicitVersionBump);\n const tagResults = await this.snapping.tag({\n all: true,\n message,\n build,\n failFast: true,\n persist: hasSoftTaggedComponents,\n releaseType: finalReleaseType,\n autoTagReleaseType,\n preReleaseId,\n incrementBy,\n versionsFile,\n });\n\n if (tagResults) {\n const tagOutput = tagResultOutput(tagResults);\n this.logger.console(tagOutput);\n } else {\n this.logger.console(chalk.yellow('No components to tag'));\n }\n\n const hasTaggedComponents = tagResults?.taggedComponents && tagResults.taggedComponents.length > 0;\n\n if (hasTaggedComponents) {\n this.logger.console(chalk.blue('Exporting components'));\n const exportResult = await this.exporter.export();\n\n if (exportResult.componentsIds.length > 0) {\n this.logger.console(chalk.green(`Exported ${exportResult.componentsIds.length} component(s)`));\n } else {\n this.logger.console(chalk.yellow('Nothing to export'));\n }\n\n if (noBitmapCommit) {\n this.logger.console(\n chalk.yellow(\n 'Skipping bitmap commit (--no-bitmap-commit flag). The new versions are in scope; no git commit will be created on the default branch.'\n )\n );\n this.logger.console(\n chalk.gray(\n 'Developers auto-sync their local .bitmap on the next bit command after `git pull` when `bitmapAutoSync: true` is set in workspace.jsonc.'\n )\n );\n } else {\n await this.commitAndPushBitmapChanges({ verbose, skipPush, defaultBranch });\n }\n } else {\n this.logger.console(chalk.yellow('No components were tagged, skipping export and git operations'));\n }\n\n this.logger.console(chalk.green('Merged PR'));\n\n // Enhanced lane cleanup logic\n await this.performLaneCleanup(currentLane, laneName, initialCommitSha);\n\n return { code: 0, data: '' };\n }\n\n /**\n * Stage every changed file (post-tag/export the bitmap, lockfiles, and any files\n * touched by `bit checkout head` may differ), commit with the configured message,\n * rebase against origin, and push — unless `skipPush` was passed.\n */\n private async commitAndPushBitmapChanges({\n verbose,\n skipPush,\n defaultBranch,\n }: {\n verbose?: boolean;\n skipPush?: boolean;\n defaultBranch: string;\n }) {\n this.logger.console('🔄 Git Operations');\n await git.addConfig('user.email', 'bit-ci[bot]@bit.cloud');\n await git.addConfig('user.name', 'Bit CI');\n\n const statusBeforeCommit = await git.status();\n this.logger.console(chalk.blue(`Git status before commit: ${statusBeforeCommit.files.length} files`));\n statusBeforeCommit.files.forEach((file) => {\n this.logger.console(chalk.gray(` ${file.working_dir}${file.index} ${file.path}`));\n });\n\n if (verbose && statusBeforeCommit.files.length > 0) {\n try {\n const diff = await git.diff();\n if (diff) {\n this.logger.console(chalk.blue('Git diff before commit:'));\n this.logger.console(diff);\n }\n } catch (error) {\n this.logger.console(chalk.yellow(`Failed to show git diff: ${error}`));\n }\n }\n\n // Stage everything: `bit checkout head` earlier in the flow may modify files\n // beyond .bitmap and pnpm-lock.yaml, so a narrow `git add` would miss them.\n // The two exclusions in the shared helper keep the local bit scope (`.bit`) and `node_modules` out\n // of the commit in a workspace whose `.gitignore` lacks Bit's block — otherwise this stages the\n // object store into the default branch. Same helper the sync executors use, so all three commit\n // paths agree on what counts as workspace content.\n await addAllExceptScopeAndModules();\n const commitMessage = await this.getCustomCommitMessage();\n await git.commit(commitMessage);\n\n const statusAfterCommit = await git.status();\n this.logger.console(chalk.blue(`Git status after commit: ${statusAfterCommit.files.length} files`));\n statusAfterCommit.files.forEach((file) => {\n this.logger.console(chalk.gray(` ${file.working_dir}${file.index} ${file.path}`));\n });\n\n await git.pull('origin', defaultBranch, { '--rebase': 'true' });\n if (skipPush) {\n this.logger.console(chalk.yellow('Skipping git push (--skip-push flag)'));\n return;\n }\n await git.push('origin', defaultBranch);\n }\n\n /**\n * Compare lane Version extensions with main Version extensions for each component.\n * Any config differences (e.g. env-set, deps-set) are saved to .bitmap so they survive\n * the switch from lane to main and get included in the subsequent tag.\n */\n private async restoreLaneConfigChanges(laneComponents: LaneComponent[]) {\n const scope = this.workspace.scope.legacyScope;\n const repo = scope.objects;\n let hasChanges = false;\n\n const activeComponents = laneComponents.filter((c) => !c.isDeleted);\n await Promise.all(\n activeComponents.map(async (laneComp) => {\n const laneVersion = (await repo.load(laneComp.head)) as Version;\n if (!laneVersion) {\n this.logger.console(chalk.yellow(`Warning: could not load Version object for ${laneComp.id.toString()}`));\n return;\n }\n\n const laneConfig = laneVersion.extensions.toConfigObject();\n if (!laneConfig || Object.keys(laneConfig).length === 0) return;\n\n // Get main Version for comparison\n let mainConfig: Record<string, any> = {};\n const modelComp = await scope.getModelComponentIfExist(laneComp.id.changeVersion(undefined));\n const mainHead = modelComp?.getHead();\n if (mainHead) {\n const mainVersion = (await repo.load(mainHead)) as Version;\n mainConfig = mainVersion?.extensions.toConfigObject() ?? {};\n }\n\n for (const [aspectId, config] of Object.entries(laneConfig)) {\n if (!isEqual(config, mainConfig[aspectId])) {\n const updated = this.workspace.bitMap.addComponentConfig(\n laneComp.id,\n aspectId,\n config as Record<string, any>\n );\n if (updated) hasChanges = true;\n }\n }\n })\n );\n\n if (hasChanges) {\n await this.workspace.bitMap.write('restore lane config');\n await this.workspace.clearCache();\n this.logger.console(chalk.blue('Restored config changes from lane'));\n }\n }\n\n /**\n * Performs lane cleanup by attempting to detect and delete the source lane\n * after a successful merge, even when running on the main branch\n */\n private async performLaneCleanup(currentLane: any, explicitLaneName?: string, initialCommitSha?: string) {\n this.logger.console('🗑️ Lane Cleanup');\n\n // If we already have a current lane, use it\n if (currentLane) {\n this.logger.console(chalk.blue(`Found current lane: ${currentLane.name}`));\n const laneId = currentLane.id();\n await this.archiveLane(laneId.toString());\n return;\n }\n\n // If no current lane but explicit lane name provided, try to delete it\n if (explicitLaneName) {\n this.logger.console(chalk.blue(`Using explicitly provided lane name: ${explicitLaneName}`));\n try {\n const laneId = await this.lanes.parseLaneId(explicitLaneName);\n await this.archiveLane(laneId.toString());\n return;\n } catch (e: any) {\n this.logger.console(chalk.yellow(`Failed to parse lane name '${explicitLaneName}': ${e.message}`));\n }\n }\n\n // Try to auto-detect source branch/lane name using the dedicated detector\n const sourceBranchDetector = new SourceBranchDetector(this.logger);\n const sourceBranchName = await sourceBranchDetector.getSourceBranchName(initialCommitSha);\n if (!sourceBranchName) {\n this.logger.console(chalk.yellow('No current lane and unable to detect source branch - skipping lane cleanup'));\n return;\n }\n try {\n const laneIdStr = this.convertBranchToLaneId(sourceBranchName);\n\n this.logger.console(\n chalk.blue(`Attempting to delete lane based on source branch: ${sourceBranchName} -> ${laneIdStr}`)\n );\n\n const laneId = await this.lanes.parseLaneId(laneIdStr);\n await this.archiveLane(laneId.toString());\n } catch (e: any) {\n this.logger.console(\n chalk.yellow(`Error during lane cleanup for source branch '${sourceBranchName}': ${e.message}`)\n );\n }\n }\n\n /**\n * Export with retry on lane hash-mismatch, caused by a concurrent `bit ci pr` run pushing the\n * same lane id between our pre-export delete and the hub's merge (the export takes 1-2 minutes,\n * plenty of time to race). Used by the default (temp-lane) flow. On mismatch we delete the\n * remote lane and retry — the temp-lane flow recreates the lane on every run anyway, so there's\n * no lane history to preserve. (The `--keep-lane` flow instead adopts the remote lane and\n * rebases onto it; see `exportWithAdoptOnConflict`.)\n */\n private async exportWithRetryOnLaneHashMismatch(laneIdStr: string, maxAttempts = 3) {\n const isHashMismatchErr = (err: any) => (err?.message || err?.toString() || '').includes(LANE_HASH_MISMATCH_MARKER);\n\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n try {\n return await this.exporter.export();\n } catch (e: any) {\n if (!isHashMismatchErr(e) || attempt === maxAttempts) throw e;\n this.logger.console(\n chalk.yellow(\n `Export attempt ${attempt}/${maxAttempts} failed with lane hash mismatch on \"${laneIdStr}\" (likely a concurrent CI push). Deleting remote lane and retrying.`\n )\n );\n try {\n await this.archiveLane(laneIdStr, true);\n } catch (archiveErr: any) {\n // Preserve the original export error - rethrowing the archive error would hide the real\n // reason the push was rejected.\n this.logger.console(\n chalk.yellow(\n `Failed to delete remote lane \"${laneIdStr}\" while recovering from hash mismatch: ${archiveErr?.message || archiveErr}. Rethrowing the original export error.`\n )\n );\n if (e && typeof e === 'object' && (e as any).cause == null) {\n (e as any).cause = archiveErr;\n }\n throw e;\n }\n }\n }\n throw new Error(`exportWithRetryOnLaneHashMismatch: exhausted ${maxAttempts} attempts for lane ${laneIdStr}`);\n }\n\n /**\n * Archives (deletes) a lane with proper error handling and logging.\n * @param throwOnError - if true, throws on failure (use for critical operations like pre-export cleanup)\n */\n private async archiveLane(laneId: string, throwOnError = false): Promise<'deleted' | 'not-found' | 'error'> {\n try {\n this.logger.console(chalk.blue(`Archiving lane ${laneId}`));\n // force means to remove the lane even if it was not merged. in this case, we don't care much because main already has the changes.\n const archiveLane = await this.lanes.removeLanes([laneId], { remote: true, force: true });\n if (archiveLane.length) {\n this.logger.console(chalk.green(`Lane '${laneId}' archived successfully`));\n return 'deleted';\n }\n this.logger.console(chalk.yellow(`Failed to archive lane '${laneId}' - no lanes were removed`));\n return 'not-found';\n } catch (e: any) {\n if (e.message?.includes('was not found') || e.toString().includes('was not found')) {\n this.logger.console(chalk.yellow(`Lane '${laneId}' was not found on the remote`));\n return 'not-found';\n }\n this.logger.console(chalk.red(`Error archiving lane '${laneId}': ${e.message}`));\n if (throwOnError) {\n throw new Error(`Failed to delete remote lane '${laneId}': ${e.message}`);\n }\n return 'error';\n // Don't throw the error - lane cleanup is not critical to the merge process\n }\n }\n\n /**\n * Auto-detect version bump from commit messages if no explicit version bump was provided\n */\n private async determineReleaseType(releaseType: ReleaseType, explicitVersionBump?: boolean): Promise<ReleaseType> {\n if (explicitVersionBump) {\n this.logger.console(chalk.blue(`Using explicit version bump: ${releaseType}`));\n return releaseType;\n }\n // Only auto-detect if user didn't specify any version flags\n const lastCommit = await this.getGitCommitMessage();\n if (!lastCommit) {\n this.logger.console(chalk.blue('No commit message found, using default patch'));\n return releaseType;\n }\n const detectedReleaseType = this.parseVersionBumpFromCommit(lastCommit);\n if (detectedReleaseType) {\n this.logger.console(chalk.green(`Auto-detected version bump: ${detectedReleaseType}`));\n return detectedReleaseType;\n }\n this.logger.console(chalk.blue('No specific version bump detected, using default patch'));\n return releaseType;\n }\n}\n\nfunction reportToString(result: string | { data: string }): string {\n return typeof result === 'string' ? result : result.data;\n}\n\nCiAspect.addRuntime(CiMain);\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,MAAA,YAAAA,C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AACwc,eAAI,CAACC,QAAQ,CAAkB,CAAC,CAAC;AA2xDnD,SAASvE,cAAcA,CAAC/S,MAAiC,EAAU;EACjE,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGA,MAAM,CAACtK,IAAI;AAC1D;AAEAoG,cAAQ,CAACyb,UAAU,CAAC1c,MAAM,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_harmony","data","require","_cli","_logger","_workspace","_builder","_status","_lanes","_snapping","_export","_importer","_checkout","_component","_configMerger","_dependencyResolver","_execa","_interopRequireDefault","_chalk","_ci","_ci2","_verify","_pr","_merge","_sync","_git","_componentId","_lodash","_objects","_sourceBranchDetector","_toolboxString","_toolboxPromise","_harmonyModules","_skipTasksFromMessage","_pullRequestRef","_adoptLaneNewComponents","_syncOrchestrator","_githubClient","_gitOps","_syncConfig","_syncState","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","LANE_HASH_MISMATCH_MARKER","COMPONENT_DIVERGENCE_MARKER","CiMain","constructor","workspace","builder","status","lanes","snapping","exporter","importer","checkout","logger","config","gitHostProviderSlot","provider","cli","loggerAspect","createLogger","CiAspect","id","ci","registerGitHostProvider","GitHubHostProvider","message","consoleWarning","ciCmd","CiCmd","commands","CiVerifyCmd","CiPrCmd","CiMergeCmd","CiSyncCmd","register","listGitHostProviders","values","getBranchName","process","env","GITHUB_HEAD_REF","branch","git","current","isPullRequestRef","CIRCLE_BRANCH","circlePullRequestBranch","getCirclePullRequestBranchName","Error","toString","pullRequestUrl","CIRCLE_PULL_REQUEST","CIRCLE_PULL_REQUESTS","split","undefined","pathname","URL","owner","repo","pullSegment","pullNumber","headers","Accept","GITHUB_TOKEN","Authorization","controller","AbortController","timeout","setTimeout","abort","response","fetch","signal","ok","pullRequest","json","head","ref","clearTimeout","convertBranchToLaneId","branchName","sanitizedBranch","replace","toLowerCase","defaultScope","getDefaultBranchName","result","raw","local","parseOriginHeadRef","isValidGitBranchName","remote","remoteHeadBranch","probeDefaultBranchName","originalError","branches","all","includes","console","chalk","yellow","getGitCommitMessage","commit","log","maxCount","latest","body","parseVersionBumpFromCommit","commitMessage","useExplicitBumpKeywords","blue","useConventionalCommitsForVersionBump","test","getCustomCommitMessage","commitMessageScript","parts","command","args","slice","execa","cwd","path","encoding","customMessage","stdout","trim","green","verifyWorkspaceStatusInternal","strict","statusOutput","code","formatStatusOutput","warnings","failOnError","consoleSuccess","switchToLane","laneName","options","writeAdoptedFiles","switchOptions","doSwitch","switchLanes","forceOurs","workspaceOnly","skipDependencyInstallation","failure","err","red","isLaneMissingComponentError","retryErr","adoptAndRetrySwitch","reloadWorkspace","reloadWorkspaceFromDisk","switchToLaneForSync","_reloadConsumer","hasUnsyncedWorkChanges","divergence","newComponents","modifiedComponents","stagedComponents","locallySoftRemoved","pendingUpdateDependents","mergePendingComponents","componentsDuringMergeState","some","components","sync","opts","SyncOrchestrator","syncConfigFromMain","laneId","legacyScope","scope","objects","mainLaneId","getDefaultLaneId","currentLane","getCurrentLane","workspaceIds","listIds","componentsToSync","compact","Promise","map","laneComp","hasWithoutVersion","modelComponent","getModelComponentIfExist","mainHead","isEqual","toStringWithoutVersion","mainHeadIds","changeVersion","prefetchFromMainForConfigSync","componentsToMerge","pMapPool","item","divergeData","getDivergeData","sourceHead","targetHead","throws","isTargetAhead","isDiverged","concurrency","concurrentComponentsLimit","baseIds","baseSnap","commonSnapBeforeDiverge","syncedIds","laneHead","currentVersion","loadVersion","otherVersion","baseVersion","configMerger","ComponentConfigMerger","extensions","mergedConfig","merge","getSuccessfullyMergedConfig","filterDeletedDependenciesFromConfig","unmergedComponents","removeComponent","addEntry","name","fullName","join","write","clearAllComponentsCache","ids","label","importObjectsFromMainIfExist","cache","mergeConfig","policy","DependencyResolverAspect","depType","filtered","dep","version","isBranchBehindDefaultBranch","defaultBranch","defaultRefSha","revparse","headSha","mergeBase","verifyWorkspaceStatus","list","build","throwErrorsIfExist","snapPrCommit","laneIdStr","dryRun","keepLane","skipCleanup","skipTasks","noDestructiveRecovery","resolvedSkipCleanup","Boolean","messageSkipTasks","resolvedMessage","extractSkipTasksFromMessage","cliSkipTasks","task","mergedSkipTasks","Set","resolvedSkipTasks","originalLane","parseLaneId","import","installNpmPackages","writeConfigFiles","catch","snapAndExportReusingLane","snapAndExportWithTempLane","restoreWorkspaceAfterPr","targetLane","longProcessLogger","createLongProcessLogger","switchErr","skipNpmInstall","cleanupErr","end","existingLanes","getLanes","laneExists","foundErr","switchedLane","landedOnLane","errMsg","isStaleLane","staleHash","hash","recheck","currentRemoteHash","remoteChanged","removeLanes","force","msg","localLane","loadLane","moveObjectsToTrash","resetErr","afterReset","createLaneResult","createLane","forkLaneNewScope","results","snap","exitOnFirstFailedTask","NO_CHANGES_TO_SNAP","snappedComponents","snapOutput","snapResultOutput","exportWithAdoptOnConflict","tempLaneName","generateRandomStr","renamedToFinalName","archiveResult","archiveLane","stillExists","verifyErr","rename","exportResults","exportWithRetryOnLaneHashMismatch","componentsIds","switchedBack","tempLaneFullName","export","isLaneHashMismatch","isComponentDivergence","cause","snappedHeads","c","Ref","from","rebaseOntoRemoteLane","exportWithBusyRetry","maxAttempts","isBusyErr","lastErr","attempt","resolve","remoteLane","fetchLaneWithItsComponents","remoteComp","find","isEqualWithoutVersion","remoteHead","load","parents","p","beforeParents","afterParents","add","getModelComponent","versionHistory","updateRebasedVersionHistory","updatedComponents","s","setLaneComponents","hasChanged","saveLane","saveLaneHistory","persist","consumer","setCurrentLane","bitMap","mergePr","argMessage","releaseType","autoTagReleaseType","preReleaseId","incrementBy","explicitVersionBump","verbose","versionsFile","autoMergeResolve","forceTheirs","skipPush","noBitmapCommit","initialCommitSha","laneComponents","changedIds","resetLaneComponentsToNew","changedIdsList","ComponentIdList","fromArray","removeMany","clearCache","gitStatus","hasChanges","files","stash","pull","importCurrentObjects","checkoutProps","mergeStrategy","checkoutResults","reportToString","checkoutOutput","restoreLaneConfigChanges","workspaceConfigUpdateResult","workspaceDepsConflicts","workspaceConfigConflictWriteError","bold","gray","leftUnresolvedConflicts","componentsWithConflicts","filesStatus","conflictedComponentIds","hasSoftTaggedComponents","softTaggedComponents","finalReleaseType","determineReleaseType","tagResults","tag","failFast","tagOutput","tagResultOutput","hasTaggedComponents","taggedComponents","exportResult","commitAndPushBitmapChanges","performLaneCleanup","addConfig","statusBeforeCommit","file","working_dir","index","diff","error","addAllExceptScopeAndModules","statusAfterCommit","activeComponents","isDeleted","laneVersion","laneConfig","toConfigObject","mainConfig","modelComp","getHead","mainVersion","aspectId","entries","updated","addComponentConfig","explicitLaneName","sourceBranchDetector","SourceBranchDetector","sourceBranchName","getSourceBranchName","isHashMismatchErr","archiveErr","throwOnError","lastCommit","detectedReleaseType","exports","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","BuilderAspect","StatusAspect","LanesAspect","SnappingAspect","ExportAspect","ImporterAspect","CheckoutAspect","Slot","withType","addRuntime"],"sources":["ci.main.runtime.ts"],"sourcesContent":["import type { RuntimeDefinition, SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport { CLIAspect, type CLIMain, MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, type LoggerMain, type Logger } from '@teambit/logger';\nimport { WorkspaceAspect, type Workspace } from '@teambit/workspace';\nimport { BuilderAspect, type BuilderMain } from '@teambit/builder';\nimport { StatusAspect, type StatusMain } from '@teambit/status';\nimport { LanesAspect } from '@teambit/lanes';\nimport type { SwitchLaneOptions, LanesMain } from '@teambit/lanes';\nimport { SnappingAspect, tagResultOutput, snapResultOutput } from '@teambit/snapping';\nimport type { SnapResults, SnappingMain } from '@teambit/snapping';\nimport { ExportAspect, type ExportMain } from '@teambit/export';\nimport { ImporterAspect, type ImporterMain } from '@teambit/importer';\nimport { CheckoutAspect, checkoutOutput, type CheckoutMain } from '@teambit/checkout';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { getDivergeData } from '@teambit/component.snap-distance';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport execa from 'execa';\nimport chalk from 'chalk';\nimport type { ReleaseType } from 'semver';\nimport { CiAspect } from './ci.aspect';\nimport { CiCmd } from './ci.cmd';\nimport { CiVerifyCmd } from './commands/verify.cmd';\nimport { CiPrCmd } from './commands/pr.cmd';\nimport { CiMergeCmd } from './commands/merge.cmd';\nimport { CiSyncCmd } from './commands/sync.cmd';\nimport { git } from './git';\nimport { ComponentIdList } from '@teambit/component-id';\nimport type { ComponentID } from '@teambit/component-id';\nimport { compact, isEqual } from 'lodash';\nimport type { Version, LaneComponent, Lane } from '@teambit/objects';\nimport { Ref } from '@teambit/objects';\nimport type { LaneId } from '@teambit/lane-id';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { SourceBranchDetector } from './source-branch-detector';\nimport { generateRandomStr } from '@teambit/toolbox.string.random';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentComponentsLimit } from '@teambit/harmony.modules.concurrency';\nimport { extractSkipTasksFromMessage } from './skip-tasks-from-message';\nimport { isPullRequestRef } from './pull-request-ref';\nimport { adoptAndRetrySwitch, isLaneMissingComponentError } from './sync/adopt-lane-new-components';\n\nexport type CiSwitchLaneOptions = SwitchLaneOptions & {\n /** after an adoption retry, write the adopted components' files (`checkout --reset`) */\n writeAdoptedFiles?: boolean;\n};\nimport type { CiSyncConfig } from './sync/sync-config';\nimport { SyncOrchestrator } from './sync/sync-orchestrator';\nimport type { GitHostProvider } from './sync/git-host-provider';\nimport { GitHubHostProvider } from './sync/github-client';\nimport { addAllExceptScopeAndModules, parseOriginHeadRef, remoteHeadBranch } from './sync/git-ops';\nimport { isValidGitBranchName } from './sync/sync-config';\nimport { NO_CHANGES_TO_SNAP } from './sync/sync-state';\n\n/**\n * Registered git hosts (GitHub ships built-in; others register from their own aspect).\n * @see GitHostProvider\n */\nexport type GitHostProviderSlot = SlotRegistry<GitHostProvider>;\n\n// Two distinct conflicts can surface from the remote on a concurrent `bit ci pr` race.\n// LANE_HASH_MISMATCH fires when both runners called `Lane.create` (the lane didn't exist on\n// the remote yet), so they each minted a random `sha1(v4())` hash — `sources.mergeLane` then\n// rejects the second push's lane object on hash mismatch.\n// COMPONENT_DIVERGENCE fires when the lane already exists (both runners `switchToLane`'d\n// and got the same lane hash) but they both snapped the SAME component with DIFFERENT\n// content — `mergeLane`'s per-component diverge check collects a `ComponentNeedsUpdate`\n// and throws `MergeConflictOnRemote(\"merge error occurred when exporting the component(s)…\")`.\n// Both recover through the same adopt-and-rebase path in `rebaseOntoRemoteLane`.\nconst LANE_HASH_MISMATCH_MARKER = 'a lane with the same id already exists with a different hash';\nconst COMPONENT_DIVERGENCE_MARKER = 'merge error occurred when exporting';\nexport interface CiWorkspaceConfig {\n /**\n * Path to a custom script that generates commit messages for `bit ci merge` operations.\n * The script will be executed when components are tagged and committed to the repository.\n * If not specified, falls back to the default commit message:\n * \"chore: update .bitmap and lockfiles as needed [skip ci]\"\n *\n * @example\n * ```json\n * {\n * \"teambit.git/ci\": {\n * \"commitMessageScript\": \"node scripts/generate-commit-message.js\"\n * }\n * }\n * ```\n */\n commitMessageScript?: string;\n\n /**\n * Enables automatic version bump detection from conventional commit messages.\n * When enabled, the system analyzes commit messages to determine the appropriate version bump:\n * - `feat!:` or `BREAKING CHANGE` → major version bump\n * - `feat:` → minor version bump\n * - `fix:` → patch version bump\n *\n * Only applies when no explicit version flags (--patch, --minor, --major) are provided.\n *\n * @default false\n * @example\n * ```json\n * {\n * \"teambit.git/ci\": {\n * \"useConventionalCommitsForVersionBump\": true\n * }\n * }\n * ```\n */\n useConventionalCommitsForVersionBump?: boolean;\n\n /**\n * Enables detection of explicit version bump keywords in commit messages.\n * When enabled, the system looks for these keywords in commit messages:\n * - `BIT-BUMP-MAJOR` → major version bump\n * - `BIT-BUMP-MINOR` → minor version bump\n *\n * These keywords have higher priority than conventional commits parsing.\n * Only applies when no explicit version flags are provided.\n *\n * @default true\n * @example\n * ```json\n * {\n * \"teambit.git/ci\": {\n * \"useExplicitBumpKeywords\": true\n * }\n * }\n * ```\n */\n useExplicitBumpKeywords?: boolean;\n\n /**\n * Configuration for `bit ci sync` — bi-directional lane <-> branch/PR sync.\n * See CiSyncConfig for fields. Example:\n * { \"teambit.git/ci\": { \"sync\": { \"branchPrefix\": \"lane/\", \"lanes\": [\"*\"] } } }\n */\n sync?: CiSyncConfig;\n}\n\nexport class CiMain {\n static runtime = MainRuntime as RuntimeDefinition;\n\n static dependencies: any = [\n CLIAspect,\n WorkspaceAspect,\n LoggerAspect,\n BuilderAspect,\n StatusAspect,\n LanesAspect,\n SnappingAspect,\n ExportAspect,\n ImporterAspect,\n CheckoutAspect,\n ];\n\n static slots = [Slot.withType<GitHostProvider>()];\n\n constructor(\n private workspace: Workspace,\n\n private builder: BuilderMain,\n\n private status: StatusMain,\n\n private lanes: LanesMain,\n\n private snapping: SnappingMain,\n\n private exporter: ExportMain,\n\n private importer: ImporterMain,\n\n private checkout: CheckoutMain,\n\n private logger: Logger,\n\n private config: CiWorkspaceConfig,\n\n private gitHostProviderSlot: GitHostProviderSlot\n ) {}\n\n static async provider(\n [cli, workspace, loggerAspect, builder, status, lanes, snapping, exporter, importer, checkout]: [\n CLIMain,\n Workspace,\n LoggerMain,\n BuilderMain,\n StatusMain,\n LanesMain,\n SnappingMain,\n ExportMain,\n ImporterMain,\n CheckoutMain,\n ],\n config: CiWorkspaceConfig,\n [gitHostProviderSlot]: [GitHostProviderSlot]\n ) {\n const logger = loggerAspect.createLogger(CiAspect.id);\n const ci = new CiMain(\n workspace,\n builder,\n status,\n lanes,\n snapping,\n exporter,\n importer,\n checkout,\n logger,\n config,\n gitHostProviderSlot\n );\n // GitHub ships built-in but is not privileged: registered through the same public slot any other\n // host aspect uses. Credentials resolve lazily, so registering at aspect load is always safe.\n ci.registerGitHostProvider(new GitHubHostProvider((message) => logger.consoleWarning(message)));\n const ciCmd = new CiCmd(workspace, logger);\n ciCmd.commands = [\n new CiVerifyCmd(workspace, logger, ci),\n new CiPrCmd(workspace, logger, ci),\n new CiMergeCmd(workspace, logger, ci),\n new CiSyncCmd(workspace, logger, ci),\n ];\n cli.register(ciCmd);\n\n return ci;\n }\n\n /**\n * Register a git host (GitHub, GitLab, …) that `bit ci sync` can use for its pull-request\n * operations. Exactly one provider is selected per run, by the `origin` remote (see\n * `selectGitHostProvider`); registering a provider never changes how a repository claimed by a\n * different provider is handled.\n */\n registerGitHostProvider(provider: GitHostProvider) {\n this.gitHostProviderSlot.register(provider);\n return this;\n }\n\n /** Every registered git host provider, in registration order (one provider per registration). */\n listGitHostProviders(): GitHostProvider[] {\n return this.gitHostProviderSlot.values();\n }\n\n async getBranchName() {\n try {\n // if we are running on github, use the GITHUB_HEAD_REF env var\n if (process.env.GITHUB_HEAD_REF) return process.env.GITHUB_HEAD_REF;\n\n const branch = await git.branch();\n if (branch.current && !isPullRequestRef(branch.current)) return branch.current;\n\n // CircleCI can check out GitHub PRs as refs like \"pull/10293\". In that case the real source\n // branch is the stable lane name we also use for post-merge cleanup. Do not prefer these env\n // vars over a normal git branch; e2e tests intentionally create local feature branches while\n // running under CircleCI.\n if (process.env.CIRCLE_BRANCH && !isPullRequestRef(process.env.CIRCLE_BRANCH)) {\n return process.env.CIRCLE_BRANCH;\n }\n const circlePullRequestBranch = await this.getCirclePullRequestBranchName();\n if (circlePullRequestBranch) return circlePullRequestBranch;\n\n return branch.current;\n } catch (e: any) {\n throw new Error(`Unable to read branch: ${e.toString()}`);\n }\n }\n\n private async getCirclePullRequestBranchName(): Promise<string | undefined> {\n const pullRequestUrl = process.env.CIRCLE_PULL_REQUEST || process.env.CIRCLE_PULL_REQUESTS?.split(',')[0];\n if (!pullRequestUrl) return undefined;\n\n try {\n const { pathname } = new URL(pullRequestUrl);\n const [, owner, repo, pullSegment, pullNumber] = pathname.split('/');\n if (!owner || !repo || pullSegment !== 'pull' || !pullNumber) return undefined;\n\n const headers: Record<string, string> = {\n Accept: 'application/vnd.github+json',\n 'X-GitHub-Api-Version': '2022-11-28',\n };\n if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;\n\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5_000);\n try {\n const response = await fetch(`https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}`, {\n headers,\n signal: controller.signal,\n });\n if (!response.ok) return undefined;\n\n const pullRequest = (await response.json()) as { head?: { ref?: string } };\n return pullRequest.head?.ref;\n } finally {\n clearTimeout(timeout);\n }\n } catch {\n return undefined;\n }\n }\n\n /**\n * Converts a branch name to a lane ID string using Bit's naming conventions.\n * Sanitizes branch name by replacing slashes and dots with dashes, converting to lowercase, then\n * prefixes with the workspace's default scope.\n *\n * @param branchName - The git branch name to convert\n * @returns Lane ID in format: {defaultScope}/{sanitizedBranch}\n * @example convertBranchToLaneId(\"feature/New-Component\") => \"my-scope/feature-new-component\"\n */\n convertBranchToLaneId(branchName: string): string {\n const sanitizedBranch = branchName.replace(/[/.]/g, '-').toLowerCase();\n return `${this.workspace.defaultScope}/${sanitizedBranch}`;\n }\n\n /**\n * The repository's default branch name, whole — slashes included (see `parseOriginHeadRef`).\n * Local `origin/HEAD` symref first, then the remote's own answer, then the conventional probe.\n */\n async getDefaultBranchName(): Promise<string> {\n try {\n const result = await git.raw(['symbolic-ref', 'refs/remotes/origin/HEAD']);\n const local = parseOriginHeadRef(result);\n // Every candidate is validated before it is returned: this value becomes a checkout target and a\n // push refspec, and an option-like name (\"-x\") would be read by git as a flag. An unusable answer\n // falls through to the next source rather than reaching the argv.\n if (local && isValidGitBranchName(local)) return local;\n } catch {\n // no local origin/HEAD — normal in a fresh CI clone; ask the remote itself below.\n }\n const remote = await remoteHeadBranch();\n if (remote && isValidGitBranchName(remote)) return remote;\n return this.probeDefaultBranchName();\n }\n\n /**\n * Last-resort fallback: the two conventional names among the remote branches, then `master`.\n * Deliberately only `main`/`master` — any wider guess risks protecting the wrong branch.\n */\n private async probeDefaultBranchName(originalError?: Error): Promise<string> {\n try {\n const branches = await git.branch(['-r']);\n if (branches.all.includes('origin/main')) return 'main';\n if (branches.all.includes('origin/master')) return 'master';\n return 'master';\n } catch {\n this.logger.console(\n chalk.yellow(`Unable to detect default branch, using 'master'${originalError ? `: ${originalError}` : ''}`)\n );\n return 'master';\n }\n }\n\n async getGitCommitMessage() {\n try {\n const commit = await git.log({\n maxCount: 1,\n });\n if (!commit.latest) {\n return null;\n }\n const { message, body } = commit.latest;\n return body ? `${message}\\n\\n${body}` : message;\n } catch (e: any) {\n throw new Error(`Unable to read commit message: ${e.toString()}`);\n }\n }\n\n private parseVersionBumpFromCommit(commitMessage: string): ReleaseType | null {\n // Check explicit bump keywords (highest priority after env vars)\n if (this.config.useExplicitBumpKeywords !== false) {\n // default to true\n if (commitMessage.includes('BIT-BUMP-MAJOR')) {\n this.logger.console(chalk.blue('Found BIT-BUMP-MAJOR keyword in commit message'));\n return 'major';\n }\n if (commitMessage.includes('BIT-BUMP-MINOR')) {\n this.logger.console(chalk.blue('Found BIT-BUMP-MINOR keyword in commit message'));\n return 'minor';\n }\n }\n\n // Check conventional commits if enabled\n if (this.config.useConventionalCommitsForVersionBump) {\n // Check for breaking changes (major version bump)\n if (/^feat!(\\(.+\\))?:|^fix!(\\(.+\\))?:|BREAKING CHANGE/m.test(commitMessage)) {\n this.logger.console(chalk.blue('Found breaking changes in commit message (conventional commits)'));\n return 'major';\n }\n\n // Check for features (minor version bump)\n if (/^feat(\\(.+\\))?:/m.test(commitMessage)) {\n this.logger.console(chalk.blue('Found feature commits (conventional commits)'));\n return 'minor';\n }\n\n // Check for fixes (patch version bump) - explicit patch not needed as it's default\n if (/^fix(\\(.+\\))?:/m.test(commitMessage)) {\n this.logger.console(chalk.blue('Found fix commits (conventional commits) - using default patch'));\n return 'patch';\n }\n }\n\n return null; // No specific version bump detected\n }\n\n private async getCustomCommitMessage() {\n try {\n const commitMessageScript = this.config.commitMessageScript;\n\n if (commitMessageScript) {\n this.logger.console(chalk.blue(`Running custom commit message script: ${commitMessageScript}`));\n\n // Parse the command to avoid shell injection\n const parts = commitMessageScript.split(' ');\n const command = parts[0];\n const args = parts.slice(1);\n\n const result = await execa(command, args, {\n cwd: this.workspace.path,\n encoding: 'utf8',\n });\n const customMessage = result.stdout.trim();\n\n if (customMessage) {\n this.logger.console(chalk.green(`Using custom commit message: ${customMessage}`));\n return customMessage;\n }\n }\n } catch (e: any) {\n this.logger.console(chalk.yellow(`Failed to run custom commit message script: ${e.toString()}`));\n }\n\n // Fallback to default message\n return 'chore: update .bitmap and lockfiles as needed [skip ci]';\n }\n\n private async verifyWorkspaceStatusInternal(strict: boolean = false) {\n this.logger.console('📊 Workspace Status');\n this.logger.console(chalk.blue('Verifying status of workspace'));\n\n const status = await this.status.status({ lanes: true });\n const { data: statusOutput, code } = await this.status.formatStatusOutput(\n status,\n strict\n ? { strict: true, warnings: true } // When strict=true, fail on both errors and warnings\n : { failOnError: true, warnings: false } // By default, fail only on errors (tag blockers)\n );\n\n // Log the formatted status output\n this.logger.console(statusOutput);\n\n if (code !== 0) {\n throw new Error('Workspace status verification failed');\n }\n\n this.logger.consoleSuccess(chalk.green('Workspace status is correct'));\n return { status };\n }\n\n /**\n * Returns the caught Error on failure, or undefined on success (including the \"already checked\n * out\" no-op case). Callers that need to react to a specific failure mode (e.g. stale lane) can\n * inspect the returned error; existing callers ignore it and rely on a follow-up\n * `getCurrentLane()` check.\n *\n * A switch that fails because the lane provides a component the workspace tracks as new retries\n * once after adopting the lane's version — see `adoptNewComponentsTheLaneProvides`.\n */\n private async switchToLane(laneName: string, options: CiSwitchLaneOptions = {}): Promise<Error | undefined> {\n this.logger.console(chalk.blue(`Switching to ${laneName}`));\n const { writeAdoptedFiles, ...switchOptions } = options;\n const doSwitch = () =>\n this.lanes.switchLanes(laneName, {\n forceOurs: true,\n workspaceOnly: true,\n skipDependencyInstallation: true,\n ...switchOptions,\n });\n const failure = (err: any) => {\n this.logger.console(chalk.red(`Failed switching to ${laneName}: ${err?.toString() ?? err}`));\n return err;\n };\n try {\n await doSwitch();\n } catch (e: any) {\n if (e?.toString().includes('already checked out')) {\n this.logger.console(chalk.yellow(`Lane ${laneName} already checked out, skipping checkout`));\n return undefined;\n }\n if (!isLaneMissingComponentError(e)) return failure(e);\n const retryErr = await adoptAndRetrySwitch(laneName, e, doSwitch, writeAdoptedFiles, {\n workspace: this.workspace,\n lanes: this.lanes,\n logger: this.logger,\n checkout: this.checkout,\n reloadWorkspace: () => this.reloadWorkspaceFromDisk(),\n });\n if (retryErr) return failure(retryErr);\n }\n return undefined;\n }\n\n /**\n * Public entry point onto `switchToLane` for the lane-sync executor; returns the error instead of\n * throwing. `switchToLane` spreads caller options AFTER its defaults, so `forceOurs: true` is\n * overridable — the sync import direction depends on that. Do not reorder that spread.\n */\n async switchToLaneForSync(laneName: string, options: CiSwitchLaneOptions = {}): Promise<Error | undefined> {\n return this.switchToLane(laneName, options);\n }\n\n /**\n * Re-read `.bitmap` from disk into the live workspace. `bit ci sync` moves the git checkout\n * underneath a running process, and until the reload every bit operation resolves against the\n * `.bitmap` loaded at startup — and the next write would persist that stale state.\n */\n async reloadWorkspaceFromDisk(): Promise<void> {\n await this.workspace._reloadConsumer();\n }\n\n /**\n * Whether the workspace has anything the current lane doesn't reflect, per `bit status`. Read-only:\n * adoption uses this instead of a probe snap, which writes even under dryRun. Every signal a later\n * snap/export would push counts — including soft removals, hidden pending exports, and merge state.\n */\n async hasUnsyncedWorkChanges(): Promise<boolean> {\n const status = await this.status.status({ lanes: true });\n const divergence = [\n status.newComponents,\n status.modifiedComponents,\n status.stagedComponents,\n status.locallySoftRemoved,\n status.pendingUpdateDependents,\n status.mergePendingComponents,\n status.componentsDuringMergeState,\n ];\n return divergence.some((components) => components.length > 0);\n }\n\n /** `bit ci sync` — reconcile Bit lanes and the main scope with git branches and PRs (see `SyncOrchestrator`). */\n async sync(\n opts: { lane?: string; branch?: string; all?: boolean; main?: boolean; dryRun?: boolean; init?: boolean } = {}\n ): Promise<string> {\n return new SyncOrchestrator({\n ci: this,\n workspace: this.workspace,\n logger: this.logger,\n lanes: this.lanes,\n checkout: this.checkout,\n config: this.config,\n }).sync(opts);\n }\n\n /**\n * Sync *config-only* changes from main onto the lane — without a full `bit lane merge`.\n *\n * In this workflow git is the source of truth for files: the PR author merges the default branch\n * into their PR branch, so source changes arrive via git. The one thing git can't carry is\n * config that's already been *tagged into objects* on main — e.g. another PR ran `bit env set` /\n * `bit deps set`; those records lived in `.bitmap`, rode git into main, and `bit ci merge` baked\n * them into the component's Version (clearing them from `.bitmap`). A long-running PR's lane\n * would otherwise miss them.\n *\n * A full lane merge is the wrong tool here: it does a 3-way *file* merge and refuses to run while\n * the workspace has modified components — but in `bit ci pr` the workspace is always dirty (the\n * PR's changes, not yet snapped). So instead we do a per-component 3-way merge of the aspect\n * *config only* (base = common ancestor, ours = lane, theirs = main), keeping the PR's config on\n * conflict, and stash the result on an `unmergedComponents` entry's `mergedConfig`. The\n * subsequent `snap` reads it (via the aspects-merger on component load) and bakes main's config\n * into the new snap, while the snap's files still come from the workspace (git). No file\n * checkout, so no clean-workspace requirement.\n */\n private async syncConfigFromMain(laneId: LaneId) {\n const legacyScope = this.workspace.scope.legacyScope;\n const repo = legacyScope.objects;\n const mainLaneId = this.lanes.getDefaultLaneId();\n const currentLane = await this.lanes.getCurrentLane();\n if (!currentLane) return;\n const workspaceIds = this.workspace.listIds();\n\n this.logger.console(chalk.blue(`Syncing config changes from ${mainLaneId.toString()} into ${laneId.toString()}`));\n\n // Resolve each lane component's head on main once, keeping only those that are on main and whose\n // lane head differs from it (the rest have nothing to sync). This single pass feeds both the\n // pre-fetch below and the merge loop, so we never load the same ModelComponent twice.\n const componentsToSync = compact(\n await Promise.all(\n currentLane.components.map(async (laneComp) => {\n if (!workspaceIds.hasWithoutVersion(laneComp.id)) return undefined; // not tracked = not snappable\n try {\n const modelComponent = await legacyScope.getModelComponentIfExist(laneComp.id);\n const mainHead = modelComponent?.head; // the component's head on main\n if (!modelComponent || !mainHead || mainHead.isEqual(laneComp.head)) return undefined;\n return { laneComp, modelComponent, mainHead };\n } catch (e: any) {\n // Best-effort per component (same contract as the merge loop below): one component's\n // load failure shouldn't reject Promise.all and abort the whole config sync.\n this.logger.console(\n chalk.yellow(\n ` ${laneComp.id.toStringWithoutVersion()}: skipping config sync from main (${e?.message || e})`\n )\n );\n return undefined;\n }\n })\n )\n );\n\n // The lane import (switchToLane) brought each component's lane history plus the lightweight\n // version-history (the parent graph) — that's enough for the diverge check below to see that\n // main is ahead — but NOT the full Version object for main's head wherever main advanced past\n // the lane's fork point. Those objects live only on main and were never fetched. Without them\n // `loadVersion(mainHead)` throws VersionNotFoundOnFS, the per-component catch swallows it as\n // \"skipping config sync from main\", and the sync silently degrades to a no-op for every\n // diverged component. Pre-fetch main's head objects in one batched remote call (mirroring the\n // lane-merge flows — see merge-status-provider / merge-lanes). Pass the *specific* main-head\n // version so `cache: true` still fetches it: the component already exists locally at its lane\n // version, so a version-less id would look satisfied and skip the remote.\n const mainHeadIds = componentsToSync.map(({ laneComp, mainHead }) =>\n laneComp.id.changeVersion(mainHead.toString())\n );\n await this.prefetchFromMainForConfigSync(mainHeadIds, 'head objects');\n\n // Resolve each component's diverge state up front — before the merge loop — so we can also\n // pre-fetch the common-ancestor objects below. getDivergeData only walks the parent graph,\n // which is already local (switchToLane brings the version-history, and the head pre-fetch above\n // reinforced it), so no full Version object is needed yet. Keep only components where main is\n // actually ahead or diverged; the rest have nothing to bring in from main. Bound the fan-out\n // (getDivergeData traverses each component's version graph) so a lane with many components\n // doesn't spawn one unbounded burst of concurrent graph walks.\n const componentsToMerge = compact(\n await pMapPool(\n componentsToSync,\n async (item) => {\n try {\n const divergeData = await getDivergeData({\n repo,\n modelComponent: item.modelComponent,\n sourceHead: item.laneComp.head,\n targetHead: item.mainHead,\n throws: false,\n });\n if (!divergeData.isTargetAhead() && !divergeData.isDiverged()) return undefined;\n return { ...item, divergeData };\n } catch (e: any) {\n // Best-effort per component (same contract as the merge loop below).\n this.logger.console(\n chalk.yellow(\n ` ${item.laneComp.id.toStringWithoutVersion()}: skipping config sync from main (${e?.message || e})`\n )\n );\n return undefined;\n }\n },\n { concurrency: concurrentComponentsLimit() }\n )\n );\n\n // The head pre-fetch above brought main's head Version plus the version-history (parent graph),\n // but NOT the full Version object of the common ancestor (the lane's fork point) for components\n // where the lane and main have BOTH snapped since the fork. The 3-way config merge below loads\n // that base Version (`baseVersion.extensions`); without it, `loadVersion(baseSnap)` throws\n // VersionNotFoundOnFS, the per-component catch swallows it as \"skipping config sync from main\",\n // and the sync silently no-ops for every diverged component. The fork point lives on main and,\n // like the head, was never fetched (includeVersionHistory carries the graph, not each ancestor's\n // Version). Batch-fetch the bases in one call — same best-effort contract as the head pre-fetch.\n const baseIds = compact(\n componentsToMerge.map(({ laneComp, divergeData }) => {\n const baseSnap = divergeData.commonSnapBeforeDiverge;\n return baseSnap ? laneComp.id.changeVersion(baseSnap.toString()) : undefined;\n })\n );\n await this.prefetchFromMainForConfigSync(baseIds, 'common-ancestor objects');\n\n const syncedIds: ComponentID[] = [];\n for (const { laneComp, modelComponent, mainHead, divergeData } of componentsToMerge) {\n try {\n const laneHead = laneComp.head;\n const currentVersion = await modelComponent.loadVersion(laneHead.toString(), repo);\n const otherVersion = await modelComponent.loadVersion(mainHead.toString(), repo);\n // base = common ancestor. When the lane is strictly behind main (no divergence) the common\n // ancestor IS the lane head, so the lane's own aspects serve as the base.\n const baseSnap = divergeData.commonSnapBeforeDiverge;\n const baseVersion = baseSnap ? await modelComponent.loadVersion(baseSnap.toString(), repo) : currentVersion;\n\n const configMerger = new ComponentConfigMerger(\n laneComp.id.toStringWithoutVersion(),\n workspaceIds,\n undefined, // merging from main (the default lane) — there's no Lane object for it\n currentVersion.extensions,\n baseVersion.extensions,\n otherVersion.extensions,\n laneId.toString(),\n mainLaneId.toString(),\n this.logger,\n 'ours' as MergeStrategy // keep the PR's config on a genuine conflict\n );\n const mergedConfig = configMerger.merge().getSuccessfullyMergedConfig();\n if (!mergedConfig || !Object.keys(mergedConfig).length) continue;\n\n // Strip dependency deletion markers (version: '-'); the aspects-merger applies mergedConfig\n // as-is, so a leftover '-' would land in the policy.\n this.filterDeletedDependenciesFromConfig(mergedConfig);\n\n // Upsert: addEntry throws if an entry for this component already exists. A prior\n // --keep-lane run that crashed mid-snap (or otherwise left unmerged.json entries behind)\n // would otherwise make every later run throw here, skip the component, and keep serving\n // stale config. Remove any existing entry first so repeated runs converge on main's latest.\n legacyScope.objects.unmergedComponents.removeComponent(laneComp.id);\n legacyScope.objects.unmergedComponents.addEntry({\n id: { scope: laneComp.id.scope, name: laneComp.id.fullName },\n head: mainHead,\n laneId: mainLaneId,\n mergedConfig,\n });\n syncedIds.push(laneComp.id);\n this.logger.console(\n chalk.blue(\n ` ${laneComp.id.toStringWithoutVersion()}: applying main's config (${Object.keys(mergedConfig).join(', ')})`\n )\n );\n } catch (e: any) {\n // Best-effort per component: one component's config-merge quirk shouldn't abort the whole\n // `bit ci pr`. Log and move on — the build just won't reflect that component's main-side\n // config this run.\n this.logger.console(\n chalk.yellow(` ${laneComp.id.toStringWithoutVersion()}: skipping config sync from main (${e?.message || e})`)\n );\n }\n }\n\n if (!syncedIds.length) {\n this.logger.console(chalk.blue('No config changes from main to sync'));\n return;\n }\n await legacyScope.objects.unmergedComponents.write();\n // The components were already loaded (and their aspects cached) earlier in this run, before the\n // unmergedComponents entries existed. Clear the cache so the upcoming `snap` reloads them and\n // the aspects-merger folds in the synced `mergedConfig`.\n this.workspace.clearAllComponentsCache();\n this.logger.console(chalk.green(`Synced config from main for ${syncedIds.length} component(s)`));\n }\n\n /**\n * Batch-fetch main-side Version objects the config merge needs (heads, then common ancestors),\n * mirroring the lane-merge flows (merge-status-provider / merge-lanes). Best-effort: a fetch\n * hiccup shouldn't abort `bit ci pr` — the merge loop still runs and any component whose object is\n * still missing just logs the existing per-component skip. `label` names which objects for the log.\n */\n private async prefetchFromMainForConfigSync(ids: ComponentID[], label: string) {\n if (!ids.length) return;\n try {\n await this.importer.importObjectsFromMainIfExist(ids, { cache: true });\n } catch (e: any) {\n this.logger.console(\n chalk.yellow(`Could not pre-fetch main's ${label} for config sync (continuing): ${e?.message || e}`)\n );\n }\n }\n\n /**\n * Copied from `merging.main.runtime` (`filterDeletedDependenciesFromConfig`): the config merge\n * can emit deletion markers (`version: '-'`) for deps removed on main. The aspects-merger applies\n * `mergedConfig` verbatim, so strip those here to avoid writing a policy entry with version '-'.\n */\n private filterDeletedDependenciesFromConfig(mergeConfig?: Record<string, any>): void {\n const policy: Record<string, Array<{ version?: string }>> | undefined =\n mergeConfig?.[DependencyResolverAspect.id]?.policy;\n if (!policy) return;\n Object.keys(policy).forEach((depType) => {\n const filtered = policy[depType].filter((dep) => dep.version !== '-');\n if (filtered.length === 0) delete policy[depType];\n else policy[depType] = filtered;\n });\n }\n\n /**\n * Best-effort, fetch-free check for whether the current (PR) branch is *behind* the default\n * branch — i.e. the default branch has commits the PR branch doesn't contain.\n *\n * We intentionally do NOT `git fetch` here (a fetch in CI can hang on an interactive SSH\n * host-key prompt — that's why `isStaleCiRun` was removed in #10300). We compare against\n * whatever `origin/<default>` ref the checkout already has, which reflects the state the default\n * branch was in when this CI run started — exactly the reference point we care about.\n *\n * Returns true only when we can *confirm* the branch is behind. If the ref can't be resolved or\n * anything else goes wrong, returns false (treat as \"not behind\" / proceed) so we never silently\n * disable the main→lane config propagation.\n */\n private async isBranchBehindDefaultBranch(): Promise<boolean> {\n try {\n const defaultBranch = await this.getDefaultBranchName();\n const defaultRefSha = (await git.revparse([`refs/remotes/origin/${defaultBranch}`])).trim();\n const headSha = (await git.revparse(['HEAD'])).trim();\n if (defaultRefSha === headSha) return false; // identical → up to date\n // We deliberately do NOT use `merge-base --is-ancestor`: it reports the answer via exit code\n // (0 = ancestor, 1 = not), but simple-git's `raw` resolves rather than rejects on exit code\n // 1, so the \"not an ancestor\" case was silently read as \"is an ancestor\" — the behind check\n // never fired. Instead compute the merge-base and compare: `merge-base(A, B) === A` iff A is\n // an ancestor of B. When origin/<default> is an ancestor of HEAD the PR already contains it\n // (not behind); otherwise the default branch has commits HEAD doesn't (behind).\n const mergeBase = (await git.raw(['merge-base', defaultRefSha, headSha])).trim();\n return mergeBase !== defaultRefSha;\n } catch (err: any) {\n this.logger.console(\n chalk.yellow(\n `Could not determine whether the PR branch is up to date with the default branch ` +\n `(proceeding as if up to date): ${err?.message || err}`\n )\n );\n return false;\n }\n }\n\n async verifyWorkspaceStatus() {\n await this.verifyWorkspaceStatusInternal();\n\n this.logger.console('🔨 Build Process');\n const components = await this.workspace.list();\n\n this.logger.console(chalk.blue(`Building ${components.length} components`));\n\n const build = await this.builder.build(components);\n\n build.throwErrorsIfExist();\n\n this.logger.console(chalk.green('Components built'));\n\n return { code: 0, data: '' };\n }\n\n async snapPrCommit({\n laneIdStr,\n message,\n build,\n strict,\n dryRun,\n keepLane,\n skipCleanup,\n skipTasks,\n noDestructiveRecovery,\n }: {\n laneIdStr: string;\n message: string;\n build: boolean | undefined;\n strict: boolean | undefined;\n dryRun?: boolean;\n keepLane?: boolean;\n skipCleanup?: boolean;\n skipTasks?: string;\n /**\n * Opt out of the `--keep-lane` stale-lane recovery that deletes the remote lane and recreates it\n * from main. That trade is fine for a PR lane (a throwaway mirror of a git branch, recreated on\n * every commit) but unacceptable for `bit ci sync`, where the lane is the *authored* artifact and\n * the branch is its mirror — deleting it would destroy the very thing being synced. When set, the\n * stale-lane case throws instead, which the sync executor surfaces as a halt for a human.\n */\n noDestructiveRecovery?: boolean;\n }) {\n // The post-export cleanup switches the workspace back to main, which re-checks-out main's HEAD\n // and re-imports every workspace component — pointless when the workspace is about to be\n // discarded. It's opt-in via `--skip-cleanup` (the `bit_pr` CI job passes it) rather than\n // auto-detected from `process.env.CI`: other CI contexts *reuse* the workspace after `bit ci pr`\n // (e.g. the e2e suite, which then tags/asserts on main), and must keep restoring it.\n const resolvedSkipCleanup = Boolean(skipCleanup);\n\n // Skipping build/publish tasks is OPT-IN per PR: the build runs the full pipeline by default, and\n // a developer adds a `[skip-tasks: <names>]` token to the commit message to trade specific tasks\n // for speed on that PR (e.g. `[skip-tasks: GeneratePreview,ExtractSchema]`) without touching CI\n // config. The token merges with any explicit `--skip-tasks` flag, and is stripped from the message\n // so it doesn't leak into the snap message.\n const { skipTasks: messageSkipTasks, message: resolvedMessage } = extractSkipTasksFromMessage(message);\n const cliSkipTasks = skipTasks\n ? skipTasks\n .split(',')\n .map((task) => task.trim())\n .filter(Boolean)\n : [];\n const mergedSkipTasks = [...new Set([...cliSkipTasks, ...messageSkipTasks])];\n const resolvedSkipTasks = mergedSkipTasks.length ? mergedSkipTasks.join(',') : undefined;\n if (messageSkipTasks.length) {\n this.logger.console(chalk.blue(`Skipping tasks from commit message: ${messageSkipTasks.join(', ')}`));\n }\n\n this.logger.console(chalk.blue(`Lane name: ${laneIdStr}`));\n\n const originalLane = await this.lanes.getCurrentLane();\n\n const laneId = await this.lanes.parseLaneId(laneIdStr);\n\n await this.verifyWorkspaceStatusInternal(strict);\n\n await this.importer\n .import({\n ids: [],\n installNpmPackages: false,\n writeConfigFiles: false,\n })\n .catch((e) => {\n throw new Error(`Failed to import components: ${e.toString()}`);\n });\n\n this.logger.console('🔄 Lane Management');\n\n // `--keep-lane` opts into reusing the same remote lane across subsequent commits to a PR, so\n // the lane's history and any lane-based UI edits on Bit Cloud survive. Without it we use the\n // default, battle-tested flow: snap onto a throwaway temp lane and delete+recreate the final\n // lane at export time (the lane is recreated on every PR commit).\n if (keepLane) {\n return this.snapAndExportReusingLane({\n laneId,\n originalLane,\n message: resolvedMessage,\n build,\n dryRun,\n skipCleanup: resolvedSkipCleanup,\n skipTasks: resolvedSkipTasks,\n noDestructiveRecovery,\n });\n }\n return this.snapAndExportWithTempLane({\n laneId,\n originalLane,\n message: resolvedMessage,\n build,\n dryRun,\n skipCleanup: resolvedSkipCleanup,\n skipTasks: resolvedSkipTasks,\n });\n }\n\n /**\n * Post-export cleanup: restore the workspace to the original lane / main so an interactive\n * `bit ci pr` leaves you where you started. `switchToLane('main')` re-checks-out main's HEAD,\n * which re-imports every workspace component — on a large monorepo that's minutes of work for a\n * workspace that, in CI, is thrown away the moment the command exits. Hence `skipCleanup`.\n * Wrapped so a restore failure only warns instead of throwing out of the caller's `finally` and\n * masking the real error from snap/export. Returns whether the switch actually ran (callers use\n * it to decide whether follow-up lane bookkeeping that assumes we left the lane is safe).\n */\n private async restoreWorkspaceAfterPr(originalLane: Lane | undefined, skipCleanup: boolean): Promise<boolean> {\n this.logger.console('🔄 Cleanup');\n if (skipCleanup) {\n this.logger.console(\n chalk.yellow('Skipping workspace restore (--skip-cleanup) — leaving the workspace on the PR lane')\n );\n return false;\n }\n const targetLane = originalLane?.name ?? 'main';\n this.logger.console(chalk.blue(`Switching back to ${targetLane}`));\n const longProcessLogger = this.logger.createLongProcessLogger(`restoring workspace to ${targetLane}`);\n try {\n const currentLane = await this.lanes.getCurrentLane();\n if (currentLane) {\n // switchToLane catches its own errors and *returns* them (never throws), so a failed switch\n // would otherwise slip through as a success. Treat a returned error as \"did not switch\" so\n // callers don't run follow-up bookkeeping (e.g. temp-lane removal) while still on the lane.\n const switchErr = await this.switchToLane(targetLane);\n if (switchErr) {\n this.logger.consoleWarning(`Cleanup after PR snap failed: ${switchErr.message}`);\n return false;\n }\n } else {\n this.logger.console(chalk.yellow('Already on main, checking out to head'));\n await this.lanes.checkout.checkout({ head: true, skipNpmInstall: true });\n }\n return true;\n } catch (cleanupErr: any) {\n this.logger.consoleWarning(`Cleanup after PR snap failed: ${cleanupErr.message}`);\n return false;\n } finally {\n longProcessLogger.end();\n }\n }\n\n /**\n * `--keep-lane` flow: reuse the existing remote lane (or create it on the first run), merge main\n * into it to pick up config changes that landed since the fork, snap, and export with\n * adopt-on-conflict recovery for concurrent CI pushes. The lane object is preserved across PR\n * commits, so its history and lane-based UI edits on Bit Cloud survive.\n */\n private async snapAndExportReusingLane({\n laneId,\n originalLane,\n message,\n build,\n dryRun,\n skipCleanup,\n skipTasks,\n noDestructiveRecovery,\n }: {\n laneId: LaneId;\n originalLane: Lane | undefined;\n message: string;\n build: boolean | undefined;\n dryRun?: boolean;\n skipCleanup: boolean;\n skipTasks?: string;\n noDestructiveRecovery?: boolean;\n }) {\n // Query the remote (by name, to avoid fetching all lanes) so we know whether to reuse or create\n const existingLanes = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name }).catch((e) => {\n if (e.toString().includes('was not found')) return [];\n throw new Error(`Failed to check lane ${laneId.toString()}: ${e.toString()}`);\n });\n const laneExists = existingLanes.length > 0;\n\n let foundErr: Error | undefined;\n try {\n if (laneExists) {\n // Reuse the existing remote lane so that the lane history, lane-based UI edits, and\n // lane-history feature on Bit Cloud all survive across subsequent commits to the same PR.\n // switchToLane fetches the latest lane head from remote.\n this.logger.console(chalk.blue(`Lane ${laneId.toString()} exists on remote, reusing it`));\n const switchErr = await this.switchToLane(laneId.toString());\n // switchToLane returns the caught error (undefined on success). Combine with a\n // current-lane-state probe — comparing BOTH name AND scope, so a same-named lane in a\n // different scope can't masquerade as a successful switch.\n const switchedLane = await this.lanes.getCurrentLane();\n const landedOnLane = switchedLane?.name === laneId.name && switchedLane?.scope === laneId.scope;\n if (landedOnLane) {\n // Sync config-only changes from main onto the lane, so config that was tagged into\n // objects on main since the lane forked (e.g. `bit deps set` / `bit env set` from\n // another PR, not visible via the workspace's git checkout) is reflected on the lane.\n // Source files are git's job — see syncConfigFromMain.\n //\n // BUT only when the PR branch is actually up to date with the default branch. If the PR\n // is behind (hasn't pulled main's latest), its git checkout still reflects the older\n // fork point, so pulling main's newer config onto the lane would desync the lane from\n // the source. The author merges the default branch into their PR in git; the next\n // `bit ci pr` then propagates it here.\n if (await this.isBranchBehindDefaultBranch()) {\n this.logger.console(\n chalk.yellow(\n `PR branch is behind the default branch — skipping config sync from main. ` +\n `Merge or rebase the default branch into your PR to pick up main's latest config.`\n )\n );\n } else {\n await this.syncConfigFromMain(laneId);\n }\n } else {\n // Switch failed even though the remote lane exists. The destructive recovery below\n // (delete the remote lane + recreate fresh) is safe only when the failure is the\n // specific \"stale lane\" pattern — the lane references a ModelComponent the PR has\n // since removed/renamed (`unable to merge lane …, the component … was not found`).\n // For any other failure (transient network blip during fetch, auth error, lane locked\n // by Cloud UI, etc.) destroying lane history would be the wrong response, so we\n // rethrow and let the caller report the real cause.\n const errMsg = switchErr?.toString() ?? '';\n const isStaleLane = errMsg.includes('unable to merge lane');\n if (!isStaleLane) {\n throw new Error(\n `Failed to switch to remote lane ${laneId.toString()}: ${errMsg || '(no error captured)'}. ` +\n `Refusing destructive recovery for this failure class — the error doesn't match the ` +\n `stale-lane marker, so deleting the lane could destroy real history. Investigate or retry.`\n );\n }\n if (noDestructiveRecovery) {\n // `bit ci sync` mirrors an authored lane onto a branch. Recovering by deleting the remote\n // lane and re-forking it from main would discard the lane's components and history — the\n // exact artifact the sync exists to preserve — and the next sync would then happily\n // mirror the now-empty lane onto the branch. Fail loudly instead; the executor turns this\n // into a halt so a human resolves the lane on bit.cloud.\n throw new Error(\n `Failed to switch to remote lane ${laneId.toString()}: ${errMsg || '(no error captured)'}. ` +\n `The stale-lane recovery (delete the remote lane and recreate it from main) is disabled ` +\n `for this caller, because the lane is an authored artifact rather than a throwaway PR ` +\n `lane. Resolve the lane on bit.cloud and re-run.`\n );\n }\n this.logger.console(\n chalk.yellow(\n `Stale remote lane ${laneId.toString()} — switching failed. ` +\n `Deleting it and creating a fresh lane to recover.`\n )\n );\n // Re-check the remote lane's hash immediately before deleting. The central-hub delete\n // API is name-based — there's no compare-and-swap — so two CI jobs racing the same\n // recovery could otherwise have job B delete job A's freshly-recreated lane. By\n // re-fetching here we shrink the TOCTOU window to milliseconds: if A's recreate landed\n // before our re-fetch, the hash changed and we skip the delete entirely. The downstream\n // export then hits the lane-hash mismatch and lands in `exportWithAdoptOnConflict`,\n // which rebases our snaps onto the winner's lane — no destroyed history.\n const staleHash = existingLanes[0]?.hash;\n const recheck = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name }).catch(() => []);\n const currentRemoteHash = recheck[0]?.hash;\n const remoteChanged = staleHash && currentRemoteHash && currentRemoteHash !== staleHash;\n if (remoteChanged) {\n this.logger.console(\n chalk.blue(\n `Remote lane ${laneId.toString()} changed since we first checked (hash ` +\n `${staleHash.slice(0, 9)} → ${currentRemoteHash.slice(0, 9)}) — another concurrent ` +\n `recovery already recreated it. Skipping the delete; export will adopt-on-conflict.`\n )\n );\n } else {\n await this.lanes.removeLanes([laneId.toString()], { remote: true, force: true }).catch((e) => {\n const msg = e?.toString() ?? '';\n // Tolerate the race where another concurrent recovery deleted the lane first — the\n // desired post-condition (lane gone from remote) is already met.\n if (msg.includes('was not found') || msg.includes('not found')) {\n this.logger.console(chalk.blue(`Remote lane ${laneId.toString()} was already gone — proceeding`));\n return;\n }\n throw new Error(`Failed to delete stale remote lane ${laneId.toString()}: ${msg || e}`);\n });\n }\n // switchToLane fetched the remote lane and persisted it into the local scope's lane\n // index (via `importLaneObject` → `legacyScope.lanes.saveLane`) BEFORE the underlying\n // merge failed. Without dropping that local copy here, the upcoming `createLane` would\n // hit the \"lane … already exists\" guard in create-lane.ts. Same trash-the-local-object\n // pattern as `rebaseOntoRemoteLane`.\n const legacyScope = this.workspace.scope.legacyScope;\n const localLane = await legacyScope.loadLane(laneId);\n if (localLane) {\n await legacyScope.objects.moveObjectsToTrash([localLane.hash()]);\n }\n // Reset the workspace's current-lane pointer to main before createLane, so the new lane\n // is forked from main with an empty component list. `createLane` populates new lanes\n // from `consumer.getCurrentLaneObject()` regardless of `forkLaneNewScope` (which only\n // suppresses the cross-scope guard) — if `originalLane` is non-default (a developer\n // running `bit ci pr` from a lane), without this reset the \"fresh\" lane would silently\n // inherit `originalLane`'s components. Check the return value: a silent failure here\n // would defeat the whole point of the reset.\n const resetErr = await this.switchToLane('main');\n const afterReset = await this.lanes.getCurrentLane();\n if (resetErr || afterReset) {\n throw new Error(\n `Failed to reset to main before recreating ${laneId.toString()}: ` +\n `${resetErr?.toString() ?? `(still on lane \"${afterReset?.name}\")`}. ` +\n `Aborting to avoid silently forking the recreated lane from the wrong source.`\n );\n }\n const createLaneResult = await this.lanes.createLane(laneId.name, {\n scope: laneId.scope,\n forkLaneNewScope: true,\n });\n this.logger.console(chalk.blue(`Recreated lane ${laneId.toString()} (hash: ${createLaneResult.hash})`));\n }\n } else {\n this.logger.console(chalk.blue(`Creating lane ${laneId.toString()}`));\n const createLaneResult = await this.lanes.createLane(laneId.name, {\n scope: laneId.scope,\n forkLaneNewScope: true,\n });\n this.logger.console(chalk.blue(`Created lane ${laneId.toString()} (hash: ${createLaneResult.hash})`));\n }\n\n const currentLane = await this.lanes.getCurrentLane();\n this.logger.console(chalk.blue(`Current lane: ${currentLane?.name ?? 'main'}`));\n if (currentLane?.name !== laneId.name) {\n throw new Error(`Expected to be on lane ${laneId.name}, but current lane is ${currentLane?.name ?? 'main'}`);\n }\n\n this.logger.console('📦 Snapping Components');\n const results = await this.snapping.snap({\n message,\n build,\n exitOnFirstFailedTask: true,\n skipTasks,\n });\n\n if (!results) {\n this.logger.console(chalk.yellow(NO_CHANGES_TO_SNAP));\n return NO_CHANGES_TO_SNAP;\n }\n\n const { snappedComponents }: SnapResults = results;\n\n const snapOutput = snapResultOutput(results);\n this.logger.console(snapOutput);\n\n if (dryRun) {\n this.logger.console(chalk.yellow('🏃 Dry-run mode: skipping export'));\n this.logger.console(chalk.green(`Snapped ${snappedComponents.length} component(s) successfully`));\n return snapOutput;\n }\n\n this.logger.console(chalk.blue(`Exporting ${snappedComponents.length} components`));\n await this.exportWithAdoptOnConflict(laneId, snappedComponents);\n } catch (e: any) {\n foundErr = e;\n throw e;\n } finally {\n if (foundErr) {\n this.logger.console(chalk.red(`Found error: ${foundErr.message}`));\n }\n await this.restoreWorkspaceAfterPr(originalLane, skipCleanup);\n }\n }\n\n /**\n * Default flow: snap onto a uniquely-named temporary lane, then at export time delete any\n * existing remote lane and rename the temp lane to the final name. The temp name minimizes the\n * race window when multiple CI jobs run concurrently on the same branch. Trade-off: the final\n * lane is recreated on every PR commit, so its history and any lane-based UI edits on Bit Cloud\n * don't survive across commits — use `--keep-lane` for that.\n */\n private async snapAndExportWithTempLane({\n laneId,\n originalLane,\n message,\n build,\n dryRun,\n skipCleanup,\n skipTasks,\n }: {\n laneId: LaneId;\n originalLane: Lane | undefined;\n message: string;\n build: boolean | undefined;\n dryRun?: boolean;\n skipCleanup: boolean;\n skipTasks?: string;\n }) {\n // Use unique temp lane name to avoid race conditions when multiple CI jobs run concurrently\n const tempLaneName = `${laneId.name}-${generateRandomStr(5)}`;\n\n let foundErr: Error | undefined;\n let renamedToFinalName = false;\n try {\n const createLaneResult = await this.lanes.createLane(tempLaneName, {\n scope: laneId.scope,\n forkLaneNewScope: true,\n });\n this.logger.console(\n chalk.blue(`Created temporary lane ${laneId.scope}/${tempLaneName} (hash: ${createLaneResult.hash})`)\n );\n\n const currentLane = await this.lanes.getCurrentLane();\n\n this.logger.console(chalk.blue(`Current lane: ${currentLane?.name ?? 'main'}`));\n\n if (currentLane?.name !== tempLaneName) {\n throw new Error(\n `Expected to be on lane ${tempLaneName} after creation, but current lane is ${currentLane?.name ?? 'main'}`\n );\n }\n\n this.logger.console('📦 Snapping Components');\n const results = await this.snapping.snap({\n message,\n build,\n exitOnFirstFailedTask: true,\n skipTasks,\n });\n\n if (!results) {\n // No changes to snap - switch back to main and remove the temp lane we created\n this.logger.console(chalk.yellow('No changes detected, removing temporary lane'));\n await this.switchToLane(originalLane?.name ?? 'main');\n await this.lanes.removeLanes([tempLaneName], { remote: false, force: true });\n return NO_CHANGES_TO_SNAP;\n }\n\n const { snappedComponents }: SnapResults = results;\n\n const snapOutput = snapResultOutput(results);\n this.logger.console(snapOutput);\n\n if (dryRun) {\n this.logger.console(chalk.yellow('🏃 Dry-run mode: skipping export, lane deletion, and rename'));\n this.logger.console(chalk.green(`Snapped ${snappedComponents.length} component(s) successfully`));\n this.logger.console(\n chalk.blue(\n `Temporary lane \"${laneId.scope}/${tempLaneName}\" kept for debugging. Remove it with: bit lane remove ${laneId.scope}/${tempLaneName}`\n )\n );\n return snapOutput;\n }\n\n // Finalize atomically: delete existing lane, rename temp lane, export\n this.logger.console('🔄 Finalizing Lane');\n\n // Check if original lane exists on remote and delete it (query by name to avoid fetching all lanes)\n const existingLanes = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name }).catch((e) => {\n // Lane not found is expected on first run - just means nothing to delete\n if (e.toString().includes('was not found')) {\n return [];\n }\n throw new Error(`Failed to check lane ${laneId.toString()}: ${e.toString()}`);\n });\n\n if (existingLanes.length) {\n this.logger.console(chalk.blue(`Deleting existing remote lane ${laneId.toString()}`));\n const archiveResult = await this.archiveLane(laneId.toString(), true); // throwOnError: delete must succeed before export\n if (archiveResult === 'not-found') {\n // `getLanes` just reported the lane exists, but the delete API says \"not found\". Re-query\n // to confirm. If the lane still shows up, something is off on the remote (delete can't\n // see what list/export can), and retrying will never converge.\n let stillExists;\n try {\n stillExists = await this.lanes.getLanes({ remote: laneId.scope, name: laneId.name });\n } catch (verifyErr: any) {\n throw new Error(\n `failed to verify whether remote lane ${laneId.toString()} still exists after delete returned \"not found\": ${verifyErr?.message || verifyErr}`\n );\n }\n if (stillExists.length) {\n throw new Error(\n `unable to delete remote lane ${laneId.toString()}: the remote reports the lane as \"not found\" from ` +\n `the delete API but still lists it from the query API. maybe this is a remote issue on bit.cloud. ` +\n `please contact support or manually delete the lane on bit.cloud before re-running CI.`\n );\n }\n }\n }\n\n // Rename temp lane to original name\n this.logger.console(chalk.blue(`Renaming lane from ${tempLaneName} to ${laneId.name}`));\n await this.lanes.rename(laneId.name, tempLaneName);\n renamedToFinalName = true;\n\n // Export with the correct name. Retry on hash-mismatch, which indicates a concurrent CI job\n // pushed the same lane id between our pre-export delete and our merge on the hub.\n this.logger.console(chalk.blue(`Exporting ${snappedComponents.length} components`));\n const exportResults = await this.exportWithRetryOnLaneHashMismatch(laneId.toString());\n this.logger.console(chalk.green(`Exported ${exportResults.componentsIds.length} components`));\n } catch (e: any) {\n foundErr = e;\n throw e;\n } finally {\n if (foundErr) {\n this.logger.console(chalk.red(`Found error: ${foundErr.message}`));\n }\n const switchedBack = await this.restoreWorkspaceAfterPr(originalLane, skipCleanup);\n\n // Clean up orphaned temporary lane on error. Skip if the rename to the final name already\n // happened - in that case the temp name no longer exists locally, and the lane under the\n // final name may have been partially exported; leave it alone rather than wipe evidence.\n // Also requires having switched off the temp lane first — you can't remove the lane you're\n // currently on, so when the restore was skipped, leave the (local, soon-discarded) temp lane.\n if (switchedBack && foundErr && !renamedToFinalName) {\n const tempLaneFullName = `${laneId.scope}/${tempLaneName}`;\n this.logger.console(chalk.blue(`Cleaning up temporary lane ${tempLaneFullName}`));\n try {\n await this.lanes.removeLanes([tempLaneFullName], { remote: false, force: true });\n this.logger.console(chalk.green(`Removed temporary lane ${tempLaneFullName}`));\n } catch (cleanupErr: any) {\n // Ignore cleanup errors to avoid masking the original error\n this.logger.console(chalk.yellow(`Failed to clean up temporary lane: ${cleanupErr?.message || cleanupErr}`));\n }\n }\n }\n }\n\n /**\n * Export with a recovery path for the two concurrent-CI conflicts that can surface from the\n * remote (see the marker constants at the top of the file): lane-hash mismatch (both runners\n * created fresh lane objects when the lane didn't yet exist on the remote) and per-component\n * divergence (both reused the existing lane but snapped the same component with different\n * content).\n *\n * Recovery: adopt-the-winner. The remote lane (whoever pushed first) becomes canonical. We\n * drop our local lane object, fetch the remote, rebase our snapped Version objects so each\n * one's parent points to the remote head for that component, then swap those rebased Versions\n * in as the new lane heads and re-export. Build artifacts are preserved — only the parent\n * pointers on the Version objects change. Result: both runners' snaps end up chained on a\n * single lane object (last-writer-wins on content for any contested component, with the\n * winner's snap preserved in history as the parent).\n */\n private async exportWithAdoptOnConflict(laneId: LaneId, snappedComponents: ConsumerComponent[]) {\n try {\n const exportResults = await this.exporter.export();\n this.logger.console(chalk.green(`Exported ${exportResults.componentsIds.length} components`));\n return;\n } catch (e: any) {\n const msg = e?.message || e?.toString() || '';\n const isLaneHashMismatch = msg.includes(LANE_HASH_MISMATCH_MARKER);\n const isComponentDivergence = msg.includes(COMPONENT_DIVERGENCE_MARKER);\n if (!isLaneHashMismatch && !isComponentDivergence) throw e;\n const cause = isLaneHashMismatch ? 'Lane hash mismatch' : 'Per-component divergence';\n this.logger.console(\n chalk.yellow(\n `${cause} on \"${laneId.toString()}\" — likely a concurrent CI push. Adopting the remote lane and rebasing local snaps onto its heads.`\n )\n );\n }\n\n const snappedHeads = snappedComponents.map((c) => {\n // A just-snapped component always has a version; guard defensively so a missing one fails\n // with a clear message instead of `Ref.from(undefined)`'s opaque \"hash argument is empty\".\n if (!c.version) {\n throw new Error(\n `unable to recover from the lane-hash mismatch: snapped component \"${c.id.toString()}\" has no version to rebase onto the remote lane`\n );\n }\n return { id: c.id, head: Ref.from(c.version) };\n });\n\n await this.rebaseOntoRemoteLane(laneId, snappedHeads);\n\n this.logger.console(chalk.blue('Retrying export with rebased snaps'));\n const exportResults = await this.exportWithBusyRetry();\n this.logger.console(chalk.green(`Exported ${exportResults.componentsIds.length} components after rebase`));\n }\n\n /**\n * Wrap `exporter.export()` with retry on the \"server is busy\" error. The retried export's\n * pending-dir lands behind whichever concurrent client is still in the remote's queue (we\n * arrived second by definition — we're the loser of the original race). The 60s wait inside\n * `export-validate.waitIfNeeded` covers the common case, but on slow CI hosts or large pushes\n * we sometimes time out before the other client finishes its persist. A short sleep + retry\n * here just gives the queue room to drain.\n */\n private async exportWithBusyRetry(maxAttempts = 3) {\n const isBusyErr = (err: any) => (err?.message || err?.toString() || '').includes('server is busy by other exports');\n let lastErr: any;\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n try {\n return await this.exporter.export();\n } catch (e: any) {\n lastErr = e;\n if (!isBusyErr(e)) throw e;\n this.logger.console(\n chalk.yellow(\n `Export attempt ${attempt}/${maxAttempts} blocked by a busy remote queue. Waiting before retrying.`\n )\n );\n await new Promise((resolve) => setTimeout(resolve, 2000 * attempt));\n }\n }\n throw lastErr;\n }\n\n private async rebaseOntoRemoteLane(laneId: LaneId, snappedHeads: Array<{ id: ComponentID; head: Ref }>) {\n const legacyScope = this.workspace.scope.legacyScope;\n const repo = legacyScope.objects;\n\n // Our local lane object (the one we just snapped onto) shares the LaneId with the remote\n // (winning) lane but has a different, randomly-minted hash. Fetching the remote lane writes it\n // into our scope via `sources.mergeLane`, which rejects a same-id/different-hash lane (\"a lane\n // with the same id already exists with a different hash\") — so we must drop our local lane\n // object BEFORE the fetch, not after. We can't use `lanes.removeLanes` (it refuses to remove\n // the currently-checked-out lane), so we trash the lane object directly; that also removes it\n // from the scope index, so `loadLane` (the guard's lookup) no longer finds it. Only the lane\n // pointer is trashed — the Version objects we snapped stay in the scope for the rebase below,\n // and the fetch immediately re-persists a same-id lane object, satisfying the current-lane\n // workspace pointer again.\n const localLane = await legacyScope.loadLane(laneId);\n if (localLane) {\n this.logger.console(chalk.blue(`Dropping local lane object ${laneId.toString()} to adopt the remote one`));\n await repo.moveObjectsToTrash([localLane.hash()]);\n }\n\n // Fetch the remote (winning) lane and the Version objects it points at. With our local lane\n // object gone, `mergeLane` sees no conflicting same-id lane and persists the remote one.\n this.logger.console(chalk.blue(`Fetching remote lane ${laneId.toString()}`));\n const remoteLane = await this.lanes.fetchLaneWithItsComponents(laneId);\n\n // Rewrite each snapped Version's parent to point at the remote head for that component.\n // Bit's Version objects aren't content-addressed — `_hash` is set once and not derived\n // from content — so we can mutate `parents` in place. The hash stays the same, so the\n // build artifacts referenced from the Version remain valid and the lane's component head\n // doesn't need to be re-pointed. The remote receives the updated Version because our\n // first failed export attempt was rejected during the export-validate step (via\n // `sources.mergeLane`'s same-id/different-hash guard) — *before* `ExportPersist` writes any\n // files to disk — so the remote doesn't yet have this hash and won't dedupe-skip it during\n // transfer.\n for (const snap of snappedHeads) {\n const remoteComp = remoteLane.components.find((c) => c.id.isEqualWithoutVersion(snap.id));\n if (!remoteComp) continue; // component is only on our lane, not on the remote — no rebase target\n const remoteHead = remoteComp.head;\n if (snap.head.isEqual(remoteHead)) continue;\n\n const version = (await repo.load(snap.head)) as Version | undefined;\n if (!version) {\n throw new Error(\n `rebaseOntoRemoteLane: unable to load Version object for ${snap.id.toString()} hash ${snap.head.toString()}`\n );\n }\n if (version.parents.some((p) => p.isEqual(remoteHead))) continue; // already chains correctly\n\n const beforeParents = version.parents.map((p) => p.toString().slice(0, 9)).join(',');\n // Re-point only the lane-lineage parent (the first parent — the predecessor snap on the\n // lane) to the remote head, preserving any additional parents. A snap produced after\n // `syncConfigFromMain` is a merge snap whose second parent links to main's head; overwriting\n // the whole array with `[remoteHead]` would silently drop that merge edge and corrupt the\n // lane's ancestry.\n version.parents = [remoteHead, ...version.parents.slice(1)];\n const afterParents = version.parents.map((p) => p.toString().slice(0, 9)).join(',');\n this.logger.console(\n chalk.blue(\n `Rebasing ${snap.id.toString()}@${snap.head.toString().slice(0, 9)}: parents [${beforeParents}] → [${afterParents}]`\n )\n );\n repo.add(version);\n\n // Keep the local VersionHistory in sync with the rewritten parents. The first (failed)\n // export already traversed and wrote VersionHistory with this version's *original* parent;\n // without this update the re-export's diverge computation reads that stale history, never\n // sees the remote head as an ancestor, and can send the wrong version set or throw a\n // spurious \"no common snap\" error. `updateRebasedVersionHistory` only touches the entry if\n // this version already exists in the history (it does, from that first traversal).\n const modelComponent = await legacyScope.getModelComponent(snap.id);\n const versionHistory = await modelComponent.updateRebasedVersionHistory(repo, [version]);\n if (versionHistory) repo.add(versionHistory);\n }\n\n // Replace the remote lane's component heads with our snapped Versions. Anything we\n // didn't snap stays as the remote had it.\n //\n // TODO(stale-runner): if two consecutive PR commits trigger two CI runs and the older one\n // finishes last, it will rebase its (older-content) snap on top of the newer one — the\n // newer commit's snap stays in history but the lane head regresses to the older content.\n // The fix needs git-SHA-aware staleness detection (embed `git rev-parse HEAD` in the snap\n // log on creation, compare against the remote head's stored SHA on rebase, abort if our\n // commit is an ancestor of theirs). The prior `isStaleCiRun` (removed in #10300 for\n // SSH-prompt reasons) attempted this via `git fetch`; we'd want a fetch-free variant here.\n const updatedComponents: LaneComponent[] = remoteLane.components.map((c) => {\n const snap = snappedHeads.find((s) => s.id.isEqualWithoutVersion(c.id));\n return snap ? { ...c, head: snap.head } : c;\n });\n // Pick up any components we snapped that aren't on the remote lane yet (newly added on this PR).\n for (const snap of snappedHeads) {\n if (!updatedComponents.some((c) => c.id.isEqualWithoutVersion(snap.id))) {\n updatedComponents.push({ id: snap.id, head: snap.head });\n }\n }\n remoteLane.setLaneComponents(updatedComponents);\n remoteLane.hasChanged = true;\n await legacyScope.lanes.saveLane(remoteLane, { saveLaneHistory: false });\n\n await repo.persist();\n\n // Make sure the workspace's current-lane pointer points at the lane we just adopted.\n this.workspace.consumer.setCurrentLane(laneId, true);\n await this.workspace.bitMap.write();\n }\n\n async mergePr({\n message: argMessage,\n build,\n strict,\n releaseType,\n autoTagReleaseType,\n preReleaseId,\n incrementBy,\n explicitVersionBump,\n verbose,\n versionsFile,\n autoMergeResolve,\n forceTheirs,\n laneName,\n skipPush,\n noBitmapCommit,\n }: {\n message?: string;\n build?: boolean;\n strict?: boolean;\n releaseType: ReleaseType;\n autoTagReleaseType?: ReleaseType;\n preReleaseId?: string;\n incrementBy?: number;\n explicitVersionBump?: boolean;\n verbose?: boolean;\n versionsFile?: string;\n autoMergeResolve?: MergeStrategy;\n forceTheirs?: boolean;\n laneName?: string;\n skipPush?: boolean;\n noBitmapCommit?: boolean;\n }) {\n // Capture the initial commit SHA before any operations modify the repository\n const initialCommitSha = await git.revparse(['HEAD']);\n\n const message = argMessage || (await this.getGitCommitMessage());\n if (!message) {\n throw new Error('Failed to get commit message from git. Please provide a message using --message option.');\n }\n\n const currentLane = await this.lanes.getCurrentLane();\n const laneComponents = currentLane?.components;\n if (currentLane) {\n // this doesn't normally happen. we expect this mergePr to be called from the default branch, which normally checks\n // out to main lane.\n this.logger.console(chalk.blue(`Currently on lane ${currentLane.name}, switching to main`));\n await this.switchToLane('main');\n // this is needed to make sure components that were created on the lane are now available on main.\n // without this, the switch to main above, marks those components as not-available, and won't be tagged later on.\n // don't use the high-level `consumer.resetLaneNew()`, because it deletes the entire local scope.\n const changedIds = this.workspace.consumer.bitMap.resetLaneComponentsToNew();\n if (changedIds.length) {\n const changedIdsList = ComponentIdList.fromArray(changedIds);\n await this.workspace.scope.legacyScope.removeMany(changedIdsList, true);\n\n await this.workspace.clearCache();\n await this.workspace.bitMap.write('reset lane new');\n }\n\n this.logger.console(chalk.green('Switched to main lane'));\n }\n\n // Pull latest changes from remote to ensure we have the most up-to-date .bitmap\n // This prevents issues when multiple PRs are merged in sequence\n const defaultBranch = await this.getDefaultBranchName();\n this.logger.console(chalk.blue(`Pulling latest git changes from ${defaultBranch} branch`));\n\n // Check if there are any changes to stash before rebasing\n const gitStatus = await git.status();\n const hasChanges = gitStatus.files.length > 0;\n\n if (hasChanges) {\n this.logger.console(chalk.yellow('Stashing uncommitted changes before rebase'));\n await git.stash(['push', '-u', '-m', 'CI merge temporary stash']);\n }\n\n await git.pull('origin', defaultBranch, { '--rebase': 'true' });\n\n if (hasChanges) {\n this.logger.console(chalk.yellow('Restoring stashed changes after rebase'));\n await git.stash(['pop']);\n }\n\n this.logger.console(chalk.green('Pulled latest git changes'));\n\n this.logger.console('🔄 Checking out to main head');\n await this.importer.importCurrentObjects();\n\n const checkoutProps = {\n forceOurs: !forceTheirs && !autoMergeResolve, // only force ours if neither forceTheirs nor autoMergeResolve is specified\n head: true,\n skipNpmInstall: true,\n ...(forceTheirs && { forceTheirs }),\n ...(autoMergeResolve && { mergeStrategy: autoMergeResolve }),\n };\n const checkoutResults = await this.checkout.checkout(checkoutProps);\n\n await this.workspace.bitMap.write('checkout head');\n this.logger.console(reportToString(checkoutOutput(checkoutResults, checkoutProps)));\n\n if (laneComponents?.length) {\n await this.restoreLaneConfigChanges(laneComponents);\n }\n\n // Check for workspace.jsonc conflicts\n if (\n checkoutResults.workspaceConfigUpdateResult?.workspaceDepsConflicts ||\n checkoutResults.workspaceConfigUpdateResult?.workspaceConfigConflictWriteError\n ) {\n this.logger.console(chalk.red('❌ workspace.jsonc conflicts detected during checkout'));\n this.logger.console(chalk.blue('\\nTo resolve these conflicts, please run:'));\n this.logger.console(chalk.bold(' bit checkout head'));\n this.logger.console(chalk.gray('\\nThis will allow you to manually resolve the conflicts in workspace.jsonc.'));\n\n throw new Error(\n 'Cannot complete CI merge due to workspace.jsonc conflicts. Please run \"bit checkout head\" and fix the conflicts manually.'\n );\n }\n\n // Check for conflicts when using manual merge strategy\n if (autoMergeResolve === 'manual' && checkoutResults.leftUnresolvedConflicts) {\n const componentsWithConflicts =\n checkoutResults.components?.filter(\n (c) => c.filesStatus && Object.values(c.filesStatus).some((status) => status === 'manual')\n ) || [];\n\n const conflictedComponentIds = componentsWithConflicts.map((c) => c.id.toString());\n\n this.logger.console(chalk.red('❌ Merge conflicts detected during checkout'));\n this.logger.console(chalk.yellow('The following components have conflicts:'));\n conflictedComponentIds.forEach((id) => {\n this.logger.console(chalk.yellow(` - ${id}`));\n });\n this.logger.console(chalk.blue('\\nTo resolve these conflicts, please run:'));\n this.logger.console(chalk.bold(' bit checkout head'));\n this.logger.console(chalk.gray('\\nThis will allow you to manually resolve the conflicts.'));\n\n throw new Error(\n 'Cannot complete CI merge due to unresolved conflicts. Please resolve conflicts manually and try again.'\n );\n }\n\n const { status } = await this.verifyWorkspaceStatusInternal(strict);\n\n const hasSoftTaggedComponents = status.softTaggedComponents.length > 0;\n\n this.logger.console('📦 Component Operations');\n this.logger.console(chalk.blue('Tagging components'));\n const finalReleaseType = await this.determineReleaseType(releaseType, explicitVersionBump);\n const tagResults = await this.snapping.tag({\n all: true,\n message,\n build,\n failFast: true,\n persist: hasSoftTaggedComponents,\n releaseType: finalReleaseType,\n autoTagReleaseType,\n preReleaseId,\n incrementBy,\n versionsFile,\n });\n\n if (tagResults) {\n const tagOutput = tagResultOutput(tagResults);\n this.logger.console(tagOutput);\n } else {\n this.logger.console(chalk.yellow('No components to tag'));\n }\n\n const hasTaggedComponents = tagResults?.taggedComponents && tagResults.taggedComponents.length > 0;\n\n if (hasTaggedComponents) {\n this.logger.console(chalk.blue('Exporting components'));\n const exportResult = await this.exporter.export();\n\n if (exportResult.componentsIds.length > 0) {\n this.logger.console(chalk.green(`Exported ${exportResult.componentsIds.length} component(s)`));\n } else {\n this.logger.console(chalk.yellow('Nothing to export'));\n }\n\n if (noBitmapCommit) {\n this.logger.console(\n chalk.yellow(\n 'Skipping bitmap commit (--no-bitmap-commit flag). The new versions are in scope; no git commit will be created on the default branch.'\n )\n );\n this.logger.console(\n chalk.gray(\n 'Developers auto-sync their local .bitmap on the next bit command after `git pull` when `bitmapAutoSync: true` is set in workspace.jsonc.'\n )\n );\n } else {\n await this.commitAndPushBitmapChanges({ verbose, skipPush, defaultBranch });\n }\n } else {\n this.logger.console(chalk.yellow('No components were tagged, skipping export and git operations'));\n }\n\n this.logger.console(chalk.green('Merged PR'));\n\n // Enhanced lane cleanup logic\n await this.performLaneCleanup(currentLane, laneName, initialCommitSha);\n\n return { code: 0, data: '' };\n }\n\n /**\n * Stage every changed file (post-tag/export the bitmap, lockfiles, and any files\n * touched by `bit checkout head` may differ), commit with the configured message,\n * rebase against origin, and push — unless `skipPush` was passed.\n */\n private async commitAndPushBitmapChanges({\n verbose,\n skipPush,\n defaultBranch,\n }: {\n verbose?: boolean;\n skipPush?: boolean;\n defaultBranch: string;\n }) {\n this.logger.console('🔄 Git Operations');\n await git.addConfig('user.email', 'bit-ci[bot]@bit.cloud');\n await git.addConfig('user.name', 'Bit CI');\n\n const statusBeforeCommit = await git.status();\n this.logger.console(chalk.blue(`Git status before commit: ${statusBeforeCommit.files.length} files`));\n statusBeforeCommit.files.forEach((file) => {\n this.logger.console(chalk.gray(` ${file.working_dir}${file.index} ${file.path}`));\n });\n\n if (verbose && statusBeforeCommit.files.length > 0) {\n try {\n const diff = await git.diff();\n if (diff) {\n this.logger.console(chalk.blue('Git diff before commit:'));\n this.logger.console(diff);\n }\n } catch (error) {\n this.logger.console(chalk.yellow(`Failed to show git diff: ${error}`));\n }\n }\n\n // Stage everything: `bit checkout head` earlier in the flow may modify files\n // beyond .bitmap and pnpm-lock.yaml, so a narrow `git add` would miss them.\n // The two exclusions in the shared helper keep the local bit scope (`.bit`) and `node_modules` out\n // of the commit in a workspace whose `.gitignore` lacks Bit's block — otherwise this stages the\n // object store into the default branch. Same helper the sync executors use, so all three commit\n // paths agree on what counts as workspace content.\n await addAllExceptScopeAndModules();\n const commitMessage = await this.getCustomCommitMessage();\n await git.commit(commitMessage);\n\n const statusAfterCommit = await git.status();\n this.logger.console(chalk.blue(`Git status after commit: ${statusAfterCommit.files.length} files`));\n statusAfterCommit.files.forEach((file) => {\n this.logger.console(chalk.gray(` ${file.working_dir}${file.index} ${file.path}`));\n });\n\n await git.pull('origin', defaultBranch, { '--rebase': 'true' });\n if (skipPush) {\n this.logger.console(chalk.yellow('Skipping git push (--skip-push flag)'));\n return;\n }\n await git.push('origin', defaultBranch);\n }\n\n /**\n * Compare lane Version extensions with main Version extensions for each component.\n * Any config differences (e.g. env-set, deps-set) are saved to .bitmap so they survive\n * the switch from lane to main and get included in the subsequent tag.\n */\n private async restoreLaneConfigChanges(laneComponents: LaneComponent[]) {\n const scope = this.workspace.scope.legacyScope;\n const repo = scope.objects;\n let hasChanges = false;\n\n const activeComponents = laneComponents.filter((c) => !c.isDeleted);\n await Promise.all(\n activeComponents.map(async (laneComp) => {\n const laneVersion = (await repo.load(laneComp.head)) as Version;\n if (!laneVersion) {\n this.logger.console(chalk.yellow(`Warning: could not load Version object for ${laneComp.id.toString()}`));\n return;\n }\n\n const laneConfig = laneVersion.extensions.toConfigObject();\n if (!laneConfig || Object.keys(laneConfig).length === 0) return;\n\n // Get main Version for comparison\n let mainConfig: Record<string, any> = {};\n const modelComp = await scope.getModelComponentIfExist(laneComp.id.changeVersion(undefined));\n const mainHead = modelComp?.getHead();\n if (mainHead) {\n const mainVersion = (await repo.load(mainHead)) as Version;\n mainConfig = mainVersion?.extensions.toConfigObject() ?? {};\n }\n\n for (const [aspectId, config] of Object.entries(laneConfig)) {\n if (!isEqual(config, mainConfig[aspectId])) {\n const updated = this.workspace.bitMap.addComponentConfig(\n laneComp.id,\n aspectId,\n config as Record<string, any>\n );\n if (updated) hasChanges = true;\n }\n }\n })\n );\n\n if (hasChanges) {\n await this.workspace.bitMap.write('restore lane config');\n await this.workspace.clearCache();\n this.logger.console(chalk.blue('Restored config changes from lane'));\n }\n }\n\n /**\n * Performs lane cleanup by attempting to detect and delete the source lane\n * after a successful merge, even when running on the main branch\n */\n private async performLaneCleanup(currentLane: any, explicitLaneName?: string, initialCommitSha?: string) {\n this.logger.console('🗑️ Lane Cleanup');\n\n // If we already have a current lane, use it\n if (currentLane) {\n this.logger.console(chalk.blue(`Found current lane: ${currentLane.name}`));\n const laneId = currentLane.id();\n await this.archiveLane(laneId.toString());\n return;\n }\n\n // If no current lane but explicit lane name provided, try to delete it\n if (explicitLaneName) {\n this.logger.console(chalk.blue(`Using explicitly provided lane name: ${explicitLaneName}`));\n try {\n const laneId = await this.lanes.parseLaneId(explicitLaneName);\n await this.archiveLane(laneId.toString());\n return;\n } catch (e: any) {\n this.logger.console(chalk.yellow(`Failed to parse lane name '${explicitLaneName}': ${e.message}`));\n }\n }\n\n // Try to auto-detect source branch/lane name using the dedicated detector\n const sourceBranchDetector = new SourceBranchDetector(this.logger);\n const sourceBranchName = await sourceBranchDetector.getSourceBranchName(initialCommitSha);\n if (!sourceBranchName) {\n this.logger.console(chalk.yellow('No current lane and unable to detect source branch - skipping lane cleanup'));\n return;\n }\n try {\n const laneIdStr = this.convertBranchToLaneId(sourceBranchName);\n\n this.logger.console(\n chalk.blue(`Attempting to delete lane based on source branch: ${sourceBranchName} -> ${laneIdStr}`)\n );\n\n const laneId = await this.lanes.parseLaneId(laneIdStr);\n await this.archiveLane(laneId.toString());\n } catch (e: any) {\n this.logger.console(\n chalk.yellow(`Error during lane cleanup for source branch '${sourceBranchName}': ${e.message}`)\n );\n }\n }\n\n /**\n * Export with retry on lane hash-mismatch, caused by a concurrent `bit ci pr` run pushing the\n * same lane id between our pre-export delete and the hub's merge (the export takes 1-2 minutes,\n * plenty of time to race). Used by the default (temp-lane) flow. On mismatch we delete the\n * remote lane and retry — the temp-lane flow recreates the lane on every run anyway, so there's\n * no lane history to preserve. (The `--keep-lane` flow instead adopts the remote lane and\n * rebases onto it; see `exportWithAdoptOnConflict`.)\n */\n private async exportWithRetryOnLaneHashMismatch(laneIdStr: string, maxAttempts = 3) {\n const isHashMismatchErr = (err: any) => (err?.message || err?.toString() || '').includes(LANE_HASH_MISMATCH_MARKER);\n\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n try {\n return await this.exporter.export();\n } catch (e: any) {\n if (!isHashMismatchErr(e) || attempt === maxAttempts) throw e;\n this.logger.console(\n chalk.yellow(\n `Export attempt ${attempt}/${maxAttempts} failed with lane hash mismatch on \"${laneIdStr}\" (likely a concurrent CI push). Deleting remote lane and retrying.`\n )\n );\n try {\n await this.archiveLane(laneIdStr, true);\n } catch (archiveErr: any) {\n // Preserve the original export error - rethrowing the archive error would hide the real\n // reason the push was rejected.\n this.logger.console(\n chalk.yellow(\n `Failed to delete remote lane \"${laneIdStr}\" while recovering from hash mismatch: ${archiveErr?.message || archiveErr}. Rethrowing the original export error.`\n )\n );\n if (e && typeof e === 'object' && (e as any).cause == null) {\n (e as any).cause = archiveErr;\n }\n throw e;\n }\n }\n }\n throw new Error(`exportWithRetryOnLaneHashMismatch: exhausted ${maxAttempts} attempts for lane ${laneIdStr}`);\n }\n\n /**\n * Archives (deletes) a lane with proper error handling and logging.\n * @param throwOnError - if true, throws on failure (use for critical operations like pre-export cleanup)\n */\n private async archiveLane(laneId: string, throwOnError = false): Promise<'deleted' | 'not-found' | 'error'> {\n try {\n this.logger.console(chalk.blue(`Archiving lane ${laneId}`));\n // force means to remove the lane even if it was not merged. in this case, we don't care much because main already has the changes.\n const archiveLane = await this.lanes.removeLanes([laneId], { remote: true, force: true });\n if (archiveLane.length) {\n this.logger.console(chalk.green(`Lane '${laneId}' archived successfully`));\n return 'deleted';\n }\n this.logger.console(chalk.yellow(`Failed to archive lane '${laneId}' - no lanes were removed`));\n return 'not-found';\n } catch (e: any) {\n if (e.message?.includes('was not found') || e.toString().includes('was not found')) {\n this.logger.console(chalk.yellow(`Lane '${laneId}' was not found on the remote`));\n return 'not-found';\n }\n this.logger.console(chalk.red(`Error archiving lane '${laneId}': ${e.message}`));\n if (throwOnError) {\n throw new Error(`Failed to delete remote lane '${laneId}': ${e.message}`);\n }\n return 'error';\n // Don't throw the error - lane cleanup is not critical to the merge process\n }\n }\n\n /**\n * Auto-detect version bump from commit messages if no explicit version bump was provided\n */\n private async determineReleaseType(releaseType: ReleaseType, explicitVersionBump?: boolean): Promise<ReleaseType> {\n if (explicitVersionBump) {\n this.logger.console(chalk.blue(`Using explicit version bump: ${releaseType}`));\n return releaseType;\n }\n // Only auto-detect if user didn't specify any version flags\n const lastCommit = await this.getGitCommitMessage();\n if (!lastCommit) {\n this.logger.console(chalk.blue('No commit message found, using default patch'));\n return releaseType;\n }\n const detectedReleaseType = this.parseVersionBumpFromCommit(lastCommit);\n if (detectedReleaseType) {\n this.logger.console(chalk.green(`Auto-detected version bump: ${detectedReleaseType}`));\n return detectedReleaseType;\n }\n this.logger.console(chalk.blue('No specific version bump detected, using default patch'));\n return releaseType;\n }\n}\n\nfunction reportToString(result: string | { data: string }): string {\n return typeof result === 'string' ? result : result.data;\n}\n\nCiAspect.addRuntime(CiMain);\n"],"mappings":";;;;;;AACA,SAA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