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 |
|---|---|
|
Comma-separated context filter |
|
Resource names |
|
Function ids |
|
Output path |
|
Skip TypeScript types |
function add¶
npx poly function add <name> <file>
--client or --server (required for kind).
Flag |
Role |
|---|---|
|
Namespace |
|
Description |
|
Server function logs |
|
Limit contexts generated into the server runtime library |
|
Deploy without regenerating the local SDK |
|
Runtime key used when the function executes |
|
Cache the Poly library in the server image |
|
Custom image (advanced) |
|
|
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 envDISABLE_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.