@bensandee/tooling 0.52.1 → 0.52.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.mjs +46 -13
  2. package/package.json +1 -1
package/dist/bin.mjs CHANGED
@@ -1596,7 +1596,7 @@ async function generatePackageJson(ctx) {
1596
1596
  const devDeps = { ...ROOT_DEV_DEPS };
1597
1597
  if (!isMonorepo) Object.assign(devDeps, PER_PACKAGE_DEV_DEPS);
1598
1598
  devDeps["@bensandee/config"] = isWorkspacePackage(ctx, "@bensandee/config") ? "workspace:*" : "0.10.2";
1599
- devDeps["@bensandee/tooling"] = isWorkspacePackage(ctx, "@bensandee/tooling") ? "workspace:*" : "0.52.1";
1599
+ devDeps["@bensandee/tooling"] = isWorkspacePackage(ctx, "@bensandee/tooling") ? "workspace:*" : "0.52.3";
1600
1600
  if (ctx.config.useEslintPlugin) devDeps["@bensandee/eslint-plugin"] = isWorkspacePackage(ctx, "@bensandee/eslint-plugin") ? "workspace:*" : "0.12.0";
1601
1601
  if (ctx.config.formatter === "oxfmt") devDeps["oxfmt"] = {
1602
1602
  "@changesets/cli": "2.30.0",
@@ -2218,13 +2218,13 @@ const DEFAULT_POST_RELEASE_COMMAND = ["pnpm exec bst webhook:send", " \"$POST_RE
2218
2218
  /** Build env vars for hook secrets to inject into a workflow step. */
2219
2219
  function hookSecretEnv(secrets) {
2220
2220
  const env = {
2221
- POST_RELEASE_HOOK_URL: actionsExpr("secrets.POST_RELEASE_HOOK_URL"),
2221
+ POST_RELEASE_HOOK_URL: actionsExpr("vars.POST_RELEASE_HOOK_URL || secrets.POST_RELEASE_HOOK_URL"),
2222
2222
  WEBHOOK_SECRET: actionsExpr("secrets.POST_RELEASE_HOOK_SECRET")
2223
2223
  };
2224
2224
  for (const name of secrets ?? []) env[name] = actionsExpr(`secrets.${name}`);
2225
2225
  return env;
2226
2226
  }
2227
- /** Step that runs after release, gated on the POST_RELEASE_HOOK_URL secret being set. */
2227
+ /** Step that runs after release with post-release webhook env wired up. */
2228
2228
  function postReleaseHookStep(opts) {
2229
2229
  const ifCondition = opts?.condition ?? (opts?.guardMain ? "github.ref == 'refs/heads/main'" : void 0);
2230
2230
  return { step: {
@@ -3012,11 +3012,15 @@ async function generateChangesets(ctx) {
3012
3012
  }
3013
3013
  //#endregion
3014
3014
  //#region src/generators/lefthook.ts
3015
+ const LINT_COMMAND = "pnpm exec oxlint --no-error-on-unmatched-pattern {staged_files}";
3016
+ function formatCommandFor(formatter) {
3017
+ 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}";
3018
+ }
3015
3019
  function requiredCommands(formatter) {
3016
3020
  return {
3017
- lint: { run: "pnpm exec oxlint {staged_files}" },
3021
+ lint: { run: LINT_COMMAND },
3018
3022
  format: {
3019
- run: formatter === "prettier" ? "pnpm exec prettier --write {staged_files}" : "pnpm exec oxfmt --no-error-on-unmatched-pattern {staged_files}",
3023
+ run: formatCommandFor(formatter),
3020
3024
  stage_fixed: true
3021
3025
  }
3022
3026
  };
@@ -3026,9 +3030,9 @@ function buildConfig$1(formatter) {
3026
3030
  "pre-commit:",
3027
3031
  " commands:",
3028
3032
  " lint:",
3029
- " run: pnpm exec oxlint {staged_files}",
3033
+ ` run: ${LINT_COMMAND}`,
3030
3034
  " format:",
3031
- ` run: ${formatter === "prettier" ? "pnpm exec prettier --write {staged_files}" : "pnpm exec oxfmt --no-error-on-unmatched-pattern {staged_files}"}`,
3035
+ ` run: ${formatCommandFor(formatter)}`,
3032
3036
  " stage_fixed: true",
3033
3037
  ""
3034
3038
  ].join("\n");
@@ -3368,7 +3372,7 @@ async function runGenerators(ctx) {
3368
3372
  function generateMigratePrompt(results, config, detected) {
3369
3373
  const sections = [];
3370
3374
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
3371
- sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.52.1 repo:sync\` on ${timestamp}_\n`);
3375
+ sections.push(`# Migration Prompt\n\n_Generated by \`@bensandee/tooling@0.52.3 repo:sync\` on ${timestamp}_\n`);
3372
3376
  const changed = results.filter((r) => r.action === "created" || r.action === "updated" || r.action === "archived");
3373
3377
  if (changed.length > 0) {
3374
3378
  const items = changed.map((r) => {
@@ -6620,11 +6624,39 @@ async function sendWebhook(options) {
6620
6624
  } catch (error) {
6621
6625
  return {
6622
6626
  ok: false,
6623
- error: error instanceof Error ? error.message : String(error)
6627
+ error: formatError(error)
6624
6628
  };
6625
6629
  }
6626
6630
  }
6627
6631
  /**
6632
+ * Flatten an error and its `cause` chain into a single message.
6633
+ * Node's `fetch` wraps the real network error (ENOTFOUND, ECONNREFUSED, TLS
6634
+ * issues) inside a generic `TypeError: fetch failed`, with the actual cause
6635
+ * on `error.cause` — walking the chain surfaces the useful diagnostic.
6636
+ */
6637
+ function formatError(error) {
6638
+ if (!(error instanceof Error)) return String(error);
6639
+ const parts = [error.message];
6640
+ let cause = error.cause;
6641
+ while (cause instanceof Error) {
6642
+ parts.push(cause.message);
6643
+ cause = cause.cause;
6644
+ }
6645
+ return parts.join(": ");
6646
+ }
6647
+ /**
6648
+ * Mask a secret for diagnostic output: reveal the first/last 3 chars and the
6649
+ * length so misconfiguration (wrong secret, truncated env var) is visible
6650
+ * without leaking the actual value. Short secrets are replaced entirely.
6651
+ */
6652
+ function maskSecret(secret) {
6653
+ if (secret === void 0) return "<none>";
6654
+ const len = secret.length;
6655
+ if (len === 0) return "<empty>";
6656
+ if (len <= 8) return `<${String(len)} chars>`;
6657
+ return `${secret.slice(0, 3)}…${secret.slice(-3)} (${String(len)} chars)`;
6658
+ }
6659
+ /**
6628
6660
  * Send a webhook and log the result. Intended for CLI usage.
6629
6661
  * Never throws.
6630
6662
  */
@@ -6634,15 +6666,16 @@ async function sendWebhookWithLogging(url, secret, payload) {
6634
6666
  secret,
6635
6667
  payload
6636
6668
  });
6637
- if (result.ok) log.info("Post-release hook completed successfully");
6638
- else log.warn(`Post-release hook failed: ${result.error ?? "unknown error"}`);
6669
+ const context = `url=${url}, secret=${maskSecret(secret)}`;
6670
+ if (result.ok) log.info(`Post-release hook completed successfully (${context})`);
6671
+ else log.warn(`Post-release hook failed: ${result.error ?? "unknown error"} (${context})`);
6639
6672
  }
6640
6673
  //#endregion
6641
6674
  //#region src/bin.ts
6642
6675
  const main = defineCommand({
6643
6676
  meta: {
6644
6677
  name: "bst",
6645
- version: "0.52.1",
6678
+ version: "0.52.3",
6646
6679
  description: "Bootstrap and maintain standardized TypeScript project tooling"
6647
6680
  },
6648
6681
  subCommands: {
@@ -6710,7 +6743,7 @@ const main = defineCommand({
6710
6743
  })
6711
6744
  }
6712
6745
  });
6713
- console.log(`@bensandee/tooling v0.52.1`);
6746
+ console.log(`@bensandee/tooling v0.52.3`);
6714
6747
  async function run() {
6715
6748
  await runMain(main);
6716
6749
  process.exit(process.exitCode ?? 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bensandee/tooling",
3
- "version": "0.52.1",
3
+ "version": "0.52.3",
4
4
  "description": "CLI tool to bootstrap and maintain standardized TypeScript project tooling",
5
5
  "license": "MIT",
6
6
  "repository": {