Allow pnpm source updates to build OpenClaw (#81294)

Merged via squash.

Prepared head SHA: 4815d5a8c9
Co-authored-by: fuller-stack-dev <263060202+fuller-stack-dev@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
Jason
2026-05-13 05:30:08 -06:00
committed by GitHub
parent af42260440
commit ce31fc91e1
3 changed files with 50 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ Docs: https://docs.openclaw.ai
- Agents: rewrite generic provider internal errors with support request IDs into user-friendly transient error copy. (#49401) Thanks @y471823206.
- WhatsApp: finish handling pending debounced inbound messages before closing the socket. (#81246) Thanks @mcaxtr.
- CLI/commitments: write `--json` output to stdout instead of diagnostic logs so automation can parse commitment list and dismiss results. (#81215) Thanks @giodl73-repo.
- Update: allow pnpm GitHub-source OpenClaw updates to approve the OpenClaw package build, so source installs complete their prepare/prepack lifecycle. (#81294) Thanks @fuller-stack-dev.
### Changes

View File

@@ -570,6 +570,22 @@ describe("update global helpers", () => {
"-g",
"openclaw@latest",
]);
expect(globalInstallArgs("pnpm", "github:openclaw/openclaw#release/2026.5.12")).toEqual([
"pnpm",
"add",
"-g",
"--allow-build=openclaw",
"github:openclaw/openclaw#release/2026.5.12",
]);
expect(
globalInstallArgs("pnpm", "openclaw@git+https://github.com/openclaw/openclaw.git"),
).toEqual([
"pnpm",
"add",
"-g",
"--allow-build=openclaw",
"openclaw@git+https://github.com/openclaw/openclaw.git",
]);
expect(globalInstallArgs("bun", "openclaw@latest")).toEqual([
"bun",
"add",
@@ -599,6 +615,22 @@ describe("update global helpers", () => {
"/opt/pnpm-global",
"openclaw@latest",
]);
expect(
globalInstallArgs(
"pnpm",
"github:openclaw/openclaw#release/2026.5.12",
null,
"/opt/pnpm-global",
),
).toEqual([
"pnpm",
"add",
"-g",
"--global-dir",
"/opt/pnpm-global",
"--allow-build=openclaw",
"github:openclaw/openclaw#release/2026.5.12",
]);
});
it("builds npm staged install argv with an explicit prefix", () => {

View File

@@ -46,6 +46,7 @@ const NPM_GLOBAL_INSTALL_OMIT_OPTIONAL_FLAGS = [
"--omit=optional",
...NPM_GLOBAL_INSTALL_QUIET_FLAGS,
] as const;
const PNPM_OPENCLAW_BUILD_ALLOWLIST_FLAG = `--allow-build=${PRIMARY_PACKAGE_NAME}`;
const FIRST_PACKAGED_DIST_INVENTORY_VERSION = { major: 2026, minor: 4, patch: 15 };
const OMITTED_PRIVATE_QA_BUNDLED_PLUGIN_ROOTS = new Set([
"dist/extensions/qa-channel",
@@ -87,6 +88,21 @@ export function isExplicitPackageInstallSpec(value: string): boolean {
);
}
function stripPrimaryPackageAlias(spec: string): string {
const normalized = normalizePackageTarget(spec);
const prefix = `${PRIMARY_PACKAGE_NAME}@`;
return normalized.startsWith(prefix) ? normalized.slice(prefix.length).trim() : normalized;
}
function isPnpmOpenClawSourceInstallSpec(spec: string): boolean {
const target = stripPrimaryPackageAlias(spec);
return (
/^github:/i.test(target) ||
/^git\+(?:ssh|https|http|file):/i.test(target) ||
/^git:/i.test(target)
);
}
export function resolveExpectedInstalledVersionFromSpec(
packageName: string,
spec: string,
@@ -715,6 +731,7 @@ export function globalInstallArgs(
"add",
"-g",
...(installPrefix ? ["--global-dir", installPrefix] : []),
...(isPnpmOpenClawSourceInstallSpec(spec) ? [PNPM_OPENCLAW_BUILD_ALLOWLIST_FLAG] : []),
spec,
];
}