getBlockType

This commit is contained in:
Nate 2025-01-26 22:33:41 -08:00
parent b3628ec912
commit aa4a72996b
7 changed files with 45 additions and 12 deletions

View file

@ -13,7 +13,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.18",
"@continuedev/config-yaml": "^1.0.20",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -3038,9 +3038,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.18",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.18.tgz",
"integrity": "sha512-Un7ngLG+8pVWsnAQHBvtTK0Efc5rRCDCI7UhhpS20yCWjmo8yZzcLd3N4yb06DtdRJs2jqo9pSKxnt8ORL4l0Q==",
"version": "1.0.20",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.20.tgz",
"integrity": "sha512-MMCqE5khk5MnQc4udPOGCuXf8q+Zo01D4n4qbZu4oPV1foXHfQIZwQkWaQLJOJzzODZEBpgeJeJCknweYckgWg==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.18",
"@continuedev/config-yaml": "^1.0.20",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

10
gui/package-lock.json generated
View file

@ -7,7 +7,7 @@
"name": "gui",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.0.18",
"@continuedev/config-yaml": "^1.0.20",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
@ -108,7 +108,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.18",
"@continuedev/config-yaml": "^1.0.20",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -556,9 +556,9 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.18",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.18.tgz",
"integrity": "sha512-Un7ngLG+8pVWsnAQHBvtTK0Efc5rRCDCI7UhhpS20yCWjmo8yZzcLd3N4yb06DtdRJs2jqo9pSKxnt8ORL4l0Q==",
"version": "1.0.20",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.20.tgz",
"integrity": "sha512-MMCqE5khk5MnQc4udPOGCuXf8q+Zo01D4n4qbZu4oPV1foXHfQIZwQkWaQLJOJzzODZEBpgeJeJCknweYckgWg==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",

View file

@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "^1.0.18",
"@continuedev/config-yaml": "^1.0.20",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.19",
"version": "1.0.22",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -3,6 +3,7 @@ export * from "./interfaces/index.js";
export * from "./interfaces/SecretResult.js";
export * from "./interfaces/slugs.js";
export * from "./load/clientRender.js";
export * from "./load/getBlockType.js";
export * from "./load/merge.js";
export * from "./load/proxySecretResolution.js";
export * from "./load/unroll.js";

View file

@ -0,0 +1,32 @@
import { ConfigYaml } from "../schemas/index.js";
export type BlockType =
| "models"
| "context"
| "docs"
| "tools"
| "mcpServers"
| "data"
| "rules"
| "prompts";
export function getBlockType(block: ConfigYaml): BlockType {
if (block.context?.length) {
return "context";
} else if (block.models?.length) {
return "models";
} else if (block.docs?.length) {
return "docs";
} else if (block.tools?.length) {
return "tools";
} else if (block.mcpServers?.length) {
return "mcpServers";
} else if (block.data?.length) {
return "data";
} else if (block.rules?.length) {
return "rules";
} else if (block.prompts?.length) {
return "prompts";
} else {
throw new Error("Unknown block type");
}
}