Publishing to npm (Human + AI Workflow)
This repo supports an AI-assisted release flow with human-controlled credentials.
Recommended flow
- Ask AI to prepare release changes and update docs/changelog.
- Run publish preflight checks locally/CI.
- Verify package contents with
npm pack --dry-run. - Authenticate with npm token (
NPM_TOKEN) in CI or local shell. - Publish once version is confirmed unique.
Commands
# 1) Validate package and tests
npm ci
npm test
npm run build
# 2) Validate packaging scope
npm run publish:check
npm run publish:dryrun
# 3) Authenticate (if local)
npm whoami || npm adduser
# 4) Publish
npm publish --access public
AI-safe model
- Let AI handle code/tests/docs and dry-run validation.
- Keep npm credentials outside AI context using CI secrets (
NPM_TOKEN). - Require a human approval step before publish.
Common failure modes
ENEEDAUTH: not logged in (npm adduseror setNPM_TOKEN).- version already exists: bump
package.jsonversion and republish. - unexpected files: update
package.json > filesand rerunnpm pack --dry-run.