Skip to content
Merged
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
17 changes: 16 additions & 1 deletion genkit-tools/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,22 @@ export const init = new Command('init')
process.exit(1);
}
const runtime = detectRuntime(process.cwd());
if (!supportedRuntimes.includes(runtime)) {
if (!runtime) {
logger.info('No runtime was detected in the current directory.');
if (
await confirm({
default: true,
message: 'Would you like to initialize a Node.js Genkit project?',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would it look like for Go?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention was just to use Node.js as the default if nothing is detected since we don't have any support for Go here yet.

})
) {
execSync(`npm init -y`, { stdio: 'inherit' });
} else {
logger.error(
'Please re-run `genkit init` from an active project directory.'
);
process.exit(1);
}
} else if (!supportedRuntimes.includes(runtime)) {
logger.error(
`The runtime could not be detected or is not supported. Supported runtimes: ${supportedRuntimes}`
);
Expand Down