@m4ss/pi-skills 0.1.0 → 0.2.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.
@@ -0,0 +1,162 @@
1
+ # Forgejo Actions
2
+
3
+ Forgejo Actions runs workflows from `.forgejo/workflows/` using GitHub Actions
4
+ syntax with three differences on every Forgejo instance:
5
+
6
+ - Omit `permissions:` (Forgejo does not support it).
7
+ - Use the `forgejo` context (`github` is an alias) and `FORGEJO_*` environment
8
+ files (e.g., `$FORGEJO_ENV`).
9
+ - Always use full URLs in `uses:` (bare `owner/repo` resolves against the
10
+ instance's `DEFAULT_ACTIONS_URL`).
11
+
12
+ **Scope:** The rest of this file applies only to our repositories (`SKILL.md`,
13
+ "Our repositories"). In an external repository, use its own instance's mirrors
14
+ and runner labels (ask if unknown).
15
+
16
+ ## `code.m4ss.net`
17
+
18
+ All non-GitHub-specific rules in `references/ci-audit.md` apply here as well.
19
+
20
+ - **Private repository check**: When creating a repository on `code.m4ss.net`
21
+ or making initial commits in one meant to be private, verify an
22
+ unauthenticated request returns `404` (not `200`):
23
+ `curl -sS -o /dev/null -w '%{http_code}' https://code.m4ss.net/api/v1/repos/<owner>/<repo>`.
24
+ - **`.github/` and `.forgejo/` twins**: When a repository has both, `.github/`
25
+ is the primary reference and both must run the same checks. They may differ
26
+ only where Forgejo requires it: the rules below, action versions that differ
27
+ on Forgejo (`upload-artifact`, `cache`), releases not yet synced to the
28
+ mirror, or job layout (e.g., an MSRV matrix entry on GitHub split into a
29
+ standalone job on Forgejo). Fix any other difference when editing either side.
30
+
31
+ ### Workflow rules
32
+
33
+ 1. **Full `https://code.m4ss.net/Actions/` URLs in every `uses:`**, pinned to a
34
+ commit SHA with a version comment:
35
+
36
+ ```yaml
37
+ - name: Checkout
38
+ uses: https://code.m4ss.net/Actions/checkout@<sha> # v7.0.1
39
+ with:
40
+ persist-credentials: false
41
+ ```
42
+
43
+ Fix any `uses:` pointing to `github.com`, `code.forgejo.org`,
44
+ `data.forgejo.org`, or another `code.m4ss.net` organization like `Mirror`.
45
+
46
+ 2. **Use mirrored official actions** rather than Forgejo forks, except where the
47
+ upstream action refuses non-GitHub servers (currently only `upload-artifact`
48
+ v7; document the exception in a comment). Query current mirrors with:
49
+ `curl -sS 'https://code.m4ss.net/api/v1/orgs/Actions/repos?limit=50' | jq -r '.[].full_name'`.
50
+
51
+ Mirrors available at the time of writing:
52
+
53
+ | Repository | Upstream | Notes |
54
+ | ------------------- | ------------------------------------------ | ----------------------------------------------------------- |
55
+ | `checkout` | `actions/checkout` | |
56
+ | `setup-node` | `actions/setup-node` | |
57
+ | `setup-python` | `actions/setup-python` | Requires egress to `github.com` and `pypi.org` |
58
+ | `cache` | `actions/cache` | Manual copy (not a live mirror due to `actions/cache#1795`) |
59
+ | `rust-toolchain` | `dtolnay/rust-toolchain` | |
60
+ | `install-action` | `taiki-e/install-action` | |
61
+ | `cargo-deny-action` | `EmbarkStudios/cargo-deny-action` | Docker action |
62
+ | `upload-artifact` | `code.forgejo.org/forgejo/upload-artifact` | Forgejo fork, versioned separately |
63
+ | `cache-nix-action` | `nix-community/cache-nix-action` | |
64
+ | `ci-images` | — | Runner container images (see below) |
65
+
66
+ If a workflow needs an unmirrored action (`download-artifact`,
67
+ `Swatinem/rust-cache`, etc.), stop and ask the user to mirror it first. Note
68
+ that `pnpm` is preinstalled in `ci-images`, so `pnpm/action-setup` is
69
+ unnecessary on Forgejo.
70
+
71
+ 3. **Verify the mirror has the commit before pinning**: Mirrors keep upstream
72
+ commit SHAs and sync every 8–24 hours. Confirm the tag is present with:
73
+ `git ls-remote https://code.m4ss.net/Actions/<repo> 'refs/tags/<tag>' 'refs/tags/<tag>^{}'`.
74
+
75
+ 4. **Block fork pull requests on every job** (job containers run privileged;
76
+ include the comment on the first job):
77
+
78
+ ```yaml
79
+ # The job containers on these runners are privileged, so never run them
80
+ # for code from a fork.
81
+ if: forgejo.event_name != 'pull_request' || forgejo.event.pull_request.head.repo.full_name == forgejo.repository
82
+ ```
83
+
84
+ 5. **Runner labels**: Use `ubuntu-26.04` by default. Keep release-binary build
85
+ jobs on `ubuntu-24.04` unless asked (`references/ci-audit.md`, "Runners").
86
+
87
+ Example job:
88
+
89
+ ```yaml
90
+ env:
91
+ RUST_VERSION: 1.100.0
92
+
93
+ concurrency:
94
+ group: ${{ forgejo.workflow }}-${{ forgejo.ref }}
95
+ cancel-in-progress: true
96
+
97
+ jobs:
98
+ clippy:
99
+ # The job containers on these runners are privileged, so never run them
100
+ # for code from a fork.
101
+ if: forgejo.event_name != 'pull_request' || forgejo.event.pull_request.head.repo.full_name == forgejo.repository
102
+ name: clippy / 1.100.0
103
+ runs-on: ubuntu-26.04
104
+ timeout-minutes: 15
105
+ steps:
106
+ - name: Checkout
107
+ uses: https://code.m4ss.net/Actions/checkout@<sha> # v7.0.1
108
+ with:
109
+ persist-credentials: false
110
+
111
+ - name: Rust toolchain
112
+ uses: https://code.m4ss.net/Actions/rust-toolchain@<sha> # master
113
+ with:
114
+ toolchain: ${{ env.RUST_VERSION }}
115
+ components: clippy
116
+
117
+ - name: cargo clippy
118
+ run: cargo clippy --locked --all-targets --all-features -- -D warnings
119
+ ```
120
+
121
+ ### Runner images (`Actions/ci-images`)
122
+
123
+ `https://code.m4ss.net/Actions/ci-images` defines the images for `ubuntu-24.04`
124
+ and `ubuntu-26.04`. They preinstall one version each of Rust (stable with
125
+ `clippy` and `rustfmt`), Go, Node.js and pnpm, plus Python, podman, skopeo,
126
+ PHP/composer, jq, SQLite and the PostgreSQL client, running as user `runner`
127
+ with passwordless `sudo`. If `ci-images`'s README conflicts with its
128
+ `Dockerfile`s or this file, trust the `Dockerfile`s and this file.
129
+
130
+ Preinstalled toolchains act only as a local cache: workflows must still
131
+ explicitly request versions and components (`rust-toolchain` with
132
+ `toolchain: ${{ env.RUST_VERSION }}` and `components: clippy` / `rustfmt`,
133
+ `setup-node`, and `packageManager` in `package.json`). When a workflow requests
134
+ a version different from the image's, the action downloads and installs a
135
+ `--profile minimal` toolchain with the requested components.
136
+
137
+ ### Maintaining `Actions/ci-images`
138
+
139
+ When updating pinned toolchains in `Actions/ci-images`:
140
+
141
+ 1. Update `*_VERSION` and `*_SHA256` together in the `Dockerfile`s (following
142
+ the source URL comment above each checksum; for `pnpm`, run `sha256sum` on
143
+ the release tarball and cross-check against GitHub's release asset `digest`
144
+ via `curl -sS https://api.github.com/repos/pnpm/pnpm/releases/tags/v<version> | jq -r '.assets[] | select(.name == "pnpm-linux-x64.tar.gz") | .digest'`).
145
+ Rust only needs `RUST_VERSION`.
146
+ 2. Keep `ubuntu-24.04.Dockerfile` and `ubuntu-26.04.Dockerfile` identical
147
+ except for the `FROM` base image.
148
+ 3. Enforce the 1-day release-age gate on non-security releases of Node.js,
149
+ Go and pnpm (a release whose notes mention a security fix counts as a
150
+ security release, advisory or not). Rust has no release-age gate: take the
151
+ latest stable release, however recent. Patch/minor updates and new Rust
152
+ stable releases are routine; ask before bumping Node.js or Go to a new
153
+ major.
154
+ 4. Check whether `quay.io/podman/stable:<tag>` in the build workflow has a
155
+ newer digest and update the pinned digest if so:
156
+
157
+ ```sh
158
+ skopeo inspect --format '{{.Digest}}' docker://quay.io/podman/stable:<tag>
159
+ ```
160
+
161
+ 5. Commit per `SKILL.md`, "Commit subjects". `ci-images` and workflow pins can
162
+ be bumped together or separately.
@@ -0,0 +1,376 @@
1
+ # Node.js dependencies (pnpm)
2
+
3
+ This procedure targets pnpm 12 (pinned in `packageManager`). pnpm settings live
4
+ in `pnpm-workspace.yaml` (even in single-package repositories); `.npmrc` only
5
+ holds auth, registry and network settings. Unknown keys in
6
+ `pnpm-workspace.yaml` cause commands to fail when `packageManager` pins pnpm,
7
+ so check key names carefully.
8
+
9
+ Create commits in this order (omit any step that has no changes):
10
+
11
+ ```text
12
+ build(deps): upgrade semver compatible Node dependencies
13
+ build(deps): upgrade <name> to v<version> (a version younger than a day)
14
+ build(deps): upgrade <name> to v<major> (one per upgrade or group)
15
+ build(deps): ... (standing holds that became obsolete)
16
+ ```
17
+
18
+ ## Mandatory pnpm flags and the 1-day release-age gate
19
+
20
+ Run every pnpm command that resolves, installs or fixes (`update`, `add`,
21
+ `install`, `audit --fix`, `dlx`) with these CLI flags:
22
+
23
+ ```sh
24
+ pnpm --config.minimumReleaseAge=1440 --config.trustPolicy=no-downgrade <command>
25
+ ```
26
+
27
+ Below, `pnpm ... <command>` stands for exactly this: type the two flags in
28
+ place of `...`, never the dots themselves.
29
+
30
+ Without these flags, pnpm silently installs releases younger than a day and adds
31
+ them to `minimumReleaseAgeExclude`: its default one-day gate is not strict.
32
+ Setting `minimumReleaseAge` explicitly, as these flags do, makes it strict, so
33
+ pnpm fails with `ERR_PNPM_NO_MATURE_MATCHING_VERSION` instead.
34
+ `trustPolicy=no-downgrade` makes pnpm fail instead of installing a version with
35
+ weaker publishing trust (for example, no provenance) than the version it
36
+ replaces.
37
+
38
+ Never write `minimumReleaseAge` or `trustPolicy` into `pnpm-workspace.yaml`.
39
+
40
+ Do not install any version published less than 24 hours ago (1440 minutes)
41
+ unless it is a security fix (`SKILL.md`, "Security fixes and the release-age
42
+ gate"), with or without an advisory, and passes a supply-chain diff audit
43
+ (Step 5). The gate hides young releases from resolution, so to find them
44
+ compare `pnpm outdated -r` with and without `--config.minimumReleaseAge=0`
45
+ (read-only) and read the changelog of every release that only shows up
46
+ without the gate.
47
+
48
+ - Resolution (`update`, `update --latest`, `outdated`) picks the newest version
49
+ at least a day old.
50
+ - Every install run with these flags, including `--frozen-lockfile`, re-checks
51
+ the lockfile and fails with `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` if any
52
+ locked version is younger than a day and not listed in
53
+ `minimumReleaseAgeExclude`. An install without them, such as a plain
54
+ `pnpm install --frozen-lockfile` in CI, does not check and installs the
55
+ locked version, so CI is not a safety net for the gate.
56
+ - If a command fails with `ERR_PNPM_NO_MATURE_MATCHING_VERSION` outside Step 5,
57
+ first read the changelog of the young version it wanted. If it is a security
58
+ fix, go to Step 5. Otherwise:
59
+ - Direct dependency: select the newest version at least a day old.
60
+ - Transitive dependency: hold back the parent package
61
+ (`update -r '!<parent>'`). Adding an `overrides` entry requires user
62
+ approval.
63
+ - Record each Step 5 exception (no approval needed) by exact version (never by
64
+ bare package name), with a comment citing the advisory, or the changelog line
65
+ when there is no advisory:
66
+
67
+ ```yaml
68
+ minimumReleaseAgeExclude:
69
+ # GHSA-xxxx-xxxx-xxxx: diff from 1.2.2 audited
70
+ - some-package@1.2.3
71
+ ```
72
+
73
+ - `pnpm audit --fix` can append patched versions younger than a day to
74
+ `minimumReleaseAgeExclude`: always inspect `git diff -- pnpm-workspace.yaml`
75
+ after running it and keep only entries that satisfy Step 5.
76
+ - Check a version's publish timestamp with:
77
+ `npm view <name> time --json | jq -r '."<version>"'`.
78
+
79
+ ## 1. Take a baseline
80
+
81
+ Inspect the repository configuration:
82
+
83
+ - **pnpm version**: `packageManager` (and `devEngines.packageManager`, if set)
84
+ in the root `package.json`. If neither is set, do not add one: it changes
85
+ the pnpm version for everyone working on the repository. Run with the
86
+ installed pnpm and mention the missing pin in the report.
87
+ - **Workspace settings (`pnpm-workspace.yaml`)**: `packages`, `catalog` /
88
+ `catalogs`, `minimumReleaseAgeExclude`, `trustPolicyExclude`, `allowBuilds`,
89
+ `audit.ignore`, `overrides`, `patchedDependencies` and
90
+ `update.githubActions`.
91
+ - **CI scripts**: The commands CI runs after `pnpm install --frozen-lockfile`
92
+ (typically `check`, `lint`, `test` and `build`; in SvelteKit repositories
93
+ `prepare` runs `svelte-kit sync` and `check` runs `svelte-check`).
94
+ - **Generated code**: Gitignored directories that a build step generates, such
95
+ as Paraglide's `src/lib/paraglide` (from `paraglide-js compile` or its Vite
96
+ plugin). `svelte-check` fails until they exist, so generate them the way CI
97
+ does before running it. `paraglide-js compile` exits 0 even when
98
+ `project.inlang/settings.json` is broken, so `svelte-check` is the check
99
+ that counts.
100
+ - **Code from CDNs**: URLs under `modules` in `project.inlang/settings.json`,
101
+ and any `import` or `<script src>` from jsDelivr, unpkg or esm.sh. They skip
102
+ the lockfile and the release-age gate (`SKILL.md`, "Stop and ask").
103
+ - **Node.js versions**: `engines.node`, `.nvmrc` / `.node-version`, and the CI
104
+ matrix.
105
+ - **Exact pins**: Version specifiers without a range (`"1.2.3"`), or
106
+ `save-exact` settings.
107
+ - **Published packages**: Check which packages are published to npm and whether
108
+ unpublished ones set `"private": true` (`references/ci-audit.md`,
109
+ "Publishing"). Report any unpublished package missing `"private": true`.
110
+
111
+ Record baseline advisories (`pnpm audit` exits with 1 when advisories exist)
112
+ and outdated packages:
113
+
114
+ ```sh
115
+ pnpm audit > <scratch>/audit-before.txt
116
+ pnpm outdated -r
117
+ ```
118
+
119
+ ## 2. Upgrade within the declared ranges
120
+
121
+ Run across all workspace packages (`-r` is also safe in single-package repos):
122
+
123
+ ```sh
124
+ pnpm --config.minimumReleaseAge=1440 --config.trustPolicy=no-downgrade update -r
125
+ ```
126
+
127
+ This raises range floors in `package.json` (`^3.9.4` -> `^3.9.10`), updates
128
+ `catalog:` entries in `pnpm-workspace.yaml`, and refreshes transitive
129
+ dependencies in `pnpm-lock.yaml`.
130
+
131
+ Then handle these cases:
132
+
133
+ - **If `update.githubActions: true` modified `.github/workflows/`**: Do not
134
+ include workflow changes in the dependency commit. Revert or unstage them,
135
+ review and commit them separately per `references/ci-audit.md`, and sync
136
+ `.forgejo/workflows/` twins.
137
+ - **If exact pins exist** (no range prefix): Check whether a comment or the
138
+ commit that added the pin gives a reason (a standing hold for Step 9). If
139
+ not, update it to the newest release of its current major (for `1.2.3`,
140
+ `<major>` is `1`; for `0.3.1`, it is `0.3`; a `0.0.x` pin has no newer
141
+ release in its major, so leave it for Step 6), in each package that pins it.
142
+ `<package>` is the `name` in that package's `package.json`, also in a
143
+ single-package repository. This takes three commands, because `update`
144
+ rewrites the exact pin as a range:
145
+ `pnpm ... --filter <package> update '<name>@^<major>'`, then read the
146
+ version it locked with
147
+ `pnpm --filter <package> list <name> --depth 0 --json | jq -r '.[0] | (.dependencies // {}) + (.devDependencies // {}) | .["<name>"].version'`,
148
+ and pin that version exactly with
149
+ `pnpm ... --filter <package> add <name>@<that-version> --save-exact`. A
150
+ newer major is handled in Step 6.
151
+ - **Update pnpm in `packageManager`**: `pnpm update -r` can already have
152
+ changed the pnpm version in `packageManager` (or
153
+ `devEngines.packageManager`). Check `git diff -- package.json`: if the pnpm
154
+ major changed, put the previous pin back and handle the new major in Step 6.
155
+ Otherwise make sure the pin is the newest release of the same major that is
156
+ at least a day old (`npm view pnpm time --json`). To change the pin, edit
157
+ the version in `packageManager` by hand. Never run `pnpm self-update`: it
158
+ runs as the installed pnpm, and on pnpm 12 it also replaces the installed
159
+ pnpm. If the pin has a `+sha512...` hash, replace the whole value with the
160
+ output of:
161
+ `echo "pnpm@<version>+sha512.$(npm view pnpm@<version> dist.integrity | sed 's/^sha512-//' | base64 -d | od -An -tx1 -v | tr -d ' \n')"`.
162
+ pnpm does not check the hash, so a wrong one goes unnoticed: always use this
163
+ command rather than editing the hash. Then run `pnpm --version` in the
164
+ repository (it must print `<version>`) and
165
+ `pnpm --config.minimumReleaseAge=1440 --config.trustPolicy=no-downgrade install`.
166
+ Afterwards `pnpm-lock.yaml` records the new pin; include that change in this
167
+ commit. Treat a new pnpm major as a major upgrade (Step 6).
168
+ - **If a minor TypeScript update introduces type errors**: Include small fixes
169
+ in this commit; if the fixes are non-trivial, hold TypeScript back
170
+ (`update -r '!typescript'`) and move it to its own commit.
171
+ - **If the update breaks lint, formatting or the build** (for example a plugin
172
+ that fails at runtime with a newer host package, such as
173
+ `prettier-plugin-svelte` with a newer `prettier`): first check whether a
174
+ newer major of the plugin or its peer group fixes it (Step 6), and search
175
+ the plugin's issues for the error. If nothing fixes it, hold the host package
176
+ back with `update -r '!<name>'`, keeping its range, and report the hold with
177
+ the upstream issue. Do not pin an exact older version to get past the error.
178
+ - **On policy errors**:
179
+ - `ERR_PNPM_NO_MATURE_MATCHING_VERSION`: Follow the release-age gate rules
180
+ above.
181
+ - `ERR_PNPM_IGNORED_BUILDS`: Handle unreviewed install scripts in Step 7.
182
+ - `ERR_PNPM_TRUST_DOWNGRADE`: Handle trust downgrades in Step 8.
183
+
184
+ ## 3. Advisories
185
+
186
+ Re-run `pnpm audit` and diff advisory IDs against the baseline:
187
+
188
+ ```sh
189
+ pnpm audit > <scratch>/audit-after.txt
190
+ diff <(grep -oE 'GHSA(-[0-9a-z]{4}){3}' <scratch>/audit-before.txt | sort -u) \
191
+ <(grep -oE 'GHSA(-[0-9a-z]{4}){3}' <scratch>/audit-after.txt | sort -u)
192
+ ```
193
+
194
+ Cite advisories resolved by `update -r` in Step 4's commit body. For each
195
+ remaining advisory:
196
+
197
+ 1. **Check for a fix:** Check `patched_versions` in `pnpm audit --json` (`null`
198
+ means no fix). Prefer `pnpm ... audit --fix=update`, which updates
199
+ `pnpm-lock.yaml` and raises the range in `package.json`, without adding
200
+ overrides, and include the change in Step 4. Plain `audit --fix` writes
201
+ `overrides` to `pnpm-workspace.yaml`: ask the user before adding an override.
202
+ If the fix is younger than a day, follow Step 5.
203
+ 2. **Check whether it affects this repository:** Read
204
+ `https://github.com/advisories/<GHSA>` for affected functions and inputs,
205
+ and run `pnpm why -r <name>` (`pnpm audit --prod` checks only runtime
206
+ `dependencies`). In SvelteKit apps, only server and client bundles ship to
207
+ production; dev servers, bundlers and linters run only in CI and on
208
+ developer machines (relevant for crafted-input DoS, but not for compromised
209
+ packages).
210
+ 3. **Act:**
211
+ - **Does not apply:** Report it with the reasoning. Do not add it to
212
+ `audit.ignore` unless the user asks.
213
+ - **Applies and has no fix, or requires an override:** Stop and present the
214
+ options to the user.
215
+ - **Malicious or compromised package:** Stop immediately and report: which
216
+ versions are locked and since when, whether its install scripts could have
217
+ executed (only if permitted by `allowBuilds`), and that credentials on
218
+ machines that installed it may need rotation.
219
+
220
+ ## 4. Commit the compatible upgrade
221
+
222
+ 1. Remove obsolete `minimumReleaseAgeExclude` entries (Step 9, "Standing
223
+ holds").
224
+ 2. Verify the lockfile passes strict CI checks:
225
+
226
+ ```sh
227
+ pnpm --config.minimumReleaseAge=1440 --config.trustPolicy=no-downgrade install --frozen-lockfile
228
+ ```
229
+
230
+ 3. Run the repository's CI checks (`check`, `lint`, `test`, `build`).
231
+ 4. Commit `package.json`, `pnpm-lock.yaml` and `pnpm-workspace.yaml` as
232
+ `build(deps): upgrade semver compatible Node dependencies`. Add a body only
233
+ for resolved advisories, removed release-age exceptions, or holds.
234
+
235
+ ## 5. Taking a version younger than a day
236
+
237
+ Use this exception **only** for a security fix: a release that fixes an
238
+ applicable advisory (from Step 3), or whose changelog mentions a security fix
239
+ when no advisory exists yet. Take it right away, without asking. Where the
240
+ steps below name the advisory, quote the changelog line instead:
241
+
242
+ 1. Audit the diff from the currently locked version (`references/changelogs.md`)
243
+ to confirm it contains only the fix. Stop and report immediately if the diff
244
+ introduces any of the following supply-chain red flags:
245
+ - new or modified install scripts (`preinstall`, `install`, `postinstall`,
246
+ `prepare`);
247
+ - new dependencies;
248
+ - new minified, bundled or obfuscated code, or large encoded blobs;
249
+ - access to environment variables, credentials, files outside the package,
250
+ network, `eval`, `new Function` or `child_process`;
251
+ - a changed publisher or repository URL, or missing provenance attestations
252
+ when prior releases had them (`npm view <name>@<version> dist.attestations`).
253
+ 2. Add the exact version (plus any equally young companion platform packages
254
+ listed in the pnpm error) to `minimumReleaseAgeExclude` with a comment naming
255
+ the advisory.
256
+ 3. Upgrade it with
257
+ `pnpm --config.minimumReleaseAge=1440 --config.trustPolicy=no-downgrade update -r <name>`.
258
+ Give no version: with `<name>@<version>`, pnpm skips the package when it is
259
+ only a transitive dependency. Confirm the excluded version is now locked
260
+ (`grep -E "^ '?<name>@" pnpm-lock.yaml`; scoped names are quoted). If
261
+ the fix needs a newer range in a parent dependency, upgrade the parent the
262
+ same way. Then run the checks.
263
+ 4. Commit as `build(deps): upgrade <name> to v<version>`, stating the fixed
264
+ advisory, that the release is under the 1-day gate, and that its diff was
265
+ audited.
266
+
267
+ ## 6. Major upgrades
268
+
269
+ Identify major upgrades from `pnpm outdated -r` (`Latest` outside the declared
270
+ range; `^0.3` does not allow `0.4`). Create one commit per upgrade or coupled
271
+ peer group.
272
+
273
+ **Group coupled packages by `peerDependencies`**
274
+ (`npm view <name>@<version> peerDependencies`):
275
+
276
+ - `svelte` + `@sveltejs/kit`, `@sveltejs/vite-plugin-svelte`, `svelte-check`,
277
+ `eslint-plugin-svelte`, `prettier-plugin-svelte`
278
+ - `vite` + `@sveltejs/vite-plugin-svelte`, `vitest`
279
+ - `eslint` + `typescript-eslint`, ESLint plugins
280
+ - `typescript` + `svelte-check`, `typescript-eslint`
281
+
282
+ Do not commit upgrades that introduce new unmet peer dependency warnings. Keep
283
+ `@types/node` on the major of the **oldest** Node.js release tested in CI (the
284
+ oldest entry of the CI matrix, or the only version CI uses), not the newest. If
285
+ `engines.node` allows an older major than CI tests, report the mismatch. Keep
286
+ other `@types/*` packages aligned with their corresponding library major.
287
+
288
+ For each major upgrade (or group):
289
+
290
+ 1. Audit the release diff and changelog (`references/changelogs.md`).
291
+ 2. Upgrade with strict flags (`pnpm ... update -r --latest <name>...` or
292
+ `pnpm ... add <name>@^<major>` in the target workspace package). If peer
293
+ dependencies in the ecosystem do not yet support the new major, revert, skip
294
+ the upgrade, and report it.
295
+ 3. If upgrading Svelte/SvelteKit and the migration guide recommends
296
+ `sv migrate`, run `pnpm ... dlx sv migrate <migration>` and review all
297
+ resulting edits.
298
+ 4. Adapt code to breaking changes and run CI checks.
299
+ 5. Commit as `build(deps): upgrade <name> to v<major>` (or `build(deps)!:` if
300
+ it breaks a published package's public API; see `SKILL.md`, "Commit
301
+ subjects") with a body following `references/changelogs.md`.
302
+
303
+ ## 7. Install scripts (`ERR_PNPM_IGNORED_BUILDS`)
304
+
305
+ `strictDepBuilds` is enabled by default, so pnpm blocks any package with
306
+ install scripts not listed in `allowBuilds` in `pnpm-workspace.yaml`. When an
307
+ update triggers `ERR_PNPM_IGNORED_BUILDS`:
308
+
309
+ - **If an existing package gained an install script in a minor or patch
310
+ release:** This is a supply-chain red flag (the list in Step 5, item 1). Read
311
+ the release diff (`references/changelogs.md`) to say what the script does,
312
+ then hold the package at its previous version (restore `pnpm-lock.yaml` from
313
+ git, or hold back its parent with `update -r '!<parent>'`) and stop and report
314
+ it. Do not add it to `allowBuilds` and do not continue to the next bullet.
315
+ - **Otherwise, inspect the install script:**
316
+ - If the package works without running the script (e.g., prebuilt binaries
317
+ come from optional platform dependencies, or the script is a no-op), set
318
+ `<package>: false` in `allowBuilds` with an explanatory comment (no user
319
+ approval needed):
320
+
321
+ ```yaml
322
+ allowBuilds:
323
+ # esbuild works without its postinstall: the platform binary comes from the
324
+ # @esbuild/* optional dependency; the script only validates/re-downloads it.
325
+ esbuild: false
326
+ ```
327
+
328
+ - If the script must run for the package to work, stop and ask the user
329
+ before setting `<package>: true`.
330
+ - Never set `dangerouslyAllowAllBuilds`.
331
+
332
+ ## 8. Trust downgrades (`ERR_PNPM_TRUST_DOWNGRADE`)
333
+
334
+ `ERR_PNPM_TRUST_DOWNGRADE` fires when a release has weaker trust evidence (no
335
+ provenance attestation or trusted publisher) than an earlier version of the
336
+ same package (including versions already in `pnpm-lock.yaml`).
337
+
338
+ Inspect the package's publishing history (URL-encode scoped packages as
339
+ `@scope%2Fname`):
340
+
341
+ ```sh
342
+ curl -sS https://registry.npmjs.org/<name> | jq -r '.time as $t | .versions | to_entries[]
343
+ | [.key, $t[.key], (if .value.dist.attestations then "provenance" else "-" end),
344
+ (if .value._npmUser.trustedPublisher then "trusted publisher" else "-" end),
345
+ .value._npmUser.name] | @tsv'
346
+ ```
347
+
348
+ Stop and report the history to the user: distinguish a suspicious change (new
349
+ maintainer account or repository) from a single maintainer alternating between
350
+ CI and manual publishing. Add the package to `trustPolicyExclude` in
351
+ `pnpm-workspace.yaml` (with a comment) only if the user approves.
352
+
353
+ ## 9. Standing holds
354
+
355
+ Check whether existing holds and exceptions in `pnpm-workspace.yaml` and
356
+ `package.json` are now obsolete:
357
+
358
+ - **`minimumReleaseAgeExclude`**: Remove exact-version entries (`pkg@1.2.3`)
359
+ once the version is more than a day old or no longer in `pnpm-lock.yaml`
360
+ (`pnpm why -r <name>`). Keep package-wide or glob policy entries
361
+ (`caniuse-lite`, `@scope/*`), but report any whose package is no longer used.
362
+ - **`audit.ignore`**: To test which ignored GHSA IDs are still active, copy
363
+ `pnpm-workspace.yaml` to `<scratch>`, clear `audit.ignore`, run
364
+ `pnpm audit --json | jq -r '.advisories[].github_advisory_id' | sort -u`, and
365
+ restore `pnpm-workspace.yaml`. Remove any ID no longer reported.
366
+ - **`trustPolicyExclude`**: Keep until the package resumes publishing with
367
+ provenance/trusted publishing.
368
+ - **`overrides` and `patchedDependencies`**: Remove when normal dependency
369
+ ranges resolve to a version containing the fix.
370
+ - **Intentional exact pins in `package.json`**: Verify whether the reason for
371
+ pinning still applies.
372
+
373
+ Remove obsolete holds in a `build(deps): ...` commit explaining why each is no
374
+ longer needed (or fold into Step 4 when resolved by the compatible upgrade), and
375
+ verify with `pnpm ... install --frozen-lockfile`. Report all remaining holds
376
+ and their reasons.