Skip to content

Commit 0975ddc

Browse files
committed
refactor(cli): change name of internal command
1 parent cf2360b commit 0975ddc

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

genkit-tools/cli/src/cli.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import { evalRun } from './commands/eval-run';
2929
import { flowBatchRun } from './commands/flow-batch-run';
3030
import { flowRun } from './commands/flow-run';
3131
import { getPluginCommands, getPluginSubCommand } from './commands/plugins';
32+
import {
33+
SERVER_HARNESS_COMMAND,
34+
serverHarness,
35+
} from './commands/server-harness';
3236
import { start } from './commands/start';
3337
import { uiStart } from './commands/ui-start';
34-
import {
35-
UI_START_SERVER_COMMAND,
36-
uiStartServer,
37-
} from './commands/ui-start-server';
3838
import { uiStop } from './commands/ui-stop';
3939
import { version } from './utils/version';
4040

@@ -83,10 +83,10 @@ export async function startCLI(): Promise<void> {
8383
await record(new RunCommandEvent(commandName));
8484
});
8585

86-
// When running as a spawned UI server process, argv[1] will be '__ui:start-server'
86+
// When running as a spawned UI server process, argv[1] will be '__server-harness'
8787
// instead of a normal command. This allows the same binary to serve both CLI and server roles.
88-
if (process.argv[1] === UI_START_SERVER_COMMAND) {
89-
program.addCommand(uiStartServer);
88+
if (process.argv[1] === SERVER_HARNESS_COMMAND) {
89+
program.addCommand(serverHarness);
9090
}
9191

9292
for (const command of commands) program.addCommand(command);

genkit-tools/cli/src/commands/ui-start-server.ts renamed to genkit-tools/cli/src/commands/server-harness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ function redirectStdoutToFile(logFile: string) {
3232
process.stderr.write = process.stdout.write;
3333
}
3434

35-
export const UI_START_SERVER_COMMAND = '__ui:start-server' as const;
35+
export const SERVER_HARNESS_COMMAND = '__server-harness' as const;
3636

37-
export const uiStartServer = new Command('__ui:start-server')
37+
export const serverHarness = new Command('__server-harness')
3838
.argument('<port>', 'Port to serve on')
3939
.argument('<logFile>', 'Log file path')
4040
.action(async (port: string, logFile: string) => {

genkit-tools/cli/src/commands/ui-start.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import fs from 'fs/promises';
2929
import getPort, { makeRange } from 'get-port';
3030
import open from 'open';
3131
import path from 'path';
32+
import { SERVER_HARNESS_COMMAND } from './server-harness';
3233

3334
interface StartOptions {
3435
port: string;
@@ -128,7 +129,7 @@ async function startAndWaitUntilHealthy(
128129
return new Promise((resolve, reject) => {
129130
const child = spawn(
130131
process.execPath,
131-
['__ui:start-server', port.toString(), serversDir + '/devui.log'],
132+
[SERVER_HARNESS_COMMAND, port.toString(), serversDir + '/devui.log'],
132133
{
133134
stdio: ['ignore', 'ignore', 'ignore'],
134135
}

0 commit comments

Comments
 (0)