# Npm Publish
> Gestiona el flujo completo de socket-release para npm: bootstrap del paquete, publicación staged, promoción con --approve, backfill de versiones y rollback con deprecate.
Fuente: https://skillsagentes.com/skills/socketdev/sauce/npm-publish
Markdown: https://skillsagentes.com/skills/socketdev/sauce/npm-publish.md
Repositorio: https://github.com/SocketDev/sauce
Autor: SocketDev
Licencia: MIT
Actualizado: hace 2 meses
Coste de contexto: 85 tok instalada, 1.1k tok al activarse, 1.1k tok con todos los archivos del bundle
Bundle: 1 archivo, 4 KB
Permisos que pide: ninguno declarado
## Instalación
Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina.
```bash
# Claude Code
npx -y skills add SocketDev/sauce --skill npm-publish --agent claude-code
# Cursor
npx -y skills add SocketDev/sauce --skill npm-publish --agent cursor
# Codex
npx -y skills add SocketDev/sauce --skill npm-publish --agent codex
# Gemini CLI
npx -y skills add SocketDev/sauce --skill npm-publish --agent gemini
# Windsurf
npx -y skills add SocketDev/sauce --skill npm-publish --agent windsurf
# Cline
npx -y skills add SocketDev/sauce --skill npm-publish --agent cline
```
## Qué hace
- Bootstrapea un paquete npm (reserva de nombre, acceso de publicación permisivo-luego-solo-staged, trusted publishing)
- Despacha una publicación staged desde CI y la promueve con --approve tras verificación byte a byte
- Hace backfill de una versión antigua ya etiquetada con un dist-tag no-latest
- Revierte versiones malas con npm deprecate o rechaza entradas staged nunca promovidas
## Cuándo usarla
- Vas a publicar un paquete npm en un repo que lleva scripts/socket-release/
- Necesitas bootstrapear por primera vez el flujo de publicación staged de un paquete
- Tienes que hacer backfill de una versión ya taggeada que nunca se publicó
- Hay que revertir una versión publicada mala
## Qué la activa
- "Bootstrapea la publicación staged de este paquete npm"
- "Promociona la publicación staged con --approve"
- "Necesito hacer backfill de la versión 1.2.3 que nunca se publicó"
- "Revierte la versión 2.0.1 que salió rota"
## Antes de instalar
- Requiere un repo con scripts/socket-release/, acceso npm con 2FA del operador y GitHub Actions configurado para trusted publishing (OIDC).
- Necesita en el PATH: node, npm
## Archivos
- SKILL.md — 4 KB
## SKILL.md
Reproducido tal cual desde SocketDev/sauce bajo MIT. Esta sección es el documento original y está en inglés.
# npm publish (staged)
The kit's npm model: CI STAGES the publish through trusted publishing
(OIDC, environment `npm-publish`); a human PROMOTES it locally after
byte-verification. Direct publishing is disabled after bootstrap - staged
is the only path. Dry-run is every command's default.
## One-time bootstrap
```bash
node scripts/socket-release/bootstrap.mts # plan
node scripts/socket-release/bootstrap.mts --apply # stand up, stops at gates
node scripts/socket-release/bootstrap.mts --status # receipts
```
The canonical step order, the two access phases, and the four stop-and-gate moments
Steps run in canonical order: preflight → placeholder →
npm-access-permissive → github-env → staged-config → trusted-publisher →
npm-access-staged-only → verify. Two of them are npm publishing-access
steps: PERMISSIVE first (direct + staged enabled, only while the 0.0.0
placeholder is pending, so the one-time direct publish can land), then
STAGED-ONLY (direct publishing unchecked in the npm web UI once trusted
publishing stands). A re-run never re-widens; `verify` FAILS a package left
permissive and names the fix
(`node scripts/socket-release/bootstrap.mts npm-access-staged-only --apply`).
STOP AND GATE, never improvise, at these moments:
- **reserve name** - publishing `@0.0.0` is irreversible; only
`node scripts/socket-release/bootstrap.mts placeholder --apply --reserve `
performs it: the bootstrap renders the gate.
- **npm web-2FA** - the PTY prints `APPROVE HERE (expires in minutes): `;
the operator approves in their browser, the command keeps waiting.
- **placeholder promote** - a staged 0.0.0 needs
`node scripts/socket-release/npm-publish.mts --approve` plus the
operator's 2FA.
- **npm auth dead** - `node scripts/socket-release/npm-web-auth.mts login`
(both lanes run the same router command).
## Release cycle
1. Bump: edit `version` + CHANGELOG, commit
`chore: bump version to ` (load-bearing subject), push.
2. Stage from CI: the operator dispatches the `npm publish` workflow from
the Actions UI with `publish: true` (dry-run is the dispatch default;
`gh workflow run` is guard-blocked for agents - the human clicks).
3. Soak: staged entries are maintainer-visible only. Inspect with
`pnpm stage list --json` - an unauthenticated or wrong-account list
reads as EMPTY, not as an error, so identity-check first
(`node scripts/socket-release/npm-web-auth.mts login`).
4. Promote: `node scripts/socket-release/npm-publish.mts --approve` - it
byte-verifies the staged tarball, promotes through the operator's 2FA,
then cuts the git tag + immutable GitHub release once the version
resolves live (ORDER RULE - registry first, release marker last).
5. Verify: the version resolves on the registry and the release exists; a
missing tag/release heals with
`node scripts/socket-release/github-release.mts --tag v --release`.
## Backfill
An already-tagged version that never published: a backfill never moves the
`latest` pointer, so it always needs an explicit non-`latest` dist-tag.
Dispatch the workflow with `backfill-version: X.Y.Z` + `checkout-ref: vX.Y.Z`
\+ `dist-tag: backfill` (any non-`latest` tag), or locally
```bash
node scripts/socket-release/npm-publish.mts --staged --backfill X.Y.Z --checkout-ref vX.Y.Z --tag backfill --dry-run
```
Drop `--dry-run` only after the plan reads clean; promotion is the same
`--approve` path.
## Rollback
npm publishes are permanent (unpublish closes at 72h and burns nothing
back). Roll back by deprecating the bad version and shipping a fixed one:
```bash
npm deprecate @ "broken — use "
```
Deprecation needs the operator's npm auth (2FA) - gate, do not improvise.
A never-promoted staged entry needs no rollback: reject it with
`node scripts/socket-release/npm-web-auth.mts stage reject ` and
re-stage.
## Dónde encaja
- Categoría: [DevOps e infraestructura](https://skillsagentes.com/categorias/devops-infraestructura.md) — Despliegues, contenedores, IaC y flujos de gestión de incidentes.
- Creador: [SocketDev](https://skillsagentes.com/creators/socketdev.md) — 15 skills en el directorio
- [Todas las skills](https://skillsagentes.com/skills.md)
- [Ranking de instalaciones](https://skillsagentes.com/ranking.md)
## Otras skills del mismo repositorio
- [Socket Connect](https://skillsagentes.com/skills/socketdev/sauce/socket-connect.md): Conecta tu agente a Socket iniciando sesión por el navegador, sin copiar ni pegar una API key. Incluye el servidor Socket MCP alojado (OAuth), lista tus organizaciones y enlaza el Socket CLI para escaneos.
- [Socket Fix](https://skillsagentes.com/skills/socketdev/sauce/socket-fix.md): Arregla problemas de seguridad en dependencias: escanea y corrige todo (requiere /socket-scan) o repara un paquete concreto, orquestando los subskills de limpieza, reemplazo, parcheo y actualización.
- [Socket Dep Upgrade](https://skillsagentes.com/skills/socketdev/sauce/socket-dep-upgrade.md): Usa `socket fix` para encontrar y actualizar dependencias vulnerables, y luego corrige los cambios incompatibles en el código. Actualizaciones auditadas en seguridad con migración de código automatizada.
- [Socket Inspect](https://skillsagentes.com/skills/socketdev/sauce/socket-inspect.md): Investiga un paquete antes de depender de él: extrae señales de Socket (scores, alertas, malware, CVEs, riesgo de cadena de suministro), revisa socket.dev, evalúa alternativas y muestra parches disponibles.
- [Socket Scan](https://skillsagentes.com/skills/socketdev/sauce/socket-scan.md): Ejecuta un escaneo de dependencias con Socket CLI: pide login o cuenta si no estás autenticado, ofrece un SBOM local si lo rechazas, y añade reachability y auditoría de licencias para enterprise.
## Skills relacionadas
- [Socket Release](https://skillsagentes.com/skills/socketdev/sauce/socket-release.md): Pon en marcha la publicación de SocketDev (npm, crates.io, GitHub releases, tap de Homebrew) en un repo copiando el kit socket-release desde sauce y ejecutando su bootstrap.
- [Brew Publish](https://skillsagentes.com/skills/socketdev/sauce/brew-publish.md): Gestiona el flujo de la tap de Homebrew de socket-release: fórmula con descarga binaria, bumps ligados a releases y verificación de sha256 contra el checksums.txt del release.
- [Cargo Publish](https://skillsagentes.com/skills/socketdev/sauce/cargo-publish.md): Gestiona el flujo de publicación en crates.io: modelo cargo staged (dry-run por defecto), trusted publishing vía OIDC bajo el entorno cargo-publish, espera de propagación de índice y rollback con yank.
- [Github Release](https://skillsagentes.com/skills/socketdev/sauce/github-release.md): Corta, verifica y repara releases inmutables de GitHub con el kit socket-release: la ORDER RULE de resolubilidad del registro, el corte en tres pasos draft-upload-undraft, checksums.txt y reparación de gaps de tag.
- [Socket Setup](https://skillsagentes.com/skills/socketdev/sauce/socket-setup.md): Configura Socket: conecta tu cuenta mediante inicio de sesión en el navegador, instala el CLI, configura políticas y tokens de CI, y prepara el CI/CD para los modos firewall o patch en GitHub, GitLab, Bitbucket y otros sistemas.
---
Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)