From 22344b7201602799d025a82bd3105f7b548cf9f5 Mon Sep 17 00:00:00 2001 From: Jacob Cable Date: Thu, 22 Aug 2024 12:50:59 +0100 Subject: [PATCH 1/2] refactor: rename genkit -> genkit-cli --- genkit-tools/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genkit-tools/cli/package.json b/genkit-tools/cli/package.json index 3616f5f831..0df3a532cd 100644 --- a/genkit-tools/cli/package.json +++ b/genkit-tools/cli/package.json @@ -1,5 +1,5 @@ { - "name": "genkit", + "name": "genkit-cli", "version": "0.5.10", "description": "CLI for interacting with the Google GenKit AI framework", "license": "Apache-2.0", From 25b49cb5e9dbac52ec9ed39585402f209e2968c5 Mon Sep 17 00:00:00 2001 From: Jacob Cable Date: Thu, 22 Aug 2024 13:23:30 +0100 Subject: [PATCH 2/2] feat(genkit-cli): add npx alias create-genkit --- genkit-tools/cli/package.json | 3 ++- genkit-tools/cli/src/bin/create-genkit.ts | 27 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 genkit-tools/cli/src/bin/create-genkit.ts diff --git a/genkit-tools/cli/package.json b/genkit-tools/cli/package.json index 0df3a532cd..49ca6cce15 100644 --- a/genkit-tools/cli/package.json +++ b/genkit-tools/cli/package.json @@ -11,7 +11,8 @@ ], "author": "genkit", "bin": { - "genkit": "dist/bin/genkit.js" + "genkit": "dist/bin/genkit.js", + "create-genkit": "dist/bin/create-genkit.js" }, "main": "dist/index.js", "scripts": { diff --git a/genkit-tools/cli/src/bin/create-genkit.ts b/genkit-tools/cli/src/bin/create-genkit.ts new file mode 100644 index 0000000000..72d6f6e47e --- /dev/null +++ b/genkit-tools/cli/src/bin/create-genkit.ts @@ -0,0 +1,27 @@ +#!/usr/bin/env node +/** + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { spawnSync } from 'child_process'; +import { join } from 'path'; + +// Resolve the path to the genkit.js file +const genkitPath = join(__dirname, 'genkit.js'); + +// Execute the genkit script with "init" as the argument +const result = spawnSync('node', [genkitPath, 'init'], { stdio: 'inherit' }); + +process.exit(result.status ?? 1);