{"id":47601909,"url":"https://github.com/kitops-ml/kitops-ts","last_synced_at":"2026-04-01T18:52:50.516Z","repository":{"id":345608845,"uuid":"1180219734","full_name":"kitops-ml/kitops-ts","owner":"kitops-ml","description":"Typescript library for KitOps","archived":false,"fork":false,"pushed_at":"2026-03-30T19:26:48.000Z","size":76,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-30T21:20:00.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitops-ml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T20:30:20.000Z","updated_at":"2026-03-25T14:22:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kitops-ml/kitops-ts","commit_stats":null,"previous_names":["kitops-ml/kitops-ts"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kitops-ml/kitops-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitops-ml%2Fkitops-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitops-ml%2Fkitops-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitops-ml%2Fkitops-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitops-ml%2Fkitops-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitops-ml","download_url":"https://codeload.github.com/kitops-ml/kitops-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitops-ml%2Fkitops-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-01T18:52:49.875Z","updated_at":"2026-04-01T18:52:50.504Z","avatar_url":"https://github.com/kitops-ml.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kitops-ts\n\n[![npm version](https://img.shields.io/npm/v/@kitops/kitops-ts)](https://www.npmjs.com/package/@kitops/kitops-ts)\n[![CI](https://github.com/kitops-ml/kitops-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/kitops-ml/kitops-ts/actions/workflows/ci.yml)\n[![License](https://img.shields.io/npm/l/@kitops/kitops-ts)](./LICENSE)\n\nTypeScript/Node.js SDK for the [KitOps](https://kitops.org) CLI. Provides a type-safe functional API for packing, pushing, pulling, and inspecting ModelKits — without having to shell out manually.\n\nSimilar to [pykitops](https://github.com/kitops-ml/pykitops) but for TypeScript/JavaScript.\n\n## Requirements\n\n- Node.js \u003e= 23\n- [KitOps CLI](https://kitops.org/docs/cli/installation/) installed and available in `PATH`\n  (or set `KITOPS_CLI_PATH` to the full path of the binary)\n\n## Installation\n\n```bash\nnpm install @kitops/kitops-ts\n# or\npnpm add @kitops/kitops-ts\n```\n\n## Quick start\n\n```typescript\nimport { login, pack, push } from '@kitops/kitops-ts';\n\nawait login('registry.example.com', process.env.REGISTRY_USER!, process.env.REGISTRY_PASS!);\nawait pack('.', { tag: 'registry.example.com/org/my-model:v1.0.0' });\nawait push('registry.example.com/org/my-model:v1.0.0');\n```\n\n## API\n\n### `init(path?, flags?)`\n\nScans a directory for ML artifacts and generates a Kitfile. Automatically detects models, datasets, code, and docs by file extension.\n\n```typescript\nconst result = await init('./my-model', {\n  name: 'my-model',\n  desc: 'Sentiment analysis model',\n  author: 'ML Team',\n  force: true, // overwrite existing Kitfile\n});\n\nconsole.log(result.kitfilePath); // absolute path to the generated Kitfile\n```\n\n### `info(repository, tag, flags?)`\n\nReturns the parsed Kitfile for a ModelKit. The result also carries a non-enumerable `_raw` property with the original YAML string.\n\n```typescript\nconst kitfile = await info('registry.example.com/org/my-model', 'v1.0.0');\nconsole.log(kitfile.package?.name);\nconsole.log(kitfile.model?.path);\n```\n\n### `inspect(repository, tag, flags?)`\n\nReturns the full OCI manifest and parsed Kitfile. Use `flags.remote` to inspect directly from a registry without pulling first.\n\n```typescript\nconst result = await inspect('registry.example.com/org/my-model', 'v1.0.0', { remote: true });\nconsole.log(result.digest);\nconsole.log(result.manifest.layers);\n```\n\n### `pack(directory?, flags?)`\n\nPackages a directory containing a Kitfile into a ModelKit.\n\n```typescript\nawait pack('.', {\n  tag: 'registry.example.com/org/my-model:v1.0.0',\n  compression: 'zstd',\n});\n```\n\n### `unpack(destination, flags?)`\n\nExtracts a ModelKit into a directory. Use `flags.filter` to pull out specific layers or paths.\n\n```typescript\n// Extract everything\nawait unpack('./output');\n\n// Model layer only\nawait unpack('./output', { filter: 'model' });\n\n// A specific dataset and the full docs layer\nawait unpack('./output', { filter: 'datasets:validation,docs' });\n\n// Don't fail if files already exist\nawait unpack('./output', { ignoreExisting: true });\n```\n\n### `list(repository?)`\n\nLists ModelKits. Omit the argument to list local storage; pass a registry/repository to list remote tags.\n\n```typescript\nconst local = await list();\nconst remote = await list('registry.example.com/org/my-model');\n\nfor (const kit of local) {\n  console.log(kit.repository, kit.tag, kit.size, kit.digest);\n}\n```\n\n### `push(source, destination?)`\n\nPushes a ModelKit to a registry. Supply `destination` to push under a different reference (e.g. promote from staging to production).\n\n```typescript\nawait push('registry.example.com/org/my-model:v1.0.0');\n\n// Push to a different registry under a different tag\nawait push('staging.example.com/my-model:rc1', 'registry.example.com/org/my-model:v1.0.0');\n```\n\n### `pull(reference)`\n\nPulls a ModelKit from a registry into local storage.\n\n```typescript\nawait pull('registry.example.com/org/my-model:v1.0.0');\n```\n\n### `loginUnsafe(registry, username, password)`\n\nAuthenticates with a registry. The password is passed as a CLI argument and will be visible in the process list — use `login` instead for production.\n\n```typescript\nawait loginUnsafe('registry.example.com', 'user', 'pass');\n```\n\n### `login(registry, username, password)`\n\nSame as `login` but passes the password via stdin, keeping it out of the process list. Preferred for CI and automated workflows.\n\n```typescript\nawait login(\n  'registry.example.com',\n  process.env.REGISTRY_USER!,\n  process.env.REGISTRY_PASS!,\n);\n```\n\n### `logout(registry)`\n\n```typescript\nawait logout('registry.example.com');\n```\n\n### `tag(source, destination)`\n\nAssigns a new tag to an existing local ModelKit without re-packing. Use `push` afterward to publish it.\n\n```typescript\nawait tag('registry.example.com/org/my-model:rc1', 'registry.example.com/org/my-model:v1.0.0');\n```\n\n### `remove(registry, repository, tagOrDigest, flags?)`\n\nRemoves a ModelKit from local storage or a remote registry.\n\n```typescript\n// Remove a specific tag\nawait remove('registry.example.com', 'org/my-model', 'v0.9.0');\n\n// Remove all locally cached ModelKits\nawait remove('', '', '', { all: true });\n\n// Force-remove from the remote registry\nawait remove('registry.example.com', 'org/my-model', 'v0.9.0', { force: true, remote: true });\n```\n\n### `version()`\n\nReturns version information for the installed `kit` binary.\n\n```typescript\nconst { version, commit, built, goVersion } = await version();\nconsole.log(`kit ${version} (${commit})`);\n```\n\n### `kit(command, args, options?)`\n\nLow-level escape hatch for running any `kit` subcommand directly, useful when the higher-level wrappers don't expose a flag you need.\n\n```typescript\nconst result = await kit('pack', ['.', '--tag', 'my-model:latest'], { cwd: '/path/to/project' });\nconsole.log(result.stdout);\n```\n\n## Error handling\n\nAll functions reject with a string message that includes the exit code and stderr output from the CLI. Wrap calls in `try/catch` to handle failures:\n\n```typescript\ntry {\n  await push('registry.example.com/org/my-model:v1.0.0');\n} catch (err) {\n  console.error(err); // \"Kit command failed with exit code 1: ...\"\n  process.exit(1);\n}\n```\n\n## Environment variables\n\n| Variable | Description |\n|---|---|\n| `KITOPS_CLI_PATH` | Full path to the `kit` binary. Defaults to `kit` (resolved via `PATH`). |\n\n## Examples\n\nSee the [`examples/`](./examples) directory for runnable scripts covering common workflows:\n\n- [Build a Kitfile programmatically](./examples/build-kitfile.js)\n- [CI/CD pipeline](./examples/ci-cd.js)\n- [Tag and promote a release](./examples/tag-and-promote.js)\n- [LLM fine-tuning dataset packaging](./examples/llm-prompts-ci.js)\n\n## Development\n\n```bash\npnpm install\npnpm build       # compile TypeScript\npnpm dev         # watch mode\npnpm test        # run tests\npnpm typecheck   # type-check without emitting\n```\n\n## Related\n\n- [KitOps](https://kitops.org) — the ModelKit standard and CLI\n- [pykitops](https://github.com/kitops-ml/pykitops) — Python SDK\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitops-ml%2Fkitops-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitops-ml%2Fkitops-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitops-ml%2Fkitops-ts/lists"}