Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@PeterDaveHello
Copy link
Contributor

Context

Add kilocode update command for CLI self-update functionality. Users can check for updates and install the latest version directly from the terminal without manually running package manager commands.

Implementation

  • Installation detection: Detects how the CLI was installed (npm, pnpm, yarn, bun, npx, docker, or local project dependency) by analyzing process.argv[1] path patterns
    • Uses original path (before symlink resolution) to distinguish local vs global installs
    • Handles Yarn PnP projects (.yarn/cache, .yarn/unplugged)
    • Excludes global path patterns to avoid misdetecting global installs as local
  • Version checking: Fetches latest version from npm registry with 10s timeout using AbortController
  • Update execution: Spawns appropriate package manager command with shell: true for Windows compatibility
  • Subcommand registration: Added to SUBCOMMANDS array in index.ts for fallback handling

Key design decisions:

  • Returns canUpdate: false for local installs, npx, and docker with manual update instructions
  • Uses semver.gt() for version comparison (consistent with auto-update.ts style)
  • Original argv path used for local detection to avoid pnpm store path conflicts
  • Updated auto-update notification to suggest kilocode update instead of hardcoded npm install -g

Screenshots

N/A (CLI command)

How to Test

# Build CLI
cd cli && pnpm build

# Test update check
pnpm start update --check

# Test with different install scenarios (mock by setting process.argv[1])
pnpm vitest run src/commands/__tests__/update.test.ts

Expected behaviors:

  • Global npm/pnpm/yarn/bun install → shows update command and executes it
  • Local node_modules install → shows "Running from local node_modules" with manual instructions
  • Yarn PnP project → shows "Running from Yarn PnP" with yarn up instruction
  • npx/pnpx/bunx → shows "Each run uses the latest version automatically"
  • Docker → shows docker pull instruction

Get in Touch

@PeterDaveHello

@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2026

🦋 Changeset detected

Latest commit: 07a5515

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@PeterDaveHello PeterDaveHello force-pushed the feat/cli-update-command branch from c033d86 to c8d6450 Compare January 28, 2026 18:44
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c033d86866

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@PeterDaveHello PeterDaveHello force-pushed the feat/cli-update-command branch from c8d6450 to f1326d7 Compare January 28, 2026 18:50
Add 'kilocode update' subcommand to check for and install CLI updates.

Features:
- Detects installation method (npm/pnpm/yarn/bun/npx/docker)
- Supports Linux, macOS, and Windows paths
- Uses semver for version comparison
- --check flag for check-only mode

Includes unit tests and README documentation.
@PeterDaveHello PeterDaveHello force-pushed the feat/cli-update-command branch from f1326d7 to 07a5515 Compare January 28, 2026 19:09
@kevinvandijk kevinvandijk added the CLI Kilo Code CLI label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI Kilo Code CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants