@databricks-solutions/lakebase-scm-utils 0.2.41 → 0.2.43
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/dist/scripts/github/index.cjs +3 -1
- package/dist/scripts/github/index.js +3 -1
- package/dist/scripts/github/pr.cli.cjs +3 -1
- package/dist/scripts/github/pr.cli.js +3 -1
- package/dist/scripts/index.cjs +84 -21
- package/dist/scripts/index.d.cts +1 -1
- package/dist/scripts/index.d.ts +1 -1
- package/dist/scripts/index.js +76 -15
- package/dist/scripts/lakebase/branch.cli.cjs +3 -1
- package/dist/scripts/lakebase/branch.cli.js +3 -1
- package/dist/scripts/lakebase/ci-app-endpoint.cli.cjs +3 -1
- package/dist/scripts/lakebase/ci-app-endpoint.cli.js +3 -1
- package/dist/scripts/lakebase/ci-resolve-branch.cli.cjs +5 -3
- package/dist/scripts/lakebase/ci-resolve-branch.cli.js +5 -3
- package/dist/scripts/lakebase/collapse-heads.cli.cjs +5 -3
- package/dist/scripts/lakebase/collapse-heads.cli.js +5 -3
- package/dist/scripts/lakebase/cut-backup.cli.cjs +3 -1
- package/dist/scripts/lakebase/cut-backup.cli.js +3 -1
- package/dist/scripts/lakebase/cut-tier.cli.cjs +3 -1
- package/dist/scripts/lakebase/cut-tier.cli.js +3 -1
- package/dist/scripts/lakebase/detect-language.cli.cjs +5 -3
- package/dist/scripts/lakebase/detect-language.cli.js +5 -3
- package/dist/scripts/lakebase/doctor.cli.cjs +5 -3
- package/dist/scripts/lakebase/doctor.cli.js +5 -3
- package/dist/scripts/lakebase/get-connection.cli.cjs +5 -3
- package/dist/scripts/lakebase/get-connection.cli.js +5 -3
- package/dist/scripts/lakebase/index.cjs +84 -21
- package/dist/scripts/lakebase/index.d.cts +21 -1
- package/dist/scripts/lakebase/index.d.ts +21 -1
- package/dist/scripts/lakebase/index.js +76 -15
- package/dist/scripts/lakebase/infra-runner.cli.cjs +5 -3
- package/dist/scripts/lakebase/infra-runner.cli.js +5 -3
- package/dist/scripts/lakebase/new-migration.cli.cjs +5 -3
- package/dist/scripts/lakebase/new-migration.cli.js +5 -3
- package/dist/scripts/lakebase/schema-diff.cli.cjs +5 -3
- package/dist/scripts/lakebase/schema-diff.cli.js +5 -3
- package/dist/scripts/lakebase/schema-migrate.cli.cjs +5 -3
- package/dist/scripts/lakebase/schema-migrate.cli.js +5 -3
- package/dist/scripts/lakebase/scm-abandon-feature.cli.cjs +37 -1
- package/dist/scripts/lakebase/scm-abandon-feature.cli.js +37 -1
- package/dist/scripts/lakebase/scm-adopt-state.cli.cjs +37 -1
- package/dist/scripts/lakebase/scm-adopt-state.cli.js +37 -1
- package/dist/scripts/lakebase/scm-claim-feature.cli.cjs +45 -9
- package/dist/scripts/lakebase/scm-claim-feature.cli.js +39 -3
- package/dist/scripts/lakebase/scm-cleanup.cli.cjs +3 -1
- package/dist/scripts/lakebase/scm-cleanup.cli.js +3 -1
- package/dist/scripts/lakebase/scm-doctor.cli.cjs +56 -29
- package/dist/scripts/lakebase/scm-doctor.cli.js +50 -23
- package/dist/scripts/lakebase/scm-feature-branch.cli.cjs +1 -0
- package/dist/scripts/lakebase/scm-feature-branch.cli.js +1 -0
- package/dist/scripts/lakebase/scm-merge.cli.cjs +61 -9
- package/dist/scripts/lakebase/scm-merge.cli.js +55 -3
- package/dist/scripts/lakebase/scm-prepare-pr.cli.cjs +34 -0
- package/dist/scripts/lakebase/scm-prepare-pr.cli.js +34 -0
- package/dist/scripts/lakebase/scm-reconcile-tier.cli.cjs +6 -3
- package/dist/scripts/lakebase/scm-reconcile-tier.cli.js +6 -3
- package/dist/scripts/lakebase/scm-recover-orphans.cli.cjs +37 -1
- package/dist/scripts/lakebase/scm-recover-orphans.cli.js +37 -1
- package/dist/scripts/lakebase/scm-state.cli.cjs +5 -4
- package/dist/scripts/lakebase/scm-state.cli.js +4 -3
- package/dist/scripts/lakebase/scm-wait-ci.cli.cjs +34 -0
- package/dist/scripts/lakebase/scm-wait-ci.cli.js +34 -0
- package/dist/scripts/util/index.cjs +5 -3
- package/dist/scripts/util/index.js +5 -3
- package/package.json +1 -1
- package/scripts/lakebase/databricks-cli.ts +7 -1
- package/scripts/lakebase/enable-e2e.ts +19 -3
- package/scripts/lakebase/scm-doctor.ts +1 -12
- package/scripts/lakebase/scm-merge.ts +36 -0
- package/scripts/lakebase/scm-workflow-state.ts +49 -0
- package/templates/project/common/.github/workflows/merge.yml +17 -6
- package/templates/project/common/.github/workflows/pr.yml +17 -6
- package/templates/project/common/.gitignore.base +8 -0
- package/templates/project/common/scripts/run-tests.sh +18 -1
- package/templates/project/python/tests/__pycache__/conftest.cpython-314.pyc +0 -0
- package/templates/project/python/tests/conftest.py +10 -3
|
@@ -219,7 +219,9 @@ function resolveProfile(opts) {
|
|
|
219
219
|
function buildInvocation(args, opts) {
|
|
220
220
|
const base = opts.env ?? process.env;
|
|
221
221
|
const trimmedHost = effectiveHost(opts)?.replace(/\/+$/, "");
|
|
222
|
-
const env =
|
|
222
|
+
const env = { ...base };
|
|
223
|
+
if (trimmedHost) env.DATABRICKS_HOST = trimmedHost;
|
|
224
|
+
delete env.DATABRICKS_WORKSPACE_ID;
|
|
223
225
|
const profile = resolveProfile(opts);
|
|
224
226
|
const argv = profile && !opts.noProfile && !args.includes("--profile") ? [...args, "--profile", profile] : args;
|
|
225
227
|
return { argv, env, profile };
|
|
@@ -406,6 +408,39 @@ function dbcli(args, host) {
|
|
|
406
408
|
// scripts/lakebase/scm-workflow-state.ts
|
|
407
409
|
import * as fs3 from "fs";
|
|
408
410
|
import * as path2 from "path";
|
|
411
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
412
|
+
function isGitTracked(projectDir, rel) {
|
|
413
|
+
try {
|
|
414
|
+
execFileSync3("git", ["ls-files", "--error-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
415
|
+
return true;
|
|
416
|
+
} catch {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function ensureWorkflowStateUntracked(projectDir) {
|
|
421
|
+
const rel = ".lakebase/workflow-state.json";
|
|
422
|
+
try {
|
|
423
|
+
if (isGitTracked(projectDir, rel)) {
|
|
424
|
+
execFileSync3("git", ["rm", "--cached", "--quiet", "--ignore-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
425
|
+
}
|
|
426
|
+
} catch {
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
const gitignore = path2.join(projectDir, ".gitignore");
|
|
430
|
+
const existing = fs3.existsSync(gitignore) ? fs3.readFileSync(gitignore, "utf8") : "";
|
|
431
|
+
if (!existing.split("\n").some((l) => l.trim() === rel)) {
|
|
432
|
+
const sep = existing === "" || existing.endsWith("\n") ? "" : "\n";
|
|
433
|
+
fs3.appendFileSync(
|
|
434
|
+
gitignore,
|
|
435
|
+
`${sep}# Runtime SCM claim state (per working tree): a branch checkout must never restore
|
|
436
|
+
# a stale committed claim over the live one (issue #203 / Finding 28).
|
|
437
|
+
${rel}
|
|
438
|
+
`
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
} catch {
|
|
442
|
+
}
|
|
443
|
+
}
|
|
409
444
|
var SCM_STATES = [
|
|
410
445
|
"scaffold-complete",
|
|
411
446
|
"feature-claimed",
|
|
@@ -452,6 +487,7 @@ function writeWorkflowState(projectDir, state) {
|
|
|
452
487
|
throw new Error(`Refusing to write invalid SCM state:
|
|
453
488
|
${summary}`);
|
|
454
489
|
}
|
|
490
|
+
ensureWorkflowStateUntracked(projectDir);
|
|
455
491
|
const dir = path2.join(projectDir, ".lakebase");
|
|
456
492
|
fs3.mkdirSync(dir, { recursive: true });
|
|
457
493
|
const target = stateFilePath(projectDir);
|
|
@@ -77826,7 +77826,9 @@ function resolveProfile(opts) {
|
|
|
77826
77826
|
function buildInvocation(args, opts) {
|
|
77827
77827
|
const base = opts.env ?? process.env;
|
|
77828
77828
|
const trimmedHost = effectiveHost(opts)?.replace(/\/+$/, "");
|
|
77829
|
-
const env =
|
|
77829
|
+
const env = { ...base };
|
|
77830
|
+
if (trimmedHost) env.DATABRICKS_HOST = trimmedHost;
|
|
77831
|
+
delete env.DATABRICKS_WORKSPACE_ID;
|
|
77830
77832
|
const profile = resolveProfile(opts);
|
|
77831
77833
|
const argv = profile && !opts.noProfile && !args.includes("--profile") ? [...args, "--profile", profile] : args;
|
|
77832
77834
|
return { argv, env, profile };
|
|
@@ -79763,8 +79765,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
79763
79765
|
var cached;
|
|
79764
79766
|
function substrateSelfVersion() {
|
|
79765
79767
|
if (cached !== void 0) return cached;
|
|
79766
|
-
if ("0.2.
|
|
79767
|
-
cached = "0.2.
|
|
79768
|
+
if ("0.2.43".length > 0) {
|
|
79769
|
+
cached = "0.2.43";
|
|
79768
79770
|
return cached;
|
|
79769
79771
|
}
|
|
79770
79772
|
cached = "unknown";
|
|
@@ -80225,6 +80227,39 @@ async function createFeaturePairedBranch(args) {
|
|
|
80225
80227
|
init_cjs_shims();
|
|
80226
80228
|
var fs6 = __toESM(require("fs"), 1);
|
|
80227
80229
|
var path4 = __toESM(require("path"), 1);
|
|
80230
|
+
var import_node_child_process4 = require("child_process");
|
|
80231
|
+
function isGitTracked(projectDir, rel) {
|
|
80232
|
+
try {
|
|
80233
|
+
(0, import_node_child_process4.execFileSync)("git", ["ls-files", "--error-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
80234
|
+
return true;
|
|
80235
|
+
} catch {
|
|
80236
|
+
return false;
|
|
80237
|
+
}
|
|
80238
|
+
}
|
|
80239
|
+
function ensureWorkflowStateUntracked(projectDir) {
|
|
80240
|
+
const rel = ".lakebase/workflow-state.json";
|
|
80241
|
+
try {
|
|
80242
|
+
if (isGitTracked(projectDir, rel)) {
|
|
80243
|
+
(0, import_node_child_process4.execFileSync)("git", ["rm", "--cached", "--quiet", "--ignore-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
80244
|
+
}
|
|
80245
|
+
} catch {
|
|
80246
|
+
}
|
|
80247
|
+
try {
|
|
80248
|
+
const gitignore = path4.join(projectDir, ".gitignore");
|
|
80249
|
+
const existing = fs6.existsSync(gitignore) ? fs6.readFileSync(gitignore, "utf8") : "";
|
|
80250
|
+
if (!existing.split("\n").some((l) => l.trim() === rel)) {
|
|
80251
|
+
const sep2 = existing === "" || existing.endsWith("\n") ? "" : "\n";
|
|
80252
|
+
fs6.appendFileSync(
|
|
80253
|
+
gitignore,
|
|
80254
|
+
`${sep2}# Runtime SCM claim state (per working tree): a branch checkout must never restore
|
|
80255
|
+
# a stale committed claim over the live one (issue #203 / Finding 28).
|
|
80256
|
+
${rel}
|
|
80257
|
+
`
|
|
80258
|
+
);
|
|
80259
|
+
}
|
|
80260
|
+
} catch {
|
|
80261
|
+
}
|
|
80262
|
+
}
|
|
80228
80263
|
var SCM_STATES = [
|
|
80229
80264
|
"scaffold-complete",
|
|
80230
80265
|
"feature-claimed",
|
|
@@ -80271,6 +80306,7 @@ function writeWorkflowState(projectDir, state) {
|
|
|
80271
80306
|
throw new Error(`Refusing to write invalid SCM state:
|
|
80272
80307
|
${summary}`);
|
|
80273
80308
|
}
|
|
80309
|
+
ensureWorkflowStateUntracked(projectDir);
|
|
80274
80310
|
const dir = path4.join(projectDir, ".lakebase");
|
|
80275
80311
|
fs6.mkdirSync(dir, { recursive: true });
|
|
80276
80312
|
const target = stateFilePath(projectDir);
|
|
@@ -80681,7 +80717,7 @@ var path8 = __toESM(require("path"), 1);
|
|
|
80681
80717
|
|
|
80682
80718
|
// scripts/lakebase/schema-migrate-runners/alembic.ts
|
|
80683
80719
|
init_cjs_shims();
|
|
80684
|
-
var
|
|
80720
|
+
var import_node_child_process5 = require("child_process");
|
|
80685
80721
|
var fs9 = __toESM(require("fs"), 1);
|
|
80686
80722
|
var path7 = __toESM(require("path"), 1);
|
|
80687
80723
|
function resolveAlembicBin(projectDir) {
|
|
@@ -80703,7 +80739,7 @@ function spawnAlembic(projectDir, args, dsn) {
|
|
|
80703
80739
|
const env = { ...process.env };
|
|
80704
80740
|
env.PYTHONPATH = [projectDir, process.env.PYTHONPATH].filter(Boolean).join(path7.delimiter);
|
|
80705
80741
|
if (dsn) env.DATABASE_URL = dsn;
|
|
80706
|
-
const child = (0,
|
|
80742
|
+
const child = (0, import_node_child_process5.spawn)(bin, args, {
|
|
80707
80743
|
cwd: projectDir,
|
|
80708
80744
|
env,
|
|
80709
80745
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -81065,7 +81101,7 @@ var path10 = __toESM(require("path"), 1);
|
|
|
81065
81101
|
|
|
81066
81102
|
// scripts/lakebase/schema-migrate-runners/flyway.ts
|
|
81067
81103
|
init_cjs_shims();
|
|
81068
|
-
var
|
|
81104
|
+
var import_node_child_process6 = require("child_process");
|
|
81069
81105
|
var path9 = __toESM(require("path"), 1);
|
|
81070
81106
|
function dsnToFlywayEnv(dsn) {
|
|
81071
81107
|
const u = new URL(dsn);
|
|
@@ -81081,7 +81117,7 @@ function migrationsLocation(projectDir) {
|
|
|
81081
81117
|
function runFlyway(ctx, args) {
|
|
81082
81118
|
const { url, user, password } = dsnToFlywayEnv(ctx.dsn);
|
|
81083
81119
|
return new Promise((resolve3, reject) => {
|
|
81084
|
-
const child = (0,
|
|
81120
|
+
const child = (0, import_node_child_process6.spawn)(
|
|
81085
81121
|
"flyway",
|
|
81086
81122
|
["-outputType=json", `-locations=${migrationsLocation(ctx.projectDir)}`, ...args],
|
|
81087
81123
|
{
|
|
@@ -81318,7 +81354,7 @@ var path12 = __toESM(require("path"), 1);
|
|
|
81318
81354
|
|
|
81319
81355
|
// scripts/lakebase/schema-migrate-runners/knex.ts
|
|
81320
81356
|
init_cjs_shims();
|
|
81321
|
-
var
|
|
81357
|
+
var import_node_child_process7 = require("child_process");
|
|
81322
81358
|
var fs12 = __toESM(require("fs"), 1);
|
|
81323
81359
|
var path11 = __toESM(require("path"), 1);
|
|
81324
81360
|
var KNEXFILE_VARIANTS = ["knexfile.js", "knexfile.ts", "knexfile.mjs", "knexfile.cjs"];
|
|
@@ -81340,7 +81376,7 @@ function spawnKnex(projectDir, args, dsn) {
|
|
|
81340
81376
|
);
|
|
81341
81377
|
return;
|
|
81342
81378
|
}
|
|
81343
|
-
const child = (0,
|
|
81379
|
+
const child = (0, import_node_child_process7.spawn)("npx", ["--no-install", "knex", "--knexfile", knexfile, ...args], {
|
|
81344
81380
|
cwd: projectDir,
|
|
81345
81381
|
env: dsn ? { ...process.env, DATABASE_URL: dsn } : { ...process.env },
|
|
81346
81382
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -296,7 +296,9 @@ function resolveProfile(opts) {
|
|
|
296
296
|
function buildInvocation(args, opts) {
|
|
297
297
|
const base = opts.env ?? process.env;
|
|
298
298
|
const trimmedHost = effectiveHost(opts)?.replace(/\/+$/, "");
|
|
299
|
-
const env =
|
|
299
|
+
const env = { ...base };
|
|
300
|
+
if (trimmedHost) env.DATABRICKS_HOST = trimmedHost;
|
|
301
|
+
delete env.DATABRICKS_WORKSPACE_ID;
|
|
300
302
|
const profile = resolveProfile(opts);
|
|
301
303
|
const argv = profile && !opts.noProfile && !args.includes("--profile") ? [...args, "--profile", profile] : args;
|
|
302
304
|
return { argv, env, profile };
|
|
@@ -844,8 +846,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
844
846
|
var cached;
|
|
845
847
|
function substrateSelfVersion() {
|
|
846
848
|
if (cached !== void 0) return cached;
|
|
847
|
-
if ("0.2.
|
|
848
|
-
cached = "0.2.
|
|
849
|
+
if ("0.2.43".length > 0) {
|
|
850
|
+
cached = "0.2.43";
|
|
849
851
|
return cached;
|
|
850
852
|
}
|
|
851
853
|
cached = "unknown";
|
|
@@ -1304,6 +1306,39 @@ async function createFeaturePairedBranch(args) {
|
|
|
1304
1306
|
// scripts/lakebase/scm-workflow-state.ts
|
|
1305
1307
|
import * as fs5 from "fs";
|
|
1306
1308
|
import * as path4 from "path";
|
|
1309
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
1310
|
+
function isGitTracked(projectDir, rel) {
|
|
1311
|
+
try {
|
|
1312
|
+
execFileSync4("git", ["ls-files", "--error-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
1313
|
+
return true;
|
|
1314
|
+
} catch {
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
function ensureWorkflowStateUntracked(projectDir) {
|
|
1319
|
+
const rel = ".lakebase/workflow-state.json";
|
|
1320
|
+
try {
|
|
1321
|
+
if (isGitTracked(projectDir, rel)) {
|
|
1322
|
+
execFileSync4("git", ["rm", "--cached", "--quiet", "--ignore-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
1323
|
+
}
|
|
1324
|
+
} catch {
|
|
1325
|
+
}
|
|
1326
|
+
try {
|
|
1327
|
+
const gitignore = path4.join(projectDir, ".gitignore");
|
|
1328
|
+
const existing = fs5.existsSync(gitignore) ? fs5.readFileSync(gitignore, "utf8") : "";
|
|
1329
|
+
if (!existing.split("\n").some((l) => l.trim() === rel)) {
|
|
1330
|
+
const sep2 = existing === "" || existing.endsWith("\n") ? "" : "\n";
|
|
1331
|
+
fs5.appendFileSync(
|
|
1332
|
+
gitignore,
|
|
1333
|
+
`${sep2}# Runtime SCM claim state (per working tree): a branch checkout must never restore
|
|
1334
|
+
# a stale committed claim over the live one (issue #203 / Finding 28).
|
|
1335
|
+
${rel}
|
|
1336
|
+
`
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
} catch {
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1307
1342
|
var SCM_STATES = [
|
|
1308
1343
|
"scaffold-complete",
|
|
1309
1344
|
"feature-claimed",
|
|
@@ -1350,6 +1385,7 @@ function writeWorkflowState(projectDir, state) {
|
|
|
1350
1385
|
throw new Error(`Refusing to write invalid SCM state:
|
|
1351
1386
|
${summary}`);
|
|
1352
1387
|
}
|
|
1388
|
+
ensureWorkflowStateUntracked(projectDir);
|
|
1353
1389
|
const dir = path4.join(projectDir, ".lakebase");
|
|
1354
1390
|
fs5.mkdirSync(dir, { recursive: true });
|
|
1355
1391
|
const target = stateFilePath(projectDir);
|
|
@@ -239,7 +239,9 @@ function resolveProfile(opts) {
|
|
|
239
239
|
function buildInvocation(args, opts) {
|
|
240
240
|
const base = opts.env ?? process.env;
|
|
241
241
|
const trimmedHost = effectiveHost(opts)?.replace(/\/+$/, "");
|
|
242
|
-
const env =
|
|
242
|
+
const env = { ...base };
|
|
243
|
+
if (trimmedHost) env.DATABRICKS_HOST = trimmedHost;
|
|
244
|
+
delete env.DATABRICKS_WORKSPACE_ID;
|
|
243
245
|
const profile = resolveProfile(opts);
|
|
244
246
|
const argv = profile && !opts.noProfile && !args.includes("--profile") ? [...args, "--profile", profile] : args;
|
|
245
247
|
return { argv, env, profile };
|
|
@@ -199,7 +199,9 @@ function resolveProfile(opts) {
|
|
|
199
199
|
function buildInvocation(args, opts) {
|
|
200
200
|
const base = opts.env ?? process.env;
|
|
201
201
|
const trimmedHost = effectiveHost(opts)?.replace(/\/+$/, "");
|
|
202
|
-
const env =
|
|
202
|
+
const env = { ...base };
|
|
203
|
+
if (trimmedHost) env.DATABRICKS_HOST = trimmedHost;
|
|
204
|
+
delete env.DATABRICKS_WORKSPACE_ID;
|
|
203
205
|
const profile = resolveProfile(opts);
|
|
204
206
|
const argv = profile && !opts.noProfile && !args.includes("--profile") ? [...args, "--profile", profile] : args;
|
|
205
207
|
return { argv, env, profile };
|
|
@@ -78963,7 +78963,6 @@ function isCliEntry(importMetaUrl2) {
|
|
|
78963
78963
|
// scripts/lakebase/scm-doctor.ts
|
|
78964
78964
|
init_cjs_shims();
|
|
78965
78965
|
var fs14 = __toESM(require("fs"), 1);
|
|
78966
|
-
var import_node_child_process8 = require("child_process");
|
|
78967
78966
|
var path13 = __toESM(require("path"), 1);
|
|
78968
78967
|
|
|
78969
78968
|
// scripts/lakebase/branch-utils.ts
|
|
@@ -79237,7 +79236,9 @@ function resolveProfile(opts) {
|
|
|
79237
79236
|
function buildInvocation(args, opts) {
|
|
79238
79237
|
const base = opts.env ?? process.env;
|
|
79239
79238
|
const trimmedHost = effectiveHost(opts)?.replace(/\/+$/, "");
|
|
79240
|
-
const env =
|
|
79239
|
+
const env = { ...base };
|
|
79240
|
+
if (trimmedHost) env.DATABRICKS_HOST = trimmedHost;
|
|
79241
|
+
delete env.DATABRICKS_WORKSPACE_ID;
|
|
79241
79242
|
const profile = resolveProfile(opts);
|
|
79242
79243
|
const argv = profile && !opts.noProfile && !args.includes("--profile") ? [...args, "--profile", profile] : args;
|
|
79243
79244
|
return { argv, env, profile };
|
|
@@ -86158,6 +86159,39 @@ init_cjs_shims();
|
|
|
86158
86159
|
init_cjs_shims();
|
|
86159
86160
|
var fs3 = __toESM(require("fs"), 1);
|
|
86160
86161
|
var path2 = __toESM(require("path"), 1);
|
|
86162
|
+
var import_node_child_process4 = require("child_process");
|
|
86163
|
+
function isGitTracked(projectDir, rel) {
|
|
86164
|
+
try {
|
|
86165
|
+
(0, import_node_child_process4.execFileSync)("git", ["ls-files", "--error-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
86166
|
+
return true;
|
|
86167
|
+
} catch {
|
|
86168
|
+
return false;
|
|
86169
|
+
}
|
|
86170
|
+
}
|
|
86171
|
+
function ensureWorkflowStateUntracked(projectDir) {
|
|
86172
|
+
const rel = ".lakebase/workflow-state.json";
|
|
86173
|
+
try {
|
|
86174
|
+
if (isGitTracked(projectDir, rel)) {
|
|
86175
|
+
(0, import_node_child_process4.execFileSync)("git", ["rm", "--cached", "--quiet", "--ignore-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
86176
|
+
}
|
|
86177
|
+
} catch {
|
|
86178
|
+
}
|
|
86179
|
+
try {
|
|
86180
|
+
const gitignore = path2.join(projectDir, ".gitignore");
|
|
86181
|
+
const existing = fs3.existsSync(gitignore) ? fs3.readFileSync(gitignore, "utf8") : "";
|
|
86182
|
+
if (!existing.split("\n").some((l) => l.trim() === rel)) {
|
|
86183
|
+
const sep3 = existing === "" || existing.endsWith("\n") ? "" : "\n";
|
|
86184
|
+
fs3.appendFileSync(
|
|
86185
|
+
gitignore,
|
|
86186
|
+
`${sep3}# Runtime SCM claim state (per working tree): a branch checkout must never restore
|
|
86187
|
+
# a stale committed claim over the live one (issue #203 / Finding 28).
|
|
86188
|
+
${rel}
|
|
86189
|
+
`
|
|
86190
|
+
);
|
|
86191
|
+
}
|
|
86192
|
+
} catch {
|
|
86193
|
+
}
|
|
86194
|
+
}
|
|
86161
86195
|
var SCM_STATES = [
|
|
86162
86196
|
"scaffold-complete",
|
|
86163
86197
|
"feature-claimed",
|
|
@@ -86204,6 +86238,7 @@ function writeWorkflowState(projectDir, state) {
|
|
|
86204
86238
|
throw new Error(`Refusing to write invalid SCM state:
|
|
86205
86239
|
${summary}`);
|
|
86206
86240
|
}
|
|
86241
|
+
ensureWorkflowStateUntracked(projectDir);
|
|
86207
86242
|
const dir = path2.join(projectDir, ".lakebase");
|
|
86208
86243
|
fs3.mkdirSync(dir, { recursive: true });
|
|
86209
86244
|
const target = stateFilePath(projectDir);
|
|
@@ -86497,7 +86532,7 @@ init_cjs_shims();
|
|
|
86497
86532
|
init_cjs_shims();
|
|
86498
86533
|
var fs6 = __toESM(require("fs"), 1);
|
|
86499
86534
|
var path4 = __toESM(require("path"), 1);
|
|
86500
|
-
var
|
|
86535
|
+
var import_node_child_process5 = require("child_process");
|
|
86501
86536
|
|
|
86502
86537
|
// scripts/lakebase/branch-create.ts
|
|
86503
86538
|
init_cjs_shims();
|
|
@@ -88187,8 +88222,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
|
|
|
88187
88222
|
var cached;
|
|
88188
88223
|
function substrateSelfVersion() {
|
|
88189
88224
|
if (cached !== void 0) return cached;
|
|
88190
|
-
if ("0.2.
|
|
88191
|
-
cached = "0.2.
|
|
88225
|
+
if ("0.2.43".length > 0) {
|
|
88226
|
+
cached = "0.2.43";
|
|
88192
88227
|
return cached;
|
|
88193
88228
|
}
|
|
88194
88229
|
cached = "unknown";
|
|
@@ -88377,7 +88412,7 @@ async function isDirty(args) {
|
|
|
88377
88412
|
|
|
88378
88413
|
// scripts/lakebase/paired-branch.ts
|
|
88379
88414
|
function gitCurrentBranch(cwd) {
|
|
88380
|
-
return (0,
|
|
88415
|
+
return (0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
88381
88416
|
cwd,
|
|
88382
88417
|
encoding: "utf8",
|
|
88383
88418
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -88386,7 +88421,7 @@ function gitCurrentBranch(cwd) {
|
|
|
88386
88421
|
}
|
|
88387
88422
|
function gitHasLocalBranch(cwd, branch) {
|
|
88388
88423
|
try {
|
|
88389
|
-
(0,
|
|
88424
|
+
(0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`], {
|
|
88390
88425
|
cwd,
|
|
88391
88426
|
stdio: "ignore",
|
|
88392
88427
|
timeout: KIT_TIMEOUTS.gitDefault
|
|
@@ -88398,7 +88433,7 @@ function gitHasLocalBranch(cwd, branch) {
|
|
|
88398
88433
|
}
|
|
88399
88434
|
function gitCheckoutNewBranch(cwd, branch, startPoint) {
|
|
88400
88435
|
const argv = startPoint ? ["checkout", "-b", branch, startPoint] : ["checkout", "-b", branch];
|
|
88401
|
-
(0,
|
|
88436
|
+
(0, import_node_child_process5.execFileSync)("git", argv, {
|
|
88402
88437
|
cwd,
|
|
88403
88438
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88404
88439
|
timeout: KIT_TIMEOUTS.gitCheckout
|
|
@@ -88406,7 +88441,7 @@ function gitCheckoutNewBranch(cwd, branch, startPoint) {
|
|
|
88406
88441
|
}
|
|
88407
88442
|
function gitFetchBranch(cwd, remote, branch) {
|
|
88408
88443
|
try {
|
|
88409
|
-
(0,
|
|
88444
|
+
(0, import_node_child_process5.execFileSync)("git", ["fetch", remote, branch], {
|
|
88410
88445
|
cwd,
|
|
88411
88446
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88412
88447
|
timeout: KIT_TIMEOUTS.gitNetwork
|
|
@@ -88416,7 +88451,7 @@ function gitFetchBranch(cwd, remote, branch) {
|
|
|
88416
88451
|
}
|
|
88417
88452
|
function gitRefExists(cwd, ref) {
|
|
88418
88453
|
try {
|
|
88419
|
-
(0,
|
|
88454
|
+
(0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--verify", "--quiet", ref], {
|
|
88420
88455
|
cwd,
|
|
88421
88456
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88422
88457
|
timeout: KIT_TIMEOUTS.gitDefault
|
|
@@ -88428,7 +88463,7 @@ function gitRefExists(cwd, ref) {
|
|
|
88428
88463
|
}
|
|
88429
88464
|
function gitIsAncestor(cwd, ancestor, descendant) {
|
|
88430
88465
|
try {
|
|
88431
|
-
(0,
|
|
88466
|
+
(0, import_node_child_process5.execFileSync)("git", ["merge-base", "--is-ancestor", ancestor, descendant], {
|
|
88432
88467
|
cwd,
|
|
88433
88468
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88434
88469
|
timeout: KIT_TIMEOUTS.gitDefault
|
|
@@ -88461,14 +88496,14 @@ async function assertCleanForFork(cwd, startPoint) {
|
|
|
88461
88496
|
}
|
|
88462
88497
|
function gitCheckoutExistingBranch(cwd, branch, force = false) {
|
|
88463
88498
|
const argv = force ? ["checkout", "-f", branch] : ["checkout", branch];
|
|
88464
|
-
(0,
|
|
88499
|
+
(0, import_node_child_process5.execFileSync)("git", argv, {
|
|
88465
88500
|
cwd,
|
|
88466
88501
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88467
88502
|
timeout: KIT_TIMEOUTS.gitCheckout
|
|
88468
88503
|
});
|
|
88469
88504
|
}
|
|
88470
88505
|
function gitDeleteLocalBranch(cwd, branch, force = true) {
|
|
88471
|
-
(0,
|
|
88506
|
+
(0, import_node_child_process5.execFileSync)("git", ["branch", force ? "-D" : "-d", branch], {
|
|
88472
88507
|
cwd,
|
|
88473
88508
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88474
88509
|
timeout: KIT_TIMEOUTS.gitDefault
|
|
@@ -88476,7 +88511,7 @@ function gitDeleteLocalBranch(cwd, branch, force = true) {
|
|
|
88476
88511
|
}
|
|
88477
88512
|
function gitHasRemoteBranch(cwd, remote, branch) {
|
|
88478
88513
|
try {
|
|
88479
|
-
const out = (0,
|
|
88514
|
+
const out = (0, import_node_child_process5.execFileSync)(
|
|
88480
88515
|
"git",
|
|
88481
88516
|
["ls-remote", "--exit-code", "--heads", remote, branch],
|
|
88482
88517
|
{ cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: KIT_TIMEOUTS.gitNetwork }
|
|
@@ -88487,7 +88522,7 @@ function gitHasRemoteBranch(cwd, remote, branch) {
|
|
|
88487
88522
|
}
|
|
88488
88523
|
}
|
|
88489
88524
|
function gitDeleteRemoteBranch(cwd, remote, branch) {
|
|
88490
|
-
(0,
|
|
88525
|
+
(0, import_node_child_process5.execFileSync)("git", ["push", remote, "--delete", branch], {
|
|
88491
88526
|
cwd,
|
|
88492
88527
|
stdio: ["ignore", "pipe", "pipe"],
|
|
88493
88528
|
timeout: KIT_TIMEOUTS.gitPush
|
|
@@ -88985,7 +89020,7 @@ var path7 = __toESM(require("path"), 1);
|
|
|
88985
89020
|
|
|
88986
89021
|
// scripts/lakebase/schema-migrate-runners/alembic.ts
|
|
88987
89022
|
init_cjs_shims();
|
|
88988
|
-
var
|
|
89023
|
+
var import_node_child_process6 = require("child_process");
|
|
88989
89024
|
var fs8 = __toESM(require("fs"), 1);
|
|
88990
89025
|
var path6 = __toESM(require("path"), 1);
|
|
88991
89026
|
function resolveAlembicBin(projectDir) {
|
|
@@ -89007,7 +89042,7 @@ function spawnAlembic(projectDir, args, dsn) {
|
|
|
89007
89042
|
const env = { ...process.env };
|
|
89008
89043
|
env.PYTHONPATH = [projectDir, process.env.PYTHONPATH].filter(Boolean).join(path6.delimiter);
|
|
89009
89044
|
if (dsn) env.DATABASE_URL = dsn;
|
|
89010
|
-
const child = (0,
|
|
89045
|
+
const child = (0, import_node_child_process6.spawn)(bin, args, {
|
|
89011
89046
|
cwd: projectDir,
|
|
89012
89047
|
env,
|
|
89013
89048
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -89369,7 +89404,7 @@ var path9 = __toESM(require("path"), 1);
|
|
|
89369
89404
|
|
|
89370
89405
|
// scripts/lakebase/schema-migrate-runners/flyway.ts
|
|
89371
89406
|
init_cjs_shims();
|
|
89372
|
-
var
|
|
89407
|
+
var import_node_child_process7 = require("child_process");
|
|
89373
89408
|
var path8 = __toESM(require("path"), 1);
|
|
89374
89409
|
function dsnToFlywayEnv(dsn) {
|
|
89375
89410
|
const u = new URL(dsn);
|
|
@@ -89385,7 +89420,7 @@ function migrationsLocation(projectDir) {
|
|
|
89385
89420
|
function runFlyway(ctx, args) {
|
|
89386
89421
|
const { url, user, password } = dsnToFlywayEnv(ctx.dsn);
|
|
89387
89422
|
return new Promise((resolve3, reject) => {
|
|
89388
|
-
const child = (0,
|
|
89423
|
+
const child = (0, import_node_child_process7.spawn)(
|
|
89389
89424
|
"flyway",
|
|
89390
89425
|
["-outputType=json", `-locations=${migrationsLocation(ctx.projectDir)}`, ...args],
|
|
89391
89426
|
{
|
|
@@ -89622,7 +89657,7 @@ var path11 = __toESM(require("path"), 1);
|
|
|
89622
89657
|
|
|
89623
89658
|
// scripts/lakebase/schema-migrate-runners/knex.ts
|
|
89624
89659
|
init_cjs_shims();
|
|
89625
|
-
var
|
|
89660
|
+
var import_node_child_process8 = require("child_process");
|
|
89626
89661
|
var fs11 = __toESM(require("fs"), 1);
|
|
89627
89662
|
var path10 = __toESM(require("path"), 1);
|
|
89628
89663
|
var KNEXFILE_VARIANTS = ["knexfile.js", "knexfile.ts", "knexfile.mjs", "knexfile.cjs"];
|
|
@@ -89644,7 +89679,7 @@ function spawnKnex(projectDir, args, dsn) {
|
|
|
89644
89679
|
);
|
|
89645
89680
|
return;
|
|
89646
89681
|
}
|
|
89647
|
-
const child = (0,
|
|
89682
|
+
const child = (0, import_node_child_process8.spawn)("npx", ["--no-install", "knex", "--knexfile", knexfile, ...args], {
|
|
89648
89683
|
cwd: projectDir,
|
|
89649
89684
|
env: dsn ? { ...process.env, DATABASE_URL: dsn } : { ...process.env },
|
|
89650
89685
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -90054,14 +90089,6 @@ function readEnv(projectDir) {
|
|
|
90054
90089
|
function leafOf2(b) {
|
|
90055
90090
|
return b.name.split("/").pop() ?? b.name;
|
|
90056
90091
|
}
|
|
90057
|
-
function isGitTracked(projectDir, rel) {
|
|
90058
|
-
try {
|
|
90059
|
-
(0, import_node_child_process8.execFileSync)("git", ["ls-files", "--error-unmatch", "--", rel], { cwd: projectDir, stdio: "ignore" });
|
|
90060
|
-
return true;
|
|
90061
|
-
} catch {
|
|
90062
|
-
return false;
|
|
90063
|
-
}
|
|
90064
|
-
}
|
|
90065
90092
|
function worstOf(a, b) {
|
|
90066
90093
|
const order = ["ok", "warn", "fail"];
|
|
90067
90094
|
return order[Math.max(order.indexOf(a), order.indexOf(b))];
|