From eed2bba90877ae282bd389387abf44d0975ce14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javis=20P=C3=A9rez?= Date: Mon, 30 Mar 2026 15:14:10 -0400 Subject: [PATCH 1/4] Fixes to some wrong types definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Javis Pérez --- docs/types.md | 101 ++++++++++++++++++++++++++++++------------- package.json | 2 +- src/types/kitfile.ts | 58 ++++++++++++------------- 3 files changed, 98 insertions(+), 63 deletions(-) diff --git a/docs/types.md b/docs/types.md index 6afd77a..dac9f58 100644 --- a/docs/types.md +++ b/docs/types.md @@ -427,31 +427,49 @@ type Package = { --- +### `LayerBase` + +Base interface extended by all Kitfile layer types. Provides the common `path` and `description` fields. + +```typescript +interface LayerBase { + 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 [`LayerBase`](#layerbase). ```typescript -interface Model { +interface Model extends LayerBase { 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 `LayerBase`)* | +| `description` | `string` | Human-readable description. *(from `LayerBase`)* | | `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 [`LayerBase`](#layerbase). ```typescript -interface Dataset { +interface Dataset extends LayerBase { name?: string; - path?: string; - description?: string; license?: string; parameters?: unknown; } ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the dataset file or directory. *(from `LayerBase`)* | +| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `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 [`LayerBase`](#layerbase). ```typescript -interface Code { - path: string; - description: string; +interface Code extends LayerBase { + license?: string; } ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the source code file or directory. *(from `LayerBase`)* | +| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `license` | `string` | SPDX license identifier. | + --- ### `Doc` -Documentation artifact definition in a Kitfile. +Documentation artifact definition in a Kitfile. Extends [`LayerBase`](#layerbase). ```typescript -interface Doc { - path: string; - description: string; -} +interface Doc extends LayerBase {} ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the documentation file or directory. *(from `LayerBase`)* | +| `description` | `string` | Human-readable description. *(from `LayerBase`)* | + --- ### `Prompt` -Prompt artifact definition in a Kitfile. +Prompt artifact definition in a Kitfile. Extends [`LayerBase`](#layerbase). ```typescript -interface Prompt { - path?: string; - description?: string; -} +interface Prompt extends LayerBase {} ``` +| Property | Type | Description | +|---|---|---| +| `path` | `string` | Path to the prompt file or directory. *(from `LayerBase`)* | +| `description` | `string` | Human-readable description. *(from `LayerBase`)* | + --- ## 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/types/kitfile.ts b/src/types/kitfile.ts index 72ac8cc..c0afcb5 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 LayerBase { + path: string; + description?: string; +} + export interface ModelPart { + name?: string, path?: string, - type?: string, - license?: string; + type?: string } -export interface Model { +export interface Model extends LayerBase { 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 LayerBase { name?: string, - path?: string, - description?: string; license?: string; parameters?: unknown; } -export interface Code { - path: string, - description: string +export interface Code extends LayerBase { + license?: string; } -export interface Doc { - path: string, - description: string -} +export interface Doc extends LayerBase {} -export interface Prompt { - path?: string; - description?: string; -} +export interface Prompt extends LayerBase {} // 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. From 700fe32e8633a519f6433e177367cd1eae3ace97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javis=20P=C3=A9rez?= Date: Mon, 30 Mar 2026 15:21:52 -0400 Subject: [PATCH 2/4] Update index.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Javis Pérez --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 63b15d0..35a25a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ export type { export type { Kitfile, Package, + LayerBase, Model, ModelPart, Dataset, From ca4572b038f2c0a39fedde8905955c9d5c2bc705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javis=20P=C3=A9rez?= Date: Mon, 30 Mar 2026 15:25:06 -0400 Subject: [PATCH 3/4] Update examples.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Javis Pérez --- docs/examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' }, From 01a8d6b7abfb39f3d5df816f63c09385694ceac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javis=20P=C3=A9rez?= Date: Tue, 31 Mar 2026 11:52:03 -0400 Subject: [PATCH 4/4] Rename `LayerBase` to `LayerCommons` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Javis Pérez --- docs/types.md | 44 ++++++++++++++++++++++---------------------- src/index.ts | 2 +- src/types/kitfile.ts | 12 ++++++------ 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/types.md b/docs/types.md index dac9f58..b29c0f7 100644 --- a/docs/types.md +++ b/docs/types.md @@ -427,12 +427,12 @@ type Package = { --- -### `LayerBase` +### `LayerCommons` Base interface extended by all Kitfile layer types. Provides the common `path` and `description` fields. ```typescript -interface LayerBase { +interface LayerCommons { path: string; description?: string; } @@ -447,10 +447,10 @@ interface LayerBase { ### `Model` -Model artifact definition in a Kitfile. Extends [`LayerBase`](#layerbase). +Model artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Model extends LayerBase { +interface Model extends LayerCommons { name?: string; framework?: string; version?: string; @@ -462,8 +462,8 @@ interface Model extends LayerBase { | Property | Type | Description | |---|---|---| -| `path` | `string` | Path to the model file or directory. *(from `LayerBase`)* | -| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `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. | | `framework` | `string` | ML framework (e.g. `'pytorch'`, `'tensorflow'`). | | `version` | `string` | Model version. | @@ -495,10 +495,10 @@ interface ModelPart { ### `Dataset` -Dataset artifact definition in a Kitfile. Extends [`LayerBase`](#layerbase). +Dataset artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Dataset extends LayerBase { +interface Dataset extends LayerCommons { name?: string; license?: string; parameters?: unknown; @@ -507,8 +507,8 @@ interface Dataset extends LayerBase { | Property | Type | Description | |---|---|---| -| `path` | `string` | Path to the dataset file or directory. *(from `LayerBase`)* | -| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `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. | @@ -517,49 +517,49 @@ interface Dataset extends LayerBase { ### `Code` -Source code artifact definition in a Kitfile. Extends [`LayerBase`](#layerbase). +Source code artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Code extends LayerBase { +interface Code extends LayerCommons { license?: string; } ``` | Property | Type | Description | |---|---|---| -| `path` | `string` | Path to the source code file or directory. *(from `LayerBase`)* | -| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `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. Extends [`LayerBase`](#layerbase). +Documentation artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Doc extends LayerBase {} +interface Doc extends LayerCommons {} ``` | Property | Type | Description | |---|---|---| -| `path` | `string` | Path to the documentation file or directory. *(from `LayerBase`)* | -| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `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. Extends [`LayerBase`](#layerbase). +Prompt artifact definition in a Kitfile. Extends [`LayerCommons`](#layerbase). ```typescript -interface Prompt extends LayerBase {} +interface Prompt extends LayerCommons {} ``` | Property | Type | Description | |---|---|---| -| `path` | `string` | Path to the prompt file or directory. *(from `LayerBase`)* | -| `description` | `string` | Human-readable description. *(from `LayerBase`)* | +| `path` | `string` | Path to the prompt file or directory. *(from `LayerCommons`)* | +| `description` | `string` | Human-readable description. *(from `LayerCommons`)* | --- diff --git a/src/index.ts b/src/index.ts index 35a25a5..56f3872 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,7 +62,7 @@ export type { export type { Kitfile, Package, - LayerBase, + LayerCommons, Model, ModelPart, Dataset, diff --git a/src/types/kitfile.ts b/src/types/kitfile.ts index c0afcb5..692a578 100644 --- a/src/types/kitfile.ts +++ b/src/types/kitfile.ts @@ -16,7 +16,7 @@ interface LayerIdentity { } // Base interface for all layer types, which includes the common `path` and optional `description` fields. -export interface LayerBase { +export interface LayerCommons { path: string; description?: string; } @@ -27,7 +27,7 @@ export interface ModelPart { type?: string } -export interface Model extends LayerBase { +export interface Model extends LayerCommons { name?: string, framework?: string; version?: string; @@ -36,19 +36,19 @@ export interface Model extends LayerBase { parameters?: unknown; } -export interface Dataset extends LayerBase { +export interface Dataset extends LayerCommons { name?: string, license?: string; parameters?: unknown; } -export interface Code extends LayerBase { +export interface Code extends LayerCommons { license?: string; } -export interface Doc extends LayerBase {} +export interface Doc extends LayerCommons {} -export interface Prompt extends LayerBase {} +export interface Prompt extends LayerCommons {} // Internal types for the kitfile definition, which include the OCI layer info fields interface KitfileModelPart extends ModelPart, LayerIdentity { }