@bensandee/tooling 0.104.0 → 0.106.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 +87 -26
- package/bin/bst.mjs +12 -3
- package/dist/bin.mjs +1318 -347
- package/package.json +4 -4
- package/tooling.schema.json +50 -9
package/dist/bin.mjs
CHANGED
|
@@ -173,7 +173,7 @@ function loadEnvFileForBin(rawArgs, bin, io = processIo) {
|
|
|
173
173
|
// src/env-file-preload.ts
|
|
174
174
|
const envFileLoad = loadEnvFileForBin(process.argv.slice(2), {
|
|
175
175
|
name: "bst",
|
|
176
|
-
version: "0.
|
|
176
|
+
version: "0.106.0"
|
|
177
177
|
});
|
|
178
178
|
// ../cli-kit/src/logger.ts
|
|
179
179
|
const RANK = {
|
|
@@ -846,7 +846,6 @@ const TolerantDockerCheckConfigSchema = z.object({
|
|
|
846
846
|
});
|
|
847
847
|
const DEFAULT_BRANCH_NAME_PATTERN = /^(?!refs\/)(?!.*\/\/)(?!.*\.\.)(?!.*\/$)(?!.*\.lock$)[A-Za-z0-9][A-Za-z0-9._/-]*$/;
|
|
848
848
|
const DefaultBranchNameSchema = z.string().regex(DEFAULT_BRANCH_NAME_PATTERN, "must be a plain branch name: ASCII letters, digits, '.', '_', '-' and '/', starting with a letter or digit, with no leading 'refs/', no '//', '..', trailing '/', or '.lock' suffix");
|
|
849
|
-
const TrustedRunnerLabelSchema = z.string().regex(/^(?!ubuntu-latest$)[A-Za-z0-9][A-Za-z0-9._-]*$/, "must be a plain runner label: ASCII letters, digits, '.', '_' and '-', starting with a letter or digit, non-empty, and not 'ubuntu-latest' (the shared label this setting moves work off)");
|
|
850
849
|
const AgentEnabledSliceSchema = z.looseObject({ agent: z.looseObject({ enabled: z.boolean().optional() }).optional() });
|
|
851
850
|
function agentEnabledIn(raw) {
|
|
852
851
|
try {
|
|
@@ -1644,15 +1643,23 @@ function resolveDocsConfig(targetDir) {
|
|
|
1644
1643
|
}
|
|
1645
1644
|
// src/utils/tooling-config.ts
|
|
1646
1645
|
const CONFIG_FILE = ".tooling.json";
|
|
1647
|
-
const ReleaseAssetSchema = z.strictObject({
|
|
1646
|
+
const ReleaseAssetSchema$1 = z.strictObject({
|
|
1648
1647
|
command: z.array(z.string()).nonempty().optional().meta({ description: "argv passed directly to the child process (no shell interpolation), e.g. [\"pnpm\",\"build\"]" }),
|
|
1649
|
-
file: z.string().meta({ description: "Path to the asset file to upload, relative to the project root" }),
|
|
1650
|
-
|
|
1648
|
+
file: z.string().optional().meta({ description: "Path to the single asset file to upload, relative to the project root. Exactly one of file and files" }),
|
|
1649
|
+
files: z.array(z.string()).nonempty().optional().meta({ description: "Glob patterns; every match is uploaded under its basename, after the entry's build runs. Exactly one of file and files" }),
|
|
1650
|
+
name: z.string().optional().meta({ description: "Asset name in the release (defaults to the file's basename; file only)" }),
|
|
1651
|
+
package: z.string().optional().meta({ description: "Workspace package this asset belongs to: the build, its version stamp and its uploads run once per release of that package. In a monorepo, a releaseAssets entry must name one" })
|
|
1651
1652
|
});
|
|
1652
1653
|
const VersionStampSchema = z.strictObject({
|
|
1653
1654
|
file: z.string().meta({ description: "Path to the file whose version line release:assets stamps, relative to the project root" }),
|
|
1654
1655
|
prefix: z.string().min(1).meta({ description: "Literal string (never a pattern) the target line must start with. Not a regex -- read the output line straight off prefix + version + suffix" }),
|
|
1655
|
-
suffix: z.string().optional().meta({ description: "Literal string (never a pattern) the target line must end with (default: none)" })
|
|
1656
|
+
suffix: z.string().optional().meta({ description: "Literal string (never a pattern) the target line must end with (default: none)" }),
|
|
1657
|
+
package: z.string().optional().meta({ description: "Workspace package whose release version this stamp carries; the stamp runs with each release of that package. Omitted: the root package's version, as before" })
|
|
1658
|
+
});
|
|
1659
|
+
const SnapshotConfigSchema = z.strictObject({
|
|
1660
|
+
preid: z.string().regex(/^[a-z][a-z0-9]*$/).meta({ description: "Prerelease identifier the snapshot versions carry, e.g. `alpha` in `1.2.6-alpha.42`" }),
|
|
1661
|
+
keep: z.number().int().min(1).optional().meta({ description: "How many snapshot releases to keep per package before the oldest are pruned (default: 3)" }),
|
|
1662
|
+
packages: z.array(z.string()).nonempty().optional().meta({ description: "Workspace package names to snapshot. Required in a monorepo; in a single-package repo the root package is the default" })
|
|
1656
1663
|
});
|
|
1657
1664
|
const DeployConfigSchema = z.strictObject({
|
|
1658
1665
|
dispatchRepo: z.string().meta({ description: "Target repository (owner/repo) whose workflow the release dispatches to trigger a deploy" }),
|
|
@@ -1744,7 +1751,8 @@ const AgentConfigSchema = z.strictObject({
|
|
|
1744
1751
|
egress: AgentEgressConfigSchema.optional().meta({ description: "Extra egress hosts this repo's agent containers ask to reach -- a request the deployment grants, not an opening of a host. `browseHosts` joins the agent's browse lane (GET and HEAD only) on top of the hosts every run needs; the passthrough lane stays agent-owned. Each entry is a host pattern -- an exact host or a *.host wildcard, never a port. Read from the repo's DEFAULT BRANCH, never off a pull request's own tree, so a run can never widen its own egress: under the default `auto` grant mode the request takes effect on the first container started after a human merges it, and under `approve` it waits for an admin's grant for this repo. A host the product or the deployment known-denies is never opened, whatever the declaration or the verdict says. An entry whose pattern the agent cannot parse refuses the run rather than being dropped. Changing this block holds the pull request from automerge." }),
|
|
1745
1752
|
findingHolds: FindingHoldsConfigSchema.optional().meta({ description: "Which of a pull request's linked open findings withhold its unattended merge. `rules` is ordered and the first `when` that matches decides; no match falls through to `default`; an absent block is { rules: [], default: true }, so every open linked finding holds by default. Read off the repo's DEFAULT BRANCH, never off the pull request's own tree -- a pull request cannot edit the rule deciding whether it is held. In a `mentions` entry a /.../flags pattern is a regular expression, a literal:<text> pattern is the substring <text> (how to name a path such as /src/utils), and anything else is a case-insensitive substring." }),
|
|
1746
1753
|
chatIssueRepos: z.array(z.string().regex(REPO_FULL_NAME)).optional().meta({ description: "Repositories with a DIFFERENT owner that a control-panel chat from this repository may file an issue in, each one a full `owner/name`, never a wildcard. A repository with the same owner needs no entry, and an entry grants nothing on its own: the target must have enabled the agent too. Read from the repo's DEFAULT BRANCH at the moment a card is applied, so a pull request cannot widen the reach of its own chat. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." }),
|
|
1747
|
-
ciOnlySteps: z.array(z.string().regex(/^[\w:*?.\-[\]{}!,]+$/)).optional().meta({ description: "Step names or globs in `checks:run --skip` syntax that agent runs leave to CI, for example [\"docker:check\"]. Separate from `checks.skip`, which drops a step in CI too: here CI still runs the step and its status still gates the merge. Read from the repo's DEFAULT BRANCH only, never off the pull request's own tree, so a pull request cannot widen its own skip list. The agent merges such a pull request only on green CI, because the gate no longer measures these steps. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." })
|
|
1754
|
+
ciOnlySteps: z.array(z.string().regex(/^[\w:*?.\-[\]{}!,]+$/)).optional().meta({ description: "Step names or globs in `checks:run --skip` syntax that agent runs leave to CI, for example [\"docker:check\"]. Separate from `checks.skip`, which drops a step in CI too: here CI still runs the step and its status still gates the merge. Read from the repo's DEFAULT BRANCH only, never off the pull request's own tree, so a pull request cannot widen its own skip list. The agent merges such a pull request only on green CI, because the gate no longer measures these steps. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." }),
|
|
1755
|
+
localVerify: z.boolean().optional().meta({ description: "Keep an agent run's check gate in the agent's own sandboxed verify container instead of measuring it on this repo's forge CI. `true` is the local verify; leaving the key out is the other answer, so the agent waits for the CI run of the commit it pushed and reads its `checks:run` job log, falling back to the local verify whenever CI cannot stand in. Read from the repo's DEFAULT BRANCH only, never off the pull request's own tree, so a pull request cannot choose the gate that measures it. Like every other `agent.*` key, this has no effect unless `agent.enabled` is true." })
|
|
1748
1756
|
});
|
|
1749
1757
|
const TolerantAgentConfigSchema = z.object({
|
|
1750
1758
|
...AgentConfigSchema.shape,
|
|
@@ -1790,8 +1798,9 @@ const ToolingConfigSchema = z.strictObject({
|
|
|
1790
1798
|
dockerCheck: z.union([z.literal(false), DockerCheckConfigSchema]).optional().meta({ description: "Docker health check configuration or false to disable" }),
|
|
1791
1799
|
registryHost: z.string().optional().meta({ description: "Docker registry hostname (e.g. ghcr.io, code.example.com)" }),
|
|
1792
1800
|
registryNamespace: z.string().optional().meta({ description: "Docker registry namespace (e.g. ghcr.io/myorg, code.example.com/myorg)" }),
|
|
1793
|
-
releaseAssets: z.array(ReleaseAssetSchema).optional().meta({ description: "Custom assets to build and upload to the release" }),
|
|
1801
|
+
releaseAssets: z.array(ReleaseAssetSchema$1).optional().meta({ description: "Custom assets to build and upload to the release" }),
|
|
1794
1802
|
versionStamp: z.array(VersionStampSchema).optional().meta({ description: "Files release:assets stamps with the release version before building assets, and verifies afterward. For a repo whose released artifact carries its version somewhere other than package.json (e.g. a WordPress theme's style.css Version: header). Fails loudly when a file's prefix/suffix does not match exactly one line." }),
|
|
1803
|
+
snapshot: SnapshotConfigSchema.optional().meta({ description: "Snapshot channel: a push to the default branch that cuts no real release gets a prerelease <version>-<preid>.<build> per listed package, built with the release-assets machinery and uploaded as a prerelease, pruning all but the newest `keep` per package." }),
|
|
1795
1804
|
postReleaseHook: z.string().optional().meta({ description: "Override the post-release hook command (default: POST to POST_RELEASE_HOOK_URL with HMAC-SHA256 auth)" }),
|
|
1796
1805
|
postReleaseHookSecrets: z.array(z.string()).optional().meta({ description: "Additional secret names to inject as env vars in the post-release hook step (e.g. ['WEBHOOK_SECRET'])" }),
|
|
1797
1806
|
coverage: z.union([z.literal(false), CoverageConfigSchema]).optional().meta({ description: "Coverage tracking configuration. Set to false to disable; omit for default-on (when a vitest config is present)." }),
|
|
@@ -1803,7 +1812,6 @@ const ToolingConfigSchema = z.strictObject({
|
|
|
1803
1812
|
deploy: DeployConfigSchema.optional().meta({ description: "Generate a deploy-dispatch step in the release workflow that triggers a workflow_dispatch event in another repo after a successful release. The resolved release token must have rights on `dispatchRepo`." }),
|
|
1804
1813
|
pnpmWorkspace: z.literal(false).optional().meta({ description: "Set to false to opt out of pnpm-workspace.yaml management (skips both generation and the repo:sync --check validation)." }),
|
|
1805
1814
|
defaultBranch: DefaultBranchNameSchema.optional().meta({ description: "Repository default branch name. Drives the generated CI `on.push` trigger and every default-branch gate in `ci.yml` and `release.yml`, the release path (`release:changesets`, the version PR, `release:trigger`) and `checks:run`'s coverage gate. Generated output uses 'main' when unset; `checks:run` still falls back to `origin/HEAD`. Must be a plain branch name: ASCII letters, digits, '.', '_', '-' and '/', with no leading 'refs/'." }),
|
|
1806
|
-
trustedRunner: TrustedRunnerLabelSchema.optional().meta({ description: "Self-hosted runner label for default-branch CI jobs: they run on this label while pull request jobs stay on 'ubuntu-latest'. Only a workflow edit moves a job, so the runner must be scoped so no other repository can name this label. A job aimed at a label no runner serves waits forever, so set this key only once the runner exists." }),
|
|
1807
1815
|
unmanagedDevDependencies: UnmanagedDevDependenciesSchema.optional().meta({ description: "devDependency names repo:sync must never add or re-pin. Escape hatch for holding a tooling-managed dep (oxlint, vitest, knip, ...) at a deliberately off-canonical version; without it, repo:sync raises any managed devDep whose version has drifted below the canonical pin." }),
|
|
1808
1816
|
stack: StackSchema.optional().meta({ description: "Whether the repo has TS/JS source. Detected from source evidence; TypeScript is never inferred from absence. Setting this key pins its value, even one that equals detection, and repo:sync keeps it until the key is deleted." }),
|
|
1809
1817
|
builder: z.enum([
|
|
@@ -1833,8 +1841,9 @@ const TolerantToolingConfigSchema = z.object({
|
|
|
1833
1841
|
lint: tolerantBlock(LintConfigSchema).optional(),
|
|
1834
1842
|
agent: TolerantAgentConfigSchema.optional(),
|
|
1835
1843
|
branchPrune: tolerantBlock(BranchPruneConfigSchema).optional(),
|
|
1836
|
-
releaseAssets: z.array(tolerantBlock(ReleaseAssetSchema)).optional(),
|
|
1844
|
+
releaseAssets: z.array(tolerantBlock(ReleaseAssetSchema$1)).optional(),
|
|
1837
1845
|
versionStamp: z.array(tolerantBlock(VersionStampSchema)).optional(),
|
|
1846
|
+
snapshot: tolerantBlock(SnapshotConfigSchema).optional(),
|
|
1838
1847
|
issues: tolerantBlock(IssuesConfigSchema).optional(),
|
|
1839
1848
|
egress: tolerantBlock(EgressConfigSchema).optional()
|
|
1840
1849
|
});
|
|
@@ -3149,6 +3158,22 @@ function createRealExecutor$1(logger = rootLogger) {
|
|
|
3149
3158
|
return [];
|
|
3150
3159
|
}
|
|
3151
3160
|
},
|
|
3161
|
+
globFiles(cwd, patterns) {
|
|
3162
|
+
const found = /* @__PURE__ */ new Set();
|
|
3163
|
+
for (const pattern of patterns) {
|
|
3164
|
+
let matches;
|
|
3165
|
+
try {
|
|
3166
|
+
matches = globSync(pattern, {
|
|
3167
|
+
cwd,
|
|
3168
|
+
withFileTypes: true
|
|
3169
|
+
});
|
|
3170
|
+
} catch {
|
|
3171
|
+
continue;
|
|
3172
|
+
}
|
|
3173
|
+
for (const entry of matches) if (entry.isFile()) found.add(path.join(entry.parentPath, entry.name));
|
|
3174
|
+
}
|
|
3175
|
+
return [...found];
|
|
3176
|
+
},
|
|
3152
3177
|
readFile(filePath) {
|
|
3153
3178
|
try {
|
|
3154
3179
|
return readFileSync(filePath, "utf-8");
|
|
@@ -3268,14 +3293,14 @@ function parseReleaseVersion(version) {
|
|
|
3268
3293
|
prerelease: match[4] === void 0 ? [] : match[4].split(".")
|
|
3269
3294
|
};
|
|
3270
3295
|
}
|
|
3271
|
-
function isPrerelease(version) {
|
|
3296
|
+
function isPrerelease$1(version) {
|
|
3272
3297
|
return (parseReleaseVersion(version)?.prerelease.length ?? 0) > 0;
|
|
3273
3298
|
}
|
|
3274
3299
|
const TRAILING_TAG_VERSION = /(?:^|[^\d.])(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?:\+[0-9A-Za-z.-]+)?$/u;
|
|
3275
3300
|
function tagIsPrerelease(tag) {
|
|
3276
3301
|
const version = TRAILING_TAG_VERSION.exec(tag)?.[1];
|
|
3277
3302
|
if (version === void 0) return false;
|
|
3278
|
-
return isPrerelease(version);
|
|
3303
|
+
return isPrerelease$1(version);
|
|
3279
3304
|
}
|
|
3280
3305
|
function comparePrereleaseIdentifier(a, b) {
|
|
3281
3306
|
const aNumeric = /^\d+$/.test(a);
|
|
@@ -3353,7 +3378,7 @@ function highestVersionAtSha(family, remote, sha) {
|
|
|
3353
3378
|
function planFloatingTagMoves(family, version, remote) {
|
|
3354
3379
|
const targetSha = remote.get(family.exact(version))?.commit;
|
|
3355
3380
|
const planned = [];
|
|
3356
|
-
if (isPrerelease(version)) {
|
|
3381
|
+
if (isPrerelease$1(version)) {
|
|
3357
3382
|
for (const tag of family.floating(version)) {
|
|
3358
3383
|
const observed = remote.get(tag);
|
|
3359
3384
|
planned.push({
|
|
@@ -4194,7 +4219,7 @@ function runDockerBuild(executor, config) {
|
|
|
4194
4219
|
}
|
|
4195
4220
|
function tagAndPushPackage(executor, config, pkg, outcome) {
|
|
4196
4221
|
const version = pkg.version ?? "";
|
|
4197
|
-
const prerelease = isPrerelease(version);
|
|
4222
|
+
const prerelease = isPrerelease$1(version);
|
|
4198
4223
|
const tags = generateTags(version);
|
|
4199
4224
|
const exactTag = exactImageTag(version);
|
|
4200
4225
|
const exactRef = imageRef(config.registryNamespace, pkg.imageName, exactTag);
|
|
@@ -4477,7 +4502,7 @@ function createDockerDiscoveryMemo() {
|
|
|
4477
4502
|
}
|
|
4478
4503
|
return { detect };
|
|
4479
4504
|
}
|
|
4480
|
-
// src/generators/docker-reader.ts
|
|
4505
|
+
// src/generators/ci/docker-reader.ts
|
|
4481
4506
|
const perContextMemos = /* @__PURE__ */ new WeakMap();
|
|
4482
4507
|
function memoFor(ctx) {
|
|
4483
4508
|
if (ctx.dockerDiscovery !== void 0) return ctx.dockerDiscovery;
|
|
@@ -4780,6 +4805,11 @@ function preservePinnedActions(generated, existing, owned = []) {
|
|
|
4780
4805
|
}
|
|
4781
4806
|
return result;
|
|
4782
4807
|
}
|
|
4808
|
+
const SHARED_RUNNER_EXPR = "vars.BST_RUNNER || 'ubuntu-latest'";
|
|
4809
|
+
const TRUSTED_RUNNER_EXPR = "vars.BST_TRUSTED_RUNNER || vars.BST_RUNNER || 'ubuntu-latest'";
|
|
4810
|
+
function runnerExpr(expr) {
|
|
4811
|
+
return `\${{ ${expr} }}`;
|
|
4812
|
+
}
|
|
4783
4813
|
function buildWorkflowYaml(options) {
|
|
4784
4814
|
const doc = { name: options.name };
|
|
4785
4815
|
if (options.enableEmailNotifications) doc["enable-email-notifications"] = true;
|
|
@@ -4788,7 +4818,7 @@ function buildWorkflowYaml(options) {
|
|
|
4788
4818
|
if (options.concurrency) doc["concurrency"] = options.concurrency;
|
|
4789
4819
|
const jobs = { [options.jobName]: {
|
|
4790
4820
|
...options.jobIf && { if: options.jobIf },
|
|
4791
|
-
"runs-on": options.runsOn ?? "ubuntu-latest",
|
|
4821
|
+
"runs-on": options.runsOn ?? runnerExpr("vars.BST_RUNNER || 'ubuntu-latest'"),
|
|
4792
4822
|
...options.jobEnv && { env: options.jobEnv },
|
|
4793
4823
|
...options.jobOutputs && { outputs: options.jobOutputs },
|
|
4794
4824
|
steps: options.steps.map((s) => s.step)
|
|
@@ -4797,8 +4827,9 @@ function buildWorkflowYaml(options) {
|
|
|
4797
4827
|
...def.needs && { needs: def.needs },
|
|
4798
4828
|
...def.if && { if: def.if },
|
|
4799
4829
|
...def["continue-on-error"] && { "continue-on-error": true },
|
|
4800
|
-
"runs-on": def.runsOn ?? "ubuntu-latest",
|
|
4830
|
+
"runs-on": def.runsOn ?? runnerExpr("vars.BST_RUNNER || 'ubuntu-latest'"),
|
|
4801
4831
|
...def.env && { env: def.env },
|
|
4832
|
+
...def.outputs && { outputs: def.outputs },
|
|
4802
4833
|
steps: def.steps.map((s) => s.step)
|
|
4803
4834
|
};
|
|
4804
4835
|
doc["jobs"] = jobs;
|
|
@@ -4809,12 +4840,12 @@ function buildWorkflowYaml(options) {
|
|
|
4809
4840
|
return ensureSchemaComment(WORKFLOW_MANAGED_HEADER + "\n" + readable, options.ci);
|
|
4810
4841
|
}
|
|
4811
4842
|
// src/generators/mise-pin.ts
|
|
4812
|
-
const MISE_VERSION = "2026.10.
|
|
4813
|
-
const MISE_LINUX_X64_SHA256 = "
|
|
4843
|
+
const MISE_VERSION = "2026.10.25";
|
|
4844
|
+
const MISE_LINUX_X64_SHA256 = "5d362ecc578dc7c146679b841dda949d6472cbf86ff5635db7afdca1b6b3fd87";
|
|
4814
4845
|
const SETUP_MISE_ACTION_URL = "https://code.orangebikelabs.com/bensandee/common/actions/setup-mise";
|
|
4815
4846
|
const SETUP_MISE_ACTION_TAG = "setup-mise@latest";
|
|
4816
4847
|
const SETUP_MISE_ACTION_SHA = "ebe622ef0d24c7efec4a5f6093ddb18500900e24";
|
|
4817
|
-
// src/generators/ci-utils.ts
|
|
4848
|
+
// src/generators/ci/ci-utils.ts
|
|
4818
4849
|
function actionsExpr(expr) {
|
|
4819
4850
|
return `\${{ ${expr} }}`;
|
|
4820
4851
|
}
|
|
@@ -4822,10 +4853,6 @@ function branchNameLiteral(name) {
|
|
|
4822
4853
|
if (DEFAULT_BRANCH_NAME_PATTERN.test(name)) return name;
|
|
4823
4854
|
return name.replace(/'/g, "''");
|
|
4824
4855
|
}
|
|
4825
|
-
const TrustedRunnerSliceSchema = z.object({ trustedRunner: TrustedRunnerLabelSchema.optional() });
|
|
4826
|
-
function configuredTrustedRunner(raw) {
|
|
4827
|
-
return parseToolingConfigSlice(raw, TrustedRunnerSliceSchema, { block: "trustedRunner" })?.trustedRunner;
|
|
4828
|
-
}
|
|
4829
4856
|
function isDefaultBranch(name) {
|
|
4830
4857
|
return `github.ref == 'refs/heads/${branchNameLiteral(name)}'`;
|
|
4831
4858
|
}
|
|
@@ -4962,7 +4989,7 @@ function retireManagedWorkflow(ctx, workflowPath, reason) {
|
|
|
4962
4989
|
description
|
|
4963
4990
|
};
|
|
4964
4991
|
}
|
|
4965
|
-
// src/generators/publish-ci.ts
|
|
4992
|
+
// src/generators/ci/publish-ci.ts
|
|
4966
4993
|
const RegistryHostSchema = z.object({ registryHost: z.string().optional() });
|
|
4967
4994
|
function resolveGenTimeHost(ctx) {
|
|
4968
4995
|
const toolingRaw = ctx.read(".tooling.json");
|
|
@@ -4992,7 +5019,7 @@ const PostReleaseHookSchema = z.object({
|
|
|
4992
5019
|
postReleaseHook: z.string().optional(),
|
|
4993
5020
|
postReleaseHookSecrets: z.array(z.string()).optional()
|
|
4994
5021
|
});
|
|
4995
|
-
const ReleaseAssetsSchema = z.object({ releaseAssets: z.array(ReleaseAssetSchema).optional() });
|
|
5022
|
+
const ReleaseAssetsSchema = z.object({ releaseAssets: z.array(ReleaseAssetSchema$1).optional() });
|
|
4996
5023
|
const VersionStampConfigSchema = z.object({ versionStamp: z.array(VersionStampSchema).optional() });
|
|
4997
5024
|
const DeploySchema = z.object({ deploy: DeployConfigSchema.optional() });
|
|
4998
5025
|
function getDeployConfig(ctx) {
|
|
@@ -5381,18 +5408,18 @@ function perPackageDevDeps(config) {
|
|
|
5381
5408
|
"@types/node": "24.19.2",
|
|
5382
5409
|
"@vitest/coverage-v8": "5.0.5",
|
|
5383
5410
|
"commit-and-tag-version": "13.3.0",
|
|
5384
|
-
"knip": "6.
|
|
5411
|
+
"knip": "6.44.0",
|
|
5385
5412
|
"lefthook": "2.2.2",
|
|
5386
|
-
"modern-web-guidance": "0.0.
|
|
5387
|
-
"oxfmt": "0.
|
|
5388
|
-
"oxlint": "1.
|
|
5413
|
+
"modern-web-guidance": "0.0.196",
|
|
5414
|
+
"oxfmt": "0.75.0",
|
|
5415
|
+
"oxlint": "1.90.0",
|
|
5389
5416
|
"oxlint-tsgolint": "7.0.2005",
|
|
5390
5417
|
"prettier": "3.9.10",
|
|
5391
5418
|
"release-it": "21.1.1",
|
|
5392
|
-
"tsdown": "0.23.
|
|
5419
|
+
"tsdown": "0.23.4",
|
|
5393
5420
|
"typescript": "6.0.3",
|
|
5394
5421
|
"vitest": "5.0.5",
|
|
5395
|
-
"pnpm": "11.28.
|
|
5422
|
+
"pnpm": "11.28.9"
|
|
5396
5423
|
}["typescript"];
|
|
5397
5424
|
deps["@types/node"] = {
|
|
5398
5425
|
"@changesets/cli": "3.0.3",
|
|
@@ -5400,18 +5427,18 @@ function perPackageDevDeps(config) {
|
|
|
5400
5427
|
"@types/node": "24.19.2",
|
|
5401
5428
|
"@vitest/coverage-v8": "5.0.5",
|
|
5402
5429
|
"commit-and-tag-version": "13.3.0",
|
|
5403
|
-
"knip": "6.
|
|
5430
|
+
"knip": "6.44.0",
|
|
5404
5431
|
"lefthook": "2.2.2",
|
|
5405
|
-
"modern-web-guidance": "0.0.
|
|
5406
|
-
"oxfmt": "0.
|
|
5407
|
-
"oxlint": "1.
|
|
5432
|
+
"modern-web-guidance": "0.0.196",
|
|
5433
|
+
"oxfmt": "0.75.0",
|
|
5434
|
+
"oxlint": "1.90.0",
|
|
5408
5435
|
"oxlint-tsgolint": "7.0.2005",
|
|
5409
5436
|
"prettier": "3.9.10",
|
|
5410
5437
|
"release-it": "21.1.1",
|
|
5411
|
-
"tsdown": "0.23.
|
|
5438
|
+
"tsdown": "0.23.4",
|
|
5412
5439
|
"typescript": "6.0.3",
|
|
5413
5440
|
"vitest": "5.0.5",
|
|
5414
|
-
"pnpm": "11.28.
|
|
5441
|
+
"pnpm": "11.28.9"
|
|
5415
5442
|
}["@types/node"];
|
|
5416
5443
|
}
|
|
5417
5444
|
if (config.builder === "tsdown") deps["tsdown"] = {
|
|
@@ -5420,18 +5447,18 @@ function perPackageDevDeps(config) {
|
|
|
5420
5447
|
"@types/node": "24.19.2",
|
|
5421
5448
|
"@vitest/coverage-v8": "5.0.5",
|
|
5422
5449
|
"commit-and-tag-version": "13.3.0",
|
|
5423
|
-
"knip": "6.
|
|
5450
|
+
"knip": "6.44.0",
|
|
5424
5451
|
"lefthook": "2.2.2",
|
|
5425
|
-
"modern-web-guidance": "0.0.
|
|
5426
|
-
"oxfmt": "0.
|
|
5427
|
-
"oxlint": "1.
|
|
5452
|
+
"modern-web-guidance": "0.0.196",
|
|
5453
|
+
"oxfmt": "0.75.0",
|
|
5454
|
+
"oxlint": "1.90.0",
|
|
5428
5455
|
"oxlint-tsgolint": "7.0.2005",
|
|
5429
5456
|
"prettier": "3.9.10",
|
|
5430
5457
|
"release-it": "21.1.1",
|
|
5431
|
-
"tsdown": "0.23.
|
|
5458
|
+
"tsdown": "0.23.4",
|
|
5432
5459
|
"typescript": "6.0.3",
|
|
5433
5460
|
"vitest": "5.0.5",
|
|
5434
|
-
"pnpm": "11.28.
|
|
5461
|
+
"pnpm": "11.28.9"
|
|
5435
5462
|
}["tsdown"];
|
|
5436
5463
|
return deps;
|
|
5437
5464
|
}
|
|
@@ -5443,18 +5470,18 @@ function vitestDevDeps() {
|
|
|
5443
5470
|
"@types/node": "24.19.2",
|
|
5444
5471
|
"@vitest/coverage-v8": "5.0.5",
|
|
5445
5472
|
"commit-and-tag-version": "13.3.0",
|
|
5446
|
-
"knip": "6.
|
|
5473
|
+
"knip": "6.44.0",
|
|
5447
5474
|
"lefthook": "2.2.2",
|
|
5448
|
-
"modern-web-guidance": "0.0.
|
|
5449
|
-
"oxfmt": "0.
|
|
5450
|
-
"oxlint": "1.
|
|
5475
|
+
"modern-web-guidance": "0.0.196",
|
|
5476
|
+
"oxfmt": "0.75.0",
|
|
5477
|
+
"oxlint": "1.90.0",
|
|
5451
5478
|
"oxlint-tsgolint": "7.0.2005",
|
|
5452
5479
|
"prettier": "3.9.10",
|
|
5453
5480
|
"release-it": "21.1.1",
|
|
5454
|
-
"tsdown": "0.23.
|
|
5481
|
+
"tsdown": "0.23.4",
|
|
5455
5482
|
"typescript": "6.0.3",
|
|
5456
5483
|
"vitest": "5.0.5",
|
|
5457
|
-
"pnpm": "11.28.
|
|
5484
|
+
"pnpm": "11.28.9"
|
|
5458
5485
|
}["vitest"],
|
|
5459
5486
|
"@vitest/coverage-v8": {
|
|
5460
5487
|
"@changesets/cli": "3.0.3",
|
|
@@ -5462,18 +5489,18 @@ function vitestDevDeps() {
|
|
|
5462
5489
|
"@types/node": "24.19.2",
|
|
5463
5490
|
"@vitest/coverage-v8": "5.0.5",
|
|
5464
5491
|
"commit-and-tag-version": "13.3.0",
|
|
5465
|
-
"knip": "6.
|
|
5492
|
+
"knip": "6.44.0",
|
|
5466
5493
|
"lefthook": "2.2.2",
|
|
5467
|
-
"modern-web-guidance": "0.0.
|
|
5468
|
-
"oxfmt": "0.
|
|
5469
|
-
"oxlint": "1.
|
|
5494
|
+
"modern-web-guidance": "0.0.196",
|
|
5495
|
+
"oxfmt": "0.75.0",
|
|
5496
|
+
"oxlint": "1.90.0",
|
|
5470
5497
|
"oxlint-tsgolint": "7.0.2005",
|
|
5471
5498
|
"prettier": "3.9.10",
|
|
5472
5499
|
"release-it": "21.1.1",
|
|
5473
|
-
"tsdown": "0.23.
|
|
5500
|
+
"tsdown": "0.23.4",
|
|
5474
5501
|
"typescript": "6.0.3",
|
|
5475
5502
|
"vitest": "5.0.5",
|
|
5476
|
-
"pnpm": "11.28.
|
|
5503
|
+
"pnpm": "11.28.9"
|
|
5477
5504
|
}["@vitest/coverage-v8"]
|
|
5478
5505
|
};
|
|
5479
5506
|
}
|
|
@@ -5484,18 +5511,18 @@ function rootDevDeps(config) {
|
|
|
5484
5511
|
"@types/node": "24.19.2",
|
|
5485
5512
|
"@vitest/coverage-v8": "5.0.5",
|
|
5486
5513
|
"commit-and-tag-version": "13.3.0",
|
|
5487
|
-
"knip": "6.
|
|
5514
|
+
"knip": "6.44.0",
|
|
5488
5515
|
"lefthook": "2.2.2",
|
|
5489
|
-
"modern-web-guidance": "0.0.
|
|
5490
|
-
"oxfmt": "0.
|
|
5491
|
-
"oxlint": "1.
|
|
5516
|
+
"modern-web-guidance": "0.0.196",
|
|
5517
|
+
"oxfmt": "0.75.0",
|
|
5518
|
+
"oxlint": "1.90.0",
|
|
5492
5519
|
"oxlint-tsgolint": "7.0.2005",
|
|
5493
5520
|
"prettier": "3.9.10",
|
|
5494
5521
|
"release-it": "21.1.1",
|
|
5495
|
-
"tsdown": "0.23.
|
|
5522
|
+
"tsdown": "0.23.4",
|
|
5496
5523
|
"typescript": "6.0.3",
|
|
5497
5524
|
"vitest": "5.0.5",
|
|
5498
|
-
"pnpm": "11.28.
|
|
5525
|
+
"pnpm": "11.28.9"
|
|
5499
5526
|
}["lefthook"] };
|
|
5500
5527
|
if (config.stack !== "none") {
|
|
5501
5528
|
deps["knip"] = {
|
|
@@ -5504,18 +5531,18 @@ function rootDevDeps(config) {
|
|
|
5504
5531
|
"@types/node": "24.19.2",
|
|
5505
5532
|
"@vitest/coverage-v8": "5.0.5",
|
|
5506
5533
|
"commit-and-tag-version": "13.3.0",
|
|
5507
|
-
"knip": "6.
|
|
5534
|
+
"knip": "6.44.0",
|
|
5508
5535
|
"lefthook": "2.2.2",
|
|
5509
|
-
"modern-web-guidance": "0.0.
|
|
5510
|
-
"oxfmt": "0.
|
|
5511
|
-
"oxlint": "1.
|
|
5536
|
+
"modern-web-guidance": "0.0.196",
|
|
5537
|
+
"oxfmt": "0.75.0",
|
|
5538
|
+
"oxlint": "1.90.0",
|
|
5512
5539
|
"oxlint-tsgolint": "7.0.2005",
|
|
5513
5540
|
"prettier": "3.9.10",
|
|
5514
5541
|
"release-it": "21.1.1",
|
|
5515
|
-
"tsdown": "0.23.
|
|
5542
|
+
"tsdown": "0.23.4",
|
|
5516
5543
|
"typescript": "6.0.3",
|
|
5517
5544
|
"vitest": "5.0.5",
|
|
5518
|
-
"pnpm": "11.28.
|
|
5545
|
+
"pnpm": "11.28.9"
|
|
5519
5546
|
}["knip"];
|
|
5520
5547
|
deps["oxlint"] = {
|
|
5521
5548
|
"@changesets/cli": "3.0.3",
|
|
@@ -5523,18 +5550,18 @@ function rootDevDeps(config) {
|
|
|
5523
5550
|
"@types/node": "24.19.2",
|
|
5524
5551
|
"@vitest/coverage-v8": "5.0.5",
|
|
5525
5552
|
"commit-and-tag-version": "13.3.0",
|
|
5526
|
-
"knip": "6.
|
|
5553
|
+
"knip": "6.44.0",
|
|
5527
5554
|
"lefthook": "2.2.2",
|
|
5528
|
-
"modern-web-guidance": "0.0.
|
|
5529
|
-
"oxfmt": "0.
|
|
5530
|
-
"oxlint": "1.
|
|
5555
|
+
"modern-web-guidance": "0.0.196",
|
|
5556
|
+
"oxfmt": "0.75.0",
|
|
5557
|
+
"oxlint": "1.90.0",
|
|
5531
5558
|
"oxlint-tsgolint": "7.0.2005",
|
|
5532
5559
|
"prettier": "3.9.10",
|
|
5533
5560
|
"release-it": "21.1.1",
|
|
5534
|
-
"tsdown": "0.23.
|
|
5561
|
+
"tsdown": "0.23.4",
|
|
5535
5562
|
"typescript": "6.0.3",
|
|
5536
5563
|
"vitest": "5.0.5",
|
|
5537
|
-
"pnpm": "11.28.
|
|
5564
|
+
"pnpm": "11.28.9"
|
|
5538
5565
|
}["oxlint"];
|
|
5539
5566
|
Object.assign(deps, vitestDevDeps());
|
|
5540
5567
|
}
|
|
@@ -5544,18 +5571,18 @@ function rootDevDeps(config) {
|
|
|
5544
5571
|
"@types/node": "24.19.2",
|
|
5545
5572
|
"@vitest/coverage-v8": "5.0.5",
|
|
5546
5573
|
"commit-and-tag-version": "13.3.0",
|
|
5547
|
-
"knip": "6.
|
|
5574
|
+
"knip": "6.44.0",
|
|
5548
5575
|
"lefthook": "2.2.2",
|
|
5549
|
-
"modern-web-guidance": "0.0.
|
|
5550
|
-
"oxfmt": "0.
|
|
5551
|
-
"oxlint": "1.
|
|
5576
|
+
"modern-web-guidance": "0.0.196",
|
|
5577
|
+
"oxfmt": "0.75.0",
|
|
5578
|
+
"oxlint": "1.90.0",
|
|
5552
5579
|
"oxlint-tsgolint": "7.0.2005",
|
|
5553
5580
|
"prettier": "3.9.10",
|
|
5554
5581
|
"release-it": "21.1.1",
|
|
5555
|
-
"tsdown": "0.23.
|
|
5582
|
+
"tsdown": "0.23.4",
|
|
5556
5583
|
"typescript": "6.0.3",
|
|
5557
5584
|
"vitest": "5.0.5",
|
|
5558
|
-
"pnpm": "11.28.
|
|
5585
|
+
"pnpm": "11.28.9"
|
|
5559
5586
|
}["oxlint-tsgolint"];
|
|
5560
5587
|
return deps;
|
|
5561
5588
|
}
|
|
@@ -5568,18 +5595,18 @@ function addReleaseDeps(deps, ctx) {
|
|
|
5568
5595
|
"@types/node": "24.19.2",
|
|
5569
5596
|
"@vitest/coverage-v8": "5.0.5",
|
|
5570
5597
|
"commit-and-tag-version": "13.3.0",
|
|
5571
|
-
"knip": "6.
|
|
5598
|
+
"knip": "6.44.0",
|
|
5572
5599
|
"lefthook": "2.2.2",
|
|
5573
|
-
"modern-web-guidance": "0.0.
|
|
5574
|
-
"oxfmt": "0.
|
|
5575
|
-
"oxlint": "1.
|
|
5600
|
+
"modern-web-guidance": "0.0.196",
|
|
5601
|
+
"oxfmt": "0.75.0",
|
|
5602
|
+
"oxlint": "1.90.0",
|
|
5576
5603
|
"oxlint-tsgolint": "7.0.2005",
|
|
5577
5604
|
"prettier": "3.9.10",
|
|
5578
5605
|
"release-it": "21.1.1",
|
|
5579
|
-
"tsdown": "0.23.
|
|
5606
|
+
"tsdown": "0.23.4",
|
|
5580
5607
|
"typescript": "6.0.3",
|
|
5581
5608
|
"vitest": "5.0.5",
|
|
5582
|
-
"pnpm": "11.28.
|
|
5609
|
+
"pnpm": "11.28.9"
|
|
5583
5610
|
}["release-it"];
|
|
5584
5611
|
if (ctx.config.structure === "monorepo") deps["@release-it/bumper"] = {
|
|
5585
5612
|
"@changesets/cli": "3.0.3",
|
|
@@ -5587,18 +5614,18 @@ function addReleaseDeps(deps, ctx) {
|
|
|
5587
5614
|
"@types/node": "24.19.2",
|
|
5588
5615
|
"@vitest/coverage-v8": "5.0.5",
|
|
5589
5616
|
"commit-and-tag-version": "13.3.0",
|
|
5590
|
-
"knip": "6.
|
|
5617
|
+
"knip": "6.44.0",
|
|
5591
5618
|
"lefthook": "2.2.2",
|
|
5592
|
-
"modern-web-guidance": "0.0.
|
|
5593
|
-
"oxfmt": "0.
|
|
5594
|
-
"oxlint": "1.
|
|
5619
|
+
"modern-web-guidance": "0.0.196",
|
|
5620
|
+
"oxfmt": "0.75.0",
|
|
5621
|
+
"oxlint": "1.90.0",
|
|
5595
5622
|
"oxlint-tsgolint": "7.0.2005",
|
|
5596
5623
|
"prettier": "3.9.10",
|
|
5597
5624
|
"release-it": "21.1.1",
|
|
5598
|
-
"tsdown": "0.23.
|
|
5625
|
+
"tsdown": "0.23.4",
|
|
5599
5626
|
"typescript": "6.0.3",
|
|
5600
5627
|
"vitest": "5.0.5",
|
|
5601
|
-
"pnpm": "11.28.
|
|
5628
|
+
"pnpm": "11.28.9"
|
|
5602
5629
|
}["@release-it/bumper"];
|
|
5603
5630
|
break;
|
|
5604
5631
|
case "simple":
|
|
@@ -5608,18 +5635,18 @@ function addReleaseDeps(deps, ctx) {
|
|
|
5608
5635
|
"@types/node": "24.19.2",
|
|
5609
5636
|
"@vitest/coverage-v8": "5.0.5",
|
|
5610
5637
|
"commit-and-tag-version": "13.3.0",
|
|
5611
|
-
"knip": "6.
|
|
5638
|
+
"knip": "6.44.0",
|
|
5612
5639
|
"lefthook": "2.2.2",
|
|
5613
|
-
"modern-web-guidance": "0.0.
|
|
5614
|
-
"oxfmt": "0.
|
|
5615
|
-
"oxlint": "1.
|
|
5640
|
+
"modern-web-guidance": "0.0.196",
|
|
5641
|
+
"oxfmt": "0.75.0",
|
|
5642
|
+
"oxlint": "1.90.0",
|
|
5616
5643
|
"oxlint-tsgolint": "7.0.2005",
|
|
5617
5644
|
"prettier": "3.9.10",
|
|
5618
5645
|
"release-it": "21.1.1",
|
|
5619
|
-
"tsdown": "0.23.
|
|
5646
|
+
"tsdown": "0.23.4",
|
|
5620
5647
|
"typescript": "6.0.3",
|
|
5621
5648
|
"vitest": "5.0.5",
|
|
5622
|
-
"pnpm": "11.28.
|
|
5649
|
+
"pnpm": "11.28.9"
|
|
5623
5650
|
}["commit-and-tag-version"];
|
|
5624
5651
|
break;
|
|
5625
5652
|
case "changesets": deps["@changesets/cli"] = {
|
|
@@ -5628,18 +5655,18 @@ function addReleaseDeps(deps, ctx) {
|
|
|
5628
5655
|
"@types/node": "24.19.2",
|
|
5629
5656
|
"@vitest/coverage-v8": "5.0.5",
|
|
5630
5657
|
"commit-and-tag-version": "13.3.0",
|
|
5631
|
-
"knip": "6.
|
|
5658
|
+
"knip": "6.44.0",
|
|
5632
5659
|
"lefthook": "2.2.2",
|
|
5633
|
-
"modern-web-guidance": "0.0.
|
|
5634
|
-
"oxfmt": "0.
|
|
5635
|
-
"oxlint": "1.
|
|
5660
|
+
"modern-web-guidance": "0.0.196",
|
|
5661
|
+
"oxfmt": "0.75.0",
|
|
5662
|
+
"oxlint": "1.90.0",
|
|
5636
5663
|
"oxlint-tsgolint": "7.0.2005",
|
|
5637
5664
|
"prettier": "3.9.10",
|
|
5638
5665
|
"release-it": "21.1.1",
|
|
5639
|
-
"tsdown": "0.23.
|
|
5666
|
+
"tsdown": "0.23.4",
|
|
5640
5667
|
"typescript": "6.0.3",
|
|
5641
5668
|
"vitest": "5.0.5",
|
|
5642
|
-
"pnpm": "11.28.
|
|
5669
|
+
"pnpm": "11.28.9"
|
|
5643
5670
|
}["@changesets/cli"];
|
|
5644
5671
|
}
|
|
5645
5672
|
}
|
|
@@ -5756,18 +5783,18 @@ function applyMetadataDefaults(pkg, ctx, changes) {
|
|
|
5756
5783
|
"@types/node": "24.19.2",
|
|
5757
5784
|
"@vitest/coverage-v8": "5.0.5",
|
|
5758
5785
|
"commit-and-tag-version": "13.3.0",
|
|
5759
|
-
"knip": "6.
|
|
5786
|
+
"knip": "6.44.0",
|
|
5760
5787
|
"lefthook": "2.2.2",
|
|
5761
|
-
"modern-web-guidance": "0.0.
|
|
5762
|
-
"oxfmt": "0.
|
|
5763
|
-
"oxlint": "1.
|
|
5788
|
+
"modern-web-guidance": "0.0.196",
|
|
5789
|
+
"oxfmt": "0.75.0",
|
|
5790
|
+
"oxlint": "1.90.0",
|
|
5764
5791
|
"oxlint-tsgolint": "7.0.2005",
|
|
5765
5792
|
"prettier": "3.9.10",
|
|
5766
5793
|
"release-it": "21.1.1",
|
|
5767
|
-
"tsdown": "0.23.
|
|
5794
|
+
"tsdown": "0.23.4",
|
|
5768
5795
|
"typescript": "6.0.3",
|
|
5769
5796
|
"vitest": "5.0.5",
|
|
5770
|
-
"pnpm": "11.28.
|
|
5797
|
+
"pnpm": "11.28.9"
|
|
5771
5798
|
}["pnpm"];
|
|
5772
5799
|
const desiredPm = pinnedPnpm ? `pnpm@${pinnedPnpm}` : void 0;
|
|
5773
5800
|
if (desiredPm) {
|
|
@@ -5806,27 +5833,27 @@ function buildManagedDevDeps(ctx) {
|
|
|
5806
5833
|
const devDeps = { ...rootDevDeps(ctx.config) };
|
|
5807
5834
|
if (!isMonorepo) Object.assign(devDeps, perPackageDevDeps(ctx.config));
|
|
5808
5835
|
if (ctx.config.stack !== "none") devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.15.1";
|
|
5809
|
-
if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.
|
|
5836
|
+
if (!isWorkspacePackage(ctx, "@bensandee/tooling")) devDeps["@bensandee/tooling"] = "0.106.0";
|
|
5810
5837
|
if (ctx.config.useEslintPlugin && ctx.config.stack !== "none") devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.18.0";
|
|
5811
|
-
if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.3.
|
|
5838
|
+
if (wantsAgentCli(ctx)) devDeps[AGENT_CLI_PACKAGE] = "0.3.2";
|
|
5812
5839
|
if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = {
|
|
5813
5840
|
"@changesets/cli": "3.0.3",
|
|
5814
5841
|
"@release-it/bumper": "8.0.1",
|
|
5815
5842
|
"@types/node": "24.19.2",
|
|
5816
5843
|
"@vitest/coverage-v8": "5.0.5",
|
|
5817
5844
|
"commit-and-tag-version": "13.3.0",
|
|
5818
|
-
"knip": "6.
|
|
5845
|
+
"knip": "6.44.0",
|
|
5819
5846
|
"lefthook": "2.2.2",
|
|
5820
|
-
"modern-web-guidance": "0.0.
|
|
5821
|
-
"oxfmt": "0.
|
|
5822
|
-
"oxlint": "1.
|
|
5847
|
+
"modern-web-guidance": "0.0.196",
|
|
5848
|
+
"oxfmt": "0.75.0",
|
|
5849
|
+
"oxlint": "1.90.0",
|
|
5823
5850
|
"oxlint-tsgolint": "7.0.2005",
|
|
5824
5851
|
"prettier": "3.9.10",
|
|
5825
5852
|
"release-it": "21.1.1",
|
|
5826
|
-
"tsdown": "0.23.
|
|
5853
|
+
"tsdown": "0.23.4",
|
|
5827
5854
|
"typescript": "6.0.3",
|
|
5828
5855
|
"vitest": "5.0.5",
|
|
5829
|
-
"pnpm": "11.28.
|
|
5856
|
+
"pnpm": "11.28.9"
|
|
5830
5857
|
}["oxfmt"];
|
|
5831
5858
|
if (ctx.config.formatter === "prettier") devDeps["prettier"] = {
|
|
5832
5859
|
"@changesets/cli": "3.0.3",
|
|
@@ -5834,18 +5861,18 @@ function buildManagedDevDeps(ctx) {
|
|
|
5834
5861
|
"@types/node": "24.19.2",
|
|
5835
5862
|
"@vitest/coverage-v8": "5.0.5",
|
|
5836
5863
|
"commit-and-tag-version": "13.3.0",
|
|
5837
|
-
"knip": "6.
|
|
5864
|
+
"knip": "6.44.0",
|
|
5838
5865
|
"lefthook": "2.2.2",
|
|
5839
|
-
"modern-web-guidance": "0.0.
|
|
5840
|
-
"oxfmt": "0.
|
|
5841
|
-
"oxlint": "1.
|
|
5866
|
+
"modern-web-guidance": "0.0.196",
|
|
5867
|
+
"oxfmt": "0.75.0",
|
|
5868
|
+
"oxlint": "1.90.0",
|
|
5842
5869
|
"oxlint-tsgolint": "7.0.2005",
|
|
5843
5870
|
"prettier": "3.9.10",
|
|
5844
5871
|
"release-it": "21.1.1",
|
|
5845
|
-
"tsdown": "0.23.
|
|
5872
|
+
"tsdown": "0.23.4",
|
|
5846
5873
|
"typescript": "6.0.3",
|
|
5847
5874
|
"vitest": "5.0.5",
|
|
5848
|
-
"pnpm": "11.28.
|
|
5875
|
+
"pnpm": "11.28.9"
|
|
5849
5876
|
}["prettier"];
|
|
5850
5877
|
addReleaseDeps(devDeps, ctx);
|
|
5851
5878
|
return devDeps;
|
|
@@ -5905,18 +5932,18 @@ async function generatePackageJson(ctx) {
|
|
|
5905
5932
|
"@types/node": "24.19.2",
|
|
5906
5933
|
"@vitest/coverage-v8": "5.0.5",
|
|
5907
5934
|
"commit-and-tag-version": "13.3.0",
|
|
5908
|
-
"knip": "6.
|
|
5935
|
+
"knip": "6.44.0",
|
|
5909
5936
|
"lefthook": "2.2.2",
|
|
5910
|
-
"modern-web-guidance": "0.0.
|
|
5911
|
-
"oxfmt": "0.
|
|
5912
|
-
"oxlint": "1.
|
|
5937
|
+
"modern-web-guidance": "0.0.196",
|
|
5938
|
+
"oxfmt": "0.75.0",
|
|
5939
|
+
"oxlint": "1.90.0",
|
|
5913
5940
|
"oxlint-tsgolint": "7.0.2005",
|
|
5914
5941
|
"prettier": "3.9.10",
|
|
5915
5942
|
"release-it": "21.1.1",
|
|
5916
|
-
"tsdown": "0.23.
|
|
5943
|
+
"tsdown": "0.23.4",
|
|
5917
5944
|
"typescript": "6.0.3",
|
|
5918
5945
|
"vitest": "5.0.5",
|
|
5919
|
-
"pnpm": "11.28.
|
|
5946
|
+
"pnpm": "11.28.9"
|
|
5920
5947
|
}["pnpm"]}`
|
|
5921
5948
|
};
|
|
5922
5949
|
ctx.write(filePath, JSON.stringify(pkg, null, 2) + "\n");
|
|
@@ -6259,9 +6286,10 @@ const PackageEntrySchema = z.object({
|
|
|
6259
6286
|
const CoverageBaselineSchema = z.object({
|
|
6260
6287
|
totals: TotalsSchema,
|
|
6261
6288
|
packages: z.record(z.string(), PackageEntrySchema),
|
|
6262
|
-
scope: z.literal("include")
|
|
6289
|
+
scope: z.literal("include")
|
|
6263
6290
|
});
|
|
6264
6291
|
const CoverageRecordSchema = CoverageBaselineSchema.extend({
|
|
6292
|
+
scope: z.literal("include").optional(),
|
|
6265
6293
|
sha: z.string(),
|
|
6266
6294
|
timestamp: z.string()
|
|
6267
6295
|
});
|
|
@@ -6657,7 +6685,7 @@ async function generateVitest(ctx) {
|
|
|
6657
6685
|
warnIfMissingInclude(ctx);
|
|
6658
6686
|
return results;
|
|
6659
6687
|
}
|
|
6660
|
-
// src/generators/oxlint.ts
|
|
6688
|
+
// src/generators/lint-format/oxlint.ts
|
|
6661
6689
|
const IGNORE_PATTERNS_SPREAD = "...(recommended.ignorePatterns ?? [])";
|
|
6662
6690
|
const CONFIG_WITH_LINT_RULES = `import recommended from "@bensandee/config/oxlint/recommended";
|
|
6663
6691
|
import bensandee from "@bensandee/eslint-plugin/recommended";
|
|
@@ -6835,7 +6863,7 @@ async function generateOxlint(ctx) {
|
|
|
6835
6863
|
description: "Generated oxlint.config.ts"
|
|
6836
6864
|
};
|
|
6837
6865
|
}
|
|
6838
|
-
// src/generators/formatter.ts
|
|
6866
|
+
// src/generators/lint-format/formatter.ts
|
|
6839
6867
|
const BASE_IGNORE_PATTERNS = [
|
|
6840
6868
|
".claude",
|
|
6841
6869
|
".agent/findings",
|
|
@@ -7244,11 +7272,24 @@ async function deleteTag(executor, conn, tag) {
|
|
|
7244
7272
|
resource: tag
|
|
7245
7273
|
}));
|
|
7246
7274
|
}
|
|
7247
|
-
z.looseObject({
|
|
7275
|
+
const TagSchema = z.looseObject({
|
|
7248
7276
|
name: z.string(),
|
|
7249
7277
|
id: z.string(),
|
|
7250
7278
|
commit: z.object({ sha: z.string().regex(/^[0-9a-f]{40}$/) })
|
|
7251
7279
|
});
|
|
7280
|
+
async function getTagCommit(executor, conn, tag) {
|
|
7281
|
+
const encodedTag = encodeURIComponent(tag);
|
|
7282
|
+
const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/tags/${encodedTag}`;
|
|
7283
|
+
const res = await executor.fetch(url, { headers: { Authorization: `token ${conn.token}` } });
|
|
7284
|
+
if (res.status === 404) return null;
|
|
7285
|
+
if (!res.ok) throw new TransientError(await forgejoErrorMessage(res, {
|
|
7286
|
+
verb: "read tag",
|
|
7287
|
+
resource: tag
|
|
7288
|
+
}));
|
|
7289
|
+
const parsed = TagSchema.safeParse(await res.json());
|
|
7290
|
+
if (!parsed.success) throw new UnexpectedError(`Unexpected tag response: ${parsed.error.message}`);
|
|
7291
|
+
return parsed.data.commit.sha;
|
|
7292
|
+
}
|
|
7252
7293
|
async function deleteRelease(executor, conn, releaseId) {
|
|
7253
7294
|
const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/releases/${String(releaseId)}`;
|
|
7254
7295
|
const res = await executor.fetch(url, {
|
|
@@ -7371,6 +7412,31 @@ async function settleBackoff(attempt, baseDelayMs) {
|
|
|
7371
7412
|
const delay = Math.min(baseDelayMs * 2 ** (attempt - 1), SETTLE_MAX_DELAY_MS);
|
|
7372
7413
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
7373
7414
|
}
|
|
7415
|
+
const ReleaseAssetSchema = z.object({
|
|
7416
|
+
id: z.number(),
|
|
7417
|
+
name: z.string()
|
|
7418
|
+
});
|
|
7419
|
+
const UploadReleaseRowSchema = z.object({
|
|
7420
|
+
id: z.number(),
|
|
7421
|
+
assets: z.array(ReleaseAssetSchema).nullish()
|
|
7422
|
+
});
|
|
7423
|
+
async function deleteReleaseAssetsNamed(executor, conn, release, tag, assetName) {
|
|
7424
|
+
for (const asset of release.assets ?? []) {
|
|
7425
|
+
if (asset.name !== assetName) continue;
|
|
7426
|
+
const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/releases/${String(release.id)}/assets/${String(asset.id)}`;
|
|
7427
|
+
const res = await executor.fetch(url, {
|
|
7428
|
+
method: "DELETE",
|
|
7429
|
+
headers: { Authorization: `token ${conn.token}` }
|
|
7430
|
+
});
|
|
7431
|
+
if (!res.ok) {
|
|
7432
|
+
const detail = await forgejoErrorMessage(res, {
|
|
7433
|
+
verb: "delete asset",
|
|
7434
|
+
resource: `${assetName} on ${tag}`
|
|
7435
|
+
});
|
|
7436
|
+
throw new TransientError(`Cannot replace asset ${assetName} on ${tag}: the forge refused to delete the existing copy (asset ${String(asset.id)}, HTTP ${String(res.status)}).\n${detail}`);
|
|
7437
|
+
}
|
|
7438
|
+
}
|
|
7439
|
+
}
|
|
7374
7440
|
async function uploadReleaseAsset(executor, conn, tag, options) {
|
|
7375
7441
|
const encodedTag = encodeURIComponent(tag);
|
|
7376
7442
|
const releaseUrl = `${conn.serverUrl}/api/v1/repos/${conn.repository}/releases/tags/${encodedTag}`;
|
|
@@ -7379,9 +7445,11 @@ async function uploadReleaseAsset(executor, conn, tag, options) {
|
|
|
7379
7445
|
verb: "get release",
|
|
7380
7446
|
resource: tag
|
|
7381
7447
|
}));
|
|
7382
|
-
const parsed =
|
|
7448
|
+
const parsed = UploadReleaseRowSchema.safeParse(await releaseRes.json());
|
|
7383
7449
|
if (!parsed.success) throw new UnexpectedError(`Unexpected release response: ${parsed.error.message}`);
|
|
7384
|
-
const
|
|
7450
|
+
const release = parsed.data;
|
|
7451
|
+
const releaseId = release.id;
|
|
7452
|
+
if (options.replace) await deleteReleaseAssetsNamed(executor, conn, release, tag, options.assetName);
|
|
7385
7453
|
const uploadUrl = `${conn.serverUrl}/api/v1/repos/${conn.repository}/releases/${String(releaseId)}/assets?name=${encodeURIComponent(options.assetName)}`;
|
|
7386
7454
|
const form = new FormData();
|
|
7387
7455
|
form.append("attachment", new Blob([new Uint8Array(options.fileBuffer)]), options.assetName);
|
|
@@ -7395,7 +7463,9 @@ async function uploadReleaseAsset(executor, conn, tag, options) {
|
|
|
7395
7463
|
resource: `${options.assetName} to ${tag}`
|
|
7396
7464
|
}));
|
|
7397
7465
|
}
|
|
7398
|
-
|
|
7466
|
+
const LIST_PAGE_SIZE = 50;
|
|
7467
|
+
const LIST_MAX_PAGES = 20;
|
|
7468
|
+
const ReleaseListRowSchema = z.looseObject({
|
|
7399
7469
|
id: z.number(),
|
|
7400
7470
|
tag_name: z.string(),
|
|
7401
7471
|
name: z.string().nullish(),
|
|
@@ -7413,6 +7483,68 @@ z.looseObject({
|
|
|
7413
7483
|
created: z.string().nullish()
|
|
7414
7484
|
})
|
|
7415
7485
|
});
|
|
7486
|
+
async function readListPages(executor, conn, path, options, all) {
|
|
7487
|
+
const rows = [];
|
|
7488
|
+
const stopAt = all ? Number.POSITIVE_INFINITY : options.limit;
|
|
7489
|
+
const pageSize = Math.min(Math.max(options.limit, 1), LIST_PAGE_SIZE);
|
|
7490
|
+
for (let page = 1; page <= LIST_MAX_PAGES && rows.length < stopAt; page++) {
|
|
7491
|
+
const params = new URLSearchParams({
|
|
7492
|
+
page: String(page),
|
|
7493
|
+
limit: String(pageSize)
|
|
7494
|
+
});
|
|
7495
|
+
const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/${path}?${params.toString()}`;
|
|
7496
|
+
const res = await executor.fetch(url, { headers: { Authorization: `token ${conn.token}` } });
|
|
7497
|
+
if (!res.ok) throw new TransientError(await forgejoErrorMessage(res, {
|
|
7498
|
+
verb: `list ${path}`,
|
|
7499
|
+
resource: conn.repository
|
|
7500
|
+
}));
|
|
7501
|
+
const body = await res.json();
|
|
7502
|
+
if (!Array.isArray(body)) throw new UnexpectedError(`Unexpected ${path} list response: not an array`);
|
|
7503
|
+
if (body.length === 0) break;
|
|
7504
|
+
rows.push(...body);
|
|
7505
|
+
}
|
|
7506
|
+
return rows;
|
|
7507
|
+
}
|
|
7508
|
+
async function listReleases(executor, conn, options) {
|
|
7509
|
+
const parsed = ReleaseListRowSchema.array().safeParse(await readListPages(executor, conn, "releases", options, false));
|
|
7510
|
+
if (!parsed.success) throw new UnexpectedError(`Unexpected release list response: ${parsed.error.message}`);
|
|
7511
|
+
const rows = parsed.data.slice(0, options.limit);
|
|
7512
|
+
return Promise.all(rows.map(async (row) => ({
|
|
7513
|
+
tag: row.tag_name,
|
|
7514
|
+
name: row.name ?? row.tag_name,
|
|
7515
|
+
commitSha: await getTagCommit(executor, conn, row.tag_name),
|
|
7516
|
+
target: row.target_commitish ?? null,
|
|
7517
|
+
createdAt: row.created_at ?? null,
|
|
7518
|
+
url: row.html_url ?? null,
|
|
7519
|
+
draft: row.draft ?? false,
|
|
7520
|
+
prerelease: row.prerelease ?? false,
|
|
7521
|
+
assetCount: row.assets?.length ?? 0
|
|
7522
|
+
})));
|
|
7523
|
+
}
|
|
7524
|
+
// src/release/publish/release-tag.ts
|
|
7525
|
+
function releaseTag(pkg) {
|
|
7526
|
+
if (pkg.root) return `v${pkg.version}`;
|
|
7527
|
+
return `${pkg.name}@${pkg.version}`;
|
|
7528
|
+
}
|
|
7529
|
+
const TAG_VERSION = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.+-]*)?$/;
|
|
7530
|
+
function parseReleaseTag(tag, rootName) {
|
|
7531
|
+
if (tag.startsWith("v") && rootName !== null) {
|
|
7532
|
+
const version = tag.slice(1);
|
|
7533
|
+
if (TAG_VERSION.test(version)) return {
|
|
7534
|
+
packageName: rootName,
|
|
7535
|
+
version
|
|
7536
|
+
};
|
|
7537
|
+
}
|
|
7538
|
+
const at = tag.lastIndexOf("@");
|
|
7539
|
+
if (at > 0) {
|
|
7540
|
+
const version = tag.slice(at + 1);
|
|
7541
|
+
if (TAG_VERSION.test(version)) return {
|
|
7542
|
+
packageName: tag.slice(0, at),
|
|
7543
|
+
version
|
|
7544
|
+
};
|
|
7545
|
+
}
|
|
7546
|
+
return null;
|
|
7547
|
+
}
|
|
7416
7548
|
// src/release/publish/version-of-record.ts
|
|
7417
7549
|
const FOREIGN_VERSION_FILES = [{
|
|
7418
7550
|
file: "Cargo.toml",
|
|
@@ -7498,26 +7630,53 @@ function stampContent(content, entry, version) {
|
|
|
7498
7630
|
return joinLines(split);
|
|
7499
7631
|
}
|
|
7500
7632
|
// src/release/publish/assets.ts
|
|
7633
|
+
function releaseContextEnv(context) {
|
|
7634
|
+
return {
|
|
7635
|
+
RELEASE_VERSION: context.version,
|
|
7636
|
+
RELEASE_TAG: context.tag,
|
|
7637
|
+
RELEASE_PRERELEASE: String(context.prerelease),
|
|
7638
|
+
RELEASE_BUILD_NUMBER: context.buildNumber
|
|
7639
|
+
};
|
|
7640
|
+
}
|
|
7501
7641
|
const CONVENTION_SCRIPT = "build:release-assets";
|
|
7502
7642
|
const CONVENTION_OUTPUT_DIR = "release-assets";
|
|
7503
|
-
function configuredTargets(cwd, toolingConfig) {
|
|
7504
|
-
return (toolingConfig?.releaseAssets ?? []).map((asset) =>
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7643
|
+
function configuredTargets(cwd, toolingConfig, rootName) {
|
|
7644
|
+
return (toolingConfig?.releaseAssets ?? []).map((asset) => {
|
|
7645
|
+
const owner = asset.package ?? rootName;
|
|
7646
|
+
if (asset.file === void 0 === (asset.files === void 0)) throw new FatalError(`releaseAssets entry must set exactly one of file and files: ${JSON.stringify(asset)}`);
|
|
7647
|
+
if (asset.file === void 0) {
|
|
7648
|
+
const patterns = asset.files ?? [];
|
|
7649
|
+
return {
|
|
7650
|
+
owner,
|
|
7651
|
+
commandCwd: cwd,
|
|
7652
|
+
command: asset.command,
|
|
7653
|
+
files: [],
|
|
7654
|
+
globs: patterns,
|
|
7655
|
+
label: `files ${JSON.stringify(patterns)}`
|
|
7656
|
+
};
|
|
7657
|
+
}
|
|
7658
|
+
return {
|
|
7659
|
+
owner,
|
|
7660
|
+
commandCwd: cwd,
|
|
7661
|
+
command: asset.command,
|
|
7662
|
+
files: [{
|
|
7663
|
+
path: path.resolve(cwd, asset.file),
|
|
7664
|
+
...asset.name && { name: asset.name }
|
|
7665
|
+
}],
|
|
7666
|
+
label: `file ${asset.file}`
|
|
7667
|
+
};
|
|
7668
|
+
});
|
|
7512
7669
|
}
|
|
7513
|
-
function conventionTargets(executor, cwd) {
|
|
7670
|
+
function conventionTargets(executor, cwd, rootName) {
|
|
7514
7671
|
const targets = [];
|
|
7515
|
-
const checkDir = (relDir) => {
|
|
7672
|
+
const checkDir = (relDir, isRoot) => {
|
|
7516
7673
|
const absDir = path.resolve(cwd, relDir);
|
|
7517
7674
|
const raw = executor.readFile(path.join(absDir, "package.json"));
|
|
7518
7675
|
if (!raw) return;
|
|
7519
|
-
|
|
7676
|
+
const pkg = parsePackageJson(raw);
|
|
7677
|
+
if (!pkg?.scripts?.[CONVENTION_SCRIPT]) return;
|
|
7520
7678
|
targets.push({
|
|
7679
|
+
owner: isRoot || rootName !== null ? rootName : pkg.name ?? null,
|
|
7521
7680
|
commandCwd: absDir,
|
|
7522
7681
|
command: [
|
|
7523
7682
|
"pnpm",
|
|
@@ -7528,10 +7687,24 @@ function conventionTargets(executor, cwd) {
|
|
|
7528
7687
|
collectFromDir: path.join(absDir, CONVENTION_OUTPUT_DIR)
|
|
7529
7688
|
});
|
|
7530
7689
|
};
|
|
7531
|
-
checkDir(".");
|
|
7532
|
-
for (const dir of executor.listPackageDirs(cwd)) checkDir(path.join("packages", dir));
|
|
7690
|
+
checkDir(".", true);
|
|
7691
|
+
for (const dir of executor.listPackageDirs(cwd)) checkDir(path.join("packages", dir), false);
|
|
7533
7692
|
return targets;
|
|
7534
7693
|
}
|
|
7694
|
+
function allTargets(executor, cwd, toolingConfig, rootName) {
|
|
7695
|
+
return [...configuredTargets(cwd, toolingConfig, rootName), ...conventionTargets(executor, cwd, rootName)];
|
|
7696
|
+
}
|
|
7697
|
+
function isMonorepoRepo$1(executor, cwd, toolingConfig) {
|
|
7698
|
+
if (toolingConfig?.structure !== void 0) return toolingConfig.structure === "monorepo";
|
|
7699
|
+
return executor.readFile(path.join(cwd, "pnpm-workspace.yaml")) !== null;
|
|
7700
|
+
}
|
|
7701
|
+
function rootPackageName(executor, cwd) {
|
|
7702
|
+
const raw = executor.readFile(path.join(cwd, "package.json"));
|
|
7703
|
+
return (raw === null ? void 0 : parsePackageJson(raw))?.name ?? "";
|
|
7704
|
+
}
|
|
7705
|
+
function ownedTargets(executor, cwd, toolingConfig, packageName, isMonorepo) {
|
|
7706
|
+
return allTargets(executor, cwd, toolingConfig, isMonorepo ? null : rootPackageName(executor, cwd)).filter((target) => target.owner === packageName);
|
|
7707
|
+
}
|
|
7535
7708
|
function resolveStampVersion(executor, cwd) {
|
|
7536
7709
|
const pkgPath = path.join(cwd, "package.json");
|
|
7537
7710
|
const raw = executor.readFile(pkgPath);
|
|
@@ -7540,8 +7713,7 @@ function resolveStampVersion(executor, cwd) {
|
|
|
7540
7713
|
if (!pkg?.version) throw new FatalError(`release:assets could not find a "version" field in package.json at ${pkgPath}. versionStamp needs a version to stamp.`);
|
|
7541
7714
|
return pkg.version;
|
|
7542
7715
|
}
|
|
7543
|
-
function stampVersionFiles(executor, cwd,
|
|
7544
|
-
const entries = toolingConfig?.versionStamp ?? [];
|
|
7716
|
+
function stampVersionFiles(executor, cwd, entries, version) {
|
|
7545
7717
|
const stamped = [];
|
|
7546
7718
|
for (const entry of entries) {
|
|
7547
7719
|
const filePath = path.resolve(cwd, entry.file);
|
|
@@ -7565,27 +7737,53 @@ function verifyStamp(executor, stamped) {
|
|
|
7565
7737
|
if (matches !== 1) throw new FatalError(`versionStamp verify failed for ${filePath}: expected exactly one line "${expectedLine}" after the build, found ${matches}. The build likely overwrote the stamp -- check for a script that regenerates or copies over this file.`);
|
|
7566
7738
|
}
|
|
7567
7739
|
}
|
|
7568
|
-
function
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7740
|
+
function refuseForeignVersionOfRecord(cwd) {
|
|
7741
|
+
const conflict = detectForeignVersionOfRecord(cwd);
|
|
7742
|
+
if (conflict) throw new FatalError(`bst stamps package.json's version into versionStamp files, but this repo's version-of-record is ${conflict}. A stamp would carry a version the ${conflict} artifact never gets. Release this repo through its own toolchain, or remove the versionStamp block.`);
|
|
7743
|
+
}
|
|
7744
|
+
function stampOwnedVersionFiles(executor, cwd, toolingConfig, context, isMonorepo) {
|
|
7745
|
+
const rootName = isMonorepo ? null : rootPackageName(executor, cwd);
|
|
7746
|
+
const owned = (toolingConfig?.versionStamp ?? []).filter((entry) => stampOwner(entry, rootName) === context.packageName);
|
|
7747
|
+
if (owned.length === 0) return [];
|
|
7748
|
+
refuseForeignVersionOfRecord(cwd);
|
|
7749
|
+
return stampVersionFiles(executor, cwd, owned, context.version);
|
|
7750
|
+
}
|
|
7751
|
+
function stampWithRootVersion(executor, cwd, entries) {
|
|
7752
|
+
if (entries.length === 0) return [];
|
|
7753
|
+
return stampVersionFiles(executor, cwd, entries, resolveStampVersion(executor, cwd));
|
|
7574
7754
|
}
|
|
7575
|
-
function runBuild(executor, target,
|
|
7755
|
+
function runBuild(executor, target, context, opts) {
|
|
7576
7756
|
if (!target.command || target.command.length === 0) return;
|
|
7577
7757
|
const [file, ...args] = target.command;
|
|
7578
7758
|
if (!file) return;
|
|
7579
|
-
const label = target.commandCwd ===
|
|
7759
|
+
const label = target.commandCwd === opts.cwd ? "root" : path.relative(opts.cwd, target.commandCwd);
|
|
7580
7760
|
log$1.info(`Building assets in ${label}: ${target.command.join(" ")}`);
|
|
7581
|
-
|
|
7582
|
-
|
|
7761
|
+
const options = context === null ? { cwd: target.commandCwd } : {
|
|
7762
|
+
cwd: target.commandCwd,
|
|
7763
|
+
env: releaseContextEnv(context)
|
|
7764
|
+
};
|
|
7765
|
+
executor.execInherit(file, args, options);
|
|
7766
|
+
debug(opts, `Asset build completed for ${label}`);
|
|
7583
7767
|
}
|
|
7584
7768
|
function collectFromDir(executor, target) {
|
|
7585
|
-
if (!target.collectFromDir) return;
|
|
7586
|
-
const
|
|
7587
|
-
|
|
7588
|
-
|
|
7769
|
+
if (!target.collectFromDir) return [];
|
|
7770
|
+
const files = executor.listFiles(target.collectFromDir).map((entry) => ({ path: path.join(target.collectFromDir ?? "", entry) }));
|
|
7771
|
+
if (files.length === 0) throw new FatalError(`${CONVENTION_SCRIPT} ran in ${target.commandCwd} but emitted no files to ${target.collectFromDir}. Update your script to write artifacts there, or declare assets explicitly via releaseAssets in .tooling.json.`);
|
|
7772
|
+
return files;
|
|
7773
|
+
}
|
|
7774
|
+
function collectFromGlobs(executor, cwd, target) {
|
|
7775
|
+
if (!target.globs) return [];
|
|
7776
|
+
const matches = executor.globFiles(cwd, target.globs);
|
|
7777
|
+
if (matches.length === 0) throw new FatalError(`releaseAssets entry with ${target.label ?? "globs"} matched no files under ${cwd} after its build ran. Check the glob and where the build writes its output.`);
|
|
7778
|
+
return matches.map((match) => ({ path: match }));
|
|
7779
|
+
}
|
|
7780
|
+
function buildTargets(executor, targets, context, opts) {
|
|
7781
|
+
const built = [];
|
|
7782
|
+
for (const target of targets) {
|
|
7783
|
+
runBuild(executor, target, context, opts);
|
|
7784
|
+
built.push(...target.files, ...collectFromDir(executor, target), ...collectFromGlobs(executor, opts.cwd, target));
|
|
7785
|
+
}
|
|
7786
|
+
return built;
|
|
7589
7787
|
}
|
|
7590
7788
|
function uploadToGitHub(executor, config, tag, asset) {
|
|
7591
7789
|
const assetName = asset.name ?? path.basename(asset.path);
|
|
@@ -7610,48 +7808,106 @@ async function uploadToForgejo(executor, conn, tag, asset) {
|
|
|
7610
7808
|
});
|
|
7611
7809
|
log$1.info(`Uploaded ${assetName} to ${tag} (Forgejo)`);
|
|
7612
7810
|
}
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
runBuild(executor, target, config);
|
|
7619
|
-
collectFromDir(executor, target);
|
|
7620
|
-
}
|
|
7621
|
-
verifyStamp(executor, stampedFiles);
|
|
7622
|
-
if (targets.length === 0) {
|
|
7623
|
-
log$1.info(`No release assets configured in .tooling.json or by convention (${CONVENTION_SCRIPT} script)`);
|
|
7624
|
-
return;
|
|
7625
|
-
}
|
|
7626
|
-
if (config.dryRun) {
|
|
7627
|
-
log$1.info("[dry-run] Skipping upload");
|
|
7628
|
-
return;
|
|
7629
|
-
}
|
|
7630
|
-
if (!config.platform) throw new FatalError("Platform connection is required for asset upload");
|
|
7811
|
+
function isPrerelease(version) {
|
|
7812
|
+
const [core = ""] = version.split("+");
|
|
7813
|
+
return core.includes("-");
|
|
7814
|
+
}
|
|
7815
|
+
async function findReleasesAtHead(executor, config, rootName) {
|
|
7631
7816
|
const tagResult = executor.exec("git", [
|
|
7632
7817
|
"tag",
|
|
7633
7818
|
"--points-at",
|
|
7634
7819
|
"HEAD"
|
|
7635
7820
|
], { cwd: config.cwd });
|
|
7636
7821
|
debugExec(config, "git tag --points-at HEAD", tagResult);
|
|
7637
|
-
if (tagResult.exitCode !== 0)
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
log$1.info("No tags pointing to HEAD, skipping upload");
|
|
7641
|
-
return;
|
|
7822
|
+
if (tagResult.exitCode !== 0) {
|
|
7823
|
+
if (config.dryRun) return [];
|
|
7824
|
+
throw new FatalError("Could not determine current tags");
|
|
7642
7825
|
}
|
|
7643
|
-
|
|
7826
|
+
const tags = tagResult.stdout.trim().split("\n").filter(Boolean);
|
|
7827
|
+
const buildNumber = process.env["GITHUB_RUN_NUMBER"] ?? "";
|
|
7828
|
+
const releases = [];
|
|
7644
7829
|
for (const tag of tags) {
|
|
7645
|
-
if (!await releaseExists(executor, config, tag)) {
|
|
7830
|
+
if (!config.dryRun && !await releaseExists(executor, config, tag)) {
|
|
7646
7831
|
log$1.info(`No release found for ${tag}, skipping (likely a sliding tag)`);
|
|
7647
7832
|
continue;
|
|
7648
7833
|
}
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7834
|
+
const parsed = parseReleaseTag(tag, rootName);
|
|
7835
|
+
const context = parsed === null ? null : {
|
|
7836
|
+
...parsed,
|
|
7837
|
+
tag,
|
|
7838
|
+
prerelease: isPrerelease(parsed.version),
|
|
7839
|
+
buildNumber
|
|
7840
|
+
};
|
|
7841
|
+
releases.push({
|
|
7842
|
+
tag,
|
|
7843
|
+
context
|
|
7844
|
+
});
|
|
7845
|
+
}
|
|
7846
|
+
return releases;
|
|
7847
|
+
}
|
|
7848
|
+
async function uploadFiles(executor, config, tag, files) {
|
|
7849
|
+
if (config.dryRun) {
|
|
7850
|
+
log$1.info(`[dry-run] Skipping upload to ${tag}`);
|
|
7851
|
+
return;
|
|
7852
|
+
}
|
|
7853
|
+
if (!config.platform) throw new FatalError("Platform connection is required for asset upload");
|
|
7854
|
+
log$1.info(`Uploading assets to release ${tag}`);
|
|
7855
|
+
for (const asset of files) if (config.platform.type === "github") uploadToGitHub(executor, config, tag, asset);
|
|
7856
|
+
else await uploadToForgejo(executor, config.platform.conn, tag, asset);
|
|
7857
|
+
}
|
|
7858
|
+
async function runReleaseAssets(executor, config) {
|
|
7859
|
+
debug(config, `Config: dryRun=${String(config.dryRun)} cwd=${config.cwd}`);
|
|
7860
|
+
const isMonorepo = isMonorepoRepo$1(executor, config.cwd, config.toolingConfig);
|
|
7861
|
+
const rootName = isMonorepo ? null : rootPackageName(executor, config.cwd);
|
|
7862
|
+
const targets = allTargets(executor, config.cwd, config.toolingConfig, rootName);
|
|
7863
|
+
const stampEntries = config.toolingConfig?.versionStamp ?? [];
|
|
7864
|
+
if (targets.length === 0 && stampEntries.length === 0) {
|
|
7865
|
+
log$1.info(`No release assets configured in .tooling.json or by convention (${CONVENTION_SCRIPT} script)`);
|
|
7866
|
+
return;
|
|
7867
|
+
}
|
|
7868
|
+
if (stampEntries.length > 0) refuseForeignVersionOfRecord(config.cwd);
|
|
7869
|
+
if (!config.dryRun && !config.platform && targets.length > 0) throw new FatalError("Platform connection is required for asset upload");
|
|
7870
|
+
const releases = await findReleasesAtHead(executor, config, rootName);
|
|
7871
|
+
const plan = {
|
|
7872
|
+
targets,
|
|
7873
|
+
stampEntries,
|
|
7874
|
+
isMonorepo,
|
|
7875
|
+
releases
|
|
7876
|
+
};
|
|
7877
|
+
if (releases.every((release) => release.context === null)) {
|
|
7878
|
+
await buildOnceForEveryRelease(executor, config, plan, null);
|
|
7879
|
+
return;
|
|
7880
|
+
}
|
|
7881
|
+
await buildPerPackageRelease(executor, config, plan);
|
|
7882
|
+
const unowned = {
|
|
7883
|
+
...plan,
|
|
7884
|
+
targets: targets.filter((target) => target.owner === null),
|
|
7885
|
+
stampEntries: stampEntries.filter((entry) => stampOwner(entry, rootName) === null)
|
|
7886
|
+
};
|
|
7887
|
+
if (unowned.targets.length === 0 && unowned.stampEntries.length === 0) return;
|
|
7888
|
+
await buildOnceForEveryRelease(executor, config, unowned, (releases.length === 1 ? releases[0] : void 0)?.context ?? null);
|
|
7889
|
+
}
|
|
7890
|
+
function stampOwner(entry, rootName) {
|
|
7891
|
+
return entry.package ?? rootName;
|
|
7892
|
+
}
|
|
7893
|
+
async function buildOnceForEveryRelease(executor, config, plan, context) {
|
|
7894
|
+
const stamped = stampWithRootVersion(executor, config.cwd, plan.stampEntries);
|
|
7895
|
+
const files = buildTargets(executor, plan.targets, context, config);
|
|
7896
|
+
verifyStamp(executor, stamped);
|
|
7897
|
+
if (plan.releases.length === 0) log$1.info("No release found at HEAD, skipping upload");
|
|
7898
|
+
for (const release of plan.releases) await uploadFiles(executor, config, release.tag, files);
|
|
7899
|
+
}
|
|
7900
|
+
async function buildPerPackageRelease(executor, config, plan) {
|
|
7901
|
+
for (const release of plan.releases) {
|
|
7902
|
+
const context = release.context;
|
|
7903
|
+
if (context === null) continue;
|
|
7904
|
+
const owned = plan.targets.filter((target) => target.owner === context.packageName);
|
|
7905
|
+
const stamped = stampOwnedVersionFiles(executor, config.cwd, config.toolingConfig, context, plan.isMonorepo);
|
|
7906
|
+
if (owned.length === 0 && stamped.length === 0) continue;
|
|
7907
|
+
const files = buildTargets(executor, owned, context, config);
|
|
7908
|
+
verifyStamp(executor, stamped);
|
|
7909
|
+
await uploadFiles(executor, config, release.tag, files);
|
|
7653
7910
|
}
|
|
7654
|
-
if (uploaded === 0) log$1.info("No releases found for any tag pointing to HEAD, skipping upload");
|
|
7655
7911
|
}
|
|
7656
7912
|
async function releaseExists(executor, config, tag) {
|
|
7657
7913
|
if (!config.platform) return false;
|
|
@@ -7819,7 +8075,7 @@ function refuseForgeDefaultMismatch(configured, source, command) {
|
|
|
7819
8075
|
if (reported === void 0 || reported === configured) return;
|
|
7820
8076
|
throw new FatalError(`${command}: .tooling.json#defaultBranch is "${configured}", but the forge reports "${reported}" as this repository's default branch. Set .tooling.json#defaultBranch to "${reported}" and run pnpm exec bst repo:sync.`);
|
|
7821
8077
|
}
|
|
7822
|
-
// src/generators/release-ci.ts
|
|
8078
|
+
// src/generators/ci/release-ci.ts
|
|
7823
8079
|
const DEFAULT_POST_RELEASE_COMMAND = [
|
|
7824
8080
|
"pnpm exec bst webhook:send",
|
|
7825
8081
|
" \"$POST_RELEASE_HOOK_URL\"",
|
|
@@ -7850,7 +8106,7 @@ function postReleaseHookJob(opts) {
|
|
|
7850
8106
|
return {
|
|
7851
8107
|
needs: opts.needsJob,
|
|
7852
8108
|
if: onlyOnDefaultBranch(opts.defaultBranch, opts.publishCondition),
|
|
7853
|
-
|
|
8109
|
+
runsOn: opts.runsOn,
|
|
7854
8110
|
"continue-on-error": true,
|
|
7855
8111
|
steps: [...commonSteps(opts.ci), { step: {
|
|
7856
8112
|
name: "Post-release hook",
|
|
@@ -7880,7 +8136,7 @@ function deployDispatchStep(opts) {
|
|
|
7880
8136
|
env: {
|
|
7881
8137
|
...opts.releaseEnv,
|
|
7882
8138
|
...secretsEnv(opts.secrets),
|
|
7883
|
-
RELEASE_TAG:
|
|
8139
|
+
RELEASE_TAG: opts.releaseTagExpr
|
|
7884
8140
|
},
|
|
7885
8141
|
run: command
|
|
7886
8142
|
} };
|
|
@@ -7995,7 +8251,7 @@ async function generateReleaseCi(ctx) {
|
|
|
7995
8251
|
const filePath = "release-ci";
|
|
7996
8252
|
const isGitHub = ctx.config.ci === "github";
|
|
7997
8253
|
const defaultBranch = configuredDefaultBranch(ctx.read(".tooling.json"));
|
|
7998
|
-
const
|
|
8254
|
+
const trustedRunsOn = actionsExpr(TRUSTED_RUNNER_EXPR);
|
|
7999
8255
|
if (ctx.config.ci === "none" || ctx.config.releaseStrategy === "none") return {
|
|
8000
8256
|
filePath,
|
|
8001
8257
|
action: "skipped",
|
|
@@ -8032,6 +8288,7 @@ async function generateReleaseCi(ctx) {
|
|
|
8032
8288
|
deploy,
|
|
8033
8289
|
packageName: ctx.config.name,
|
|
8034
8290
|
releaseEnv: connectionEnv(ctx.config.ci),
|
|
8291
|
+
releaseTagExpr: actionsExpr("steps.release.outputs.tag"),
|
|
8035
8292
|
condition: "steps.release.outputs.pushed == 'true'",
|
|
8036
8293
|
secrets: hookSecrets
|
|
8037
8294
|
}));
|
|
@@ -8052,7 +8309,7 @@ async function generateReleaseCi(ctx) {
|
|
|
8052
8309
|
defaultBranch,
|
|
8053
8310
|
ci: ctx.config.ci,
|
|
8054
8311
|
needsJob: "release",
|
|
8055
|
-
|
|
8312
|
+
runsOn: trustedRunsOn,
|
|
8056
8313
|
publishCondition: "needs.release.outputs.pushed == 'true'",
|
|
8057
8314
|
releaseTagExpr: actionsExpr("needs.release.outputs.tag"),
|
|
8058
8315
|
command: getPostReleaseHookCommand(ctx),
|
|
@@ -8067,7 +8324,7 @@ async function generateReleaseCi(ctx) {
|
|
|
8067
8324
|
...isGitHub && { permissions: { contents: "write" } },
|
|
8068
8325
|
jobName: "release",
|
|
8069
8326
|
jobIf: isDefaultBranch(defaultBranch),
|
|
8070
|
-
|
|
8327
|
+
runsOn: trustedRunsOn,
|
|
8071
8328
|
...jobOutputs && { jobOutputs },
|
|
8072
8329
|
steps,
|
|
8073
8330
|
...extraJobs && { extraJobs }
|
|
@@ -8100,7 +8357,7 @@ async function generateReleaseCi(ctx) {
|
|
|
8100
8357
|
function versionPrBranch(defaultBranch) {
|
|
8101
8358
|
return `changeset-release/${defaultBranch}`;
|
|
8102
8359
|
}
|
|
8103
|
-
// src/generators/ci.ts
|
|
8360
|
+
// src/generators/ci/ci.ts
|
|
8104
8361
|
function coverageHistorySteps() {
|
|
8105
8362
|
return [
|
|
8106
8363
|
{ step: {
|
|
@@ -8174,9 +8431,8 @@ function ciConcurrency(ci, defaultBranch) {
|
|
|
8174
8431
|
"cancel-in-progress": actionsExpr(isNotDefaultBranch(defaultBranch))
|
|
8175
8432
|
};
|
|
8176
8433
|
}
|
|
8177
|
-
function checkJobRunsOn(defaultBranch
|
|
8178
|
-
|
|
8179
|
-
return actionsExpr(`${isDefaultBranch(defaultBranch)} && '${trustedRunner}' || 'ubuntu-latest'`);
|
|
8434
|
+
function checkJobRunsOn(defaultBranch) {
|
|
8435
|
+
return actionsExpr(`${isDefaultBranch(defaultBranch)} && (${TRUSTED_RUNNER_EXPR}) || (${SHARED_RUNNER_EXPR})`);
|
|
8180
8436
|
}
|
|
8181
8437
|
function checkSteps(ci, coverageEnabled, emitDockerSweepStep) {
|
|
8182
8438
|
const checkCommand = coverageEnabled ? "pnpm ci:check" : "pnpm ci:check --no-coverage";
|
|
@@ -8200,6 +8456,26 @@ function checkSteps(ci, coverageEnabled, emitDockerSweepStep) {
|
|
|
8200
8456
|
function ciWorkflowPath(ci, releaseStrategy) {
|
|
8201
8457
|
return `${ci === "github" ? ".github/workflows" : ".forgejo/workflows"}/${releaseStrategy === "changesets" ? "ci.yml" : "check.yml"}`;
|
|
8202
8458
|
}
|
|
8459
|
+
const SnapshotSliceSchema = z.object({ snapshot: SnapshotConfigSchema.optional() });
|
|
8460
|
+
function snapshotJob(defaultBranch, ci, releaseEnv) {
|
|
8461
|
+
return {
|
|
8462
|
+
needs: "check",
|
|
8463
|
+
if: onlyOnDefaultBranch(defaultBranch, "needs.check.outputs.published != 'true'"),
|
|
8464
|
+
runsOn: actionsExpr(TRUSTED_RUNNER_EXPR),
|
|
8465
|
+
outputs: {
|
|
8466
|
+
published: actionsExpr("steps.snapshot.outputs.published"),
|
|
8467
|
+
version: actionsExpr("steps.snapshot.outputs.version"),
|
|
8468
|
+
tag: actionsExpr("steps.snapshot.outputs.tag"),
|
|
8469
|
+
packages: actionsExpr("steps.snapshot.outputs.packages")
|
|
8470
|
+
},
|
|
8471
|
+
steps: [...commonSteps(ci), { step: {
|
|
8472
|
+
id: "snapshot",
|
|
8473
|
+
name: "Snapshot release",
|
|
8474
|
+
env: releaseEnv,
|
|
8475
|
+
run: "pnpm exec bst release:snapshot"
|
|
8476
|
+
} }]
|
|
8477
|
+
};
|
|
8478
|
+
}
|
|
8203
8479
|
async function generateCi(ctx) {
|
|
8204
8480
|
if (ctx.config.ci === "none") return {
|
|
8205
8481
|
filePath: "ci",
|
|
@@ -8207,8 +8483,7 @@ async function generateCi(ctx) {
|
|
|
8207
8483
|
description: "CI workflow not requested"
|
|
8208
8484
|
};
|
|
8209
8485
|
const defaultBranch = configuredDefaultBranch(ctx.read(".tooling.json"));
|
|
8210
|
-
const
|
|
8211
|
-
const checkRunsOn = checkJobRunsOn(defaultBranch, trustedRunner);
|
|
8486
|
+
const checkRunsOn = checkJobRunsOn(defaultBranch);
|
|
8212
8487
|
const isGitHub = ctx.config.ci === "github";
|
|
8213
8488
|
const isForgejo = !isGitHub;
|
|
8214
8489
|
const isChangesets = ctx.config.releaseStrategy === "changesets";
|
|
@@ -8224,14 +8499,16 @@ async function generateCi(ctx) {
|
|
|
8224
8499
|
const host = hasDocker ? resolveGenTimeHost(ctx) : null;
|
|
8225
8500
|
const publishedIf = "steps.release.outputs.published == 'true'";
|
|
8226
8501
|
const publishedOnDefaultIf = onlyOnDefaultBranch(defaultBranch, publishedIf);
|
|
8502
|
+
const publishedTagJq = ctx.config.structure === "monorepo" ? ".[0] | \"\\(.name)@\\(.version)\"" : ".[0] | \"v\\(.version)\"";
|
|
8227
8503
|
const githubChangesetsDeriveTagStep = { step: {
|
|
8228
8504
|
name: "Derive release tag",
|
|
8229
8505
|
id: "derive-tag",
|
|
8230
8506
|
if: publishedIf,
|
|
8231
8507
|
env: { PUBLISHED_PACKAGES: actionsExpr("steps.release.outputs.publishedPackages") },
|
|
8232
|
-
run:
|
|
8508
|
+
run: `echo "tag=$(echo "$PUBLISHED_PACKAGES" | jq -r '${publishedTagJq}')" >> "$GITHUB_OUTPUT"\necho "version=\$(echo "\$PUBLISHED_PACKAGES" | jq -r '.[0].version')" >> "\$GITHUB_OUTPUT"`
|
|
8233
8509
|
} };
|
|
8234
8510
|
const changesetsTagOutputExpr = isGitHub ? actionsExpr("steps.derive-tag.outputs.tag") : actionsExpr("steps.release.outputs.tag");
|
|
8511
|
+
const changesetsVersionOutputExpr = isGitHub ? actionsExpr("steps.derive-tag.outputs.version") : actionsExpr("steps.release.outputs.version");
|
|
8235
8512
|
const releaseEnv = {};
|
|
8236
8513
|
if (isGitHub) releaseEnv["GITHUB_TOKEN"] = actionsExpr("secrets.RELEASE_TOKEN");
|
|
8237
8514
|
else {
|
|
@@ -8262,6 +8539,7 @@ async function generateCi(ctx) {
|
|
|
8262
8539
|
deploy,
|
|
8263
8540
|
packageName: ctx.config.name,
|
|
8264
8541
|
releaseEnv,
|
|
8542
|
+
releaseTagExpr: changesetsTagOutputExpr,
|
|
8265
8543
|
condition: publishedOnDefaultIf,
|
|
8266
8544
|
secrets: hookSecrets
|
|
8267
8545
|
})] : []
|
|
@@ -8271,18 +8549,20 @@ async function generateCi(ctx) {
|
|
|
8271
8549
|
if (isChangesets) {
|
|
8272
8550
|
jobOutputs = {
|
|
8273
8551
|
published: actionsExpr("steps.release.outputs.published"),
|
|
8274
|
-
tag: changesetsTagOutputExpr
|
|
8552
|
+
tag: changesetsTagOutputExpr,
|
|
8553
|
+
version: changesetsVersionOutputExpr
|
|
8275
8554
|
};
|
|
8276
8555
|
extraJobs = { "post-release-hook": postReleaseHookJob({
|
|
8277
8556
|
defaultBranch,
|
|
8278
8557
|
ci: ctx.config.ci,
|
|
8279
8558
|
needsJob: "check",
|
|
8280
|
-
|
|
8559
|
+
runsOn: actionsExpr(TRUSTED_RUNNER_EXPR),
|
|
8281
8560
|
publishCondition: "needs.check.outputs.published == 'true'",
|
|
8282
8561
|
releaseTagExpr: actionsExpr("needs.check.outputs.tag"),
|
|
8283
8562
|
command: hookCommand,
|
|
8284
8563
|
secrets: hookSecrets
|
|
8285
8564
|
}) };
|
|
8565
|
+
if (parseToolingConfigSlice(ctx.read(".tooling.json"), SnapshotSliceSchema, { block: "snapshot" })?.snapshot) extraJobs["snapshot"] = snapshotJob(defaultBranch, ctx.config.ci, { ...releaseEnv });
|
|
8286
8566
|
}
|
|
8287
8567
|
const checkJobEnv = emitCoverageSteps || emitHealthHistory ? defaultBranchJobEnv(defaultBranch) : {};
|
|
8288
8568
|
const checksSlice = parseToolingConfigSlice(ctx.read(".tooling.json"), z.object({ checks: ChecksConfigSchema.optional() }), { block: "checks" });
|
|
@@ -8301,7 +8581,7 @@ async function generateCi(ctx) {
|
|
|
8301
8581
|
enableEmailNotifications: isForgejo,
|
|
8302
8582
|
...isChangesets && { concurrency: ciConcurrency(ctx.config.ci, defaultBranch) },
|
|
8303
8583
|
jobName: "check",
|
|
8304
|
-
|
|
8584
|
+
runsOn: checkRunsOn,
|
|
8305
8585
|
...skipOnVersionPr && { jobIf: `github.head_ref != '${versionPrBranch(defaultBranch)}'` },
|
|
8306
8586
|
...Object.keys(checkJobEnv).length > 0 && { jobEnv: checkJobEnv },
|
|
8307
8587
|
...jobOutputs && { jobOutputs },
|
|
@@ -8333,7 +8613,7 @@ async function generateCi(ctx) {
|
|
|
8333
8613
|
description: `Generated ${isGitHub ? "GitHub" : "Forgejo"} Actions CI workflow`
|
|
8334
8614
|
};
|
|
8335
8615
|
}
|
|
8336
|
-
// src/generators/knip.ts
|
|
8616
|
+
// src/generators/lint-format/knip.ts
|
|
8337
8617
|
const FOREIGN_OWNED = ["composer"];
|
|
8338
8618
|
function scriptsInvoke(ctx, binary) {
|
|
8339
8619
|
const invocation = new RegExp(String.raw`(?<![\w.-])${binary}(?![\w.-])`);
|
|
@@ -8718,10 +8998,10 @@ async function generatePnpmWorkspace(ctx) {
|
|
|
8718
8998
|
description: changes.join(", ")
|
|
8719
8999
|
};
|
|
8720
9000
|
}
|
|
8721
|
-
// src/generators/claude-hooks-placeholder.ts
|
|
9001
|
+
// src/generators/claude/claude-hooks-placeholder.ts
|
|
8722
9002
|
const HOOK_NOT_BUILT_PLACEHOLDER = "/* bst-hook not built -- run pnpm build from packages/claude-hooks first */";
|
|
8723
9003
|
const GUIDE_NOT_BUILT_PLACEHOLDER = "<!-- bst-hook guide not built -->";
|
|
8724
|
-
// src/generators/claude-hooks.ts
|
|
9004
|
+
// src/generators/claude/claude-hooks.ts
|
|
8725
9005
|
const HOOK_PATH = ".claude/hooks/bst-hook.mjs";
|
|
8726
9006
|
const GUIDE_PATH = ".claude/hooks/bst-hook-guide.md";
|
|
8727
9007
|
const SETTINGS_PATH$1 = ".claude/hooks/bst-hook.settings.json";
|
|
@@ -8788,7 +9068,7 @@ async function generateClaudeHooks(ctx, embedded = {
|
|
|
8788
9068
|
if (legacyAllowResult) results.push(legacyAllowResult);
|
|
8789
9069
|
return results;
|
|
8790
9070
|
}
|
|
8791
|
-
// src/generators/claude-settings.ts
|
|
9071
|
+
// src/generators/claude/claude-settings.ts
|
|
8792
9072
|
const HookEntrySchema = z.object({
|
|
8793
9073
|
type: z.string().optional(),
|
|
8794
9074
|
command: z.string().optional()
|
|
@@ -8945,7 +9225,7 @@ async function generateClaudeSettings(ctx) {
|
|
|
8945
9225
|
}
|
|
8946
9226
|
return results;
|
|
8947
9227
|
}
|
|
8948
|
-
// src/generators/release-it.ts
|
|
9228
|
+
// src/generators/release/release-it.ts
|
|
8949
9229
|
function buildConfig$3(ci, isMonorepo) {
|
|
8950
9230
|
const config = {
|
|
8951
9231
|
$schema: "https://unpkg.com/release-it/schema/release-it.json",
|
|
@@ -8995,8 +9275,8 @@ async function generateReleaseIt(ctx) {
|
|
|
8995
9275
|
description: "Generated .release-it.json"
|
|
8996
9276
|
};
|
|
8997
9277
|
}
|
|
8998
|
-
// src/generators/changesets.ts
|
|
8999
|
-
function buildConfig$2(defaultBranch) {
|
|
9278
|
+
// src/generators/release/changesets.ts
|
|
9279
|
+
function buildConfig$2(defaultBranch, privateRoot) {
|
|
9000
9280
|
return {
|
|
9001
9281
|
$schema: "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
9002
9282
|
changelog: "@changesets/cli/changelog",
|
|
@@ -9006,7 +9286,11 @@ function buildConfig$2(defaultBranch) {
|
|
|
9006
9286
|
access: "public",
|
|
9007
9287
|
baseBranch: defaultBranch,
|
|
9008
9288
|
updateInternalDependencies: "patch",
|
|
9009
|
-
ignore: []
|
|
9289
|
+
ignore: [],
|
|
9290
|
+
...privateRoot ? { privatePackages: {
|
|
9291
|
+
version: true,
|
|
9292
|
+
tag: true
|
|
9293
|
+
} } : {}
|
|
9010
9294
|
};
|
|
9011
9295
|
}
|
|
9012
9296
|
async function generateChangesets(ctx) {
|
|
@@ -9016,9 +9300,9 @@ async function generateChangesets(ctx) {
|
|
|
9016
9300
|
action: "skipped",
|
|
9017
9301
|
description: "Changesets not requested"
|
|
9018
9302
|
};
|
|
9019
|
-
const
|
|
9020
|
-
const
|
|
9021
|
-
if (
|
|
9303
|
+
const privateRoot = ctx.config.structure !== "monorepo" && ctx.packageJson?.private === true;
|
|
9304
|
+
const content = JSON.stringify(buildConfig$2(configuredDefaultBranch(ctx.read(".tooling.json")), privateRoot), null, 2) + "\n";
|
|
9305
|
+
if (ctx.read(filePath)) return {
|
|
9022
9306
|
filePath,
|
|
9023
9307
|
action: "skipped",
|
|
9024
9308
|
description: "Existing changesets config preserved"
|
|
@@ -9026,11 +9310,11 @@ async function generateChangesets(ctx) {
|
|
|
9026
9310
|
ctx.write(filePath, content);
|
|
9027
9311
|
return {
|
|
9028
9312
|
filePath,
|
|
9029
|
-
action:
|
|
9313
|
+
action: "created",
|
|
9030
9314
|
description: "Generated .changeset/config.json"
|
|
9031
9315
|
};
|
|
9032
9316
|
}
|
|
9033
|
-
// src/generators/lefthook.ts
|
|
9317
|
+
// src/generators/lint-format/lefthook.ts
|
|
9034
9318
|
const LINT_COMMAND = "pnpm exec oxlint --no-error-on-unmatched-pattern {staged_files}";
|
|
9035
9319
|
function formatCommandFor(formatter) {
|
|
9036
9320
|
return formatter === "prettier" ? "pnpm exec prettier --ignore-unknown --no-error-on-unmatched-pattern --write {staged_files}" : "pnpm exec oxfmt --no-error-on-unmatched-pattern {staged_files}";
|
|
@@ -9604,7 +9888,7 @@ function matchStatusBlock(content) {
|
|
|
9604
9888
|
quoted: statusQuoted
|
|
9605
9889
|
};
|
|
9606
9890
|
}
|
|
9607
|
-
// src/generators/claude-md.ts
|
|
9891
|
+
// src/generators/claude/claude-md.ts
|
|
9608
9892
|
const FILE = "CLAUDE.md";
|
|
9609
9893
|
function codeList(words) {
|
|
9610
9894
|
return words.map((word) => `\`${word}\``).join(", ");
|
|
@@ -9869,18 +10153,18 @@ function webUiGuideBody() {
|
|
|
9869
10153
|
"@types/node": "24.19.2",
|
|
9870
10154
|
"@vitest/coverage-v8": "5.0.5",
|
|
9871
10155
|
"commit-and-tag-version": "13.3.0",
|
|
9872
|
-
"knip": "6.
|
|
10156
|
+
"knip": "6.44.0",
|
|
9873
10157
|
"lefthook": "2.2.2",
|
|
9874
|
-
"modern-web-guidance": "0.0.
|
|
9875
|
-
"oxfmt": "0.
|
|
9876
|
-
"oxlint": "1.
|
|
10158
|
+
"modern-web-guidance": "0.0.196",
|
|
10159
|
+
"oxfmt": "0.75.0",
|
|
10160
|
+
"oxlint": "1.90.0",
|
|
9877
10161
|
"oxlint-tsgolint": "7.0.2005",
|
|
9878
10162
|
"prettier": "3.9.10",
|
|
9879
10163
|
"release-it": "21.1.1",
|
|
9880
|
-
"tsdown": "0.23.
|
|
10164
|
+
"tsdown": "0.23.4",
|
|
9881
10165
|
"typescript": "6.0.3",
|
|
9882
10166
|
"vitest": "5.0.5",
|
|
9883
|
-
"pnpm": "11.28.
|
|
10167
|
+
"pnpm": "11.28.9"
|
|
9884
10168
|
}["modern-web-guidance"]}`;
|
|
9885
10169
|
return [
|
|
9886
10170
|
"# Web UI",
|
|
@@ -10284,7 +10568,7 @@ async function generateClaudeMd(ctx) {
|
|
|
10284
10568
|
syncAgentsMdLink(ctx)
|
|
10285
10569
|
];
|
|
10286
10570
|
}
|
|
10287
|
-
// src/generators/versionrc.ts
|
|
10571
|
+
// src/generators/release/versionrc.ts
|
|
10288
10572
|
function buildConfig() {
|
|
10289
10573
|
return {
|
|
10290
10574
|
header: "# Changelog\n\nAll notable changes to this project will be documented in this file.\n",
|
|
@@ -10349,7 +10633,7 @@ async function generateVersionrc(ctx) {
|
|
|
10349
10633
|
description: "Generated .versionrc.json"
|
|
10350
10634
|
};
|
|
10351
10635
|
}
|
|
10352
|
-
// src/generators/stale-ci-workflows.ts
|
|
10636
|
+
// src/generators/ci/stale-ci-workflows.ts
|
|
10353
10637
|
async function generateStaleCiWorkflows(ctx) {
|
|
10354
10638
|
const ci = ctx.config.ci;
|
|
10355
10639
|
if (ci === "none") return [];
|
|
@@ -10430,7 +10714,7 @@ async function runGenerators(ctx) {
|
|
|
10430
10714
|
results.push(saveToolingConfig(ctx, ctx.config));
|
|
10431
10715
|
return results;
|
|
10432
10716
|
}
|
|
10433
|
-
// src/
|
|
10717
|
+
// src/generators/generator-failures.ts
|
|
10434
10718
|
function failedResults(results) {
|
|
10435
10719
|
return results.filter((r) => r.action === "failed");
|
|
10436
10720
|
}
|
|
@@ -10443,7 +10727,7 @@ function reportFailures(failed, command) {
|
|
|
10443
10727
|
function generateMigratePrompt(results, config, detected) {
|
|
10444
10728
|
const sections = [];
|
|
10445
10729
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
10446
|
-
sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.
|
|
10730
|
+
sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.106.0 repo:sync\` on ${timestamp}_\n`);
|
|
10447
10731
|
const changed = results.filter((r) => r.action === "created" || r.action === "updated" || r.action === "archived");
|
|
10448
10732
|
if (changed.length > 0) {
|
|
10449
10733
|
const items = changed.map((r) => {
|
|
@@ -10554,7 +10838,7 @@ function addTestGenerationTasks(tasks, results) {
|
|
|
10554
10838
|
A starter test was created at \`test/example.test.ts\`. Review \`src/\` and create additional tests covering exported functions and edge cases.
|
|
10555
10839
|
`);
|
|
10556
10840
|
}
|
|
10557
|
-
// src/commands/repo-init.ts
|
|
10841
|
+
// src/commands/repo/repo-init.ts
|
|
10558
10842
|
function logDetectionSummary(ctx) {
|
|
10559
10843
|
if (ctx.config.publishDocker) {
|
|
10560
10844
|
const publishablePackages = detectContextDockerPackages(ctx).filter((pkg) => pkg.publish);
|
|
@@ -12105,7 +12389,7 @@ function parseListFlag(rawArgs, flag) {
|
|
|
12105
12389
|
}
|
|
12106
12390
|
return values.flatMap((value) => value.split(",")).map((value) => value.trim()).filter((value) => value.length > 0);
|
|
12107
12391
|
}
|
|
12108
|
-
// src/commands/repo-run-checks.ts
|
|
12392
|
+
// src/commands/repo/repo-run-checks.ts
|
|
12109
12393
|
const CHECKS = [
|
|
12110
12394
|
{ name: "build" },
|
|
12111
12395
|
{ name: "typecheck" },
|
|
@@ -12492,7 +12776,7 @@ const WORKFLOW_DIR_PREFIXES = [".forgejo/workflows/", ".github/workflows/"];
|
|
|
12492
12776
|
function isWorkflowDirPath(filePath) {
|
|
12493
12777
|
return WORKFLOW_DIR_PREFIXES.some((prefix) => filePath.startsWith(prefix));
|
|
12494
12778
|
}
|
|
12495
|
-
// src/commands/workflow-apt-steps.ts
|
|
12779
|
+
// src/commands/repo/workflow-apt-steps.ts
|
|
12496
12780
|
const APT_INSTALL = /\bapt(?:-get)?(?:\s+-\S+)*\s+install\b/g;
|
|
12497
12781
|
const COMMAND_END = /&&|\|\||;|\|/;
|
|
12498
12782
|
function workflowFiles(targetDir) {
|
|
@@ -12575,7 +12859,7 @@ function findWorkflowAptSteps(targetDir) {
|
|
|
12575
12859
|
}
|
|
12576
12860
|
return steps.toSorted((a, b) => a.file.localeCompare(b.file));
|
|
12577
12861
|
}
|
|
12578
|
-
// src/commands/sync-gates.ts
|
|
12862
|
+
// src/commands/repo/sync-gates.ts
|
|
12579
12863
|
function runReleaseTargetGate(config, targetDir) {
|
|
12580
12864
|
const file = releaseTargetConflict(config.stack, config.releaseStrategy, targetDir);
|
|
12581
12865
|
if (!file) return false;
|
|
@@ -12657,6 +12941,91 @@ function runVersionStampGate(config, targetDir, releaseStrategy) {
|
|
|
12657
12941
|
}
|
|
12658
12942
|
return offenders;
|
|
12659
12943
|
}
|
|
12944
|
+
function describeAssetEntry(entry, index) {
|
|
12945
|
+
const named = entry.file ?? (entry.files === void 0 ? "" : entry.files.join(", "));
|
|
12946
|
+
return named === "" ? `releaseAssets[${String(index)}]` : `releaseAssets[${String(index)}] ("${named}")`;
|
|
12947
|
+
}
|
|
12948
|
+
function runSnapshotConfigGate(config, targetDir, structure) {
|
|
12949
|
+
let offenders = 0;
|
|
12950
|
+
const releaseAssets = config?.releaseAssets ?? [];
|
|
12951
|
+
for (const [index, entry] of releaseAssets.entries()) {
|
|
12952
|
+
if (entry.file === void 0 !== (entry.files === void 0)) continue;
|
|
12953
|
+
log$1.error(`.tooling.json ${describeAssetEntry(entry, index)} sets ${entry.file === void 0 ? "neither" : "both"} file and files. Exactly one names the asset: keep file for a single path, or files for the globs the build writes.`);
|
|
12954
|
+
offenders++;
|
|
12955
|
+
}
|
|
12956
|
+
const snapshot = config?.snapshot;
|
|
12957
|
+
if (!snapshot) return offenders;
|
|
12958
|
+
const knownPackages = getMonorepoPackages(targetDir).map((pkg) => pkg.name);
|
|
12959
|
+
if (structure !== "monorepo") {
|
|
12960
|
+
const rootName = readPackageJson(targetDir)?.name;
|
|
12961
|
+
if (rootName !== void 0) knownPackages.push(rootName);
|
|
12962
|
+
}
|
|
12963
|
+
const listed = snapshot.packages;
|
|
12964
|
+
if ((listed === void 0 || listed.length === 0) && structure === "monorepo") {
|
|
12965
|
+
log$1.error(`.tooling.json#snapshot is set on a monorepo but names no packages, and bst will not choose them for you: most monorepos have packages nobody installs from a snapshot. List the ones to snapshot under snapshot.packages. This repo has: ${knownPackages.length === 0 ? "none under packages/" : knownPackages.join(", ")}.`);
|
|
12966
|
+
offenders++;
|
|
12967
|
+
}
|
|
12968
|
+
for (const name of listed ?? []) {
|
|
12969
|
+
if (knownPackages.includes(name)) continue;
|
|
12970
|
+
log$1.error(`.tooling.json#snapshot.packages names "${name}", which has no package.json behind it. release:snapshot resolves every name to a package directory, and would fail mid-publish over this one. Fix the name or drop it. This repo has: ${knownPackages.join(", ")}.`);
|
|
12971
|
+
offenders++;
|
|
12972
|
+
}
|
|
12973
|
+
if (structure !== "monorepo") return offenders;
|
|
12974
|
+
for (const [index, entry] of releaseAssets.entries()) {
|
|
12975
|
+
if (entry.package !== void 0) continue;
|
|
12976
|
+
log$1.error(`.tooling.json ${describeAssetEntry(entry, index)} names no package, but snapshot is set on a monorepo and a snapshot is cut per package, so it must know which package this asset serves. Set package to the package it serves (this repo has: ${knownPackages.join(", ")}).`);
|
|
12977
|
+
offenders++;
|
|
12978
|
+
}
|
|
12979
|
+
for (const [index, entry] of (config?.versionStamp ?? []).entries()) {
|
|
12980
|
+
if (entry.package !== void 0) continue;
|
|
12981
|
+
log$1.error(`.tooling.json versionStamp[${String(index)}] ("${entry.file}") names no package, but snapshot is set on a monorepo and a stamp carries the version of the release it belongs to. Set package to the package whose release it stamps (this repo has: ${knownPackages.join(", ")}).`);
|
|
12982
|
+
offenders++;
|
|
12983
|
+
}
|
|
12984
|
+
return offenders;
|
|
12985
|
+
}
|
|
12986
|
+
const ChangesetPrivatePackagesSchema = z.looseObject({ privatePackages: z.union([z.boolean(), z.looseObject({
|
|
12987
|
+
version: z.boolean().optional(),
|
|
12988
|
+
tag: z.boolean().optional()
|
|
12989
|
+
})]).optional() });
|
|
12990
|
+
function changesetsTagsPrivatePackages(targetDir) {
|
|
12991
|
+
const configPath = path.join(targetDir, ".changeset", "config.json");
|
|
12992
|
+
if (!existsSync(configPath)) return void 0;
|
|
12993
|
+
let data;
|
|
12994
|
+
try {
|
|
12995
|
+
data = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
12996
|
+
} catch (_error) {
|
|
12997
|
+
return;
|
|
12998
|
+
}
|
|
12999
|
+
const parsed = ChangesetPrivatePackagesSchema.safeParse(data);
|
|
13000
|
+
if (!parsed.success) return void 0;
|
|
13001
|
+
const privatePackages = parsed.data.privatePackages;
|
|
13002
|
+
if (privatePackages === void 0) return false;
|
|
13003
|
+
if (typeof privatePackages === "boolean") return privatePackages;
|
|
13004
|
+
return privatePackages.tag === true;
|
|
13005
|
+
}
|
|
13006
|
+
function runPrivateReleaseAdvisory(config, saved, targetDir) {
|
|
13007
|
+
if (config.ci !== "github" || config.releaseStrategy !== "changesets") return [];
|
|
13008
|
+
const messages = [];
|
|
13009
|
+
const tagFix = "Set \"privatePackages\": { \"version\": true, \"tag\": true } in .changeset/config.json";
|
|
13010
|
+
if (config.structure === "monorepo") {
|
|
13011
|
+
if (changesetsTagsPrivatePackages(targetDir) === true) return [];
|
|
13012
|
+
const workspacePackages = getMonorepoPackages(targetDir);
|
|
13013
|
+
for (const name of saved?.snapshot?.packages ?? []) {
|
|
13014
|
+
const pkg = workspacePackages.find((candidate) => candidate.name === name);
|
|
13015
|
+
if (pkg === void 0 || readPackageJson(pkg.dir)?.private !== true) continue;
|
|
13016
|
+
const message = `.tooling.json#snapshot.packages names "${name}", whose package.json is private. Its snapshots ship, because bst cuts them itself, but changesets skips a private package, so its stable releases never will. ${tagFix}, or drop "${name}" from snapshot.packages.`;
|
|
13017
|
+
log$1.warn(message);
|
|
13018
|
+
messages.push(message);
|
|
13019
|
+
}
|
|
13020
|
+
return messages;
|
|
13021
|
+
}
|
|
13022
|
+
if (readPackageJson(targetDir)?.private !== true) return [];
|
|
13023
|
+
if (changesetsTagsPrivatePackages(targetDir) !== false) return [];
|
|
13024
|
+
const message = `The root package is private, and .changeset/config.json never turns privatePackages.tag on, so changesets skips it: this repo versions nothing, tags nothing and publishes nothing. ${tagFix}, or drop "private": true from package.json.`;
|
|
13025
|
+
log$1.warn(message);
|
|
13026
|
+
messages.push(message);
|
|
13027
|
+
return messages;
|
|
13028
|
+
}
|
|
12660
13029
|
function warnStaleChecksAdd(config) {
|
|
12661
13030
|
const stale = staleChecksAddNames(config);
|
|
12662
13031
|
if (stale.length === 0) return;
|
|
@@ -12802,7 +13171,7 @@ function runToolchainGate(targetDir) {
|
|
|
12802
13171
|
if (!declared) return 0;
|
|
12803
13172
|
return checkDeclaredToolsActive(targetDir, declared);
|
|
12804
13173
|
}
|
|
12805
|
-
// src/commands/repo-sync.ts
|
|
13174
|
+
// src/commands/repo/repo-sync.ts
|
|
12806
13175
|
const rawLog$1 = (msg) => console.log(msg);
|
|
12807
13176
|
const syncCommand = defineCommand({
|
|
12808
13177
|
meta: {
|
|
@@ -12841,7 +13210,7 @@ const syncCommand = defineCommand({
|
|
|
12841
13210
|
},
|
|
12842
13211
|
json: {
|
|
12843
13212
|
type: "boolean",
|
|
12844
|
-
description: "Emit one JSON document: status (up-to-date | drift | workflow-drift | failed), actionable, failed, checkOnlyImages, aptSteps, inertAgentKeys, warnCount, exitCode. --check only: the write mode prompts and inherits child streams."
|
|
13213
|
+
description: "Emit one JSON document: status (up-to-date | drift | workflow-drift | failed), actionable, failed, checkOnlyImages, aptSteps, inertAgentKeys, privateRelease, warnCount, exitCode. --check only: the write mode prompts and inherits child streams."
|
|
12845
13214
|
}
|
|
12846
13215
|
},
|
|
12847
13216
|
async run({ args }) {
|
|
@@ -12906,6 +13275,15 @@ async function runUpdateReport(targetDir, flags = {}, options = {}) {
|
|
|
12906
13275
|
const config = mergeWithSavedConfig(buildDefaultConfig(targetDir, flags), saved);
|
|
12907
13276
|
runReleaseTargetGate(config, targetDir);
|
|
12908
13277
|
runVersionStampGate(saved, targetDir, config.releaseStrategy);
|
|
13278
|
+
if (runSnapshotConfigGate(saved, targetDir, config.structure) > 0) {
|
|
13279
|
+
process.exitCode = 1;
|
|
13280
|
+
return {
|
|
13281
|
+
status: "stopped",
|
|
13282
|
+
results: [],
|
|
13283
|
+
install: "not-run"
|
|
13284
|
+
};
|
|
13285
|
+
}
|
|
13286
|
+
runPrivateReleaseAdvisory(config, saved, targetDir);
|
|
12909
13287
|
if (runPublishConfigGate(config, targetDir) > 0) {
|
|
12910
13288
|
process.exitCode = 1;
|
|
12911
13289
|
return {
|
|
@@ -12935,12 +13313,13 @@ function gateFailure() {
|
|
|
12935
13313
|
checkOnlyImages: [],
|
|
12936
13314
|
aptSteps: [],
|
|
12937
13315
|
inertAgentKeys: [],
|
|
13316
|
+
privateRelease: [],
|
|
12938
13317
|
warnCount: 0,
|
|
12939
13318
|
exitCode: 1
|
|
12940
13319
|
};
|
|
12941
13320
|
}
|
|
12942
13321
|
function advisoryWarnCount(advisories) {
|
|
12943
|
-
return advisories.checkOnlyImages.length + advisories.aptSteps.length + (advisories.inertAgentKeys.length > 0 ? 1 : 0);
|
|
13322
|
+
return advisories.checkOnlyImages.length + advisories.aptSteps.length + advisories.privateRelease.length + (advisories.inertAgentKeys.length > 0 ? 1 : 0);
|
|
12944
13323
|
}
|
|
12945
13324
|
function upToDateReport(advisories) {
|
|
12946
13325
|
const warnCount = advisoryWarnCount(advisories);
|
|
@@ -12954,6 +13333,7 @@ function upToDateReport(advisories) {
|
|
|
12954
13333
|
checkOnlyImages: advisories.checkOnlyImages,
|
|
12955
13334
|
aptSteps: advisories.aptSteps,
|
|
12956
13335
|
inertAgentKeys: advisories.inertAgentKeys,
|
|
13336
|
+
privateRelease: advisories.privateRelease,
|
|
12957
13337
|
warnCount,
|
|
12958
13338
|
exitCode: 0
|
|
12959
13339
|
};
|
|
@@ -12971,12 +13351,14 @@ async function runCheckReport(targetDir) {
|
|
|
12971
13351
|
const config = saved ? mergeWithSavedConfig(detected, saved) : detected;
|
|
12972
13352
|
if (runReleaseTargetGate(config, targetDir)) return gateFailure();
|
|
12973
13353
|
if (runVersionStampGate(saved, targetDir, config.releaseStrategy) > 0) return gateFailure();
|
|
13354
|
+
if (runSnapshotConfigGate(saved, targetDir, config.structure) > 0) return gateFailure();
|
|
12974
13355
|
if (runPublishConfigGate(config, targetDir) > 0) return gateFailure();
|
|
12975
13356
|
if (runToolchainGate(targetDir) > 0) return gateFailure();
|
|
12976
13357
|
const advisories = {
|
|
12977
13358
|
checkOnlyImages: runCheckOnlyImageGate(config, targetDir, dockerDiscovery),
|
|
12978
13359
|
aptSteps: runWorkflowAptGate(targetDir),
|
|
12979
|
-
inertAgentKeys: runInertAgentSettingsGate(saved)
|
|
13360
|
+
inertAgentKeys: runInertAgentSettingsGate(saved),
|
|
13361
|
+
privateRelease: runPrivateReleaseAdvisory(config, saved, targetDir)
|
|
12980
13362
|
};
|
|
12981
13363
|
const { ctx, pendingWrites } = createDryRunContext(config, dockerDiscovery);
|
|
12982
13364
|
logDetectionSummary(ctx);
|
|
@@ -12993,6 +13375,7 @@ async function runCheckReport(targetDir) {
|
|
|
12993
13375
|
checkOnlyImages: [],
|
|
12994
13376
|
aptSteps: [],
|
|
12995
13377
|
inertAgentKeys: [],
|
|
13378
|
+
privateRelease: [],
|
|
12996
13379
|
warnCount: 0,
|
|
12997
13380
|
exitCode: 1
|
|
12998
13381
|
};
|
|
@@ -13008,6 +13391,7 @@ async function runCheckReport(targetDir) {
|
|
|
13008
13391
|
checkOnlyImages: advisories.checkOnlyImages,
|
|
13009
13392
|
aptSteps: advisories.aptSteps,
|
|
13010
13393
|
inertAgentKeys: advisories.inertAgentKeys,
|
|
13394
|
+
privateRelease: advisories.privateRelease,
|
|
13011
13395
|
warnCount,
|
|
13012
13396
|
exitCode: 0
|
|
13013
13397
|
};
|
|
@@ -13019,6 +13403,7 @@ async function runCheckReport(targetDir) {
|
|
|
13019
13403
|
checkOnlyImages: [],
|
|
13020
13404
|
aptSteps: [],
|
|
13021
13405
|
inertAgentKeys: [],
|
|
13406
|
+
privateRelease: [],
|
|
13022
13407
|
warnCount: 0,
|
|
13023
13408
|
exitCode: 1
|
|
13024
13409
|
};
|
|
@@ -13129,6 +13514,7 @@ async function findOpenPr(executor, conn, head, signal = null) {
|
|
|
13129
13514
|
const PullListItemSchema = z.object({
|
|
13130
13515
|
number: z.number(),
|
|
13131
13516
|
title: z.string().nullish(),
|
|
13517
|
+
body: z.string().nullish(),
|
|
13132
13518
|
head: z.object({
|
|
13133
13519
|
ref: z.string(),
|
|
13134
13520
|
repo: z.object({ full_name: z.string() }).nullish()
|
|
@@ -13176,6 +13562,7 @@ async function listPulls(executor, conn, options = {}) {
|
|
|
13176
13562
|
const items = parsed.data.map((pr) => ({
|
|
13177
13563
|
number: pr.number,
|
|
13178
13564
|
title: pr.title ?? null,
|
|
13565
|
+
body: pr.body ?? null,
|
|
13179
13566
|
headRef: pr.head.ref,
|
|
13180
13567
|
headRepo: pr.head.repo?.full_name ?? null,
|
|
13181
13568
|
baseRef: pr.base?.ref ?? null,
|
|
@@ -13255,6 +13642,7 @@ const PrDetailSchema = z.object({
|
|
|
13255
13642
|
draft: z.boolean(),
|
|
13256
13643
|
merged: z.boolean(),
|
|
13257
13644
|
mergeable: z.boolean().nullish(),
|
|
13645
|
+
merge_commit_sha: z.string().nullish(),
|
|
13258
13646
|
state: z.string()
|
|
13259
13647
|
});
|
|
13260
13648
|
function parsePrDetailOrThrow(data) {
|
|
@@ -13262,6 +13650,10 @@ function parsePrDetailOrThrow(data) {
|
|
|
13262
13650
|
if (!parsed.success) throw new UnexpectedError(`Unexpected PR detail response: ${parsed.error.message}`);
|
|
13263
13651
|
return parsed.data;
|
|
13264
13652
|
}
|
|
13653
|
+
const MERGE_COMMIT_SHA = /^[0-9a-f]{7,64}$/;
|
|
13654
|
+
function isMergeCommitSha(value) {
|
|
13655
|
+
return value !== void 0 && value !== null && MERGE_COMMIT_SHA.test(value);
|
|
13656
|
+
}
|
|
13265
13657
|
function normalizePrDetail(data) {
|
|
13266
13658
|
return {
|
|
13267
13659
|
head: {
|
|
@@ -13277,6 +13669,7 @@ function normalizePrDetail(data) {
|
|
|
13277
13669
|
draft: data.draft,
|
|
13278
13670
|
merged: data.merged,
|
|
13279
13671
|
mergeable: data.mergeable ?? null,
|
|
13672
|
+
mergeCommitSha: isMergeCommitSha(data.merge_commit_sha) ? data.merge_commit_sha : null,
|
|
13280
13673
|
state: data.state
|
|
13281
13674
|
};
|
|
13282
13675
|
}
|
|
@@ -13321,6 +13714,21 @@ async function retargetPr(executor, conn, prNumber, base) {
|
|
|
13321
13714
|
resource: `#${String(prNumber)}`
|
|
13322
13715
|
});
|
|
13323
13716
|
}
|
|
13717
|
+
async function reopenPr(executor, conn, prNumber) {
|
|
13718
|
+
const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/pulls/${String(prNumber)}`;
|
|
13719
|
+
const res = await executor.fetch(url, {
|
|
13720
|
+
method: "PATCH",
|
|
13721
|
+
headers: {
|
|
13722
|
+
Authorization: `token ${conn.token}`,
|
|
13723
|
+
"Content-Type": "application/json"
|
|
13724
|
+
},
|
|
13725
|
+
body: JSON.stringify({ state: "open" })
|
|
13726
|
+
}, { idempotent: true });
|
|
13727
|
+
if (!res.ok) await throwForgejoFailure(res, {
|
|
13728
|
+
verb: "reopen PR",
|
|
13729
|
+
resource: `#${String(prNumber)}`
|
|
13730
|
+
});
|
|
13731
|
+
}
|
|
13324
13732
|
const PrContentSchema = z.object({
|
|
13325
13733
|
title: z.string(),
|
|
13326
13734
|
body: z.string().nullish()
|
|
@@ -13437,7 +13845,6 @@ function readRootPackage(executor, cwd) {
|
|
|
13437
13845
|
if (!content) return null;
|
|
13438
13846
|
const pkg = parsePackageJson(content);
|
|
13439
13847
|
if (!pkg?.name || !pkg.version) return null;
|
|
13440
|
-
if (pkg.private) return null;
|
|
13441
13848
|
return {
|
|
13442
13849
|
name: pkg.name,
|
|
13443
13850
|
version: pkg.version
|
|
@@ -13711,7 +14118,7 @@ function floatingFamilies(packages, remoteSet, pushedTags) {
|
|
|
13711
14118
|
function prereleaseTag(families, tag) {
|
|
13712
14119
|
for (const entry of families) {
|
|
13713
14120
|
const version = entry.family.versionOfExact(tag);
|
|
13714
|
-
if (version !== void 0) return isPrerelease(version);
|
|
14121
|
+
if (version !== void 0) return isPrerelease$1(version);
|
|
13715
14122
|
}
|
|
13716
14123
|
return false;
|
|
13717
14124
|
}
|
|
@@ -13766,7 +14173,7 @@ async function runPublishMode(executor, config, bumped) {
|
|
|
13766
14173
|
family: changesetsTagFamily(p.name),
|
|
13767
14174
|
version: p.version
|
|
13768
14175
|
}));
|
|
13769
|
-
const bumpedPrerelease = new Map(bumped.map((p) => [p.tag, isPrerelease(p.version)]));
|
|
14176
|
+
const bumpedPrerelease = new Map(bumped.map((p) => [p.tag, isPrerelease$1(p.version)]));
|
|
13770
14177
|
function prereleaseFor(tag) {
|
|
13771
14178
|
const own = bumpedPrerelease.get(tag);
|
|
13772
14179
|
if (own !== void 0) return own;
|
|
@@ -13905,7 +14312,11 @@ function readBumpedSet(executor, config) {
|
|
|
13905
14312
|
bumped.push({
|
|
13906
14313
|
name: after.name,
|
|
13907
14314
|
version,
|
|
13908
|
-
tag:
|
|
14315
|
+
tag: releaseTag({
|
|
14316
|
+
name: after.name,
|
|
14317
|
+
version,
|
|
14318
|
+
root: candidate.root
|
|
14319
|
+
}),
|
|
13909
14320
|
private: after.private ?? false,
|
|
13910
14321
|
access: readAccess(after.publishConfig)
|
|
13911
14322
|
});
|
|
@@ -14010,7 +14421,7 @@ async function configureGitIdentity(executor, platform, cwd, conn, signal = null
|
|
|
14010
14421
|
email
|
|
14011
14422
|
};
|
|
14012
14423
|
}
|
|
14013
|
-
// src/commands/release-changesets.ts
|
|
14424
|
+
// src/commands/release/release-changesets.ts
|
|
14014
14425
|
const releaseForgejoCommand = defineCommand({
|
|
14015
14426
|
meta: {
|
|
14016
14427
|
name: "release:changesets",
|
|
@@ -14042,12 +14453,19 @@ const releaseForgejoCommand = defineCommand({
|
|
|
14042
14453
|
const outputFile = process.env["GITHUB_OUTPUT"];
|
|
14043
14454
|
if (outputFile) try {
|
|
14044
14455
|
const tag = result.tags[0] ?? "";
|
|
14045
|
-
appendFileSync(outputFile, `published=true\ntag=${tag}\n`);
|
|
14456
|
+
appendFileSync(outputFile, `published=true\ntag=${tag}\nversion=${versionFromTag(tag)}\n`);
|
|
14046
14457
|
} catch (_error) {}
|
|
14047
14458
|
}
|
|
14048
14459
|
if (result.mode === "none") process.exitCode = 0;
|
|
14049
14460
|
}
|
|
14050
14461
|
});
|
|
14462
|
+
function versionFromTag(tag) {
|
|
14463
|
+
if (tag === "") return "";
|
|
14464
|
+
if (tag.startsWith("v") && !tag.includes("@")) return tag.slice(1);
|
|
14465
|
+
const at = tag.lastIndexOf("@");
|
|
14466
|
+
if (at <= 0) return "";
|
|
14467
|
+
return tag.slice(at + 1);
|
|
14468
|
+
}
|
|
14051
14469
|
function releasePayload(result, dryRun) {
|
|
14052
14470
|
if (result.mode === "version") return {
|
|
14053
14471
|
mode: "version",
|
|
@@ -14257,7 +14675,7 @@ function dispatchGitHub(options, executor) {
|
|
|
14257
14675
|
inputs: options.inputs
|
|
14258
14676
|
};
|
|
14259
14677
|
}
|
|
14260
|
-
// src/commands/release-trigger.ts
|
|
14678
|
+
// src/commands/release/release-trigger.ts
|
|
14261
14679
|
const releaseTriggerCommand = defineCommand({
|
|
14262
14680
|
meta: {
|
|
14263
14681
|
name: "release:trigger",
|
|
@@ -15502,7 +15920,8 @@ function forgejoPrEditHost(fetcher, conn) {
|
|
|
15502
15920
|
readLive: (number) => getPrEditState(fetcher, conn, number),
|
|
15503
15921
|
branchExists: (name) => branchExists(fetcher, conn, name),
|
|
15504
15922
|
setBase: (number, base) => retargetPr(fetcher, conn, number, base),
|
|
15505
|
-
ready: (number, write) => updatePr(fetcher, conn, number, { title: write.title })
|
|
15923
|
+
ready: (number, write) => updatePr(fetcher, conn, number, { title: write.title }),
|
|
15924
|
+
reopen: (number) => reopenPr(fetcher, conn, number)
|
|
15506
15925
|
};
|
|
15507
15926
|
}
|
|
15508
15927
|
// src/release/github-pr-host.ts
|
|
@@ -15754,6 +16173,15 @@ function githubPrEditHost(executor, cwd, repository) {
|
|
|
15754
16173
|
]);
|
|
15755
16174
|
if (result.exitCode !== 0) throw new FatalError(`Failed to retarget PR #${String(number)}: ${result.stderr || result.stdout}`);
|
|
15756
16175
|
},
|
|
16176
|
+
async reopen(number) {
|
|
16177
|
+
const result = await runGh$1(executor, cwd, [
|
|
16178
|
+
"pr",
|
|
16179
|
+
"reopen",
|
|
16180
|
+
String(number),
|
|
16181
|
+
...target
|
|
16182
|
+
]);
|
|
16183
|
+
if (result.exitCode !== 0) throw new FatalError(`Failed to reopen PR #${String(number)}: ${result.stderr || result.stdout}`);
|
|
16184
|
+
},
|
|
15757
16185
|
async ready(number, write) {
|
|
15758
16186
|
if (write.draft) {
|
|
15759
16187
|
const result = await runGh$1(executor, cwd, [
|
|
@@ -18542,6 +18970,30 @@ function walkUnits(text, boxes) {
|
|
|
18542
18970
|
if (section !== void 0) return section.index;
|
|
18543
18971
|
return loneBoxUnit;
|
|
18544
18972
|
};
|
|
18973
|
+
const walkHeading = (heading, index) => {
|
|
18974
|
+
const level = (heading[1] ?? "").length;
|
|
18975
|
+
while (open.length > 0 && (open[open.length - 1]?.level ?? 0) >= level) open.pop();
|
|
18976
|
+
loneBoxUnit = null;
|
|
18977
|
+
const headingText = (heading[2] ?? "").trim();
|
|
18978
|
+
const label = taskLabelId(headingText);
|
|
18979
|
+
if (label === null) {
|
|
18980
|
+
unitAtLine[index] = inEffect();
|
|
18981
|
+
return;
|
|
18982
|
+
}
|
|
18983
|
+
const unit = {
|
|
18984
|
+
key: headingText,
|
|
18985
|
+
task: planTask(headingText, label),
|
|
18986
|
+
boxes: []
|
|
18987
|
+
};
|
|
18988
|
+
const unitIndex = units.length;
|
|
18989
|
+
units.push(unit);
|
|
18990
|
+
open.push({
|
|
18991
|
+
level,
|
|
18992
|
+
unit,
|
|
18993
|
+
index: unitIndex
|
|
18994
|
+
});
|
|
18995
|
+
unitAtLine[index] = unitIndex;
|
|
18996
|
+
};
|
|
18545
18997
|
for (const [index, rawLine] of lines.entries()) {
|
|
18546
18998
|
const line = rawLine ?? "";
|
|
18547
18999
|
if (fenced[index] === true) {
|
|
@@ -18550,28 +19002,7 @@ function walkUnits(text, boxes) {
|
|
|
18550
19002
|
}
|
|
18551
19003
|
const heading = HEADING.exec(line);
|
|
18552
19004
|
if (heading !== null) {
|
|
18553
|
-
|
|
18554
|
-
while (open.length > 0 && (open[open.length - 1]?.level ?? 0) >= level) open.pop();
|
|
18555
|
-
loneBoxUnit = null;
|
|
18556
|
-
const headingText = (heading[2] ?? "").trim();
|
|
18557
|
-
const label = taskLabelId(headingText);
|
|
18558
|
-
if (label === null) {
|
|
18559
|
-
unitAtLine[index] = inEffect();
|
|
18560
|
-
continue;
|
|
18561
|
-
}
|
|
18562
|
-
const unit = {
|
|
18563
|
-
key: headingText,
|
|
18564
|
-
task: planTask(headingText, label),
|
|
18565
|
-
boxes: []
|
|
18566
|
-
};
|
|
18567
|
-
const unitIndex = units.length;
|
|
18568
|
-
units.push(unit);
|
|
18569
|
-
open.push({
|
|
18570
|
-
level,
|
|
18571
|
-
unit,
|
|
18572
|
-
index: unitIndex
|
|
18573
|
-
});
|
|
18574
|
-
unitAtLine[index] = unitIndex;
|
|
19005
|
+
walkHeading(heading, index);
|
|
18575
19006
|
continue;
|
|
18576
19007
|
}
|
|
18577
19008
|
const box = boxAtLine.get(index);
|
|
@@ -19030,7 +19461,7 @@ function issueFacts(issue) {
|
|
|
19030
19461
|
url: issue.url
|
|
19031
19462
|
};
|
|
19032
19463
|
}
|
|
19033
|
-
async function resolveTarget(git, forge, defaultBranch, ref, checkoutHead) {
|
|
19464
|
+
async function resolveTarget$1(git, forge, defaultBranch, ref, checkoutHead) {
|
|
19034
19465
|
const resolved = {
|
|
19035
19466
|
kind: ref === null ? "branch" : "issue",
|
|
19036
19467
|
branch: null,
|
|
@@ -19297,7 +19728,7 @@ async function commitsSection({ git, resolved }) {
|
|
|
19297
19728
|
}
|
|
19298
19729
|
async function buildWorkStatus(deps, ref) {
|
|
19299
19730
|
const { git, forge, docsExtraDirs, defaultBranch, agentLogin, checkoutHead = false } = deps;
|
|
19300
|
-
const resolved = await resolveTarget(git, forge, defaultBranch, ref, checkoutHead);
|
|
19731
|
+
const resolved = await resolveTarget$1(git, forge, defaultBranch, ref, checkoutHead);
|
|
19301
19732
|
const forgeDown = resolved.failed ?? resolved.forgeDown;
|
|
19302
19733
|
const inputs = {
|
|
19303
19734
|
git,
|
|
@@ -20390,7 +20821,7 @@ async function readClosedIssueClaims(executor, options) {
|
|
|
20390
20821
|
return null;
|
|
20391
20822
|
}
|
|
20392
20823
|
}
|
|
20393
|
-
// src/commands/pr-create.ts
|
|
20824
|
+
// src/commands/pr/pr-create.ts
|
|
20394
20825
|
const prCreateCommand = defineCommand({
|
|
20395
20826
|
meta: {
|
|
20396
20827
|
name: "pr:create",
|
|
@@ -20482,8 +20913,9 @@ function isOpen(live) {
|
|
|
20482
20913
|
return live.state === "open" && live.merged === false;
|
|
20483
20914
|
}
|
|
20484
20915
|
function notOpenMessage(prNumber, live) {
|
|
20485
|
-
const
|
|
20486
|
-
return `Pull request
|
|
20916
|
+
const number = `#${String(prNumber)}`;
|
|
20917
|
+
if (live.merged) return `Pull request ${number} is merged, so it has no base or draft state left to change.`;
|
|
20918
|
+
return `Pull request ${number} is ${live.state}, so it has no base or draft state left to change. Run \`pr:reopen ${String(prNumber)}\` first if this work is still live.`;
|
|
20487
20919
|
}
|
|
20488
20920
|
async function runPrRetarget(host, options) {
|
|
20489
20921
|
const live = await host.readLive(options.number);
|
|
@@ -20579,8 +21011,47 @@ async function runPrReady(host, options) {
|
|
|
20579
21011
|
dryRun: false
|
|
20580
21012
|
};
|
|
20581
21013
|
}
|
|
21014
|
+
async function runPrReopen(host, options) {
|
|
21015
|
+
const live = await host.readLive(options.number);
|
|
21016
|
+
if (live.merged === true) throw new FatalError(`Pull request #${String(options.number)} was merged, so there is nothing to reopen -- open a new pull request for further work.`);
|
|
21017
|
+
if (live.state === "open") return {
|
|
21018
|
+
action: "already-open",
|
|
21019
|
+
number: options.number,
|
|
21020
|
+
url: live.url,
|
|
21021
|
+
title: live.title,
|
|
21022
|
+
head: live.head,
|
|
21023
|
+
base: live.base,
|
|
21024
|
+
draft: live.draft,
|
|
21025
|
+
dryRun: options.dryRun
|
|
21026
|
+
};
|
|
21027
|
+
if (live.state !== "closed") throw new FatalError(`Pull request #${String(options.number)} reports the state "${live.state}", which this command has no rule for -- it reopens a pull request reported as closed, and guesses at no state it did not expect.`);
|
|
21028
|
+
if (options.dryRun) return {
|
|
21029
|
+
action: "would-reopen",
|
|
21030
|
+
number: options.number,
|
|
21031
|
+
url: live.url,
|
|
21032
|
+
title: live.title,
|
|
21033
|
+
head: live.head,
|
|
21034
|
+
base: live.base,
|
|
21035
|
+
draft: live.draft,
|
|
21036
|
+
dryRun: true
|
|
21037
|
+
};
|
|
21038
|
+
await host.reopen(options.number);
|
|
21039
|
+
const recheck = await host.readLive(options.number);
|
|
21040
|
+
if (!isOpen(recheck)) throw new FatalError(`Pull request #${String(options.number)} still reports \`${recheck.state}\` after the request to reopen it -- reopen it in the forge's web interface.`);
|
|
21041
|
+
return {
|
|
21042
|
+
action: "reopened",
|
|
21043
|
+
number: options.number,
|
|
21044
|
+
url: recheck.url,
|
|
21045
|
+
title: recheck.title,
|
|
21046
|
+
head: recheck.head,
|
|
21047
|
+
base: recheck.base,
|
|
21048
|
+
draft: recheck.draft,
|
|
21049
|
+
dryRun: false
|
|
21050
|
+
};
|
|
21051
|
+
}
|
|
20582
21052
|
const PR_RETARGET_JSON_HELP = "Emit one JSON document: action (retargeted | unchanged | would-retarget), number, url, previousBase, base, head, mergeable (true | false | null, advice only), dryRun; a refusal is an error, never this document.";
|
|
20583
21053
|
const PR_READY_JSON_HELP = "Emit one JSON document: action (readied | retitled | already-ready | would-ready | would-retitle), number, url, previousTitle, title, draft, dryRun; a refusal is an error, never this document.";
|
|
21054
|
+
const PR_REOPEN_JSON_HELP = "Emit one JSON document: action (reopened | already-open | would-reopen), number, url, title, head, base, draft, dryRun; a refusal is an error, never this document.";
|
|
20584
21055
|
function mergeabilityLine(mergeable) {
|
|
20585
21056
|
if (mergeable === true) return "Mergeability: mergeable.";
|
|
20586
21057
|
if (mergeable === false) return "Mergeability: not mergeable -- advice, not a verdict.";
|
|
@@ -20603,6 +21074,16 @@ function renderPrReady(result) {
|
|
|
20603
21074
|
if (result.action === "would-ready") return `Dry run: pull request ${number} would stop being a draft, reading "${result.title}".`;
|
|
20604
21075
|
return `Dry run: pull request ${number} would read "${result.title}".`;
|
|
20605
21076
|
}
|
|
21077
|
+
function renderPrReopen(result) {
|
|
21078
|
+
const number = `#${String(result.number)}`;
|
|
21079
|
+
if (result.action === "reopened") {
|
|
21080
|
+
const lines = [`Pull request ${number} is open again (head "${result.head}" -> "${result.base}").`];
|
|
21081
|
+
if (result.draft) lines.push(`It is still a draft -- run pr:ready ${String(result.number)} when it is ready for review.`);
|
|
21082
|
+
return lines.join("\n");
|
|
21083
|
+
}
|
|
21084
|
+
if (result.action === "already-open") return `Pull request ${number} is already open.`;
|
|
21085
|
+
return `Dry run: pull request ${number} would be reopened.`;
|
|
21086
|
+
}
|
|
20606
21087
|
// ../forgejo/src/pr-number.ts
|
|
20607
21088
|
function parsePrNumber(raw) {
|
|
20608
21089
|
const value = Number(raw);
|
|
@@ -20610,13 +21091,22 @@ function parsePrNumber(raw) {
|
|
|
20610
21091
|
return value;
|
|
20611
21092
|
}
|
|
20612
21093
|
// src/release/pr-edit-host.ts
|
|
20613
|
-
function
|
|
21094
|
+
function resolvePrEditTarget(executor, cwd, repo) {
|
|
20614
21095
|
const resolved = resolveIssueTransport(executor, cwd, parseRepoTarget(repo));
|
|
20615
|
-
if (resolved.target.hostname === "github.com") return
|
|
21096
|
+
if (resolved.target.hostname === "github.com") return {
|
|
21097
|
+
host: githubPrEditHost(executor, cwd, resolved.target.repository),
|
|
21098
|
+
issues: resolved.api
|
|
21099
|
+
};
|
|
20616
21100
|
if (resolved.conn === void 0) throw new UnexpectedError(`Resolved a non-github.com target (${resolved.target.hostname}) with no Forgejo connection.`);
|
|
20617
|
-
return
|
|
21101
|
+
return {
|
|
21102
|
+
host: forgejoPrEditHost(executor, resolved.conn),
|
|
21103
|
+
issues: resolved.api
|
|
21104
|
+
};
|
|
20618
21105
|
}
|
|
20619
|
-
|
|
21106
|
+
function resolvePrEditHost(executor, cwd, repo) {
|
|
21107
|
+
return resolvePrEditTarget(executor, cwd, repo).host;
|
|
21108
|
+
}
|
|
21109
|
+
// src/commands/pr/pr-ready.ts
|
|
20620
21110
|
const prReadyCommand = defineCommand({
|
|
20621
21111
|
meta: {
|
|
20622
21112
|
name: "pr:ready",
|
|
@@ -20660,7 +21150,49 @@ const prReadyCommand = defineCommand({
|
|
|
20660
21150
|
out.text(renderPrReady(result));
|
|
20661
21151
|
}
|
|
20662
21152
|
});
|
|
20663
|
-
// src/commands/pr-
|
|
21153
|
+
// src/commands/pr/pr-reopen.ts
|
|
21154
|
+
const prReopenCommand = defineCommand({
|
|
21155
|
+
meta: {
|
|
21156
|
+
name: "pr:reopen",
|
|
21157
|
+
description: "Reopen a closed, unmerged pull request and confirm the forge reports it open, on Forgejo or GitHub. An already-open pull request is reported without writing; a merged one, or an issue, is refused"
|
|
21158
|
+
},
|
|
21159
|
+
args: {
|
|
21160
|
+
number: {
|
|
21161
|
+
type: "positional",
|
|
21162
|
+
required: true,
|
|
21163
|
+
description: "Pull request number"
|
|
21164
|
+
},
|
|
21165
|
+
repo: {
|
|
21166
|
+
type: "string",
|
|
21167
|
+
description: "Repository URL (default: this repo)"
|
|
21168
|
+
},
|
|
21169
|
+
"dry-run": {
|
|
21170
|
+
type: "boolean",
|
|
21171
|
+
description: "Run every read and report, but do not write"
|
|
21172
|
+
},
|
|
21173
|
+
json: {
|
|
21174
|
+
type: "boolean",
|
|
21175
|
+
description: PR_REOPEN_JSON_HELP
|
|
21176
|
+
},
|
|
21177
|
+
verbose: {
|
|
21178
|
+
type: "boolean",
|
|
21179
|
+
description: "Emit detailed debug output"
|
|
21180
|
+
}
|
|
21181
|
+
},
|
|
21182
|
+
async run({ args }) {
|
|
21183
|
+
const out = createCliOutput(args.json === true);
|
|
21184
|
+
const { host, issues } = resolvePrEditTarget(createRealExecutor$1(), process.cwd(), args.repo ?? void 0);
|
|
21185
|
+
const number = parsePrNumber(args.number);
|
|
21186
|
+
if (!(await issues.get(number)).isPullRequest) throw new FatalError(`#${String(number)} is an issue, not a pull request -- pr:reopen refuses to write issue state. Use \`pnpm exec bst issue:reopen ${String(number)}\` to reopen it.`);
|
|
21187
|
+
const result = await runPrReopen(host, {
|
|
21188
|
+
number,
|
|
21189
|
+
dryRun: args["dry-run"] === true
|
|
21190
|
+
});
|
|
21191
|
+
out.json(result);
|
|
21192
|
+
out.text(renderPrReopen(result));
|
|
21193
|
+
}
|
|
21194
|
+
});
|
|
21195
|
+
// src/commands/pr/pr-retarget.ts
|
|
20664
21196
|
const prRetargetCommand = defineCommand({
|
|
20665
21197
|
meta: {
|
|
20666
21198
|
name: "pr:retarget",
|
|
@@ -20707,7 +21239,7 @@ const prRetargetCommand = defineCommand({
|
|
|
20707
21239
|
out.text(renderPrRetarget(result));
|
|
20708
21240
|
}
|
|
20709
21241
|
});
|
|
20710
|
-
// src/commands/pr-update.ts
|
|
21242
|
+
// src/commands/pr/pr-update.ts
|
|
20711
21243
|
const prUpdateCommand = defineCommand({
|
|
20712
21244
|
meta: {
|
|
20713
21245
|
name: "pr:update",
|
|
@@ -20896,7 +21428,7 @@ async function runSimpleRelease(executor, config) {
|
|
|
20896
21428
|
if (!tag) throw new FatalError("Could not determine the new tag from git describe");
|
|
20897
21429
|
log$1.info(`Version ${version} tagged as ${tag}`);
|
|
20898
21430
|
if (config.dryRun) {
|
|
20899
|
-
const prerelease = isPrerelease(version);
|
|
21431
|
+
const prerelease = isPrerelease$1(version);
|
|
20900
21432
|
let slidingTags = [];
|
|
20901
21433
|
if (!config.noSlidingTags && !prerelease) slidingTags = computeSlidingTags(version);
|
|
20902
21434
|
log$1.info(`[dry-run] Would push to origin with --follow-tags`);
|
|
@@ -20982,7 +21514,7 @@ async function createPlatformRelease(executor, config, tag, version) {
|
|
|
20982
21514
|
const target = resolveTagCommit(executor, config.cwd, tag);
|
|
20983
21515
|
const { status: releaseStatus } = await ensureRelease(executor, config.platform.conn, tag, {
|
|
20984
21516
|
target,
|
|
20985
|
-
prerelease: isPrerelease(version)
|
|
21517
|
+
prerelease: isPrerelease$1(version)
|
|
20986
21518
|
});
|
|
20987
21519
|
if (releaseStatus === "exists") {
|
|
20988
21520
|
debug(config, `Release for ${tag} already exists, skipping`);
|
|
@@ -20997,7 +21529,7 @@ async function createPlatformRelease(executor, config, tag, version) {
|
|
|
20997
21529
|
tag,
|
|
20998
21530
|
"--generate-notes"
|
|
20999
21531
|
];
|
|
21000
|
-
if (isPrerelease(version)) ghArgs.push("--prerelease");
|
|
21532
|
+
if (isPrerelease$1(version)) ghArgs.push("--prerelease");
|
|
21001
21533
|
const ghResult = executor.exec("gh", ghArgs, { cwd: config.cwd });
|
|
21002
21534
|
debugExec(config, "gh release create", ghResult);
|
|
21003
21535
|
if (ghResult.exitCode !== 0) {
|
|
@@ -21007,7 +21539,7 @@ async function createPlatformRelease(executor, config, tag, version) {
|
|
|
21007
21539
|
log$1.info(`Created GitHub release for ${tag}`);
|
|
21008
21540
|
return true;
|
|
21009
21541
|
}
|
|
21010
|
-
// src/commands/release-simple.ts
|
|
21542
|
+
// src/commands/release/release-simple.ts
|
|
21011
21543
|
const releaseSimpleCommand = defineCommand({
|
|
21012
21544
|
meta: {
|
|
21013
21545
|
name: "release:simple",
|
|
@@ -21095,7 +21627,7 @@ const releaseSimpleCommand = defineCommand({
|
|
|
21095
21627
|
}
|
|
21096
21628
|
}
|
|
21097
21629
|
});
|
|
21098
|
-
// src/commands/release-assets.ts
|
|
21630
|
+
// src/commands/release/release-assets.ts
|
|
21099
21631
|
const releaseAssetsCommand = defineCommand({
|
|
21100
21632
|
meta: {
|
|
21101
21633
|
name: "release:assets",
|
|
@@ -21132,6 +21664,446 @@ const releaseAssetsCommand = defineCommand({
|
|
|
21132
21664
|
await runReleaseAssets(createRealExecutor$1(), config);
|
|
21133
21665
|
}
|
|
21134
21666
|
});
|
|
21667
|
+
// src/release/publish/snapshot-forge.ts
|
|
21668
|
+
const LIST_LIMIT = 100;
|
|
21669
|
+
function createSnapshotForge(executor, platform, cwd) {
|
|
21670
|
+
return platform.type === "github" ? githubForge(executor, cwd) : forgejoForge(executor, platform.conn);
|
|
21671
|
+
}
|
|
21672
|
+
function gh(executor, cwd, args, verb) {
|
|
21673
|
+
const result = executor.exec("gh", args, { cwd });
|
|
21674
|
+
if (result.exitCode !== 0) throw new TransientError(`GitHub ${verb} failed (exit ${String(result.exitCode)}):\n${childOutput(result)}`);
|
|
21675
|
+
return result;
|
|
21676
|
+
}
|
|
21677
|
+
const GitHubReleaseListSchema = z.array(z.looseObject({
|
|
21678
|
+
tagName: z.string(),
|
|
21679
|
+
createdAt: z.string().nullish()
|
|
21680
|
+
}));
|
|
21681
|
+
function parseGitHubReleaseList(stdout) {
|
|
21682
|
+
let json;
|
|
21683
|
+
try {
|
|
21684
|
+
json = JSON.parse(stdout);
|
|
21685
|
+
} catch {
|
|
21686
|
+
throw new UnexpectedError(`Unexpected GitHub release list output: ${stdout.slice(0, 200)}`);
|
|
21687
|
+
}
|
|
21688
|
+
const parsed = GitHubReleaseListSchema.safeParse(json);
|
|
21689
|
+
if (!parsed.success) throw new UnexpectedError(`Unexpected GitHub release list response: ${parsed.error.message}`);
|
|
21690
|
+
return parsed.data.map((row) => ({
|
|
21691
|
+
tag: row.tagName,
|
|
21692
|
+
createdAt: row.createdAt ?? null
|
|
21693
|
+
}));
|
|
21694
|
+
}
|
|
21695
|
+
function githubForge(executor, cwd) {
|
|
21696
|
+
return {
|
|
21697
|
+
async releaseExists(tag) {
|
|
21698
|
+
return executor.exec("gh", [
|
|
21699
|
+
"release",
|
|
21700
|
+
"view",
|
|
21701
|
+
tag
|
|
21702
|
+
], { cwd }).exitCode === 0;
|
|
21703
|
+
},
|
|
21704
|
+
async createPrerelease(tag, options) {
|
|
21705
|
+
gh(executor, cwd, [
|
|
21706
|
+
"release",
|
|
21707
|
+
"create",
|
|
21708
|
+
tag,
|
|
21709
|
+
"--prerelease",
|
|
21710
|
+
"--target",
|
|
21711
|
+
options.target,
|
|
21712
|
+
"--title",
|
|
21713
|
+
tag,
|
|
21714
|
+
"--notes",
|
|
21715
|
+
options.notes
|
|
21716
|
+
], `release create ${tag}`);
|
|
21717
|
+
log$1.info(`Created prerelease ${tag} (GitHub)`);
|
|
21718
|
+
},
|
|
21719
|
+
async uploadAsset(tag, file) {
|
|
21720
|
+
gh(executor, cwd, [
|
|
21721
|
+
"release",
|
|
21722
|
+
"upload",
|
|
21723
|
+
tag,
|
|
21724
|
+
file.path,
|
|
21725
|
+
"--clobber"
|
|
21726
|
+
], `release upload ${file.name} to ${tag}`);
|
|
21727
|
+
log$1.info(`Uploaded ${file.name} to ${tag} (GitHub)`);
|
|
21728
|
+
},
|
|
21729
|
+
async listReleases() {
|
|
21730
|
+
return parseGitHubReleaseList(gh(executor, cwd, [
|
|
21731
|
+
"release",
|
|
21732
|
+
"list",
|
|
21733
|
+
"--json",
|
|
21734
|
+
"tagName,createdAt",
|
|
21735
|
+
"--limit",
|
|
21736
|
+
String(LIST_LIMIT)
|
|
21737
|
+
], "release list").stdout);
|
|
21738
|
+
},
|
|
21739
|
+
async deleteRelease(tag) {
|
|
21740
|
+
gh(executor, cwd, [
|
|
21741
|
+
"release",
|
|
21742
|
+
"delete",
|
|
21743
|
+
tag,
|
|
21744
|
+
"--cleanup-tag",
|
|
21745
|
+
"--yes"
|
|
21746
|
+
], `release delete ${tag}`);
|
|
21747
|
+
log$1.info(`Deleted ${tag} (GitHub)`);
|
|
21748
|
+
}
|
|
21749
|
+
};
|
|
21750
|
+
}
|
|
21751
|
+
function forgejoForge(executor, conn) {
|
|
21752
|
+
return {
|
|
21753
|
+
async releaseExists(tag) {
|
|
21754
|
+
return findRelease(executor, conn, tag);
|
|
21755
|
+
},
|
|
21756
|
+
async createPrerelease(tag, options) {
|
|
21757
|
+
await createRelease(executor, conn, tag, {
|
|
21758
|
+
prerelease: true,
|
|
21759
|
+
target: options.target,
|
|
21760
|
+
name: tag,
|
|
21761
|
+
body: options.notes
|
|
21762
|
+
});
|
|
21763
|
+
log$1.info(`Created prerelease ${tag} (Forgejo)`);
|
|
21764
|
+
},
|
|
21765
|
+
async uploadAsset(tag, file) {
|
|
21766
|
+
const fileBuffer = executor.readFileBuffer(file.path);
|
|
21767
|
+
if (fileBuffer === null) throw new FatalError(`Snapshot asset file not found: ${file.path}`);
|
|
21768
|
+
await uploadReleaseAsset(executor, conn, tag, {
|
|
21769
|
+
assetName: file.name,
|
|
21770
|
+
fileBuffer,
|
|
21771
|
+
replace: true
|
|
21772
|
+
});
|
|
21773
|
+
log$1.info(`Uploaded ${file.name} to ${tag} (Forgejo)`);
|
|
21774
|
+
},
|
|
21775
|
+
async listReleases() {
|
|
21776
|
+
return (await listReleases(executor, conn, { limit: LIST_LIMIT })).map((row) => ({
|
|
21777
|
+
tag: row.tag,
|
|
21778
|
+
createdAt: row.createdAt
|
|
21779
|
+
}));
|
|
21780
|
+
},
|
|
21781
|
+
async deleteRelease(tag) {
|
|
21782
|
+
const release = await getReleaseByTag(executor, conn, tag);
|
|
21783
|
+
if (release !== null) await deleteRelease(executor, conn, release.id);
|
|
21784
|
+
await deleteTag(executor, conn, tag);
|
|
21785
|
+
log$1.info(`Deleted ${tag} (Forgejo)`);
|
|
21786
|
+
}
|
|
21787
|
+
};
|
|
21788
|
+
}
|
|
21789
|
+
// src/release/publish/snapshot-version.ts
|
|
21790
|
+
const STATUS_FILE = ".bst-changeset-status.json";
|
|
21791
|
+
const ChangesetStatusSchema = z.looseObject({
|
|
21792
|
+
releases: z.array(z.looseObject({
|
|
21793
|
+
name: z.string(),
|
|
21794
|
+
newVersion: z.string()
|
|
21795
|
+
})),
|
|
21796
|
+
changesets: z.array(z.looseObject({
|
|
21797
|
+
summary: z.string(),
|
|
21798
|
+
releases: z.array(z.looseObject({ name: z.string() }))
|
|
21799
|
+
}))
|
|
21800
|
+
});
|
|
21801
|
+
function readChangesetStatus(executor, cwd) {
|
|
21802
|
+
const result = executor.exec("pnpm", [
|
|
21803
|
+
"changeset",
|
|
21804
|
+
"status",
|
|
21805
|
+
"--output",
|
|
21806
|
+
STATUS_FILE
|
|
21807
|
+
], { cwd });
|
|
21808
|
+
const statusPath = path.join(cwd, STATUS_FILE);
|
|
21809
|
+
try {
|
|
21810
|
+
if (result.exitCode !== 0) throw new FatalError(`\`changeset status\` failed (exit ${String(result.exitCode)}) -- a snapshot needs the version the pending changesets would give, and there is no fallback version:\n` + childOutput(result));
|
|
21811
|
+
const raw = executor.readFile(statusPath);
|
|
21812
|
+
if (raw === null) throw new FatalError(`\`changeset status\` exited zero but wrote no ${STATUS_FILE}:\n` + childOutput(result));
|
|
21813
|
+
const status = parseStatus(raw);
|
|
21814
|
+
if (status === null) throw new FatalError(`\`changeset status\` wrote a ${STATUS_FILE} this run cannot read:\n` + childOutput(result));
|
|
21815
|
+
return status;
|
|
21816
|
+
} finally {
|
|
21817
|
+
executor.removeDir(statusPath);
|
|
21818
|
+
}
|
|
21819
|
+
}
|
|
21820
|
+
function parseStatus(raw) {
|
|
21821
|
+
let json;
|
|
21822
|
+
try {
|
|
21823
|
+
json = JSON.parse(raw);
|
|
21824
|
+
} catch {
|
|
21825
|
+
return null;
|
|
21826
|
+
}
|
|
21827
|
+
const parsed = ChangesetStatusSchema.safeParse(json);
|
|
21828
|
+
return parsed.success ? parsed.data : null;
|
|
21829
|
+
}
|
|
21830
|
+
const SEMVER_CORE = /^(\d+)\.(\d+)\.(\d+)/;
|
|
21831
|
+
function snapshotVersion(input) {
|
|
21832
|
+
return `${input.nextVersion ?? raisePatch(input.currentVersion)}-${input.preid}.${input.build}`;
|
|
21833
|
+
}
|
|
21834
|
+
function raisePatch(currentVersion) {
|
|
21835
|
+
const [major, minor, patch] = SEMVER_CORE.exec(currentVersion)?.slice(1) ?? [];
|
|
21836
|
+
if (major === void 0 || minor === void 0 || patch === void 0) throw new FatalError(`Cannot snapshot ${currentVersion}: it carries no x.y.z core to raise a patch from, and no pending changeset gives this package a next version.`);
|
|
21837
|
+
return `${major}.${minor}.${String(Number(patch) + 1)}`;
|
|
21838
|
+
}
|
|
21839
|
+
// src/release/publish/snapshot.ts
|
|
21840
|
+
const DEFAULT_KEEP = 3;
|
|
21841
|
+
async function runReleaseSnapshot(executor, config) {
|
|
21842
|
+
const settings = readSnapshotSettings(config);
|
|
21843
|
+
const isMonorepo = isMonorepoRepo(executor, config);
|
|
21844
|
+
refuseUnownedEntries(config, isMonorepo);
|
|
21845
|
+
const packages = resolvePackages(executor, config, settings, isMonorepo);
|
|
21846
|
+
const build = resolveBuild(config);
|
|
21847
|
+
const target = resolveTarget(config);
|
|
21848
|
+
const status = readChangesetStatus(executor, config.cwd);
|
|
21849
|
+
debug(config, `Snapshotting ${String(packages.length)} package(s) at build ${build}`);
|
|
21850
|
+
const run = {
|
|
21851
|
+
executor,
|
|
21852
|
+
buildExecutor: config.captureBuildOutput ? capturingExecutor(executor) : executor,
|
|
21853
|
+
forge: config.dryRun ? inertForge() : createRealForge(executor, config),
|
|
21854
|
+
config,
|
|
21855
|
+
status,
|
|
21856
|
+
settings,
|
|
21857
|
+
target,
|
|
21858
|
+
build,
|
|
21859
|
+
isMonorepo
|
|
21860
|
+
};
|
|
21861
|
+
const results = [];
|
|
21862
|
+
let published = !config.dryRun && packages.length > 0;
|
|
21863
|
+
for (const pkg of packages) {
|
|
21864
|
+
const cut = await snapshotPackage(run, pkg);
|
|
21865
|
+
results.push(cut.result);
|
|
21866
|
+
published = published && cut.exists;
|
|
21867
|
+
}
|
|
21868
|
+
const result = {
|
|
21869
|
+
published,
|
|
21870
|
+
packages: results
|
|
21871
|
+
};
|
|
21872
|
+
appendOutputs(executor, config, result);
|
|
21873
|
+
return result;
|
|
21874
|
+
}
|
|
21875
|
+
function readSnapshotSettings(config) {
|
|
21876
|
+
const snapshot = config.toolingConfig?.snapshot;
|
|
21877
|
+
if (snapshot === void 0) throw new FatalError("release:snapshot needs a `snapshot` block in .tooling.json. Its `preid` is the prerelease identifier every snapshot version carries, and bst will not pick one for your channel.");
|
|
21878
|
+
return {
|
|
21879
|
+
preid: snapshot.preid,
|
|
21880
|
+
keep: snapshot.keep ?? DEFAULT_KEEP,
|
|
21881
|
+
packages: snapshot.packages
|
|
21882
|
+
};
|
|
21883
|
+
}
|
|
21884
|
+
function isMonorepoRepo(executor, config) {
|
|
21885
|
+
const structure = config.toolingConfig?.structure;
|
|
21886
|
+
if (structure !== void 0) return structure === "monorepo";
|
|
21887
|
+
return executor.readFile(path.join(config.cwd, "pnpm-workspace.yaml")) !== null;
|
|
21888
|
+
}
|
|
21889
|
+
function refuseUnownedEntries(config, isMonorepo) {
|
|
21890
|
+
if (!isMonorepo) return;
|
|
21891
|
+
const unowned = (config.toolingConfig?.releaseAssets ?? []).filter((entry) => entry.package === void 0);
|
|
21892
|
+
if (unowned.length > 0) {
|
|
21893
|
+
const entry = unowned[0];
|
|
21894
|
+
throw new FatalError(`release:snapshot cannot build a releaseAssets entry that names no package in a monorepo: ${JSON.stringify(entry)}. A snapshot uploads to one package's prerelease, so name the package the entry builds for.`);
|
|
21895
|
+
}
|
|
21896
|
+
const unownedStamp = (config.toolingConfig?.versionStamp ?? []).find((entry) => entry.package === void 0);
|
|
21897
|
+
if (unownedStamp !== void 0) throw new FatalError(`release:snapshot cannot stamp a versionStamp entry that names no package in a monorepo: ${JSON.stringify(unownedStamp)}. A snapshot cuts one version per package, so name the package whose release this entry stamps.`);
|
|
21898
|
+
}
|
|
21899
|
+
function resolvePackages(executor, config, settings, isMonorepo) {
|
|
21900
|
+
if (isMonorepo) {
|
|
21901
|
+
const listed = settings.packages;
|
|
21902
|
+
if (listed === void 0 || listed.length === 0) throw new FatalError("release:snapshot needs `snapshot.packages` in a monorepo: which packages a tester installs is the repo owner's call, and bst does not guess it.");
|
|
21903
|
+
const workspace = executor.listWorkspacePackages(config.cwd);
|
|
21904
|
+
return listed.map((name) => {
|
|
21905
|
+
const found = workspace.find((pkg) => pkg.name === name);
|
|
21906
|
+
if (found === void 0) throw unknownPackageName(name);
|
|
21907
|
+
return {
|
|
21908
|
+
name,
|
|
21909
|
+
currentVersion: found.version,
|
|
21910
|
+
dir: path.join(config.cwd, "packages", found.dir),
|
|
21911
|
+
root: false
|
|
21912
|
+
};
|
|
21913
|
+
});
|
|
21914
|
+
}
|
|
21915
|
+
const root = rootPackage(executor, config.cwd);
|
|
21916
|
+
for (const name of settings.packages ?? []) if (name !== root.name) throw unknownPackageName(name);
|
|
21917
|
+
return [root];
|
|
21918
|
+
}
|
|
21919
|
+
function unknownPackageName(name) {
|
|
21920
|
+
return new FatalError(`snapshot.packages names ${name}, which is not a workspace package of this repo. Spell it as its package.json does.`);
|
|
21921
|
+
}
|
|
21922
|
+
function rootPackage(executor, cwd) {
|
|
21923
|
+
const manifestPath = path.join(cwd, "package.json");
|
|
21924
|
+
const raw = executor.readFile(manifestPath);
|
|
21925
|
+
const pkg = raw === null ? void 0 : parsePackageJson(raw);
|
|
21926
|
+
if (pkg?.name === void 0 || pkg.version === void 0) throw new FatalError(`release:snapshot cannot snapshot the root package: ${manifestPath} carries no name or no version, and a snapshot version is raised from the version it holds.`);
|
|
21927
|
+
return {
|
|
21928
|
+
name: pkg.name,
|
|
21929
|
+
currentVersion: pkg.version,
|
|
21930
|
+
dir: cwd,
|
|
21931
|
+
root: true
|
|
21932
|
+
};
|
|
21933
|
+
}
|
|
21934
|
+
function resolveBuild(config) {
|
|
21935
|
+
const build = process.env["GITHUB_RUN_NUMBER"] ?? config.build;
|
|
21936
|
+
if (build === void 0 || build === "") throw new FatalError("release:snapshot needs a build number: GITHUB_RUN_NUMBER is what a CI job supplies, and outside CI --build <n> is the only source. Two cuts sharing a suffix collide on one tag.");
|
|
21937
|
+
return build;
|
|
21938
|
+
}
|
|
21939
|
+
function resolveTarget(config) {
|
|
21940
|
+
const target = process.env["GITHUB_SHA"] ?? "";
|
|
21941
|
+
if (target === "" && !config.dryRun) throw new FatalError("release:snapshot needs GITHUB_SHA: the prerelease targets the exact commit the job checked out, so the tag names the code it was built from. --dry-run is the only run that may go without it.");
|
|
21942
|
+
return target;
|
|
21943
|
+
}
|
|
21944
|
+
function createRealForge(executor, config) {
|
|
21945
|
+
if (config.platform === void 0) throw new FatalError("Platform connection is required for a snapshot release");
|
|
21946
|
+
return createSnapshotForge(executor, config.platform, config.cwd);
|
|
21947
|
+
}
|
|
21948
|
+
function inertForge() {
|
|
21949
|
+
return {
|
|
21950
|
+
async releaseExists() {
|
|
21951
|
+
return false;
|
|
21952
|
+
},
|
|
21953
|
+
async createPrerelease() {},
|
|
21954
|
+
async uploadAsset() {},
|
|
21955
|
+
async listReleases() {
|
|
21956
|
+
return [];
|
|
21957
|
+
},
|
|
21958
|
+
async deleteRelease() {}
|
|
21959
|
+
};
|
|
21960
|
+
}
|
|
21961
|
+
async function snapshotPackage(run, pkg) {
|
|
21962
|
+
const version = snapshotVersion({
|
|
21963
|
+
currentVersion: pkg.currentVersion,
|
|
21964
|
+
nextVersion: nextVersionFor(run.status, pkg.name),
|
|
21965
|
+
preid: run.settings.preid,
|
|
21966
|
+
build: run.build
|
|
21967
|
+
});
|
|
21968
|
+
const tag = releaseTag({
|
|
21969
|
+
name: pkg.name,
|
|
21970
|
+
version,
|
|
21971
|
+
root: pkg.root
|
|
21972
|
+
});
|
|
21973
|
+
const context = {
|
|
21974
|
+
packageName: pkg.name,
|
|
21975
|
+
version,
|
|
21976
|
+
tag,
|
|
21977
|
+
prerelease: true,
|
|
21978
|
+
buildNumber: run.build
|
|
21979
|
+
};
|
|
21980
|
+
if (run.config.dryRun) {
|
|
21981
|
+
log$1.info(`[dry-run] ${pkg.name} -> ${tag} (no forge call)`);
|
|
21982
|
+
return {
|
|
21983
|
+
result: {
|
|
21984
|
+
name: pkg.name,
|
|
21985
|
+
version,
|
|
21986
|
+
tag
|
|
21987
|
+
},
|
|
21988
|
+
exists: false
|
|
21989
|
+
};
|
|
21990
|
+
}
|
|
21991
|
+
writeWorkingTreeVersion(run, path.join(pkg.dir, "package.json"), version);
|
|
21992
|
+
const stamped = stampOwnedVersionFiles(run.executor, run.config.cwd, run.config.toolingConfig, context, run.isMonorepo);
|
|
21993
|
+
if (await run.forge.releaseExists(tag)) log$1.info(`Prerelease ${tag} already exists, uploading its assets with replacement`);
|
|
21994
|
+
else await run.forge.createPrerelease(tag, {
|
|
21995
|
+
target: run.target,
|
|
21996
|
+
notes: releaseNotes(run.status, pkg.name)
|
|
21997
|
+
});
|
|
21998
|
+
const targets = ownedTargets(run.executor, run.config.cwd, run.config.toolingConfig, pkg.name, run.isMonorepo);
|
|
21999
|
+
const files = buildTargets(run.buildExecutor, targets, context, run.config);
|
|
22000
|
+
verifyStamp(run.executor, stamped);
|
|
22001
|
+
for (const file of files) await run.forge.uploadAsset(tag, {
|
|
22002
|
+
path: file.path,
|
|
22003
|
+
name: file.name ?? path.basename(file.path)
|
|
22004
|
+
});
|
|
22005
|
+
await pruneSnapshots(run.forge, pkg, run.settings);
|
|
22006
|
+
return {
|
|
22007
|
+
result: {
|
|
22008
|
+
name: pkg.name,
|
|
22009
|
+
version,
|
|
22010
|
+
tag
|
|
22011
|
+
},
|
|
22012
|
+
exists: true
|
|
22013
|
+
};
|
|
22014
|
+
}
|
|
22015
|
+
function nextVersionFor(status, packageName) {
|
|
22016
|
+
return status.releases.find((release) => release.name === packageName)?.newVersion ?? null;
|
|
22017
|
+
}
|
|
22018
|
+
function releaseNotes(status, packageName) {
|
|
22019
|
+
return status.changesets.filter((changeset) => changeset.releases.some((release) => release.name === packageName)).map((changeset) => `- ${changeset.summary.trim()}`).join("\n");
|
|
22020
|
+
}
|
|
22021
|
+
function writeWorkingTreeVersion(run, manifestPath, version) {
|
|
22022
|
+
const raw = run.executor.readFile(manifestPath);
|
|
22023
|
+
if (raw === null) throw new FatalError(`Cannot write the snapshot version: ${manifestPath} is not readable.`);
|
|
22024
|
+
run.executor.writeFile(manifestPath, applyEdits(raw, modify(raw, ["version"], version, {})));
|
|
22025
|
+
debug(run.config, `Wrote ${version} into ${manifestPath} (working tree only)`);
|
|
22026
|
+
}
|
|
22027
|
+
async function pruneSnapshots(forge, pkg, settings) {
|
|
22028
|
+
const prefix = pkg.root ? "v" : `${pkg.name}@`;
|
|
22029
|
+
const pattern = new RegExp(`^${escapeRegExp$1(prefix)}\\d+\\.\\d+\\.\\d+-${escapeRegExp$1(settings.preid)}\\.\\d+$`);
|
|
22030
|
+
const rows = (await forge.listReleases()).filter((row) => pattern.test(row.tag)).toSorted(byNewestFirst);
|
|
22031
|
+
for (const row of rows.slice(settings.keep)) await forge.deleteRelease(row.tag);
|
|
22032
|
+
}
|
|
22033
|
+
function escapeRegExp$1(value) {
|
|
22034
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
22035
|
+
}
|
|
22036
|
+
function byNewestFirst(a, b) {
|
|
22037
|
+
const left = a.createdAt ?? "";
|
|
22038
|
+
const right = b.createdAt ?? "";
|
|
22039
|
+
if (left === right) return 0;
|
|
22040
|
+
return left < right ? 1 : -1;
|
|
22041
|
+
}
|
|
22042
|
+
function capturingExecutor(executor) {
|
|
22043
|
+
return {
|
|
22044
|
+
...executor,
|
|
22045
|
+
execInherit(file, args, options) {
|
|
22046
|
+
const result = executor.exec(file, args, options);
|
|
22047
|
+
if (result.exitCode !== 0) throw new FatalError(`Asset build failed (exit ${String(result.exitCode)}):\n${childOutput(result)}`);
|
|
22048
|
+
}
|
|
22049
|
+
};
|
|
22050
|
+
}
|
|
22051
|
+
function appendOutputs(executor, config, result) {
|
|
22052
|
+
const outputFile = process.env["GITHUB_OUTPUT"];
|
|
22053
|
+
if (outputFile === void 0 || outputFile === "") return;
|
|
22054
|
+
const first = result.packages[0];
|
|
22055
|
+
executor.appendFile(outputFile, `published=${String(result.published)}\nversion=${first?.version ?? ""}\ntag=${first?.tag ?? ""}\npackages=${JSON.stringify(result.packages)}\n`);
|
|
22056
|
+
debug(config, `Wrote snapshot outputs to ${outputFile}`);
|
|
22057
|
+
}
|
|
22058
|
+
// src/commands/release/release-snapshot.ts
|
|
22059
|
+
const releaseSnapshotCommand = defineCommand({
|
|
22060
|
+
meta: {
|
|
22061
|
+
name: "release:snapshot",
|
|
22062
|
+
description: "Cut the snapshot-channel prereleases configured in .tooling.json#snapshot: one prerelease per listed package at <version>-<preid>.<build>, with its assets, pruned back to `keep`. Never commits, never moves a floating tag."
|
|
22063
|
+
},
|
|
22064
|
+
args: {
|
|
22065
|
+
build: {
|
|
22066
|
+
type: "string",
|
|
22067
|
+
description: "Build number for the snapshot suffix. Outside CI, where GITHUB_RUN_NUMBER is unset, this is the only source and the command refuses without it"
|
|
22068
|
+
},
|
|
22069
|
+
"dry-run": {
|
|
22070
|
+
type: "boolean",
|
|
22071
|
+
description: "Compute and print the cut; write nothing and call no forge"
|
|
22072
|
+
},
|
|
22073
|
+
json: {
|
|
22074
|
+
type: "boolean",
|
|
22075
|
+
description: "Emit one JSON document: published (boolean) and packages (array of { name, version, tag }). Every key is always present. Asset builds run captured so the document is the only thing on either stream."
|
|
22076
|
+
},
|
|
22077
|
+
verbose: {
|
|
22078
|
+
type: "boolean",
|
|
22079
|
+
description: "Enable detailed debug logging (also enabled by TOOLING_DEBUG env var)"
|
|
22080
|
+
}
|
|
22081
|
+
},
|
|
22082
|
+
async run({ args }) {
|
|
22083
|
+
const out = createCliOutput(args.json === true);
|
|
22084
|
+
const cwd = process.cwd();
|
|
22085
|
+
const dryRun = args["dry-run"] === true;
|
|
22086
|
+
let platform;
|
|
22087
|
+
if (!dryRun) {
|
|
22088
|
+
const resolved = resolveConnection(cwd);
|
|
22089
|
+
platform = resolved.type === "forgejo" ? {
|
|
22090
|
+
type: "forgejo",
|
|
22091
|
+
conn: resolved.conn
|
|
22092
|
+
} : { type: "github" };
|
|
22093
|
+
}
|
|
22094
|
+
const config = {
|
|
22095
|
+
cwd,
|
|
22096
|
+
dryRun,
|
|
22097
|
+
verbose: args.verbose === true || isEnvVerbose(),
|
|
22098
|
+
toolingConfig: loadToolingConfig(cwd),
|
|
22099
|
+
platform,
|
|
22100
|
+
build: args.build,
|
|
22101
|
+
captureBuildOutput: args.json === true
|
|
22102
|
+
};
|
|
22103
|
+
const result = await runReleaseSnapshot(createRealExecutor$1(), config);
|
|
22104
|
+
out.json(result);
|
|
22105
|
+
}
|
|
22106
|
+
});
|
|
21135
22107
|
// src/lint-types/executor.ts
|
|
21136
22108
|
function runViaShim(args, cwd) {
|
|
21137
22109
|
const result = spawnViaShim("pnpm", args, {
|
|
@@ -21410,7 +22382,7 @@ const lintReportCommand = defineCommand({
|
|
|
21410
22382
|
process.exitCode = exitCode;
|
|
21411
22383
|
}
|
|
21412
22384
|
});
|
|
21413
|
-
// src/commands/publish-docker.ts
|
|
22385
|
+
// src/commands/docker/publish-docker.ts
|
|
21414
22386
|
function requireDockerCredentials(registryHost) {
|
|
21415
22387
|
const username = process.env["DOCKER_USERNAME"];
|
|
21416
22388
|
const password = process.env["DOCKER_PASSWORD"];
|
|
@@ -21485,7 +22457,7 @@ const publishDockerCommand = defineCommand({
|
|
|
21485
22457
|
runDockerPublish(createRealExecutor$1(), config);
|
|
21486
22458
|
}
|
|
21487
22459
|
});
|
|
21488
|
-
// src/commands/docker-build.ts
|
|
22460
|
+
// src/commands/docker/docker-build.ts
|
|
21489
22461
|
function detectSubpackage(cwd) {
|
|
21490
22462
|
const parent = path.dirname(cwd);
|
|
21491
22463
|
if (path.basename(parent) === "packages" && existsSync(path.join(parent, "..", "package.json"))) return {
|
|
@@ -21838,7 +22810,7 @@ function composePs(executor, config) {
|
|
|
21838
22810
|
// src/docker-check/health.ts
|
|
21839
22811
|
const DOCKER_RUN_START_FAILURE_EXIT_CODE = 125;
|
|
21840
22812
|
const PROBE_TIMEOUT_SECONDS = "5";
|
|
21841
|
-
const PROBE_IMAGE = "curlimages/curl:8.23.0@sha256:
|
|
22813
|
+
const PROBE_IMAGE = "curlimages/curl:8.23.0@sha256:3fb7e13e5d179a845c97d78204f3f1064d1907037f26a3ebf91710571151fd93";
|
|
21842
22814
|
function getContainerHealth(containers, serviceName) {
|
|
21843
22815
|
return containers.find((c) => c.Service === serviceName)?.Health ?? "unknown";
|
|
21844
22816
|
}
|
|
@@ -22094,7 +23066,7 @@ function deriveProjectName(repoName, env = process.env) {
|
|
|
22094
23066
|
function sanitize(name) {
|
|
22095
23067
|
return name.replace(/^@[^/]+\//, "").toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
22096
23068
|
}
|
|
22097
|
-
// src/commands/docker-check.ts
|
|
23069
|
+
// src/commands/docker/docker-check.ts
|
|
22098
23070
|
function toHttpHealthChecks(checks) {
|
|
22099
23071
|
return checks.map((check) => ({
|
|
22100
23072
|
name: check.name,
|
|
@@ -22219,7 +23191,7 @@ const dockerCheckCommand = defineCommand({
|
|
|
22219
23191
|
}
|
|
22220
23192
|
}
|
|
22221
23193
|
});
|
|
22222
|
-
// src/commands/docker-sweep.ts
|
|
23194
|
+
// src/commands/docker/docker-sweep.ts
|
|
22223
23195
|
function parseMaxAgeHours(raw) {
|
|
22224
23196
|
const value = Number(raw);
|
|
22225
23197
|
if (raw.trim() === "" || !Number.isFinite(value) || value < 0) throw new FatalError(`--max-age must be a non-negative number of hours, got "${raw}"`);
|
|
@@ -23326,14 +24298,14 @@ function formatTimestamp(iso) {
|
|
|
23326
24298
|
if (Number.isNaN(date.getTime())) return iso;
|
|
23327
24299
|
return `${String(date.getUTCFullYear())}-${String(date.getUTCMonth() + 1).padStart(2, "0")}-${String(date.getUTCDate()).padStart(2, "0")}`;
|
|
23328
24300
|
}
|
|
23329
|
-
// src/commands/coverage-missing-summary.ts
|
|
24301
|
+
// src/commands/coverage-tracking/coverage-missing-summary.ts
|
|
23330
24302
|
const COVERAGE_SUMMARY_FILE$3 = "coverage/coverage-summary.json";
|
|
23331
24303
|
function missingSummaryMessage(targetDir) {
|
|
23332
24304
|
const base = `${COVERAGE_SUMMARY_FILE$3} not found. Run \`pnpm test:coverage\` first, or add "json-summary" to your vitest reporters.`;
|
|
23333
24305
|
const hint = diagnoseCheckScriptForwardingAt(targetDir);
|
|
23334
24306
|
return hint ? `${base}\n\n${hint}` : base;
|
|
23335
24307
|
}
|
|
23336
|
-
// src/commands/coverage-summary.ts
|
|
24308
|
+
// src/commands/coverage-tracking/coverage-summary.ts
|
|
23337
24309
|
const COVERAGE_SUMMARY_FILE$2 = "coverage/coverage-summary.json";
|
|
23338
24310
|
function readSummary(targetDir) {
|
|
23339
24311
|
const summaryPath = path.join(targetDir, COVERAGE_SUMMARY_FILE$2);
|
|
@@ -23397,10 +24369,9 @@ const coverageSummaryCommand = defineCommand({
|
|
|
23397
24369
|
function serializeBaseline(baseline) {
|
|
23398
24370
|
return JSON.stringify(baseline, null, 2) + "\n";
|
|
23399
24371
|
}
|
|
23400
|
-
// src/commands/coverage-check.ts
|
|
24372
|
+
// src/commands/coverage-tracking/coverage-check.ts
|
|
23401
24373
|
const COVERAGE_SUMMARY_FILE$1 = "coverage/coverage-summary.json";
|
|
23402
24374
|
const BASELINE_FILE$2 = "coverage-baseline.json";
|
|
23403
|
-
const MIGRATION_NOTICE = `${BASELINE_FILE$2} predates coverage.include scoping (no scope marker). Totals may have shifted because previously-untested files entered the denominator for the first time -- that is not necessarily a regression. This comparison is advisory only until the baseline is migrated: run \`pnpm test:coverage && pnpm exec bst coverage:check --update-baseline --reset\` once to adopt the honest, marked baseline. Normal gating resumes after that.`;
|
|
23404
24375
|
function applyBaselineUpdate$1(out, baselinePath, baseline, current, options) {
|
|
23405
24376
|
const { reset, floorPp } = options;
|
|
23406
24377
|
if (reset) {
|
|
@@ -23422,7 +24393,7 @@ function applyBaselineUpdate$1(out, baselinePath, baseline, current, options) {
|
|
|
23422
24393
|
const coverageCheckCommand = defineCommand({
|
|
23423
24394
|
meta: {
|
|
23424
24395
|
name: "coverage:check",
|
|
23425
|
-
description: "Compare the latest coverage run against coverage-baseline.json. Exits 1 when a total fails the comparison
|
|
24396
|
+
description: "Compare the latest coverage run against coverage-baseline.json. Exits 1 when a total fails the comparison."
|
|
23426
24397
|
},
|
|
23427
24398
|
args: {
|
|
23428
24399
|
dir: {
|
|
@@ -23437,7 +24408,7 @@ const coverageCheckCommand = defineCommand({
|
|
|
23437
24408
|
},
|
|
23438
24409
|
reset: {
|
|
23439
24410
|
type: "boolean",
|
|
23440
|
-
description: "With --update-baseline, rewrite coverage-baseline.json unconditionally, even when totals dropped.
|
|
24411
|
+
description: "With --update-baseline, rewrite coverage-baseline.json unconditionally, even when totals dropped."
|
|
23441
24412
|
},
|
|
23442
24413
|
"fail-on-missing-baseline": {
|
|
23443
24414
|
type: "boolean",
|
|
@@ -23446,7 +24417,7 @@ const coverageCheckCommand = defineCommand({
|
|
|
23446
24417
|
},
|
|
23447
24418
|
json: {
|
|
23448
24419
|
type: "boolean",
|
|
23449
|
-
description: "Emit one JSON document: status (disabled | baseline-created | missing-baseline | compared
|
|
24420
|
+
description: "Emit one JSON document: status (disabled | baseline-created | missing-baseline | compared), reason?, totals?, pass?, tolerancePp?, floorPp?. reason comes only with disabled; totals is {lines, statements, branches, functions} with baseline-created and missing-baseline, and [{key, baseline, current, delta, pass}] after a comparison, which alone carries pass, tolerancePp and floorPp?."
|
|
23450
24421
|
}
|
|
23451
24422
|
},
|
|
23452
24423
|
run({ args }) {
|
|
@@ -23488,21 +24459,19 @@ const coverageCheckCommand = defineCommand({
|
|
|
23488
24459
|
}
|
|
23489
24460
|
const baseline = parseBaseline(readFileSync(baselinePath, "utf-8"));
|
|
23490
24461
|
const result = compareTotals(baseline.totals, current.totals, config.tolerancePp, config.floorPp);
|
|
23491
|
-
const isLegacyBaseline = baseline.scope !== "include";
|
|
23492
24462
|
out.text(formatCompareDiff$1(result));
|
|
23493
|
-
if (isLegacyBaseline) out.notice(MIGRATION_NOTICE);
|
|
23494
24463
|
out.json({
|
|
23495
|
-
status:
|
|
24464
|
+
status: "compared",
|
|
23496
24465
|
...result
|
|
23497
24466
|
});
|
|
23498
24467
|
if (args["update-baseline"] === true) applyBaselineUpdate$1(out, baselinePath, baseline, current, {
|
|
23499
24468
|
reset: args.reset === true,
|
|
23500
24469
|
floorPp: config.floorPp
|
|
23501
24470
|
});
|
|
23502
|
-
if (!result.pass
|
|
24471
|
+
if (!result.pass) process.exitCode = 1;
|
|
23503
24472
|
}
|
|
23504
24473
|
});
|
|
23505
|
-
// src/commands/coverage-record.ts
|
|
24474
|
+
// src/commands/coverage-tracking/coverage-record.ts
|
|
23506
24475
|
const COVERAGE_SUMMARY_FILE = "coverage/coverage-summary.json";
|
|
23507
24476
|
const coverageRecordCommand = defineCommand({
|
|
23508
24477
|
meta: {
|
|
@@ -23572,7 +24541,7 @@ const coverageRecordCommand = defineCommand({
|
|
|
23572
24541
|
});
|
|
23573
24542
|
}
|
|
23574
24543
|
});
|
|
23575
|
-
// src/commands/coverage-status.ts
|
|
24544
|
+
// src/commands/coverage-tracking/coverage-status.ts
|
|
23576
24545
|
const coverageStatusCommand = defineCommand({
|
|
23577
24546
|
meta: {
|
|
23578
24547
|
name: "coverage:status",
|
|
@@ -23618,7 +24587,7 @@ const coverageStatusCommand = defineCommand({
|
|
|
23618
24587
|
out.text(formatTrendTable(trailing));
|
|
23619
24588
|
}
|
|
23620
24589
|
});
|
|
23621
|
-
// src/codebase-health/baseline.ts
|
|
24590
|
+
// src/codebase-health/baseline/baseline.ts
|
|
23622
24591
|
function serializeHealthBaseline(metrics, ceilings, sizeBudgets) {
|
|
23623
24592
|
const ordered = {};
|
|
23624
24593
|
for (const key of METRIC_KEYS) {
|
|
@@ -23640,7 +24609,7 @@ function writeHealthBaseline(targetDir, baseline) {
|
|
|
23640
24609
|
const format = healthFileFormatter(targetDir);
|
|
23641
24610
|
writeFileSync(path.join(targetDir, "health-baseline.json"), format("health-baseline.json", serializeHealthBaseline(baseline, baseline.moduleCeilings, baseline.sizeBudgets)));
|
|
23642
24611
|
}
|
|
23643
|
-
// src/codebase-health/exclude.ts
|
|
24612
|
+
// src/codebase-health/collect/exclude.ts
|
|
23644
24613
|
function normalize(rel) {
|
|
23645
24614
|
const posix = rel.replace(/\\/g, "/");
|
|
23646
24615
|
return posix.startsWith("./") ? posix.slice(2) : posix;
|
|
@@ -23665,7 +24634,7 @@ function createExcludeMatcher(patterns) {
|
|
|
23665
24634
|
return ancestors(normalized).some((dir) => isMatch(dir));
|
|
23666
24635
|
};
|
|
23667
24636
|
}
|
|
23668
|
-
// src/codebase-health/exempt-match.ts
|
|
24637
|
+
// src/codebase-health/collect/exempt-match.ts
|
|
23669
24638
|
function exemptKeyMatcher(key) {
|
|
23670
24639
|
if (!picomatch.scan(key).isGlob) return (path) => path === key;
|
|
23671
24640
|
const isMatch = picomatch(key, { dot: true });
|
|
@@ -23678,7 +24647,7 @@ function createExemptLookup(reasons) {
|
|
|
23678
24647
|
}));
|
|
23679
24648
|
return (path) => reasons[path] ?? globs.find((glob) => glob.matches(path))?.reason;
|
|
23680
24649
|
}
|
|
23681
|
-
// src/codebase-health/depcruise.ts
|
|
24650
|
+
// src/codebase-health/collect/depcruise.ts
|
|
23682
24651
|
const DependencySchema = z.object({
|
|
23683
24652
|
module: z.string(),
|
|
23684
24653
|
resolved: z.string(),
|
|
@@ -23938,7 +24907,7 @@ function collectGraphDetails(executor, config, isExcluded = () => false, sourceL
|
|
|
23938
24907
|
workspacePackages
|
|
23939
24908
|
}) };
|
|
23940
24909
|
}
|
|
23941
|
-
// src/codebase-health/workspace-packages.ts
|
|
24910
|
+
// src/codebase-health/collect/workspace-packages.ts
|
|
23942
24911
|
const PnpmWorkspaceSchema = z.object({ packages: z.array(z.string()).optional() });
|
|
23943
24912
|
const RootManifestSchema = z.object({ workspaces: z.union([z.array(z.string()), z.object({ packages: z.array(z.string()) })]).optional() });
|
|
23944
24913
|
const PackageNameSchema = z.object({ name: z.string() });
|
|
@@ -24032,7 +25001,7 @@ function listWorkspacePackageNames(executor) {
|
|
|
24032
25001
|
}
|
|
24033
25002
|
return names;
|
|
24034
25003
|
}
|
|
24035
|
-
// src/codebase-health/collect.ts
|
|
25004
|
+
// src/codebase-health/collect/collect.ts
|
|
24036
25005
|
function buildCollectConfig(config, opts) {
|
|
24037
25006
|
return {
|
|
24038
25007
|
src: config.src,
|
|
@@ -24431,7 +25400,7 @@ function isFlatOrBetter(baseline, current, currentCeilings = {}, sizes = []) {
|
|
|
24431
25400
|
});
|
|
24432
25401
|
return metricsFlat && ceilingsFlat && sizesFlat;
|
|
24433
25402
|
}
|
|
24434
|
-
// src/codebase-health/raise.ts
|
|
25403
|
+
// src/codebase-health/baseline/raise.ts
|
|
24435
25404
|
const SIZE_RAISE_FACTOR = 1.01;
|
|
24436
25405
|
function sizeRaiseValue(measured) {
|
|
24437
25406
|
return Math.floor(measured * SIZE_RAISE_FACTOR) + 1;
|
|
@@ -24820,7 +25789,7 @@ const CARRIED_RAISES_FIRST_LINE = "raises carried by this branch:";
|
|
|
24820
25789
|
function formatCarriedRaises(raises) {
|
|
24821
25790
|
return [CARRIED_RAISES_FIRST_LINE, ...raises.map((r) => ` ${r.leaf}: ${r.reference} -> ${r.current}`)].join("\n");
|
|
24822
25791
|
}
|
|
24823
|
-
// src/codebase-health/tighten.ts
|
|
25792
|
+
// src/codebase-health/baseline/tighten.ts
|
|
24824
25793
|
const GRAPH_METRIC_KEYS = new Set(METRIC_KEYS.filter((key) => key !== "crowdedDirectories"));
|
|
24825
25794
|
function isGraphMetric(key) {
|
|
24826
25795
|
return GRAPH_METRIC_KEYS.has(key);
|
|
@@ -25002,7 +25971,7 @@ function baselineUpdateRefusal(attribution) {
|
|
|
25002
25971
|
}
|
|
25003
25972
|
return null;
|
|
25004
25973
|
}
|
|
25005
|
-
// src/codebase-health/base-checkout.ts
|
|
25974
|
+
// src/codebase-health/baseline/base-checkout.ts
|
|
25006
25975
|
const TEMP_PREFIX = "bst-health-base-";
|
|
25007
25976
|
function withMergeBaseCheckout(executor, targetDir, mergeBase, use) {
|
|
25008
25977
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), TEMP_PREFIX));
|
|
@@ -25091,7 +26060,7 @@ function linkRelative(link, target) {
|
|
|
25091
26060
|
fs.symlinkSync(link, target);
|
|
25092
26061
|
} catch (_error) {}
|
|
25093
26062
|
}
|
|
25094
|
-
// src/codebase-health/base-outliers.ts
|
|
26063
|
+
// src/codebase-health/baseline/base-outliers.ts
|
|
25095
26064
|
function unavailable(reason) {
|
|
25096
26065
|
return {
|
|
25097
26066
|
status: "unavailable",
|
|
@@ -25120,7 +26089,7 @@ function measureBaseOutliers(opts) {
|
|
|
25120
26089
|
return unavailable(describeError$1(error));
|
|
25121
26090
|
}
|
|
25122
26091
|
}
|
|
25123
|
-
// src/codebase-health/size.ts
|
|
26092
|
+
// src/codebase-health/collect/size.ts
|
|
25124
26093
|
function byteLength(absolute) {
|
|
25125
26094
|
try {
|
|
25126
26095
|
const stats = statSync(absolute);
|
|
@@ -25371,7 +26340,7 @@ function findStaleEntries(baseline, details, exempt) {
|
|
|
25371
26340
|
}
|
|
25372
26341
|
return stale;
|
|
25373
26342
|
}
|
|
25374
|
-
// src/commands/health-check.ts
|
|
26343
|
+
// src/commands/health/health-check.ts
|
|
25375
26344
|
function assessSwitchOff(executor, targetDir, config, out) {
|
|
25376
26345
|
const read = readTargetReference(executor, targetDir, out);
|
|
25377
26346
|
if (read.kind === "unavailable") return void 0;
|
|
@@ -25597,7 +26566,7 @@ const healthCheckCommand = defineCommand({
|
|
|
25597
26566
|
if (!verdictPasses || graphUnavailable !== void 0) process.exitCode = 1;
|
|
25598
26567
|
}
|
|
25599
26568
|
});
|
|
25600
|
-
// src/commands/health-raise.ts
|
|
26569
|
+
// src/commands/health/health-raise.ts
|
|
25601
26570
|
const JsonValueSchema = z.json();
|
|
25602
26571
|
const TOOLING_FILE = ".tooling.json";
|
|
25603
26572
|
function collectExemptPairs(rawArgs) {
|
|
@@ -25715,7 +26684,7 @@ function writePlan(targetDir, plan) {
|
|
|
25715
26684
|
}
|
|
25716
26685
|
return wrote;
|
|
25717
26686
|
}
|
|
25718
|
-
// src/commands/health-tighten.ts
|
|
26687
|
+
// src/commands/health/health-tighten.ts
|
|
25719
26688
|
const BASELINE_FILE = "health-baseline.json";
|
|
25720
26689
|
function describePlan(plan) {
|
|
25721
26690
|
const lines = [];
|
|
@@ -25879,7 +26848,7 @@ function formatModuleReports(reports) {
|
|
|
25879
26848
|
}
|
|
25880
26849
|
return lines.join("\n");
|
|
25881
26850
|
}
|
|
25882
|
-
// src/commands/health-summary.ts
|
|
26851
|
+
// src/commands/health/health-summary.ts
|
|
25883
26852
|
function readCoverageNote(targetDir) {
|
|
25884
26853
|
const file = path.join(targetDir, "coverage-baseline.json");
|
|
25885
26854
|
if (!existsSync(file)) return void 0;
|
|
@@ -25984,7 +26953,7 @@ const healthSummaryCommand = defineCommand({
|
|
|
25984
26953
|
if (moduleReports !== void 0) out.text(formatModuleReports(moduleReports));
|
|
25985
26954
|
}
|
|
25986
26955
|
});
|
|
25987
|
-
// src/codebase-health/history.ts
|
|
26956
|
+
// src/codebase-health/baseline/history.ts
|
|
25988
26957
|
const HEALTH_HISTORY_FILE = "health-history.jsonl";
|
|
25989
26958
|
function appendHealthRecord(executor, config, record) {
|
|
25990
26959
|
return appendRecord(executor, {
|
|
@@ -25999,7 +26968,7 @@ function readHealthRecords(executor, config) {
|
|
|
25999
26968
|
historyFile: HEALTH_HISTORY_FILE
|
|
26000
26969
|
}, parseHealthHistoryLine);
|
|
26001
26970
|
}
|
|
26002
|
-
// src/commands/health-record.ts
|
|
26971
|
+
// src/commands/health/health-record.ts
|
|
26003
26972
|
const healthRecordCommand = defineCommand({
|
|
26004
26973
|
meta: {
|
|
26005
26974
|
name: "health:record",
|
|
@@ -26074,7 +27043,7 @@ const healthRecordCommand = defineCommand({
|
|
|
26074
27043
|
});
|
|
26075
27044
|
}
|
|
26076
27045
|
});
|
|
26077
|
-
// src/commands/health-status.ts
|
|
27046
|
+
// src/commands/health/health-status.ts
|
|
26078
27047
|
const healthStatusCommand = defineCommand({
|
|
26079
27048
|
meta: {
|
|
26080
27049
|
name: "health:status",
|
|
@@ -27433,7 +28402,7 @@ function formatReport(result) {
|
|
|
27433
28402
|
lines.push(`[x] docs: ${String(fatal.length)} violation(s).`, "", ...group(fatal), "The plan-lifecycle guide (`.agent/guides/plan-lifecycle.md`) is the spec for all of this.", "Reminder: a doc's DIRECTORY is the source of truth for done-ness -- not its Status line, not its checkboxes.");
|
|
27434
28403
|
return lines.join("\n");
|
|
27435
28404
|
}
|
|
27436
|
-
// src/commands/docs-check.ts
|
|
28405
|
+
// src/commands/docs/docs-check.ts
|
|
27437
28406
|
function runDocsCheck(exec, config, opts) {
|
|
27438
28407
|
const vc = { verbose: opts.verbose ?? false };
|
|
27439
28408
|
if (!config.enabled) {
|
|
@@ -27574,7 +28543,7 @@ function listOpenDocs(exec, config, options = {}) {
|
|
|
27574
28543
|
}
|
|
27575
28544
|
return docs.toSorted(byPath);
|
|
27576
28545
|
}
|
|
27577
|
-
// src/commands/docs-list.ts
|
|
28546
|
+
// src/commands/docs/docs-list.ts
|
|
27578
28547
|
function dayOf(iso) {
|
|
27579
28548
|
if (iso === void 0) return "unknown";
|
|
27580
28549
|
const day = iso.slice(0, 10);
|
|
@@ -27821,7 +28790,7 @@ function createRealRelocateExecutor(rootDir) {
|
|
|
27821
28790
|
}
|
|
27822
28791
|
};
|
|
27823
28792
|
}
|
|
27824
|
-
// src/commands/docs-delink.ts
|
|
28793
|
+
// src/commands/docs/docs-delink.ts
|
|
27825
28794
|
const RETIRED_DIR_NAMES = /* @__PURE__ */ new Set(["retired", "completed"]);
|
|
27826
28795
|
function assertRetiredDirs(dirs) {
|
|
27827
28796
|
if (dirs.length === 0) throw new FatalError("docs:delink: at least one retired/ directory is required");
|
|
@@ -28017,7 +28986,7 @@ function applyRelocatePlan(exec, plan) {
|
|
|
28017
28986
|
for (const move of plan.moves) if (move.status === "pending") exec.move(move.from, move.to);
|
|
28018
28987
|
for (const rewrite of plan.rewrites) exec.writeFile(rewrite.file, rewrite.content);
|
|
28019
28988
|
}
|
|
28020
|
-
// src/commands/docs-relocate.ts
|
|
28989
|
+
// src/commands/docs/docs-relocate.ts
|
|
28021
28990
|
function isExistingDirectory(exec, rel) {
|
|
28022
28991
|
return exec.exists(rel) && exec.readFile(rel) === void 0;
|
|
28023
28992
|
}
|
|
@@ -28116,7 +29085,7 @@ const docsRelocateCommand = defineCommand({
|
|
|
28116
29085
|
function localToday(now) {
|
|
28117
29086
|
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
|
28118
29087
|
}
|
|
28119
|
-
// src/commands/docs-retire.ts
|
|
29088
|
+
// src/commands/docs/docs-retire.ts
|
|
28120
29089
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
28121
29090
|
function validateRetireArgs(exec, src, opts) {
|
|
28122
29091
|
if (!isRetireVerb(opts.status)) throw new FatalError(`docs:retire: unrecognized --status "${opts.status}" (expected one of: ${RETIRE_VERBS.join(", ")})`);
|
|
@@ -28466,7 +29435,7 @@ async function runIssueCreate(executor, options) {
|
|
|
28466
29435
|
throw error;
|
|
28467
29436
|
}
|
|
28468
29437
|
}
|
|
28469
|
-
// src/commands/issue-view.ts
|
|
29438
|
+
// src/commands/issue/issue-view.ts
|
|
28470
29439
|
const issueViewCommand = defineCommand({
|
|
28471
29440
|
meta: {
|
|
28472
29441
|
name: "issue:view",
|
|
@@ -28505,7 +29474,7 @@ const issueViewCommand = defineCommand({
|
|
|
28505
29474
|
log$1.info(formatIssue(view));
|
|
28506
29475
|
}
|
|
28507
29476
|
});
|
|
28508
|
-
// src/commands/issue-list.ts
|
|
29477
|
+
// src/commands/issue/issue-list.ts
|
|
28509
29478
|
const issueListCommand = defineCommand({
|
|
28510
29479
|
meta: {
|
|
28511
29480
|
name: "issue:list",
|
|
@@ -28558,7 +29527,7 @@ const issueListCommand = defineCommand({
|
|
|
28558
29527
|
log$1.info(formatIssueList(result));
|
|
28559
29528
|
}
|
|
28560
29529
|
});
|
|
28561
|
-
// src/commands/issue-comment.ts
|
|
29530
|
+
// src/commands/issue/issue-comment.ts
|
|
28562
29531
|
const issueCommentCommand = defineCommand({
|
|
28563
29532
|
meta: {
|
|
28564
29533
|
name: "issue:comment",
|
|
@@ -28613,7 +29582,7 @@ const issueCommentCommand = defineCommand({
|
|
|
28613
29582
|
log$1.info(formatIssueComment(result, args["dry-run"] === true));
|
|
28614
29583
|
}
|
|
28615
29584
|
});
|
|
28616
|
-
// src/commands/issue-create.ts
|
|
29585
|
+
// src/commands/issue/issue-create.ts
|
|
28617
29586
|
function collectLabelArgs(rawArgs) {
|
|
28618
29587
|
return collectFlagValues(rawArgs, "--label");
|
|
28619
29588
|
}
|
|
@@ -28694,7 +29663,7 @@ const issueCreateCommand = defineCommand({
|
|
|
28694
29663
|
for (const line of formatIssueCreate(result, args.title, args["dry-run"] === true)) log$1.info(line);
|
|
28695
29664
|
}
|
|
28696
29665
|
});
|
|
28697
|
-
// src/commands/issue-update.ts
|
|
29666
|
+
// src/commands/issue/issue-update.ts
|
|
28698
29667
|
const issueUpdateCommand = defineCommand({
|
|
28699
29668
|
meta: {
|
|
28700
29669
|
name: "issue:update",
|
|
@@ -28877,7 +29846,7 @@ async function runIssueDownload(executor, options) {
|
|
|
28877
29846
|
throw error;
|
|
28878
29847
|
}
|
|
28879
29848
|
}
|
|
28880
|
-
// src/commands/issue-download.ts
|
|
29849
|
+
// src/commands/issue/issue-download.ts
|
|
28881
29850
|
const issueDownloadCommand = defineCommand({
|
|
28882
29851
|
meta: {
|
|
28883
29852
|
name: "issue:download",
|
|
@@ -29027,7 +29996,7 @@ async function runIssueLabel(executor, options) {
|
|
|
29027
29996
|
throw error;
|
|
29028
29997
|
}
|
|
29029
29998
|
}
|
|
29030
|
-
// src/commands/issue-label.ts
|
|
29999
|
+
// src/commands/issue/issue-label.ts
|
|
29031
30000
|
function defineIssueLabelCommand(action) {
|
|
29032
30001
|
return defineCommand({
|
|
29033
30002
|
meta: {
|
|
@@ -29106,7 +30075,7 @@ async function runIssueSetLabels(executor, options) {
|
|
|
29106
30075
|
throw error;
|
|
29107
30076
|
}
|
|
29108
30077
|
}
|
|
29109
|
-
// src/commands/issue-set-labels.ts
|
|
30078
|
+
// src/commands/issue/issue-set-labels.ts
|
|
29110
30079
|
const issueSetLabelsCommand = defineCommand({
|
|
29111
30080
|
meta: {
|
|
29112
30081
|
name: "issue:set-labels",
|
|
@@ -29279,16 +30248,16 @@ async function runIssueState(executor, options) {
|
|
|
29279
30248
|
file: "--comment-file"
|
|
29280
30249
|
}));
|
|
29281
30250
|
if (error instanceof PullRequestStateError) {
|
|
29282
|
-
const
|
|
30251
|
+
const advice = error.action === "close" ? `Run \`pnpm exec bst-fj pr:close ${String(error.number)}\` to close it; that bin installs with \`@bensandee/forgejo-cli\`. On GitHub, \`gh pr close ${String(error.number)}\`.` : `Run \`pnpm exec bst pr:reopen ${String(error.number)}\` to reopen it.`;
|
|
29283
30252
|
throw new FatalError(describePullRequestState(error, {
|
|
29284
30253
|
command: `issue:${error.action}`,
|
|
29285
|
-
advice
|
|
30254
|
+
advice
|
|
29286
30255
|
}));
|
|
29287
30256
|
}
|
|
29288
30257
|
throw error;
|
|
29289
30258
|
}
|
|
29290
30259
|
}
|
|
29291
|
-
// src/commands/issue-state.ts
|
|
30260
|
+
// src/commands/issue/issue-state.ts
|
|
29292
30261
|
function defineIssueStateCommand(action) {
|
|
29293
30262
|
return defineCommand({
|
|
29294
30263
|
meta: {
|
|
@@ -29351,7 +30320,7 @@ function defineIssueStateCommand(action) {
|
|
|
29351
30320
|
}
|
|
29352
30321
|
const issueCloseCommand = defineIssueStateCommand("close");
|
|
29353
30322
|
const issueReopenCommand = defineIssueStateCommand("reopen");
|
|
29354
|
-
// src/commands/findings-add.ts
|
|
30323
|
+
// src/commands/findings/findings-add.ts
|
|
29355
30324
|
const SOURCE_RE = /^(pr|issue)#(\d+)$/;
|
|
29356
30325
|
const ALLOWED_CLASSES = ["nit", "pre-existing"];
|
|
29357
30326
|
function parseSource(source) {
|
|
@@ -29468,7 +30437,7 @@ const findingsAddCommand = defineCommand({
|
|
|
29468
30437
|
if (result.createdLedgerDir) out.notice(`Created ${FINDINGS_DIR}/ -- the backlog sweep is now armed for this repo.`);
|
|
29469
30438
|
}
|
|
29470
30439
|
});
|
|
29471
|
-
// src/commands/findings-list.ts
|
|
30440
|
+
// src/commands/findings/findings-list.ts
|
|
29472
30441
|
const MS_PER_DAY = 864e5;
|
|
29473
30442
|
function readFindingSummary(fullPath) {
|
|
29474
30443
|
let body;
|
|
@@ -29551,7 +30520,7 @@ const findingsListCommand = defineCommand({
|
|
|
29551
30520
|
out.text(renderText(result));
|
|
29552
30521
|
}
|
|
29553
30522
|
});
|
|
29554
|
-
// src/commands/findings-resolve.ts
|
|
30523
|
+
// src/commands/findings/findings-resolve.ts
|
|
29555
30524
|
function resolveFindingPath(rootDir, name) {
|
|
29556
30525
|
const ledgerDir = path.join(rootDir, FINDINGS_DIR);
|
|
29557
30526
|
const relative = name.includes("/") ? name : `${FINDINGS_DIR}/${name}`;
|
|
@@ -30127,7 +31096,7 @@ async function runCli(config) {
|
|
|
30127
31096
|
// src/cli-main.ts
|
|
30128
31097
|
setLogLevel(resolveLogLevel({}));
|
|
30129
31098
|
setForgejoLogger(log$1);
|
|
30130
|
-
const displayVersion = "0.
|
|
31099
|
+
const displayVersion = "0.106.0";
|
|
30131
31100
|
const bstSubCommands = {
|
|
30132
31101
|
"repo:sync": syncCommand,
|
|
30133
31102
|
"checks:run": runChecksCommand,
|
|
@@ -30139,10 +31108,12 @@ const bstSubCommands = {
|
|
|
30139
31108
|
"changesets:merge": releaseMergeCommand,
|
|
30140
31109
|
"pr:create": prCreateCommand,
|
|
30141
31110
|
"pr:ready": prReadyCommand,
|
|
31111
|
+
"pr:reopen": prReopenCommand,
|
|
30142
31112
|
"pr:retarget": prRetargetCommand,
|
|
30143
31113
|
"pr:update": prUpdateCommand,
|
|
30144
31114
|
"release:simple": releaseSimpleCommand,
|
|
30145
31115
|
"release:assets": releaseAssetsCommand,
|
|
31116
|
+
"release:snapshot": releaseSnapshotCommand,
|
|
30146
31117
|
"docker:publish": publishDockerCommand,
|
|
30147
31118
|
"docker:build": dockerBuildCommand,
|
|
30148
31119
|
"docker:check": dockerCheckCommand,
|