Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
contentstack avatar

Typescript Cli Tsgen

  • 1 installs
  • 11 repo stars
  • Updated June 3, 2026
  • contentstack/contentstack-cli-tsgen

Understand and work with the contentstack-cli-tsgen OCLIF plugin and csdx tsgen command that generate TypeScript types from Contentstack schemas.

About

Provides a mental model for the contentstack-cli-tsgen OCLIF plugin and its tsgen command, which generates TypeScript types from Contentstack schemas. A developer uses it to work on or use the csdx tsgen type-generation command.

  • Mental model for the contentstack-cli-tsgen OCLIF plugin and tsgen command
  • Separates CLI-plugin concerns from the types-generator library

Typescript Cli Tsgen by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #468 of 550 CLI & Terminal skills by installs in the Skillselion catalog
  • Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/contentstack/contentstack-cli-tsgen --skill typescript-cli-tsgen

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars11
Last updatedJune 3, 2026
Repositorycontentstack/contentstack-cli-tsgen

What it does

Understand and work with the contentstack-cli-tsgen OCLIF plugin and csdx tsgen command that generate TypeScript types from Contentstack schemas.

Files

SKILL.mdMarkdownGitHub ↗

TypeScript CLI tsgen skill

Role of this repo

  • Plugin for `csdx`: implements `TypeScriptCodeGeneratorCommand` in `src/commands/tsgen.ts`.
  • Generation is delegated to `@contentstack/types-generator` (npm, GitHub)—version ^3.9.3 in package.json. Do not assume a local clone; use npm and published source only.

Change here vs change in the library

ConcernWhere
New flags, output path, csdx UX, `printFormattedError`This repo (src/commands/, src/lib/)
Schema mapping, Delivery SDK calls, GraphQL introspection`@contentstack/types-generator`

Helpers

  • `src/lib/helper.ts`: `sanitizePath`, `printFormattedError` (FormattedError, `error_code` switch).
  • `src/types/index.ts`: `StackConnectionConfig` and related CLI types.

OCLIF

  • Commands compile to `lib/commands`; `prepack` refreshes `oclif.manifest.json` and README.

Command shape (tsgen)

  • Extends `Command` from `@contentstack/cli-command` (`src/commands/tsgen.ts`).
  • Flags include `token-alias` (-a, required), `output` (-o), `prefix`, `doc`, `branch`, `include-system-fields`, `include-editable-tags`, `include-referenced-entry`, `api-type` (rest \| graphql), `namespace` (GraphQL).
  • Resolve token via `this.getToken(flags["token-alias"])`; warn if `token.type !== "delivery"` (management token can break Delivery/GraphQL flows).
  • Build `StackConnectionConfig`: `apiKey`, `token`, `region`, `environment`, `branch`, `host` as in existing code.
  • `api-type === "graphql"``graphqlTS(...)` with delivery token; REST`generateTS` with `tokenType: "delivery"`; write output with `fs.writeFileSync` to the resolved path.
  • Use `printFormattedError` from `src/lib/helper.ts` for consistent CLI messaging.

Related skills

CLI & Terminalintegrationsbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.