@bensandee/tooling 0.103.0 → 0.105.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 CHANGED
@@ -119,6 +119,37 @@ Custom blocks are anchored to the nearest preceding non-blank line. When `repo:s
119
119
 
120
120
  To skip a workflow file entirely, add `# @bensandee/tooling:ignore` as the first line -- `repo:sync` will leave the file untouched.
121
121
 
122
+ ### Runner labels
123
+
124
+ Every generated job reads the runner from the forge's Actions variables, so the deployment names
125
+ its runners once and `repo:sync` stays offline: the generated YAML holds an expression, and the
126
+ forge fills in the value when it schedules the job.
127
+
128
+ - `BST_RUNNER` is the shared pool. Every job falls back to it.
129
+ - `BST_TRUSTED_RUNNER` is the trusted runner. The default-branch-only jobs try it first, so a
130
+ deployment with one pool sets nothing.
131
+
132
+ | Job | File | `runs-on` |
133
+ | ------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
134
+ | `check` | `check.yml` (every strategy but `changesets`) / `ci.yml` (`changesets`) | the trusted label on the push run on the default branch; the shared pool on every pull request |
135
+ | `release` | `release.yml` | `${{ vars.BST_TRUSTED_RUNNER \|\| vars.BST_RUNNER \|\| 'ubuntu-latest' }}` |
136
+ | `post-release-hook` | `ci.yml` (`changesets`) / `release.yml` (`simple`) | `${{ vars.BST_TRUSTED_RUNNER \|\| vars.BST_RUNNER \|\| 'ubuntu-latest' }}` |
137
+
138
+ With neither variable set, an unset one is the empty string and every job runs on `ubuntu-latest`
139
+ -- no job waits on an empty label. The YAML is the same on GitHub, where a repository on hosted
140
+ runners simply sets nothing.
141
+
142
+ Set the variables at the user, org or repo level (`Settings -> Actions -> General -> Variables`);
143
+ a repo-level value overrides the org and user ones. A user-level and a repo-level variable were
144
+ measured reaching `runs-on` on Forgejo 16.0.7; an org-level one was not yet, so set that level
145
+ against a scratch repository first.
146
+
147
+ Three things to know before setting them:
148
+
149
+ - **Scope the runner.** A job runs on any runner whose label it can name, so the runner must be scoped so no other repository on the forge can name its label. Until it is, setting the variable moves your secrets onto a machine other repos can claim.
150
+ - **A missing label hangs the job.** A job aimed at a label no runner serves waits forever. Set a variable only once a runner exists and is serving that label.
151
+ - **Writing a variable is an admin action.** Anyone who can write the repository's Actions variables can move every job with `BST_RUNNER`, pull request jobs included -- no workflow edit needed, and a repo-level value beats the org or user one. So the trusted runner must serve only its own label and be scoped to the repositories allowed to reach it; that registration is the guard, not the generated YAML. Read on 2026-11-02, the agent's forge token is a `write` collaborator on every agent-enabled repo, so a run cannot write these variables -- the admin action stays a person's.
152
+
122
153
  ### pnpm-workspace.yaml
123
154
 
124
155
  `repo:sync` manages `pnpm-workspace.yaml` with a narrow contract -- mandated keys, a few seeded-on-creation keys, and everything else passed through verbatim.
package/bin/bst.mjs CHANGED
@@ -12,8 +12,8 @@
12
12
  *
13
13
  * The indirection costs one module load and makes the bin link independent of build state: the
14
14
  * link always exists, and `dist/bin.mjs` only has to be there by the time someone runs it. When
15
- * it is not, the failure is an explicit ERR_MODULE_NOT_FOUND naming the missing build output --
16
- * a far better error than a command that appears not to exist.
15
+ * it is not, the shim says so in one line and names the command that builds it, rather than
16
+ * leaving Node's ERR_MODULE_NOT_FOUND stack trace.
17
17
  *
18
18
  * Consumers installing from the registry get both files (`files` ships `bin` and `dist`) and are
19
19
  * unaffected either way, since a published tarball is always built.
@@ -23,4 +23,13 @@
23
23
  * wrong trade for a file whose entire purpose is a side effect: the dynamic form says "run this"
24
24
  * rather than "bring in these bindings", which is what is actually meant here.
25
25
  */
26
- await import("../dist/bin.mjs");
26
+ import { existsSync } from "node:fs";
27
+ import { fileURLToPath } from "node:url";
28
+
29
+ const entry = new URL("../dist/bin.mjs", import.meta.url);
30
+ if (existsSync(entry)) {
31
+ await import(entry.href);
32
+ } else {
33
+ process.stderr.write(`bst: ${fileURLToPath(entry)} is missing. Run \`pnpm build\` first.\n`);
34
+ process.exitCode = 1;
35
+ }