Skip to content

Add npm package infrastructure for global CLI installation#6

Merged
TayDa64 merged 5 commits intomainfrom
copilot/add-cli-package-for-liku
Feb 2, 2026
Merged

Add npm package infrastructure for global CLI installation#6
TayDa64 merged 5 commits intomainfrom
copilot/add-cli-package-for-liku

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 2, 2026

Configures copilot-liku-cli as a production-ready npm package with automated publishing. Users can install globally with npm install -g copilot-liku-cli and run liku from any directory.

Package Configuration

  • Made src/cli/liku.js executable (already had correct shebang)
  • Enhanced package.json with repository metadata, engine constraints (Node ≥22, npm ≥10), OS compatibility, and explicit files property
  • Added .npmignore to optimize package size (145 KB packed, 71 files)

CI/CD Automation

Created .github/workflows/publish-npm.yml triggered on GitHub releases:

  • Runs tests and verifies package contents
  • Checks for version conflicts
  • Publishes to npm using NPM_TOKEN secret
  • Auto-comments on releases with install instructions

Documentation

New guides:

  • INSTALLATION.md - Platform-specific instructions (macOS/Linux/Windows) with Homebrew/Scoop placeholders
  • CONTRIBUTING.md - Development workflow using npm link
  • PUBLISHING.md - npm publishing procedures (manual and automated)
  • RELEASE_PROCESS.md - Versioning and release management

Updated:

  • README.md - npm global install instructions and documentation index
  • QUICKSTART.md - Global install option

Usage

After publication:

npm install -g copilot-liku-cli
liku --version
liku start

For local development:

git clone <repo>
npm install && npm link

To publish, set NPM_TOKEN in repository secrets and create a GitHub release. Workflow handles the rest.

Original prompt

I was brainstorming with copilot on how to Make liku globally runnable by publishing a proper CLI package and providing OS-specific installers; the fastest, lowest-friction path is to add a bin entry in package.json, publish to npm, and document npm install -g liku plus optional Homebrew/Scoop taps for macOS/Windows. npm Docs +1

Goals and constraints

• Goal: Launch copilot-Liku-cli as a top-level liku command from any directory.
• Constraints: cross-platform support (macOS, Linux, Windows), easy updates, secure distribution, CI-friendly releases.


High-level options comparison

Approach Ease of use Cross-platform Auto-updates Notes
npm global package High Yes No (user reinstalls) Standard for Node CLIs; uses bin in package.json. npm Docs
npm link / local symlink Dev-friendly Yes No Good for contributors; not for end users. Stack Overflow
Standalone binary (pkg / nexe) Medium Yes (build per OS) No Single-file executables; easier for non-Node users.
Homebrew / Scoop / Chocolatey High for users Platform-specific Yes (via package manager) Best UX on macOS/Windows; requires maintaining taps/packages.
OS packages (deb/rpm/MSI) Low for dev Platform-specific Yes Good for enterprise distribution; more maintenance overhead.


Recommended implementation plan

  1. Make the CLI a proper npm package

• Add bin to package.json so npm links an executable named liku into the global bin directory when installed with npm install -g. Example:

{
"name": "copilot-liku-cli",
"version": "1.0.0",
"bin": {
"liku": "./bin/liku.js"
}
}

• Ensure ./bin/liku.js has a shebang #!/usr/bin/env node and is executable. This is the canonical Node CLI pattern. npm Docs

  1. Publish to npm and document global install

• Publish as copilot-liku-cli or liku on npm and document npm install -g copilot-liku-cli and liku usage.
• Add CI that tags releases and publishes to npm automatically.

  1. Improve cross-platform UX

• Homebrew tap for macOS: create a formula that installs the npm package or a prebuilt binary. Enables brew install liku.
• Scoop / Chocolatey for Windows: provide manifests so Windows users can scoop install liku or choco install liku.
• Optionally produce single-file binaries with pkg for users who cannot run Node.

  1. Developer convenience

• Keep npm link documented for contributors to test local installs. Stack Overflow


Risks and mitigations

• PATH issues: Users may not have npm global bin in PATH; document how to find npm bin -g and add it. npm Docs
• Version drift: Recommend using package manager installs (Homebrew/Scoop) for easier updates.
• Permissions: Global npm installs may require sudo on some systems; suggest npm config set prefix or using Node version managers.



💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 2, 2026 11:35
- Made src/cli/liku.js executable (chmod +x)
- Enhanced package.json with repository, bugs, homepage, engines, and os fields
- Added comprehensive npm global installation instructions to README.md
- Updated QUICKSTART.md with npm install options
- Created CONTRIBUTING.md for development workflow guide
- Created INSTALLATION.md with platform-specific installation guides
- Added documentation section to README.md linking to all guides
- Verified npm link workflow works correctly

Co-authored-by: TayDa64 <976929+TayDa64@users.noreply.github.com>
- 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>
- Created GitHub Actions workflow for automated npm publishing on releases
- Added RELEASE_PROCESS.md with comprehensive release guidelines
- Updated PUBLISHING.md with automated workflow documentation
- Updated README.md to include release process documentation
- Workflow includes version checking, testing, and automatic commenting
- Supports both automated (via releases) and manual publishing

Co-authored-by: TayDa64 <976929+TayDa64@users.noreply.github.com>
- Fixed changelog filename references to match actual file (changelog.md)
- Added comment in .npmignore explaining .github/ exclusion for transparency
- Ensured consistency across documentation

Co-authored-by: TayDa64 <976929+TayDa64@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI package entry for liku installation Add npm package infrastructure for global CLI installation Feb 2, 2026
Copilot AI requested a review from TayDa64 February 2, 2026 11:44
Copy link
Copy Markdown
Owner

@TayDa64 TayDa64 left a comment

Choose a reason for hiding this comment

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

Making Liku global

@TayDa64 TayDa64 marked this pull request as ready for review February 2, 2026 12:22
Copilot AI review requested due to automatic review settings February 2, 2026 12:22
@TayDa64 TayDa64 merged commit d2d33a1 into main Feb 2, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request configures copilot-liku-cli as a production-ready npm package with global CLI installation support. Users will be able to install the package globally via npm install -g copilot-liku-cli and run the liku command from any directory. The PR adds comprehensive documentation, GitHub Actions automation for npm publishing, and package configuration optimizations.

Changes:

  • Added bin entry in package.json pointing to executable CLI entry point with proper shebang
  • Created GitHub Actions workflow for automated npm publishing on releases with version checking and package verification
  • Added comprehensive documentation (INSTALLATION.md, CONTRIBUTING.md, PUBLISHING.md, RELEASE_PROCESS.md) covering installation methods, development workflows, and release procedures
  • Enhanced package.json with repository metadata, Node ≥22/npm ≥10 engine constraints, OS compatibility, and explicit files property
  • Added .npmignore to exclude development files and reduce package size to ~145 KB

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
package.json Added bin entry, repository metadata, engine constraints, OS compatibility, and files list for npm packaging
src/cli/liku.js New CLI entry point with shebang, command registry, argument parsing, and help system
.github/workflows/publish-npm.yml Automated npm publishing workflow triggered on releases with tests, version checking, and comment creation
INSTALLATION.md Platform-specific installation instructions for macOS/Linux/Windows with troubleshooting guide
CONTRIBUTING.md Developer setup guide with npm link workflow for local development
PUBLISHING.md Complete npm publishing guide covering manual and automated workflows
RELEASE_PROCESS.md Versioning and release management procedures
README.md Updated with global npm installation instructions and documentation index
QUICKSTART.md Added global install option alongside local development setup
.npmignore Package optimization to exclude test files, development artifacts, and large documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +73 to +77
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🎉 Successfully published \`${packageJson.name}@${packageJson.version}\` to npm!\n\nInstall with:\n\`\`\`bash\nnpm install -g ${packageJson.name}\n\`\`\``
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 workflow attempts to create a comment on a release, but releases don't have an issue_number. The context.issue.number will be undefined for release events. You should use the release ID instead. Replace issue_number: context.issue.number with a proper release comment mechanism or use the GitHub Releases API to add a comment to the release body.

Suggested change
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🎉 Successfully published \`${packageJson.name}@${packageJson.version}\` to npm!\n\nInstall with:\n\`\`\`bash\nnpm install -g ${packageJson.name}\n\`\`\``
const release = context.payload.release;
const successMessage = `🎉 Successfully published \`${packageJson.name}@${packageJson.version}\` to npm!\n\nInstall with:\n\`\`\`bash\nnpm install -g ${packageJson.name}\n\`\`\``;
const updatedBody = (release.body || '') + '\n\n' + successMessage;
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
body: updatedBody,

Copilot uses AI. Check for mistakes.

### 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.
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci || npm install
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 fallback from npm ci to npm install using || could mask errors. If npm ci fails due to a package-lock.json mismatch or corruption, it will silently fall back to npm install, which could install different dependency versions than expected. Consider either ensuring package-lock.json is committed and up-to-date, or use npm ci without fallback for reproducible builds.

Suggested change
run: npm ci || npm install
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +59
- name: Check if version already published
id: check-version
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
PACKAGE_VERSION=$(node -p "require('./package.json').version")

if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" version 2>/dev/null; then
echo "⚠️ Version $PACKAGE_VERSION is already published"
echo "already_published=true" >> $GITHUB_OUTPUT
else
echo "✅ Version $PACKAGE_VERSION is not published yet"
echo "already_published=false" >> $GITHUB_OUTPUT
fi
continue-on-error: true
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 version check step has continue-on-error: true, which means if the check itself fails (e.g., npm registry is down), the workflow will continue and attempt to publish anyway, potentially causing an error later. Consider removing continue-on-error or adding explicit error handling to ensure the workflow behaves correctly when the npm registry is unavailable.

Copilot uses AI. Check for mistakes.
```bash
gh release create v1.0.0 \
--title "v1.0.0 - Release Name" \
--notes-file RELEASE_NOTES.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 a file RELEASE_NOTES.md that doesn't exist in the repository. This will cause the gh release create command to fail if a user follows these instructions. Either create this file, or update the example to use a different approach (like using --notes with inline text or referencing an existing file like changelog.md).

Suggested change
--notes-file RELEASE_NOTES.md
--notes-file changelog.md

Copilot uses AI. Check for mistakes.
runs-on: ubuntu-latest

permissions:
contents: read
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 workflow needs write permissions for contents and/or issues to create comments. Currently, it only has contents: read and id-token: write. Add contents: write to the permissions section to allow creating release comments or updating release descriptions.

Suggested change
contents: read
contents: write

Copilot uses AI. Check for mistakes.

- name: Run tests
run: npm test
continue-on-error: true
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.

Tests are set to continue-on-error: true, meaning the workflow will publish to npm even if tests fail. This is risky and could publish broken versions. Either remove continue-on-error: true or add a clear comment explaining why test failures should be ignored during publication.

Suggested change
continue-on-error: true

Copilot uses AI. Check for mistakes.
- [ ] All planned features/fixes are merged to `main`
- [ ] All tests are passing
- [ ] Documentation is up to date
- [ ] changelog.md is updated with release notes
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.

Copilot uses AI. Check for mistakes.
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/TayDa64/copilot-Liku-cli.git"
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.

There's an inconsistency in the repository URL capitalization. package.json uses copilot-Liku-cli.git while README.md uses copilot-Liku-cli (without .git). While GitHub handles this, it's better to be consistent. Either both should include .git or neither should.

Suggested change
"url": "https://github.com/TayDa64/copilot-Liku-cli.git"
"url": "https://github.com/TayDa64/copilot-Liku-cli"

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
"node": ">=22.0.0",
"npm": ">=10.0.0"
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 engines constraint requires Node.js >=22.0.0, which is a very recent version (released in April 2024). This may limit adoption significantly. Unless there are specific features from Node 22 that are required, consider using a lower version constraint like >=18.0.0 (LTS) or >=20.0.0 to allow more users to install the package.

Suggested change
"node": ">=22.0.0",
"npm": ">=10.0.0"
"node": ">=18.0.0",
"npm": ">=8.0.0"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants