Skip to content

fix: set repository field on published packages for npm provenance - #112

Merged
setu4993 merged 1 commit into
mainfrom
fix/npm-provenance-repository
Nov 14, 2026
Merged

setu4993 merged 1 commit into
mainfrom
fix/npm-provenance-repository

Conversation

@setu4993

Copy link
Copy Markdown
Member

Summary

  • scripts/publish.mjs now sets repository (git+https://github.com/salesforce/agentscript.git plus the package's directory) on every non-private workspace package before pnpm -r publish.
  • With trusted publishing working (fix: upgrade npm in publish workflow so trusted publishing works #111), npm generates a provenance attestation, and the registry validates package.json repository.url against the repo in that attestation. None of the public packages declare repository, so the publish for fix: upgrade npm in publish workflow so trusted publishing works #111 failed with:

    E422 Unprocessable Entity - PUT .../@sf-agentscript%2fagentforce-dialect - Error verifying sigstore provenance bundle: Failed to validate repository information: package.json: "repository.url" is "", expected to match "https://github.com/salesforce/agentscript" from provenance

  • Injected at publish time, next to the existing @agentscript → @sf-agentscript rewrite, so the internal → open source sync can't drop it. It also adds the repo link to the published packages on npmjs.com.

Test plan

  • node --check scripts/publish.mjs
  • Read-only run of the new loop against the workspace: 15 public packages, correct directory for each; private docs, ui, vscode and the root are skipped
  • After merge, the Publish run on main publishes the pending versions (e.g. agentforce-dialect@2.88.3) without E422
  • No E404 on other packages (would mean that package is missing its trusted publisher config)

Trusted publishing generates a provenance attestation, and the registry rejects the publish (E422) unless package.json repository.url matches the GitHub repo that built it. None of the public packages declare one, so inject it at publish time alongside the scope rewrite.
@setu4993
setu4993 marked this pull request as ready for review November 14, 2026 00:28
@setu4993
setu4993 merged commit 6034749 into main Nov 14, 2026
8 checks passed
@setu4993
setu4993 deleted the fix/npm-provenance-repository branch November 14, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants