/** * 金蝶规则路由清单(单一真源) * 扩展 kingdee-rule-router 与索引文档应对齐本表。 */ export type ProductFamily = "cosmic" | "enterprise" | "unknown"; export interface DomainRuleSpec { /** rule name = 文件名(无扩展名),与 packages/kcode-pi/rules 一致 */ name: string; /** 产品线门控;unknown 表示跨线可用 */ families: readonly ProductFamily[]; /** 用户 prompt / 路径 关键词(小写匹配) */ keywords: readonly string[]; /** 路由优先级,越大越优先(在命中集合内排序) */ priority: number; } /** 每轮最多注入的领域规则数(不含 base) */ export const MAX_DOMAIN_RULES = 2; /** 注入正文总字节上限(UTF-8) */ export const MAX_INJECT_BYTES = 8 * 1024; /** 基础规范:有编码任务时总是带上 */ export const BASE_RULE_NAME = "kd-coding-standards"; /** 反过度工程:与 base 一并注入 */ export const STYLE_RULE_NAME = "kd-no-overengineering"; /** * 领域规则(按需 1~2 个 + base) * 不含索引类、skill-autoload(路由由扩展完成) */ export const DOMAIN_RULES: readonly DomainRuleSpec[] = [ { name: "kd-flagship-plugin", families: ["cosmic"], keywords: [ "插件", "plugin", "表单", "列表", "操作", "转换", "botp", "生命周期", "afterbind", "beforebind", "initialize", "registerlistener", "setenable", "setreadonly", "setvisible", "updateview", "控件", "分录", "entry", "getentrycount", "getentryrowcount", "createnewentryrow", "deleteentryrow", "getentryrowentity", "addrow", "deleterow", "getentry", "abstractformplugin", ], priority: 100, }, { name: "kd-flagship-data", families: ["cosmic"], keywords: [ "查询", "query", "dataset", "事务", "tx", "缓存", "循环", "orm", "businessdataservice", "queryservice", "queryall", "loadfromcache", "基础资料", "qfilter", "qcp", ], priority: 90, }, { name: "kd-flagship-security", families: ["cosmic"], keywords: ["日志", "异常", "安全", "注入", "xss", "权限", "脱敏"], priority: 80, }, { name: "kd-flagship-naming", families: ["cosmic"], keywords: ["命名", "类名", "方法名", "常量"], priority: 50, }, { name: "kd-flagship-sdk", families: ["cosmic"], keywords: ["sdk", "jar", "跨云", "枚举"], priority: 60, }, { name: "kd-ksql-rules", families: ["cosmic", "enterprise", "unknown"], keywords: ["ksql", "数据修复", "update ", "delete ", "回填", "备份", "回滚", "sql 修复"], priority: 110, }, { name: "kd-enterprise-db", families: ["enterprise"], keywords: ["数据库", "ddl", "dml", "表结构", "sql", "查询", "事务", "网控"], priority: 95, }, { name: "kd-enterprise-three-ids", families: ["enterprise"], keywords: [ "字段", "标识", "实体属性", "字段名", "getvalue", "setvalue", "dynamicobject", "dataentity", "fieldkey", "fieldkeys", "sql", "表单", "插件", "分录", "fbillno", "fqty", "三标识", ], priority: 115, }, { name: "kd-enterprise-api", families: ["enterprise"], keywords: [ "openapi", "webapi", "http", "第三方", "外部系统", "api", "isautosubmitandaudit", "validaterepeatjson", "防重", ], priority: 105, }, { name: "kd-enterprise-ipy-shape", families: ["enterprise"], keywords: ["ironpython", "python", "裸函数", "ipy", "bos 脚本", "脚本插件"], priority: 118, }, { name: "kd-enterprise-payment", families: ["enterprise"], keywords: ["付款", "核销", "银企", "支付", "财务"], priority: 85, }, { name: "kd-enterprise-ui", families: ["enterprise"], keywords: ["控件", "布局", "html5", "前端", "报表界面"], priority: 70, }, { name: "kd-enterprise-security", families: ["enterprise"], keywords: ["安全", "日志", "敏感"], priority: 75, }, { name: "kd-enterprise-project", families: ["enterprise"], // 勿用裸「工程」——对抗题「禁写完整工程」会误抢 domain 槽 keywords: [ "脚手架", "空目录", "csproj", "sln", "类库", "dotnet", "初始化项目", "创建工程", "kcode init", "业务对象扩展", "布局规范", ], priority: 120, }, { name: "kd-enterprise-code", families: ["enterprise"], keywords: ["插件", "plugin", "c#", "csharp", "ironpython", "裸函数", "python", "代码安全", "process", "abstractbill"], priority: 100, }, { name: "kd-debug-rules", families: ["cosmic", "enterprise", "unknown"], keywords: ["调试", "npe", "报错", "异常排查", "oom", "死锁", "bug", "classnotfound"], priority: 70, }, { name: "kd-cosmic-review-rules", families: ["cosmic"], keywords: ["审查", "review", "code review", "代码评审"], priority: 100, }, { name: "kd-delivery-rules", families: ["cosmic", "enterprise", "unknown"], keywords: ["交付", "预检", "门禁", "阶段"], priority: 70, }, // 动态注入:口述/API 对账题也要带上幻觉对照表(TTSR condition 不进 -p) { name: "kd-ttsr-no-hallucinated-api", families: ["cosmic", "unknown"], keywords: [ "setreadonly", "queryall", "getentrycount", "createnewentryrow", "deleteentryrow", "addrow", "deleterow", "getentry", "幻觉", "api 存在", "不存在", "hallucin", ], priority: 125, }, ] as const; /** 纯文档/无关任务:不注入业务编码规则 */ export const SKIP_CODING_KEYWORDS = [ "只改 readme", "只改文档", "changelog", "写文档", "翻译文档", "更新说明", ] as const; export const CODING_SIGNAL_KEYWORDS = [ "插件", "plugin", "java", "c#", "csharp", "python", "ironpython", "ksql", "sql", "字段", "表单", "列表", "操作", "报表", "openapi", "api", "查询", "事务", "代码", "实现", "开发", "编写", "修改", "修复", "bug", "审查", "review", "脚手架", "空目录", "csproj", "工程", "类库", "setenable", "setreadonly", "loadfromcache", "getentrycount", "createnewentryrow", "fieldkeys", "initialize", "分录", ".java", ".cs", ".py", ] as const;