提交记录修改desktop/linux/cage-desktop.c+1 −0看文件
修改ui/scripts/workbench-fixture.mjs+7 −0看文件
修改ui/scripts/workbench-smoke.mjs+5 −4看文件
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | /* Native Linux host for the shared Cage workbench. */ |
| 2 | 新增:#define _POSIX_C_SOURCE 200809L | |
| 2 | 3 | #include <gtk/gtk.h> |
| 3 | 4 | #include <webkit2/webkit2.h> |
| 4 | 5 | #include <json-glib/json-glib.h> |
| @@ -206,6 +206,13 @@ export async function createWorkbench({ | ||
| 206 | 206 | result = state.settings; |
| 207 | 207 | else if (path === "/status") |
| 208 | 208 | result = { ...state.status, workspace: state.settings.workspace }; |
| 209 | 新增: else if (path === "/projects/open") { | |
| 210 | 新增: if (state.failJob) return route.fulfill({ status: 400, body: "项目文件夹连接失败,原项目保持不变" }); | |
| 211 | 新增: if (!body.add && !state.status.projects.includes(body.workspace)) return route.fulfill({ status: 400, body: "请选择已授权的项目" }); | |
| 212 | 新增: if (body.add && !state.status.projects.includes(body.workspace)) state.status.projects.push(body.workspace); | |
| 213 | 新增: if (body.activate) state.settings.workspace = body.workspace; | |
| 214 | 新增: result = { workspace: body.workspace }; | |
| 215 | 新增: } | |
| 209 | 216 | else if (path === "/settings") { |
| 210 | 217 | state.saves.push(body); |
| 211 | 218 | if (state.failSave) |
| @@ -28,13 +28,13 @@ try { | ||
| 28 | 28 | .getByRole("navigation", { name: "主导航" }) |
| 29 | 29 | .getByRole("button", { name: /^打开项目/ }) |
| 30 | 30 | .click(); |
| 31 | 删除: await page.getByRole("button", { name: "选择文件夹…", exact: true }).click(); | |
| 31 | 新增: await page.getByRole("button", { name: "添加本机项目…", exact: true }).click(); | |
| 32 | 32 | await page.waitForFunction( |
| 33 | 33 | (path) => document.getElementById("project-path")?.value === path, |
| 34 | 34 | state.chosenFolder, |
| 35 | 35 | ); |
| 36 | 36 | assert.equal( |
| 37 | 删除: await page.getByLabel("项目文件夹", { exact: true }).inputValue(), | |
| 37 | 新增: await page.getByLabel("新项目文件夹", { exact: true }).inputValue(), | |
| 38 | 38 | state.chosenFolder, |
| 39 | 39 | ); |
| 40 | 40 | state.failJob = true; |
| @@ -49,7 +49,7 @@ try { | ||
| 49 | 49 | .filter({ hasText: "项目文件夹连接失败" }) |
| 50 | 50 | .waitFor(); |
| 51 | 51 | assert.equal( |
| 52 | 删除: await page.getByLabel("项目文件夹", { exact: true }).inputValue(), | |
| 52 | 新增: await page.getByLabel("新项目文件夹", { exact: true }).inputValue(), | |
| 53 | 53 | state.chosenFolder, |
| 54 | 54 | ); |
| 55 | 55 | assert.ok(state.settings.workspace.endsWith(".claude-cage-workspace")); |
| @@ -255,8 +255,9 @@ try { | ||
| 255 | 255 | .getByRole("navigation", { name: "主导航" }) |
| 256 | 256 | .getByRole("button", { name: /^打开项目/ }) |
| 257 | 257 | .click(); |
| 258 | 新增: await page.getByRole("button", { name: "添加本机项目…", exact: true }).click(); | |
| 258 | 259 | await page |
| 259 | 删除: .getByLabel("项目文件夹", { exact: true }) | |
| 260 | 新增: .getByLabel("新项目文件夹", { exact: true }) | |
| 260 | 261 | .fill("/Users/shihao/Projects/another-project"); |
| 261 | 262 | await page |
| 262 | 263 | .getByRole("dialog") |

