@brainervirus/workit-pi 8.0.1 → 8.1.0
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/worker.js +1 -0
- package/dist/workit.js +175 -105
- package/package.json +1 -1
package/dist/worker.js
CHANGED
package/dist/workit.js
CHANGED
|
@@ -3,7 +3,7 @@ import { randomUUID as randomUUID5 } from "node:crypto";
|
|
|
3
3
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4
4
|
|
|
5
5
|
// packages/workit-core/src/core.ts
|
|
6
|
-
import { spawnSync as
|
|
6
|
+
import { spawnSync as spawnSync13 } from "node:child_process";
|
|
7
7
|
import { existsSync as existsSync7, realpathSync as realpathSync5 } from "node:fs";
|
|
8
8
|
import path19 from "node:path";
|
|
9
9
|
|
|
@@ -13927,73 +13927,8 @@ var exportDigest = (bundle) => sha256({
|
|
|
13927
13927
|
// packages/workit-core/src/core/branch.ts
|
|
13928
13928
|
import { createHash as createHash10 } from "node:crypto";
|
|
13929
13929
|
|
|
13930
|
-
// packages/workit-core/src/core/
|
|
13931
|
-
import {
|
|
13932
|
-
var run = (cwd, args) => {
|
|
13933
|
-
try {
|
|
13934
|
-
const stdout = execFileSync("git", args, {
|
|
13935
|
-
cwd,
|
|
13936
|
-
encoding: "utf8",
|
|
13937
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
13938
|
-
});
|
|
13939
|
-
return { stdout: stdout.trimEnd(), stderr: "", exitCode: 0 };
|
|
13940
|
-
} catch (error) {
|
|
13941
|
-
const e = error;
|
|
13942
|
-
return {
|
|
13943
|
-
stdout: (e.stdout ?? "").trimEnd(),
|
|
13944
|
-
stderr: (e.stderr ?? "").trimEnd(),
|
|
13945
|
-
exitCode: e.status ?? 1
|
|
13946
|
-
};
|
|
13947
|
-
}
|
|
13948
|
-
};
|
|
13949
|
-
var gitContext = (workspaceRoot, paths = []) => {
|
|
13950
|
-
const cwd = workspaceRoot;
|
|
13951
|
-
let failure;
|
|
13952
|
-
const runHere = (args) => {
|
|
13953
|
-
const result = run(cwd, args);
|
|
13954
|
-
if (!failure && result.exitCode !== 0) {
|
|
13955
|
-
failure = { stderr: result.stderr, exitCode: result.exitCode };
|
|
13956
|
-
}
|
|
13957
|
-
return result.stdout;
|
|
13958
|
-
};
|
|
13959
|
-
const branch = runHere(["rev-parse", "--abbrev-ref", "HEAD"]) || "unknown";
|
|
13960
|
-
const status_short = runHere(["status", "--porcelain"]);
|
|
13961
|
-
const staged = [];
|
|
13962
|
-
const unstaged = [];
|
|
13963
|
-
const untracked = [];
|
|
13964
|
-
for (const line of status_short.split(`
|
|
13965
|
-
`).filter(Boolean)) {
|
|
13966
|
-
const code = line.slice(0, 2);
|
|
13967
|
-
const file = line.slice(3);
|
|
13968
|
-
if (code === "??") {
|
|
13969
|
-
untracked.push(file);
|
|
13970
|
-
} else {
|
|
13971
|
-
if (code[0] !== " " && code[0] !== "?")
|
|
13972
|
-
staged.push(file);
|
|
13973
|
-
if (code[1] !== " " && code[1] !== "?")
|
|
13974
|
-
unstaged.push(file);
|
|
13975
|
-
}
|
|
13976
|
-
}
|
|
13977
|
-
const pathArgs = paths.length ? ["--", ...paths] : [];
|
|
13978
|
-
const diff_stat = runHere(["diff", "--stat", ...pathArgs]);
|
|
13979
|
-
const cached_stat = runHere(["diff", "--cached", "--stat", ...pathArgs]);
|
|
13980
|
-
const stagedSet = new Set(staged);
|
|
13981
|
-
const unstagedSet = new Set(unstaged);
|
|
13982
|
-
const partial_staged = [...stagedSet].filter((f) => unstagedSet.has(f));
|
|
13983
|
-
return {
|
|
13984
|
-
workspace_root: cwd,
|
|
13985
|
-
branch,
|
|
13986
|
-
status_short,
|
|
13987
|
-
staged,
|
|
13988
|
-
unstaged,
|
|
13989
|
-
untracked,
|
|
13990
|
-
diff_stat: [diff_stat, cached_stat].filter(Boolean).join(`
|
|
13991
|
-
`),
|
|
13992
|
-
partial_staged: partial_staged.length > 0,
|
|
13993
|
-
partial_staged_files: partial_staged,
|
|
13994
|
-
...failure ? { stderr: failure.stderr, exitCode: failure.exitCode } : {}
|
|
13995
|
-
};
|
|
13996
|
-
};
|
|
13930
|
+
// packages/workit-core/src/core/branch-policy.ts
|
|
13931
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
13997
13932
|
|
|
13998
13933
|
// packages/workit-core/src/core/config.ts
|
|
13999
13934
|
import {
|
|
@@ -14104,6 +14039,7 @@ var DEFAULTS = {
|
|
|
14104
14039
|
},
|
|
14105
14040
|
commitPolicy: { preset: "conventional" }
|
|
14106
14041
|
};
|
|
14042
|
+
var unchosenBranchPolicy = new WeakSet([DEFAULTS]);
|
|
14107
14043
|
var readSafe = (p) => {
|
|
14108
14044
|
try {
|
|
14109
14045
|
return readFileSync3(p, "utf8");
|
|
@@ -14128,22 +14064,21 @@ var parseConfigResult = (raw, file) => {
|
|
|
14128
14064
|
const locale = LOCALE_RE.test(String(input.locale ?? "")) ? input.locale : DEFAULTS.locale;
|
|
14129
14065
|
const preset = Object.hasOwn(PRESETS, input.branchPolicy?.preset) ? input.branchPolicy?.preset : "gitflow";
|
|
14130
14066
|
const commitPreset = COMMIT_PRESETS.includes(String(input.commitPolicy?.preset ?? "")) ? input.commitPolicy?.preset : "conventional";
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
}
|
|
14141
|
-
commitPolicy: {
|
|
14142
|
-
preset: commitPreset,
|
|
14143
|
-
...typeof input.commitPolicy?.pattern === "string" ? { pattern: input.commitPolicy.pattern } : {}
|
|
14144
|
-
}
|
|
14067
|
+
const config = {
|
|
14068
|
+
locale,
|
|
14069
|
+
localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
|
|
14070
|
+
branchPolicy: mergePreset(preset, {
|
|
14071
|
+
allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
|
|
14072
|
+
protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
|
|
14073
|
+
}, DEFAULTS),
|
|
14074
|
+
commitPolicy: {
|
|
14075
|
+
preset: commitPreset,
|
|
14076
|
+
...typeof input.commitPolicy?.pattern === "string" ? { pattern: input.commitPolicy.pattern } : {}
|
|
14145
14077
|
}
|
|
14146
14078
|
};
|
|
14079
|
+
if (!Object.hasOwn(PRESETS, input.branchPolicy?.preset))
|
|
14080
|
+
unchosenBranchPolicy.add(config);
|
|
14081
|
+
return { status: "valid", path: file, config };
|
|
14147
14082
|
};
|
|
14148
14083
|
var readConfigTyped = (dir) => {
|
|
14149
14084
|
const file = path12.join(dir ?? configDir(), "config.json");
|
|
@@ -14157,9 +14092,11 @@ var readConfig = () => {
|
|
|
14157
14092
|
};
|
|
14158
14093
|
var vcsConfigPath = () => process.env.WORKFLOW_VCS_CONFIG ?? path12.join(configDir(), "vcs.json");
|
|
14159
14094
|
var branchGlobPattern = (glob) => new RegExp(`^${glob.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`, "i");
|
|
14160
|
-
var resolveBranchPolicy = (config, workspace) => {
|
|
14095
|
+
var resolveBranchPolicy = (config, workspace, repoPreset) => {
|
|
14161
14096
|
const wp = workspace?.branchPolicy ?? {};
|
|
14162
|
-
const
|
|
14097
|
+
const workspacePreset = Object.hasOwn(PRESETS, wp.preset);
|
|
14098
|
+
const detected = !workspacePreset && unchosenBranchPolicy.has(config) ? repoPreset?.() ?? null : null;
|
|
14099
|
+
const preset = workspacePreset ? wp.preset : detected ?? config.branchPolicy?.preset ?? "gitflow";
|
|
14163
14100
|
const merged = mergePreset(preset, {
|
|
14164
14101
|
allowed: wp.allowed,
|
|
14165
14102
|
protectedNames: wp.protected
|
|
@@ -14168,9 +14105,10 @@ var resolveBranchPolicy = (config, workspace) => {
|
|
|
14168
14105
|
return {
|
|
14169
14106
|
preset,
|
|
14170
14107
|
allowed,
|
|
14171
|
-
protected: new Set(merged.protected.map((p) => p.toLowerCase())),
|
|
14108
|
+
protected: new Set([...merged.protected, ...detected ? PRESETS.gitflow.protected : []].map((p) => p.toLowerCase())),
|
|
14172
14109
|
integration: wp.integration === "merge" ? "merge" : "pr",
|
|
14173
|
-
defaultTargetBranch: preset === "github-flow" ? "main" : preset === "trunk-based" ? "master" : "develop"
|
|
14110
|
+
defaultTargetBranch: preset === "github-flow" ? "main" : preset === "trunk-based" ? "master" : "develop",
|
|
14111
|
+
detected: detected !== null
|
|
14174
14112
|
};
|
|
14175
14113
|
};
|
|
14176
14114
|
var COMMIT_PRESETS = [
|
|
@@ -14192,6 +14130,138 @@ var resolveCommitPolicy = (config, workspace) => {
|
|
|
14192
14130
|
return config.commitPolicy ?? { preset: "conventional" };
|
|
14193
14131
|
};
|
|
14194
14132
|
|
|
14133
|
+
// packages/workit-core/src/core/branch-policy.ts
|
|
14134
|
+
var PREFIXES = {
|
|
14135
|
+
feature: "feature/*",
|
|
14136
|
+
bugfix: "bugfix/*",
|
|
14137
|
+
release: "release/*",
|
|
14138
|
+
hotfix: "hotfix/*"
|
|
14139
|
+
};
|
|
14140
|
+
var branchNames = (workspaceRoot) => {
|
|
14141
|
+
const r = spawnSync7("git", ["for-each-ref", "--format=%(refname)", "refs/heads", "refs/remotes/origin"], { cwd: workspaceRoot, encoding: "utf8" });
|
|
14142
|
+
if (r.status !== 0)
|
|
14143
|
+
return new Set;
|
|
14144
|
+
return new Set((r.stdout ?? "").split(`
|
|
14145
|
+
`).filter(Boolean).map((ref) => ref.startsWith("refs/heads/") ? ref.slice("refs/heads/".length) : ref.slice("refs/remotes/origin/".length)));
|
|
14146
|
+
};
|
|
14147
|
+
var detectBranchPolicy = (workspaceRoot) => {
|
|
14148
|
+
const names = branchNames(workspaceRoot);
|
|
14149
|
+
const develop = names.has("develop");
|
|
14150
|
+
const main = names.has("main");
|
|
14151
|
+
const master = names.has("master");
|
|
14152
|
+
const root = main ? "main" : master ? "master" : null;
|
|
14153
|
+
if (develop) {
|
|
14154
|
+
return {
|
|
14155
|
+
preset: "gitflow",
|
|
14156
|
+
developBranch: "develop",
|
|
14157
|
+
integration: "merge",
|
|
14158
|
+
protected: root ? [root, "develop"] : ["develop"],
|
|
14159
|
+
allowed: [...PRESETS.gitflow.allowed],
|
|
14160
|
+
prefixes: PREFIXES
|
|
14161
|
+
};
|
|
14162
|
+
}
|
|
14163
|
+
if (root === "main") {
|
|
14164
|
+
return {
|
|
14165
|
+
preset: "github-flow",
|
|
14166
|
+
developBranch: null,
|
|
14167
|
+
integration: "pr",
|
|
14168
|
+
protected: [root],
|
|
14169
|
+
allowed: ["*"],
|
|
14170
|
+
prefixes: PREFIXES
|
|
14171
|
+
};
|
|
14172
|
+
}
|
|
14173
|
+
if (root === "master") {
|
|
14174
|
+
return {
|
|
14175
|
+
preset: "trunk-based",
|
|
14176
|
+
developBranch: null,
|
|
14177
|
+
integration: "pr",
|
|
14178
|
+
protected: [root],
|
|
14179
|
+
allowed: ["*"],
|
|
14180
|
+
prefixes: PREFIXES
|
|
14181
|
+
};
|
|
14182
|
+
}
|
|
14183
|
+
return {
|
|
14184
|
+
preset: "gitflow",
|
|
14185
|
+
developBranch: null,
|
|
14186
|
+
integration: "merge",
|
|
14187
|
+
protected: [],
|
|
14188
|
+
allowed: [],
|
|
14189
|
+
prefixes: PREFIXES
|
|
14190
|
+
};
|
|
14191
|
+
};
|
|
14192
|
+
var repoBranchPreset = (workspaceRoot) => {
|
|
14193
|
+
const detected = detectBranchPolicy(workspaceRoot);
|
|
14194
|
+
return detected.developBranch || detected.allowed.length ? detected.preset : null;
|
|
14195
|
+
};
|
|
14196
|
+
|
|
14197
|
+
// packages/workit-core/src/core/git.ts
|
|
14198
|
+
import { execFileSync } from "node:child_process";
|
|
14199
|
+
var run = (cwd, args) => {
|
|
14200
|
+
try {
|
|
14201
|
+
const stdout = execFileSync("git", args, {
|
|
14202
|
+
cwd,
|
|
14203
|
+
encoding: "utf8",
|
|
14204
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
14205
|
+
});
|
|
14206
|
+
return { stdout: stdout.trimEnd(), stderr: "", exitCode: 0 };
|
|
14207
|
+
} catch (error) {
|
|
14208
|
+
const e = error;
|
|
14209
|
+
return {
|
|
14210
|
+
stdout: (e.stdout ?? "").trimEnd(),
|
|
14211
|
+
stderr: (e.stderr ?? "").trimEnd(),
|
|
14212
|
+
exitCode: e.status ?? 1
|
|
14213
|
+
};
|
|
14214
|
+
}
|
|
14215
|
+
};
|
|
14216
|
+
var gitContext = (workspaceRoot, paths = []) => {
|
|
14217
|
+
const cwd = workspaceRoot;
|
|
14218
|
+
let failure;
|
|
14219
|
+
const runHere = (args) => {
|
|
14220
|
+
const result = run(cwd, args);
|
|
14221
|
+
if (!failure && result.exitCode !== 0) {
|
|
14222
|
+
failure = { stderr: result.stderr, exitCode: result.exitCode };
|
|
14223
|
+
}
|
|
14224
|
+
return result.stdout;
|
|
14225
|
+
};
|
|
14226
|
+
const branch = runHere(["rev-parse", "--abbrev-ref", "HEAD"]) || "unknown";
|
|
14227
|
+
const status_short = runHere(["status", "--porcelain"]);
|
|
14228
|
+
const staged = [];
|
|
14229
|
+
const unstaged = [];
|
|
14230
|
+
const untracked = [];
|
|
14231
|
+
for (const line of status_short.split(`
|
|
14232
|
+
`).filter(Boolean)) {
|
|
14233
|
+
const code = line.slice(0, 2);
|
|
14234
|
+
const file = line.slice(3);
|
|
14235
|
+
if (code === "??") {
|
|
14236
|
+
untracked.push(file);
|
|
14237
|
+
} else {
|
|
14238
|
+
if (code[0] !== " " && code[0] !== "?")
|
|
14239
|
+
staged.push(file);
|
|
14240
|
+
if (code[1] !== " " && code[1] !== "?")
|
|
14241
|
+
unstaged.push(file);
|
|
14242
|
+
}
|
|
14243
|
+
}
|
|
14244
|
+
const pathArgs = paths.length ? ["--", ...paths] : [];
|
|
14245
|
+
const diff_stat = runHere(["diff", "--stat", ...pathArgs]);
|
|
14246
|
+
const cached_stat = runHere(["diff", "--cached", "--stat", ...pathArgs]);
|
|
14247
|
+
const stagedSet = new Set(staged);
|
|
14248
|
+
const unstagedSet = new Set(unstaged);
|
|
14249
|
+
const partial_staged = [...stagedSet].filter((f) => unstagedSet.has(f));
|
|
14250
|
+
return {
|
|
14251
|
+
workspace_root: cwd,
|
|
14252
|
+
branch,
|
|
14253
|
+
status_short,
|
|
14254
|
+
staged,
|
|
14255
|
+
unstaged,
|
|
14256
|
+
untracked,
|
|
14257
|
+
diff_stat: [diff_stat, cached_stat].filter(Boolean).join(`
|
|
14258
|
+
`),
|
|
14259
|
+
partial_staged: partial_staged.length > 0,
|
|
14260
|
+
partial_staged_files: partial_staged,
|
|
14261
|
+
...failure ? { stderr: failure.stderr, exitCode: failure.exitCode } : {}
|
|
14262
|
+
};
|
|
14263
|
+
};
|
|
14264
|
+
|
|
14195
14265
|
// packages/workit-core/src/core/workspaces.ts
|
|
14196
14266
|
import { createHash as createHash8 } from "node:crypto";
|
|
14197
14267
|
import { readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
|
|
@@ -14597,18 +14667,18 @@ function workspaceDefaultTarget(cwd, globalDefault) {
|
|
|
14597
14667
|
const wp = ws?.branchPolicy ?? {};
|
|
14598
14668
|
const hasWorkspacePolicy = typeof wp.preset === "string" && Object.hasOwn(PRESETS, wp.preset);
|
|
14599
14669
|
const selected = resolveRuntimeWorkspacePolicy(cwd, "branch", process.env.WORKFLOW_PROFILE?.trim() || undefined);
|
|
14600
|
-
const policyDefault = resolveBranchPolicy(readConfig(), selected.policy ? { branchPolicy: selected.policy } : null).defaultTargetBranch;
|
|
14670
|
+
const policyDefault = resolveBranchPolicy(readConfig(), selected.policy ? { branchPolicy: selected.policy } : null, () => repoBranchPreset(cwd)).defaultTargetBranch;
|
|
14601
14671
|
return String(ws?.vcs?.defaultTargetBranch ?? (hasWorkspacePolicy ? policyDefault : globalDefault ?? policyDefault) ?? "develop");
|
|
14602
14672
|
}
|
|
14603
14673
|
|
|
14604
14674
|
// packages/workit-core/src/core/vcs-config.ts
|
|
14605
14675
|
import fs12 from "node:fs";
|
|
14606
14676
|
import path14 from "node:path";
|
|
14607
|
-
import { spawnSync as
|
|
14677
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
14608
14678
|
|
|
14609
14679
|
// packages/workit-core/src/core/release-tracks.ts
|
|
14610
14680
|
import { createHash as createHash9 } from "node:crypto";
|
|
14611
|
-
import { spawnSync as
|
|
14681
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
14612
14682
|
class ReleaseTrackError extends Error {
|
|
14613
14683
|
}
|
|
14614
14684
|
var KNOWN_FIELDS = new Set([
|
|
@@ -14893,7 +14963,7 @@ function resolveReleaseTrack(input) {
|
|
|
14893
14963
|
return fallback(`${branch} has the same or unrelated fork points with ${[...new Set(newest.map((fork) => `${fork.ref} (${fork.track.name === IMPLICIT ? "workspace default" : fork.track.name})`))].join(" and ")}`);
|
|
14894
14964
|
}
|
|
14895
14965
|
var git4 = (cwd, args) => {
|
|
14896
|
-
const run =
|
|
14966
|
+
const run = spawnSync8("git", args, {
|
|
14897
14967
|
cwd,
|
|
14898
14968
|
encoding: "utf8",
|
|
14899
14969
|
timeout: 20000,
|
|
@@ -15008,7 +15078,7 @@ function resolveTrackFor(cwd, options) {
|
|
|
15008
15078
|
var workspacesPath = () => path14.join(configDir(), "workspaces.json");
|
|
15009
15079
|
var vcsCwd = (cwd) => cwd ?? process.env.WORKFLOW_WORKSPACE_ROOT ?? process.cwd();
|
|
15010
15080
|
var remoteProvider = (cwd) => {
|
|
15011
|
-
const r =
|
|
15081
|
+
const r = spawnSync9("git", ["remote", "get-url", "origin"], { cwd, encoding: "utf8" });
|
|
15012
15082
|
if (r.status !== 0)
|
|
15013
15083
|
return null;
|
|
15014
15084
|
const url = (r.stdout ?? "").trim();
|
|
@@ -15045,7 +15115,7 @@ var remoteEndpoint = (remote) => {
|
|
|
15045
15115
|
var configuredSshEndpoint = (host) => {
|
|
15046
15116
|
if (host.startsWith("-"))
|
|
15047
15117
|
return null;
|
|
15048
|
-
const resolved =
|
|
15118
|
+
const resolved = spawnSync9("ssh", ["-G", host], {
|
|
15049
15119
|
encoding: "utf8",
|
|
15050
15120
|
timeout: 5000,
|
|
15051
15121
|
maxBuffer: 1024 * 1024,
|
|
@@ -15218,7 +15288,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
15218
15288
|
`).filter((l) => l.startsWith("## ")).map((l) => l.trim()),
|
|
15219
15289
|
descriptionPreview: desc.slice(0, 600)
|
|
15220
15290
|
});
|
|
15221
|
-
const remoteResult =
|
|
15291
|
+
const remoteResult = spawnSync9("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
15222
15292
|
cwd,
|
|
15223
15293
|
encoding: "utf8"
|
|
15224
15294
|
});
|
|
@@ -15234,7 +15304,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
15234
15304
|
if (!hostingApiHostMatches(remote, host))
|
|
15235
15305
|
return { ok: false, error: "PR style target does not match the provider host" };
|
|
15236
15306
|
if (provider === "gitlab") {
|
|
15237
|
-
const run = (args) =>
|
|
15307
|
+
const run = (args) => spawnSync9("glab", ["api", ...args], {
|
|
15238
15308
|
cwd,
|
|
15239
15309
|
encoding: "utf8",
|
|
15240
15310
|
env
|
|
@@ -15254,7 +15324,7 @@ function mergedPrStyle(limit = 6, cwd) {
|
|
|
15254
15324
|
});
|
|
15255
15325
|
}
|
|
15256
15326
|
} else if (provider === "github") {
|
|
15257
|
-
const r =
|
|
15327
|
+
const r = spawnSync9("gh", [
|
|
15258
15328
|
"pr",
|
|
15259
15329
|
"list",
|
|
15260
15330
|
"--repo",
|
|
@@ -15315,7 +15385,7 @@ function effectiveWorkspacePolicy(workspaceRoot, kind, profileName) {
|
|
|
15315
15385
|
const selected = resolveRuntimeWorkspacePolicy(workspaceRoot, kind, profileName?.trim() || process.env.WORKFLOW_PROFILE?.trim() || undefined);
|
|
15316
15386
|
const config = readConfig();
|
|
15317
15387
|
return kind === "branch" ? {
|
|
15318
|
-
branchPolicy: withReleaseTracks(workspaceRoot, resolveBranchPolicy(config, selected.policy ? { branchPolicy: selected.policy } : null)),
|
|
15388
|
+
branchPolicy: withReleaseTracks(workspaceRoot, resolveBranchPolicy(config, selected.policy ? { branchPolicy: selected.policy } : null, () => repoBranchPreset(workspaceRoot))),
|
|
15319
15389
|
provenance: { branchPolicy: selected.source }
|
|
15320
15390
|
} : {
|
|
15321
15391
|
commitPolicy: resolveCommitPolicy(config, selected.policy ? { commitPolicy: selected.policy } : null),
|
|
@@ -17300,7 +17370,7 @@ class WorkitCore {
|
|
|
17300
17370
|
}
|
|
17301
17371
|
}
|
|
17302
17372
|
// packages/workit-core/src/core/repo-context.ts
|
|
17303
|
-
import { spawnSync as
|
|
17373
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
17304
17374
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
17305
17375
|
import path16 from "node:path";
|
|
17306
17376
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
@@ -17329,7 +17399,7 @@ var invalidRange = (cwd) => ({
|
|
|
17329
17399
|
cwd
|
|
17330
17400
|
});
|
|
17331
17401
|
var runGit = (cwd, args) => {
|
|
17332
|
-
const result =
|
|
17402
|
+
const result = spawnSync10("git", args, { cwd, encoding: "utf8" });
|
|
17333
17403
|
return {
|
|
17334
17404
|
stdout: (result.stdout ?? "").trimEnd(),
|
|
17335
17405
|
stderr: (result.stderr ?? "").trimEnd(),
|
|
@@ -17770,12 +17840,12 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
17770
17840
|
}
|
|
17771
17841
|
|
|
17772
17842
|
// packages/workit-core/src/core/tracker-issues.ts
|
|
17773
|
-
import { spawnSync as
|
|
17843
|
+
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
17774
17844
|
|
|
17775
17845
|
// packages/workit-core/src/core/pr-create.ts
|
|
17776
17846
|
import fs13 from "node:fs";
|
|
17777
17847
|
import path17 from "node:path";
|
|
17778
|
-
import { spawnSync as
|
|
17848
|
+
import { spawnSync as spawnSync11 } from "node:child_process";
|
|
17779
17849
|
// packages/workit-core/src/forge/pr-body.ts
|
|
17780
17850
|
function parseGhIssue(value) {
|
|
17781
17851
|
const m = /issues\/(\d+)/.exec(value);
|
|
@@ -17800,7 +17870,7 @@ function whichOnPath(tool) {
|
|
|
17800
17870
|
}
|
|
17801
17871
|
var hostingCliAvailable = (provider) => whichOnPath(provider === "gitlab" ? "glab" : "gh") !== null;
|
|
17802
17872
|
var pushRemote = (cwd) => {
|
|
17803
|
-
const result =
|
|
17873
|
+
const result = spawnSync11("git", ["remote", "get-url", "--push", "--all", "origin"], {
|
|
17804
17874
|
cwd,
|
|
17805
17875
|
encoding: "utf8"
|
|
17806
17876
|
});
|
|
@@ -17831,7 +17901,7 @@ var defaultCli = (bin, available) => {
|
|
|
17831
17901
|
if (!available)
|
|
17832
17902
|
return null;
|
|
17833
17903
|
return (args, root) => {
|
|
17834
|
-
const out =
|
|
17904
|
+
const out = spawnSync12(bin, args, {
|
|
17835
17905
|
cwd: root,
|
|
17836
17906
|
encoding: "utf8",
|
|
17837
17907
|
env: { ...process.env, PATH: process.env.PATH ?? "" }
|
|
@@ -18364,7 +18434,7 @@ function resolveInside(root, candidate) {
|
|
|
18364
18434
|
}
|
|
18365
18435
|
function run2(root, executable, args, env = {}) {
|
|
18366
18436
|
const cwd = realpathSync5(root);
|
|
18367
|
-
const result =
|
|
18437
|
+
const result = spawnSync13(executable, args, {
|
|
18368
18438
|
cwd,
|
|
18369
18439
|
encoding: "utf8",
|
|
18370
18440
|
env: { ...process.env, ...env }
|
|
@@ -18665,11 +18735,11 @@ var segmentsOf = (command) => {
|
|
|
18665
18735
|
flushSegment();
|
|
18666
18736
|
return segments;
|
|
18667
18737
|
};
|
|
18668
|
-
var
|
|
18738
|
+
var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs"]);
|
|
18669
18739
|
var operands = (words) => words.filter((item) => !item.startsWith("-"));
|
|
18670
18740
|
var editsOf = (input) => {
|
|
18671
18741
|
let words = input;
|
|
18672
|
-
while (words.length && (
|
|
18742
|
+
while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0])))
|
|
18673
18743
|
words = words.slice(1);
|
|
18674
18744
|
const [verb, ...args] = words;
|
|
18675
18745
|
const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
|