genko.meDocs
SDK and CLI

CLI reference

CLI commands, generated files, overwrite behavior, and non-interactive use.

@genko-me/cli installs SDK packages, syncs types, and provides setup instructions for AI tools. This page corresponds to the 0.2.7 implementation. On Node.js 20.12 or later, run from the directory where the app's package.json is located.

Choose a command

CommandUsage
initInitial dependency addition, connection settings, and type generation
pullRegenerate types from the latest schema in the dashboard
mcpShow how to register the OAuth MCP server with an AI client
skillShow how to add genko.me instructions to a project

init: initial setup

bash
npx @genko-me/cli init

Enter your workspace ID (the slug in /w/{slug} on the dashboard) and API key, then select the APIs to sync. The CLI fetches the API definitions and adds or updates @genko-me/sdk@^0.6.0 and the development dependency @genko-me/cli@^0.2.6. If the project's package.json includes Next.js, it also adds or updates @genko-me/react@^0.5.0 and includes import "server-only" in client.ts. The package manager determines this from the package.json specification and lock file.

FileContentsEdit manually?
lib/schema.tsTypes and definitions for each APIDo not change as they will be regenerated
lib/client.tscreateGenko connection settingsPlugins etc. can be added
genko.config.jsonWorkspace, base URL, generation destinationAdjust if necessary
.env.exampleGuide to environment variablesAdjust to project operation
.env.localStorage location if the key is not set elsewhereTreated as secret information

If the key can be obtained from an environment variable or an existing environment file, do not store it in .env.local. The keys are not displayed on the screen.

init stops if generated files or configuration already exist. --force allows overwriting; use pull for routine type updates instead.

CLI generates connection settings and schema. Files for list/details pages are not generated. Please place the example page of Quick Start.

The interactive prompt masks the key and shows connection progress, generated file paths, and next steps. A generated file will not be created if you cancel during input. In an environment without a terminal such as CI, use --yes and --apis and environment variables.

pull: update types

bash
npx @genko-me/cli pull

Reads the schema from the connection destination of genko.config.json and regenerates the configured schema file. lib/client.ts will not be overwritten. If there are no changes to the schema, the file will not be rewritten and no update message will be displayed.

Since the API list is also synchronized, there is no need to edit the generated client. Since it only retrieves the schema, it does not upload entries or migrate data.

Configuration file

genko.config.json
{  "version": 1,  "workspace": "your-workspace",  "baseUrl": "https://api.genko.me",  "schemaOutput": "lib/schema.ts",  "clientOutput": "lib/client.ts"}

The destination is the path from the project root. For example, if you want to move to src/lib, also match the configuration path. API keys are not written in this file.

Projects using src/lib

init checks the routing directory and chooses the destination.

ConfigurationGenerate destination
src/app or src/pagessrc/lib/schema.ts/src/lib/client.ts
Root app or pageslib/schema.ts/lib/client.ts
None of the abovelib/schema.ts/lib/client.ts

If you have both, give priority to the root side, similar to Next.js. pull does not re-detect and uses the generation destination saved in genko.config.json. If you want to move the generation destination of an existing project, move the two files and change schemaOutput and clientOutput as well. Custom import aliases will not change automatically.

Select APIs to sync

Running init interactively shows API names and endpoints. Move with the arrow keys, check with Space, and confirm with Enter. You can interrupt it with Ctrl+C. Your selections are saved to endpoints in the configuration file.

bash
# Select APIs on first setupnpx @genko-me/cli init --workspace your-workspace --apis blog,works# Change the selection in an initialized projectnpx @genko-me/cli pull --select-apis# Change and save the selection without promptsnpx @genko-me/cli pull --apis blog,works# Sync all APIs, including future additionsnpx @genko-me/cli pull --all-apis

The API schema referenced from the selected API is automatically included because the display component handles the reference destination. This also applies to the destination where the reference was followed. It does not generate extraneous APIs. If the selected API or reference destination has been deleted or the definition cannot be obtained because it is not covered by the API key, the existing file will not be changed and an error will occur.

To get the list for selection, read the definition of the API allowed by that key from the delivery API's _schema. After that, narrow down the APIs to be generated and synchronized. Entry data is not fetched. API selection is not a setting that limits access rights.

Existing configuration without endpoints and init --yes without targeting will synchronize all APIs as before. If you want to fix the target, please specify --apis. If you use --watch, first save your selection with pull --select-apis.

Non-interactive execution

In CI etc., set GENKO_API_KEY in the secret information store and then execute.

bash
npx @genko-me/cli init --workspace your-workspace --yes --skip-install
OptionPurpose
--workspaceWorkspace ID (slug). GENKO_WORKSPACE can also be specified in init
--yesSkip interactive input
--base-urlConnect to another delivery API. In init, you can also specify GENKO_API_BASE_URL
--skip-installSkip installation of dependent packages
--apisSpecify endpoints to synchronize separated by commas and save
--all-apisSynchronize all APIs including future additions
--select-apisRe-select synchronization target interactively
--forceAllow overwriting of existing files during initial configuration

pull does not refer to GENKO_WORKSPACE or GENKO_API_BASE_URL, but uses configuration file or command options. If you pass only --workspace and --base-url, they apply only to the current fetch, and if you also specify API selection changes, they will be saved in the configuration file. The connection destination of client.ts is not automatically rewritten, so if you change the connection destination, please update it at the same time.

In an environment where --skip-install is specified, please prepare dependencies such as SDK separately. For CIs that have already been initialized, pull is usually used.

Settings for AI tools

bash
npx @genko-me/cli mcp --manualnpx @genko-me/cli skill --print

These only display the settings. Please refer to MCP Server and Skill for the storage location and overwriting policy when actually registering and deploying.

Troubleshooting

SituationAction
Already initializedUse pull and check that you are in the right project
Authentication errorCheck key issuer and workspace
Unable to call new APISynchronize API list and field definition with pull
Type changes disappearChange the schema in the dashboard, not the generated file
Key missing in productionSet the environment variable in production and redeploy

For a walkthrough of your first CLI setup, return to Quick Start.

Automatic synchronization during development

Run pull --watch in another terminal. Checks every 10 seconds and updates schema.ts only when changes occur. The API list is also synchronized, so there is no need to manually update the selected API to client.ts. If you want to use a new API, add it to the selection with pull --select-apis. Stop with Ctrl+C.

Last updated: October 16, 2026

On this page