Repository navigation
[pull] main from pnpm:main - #358
Merged
Merged
Conversation
* feat(pacquet-cli): add link command Co-authored-by: Zoltan Kochan <[email protected]> * fix(link): add dylint reason, fix TOCTOU and path normalization, and add integration tests Co-authored-by: Zoltan Kochan <[email protected]> * fix: update Cargo.lock and fix dylint macro-argument-binding in link command Co-authored-by: Zoltan Kochan <[email protected]> * fix: resolve test errors Co-authored-by: Zoltan Kochan <[email protected]> * test: add edge cases and coverage for link Co-authored-by: Zoltan Kochan <[email protected]> * fix: link test assertion Co-authored-by: Zoltan Kochan <[email protected]> * style: cargo fmt Co-authored-by: Zoltan Kochan <[email protected]> * fix: test failures on macos and windows for pacquet-link Co-authored-by: Zoltan Kochan <[email protected]> * style: fix clippy single_char_pattern Co-authored-by: Zoltan Kochan <[email protected]> * test: use fixture-relative path for missing target Co-authored-by: Zoltan Kochan <[email protected]> * fix: add disable_optimistic_repeat_install and add link command tests Adds the missing disable_optimistic_repeat_install field to the Install struct initializer required by upstream/main. Also adds comprehensive test coverage for the link command (ln alias, absolute paths, multiple targets, stderr error assertions). Co-authored-by: Zoltan Kochan <[email protected]> * feat(pacquet-cli): restore Zoltan's link fixes with workspace override support Restore Zoltan Kochan's link command improvements (LinkError, link_spec, already_declared, workspace-relative overrides) and add the missing set_overrides function in workspace-manifest-writer for pnpm-workspace.yaml override writing. Co-authored-by: Zoltan Kochan <[email protected]> * test(pacquet-cli): cover link override persistence and existing-dependency case Add two integration tests on top of the link command: - `link_persists_override_to_workspace_yaml` asserts the `link:` spec is recorded in `pnpm-workspace.yaml`'s `overrides:` block, not only in `dependencies`. - `link_existing_dependency_writes_override_only` covers a package already declared in `devDependencies`: no duplicate `dependencies` entry is added, the override still makes the local `link:` win, and the symlink is created. Also add the trailing commas the dylint perfectionist lint requires to the existing multi-line assertions. --------- Co-authored-by: Zoltan Kochan <[email protected]>
* ci: make review label automation tolerate queued captures * ci: harden review label lookup * ci: skip review label runner for untrusted actors
…12559) Add an `_auth` setting that carries registry authentication as one structured, URL-keyed value instead of many `//host/:_authToken=…` keys. GitHub Actions silently drops env vars whose names contain `/`, `:`, or `.` (and bash/zsh reject them outright), which broke the `pnpm_config_//host/:_authToken=…` form on CI (#12314). The `pnpm_config__auth` env var — the env projection of the `_auth` setting — sidesteps the runner-level filter while preserving host scoping. The same value can be set in the global pnpm config.yaml as a native YAML map. Design: - `_auth` is honored only from the env var and the global config.yaml — never a project pnpm-workspace.yaml / .npmrc — so repo-controlled config can never supply registry auth. The env var wins over the global config on a conflicting key. - The value is host-keyed: `{ "https://registry.example": { "@": {...}, "@org": {...} } }`. The host and credential arrive in one trusted value, so the same entry is a safe source of registry routing — repo config cannot redirect an env token to a different host. Routes inferred from `_auth` are applied after workspace yaml (env/global wins over repo config) and before PNPM_CONFIG_* so an explicit registry override still wins — matching pnpm's "CLI > _auth > yaml" precedence. - Reuses npm's deprecated `_auth` key name on purpose: pnpm reads the structured form only from its own yaml (and the env projection), so it never collides with npm's legacy `.npmrc` `_auth` scalar, and it is already covered by the existing protected-settings redaction (prints as `(protected)`). - Only `authToken` is accepted (maps byte-for-byte to the existing `//host/:_authToken` .npmrc key), so the parser is a thin adapter onto the existing auth pipeline. The deprecated `basicAuth` / `username` + `password` forms and `tokenHelper` are excluded — dropped with a warning. - Malformed values, non-object shapes, non-URL keys, non-http(s) schemes, URLs carrying credentials/query/fragment, invalid scopes, and unsupported auth fields each push a distinct warning and are skipped without aborting the load. Warnings never leak raw URL credentials. Parity: implemented on both sides (TS CLI + pacquet). Both support the single credential field `authToken`. Closes #12314. --------- Co-authored-by: Zoltan Kochan <[email protected]>
Port global package installation from the TypeScript pnpm CLI (pnpm11/) to the Rust pacquet port: `add -g`, `remove -g`, `update -g`, `outdated -g`, and a global `list`/`ls`. - New pacquet-global crate (ports @pnpm/global.packages + the pure helpers of @pnpm/global.commands): scan/find global package groups, hash-symlink helpers, createGlobalCacheKey, bin-conflict detection, and the depth-0 list -g tree/json/parseable renderers. - config: default_pnpm_home_dir (mirrors getDataDir), GLOBAL_LAYOUT_VERSION, the global dir fields, and checkGlobalBinDir (NO_PATH_ENV / GLOBAL_BIN_DIR_NOT_IN_PATH / PNPM_DIR_NOT_WRITABLE). Config now derives Clone. - cmd-shim: remove_bin (ports @pnpm/bins.remover) and an exclude_bins variant of link_bins_of_packages. - crypto-hash: create_hex_hash (full hex sha256) backing the cache key. - cli: per-group isolated installs reusing the install pipeline, the interactive promptApproveGlobalBuilds flow, -g on add/remove/update, the outdated -g aggregation, and the new list/ls command (global-only for now). list without -g and runtime --global remain unsupported. This is the pacquet (Rust) side of a feature that already exists in the TypeScript CLI.
Every request-path database call in the libsql/Turso auth backend was a bare await with no timeout, while the sqlx backend wraps its reads in with_auth_timeout and returns AuthDatabaseTimeout (HTTP 504). A stalled or hostile libsql endpoint could hold a Tokio task open indefinitely on every authenticated request, exhausting the executor and taking the whole registry down — a remote DoS with no 504 ever returned. Wrap the request-path reads (stored_hash, user_count, lookup, find_by_key, list_for_user) and the startup schema setup with a deadline, surfacing AuthDatabaseTimeout on expiry. The AuthDatabaseTimeout variant and its log_kind / status_code arms now compile under backend-libsql, not just the sqlx drivers. Writes stay unwrapped for the reason the sqlx backend documents: a cancelled write would leave an unknown commit state. --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Zoltan Kochan <[email protected]>
…UT (#12647) update_packument (PUT /:pkg/-rev/:rev) stripped only _attachments/_rev/_revisions and wrote the body verbatim, so a publisher with publish+unpublish rights could set versions[v].dist.integrity to a bogus SRI while the real tarball stayed valid — a permanent client-side EINTEGRITY DoS for that version, with no upload. The body name was also unchecked. Add three guards: reject a body whose name does not match the URL package; reject any change to an already-published version's dist.integrity (read under the package lock so a concurrent publish cannot race it); and reject a malformed SRI on a newly added version entry. All map to 400. The partial-unpublish flow is unaffected. --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Zoltan Kochan <[email protected]>
Move the agent comment guidance out of the TypeScript-only code style section into a repo-wide Comments section so it applies to the pnpm CLI, pacquet, and pnpr. Keep the Rust-specific comment additions in pacquet AGENTS.md and have pnpr reference that canonical Rust guidance instead of copying the same rules. This removes ambiguity about whether pnpr follows the pacquet convention without creating another block to maintain.
Move the PR conflict resolution helper out of pnpm11/shell and into root shell/. The helper is invoked by the git-wt PR hook and applies to whole-repo PR conflict resolution, including non-TypeScript changes, so it should not live under the TypeScript workspace.
…#12655) `send_with_retry` wraps only the request, so a body that fails mid-stream after a 200 ("error decoding response body") aborted the install instead of retrying. pnpm CLI retries this in a second `@zkochan/retry` layer in `fetchMetadataFromFromRegistry`; pacquet only had the request-level layer. - Add `retry_async` to `pacquet-network`, the body-read/parse companion to `send_with_retry`: it re-issues a full fetch closure under the same `RetryOpts` backoff when the closure returns a retryable error. - Add a distinct `FetchMetadataError::BodyRead` variant plus an `is_body_retryable()` predicate. Only `BodyRead` (mid-stream body failure) and `Decode` (broken JSON) retry; `Network` (transport/status, already retried inside `send_with_retry`) does not, so transport errors are not double-retried — matching pnpm, which rejects a fetch failure immediately while letting the network library retry internally. - Both metadata fetchers wrap their send -> body-read -> parse pipeline in `retry_async`, mapping `response.text()` failures to `BodyRead`. A 304 stays a success (returns the cached mirror body), not a retry.
Port the remaining `pnpm audit` fix/ignore features to pacquet, which previously implemented only the read/report path. - `--ignore <GHSA>` / `--ignore-unfixable`: suppress advisories and persist GHSAs to `auditConfig.ignoreGhsas`. - `--fix` (override): write `^patched` overrides to the `overrides:` block. - `--fix update`: re-resolve to non-vulnerable versions via a resolver-time PackageVersionGuard carried through the existing ResolutionObserver seam; report fixed vs. remaining from the post-update lockfile. - `-i` / `--interactive`: pick advisories to fix via a dialoguer multi-select. - minimumReleaseAge handling for both fix paths: patched versions are merged into minimumReleaseAgeExclude (new merge_package_version_specs in the config crate) and injected into the in-process update's resolve so the maturity cutoff doesn't block the fix. New format-preserving writers (set_overrides, set_audit_ignore_ghsas, set_minimum_release_age_excludes) land in the workspace-manifest writer. Normal installs are unchanged: the resolve override is None unless an audit-fix observer is installed.
…vironment (#12639) The Docker workflow can be triggered via workflow_dispatch, and its build job pushes mutable tags (:latest and :<major>) to ghcr.io/pnpm/pnpm. Unlike release.yml and update-latest.yml, the build job had no environment gate, so any collaborator with write access could publish an image to the public mutable tags without reviewer approval. Add an environment: release gate to the build job so workflow_dispatch runs require approval from the release environment reviewers, matching the protection already used by the other publishing workflows. The release (published) event path is unaffected. Co-authored-by: Claude <[email protected]>
…environment (#12640) pnpr-release-to-npm.yml can be triggered via workflow_dispatch. Its publish job uses npm OIDC trusted publishing to publish the `@pnpm/pnpr` package, and its docker job pushes the mutable ghcr.io/pnpm/pnpr:latest tag. Neither had an environment gate, so any collaborator with write access could publish to npm and overwrite the mutable Docker tag without reviewer approval. Add an environment: release gate to the publish and docker jobs (the build job produces no externally visible artifacts and is intentionally left ungated), matching the protection used by release.yml. Co-authored-by: Claude <[email protected]>
…12642) PackageManifest::save truncated package.json in place with File::create + write_all. A crash, OOM, or ENOSPC between the truncate and the completed write left the file empty or partial, destroying the user's dependency declarations with no recovery path. add/remove/update and set-script all go through this path. Write the serialized manifest to a sibling temp file, fsync it, then rename it over the target, matching the write-file-atomic guarantee the TypeScript pnpm CLI relies on. The crate's sibling workspace-manifest-writer already uses this pattern. --------- Co-authored-by: Claude <[email protected]>
Ports the unlink command from pnpm to pacquet. UnlinkArgs::run builds a list of packages to remove: the explicitly provided names or all link:-versioned dependencies across all groups (prod, dev, optional). If the list is empty the command is a no-op. It calls PackageManifest::remove_dependencies, saves the manifest, and delegates to Install which cleans up the stale symlink. No changeset because pacquet is not a published package. Related to #11633 --------- Co-authored-by: Zoltan Kochan <[email protected]>
…12659) #12646 rejects any re-PUT of an already-hosted version with 409 to keep published content immutable. But `pnpm deprecate`/`undeprecate` work by GET-ing the packument, flipping the `deprecated` flag, and re-PUT-ting it with no attachments and the hosted `dist` unchanged. That metadata-only update tripped the 409 guard, breaking test/deprecate.ts across the e2e suite (on every PR, via the merge commit). Narrow the guard to reject only a content re-publish of a clashing version: one that carries a new tarball (an attachment) or changes `dist.integrity`. Integrity is the content anchor clients verify against; the `tarball` URL is rewritten on read, so a faithful deprecate re-PUT carries a different URL but the same integrity and must be allowed. A metadata-only clash now passes, and merge_manifest preserves the hosted version's `dist`, so a metadata update can never repoint a version's integrity or tarball. Adds pnpr integration tests: a deprecate-style update is allowed and keeps the hosted `dist`; the attachment re-publish and the no-attachment integrity smuggle stay 409.
* feat(cli): port the `root` command to pacquet Add `pacquet root`, ported from pnpm11/pnpm/src/cmd/root.ts. Prints `<dir>/node_modules` built from the canonicalized `--dir`. It hardcodes the `node_modules` leaf and deliberately does not read `config.modules_dir`: pnpm's handler ignores a configured modules-dir, and pacquet re-anchors `config.modules_dir` to the workspace root inside a workspace, whereas pnpm's `root` uses `config.dir` (the cwd). Anchoring on `--dir` keeps parity in both cases. `--global` / `-g` is rejected with a "not supported yet" error: pacquet has no global packages directory yet, deferred to a shared follow-up that also unblocks `bin -g`. Related to #11633. * fix(cli): gate `root` differential test on Windows and type its `--global` error The `root_matches_pnpm_from_a_workspace_subdir` differential test spawns the real `pnpm`, which on Windows is a `pnpm.cmd` shim that `std::process::Command` cannot resolve via `PATHEXT` ("program not found"). Gate it with `#[cfg_attr(target_os = "windows", ignore)]`, matching the `cfg(unix)` gating in `pnpm_compatibility` and `hoist`. The other three `root` tests spawn only `pacquet` and keep running on Windows. Replace the bare `miette::miette!` rejection of `pacquet root --global` with a typed `RootError::GlobalUnsupported` diagnostic (code `pacquet_cli::root_global_unsupported`), mirroring `runtime`'s `GlobalUnsupported`, so the refusal carries a stable error code.
* feat(pacquet): port whoami command * fix(cli): redact registry URL from whoami error context * fix(cli): sanitize whoami username before printing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )