Skip to content

Commit ff4b2c8

Browse files
committed
feat(cli): add --no-update-notification flag
1 parent afa24ad commit ff4b2c8

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

genkit-tools/cli/src/cli.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export async function startCLI(): Promise<void> {
6666
.name('genkit')
6767
.description('Genkit CLI')
6868
.version(version)
69+
.option('--no-update-notification', 'Do not show update notification')
6970
.hook('preAction', async (_, actionCommand) => {
7071
await notifyAnalyticsIfFirstRun();
7172

@@ -87,12 +88,19 @@ export async function startCLI(): Promise<void> {
8788
await record(new RunCommandEvent(commandName));
8889
});
8990

90-
// Check for updates and show notification if available
91+
// Parse argv early to get global options
92+
program.parseOptions(process.argv);
93+
94+
// Check for updates and show notification if available,
95+
// unless --no-update-notification is set
9196
// Run this synchronously to ensure it shows before command execution
92-
try {
93-
await showUpdateNotification();
94-
} catch {
95-
// Silently ignore errors - update notifications shouldn't break the CLI
97+
const opts = program.opts();
98+
if (!opts.noUpdateNotification) {
99+
try {
100+
await showUpdateNotification();
101+
} catch {
102+
// Silently ignore errors - update notifications shouldn't break the CLI
103+
}
96104
}
97105

98106
// When running as a spawned UI server process, argv[1] will be '__server-harness'

0 commit comments

Comments
 (0)