Skip to content

Commit 9663e03

Browse files
committed
Add startup update notification
1 parent 4d884d2 commit 9663e03

12 files changed

Lines changed: 1146 additions & 5 deletions

‎CHANGELOG.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
99

1010
### [Unreleased]
1111

12+
#### Added
13+
14+
- **Startup update prompt** — Direct console launches with stdin, stdout, and stderr unredirected now check trusted nuget.org registration metadata for a newer listed stable release and offer `1. Update now` (runs `dotnet tool update --global nildiff`), `2. Skip` for the current run, or `3. Skip until next version`. The third choice stores `dismissedVersion` in the user-local cache, suppressing that release until a newer one is found. A successful update command exits cleanly with restart guidance; a skipped or failed update continues the requested CLI operation. Successful checks use a user-local 20-hour cache, failed checks use a one-hour retry backoff, redirected or automated runs skip the feature, and prereleases or unlisted packages are ignored. Network, response, cache, and updater failures cannot fail the CLI. Affected: `Services/UpdateNotificationService.cs`, `ProgramRunner.cs`, `Runner/ProgramRunner.Core.cs`, `Common/AppDataPaths.cs`, `README.md`, `USER_GUIDE.md`, `PACKAGE_README.md`, `doc/DEVELOPER_GUIDE.md`, `SECURITY.md`. Tests: `UpdateNotificationServiceTests` (16 tests).
15+
16+
#### Changed
17+
18+
- **Startup update prompt spacing** — Successful update and “skip until next version” confirmations now leave a blank line before subsequent terminal output. Affected: `Services/UpdateNotificationService.cs`. Tests: `UpdateNotificationServiceTests`.
19+
1220
#### Documentation
1321

22+
- **Centralized startup-update documentation** — Made `USER_GUIDE.md` the user-facing source of truth for console terminology, Windows/macOS/Linux examples, eligibility, choices, caching, and automation safety. Reduced `README.md` and `PACKAGE_README.md` to summaries with links, while developer, troubleshooting, and security documents now retain only role-specific details and refer back to the guide.
1423
- **Simplified the cdidx code-search policy** — Replaced duplicated version-specific setup, freshness, query, fallback, and command examples in `AGENT_GUIDE.md` with a concise requirement to use `cdidx`, identify [Widthdom/CodeIndex](https://github.com/Widthdom/CodeIndex) as its official source, and follow the MCP instructions and tool descriptions or CLI help and diagnostics provided by `cdidx` itself.
1524

1625
### [1.22.0] - 2026-07-26
@@ -1702,8 +1711,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
17021711

17031712
### [Unreleased]
17041713

1714+
#### 追加
1715+
1716+
- **起動時の更新プロンプト** — stdin・stdout・stderr がリダイレクトされていないコンソールから `nildiff` を直接起動したときに、信頼済み nuget.org registration metadata から listed な新しい安定版を確認し、`1. Update now`(`dotnet tool update --global nildiff` を実行)、今回だけ処理を続ける `2. Skip`、その版を通知対象外にする `3. Skip until next version` を選べるようにしました。3 を選ぶとユーザーローカルキャッシュの `dismissedVersion` に対象版を保存し、その版は再表示せず、さらに新しい版が見つかったときだけ再通知します。更新コマンド成功時は再起動案内を表示して正常終了し、スキップまたは更新失敗時は要求された CLI 処理を続行します。確認成功時はユーザーローカルの 20 時間キャッシュ、失敗時は 1 時間の再試行バックオフを使い、リダイレクトまたは自動実行された処理をスキップし、プレリリースと unlisted パッケージを無視します。ネットワーク、レスポンス、キャッシュ、更新処理が失敗しても CLI 本体は失敗しません。影響: `Services/UpdateNotificationService.cs`、`ProgramRunner.cs`、`Runner/ProgramRunner.Core.cs`、`Common/AppDataPaths.cs`、`README.md`、`USER_GUIDE.md`、`PACKAGE_README.md`、`doc/DEVELOPER_GUIDE.md`、`SECURITY.md`。テスト: `UpdateNotificationServiceTests`(16 件)。
1717+
1718+
#### 変更
1719+
1720+
- **起動時更新プロンプトの余白** — 更新成功時と「次の版までスキップ」の確認文の後には、続くターミナル出力との間に空行を残します。影響: `Services/UpdateNotificationService.cs`。テスト: `UpdateNotificationServiceTests`。
1721+
17051722
#### ドキュメント
17061723

1724+
- **起動時更新ドキュメントを集約** — コンソール用語、Windows/macOS/Linux の例、表示条件、選択肢、キャッシュ、自動処理を保護する理由について、`USER_GUIDE.md` を利用者向けの正本にしました。`README.md` と `PACKAGE_README.md` は参照リンク付きの要約へ縮小し、開発者向け、トラブルシューティング、セキュリティ文書には各役割に固有の説明だけを残してユーザーガイドを参照する構成にしました。
17071725
- **cdidx コード検索ポリシーを簡素化** — `AGENT_GUIDE.md` に重複していたバージョン依存のセットアップ、鮮度確認、クエリ、フォールバック、コマンド例を削除し、[Widthdom/CodeIndex](https://github.com/Widthdom/CodeIndex) を公式配布元として明示したうえで `cdidx` を使い、`cdidx` 自身が提供する MCP の instructions と tool descriptions、または CLI の help と diagnostics に従うという簡潔な要件へ置き換えました。
17081726

17091727
### [1.22.0] - 2026-07-26

‎Common/AppDataPaths.cs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
namespace FolderDiffIL4DotNet.Common
55
{
66
/// <summary>
7-
/// Resolves the application's user-local data paths for reports, logs, config, review checklist, and IL cache.
7+
/// Resolves the application's user-local data paths for reports, logs, config, review checklist, update checks, and IL cache.
88
/// Tests can override the LocalApplicationData root via <see cref="AppContext.SetData(string, object?)"/>.
9-
/// レポート、ログ、設定、レビューチェックリスト、IL キャッシュ向けのユーザーローカルデータパスを解決します。
9+
/// レポート、ログ、設定、レビューチェックリスト、更新確認、IL キャッシュ向けのユーザーローカルデータパスを解決します。
1010
/// テストでは <see cref="AppContext.SetData(string, object?)"/> で LocalApplicationData ルートを上書きできます。
1111
/// </summary>
1212
internal static class AppDataPaths
@@ -18,6 +18,7 @@ internal static class AppDataPaths
1818
private const string HTML_REPORT_DIRECTORY_NAME = "HtmlReport";
1919
private const string CONFIG_FILE_NAME = "config.json";
2020
private const string REVIEW_CHECKLIST_FILE_NAME = "checklist.json";
21+
private const string UPDATE_CHECK_CACHE_FILE_NAME = "update-check.json";
2122
private const string ERROR_LOCAL_APP_DATA_UNRESOLVED = "LocalApplicationData could not be resolved.";
2223

2324
/// <summary>
@@ -81,6 +82,10 @@ internal static string GetDefaultHtmlReportDirectoryAbsolutePath()
8182
internal static string GetDefaultReviewChecklistFileAbsolutePath()
8283
=> Path.Combine(GetDefaultConfigDirectoryAbsolutePath(), REVIEW_CHECKLIST_FILE_NAME);
8384

85+
/// <summary>Gets the update-check cache file path. / 更新確認キャッシュファイルのパスを返します。</summary>
86+
internal static string GetUpdateCheckCacheFileAbsolutePath()
87+
=> Path.Combine(GetApplicationDataRootAbsolutePath(), UPDATE_CHECK_CACHE_FILE_NAME);
88+
8489
/// <summary>Gets the bundled fallback config file path next to the executable. / 実行ファイル隣にある同梱フォールバック設定ファイルパスを返します。</summary>
8590
internal static string GetBundledConfigFileAbsolutePath()
8691
=> Path.Combine(AppContext.BaseDirectory, CONFIG_FILE_NAME);

0 commit comments

Comments
 (0)