diff --git a/docs/examples.md b/docs/examples.md index 55e0466..574a04b 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -32,7 +32,7 @@ const yaml = buildKitfile({ model: { name: 'sentiment-classifier', path: './model/weights.pt', - format: 'pytorch', + framework: 'pytorch', }, datasets: [ { name: 'training-set', path: './data/train.csv', license: 'CC-BY-4.0' }, diff --git a/docs/types.md b/docs/types.md index 6afd77a..b29c0f7 100644 --- a/docs/types.md +++ b/docs/types.md @@ -427,31 +427,49 @@ type Package = { --- +### `LayerCommons` + +Base interface extended by all Kitfile layer types. Provides the common `path` and `description` fields. + +```typescript +interface LayerCommons { + path: string; + description?: string; +} +``` + +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the artifact file or directory. | +| `description` | `string` | Human-readable description. | + +--- + ### `Model` -Model artifact definition in a Kitfile. +Model artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Model { +interface Model extends LayerCommons { name?: string; - path?: string; - parts?: ModelPart[]; + framework?: string; + version?: string; license?: string; - description?: string; - format?: string; - parameters?: Record; + parts?: ModelPart[]; + parameters?: unknown; } ``` | Property | Type | Description | |---|---|---| +| `path` | `string` | Path to the model file or directory. *(from `LayerCommons`)* | +| `description` | `string` | Human-readable description. *(from `LayerCommons`)* | | `name` | `string` | Display name for the model. | -| `path` | `string` | Path to the model file or directory. | -| `parts` | [`ModelPart[]`](#modelpart) | Sub-parts of a composite model (e.g. split weight files). | +| `framework` | `string` | ML framework (e.g. `'pytorch'`, `'tensorflow'`). | +| `version` | `string` | Model version. | | `license` | `string` | SPDX license identifier. | -| `description` | `string` | Human-readable description. | -| `format` | `string` | Model format (e.g. `'gguf'`, `'safetensors'`). | -| `parameters` | `Record` | Arbitrary model parameters (e.g. context length, quantization). | +| `parts` | [`ModelPart[]`](#modelpart) | Sub-parts of a composite model (e.g. split weight files). | +| `parameters` | `unknown` | Arbitrary model parameters. | --- @@ -461,67 +479,88 @@ A sub-part of a composite model. ```typescript interface ModelPart { + name?: string; path?: string; type?: string; - license?: string; } ``` +| Property | Type | Description | +|---|---|---| +| `name` | `string` | Display name for this part. | +| `path` | `string` | Path to the part file. | +| `type` | `string` | Part type identifier. | + --- ### `Dataset` -Dataset artifact definition in a Kitfile. +Dataset artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Dataset { +interface Dataset extends LayerCommons { name?: string; - path?: string; - description?: string; license?: string; parameters?: unknown; } ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the dataset file or directory. *(from `LayerCommons`)* | +| `description` | `string` | Human-readable description. *(from `LayerCommons`)* | +| `name` | `string` | Display name for the dataset. | +| `license` | `string` | SPDX license identifier. | +| `parameters` | `unknown` | Arbitrary dataset parameters. | + --- ### `Code` -Source code artifact definition in a Kitfile. +Source code artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Code { - path: string; - description: string; +interface Code extends LayerCommons { + license?: string; } ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the source code file or directory. *(from `LayerCommons`)* | +| `description` | `string` | Human-readable description. *(from `LayerCommons`)* | +| `license` | `string` | SPDX license identifier. | + --- ### `Doc` -Documentation artifact definition in a Kitfile. +Documentation artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Doc { - path: string; - description: string; -} +interface Doc extends LayerCommons {} ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the documentation file or directory. *(from `LayerCommons`)* | +| `description` | `string` | Human-readable description. *(from `LayerCommons`)* | + --- ### `Prompt` -Prompt artifact definition in a Kitfile. +Prompt artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Prompt { - path?: string; - description?: string; -} +interface Prompt extends LayerCommons {} ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the prompt file or directory. *(from `LayerCommons`)* | +| `description` | `string` | Human-readable description. *(from `LayerCommons`)* | + --- ## Manifest Types diff --git a/package.json b/package.json index 8135b15..a5e9ae9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kitops/kitops-ts", - "version": "0.0.3", + "version": "0.0.4", "description": "TypeScript library for KitOps CLI", "type": "module", "main": "./dist/index.js", diff --git a/src/index.ts b/src/index.ts index 63b15d0..56f3872 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ export type { export type { Kitfile, Package, + LayerCommons, Model, ModelPart, Dataset, diff --git a/src/types/kitfile.ts b/src/types/kitfile.ts index 72ac8cc..692a578 100644 --- a/src/types/kitfile.ts +++ b/src/types/kitfile.ts @@ -1,5 +1,3 @@ -import { Layer } from "./kitops.js"; - export type Package = { name?: string, authors?: string[], @@ -12,57 +10,55 @@ export type Package = { * OCI layer identity fields populated after a pack or inspect operation. * These are read-only from the registry; you don't set them when authoring a Kitfile. */ -interface LayerInfo { +interface LayerIdentity { digest?: string; diffId?: string; } +// Base interface for all layer types, which includes the common `path` and optional `description` fields. +export interface LayerCommons { + path: string; + description?: string; +} + export interface ModelPart { + name?: string, path?: string, - type?: string, - license?: string; + type?: string } -export interface Model { +export interface Model extends LayerCommons { name?: string, - path?: string, - parts?: ModelPart[], + framework?: string; + version?: string; license?: string, - description?: string, - format?: string, - parameters?: Record + parts?: ModelPart[], + parameters?: unknown; } -export interface Dataset { +export interface Dataset extends LayerCommons { name?: string, - path?: string, - description?: string; license?: string; parameters?: unknown; } -export interface Code { - path: string, - description: string +export interface Code extends LayerCommons { + license?: string; } -export interface Doc { - path: string, - description: string -} +export interface Doc extends LayerCommons {} -export interface Prompt { - path?: string; - description?: string; -} +export interface Prompt extends LayerCommons {} // Internal types for the kitfile definition, which include the OCI layer info fields -interface KitfileModelPart extends ModelPart, LayerInfo { } -interface KitfileModel extends Model, LayerInfo { } -interface KitfileDataset extends Dataset, LayerInfo { } -interface KitfileCode extends Code, LayerInfo { } -interface KitfileDoc extends Doc, LayerInfo { } -interface KitfilePrompt extends Prompt, LayerInfo { } +interface KitfileModelPart extends ModelPart, LayerIdentity { } +interface KitfileModel extends Model, LayerIdentity { + parts?: KitfileModelPart[]; +} +interface KitfileDataset extends Dataset, LayerIdentity { } +interface KitfileCode extends Code, LayerIdentity { } +interface KitfileDoc extends Doc, LayerIdentity { } +interface KitfilePrompt extends Prompt, LayerIdentity { } /** * Typed representation of a Kitfile.