Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
## [Unreleased]

### 2026-04-03
- **Feat**: `geonic cli update` コマンドを追加 — `npm update -g` のエイリアスとして CLI を最新版に更新可能に (#94)
- **Fix**: 複数ターミナルで同一プロファイルを使用時、refresh token rotation によりセッションが無効化される問題を修正 — トークンリフレッシュ前に config を再読み込みし、別プロセスが既にリフレッシュ済みならそのトークンを使用する (#93)

## [0.9.0] - 2026-03-25
Expand Down
28 changes: 28 additions & 0 deletions src/commands/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { execSync } from "node:child_process";
import { createRequire } from "node:module";
import type { Command, Option } from "commander";
import { printInfo, printSuccess } from "../output.js";
import { withErrorHandler, resolveOptions } from "../helpers.js";
import { addExamples } from "./help.js";

function findOption(
Expand Down Expand Up @@ -275,4 +278,29 @@ export function registerCliCommand(program: Command): void {
command: "geonic cli version",
},
]);

const update = cli
.command("update")
.description("Update the CLI to the latest version")
.action(
withErrorHandler(async (...args: unknown[]) => {
const cmd = args[args.length - 1] as Command;
const opts = resolveOptions(cmd);
const updateCommand = "npm update -g @geolonia/geonicdb-cli";
if (opts.dryRun) {
printInfo(`[dry-run] ${updateCommand}`);
return;
}
printInfo("Updating @geolonia/geonicdb-cli...");
execSync(updateCommand, { stdio: "inherit" });
printSuccess("Update complete.");
}),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
);

addExamples(update, [
{
description: "Update CLI to the latest version",
command: "geonic cli update",
},
]);
}
Loading