GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — cli/vite.config.ts at main · modelstudioai/cli Expand file tree/ Copy pathvite.config.tsMore file actions 145 lines (141 loc) · 5.87 KB / Copy pathvite.config.tsFile metadata and controls145 lines (141 loc) · 5.87 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 import { defineConfig } from "vite-plus"; const commandCapabilityRestrictions = [ { property: "configStore", message: "configStore is only available to commands/config/**.", }, { property: "authStore", message: "authStore is only available to commands/auth/**.", }, { property: "commandPacks", message: "commandPacks is only available to commands/plugin/**.", }, { property: "exportApiCredential", message: "exportApiCredential is only available to commands/managed-agent/_engine/** (embedded-SDK credential delegation).", }, ] as const; type CommandCapabilityRestriction = (typeof commandCapabilityRestrictions)[number]; type CommandCapability = CommandCapabilityRestriction["property"]; function restrictCommandCapabilities( allowed?: CommandCapability, ): ["error", CommandCapabilityRestriction, ...CommandCapabilityRestriction[]] { return [ "error", ...commandCapabilityRestrictions.filter(({ property }) => property !== allowed), ] as ["error", CommandCapabilityRestriction, ...CommandCapabilityRestriction[]]; } export default defineConfig({ test: { globalSetup: "./packages/e2e/src/global-setup.ts", setupFiles: ["./packages/e2e/src/iso-root-setup.ts"], testTimeout: 60_000, hookTimeout: 60_000, }, staged: { // 用函数形式返回命令:不把匹配到的文件名插值进 argv,改为跑一次全量检查。 // 逐文件传参会让 `vp check` 的 node 进程 argv 携带仓库内的文件名, // 命中终端安全软件按 argv 子串匹配的进程管控规则时整个进程被 SIGKILL, // 导致 pre-commit 无法完成。全量检查覆盖面更广,也不依赖文件名。 "*.{js,mjs,cjs,ts,mts,cts,jsx,tsx,json,yaml,yml,md}": () => "vp check --fix", }, lint: { options: { typeAware: true, typeCheck: true }, // 命令只许抛错;进程退出统一收口到 runtime 的 handleError。 rules: { "unicorn/no-process-exit": "error" }, overrides: [ { // runtime 是统一出口层;tools/ 与测试是独立脚本入口,可直接退出。 files: ["packages/runtime/src/**", "tools/**", "**/tests/**"], rules: { "unicorn/no-process-exit": "off" }, }, { // finetune watch 的退出码是公开探针契约(0 成功/1 失败/2 超时/3 运行中/130 中断), // 非错误语义,不走 handleError。 files: ["packages/commands/src/commands/finetune/watch.ts"], rules: { "unicorn/no-process-exit": "off" }, }, { // 普通业务命令只依赖 settings/flags/client;持久化和管理能力按命令族开放。 files: ["packages/commands/src/commands/**/*.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities() }, }, { files: ["packages/commands/src/commands/config/**/*.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities("configStore"), }, }, { files: ["packages/commands/src/commands/auth/**/*.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities("authStore"), }, }, { files: ["packages/commands/src/commands/plugin/**/*.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities("commandPacks"), }, }, { files: ["packages/commands/src/commands/managed-agent/_engine/**/*.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities("exportApiCredential"), }, }, { // advisor recommend 的推荐引擎自带 OpenAI 兼容 LLM client(不经过 core 的 // request/requestJson 通道),凭证经 exportApiCredential 注入,与 // managed-agent/_engine 的嵌入式 SDK 委托同属受控例外。 files: ["packages/commands/src/commands/advisor/**/*.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities("exportApiCredential"), }, }, { // RL/OPD 沙箱执行器把 API 凭证委托给隔离沙箱内嵌的 dashscope SDK(不经过 // core 的 request/requestJson 通道),与 managed-agent/_engine、advisor 的 // 嵌入式 SDK 委托同属受控例外;仅限执行器本身,不波及整个 finetune 命令族。 files: ["packages/commands/src/commands/finetune/rl-shared.ts"], rules: { "no-restricted-properties": restrictCommandCapabilities("exportApiCredential"), }, }, { // dsh 插件(下游宿主适配层)的 `_` 前缀是“有意不用”的声明:被忽略的 catch // 绑定用 `_原因` 命名解释为何可以忽略,测试 mock 的 `_path` 类参数则是为了 // 钉住被 mock 函数的签名(删了就不再约束调用形状)。 files: ["packages/bailian-kb-dsh/**/*.{ts,tsx}", "packages/bailian-memo-dsh/**/*.{ts,tsx}"], rules: { "no-unused-vars": ["error", { caughtErrorsIgnorePattern: "^_", argsIgnorePattern: "^_" }], }, }, { // web 半会被 tsdown 打成浏览器 bundle,由 host 的 frozen module table 解析 require: // node 内置模块和本仓 CLI 包在那里根本不存在,import 到就是运行时必崩。 // @deepseek-ai/* 的 platform module 白名单仍由 tsdown 的 dsh-client-bundle-purity // 插件在构建期把关(名单即 CLIENT_EXTERNALS,见 tsdown.config.ts)。 files: [ "packages/bailian-kb-dsh/src/web/**/*.{ts,tsx}", "packages/bailian-memo-dsh/src/web/**/*.{ts,tsx}", ], rules: { "no-restricted-imports": [ "error", { paths: ["bailian-cli-core", "bailian-cli-runtime", "bailian-cli-commands"], patterns: ["node:*"], }, ], }, }, ], }, run: { cache: true, }, }); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |