TypeScript CLI reference

npx poly is the TypeScript package CLI (yargs, strict flags). Tutorial: TypeScript (Node). OpenAPI host modes: Using OpenAPI Specs. Glide: Project Glide.

Unknown flags error. Use npx poly <command> --help.

Permissions: generate needs Generate Library. sync and function add need CustomDev.

Commands

setup

npx poly setup [baseUrl] [apiKey]

Optional --apiVersion: 1 or 2 (default 1).

Stores instance URL and API key (see the TypeScript page for node_modules/.poly/.config.env).

generate

npx poly generate

Flag

Role

--contexts

Comma-separated context filter

--names

Resource names

--ids / --functionIds

Function ids

--customPath

Output path

--noTypes / --no-types

Skip TypeScript types

function add

npx poly function add <name> <file>

--client or --server (required for kind).

Flag

Role

--context

Namespace

--description

Description

--logs=enabled|disabled

Server function logs

--generateContexts

Limit contexts generated into the server runtime library

--skip-generate

Deploy without regenerating the local SDK

--execution-api-key

Runtime key used when the function executes

--cache-poly-library

Cache the Poly library in the server image

--image

Custom image (advanced)

--visibility

PUBLIC | TENANT | ENVIRONMENT (default ENVIRONMENT)

model generate / validate / train

OpenAPI → Specification Input → upsert. TypeScript CLI only.

$ npx poly model generate ./spec.yaml --context "myApi" --hostUrlAsArgument
$ npx poly model validate ./fake-title.json
$ npx poly model train ./fake-title.json

model generate <path> [destination] flags: --context, --hostUrl, --hostUrlAsArgument, --disable-ai, --rename.

If both host flags are set, --hostUrl wins. See Using OpenAPI Specs.

prepare / sync

Glide commands.

  • npx poly prepare — --lazy, --disable-docs, --disable-ai (or env DISABLE_AI=true)

  • npx poly sync — --dry-run, --custom-path, --execution-api-key

See Project Glide.

snippet add

npx poly snippet add <name> <path> --context … --description …

Env

POLY_API_KEY, POLY_API_BASE_URL (non-interactive), NO_COLOR, DISABLE_AI.