@bensandee/tooling 0.96.0 → 0.98.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/README.md +2 -0
- package/dist/bin.mjs +440 -280
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -719,6 +719,8 @@ serve one page and then be a dead surface whose every control did nothing.
|
|
|
719
719
|
|
|
720
720
|
`docker:check` verifies that a Docker Compose stack starts correctly, passes health checks, and (optionally) survives a smoketest command. The lifecycle is: build images, compose up, poll health checks, run smoketest, compose down.
|
|
721
721
|
|
|
722
|
+
On a timeout or a failed `compose up`, `docker:check` dumps `docker compose ps -a` and every service's logs; on an unhealthy container, it dumps `docker compose ps -a` and that one service's logs. Each of the three then prints the **health log** of every service whose healthcheck has not passed: the last probe results Docker keeps, with each one's exit code and output. A probe's own output lives only there -- never in the container log -- so a healthcheck that is itself a test script fails visibly instead of ending in `(no log output)`.
|
|
723
|
+
|
|
722
724
|
### Smoketests
|
|
723
725
|
|
|
724
726
|
A smoketest is a command that runs against the live Docker stack after all containers are healthy and HTTP health checks pass. This is useful for running integration tests, API contract checks, or any validation that requires the full stack to be running.
|
package/dist/bin.mjs
CHANGED
|
@@ -11,13 +11,13 @@ import { z } from "zod";
|
|
|
11
11
|
import JSON5 from "json5";
|
|
12
12
|
import { applyEdits, modify, parse } from "jsonc-parser";
|
|
13
13
|
import spawn$1 from "cross-spawn";
|
|
14
|
+
import os, { tmpdir } from "node:os";
|
|
15
|
+
import { createHmac, randomUUID } from "node:crypto";
|
|
14
16
|
import { isMap, isScalar, isSeq, parse as parse$1, parseAllDocuments, parseDocument, stringify, visit } from "yaml";
|
|
15
17
|
import { StringDecoder } from "node:string_decoder";
|
|
16
18
|
import { parse as parse$2 } from "smol-toml";
|
|
17
19
|
import picomatch from "picomatch";
|
|
18
|
-
import os, { tmpdir } from "node:os";
|
|
19
20
|
import net from "node:net";
|
|
20
|
-
import { createHmac } from "node:crypto";
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
//#region ../cli-kit/src/json.ts
|
|
23
23
|
function resolveJsonMode(rawArgs) {
|
|
@@ -175,7 +175,7 @@ function loadEnvFileForBin(rawArgs, bin, io = processIo) {
|
|
|
175
175
|
//#region src/env-file-preload.ts
|
|
176
176
|
const envFileLoad = loadEnvFileForBin(process.argv.slice(2), {
|
|
177
177
|
name: "bst",
|
|
178
|
-
version: "0.
|
|
178
|
+
version: "0.98.0"
|
|
179
179
|
});
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region ../cli-kit/src/logger.ts
|
|
@@ -2037,20 +2037,23 @@ function parseRepositoryUrl(cwd) {
|
|
|
2037
2037
|
//#endregion
|
|
2038
2038
|
//#region ../forgejo/src/errors.ts
|
|
2039
2039
|
var ForgeAccessError = class extends FatalError {};
|
|
2040
|
-
function authHeaders
|
|
2040
|
+
function authHeaders(conn) {
|
|
2041
2041
|
return { Authorization: `token ${conn.token}` };
|
|
2042
2042
|
}
|
|
2043
2043
|
function jsonHeaders(conn) {
|
|
2044
2044
|
return {
|
|
2045
|
-
...authHeaders
|
|
2045
|
+
...authHeaders(conn),
|
|
2046
2046
|
"Content-Type": "application/json"
|
|
2047
2047
|
};
|
|
2048
2048
|
}
|
|
2049
2049
|
function repoNotFoundMessage(conn) {
|
|
2050
2050
|
return `Repository ${conn.repository} not found (or the token cannot see it)`;
|
|
2051
2051
|
}
|
|
2052
|
+
function repoBase(conn) {
|
|
2053
|
+
return `${conn.serverUrl}/api/v1/repos/${conn.repository}`;
|
|
2054
|
+
}
|
|
2052
2055
|
function issuesBase(conn) {
|
|
2053
|
-
return `${conn
|
|
2056
|
+
return `${repoBase(conn)}/issues`;
|
|
2054
2057
|
}
|
|
2055
2058
|
function issueNotFoundMessage(conn, number) {
|
|
2056
2059
|
return `Issue #${String(number)} not found in ${conn.repository}`;
|
|
@@ -2247,6 +2250,63 @@ function loadRegistryHostOverride(cwd) {
|
|
|
2247
2250
|
}
|
|
2248
2251
|
}
|
|
2249
2252
|
//#endregion
|
|
2253
|
+
//#region src/release/docker-bake.ts
|
|
2254
|
+
function escapeBakeTemplate(value) {
|
|
2255
|
+
return value.replace(/\$\{/gu, () => "$${").replace(/%\{/gu, () => "%%{");
|
|
2256
|
+
}
|
|
2257
|
+
function escapeBakeTemplateValues(values) {
|
|
2258
|
+
const escaped = {};
|
|
2259
|
+
for (const [key, value] of Object.entries(values)) escaped[key] = escapeBakeTemplate(value);
|
|
2260
|
+
return escaped;
|
|
2261
|
+
}
|
|
2262
|
+
function uniqueTargetName(taken, imageName) {
|
|
2263
|
+
const root = imageName.replace(/[^A-Za-z0-9_-]/gu, "_");
|
|
2264
|
+
const candidate = (suffix) => suffix === 1 ? root : `${root}_${String(suffix)}`;
|
|
2265
|
+
let suffix = 1;
|
|
2266
|
+
while (taken.has(candidate(suffix))) suffix++;
|
|
2267
|
+
return candidate(suffix);
|
|
2268
|
+
}
|
|
2269
|
+
function buildBakeDefinition(images) {
|
|
2270
|
+
const targetByImageName = /* @__PURE__ */ new Map();
|
|
2271
|
+
const takenTargetNames = /* @__PURE__ */ new Set();
|
|
2272
|
+
const named = [];
|
|
2273
|
+
for (const image of images) {
|
|
2274
|
+
const target = uniqueTargetName(takenTargetNames, image.imageName);
|
|
2275
|
+
takenTargetNames.add(target);
|
|
2276
|
+
targetByImageName.set(image.imageName, target);
|
|
2277
|
+
named.push({
|
|
2278
|
+
image,
|
|
2279
|
+
target
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
const target = {};
|
|
2283
|
+
const targets = [];
|
|
2284
|
+
for (const { image, target: name } of named) {
|
|
2285
|
+
const entry = {
|
|
2286
|
+
context: escapeBakeTemplate(image.context),
|
|
2287
|
+
dockerfile: escapeBakeTemplate(image.dockerfile),
|
|
2288
|
+
tags: [escapeBakeTemplate(`${image.imageName}:latest`)],
|
|
2289
|
+
args: escapeBakeTemplateValues(image.args),
|
|
2290
|
+
labels: escapeBakeTemplateValues(image.labels)
|
|
2291
|
+
};
|
|
2292
|
+
if (image.bases.length > 0) {
|
|
2293
|
+
const contexts = {};
|
|
2294
|
+
for (const base of image.bases) {
|
|
2295
|
+
const baseTarget = targetByImageName.get(base);
|
|
2296
|
+
if (baseTarget === void 0) throw new UnexpectedError(`Docker bake definition: image "${image.imageName}" FROMs "${base}", which is not in the set of images being built`);
|
|
2297
|
+
contexts[base] = `target:${baseTarget}`;
|
|
2298
|
+
}
|
|
2299
|
+
entry.contexts = contexts;
|
|
2300
|
+
}
|
|
2301
|
+
target[name] = entry;
|
|
2302
|
+
targets.push(name);
|
|
2303
|
+
}
|
|
2304
|
+
return {
|
|
2305
|
+
group: { default: { targets } },
|
|
2306
|
+
target
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
//#endregion
|
|
2250
2310
|
//#region src/utils/debug.ts
|
|
2251
2311
|
const verboseLogger = createLogger({ level: "trace" });
|
|
2252
2312
|
function isEnvVerbose() {
|
|
@@ -2678,6 +2738,51 @@ function fetchWithRetry(fetchImpl, policy = DEFAULT_RETRY_POLICY, defaultTimeout
|
|
|
2678
2738
|
}
|
|
2679
2739
|
//#endregion
|
|
2680
2740
|
//#region src/utils/exec.ts
|
|
2741
|
+
const EXEC_MAX_BUFFER = 67108864;
|
|
2742
|
+
function execCapture$2(file, args, options) {
|
|
2743
|
+
try {
|
|
2744
|
+
return {
|
|
2745
|
+
status: 0,
|
|
2746
|
+
stdout: execFileSync(file, args, {
|
|
2747
|
+
cwd: options.cwd,
|
|
2748
|
+
env: options.env ? {
|
|
2749
|
+
...process.env,
|
|
2750
|
+
...options.env
|
|
2751
|
+
} : void 0,
|
|
2752
|
+
input: options.input,
|
|
2753
|
+
encoding: "utf-8",
|
|
2754
|
+
stdio: [
|
|
2755
|
+
options.stdin ?? "pipe",
|
|
2756
|
+
"pipe",
|
|
2757
|
+
"pipe"
|
|
2758
|
+
],
|
|
2759
|
+
maxBuffer: EXEC_MAX_BUFFER
|
|
2760
|
+
}),
|
|
2761
|
+
stderr: ""
|
|
2762
|
+
};
|
|
2763
|
+
} catch (err) {
|
|
2764
|
+
if (isExecSyncError(err)) return {
|
|
2765
|
+
status: err.status,
|
|
2766
|
+
stdout: err.stdout,
|
|
2767
|
+
stderr: err.stderr
|
|
2768
|
+
};
|
|
2769
|
+
if (options.keepPartialStdoutOnKill && isKilledExecError(err)) {
|
|
2770
|
+
const detail = describeError$1(err);
|
|
2771
|
+
const stderr = err.stderr.trim() === "" ? detail : `${err.stderr}\n${detail}`;
|
|
2772
|
+
return {
|
|
2773
|
+
status: 1,
|
|
2774
|
+
stdout: err.stdout,
|
|
2775
|
+
stderr
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
return {
|
|
2779
|
+
status: 1,
|
|
2780
|
+
stdout: "",
|
|
2781
|
+
stderr: describeError$1(err),
|
|
2782
|
+
error: err
|
|
2783
|
+
};
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2681
2786
|
function isExecSyncError(err) {
|
|
2682
2787
|
return err instanceof Error && "stdout" in err && typeof err.stdout === "string" && "stderr" in err && typeof err.stderr === "string" && "status" in err && typeof err.status === "number";
|
|
2683
2788
|
}
|
|
@@ -3684,17 +3789,28 @@ function extractFromRefs(dockerfileContent) {
|
|
|
3684
3789
|
}
|
|
3685
3790
|
return refs;
|
|
3686
3791
|
}
|
|
3792
|
+
function localBaseImages(packages, executor, cwd) {
|
|
3793
|
+
const imageNames = new Set(packages.map((pkg) => pkg.imageName));
|
|
3794
|
+
const basesByImageName = /* @__PURE__ */ new Map();
|
|
3795
|
+
for (const pkg of packages) {
|
|
3796
|
+
const content = executor.readFile(path.join(cwd, pkg.docker.dockerfile));
|
|
3797
|
+
const bases = [];
|
|
3798
|
+
if (content !== null) {
|
|
3799
|
+
for (const ref of extractFromRefs(content)) if (ref !== pkg.imageName && imageNames.has(ref) && !bases.includes(ref)) bases.push(ref);
|
|
3800
|
+
}
|
|
3801
|
+
basesByImageName.set(pkg.imageName, bases);
|
|
3802
|
+
}
|
|
3803
|
+
return basesByImageName;
|
|
3804
|
+
}
|
|
3687
3805
|
function sortPackagesByDependency(packages, executor, cwd) {
|
|
3688
3806
|
const indexByImageName = new Map(packages.map((pkg, index) => [pkg.imageName, index]));
|
|
3807
|
+
const basesByImageName = localBaseImages(packages, executor, cwd);
|
|
3689
3808
|
const dependencyIndexes = [];
|
|
3690
|
-
for (
|
|
3691
|
-
const pkg = packages[selfIndex];
|
|
3692
|
-
if (pkg === void 0) continue;
|
|
3693
|
-
const content = executor.readFile(path.join(cwd, pkg.docker.dockerfile));
|
|
3809
|
+
for (const pkg of packages) {
|
|
3694
3810
|
const deps = [];
|
|
3695
|
-
|
|
3696
|
-
const depIndex = indexByImageName.get(
|
|
3697
|
-
if (depIndex !== void 0
|
|
3811
|
+
for (const base of basesByImageName.get(pkg.imageName) ?? []) {
|
|
3812
|
+
const depIndex = indexByImageName.get(base);
|
|
3813
|
+
if (depIndex !== void 0) deps.push(depIndex);
|
|
3698
3814
|
}
|
|
3699
3815
|
dependencyIndexes.push(deps);
|
|
3700
3816
|
}
|
|
@@ -3718,6 +3834,15 @@ function sortPackagesByDependency(packages, executor, cwd) {
|
|
|
3718
3834
|
}
|
|
3719
3835
|
return sorted;
|
|
3720
3836
|
}
|
|
3837
|
+
function refuseDuplicateImageNames(packages) {
|
|
3838
|
+
const dirsByImageName = /* @__PURE__ */ new Map();
|
|
3839
|
+
for (const pkg of packages) {
|
|
3840
|
+
const dirs = dirsByImageName.get(pkg.imageName);
|
|
3841
|
+
if (dirs === void 0) dirsByImageName.set(pkg.imageName, [pkg.dir]);
|
|
3842
|
+
else dirs.push(pkg.dir);
|
|
3843
|
+
}
|
|
3844
|
+
for (const [imageName, dirs] of dirsByImageName) if (dirs.length > 1) throw new FatalError(`More than one Docker package builds the image name "${imageName}": ${dirs.map((dir) => `"${dir}"`).join(", ")}. They would all build the same tag, so set a distinct "imageName" for one of them under .tooling.json#docker`);
|
|
3845
|
+
}
|
|
3721
3846
|
function detectDockerPackages(executor, cwd, repoName, phase = DOCKER_CHECK_ONLY_PHASE) {
|
|
3722
3847
|
const { overrides, composeFiles } = loadDockerConfigSlice(executor, cwd);
|
|
3723
3848
|
const packageDirs = executor.listPackageDirs(cwd);
|
|
@@ -3776,6 +3901,7 @@ function detectDockerPackages(executor, cwd, repoName, phase = DOCKER_CHECK_ONLY
|
|
|
3776
3901
|
origin: NO_COMPOSE_ORIGIN
|
|
3777
3902
|
}));
|
|
3778
3903
|
}
|
|
3904
|
+
refuseDuplicateImageNames(packages);
|
|
3779
3905
|
return sortPackagesByDependency(packages, executor, cwd);
|
|
3780
3906
|
}
|
|
3781
3907
|
function readSinglePackageDocker(executor, cwd, packageDir, repoName) {
|
|
@@ -3837,18 +3963,15 @@ function interpolate(value, env, onMissing) {
|
|
|
3837
3963
|
}
|
|
3838
3964
|
function resolveBuildArgs(pkg, env) {
|
|
3839
3965
|
const entries = Object.entries(pkg.docker.buildArgs ?? {});
|
|
3840
|
-
if (entries.length === 0) return
|
|
3966
|
+
if (entries.length === 0) return {};
|
|
3841
3967
|
const warned = /* @__PURE__ */ new Set();
|
|
3842
|
-
const
|
|
3843
|
-
for (const [k, rawValue] of entries) {
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
pairs.push(`${k}=${resolved}`);
|
|
3850
|
-
}
|
|
3851
|
-
return pairs;
|
|
3968
|
+
const args = {};
|
|
3969
|
+
for (const [k, rawValue] of entries) args[k] = interpolate(rawValue, env, (missing) => {
|
|
3970
|
+
if (warned.has(missing)) return;
|
|
3971
|
+
warned.add(missing);
|
|
3972
|
+
log$1.warn(`docker build arg "${k}" for ${pkg.dir}: env var ${missing} is not set; using empty string`);
|
|
3973
|
+
});
|
|
3974
|
+
return args;
|
|
3852
3975
|
}
|
|
3853
3976
|
const IMAGE_REVISION_LABEL = "org.opencontainers.image.revision";
|
|
3854
3977
|
const IMAGE_VERSION_LABEL = "org.opencontainers.image.version";
|
|
@@ -3856,14 +3979,14 @@ const IMAGE_CONTEXT_TREE_LABEL = "com.bensandee.tooling.context-tree";
|
|
|
3856
3979
|
function resolveProvenanceLabels(executor, cwd, contextRelPath) {
|
|
3857
3980
|
const headResult = executor.exec("git", ["rev-parse", "HEAD"], { cwd });
|
|
3858
3981
|
const revision = headResult.stdout.trim();
|
|
3859
|
-
if (headResult.exitCode !== 0 || revision === "") return
|
|
3982
|
+
if (headResult.exitCode !== 0 || revision === "") return {};
|
|
3860
3983
|
const prefixResult = executor.exec("git", ["rev-parse", "--show-prefix"], { cwd });
|
|
3861
|
-
if (prefixResult.exitCode !== 0) return
|
|
3984
|
+
if (prefixResult.exitCode !== 0) return {};
|
|
3862
3985
|
const contextFromRoot = [prefixResult.stdout.trim().replace(/\/$/, ""), path.relative(cwd, path.resolve(cwd, contextRelPath)).split(path.sep).join("/")].filter((part) => part !== "").join("/");
|
|
3863
3986
|
const treeTarget = contextFromRoot === "" ? "HEAD^{tree}" : `HEAD:${contextFromRoot}`;
|
|
3864
3987
|
const treeResult = executor.exec("git", ["rev-parse", treeTarget], { cwd });
|
|
3865
3988
|
const tree = treeResult.stdout.trim();
|
|
3866
|
-
if (treeResult.exitCode !== 0 || tree === "") return
|
|
3989
|
+
if (treeResult.exitCode !== 0 || tree === "") return {};
|
|
3867
3990
|
const statusResult = executor.exec("git", [
|
|
3868
3991
|
"status",
|
|
3869
3992
|
"--porcelain",
|
|
@@ -3871,22 +3994,24 @@ function resolveProvenanceLabels(executor, cwd, contextRelPath) {
|
|
|
3871
3994
|
contextRelPath
|
|
3872
3995
|
], { cwd });
|
|
3873
3996
|
const dirty = statusResult.exitCode === 0 && statusResult.stdout.trim() !== "";
|
|
3874
|
-
return
|
|
3875
|
-
|
|
3876
|
-
`${
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3997
|
+
return {
|
|
3998
|
+
[IMAGE_REVISION_LABEL]: revision,
|
|
3999
|
+
[IMAGE_CONTEXT_TREE_LABEL]: `${tree}${dirty ? "-dirty" : ""}`
|
|
4000
|
+
};
|
|
4001
|
+
}
|
|
4002
|
+
function resolveImageLabels(executor, pkg, cwd) {
|
|
4003
|
+
const labels = resolveProvenanceLabels(executor, cwd, pkg.docker.context);
|
|
4004
|
+
if (pkg.version) labels[IMAGE_VERSION_LABEL] = pkg.version;
|
|
4005
|
+
return labels;
|
|
3880
4006
|
}
|
|
3881
4007
|
function buildImage(executor, pkg, cwd, extraArgs) {
|
|
3882
4008
|
const dockerfilePath = path.resolve(cwd, pkg.docker.dockerfile);
|
|
3883
4009
|
const contextPath = path.resolve(cwd, pkg.docker.context);
|
|
3884
|
-
const
|
|
3885
|
-
log$1.info(` build args: ${
|
|
4010
|
+
const pairs = Object.entries(resolveBuildArgs(pkg, process.env)).map(([key, value]) => `${key}=${value}`);
|
|
4011
|
+
log$1.info(` build args: ${pairs.length > 0 ? pairs.join(" ") : "(none)"}`);
|
|
3886
4012
|
log$1.info(` extra args: ${extraArgs.length > 0 ? extraArgs.join(" ") : "(none)"}`);
|
|
3887
|
-
const buildArgFlags =
|
|
3888
|
-
const
|
|
3889
|
-
const versionLabel = pkg.version ? ["--label", `${IMAGE_VERSION_LABEL}=${pkg.version}`] : [];
|
|
4013
|
+
const buildArgFlags = pairs.flatMap((pair) => ["--build-arg", pair]);
|
|
4014
|
+
const labelFlags = Object.entries(resolveImageLabels(executor, pkg, cwd)).flatMap(([key, value]) => ["--label", `${key}=${value}`]);
|
|
3890
4015
|
executor.execInherit("docker", [
|
|
3891
4016
|
"build",
|
|
3892
4017
|
"-f",
|
|
@@ -3894,12 +4019,46 @@ function buildImage(executor, pkg, cwd, extraArgs) {
|
|
|
3894
4019
|
"-t",
|
|
3895
4020
|
`${pkg.imageName}:latest`,
|
|
3896
4021
|
...buildArgFlags,
|
|
3897
|
-
...
|
|
3898
|
-
...versionLabel,
|
|
4022
|
+
...labelFlags,
|
|
3899
4023
|
...extraArgs,
|
|
3900
4024
|
contextPath
|
|
3901
4025
|
]);
|
|
3902
4026
|
}
|
|
4027
|
+
function bakeImages(executor, packages, config) {
|
|
4028
|
+
const cwd = config.cwd;
|
|
4029
|
+
const basesByImageName = localBaseImages(packages, executor, cwd);
|
|
4030
|
+
const images = [];
|
|
4031
|
+
for (const pkg of packages) {
|
|
4032
|
+
log$1.info(`Building image for ${pkg.dir} (${pkg.imageName}:latest)...`);
|
|
4033
|
+
debug(config, `Dockerfile: ${pkg.docker.dockerfile}, context: ${pkg.docker.context}`);
|
|
4034
|
+
const buildArgs = resolveBuildArgs(pkg, process.env);
|
|
4035
|
+
const pairs = Object.entries(buildArgs).map(([key, value]) => `${key}=${value}`);
|
|
4036
|
+
log$1.info(` build args: ${pairs.length > 0 ? pairs.join(" ") : "(none)"}`);
|
|
4037
|
+
images.push({
|
|
4038
|
+
imageName: pkg.imageName,
|
|
4039
|
+
dockerfile: path.resolve(cwd, pkg.docker.dockerfile),
|
|
4040
|
+
context: path.resolve(cwd, pkg.docker.context),
|
|
4041
|
+
args: buildArgs,
|
|
4042
|
+
labels: resolveImageLabels(executor, pkg, cwd),
|
|
4043
|
+
bases: basesByImageName.get(pkg.imageName) ?? []
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
const definitionDir = path.join(os.tmpdir(), `bst-docker-bake-${randomUUID()}`);
|
|
4047
|
+
const definitionPath = path.join(definitionDir, "docker-bake.json");
|
|
4048
|
+
executor.makeDir(definitionDir);
|
|
4049
|
+
try {
|
|
4050
|
+
executor.writeFile(definitionPath, JSON.stringify(buildBakeDefinition(images)));
|
|
4051
|
+
executor.execInherit("docker", [
|
|
4052
|
+
"buildx",
|
|
4053
|
+
"bake",
|
|
4054
|
+
"--file",
|
|
4055
|
+
definitionPath,
|
|
4056
|
+
"--load"
|
|
4057
|
+
], { cwd });
|
|
4058
|
+
} finally {
|
|
4059
|
+
executor.removeDir(definitionDir);
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
3903
4062
|
function runDockerBuild(executor, config) {
|
|
3904
4063
|
const repoName = readRepoName(executor, config.cwd);
|
|
3905
4064
|
if (config.packageDir) {
|
|
@@ -3916,7 +4075,16 @@ function runDockerBuild(executor, config) {
|
|
|
3916
4075
|
return { packages: [] };
|
|
3917
4076
|
}
|
|
3918
4077
|
log$1.info(`Found ${String(packages.length)} Docker package(s): ${packages.map((p) => p.dir).join(", ")}`);
|
|
3919
|
-
|
|
4078
|
+
let useBake = true;
|
|
4079
|
+
if (config.extraArgs.length > 0) {
|
|
4080
|
+
log$1.info("Building one image at a time: the extra arguments go to `docker build`, and bake does not take them.");
|
|
4081
|
+
useBake = false;
|
|
4082
|
+
} else if (executor.exec("docker", ["buildx", "version"]).exitCode !== 0) {
|
|
4083
|
+
log$1.info("Building one image at a time: `docker buildx` is not available on this host.");
|
|
4084
|
+
useBake = false;
|
|
4085
|
+
}
|
|
4086
|
+
if (useBake) bakeImages(executor, packages, config);
|
|
4087
|
+
else for (const pkg of packages) {
|
|
3920
4088
|
log$1.info(`Building image for ${pkg.dir} (${pkg.imageName}:latest)...`);
|
|
3921
4089
|
debug(config, `Dockerfile: ${pkg.docker.dockerfile}, context: ${pkg.docker.context}`);
|
|
3922
4090
|
buildImage(executor, pkg, config.cwd, config.extraArgs);
|
|
@@ -5532,9 +5700,9 @@ function buildManagedDevDeps(ctx) {
|
|
|
5532
5700
|
const devDeps = { ...rootDevDeps(ctx.config) };
|
|
5533
5701
|
if (!isMonorepo) Object.assign(devDeps, perPackageDevDeps(ctx.config));
|
|
5534
5702
|
if (ctx.config.stack !== "none") devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.15.0";
|
|
5535
|
-
if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.
|
|
5703
|
+
if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.98.0";
|
|
5536
5704
|
if (ctx.config.useEslintPlugin && ctx.config.stack !== "none") devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.17.0";
|
|
5537
|
-
if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.
|
|
5705
|
+
if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.2.0";
|
|
5538
5706
|
if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = {
|
|
5539
5707
|
"@changesets/cli": "3.0.3",
|
|
5540
5708
|
"@release-it/bumper": "8.0.1",
|
|
@@ -9456,13 +9624,13 @@ const GIT_GUIDE_BODY = [
|
|
|
9456
9624
|
"",
|
|
9457
9625
|
"## Claiming work by hand",
|
|
9458
9626
|
"",
|
|
9459
|
-
"If the bst agent drives this repo, claim an issue or pull request before you work it by hand, so the agent does not start a run beside you: run `pnpm exec bst work:start <n>`. It prints the same orientation `work:status` does and then puts `agent-flags/
|
|
9627
|
+
"If the bst agent drives this repo, claim an issue or pull request before you work it by hand, so the agent does not start a run beside you: run `pnpm exec bst work:start <n>`. It prints the same orientation `work:status` does and then puts `agent-flags/human-driven` on the object. It claims only where the repo's default branch sets `agent.enabled: true`, and does nothing anywhere else. **Exit 1 means do not start**: a run is live on the pair, or one is queued on it -- the output names which. An object the agent parked at a terminal such as `agent/implement-blocked` is claimed, since nothing runs there until a person acts. Exit 0 means the pair is yours, whether the command wrote the flag or found it there already.",
|
|
9460
9628
|
"",
|
|
9461
9629
|
"The flag records who is working an object now, not who wrote it. Do not claim an issue or pull request you only file or open for later, even one a person or a coding session wrote by hand: leave it unclaimed so the agent can take it if asked. Claim it when you are about to work it.",
|
|
9462
9630
|
"",
|
|
9463
9631
|
"A pull request you open yourself that closes no claimed issue needs its own `pnpm exec bst work:start <n>` once it exists -- the flag on either half of a pair holds both, but there is no pair until something closes something.",
|
|
9464
9632
|
"",
|
|
9465
|
-
"Hand the work back with the control panel's **Release to the agent**, or by removing `agent-flags/
|
|
9633
|
+
"Hand the work back with the control panel's **Release to the agent**, or by removing `agent-flags/human-driven` from both halves. Removing it does not queue anything: the agent picks the object up on its next cycle only if a label or a comment asks it to.",
|
|
9466
9634
|
"",
|
|
9467
9635
|
"## Issue linking",
|
|
9468
9636
|
"",
|
|
@@ -10172,7 +10340,7 @@ function reportFailures(failed, command) {
|
|
|
10172
10340
|
function generateMigratePrompt(results, config, detected) {
|
|
10173
10341
|
const sections = [];
|
|
10174
10342
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
10175
|
-
sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.
|
|
10343
|
+
sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.98.0 repo:sync\` on ${timestamp}_\n`);
|
|
10176
10344
|
const changed = results.filter((r) => r.action === "created" || r.action === "updated" || r.action === "archived");
|
|
10177
10345
|
if (changed.length > 0) {
|
|
10178
10346
|
const items = changed.map((r) => {
|
|
@@ -11056,38 +11224,17 @@ function groupSkippedSteps(steps, defined, flagSkip, configSkip) {
|
|
|
11056
11224
|
function createRealHealthExecutor(rootDir) {
|
|
11057
11225
|
return {
|
|
11058
11226
|
exec(file, args, options) {
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
"pipe",
|
|
11071
|
-
"pipe",
|
|
11072
|
-
"pipe"
|
|
11073
|
-
],
|
|
11074
|
-
maxBuffer: 67108864
|
|
11075
|
-
}),
|
|
11076
|
-
stderr: "",
|
|
11077
|
-
exitCode: 0
|
|
11078
|
-
};
|
|
11079
|
-
} catch (err) {
|
|
11080
|
-
if (isExecSyncError(err)) return {
|
|
11081
|
-
stdout: err.stdout,
|
|
11082
|
-
stderr: err.stderr,
|
|
11083
|
-
exitCode: err.status
|
|
11084
|
-
};
|
|
11085
|
-
return {
|
|
11086
|
-
stdout: "",
|
|
11087
|
-
stderr: describeError$1(err),
|
|
11088
|
-
exitCode: 1
|
|
11089
|
-
};
|
|
11090
|
-
}
|
|
11227
|
+
const result = execCapture$2(file, args, {
|
|
11228
|
+
cwd: options?.cwd ?? rootDir,
|
|
11229
|
+
env: options?.env,
|
|
11230
|
+
input: options?.input,
|
|
11231
|
+
keepPartialStdoutOnKill: false
|
|
11232
|
+
});
|
|
11233
|
+
return {
|
|
11234
|
+
stdout: result.stdout,
|
|
11235
|
+
stderr: result.stderr,
|
|
11236
|
+
exitCode: result.status
|
|
11237
|
+
};
|
|
11091
11238
|
},
|
|
11092
11239
|
readFile(rel) {
|
|
11093
11240
|
const full = path.join(rootDir, rel);
|
|
@@ -13715,7 +13862,7 @@ const AuthenticatedUserSchema = z.object({
|
|
|
13715
13862
|
});
|
|
13716
13863
|
async function getAuthenticatedUser(executor, conn, signal = null) {
|
|
13717
13864
|
const res = await executor.fetch(`${conn.serverUrl}/api/v1/user`, {
|
|
13718
|
-
headers: authHeaders
|
|
13865
|
+
headers: authHeaders(conn),
|
|
13719
13866
|
signal
|
|
13720
13867
|
});
|
|
13721
13868
|
if (!res.ok) return {
|
|
@@ -13742,12 +13889,6 @@ function sleep(ms) {
|
|
|
13742
13889
|
setTimeout(resolve, ms);
|
|
13743
13890
|
});
|
|
13744
13891
|
}
|
|
13745
|
-
function envMsOverride(raw, productionMs) {
|
|
13746
|
-
if (raw === void 0) return productionMs;
|
|
13747
|
-
const parsed = Number(raw.trim());
|
|
13748
|
-
if (!Number.isSafeInteger(parsed) || parsed <= 0) return productionMs;
|
|
13749
|
-
return Math.min(parsed, productionMs);
|
|
13750
|
-
}
|
|
13751
13892
|
//#endregion
|
|
13752
13893
|
//#region src/release/git-identity.ts
|
|
13753
13894
|
function ciActorName(platform) {
|
|
@@ -14153,7 +14294,7 @@ const LABELS_MAX_PAGES = 20;
|
|
|
14153
14294
|
async function fetchAllForgejoLabels(executor, conn) {
|
|
14154
14295
|
const labels = [];
|
|
14155
14296
|
for (let page = 1; page <= LABELS_MAX_PAGES; page++) {
|
|
14156
|
-
const res = await executor.fetch(`${conn.serverUrl}/api/v1/repos/${conn.repository}/labels?limit=${String(LABELS_PAGE_SIZE)}&page=${String(page)}`, { headers: authHeaders
|
|
14297
|
+
const res = await executor.fetch(`${conn.serverUrl}/api/v1/repos/${conn.repository}/labels?limit=${String(LABELS_PAGE_SIZE)}&page=${String(page)}`, { headers: authHeaders(conn) });
|
|
14157
14298
|
if (!res.ok) await throwForgejoFailure(res, {
|
|
14158
14299
|
verb: "list labels",
|
|
14159
14300
|
resource: conn.repository
|
|
@@ -14218,7 +14359,7 @@ async function removeForgejoIssueLabel(executor, conn, number, name, labelIds) {
|
|
|
14218
14359
|
const id = await resolveLabelId(executor, conn, name, labelIds);
|
|
14219
14360
|
const res = await executor.fetch(`${issuesBase(conn)}/${String(number)}/labels/${String(id)}`, {
|
|
14220
14361
|
method: "DELETE",
|
|
14221
|
-
headers: authHeaders
|
|
14362
|
+
headers: authHeaders(conn)
|
|
14222
14363
|
}, { idempotent: true });
|
|
14223
14364
|
if (!res.ok) await throwForgejoFailure(res, {
|
|
14224
14365
|
verb: "remove label",
|
|
@@ -14278,7 +14419,7 @@ async function listForgejoComments(executor, conn, number, options = {}) {
|
|
|
14278
14419
|
limit: String(COMMENTS_PAGE_SIZE),
|
|
14279
14420
|
page: String(page)
|
|
14280
14421
|
});
|
|
14281
|
-
const res = await executor.fetch(`${issuesBase(conn)}/${String(number)}/comments?${params.toString()}`, { headers: authHeaders
|
|
14422
|
+
const res = await executor.fetch(`${issuesBase(conn)}/${String(number)}/comments?${params.toString()}`, { headers: authHeaders(conn) });
|
|
14282
14423
|
if (!res.ok) await throwForgejoFailure(res, {
|
|
14283
14424
|
verb: "list comments",
|
|
14284
14425
|
resource: `#${String(number)}`
|
|
@@ -14372,7 +14513,7 @@ function toIssueSummaries(raw, type = "issues") {
|
|
|
14372
14513
|
return type === "issues" ? summaries.filter((s) => !s.isPullRequest) : summaries;
|
|
14373
14514
|
}
|
|
14374
14515
|
async function getForgejoIssue(executor, conn, number) {
|
|
14375
|
-
const res = await executor.fetch(`${issuesBase(conn)}/${String(number)}`, { headers: authHeaders
|
|
14516
|
+
const res = await executor.fetch(`${issuesBase(conn)}/${String(number)}`, { headers: authHeaders(conn) });
|
|
14376
14517
|
if (!res.ok) await throwForgejoFailure(res, {
|
|
14377
14518
|
verb: "get issue",
|
|
14378
14519
|
resource: `#${String(number)}`
|
|
@@ -14396,7 +14537,7 @@ function issueListParams(type, query) {
|
|
|
14396
14537
|
return params;
|
|
14397
14538
|
}
|
|
14398
14539
|
async function fetchIssueListPage(executor, conn, params) {
|
|
14399
|
-
const res = await executor.fetch(`${issuesBase(conn)}?${params.toString()}`, { headers: authHeaders
|
|
14540
|
+
const res = await executor.fetch(`${issuesBase(conn)}?${params.toString()}`, { headers: authHeaders(conn) });
|
|
14400
14541
|
if (!res.ok) await throwForgejoFailure(res, {
|
|
14401
14542
|
verb: "list issues",
|
|
14402
14543
|
resource: conn.repository
|
|
@@ -14791,11 +14932,16 @@ function groupLabels(names, descriptions) {
|
|
|
14791
14932
|
return groups;
|
|
14792
14933
|
}
|
|
14793
14934
|
const RUNNING_LABEL = /^agent\/[a-z-]+-running$/;
|
|
14794
|
-
const
|
|
14935
|
+
const QUEUED_LABEL = /^agent\/[a-z]+$/;
|
|
14936
|
+
const HUMAN_DRIVEN_LABEL = "agent-flags/human-driven";
|
|
14937
|
+
const HUMAN_DRIVEN_LABEL_NAMES = [HUMAN_DRIVEN_LABEL, "agent-flags/hand-authored"];
|
|
14795
14938
|
function liftedFacts(names) {
|
|
14939
|
+
const runLive = names.filter((name) => RUNNING_LABEL.test(name)).toSorted();
|
|
14940
|
+
const heldBy = HUMAN_DRIVEN_LABEL_NAMES.find((name) => names.includes(name)) ?? null;
|
|
14796
14941
|
return {
|
|
14797
|
-
runLive
|
|
14798
|
-
heldByHand:
|
|
14942
|
+
runLive,
|
|
14943
|
+
heldByHand: heldBy !== null,
|
|
14944
|
+
heldBy
|
|
14799
14945
|
};
|
|
14800
14946
|
}
|
|
14801
14947
|
function labelNamesOf(section) {
|
|
@@ -14809,20 +14955,26 @@ function ownerOf(names) {
|
|
|
14809
14955
|
if (running !== void 0) return {
|
|
14810
14956
|
owner: "agent",
|
|
14811
14957
|
label: running,
|
|
14812
|
-
|
|
14958
|
+
hold: "running"
|
|
14813
14959
|
};
|
|
14814
|
-
if (names.includes(
|
|
14815
|
-
const
|
|
14816
|
-
if (
|
|
14960
|
+
if (HUMAN_DRIVEN_LABEL_NAMES.some((name) => names.includes(name))) return { owner: "person" };
|
|
14961
|
+
const queued = agent.find((name) => QUEUED_LABEL.test(name));
|
|
14962
|
+
if (queued !== void 0) return {
|
|
14817
14963
|
owner: "agent",
|
|
14818
|
-
label:
|
|
14819
|
-
|
|
14964
|
+
label: queued,
|
|
14965
|
+
hold: "queued"
|
|
14966
|
+
};
|
|
14967
|
+
const parked = agent[0];
|
|
14968
|
+
if (parked !== void 0) return {
|
|
14969
|
+
owner: "agent",
|
|
14970
|
+
label: parked,
|
|
14971
|
+
hold: "parked"
|
|
14820
14972
|
};
|
|
14821
14973
|
return { owner: "unclaimed" };
|
|
14822
14974
|
}
|
|
14823
14975
|
//#endregion
|
|
14824
14976
|
//#region src/work-status/claim.ts
|
|
14825
|
-
const HANDOVER_ROUTES = "Claim it from the control panel's \"Claim for hand work\", or remove the agent label by hand and run pnpm exec bst work:start again.";
|
|
14977
|
+
const HANDOVER_ROUTES = "Claim it from the control panel's \"Claim for hand work\", which strips the trigger, or remove the agent label by hand and run pnpm exec bst work:start again.";
|
|
14826
14978
|
function decideClaim(report, enabled) {
|
|
14827
14979
|
if (!enabled) return {
|
|
14828
14980
|
kind: "answer",
|
|
@@ -14855,7 +15007,7 @@ function decideClaim(report, enabled) {
|
|
|
14855
15007
|
exitCode: 0,
|
|
14856
15008
|
result: { outcome: "already-claimed" }
|
|
14857
15009
|
};
|
|
14858
|
-
if (held.kind === "agent") return {
|
|
15010
|
+
if (held.kind === "agent" && held.hold !== "parked") return {
|
|
14859
15011
|
kind: "answer",
|
|
14860
15012
|
exitCode: 1,
|
|
14861
15013
|
result: {
|
|
@@ -14864,17 +15016,26 @@ function decideClaim(report, enabled) {
|
|
|
14864
15016
|
reason: `The agent holds this object (${held.label}). ${HANDOVER_ROUTES}`
|
|
14865
15017
|
}
|
|
14866
15018
|
};
|
|
15019
|
+
if (held.kind === "agent" && report.runLive === null) return {
|
|
15020
|
+
kind: "answer",
|
|
15021
|
+
exitCode: 1,
|
|
15022
|
+
result: {
|
|
15023
|
+
outcome: "failed",
|
|
15024
|
+
reason: `A label read failed, so a run may be live or queued beside ${held.label} unseen. Nothing was claimed; retry once the forge read works.`
|
|
15025
|
+
}
|
|
15026
|
+
};
|
|
14867
15027
|
return { kind: "write" };
|
|
14868
15028
|
}
|
|
14869
15029
|
function ownershipOf(report) {
|
|
14870
15030
|
if (report.labels.state === "ok") {
|
|
14871
15031
|
const ownership = ownerOf(labelNamesOf(report.labels));
|
|
14872
|
-
if (ownership.owner === "agent") return ownership.running ? {
|
|
15032
|
+
if (ownership.owner === "agent") return ownership.hold === "running" ? {
|
|
14873
15033
|
kind: "running",
|
|
14874
15034
|
label: ownership.label
|
|
14875
15035
|
} : {
|
|
14876
15036
|
kind: "agent",
|
|
14877
|
-
label: ownership.label
|
|
15037
|
+
label: ownership.label,
|
|
15038
|
+
hold: ownership.hold
|
|
14878
15039
|
};
|
|
14879
15040
|
if (ownership.owner === "person") return { kind: "person" };
|
|
14880
15041
|
return { kind: "unclaimed" };
|
|
@@ -14883,7 +15044,8 @@ function ownershipOf(report) {
|
|
|
14883
15044
|
const live = report.runLive?.[0];
|
|
14884
15045
|
return live === void 0 ? {
|
|
14885
15046
|
kind: "agent",
|
|
14886
|
-
label: "an agent label"
|
|
15047
|
+
label: "an agent label",
|
|
15048
|
+
hold: "unread"
|
|
14887
15049
|
} : {
|
|
14888
15050
|
kind: "running",
|
|
14889
15051
|
label: live
|
|
@@ -14894,15 +15056,15 @@ function ownershipOf(report) {
|
|
|
14894
15056
|
async function writeClaim(executor, cwd, target, number) {
|
|
14895
15057
|
try {
|
|
14896
15058
|
const { conn } = requireForgejoTransport(executor, cwd, target, "bst work:start claims work on Forgejo, the forge the agent drives; a GitHub checkout has no agent to hand work to.");
|
|
14897
|
-
const flag = (await fetchAllForgejoLabels(executor, conn)).find((label) => label.name ===
|
|
15059
|
+
const flag = (await fetchAllForgejoLabels(executor, conn)).find((label) => label.name === HUMAN_DRIVEN_LABEL);
|
|
14898
15060
|
if (flag === void 0) return {
|
|
14899
15061
|
outcome: "failed",
|
|
14900
|
-
reason: `The forge has no label named ${
|
|
15062
|
+
reason: `The forge has no label named ${HUMAN_DRIVEN_LABEL}. Provision the agent's labels first with pnpm exec bst-agent agent:labels --repo ${conn.repository}, or the control panel's Provision labels.`
|
|
14901
15063
|
};
|
|
14902
|
-
await addForgejoIssueLabel(executor, conn, number,
|
|
15064
|
+
await addForgejoIssueLabel(executor, conn, number, HUMAN_DRIVEN_LABEL, /* @__PURE__ */ new Map([[HUMAN_DRIVEN_LABEL, flag.id]]));
|
|
14903
15065
|
return {
|
|
14904
15066
|
outcome: "claimed",
|
|
14905
|
-
label:
|
|
15067
|
+
label: HUMAN_DRIVEN_LABEL
|
|
14906
15068
|
};
|
|
14907
15069
|
} catch (error) {
|
|
14908
15070
|
return {
|
|
@@ -15205,18 +15367,12 @@ z.object({
|
|
|
15205
15367
|
created: z.string()
|
|
15206
15368
|
});
|
|
15207
15369
|
z.array(z.unknown());
|
|
15208
|
-
function repoBase$1(conn) {
|
|
15209
|
-
return `${conn.serverUrl}/api/v1/repos/${conn.repository}`;
|
|
15210
|
-
}
|
|
15211
|
-
function authHeaders$1(conn) {
|
|
15212
|
-
return { Authorization: `token ${conn.token}` };
|
|
15213
|
-
}
|
|
15214
15370
|
function branchNotFoundMessage(conn, branch) {
|
|
15215
15371
|
return `Branch ${branch} not found in ${conn.repository}`;
|
|
15216
15372
|
}
|
|
15217
15373
|
async function branchExists(executor, conn, branch) {
|
|
15218
|
-
const url = `${repoBase
|
|
15219
|
-
const res = await executor.fetch(url, { headers: authHeaders
|
|
15374
|
+
const url = `${repoBase(conn)}/branches/${encodeURIComponent(branch)}`;
|
|
15375
|
+
const res = await executor.fetch(url, { headers: authHeaders(conn) });
|
|
15220
15376
|
if (res.status === 404) return false;
|
|
15221
15377
|
if (!res.ok) await throwForgejoFailure(res, {
|
|
15222
15378
|
verb: "check branch",
|
|
@@ -16464,7 +16620,17 @@ const INVISIBLE_OFFENDERS = [
|
|
|
16464
16620
|
char: "ᅠ",
|
|
16465
16621
|
group: "invisible"
|
|
16466
16622
|
},
|
|
16467
|
-
...rangeOffenders(917504, 917631, "TAG CHARACTER", "invisible")
|
|
16623
|
+
...rangeOffenders(917504, 917631, "TAG CHARACTER", "invisible"),
|
|
16624
|
+
...rangeOffenders(0, 8, "C0 CONTROL", "invisible"),
|
|
16625
|
+
...rangeOffenders(11, 12, "C0 CONTROL", "invisible"),
|
|
16626
|
+
...rangeOffenders(14, 31, "C0 CONTROL", "invisible"),
|
|
16627
|
+
{
|
|
16628
|
+
codepoint: "U+007F",
|
|
16629
|
+
name: "DELETE",
|
|
16630
|
+
tier: 1,
|
|
16631
|
+
char: "",
|
|
16632
|
+
group: "invisible"
|
|
16633
|
+
}
|
|
16468
16634
|
];
|
|
16469
16635
|
const SCRIPT_DEPENDENT_OFFENDERS = [
|
|
16470
16636
|
{
|
|
@@ -16699,6 +16865,34 @@ function offenderNameByCodepoint(codepoint) {
|
|
|
16699
16865
|
return nameByCodepoint.get(codepoint);
|
|
16700
16866
|
}
|
|
16701
16867
|
//#endregion
|
|
16868
|
+
//#region src/chars-check/span-lexer.ts
|
|
16869
|
+
var SpanLexer = class {
|
|
16870
|
+
spans = [];
|
|
16871
|
+
spanStart = 0;
|
|
16872
|
+
spanContext;
|
|
16873
|
+
constructor(initialContext) {
|
|
16874
|
+
this.spanContext = initialContext;
|
|
16875
|
+
}
|
|
16876
|
+
flushTo(end, context) {
|
|
16877
|
+
if (context === this.spanContext) return;
|
|
16878
|
+
if (end > this.spanStart) this.spans.push({
|
|
16879
|
+
start: this.spanStart,
|
|
16880
|
+
end,
|
|
16881
|
+
context: this.spanContext
|
|
16882
|
+
});
|
|
16883
|
+
this.spanStart = end;
|
|
16884
|
+
this.spanContext = context;
|
|
16885
|
+
}
|
|
16886
|
+
finish(length) {
|
|
16887
|
+
if (length > this.spanStart) this.spans.push({
|
|
16888
|
+
start: this.spanStart,
|
|
16889
|
+
end: length,
|
|
16890
|
+
context: this.spanContext
|
|
16891
|
+
});
|
|
16892
|
+
return this.spans;
|
|
16893
|
+
}
|
|
16894
|
+
};
|
|
16895
|
+
//#endregion
|
|
16702
16896
|
//#region src/chars-check/context-js-ts.ts
|
|
16703
16897
|
const EXPRESSION_START_PUNCTUATION = /* @__PURE__ */ new Set([
|
|
16704
16898
|
"(",
|
|
@@ -16749,7 +16943,7 @@ function isJsxNameStart(ch) {
|
|
|
16749
16943
|
function resumeAfterTagClose(stack) {
|
|
16750
16944
|
return stack[stack.length - 1]?.kind === "jsx-children" ? "jsx-text" : "code";
|
|
16751
16945
|
}
|
|
16752
|
-
var JsTsLexer = class {
|
|
16946
|
+
var JsTsLexer = class extends SpanLexer {
|
|
16753
16947
|
text;
|
|
16754
16948
|
jsx;
|
|
16755
16949
|
n;
|
|
@@ -16758,11 +16952,9 @@ var JsTsLexer = class {
|
|
|
16758
16952
|
expectsExpression = true;
|
|
16759
16953
|
regexInClass = false;
|
|
16760
16954
|
stack = [];
|
|
16761
|
-
spans = [];
|
|
16762
|
-
spanStart = 0;
|
|
16763
|
-
spanContext = "code";
|
|
16764
16955
|
bailed = false;
|
|
16765
16956
|
constructor(text, jsx) {
|
|
16957
|
+
super("code");
|
|
16766
16958
|
this.text = text;
|
|
16767
16959
|
this.jsx = jsx;
|
|
16768
16960
|
this.n = text.length;
|
|
@@ -16771,13 +16963,9 @@ var JsTsLexer = class {
|
|
|
16771
16963
|
while (this.i < this.n && !this.bailed) this.step();
|
|
16772
16964
|
if (this.bailed) return null;
|
|
16773
16965
|
if (this.mode === "line-comment") this.mode = "code";
|
|
16774
|
-
|
|
16775
|
-
start: this.spanStart,
|
|
16776
|
-
end: this.n,
|
|
16777
|
-
context: this.spanContext
|
|
16778
|
-
});
|
|
16966
|
+
const spans = this.finish(this.n);
|
|
16779
16967
|
if (this.mode !== "code" || this.stack.length > 0) return null;
|
|
16780
|
-
return
|
|
16968
|
+
return spans;
|
|
16781
16969
|
}
|
|
16782
16970
|
bail() {
|
|
16783
16971
|
this.bailed = true;
|
|
@@ -16785,16 +16973,6 @@ var JsTsLexer = class {
|
|
|
16785
16973
|
char(offset = 0) {
|
|
16786
16974
|
return this.text[this.i + offset] ?? "";
|
|
16787
16975
|
}
|
|
16788
|
-
flushTo(end, context) {
|
|
16789
|
-
if (context === this.spanContext) return;
|
|
16790
|
-
if (end > this.spanStart) this.spans.push({
|
|
16791
|
-
start: this.spanStart,
|
|
16792
|
-
end,
|
|
16793
|
-
context: this.spanContext
|
|
16794
|
-
});
|
|
16795
|
-
this.spanStart = end;
|
|
16796
|
-
this.spanContext = context;
|
|
16797
|
-
}
|
|
16798
16976
|
step() {
|
|
16799
16977
|
switch (this.mode) {
|
|
16800
16978
|
case "code": return this.stepCode();
|
|
@@ -17091,7 +17269,7 @@ const jsxFamily = {
|
|
|
17091
17269
|
};
|
|
17092
17270
|
//#endregion
|
|
17093
17271
|
//#region src/chars-check/context-kt-java.ts
|
|
17094
|
-
var KtJavaLexer = class {
|
|
17272
|
+
var KtJavaLexer = class extends SpanLexer {
|
|
17095
17273
|
text;
|
|
17096
17274
|
kotlin;
|
|
17097
17275
|
rawStringContext;
|
|
@@ -17099,11 +17277,9 @@ var KtJavaLexer = class {
|
|
|
17099
17277
|
i = 0;
|
|
17100
17278
|
mode = "code";
|
|
17101
17279
|
stack = [];
|
|
17102
|
-
spans = [];
|
|
17103
|
-
spanStart = 0;
|
|
17104
|
-
spanContext = "code";
|
|
17105
17280
|
bailed = false;
|
|
17106
17281
|
constructor(text, kotlin) {
|
|
17282
|
+
super("code");
|
|
17107
17283
|
this.text = text;
|
|
17108
17284
|
this.kotlin = kotlin;
|
|
17109
17285
|
this.rawStringContext = kotlin ? "raw-string" : "text-block";
|
|
@@ -17113,13 +17289,9 @@ var KtJavaLexer = class {
|
|
|
17113
17289
|
while (this.i < this.n && !this.bailed) this.step();
|
|
17114
17290
|
if (this.bailed) return null;
|
|
17115
17291
|
if (this.mode === "line-comment") this.mode = "code";
|
|
17116
|
-
|
|
17117
|
-
start: this.spanStart,
|
|
17118
|
-
end: this.n,
|
|
17119
|
-
context: this.spanContext
|
|
17120
|
-
});
|
|
17292
|
+
const spans = this.finish(this.n);
|
|
17121
17293
|
if (this.mode !== "code" || this.stack.length > 0) return null;
|
|
17122
|
-
return
|
|
17294
|
+
return spans;
|
|
17123
17295
|
}
|
|
17124
17296
|
bail() {
|
|
17125
17297
|
this.bailed = true;
|
|
@@ -17127,16 +17299,6 @@ var KtJavaLexer = class {
|
|
|
17127
17299
|
char(offset = 0) {
|
|
17128
17300
|
return this.text[this.i + offset] ?? "";
|
|
17129
17301
|
}
|
|
17130
|
-
flushTo(end, context) {
|
|
17131
|
-
if (context === this.spanContext) return;
|
|
17132
|
-
if (end > this.spanStart) this.spans.push({
|
|
17133
|
-
start: this.spanStart,
|
|
17134
|
-
end,
|
|
17135
|
-
context: this.spanContext
|
|
17136
|
-
});
|
|
17137
|
-
this.spanStart = end;
|
|
17138
|
-
this.spanContext = context;
|
|
17139
|
-
}
|
|
17140
17302
|
step() {
|
|
17141
17303
|
switch (this.mode) {
|
|
17142
17304
|
case "code": return this.stepCode();
|
|
@@ -17249,7 +17411,7 @@ const javaFamily = {
|
|
|
17249
17411
|
//#region src/chars-check/context-markup.ts
|
|
17250
17412
|
const TAG_START = /[A-Za-z!?]/;
|
|
17251
17413
|
const TAG_NAME_CHAR = /[A-Za-z0-9:_-]/;
|
|
17252
|
-
var MarkupLexer = class {
|
|
17414
|
+
var MarkupLexer = class extends SpanLexer {
|
|
17253
17415
|
text;
|
|
17254
17416
|
html;
|
|
17255
17417
|
n;
|
|
@@ -17258,11 +17420,9 @@ var MarkupLexer = class {
|
|
|
17258
17420
|
tagKind = "open";
|
|
17259
17421
|
pendingTagName = "";
|
|
17260
17422
|
islandCloseTag = "";
|
|
17261
|
-
spans = [];
|
|
17262
|
-
spanStart = 0;
|
|
17263
|
-
spanContext = "markup-text";
|
|
17264
17423
|
bailed = false;
|
|
17265
17424
|
constructor(text, html) {
|
|
17425
|
+
super("markup-text");
|
|
17266
17426
|
this.text = text;
|
|
17267
17427
|
this.html = html;
|
|
17268
17428
|
this.n = text.length;
|
|
@@ -17270,13 +17430,9 @@ var MarkupLexer = class {
|
|
|
17270
17430
|
run() {
|
|
17271
17431
|
while (this.i < this.n && !this.bailed) this.step();
|
|
17272
17432
|
if (this.bailed) return null;
|
|
17273
|
-
|
|
17274
|
-
start: this.spanStart,
|
|
17275
|
-
end: this.n,
|
|
17276
|
-
context: this.spanContext
|
|
17277
|
-
});
|
|
17433
|
+
const spans = this.finish(this.n);
|
|
17278
17434
|
if (this.mode !== "text") return null;
|
|
17279
|
-
return
|
|
17435
|
+
return spans;
|
|
17280
17436
|
}
|
|
17281
17437
|
bail() {
|
|
17282
17438
|
this.bailed = true;
|
|
@@ -17284,16 +17440,6 @@ var MarkupLexer = class {
|
|
|
17284
17440
|
char(offset = 0) {
|
|
17285
17441
|
return this.text[this.i + offset] ?? "";
|
|
17286
17442
|
}
|
|
17287
|
-
flushTo(end, context) {
|
|
17288
|
-
if (context === this.spanContext) return;
|
|
17289
|
-
if (end > this.spanStart) this.spans.push({
|
|
17290
|
-
start: this.spanStart,
|
|
17291
|
-
end,
|
|
17292
|
-
context: this.spanContext
|
|
17293
|
-
});
|
|
17294
|
-
this.spanStart = end;
|
|
17295
|
-
this.spanContext = context;
|
|
17296
|
-
}
|
|
17297
17443
|
step() {
|
|
17298
17444
|
switch (this.mode) {
|
|
17299
17445
|
case "text": return this.stepText();
|
|
@@ -17469,17 +17615,15 @@ function conditionalParseVerify(tryParse) {
|
|
|
17469
17615
|
return tryParse(rewritten);
|
|
17470
17616
|
};
|
|
17471
17617
|
}
|
|
17472
|
-
var JsonLexer = class {
|
|
17618
|
+
var JsonLexer = class extends SpanLexer {
|
|
17473
17619
|
text;
|
|
17474
17620
|
commentsAllowed;
|
|
17475
17621
|
n;
|
|
17476
17622
|
i = 0;
|
|
17477
17623
|
mode = "code";
|
|
17478
|
-
spans = [];
|
|
17479
|
-
spanStart = 0;
|
|
17480
|
-
spanContext = "code";
|
|
17481
17624
|
bailed = false;
|
|
17482
17625
|
constructor(text, commentsAllowed) {
|
|
17626
|
+
super("code");
|
|
17483
17627
|
this.text = text;
|
|
17484
17628
|
this.commentsAllowed = commentsAllowed;
|
|
17485
17629
|
this.n = text.length;
|
|
@@ -17488,13 +17632,9 @@ var JsonLexer = class {
|
|
|
17488
17632
|
while (this.i < this.n && !this.bailed) this.step();
|
|
17489
17633
|
if (this.bailed) return null;
|
|
17490
17634
|
if (this.mode === "line-comment") this.mode = "code";
|
|
17491
|
-
|
|
17492
|
-
start: this.spanStart,
|
|
17493
|
-
end: this.n,
|
|
17494
|
-
context: this.spanContext
|
|
17495
|
-
});
|
|
17635
|
+
const spans = this.finish(this.n);
|
|
17496
17636
|
if (this.mode !== "code") return null;
|
|
17497
|
-
return
|
|
17637
|
+
return spans;
|
|
17498
17638
|
}
|
|
17499
17639
|
bail() {
|
|
17500
17640
|
this.bailed = true;
|
|
@@ -17502,16 +17642,6 @@ var JsonLexer = class {
|
|
|
17502
17642
|
char(offset = 0) {
|
|
17503
17643
|
return this.text[this.i + offset] ?? "";
|
|
17504
17644
|
}
|
|
17505
|
-
flushTo(end, context) {
|
|
17506
|
-
if (context === this.spanContext) return;
|
|
17507
|
-
if (end > this.spanStart) this.spans.push({
|
|
17508
|
-
start: this.spanStart,
|
|
17509
|
-
end,
|
|
17510
|
-
context: this.spanContext
|
|
17511
|
-
});
|
|
17512
|
-
this.spanStart = end;
|
|
17513
|
-
this.spanContext = context;
|
|
17514
|
-
}
|
|
17515
17645
|
step() {
|
|
17516
17646
|
switch (this.mode) {
|
|
17517
17647
|
case "code": return this.stepCode();
|
|
@@ -18987,6 +19117,7 @@ function liftedFactsOf(resolved, forgeDown) {
|
|
|
18987
19117
|
return {
|
|
18988
19118
|
runLive: complete || read.runLive.length > 0 ? read.runLive : null,
|
|
18989
19119
|
heldByHand: complete || read.heldByHand ? read.heldByHand : null,
|
|
19120
|
+
heldBy: complete || read.heldBy !== null ? read.heldBy : null,
|
|
18990
19121
|
owner: complete || ownership.owner === "agent" ? ownership.owner : null
|
|
18991
19122
|
};
|
|
18992
19123
|
}
|
|
@@ -19103,6 +19234,7 @@ async function buildWorkStatus(deps, ref) {
|
|
|
19103
19234
|
},
|
|
19104
19235
|
runLive: lifted.runLive,
|
|
19105
19236
|
heldByHand: lifted.heldByHand,
|
|
19237
|
+
heldBy: lifted.heldBy,
|
|
19106
19238
|
owner: lifted.owner,
|
|
19107
19239
|
object: await section(() => objectSection(inputs)),
|
|
19108
19240
|
docs: await section(() => docsSection(inputs)),
|
|
@@ -19176,7 +19308,7 @@ function renderWorkStatus(report, options) {
|
|
|
19176
19308
|
const lines = [heading(report.target)];
|
|
19177
19309
|
for (const label of report.runLive ?? []) lines.push(`RUN LIVE: ${label} -- a run is working this object; do not start another.`);
|
|
19178
19310
|
if (report.runLive === null || report.heldByHand === null) lines.push("UNKNOWN: whether a run is live or a human holds this -- not every label could be read.");
|
|
19179
|
-
if (report.
|
|
19311
|
+
if (report.heldBy !== null) lines.push(`HELD BY HAND: ${report.heldBy} -- a human claimed this one; do not drive it.`);
|
|
19180
19312
|
if (options?.agentEnabled === true && report.owner === "unclaimed") {
|
|
19181
19313
|
const number = claimableNumber(report);
|
|
19182
19314
|
if (number !== null) lines.push(`UNCLAIMED: no agent label and no hand claim -- run \`pnpm exec bst work:start ${String(number)}\` before you work this.`);
|
|
@@ -19213,7 +19345,7 @@ function renderWorkStatus(report, options) {
|
|
|
19213
19345
|
//#endregion
|
|
19214
19346
|
//#region src/commands/work-start.ts
|
|
19215
19347
|
function claimLine(result) {
|
|
19216
|
-
if (result.outcome === "claimed") return `claim: claimed -- ${result.label ?? "agent-flags/
|
|
19348
|
+
if (result.outcome === "claimed") return `claim: claimed -- ${result.label ?? "agent-flags/human-driven"} is on this object.`;
|
|
19217
19349
|
if (result.outcome === "already-claimed") return "claim: already-claimed -- the flag is already on it; nothing was written.";
|
|
19218
19350
|
if (result.outcome === "not-agent-repo") return `claim: not-agent-repo -- ${result.reason ?? "nothing was claimed."}`;
|
|
19219
19351
|
return `claim: ${result.outcome} -- ${result.reason ?? "nothing was claimed."}`;
|
|
@@ -19224,7 +19356,7 @@ function claimFailed(result) {
|
|
|
19224
19356
|
const workStartCommand = defineCommand({
|
|
19225
19357
|
meta: {
|
|
19226
19358
|
name: "work:start",
|
|
19227
|
-
description: "Claim an issue or pull request for hand work: put agent-flags/
|
|
19359
|
+
description: "Claim an issue or pull request for hand work: put agent-flags/human-driven on it so the agent leaves it alone"
|
|
19228
19360
|
},
|
|
19229
19361
|
args: {
|
|
19230
19362
|
ref: {
|
|
@@ -19234,7 +19366,7 @@ const workStartCommand = defineCommand({
|
|
|
19234
19366
|
},
|
|
19235
19367
|
json: {
|
|
19236
19368
|
type: "boolean",
|
|
19237
|
-
description: "Emit one JSON document: the whole work:status report plus a claim member {outcome, label?, reason?}. outcome is claimed (the flag was written), already-claimed (it was already on the object, nothing written), not-agent-repo (the default branch does not set agent.enabled, nothing written), refused (a live run or
|
|
19369
|
+
description: "Emit one JSON document: the whole work:status report plus a claim member {outcome, label?, reason?}. outcome is claimed (the flag was written), already-claimed (it was already on the object, nothing written), not-agent-repo (the default branch does not set agent.enabled, nothing written), refused (a live run or a queued agent trigger holds it; exit 1), or failed (a read or write could not be done; exit 1). refused and failed carry ok: false and an error member of kind runtime, and the report survives beside them."
|
|
19238
19370
|
},
|
|
19239
19371
|
verbose: {
|
|
19240
19372
|
type: "boolean",
|
|
@@ -19295,7 +19427,7 @@ const workStatusCommand = defineCommand({
|
|
|
19295
19427
|
},
|
|
19296
19428
|
json: {
|
|
19297
19429
|
type: "boolean",
|
|
19298
|
-
description: "Emit one JSON document: target, runLive, heldByHand, owner (agent, person or unclaimed; each null when not every label could be read), and six sections (object, docs, labels, feedback, findings, commits), each {state: ok} with its fields, {state: absent, reason} or {state: unavailable, reason}. The output is advice, not a gate: the feedback cutoff is the newest agent run or review comment on the pull request and is approximate, and review comments on diff lines are not in the thread this reads."
|
|
19430
|
+
description: "Emit one JSON document: target, runLive, heldByHand, heldBy (the hold label the report found, null when none or unread), owner (agent, person or unclaimed; each null when not every label could be read), and six sections (object, docs, labels, feedback, findings, commits), each {state: ok} with its fields, {state: absent, reason} or {state: unavailable, reason}. The output is advice, not a gate: the feedback cutoff is the newest agent run or review comment on the pull request and is approximate, and review comments on diff lines are not in the thread this reads."
|
|
19299
19431
|
},
|
|
19300
19432
|
verbose: {
|
|
19301
19433
|
type: "boolean",
|
|
@@ -19504,6 +19636,14 @@ z.object({
|
|
|
19504
19636
|
})
|
|
19505
19637
|
});
|
|
19506
19638
|
//#endregion
|
|
19639
|
+
//#region ../cli-kit/src/env-override.ts
|
|
19640
|
+
function envMsOverride(raw, productionMs) {
|
|
19641
|
+
if (raw === void 0) return productionMs;
|
|
19642
|
+
const parsed = Number(raw.trim());
|
|
19643
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0) return productionMs;
|
|
19644
|
+
return Math.min(parsed, productionMs);
|
|
19645
|
+
}
|
|
19646
|
+
//#endregion
|
|
19507
19647
|
//#region src/release/publish/version-merge.ts
|
|
19508
19648
|
function evaluateVersionPr(state) {
|
|
19509
19649
|
const label = `PR #${String(state.prNumber)}`;
|
|
@@ -20811,11 +20951,10 @@ const releaseAssetsCommand = defineCommand({
|
|
|
20811
20951
|
});
|
|
20812
20952
|
//#endregion
|
|
20813
20953
|
//#region src/lint-types/executor.ts
|
|
20814
|
-
const MAX_BUFFER = 67108864;
|
|
20815
20954
|
function runViaShim(args, cwd) {
|
|
20816
20955
|
const result = spawnViaShim("pnpm", args, {
|
|
20817
20956
|
cwd,
|
|
20818
|
-
maxBuffer:
|
|
20957
|
+
maxBuffer: EXEC_MAX_BUFFER,
|
|
20819
20958
|
encoding: "utf-8",
|
|
20820
20959
|
stdio: [
|
|
20821
20960
|
"ignore",
|
|
@@ -20837,34 +20976,17 @@ function runViaShim(args, cwd) {
|
|
|
20837
20976
|
}
|
|
20838
20977
|
function createRealLintTypesExecutor() {
|
|
20839
20978
|
return { run(args, cwd) {
|
|
20840
|
-
|
|
20841
|
-
|
|
20842
|
-
|
|
20843
|
-
|
|
20844
|
-
|
|
20845
|
-
|
|
20846
|
-
|
|
20847
|
-
|
|
20848
|
-
|
|
20849
|
-
|
|
20850
|
-
|
|
20851
|
-
}),
|
|
20852
|
-
stderr: "",
|
|
20853
|
-
exitCode: 0
|
|
20854
|
-
};
|
|
20855
|
-
} catch (err) {
|
|
20856
|
-
if (isExecSyncError(err)) return {
|
|
20857
|
-
stdout: err.stdout,
|
|
20858
|
-
stderr: err.stderr,
|
|
20859
|
-
exitCode: err.status
|
|
20860
|
-
};
|
|
20861
|
-
if (shouldRetryViaShim(err)) return runViaShim(args, cwd);
|
|
20862
|
-
return {
|
|
20863
|
-
stdout: "",
|
|
20864
|
-
stderr: describeError$1(err),
|
|
20865
|
-
exitCode: 1
|
|
20866
|
-
};
|
|
20867
|
-
}
|
|
20979
|
+
const result = execCapture$2("pnpm", args, {
|
|
20980
|
+
cwd,
|
|
20981
|
+
stdin: "ignore",
|
|
20982
|
+
keepPartialStdoutOnKill: false
|
|
20983
|
+
});
|
|
20984
|
+
if (result.error !== void 0 && shouldRetryViaShim(result.error)) return runViaShim(args, cwd);
|
|
20985
|
+
return {
|
|
20986
|
+
stdout: result.stdout,
|
|
20987
|
+
stderr: result.stderr,
|
|
20988
|
+
exitCode: result.status
|
|
20989
|
+
};
|
|
20868
20990
|
} };
|
|
20869
20991
|
}
|
|
20870
20992
|
//#endregion
|
|
@@ -21444,6 +21566,73 @@ function composePsDump(executor, config) {
|
|
|
21444
21566
|
if (!result.stdout.trim() && !result.stderr.trim()) executor.log("(no ps output)");
|
|
21445
21567
|
} catch (_error) {}
|
|
21446
21568
|
}
|
|
21569
|
+
const HealthStateSchema = z.object({
|
|
21570
|
+
Status: z.string(),
|
|
21571
|
+
FailingStreak: z.number(),
|
|
21572
|
+
Log: z.array(z.object({
|
|
21573
|
+
Start: z.string(),
|
|
21574
|
+
ExitCode: z.number(),
|
|
21575
|
+
Output: z.string()
|
|
21576
|
+
})).nullable().transform((log) => log ?? [])
|
|
21577
|
+
});
|
|
21578
|
+
const HEALTH_INSPECT_FORMAT = "{{json .State.Health}}";
|
|
21579
|
+
function parseHealthState(stdout) {
|
|
21580
|
+
let raw;
|
|
21581
|
+
try {
|
|
21582
|
+
raw = JSON.parse(stdout);
|
|
21583
|
+
} catch (_error) {
|
|
21584
|
+
return;
|
|
21585
|
+
}
|
|
21586
|
+
const parsed = HealthStateSchema.safeParse(raw);
|
|
21587
|
+
return parsed.success ? parsed.data : void 0;
|
|
21588
|
+
}
|
|
21589
|
+
function printServiceHealthLog(executor, config, service, id) {
|
|
21590
|
+
executor.log(`-- ${service} health log --`);
|
|
21591
|
+
try {
|
|
21592
|
+
if (!id) {
|
|
21593
|
+
executor.log("(health log unavailable: compose reported no container id)");
|
|
21594
|
+
return;
|
|
21595
|
+
}
|
|
21596
|
+
const result = executor.exec("docker", [
|
|
21597
|
+
"inspect",
|
|
21598
|
+
"--format",
|
|
21599
|
+
HEALTH_INSPECT_FORMAT,
|
|
21600
|
+
id
|
|
21601
|
+
], {
|
|
21602
|
+
cwd: config.cwd,
|
|
21603
|
+
env: config.env
|
|
21604
|
+
});
|
|
21605
|
+
const health = parseHealthState(result.stdout);
|
|
21606
|
+
if (result.exitCode !== 0 || !health) {
|
|
21607
|
+
executor.log("(health log unavailable)");
|
|
21608
|
+
if (result.stderr.trim()) executor.logError(result.stderr);
|
|
21609
|
+
return;
|
|
21610
|
+
}
|
|
21611
|
+
executor.log(`status ${health.Status}, failing streak ${String(health.FailingStreak)}`);
|
|
21612
|
+
if (health.Log.length === 0) {
|
|
21613
|
+
executor.log("(no health checks have run yet)");
|
|
21614
|
+
return;
|
|
21615
|
+
}
|
|
21616
|
+
for (const entry of health.Log) {
|
|
21617
|
+
executor.log(`[exit ${String(entry.ExitCode)}] ${entry.Start}`);
|
|
21618
|
+
const output = entry.Output.trimEnd();
|
|
21619
|
+
executor.log(output.length > 0 ? output : "(no output)");
|
|
21620
|
+
}
|
|
21621
|
+
} catch (_error) {
|
|
21622
|
+
executor.log("(health log unavailable)");
|
|
21623
|
+
}
|
|
21624
|
+
}
|
|
21625
|
+
function composeHealthLogs(executor, config) {
|
|
21626
|
+
try {
|
|
21627
|
+
const containers = composePs(executor, config);
|
|
21628
|
+
for (const service of config.services) {
|
|
21629
|
+
const container = containers.find((c) => c.Service === service);
|
|
21630
|
+
if (!container) continue;
|
|
21631
|
+
if (container.Health !== "unhealthy" && container.Health !== "starting") continue;
|
|
21632
|
+
printServiceHealthLog(executor, config, service, container.ID);
|
|
21633
|
+
}
|
|
21634
|
+
} catch (_error) {}
|
|
21635
|
+
}
|
|
21447
21636
|
function composePs(executor, config) {
|
|
21448
21637
|
const output = executor.exec("docker", [
|
|
21449
21638
|
...composeArgs(config),
|
|
@@ -21622,6 +21811,7 @@ async function runDockerCheck(executor, rawConfig) {
|
|
|
21622
21811
|
executor.logError(`Compose stack failed to start -- dumping logs`);
|
|
21623
21812
|
composePsDump(executor, compose);
|
|
21624
21813
|
for (const service of compose.services) composeLogs(executor, compose, service);
|
|
21814
|
+
composeHealthLogs(executor, compose);
|
|
21625
21815
|
cleanup();
|
|
21626
21816
|
return {
|
|
21627
21817
|
success: false,
|
|
@@ -21647,6 +21837,7 @@ async function runDockerCheck(executor, rawConfig) {
|
|
|
21647
21837
|
executor.logError(`Container ${service} is unhealthy`);
|
|
21648
21838
|
composePsDump(executor, compose);
|
|
21649
21839
|
composeLogs(executor, compose, service);
|
|
21840
|
+
composeHealthLogs(executor, compose);
|
|
21650
21841
|
cleanup();
|
|
21651
21842
|
return {
|
|
21652
21843
|
success: false,
|
|
@@ -21700,6 +21891,7 @@ async function runDockerCheck(executor, rawConfig) {
|
|
|
21700
21891
|
executor.logError("Timeout waiting for stack to become healthy");
|
|
21701
21892
|
composePsDump(executor, compose);
|
|
21702
21893
|
for (const service of compose.services) composeLogs(executor, compose, service);
|
|
21894
|
+
composeHealthLogs(executor, compose);
|
|
21703
21895
|
cleanup();
|
|
21704
21896
|
return {
|
|
21705
21897
|
success: false,
|
|
@@ -22855,47 +23047,17 @@ function deriveRecord(summary, options) {
|
|
|
22855
23047
|
//#region src/coverage-tracking/executor.ts
|
|
22856
23048
|
function createRealCoverageExecutor() {
|
|
22857
23049
|
return { exec(file, args, options) {
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
"pipe",
|
|
22870
|
-
"pipe",
|
|
22871
|
-
"pipe"
|
|
22872
|
-
],
|
|
22873
|
-
maxBuffer: 67108864
|
|
22874
|
-
}),
|
|
22875
|
-
stderr: "",
|
|
22876
|
-
exitCode: 0
|
|
22877
|
-
};
|
|
22878
|
-
} catch (err) {
|
|
22879
|
-
if (isExecSyncError(err)) return {
|
|
22880
|
-
stdout: err.stdout,
|
|
22881
|
-
stderr: err.stderr,
|
|
22882
|
-
exitCode: err.status
|
|
22883
|
-
};
|
|
22884
|
-
if (isKilledExecError(err)) {
|
|
22885
|
-
const detail = describeError$1(err);
|
|
22886
|
-
const stderr = err.stderr.trim() === "" ? detail : `${err.stderr}\n${detail}`;
|
|
22887
|
-
return {
|
|
22888
|
-
stdout: err.stdout,
|
|
22889
|
-
stderr,
|
|
22890
|
-
exitCode: 1
|
|
22891
|
-
};
|
|
22892
|
-
}
|
|
22893
|
-
return {
|
|
22894
|
-
stdout: "",
|
|
22895
|
-
stderr: describeError$1(err),
|
|
22896
|
-
exitCode: 1
|
|
22897
|
-
};
|
|
22898
|
-
}
|
|
23050
|
+
const result = execCapture$2(file, args, {
|
|
23051
|
+
cwd: options?.cwd,
|
|
23052
|
+
env: options?.env,
|
|
23053
|
+
input: options?.input,
|
|
23054
|
+
keepPartialStdoutOnKill: true
|
|
23055
|
+
});
|
|
23056
|
+
return {
|
|
23057
|
+
stdout: result.stdout,
|
|
23058
|
+
stderr: result.stderr,
|
|
23059
|
+
exitCode: result.status
|
|
23060
|
+
};
|
|
22899
23061
|
} };
|
|
22900
23062
|
}
|
|
22901
23063
|
//#endregion
|
|
@@ -24721,6 +24883,7 @@ function handleMissingBaseline(state, updateBaseline, failOnMissingBaseline) {
|
|
|
24721
24883
|
metrics: current,
|
|
24722
24884
|
sources: details.sources
|
|
24723
24885
|
});
|
|
24886
|
+
reportCarriedRaises(state.referenceFields.raises, out);
|
|
24724
24887
|
process.exitCode = 1;
|
|
24725
24888
|
return;
|
|
24726
24889
|
}
|
|
@@ -24732,6 +24895,7 @@ function handleMissingBaseline(state, updateBaseline, failOnMissingBaseline) {
|
|
|
24732
24895
|
metrics: current,
|
|
24733
24896
|
sources: details.sources
|
|
24734
24897
|
});
|
|
24898
|
+
reportCarriedRaises(state.referenceFields.raises, out);
|
|
24735
24899
|
return;
|
|
24736
24900
|
}
|
|
24737
24901
|
const message = `${BASELINE_FILE} not found. Run with --update-baseline to create one from the current run.`;
|
|
@@ -24743,8 +24907,10 @@ function handleMissingBaseline(state, updateBaseline, failOnMissingBaseline) {
|
|
|
24743
24907
|
metrics: current,
|
|
24744
24908
|
sources: details.sources
|
|
24745
24909
|
});
|
|
24910
|
+
reportCarriedRaises(state.referenceFields.raises, out);
|
|
24746
24911
|
return;
|
|
24747
24912
|
}
|
|
24913
|
+
reportCarriedRaises(state.referenceFields.raises, out);
|
|
24748
24914
|
throw new FatalError(message);
|
|
24749
24915
|
}
|
|
24750
24916
|
function applyBaselineUpdate(state, baseline, reset) {
|
|
@@ -25848,12 +26014,6 @@ const BranchEntrySchema = z.object({
|
|
|
25848
26014
|
});
|
|
25849
26015
|
const BRANCHES_PAGE_SIZE = 50;
|
|
25850
26016
|
const DEFAULT_MAX_PAGES = 20;
|
|
25851
|
-
function repoBase(conn) {
|
|
25852
|
-
return `${conn.serverUrl}/api/v1/repos/${conn.repository}`;
|
|
25853
|
-
}
|
|
25854
|
-
function authHeaders(conn) {
|
|
25855
|
-
return { Authorization: `token ${conn.token}` };
|
|
25856
|
-
}
|
|
25857
26017
|
async function listBranches(executor, conn, options = {}) {
|
|
25858
26018
|
const signal = options.signal;
|
|
25859
26019
|
const maxPages = options.maxPages ?? DEFAULT_MAX_PAGES;
|
|
@@ -29389,7 +29549,7 @@ async function runCli(config) {
|
|
|
29389
29549
|
//#region src/cli-main.ts
|
|
29390
29550
|
setLogLevel(resolveLogLevel({}));
|
|
29391
29551
|
setForgejoLogger(log$1);
|
|
29392
|
-
const displayVersion = "0.
|
|
29552
|
+
const displayVersion = "0.98.0";
|
|
29393
29553
|
const bstSubCommands = {
|
|
29394
29554
|
"repo:sync": syncCommand,
|
|
29395
29555
|
"checks:run": runChecksCommand,
|