@bensandee/tooling 0.104.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,27 +119,36 @@ 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
- ### Trusted runner label
122
+ ### Runner labels
123
123
 
124
- By default every generated job runs on `ubuntu-latest`. Set `trustedRunner` in `.tooling.json` to a self-hosted runner label and the default-branch-only jobs move to it:
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.
125
127
 
126
- ```json
127
- { "trustedRunner": "trusted" }
128
- ```
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' }}` |
129
137
 
130
- | Job | File | Moves to the label |
131
- | ------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
132
- | `check` | `check.yml` (`simple`, `release-it`) / `ci.yml` (`changesets`) | Yes -- the push run on the default branch; pull request runs stay on `ubuntu-latest` |
133
- | `release` | `release.yml` | Yes -- it only ever runs on the default branch |
134
- | `post-release-hook` | `ci.yml` (`changesets`) / `release.yml` (`simple`) | Yes -- it only ever runs on the default branch |
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.
135
141
 
136
- Pull request jobs stay on `ubuntu-latest` even with the key set. The label itself is the boundary: the forge picks the runner before any step runs, so a job that reaches the shared pool never does so on the trusted runner's machine.
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.
137
146
 
138
- Three things to know before setting it:
147
+ Three things to know before setting them:
139
148
 
140
- - **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 key moves your secrets onto a machine other repos can claim.
141
- - **A missing label hangs the job.** A job aimed at a label no runner serves waits forever. Set the key only once the runner exists and is serving that label.
142
- - **The move is a workflow edit.** Generated workflows are rewritten on `repo:sync`; setting or removing the key changes nothing until the workflow is regenerated, and removing it likewise does nothing until then. An agent's edit to a generated workflow is held for an operator before it is pushed.
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.
143
152
 
144
153
  ### pnpm-workspace.yaml
145
154
 
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
+ }