---
name: 58publish
description: >-
  Publish internal skills, bundles, or other prepared npm packages to the 58 private registry.
  Includes env checks, a high-level publish orchestrator, and a low-level publish script for one-step dry-run and publish flows.
---

# 58 Publish

This skill publishes prepared package directories to the 58 private npm registry.

## Included Components

- `scripts/check-58npm-env.mjs`
  - Checks whether the current shell has 58npm auth environment variables
  - Optionally runs `npm whoami` as a preflight
- `scripts/publish-58npm-package.mjs`
  - High-level publish orchestrator
  - Handles git checks, optional prepare commands, auth preflight, then calls the core publisher
- `scripts/publish-58npm-package-core.mjs`
  - Low-level publish script
  - Handles temporary `.npmrc`, `npm pack --dry-run`, and `npm publish`

## Positioning

- `tools-base/skills/58publish` is the shared upstream source of this 58 registry publishing capability.
- Business repositories can copy, bundle, or wrap these scripts without re-implementing the publish logic.
- If downstream repositories still keep older skill names or scripts, treat them as distribution copies rather than new sources of truth.

## Principles

- Publish only package directories that are already prepared.
- Never write `epfenpm` passwords, base64 credentials, or temporary tokens into the repository.
- Inject authentication only through environment variables.
- Run `--dry-run` first, then publish for real.

## Authentication

Preferred:

```bash
export NPM_58_AUTH_BASE64="base64(username:password)"
```

Or:

```bash
export NPM_58_USERNAME="epfenpm"
export NPM_58_PASSWORD="***"
export NPM_58_EMAIL="epfe@58.com"
```

## Recommended Commands

Check the environment first:

```bash
node scripts/check-58npm-env.mjs
```

Use the high-level orchestrator by default:

```bash
node scripts/publish-58npm-package.mjs --package-dir <dir> --dry-run
node scripts/publish-58npm-package.mjs --package-dir <dir>
```

If you need a build or bundle step before publishing:

```bash
node scripts/publish-58npm-package.mjs \
  --package-dir <dir> \
  --prepare-cmd "<build-or-bundle-cmd>" \
  --dry-run
```

## Typical Use Cases

- Publish skills bundles
- Publish business bundles
- Publish standalone installer packages
- Publish other prepared internal npm packages

## Recommended Flow

1. Prepare the bundle or package directory.
2. Run `node scripts/check-58npm-env.mjs`.
3. Run the high-level dry-run.
4. Check `package.json` fields such as `name`, `version`, `bin`, `files`, and `publishConfig.registry`.
5. Publish only after the dry-run succeeds.

## Read On Demand

- Workflow details: [resources/publish-workflow.md](resources/publish-workflow.md)
- Auth and environment variables: [resources/auth-and-env.md](resources/auth-and-env.md)
- Downstream sync guidance: [resources/downstream-sync.md](resources/downstream-sync.md)
