@kb-labs/quality-contracts 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -0
- package/README.md +90 -0
- package/dist/contract.d.ts +99 -0
- package/dist/contract.js +100 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +967 -0
- package/dist/index.js +210 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @kb-labs/plugin-template-contracts
|
|
2
|
+
|
|
3
|
+
Lightweight public contracts package for the plugin: it describes guaranteed artifacts, commands, workflows, API payloads, and the version of these promises.
|
|
4
|
+
|
|
5
|
+
## Why this package exists
|
|
6
|
+
|
|
7
|
+
Every KB Labs plugin is expected to publish a clear, lightweight “promise” to the rest of the ecosystem. This package is that promise: it contains only types, manifests, and validation helpers, so other teams (CLI, Workflow Engine, Studio, REST, marketplace tooling) can rely on a single source of truth without dragging in plugin runtime code.
|
|
8
|
+
|
|
9
|
+
## Quick start checklist
|
|
10
|
+
|
|
11
|
+
1. Clone this package as part of your plugin workspace (`packages/contracts`).
|
|
12
|
+
2. Update `pluginContractsManifest` with your plugin ID and initial artifacts/commands.
|
|
13
|
+
3. Adjust Zod schemas in `src/schema.ts` (or add new ones) to match your payloads.
|
|
14
|
+
4. Bump `contractsVersion` whenever the public promise changes (SemVer rules below).
|
|
15
|
+
5. Run `pnpm test` and `pnpm type-check` to ensure the manifest validates.
|
|
16
|
+
6. Import the manifest in your CLI/REST/workflow code to avoid hard-coded IDs.
|
|
17
|
+
|
|
18
|
+
### Renaming this package
|
|
19
|
+
|
|
20
|
+
When you turn the template into your own plugin:
|
|
21
|
+
- Change the npm name in `package.json` (e.g. `@kb-labs/my-plugin-contracts`).
|
|
22
|
+
- Update `pluginContractsManifest.pluginId` in `src/contract.ts`.
|
|
23
|
+
- Adjust aliases in `tsconfig.paths.json` and imports across the workspace (`@kb-labs/plugin-template-contracts` → your new name).
|
|
24
|
+
- Replace sample artifact IDs (`template.hello.*`) with your own naming scheme.
|
|
25
|
+
|
|
26
|
+
## What's inside
|
|
27
|
+
|
|
28
|
+
- `pluginContractsManifest` — the single source of truth for the plugin's public capabilities
|
|
29
|
+
- TypeScript types (`src/types`) and Zod schemas (`src/schema`) for artifacts, commands, workflows, and API payloads
|
|
30
|
+
- `parsePluginContracts` utility for runtime validation of the manifest and third-party contracts
|
|
31
|
+
|
|
32
|
+
## Versioning rules
|
|
33
|
+
|
|
34
|
+
- `contractsVersion` follows SemVer and is **independent** from the plugin's npm version.
|
|
35
|
+
- **MAJOR** — breaking changes (removing/renaming artifacts, changing payload formats).
|
|
36
|
+
- **MINOR** — backwards-compatible extensions (new artifacts, commands, fields).
|
|
37
|
+
- **PATCH** — documentation/metadata updates without altering payload formats.
|
|
38
|
+
|
|
39
|
+
## Minimal manifest example
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import type { PluginContracts } from '@kb-labs/plugin-template-contracts';
|
|
43
|
+
|
|
44
|
+
export const pluginContractsManifest: PluginContracts = {
|
|
45
|
+
schema: 'kb.plugin.contracts/1',
|
|
46
|
+
pluginId: '@kb-labs/my-plugin',
|
|
47
|
+
contractsVersion: '1.0.0',
|
|
48
|
+
artifacts: {
|
|
49
|
+
'my-plugin.result': {
|
|
50
|
+
id: 'my-plugin.result',
|
|
51
|
+
kind: 'json',
|
|
52
|
+
description: 'Primary output of the CLI command.'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// commands/workflows/api can be added later when needed
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Optional sections
|
|
60
|
+
|
|
61
|
+
All additional sections are **optional** — include only what your plugin actually supports:
|
|
62
|
+
|
|
63
|
+
- `commands` — define CLI or workflow commands that produce/consume artifacts.
|
|
64
|
+
- `workflows` — describe composed workflows and their steps.
|
|
65
|
+
- `api` — document REST (or future surfaces) when the plugin exposes them.
|
|
66
|
+
|
|
67
|
+
If your plugin only ships a CLI command, keep `commands` + `artifacts` and omit `workflows`/`api`. The Zod schema accepts missing sections.
|
|
68
|
+
|
|
69
|
+
## Usage in plugin code
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { pluginContractsManifest } from '@kb-labs/plugin-template-contracts';
|
|
73
|
+
|
|
74
|
+
const helloArtifactId = pluginContractsManifest.artifacts['template.hello.greeting'].id;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Use the manifest to avoid magic strings, assert that required artifacts exist, or log which promises were fulfilled.
|
|
78
|
+
|
|
79
|
+
## Who relies on the contract
|
|
80
|
+
|
|
81
|
+
- **Workflow Engine** — verifies allowed steps, required artifacts, and matches produced results with the contract.
|
|
82
|
+
- **Studio** — builds UI and hints based on declared artifacts and commands.
|
|
83
|
+
- **CLI / REST / other plugins** — reuse types and schemas as the source of truth, validate inputs/outputs.
|
|
84
|
+
- **Marketplace & QA tooling** — checks plugin compatibility and correctness before publishing.
|
|
85
|
+
|
|
86
|
+
## Looking ahead
|
|
87
|
+
|
|
88
|
+
- Generate JSON Schema / OpenAPI from the `api` contract surface.
|
|
89
|
+
- Add automatic inspectors in Studio and validators for the marketplace.
|
|
90
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
declare const pluginContractsManifest: {
|
|
2
|
+
readonly schema: "kb.plugin.contracts/1";
|
|
3
|
+
readonly pluginId: "@kb-labs/plugin-template";
|
|
4
|
+
readonly contractsVersion: "1.0.0";
|
|
5
|
+
readonly artifacts: {
|
|
6
|
+
readonly 'template.hello.greeting': {
|
|
7
|
+
readonly id: "template.hello.greeting";
|
|
8
|
+
readonly kind: "json";
|
|
9
|
+
readonly description: "Machine-readable greeting payload returned by the hello surfaces.";
|
|
10
|
+
readonly pathPattern: "artifacts/template/hello/greeting.json";
|
|
11
|
+
readonly mediaType: "application/json";
|
|
12
|
+
readonly schemaRef: "@kb-labs/plugin-template-contracts/schema#HelloGreeting";
|
|
13
|
+
readonly example: {
|
|
14
|
+
readonly summary: "Greeting payload for anonymous user";
|
|
15
|
+
readonly payload: {
|
|
16
|
+
readonly message: "Hello, World!";
|
|
17
|
+
readonly target: "World";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
readonly 'template.hello.log': {
|
|
22
|
+
readonly id: "template.hello.log";
|
|
23
|
+
readonly kind: "log";
|
|
24
|
+
readonly description: "Execution log for hello command/workflow.";
|
|
25
|
+
readonly pathPattern: "logs/template/hello/run.log";
|
|
26
|
+
readonly mediaType: "text/plain";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly commands: {
|
|
30
|
+
readonly 'plugin-template:hello': {
|
|
31
|
+
readonly id: "plugin-template:hello";
|
|
32
|
+
readonly description: "Produce a greeting message optionally targeting a provided name.";
|
|
33
|
+
readonly input: {
|
|
34
|
+
readonly ref: "@kb-labs/plugin-template-contracts/schema#HelloCommandInput";
|
|
35
|
+
readonly format: "zod";
|
|
36
|
+
};
|
|
37
|
+
readonly output: {
|
|
38
|
+
readonly ref: "@kb-labs/plugin-template-contracts/schema#HelloCommandOutput";
|
|
39
|
+
readonly format: "zod";
|
|
40
|
+
};
|
|
41
|
+
readonly produces: ["template.hello.greeting", "template.hello.log"];
|
|
42
|
+
readonly examples: ["kb plugin-template hello", "kb plugin-template hello --name Dev", "kb plugin-template hello --json"];
|
|
43
|
+
};
|
|
44
|
+
readonly 'plugin-template:test-loader': {
|
|
45
|
+
readonly id: "plugin-template:test-loader";
|
|
46
|
+
readonly description: "Test UI loader/spinner functionality with various scenarios.";
|
|
47
|
+
readonly input: {
|
|
48
|
+
readonly ref: "@kb-labs/plugin-template-contracts/schema#TestLoaderCommandInput";
|
|
49
|
+
readonly format: "zod";
|
|
50
|
+
};
|
|
51
|
+
readonly output: {
|
|
52
|
+
readonly ref: "@kb-labs/plugin-template-contracts/schema#TestLoaderCommandOutput";
|
|
53
|
+
readonly format: "zod";
|
|
54
|
+
};
|
|
55
|
+
readonly produces: [];
|
|
56
|
+
readonly examples: ["kb plugin-template test-loader", "kb plugin-template test-loader --duration 1000", "kb plugin-template test-loader --fail"];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly workflows: {
|
|
60
|
+
readonly 'template.workflow.hello': {
|
|
61
|
+
readonly id: "template.workflow.hello";
|
|
62
|
+
readonly description: "Single-step workflow executing the hello command and emitting greeting artifacts.";
|
|
63
|
+
readonly produces: ["template.hello.greeting", "template.hello.log"];
|
|
64
|
+
readonly steps: [{
|
|
65
|
+
readonly id: "template.workflow.hello.step.run-command";
|
|
66
|
+
readonly commandId: "plugin-template:hello";
|
|
67
|
+
readonly produces: ["template.hello.greeting", "template.hello.log"];
|
|
68
|
+
}];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly api: {
|
|
72
|
+
readonly rest: {
|
|
73
|
+
readonly basePath: "/v1/plugins/template";
|
|
74
|
+
readonly routes: {
|
|
75
|
+
readonly 'template.rest.hello': {
|
|
76
|
+
readonly id: "template.rest.hello";
|
|
77
|
+
readonly method: "GET";
|
|
78
|
+
readonly path: "/hello";
|
|
79
|
+
readonly description: "Return a greeting payload from the REST surface.";
|
|
80
|
+
readonly response: {
|
|
81
|
+
readonly ref: "@kb-labs/plugin-template-contracts/schema#HelloCommandOutput";
|
|
82
|
+
readonly format: "zod";
|
|
83
|
+
};
|
|
84
|
+
readonly produces: ["template.hello.greeting"];
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type PluginArtifactIds = keyof typeof pluginContractsManifest.artifacts;
|
|
91
|
+
type PluginCommandIds = keyof typeof pluginContractsManifest.commands;
|
|
92
|
+
type PluginWorkflowIds = keyof typeof pluginContractsManifest.workflows;
|
|
93
|
+
type PluginRouteIds = typeof pluginContractsManifest.api extends {
|
|
94
|
+
rest: {
|
|
95
|
+
routes: infer R;
|
|
96
|
+
};
|
|
97
|
+
} ? R extends Record<string, any> ? keyof R : never : never;
|
|
98
|
+
|
|
99
|
+
export { type PluginArtifactIds, type PluginCommandIds, type PluginRouteIds, type PluginWorkflowIds, pluginContractsManifest };
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/version.ts
|
|
2
|
+
var contractsSchemaId = "kb.plugin.contracts/1";
|
|
3
|
+
var contractsVersion = "1.0.0";
|
|
4
|
+
|
|
5
|
+
// src/contract.ts
|
|
6
|
+
var pluginContractsManifest = {
|
|
7
|
+
schema: contractsSchemaId,
|
|
8
|
+
pluginId: "@kb-labs/plugin-template",
|
|
9
|
+
contractsVersion,
|
|
10
|
+
artifacts: {
|
|
11
|
+
"template.hello.greeting": {
|
|
12
|
+
id: "template.hello.greeting",
|
|
13
|
+
kind: "json",
|
|
14
|
+
description: "Machine-readable greeting payload returned by the hello surfaces.",
|
|
15
|
+
pathPattern: "artifacts/template/hello/greeting.json",
|
|
16
|
+
mediaType: "application/json",
|
|
17
|
+
schemaRef: "@kb-labs/plugin-template-contracts/schema#HelloGreeting",
|
|
18
|
+
example: {
|
|
19
|
+
summary: "Greeting payload for anonymous user",
|
|
20
|
+
payload: {
|
|
21
|
+
message: "Hello, World!",
|
|
22
|
+
target: "World"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"template.hello.log": {
|
|
27
|
+
id: "template.hello.log",
|
|
28
|
+
kind: "log",
|
|
29
|
+
description: "Execution log for hello command/workflow.",
|
|
30
|
+
pathPattern: "logs/template/hello/run.log",
|
|
31
|
+
mediaType: "text/plain"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
"plugin-template:hello": {
|
|
36
|
+
id: "plugin-template:hello",
|
|
37
|
+
description: "Produce a greeting message optionally targeting a provided name.",
|
|
38
|
+
input: {
|
|
39
|
+
ref: "@kb-labs/plugin-template-contracts/schema#HelloCommandInput",
|
|
40
|
+
format: "zod"
|
|
41
|
+
},
|
|
42
|
+
output: {
|
|
43
|
+
ref: "@kb-labs/plugin-template-contracts/schema#HelloCommandOutput",
|
|
44
|
+
format: "zod"
|
|
45
|
+
},
|
|
46
|
+
produces: ["template.hello.greeting", "template.hello.log"],
|
|
47
|
+
examples: ["kb plugin-template hello", "kb plugin-template hello --name Dev", "kb plugin-template hello --json"]
|
|
48
|
+
},
|
|
49
|
+
"plugin-template:test-loader": {
|
|
50
|
+
id: "plugin-template:test-loader",
|
|
51
|
+
description: "Test UI loader/spinner functionality with various scenarios.",
|
|
52
|
+
input: {
|
|
53
|
+
ref: "@kb-labs/plugin-template-contracts/schema#TestLoaderCommandInput",
|
|
54
|
+
format: "zod"
|
|
55
|
+
},
|
|
56
|
+
output: {
|
|
57
|
+
ref: "@kb-labs/plugin-template-contracts/schema#TestLoaderCommandOutput",
|
|
58
|
+
format: "zod"
|
|
59
|
+
},
|
|
60
|
+
produces: [],
|
|
61
|
+
examples: ["kb plugin-template test-loader", "kb plugin-template test-loader --duration 1000", "kb plugin-template test-loader --fail"]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
workflows: {
|
|
65
|
+
"template.workflow.hello": {
|
|
66
|
+
id: "template.workflow.hello",
|
|
67
|
+
description: "Single-step workflow executing the hello command and emitting greeting artifacts.",
|
|
68
|
+
produces: ["template.hello.greeting", "template.hello.log"],
|
|
69
|
+
steps: [
|
|
70
|
+
{
|
|
71
|
+
id: "template.workflow.hello.step.run-command",
|
|
72
|
+
commandId: "plugin-template:hello",
|
|
73
|
+
produces: ["template.hello.greeting", "template.hello.log"]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
api: {
|
|
79
|
+
rest: {
|
|
80
|
+
basePath: "/v1/plugins/template",
|
|
81
|
+
routes: {
|
|
82
|
+
"template.rest.hello": {
|
|
83
|
+
id: "template.rest.hello",
|
|
84
|
+
method: "GET",
|
|
85
|
+
path: "/hello",
|
|
86
|
+
description: "Return a greeting payload from the REST surface.",
|
|
87
|
+
response: {
|
|
88
|
+
ref: "@kb-labs/plugin-template-contracts/schema#HelloCommandOutput",
|
|
89
|
+
format: "zod"
|
|
90
|
+
},
|
|
91
|
+
produces: ["template.hello.greeting"]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { pluginContractsManifest };
|
|
99
|
+
//# sourceMappingURL=contract.js.map
|
|
100
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../src/contract.ts"],"names":[],"mappings":";AAAO,IAAM,iBAAA,GAAoB,uBAAA;AAI1B,IAAM,gBAAA,GAAmB,OAAA;;;ACAzB,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ,iBAAA;AAAA,EACR,QAAA,EAAU,0BAAA;AAAA,EACV,gBAAA;AAAA,EACA,SAAA,EAAW;AAAA,IACT,yBAAA,EAA2B;AAAA,MACzB,EAAA,EAAI,yBAAA;AAAA,MACJ,IAAA,EAAM,MAAA;AAAA,MACN,WAAA,EAAa,mEAAA;AAAA,MACb,WAAA,EAAa,wCAAA;AAAA,MACb,SAAA,EAAW,kBAAA;AAAA,MACX,SAAA,EAAW,yDAAA;AAAA,MACX,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,qCAAA;AAAA,QACT,OAAA,EAAS;AAAA,UACP,OAAA,EAAS,eAAA;AAAA,UACT,MAAA,EAAQ;AAAA;AACV;AACF,KACF;AAAA,IACA,oBAAA,EAAsB;AAAA,MACpB,EAAA,EAAI,oBAAA;AAAA,MACJ,IAAA,EAAM,KAAA;AAAA,MACN,WAAA,EAAa,2CAAA;AAAA,MACb,WAAA,EAAa,6BAAA;AAAA,MACb,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,uBAAA,EAAyB;AAAA,MACvB,EAAA,EAAI,uBAAA;AAAA,MACJ,WAAA,EAAa,kEAAA;AAAA,MACb,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,6DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,8DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,QAAA,EAAU,CAAC,yBAAA,EAA2B,oBAAoB,CAAA;AAAA,MAC1D,QAAA,EAAU,CAAC,0BAAA,EAA4B,qCAAA,EAAuC,iCAAiC;AAAA,KACjH;AAAA,IACA,6BAAA,EAA+B;AAAA,MAC7B,EAAA,EAAI,6BAAA;AAAA,MACJ,WAAA,EAAa,8DAAA;AAAA,MACb,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,kEAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,mEAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,UAAU,EAAC;AAAA,MACX,QAAA,EAAU,CAAC,gCAAA,EAAkC,gDAAA,EAAkD,uCAAuC;AAAA;AACxI,GACF;AAAA,EACA,SAAA,EAAW;AAAA,IACT,yBAAA,EAA2B;AAAA,MACzB,EAAA,EAAI,yBAAA;AAAA,MACJ,WAAA,EAAa,mFAAA;AAAA,MACb,QAAA,EAAU,CAAC,yBAAA,EAA2B,oBAAoB,CAAA;AAAA,MAC1D,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,0CAAA;AAAA,UACJ,SAAA,EAAW,uBAAA;AAAA,UACX,QAAA,EAAU,CAAC,yBAAA,EAA2B,oBAAoB;AAAA;AAC5D;AACF;AACF,GACF;AAAA,EACA,GAAA,EAAK;AAAA,IACH,IAAA,EAAM;AAAA,MACJ,QAAA,EAAU,sBAAA;AAAA,MACV,MAAA,EAAQ;AAAA,QACN,qBAAA,EAAuB;AAAA,UACrB,EAAA,EAAI,qBAAA;AAAA,UACJ,MAAA,EAAQ,KAAA;AAAA,UACR,IAAA,EAAM,QAAA;AAAA,UACN,WAAA,EAAa,kDAAA;AAAA,UACb,QAAA,EAAU;AAAA,YACR,GAAA,EAAK,8DAAA;AAAA,YACL,MAAA,EAAQ;AAAA,WACV;AAAA,UACA,QAAA,EAAU,CAAC,yBAAyB;AAAA;AACtC;AACF;AACF;AAEJ","file":"contract.js","sourcesContent":["export const contractsSchemaId = 'kb.plugin.contracts/1' as const;\n\nexport type ContractsSchemaId = typeof contractsSchemaId;\n\nexport const contractsVersion = '1.0.0' as const;\n\n","import type { PluginContracts } from './types';\nimport { contractsSchemaId, contractsVersion } from './version';\n\n// Level 2: Contracts типизация с as const для извлечения типов\nexport const pluginContractsManifest = {\n schema: contractsSchemaId,\n pluginId: '@kb-labs/plugin-template',\n contractsVersion,\n artifacts: {\n 'template.hello.greeting': {\n id: 'template.hello.greeting',\n kind: 'json',\n description: 'Machine-readable greeting payload returned by the hello surfaces.',\n pathPattern: 'artifacts/template/hello/greeting.json',\n mediaType: 'application/json',\n schemaRef: '@kb-labs/plugin-template-contracts/schema#HelloGreeting',\n example: {\n summary: 'Greeting payload for anonymous user',\n payload: {\n message: 'Hello, World!',\n target: 'World'\n }\n }\n },\n 'template.hello.log': {\n id: 'template.hello.log',\n kind: 'log',\n description: 'Execution log for hello command/workflow.',\n pathPattern: 'logs/template/hello/run.log',\n mediaType: 'text/plain'\n }\n },\n commands: {\n 'plugin-template:hello': {\n id: 'plugin-template:hello',\n description: 'Produce a greeting message optionally targeting a provided name.',\n input: {\n ref: '@kb-labs/plugin-template-contracts/schema#HelloCommandInput',\n format: 'zod'\n },\n output: {\n ref: '@kb-labs/plugin-template-contracts/schema#HelloCommandOutput',\n format: 'zod'\n },\n produces: ['template.hello.greeting', 'template.hello.log'],\n examples: ['kb plugin-template hello', 'kb plugin-template hello --name Dev', 'kb plugin-template hello --json']\n },\n 'plugin-template:test-loader': {\n id: 'plugin-template:test-loader',\n description: 'Test UI loader/spinner functionality with various scenarios.',\n input: {\n ref: '@kb-labs/plugin-template-contracts/schema#TestLoaderCommandInput',\n format: 'zod'\n },\n output: {\n ref: '@kb-labs/plugin-template-contracts/schema#TestLoaderCommandOutput',\n format: 'zod'\n },\n produces: [],\n examples: ['kb plugin-template test-loader', 'kb plugin-template test-loader --duration 1000', 'kb plugin-template test-loader --fail']\n }\n },\n workflows: {\n 'template.workflow.hello': {\n id: 'template.workflow.hello',\n description: 'Single-step workflow executing the hello command and emitting greeting artifacts.',\n produces: ['template.hello.greeting', 'template.hello.log'],\n steps: [\n {\n id: 'template.workflow.hello.step.run-command',\n commandId: 'plugin-template:hello',\n produces: ['template.hello.greeting', 'template.hello.log']\n }\n ]\n }\n },\n api: {\n rest: {\n basePath: '/v1/plugins/template',\n routes: {\n 'template.rest.hello': {\n id: 'template.rest.hello',\n method: 'GET',\n path: '/hello',\n description: 'Return a greeting payload from the REST surface.',\n response: {\n ref: '@kb-labs/plugin-template-contracts/schema#HelloCommandOutput',\n format: 'zod'\n },\n produces: ['template.hello.greeting']\n }\n }\n }\n }\n} as const satisfies PluginContracts;\n\n// Извлекаем типы для использования в других местах\nexport type PluginArtifactIds = keyof typeof pluginContractsManifest.artifacts;\nexport type PluginCommandIds = keyof typeof pluginContractsManifest.commands;\nexport type PluginWorkflowIds = keyof typeof pluginContractsManifest.workflows;\nexport type PluginRouteIds = typeof pluginContractsManifest.api extends { rest: { routes: infer R } }\n ? R extends Record<string, any>\n ? keyof R\n : never\n : never;\n\n"]}
|