feat: 品牌替换 + 启动优化 + AGENTS.md 模板定制
- 品牌替换:OpenCode/opencode → AirCoding/aircoding(16+ 文件) - Logo ASCII art:修复 left/right 行数不匹配导致的启动崩溃 - 启动诊断:添加 OPENCODE_PRINT_TIMING 计时探针 - dev 模式默认 --pure 跳过外部插件加载 - AGENTS.md 模板:追加 AirCoding 多 Agent 专项段落 - architect prompt + plugin:强化 AGENTS.md 产出验证
This commit is contained in:
32
packages/ui/script/build-oc2-v2-overrides.ts
Normal file
32
packages/ui/script/build-oc2-v2-overrides.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { V2_PRIMITIVES_DEFAULT } from "../src/theme/v2/default-primitives"
|
||||
import type { DesktopTheme } from "../src/theme/types"
|
||||
|
||||
const themePath = import.meta.dir + "/../src/theme/themes/oc-2.json"
|
||||
const theme = (await Bun.file(themePath).json()) as DesktopTheme
|
||||
const css = await Bun.file(import.meta.dir + "/../src/v2/styles/theme.css").text()
|
||||
|
||||
const light = { ...V2_PRIMITIVES_DEFAULT, ...readTokens("light") }
|
||||
const dark = { ...V2_PRIMITIVES_DEFAULT, ...readTokens("dark") }
|
||||
|
||||
const next: DesktopTheme = {
|
||||
...theme,
|
||||
light: { ...theme.light, v2Overrides: light },
|
||||
dark: { ...theme.dark, v2Overrides: dark },
|
||||
}
|
||||
|
||||
await Bun.write(themePath, JSON.stringify(next, null, 2) + "\n")
|
||||
console.log("Updated oc-2.json v2Overrides", Object.keys(light).length, "tokens per mode")
|
||||
|
||||
function readTokens(mode: "light" | "dark") {
|
||||
const selector = mode === "light" ? ":root" : `\\[data-color-scheme="${mode}"\\]`
|
||||
const block = css.match(new RegExp(`${selector} \\{([\\s\\S]*?)\\n \\}`))?.[1]
|
||||
if (!block) throw new Error(`Missing ${mode} OC-2 tokens`)
|
||||
return Object.fromEntries(
|
||||
[...block.matchAll(/--(v2-[\w-]+):\s*([^;]+);/g)]
|
||||
// Fonts and the fixed avatar foreground remain global CSS rather than theme overrides.
|
||||
.filter(([, key]) => key !== "v2-avatar-fg" && key !== "v2-font-family-sans")
|
||||
.map(([, key, value]) => [key, value!.replace(/\s+/g, " ").trim()]),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user