UNPKG

@lark-project/cli

Version:

飞书项目插件开发工具

170 lines (169 loc) 4.97 kB
export declare enum ECommandName { init = "init", create = "create", publish = "publish", start = "start", build = "build", release = "release", config = "config", update = "update", check = "check", schema = "schema", localConfig = "local-config", login = "login", listCategories = "list-categories", updateDescription = "update-description", workspace = "workspace", perm = "perm", ai = "ai", whoami = "whoami" } /** * 插件框架版本 */ export declare enum EPluginFrameworkVersion { v1 = "1.0.0", v2 = "2.0.0" } /** * 插件形态。三种状态在创建时定型且不可互转: * - normal:普通插件,可任意组合点位 * - ai_node:AI 节点插件,全工程恰好一个 ai_node 点位 * - ai_field:AI 字段插件,全工程恰好一个 ai_field 点位 * * 持久化在 plugin.config.json 的 `app_type` 字段,下游所有命令分流的事实来源。 * 缺省(已存在工程未声明)按 `'normal'` 解释,向后兼容。 */ export declare const APP_TYPES: readonly ["normal", "ai_node", "ai_field"]; export type AppType = typeof APP_TYPES[number]; /** * 插件产物配置项(2.0 插件框架) */ export interface IPluginConfigResource { id: string; entry: string; } /** * 插件配置文件(2.0 插件框架) */ export interface IPluginConfig { siteDomain: string; pluginId: string; pluginSecret: string; resources: IPluginConfigResource[]; source_type?: 'local' | 'remote'; /** 缺省视为 'normal'(兼容存量工程) */ app_type?: AppType; /** * true = 后端向工程(无/少前端产物)。由 `lpm init --config-only` 写入; * `lpm check context` 按此 flag(而非目录名)判定 BACKEND_HANDLE_CWD, * workflow 据此跳过前端阶段。缺省视为前端工程(兼容存量)。 */ backendOnly?: boolean; } /** * 插件构成后端类型枚举 */ export declare enum EFeatureType { page = "board",// 导航(本地名 page,后端 wire 仍为 board) button = "button",// 按钮 tab = "dashboard",// 详情页标签 control = "control",// 控件 view = "view",// 视图模式 configuration = "config",// 插件配置页(本地名 configuration,后端 wire 仍为 config) intercept = "intercept",// 拦截事件 component = "component", customField = "field_template",// 扩展字段-字段类型(本地名 customField,后端 wire 仍为 field_template) liteAppComponent = "builder_comp" } /** * 把调用方传的点位类型名翻译成后端 wire 值。`EFeatureType` 编码了两套词汇: * 枚举 key 是本地/skill 对外名(page / customField / liteAppComponent…), * 枚举 value 是 draft/remote JSON 里真实存的 wire 值(board / field_template / * builder_comp…)。该函数让 `lpm ai peek` / `patch-json` 的 path 谓词可以统一用 * 本地词汇——传入 wire 值或未知名字时原样返回,不会破坏既有调用。 */ export declare function resolvePointTypeAlias(value: string): string; /** * component 组件类型 */ export declare enum ECompType { schedule = "component_schedule" } /** * 插件构成适用工作项类型范围枚举 */ export declare enum EFeatureWorkItemTypeScope { all = "_all", issue = "issue", sprint = "sprint", story = "story", version = "version", others = "work_object" } /** * 插件构成适配端类型枚举 */ export declare enum EFeaturePlatform { web = "web", mobile = "mobile" } /** * 插件构成适用位置 */ export declare enum EFeatureScene { controlTable = 1, controlDetailForm = 2, controlNodeForm = 6, buttonWorkItemMore = 3, buttonWorkItemNodeMore = 4, buttonWorkItemCreate = 5, buttonWorkItemNodeComplete = 7,// 节点按钮完成事件 buttonScheduleUnit = 8,// 计划表更多按钮 buttonBatch = 9 } /** * 插件构成 */ export interface IPluginFeature { key: string; name: string; icon?: string; description: string; i18n_info: { ['zh-cn']: { name: string; description: string; }; ['en-us']: { name: string; description: string; }; ['ja-jp']: { name: string; description: string; }; }; type: EFeatureType; component_type?: ECompType; workItemTypeKeys: EFeatureWorkItemTypeScope[]; customWorkItemTypeKeys?: string[]; [EFeaturePlatform.mobile]: { scenes: EFeatureScene[]; resourceId: { resource: string; }; }; [EFeaturePlatform.web]: { scenes: EFeatureScene[]; resourceId: { resource: string; }; }; extension?: { ext_key: string; ext_type: string; ext_subType: string; ext_config: unknown; }[]; }