@databricks-solutions/lakebase-scm-utils 0.3.10 → 0.3.12

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 (49) 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 +268 -76
  10. package/dist/scripts/index.d.cts +4 -4
  11. package/dist/scripts/index.d.ts +4 -4
  12. package/dist/scripts/index.js +261 -76
  13. package/dist/scripts/lakebase/ci-resolve-branch.cli.cjs +2 -2
  14. package/dist/scripts/lakebase/ci-resolve-branch.cli.js +2 -2
  15. package/dist/scripts/lakebase/collapse-heads.cli.cjs +2 -2
  16. package/dist/scripts/lakebase/collapse-heads.cli.js +2 -2
  17. package/dist/scripts/lakebase/detect-language.cli.cjs +2 -2
  18. package/dist/scripts/lakebase/detect-language.cli.js +2 -2
  19. package/dist/scripts/lakebase/doctor.cli.cjs +2 -2
  20. package/dist/scripts/lakebase/doctor.cli.js +2 -2
  21. package/dist/scripts/lakebase/get-connection.cli.cjs +2 -2
  22. package/dist/scripts/lakebase/get-connection.cli.js +2 -2
  23. package/dist/scripts/lakebase/index.cjs +280 -77
  24. package/dist/scripts/lakebase/index.d.cts +97 -2
  25. package/dist/scripts/lakebase/index.d.ts +97 -2
  26. package/dist/scripts/lakebase/index.js +275 -77
  27. package/dist/scripts/lakebase/infra-runner.cli.cjs +2 -2
  28. package/dist/scripts/lakebase/infra-runner.cli.js +2 -2
  29. package/dist/scripts/lakebase/new-migration.cli.cjs +2 -2
  30. package/dist/scripts/lakebase/new-migration.cli.js +2 -2
  31. package/dist/scripts/lakebase/schema-diff.cli.cjs +2 -2
  32. package/dist/scripts/lakebase/schema-diff.cli.js +2 -2
  33. package/dist/scripts/lakebase/schema-migrate.cli.cjs +2 -2
  34. package/dist/scripts/lakebase/schema-migrate.cli.js +2 -2
  35. package/dist/scripts/lakebase/scm-claim-feature.cli.cjs +2 -2
  36. package/dist/scripts/lakebase/scm-claim-feature.cli.js +2 -2
  37. package/dist/scripts/lakebase/scm-doctor.cli.cjs +2 -2
  38. package/dist/scripts/lakebase/scm-doctor.cli.js +2 -2
  39. package/dist/scripts/lakebase/scm-merge.cli.cjs +2 -2
  40. package/dist/scripts/lakebase/scm-merge.cli.js +2 -2
  41. package/dist/scripts/lakebase/scm-reconcile-tier.cli.cjs +2 -2
  42. package/dist/scripts/lakebase/scm-reconcile-tier.cli.js +2 -2
  43. package/dist/scripts/util/index.cjs +2 -2
  44. package/dist/scripts/util/index.js +2 -2
  45. package/package.json +1 -1
  46. package/scripts/git/commit-push.ts +60 -14
  47. package/scripts/lakebase/create-preflight.ts +213 -1
  48. package/scripts/lakebase/create-project.ts +98 -30
  49. package/scripts/lakebase/scaffold.ts +50 -0
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
389
389
  var cached;
390
390
  function substrateSelfVersion() {
391
391
  if (cached !== void 0) return cached;
392
- if ("0.3.10".length > 0) {
393
- cached = "0.3.10";
392
+ if ("0.3.12".length > 0) {
393
+ cached = "0.3.12";
394
394
  return cached;
395
395
  }
396
396
  cached = "unknown";
@@ -78963,6 +78963,7 @@ __export(lakebase_exports, {
78963
78963
  ScmReleaseError: () => ScmReleaseError,
78964
78964
  ScmWaitCiError: () => ScmWaitCiError,
78965
78965
  SpringInitializrClient: () => SpringInitializrClient,
78966
+ TEST_CAPTURE_ROOT_FILES: () => TEST_CAPTURE_ROOT_FILES,
78966
78967
  _testMakeBrownfieldFixture: () => _testMakeBrownfieldFixture,
78967
78968
  abandonFeatureBranch: () => abandonFeatureBranch,
78968
78969
  addE2eToRunTestsScript: () => addE2eToRunTestsScript,
@@ -78982,6 +78983,7 @@ __export(lakebase_exports, {
78982
78983
  catalogExists: () => catalogExists,
78983
78984
  catalogExplorerUrl: () => catalogExplorerUrl,
78984
78985
  checkDatabricksAuth: () => checkDatabricksAuth,
78986
+ checkGitHubPreflight: () => checkGitHubPreflight,
78985
78987
  checkGitHubWorkflowScope: () => checkGitHubWorkflowScope,
78986
78988
  checkoutPaired: () => checkoutPaired,
78987
78989
  claimFeatureBranch: () => claimFeatureBranch,
@@ -78995,6 +78997,7 @@ __export(lakebase_exports, {
78995
78997
  createPairedBranch: () => createPairedBranch,
78996
78998
  createPerfPairedBranch: () => createPerfPairedBranch,
78997
78999
  createProject: () => createProject,
79000
+ createRollbackLedger: () => createRollbackLedger,
78998
79001
  createTestPairedBranch: () => createTestPairedBranch,
78999
79002
  createUatPairedBranch: () => createUatPairedBranch,
79000
79003
  cutBackup: () => cutBackup,
@@ -79017,6 +79020,7 @@ __export(lakebase_exports, {
79017
79020
  deployLanguageProject: () => deployLanguageProject,
79018
79021
  deployScripts: () => deployScripts,
79019
79022
  deploySpringStarter: () => deploySpringStarter,
79023
+ deployTestCaptureRoot: () => deployTestCaptureRoot,
79020
79024
  deployVscodeSettings: () => deployVscodeSettings,
79021
79025
  deployWorkflows: () => deployWorkflows,
79022
79026
  deriveCiAppName: () => deriveCiAppName,
@@ -79164,6 +79168,7 @@ __export(lakebase_exports, {
79164
79168
  waitForBranchReady: () => waitForBranchReady,
79165
79169
  waitForCi: () => waitForCi,
79166
79170
  warmAndVerifyKit: () => warmAndVerifyKit,
79171
+ withCreateRollback: () => withCreateRollback,
79167
79172
  withLakebaseRollback: () => withLakebaseRollback,
79168
79173
  workflowStateFileExists: () => workflowStateFileExists,
79169
79174
  writeEnvFile: () => writeEnvFile,
@@ -81640,8 +81645,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
81640
81645
  var cached;
81641
81646
  function substrateSelfVersion() {
81642
81647
  if (cached !== void 0) return cached;
81643
- if ("0.3.10".length > 0) {
81644
- cached = "0.3.10";
81648
+ if ("0.3.12".length > 0) {
81649
+ cached = "0.3.12";
81645
81650
  return cached;
81646
81651
  }
81647
81652
  cached = "unknown";
@@ -90221,6 +90226,26 @@ async function createRepo(name, opts = {}) {
90221
90226
  wrap2(err, `Failed to create repository "${name}"`);
90222
90227
  }
90223
90228
  }
90229
+ async function deleteRepo(name) {
90230
+ try {
90231
+ const { owner, repo } = parseOwnerRepo(name);
90232
+ const ctx = await newContext();
90233
+ await ctx.octokit.rest.repos.delete({ owner, repo });
90234
+ } catch (err) {
90235
+ wrap2(err, `Failed to delete repository "${name}"`);
90236
+ }
90237
+ }
90238
+ async function repoExists(name) {
90239
+ try {
90240
+ const { owner, repo } = parseOwnerRepo(name);
90241
+ const ctx = await newContext();
90242
+ await ctx.octokit.rest.repos.get({ owner, repo });
90243
+ return true;
90244
+ } catch (err) {
90245
+ if (err instanceof RequestError && err.status === 404) return false;
90246
+ wrap2(err, `Failed to check repository "${name}"`);
90247
+ }
90248
+ }
90224
90249
  async function getActionsEnabled(ownerRepo) {
90225
90250
  try {
90226
90251
  const { owner, repo } = parseOwnerRepo(ownerRepo);
@@ -90289,6 +90314,70 @@ async function checkGitHubWorkflowScope(probe = () => checkGitHubScopes(["workfl
90289
90314
  return { ok: true };
90290
90315
  }
90291
90316
  }
90317
+ async function checkGitHubPreflight(input) {
90318
+ const warnings = [];
90319
+ const hard = input.hardScopes ?? ["repo", "workflow"];
90320
+ const advisory = input.advisoryScopes ?? ["delete_repo"];
90321
+ const currentUserProbe = input.currentUser ?? getCurrentUser;
90322
+ const scopesProbe = input.scopes ?? ((req) => checkGitHubScopes(req));
90323
+ const repoExistsProbe = input.repoExists ?? repoExists;
90324
+ let activeUser;
90325
+ try {
90326
+ activeUser = await currentUserProbe();
90327
+ } catch (err) {
90328
+ return {
90329
+ ok: false,
90330
+ warnings,
90331
+ 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.`
90332
+ };
90333
+ }
90334
+ if (activeUser.toLowerCase() !== input.owner.toLowerCase()) {
90335
+ warnings.push(
90336
+ `Signed in to GitHub as "${activeUser}" but creating under "${input.owner}" (an org or another account); ensure "${activeUser}" can create repositories there.`
90337
+ );
90338
+ }
90339
+ try {
90340
+ const { granted, missing } = await scopesProbe([...hard, ...advisory]);
90341
+ if (granted !== null) {
90342
+ const missingHard = missing.filter((s2) => hard.includes(s2));
90343
+ const missingAdvisory = missing.filter((s2) => advisory.includes(s2));
90344
+ if (missingHard.length > 0) {
90345
+ return {
90346
+ ok: false,
90347
+ warnings,
90348
+ activeUser,
90349
+ reason: `GitHub token missing required scope(s): ${missingHard.join(", ")} (grants [${granted.join(", ") || "none"}]). Fix: gh auth refresh -h github.com -s ${[...hard].join(",")}`
90350
+ };
90351
+ }
90352
+ if (missingAdvisory.length > 0) {
90353
+ warnings.push(
90354
+ `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`
90355
+ );
90356
+ }
90357
+ } else {
90358
+ warnings.push(
90359
+ "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."
90360
+ );
90361
+ }
90362
+ } catch {
90363
+ warnings.push("Could not read GitHub token scopes (probe error); skipping the scope pre-check.");
90364
+ }
90365
+ try {
90366
+ if (await repoExistsProbe(`${input.owner}/${input.repoName}`)) {
90367
+ return {
90368
+ ok: false,
90369
+ warnings,
90370
+ activeUser,
90371
+ reason: `GitHub repo "${input.owner}/${input.repoName}" already exists. Pick a different project name, or delete the existing repo first.`
90372
+ };
90373
+ }
90374
+ } catch {
90375
+ warnings.push(
90376
+ `Could not check whether "${input.owner}/${input.repoName}" already exists (probe error); the create will fail clearly if it does.`
90377
+ );
90378
+ }
90379
+ return { ok: true, warnings, activeUser };
90380
+ }
90292
90381
  function githubWorkflowScopePrereqMessage(reason) {
90293
90382
  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 ? `
90294
90383
  (${reason})` : "");
@@ -90354,6 +90443,53 @@ async function withLakebaseRollback(opts, fn) {
90354
90443
  throw wrapped;
90355
90444
  }
90356
90445
  }
90446
+ function createRollbackLedger() {
90447
+ const steps = [];
90448
+ return {
90449
+ register: (label, undo) => {
90450
+ steps.push({ label, undo });
90451
+ },
90452
+ steps: () => steps
90453
+ };
90454
+ }
90455
+ async function withCreateRollback(ledger, opts, fn) {
90456
+ try {
90457
+ return await fn();
90458
+ } catch (err) {
90459
+ const report = opts.report ?? (() => {
90460
+ });
90461
+ const steps = [...ledger.steps()].reverse();
90462
+ const rolledBack = [];
90463
+ const failed = [];
90464
+ if (steps.length > 0) report(`Create failed; rolling back ${steps.length} created resource(s)...`);
90465
+ for (const s2 of steps) {
90466
+ try {
90467
+ report(` rolling back: ${s2.label}`);
90468
+ await s2.undo();
90469
+ rolledBack.push(s2.label);
90470
+ } catch (e2) {
90471
+ const m2 = e2 instanceof Error ? e2.message : String(e2);
90472
+ if (/not.?found/i.test(m2)) {
90473
+ rolledBack.push(s2.label);
90474
+ continue;
90475
+ }
90476
+ failed.push(`${s2.label} (${m2})`);
90477
+ }
90478
+ }
90479
+ const base = err instanceof Error ? err.message : String(err);
90480
+ const parts = [];
90481
+ if (rolledBack.length) parts.push(`rolled back: ${rolledBack.join(", ")}`);
90482
+ if (failed.length) {
90483
+ parts.push(
90484
+ `COULD NOT roll back: ${failed.join("; ")} , clean these up by hand before retrying the same name`
90485
+ );
90486
+ }
90487
+ const suffix = parts.length ? ` (${parts.join("; ")})` : "";
90488
+ const wrapped = err instanceof Error ? err : new Error(base);
90489
+ wrapped.message = `${base}${suffix}`;
90490
+ throw wrapped;
90491
+ }
90492
+ }
90357
90493
 
90358
90494
  // scripts/lakebase/create-project.ts
90359
90495
  init_cjs_shims();
@@ -90421,27 +90557,34 @@ To finish:
90421
90557
  this.name = "WorkflowScopeError";
90422
90558
  }
90423
90559
  };
90424
- async function commitAndPush(args) {
90425
- await exec2("git add -A", { cwd: args.projectDir });
90426
- await exec2(`git commit -m ${JSON.stringify(args.message)}`, {
90427
- cwd: args.projectDir,
90560
+ async function commitInitial(projectDir, message) {
90561
+ await exec2("git add -A", { cwd: projectDir });
90562
+ await exec2(`git commit -m ${JSON.stringify(message)}`, {
90563
+ cwd: projectDir,
90428
90564
  timeout: 3e4
90429
90565
  });
90430
- if (args.push === false) return;
90566
+ }
90567
+ async function pushInitial(args) {
90431
90568
  const remote = args.remote ?? "origin";
90432
90569
  const branch = args.branch ?? "main";
90433
- try {
90434
- await exec2(`git push -u ${remote} ${branch}`, {
90435
- cwd: args.projectDir,
90436
- timeout: 3e4
90437
- });
90438
- } catch (err) {
90439
- const msg = err instanceof Error ? err.message : String(err);
90440
- if (/without `?workflow`? scope|workflow scope/i.test(msg)) {
90441
- throw new WorkflowScopeError(args.projectDir);
90570
+ const attempts = Math.max(1, args.attempts ?? 1);
90571
+ const sleep2 = args.sleep ?? ((ms) => new Promise((r2) => setTimeout(r2, ms)));
90572
+ const run = args.run ?? ((cmd, cwd) => exec2(cmd, { cwd, timeout: 3e4 }).then(() => void 0));
90573
+ let lastErr;
90574
+ for (let i2 = 1; i2 <= attempts; i2++) {
90575
+ try {
90576
+ await run(`git push -u ${remote} ${branch}`, args.projectDir);
90577
+ return;
90578
+ } catch (err) {
90579
+ const msg = err instanceof Error ? err.message : String(err);
90580
+ if (/without `?workflow`? scope|workflow scope/i.test(msg)) {
90581
+ throw new WorkflowScopeError(args.projectDir);
90582
+ }
90583
+ lastErr = err;
90584
+ if (i2 < attempts) await sleep2(args.delayMs ?? 1500);
90442
90585
  }
90443
- throw err;
90444
90586
  }
90587
+ throw lastErr instanceof Error ? lastErr : new Error(String(lastErr));
90445
90588
  }
90446
90589
 
90447
90590
  // scripts/lakebase/scaffold.ts
@@ -91174,6 +91317,20 @@ async function deployVscodeSettings(targetDir, opts) {
91174
91317
  fs13.mkdirSync(destDir, { recursive: true });
91175
91318
  fs13.copyFileSync(src, path10.join(destDir, "settings.json"));
91176
91319
  }
91320
+ var TEST_CAPTURE_ROOT_FILES = ["consort-capture.ts", "consort-test-reporter.ts"];
91321
+ function deployTestCaptureRoot(targetDir, opts) {
91322
+ const src = commonDir(opts);
91323
+ const written = [];
91324
+ for (const rel of TEST_CAPTURE_ROOT_FILES) {
91325
+ const from = path10.join(src, rel);
91326
+ if (!fs13.existsSync(from)) {
91327
+ throw new Error(`Kit template missing: ${from}`);
91328
+ }
91329
+ fs13.copyFileSync(from, path10.join(targetDir, rel));
91330
+ written.push(rel);
91331
+ }
91332
+ return written;
91333
+ }
91177
91334
  async function deployGitignore(targetDir, language = "java", opts) {
91178
91335
  const base = fs13.readFileSync(path10.join(commonDir(opts), ".gitignore.base"), "utf-8");
91179
91336
  const extraPath = path10.join(langDir(language, opts), ".gitignore.extra");
@@ -91308,6 +91465,12 @@ async function scaffoldAll(args) {
91308
91465
  });
91309
91466
  if (client.length > 0) staticResult.client = client;
91310
91467
  }
91468
+ if (args.clientFramework === "react" || language === "nodejs") {
91469
+ report("Deploying root test-capture modules");
91470
+ staticResult.testCapture = deployTestCaptureRoot(args.targetDir, {
91471
+ templatesDir: args.templatesDir
91472
+ });
91473
+ }
91311
91474
  return staticResult;
91312
91475
  }
91313
91476
 
@@ -92747,64 +92910,72 @@ async function createProject(input, progress) {
92747
92910
  throw new Error(databricksAuthPrereqMessage(host, auth7.reason));
92748
92911
  }
92749
92912
  if (useGithub) {
92750
- report("Checking GitHub token scopes...");
92751
- const scope = await checkGitHubWorkflowScope();
92752
- if (!scope.ok) {
92753
- throw new Error(githubWorkflowScopePrereqMessage(scope.reason));
92754
- }
92755
- }
92756
- if (useGithub) {
92757
- report("Creating GitHub repository...", fullRepoName);
92758
- await createRepo(fullRepoName, {
92759
- private: input.privateRepo !== false,
92760
- description: `Lakebase project: ${input.projectName}`
92761
- });
92762
- report("Waiting for GitHub repo to be visible...", fullRepoName);
92763
- const probeDelays = [1e3, 2e3, 3e3, 5e3, 8e3];
92764
- let probeErr = "";
92765
- let visible = false;
92766
- for (const waitMs of probeDelays) {
92767
- try {
92768
- await getRepoFullName(fullRepoName);
92769
- visible = true;
92770
- break;
92771
- } catch (err) {
92772
- probeErr = err instanceof Error ? err.message : String(err);
92773
- await delay(waitMs);
92774
- }
92775
- }
92776
- if (!visible) {
92777
- let activeUser = "";
92778
- try {
92779
- activeUser = await getCurrentUser();
92780
- } catch {
92781
- }
92782
- 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." : "";
92783
- const userHint = activeUser && activeUser !== input.githubOwner ? `
92913
+ report("Checking GitHub account + token requisites...");
92914
+ const gh = await checkGitHubPreflight({ owner: input.githubOwner, repoName: input.projectName });
92915
+ for (const w of gh.warnings) {
92916
+ warnings.push(w);
92917
+ report(`Note: ${w}`);
92918
+ }
92919
+ if (!gh.ok) throw new Error(gh.reason);
92920
+ }
92921
+ const rollback = createRollbackLedger();
92922
+ return await withCreateRollback(
92923
+ rollback,
92924
+ { report },
92925
+ async () => {
92926
+ if (useGithub) {
92927
+ report("Creating GitHub repository...", fullRepoName);
92928
+ await createRepo(fullRepoName, {
92929
+ private: input.privateRepo !== false,
92930
+ description: `Lakebase project: ${input.projectName}`
92931
+ });
92932
+ rollback.register(`GitHub repo ${fullRepoName}`, () => deleteRepo(fullRepoName));
92933
+ report("Waiting for GitHub repo to be visible...", fullRepoName);
92934
+ const probeDelays = [1e3, 2e3, 3e3, 5e3, 8e3];
92935
+ let probeErr = "";
92936
+ let visible = false;
92937
+ for (const waitMs of probeDelays) {
92938
+ try {
92939
+ await getRepoFullName(fullRepoName);
92940
+ visible = true;
92941
+ break;
92942
+ } catch (err) {
92943
+ probeErr = err instanceof Error ? err.message : String(err);
92944
+ await delay(waitMs);
92945
+ }
92946
+ }
92947
+ if (!visible) {
92948
+ let activeUser = "";
92949
+ try {
92950
+ activeUser = await getCurrentUser();
92951
+ } catch {
92952
+ }
92953
+ 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." : "";
92954
+ const userHint = activeUser && activeUser !== input.githubOwner ? `
92784
92955
 
92785
92956
  Note: signed in as "${activeUser}", but the repo was created under "${input.githubOwner}".` : "";
92786
- throw new Error(
92787
- `GitHub repo "${fullRepoName}" was created but isn't visible after ~19s of polling.${samlHint}${userHint}
92957
+ throw new Error(
92958
+ `GitHub repo "${fullRepoName}" was created but isn't visible after ~19s of polling.${samlHint}${userHint}
92788
92959
 
92789
92960
  Last probe error:
92790
92961
  ${probeErr.split("\n")[0].slice(0, 200)}`
92791
- );
92792
- }
92793
- report("Cloning repository...", projectDir);
92794
- await cloneRepo({
92795
- repoUrl: `https://github.com/${fullRepoName}.git`,
92796
- parentDir: input.parentDir
92797
- });
92798
- } else {
92799
- report("Creating local project directory...", projectDir);
92800
- fs20.mkdirSync(projectDir, { recursive: true });
92801
- await gitInit(projectDir);
92802
- }
92803
- report("Creating Lakebase database (provisioning Postgres)...", lakebaseProjectId);
92804
- await createLakebaseProject({ projectId: lakebaseProjectId, host });
92805
- return await withLakebaseRollback(
92806
- { projectId: lakebaseProjectId, host, report },
92807
- async () => {
92962
+ );
92963
+ }
92964
+ report("Cloning repository...", projectDir);
92965
+ await cloneRepo({
92966
+ repoUrl: `https://github.com/${fullRepoName}.git`,
92967
+ parentDir: input.parentDir
92968
+ });
92969
+ rollback.register(`local project dir ${projectDir}`, () => fs20.rmSync(projectDir, { recursive: true, force: true }));
92970
+ } else {
92971
+ report("Creating local project directory...", projectDir);
92972
+ fs20.mkdirSync(projectDir, { recursive: true });
92973
+ await gitInit(projectDir);
92974
+ rollback.register(`local project dir ${projectDir}`, () => fs20.rmSync(projectDir, { recursive: true, force: true }));
92975
+ }
92976
+ report("Creating Lakebase database (provisioning Postgres)...", lakebaseProjectId);
92977
+ await createLakebaseProject({ projectId: lakebaseProjectId, host });
92978
+ rollback.register(`Lakebase project ${lakebaseProjectId}`, () => deleteLakebaseProject({ projectId: lakebaseProjectId, host }));
92808
92979
  report("Resolving database endpoint...");
92809
92980
  const defaultBranchId = await getDefaultBranchId({
92810
92981
  projectId: lakebaseProjectId,
@@ -92888,6 +93059,10 @@ Last probe error:
92888
93059
  projectName: input.projectName,
92889
93060
  report: (m2) => report(m2)
92890
93061
  });
93062
+ rollback.register(
93063
+ `self-hosted runner ${input.projectName}`,
93064
+ () => removeRunner({ fullRepoName, projectName: input.projectName })
93065
+ );
92891
93066
  } catch (err) {
92892
93067
  const msg = err instanceof Error ? err.message : String(err);
92893
93068
  warnings.push(`Runner setup failed: ${msg}`);
@@ -92956,6 +93131,16 @@ Last probe error:
92956
93131
  "The Consort toolkit downloads on first use , run `./scripts/lk --refresh`, or just your first `./scripts/lk` command, and it installs then."
92957
93132
  );
92958
93133
  }
93134
+ if (enableSftdd && useGithub) {
93135
+ report("Warming the Consort toolkit (so the first push doesn't cold-download mid-hook)...");
93136
+ let warm = warmAndVerifyKit(projectDir);
93137
+ if (!warm.ok) warm = warmAndVerifyKit(projectDir);
93138
+ if (!warm.ok) {
93139
+ const m2 = kitWarmWarning(projectDir, warm.reason);
93140
+ warnings.push(m2);
93141
+ report(`Note: ${m2}`);
93142
+ }
93143
+ }
92959
93144
  const langLabels = {
92960
93145
  java: "Java/Spring Boot",
92961
93146
  kotlin: "Kotlin/Spring Boot",
@@ -92976,12 +93161,25 @@ Last probe error:
92976
93161
  }
92977
93162
  }
92978
93163
  report("Creating initial commit...");
92979
- await commitAndPush({
92980
- projectDir,
92981
- message: `Initial project scaffold (${langLabel} + Lakebase)`,
92982
- push: useGithub
92983
- });
92984
- if (tiers === 2 || tiers === 3) {
93164
+ await commitInitial(projectDir, `Initial project scaffold (${langLabel} + Lakebase)`);
93165
+ let pushLanded = !useGithub;
93166
+ if (useGithub) {
93167
+ try {
93168
+ await pushInitial({ projectDir, attempts: 2 });
93169
+ pushLanded = true;
93170
+ } catch (err) {
93171
+ if (err instanceof WorkflowScopeError) throw err;
93172
+ const msg = err instanceof Error ? err.message : String(err);
93173
+ const m2 = `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`;
93174
+ warnings.push(m2);
93175
+ report(`WARNING: ${m2}`);
93176
+ }
93177
+ }
93178
+ if ((tiers === 2 || tiers === 3) && !pushLanded) {
93179
+ const m2 = `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`" : ""}.`;
93180
+ warnings.push(m2);
93181
+ report(`WARNING: ${m2}`);
93182
+ } else if (tiers === 2 || tiers === 3) {
92985
93183
  report(`Cutting staging tier (tiers=${tiers}) via createLongRunningBranch...`);
92986
93184
  try {
92987
93185
  await createLongRunningBranch({
@@ -93032,7 +93230,7 @@ Last probe error:
93032
93230
  warnings
93033
93231
  };
93034
93232
  }
93035
- // end withLakebaseRollback closure
93233
+ // end withCreateRollback closure
93036
93234
  );
93037
93235
  }
93038
93236
 
@@ -97812,6 +98010,7 @@ function isUcMissingError(msg) {
97812
98010
  ScmReleaseError,
97813
98011
  ScmWaitCiError,
97814
98012
  SpringInitializrClient,
98013
+ TEST_CAPTURE_ROOT_FILES,
97815
98014
  _testMakeBrownfieldFixture,
97816
98015
  abandonFeatureBranch,
97817
98016
  addE2eToRunTestsScript,
@@ -97831,6 +98030,7 @@ function isUcMissingError(msg) {
97831
98030
  catalogExists,
97832
98031
  catalogExplorerUrl,
97833
98032
  checkDatabricksAuth,
98033
+ checkGitHubPreflight,
97834
98034
  checkGitHubWorkflowScope,
97835
98035
  checkoutPaired,
97836
98036
  claimFeatureBranch,
@@ -97844,6 +98044,7 @@ function isUcMissingError(msg) {
97844
98044
  createPairedBranch,
97845
98045
  createPerfPairedBranch,
97846
98046
  createProject,
98047
+ createRollbackLedger,
97847
98048
  createTestPairedBranch,
97848
98049
  createUatPairedBranch,
97849
98050
  cutBackup,
@@ -97866,6 +98067,7 @@ function isUcMissingError(msg) {
97866
98067
  deployLanguageProject,
97867
98068
  deployScripts,
97868
98069
  deploySpringStarter,
98070
+ deployTestCaptureRoot,
97869
98071
  deployVscodeSettings,
97870
98072
  deployWorkflows,
97871
98073
  deriveCiAppName,
@@ -98013,6 +98215,7 @@ function isUcMissingError(msg) {
98013
98215
  waitForBranchReady,
98014
98216
  waitForCi,
98015
98217
  warmAndVerifyKit,
98218
+ withCreateRollback,
98016
98219
  withLakebaseRollback,
98017
98220
  workflowStateFileExists,
98018
98221
  writeEnvFile,