Docs / README

@kitty-game-composer/sdk

Source: sdk/README.md

Typed TypeScript contract for Game Composer configuration parsing and lifecycle operations (up, down, status, logs, stop). The SDK is transport-agnostic: result shapes and the concrete runtime adapter belong to the host application.

Install

This package is published on npm as @kitty-game-composer/sdk:

npm install @kitty-game-composer/sdk

Requires Node.js 18+ (ES modules).

This package is the library contract only and has no command. The kitty command line tool is the Python package kitty-game-composer, with an optional npm launcher, @kitty-game-composer/cli. Both channels are listed in Get Kitty.

Usage

Parse a gamecomposer.yml manifest:

import { parseConfig } from '@kitty-game-composer/sdk';

const source = await (await import('node:fs/promises')).readFile('gamecomposer.yml', 'utf8');
const config = parseConfig(source, { sourceName: 'gamecomposer.yml' });

Drive lifecycle operations through a transport you supply:

import { createGameComposerClient } from '@kitty-game-composer/sdk';

const client = createGameComposerClient({
  async invoke({ operation, projectDirectory, configPath, signal }) {
    // Delegate to your CLI, API, or runtime adapter.
    return runtime.invoke({ operation, projectDirectory, configPath, signal });
  },
});

const status = await client.status({ projectDirectory: process.cwd() });
await client.up({ projectDirectory: process.cwd(), services: ['nes'], instance: '1' });
await client.down({ projectDirectory: process.cwd() });

Requests accept timeoutMs, an AbortSignal, instance, services, and newInstance. Failures are reported as LifecycleTimeoutError, LifecycleAbortedError, or LifecycleTransportError. TypeScript types for manifests, services, registry entries, and instance records are exported from the package root.

Registry helpers (0.3.0) match the app and the kitty registry CLI:

import { filterEntries, entryPlatforms, defaultController, registryIndexUrl } from "@kitty-game-composer/sdk";

const gba = filterEntries(catalog.entries, { platform: "gba" });   // consoles, games and pads for GBA
const pad = defaultController(catalog.entries, "gba");              // dedicated pad, then generic, then phone
const url = registryIndexUrl("<commit sha>");                        // pinned raw index.json URL

Development

npm ci
npm test          # build + typecheck + node:test suite
npm pack --dry-run

Licensed under MIT. See LICENSE.

Back to all docs