@databricks-solutions/lakebase-scm-utils 0.3.9 → 0.3.11

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.
Files changed (69) hide show
  1. package/dist/{pr-e-E4aP4j.d.cts → pr-D-eayWyJ.d.cts} +59 -1
  2. package/dist/{pr-e-E4aP4j.d.ts → pr-D-eayWyJ.d.ts} +59 -1
  3. package/dist/scripts/git/index.cjs +30 -14
  4. package/dist/scripts/git/index.d.cts +32 -1
  5. package/dist/scripts/git/index.d.ts +32 -1
  6. package/dist/scripts/git/index.js +28 -14
  7. package/dist/scripts/github/index.d.cts +2 -60
  8. package/dist/scripts/github/index.d.ts +2 -60
  9. package/dist/scripts/index.cjs +301 -98
  10. package/dist/scripts/index.d.cts +4 -4
  11. package/dist/scripts/index.d.ts +4 -4
  12. package/dist/scripts/index.js +296 -98
  13. package/dist/scripts/lakebase/branch.cli.cjs +55 -10
  14. package/dist/scripts/lakebase/branch.cli.js +55 -10
  15. package/dist/scripts/lakebase/ci-resolve-branch.cli.cjs +59 -24
  16. package/dist/scripts/lakebase/ci-resolve-branch.cli.js +59 -24
  17. package/dist/scripts/lakebase/collapse-heads.cli.cjs +16 -14
  18. package/dist/scripts/lakebase/collapse-heads.cli.js +16 -14
  19. package/dist/scripts/lakebase/cut-backup.cli.cjs +43 -10
  20. package/dist/scripts/lakebase/cut-backup.cli.js +43 -10
  21. package/dist/scripts/lakebase/cut-tier.cli.cjs +43 -10
  22. package/dist/scripts/lakebase/cut-tier.cli.js +43 -10
  23. package/dist/scripts/lakebase/detect-language.cli.cjs +16 -14
  24. package/dist/scripts/lakebase/detect-language.cli.js +16 -14
  25. package/dist/scripts/lakebase/doctor.cli.cjs +16 -14
  26. package/dist/scripts/lakebase/doctor.cli.js +16 -14
  27. package/dist/scripts/lakebase/get-connection.cli.cjs +16 -14
  28. package/dist/scripts/lakebase/get-connection.cli.js +16 -14
  29. package/dist/scripts/lakebase/index.cjs +313 -99
  30. package/dist/scripts/lakebase/index.d.cts +97 -2
  31. package/dist/scripts/lakebase/index.d.ts +97 -2
  32. package/dist/scripts/lakebase/index.js +310 -99
  33. package/dist/scripts/lakebase/infra-runner.cli.cjs +16 -14
  34. package/dist/scripts/lakebase/infra-runner.cli.js +16 -14
  35. package/dist/scripts/lakebase/new-migration.cli.cjs +16 -14
  36. package/dist/scripts/lakebase/new-migration.cli.js +16 -14
  37. package/dist/scripts/lakebase/schema-diff.cli.cjs +16 -14
  38. package/dist/scripts/lakebase/schema-diff.cli.js +16 -14
  39. package/dist/scripts/lakebase/schema-migrate.cli.cjs +16 -14
  40. package/dist/scripts/lakebase/schema-migrate.cli.js +16 -14
  41. package/dist/scripts/lakebase/scm-claim-feature.cli.cjs +59 -24
  42. package/dist/scripts/lakebase/scm-claim-feature.cli.js +59 -24
  43. package/dist/scripts/lakebase/scm-doctor.cli.cjs +59 -24
  44. package/dist/scripts/lakebase/scm-doctor.cli.js +59 -24
  45. package/dist/scripts/lakebase/scm-merge.cli.cjs +16 -14
  46. package/dist/scripts/lakebase/scm-merge.cli.js +16 -14
  47. package/dist/scripts/lakebase/scm-reconcile-tier.cli.cjs +16 -14
  48. package/dist/scripts/lakebase/scm-reconcile-tier.cli.js +16 -14
  49. package/dist/scripts/lakebase/scm-recover-orphans.cli.cjs +43 -10
  50. package/dist/scripts/lakebase/scm-recover-orphans.cli.js +43 -10
  51. package/dist/scripts/lakebase/snapshot.cli.cjs +418 -0
  52. package/dist/scripts/lakebase/snapshot.cli.d.cts +1 -0
  53. package/dist/scripts/lakebase/snapshot.cli.d.ts +1 -0
  54. package/dist/scripts/lakebase/snapshot.cli.js +395 -0
  55. package/dist/scripts/util/index.cjs +2 -2
  56. package/dist/scripts/util/index.js +2 -2
  57. package/package.json +2 -1
  58. package/scripts/git/commit-push.ts +60 -14
  59. package/scripts/lakebase/branch-create.ts +93 -14
  60. package/scripts/lakebase/branch.cli.ts +15 -0
  61. package/scripts/lakebase/create-preflight.ts +213 -1
  62. package/scripts/lakebase/create-project.ts +98 -30
  63. package/scripts/lakebase/get-connection.ts +29 -12
  64. package/scripts/lakebase/snapshot.cli.ts +117 -0
  65. package/scripts/lakebase/snapshot.ts +85 -0
  66. package/templates/project/common/scripts/run-tests.sh +43 -2
  67. package/templates/project/python/tests/conftest.py +22 -0
  68. package/templates/project/common/tests/e2e/__pycache__/conftest.cpython-314.pyc +0 -0
  69. package/templates/project/python/tests/__pycache__/conftest.cpython-314.pyc +0 -0
@@ -1,7 +1,7 @@
1
- export { CreateRepoOptions, GITHUB_SCOPES, GitHubAuthDiagnosis, GitHubAuthSource, GitHubRepoError, GitHubRunnerError, GitHubScopeStatus, GitHubSecretsError, RepoRunner, VsCodeSessionOptions, checkGitHubScopes, createRegistrationToken, createRepo, deleteRepo, deleteRunner, diagnoseGitHubAuth, getActionsEnabled, getCurrentUser, getRepoFullName, getRunnerIdByName, getRunnerStatus, listRepoRunners, listSecretNames, repoExists, resolveGitHubToken, setRepoSecret, setRepoSecrets, tryGhAuthToken, tryVsCodeSession } from './github/index.js';
2
- export { C as CreatePullRequestArgs, F as FastForwardBranchArgs, G as GitHubPullRequestError, M as MergePairedPullRequestArgs, a as MergePairedPullRequestResult, b as MergePullRequestArgs, c as MergePullRequestResult, P as PullRequestCheck, d as PullRequestFile, e as PullRequestInfo, f as PullRequestReview, W as WorkflowRunSummary, g as createPullRequest, h as fastForwardBranch, i as getPullRequest, j as getPullRequestComments, k as getPullRequestFiles, l as getPullRequestReviews, m as listIssueComments, n as listWorkflowRuns, o as mergePairedPullRequest, p as mergePullRequest } from '../pr-e-E4aP4j.js';
3
- export { AbandonFeatureArgs, AbandonFeatureResult, AddE2eToRunTestsScriptArgs, AddE2eToRunTestsScriptResult, AddInfraToPackageJsonArgs, AddInfraToPackageJsonResult, AddInfraToRunTestsScriptArgs, AddInfraToRunTestsScriptResult, AddPlaywrightToPackageJsonArgs, AddPlaywrightToPackageJsonResult, AddPythonE2eDepsArgs, AddPythonE2eDepsResult, AdoptLakebaseProjectArgs, AdoptLakebaseProjectResult, AdoptStateArgs, AdoptStateResult, AppServicePrincipal, AppliedSchemaMigration, ApplySchemaMigrationsArgs, ApplySchemaMigrationsResult, BranchLookupOpts, BranchMetadata, CONVENTION_TIER_DEFAULTS, CatalogExistsArgs, CheckoutMode, CheckoutPairedArgs, CheckoutPairedResult, ClaimFeatureBranchArgs, ClaimFeatureBranchResult, ClaimedOrphan, ClientFramework, CommandDriftReport, CommandFileEntry, CommandFileStatus, ConnectionArgs, ConsortSetupHooks, CreateBranchArgs, CreateConventionBranchArgs, CreateConventionPairedBranchArgs, CreateLongRunningBranchArgs, CreateLongRunningBranchResult, CreatePairedBranchArgs, CreatePairedBranchResult, CreateProjectArgs, CreateProjectResult, CutBackupArgs, CutBackupResult, DEFAULT_PROTECTED_TIER_NAMES, DOTNET_EFCORE_DEFAULTS, DOTNET_FLYWAY_DIR, DatabricksProfile, DeleteAppEndpointArgs, DeleteAppEndpointResult, DeleteBranchArgs, DeletePairedBranchArgs, DeletePairedBranchResult, DeployClaudeCommandsOptions, DeployClaudeCommandsResult, DeployEnvExampleArgs, DeployLanguageProjectArgs, DeploySpringStarterArgs, DeployTarget, DeployTargetsConfig, DetectCommandDriftArgs, DetectScaffoldedDriftArgs, DetectWorkflowDriftArgs, DoctorArgs, DoctorFinding, DoctorReport, DoctorSeverity, DotnetMigrationTool, DsnArgs, DsnResult, EF_DESIGN_PACKAGE, EfCoreProject, EnableE2eForProjectArgs, EnableE2eForProjectResult, EnableInfraForProjectArgs, EnableInfraForProjectResult, EndpointInfo, EnsureAppEndpointArgs, EnsureAppEndpointResult, EnsureEndpointArgs, EnsureLakebaseSecretAuthArgs, EnsureLakebaseSecretAuthResult, EnsureProfilePinnedArgs, EnsureProfilePinnedResult, EnsureSchemaAndVolumeArgs, EnsureSchemaAndVolumeResult, FIXABLE_FINDING_IDS, FixFindingArgs, FixFindingResult, FixableFindingId, GateInvariant, GateStatus, GenerateAppYamlOptions, GenerateMavenProjectOptions, GetAppEndpointArgs, GetAppEndpointResult, GetAppServicePrincipalArgs, GetCiAppEndpointArgs, GetCiAppEndpointResult, GetConnectionArgs, GetCredentialArgs, GetEndpointArgs, GetSchemaDiffArgs, GrantLakebasePermissionArgs, GrantLakebasePermissionResult, GrantUcCatalogPermissionArgs, GrantUcCatalogPermissionResult, HealthDoctorReport, HookVerification, InfraCheckResult, InfraSuiteResult, InitWorkflowStateArgs, InitializrMetadata, InitializrNetworkError, InitializrParseError, InstallPlaywrightArgs, InstallPlaywrightOptions, InstallPlaywrightResult, LakebaseBranchError, LakebaseBranchInfo, LakebaseBranchTtlTooLongError, LakebasePermissionLevel, LakebaseProjectArgs, LakebaseProjectError, LakebaseProjectInfo, LakebaseProjectMetadata, ListSchemaMigrationsArgs, MAVEN_FLYWAY_DIR, MIGRATION_DEFAULTS, MergeArgs, MergePairedArgs, MergePairedResult, MergeResult, MigrationDefaults, MigrationLanguage, MigrationLayout, ModifiedSchemaObject, NODE_E2E_TEMPLATE_FILES, OrphanCandidate, PLAYWRIGHT_TEMPLATE_FILES, PLAYWRIGHT_TEST_VERSION_RANGE, PYTEST_BDD_VERSION_RANGE, PYTEST_PLAYWRIGHT_VERSION_RANGE, PYTHON_E2E_TEMPLATE_FILES, PendingSchemaMigration, PoolArgs, PreflightResult, PreparePrArgs, PreparePrResult, ProgressCallback, ProjectLanguage, PropagateCredentialsArgs, PropagateCredentialsResult, ProtectedBranchCommitError, QueryBranchSchemaArgs, RecoverOrphansArgs, RecoverOrphansResult, ReleaseArgs, ReleaseResult, RemoveRunnerArgs, ResolveDatabricksHostArgs, ResolveMigrationLayoutArgs, RollbackDeployArgs, RollbackDeployResult, RollbackOptions, RollbackSchemaMigrationArgs, RollbackSchemaMigrationResult, RunDoctorDeps, RunInfraSuiteArgs, RunPlaywrightInstallArgs, RunPlaywrightInstallResult, RunnerInfo, RunnerReportFn, RunnerType, SCM_STATES, STATE_FILE_REL, ScaffoldAllArgs, ScaffoldOptions, ScaffoldReportFn, ScaffoldStaticAllArgs, ScaffoldStaticAllResult, ScaffoldedDriftReport, SchemaColumn, SchemaDiffResult, SchemaMigrationError, SchemaMigrationFile, SchemaMigrationLanguage, SchemaMigrationStatusArgs, SchemaMigrationStatusResult, SchemaMigrationToolName, SchemaObject, SchemaQueryRow, ScmAbandonError, ScmAdoptError, ScmClaimError, ScmDoctorFixError, ScmMergeError, ScmPreparePrError, ScmRecoverError, ScmReleaseError, ScmState, ScmWaitCiError, ScmWorkflowState, SetupRunnerArgs, SftddSetupHooks, SpringInitializrClient, SpringJvmLanguage, StaleBranchFinding, SyncEnvArgs, SyncEnvResult, TableSchema, TierTopology, TryCreateCatalogArgs, TryCreateCatalogResult, UcCatalogPermission, UpdateEnvConnectionArgs, UpdateWorkflowsArgs, UpdateWorkflowsResult, UploadDirectoryArgs, UploadDirectoryResult, ValidateAppOptions, ValidateAppResult, ValidationError, ValidationResult, WaitCiArgs, WaitCiResult, WaitForBranchAuthReadyArgs, WaitForBranchReadyArgs, WorkflowDriftReport, WorkflowFileStatus, WorkflowFileUpdate, WorkflowStatus, WorkflowUpdateOutcome, WorkflowVerification, WriteEnvFileArgs, WritePlaywrightTemplatesArgs, WritePlaywrightTemplatesResult, _testMakeBrownfieldFixture, abandonFeatureBranch, addE2eToRunTestsScript, addInfraToPackageJson, addInfraToRunTestsScript, addPlaywrightToPackageJson, adoptLakebaseProject, adoptScmState, applySchemaMigrations, assertAdoptionPreflight, assertCleanForFork, assertCommitTargetNotProtected, assertCreatedProjectReady, buildPostgresUrl, buildSchemaQuery, cacheProjectRetention, catalogExists, catalogExplorerUrl, checkDatabricksAuth, checkGitHubWorkflowScope, checkoutPaired, claimFeatureBranch, clearRetentionCache, compileMigrationPattern, connectionApplicationName, createBranch, createFeaturePairedBranch, createLakebaseProject, createLongRunningBranch, createPairedBranch, createPerfPairedBranch, createProject, createTestPairedBranch, createUatPairedBranch, cutBackup, databricksAuthPrereqMessage, defaultRefreshPromoteWorkflows, deleteAppEndpoint, deleteBranch, deleteLakebaseProject, deletePairedBranch, deleteProjectArgs, deployClaudeAgents, deployClaudeCommands, deployClaudeSettings, deployClaudeSkills, deployClientProject, deployDeployTargets, deployEnv, deployEnvExample, deployGitignore, deployLanguageProject, deployScripts, deploySpringStarter, deployVscodeSettings, deployWorkflows, deriveCiAppName, describeGates, detectCommandDrift, detectLanguage, detectLanguageAt, detectScaffoldedDrift, detectWorkflowDrift, dirIsEmpty, enableE2eForProject, enableInfraForProject, endpointPath, ensureAppEndpoint, ensureCachedArchive, ensureEndpoint, ensureLakebaseSecretAuth, ensureProfilePinned, ensurePythonBddDeps, ensurePythonE2eDeps, ensureSchemaAndVolume, extractPullNumber, featureBranchName, findCsprojFiles, findDefaultBranchName, findEfCoreProject, findHistoryRetentionDuration, fixFinding, flywayMigrationsDir, formatJUnit, formatSchemaDiffAsMarkdown, generateAppYaml, getAppEndpoint, getAppServicePrincipal, getBranchByName, getCachedProjectRetention, getCiAppEndpoint, getConnection, getCredential, getDefaultBranch, getDefaultBranchId, getDefaultBranchName, getEndpoint, getProjectInfo, getProjectRetentionDuration, getRunnerInfo, getSchemaDiff, getTargetNames, githubWorkflowScopePrereqMessage, grantLakebasePermission, grantUcCatalogPermission, hasDotnetMarker, inferTierTopology, initWorkflowState, installHooks, installPlaywright, isAllSchemas, isDotnetFlywayProject, isDotnetProject, isForeignFeatureClaim, isGitTracked, isLongRunningTierBranch, isLtsJavaVersion, isPrereleaseBootVersion, isRunning, isTier, isTtlTooLongError, kitWarmWarning, listAppDeployments, listBranches, listSchemaMigrations, mergeFeature, mergePaired, minLakebaseTtl, mintCredential, normalizeHost, normalizeTierName, parseHostFromAuthDescribe, parseLakebaseTtl, parseTargetsYaml, patchWorkflowsForRunnerType, preparePr, projectPath, propagateCredentials, protectedTierNamesFromEnv, pushFailureHint, queryBranchSchema, queryBranchTables, readEnvVar, readTargets, readWorkflowState, reconcilePromoteRunState, reconcileTierToOrigin, recoverOrphans, release, removeRunner, resolveBranchId, resolveBranchPath, resolveCurrentUser, resolveDatabricksHost, resolveEndpointHost, resolveFeatureStartPoint, resolveJavaHome, resolveLatestBootVersion, resolveLatestLtsJavaVersion, resolveMigrationLanguage, resolveMigrationLayout, resolveParentBranch, resolveProfileForHost, resolveProfileForHostSync, resolveProtectedTierNames, rollbackDeploy, rollbackSchemaMigration, runDoctor, runHealthDoctor, runInfraSuite, runPlaywrightInstall, runnerDir, runnerName, sanitizeFeatureSlug, scaffoldAll, scaffoldStaticAll, schemaMigrationStatus, schemaObjectName, selectProfileForHost, setupRunner, stateFilePath, stopRunner, substituteScmUtilsVersion, substrateVersion, syncEnvToCurrentBranch, tierBranchNames, toolForLanguage, tryCreateCatalog, updateEnvConnection, updateWorkflows, uploadDirectory, validateApp, validateCreateInputs, validateWorkflowState, verifyHooks, verifyProject, verifyWorkflows, waitForBranchAuthReady, waitForBranchReady, waitForCi, warmAndVerifyKit, withLakebaseRollback, workflowStateFileExists, writeEnvFile, writePlaywrightTemplates, writeTargets, writeWorkflowState } from './lakebase/index.js';
4
- export { AddRemoteArgs, AheadBehind, AmendArgs, BranchesAtCommitArgs, CheckoutBranchArgs, CloneRepoArgs, CommitAllArgs, CommitAndPushArgs, CommitArgs, CommitFilesArgs, CreateTagArgs, CreateWorktreeArgs, CwdOnlyArgs, DeleteLocalBranchArgs, DeleteRemoteBranchArgs, DeleteRemoteTagArgs, DeleteTagArgs, DiffFilesArgs, DiscardAllChangesArgs, FetchArgs, FileChangeShort, GetFileAtRefArgs, GetMergeBaseArgs, GitBranchInfo, HasRemoteBranchArgs, IsDirtyArgs, ListLocalBranchesArgs, ListMigrationsOnBranchArgs, ListRemoteBranchesArgs, LogRawArgs, MergeBranchArgs, MergeCommit, NearestParent, OutgoingIncomingArgs, ProtectedBranchError, PublishBranchArgs, PullFromArgs, PushCurrentBranchForPrArgs, PushToArgs, RebaseBranchArgs, RecentMergesArgs, RemoveRemoteArgs, RemoveWorktreeArgs, RenameBranchArgs, ResolveNearestParentArgs, ShaArgs, StashIndexArgs, StashWithMessageArgs, UndoLastCommitArgs, WorkflowScopeError, abortRebase, addRemote, checkoutBranch, checkoutDetached, cherryPick, cloneRepo, commit, commitAll, commitAllIfChanged, commitAllSignedOff, commitAmend, commitAndPush, commitSignedOff, createTag, createWorktree, deleteLocalBranch, deleteRemoteBranch, deleteRemoteTag, deleteTag, discardAllChanges, fetch, getAheadBehind, getBranchesAtCommit, getCommitFiles, getCurrentBranch, getDiffFiles, getFileAtRef, getGitHubUrl, getIncomingCommits, getLogRaw, getLogShortstat, getMergeBase, getNearestParentName, getOutgoingCommits, getOwnerRepo, getRecentMerges, getRepoRoot, gitBranchExists, gitInit, hasRemoteBranch, hasUpstream, isDirty, isRebasing, listLocalBranches, listMigrationsOnBranch, listRemoteBranches, listRemotes, listTags, listWorktrees, mergeBranch, publishBranch, pull, pullFrom, pullRebase, push, pushCurrentBranchForPr, pushTo, rebaseBranch, removeRemote, removeWorktree, renameBranch, resolveDefaultBranch, resolveNearestParent, revert, stash, stashApply, stashDrop, stashDropAll, stashIncludeUntracked, stashList, stashPop, stashStaged, sync, undoLastCommit } from './git/index.js';
1
+ export { GITHUB_SCOPES, GitHubAuthDiagnosis, GitHubAuthSource, GitHubRunnerError, GitHubSecretsError, RepoRunner, VsCodeSessionOptions, createRegistrationToken, deleteRunner, diagnoseGitHubAuth, getRunnerIdByName, getRunnerStatus, listRepoRunners, listSecretNames, resolveGitHubToken, setRepoSecret, setRepoSecrets, tryGhAuthToken, tryVsCodeSession } from './github/index.js';
2
+ export { C as CreatePullRequestArgs, a as CreateRepoOptions, F as FastForwardBranchArgs, G as GitHubPullRequestError, b as GitHubRepoError, c as GitHubScopeStatus, M as MergePairedPullRequestArgs, d as MergePairedPullRequestResult, e as MergePullRequestArgs, f as MergePullRequestResult, P as PullRequestCheck, g as PullRequestFile, h as PullRequestInfo, i as PullRequestReview, W as WorkflowRunSummary, j as checkGitHubScopes, k as createPullRequest, l as createRepo, m as deleteRepo, n as fastForwardBranch, o as getActionsEnabled, p as getCurrentUser, q as getPullRequest, r as getPullRequestComments, s as getPullRequestFiles, t as getPullRequestReviews, u as getRepoFullName, v as listIssueComments, w as listWorkflowRuns, x as mergePairedPullRequest, y as mergePullRequest, z as repoExists } from '../pr-D-eayWyJ.js';
3
+ export { AbandonFeatureArgs, AbandonFeatureResult, AddE2eToRunTestsScriptArgs, AddE2eToRunTestsScriptResult, AddInfraToPackageJsonArgs, AddInfraToPackageJsonResult, AddInfraToRunTestsScriptArgs, AddInfraToRunTestsScriptResult, AddPlaywrightToPackageJsonArgs, AddPlaywrightToPackageJsonResult, AddPythonE2eDepsArgs, AddPythonE2eDepsResult, AdoptLakebaseProjectArgs, AdoptLakebaseProjectResult, AdoptStateArgs, AdoptStateResult, AppServicePrincipal, AppliedSchemaMigration, ApplySchemaMigrationsArgs, ApplySchemaMigrationsResult, BranchLookupOpts, BranchMetadata, CONVENTION_TIER_DEFAULTS, CatalogExistsArgs, CheckoutMode, CheckoutPairedArgs, CheckoutPairedResult, ClaimFeatureBranchArgs, ClaimFeatureBranchResult, ClaimedOrphan, ClientFramework, CommandDriftReport, CommandFileEntry, CommandFileStatus, ConnectionArgs, ConsortSetupHooks, CreateBranchArgs, CreateConventionBranchArgs, CreateConventionPairedBranchArgs, CreateLongRunningBranchArgs, CreateLongRunningBranchResult, CreatePairedBranchArgs, CreatePairedBranchResult, CreateProjectArgs, CreateProjectResult, CreateRollbackOptions, CutBackupArgs, CutBackupResult, DEFAULT_PROTECTED_TIER_NAMES, DOTNET_EFCORE_DEFAULTS, DOTNET_FLYWAY_DIR, DatabricksProfile, DeleteAppEndpointArgs, DeleteAppEndpointResult, DeleteBranchArgs, DeletePairedBranchArgs, DeletePairedBranchResult, DeployClaudeCommandsOptions, DeployClaudeCommandsResult, DeployEnvExampleArgs, DeployLanguageProjectArgs, DeploySpringStarterArgs, DeployTarget, DeployTargetsConfig, DetectCommandDriftArgs, DetectScaffoldedDriftArgs, DetectWorkflowDriftArgs, DoctorArgs, DoctorFinding, DoctorReport, DoctorSeverity, DotnetMigrationTool, DsnArgs, DsnResult, EF_DESIGN_PACKAGE, EfCoreProject, EnableE2eForProjectArgs, EnableE2eForProjectResult, EnableInfraForProjectArgs, EnableInfraForProjectResult, EndpointInfo, EnsureAppEndpointArgs, EnsureAppEndpointResult, EnsureEndpointArgs, EnsureLakebaseSecretAuthArgs, EnsureLakebaseSecretAuthResult, EnsureProfilePinnedArgs, EnsureProfilePinnedResult, EnsureSchemaAndVolumeArgs, EnsureSchemaAndVolumeResult, FIXABLE_FINDING_IDS, FixFindingArgs, FixFindingResult, FixableFindingId, GateInvariant, GateStatus, GenerateAppYamlOptions, GenerateMavenProjectOptions, GetAppEndpointArgs, GetAppEndpointResult, GetAppServicePrincipalArgs, GetCiAppEndpointArgs, GetCiAppEndpointResult, GetConnectionArgs, GetCredentialArgs, GetEndpointArgs, GetSchemaDiffArgs, GitHubPreflightInput, GitHubPreflightResult, GrantLakebasePermissionArgs, GrantLakebasePermissionResult, GrantUcCatalogPermissionArgs, GrantUcCatalogPermissionResult, HealthDoctorReport, HookVerification, InfraCheckResult, InfraSuiteResult, InitWorkflowStateArgs, InitializrMetadata, InitializrNetworkError, InitializrParseError, InstallPlaywrightArgs, InstallPlaywrightOptions, InstallPlaywrightResult, LakebaseBranchError, LakebaseBranchInfo, LakebaseBranchTtlTooLongError, LakebasePermissionLevel, LakebaseProjectArgs, LakebaseProjectError, LakebaseProjectInfo, LakebaseProjectMetadata, ListSchemaMigrationsArgs, MAVEN_FLYWAY_DIR, MIGRATION_DEFAULTS, MergeArgs, MergePairedArgs, MergePairedResult, MergeResult, MigrationDefaults, MigrationLanguage, MigrationLayout, ModifiedSchemaObject, NODE_E2E_TEMPLATE_FILES, OrphanCandidate, PLAYWRIGHT_TEMPLATE_FILES, PLAYWRIGHT_TEST_VERSION_RANGE, PYTEST_BDD_VERSION_RANGE, PYTEST_PLAYWRIGHT_VERSION_RANGE, PYTHON_E2E_TEMPLATE_FILES, PendingSchemaMigration, PoolArgs, PreflightResult, PreparePrArgs, PreparePrResult, ProgressCallback, ProjectLanguage, PropagateCredentialsArgs, PropagateCredentialsResult, ProtectedBranchCommitError, QueryBranchSchemaArgs, RecoverOrphansArgs, RecoverOrphansResult, ReleaseArgs, ReleaseResult, RemoveRunnerArgs, ResolveDatabricksHostArgs, ResolveMigrationLayoutArgs, RollbackDeployArgs, RollbackDeployResult, RollbackLedger, RollbackOptions, RollbackSchemaMigrationArgs, RollbackSchemaMigrationResult, RollbackStep, RunDoctorDeps, RunInfraSuiteArgs, RunPlaywrightInstallArgs, RunPlaywrightInstallResult, RunnerInfo, RunnerReportFn, RunnerType, SCM_STATES, STATE_FILE_REL, ScaffoldAllArgs, ScaffoldOptions, ScaffoldReportFn, ScaffoldStaticAllArgs, ScaffoldStaticAllResult, ScaffoldedDriftReport, SchemaColumn, SchemaDiffResult, SchemaMigrationError, SchemaMigrationFile, SchemaMigrationLanguage, SchemaMigrationStatusArgs, SchemaMigrationStatusResult, SchemaMigrationToolName, SchemaObject, SchemaQueryRow, ScmAbandonError, ScmAdoptError, ScmClaimError, ScmDoctorFixError, ScmMergeError, ScmPreparePrError, ScmRecoverError, ScmReleaseError, ScmState, ScmWaitCiError, ScmWorkflowState, SetupRunnerArgs, SftddSetupHooks, SpringInitializrClient, SpringJvmLanguage, StaleBranchFinding, SyncEnvArgs, SyncEnvResult, TableSchema, TierTopology, TryCreateCatalogArgs, TryCreateCatalogResult, UcCatalogPermission, UpdateEnvConnectionArgs, UpdateWorkflowsArgs, UpdateWorkflowsResult, UploadDirectoryArgs, UploadDirectoryResult, ValidateAppOptions, ValidateAppResult, ValidationError, ValidationResult, WaitCiArgs, WaitCiResult, WaitForBranchAuthReadyArgs, WaitForBranchReadyArgs, WorkflowDriftReport, WorkflowFileStatus, WorkflowFileUpdate, WorkflowStatus, WorkflowUpdateOutcome, WorkflowVerification, WriteEnvFileArgs, WritePlaywrightTemplatesArgs, WritePlaywrightTemplatesResult, _testMakeBrownfieldFixture, abandonFeatureBranch, addE2eToRunTestsScript, addInfraToPackageJson, addInfraToRunTestsScript, addPlaywrightToPackageJson, adoptLakebaseProject, adoptScmState, applySchemaMigrations, assertAdoptionPreflight, assertCleanForFork, assertCommitTargetNotProtected, assertCreatedProjectReady, buildPostgresUrl, buildSchemaQuery, cacheProjectRetention, catalogExists, catalogExplorerUrl, checkDatabricksAuth, checkGitHubPreflight, checkGitHubWorkflowScope, checkoutPaired, claimFeatureBranch, clearRetentionCache, compileMigrationPattern, connectionApplicationName, createBranch, createFeaturePairedBranch, createLakebaseProject, createLongRunningBranch, createPairedBranch, createPerfPairedBranch, createProject, createRollbackLedger, createTestPairedBranch, createUatPairedBranch, cutBackup, databricksAuthPrereqMessage, defaultRefreshPromoteWorkflows, deleteAppEndpoint, deleteBranch, deleteLakebaseProject, deletePairedBranch, deleteProjectArgs, deployClaudeAgents, deployClaudeCommands, deployClaudeSettings, deployClaudeSkills, deployClientProject, deployDeployTargets, deployEnv, deployEnvExample, deployGitignore, deployLanguageProject, deployScripts, deploySpringStarter, deployVscodeSettings, deployWorkflows, deriveCiAppName, describeGates, detectCommandDrift, detectLanguage, detectLanguageAt, detectScaffoldedDrift, detectWorkflowDrift, dirIsEmpty, enableE2eForProject, enableInfraForProject, endpointPath, ensureAppEndpoint, ensureCachedArchive, ensureEndpoint, ensureLakebaseSecretAuth, ensureProfilePinned, ensurePythonBddDeps, ensurePythonE2eDeps, ensureSchemaAndVolume, extractPullNumber, featureBranchName, findCsprojFiles, findDefaultBranchName, findEfCoreProject, findHistoryRetentionDuration, fixFinding, flywayMigrationsDir, formatJUnit, formatSchemaDiffAsMarkdown, generateAppYaml, getAppEndpoint, getAppServicePrincipal, getBranchByName, getCachedProjectRetention, getCiAppEndpoint, getConnection, getCredential, getDefaultBranch, getDefaultBranchId, getDefaultBranchName, getEndpoint, getProjectInfo, getProjectRetentionDuration, getRunnerInfo, getSchemaDiff, getTargetNames, githubWorkflowScopePrereqMessage, grantLakebasePermission, grantUcCatalogPermission, hasDotnetMarker, inferTierTopology, initWorkflowState, installHooks, installPlaywright, isAllSchemas, isDotnetFlywayProject, isDotnetProject, isForeignFeatureClaim, isGitTracked, isLongRunningTierBranch, isLtsJavaVersion, isPrereleaseBootVersion, isRunning, isTier, isTtlTooLongError, kitWarmWarning, listAppDeployments, listBranches, listSchemaMigrations, mergeFeature, mergePaired, minLakebaseTtl, mintCredential, normalizeHost, normalizeTierName, parseHostFromAuthDescribe, parseLakebaseTtl, parseTargetsYaml, patchWorkflowsForRunnerType, preparePr, projectPath, propagateCredentials, protectedTierNamesFromEnv, pushFailureHint, queryBranchSchema, queryBranchTables, readEnvVar, readTargets, readWorkflowState, reconcilePromoteRunState, reconcileTierToOrigin, recoverOrphans, release, removeRunner, resolveBranchId, resolveBranchPath, resolveCurrentUser, resolveDatabricksHost, resolveEndpointHost, resolveFeatureStartPoint, resolveJavaHome, resolveLatestBootVersion, resolveLatestLtsJavaVersion, resolveMigrationLanguage, resolveMigrationLayout, resolveParentBranch, resolveProfileForHost, resolveProfileForHostSync, resolveProtectedTierNames, rollbackDeploy, rollbackSchemaMigration, runDoctor, runHealthDoctor, runInfraSuite, runPlaywrightInstall, runnerDir, runnerName, sanitizeFeatureSlug, scaffoldAll, scaffoldStaticAll, schemaMigrationStatus, schemaObjectName, selectProfileForHost, setupRunner, stateFilePath, stopRunner, substituteScmUtilsVersion, substrateVersion, syncEnvToCurrentBranch, tierBranchNames, toolForLanguage, tryCreateCatalog, updateEnvConnection, updateWorkflows, uploadDirectory, validateApp, validateCreateInputs, validateWorkflowState, verifyHooks, verifyProject, verifyWorkflows, waitForBranchAuthReady, waitForBranchReady, waitForCi, warmAndVerifyKit, withCreateRollback, withLakebaseRollback, workflowStateFileExists, writeEnvFile, writePlaywrightTemplates, writeTargets, writeWorkflowState } from './lakebase/index.js';
4
+ export { AddRemoteArgs, AheadBehind, AmendArgs, BranchesAtCommitArgs, CheckoutBranchArgs, CloneRepoArgs, CommitAllArgs, CommitAndPushArgs, CommitArgs, CommitFilesArgs, CreateTagArgs, CreateWorktreeArgs, CwdOnlyArgs, DeleteLocalBranchArgs, DeleteRemoteBranchArgs, DeleteRemoteTagArgs, DeleteTagArgs, DiffFilesArgs, DiscardAllChangesArgs, FetchArgs, FileChangeShort, GetFileAtRefArgs, GetMergeBaseArgs, GitBranchInfo, HasRemoteBranchArgs, IsDirtyArgs, ListLocalBranchesArgs, ListMigrationsOnBranchArgs, ListRemoteBranchesArgs, LogRawArgs, MergeBranchArgs, MergeCommit, NearestParent, OutgoingIncomingArgs, ProtectedBranchError, PublishBranchArgs, PullFromArgs, PushCurrentBranchForPrArgs, PushInitialArgs, PushToArgs, RebaseBranchArgs, RecentMergesArgs, RemoveRemoteArgs, RemoveWorktreeArgs, RenameBranchArgs, ResolveNearestParentArgs, ShaArgs, StashIndexArgs, StashWithMessageArgs, UndoLastCommitArgs, WorkflowScopeError, abortRebase, addRemote, checkoutBranch, checkoutDetached, cherryPick, cloneRepo, commit, commitAll, commitAllIfChanged, commitAllSignedOff, commitAmend, commitAndPush, commitInitial, commitSignedOff, createTag, createWorktree, deleteLocalBranch, deleteRemoteBranch, deleteRemoteTag, deleteTag, discardAllChanges, fetch, getAheadBehind, getBranchesAtCommit, getCommitFiles, getCurrentBranch, getDiffFiles, getFileAtRef, getGitHubUrl, getIncomingCommits, getLogRaw, getLogShortstat, getMergeBase, getNearestParentName, getOutgoingCommits, getOwnerRepo, getRecentMerges, getRepoRoot, gitBranchExists, gitInit, hasRemoteBranch, hasUpstream, isDirty, isRebasing, listLocalBranches, listMigrationsOnBranch, listRemoteBranches, listRemotes, listTags, listWorktrees, mergeBranch, publishBranch, pull, pullFrom, pullRebase, push, pushCurrentBranchForPr, pushInitial, pushTo, rebaseBranch, removeRemote, removeWorktree, renameBranch, resolveDefaultBranch, resolveNearestParent, revert, stash, stashApply, stashDrop, stashDropAll, stashIncludeUntracked, stashList, stashPop, stashStaged, sync, undoLastCommit } from './git/index.js';
5
5
  export { CopyDirSubstitutedArgs, LAKEBASE_BRANCH_NAME_MAX, OwnerRepo, PROXY_ENV_KEYS, PollProbeDone, PollProbePending, PollProbeResult, PollUntilArgs, PollUntilDoneResult, PollUntilResult, PollUntilTimeoutResult, copyDirSubstituted, delay, extractZipToDir, formatOwnerRepo, isCliEntry, parseOwnerRepo, patchPomForLakebase, pollUntil, pollUntilDefined, proxyEnvSubset, sanitizeArtifactId, sanitizeBranchName, withProxyEnv } from './util/index.js';
6
6
  export { C as CwdOnly, E as ExecOptions, e as exec, s as shq } from '../exec-CwxSWhlz.js';
7
7
  export { C as CI_TOKEN_LIFETIME_SECONDS, a as CI_TOKEN_REMINT_MARGIN_SECONDS, b as CiFreshnessResult, c as CiTokenExpiryArgs, E as EnsureCiSecretsFreshArgs, R as REQUIRED_CI_SECRETS, S as SyncCiSecretsArgs, d as ciTokenComment, e as ciTokenExpiry, f as ensureCiSecretsFresh, g as ensureCiSecretsFreshFromEnv, m as missingCiSecrets, s as syncCiSecrets } from '../ci-secrets-CnGrdQV-.js';
@@ -9535,9 +9535,46 @@ function dbcli3(args, host, timeout = KIT_TIMEOUTS.cliDefault) {
9535
9535
  }
9536
9536
 
9537
9537
  // scripts/lakebase/branch-create.ts
9538
+ function snapshotPath(instance, snapshot) {
9539
+ return snapshot.includes("/") ? snapshot : `${projectPath(instance)}/snapshots/${snapshot}`;
9540
+ }
9541
+ function applyExpiration(spec, ttl, noExpiry) {
9542
+ if (ttl && noExpiry === true) {
9543
+ throw new LakebaseBranchError(
9544
+ `Cannot set both ttl ("${ttl}") and noExpiry: true on the same branch \u2013 they are mutually exclusive. Pass one or the other.`
9545
+ );
9546
+ }
9547
+ if (ttl) spec.ttl = ttl;
9548
+ else if (noExpiry ?? true) spec.no_expiry = true;
9549
+ }
9538
9550
  async function createBranch(args) {
9539
9551
  const sanitized = sanitizeBranchName(args.branch);
9540
9552
  const lookup = { instance: args.instance, host: args.host };
9553
+ if (args.fromSnapshot) {
9554
+ if (args.parentBranch || args.sourceBranchTime || args.sourceBranchLsn) {
9555
+ throw new LakebaseBranchError(
9556
+ `fromSnapshot is mutually exclusive with parentBranch / sourceBranchTime / sourceBranchLsn (the Lakebase API rejects source_snapshot combined with any source_branch field).`
9557
+ );
9558
+ }
9559
+ const existing2 = await getBranchByName(sanitized, lookup);
9560
+ if (existing2) return existing2;
9561
+ const spec = { source_snapshot: snapshotPath(args.instance, args.fromSnapshot) };
9562
+ applyExpiration(spec, args.ttl, args.noExpiry);
9563
+ try {
9564
+ await createWithTtlRecovery(args.instance, sanitized, spec, args.host);
9565
+ } catch (err) {
9566
+ if (err instanceof LakebaseBranchTtlTooLongError) throw err;
9567
+ const landed = await getBranchByName(sanitized, lookup);
9568
+ if (!landed) throw err;
9569
+ }
9570
+ return waitForBranchReady({
9571
+ instance: args.instance,
9572
+ host: args.host,
9573
+ branch: sanitized,
9574
+ timeoutMs: args.readyTimeoutMs ?? KIT_TIMEOUTS.readyWait,
9575
+ pollIntervalMs: args.pollIntervalMs ?? KIT_TIMEOUTS.readyPoll
9576
+ });
9577
+ }
9541
9578
  let sourceBranchPath;
9542
9579
  if (args.parentBranch) {
9543
9580
  if (looksLikeBranchUid(args.parentBranch)) {
@@ -9585,19 +9622,15 @@ async function createBranch(args) {
9585
9622
  assertSourceMatches(existing, sourceBranchPath, sanitized);
9586
9623
  return existing;
9587
9624
  }
9588
- if (args.ttl && args.noExpiry === true) {
9625
+ if (args.sourceBranchTime && args.sourceBranchLsn) {
9589
9626
  throw new LakebaseBranchError(
9590
- `Cannot set both ttl ("${args.ttl}") and noExpiry: true on the same branch \u2013 they are mutually exclusive. Pass one or the other.`
9627
+ `sourceBranchTime and sourceBranchLsn are mutually exclusive \u2013 pass at most one point-in-time.`
9591
9628
  );
9592
9629
  }
9593
- const specObj = {
9594
- source_branch: sourceBranchPath
9595
- };
9596
- if (args.ttl) {
9597
- specObj.ttl = args.ttl;
9598
- } else if (args.noExpiry ?? true) {
9599
- specObj.no_expiry = true;
9600
- }
9630
+ const specObj = { source_branch: sourceBranchPath };
9631
+ if (args.sourceBranchTime) specObj.source_branch_time = args.sourceBranchTime;
9632
+ else if (args.sourceBranchLsn) specObj.source_branch_lsn = args.sourceBranchLsn;
9633
+ applyExpiration(specObj, args.ttl, args.noExpiry);
9601
9634
  try {
9602
9635
  await createWithTtlRecovery(args.instance, sanitized, specObj, args.host);
9603
9636
  } catch (err) {
@@ -9737,8 +9770,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
9737
9770
  var cached;
9738
9771
  function substrateSelfVersion() {
9739
9772
  if (cached !== void 0) return cached;
9740
- if ("0.3.9".length > 0) {
9741
- cached = "0.3.9";
9773
+ if ("0.3.11".length > 0) {
9774
+ cached = "0.3.11";
9742
9775
  return cached;
9743
9776
  }
9744
9777
  cached = "unknown";
@@ -9785,22 +9818,24 @@ async function getConnection(args) {
9785
9818
  const endpointPath2 = `projects/${args.instance}/branches/${branchId}/endpoints/${endpointName}`;
9786
9819
  if (args.output === "dsn") {
9787
9820
  const host2 = await resolveEndpointHost(args.instance, branchId);
9788
- const { token, email: email2 } = await mintCredential(endpointPath2);
9789
- const url = buildPostgresUrl({ host: host2, port: POSTGRES_PORT, database, user: email2, password: token });
9821
+ const { token: token2, email: email2 } = await mintCredential(endpointPath2);
9822
+ const url = buildPostgresUrl({ host: host2, port: POSTGRES_PORT, database, user: email2, password: token2 });
9790
9823
  return { url, host: host2, port: POSTGRES_PORT, database, user: email2, endpointPath: endpointPath2 };
9791
9824
  }
9792
9825
  const host = await resolveEndpointHost(args.instance, branchId);
9793
- const email = await resolveCurrentUser();
9794
9826
  process.env.PGAPPNAME = connectionApplicationName();
9795
- return createLakebasePool({
9796
- endpoint: endpointPath2,
9797
- host,
9798
- database,
9799
- user: email,
9800
- // workspaceClient is passed through verbatim. createLakebasePool falls
9801
- // back to environment / ServiceContext when omitted.
9802
- ...args.workspaceClient !== void 0 ? { workspaceClient: args.workspaceClient } : {}
9803
- });
9827
+ if (args.workspaceClient !== void 0) {
9828
+ const email2 = await resolveCurrentUser();
9829
+ return createLakebasePool({
9830
+ endpoint: endpointPath2,
9831
+ host,
9832
+ database,
9833
+ user: email2,
9834
+ workspaceClient: args.workspaceClient
9835
+ });
9836
+ }
9837
+ const { token, email } = await mintCredential(endpointPath2);
9838
+ return createLakebasePool({ host, database, user: email, password: token });
9804
9839
  }
9805
9840
  async function resolveEndpointHost(instance, branch) {
9806
9841
  const branchId = await resolveBranchId({ instance, branch });
@@ -11443,6 +11478,70 @@ async function checkGitHubWorkflowScope(probe = () => checkGitHubScopes(["workfl
11443
11478
  return { ok: true };
11444
11479
  }
11445
11480
  }
11481
+ async function checkGitHubPreflight(input) {
11482
+ const warnings = [];
11483
+ const hard = input.hardScopes ?? ["repo", "workflow"];
11484
+ const advisory = input.advisoryScopes ?? ["delete_repo"];
11485
+ const currentUserProbe = input.currentUser ?? getCurrentUser;
11486
+ const scopesProbe = input.scopes ?? ((req) => checkGitHubScopes(req));
11487
+ const repoExistsProbe = input.repoExists ?? repoExists;
11488
+ let activeUser;
11489
+ try {
11490
+ activeUser = await currentUserProbe();
11491
+ } catch (err) {
11492
+ return {
11493
+ ok: false,
11494
+ warnings,
11495
+ reason: `GitHub authentication failed: ${err instanceof Error ? err.message : String(err)}. Sign in with \`gh auth login\`, or set GITHUB_TOKEN to a valid token, then re-run.`
11496
+ };
11497
+ }
11498
+ if (activeUser.toLowerCase() !== input.owner.toLowerCase()) {
11499
+ warnings.push(
11500
+ `Signed in to GitHub as "${activeUser}" but creating under "${input.owner}" (an org or another account); ensure "${activeUser}" can create repositories there.`
11501
+ );
11502
+ }
11503
+ try {
11504
+ const { granted, missing } = await scopesProbe([...hard, ...advisory]);
11505
+ if (granted !== null) {
11506
+ const missingHard = missing.filter((s) => hard.includes(s));
11507
+ const missingAdvisory = missing.filter((s) => advisory.includes(s));
11508
+ if (missingHard.length > 0) {
11509
+ return {
11510
+ ok: false,
11511
+ warnings,
11512
+ activeUser,
11513
+ reason: `GitHub token missing required scope(s): ${missingHard.join(", ")} (grants [${granted.join(", ") || "none"}]). Fix: gh auth refresh -h github.com -s ${[...hard].join(",")}`
11514
+ };
11515
+ }
11516
+ if (missingAdvisory.length > 0) {
11517
+ warnings.push(
11518
+ `GitHub token missing the ${missingAdvisory.join(", ")} scope \u2014 automatic rollback of the repo on a failed create is unavailable (you would delete it by hand). Grant it with: gh auth refresh -h github.com -s delete_repo`
11519
+ );
11520
+ }
11521
+ } else {
11522
+ warnings.push(
11523
+ "GitHub token scopes are not visible (fine-grained PAT or App token); cannot pre-verify repo/workflow access , the create will surface any gap when it pushes."
11524
+ );
11525
+ }
11526
+ } catch {
11527
+ warnings.push("Could not read GitHub token scopes (probe error); skipping the scope pre-check.");
11528
+ }
11529
+ try {
11530
+ if (await repoExistsProbe(`${input.owner}/${input.repoName}`)) {
11531
+ return {
11532
+ ok: false,
11533
+ warnings,
11534
+ activeUser,
11535
+ reason: `GitHub repo "${input.owner}/${input.repoName}" already exists. Pick a different project name, or delete the existing repo first.`
11536
+ };
11537
+ }
11538
+ } catch {
11539
+ warnings.push(
11540
+ `Could not check whether "${input.owner}/${input.repoName}" already exists (probe error); the create will fail clearly if it does.`
11541
+ );
11542
+ }
11543
+ return { ok: true, warnings, activeUser };
11544
+ }
11446
11545
  function githubWorkflowScopePrereqMessage(reason) {
11447
11546
  return "The GitHub token lacks the `workflow` OAuth scope, required to push the project's `.github/workflows/*` CI files. (Without this check, scaffolding runs all the way to the final push, is rejected, and rolls back.) Grant the scope, then re-run:\n - gh CLI: gh auth refresh -h github.com -s workflow\n - VS Code: re-sign in to GitHub and approve the workflow scope\n - token: set GITHUB_TOKEN to a PAT that includes the `workflow` scope" + (reason ? `
11448
11547
  (${reason})` : "");
@@ -11508,6 +11607,53 @@ async function withLakebaseRollback(opts, fn) {
11508
11607
  throw wrapped;
11509
11608
  }
11510
11609
  }
11610
+ function createRollbackLedger() {
11611
+ const steps = [];
11612
+ return {
11613
+ register: (label, undo) => {
11614
+ steps.push({ label, undo });
11615
+ },
11616
+ steps: () => steps
11617
+ };
11618
+ }
11619
+ async function withCreateRollback(ledger, opts, fn) {
11620
+ try {
11621
+ return await fn();
11622
+ } catch (err) {
11623
+ const report = opts.report ?? (() => {
11624
+ });
11625
+ const steps = [...ledger.steps()].reverse();
11626
+ const rolledBack = [];
11627
+ const failed = [];
11628
+ if (steps.length > 0) report(`Create failed; rolling back ${steps.length} created resource(s)...`);
11629
+ for (const s of steps) {
11630
+ try {
11631
+ report(` rolling back: ${s.label}`);
11632
+ await s.undo();
11633
+ rolledBack.push(s.label);
11634
+ } catch (e) {
11635
+ const m = e instanceof Error ? e.message : String(e);
11636
+ if (/not.?found/i.test(m)) {
11637
+ rolledBack.push(s.label);
11638
+ continue;
11639
+ }
11640
+ failed.push(`${s.label} (${m})`);
11641
+ }
11642
+ }
11643
+ const base = err instanceof Error ? err.message : String(err);
11644
+ const parts = [];
11645
+ if (rolledBack.length) parts.push(`rolled back: ${rolledBack.join(", ")}`);
11646
+ if (failed.length) {
11647
+ parts.push(
11648
+ `COULD NOT roll back: ${failed.join("; ")} , clean these up by hand before retrying the same name`
11649
+ );
11650
+ }
11651
+ const suffix = parts.length ? ` (${parts.join("; ")})` : "";
11652
+ const wrapped = err instanceof Error ? err : new Error(base);
11653
+ wrapped.message = `${base}${suffix}`;
11654
+ throw wrapped;
11655
+ }
11656
+ }
11511
11657
 
11512
11658
  // scripts/lakebase/create-project.ts
11513
11659
  init_esm_shims();
@@ -11576,26 +11722,38 @@ To finish:
11576
11722
  }
11577
11723
  };
11578
11724
  async function commitAndPush(args) {
11579
- await exec2("git add -A", { cwd: args.projectDir });
11580
- await exec2(`git commit -m ${JSON.stringify(args.message)}`, {
11581
- cwd: args.projectDir,
11725
+ await commitInitial(args.projectDir, args.message);
11726
+ if (args.push === false) return;
11727
+ await pushInitial({ projectDir: args.projectDir, remote: args.remote, branch: args.branch });
11728
+ }
11729
+ async function commitInitial(projectDir, message) {
11730
+ await exec2("git add -A", { cwd: projectDir });
11731
+ await exec2(`git commit -m ${JSON.stringify(message)}`, {
11732
+ cwd: projectDir,
11582
11733
  timeout: 3e4
11583
11734
  });
11584
- if (args.push === false) return;
11735
+ }
11736
+ async function pushInitial(args) {
11585
11737
  const remote = args.remote ?? "origin";
11586
11738
  const branch = args.branch ?? "main";
11587
- try {
11588
- await exec2(`git push -u ${remote} ${branch}`, {
11589
- cwd: args.projectDir,
11590
- timeout: 3e4
11591
- });
11592
- } catch (err) {
11593
- const msg = err instanceof Error ? err.message : String(err);
11594
- if (/without `?workflow`? scope|workflow scope/i.test(msg)) {
11595
- throw new WorkflowScopeError(args.projectDir);
11739
+ const attempts = Math.max(1, args.attempts ?? 1);
11740
+ const sleep2 = args.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
11741
+ const run = args.run ?? ((cmd, cwd) => exec2(cmd, { cwd, timeout: 3e4 }).then(() => void 0));
11742
+ let lastErr;
11743
+ for (let i = 1; i <= attempts; i++) {
11744
+ try {
11745
+ await run(`git push -u ${remote} ${branch}`, args.projectDir);
11746
+ return;
11747
+ } catch (err) {
11748
+ const msg = err instanceof Error ? err.message : String(err);
11749
+ if (/without `?workflow`? scope|workflow scope/i.test(msg)) {
11750
+ throw new WorkflowScopeError(args.projectDir);
11751
+ }
11752
+ lastErr = err;
11753
+ if (i < attempts) await sleep2(args.delayMs ?? 1500);
11596
11754
  }
11597
- throw err;
11598
11755
  }
11756
+ throw lastErr instanceof Error ? lastErr : new Error(String(lastErr));
11599
11757
  }
11600
11758
 
11601
11759
  // scripts/lakebase/scaffold.ts
@@ -13778,64 +13936,72 @@ async function createProject(input, progress) {
13778
13936
  throw new Error(databricksAuthPrereqMessage(host, auth7.reason));
13779
13937
  }
13780
13938
  if (useGithub) {
13781
- report("Checking GitHub token scopes...");
13782
- const scope = await checkGitHubWorkflowScope();
13783
- if (!scope.ok) {
13784
- throw new Error(githubWorkflowScopePrereqMessage(scope.reason));
13785
- }
13786
- }
13787
- if (useGithub) {
13788
- report("Creating GitHub repository...", fullRepoName);
13789
- await createRepo(fullRepoName, {
13790
- private: input.privateRepo !== false,
13791
- description: `Lakebase project: ${input.projectName}`
13792
- });
13793
- report("Waiting for GitHub repo to be visible...", fullRepoName);
13794
- const probeDelays = [1e3, 2e3, 3e3, 5e3, 8e3];
13795
- let probeErr = "";
13796
- let visible = false;
13797
- for (const waitMs of probeDelays) {
13798
- try {
13799
- await getRepoFullName(fullRepoName);
13800
- visible = true;
13801
- break;
13802
- } catch (err) {
13803
- probeErr = err instanceof Error ? err.message : String(err);
13804
- await delay(waitMs);
13805
- }
13806
- }
13807
- if (!visible) {
13808
- let activeUser = "";
13809
- try {
13810
- activeUser = await getCurrentUser();
13811
- } catch {
13812
- }
13813
- const samlHint = /SAML|scope does not match|sso/i.test(probeErr) ? "\n\nThe error mentions SAML \u2013 re-sign in to GitHub and authorize SSO for this org." : "";
13814
- const userHint = activeUser && activeUser !== input.githubOwner ? `
13939
+ report("Checking GitHub account + token requisites...");
13940
+ const gh = await checkGitHubPreflight({ owner: input.githubOwner, repoName: input.projectName });
13941
+ for (const w of gh.warnings) {
13942
+ warnings.push(w);
13943
+ report(`Note: ${w}`);
13944
+ }
13945
+ if (!gh.ok) throw new Error(gh.reason);
13946
+ }
13947
+ const rollback = createRollbackLedger();
13948
+ return await withCreateRollback(
13949
+ rollback,
13950
+ { report },
13951
+ async () => {
13952
+ if (useGithub) {
13953
+ report("Creating GitHub repository...", fullRepoName);
13954
+ await createRepo(fullRepoName, {
13955
+ private: input.privateRepo !== false,
13956
+ description: `Lakebase project: ${input.projectName}`
13957
+ });
13958
+ rollback.register(`GitHub repo ${fullRepoName}`, () => deleteRepo(fullRepoName));
13959
+ report("Waiting for GitHub repo to be visible...", fullRepoName);
13960
+ const probeDelays = [1e3, 2e3, 3e3, 5e3, 8e3];
13961
+ let probeErr = "";
13962
+ let visible = false;
13963
+ for (const waitMs of probeDelays) {
13964
+ try {
13965
+ await getRepoFullName(fullRepoName);
13966
+ visible = true;
13967
+ break;
13968
+ } catch (err) {
13969
+ probeErr = err instanceof Error ? err.message : String(err);
13970
+ await delay(waitMs);
13971
+ }
13972
+ }
13973
+ if (!visible) {
13974
+ let activeUser = "";
13975
+ try {
13976
+ activeUser = await getCurrentUser();
13977
+ } catch {
13978
+ }
13979
+ const samlHint = /SAML|scope does not match|sso/i.test(probeErr) ? "\n\nThe error mentions SAML \u2013 re-sign in to GitHub and authorize SSO for this org." : "";
13980
+ const userHint = activeUser && activeUser !== input.githubOwner ? `
13815
13981
 
13816
13982
  Note: signed in as "${activeUser}", but the repo was created under "${input.githubOwner}".` : "";
13817
- throw new Error(
13818
- `GitHub repo "${fullRepoName}" was created but isn't visible after ~19s of polling.${samlHint}${userHint}
13983
+ throw new Error(
13984
+ `GitHub repo "${fullRepoName}" was created but isn't visible after ~19s of polling.${samlHint}${userHint}
13819
13985
 
13820
13986
  Last probe error:
13821
13987
  ${probeErr.split("\n")[0].slice(0, 200)}`
13822
- );
13823
- }
13824
- report("Cloning repository...", projectDir);
13825
- await cloneRepo({
13826
- repoUrl: `https://github.com/${fullRepoName}.git`,
13827
- parentDir: input.parentDir
13828
- });
13829
- } else {
13830
- report("Creating local project directory...", projectDir);
13831
- fs19.mkdirSync(projectDir, { recursive: true });
13832
- await gitInit(projectDir);
13833
- }
13834
- report("Creating Lakebase database (provisioning Postgres)...", lakebaseProjectId);
13835
- await createLakebaseProject({ projectId: lakebaseProjectId, host });
13836
- return await withLakebaseRollback(
13837
- { projectId: lakebaseProjectId, host, report },
13838
- async () => {
13988
+ );
13989
+ }
13990
+ report("Cloning repository...", projectDir);
13991
+ await cloneRepo({
13992
+ repoUrl: `https://github.com/${fullRepoName}.git`,
13993
+ parentDir: input.parentDir
13994
+ });
13995
+ rollback.register(`local project dir ${projectDir}`, () => fs19.rmSync(projectDir, { recursive: true, force: true }));
13996
+ } else {
13997
+ report("Creating local project directory...", projectDir);
13998
+ fs19.mkdirSync(projectDir, { recursive: true });
13999
+ await gitInit(projectDir);
14000
+ rollback.register(`local project dir ${projectDir}`, () => fs19.rmSync(projectDir, { recursive: true, force: true }));
14001
+ }
14002
+ report("Creating Lakebase database (provisioning Postgres)...", lakebaseProjectId);
14003
+ await createLakebaseProject({ projectId: lakebaseProjectId, host });
14004
+ rollback.register(`Lakebase project ${lakebaseProjectId}`, () => deleteLakebaseProject({ projectId: lakebaseProjectId, host }));
13839
14005
  report("Resolving database endpoint...");
13840
14006
  const defaultBranchId = await getDefaultBranchId({
13841
14007
  projectId: lakebaseProjectId,
@@ -13919,6 +14085,10 @@ Last probe error:
13919
14085
  projectName: input.projectName,
13920
14086
  report: (m) => report(m)
13921
14087
  });
14088
+ rollback.register(
14089
+ `self-hosted runner ${input.projectName}`,
14090
+ () => removeRunner({ fullRepoName, projectName: input.projectName })
14091
+ );
13922
14092
  } catch (err) {
13923
14093
  const msg = err instanceof Error ? err.message : String(err);
13924
14094
  warnings.push(`Runner setup failed: ${msg}`);
@@ -13987,6 +14157,16 @@ Last probe error:
13987
14157
  "The Consort toolkit downloads on first use , run `./scripts/lk --refresh`, or just your first `./scripts/lk` command, and it installs then."
13988
14158
  );
13989
14159
  }
14160
+ if (enableSftdd && useGithub) {
14161
+ report("Warming the Consort toolkit (so the first push doesn't cold-download mid-hook)...");
14162
+ let warm = warmAndVerifyKit(projectDir);
14163
+ if (!warm.ok) warm = warmAndVerifyKit(projectDir);
14164
+ if (!warm.ok) {
14165
+ const m = kitWarmWarning(projectDir, warm.reason);
14166
+ warnings.push(m);
14167
+ report(`Note: ${m}`);
14168
+ }
14169
+ }
13990
14170
  const langLabels = {
13991
14171
  java: "Java/Spring Boot",
13992
14172
  kotlin: "Kotlin/Spring Boot",
@@ -14007,12 +14187,25 @@ Last probe error:
14007
14187
  }
14008
14188
  }
14009
14189
  report("Creating initial commit...");
14010
- await commitAndPush({
14011
- projectDir,
14012
- message: `Initial project scaffold (${langLabel} + Lakebase)`,
14013
- push: useGithub
14014
- });
14015
- if (tiers === 2 || tiers === 3) {
14190
+ await commitInitial(projectDir, `Initial project scaffold (${langLabel} + Lakebase)`);
14191
+ let pushLanded = !useGithub;
14192
+ if (useGithub) {
14193
+ try {
14194
+ await pushInitial({ projectDir, attempts: 2 });
14195
+ pushLanded = true;
14196
+ } catch (err) {
14197
+ if (err instanceof WorkflowScopeError) throw err;
14198
+ const msg = err instanceof Error ? err.message : String(err);
14199
+ const m = `Provisioning is complete, but the initial push did not land after a retry: ${msg}. The project on disk is fine , finish it with: cd ${projectDir} && git push -u origin main`;
14200
+ warnings.push(m);
14201
+ report(`WARNING: ${m}`);
14202
+ }
14203
+ }
14204
+ if ((tiers === 2 || tiers === 3) && !pushLanded) {
14205
+ const m = `INCOMPLETE TIERS: you requested ${tiers} tiers, but the initial push hasn't landed, so the tier branches can't fork off origin yet. After you finish the push (above), cut them with \`./scripts/lk lakebase-cut-tier --name staging --fork-from main\`${tiers === 3 ? " and `--name dev --fork-from staging`" : ""}.`;
14206
+ warnings.push(m);
14207
+ report(`WARNING: ${m}`);
14208
+ } else if (tiers === 2 || tiers === 3) {
14016
14209
  report(`Cutting staging tier (tiers=${tiers}) via createLongRunningBranch...`);
14017
14210
  try {
14018
14211
  await createLongRunningBranch({
@@ -14063,7 +14256,7 @@ Last probe error:
14063
14256
  warnings
14064
14257
  };
14065
14258
  }
14066
- // end withLakebaseRollback closure
14259
+ // end withCreateRollback closure
14067
14260
  );
14068
14261
  }
14069
14262
 
@@ -19452,6 +19645,7 @@ export {
19452
19645
  catalogExists,
19453
19646
  catalogExplorerUrl,
19454
19647
  checkDatabricksAuth,
19648
+ checkGitHubPreflight,
19455
19649
  checkGitHubScopes,
19456
19650
  checkGitHubWorkflowScope,
19457
19651
  checkoutBranch,
@@ -19469,6 +19663,7 @@ export {
19469
19663
  commitAllSignedOff,
19470
19664
  commitAmend,
19471
19665
  commitAndPush,
19666
+ commitInitial,
19472
19667
  commitSignedOff,
19473
19668
  compileMigrationPattern,
19474
19669
  connectionApplicationName,
@@ -19483,6 +19678,7 @@ export {
19483
19678
  createPullRequest,
19484
19679
  createRegistrationToken,
19485
19680
  createRepo,
19681
+ createRollbackLedger,
19486
19682
  createTag,
19487
19683
  createTestPairedBranch,
19488
19684
  createUatPairedBranch,
@@ -19666,6 +19862,7 @@ export {
19666
19862
  push,
19667
19863
  pushCurrentBranchForPr,
19668
19864
  pushFailureHint,
19865
+ pushInitial,
19669
19866
  pushTo,
19670
19867
  queryBranchSchema,
19671
19868
  queryBranchTables,
@@ -19755,6 +19952,7 @@ export {
19755
19952
  waitForBranchReady,
19756
19953
  waitForCi,
19757
19954
  warmAndVerifyKit,
19955
+ withCreateRollback,
19758
19956
  withLakebaseRollback,
19759
19957
  withProxyEnv,
19760
19958
  workflowStateFileExists,