Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
883bd36
feat(cli): add update command
CorieW Aug 8, 2025
ce2ba7b
feat(cli/update): force flag
CorieW Aug 8, 2025
c56eaa0
feat(cli/update): check flag
CorieW Aug 8, 2025
bfdbd57
feat(cli/update): list flag
CorieW Aug 8, 2025
6edd65f
fix(cli/update): don't show RC versions in list
CorieW Aug 10, 2025
bb6aad5
feat(cli/update): add node support, not just binary
CorieW Aug 10, 2025
99dc301
feat(cli/update): installing a specific version
CorieW Aug 10, 2025
25d5a5a
feat: add notifications, fixed npm update, and improved code
CorieW Aug 11, 2025
dfa1ce5
chore: improve the code and receieve list of version from different p…
CorieW Aug 11, 2025
5aa35d9
Merge branch 'main' of https://github.com/firebase/genkit into @inver…
CorieW Aug 11, 2025
f861d3a
chore(cli/update): code adjustments
CorieW Aug 11, 2025
a62c010
chore(cli): format
CorieW Aug 11, 2025
76cf3cc
fix(cli/update): version problem
CorieW Aug 11, 2025
e314b8d
fix(cli/update): issue that potentially could block event loop
CorieW Aug 11, 2025
23f97bb
chore(cli/update): code improvements
CorieW Aug 11, 2025
755d49a
fix(cli/update): fix updating issues and minor tweaks to console prin…
CorieW Aug 11, 2025
71347b1
fix: remove list flag as not necessary
CorieW Aug 12, 2025
268fc19
fix(cli/update): small logging issue
CorieW Aug 12, 2025
e3ec0e5
fix(cli): runningFromNpmLocally func
CorieW Aug 12, 2025
b5b470f
feat(cli/update): handle various package managers
CorieW Aug 12, 2025
eb311a0
feat(cli/update): instead of detecting package manager and global/loc…
CorieW Aug 12, 2025
d277237
fix: remove --force for --reinstall, as clearer
CorieW Aug 13, 2025
38b9765
fix: only inquire package manager when non-binary
CorieW Aug 13, 2025
9e65048
feat(cli/update): improve version not found error message, and throw …
CorieW Aug 14, 2025
afa24ad
chore(cli/update): improve some logs
CorieW Aug 14, 2025
ff4b2c8
feat(cli): add --no-update-notification flag
CorieW Aug 14, 2025
9a285ca
feat(cli/update): clear message for not finding update version for bi…
CorieW Aug 14, 2025
f4ec5b5
feat(cli/update): add some tests
CorieW Aug 15, 2025
7f95f8f
feat(cli/update): added more tests and improved robustness to error
CorieW Aug 15, 2025
40a593a
Merge branch '@invertase/cli-add-update-cmd' of https://github.com/fi…
CorieW Aug 15, 2025
46c3e78
feat(cli/update): when fail to update via package manager, suggest al…
CorieW Aug 16, 2025
859656b
feat(cli/update): add update alternative for failed binary update
CorieW Aug 18, 2025
d987d4d
chore: format
CorieW Aug 18, 2025
26b80ac
fix(cli/update): modify update notification silencing method
CorieW Aug 18, 2025
8ea0df1
fix(cli/update): tests and feedback
CorieW Aug 18, 2025
8496f24
chore(cli/update): adjust for feedback and format
CorieW Aug 19, 2025
d1eca4b
chore(cli/update): adjust for feedback
CorieW Aug 19, 2025
c5dd947
fix(cli/update): try and fix inquirer testing issue
CorieW Aug 19, 2025
d348927
chore: format
CorieW Aug 19, 2025
a3ca3d0
fix(cli/update): failing tests
CorieW Aug 19, 2025
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
6 changes: 4 additions & 2 deletions genkit-tools/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build:watch": "tsc --watch",
"compile:bun": "bun build src/bin/genkit.ts --compile --outfile dist/bin/genkit --minify",
"test": "jest --verbose",
"genversion": "genversion -esf src/utils/version.ts"
"genversion": "genversion -esf --property name,version src/utils/version.ts"
},
"repository": {
"type": "git",
Expand All @@ -37,13 +37,15 @@
"get-port": "5.1.1",
"inquirer": "^8.2.0",
"open": "^6.3.0",
"ora": "^5.4.1"
"ora": "^5.4.1",
"semver": "^7.7.2"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/inquirer": "^8.1.3",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"@types/semver": "^7.7.0",
"bun-types": "^1.2.16",
"genversion": "^3.2.0",
"jest": "^29.7.0",
Expand Down
18 changes: 18 additions & 0 deletions genkit-tools/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
import { start } from './commands/start';
import { uiStart } from './commands/ui-start';
import { uiStop } from './commands/ui-stop';
import { showUpdateNotification, update } from './commands/update';
import { version } from './utils/version';

/**
Expand All @@ -56,6 +57,7 @@ const commands: Command[] = [
config,
start,
mcp,
update,
];

/** Main entry point for CLI. */
Expand All @@ -64,6 +66,7 @@ export async function startCLI(): Promise<void> {
.name('genkit')
.description('Genkit CLI')
.version(version)
.option('--no-update-notification', 'Do not show update notification')
.hook('preAction', async (_, actionCommand) => {
await notifyAnalyticsIfFirstRun();

Expand All @@ -85,6 +88,21 @@ export async function startCLI(): Promise<void> {
await record(new RunCommandEvent(commandName));
});

// Check for updates and show notification if available,
// unless --no-update-notification is set
// Run this synchronously to ensure it shows before command execution
const hasNoUpdateNotification = process.argv.includes(
'--no-update-notification'
);
if (!hasNoUpdateNotification) {
try {
await showUpdateNotification();
} catch (e) {
logger.debug('Failed to show update notification', e);
// Silently ignore errors - update notifications shouldn't break the CLI
}
}

// When running as a spawned UI server process, argv[1] will be '__server-harness'
// instead of a normal command. This allows the same binary to serve both CLI and server roles.
if (process.argv[2] === SERVER_HARNESS_COMMAND) {
Expand Down
12 changes: 12 additions & 0 deletions genkit-tools/cli/src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import {
import * as clc from 'colorette';
import { Command } from 'commander';

export const UPDATE_NOTIFICATIONS_OPT_OUT_CONFIG_TAG =
'updateNotificationsOptOut';

const CONFIG_TAGS: Record<
string,
(value: string) => string | boolean | number
Expand All @@ -38,6 +41,15 @@ const CONFIG_TAGS: Record<
return o;
}
},
[UPDATE_NOTIFICATIONS_OPT_OUT_CONFIG_TAG]: (value) => {
let o: boolean | undefined;
try {
o = JSON.parse(value);
} finally {
if (typeof o !== 'boolean') throw new Error('Expected boolean');
return o;
}
},
};

export const config = new Command('config');
Expand Down
Loading
Loading