Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .claude/skills/_update-skills/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,4 @@ Not verified yet: that the Actions token can run the GraphQL lookup against othe

## Checking a change to the script

- `node --test .claude/skills/_update-skills/scripts/listSkillPins.test.ts`
- Break the code on purpose and confirm a test fails. Every rule the script applies should have a test that does.
- Run the listing against the real sources, then `--verify` for each skill that has a commit pinned: each must verify.
2 changes: 1 addition & 1 deletion .claude/skills/_update-skills/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Skills that a dependency ships for pnpm (approved under `permissions` in `pnpm-w
| `best-practices` | — | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/addyosmani/web-quality-skills/tree/<latest>/skills/best-practices --skill best-practices -a claude-code --copy -y` |
| `dogfood` | `agent-browser` | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/vercel-labs/agent-browser/tree/<latest>/skill-data/dogfood --skill dogfood -a claude-code --copy -y` |
| `git-commit` | — | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/github/awesome-copilot/tree/<latest>/skills/git-commit --skill git-commit -a claude-code --copy -y` |
| `pnpm` | `pnpm` (root `packageManager` field — not bumped by `update-outdated-deps`, so expect `SKIP` until pnpm is bumped by hand) | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/antfu/skills/tree/<latest>/skills/pnpm --skill pnpm -a claude-code --copy -y` |
| `pnpm` | `pnpm` (root `packageManager` field) | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/antfu/skills/tree/<latest>/skills/pnpm --skill pnpm -a claude-code --copy -y` |
| `turborepo` | `turbo` | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/vercel/turborepo/tree/<latest>/skills/turborepo --skill turborepo -a claude-code --copy -y` |
| `vitest` | `vitest` | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/antfu/skills/tree/<latest>/skills/vitest --skill vitest -a claude-code --copy -y` |
| `workleap-react-best-practices` | — | `pnpm --config.minimumReleaseAge=10080 dlx skills@<cli> add https://github.com/workleap/wl-web-configs/tree/<latest>/agent-skills/workleap-react-best-practices --skill workleap-react-best-practices -a claude-code --copy --full-depth -y` |
Expand Down
829 changes: 0 additions & 829 deletions .claude/skills/_update-skills/scripts/listSkillPins.test.ts

This file was deleted.

55 changes: 0 additions & 55 deletions .github/scripts/listUpdateDependenciesPrs.test.ts

This file was deleted.

45 changes: 45 additions & 0 deletions .github/scripts/pinPackageManagerHash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Puts the integrity hash back on the root `packageManager` field after a dependency update.
//
// node .github/scripts/pinPackageManagerHash.ts
//
// `pnpm update` moves the field to a newer pnpm version and writes it without a hash:
// `pnpm@12.21.0`. The hash is the one pnpm-lock.yaml records for that version, in hexadecimal
// instead of base64, so it is copied from there. A field that already carries a hash is left alone.
import { readFileSync, writeFileSync } from "node:fs";

const PACKAGE_MANAGER_FIELD = /("packageManager":\s*"pnpm@)([^"+]+)(")/;

export function findPnpmIntegrity(lockfile: string, version: string) {
const [, integrity] = new RegExp(`^ pnpm@${RegExp.escape(version)}:\\r?\\n resolution: \\{integrity: sha512-([A-Za-z0-9+/=]+)\\}`, "m").exec(lockfile) ?? [];

return integrity ? Buffer.from(integrity, "base64").toString("hex") : undefined;
}

/**
* Returns the package.json text with the hash added, or undefined when there is nothing to do:
* the field already carries a hash, or doesn't name pnpm.
*/
export function pinPackageManagerHash(packageJson: string, lockfile: string) {
const [, , version] = PACKAGE_MANAGER_FIELD.exec(packageJson) ?? [];
if (!version) {
return undefined;
}

const hash = findPnpmIntegrity(lockfile, version);
if (!hash) {
throw new Error(`pnpm-lock.yaml records no integrity for pnpm@${version}.`);
}

return packageJson.replace(PACKAGE_MANAGER_FIELD, `$1$2+sha512.${hash}$3`);
}

if (import.meta.main) {
const pinned = pinPackageManagerHash(readFileSync("package.json", "utf8"), readFileSync("pnpm-lock.yaml", "utf8"));

if (pinned) {
writeFileSync("package.json", pinned);
console.log("Added the integrity hash to the packageManager field.");
} else {
console.log("The packageManager field needs no hash.");
}
}
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ jobs:
- name: Syncpack
run: pnpm turbo run syncpack

- name: Test agent tooling
run: node --test .claude/skills/_update-skills/scripts/listSkillPins.test.ts

- name: Test packages
# For a PR, only test the projects that are diverging from the pull request original baseline.
run: |
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ pnpm list-outdated-deps

### update-outdated-deps

Update outdated dependencies to their latest version. For more information, view [PNPM documentation](https://pnpm.io/cli/update).
Update outdated dependencies to their latest version. For more information, view [PNPM documentation](https://pnpm.io/cli/update). It also restores the integrity hash of the root `packageManager` field, which `pnpm update` drops when it bumps pnpm.

```bash
pnpm update-outdated-deps
Expand Down
4 changes: 4 additions & 0 deletions agent-docs/references/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ The `list-outdated-deps` and `update-outdated-deps:update-versions` scripts in t

- **`@opentelemetry/*`** — the web OpenTelemetry SDK that `@workleap/telemetry` installs requires `@opentelemetry/api` below 1.10, while the newer Node SDK packages of the `endpoints` express server require 1.10. Release them once `@workleap/telemetry` ships an SDK that accepts `@opentelemetry/api` 1.10.

### `packageManager` integrity hash

The root `packageManager` field pins pnpm with its integrity hash (`pnpm@<version>+sha512.<hash>`). `pnpm update` also bumps that field and writes it without the hash, so the `update-outdated-deps:pin-package-manager` script puts it back, copied from `pnpm-lock.yaml` by `.github/scripts/pinPackageManagerHash.ts`. Do NOT remove that script or move it before `update-outdated-deps:update-versions`. After bumping pnpm by hand, run `node .github/scripts/pinPackageManagerHash.ts`.

## Adding a New Package

1. Create a folder under `packages/` matching the package name.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"list-outdated-deps": "pnpm outdated -r --format list !@opentelemetry/*",
"update-outdated-deps": "pnpm run --sequential \"/^update-outdated-deps:.*/\"",
"update-outdated-deps:update-versions": "pnpm update -r --latest !@opentelemetry/*",
"update-outdated-deps:pin-package-manager": "node .github/scripts/pinPackageManagerHash.ts",
"update-outdated-deps:update-peers": "syncpack fix",
"update-outdated-deps:format-pkg-json": "oxfmt \"**/package.json\""
},
Expand Down
Loading