From 9e88dcbd09f16b856b5a1c6d8204d9c700bad38a Mon Sep 17 00:00:00 2001 From: digua Date: Sun, 24 May 2026 15:28:54 +0800 Subject: [PATCH] feat(changelog): bundle changelogs locally --- .github/workflows/sync-changelogs.yml | 49 ------------ AGENTS.md | 1 + apps/desktop/preload/index.d.ts | 6 ++ src/components/UI/FileDropZone.vue | 2 - src/pages/home/components/ChangelogModal.vue | 83 ++++++-------------- src/pages/home/components/changelogData.ts | 47 +++++++++++ 6 files changed, 78 insertions(+), 110 deletions(-) delete mode 100644 .github/workflows/sync-changelogs.yml create mode 100644 src/pages/home/components/changelogData.ts diff --git a/.github/workflows/sync-changelogs.yml b/.github/workflows/sync-changelogs.yml deleted file mode 100644 index 71f99324..00000000 --- a/.github/workflows/sync-changelogs.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Sync changelogs to chatlab.fun - -on: - workflow_dispatch: - push: - branches: [main] - paths: - - 'changelogs/**' - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Checkout ChatLab - uses: actions/checkout@v4 - with: - sparse-checkout: changelogs - - - name: Checkout chatlab.fun - uses: actions/checkout@v4 - with: - repository: hellodigua/chatlab.fun - token: ${{ secrets.CHATLAB_FUN_TOKEN }} - path: chatlab-fun - - - name: Sync changelogs - run: | - rsync -av --delete \ - changelogs/ chatlab-fun/public/changelogs/ - - - name: Commit and push - id: push - working-directory: chatlab-fun - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add public/changelogs/ - if git diff --cached --quiet; then - echo "No changes to commit" - echo "pushed=false" >> $GITHUB_OUTPUT - else - git commit -m "sync: update changelogs from ChatLab@${GITHUB_SHA::7}" - git push - echo "pushed=true" >> $GITHUB_OUTPUT - fi - - - name: Trigger EdgeOne deploy - if: steps.push.outputs.pushed == 'true' - run: curl -s -X POST "${{ secrets.WEBSITE_DEPLOY_HOOK_URL }}" diff --git a/AGENTS.md b/AGENTS.md index a5ab04cd..188c84d3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,6 +3,7 @@ - 边界:只解决当前需求,不做与需求无关的重构和"顺手优化" - 每次完成任务后,对产生修改的文件进行类型检查、lint检查和format格式化,指定修改的文件路径去执行,确保代码质量 - 在执行检查时,如果有其他与本次修改无关的报错,也需要一并修复 +- 测试文件位置:与单个业务模块强相关的单元测试应就近放在被测文件同目录,命名为 `*.test.ts` / `*.test.js`;跨模块、集成、E2E、测试工具或不明显归属某个业务文件的测试放在根目录 `tests/`;某个 app/package 专属测试放在对应的 `apps/*` 或 `packages/*` 内,遵循该子项目现有约定 - 多语言:代码中的日志、注释、AI 工具描述、错误消息等非 UI 文本默认使用英文。当有运行时 locale 可用时(如工具返回结果、AI 看到的文本),应通过 `isChineseLocale(locale)` 等机制支持中英双语。数据清洗中与聊天平台格式匹配的标签(如 `[分享]`、`[图片]`)保持原始语言不变。UI 文案的国际化遵循 `.docs/rules/i18n.md` - 多端复用:维护 Electron 和 CLI Web 的共享业务逻辑时,优先在 `packages/node-runtime/src/services/` 下实现,禁止在路由/IPC handler 中绕过 core 直接写 SQL。详见 `.docs/README.md` 的"多端逻辑复用"章节。 - Commit 规范:使用 Conventional Commits。scope 规则——通用改动 scope 随意(如 `ai`、`import`、`sidebar` 等模块名);仅当改动是**平台特有**时才使用平台 scope(`electron`、`cli`、`web`)。 diff --git a/apps/desktop/preload/index.d.ts b/apps/desktop/preload/index.d.ts index c319da40..8e8dfab8 100644 --- a/apps/desktop/preload/index.d.ts +++ b/apps/desktop/preload/index.d.ts @@ -77,6 +77,12 @@ interface ChatApi { error?: string diagnostics?: ImportDiagnostics }> + importDirectory: (dirPath: string) => Promise<{ + success: boolean + sessionId?: string + error?: string + diagnostics?: ImportDiagnostics + }> importWithOptions: ( filePath: string, formatOptions: Record diff --git a/src/components/UI/FileDropZone.vue b/src/components/UI/FileDropZone.vue index 9329b17f..3b2b5e64 100644 --- a/src/components/UI/FileDropZone.vue +++ b/src/components/UI/FileDropZone.vue @@ -128,7 +128,6 @@ async function handleDirectoryDrop(dirEntry: FileSystemDirectoryEntry, fileList: // Electron: derive directory path from the native file path if (fileList.length > 0) { try { - // @ts-expect-error Electron webUtils const filePath: string | undefined = window.electron?.webUtils?.getPathForFile?.(fileList[0]) if (filePath) { // fileList[0] may be the directory itself or a file inside it; @@ -192,7 +191,6 @@ function processFiles(files: File[]) { // 尝试获取文件路径(Electron 环境) for (const file of files) { try { - // @ts-ignore - Electron webUtils const path = window.electron?.webUtils?.getPathForFile?.(file) if (path) { paths.push(path) diff --git a/src/pages/home/components/ChangelogModal.vue b/src/pages/home/components/ChangelogModal.vue index 75acbb9f..37bac4fe 100644 --- a/src/pages/home/components/ChangelogModal.vue +++ b/src/pages/home/components/ChangelogModal.vue @@ -1,14 +1,20 @@