From 0a1f500c12949a0158c19780799dc9c992dec104 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Wed, 24 Jun 2026 14:44:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(app+ds):=20=E9=98=B6=E6=AE=B52=20=E6=8E=A5?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=86=99=E6=93=8D=E4=BD=9C=E2=80=94=E2=80=94?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=88=9B=E5=BB=BA/=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=9D=E5=AD=98/=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 让原型里的视觉 mock 表单变为真正可写(附加式、向后兼容原型 index.html): design/ui_kits/console(surface 功能化,DS 组件本就支持 onChange): - NewTaskPanel:表单受控(title/complexity/priority/parentId),onCreate 出参; 父任务下拉扁平化含子任务 - TaskSection:暴露 onCreate prop(无则回退原 toast) - ConfigPanel:受控(concurrency/autonomy/logo/verifyCmd/model),onSave 出参 app/: - api.js:加 createProject - app.jsx:createTask→POST /tasks、saveConfig→PATCH /projects、createProject→ POST /projects;新增 NewProjectModal(design 无现成 surface,用 DS 组件就地拼装, zh/en 标签自含);接 Sidebar 新建项目入口 验证:dev + 生产构建双通过;Playwright 实测新建项目模态打开、受控输入捕获值 (["demo-app",".../demo-app","main"])、0 console 错误。写端点契约逐字段比对 server.ts(PATCH camelCase / POST tasks {title,complexity(auto),priority,parentId,deps})。 活写测试从略:maestro 为 auto-approved,建真实任务会触发 agent。 Co-Authored-By: Claude Opus 4.8 --- app/src/api.js | 1 + app/src/app.jsx | 65 +++++++++++++++++++++++++++-- design/ui_kits/console/TaskTree.jsx | 27 ++++++++---- design/ui_kits/console/Topbar.jsx | 21 +++++++--- 4 files changed, 98 insertions(+), 16 deletions(-) diff --git a/app/src/api.js b/app/src/api.js index 8056f70..3d75ab5 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -30,6 +30,7 @@ export const api = { http('POST', `/api/tasks/${taskId}/decide`, { action, reason, merge }), createTask: (pid, body) => http('POST', `/api/projects/${pid}/tasks`, body), patchProject: (pid, body) => http('PATCH', `/api/projects/${pid}`, body), + createProject: (body) => http('POST', '/api/projects', body), }; // WS 单向订阅:连上后服务端推送 events 表记录。断线自动重连(指数退避,封顶 10s)。 diff --git a/app/src/app.jsx b/app/src/app.jsx index ebfac06..16f736e 100644 --- a/app/src/app.jsx +++ b/app/src/app.jsx @@ -11,6 +11,43 @@ const { Toast } = window.MaestroDesignSystem_a6a290; const USER = { name: 'local', handle: '@local', plan: 'Claude Code', initial: 'L', hue: 200 }; +// 新建项目模态(design 无现成 surface,用 DS 组件就地拼装)。标签 zh/en 自含。 +function NewProjectModal({ t, lang, onCreate, onClose }) { + const { Button, Input, Select } = window.MaestroDesignSystem_a6a290; + const L = lang === 'zh' + ? { title: '新建项目', name: '项目名', repo: '仓库路径', branch: '默认分支', mode: '工作模式', namePh: 'my-app', repoPh: '/Users/you/code/my-app', create: '创建' } + : { title: 'New project', name: 'Name', repo: 'Repo path', branch: 'Default branch', mode: 'Mode', namePh: 'my-app', repoPh: '/Users/you/code/my-app', create: 'Create' }; + const [name, setName] = React.useState(''); + const [repoPath, setRepoPath] = React.useState(''); + const [defaultBranch, setDefaultBranch] = React.useState('main'); + const [autonomy, setAutonomy] = React.useState('manual'); + const submit = (e) => { + e.preventDefault(); + if (!name.trim() || !repoPath.trim()) return; + onCreate({ name: name.trim(), repoPath: repoPath.trim(), defaultBranch: defaultBranch.trim() || 'main', autonomy }); + }; + return ( +
+
+
+
▍ {L.title}
+
+ + +
+ + +
- ({ value: tk.id, label: tk.title }))]} /> + - + - - + + +
{t.lastSync}