This guide covers how to publish the Copilot-Liku CLI to npm.
Before publishing, ensure you have:
- npm account: Create one at npmjs.com
- npm login: Run
npm loginand authenticate - Access rights: If publishing to an organization, ensure you have publishing rights
- Clean repository: All changes committed, tests passing
Update the version in package.json following Semantic Versioning:
# For a patch release (bug fixes)
npm version patch
# For a minor release (new features, backwards compatible)
npm version minor
# For a major release (breaking changes)
npm version majorThis will:
- Update
package.json - Create a git tag
- Commit the change
Document changes in changelog.md:
## 0.0.15 - Liku Edition - 2026-XX-XX
### Added
- Description of new features
### Changed
- Description of changes
### Fixed
- Description of fixesCheck what will be published:
npm pack --dry-runReview the output to ensure:
- All necessary source files are included
- Documentation files are included
- Test files and development artifacts are excluded
.npmignoreis working correctly
Test the package locally before publishing:
# Create a tarball
npm pack
# Install globally from the tarball
npm install -g copilot-liku-cli-0.0.1.tgz
# Test the command
liku --version
liku --help
# Uninstall when done testing
npm uninstall -g copilot-liku-cliEnsure all characterization and smoke tests pass:
# Smoke suite
npm run smoke
# AI-service contract stability
node scripts/test-ai-service-contract.js
node scripts/test-ai-service-provider-orchestration.js
node scripts/test-v006-features.js
node scripts/test-bug-fixes.js
# Hook artifact enforcement
node scripts/test-hook-artifacts.js
# UI automation baseline
npm run test:uiFor the first publication to npm:
# Login to npm
npm login
# Publish the package (public)
npm publish --access public
# Or for a scoped package
npm publish --access publicFor version updates:
# 1. Update version
npm version patch # or minor, or major
# 2. Push tags
git push origin main --tags
# 3. Publish
npm publishThis repository includes automated publishing via GitHub Actions. Publishing is triggered when you create a GitHub release.
The workflow is already configured in .github/workflows/publish-npm.yml. To enable it:
-
Create an npm access token:
- Go to https://www.npmjs.com/settings/YOUR-USERNAME/tokens
- Click "Generate New Token" → "Automation"
- Copy the token
-
Add token to GitHub secrets:
- Go to your repository settings
- Navigate to Secrets and variables → Actions
- Click "New repository secret"
- Name:
NPM_TOKEN - Value: Paste your npm token
- Click "Add secret"
Once set up, publishing is automatic:
-
Update version:
npm version patch # or minor, or major git push origin main --tags -
Create a GitHub release:
- Go to https://github.com/TayDa64/copilot-Liku-cli/releases/new
- Select the tag you created
- Write release notes
- Click "Publish release"
-
Automated workflow runs:
- Checks out code
- Installs dependencies
- Runs tests
- Verifies package contents
- Publishes to npm automatically
- Comments on release with install instructions
- ✅ Automatic version checking (won't republish existing versions)
- ✅ Package verification before publishing
- ✅ Test execution
- ✅ Automatic comment with install instructions
- ✅ Manual dispatch option for testing
For detailed release process, see RELEASE_PROCESS.md.
If you prefer to publish manually instead of using the automated workflow:
For the first publication to npm:
# Login to npm
npm login
# Publish the package (public)
npm publish --access publicFor version updates:
# 1. Update version
npm version patch # or minor, or major
# 2. Push tags
git push origin main --tags
# 3. Publish
npm publish# Check on npm
npm view copilot-liku-cli
# Test installation
npm install -g copilot-liku-cli
liku --versionUpdate installation instructions if needed:
- README.md
- INSTALLATION.md
- QUICKSTART.md
- Create a GitHub release with release notes
- Update project status documentation
- Share on relevant channels
If someone else has registered the name:
- Choose a different name in
package.json - Or request transfer of the package if it's unused
Ensure you're logged in:
npm whoami # Check who you're logged in as
npm login # Login if neededCheck:
- Version isn't already published:
npm view copilot-liku-cli versions - You have publish permissions
- Package name is available
If you need to fix a published version:
- Never unpublish recent versions (npm policy)
- Publish a patch version instead:
npm version patch && npm publish
If a version has issues:
npm deprecate copilot-liku-cli@0.0.1 "Critical bug, use 0.0.2 instead"Only for mistakes within 24 hours:
npm unpublish copilot-liku-cli@0.0.1To publish to GitHub Packages instead:
- Update
.npmrc:
@TayDa64:registry=https://npm.pkg.github.com
- Update
package.json:
{
"name": "@TayDa64/copilot-liku-cli",
"repository": {
"type": "git",
"url": "https://github.com/TayDa64/copilot-Liku-cli.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
}- Authenticate with GitHub token:
npm login --registry=https://npm.pkg.github.comFor testing before official release:
# Create a prerelease version
npm version prerelease --preid=beta
# Publish with beta tag
npm publish --tag beta
# Users install with
npm install -g copilot-liku-cli@beta- Use semantic versioning consistently
- Test thoroughly before publishing
- Maintain a changelog for users
- Never publish secrets or credentials
- Use .npmignore to exclude unnecessary files
- Document breaking changes clearly
- Respond to issues from npm users
- Keep dependencies updated for security
For issues with publishing:
- Check npm status
- Review npm documentation
- Contact npm support