add process

This commit is contained in:
xiongxiao
2026-01-13 18:06:05 +08:00
parent 881fa3318a
commit 285cdddb43
8 changed files with 86 additions and 10 deletions

47
src/common/cnb-env.ts Normal file
View File

@@ -0,0 +1,47 @@
/**
* CNB 环境变量配置
* 该模块定义了 CNB (Cloud Native Build) 平台提供的所有环境变量
* 用于获取当前构建环境、仓库信息、运行器配置等元数据
*/
import { useKey } from "@kevisual/use-config"
export const CNB_ENV = {
// 仓库相关配置
/** 仓库的 HTTPS 地址,如 "https://cnb.cool/kevisual/cnb" */
CNB_REPO_URL_HTTPS: useKey('CNB_REPO_URL_HTTPS'),
// 构建相关配置
/** 流水线 ID唯一标识一次构建流水线如 "cnb-108-1jer5qekq-001" */
CNB_PIPELINE_ID: useKey('CNB_PIPELINE_ID'),
/** 构建 ID与流水线 ID 相关联,如 "cnb-108-1jer5qekq" */
CNB_BUILD_ID: useKey('CNB_BUILD_ID'),
/** 构建开始时间ISO 8601 格式,如 "2026-01-13T07:58:41.825Z" */
CNB_BUILD_START_TIME: useKey('CNB_BUILD_START_TIME'),
/** 构建日志 Web 界面 URL用于在浏览器中查看构建日志 */
CNB_BUILD_WEB_URL: useKey('CNB_BUILD_WEB_URL'),
/** 触发构建的事件类型,如 "vscode" 表示由 VS Code 触发 */
CNB_EVENT: useKey('CNB_EVENT'),
/** 当前构建对应的 Git 提交哈希值 */
CNB_COMMIT: useKey('CNB_COMMIT'),
// VS Code 相关配置
/** VS Code Web 界面的访问 URL用于在浏览器中打开 VS Code */
CNB_VSCODE_WEB_URL: useKey('CNB_VSCODE_WEB_URL'),
/** VS Code 代理 URI用于端口转发{{port}} 会被替换为实际端口号, 例如: "https://1wnts22gq3-{{port}}.cnb.run"*/
CNB_VSCODE_PROXY_URI: useKey('CNB_VSCODE_PROXY_URI'),
// 仓库标识配置
/** 仓库标识符,格式为 "组名/仓库名",如 "kevisual/cnb" */
CNB_REPO_SLUG: useKey('CNB_REPO_SLUG'),
/** 组名/命名空间标识符,如 "kevisual" */
CNB_GROUP_SLUG: useKey('CNB_GROUP_SLUG'),
// 运行器资源配置
/** 运行器分配的 CPU 核心数,单位为核, 例如: "8"*/
CNB_CPUS: useKey('CNB_CPUS'),
/** 运行器分配的内存大小,单位为 GB 例如: "16"*/
CNB_MEMORY: useKey('CNB_MEMORY'),
/** 运行器的 IP 地址,用于网络连接和调试 */
CNB_RUNNER_IP: useKey('CNB_RUNNER_IP'),
}

View File

@@ -1,5 +1,5 @@
import { CNBCore, CNBCoreOptions } from "./cnb-core.ts";
import { Workspace } from "./workspace.ts";
import { Workspace } from "./workspace/index.ts";
import { KnowledgeBase } from "./knowledge/index.ts";
import { Repo } from "./repo/index.ts";
import { User } from "./user/index.ts";
@@ -59,7 +59,7 @@ export class CNB extends CNBCore {
}
}
export * from './workspace.ts'
export * from './workspace/index.ts'
export * from './cnb-core.ts'
export * from './knowledge/index.ts'
export * from './repo/index.ts'

View File

@@ -6,7 +6,7 @@
*/
import { Result } from "@kevisual/query/query";
import { CNBCore } from "./cnb-core.ts";
import { CNBCore } from "../cnb-core.ts";
/**
*