Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add npm package publishing configuration and guides
- Added .npmignore to exclude unnecessary files from npm package
- Added files property to package.json to explicitly control package contents
- Created PUBLISHING.md with comprehensive npm publishing guide
- Updated README.md to include publishing guide in documentation
- Verified package size (145 KB packed, 555 KB unpacked)
- Tested all CLI commands work correctly after npm link

Co-authored-by: TayDa64 <976929+TayDa64@users.noreply.github.com>
  • Loading branch information
Copilot and TayDa64 committed Feb 2, 2026
commit 908ff59d65304f7b6970cca69b5eb12d662a7b77
44 changes: 44 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Test files
scripts/test-*.js
scripts/*.ps1

# Documentation (most can be included, but some might be too large)
FINAL_SUMMARY.txt
GPT-reports.md
IMPLEMENTATION_SUMMARY.md
baseline-app.md
changelog.md
OVERLAY_PROOF.png

# Project management
.github/
.git/
.gitignore

# Development files
*.swp
*.swo
.DS_Store
Thumbs.db
.vscode/
.idea/

# Build artifacts
out/
build/
dist/
*.log

# Specific directories
ultimate-ai-system/
docs/

# Keep these important files for npm users
# README.md
# LICENSE.md
# QUICKSTART.md
# INSTALLATION.md
# CONTRIBUTING.md
# ARCHITECTURE.md
# CONFIGURATION.md
# TESTING.md
306 changes: 306 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
# Publishing Guide

This guide covers how to publish the Copilot-Liku CLI to npm.

## Prerequisites

Before publishing, ensure you have:

1. **npm account**: Create one at [npmjs.com](https://www.npmjs.com/signup)
2. **npm login**: Run `npm login` and authenticate
3. **Access rights**: If publishing to an organization, ensure you have publishing rights
4. **Clean repository**: All changes committed, tests passing

## Pre-Publication Checklist

### 1. Version Update

Update the version in `package.json` following [Semantic Versioning](https://semver.org/):

```bash
# 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 major
```

This will:
- Update `package.json`
- Create a git tag
- Commit the change

### 2. Update Changelog

Document changes in `changelog.md`:
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation references changelog.md which is excluded from the npm package via .npmignore. Either include changelog.md in the package by removing it from .npmignore, or update the documentation to reference CHANGELOG.md with a capital name or use GitHub releases for changelog information instead.

Suggested change
Document changes in `changelog.md`:
Document changes in `CHANGELOG.md`:

Copilot uses AI. Check for mistakes.
```markdown
## [1.0.0] - 2024-XX-XX

### Added
- Global npm installation support
- Comprehensive installation guides

### Changed
- Updated package.json with repository metadata

### Fixed
- Made CLI executable on all platforms
```

### 3. Verify Package Contents

Check what will be published:
```bash
npm pack --dry-run
```

Review the output to ensure:
- All necessary source files are included
- Documentation files are included
- Test files and development artifacts are excluded
- `.npmignore` is working correctly

### 4. Test Installation Locally

Test the package locally before publishing:

```bash
# 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-cli
```

### 5. Run Tests

Ensure all tests pass:
```bash
npm test
npm run test:ui
```

## Publishing to npm

### First-Time Publication

For the first publication to npm:

```bash
# Login to npm
npm login

# Publish the package (public)
npm publish --access public

# Or for a scoped package
npm publish --access public
```

### Subsequent Releases

For version updates:

```bash
# 1. Update version
npm version patch # or minor, or major

# 2. Push tags
git push origin main --tags

# 3. Publish
npm publish
```

## Automated Publishing with GitHub Actions

To automate publishing on GitHub releases, create `.github/workflows/publish.yml`:

```yaml
name: Publish to npm

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```

Then:
1. Create an npm access token at https://www.npmjs.com/settings/YOUR-USERNAME/tokens
2. Add it as `NPM_TOKEN` in GitHub repository secrets
3. Create a GitHub release to trigger publication

## Post-Publication

### 1. Verify Publication

```bash
# Check on npm
npm view copilot-liku-cli

# Test installation
npm install -g copilot-liku-cli
liku --version
```

### 2. Update Documentation

Update installation instructions if needed:
- README.md
- INSTALLATION.md
- QUICKSTART.md

### 3. Announce Release

- Create a GitHub release with release notes
- Update project status documentation
- Share on relevant channels

## Troubleshooting

### Error: Package name already exists

If someone else has registered the name:
1. Choose a different name in `package.json`
2. Or request transfer of the package if it's unused

### Error: Permission denied

Ensure you're logged in:
```bash
npm whoami # Check who you're logged in as
npm login # Login if needed
```

### Error: Failed to publish

Check:
- Version isn't already published: `npm view copilot-liku-cli versions`
- You have publish permissions
- Package name is available

### Version Already Published

If you need to fix a published version:
1. **Never unpublish** recent versions (npm policy)
2. Publish a patch version instead: `npm version patch && npm publish`

## Package Maintenance

### Deprecating a Version

If a version has issues:
```bash
npm deprecate copilot-liku-cli@0.0.1 "Critical bug, use 0.0.2 instead"
```

### Unpublishing

**Only for mistakes within 24 hours:**
```bash
npm unpublish copilot-liku-cli@0.0.1
```

⚠️ **Warning:** Unpublishing after 24 hours or if the package is widely used is against npm policy.

## Package Registry Alternatives

### GitHub Package Registry

To publish to GitHub Packages instead:

1. Update `.npmrc`:
```
@TayDa64:registry=https://npm.pkg.github.com
```

2. Update `package.json`:
```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"
}
}
```

3. Authenticate with GitHub token:
```bash
npm login --registry=https://npm.pkg.github.com
```

## Beta/Prerelease Versions

For testing before official release:

```bash
# 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
```

## Best Practices

1. **Use semantic versioning** consistently
2. **Test thoroughly** before publishing
3. **Maintain a changelog** for users
4. **Never publish secrets** or credentials
5. **Use .npmignore** to exclude unnecessary files
6. **Document breaking changes** clearly
7. **Respond to issues** from npm users
8. **Keep dependencies updated** for security

## Resources

- [npm Publishing Guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)
- [Semantic Versioning](https://semver.org/)
- [npm CLI Documentation](https://docs.npmjs.com/cli/v10)
- [Creating npm Packages](https://docs.npmjs.com/creating-node-js-modules)

## Support

For issues with publishing:
- Check [npm status](https://status.npmjs.org/)
- Review [npm documentation](https://docs.npmjs.com/)
- Contact [npm support](https://www.npmjs.com/support)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ See `docs/inspect-overlay-plan.md` for the inspect overlay plan and acceptance c
- **[Installation Guide](INSTALLATION.md)** - Detailed installation instructions for all platforms
- **[Quick Start Guide](QUICKSTART.md)** - Get up and running quickly
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute to the project
- **[Publishing Guide](PUBLISHING.md)** - How to publish the package to npm
- **[Architecture](ARCHITECTURE.md)** - System design and architecture
- **[Configuration](CONFIGURATION.md)** - Configuration options
- **[Testing](TESTING.md)** - Testing guide and practices
Expand Down
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@
"win32",
"linux"
],
"files": [
"src/",
"scripts/start.js",
"README.md",
"LICENSE.md",
"QUICKSTART.md",
"INSTALLATION.md",
"CONTRIBUTING.md",
"ARCHITECTURE.md",
"CONFIGURATION.md",
"TESTING.md",
"ELECTRON_README.md",
"PROJECT_STATUS.md"
],
"dependencies": {
"electron": "^35.7.5"
}
Expand Down