cmd update reports a network failure on a single transient registry miss

オープン
#1,048 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Gurugokul05 がすでに取り組んでいます。

2026年10月22日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, node.js

調査の方向性

Start by locating fetchVersions() and buildCliUpdateCheckOutcome in the CLI source corresponding to dist/cli.mjs, then trace how the updater log is written. Reproduce the single failed npm view command-code versions --json check and inspect how its error is caught and normalized. Done when transient failures retry up to three times with short backoff, the final underlying error is shown and logged, and a successful retry reports the update status.

索引モデルが issue の本文から書いたものです。

説明

Summary

cmd update (cmdc update on Windows) prints a network failure when one registry read misses, then the same command succeeds immediately. The check has no retry, and the catch hides the real error.

Transcript

Windows, Git Bash, [email protected]. No network change between the two runs.

$ cmdc update
✖ Failed to check for updates
Please check your internet connection or try again later.

$ cmdc update
✔ Up to date (1.84.0)

npm latest was 1.84.0 at the time, so the second run was a true up-to-date, not an install.

Check path (from dist/cli.mjs of 1.84.0)

buildCliUpdateCheckOutcome maps a null updateInfo to kind check-failed, spinner fail, message Failed to check for updates, detail Please check your internet connection or try again later. An up-to-date result is spinner succeed with Up to date (${currentVersion}).

updateInfo is null only when fetchVersions() returns null:

async function checkForUpdateAvailable() {
  const versions = await fetchVersions();
  if (!versions) return null;
}

async function fetchVersions() {
  try {
    const { stdout } = await execAsync(YP, {
      encoding: "utf-8",
      timeout: 5000,
      env: { ...process.env, NODE_NO_WARNINGS: "1" }
    });
    return normalizeVersionsResponse(JSON.parse(stdout));
  } catch {
    return null;
  }
}

execAsync is util.promisify(child_process.exec). YP is `npm view ${zP} versions --json` with zP = "command-code".

So the check is one npm view command-code versions --json, 5000ms, through a shell. Any timeout, non-zero exit, or non-JSON stdout becomes null. normalizeVersionsResponse also returns null when any entry is not a valid semver, so a registry warning on stdout fails the same way as a dead network.

There is no retry.

Why this is not "no internet"

  • ~/.commandcode/logs/command.log records Starting async update check and never records the failure. ~/.commandcode/updates.json stores lastCheckedAt and pending only. A failed check leaves no cause.
  • npm cache logs from the same evening show GET https://registry.npmjs.org/command-code returning 200 in 130-287ms.
  • No proxy, VPN, or custom registry is configured. ~/.npmrc only sets prefix and allow-scripts.

Ask

  1. Retry a failed registry read (3 tries, short backoff) before printing the failure.
  2. Print the underlying error (timeout, DNS, HTTP status, npm exit code), not only "check your internet".
  3. Write that error to the updater log.

Environment

  • OS: Windows, Git Bash
  • Package: [email protected] (npm global, %APPDATA%\npm)
  • Command: cmdc update
主要言語
言語のデータがありません
スター
4.2k
フォーク
377
平均マージ
1日 17分
マージ済み PR(30日)
7

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CommandCodeAI/command-code のほかの issue

CommandCodeAI/command-code の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。