lantern-harness 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/builtin/session/lh-fs.mjs +41 -1
  3. package/builtin/session/session-runs.mjs +34 -1
  4. package/cli/data-root.mjs +11 -6
  5. package/cli/seed-skip.mjs +72 -0
  6. package/cli/spaces.mjs +23 -9
  7. package/dist/500.html +4 -4
  8. package/dist/_astro/Base.I--fR8aT.css +1 -0
  9. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.D3Mv75pF.js → Base.astro_astro_type_script_index_0_lang.BQtZbum2.js} +1 -1
  10. package/dist/_astro/{CaseExecBoard.cBdsZU9e.js → CaseExecBoard.Dnb8oP5i.js} +1 -1
  11. package/dist/_astro/CaseGenerateApp.ci_JowEk.js +10 -0
  12. package/dist/_astro/CasesLibrary.DfuTkbJN.js +21 -0
  13. package/dist/_astro/ChatApp.CAgrwilW.js +214 -0
  14. package/dist/_astro/{DashboardBoard.BNuKH_zX.js → DashboardBoard.D8-oufgg.js} +1 -1
  15. package/dist/_astro/{DocsFileBrowser.-dkkxR4X.js → DocsFileBrowser.CTICuWFf.js} +1 -1
  16. package/dist/_astro/{DocsPager.v4kQH163.js → DocsPager.B9VhI6E3.js} +1 -1
  17. package/dist/_astro/{DrawerField.C0ehOlDt.js → DrawerField.C0MkN-LW.js} +1 -1
  18. package/dist/_astro/ExcelFieldTags.CXif3Ilh.js +1 -0
  19. package/dist/_astro/{KnowledgeLibrary.D0r8ieOZ.js → KnowledgeLibrary.DGhU2p3S.js} +1 -1
  20. package/dist/_astro/{NavLibraries.D1J9BwYo.js → NavLibraries.RH3Sinuh.js} +1 -1
  21. package/dist/_astro/PluginsPage.C9vaY-lo.js +1 -0
  22. package/dist/_astro/{PluginsPage.BkwleEJf.js → PluginsPage.DjeMQX3i.js} +2 -2
  23. package/dist/_astro/PmBugsBoard.BnnaNP1y.js +1 -0
  24. package/dist/_astro/PmIterationsBoard.phiyhQVA.js +1 -0
  25. package/dist/_astro/{PmProjectDetail.B7oWL7y-.js → PmProjectDetail.C8kRX5lu.js} +1 -1
  26. package/dist/_astro/{PmProjectsBoard.8QI44RlE.js → PmProjectsBoard.CFApEGPo.js} +1 -1
  27. package/dist/_astro/PmRequirementsBoard.B-AI9iZX.js +1 -0
  28. package/dist/_astro/PmRequirementsBoard.DR9egcgA.js +1 -0
  29. package/dist/_astro/PmShared.BrBicDMN.js +1 -0
  30. package/dist/_astro/PromptsLibrary.CbGja6mq.js +1 -0
  31. package/dist/_astro/{ReportsPage.BjcajHR6.js → ReportsPage.CYZtpeiv.js} +1 -1
  32. package/dist/_astro/ReqAnalysisBoard.By08xNFf.js +29 -0
  33. package/dist/_astro/RequirementsLibrary.BSDgdppH.js +1 -0
  34. package/dist/_astro/SearchableSelect.Cbb8jMnP.js +1 -0
  35. package/dist/_astro/SelectDropdown.apWlFGbA.js +1 -0
  36. package/dist/_astro/{SettingsDialog.CmY3q7-S.js → SettingsDialog.DgpH_BVN.js} +1 -1
  37. package/dist/_astro/{SlideOverDrawer.HqVYaIjP.js → SlideOverDrawer.DMWJPD_W.js} +1 -1
  38. package/dist/_astro/{SpaceSwitcher.B8dzGxrR.js → SpaceSwitcher.Dw9LjKiJ.js} +2 -2
  39. package/dist/_astro/{TagSelect.CuN5RdF4.js → TagSelect.B9W63KWq.js} +1 -1
  40. package/dist/_astro/{TasksBoard.Bz_JL_uQ.js → TasksBoard.D0HwS5hd.js} +1 -1
  41. package/dist/_astro/TemplatesLibrary.CVv5Ef30.js +1 -0
  42. package/dist/_astro/{TestStatsBoard.EIDxmU_8.js → TestStatsBoard._qNcNorG.js} +1 -1
  43. package/dist/_astro/TodosBoard.CF5wbJy7.js +1 -0
  44. package/dist/_astro/{UiAutoBoard.BwKG4DcV.js → UiAutoBoard.nrtcQJDl.js} +3 -3
  45. package/dist/_astro/app-version.5UudQEyk.js +1 -0
  46. package/dist/_astro/case-fields.h0roo2br.js +1 -0
  47. package/dist/_astro/case-gen-run.D8DGX0mr.js +19 -0
  48. package/dist/_astro/case-review.C1hQRbQ2.js +3 -0
  49. package/dist/_astro/case-template.F1Nv08GV.js +5 -0
  50. package/dist/_astro/{i18n.B3BVhlok.js → i18n.CjqQGCAI.js} +1 -1
  51. package/dist/_astro/{llm.BZEzE0x2.js → llm.BuR7z55C.js} +1 -1
  52. package/dist/_astro/{open-docs-in-session.B6uyOxPn.js → open-docs-in-session.Cj0J2-XT.js} +1 -1
  53. package/dist/_astro/{plugins.DYyAjBXb.js → plugins.CVM1IaoC.js} +1 -1
  54. package/dist/_astro/pm.pMOkNqqK.js +4 -0
  55. package/dist/_astro/req-analysis.dhgy4p2f.js +14 -0
  56. package/dist/_astro/{settings.BvxRxdqa.js → settings.B1yetppp.js} +2 -2
  57. package/dist/_astro/{spaces-client.Dy3tSPta.js → spaces-client.DnS6MgGy.js} +1 -1
  58. package/dist/_astro/story-review.E_go1fvj.js +12 -0
  59. package/dist/case-exec/index.html +5 -5
  60. package/dist/cases/generate/index.html +5 -5
  61. package/dist/cases/library/index.html +5 -5
  62. package/dist/dashboard/index.html +5 -5
  63. package/dist/docs/changelog/index.html +47 -5
  64. package/dist/docs/install/index.html +4 -4
  65. package/dist/docs/manual/index.html +16 -14
  66. package/dist/index.html +2 -2
  67. package/dist/knowledge/index.html +5 -5
  68. package/dist/plugins/index.html +5 -5
  69. package/dist/pm/bugs/index.html +5 -5
  70. package/dist/pm/iterations/index.html +5 -5
  71. package/dist/pm/projects/detail/index.html +5 -5
  72. package/dist/pm/projects/index.html +5 -5
  73. package/dist/pm/requirements/index.html +5 -5
  74. package/dist/prompts/index.html +5 -5
  75. package/dist/reports/index.html +5 -5
  76. package/dist/requirement-analysis/index.html +5 -5
  77. package/dist/requirements/index.html +5 -5
  78. package/dist/tasks/index.html +5 -5
  79. package/dist/templates/index.html +5 -5
  80. package/dist/test-automation/index.html +5 -5
  81. package/dist/test-stats/index.html +5 -5
  82. package/dist/todos/index.html +5 -5
  83. package/dist/workbench/index.html +5 -5
  84. package/docs/lantern-harness.code-workspace +11 -0
  85. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +12 -10
  86. package/lh-plugins/case-backup-ttl.mjs +34 -0
  87. package/lh-plugins/case-review-prompt.mjs +16 -13
  88. package/lh-plugins/lh-case-review.mjs +76 -2
  89. package/lh-plugins/lh-project-docs.mjs +17 -0
  90. package/lh-plugins/lh-reports.mjs +28 -44
  91. package/lh-plugins/lh-req-analysis.mjs +41 -5
  92. package/package.json +1 -1
  93. package/dist/_astro/Base.8d5eaaN-.css +0 -1
  94. package/dist/_astro/CaseGenerateApp.DLcUOrpS.js +0 -9
  95. package/dist/_astro/CasesLibrary.BghGVLeb.js +0 -19
  96. package/dist/_astro/ChatApp.DFRI7l4j.js +0 -226
  97. package/dist/_astro/ExcelFieldTags.ytbpKt-Z.js +0 -5
  98. package/dist/_astro/PluginsPage.tkNDzVHL.js +0 -1
  99. package/dist/_astro/PmBugsBoard.BTtm1lki.js +0 -1
  100. package/dist/_astro/PmIterationsBoard.Dm67iXe_.js +0 -1
  101. package/dist/_astro/PmRequirementsBoard.DMJVLCqz.js +0 -1
  102. package/dist/_astro/PmRequirementsBoard.X98441HZ.js +0 -1
  103. package/dist/_astro/PmShared.DbDseTcc.js +0 -1
  104. package/dist/_astro/PromptsLibrary.CjSQTnKT.js +0 -1
  105. package/dist/_astro/ReqAnalysisBoard.C9g4p0Q1.js +0 -29
  106. package/dist/_astro/RequirementsLibrary.B5TE-2Ds.js +0 -1
  107. package/dist/_astro/SearchableSelect.mvcBwegf.js +0 -1
  108. package/dist/_astro/SelectDropdown.Cb-QtC-D.js +0 -1
  109. package/dist/_astro/TemplatesLibrary.DazYm5Sh.js +0 -1
  110. package/dist/_astro/TodosBoard.DV1VzVDe.js +0 -1
  111. package/dist/_astro/app-version.BRO_L8TS.js +0 -1
  112. package/dist/_astro/case-review.DYyZat83.js +0 -3
  113. package/dist/_astro/index.astro_astro_type_script_index_0_lang.CM78W1qz.js +0 -1
  114. package/dist/_astro/pm.CagBA-ht.js +0 -4
  115. package/dist/_astro/req-analysis.DGQa1vaH.js +0 -6
  116. package/dist/_astro/story-review.BXXv0Ko_.js +0 -10
  117. package/dist/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203/index.html +0 -851
  118. package/dist/raw/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203.md +0 -168
  119. package/dist/raw/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277.md +0 -58
  120. package/dist/raw/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277.md +0 -54
  121. package/dist/raw/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277.md +0 -35
  122. package/dist/raw/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277.md +0 -48
  123. package/dist/raw/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277.md +0 -30
  124. package/dist/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +0 -710
  125. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +0 -690
  126. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +0 -652
  127. package/dist/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +0 -679
  128. package/dist/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +0 -654
@@ -1 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.CF1xVPmo.js";import{i as r,o as i,s as a}from"./plugins.DYyAjBXb.js";import{a as o,n as s,o as c,r as ee}from"./view-prefs.D1snIG5o.js";import{i as l,n as te,r as u,t as ne}from"./dialog.DZHZCe_T.js";import{t as d}from"./jsx-runtime.DUg_B_vD.js";import{t as f}from"./ConfirmDialog.CsMwWevK.js";import{a as p,c as m,d as h,i as re,l as ie,n as g,o as ae,r as _,s as oe,t as v}from"./ColumnResize.BgYkV9Iy.js";import{n as se,t as y}from"./DatePicker.Bkl71M49.js";import{t as ce}from"./OverflowHint.pvo2Xc8R.js";import{t as b}from"./SelectDropdown.Cb-QtC-D.js";import{showToast as x}from"./Toast.BO2NFckG.js";import{A as S,C as le,D as ue,E as de,M as fe,N as pe,P as C,S as me,T as he,_ as ge,b as w,f as _e,g as ve,j as ye,k as be,n as T,u as xe,v as E,w as Se,x as Ce,y as D}from"./tasks.BNBkrFC3.js";import{a as O,c as k,i as we,l as A,n as j,o as M,r as N,s as P,t as F}from"./DrawerField.C0ehOlDt.js";var I=e(t(),1),L=d(),Te=8e3,Ee=[{key:`select`,width:32,min:28},{key:`index`,width:36,min:28},{key:`title`,width:300,min:160},{key:`status`,width:104,min:76},{key:`task`,width:156,min:96},{key:`priority`,width:104,min:84},{key:`start`,width:108,min:88},{key:`due`,width:108,min:88},{key:`end`,width:108,min:88},{key:`cycle`,width:64,min:52},{key:`remain`,width:86,min:64},{key:`note`,width:160,min:100},{key:`filler`,filler:!0},{key:`action`,width:88,min:72}],De=[`title`,`status`,`priority`,`linkedTask`,`startDate`,`dueDate`,`note`],Oe={in_progress:`bg-[#3370ff] text-white`,pending:`bg-stone-400 text-white`,done:`bg-[#34c724] text-white`,cancelled:`bg-stone-300 text-stone-600`,overdue:`bg-[#f54a45] text-white`},ke={in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,pending:`bg-stone-100 text-stone-600`,done:`bg-[#d9f5d2] text-[#1d7a12]`,cancelled:`bg-stone-100 text-stone-400`,overdue:`bg-[#fee4e3] text-[#c02a26]`},R={urgent_important:`bg-[#f54a45] text-white`,important:`bg-[#ff8800] text-white`,urgent:`bg-[#f7ba1e] text-stone-800`,normal:`bg-stone-200 text-stone-600`,"":`bg-transparent text-stone-400`},Ae={pending:`bg-stone-400`,in_progress:`bg-[#3370ff]`,done:`bg-[#34c724]`,overdue:`bg-[#f54a45]`,cancelled:`bg-stone-300`},je={urgent_important:`bg-[#f54a45]`,important:`bg-[#ff8800]`,urgent:`bg-[#f7ba1e]`,normal:`bg-stone-300`,"":`border border-stone-300 bg-transparent`},z={status:`按状态分组`,priority:`按紧急程度分组`,none:`不分组`},Me=[`status`,`priority`,`none`],Ne=`todos.group-by`,Pe=[`in_progress`,`pending`,`overdue`,`done`,`cancelled`],Fe=D.map(e=>({value:e,label:w[e]})),Ie=[{value:``,label:`未设置`},...ge.map(e=>({value:e,label:E[e]}))],Le=Object.keys(z).map(e=>({value:e,label:z[e]})),Re=[{value:`all`,label:`全部紧急程度`},...ge.map(e=>({value:e,label:E[e]}))],ze=Re.map(e=>e.value),Be=`todos.priority-filter`,Ve=`todos.search`,He=`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-transparent px-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-300`;function Ue(e){let{value:t,placeholder:n,muted:r,autoFocus:i,onChange:a,onCommit:o,onCancel:s}=e;return(0,L.jsx)(`input`,{type:`text`,value:t,placeholder:n,autoFocus:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),s(),e.currentTarget.blur())},className:`${He} ${r&&!t?`text-stone-300`:``}`})}function We(e){let{value:t,onChange:n,onCommit:r,onCancel:i}=e,[a,o]=(0,I.useState)(!1);return a?(0,L.jsx)(Ue,{value:t,placeholder:`—`,autoFocus:!0,onChange:n,onCommit:()=>{o(!1),r()},onCancel:()=>{o(!1),i()}}):(0,L.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`block h-8 w-full min-w-0 truncate rounded-md border border-transparent px-1.5 text-left text-sm leading-8 text-stone-700 transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:outline-none`,children:t||(0,L.jsx)(`span`,{className:`text-stone-300`,children:`—`})})}function Ge(e){return(0,L.jsx)(y,{value:e.value,onChange:e.onChange,placeholder:`选择日期`,className:`h-8 rounded-md border border-transparent px-1.5 text-sm text-stone-800 tabular-nums transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}function Ke(e){let{open:t,item:n,preset:r,tasks:i,tasksOn:a,onClose:o,onSaved:s}=e,[c,ee]=(0,I.useState)({title:``}),[d,f]=(0,I.useState)(``),[p,m]=(0,I.useState)(!1),[h,re]=(0,I.useState)(!0);(0,I.useEffect)(()=>{t&&(f(``),m(!1),re(!0),ee(n?{title:n.title,status:n.status,priority:n.priority,linkedTask:n.linkedTask,taskId:n.taskId,startDate:n.startDate,dueDate:n.dueDate,note:n.note}:{title:``,status:`pending`,priority:``,startDate:S(),dueDate:S(),...r}))},[t,n,r]);let ie=[{value:``,label:`不关联`},..._e(i.filter(e=>e.status!==`closed`&&e.status!==`cancelled`||e.id===n?.taskId)).map(e=>({value:e.id,label:e.title}))];function g(e){ee(t=>({...t,...e}))}let ae=ye({startDate:c.startDate??``,dueDate:c.dueDate??``}),_=pe({dueDate:c.dueDate??``}),oe=de(c.status??`pending`),v=oe?se((n&&de(n.status)?n.taskEndDate:``)||S()):``,le=_===null?``:c.status===`done`?`已完成`:c.status===`cancelled`?`已取消`:_<0?`逾期 ${Math.abs(_)} 天`:_===0?`今天截止`:`${_} 天`;async function ue(){let e=(c.title??``).trim();if(!e)f(`请填写待办名称`);else if(c.startDate&&c.dueDate&&c.dueDate<c.startDate)f(`截止日期不能早于开始日期`);else{m(!0),f(``);try{let t={...c,title:e};n?await C(n.id,t):await Ce([t],{mode:`manual`}),await s(),x(n?`已保存待办`:`已新建待办`,`success`),o()}catch(e){let t=e instanceof Error?e.message:String(e);f(t),x(`保存待办失败:${t}`,`error`)}finally{m(!1)}}}return(0,L.jsxs)(u,{open:t,onClose:o,transition:!0,className:`relative z-100`,children:[(0,L.jsx)(ne,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/25`,"aria-hidden":`true`}),(0,L.jsx)(`div`,{className:`fixed inset-0 flex justify-end`,children:(0,L.jsxs)(l,{transition:!0,className:`tw-drawer-panel-anim flex h-full w-full max-w-[520px] flex-col border-l border-stone-200 bg-white shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-stone-100 px-6 py-4`,children:[(0,L.jsx)(te,{className:`text-base font-semibold text-stone-900`,children:n?`待办详情`:`新建待办`}),(0,L.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`关闭`,className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`✕`})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-3`,children:[(0,L.jsx)(j,{icon:(0,L.jsx)(A,{}),label:`待办名称`,children:(0,L.jsx)(`input`,{autoFocus:!0,value:c.title,onChange:e=>g({title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ue())},placeholder:`请输入内容`,className:F})}),(0,L.jsx)(j,{icon:(0,L.jsx)(P,{}),label:`待办状态`,children:(0,L.jsx)(N,{ariaLabel:`待办状态`,menuMinWidth:140,options:Fe,value:c.status??`pending`,onChange:e=>g({status:e}),label:w[c.status??`pending`],optionDotClassName:e=>Ae[e]})}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>re(e=>!e),"aria-expanded":h,className:`flex w-full items-center gap-2 px-6 py-2 text-left text-sm text-stone-600 hover:bg-stone-50`,children:[(0,L.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center text-stone-400`,children:(0,L.jsx)(k,{})}),(0,L.jsx)(`span`,{children:`任务详情`}),(0,L.jsx)(`span`,{className:`text-stone-400`,children:(0,L.jsx)(we,{open:h})})]}),h?(0,L.jsxs)(`div`,{className:`ml-[42px] border-l border-stone-100 pl-1`,children:[(0,L.jsx)(j,{icon:(0,L.jsx)(k,{}),label:`所属任务`,children:a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(b,{flat:!0,searchable:!0,searchPlaceholder:`搜索任务…`,ariaLabel:`所属任务`,menuMinWidth:220,options:ie,value:c.taskId??``,onChange:e=>{let t=i.find(t=>t.id===e);g({taskId:e,linkedTask:t?.title??``,...t?{priority:t.priority}:{}})},renderTrigger:()=>(0,L.jsx)(ce,{text:c.taskId?i.find(e=>e.id===c.taskId)?.title??``:c.linkedTask||`请选择任务`,className:`min-w-0 flex-1 truncate ${c.taskId||c.linkedTask?`text-stone-800`:`text-stone-400`}`})}),i.length===0?(0,L.jsx)(`p`,{className:`mt-1 px-2 text-xs text-stone-400`,children:`任务管理里还没有任务,可到「任务管理」新建后再关联。`}):null]}):(0,L.jsx)(`div`,{className:`flex h-9 items-center rounded-md bg-stone-50 px-2 text-sm text-stone-400`,children:(0,L.jsx)(`span`,{className:`truncate`,children:c.linkedTask?`${c.linkedTask}(任务管理插件未启用)`:`任务管理插件未启用,无法关联任务`})})}),(0,L.jsx)(j,{icon:(0,L.jsx)(P,{}),label:`重要紧急程度`,children:(()=>{let e=c.taskId?i.find(e=>e.id===c.taskId):void 0;return e?(0,L.jsxs)(`div`,{className:`flex h-9 items-center gap-2 px-2 text-sm`,children:[(0,L.jsx)(`span`,{className:e.priority?`text-stone-800`:`text-stone-400`,children:e.priority?T[e.priority]:`任务未设置`}),(0,L.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`跟随所属任务`})]}):(0,L.jsx)(N,{ariaLabel:`重要紧急程度`,menuMinWidth:140,options:Ie,value:c.priority??``,onChange:e=>g({priority:e}),label:c.priority?E[c.priority]:`未设置`,optionDotClassName:e=>je[e]})})()}),(0,L.jsx)(j,{icon:(0,L.jsx)(O,{}),label:`结束日期`,children:(0,L.jsxs)(`div`,{className:`flex h-9 items-center px-2 text-sm tabular-nums`,"aria-readonly":`true`,children:[v?(0,L.jsx)(`span`,{className:`text-stone-800`,children:v}):(0,L.jsx)(`span`,{className:`text-stone-400`,children:`待办未完成`}),(0,L.jsx)(`span`,{className:`ml-2 text-[11px] text-stone-400`,children:oe?`按完成日期自动记录`:`状态为已完成 / 已取消时自动记录`})]})})]}):null,(0,L.jsx)(j,{icon:(0,L.jsx)(O,{}),label:`开始日期`,children:(0,L.jsx)(y,{value:c.startDate??``,onChange:e=>g({startDate:e}),className:`${F} tabular-nums`})}),(0,L.jsx)(j,{icon:(0,L.jsx)(O,{}),label:`截止日期`,children:(0,L.jsx)(y,{value:c.dueDate??``,onChange:e=>g({dueDate:e}),className:`${F} tabular-nums`})}),(0,L.jsx)(j,{icon:(0,L.jsx)(M,{}),label:`待办周期`,children:(0,L.jsx)(`div`,{className:`px-2 pt-1.5 text-sm text-stone-500`,children:ae===null?`—`:`${ae} 天`})}),(0,L.jsx)(j,{icon:(0,L.jsx)(M,{}),label:`剩余天数`,children:(0,L.jsx)(`div`,{className:`px-2 pt-1.5 text-sm text-stone-500`,children:le||`—`})}),(0,L.jsx)(j,{icon:(0,L.jsx)(A,{}),label:`备注`,children:(0,L.jsx)(`textarea`,{value:c.note??``,onChange:e=>g({note:e.target.value}),rows:4,placeholder:`请输入内容`,className:`w-full resize-y rounded-md border border-transparent bg-transparent px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`})}),d?(0,L.jsx)(`div`,{className:`mx-6 mt-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:d}):null]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-stone-100 px-6 py-3`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:o,disabled:p,className:`h-8 rounded-lg border border-stone-200 px-4 text-sm text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:`取消`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>void ue(),disabled:p,className:`h-8 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:p?`保存中…`:n?`保存`:`新建`})]})]})})]})}function B(){let[e,t]=(0,I.useState)(!1),[l,te]=(0,I.useState)(!0),[u,ne]=(0,I.useState)(null),[d,T]=(0,I.useState)([]),[D,O]=(0,I.useState)([]),[k,we]=(0,I.useState)(!1),[A,j]=(0,I.useState)(null),[M,N]=(0,I.useState)(!1),[P,F]=(0,I.useState)(()=>ee(Ve)),[z,He]=(0,I.useState)(()=>s(Be,ze,`all`)),[B,qe]=(0,I.useState)(()=>s(Ne,Me,`status`)),[Je,Ye]=(0,I.useState)({}),[V,Xe]=(0,I.useState)({});function Ze(e){o(Ne,e),qe(e)}function Qe(e){o(Be,e),He(e)}function $e(e){c(Ve,e),F(e)}let[et,tt]=(0,I.useState)({}),[H,U]=(0,I.useState)(null),[W,G]=(0,I.useState)(null),[nt,rt]=(0,I.useState)(!1),[it,at]=(0,I.useState)(null),K=(0,I.useRef)(!0),ot=(0,I.useRef)(!1),st=(0,I.useRef)(!1),q=ie(`lh:todos:cols:v1`,Ee),ct=h(`todos`),lt=H!==null,ut=(0,I.useRef)(H);ut.current=H;let dt=(0,I.useRef)(!1),ft=(0,I.useRef)(async()=>{});ft.current=bt,(0,I.useEffect)(()=>(K.current=!0,()=>{K.current=!1}),[]),(0,I.useEffect)(()=>{if(!lt)return;let e=e=>{let t=e.target;if(!(t instanceof Element)||t.closest(`.tw-new-row`)||t.closest(`.tw-date-panel`)||t.closest(`.tw-select-menu`))return;let n=ut.current;if(!n)return;if(n.title.trim()){ft.current();return}let r=S();!n.note.trim()&&!n.taskId&&n.status===n.baseStatus&&n.priority===n.basePriority&&n.startDate===r&&n.dueDate===r&&U(null)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[lt]);let J=(0,I.useCallback)(async()=>{try{let[e,t]=await Promise.all([ue(),k?xe().catch(()=>[]):Promise.resolve([])]);if(!K.current)return;let n=t;if(!ot.current&&k){ot.current=!0;let r=new Set(e.filter(e=>e.status===`pending`||e.status===`in_progress`).map(e=>e.taskId).filter(Boolean)),i=t.filter(e=>r.has(e.id)&&(e.status===`pool`||e.status===`done`));if(i.length){let e=await Promise.all(i.map(e=>ve(e.id,{status:`in_progress`}).catch(()=>null))),r=new Map(e.filter(e=>!!e).map(e=>[e.id,e]));n=t.map(e=>r.get(e.id)??e)}}T(e),O(n),j(null)}catch(e){if(!K.current)return;j(e instanceof Error?e.message:String(e))}},[k]);(0,I.useEffect)(()=>{let e=i(e=>{te(!!e.todos),we(!!e.tasks)});return n().then(()=>{te(r(`todos`)),we(r(`tasks`)),t(!0)}),e},[]),(0,I.useEffect)(()=>{e&&l&&(async()=>{let e=await Se();K.current&&(e?(await J(),K.current&&ne(!0)):ne(!1))})()},[e,l,J]),(0,I.useEffect)(()=>{if(u!==!0)return;let e=window.setInterval(()=>{st.current||J()},Te),t=()=>{st.current||J()};return window.addEventListener(`focus`,t),()=>{window.clearInterval(e),window.removeEventListener(`focus`,t)}},[u,J]),(0,I.useEffect)(()=>{if(!k||u!==!0||D.length===0)return;let e=d.filter(e=>!e.taskId&&e.linkedTask.trim());if(!e.length)return;let t=!1;return(async()=>{let n=[];for(let t of e){let e=D.find(e=>e.title.trim()===t.linkedTask.trim());if(e)try{n.push(await C(t.id,{taskId:e.id}))}catch{}}!t&&n.length&&T(e=>e.map(e=>n.find(t=>t.id===e.id)??e))})(),()=>{t=!0}},[k,u,d,D]);function pt(e,t,n){tt(r=>({...r,[e]:{...r[e],[t]:n}}))}function Y(e){tt(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})}let mt=(0,I.useMemo)(()=>[{value:``,label:`不关联`},..._e(D.filter(e=>e.status!==`closed`&&e.status!==`cancelled`)).map(e=>({value:e.id,label:e.title}))],[D]);function ht(e){return e.taskId?D.find(t=>t.id===e.taskId)?.title??e.linkedTask:e.linkedTask}function gt(e){return e.taskId?D.find(t=>t.id===e.taskId):void 0}function _t(e){let t=gt(e);return t?t.priority:e.priority}async function X(e,t){T(n=>n.map(n=>n.id===e?{...n,...t}:n));try{let n=await C(e,t);if(!K.current)return;T(t=>t.map(t=>t.id===e?n:t)),j(null),t.taskId&&await J()}catch(e){j(e instanceof Error?e.message:String(e)),await J()}}async function vt(e){let t=et[e],n=d.find(t=>t.id===e);if(!t||!n)return;let r={},i=n;for(let e of De){let n=t[e];n!==void 0&&String(i[e]??``)!==String(n)&&(r[e]=n)}if(!Object.keys(r).length)Y(e);else if(typeof r.title==`string`&&!r.title.trim())j(`待办名称不能为空`),Y(e);else try{let t=await C(e,r);if(!K.current)return;T(n=>n.map(n=>n.id===e?t:n)),tt(t=>{let n=t[e];if(!n)return t;let i={...n};for(let e of Object.keys(r))String(i[e]??``)===String(r[e]??``)&&delete i[e];if(!Object.keys(i).length){let n={...t};return delete n[e],n}return{...t,[e]:i}}),j(null)}catch(t){j(t instanceof Error?t.message:String(t)),Y(e)}}function yt(e){let t=e.newStatus??`pending`,n=e.newPriority??``;U({groupKey:e.key,title:``,status:t,priority:n,taskId:``,startDate:S(),dueDate:S(),note:``,baseStatus:t,basePriority:n}),Ye(t=>({...t,[e.key]:!1}))}async function bt(){let e=ut.current;if(!e||dt.current)return;let t=e.title.trim();if(t){dt.current=!0,rt(!0);try{let n=D.find(t=>t.id===e.taskId);await Ce([{title:t,status:e.status,priority:e.priority,taskId:e.taskId,linkedTask:n?.title??``,startDate:e.startDate,dueDate:e.dueDate,note:e.note}],{mode:`manual`}),ut.current===e&&U(null),j(null),await J()}catch(e){j(e instanceof Error?e.message:String(e))}finally{dt.current=!1,K.current&&rt(!1)}}}async function xt(){let e=W;if(e){G(null),N(!0),j(null);try{await me(e.map(e=>e.id)),Xe({}),await J(),x(e.length>1?`已删除 ${e.length} 条待办`:`已删除待办`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);j(t),x(`删除待办失败:${t}`,`error`)}finally{K.current&&N(!1)}}}let Z=S(),St=(0,I.useMemo)(()=>d.map(e=>{let t=e.taskId?D.find(t=>t.id===e.taskId):void 0;return t?{...e,priority:t.priority}:e}),[d,D]),Ct=(0,I.useMemo)(()=>he(St,{status:`all`,priority:z,keyword:P,today:Z}),[St,z,P,Z]),Q=(0,I.useMemo)(()=>be(Ct),[Ct]),wt=(0,I.useMemo)(()=>B===`none`?[{key:`all`,label:`全部待办`,pill:`bg-stone-500 text-white`,items:Q}]:B===`priority`?[...ge,``].map(e=>({key:`priority:${e||`none`}`,label:e?E[e]:`未设置`,pill:e?R[e]:`bg-stone-300 text-stone-600`,items:Q.filter(t=>t.priority===e),newPriority:e})):Pe.map(e=>({key:`status:${e}`,label:w[e],pill:Oe[e],items:Q.filter(t=>le(t,Z)===e),newStatus:e===`overdue`?`pending`:e})),[B,Q,Z]).filter(e=>e.items.length>0||H?.groupKey===e.key&&!!H),Tt=Object.keys(V).filter(e=>V[e]),$=(0,I.useMemo)(()=>{let e={total:d.length,pending:0,in_progress:0,done:0,overdue:0};for(let t of d){let n=le(t,Z);n===`overdue`?e.overdue+=1:n===`pending`?e.pending+=1:n===`in_progress`?e.in_progress+=1:n===`done`&&(e.done+=1)}return e},[d,Z]);return e?l?u===null?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在连接待办服务`,children:(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,L.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):u?(0,L.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-stone-100 px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`text-sm text-stone-600`,children:[`共 `,(0,L.jsx)(`span`,{className:`font-medium text-stone-800`,children:$.total}),` 条`,(0,L.jsxs)(`span`,{className:`text-stone-400`,children:[` `,`· 待开始 `,$.pending,` · 进行中 `,$.in_progress,` · 已完成 `,$.done,$.overdue?` · 已延期 ${$.overdue}`:``]})]}),(0,L.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`input`,{value:P,onChange:e=>$e(e.target.value),placeholder:`搜索待办…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,L.jsx)(b,{flat:!0,className:`w-[132px]`,ariaLabel:`分组方式`,options:Le,value:B,onChange:e=>Ze(e)}),(0,L.jsx)(b,{flat:!0,className:`w-[136px]`,ariaLabel:`紧急程度筛选`,options:Re,value:z,onChange:e=>Qe(e)}),(0,L.jsx)(`button`,{type:`button`,disabled:M||Tt.length===0,onClick:()=>G(d.filter(e=>V[e.id])),className:`h-9 shrink-0 rounded-lg border border-red-200 px-3 text-sm font-medium whitespace-nowrap text-red-600 hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,L.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>at({item:null}),className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建待办`})]})]}),A?(0,L.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1`,children:A}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>j(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,L.jsx)(`div`,{ref:ct,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,onFocusCapture:()=>{st.current=!0},onBlurCapture:()=>{window.setTimeout(()=>{st.current=!!document.activeElement?.closest(`.tw-todo-table`)},0)},children:(0,L.jsxs)(`table`,{className:`tw-todo-table tw-sticky-table w-full table-fixed text-sm`,style:q.tableStyle,children:[(0,L.jsx)(`colgroup`,{children:Ee.map(e=>(0,L.jsx)(`col`,{style:q.widthOf(e.key)?{width:q.widthOf(e.key)}:void 0},e.key))}),(0,L.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{className:p,children:(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`全选可见待办`,checked:Q.length>0&&Q.every(e=>V[e.id]),onChange:e=>{let t=e.target.checked;Xe(e=>{let n={...e};for(let e of Q)t?n[e.id]=!0:delete n[e.id];return n})}})}),(0,L.jsx)(`th`,{className:oe,style:{"--tw-sticky-left":`32px`},"aria-label":`行号`}),(0,L.jsxs)(`th`,{className:ae,style:{"--tw-sticky-left":`68px`},children:[`待办名称`,(0,L.jsx)(v,{...q.resizeProps(`title`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`待办状态`,(0,L.jsx)(v,{...q.resizeProps(`status`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`所属任务`,(0,L.jsx)(v,{...q.resizeProps(`task`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`紧急程度`,(0,L.jsx)(v,{...q.resizeProps(`priority`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`开始日期`,(0,L.jsx)(v,{...q.resizeProps(`start`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`截止日期`,(0,L.jsx)(v,{...q.resizeProps(`due`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`结束日期`,(0,L.jsx)(v,{...q.resizeProps(`end`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`周期`,(0,L.jsx)(v,{...q.resizeProps(`cycle`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`剩余`,(0,L.jsx)(v,{...q.resizeProps(`remain`)})]}),(0,L.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`备注`,(0,L.jsx)(v,{...q.resizeProps(`note`)})]}),(0,L.jsx)(`th`,{"aria-hidden":`true`}),(0,L.jsx)(`th`,{className:m,children:`操作`})]})}),wt.map(e=>{let t=Je[e.key]===!0;return(0,L.jsxs)(`tbody`,{children:[(0,L.jsx)(`tr`,{className:`bg-white`,children:(0,L.jsx)(`td`,{colSpan:14,className:`px-2 py-0 pt-3 pb-1.5`,children:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>Ye(n=>({...n,[e.key]:!t})),className:`flex items-center gap-2 rounded-md px-1 py-0.5 text-left hover:bg-stone-50`,"aria-expanded":!t,children:[(0,L.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`text-stone-400 transition-transform ${t?`-rotate-90`:``}`,children:(0,L.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),(0,L.jsx)(`span`,{className:`rounded-md px-2 py-0.5 text-xs font-medium ${e.pill}`,children:e.label}),(0,L.jsxs)(`span`,{className:`text-xs text-stone-400 tabular-nums`,children:[e.items.length,` 条记录`]})]})})}),t?null:e.items.map((e,t)=>{let n=et[e.id]??{},r={...e,...n},i=le(r,Z),a=ye(r),o=pe(r,Z),s=o===null?`—`:r.status===`done`?`已完成`:r.status===`cancelled`?`已取消`:o<0?`逾期 ${Math.abs(o)} 天`:o===0?`今天截止`:`${o} 天`;return(0,L.jsxs)(`tr`,{className:`group/row hover:bg-[#f7f8fa]`,children:[(0,L.jsx)(`td`,{className:g,children:(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`选择 ${e.title}`,checked:!!V[e.id],onChange:t=>Xe(n=>{let r={...n};return t.target.checked?r[e.id]=!0:delete r[e.id],r})})}),(0,L.jsx)(`td`,{className:`${_} text-xs text-stone-400 tabular-nums`,style:{"--tw-sticky-left":`32px`},children:t+1}),(0,L.jsx)(`td`,{className:g,style:{"--tw-sticky-left":`68px`},children:(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[e.source===`ai`?(0,L.jsx)(`span`,{className:`shrink-0 rounded bg-[#e1eaff] px-1 py-px text-[10px] text-[#1f4ec2]`,title:`AI 记录`,children:`AI`}):null,(0,L.jsx)(Ue,{value:r.title,placeholder:`输入待办名称`,onChange:t=>pt(e.id,`title`,t),onCommit:()=>void vt(e.id),onCancel:()=>Y(e.id)})]})}),(0,L.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,L.jsx)(b,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`待办状态`,menuMinWidth:120,options:Fe,value:e.status,onChange:t=>void X(e.id,{status:t}),triggerClassName:`h-7 w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${ke[i]}`,renderTrigger:()=>(0,L.jsx)(`span`,{className:`w-full truncate text-center`,children:w[i]}),renderOptionPrefix:e=>(0,L.jsx)(`span`,{className:`h-2 w-2 rounded-full ${Ae[e.value]}`})})}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:k?(0,L.jsx)(b,{unstyled:!0,searchable:!0,searchPlaceholder:`搜索任务…`,ariaLabel:`所属任务`,menuMinWidth:220,options:mt,value:r.taskId,onChange:t=>{let n=D.find(e=>e.id===t);X(e.id,{taskId:t,linkedTask:n?.title??``,...n?{priority:n.priority}:{}})},triggerClassName:`h-8 w-full rounded-md px-1.5 text-sm hover:border-stone-200`,renderTrigger:()=>(0,L.jsx)(ce,{text:ht(r)||`未关联`,className:`min-w-0 flex-1 truncate ${ht(r)?`text-stone-800`:`text-stone-300`}`})}):(0,L.jsx)(`span`,{className:`block truncate px-1.5 text-xs text-stone-400`,children:ht(r)?`${ht(r)} · 插件未启用`:`任务管理插件未启用`})}),(0,L.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:gt(r)?(0,L.jsx)(`span`,{title:`跟随所属任务的紧急程度`,className:`flex h-7 w-full items-center justify-center truncate rounded-md px-2 text-center text-xs font-medium ${R[_t(r)]??`text-stone-300`}`,children:_t(r)?E[_t(r)]:`未设置`}):(0,L.jsx)(b,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`紧急程度`,menuMinWidth:128,options:Ie,value:e.priority,onChange:t=>void X(e.id,{priority:t}),triggerClassName:`h-7 w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${R[e.priority]}`,renderTrigger:()=>(0,L.jsx)(`span`,{className:`w-full truncate text-center`,children:e.priority?E[e.priority]:`未设置`}),renderOptionPrefix:e=>(0,L.jsx)(`span`,{className:`h-2 w-2 rounded-full ${je[e.value]}`})})}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,L.jsx)(Ge,{value:r.startDate,onChange:t=>void X(e.id,{startDate:t})})}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,L.jsx)(Ge,{value:r.dueDate,onChange:t=>void X(e.id,{dueDate:t})})}),(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap tabular-nums`,children:fe(r)?(0,L.jsx)(`span`,{className:`text-stone-500`,children:se(fe(r))}):(0,L.jsx)(`span`,{className:`text-stone-400`,children:`待办未完成`})}),(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap text-stone-500 tabular-nums`,children:a===null?`—`:`${a} 天`}),(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap tabular-nums ${o!==null&&o<0&&i!==`done`&&i!==`cancelled`?`font-medium text-[#c02a26]`:`text-stone-500`}`,children:s}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,L.jsx)(We,{value:r.note,onChange:t=>pt(e.id,`note`,t),onCommit:()=>void vt(e.id),onCancel:()=>Y(e.id)})}),(0,L.jsx)(`td`,{"aria-hidden":`true`}),(0,L.jsx)(`td`,{className:re,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>at({item:e}),"aria-label":`展开 ${e.title}`,className:`rounded p-1 text-stone-300 transition-colors hover:bg-stone-100 hover:text-stone-600 focus:text-stone-600`,children:(0,L.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M14 4h6v6`}),(0,L.jsx)(`path`,{d:`M20 4 13 11`}),(0,L.jsx)(`path`,{d:`M10 20H4v-6`}),(0,L.jsx)(`path`,{d:`M4 20l7-7`})]})}),(0,L.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>G([e]),"aria-label":`删除 ${e.title}`,className:`tw-icon-danger rounded p-1`,children:(0,L.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M3 6h18`}),(0,L.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,L.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,L.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})})]})})]},e.id)}),t?null:H?.groupKey===e.key?(0,L.jsxs)(`tr`,{className:`tw-new-row`,children:[(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle`}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle text-xs text-stone-400 tabular-nums`,children:e.items.length+1}),(0,L.jsx)(`td`,{className:_,children:(0,L.jsx)(`input`,{autoFocus:!0,value:H.title,disabled:nt,placeholder:`输入待办名称,回车或点空白处保存`,onChange:e=>U(t=>t&&{...t,title:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),bt()):e.key===`Escape`&&(e.preventDefault(),U(null))},className:`h-8 w-full truncate rounded-md border border-[#3370ff]/40 bg-white px-2 text-sm text-stone-800 outline-none focus:border-[#3370ff]`})}),(0,L.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,L.jsx)(b,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`待办状态`,menuMinWidth:120,options:Fe,value:H.status,onChange:e=>U(t=>t&&{...t,status:e}),triggerClassName:`h-7 w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${ke[H.status]}`,renderTrigger:()=>(0,L.jsx)(`span`,{className:`w-full truncate text-center`,children:w[H.status]})})}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:k?(0,L.jsx)(b,{unstyled:!0,searchable:!0,searchPlaceholder:`搜索任务…`,ariaLabel:`所属任务`,menuMinWidth:220,options:mt,value:H.taskId,onChange:e=>U(t=>{if(!t)return t;let n=D.find(t=>t.id===e);return{...t,taskId:e,...n?{priority:n.priority}:{}}}),triggerClassName:`h-8 w-full rounded-md px-1.5 text-sm hover:border-stone-200`,renderTrigger:()=>{let e=D.find(e=>e.id===H.taskId);return(0,L.jsx)(ce,{text:e?.title||`未关联`,className:`min-w-0 flex-1 truncate ${e?`text-stone-800`:`text-stone-300`}`})}}):(0,L.jsx)(`span`,{className:`block truncate px-1.5 text-xs text-stone-400`,children:`任务管理插件未启用`})}),(0,L.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(()=>{let e=D.find(e=>e.id===H.taskId);return e?(0,L.jsx)(`span`,{title:`跟随所属任务的紧急程度`,className:`flex h-7 w-full items-center justify-center truncate rounded-md px-2 text-center text-xs font-medium ${R[e.priority]??`text-stone-300`}`,children:e.priority?E[e.priority]:`未设置`}):(0,L.jsx)(b,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`紧急程度`,menuMinWidth:128,options:Ie,value:H.priority,onChange:e=>U(t=>t&&{...t,priority:e}),triggerClassName:`h-7 w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${R[H.priority]}`,renderTrigger:()=>(0,L.jsx)(`span`,{className:`w-full truncate text-center`,children:H.priority?E[H.priority]:`未设置`})})})()}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,L.jsx)(y,{value:H.startDate,onChange:e=>U(t=>t&&{...t,startDate:e}),placeholder:`选择日期`,className:`h-8 rounded-md border border-transparent px-1.5 text-sm text-stone-800 tabular-nums transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,L.jsx)(y,{value:H.dueDate,onChange:e=>U(t=>t&&{...t,dueDate:e}),placeholder:`选择日期`,className:`h-8 rounded-md border border-transparent px-1.5 text-sm text-stone-800 tabular-nums transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}),(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap tabular-nums`,children:de(H.status)?(0,L.jsx)(`span`,{className:`text-stone-500`,children:se(S())}):(0,L.jsx)(`span`,{className:`text-stone-400`,children:`待办未完成`})}),(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap text-stone-400 tabular-nums`,children:`—`}),(0,L.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap text-stone-400 tabular-nums`,children:`—`}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,L.jsx)(`input`,{value:H.note,disabled:nt,placeholder:`—`,onChange:e=>U(t=>t&&{...t,note:e.target.value}),className:`h-8 w-full truncate rounded-md border border-transparent bg-transparent px-1.5 text-sm text-stone-800 outline-none transition-colors placeholder:text-stone-300 hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}),(0,L.jsx)(`td`,{"aria-hidden":`true`}),(0,L.jsx)(`td`,{className:`px-1 py-1 align-middle`})]}):(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`px-2 py-0.5`}),(0,L.jsx)(`td`,{className:`px-1 py-0.5`}),(0,L.jsx)(`td`,{className:`px-1 py-0.5`,colSpan:12,children:(0,L.jsxs)(`button`,{type:`button`,disabled:nt,onClick:()=>yt(e),className:`flex items-center gap-1 rounded px-1 py-0.5 text-xs text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-40`,children:[(0,L.jsx)(`span`,{className:`text-sm leading-none`,children:`+`}),`新增记录`]})})]})]},e.key)}),wt.length===0?(0,L.jsx)(`tbody`,{children:(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{colSpan:14,className:`px-3 py-16 text-center text-sm text-stone-400`,children:d.length===0?`还没有待办`:`没有匹配的待办,试试调整搜索或筛选`})})}):null]})}),(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,L.jsxs)(`span`,{children:[`共 `,Q.length,` 条`,Tt.length?` · 已选 ${Tt.length}`:``]}),(0,L.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`点击单元格直接编辑,回车或点空白处保存`})]}),(0,L.jsx)(Ke,{open:it!==null,item:it?.item??null,preset:it?.preset,tasks:D,tasksOn:k,onClose:()=>at(null),onSaved:J}),(0,L.jsx)(f,{open:W!=null,title:W&&W.length>1?`批量删除`:`删除待办`,message:W&&W.length>1?`确认删除已选中的 ${W.length} 条待办?此操作不可恢复。`:`删除「${W?.[0]?.title??``}」?此操作不可恢复。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>G(null),onConfirm:()=>void xt()})]}):(0,L.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`待办事项需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,L.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`todos`)}):(0,L.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,L.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{B as default};
@@ -1 +0,0 @@
1
- var e=`0.1.20`;export{e as t};
@@ -1,3 +0,0 @@
1
- import{t as e}from"./export.joBT53eb.js";var t={no:`用例编号`,title:`用例标题`,precondition:`前置条件`,steps:`测试步骤`,expected:`预期结果`,priority:`优先级`,type:`用例类型`,module:`所属模块`,requirement:`需求编号`},n={no:[`用例编号`,`测试用例编号`,`案例编号`,`用例号`,`用例id`,`编号`,`no`,`caseid`,`tc编号`],title:[`用例标题`,`用例名称`,`测试用例标题`,`测试分项目`,`测试项目`,`测试点`,`检查点`,`测试内容`,`用例描述`,`用例说明`,`标题`,`名称`,`摘要`,`title`,`casename`],precondition:[`前置条件`,`预置条件`,`前提条件`,`准备条件`,`初始条件`,`前置`,`precondition`],steps:[`测试步骤`,`操作步骤`,`执行步骤`,`用例步骤`,`测试过程`,`操作过程`,`步骤`,`steps`,`step`],expected:[`预期结果`,`期望结果`,`预期内容`,`期望内容标准`,`预期效果`,`期望结果标准`,`验收标准`,`检查结果`,`预期`,`expected`],priority:[`优先级`,`优先级别`,`重要级别`,`重要程度`,`级别`,`priority`],type:[`用例类型`,`测试类型`,`用例种类`,`类型`,`类别`,`type`],module:[`所属模块`,`测试模块`,`功能模块`,`所属功能`,`所属子系统`,`模块`,`测试项目`,`module`],requirement:[`需求编号`,`关联需求`,`需求id`,`需求`,`requirement`]};function r(e){return String(e??``).replace(/[((][^))]*[))]/g,``).replace(/[\s**・·::]/g,``).toLowerCase().trim()}function i(e){let t=e.map(e=>({raw:String(e??``),norm:r(e)})).filter(e=>e.norm&&e.raw),i={},a=new Set,o=Object.keys(n);for(let e of o)for(let o of n[e].map(r)){let n=t.find(e=>!a.has(e.raw)&&e.norm===o);if(n){i[e]=n.raw,a.add(n.raw);break}}for(let e of o)if(!i[e])for(let o of n[e].map(r)){if(o.length<3)continue;let n=t.find(e=>!a.has(e.raw)&&Math.abs(e.norm.length-o.length)<=2&&(e.norm.startsWith(o)||o.startsWith(e.norm)));if(n){i[e]=n.raw,a.add(n.raw);break}}return i}function a(e){let t=[];for(let n of e)for(let e of Object.keys(n))t.includes(e)||t.push(e);return t}function o(e){if(!e.length)return[...e];let n=i(a(e));return e.map(e=>{let r={...e};for(let e of Object.keys(t)){let i=n[e];i&&(String(r[t[e]]??``).trim()||(r[t[e]]=r[i]??``))}return r})}function s(e){let n=[];for(let r of Object.keys(t)){let i=e[r];if(!i)continue;let a=t[r];n.push(i===a?a:`${a}(表头:${i})`)}return n.join(` / `)}var c=`/__tb_casereview`,l=`/__tb_caseblindspot`,u=`用例质量评审提示词.md`,d=`场景遗漏补全提示词.md`,f=[`coverage`,`steps`,`expected`,`data`,`convention`],p={coverage:{label:`需求覆盖`,weight:25,hint:`对应需求点是否明确、主流程与关键分支是否走到`,tone:`blue`},steps:{label:`步骤可执行`,weight:25,hint:`一步一个动作、有编号、照着能点`,tone:`purple`},expected:{label:`预期可判定`,weight:20,hint:`状态 / 文案 / 数值写清楚,第三方能判对错`,tone:`green`},data:{label:`数据与边界`,weight:15,hint:`前置数据与角色齐备,覆盖空值 / 上下限 / 重复`,tone:`amber`},convention:{label:`规范完整`,weight:15,hint:`编号、标题、优先级、类型与模板一致`,tone:`gray`}},m=[`usable`,`revise`,`invalid`],h={usable:{label:`可用`,tone:`green`,hint:`照着能执行,预期能判定`,badge:`bg-emerald-50 text-emerald-700 border-emerald-200`},revise:{label:`待修改`,tone:`amber`,hint:`能看懂但执行会卡住或结论扯皮`,badge:`bg-amber-50 text-amber-800 border-amber-200`},invalid:{label:`错误无效`,tone:`red`,hint:`存在硬伤,不能用`,badge:`bg-red-50 text-red-700 border-red-200`}},g=[`nonfunctional`,`security`,`compatibility`,`business`],_={nonfunctional:{label:`非功能`,hint:`响应时间、并发、大数量、断网与重试`,tone:`purple`,mark:`非功能`},security:{label:`安全边界与容错`,hint:`越权、注入、重复提交、竞态与篡改`,tone:`amber`,mark:`安全`},compatibility:{label:`兼容性`,hint:`分辨率、浏览器 / 端、深浅色、时区与格式`,tone:`blue`,mark:`兼容`},business:{label:`隐藏业务规则`,hint:`金额精度、状态互斥、唯一性、跨模块联动`,tone:`green`,mark:`业务`}},v={high:{label:`高`,tone:`red`},medium:{label:`中`,tone:`amber`},low:{label:`低`,tone:`gray`}},y={usable:85,revise:60},b=/^(正常|正确|成功|符合预期|无异常|没问题|ok|okay|通过|显示正常)的?$/i,x=/(提示|跳转|弹窗|状态|变为|变成|显示|返回|报错|错误码|http\s*\d|\d+%|金额|数量|\d+\s*(ms|s|秒|条|元|位|个|行|次))|「[^」]+」|"[^"]+"/i,S=/^(验证|测试|检查)[^,。]{0,4}(功能|流程|是否正确)?$/;function C(e){let t=String(e??``).replace(/<br\s*\/?>/gi,`
2
- `).split(/\r?\n/).map(e=>e.trim()),n=[];for(let e of t){if(!e)continue;let t=e.split(/(?=(?:^|[;;])\s*\d+\s*[、..))])/).map(e=>e.replace(/^[;;\s]+/,``).trim()).filter(Boolean);n.push(...t.length?t:[e])}return n.filter(e=>e.length>0)}function w(e){let t=String(e??``).trim();return!t||b.test(t)?!1:x.test(t)&&t.length>=6}function T(e){let t=`${e.用例类型??``} ${e.用例标题??``} ${e.测试步骤??``}`;return/(边界|异常|失败|为空|超时|越界|并发|重复|非法|错误)/.test(t)}function E(e){let t=e=>String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``);return`${t(e.用例标题??``)}|${t(e.测试步骤??``)}`}function D(e,t=80){let n=String(e??``).replace(/```[\s\S]*?```/g,` `).replace(/[#>*_`]/g,` `).split(/[\n。;;!!??,,、|]+/),r=[];for(let e of n){let n=e.replace(/^[\s\-*\d.、))]+/,``).trim();if(!(n.length<3||n.length>24)&&!r.includes(n)&&(r.push(n),r.length>=t))break}return r}function O(t,n=``){let r=o(t),i=r.length,a=D(n),s=r.map(e=>{let t=String(e.用例编号??``).trim(),n=String(e.用例标题??``).trim(),r=C(e.测试步骤??``),i=String(e.预期结果??``).trim(),o=String(e.前置条件??``).trim(),s=String(e.优先级??``).trim().toUpperCase(),c=String(e.用例类型??``).trim(),l=String(e.所属模块??``).trim(),u=`${n} ${r.join(` `)} ${i}`,d=[];n||d.push(`用例标题为空`),r.length||d.push(`测试步骤为空`),i||d.push(`预期结果为空`),/^(同上|同前|同上一条|略)$/.test(i)&&d.push(`预期结果只有占位文字`);let f={coverage:(()=>{let e=l?60:25;if(a.length){let t=a.some(e=>u.includes(e));e+=t?40:0}else e+=30;return k(e)})(),steps:(()=>{if(!r.length)return 0;let e=r.length>=3?100:r.length===2?80:50;return r.some(e=>S.test(e))&&(e-=25),r.length===1&&r[0].length>80&&(e-=15),k(e)})(),expected:i?b.test(i)?45:w(i)?i.length>=12?100:90:65:0,data:(()=>{let t=o?60:20;return T(e)?t+=40:t+=15,k(t)})(),convention:(()=>{let e=100;return t||(e-=25),(n.length<6||n.length>60)&&(e-=20),[`P0`,`P1`,`P2`,`P3`].includes(s)||(e-=20),c||(e-=20),k(e)})()},p=[];n||p.push({dimension:`convention`,points:15,reason:`用例标题为空,无法从列表里认出这条用例测什么`,suggestion:`补一句「动词 + 对象 + 条件」的标题,例如「未登录用户提交订单时提示先登录」`}),r.length||p.push({dimension:`steps`,points:25,reason:`测试步骤为空,无法执行`,suggestion:`按「一步一个动作」补步骤,从进入路径写到触发动作`}),i?w(i)||p.push({dimension:`expected`,points:8,reason:`预期结果不够可判定:「${i.slice(0,30)}」`,suggestion:`写成具体状态或文案,例如「提示『手机号格式不正确』,输入框标红且不提交」`}):p.push({dimension:`expected`,points:20,reason:`预期结果为空,无法判定是否通过`,suggestion:`补可判定的结果:页面 / 状态 / 文案 / 数值`}),o||p.push({dimension:`data`,points:6,reason:`没有前置条件,执行者不知道该用什么账号 / 数据 / 状态`,suggestion:`补上需要的角色、数据量与初始状态(如「已登录普通用户,购物车有 1 件商品」)`}),T(e)||p.push({dimension:`data`,points:5,reason:`这条用例没有体现边界或异常路径`,suggestion:`确认是否需要补一条空值 / 上下限 / 失败路径的用例`}),t||p.push({dimension:`convention`,points:5,reason:`缺少用例编号,无法在报告或缺陷里互相引用`,suggestion:`按项目规则补编号(如 TC-模块-001)`});let m=A(f);return{no:t,title:n,verdict:d.length?`invalid`:m>=y.usable?`usable`:m>=y.revise?`revise`:`invalid`,score:m,dimensions:f,deductions:p,hard:d.join(`;`)}}),c={usable:0,revise:0,invalid:0};for(let e of s)c[e.verdict]+=1;let l=new Map;for(let e of r){let t=E(e);t!==`|`&&l.set(t,(l.get(t)??0)+1)}let u=[...l.values()].reduce((e,t)=>e+(t>1?t:0),0),d=j(s),f=A(d),p=e.filter(e=>r.some(t=>e in t)),m=M(r,p);return{metrics:[{key:`total`,label:`用例总数`,value:i,text:`${i}`,hint:`本文件里的用例条数`},{key:`fieldComplete`,label:`字段完整率`,value:i?m/i:0,text:N(i?m/i:0),hint:`文件里的 ${p.length} 个字段是否都有内容`},{key:`stepExecutable`,label:`步骤可执行率`,value:i?r.filter(e=>C(e.测试步骤??``).length>=2).length/i:0,text:N(i?r.filter(e=>C(e.测试步骤??``).length>=2).length/i:0),hint:`有编号且至少两步`},{key:`expectedTestable`,label:`预期可判定率`,value:i?r.filter(e=>w(e.预期结果??``)).length/i:0,text:N(i?r.filter(e=>w(e.预期结果??``)).length/i:0),hint:`排除「正常 / 符合预期」这类模糊表述`},{key:`coverage`,label:`需求覆盖率`,value:a.length?Math.min(1,d.coverage/100):-1,text:a.length?N(Math.min(1,d.coverage/100)):`—`,hint:a.length?`与对照需求的关键点做匹配`:`未挂对照需求,不计算`},{key:`duplicate`,label:`重复用例率`,value:i?u/i:0,text:N(i?u/i:0),hint:`标题 + 步骤完全相同`},{key:`priority`,label:`优先级合规率`,value:i?r.filter(e=>[`P0`,`P1`,`P2`,`P3`].includes(String(e.优先级??``).toUpperCase())).length/i:0,text:N(i?r.filter(e=>[`P0`,`P1`,`P2`,`P3`].includes(String(e.优先级??``).toUpperCase())).length/i:0),hint:`优先级为 P0–P3 之一`},{key:`hard`,label:`硬伤用例`,value:s.filter(e=>e.hard).length,text:`${s.filter(e=>e.hard).length}`,hint:`标题 / 步骤 / 预期为空或冲突,直接判无效`}],cases:s,dimensions:d,score:f,counts:c}}function k(e){return Math.min(100,Math.max(0,Math.round(e)))}function A(e){let t=0;for(let n of f)t+=e[n]*(p[n].weight/100);return k(t)}function j(e){let t={};for(let n of f)t[n]=e.length?k(e.reduce((e,t)=>e+(t.dimensions[n]??0),0)/e.length):0;return t}function M(t,n){let r=n.length?n:e;return t.filter(e=>r.every(t=>String(e[t]??``).trim())).length}function N(e){return Number.isFinite(e)?`${Math.round(Math.max(0,Math.min(1,e))*100)}%`:`—`}function P(e,t=12){let n=[],r=new Set;for(let i of e.deductions??[]){let e=String(i?.suggestion||i?.reason||``).trim();if(!e)continue;let a=e.replace(/\s+/g,` `).toLowerCase();if(!r.has(a)&&(r.add(a),n.push(e.length>240?`${e.slice(0,238)}…`:e),n.length>=t))break}return n}function F(e){return f.map(t=>({key:t,label:p[t].label,score:k(e[t]??0),weight:p[t].weight}))}function I(e,t,n){let r=new Map;for(let e of t){let t=String(e.no??``).trim()||String(e.title??``).trim();t&&r.set(t,e)}let i=0,a=e.cases.map(e=>{let t=r.get(e.no)??r.get(e.title);if(!t)return e;i+=1;let n={...e.dimensions};for(let e of f){let r=t.dimensions?.[e];typeof r==`number`&&Number.isFinite(r)&&(n[e]=k(r))}let a=Array.isArray(t.deductions)?t.deductions.filter(e=>e&&e.reason).map(e=>({dimension:f.includes(e.dimension)?e.dimension:`expected`,points:k(Number(e.points)||0),reason:String(e.reason??``).slice(0,1e3),suggestion:String(e.suggestion??``).slice(0,1e3)})):[],o=A(n),s=e.hard||String(t.hard??``).trim()||void 0,c=s?`invalid`:o>=y.usable?`usable`:o>=y.revise?`revise`:`invalid`,l={...e,verdict:c,score:o,dimensions:n,deductions:a.length?a:e.deductions};return s&&(l.hard=s),l}),o={usable:0,revise:0,invalid:0};for(let e of a)o[e.verdict]+=1;let s=j(a);return{at:new Date().toISOString(),score:A(s),counts:o,dimensions:F(s),metrics:e.metrics,cases:a,summary:n.trim(),modeled:!0,modelCovered:i}}function L(e,n){let r=new Map;if(n?.length)for(let e of o(n)){let n=String(e[t.no]??``).trim(),i=String(e[t.title]??``).trim();n&&i&&r.set(n,i)}let i=!1,a=e.cases.map(e=>{let t=e.title||r.get(String(e.no??``).trim())||``,n=e.hard?`invalid`:e.score>=y.usable?`usable`:e.score>=y.revise?`revise`:`invalid`;return t===e.title&&n===e.verdict?e:(i=!0,{...e,title:t,verdict:n})});if(!i)return e;let s={usable:0,revise:0,invalid:0};for(let e of a)s[e.verdict]+=1;return{...e,cases:a,counts:s}}function R(e,t=``){return{at:new Date().toISOString(),score:e.score,counts:e.counts,dimensions:F(e.dimensions),metrics:e.metrics,cases:e.cases,summary:t||`规则判定:可用 ${e.counts.usable} · 待修改 ${e.counts.revise} · 错误无效 ${e.counts.invalid}。未接入模型,语义类问题(与需求冲突、预期与步骤无关)未计入。`,modeled:!1}}function z(e){return g.map(t=>({key:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)}function B(e,t,n){let r=[];if(r.push(`# 用例质量评审报告 · ${e}`),r.push(``),t){r.push(`- 评审时间:${t.at}`),r.push(`- 总分:${t.score}`),r.push(`- 三档:可用 ${t.counts.usable} · 待修改 ${t.counts.revise} · 错误无效 ${t.counts.invalid}`),r.push(`- 来源:${t.modeled?`规则 + 模型`:`仅规则`}`),r.push(``),r.push(`## 五维得分`),r.push(``);for(let e of t.dimensions)r.push(`- ${e.label}(权重 ${e.weight}):${e.score}`);r.push(``),r.push(`## 量化指标`),r.push(``);for(let e of t.metrics)r.push(`- ${e.label}:${e.text}`);t.summary&&(r.push(``),r.push(`## 结论`),r.push(``),r.push(t.summary)),r.push(``),r.push(`## 逐条明细`),r.push(``);for(let e of t.cases){r.push(`### ${e.no||`(无编号)`} ${e.title||`(无标题)`} · ${h[e.verdict].label} ${e.score}`),e.hard&&r.push(`- 硬伤:${e.hard}`);for(let t of e.deductions)r.push(`- [${p[t.dimension]?.label??t.dimension} −${t.points}] ${t.reason}`),t.suggestion&&r.push(` - 建议:${t.suggestion}`);r.push(``)}}else r.push(`- 还没有质量评审结果。`),r.push(``);if(n?.items.length){r.push(`## 场景补全`),r.push(``),r.push(`- 探测时间:${n.at}`),n.context.reqTitle&&r.push(`- 对照需求:${n.context.reqTitle}`),r.push(``);for(let e of z(n.items)){let t=_[e.key];r.push(`### ${t.label}(${e.items.length})`),r.push(``);for(let t of e.items)r.push(`- **[${v[t.severity].label}] ${t.title}**${t.added?`(已补全 ${t.caseNo})`:``}`),t.why&&r.push(` - 为什么容易漏:${t.why}`),t.precondition&&r.push(` - 前置条件:${t.precondition}`),t.steps.length&&r.push(` - 步骤:${t.steps.join(` → `)}`),t.expected&&r.push(` - 预期:${t.expected}`);r.push(``)}}return`${r.join(`
3
- `).trimEnd()}\n`}function V(e,t,n){let r=`${e.replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-用例评审-${new Date().toISOString().slice(0,10)}.md`,i=new Blob([B(e,t,n)],{type:`text/markdown;charset=utf-8`}),a=URL.createObjectURL(i),o=document.createElement(`a`);return o.href=a,o.download=r,o.click(),URL.revokeObjectURL(a),r}async function H(e,t,n){let r=await fetch(`${e}${t}`,{...n,headers:n?.body===void 0?void 0:{"Content-Type":`application/json`,...n?.headers}}),i=await r.json().catch(()=>({}));if(!r.ok||i.ok===!1)throw Error(i.error||`HTTP ${r.status}`);return i}async function U(e){try{return(await fetch(`${e}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}function W(){return U(c)}function G(){return U(l)}async function K(){try{let e=await H(c,`/prompt`);return{file:e.file||`用例质量评审提示词.md`,exists:e.exists===!0,review:e.review??``}}catch(e){return{file:u,exists:!1,review:``,error:e instanceof Error?e.message:String(e)}}}async function q(){try{let e=await H(l,`/prompt`);return{file:e.file||`场景遗漏补全提示词.md`,exists:e.exists===!0,detect:e.detect??``,complete:e.complete??``}}catch(e){return{file:d,exists:!1,detect:``,complete:``,error:e instanceof Error?e.message:String(e)}}}function J(e){return H(c,`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}function Y(e){return H(l,`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function X(){return(await H(`/__tb_casereview`,`/summaries`)).files??[]}async function Z(e){let t=await H(c,`/report?path=${encodeURIComponent(e)}`);return{entry:t.entry??null,stale:t.stale===!0}}async function Q(e,t){return(await H(c,`/report`,{method:`PUT`,body:JSON.stringify({path:e,...t})})).entry}export{s as A,R as C,t as D,J as E,o as O,L as S,Y as T,W as _,p as a,z as b,h as c,O as d,P as f,Z as g,q as h,u as i,i as k,m as l,G as m,g as n,f as o,V as p,d as r,v as s,_ as t,y as u,K as v,Q as w,I as x,X as y};
@@ -1 +0,0 @@
1
- import{i as e}from"./app-config.CF1xVPmo.js";import{i as t}from"./plugins.DYyAjBXb.js";var n=`/`,r=n.endsWith(`/`)?n:`${n}/`;(async()=>{try{await e()}catch{}let n=t(`uiAuto`)?`test-automation/`:`workbench/`;window.location.replace(`${r}${n}`)})();
@@ -1,4 +0,0 @@
1
- var e=`/__tb_pm`,t=[`planning`,`in_progress`,`archived`],n=[`planning`,`in_progress`,`done`],r=[`urgent`,`high`,`medium`,`low`],i=[`pending`,`todo`,`in_progress`,`testing`,`done`,`cancelled`],a=[`critical`,`major`,`minor`,`trivial`],o=[`pending`,`todo`,`fixed`,`verifying`,`passed`,`cancelled`],s={planning:`规划中`,in_progress:`进行中`,archived:`已归档`},c={planning:`规划中`,in_progress:`进行中`,done:`已完成`},l={urgent:`紧急`,high:`高`,medium:`中`,low:`低`},u={pending:`待评估`,todo:`待开发`,in_progress:`开发中`,testing:`测试中`,done:`已完成`,cancelled:`已取消`},d={critical:`致命`,major:`严重`,minor:`一般`,trivial:`轻微`},f={pending:`待确认`,todo:`待修复`,fixed:`修复完成`,verifying:`待验证`,passed:`验证通过`,cancelled:`已取消`},p={in_progress:`fixed`,closed:`passed`};function m(e){if(typeof e!=`string`)return``;let t=e.trim();return o.includes(t)?t:p[t]??``}function h(e){return e===`passed`||e===`cancelled`}var g=/^\d{4}-\d{2}-\d{2}$/;function _(e,t=2e3){return typeof e==`string`?e.trim().slice(0,t):``}function v(e){let t=_(e,10);return g.test(t)?t:``}function y(e,t,n){let r=_(e,40);return t.includes(r)?r:n}function b(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,50)){if(!n||typeof n!=`object`)continue;let e=_(n.text,500);e&&t.push({text:e,done:n.done===!0})}return t}function x(e){if(!e||typeof e!=`object`)return null;let n=e,r=_(n.name,200);if(!r)return null;let i=new Date().toISOString();return{id:_(n.id,64)||`pj_${Math.random().toString(16).slice(2,10)}`,name:r,description:_(n.description),status:y(n.status,t,`planning`),createdAt:_(n.createdAt,40)||i,updatedAt:_(n.updatedAt,40)||i}}function S(e){if(!e||typeof e!=`object`)return null;let t=e,r=_(t.name,200);if(!r)return null;let i=new Date().toISOString();return{id:_(t.id,64)||`it_${Math.random().toString(16).slice(2,10)}`,projectId:_(t.projectId,64),name:r,startDate:v(t.startDate),endDate:v(t.endDate),status:y(t.status,n,`planning`),remark:_(t.remark),createdAt:_(t.createdAt,40)||i,updatedAt:_(t.updatedAt,40)||i}}function C(e){if(!e||typeof e!=`object`)return null;let t=e,n=_(t.title,2e3);if(!n)return null;let a=new Date().toISOString();return{id:_(t.id,64)||`rq_${Math.random().toString(16).slice(2,10)}`,autoId:_(t.autoId,20),projectId:_(t.projectId,64),iterationId:_(t.iterationId,64),title:n,priority:y(t.priority,r,`medium`),status:y(t.status,i,`pending`),description:_(t.description),acceptanceCriteria:b(t.acceptanceCriteria),githubIssue:_(t.githubIssue,50),attachment:_(t.attachment),createdAt:_(t.createdAt,40)||a,updatedAt:_(t.updatedAt,40)||a}}function w(e){if(!e||typeof e!=`object`)return null;let t=e,n=_(t.title,200);if(!n)return null;let r=new Date().toISOString();return{id:_(t.id,64)||`bg_${Math.random().toString(16).slice(2,10)}`,autoId:_(t.autoId,20),projectId:_(t.projectId,64),iterationId:_(t.iterationId,64),requirementId:_(t.requirementId,64),title:n,severity:y(t.severity,a,`minor`),status:m(t.status)||`pending`,reproduceSteps:_(t.reproduceSteps),expectedResult:_(t.expectedResult),actualResult:_(t.actualResult),environment:_(t.environment,500),githubIssue:_(t.githubIssue,50),attachment:_(t.attachment),remark:_(t.remark),createdAt:_(t.createdAt,40)||r,updatedAt:_(t.updatedAt,40)||r}}function T(e,t){return Array.isArray(e)?e.map(t).filter(e=>!!e):[]}function E(){return{projects:[],iterations:[],requirements:[],bugs:[]}}function D(e){if(!e||typeof e!=`object`)return E();let t=e;return{projects:T(t.projects,x),iterations:T(t.iterations,S),requirements:T(t.requirements,C),bugs:T(t.bugs,w)}}async function O(t,n){let r=await fetch(e,{method:t,headers:n===void 0?void 0:{"Content-Type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error||`HTTP ${r.status}`);return i}async function k(){try{return(await fetch(`${e}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function A(){return D(await O(`GET`))}async function j(){await A()}function M(e,t){return e===`projects`?x(t):e===`iterations`?S(t):e===`requirements`?C(t):w(t)}async function N(e,t,n){let r=await O(`POST`,{entity:e,items:t,...n});return(Array.isArray(r.items)?r.items:[]).map(t=>M(e,t)).filter(e=>!!e)}async function P(e,t,n){let r=M(e,(await O(`PUT`,{entity:e,id:t,...n})).item);if(!r)throw Error(`更新记录失败`);return r}async function F(e,t){let n=await O(`DELETE`,{entity:e,ids:t});return{removed:Number(n.removed??0),cascaded:Number(n.cascaded??0)}}function I(e){let[t,n,r]=e.split(`-`).map(Number);return Date.UTC(t,(n??1)-1,r??1)}function L(e,t){return!g.test(e)||!g.test(t)?null:Math.round((I(t)-I(e))/864e5)}function R(e=new Date){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function z(e,t=R()){let n=L(e.startDate,e.endDate);if(n===null)return 0;let r=n+1,i=L(e.startDate,t);return i===null?0:Math.min(100,Math.max(0,Math.round((i+1)/r*100)))}function B(e,t=R()){if(e.status===`done`)return null;let n=L(e.endDate,t);return n===null?null:n>0?n:null}function ee(e){let t={};for(let n of e.projects)t[n.id]={iterations:0,requirements:0,requirementsDone:0,bugs:0,bugsClosed:0,requirementPercent:0,bugClosedPercent:100};for(let n of e.iterations){let e=t[n.projectId];e&&(e.iterations+=1)}for(let n of e.requirements){let e=t[n.projectId];e&&(e.requirements+=1,n.status===`done`&&(e.requirementsDone+=1))}for(let n of e.bugs){let e=t[n.projectId];e&&(e.bugs+=1,h(n.status)&&(e.bugsClosed+=1))}for(let e of Object.values(t))e.requirementPercent=e.requirements?Math.round(e.requirementsDone/e.requirements*100):0,e.bugClosedPercent=e.bugs?Math.round(e.bugsClosed/e.bugs*100):100;return t}function V(e,t={}){let n=t.status??`all`,r=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.status!==n||r&&!`${e.name} ${e.description}`.toLowerCase().includes(r)))}function H(e,t={}){let n=t.projectId??`all`,r=t.status??`all`,i=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.projectId!==n||r!==`all`&&e.status!==r||i&&!`${e.name} ${e.remark}`.toLowerCase().includes(i)))}function U(e,t={}){let n=t.projectId??`all`,r=t.iterationId??`all`,i=t.status??`all`,a=t.priority??`all`,o=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.projectId!==n||r!==`all`&&e.iterationId!==r||i!==`all`&&e.status!==i||a!==`all`&&e.priority!==a||o&&!`${e.autoId} ${e.title} ${e.description}`.toLowerCase().includes(o)))}function W(e){return[...e].sort((e,t)=>{let n=e.startDate||``,r=t.startDate||``;if(n!==r)return r.localeCompare(n);let i=Date.parse(e.createdAt)||0,a=Date.parse(t.createdAt)||0;return i===a?e.name.localeCompare(t.name,`zh-Hans-CN`,{numeric:!0}):a-i})}function G(e){return[...e].sort((e,t)=>{let n=Date.parse(e.createdAt)||0,r=Date.parse(t.createdAt)||0;return n===r?t.autoId.localeCompare(e.autoId,`zh-Hans-CN`,{numeric:!0}):r-n})}function K(e,t={}){let n=t.projectId??`all`,r=t.iterationId??`all`,i=t.status??`all`,a=t.severity??`all`,o=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.projectId!==n||r!==`all`&&e.iterationId!==r||i!==`all`&&e.status!==i||a!==`all`&&e.severity!==a||o&&!`${e.autoId} ${e.title} ${e.reproduceSteps}`.toLowerCase().includes(o)))}function q(e,t){let n=t.trim();if(!n)return``;let r=e.find(e=>e.name===n);if(r)return r.id;let i=n.toLowerCase();return e.find(e=>e.name.toLowerCase()===i)?.id??``}function J(e,t){let n=t.trim();if(!n)return``;let r=n.toLowerCase();return e.find(e=>e.title===n)?.id??e.find(e=>e.title.toLowerCase()===r)?.id??e.find(e=>e.autoId.toLowerCase()===r)?.id??``}function Y(e){let t=e.split(`
2
- `).map(e=>e.trim()).find(Boolean);return t?Array.from(t).slice(0,60).join(``):``}function X(e){return e.split(`
3
- `).map(e=>e.trim()).filter(Boolean).map(e=>({url:e,name:$(e)}))}function Z(e){return e.map(e=>e.url).join(`
4
- `)}function Q(e){try{let t=new URL(e,`http://localhost`).searchParams.get(`p`)??``;return/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(decodeURIComponent(t))}catch{return!1}}function $(e){try{let t=new URL(e,`http://localhost`),n=t.searchParams.get(`p`),r=n?decodeURIComponent(n):t.pathname;return(r.split(`/`).filter(Boolean).pop()??r).replace(/^\d{10,}-[a-z0-9]+-/,``)}catch{return e}}function te(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode(...t.subarray(e,e+n));return btoa(r)}async function ne(e){if(!e.length)return[];let t=await O(`POST`,{upload:await Promise.all(e.map(async e=>({name:e.name||`attachment`,type:e.type||`application/octet-stream`,data:te(await e.arrayBuffer())})))});return(Array.isArray(t.files)?t.files:[]).map(e=>{let t=e,n=typeof t.url==`string`?t.url:``;return n?{url:n,name:typeof t.name==`string`&&t.name?t.name:$(n)}:null}).filter(e=>!!e)}async function re(e,t=``){let n=e.filter(Boolean);if(n.length)try{await O(`POST`,t?{cleanup:n,bugId:t}:{cleanup:n})}catch{}}export{X as A,U as C,B as D,Q as E,R as F,P as I,ne as L,G as M,W as N,z as O,j as P,V as S,J as T,E as _,n as a,K as b,s as c,i as d,u as f,F as g,N as h,f as i,ee as j,Z as k,r as l,re as m,d as n,c as o,Y as p,o as r,t as s,a as t,l as u,k as v,q as w,H as x,A as y};
@@ -1,6 +0,0 @@
1
- var e=`/__tb_reqanalysis`,t=`需求分析提示词.md`,n=`需求分析`,r={draft:{label:`待拆解`,tone:`gray`},decomposed:{label:`已拆解`,tone:`blue`},checked:{label:`已审查`,tone:`amber`},accepted:{label:`已验收`,tone:`green`}},i={P0:`red`,P1:`amber`,P2:`gray`},a={"uncovered-outline":`条目未覆盖`,"missing-field":`字段缺失`,"missing-scenario":`场景遗漏`,"missing-dimension":`维度缺失`,"untestable-acceptance":`验收不可测`,conflict:`与原文冲突`,"over-split":`过度拆分`,other:`其它`},o={high:`高`,medium:`中`,low:`低`},s={high:`red`,medium:`amber`,low:`gray`},c=[{key:`permission`,label:`权限与角色`,keywords:[`权限`,`角色`,`授权`,`越权`,`未登录`,`登录`,`管理员`,`普通用户`],hint:`补充不同角色 / 未登录 / 越权访问时这条流程的行为。`},{key:`boundary`,label:`边界值`,keywords:[`边界`,`上限`,`下限`,`最大`,`最小`,`长度`,`超长`,`字数`,`为空`,`空值`],hint:`补充字段长度、数量上限、刚好等于阈值时的表现。`},{key:`concurrency`,label:`并发与幂等`,keywords:[`并发`,`重复`,`幂等`,`同时`,`加锁`,`冲突`,`重复提交`],hint:`补充重复提交、多人同时操作同一数据时的结果。`},{key:`empty`,label:`空数据`,keywords:[`空数据`,`无数据`,`没有数据`,`空列表`,`暂无`,`空态`],hint:`补充列表为空、首次使用、数据被清空时的空态。`},{key:`failure`,label:`超时与失败`,keywords:[`超时`,`失败`,`异常`,`错误`,`重试`,`断网`,`不可用`,`降级`,`回滚`],hint:`补充依赖超时、接口失败、网络中断时的提示与回滚。`},{key:`i18n`,label:`国际化与时区`,keywords:[`国际化`,`时区`,`多语言`,`语言`,`翻译`,`utc`,`夏令时`],hint:`补充跨时区时间展示、多语言文案与本地化格式。`}],l=/创建|新增|新建|保存|提交|删除|编辑|修改|更新|上传|导入|导出|发布|审批|撤回|绑定|解绑|发送|支付|下单|配置|启停|启用|停用/;async function u(t,n){let r=await fetch(`${e}${t}`,{...n,headers:n?.body===void 0?void 0:{"Content-Type":`application/json`,...n?.headers}}),i=await r.json().catch(()=>({}));if(!r.ok||i.ok===!1)throw Error(i.error||`HTTP ${r.status}`);return i}async function d(){try{return(await fetch(`${e}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function f(){return(await u(`/list`)).docs??[]}async function p(e){return(await u(`/create`,{method:`POST`,body:JSON.stringify(e)})).doc}async function m(e,t){return(await u(`/`,{method:`PUT`,body:JSON.stringify({id:e,...t})})).doc}async function h(e){await u(`/delete`,{method:`POST`,body:JSON.stringify({id:e})})}async function g(){try{let e=await u(`/prompt`);return{file:e.file||`需求分析提示词.md`,exists:e.exists===!0,decompose:e.decompose??``,audit:e.audit??``,fix:e.fix??``}}catch(e){return{file:t,exists:!1,decompose:``,audit:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function _(e){return await u(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function v(e){return(await x(e)).content}async function y(e,t=2e4){try{let n=(await v(e)).trim();return{text:n.slice(0,t),total:n.length,truncated:n.length>t}}catch{return{text:``,total:0,truncated:!1}}}async function b(){return(await u(`/sources`)).files??[]}async function x(e){return u(`/source?path=${encodeURIComponent(e)}`)}var S=/[\s\p{P}\p{S}]+/gu;function C(e){return String(e??``).toLowerCase().replace(S,``)}function w(e){return Array.from(new Set(e.map(e=>String(e??``).trim()).filter(Boolean)))}function T(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function E(e,t=30,n=500){return Array.isArray(e)?e.map(e=>T(e,n)).filter(Boolean).slice(0,t):[]}function D(e){let t=2166136261,n=String(e??``);for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function O(e){return D(String(e??``))}function k(e,t,n){return`g_${D(`${e}|${t}|${n}`)}`}function A(e){let t=e&&typeof e==`object`?e:{},n=T(t.priority,4);return{id:T(t.id,20),title:T(t.title,200),role:T(t.role,120),goal:T(t.goal,500),value:T(t.value,500),sourceRefs:E(t.sourceRefs,20,40),priority:n===`P0`||n===`P1`||n===`P2`?n:`P1`,preconditions:E(t.preconditions),mainFlow:(Array.isArray(t.mainFlow)?t.mainFlow:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{actor:T(t.actor,80),action:T(t.action,500),result:T(t.result,500)}}).filter(e=>e.action).slice(0,40),altFlows:(Array.isArray(t.altFlows)?t.altFlows:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{name:T(t.name,120)||`替代流程`,trigger:T(t.trigger,500),steps:E(t.steps,20)}}).slice(0,20),exceptions:(Array.isArray(t.exceptions)?t.exceptions:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{scenario:T(t.scenario,500),expected:T(t.expected,500)}}).filter(e=>e.scenario).slice(0,30),postconditions:E(t.postconditions),acceptance:(Array.isArray(t.acceptance)?t.acceptance:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{given:T(t.given,500),when:T(t.when,500),then:T(t.then,500)}}).filter(e=>e.given||e.when||e.then).slice(0,30),dimensions:E(t.dimensions,12,40)}}function j(e){return{...e,sourceRefs:[...e.sourceRefs],preconditions:[...e.preconditions],mainFlow:e.mainFlow.map(e=>({...e})),altFlows:e.altFlows.map(e=>({...e,steps:[...e.steps]})),exceptions:e.exceptions.map(e=>({...e})),postconditions:[...e.postconditions],acceptance:e.acceptance.map(e=>({...e})),dimensions:[...e.dimensions]}}function M(e){let t=e.mainFlow?.[0];return`${C(e.title)}|${t?C(`${t.action}${t.result??``}`):``}`}function N(e,t){let n=e.map(j),r=new Map(n.filter(e=>e.id).map(e=>[e.id,e])),i=new Map(n.map(e=>[M(e),e]));for(let e of t){let t=A(e);if(!t.title)continue;let a=t.id&&r.get(t.id)||i.get(M(t));if(a)!a.role&&t.role&&(a.role=t.role),!a.goal&&t.goal&&(a.goal=t.goal),!a.value&&t.value&&(a.value=t.value),a.sourceRefs=w([...a.sourceRefs,...t.sourceRefs]),a.dimensions=w([...a.dimensions,...t.dimensions]),a.preconditions.length||(a.preconditions=[...t.preconditions]),a.mainFlow.length||(a.mainFlow=t.mainFlow.map(e=>({...e}))),a.altFlows.length||(a.altFlows=t.altFlows.map(e=>({...e}))),a.exceptions.length||(a.exceptions=t.exceptions.map(e=>({...e}))),a.postconditions.length||(a.postconditions=[...t.postconditions]),a.acceptance.length||(a.acceptance=t.acceptance.map(e=>({...e}))),t.priority===`P0`&&a.priority!==`P0`?a.priority=`P0`:t.priority===`P1`&&a.priority===`P2`&&(a.priority=`P1`);else{let e={...t,id:``};n.push(e),i.set(M(e),e)}}return n}function P(e){return[e.title,e.role,e.goal,e.value,...e.dimensions,...e.preconditions,...e.postconditions,...e.mainFlow.map(e=>`${e.actor??``} ${e.action} ${e.result??``}`),...e.altFlows.map(e=>`${e.name} ${e.trigger} ${e.steps.join(` `)}`),...e.exceptions.map(e=>`${e.scenario} ${e.expected}`),...e.acceptance.map(e=>`${e.given} ${e.when} ${e.then}`)].join(` `)}function F(e){return e.mainFlow.some(e=>l.test(e.action))}function I(e,t,n,r,i,a){return{id:k(e,t,n),storyId:t,type:e,severity:a,title:n,detail:r,suggestion:i,origin:`rule`,selected:!1}}var L=new Set([`缺少角色`,`缺少目标`,`缺少前置条件`,`缺少主流程`,`没有异常场景`,`写操作缺少异常分支`,`缺少验收标准`,`验收标准缺 then`,`没有关联需求条目`,`只写了主流程`]);function R(e){let t=e.outline??[],n=e.stories??[],r=[],i=new Set(n.flatMap(e=>e.sourceRefs));for(let e of t)i.has(e.id)||r.push(I(`uncovered-outline`,``,`需求条目未覆盖:${e.title}`,`条目 ${e.id}「${e.title}」没有任何用户故事引用。`,`补一条覆盖该条目的用户故事,或在已有故事的 sourceRefs 里加上 ${e.id}。`,`high`));for(let e of n){let t=`${e.id} ${e.title}`;e.role||r.push(I(`missing-field`,e.id,`缺少角色`,`${t} 没有写清谁在用这个功能。`,`补一个来自原文的角色;原文没写就标注「推断」。`,`medium`)),e.goal||r.push(I(`missing-field`,e.id,`缺少目标`,`${t} 没有写用户要达成什么。`,`补一句用户目标(想要什么结果)。`,`medium`)),e.preconditions.length||r.push(I(`missing-field`,e.id,`缺少前置条件`,`${t} 没有前置条件。`,`补进入这条流程前必须成立的状态。`,`low`)),e.mainFlow.length||r.push(I(`missing-field`,e.id,`缺少主流程`,`${t} 没有主流程步骤。`,`按「动作 + 结果」补主流程。`,`high`)),e.sourceRefs.length||r.push(I(`missing-field`,e.id,`没有关联需求条目`,`${t} 的 sourceRefs 为空,覆盖率无法统计。`,`把这条故事挂到对应的需求条目 id 上。`,`low`)),e.exceptions.length?F(e)&&e.exceptions.length<2&&r.push(I(`missing-scenario`,e.id,`写操作缺少异常分支`,`${t} 包含写操作,但只写了 ${e.exceptions.length} 条异常。`,`补重复提交 / 并发修改 / 保存失败时的表现与回滚。`,`medium`)):r.push(I(`missing-scenario`,e.id,`没有异常场景`,`${t} 只写了顺利路径,没有异常分支。`,`至少补 3 条:输入非法、权限不足、依赖失败 / 超时。`,`high`)),!e.altFlows.length&&F(e)&&r.push(I(`missing-scenario`,e.id,`只写了主流程`,`${t} 没有替代流程:分支条件、可跳过步骤、不同入口都没覆盖。`,`按触发条件补至少一条替代路径。`,`low`)),e.acceptance.length?e.acceptance.some(e=>!e.then)&&r.push(I(`untestable-acceptance`,e.id,`验收标准缺 then`,`${t} 有 ${e.acceptance.filter(e=>!e.then).length} 条验收没有写 then。`,`补上「应该看到什么 / 查到什么」,不要停在操作步骤。`,`high`)):r.push(I(`untestable-acceptance`,e.id,`缺少验收标准`,`${t} 没有 Given / When / Then。`,`每条验收写成 Given / When / Then,then 必须可判定。`,`high`))}let a=c.map(e=>{let t=n.filter(t=>{let n=P(t).toLowerCase();return e.keywords.some(e=>n.includes(e.toLowerCase()))}).map(e=>e.id);return{key:e.key,label:e.label,covered:t.length>0,stories:t}});for(let e of a){if(e.covered)continue;let t=c.find(t=>t.key===e.key)?.hint??``;r.push(I(`missing-dimension`,``,`维度缺失:${e.label}`,`所有用户故事都没有覆盖「${e.label}」相关场景。`,t,`medium`))}let o=t.filter(e=>i.has(e.id)).length,s={total:t.length,covered:o,rate:t.length?o/t.length:0};return{at:new Date().toISOString(),summary:`规则检查:${n.length} 个故事、${t.length} 条需求条目,覆盖率 ${t.length?Math.round(s.rate*100):0}%,发现 ${r.length} 个问题。`,coverage:s,dimensions:a,gaps:r}}function z(e,t){let n=e.map(e=>({...e})),r=new Map(n.map(e=>[`${e.storyId}|${e.type}`,e])),i=new Set(n.map(e=>e.id));for(let e of t){if(i.has(e.id))continue;let t=`${e.storyId}|${e.type}`,a=r.get(t);a?L.has(a.title)?(a.title=e.title,a.detail=[a.detail,e.detail].filter(Boolean).join(` / `),a.suggestion=e.suggestion||a.suggestion,a.severity=e.severity):C(a.title)!==C(e.title)&&(n.push({...e}),i.add(e.id)):(n.push({...e}),r.set(t,e),i.add(e.id))}return n}function B(e,t){let n=new Set(e.filter(e=>e.selected).map(e=>e.id));return n.size?t.map(e=>n.has(e.id)?{...e,selected:!0}:e):t}function V(e,t){let n=[],r=``;for(let i of e.split(/\n{2,}/)){let e=r?`${r}\n\n${i}`:i;if(e.length<=t)r=e;else if(r&&n.push(r),i.length<=t)r=i;else{for(let e=0;e<i.length;e+=t)n.push(i.slice(e,e+t));r=``}}return r&&n.push(r),n}function H(e,t=12e3){let n=String(e??``).replace(/\r\n/g,`
2
- `).trim();if(!n)return[];let r=Math.max(2e3,Math.floor(t));if(n.length<=r)return[{index:0,title:``,text:n}];let i=[],a=``,o=[],s=()=>{let e=o.join(`
3
- `).trim();e&&i.push({title:a,text:e}),o=[]};for(let e of n.split(`
4
- `)){let t=/^#{2,6}\s+(.+?)\s*$/.exec(e);t&&(s(),a=t[1]),o.push(e)}if(s(),!i.length)return[{index:0,title:``,text:n}];let c=[],l=``,u=``,d=()=>{let e=l.trim();if(e){for(let t of e.length>r?V(e,r):[e])c.push({index:c.length,title:u,text:t});l=``}};for(let e of i){let t=l?`${l}\n\n${e.text}`:e.text;t.length<=r?(l||(u=e.title),l=t):(d(),u=e.title,l=e.text,l.length>r&&d())}return d(),c.length?c:[{index:0,title:``,text:n}]}function U(e,t){return t?`- **${e}**:${t}`:``}function W(e){return e.filter(Boolean).map(e=>`- ${e}`)}function G(e){let t=[];t.push(`### ${e.id} ${e.title}`),t.push(``);let n=[U(`角色`,e.role),U(`目标`,e.goal),U(`价值`,e.value),U(`优先级`,e.priority),U(`来源条目`,e.sourceRefs.join(`、`))].filter(Boolean);if(t.push(...n),n.length&&t.push(``),e.preconditions.length&&(t.push(`**前置条件**`),t.push(...W(e.preconditions)),t.push(``)),e.mainFlow.length&&(t.push(`**主流程**`),e.mainFlow.forEach((e,n)=>{let r=e.actor?`${e.actor}:`:``;t.push(`${n+1}. ${r}${e.action}${e.result?` → ${e.result}`:``}`)}),t.push(``)),e.altFlows.length){t.push(`**替代流程**`);for(let n of e.altFlows)t.push(`- **${n.name}**${n.trigger?`(触发:${n.trigger})`:``}`),n.steps.forEach((e,n)=>t.push(` ${n+1}. ${e}`));t.push(``)}if(e.exceptions.length){t.push(`**异常场景**`);for(let n of e.exceptions)t.push(`- ${n.scenario}${n.expected?` → ${n.expected}`:``}`);t.push(``)}if(e.postconditions.length&&(t.push(`**后置条件**`),t.push(...W(e.postconditions)),t.push(``)),e.acceptance.length){t.push(`**验收标准**`);for(let n of e.acceptance)t.push(`- Given ${n.given||`(未写)`};When ${n.when||`(未写)`};Then ${n.then||`(未写)`}`);t.push(``)}return e.dimensions.length&&(t.push(`**覆盖维度**:${e.dimensions.join(`、`)}`),t.push(``)),t[t.length-1]!==``&&t.push(``),t}function K(e,t){let n=new Set((t??[]).filter(Boolean)),i=n.size?e.stories.filter(e=>n.has(e.id)):e.stories,a=[];a.push(`# ${e.title||`需求分析`} · 用户故事`),a.push(``),a.push(`> 来源需求文档:\`${e.sourcePath||`(未指定)`}\` · 状态:${r[e.status].label} · 更新:${e.updatedAt}`),a.push(``),e.outline.length&&(a.push(`## 需求条目`),a.push(``),e.outline.forEach((e,t)=>{a.push(`${t+1}. **${e.id}** ${e.title}`)}),a.push(``)),a.push(`## 用户故事`),a.push(``),i.length||(a.push(`- (暂无)`),a.push(``));for(let e of i)a.push(...G(e));return a.join(`
5
- `)}function q(e){let t=[];t.push(`# ${e.title||`需求分析`}`),t.push(``),t.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 状态:${r[e.status].label} · 更新:${e.updatedAt}`),t.push(``),t.push(`## 需求条目`),t.push(``),e.outline.length||t.push(`- (暂无)`),e.outline.forEach((e,n)=>{t.push(`${n+1}. **${e.id}** ${e.title}`),e.quote&&t.push(` > ${e.quote.replace(/\n+/g,` `)}`)}),t.push(``),t.push(`## 用户故事`),t.push(``),e.stories.length||t.push(`- (暂无)`);for(let n of e.stories)t.push(...G(n));if(t.push(`## 审查摘要`),t.push(``),!e.check)t.push(`- 还没有跑过审查。`);else{let n=e.check.coverage.total?Math.round(e.check.coverage.rate*100):0;t.push(`- 覆盖率:${e.check.coverage.covered}/${e.check.coverage.total}(${n}%)`),t.push(`- 维度覆盖:${e.check.dimensions.map(e=>`${e.label}${e.covered?` ✓`:` ✗`}`).join(` · `)||`(无)`}`),e.check.summary&&(t.push(``),t.push(e.check.summary)),t.push(``),t.push(`### 缺口清单`),t.push(``),e.check.gaps.length||t.push(`- 没有发现缺口。`);let r=[...e.check.gaps].sort((e,t)=>{let n={high:0,medium:1,low:2};return n[e.severity]-n[t.severity]});for(let e of r){let n=e.storyId?`${e.storyId} `:``;t.push(`- **[${o[e.severity]}] ${a[e.type]}** · ${n}${e.title}`),e.detail&&t.push(` - 原因:${e.detail}`),e.suggestion&&t.push(` - 建议:${e.suggestion}`)}}return t.push(``),t.join(`
6
- `)}function J(e){return`${(e.title||e.sourcePath.split(`/`).pop()||`需求分析`).replace(/\.(md|markdown|txt)$/i,``).replace(/[\\/:*?"<>|]/g,` `).trim()||`需求分析`}-用户故事.md`}export{H as C,m as D,q as E,O as S,_ as T,z as _,t as a,v as b,R as c,J as d,d as f,b as g,f as h,n as i,p as l,k as m,s as n,i as o,g as p,a as r,r as s,o as t,h as u,N as v,K as w,y as x,B as y};
@@ -1,10 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/jszip.min.Bh2Mgo40.js","_astro/react.Blvh0GOs.js"])))=>i.map(i=>d[i]);
2
- import{s as e}from"./react.Blvh0GOs.js";import{y as t}from"./settings.BvxRxdqa.js";import{r as n,s as r,t as i}from"./req-analysis.DGQa1vaH.js";import{t as a}from"./app-version.BRO_L8TS.js";var o=`/__tb_testpoints`,s=`测试点生成提示词.md`,c=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`],l=[`P0`,`P1`,`P2`,`P3`],u={functional:{label:`功能`,hint:`主流程 / 替代流程 / 每个功能点`,tone:`blue`,accent:`bg-[#3370ff]`},boundary:{label:`边界值`,hint:`为空 / 上下限 / 刚好越界`,tone:`purple`,accent:`bg-[#7b5bd6]`},exception:{label:`异常`,hint:`失败路径 / 非法输入 / 并发`,tone:`red`,accent:`bg-[#e5484d]`},business:{label:`业务规则`,hint:`状态流转 / 权限 / 唯一性`,tone:`amber`,accent:`bg-[#d9820b]`},nonfunctional:{label:`非功能`,hint:`性能 / 安全 / 兼容 / 时区`,tone:`green`,accent:`bg-[#2f9e44]`}},d={P0:{label:`P0`,tone:`red`,markerId:`priority-1`},P1:{label:`P1`,tone:`amber`,markerId:`priority-2`},P2:{label:`P2`,tone:`blue`,markerId:`priority-3`},P3:{label:`P3`,tone:`gray`,markerId:`priority-4`}},f=Object.fromEntries(c.map(e=>[e,u[e].label]));async function p(e,t){let n=await fetch(`${o}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function m(){try{let e=await p(`/prompt`);return{file:s,exists:e.exists===!0,generate:e.generate??``}}catch(e){return{file:s,exists:!1,generate:``,error:e instanceof Error?e.message:String(e)}}}async function h(e){return p(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var g={P0:0,P1:1,P2:2,P3:3};function _(e){let t=e?.points??[];return c.map(e=>({key:e,label:u[e].label,hint:u[e].hint,points:t.filter(t=>t.dimension===e).sort((e,t)=>g[e.priority]-g[t.priority]||e.title.localeCompare(t.title,`zh`))}))}function v(e){let t=e?.points??[],n={P0:0,P1:0,P2:0,P3:0};for(let e of t)e.priority in n&&(n[e.priority]+=1);return{total:t.length,byPriority:n,coveredDimensions:c.filter(e=>t.some(t=>t.dimension===e)).length}}function y(e){return[...e].sort((e,t)=>c.indexOf(e.dimension)-c.indexOf(t.dimension)||g[e.priority]-g[t.priority]||e.title.localeCompare(t.title,`zh`))}function b(e){let t=y(e);if(!t.length)return``;let n=[];for(let e of c){let r=t.filter(t=>t.dimension===e);if(r.length){n.push(`#### ${u[e].label}`);for(let e of r)n.push(`- **[${e.priority}]** ${e.title}(${e.id})`),e.storyId&&n.push(` - 来源故事:${e.storyId}`),e.precondition&&n.push(` - 前置:${e.precondition}`),e.steps.length&&n.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&n.push(` - 预期:${e.expected}`)}}return n.join(`
3
- `)}function x(e){return(e||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function S(e){let t=[];return e.precondition&&t.push(`前置条件:${e.precondition}`),e.steps.length&&(t.push(`步骤:`),e.steps.forEach((e,n)=>t.push(`${n+1}. ${e}`))),e.expected&&t.push(`预期:${e.expected}`),t.join(`
4
- `)}function C(e,t){let n=t.replace(/[^A-Za-z0-9_-]/g,``);return n?`${e}-${n}`:`${e}-${Math.random().toString(36).slice(2,8)}`}function w(e){return{id:C(`tp`,e.id),title:`[${e.priority}] ${e.title}`,labels:[u[e.dimension].label,e.priority],markers:[{markerId:d[e.priority].markerId}],notes:{plain:{content:S(e)}}}}function T(e){let t=e.testPoints?.points??[],n=e.stories.map(e=>e.id),r=new Map(e.stories.map(e=>[e.id,e.title])),i=new Map;for(let e of t){let t=e.storyId||``,n=i.get(t);n?n.push(e):i.set(t,[e])}let a=[...n,...[...i.keys()].filter(e=>e&&!n.includes(e)).sort(),``],o=[];for(let e of a){let t=i.get(e);if(!t?.length)continue;let n=e?r.get(e):``;o.push({key:e||`global`,label:e?`${e} ${n??``}`.trim():`全局测试点`,points:[...t].sort((e,t)=>g[e.priority]-g[t.priority]||c.indexOf(e.dimension)-c.indexOf(t.dimension)||e.title.localeCompare(t.title,`zh`))})}return o}function E(e){let t=e.testPoints,n=T(e).map(e=>{let t=c.map(t=>e.points.filter(e=>e.dimension===t).length),n=t.filter(e=>e>0).length;return{id:C(`fn`,e.key),title:`${e.label}(${e.points.length})`,notes:{plain:{content:`测试点 ${e.points.length} 条 · 维度覆盖 ${n}/5\n${c.map((e,n)=>`${u[e].label} ${t[n]}`).join(` · `)}`}},children:{attached:e.points.map(w)}}}),r={id:`root-topic`,title:`测试点 · ${e.title||`未命名分析`}`,structureClass:`org.xmind.ui.logic.right`,notes:{plain:{content:t?.summary?t.summary:`按功能 / 用户故事归组的测试点,叶子标注优先级与所属维度。`}},children:{attached:n}};return[{id:`sheet-1`,class:`sheet`,title:e.title||`测试点`,rootTopic:r}]}async function D(n){let r=E(n),{default:i}=await t(async()=>{let{default:t}=await import(`./jszip.min.Bh2Mgo40.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1])),o=new i;return o.file(`content.json`,JSON.stringify(r)),o.file(`metadata.json`,JSON.stringify({creator:{name:`Lantern Harness`,version:a},activeSheetId:`sheet-1`})),o.file(`manifest.json`,JSON.stringify({"file-entries":{"content.json":{},"metadata.json":{}}})),o.generateAsync({type:`blob`,compression:`DEFLATE`})}async function O(e){let t=new Date().toISOString().slice(0,10),n=`${x(e.title)}-测试点-${t}.xmind`,r=await D(e),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=n,a.click(),URL.revokeObjectURL(i),n}function k(e){let t=e.testPoints,n=[];if(n.push(`# 测试点 · ${e.title||`未命名分析`}`),n.push(``),n.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 故事 ${e.stories.length} 条`),n.push(``),!t)return n.push(`- 还没有生成测试点。`),`${n.join(`
5
- `)}\n`;let r=v(t);n.push(`- 生成时间:${t.at}`),n.push(`- 共 ${r.total} 条(P0 ${r.byPriority.P0} / P1 ${r.byPriority.P1} / P2 ${r.byPriority.P2} / P3 ${r.byPriority.P3})`),n.push(`- 维度覆盖:${r.coveredDimensions}/5`),t.summary&&(n.push(``),n.push(t.summary)),n.push(``);let i=T(e);if(!i.length)return n.push(`- 还没有生成测试点。`),`${n.join(`
6
- `).trimEnd()}\n`;for(let e of i){n.push(`## ${e.label}(${e.points.length})`),n.push(``);for(let t of e.points)n.push(`- **[${t.priority}]** ${t.title} · ${u[t.dimension].label}`),t.precondition&&n.push(` - 前置:${t.precondition}`),t.steps.length&&n.push(` - 步骤:${t.steps.join(`;`)}`),t.expected&&n.push(` - 预期:${t.expected}`);n.push(``)}return`${n.join(`
7
- `).trimEnd()}\n`}function A(e){let t=new Date().toISOString().slice(0,10),n=`${x(e.title)}-测试点-${t}.md`,r=new Blob([k(e)],{type:`text/markdown;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=n,a.click(),URL.revokeObjectURL(i),n}var j=`/__tb_storyreview`,M=`用户故事审查提示词.md`;async function N(e,t){let n=await fetch(`${j}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`HTTP ${n.status}`);return r}async function P(){try{let e=await N(`/prompt`);return{file:M,exists:e.exists===!0,review:e.review??``,fix:e.fix??``}}catch(e){return{file:M,exists:!1,review:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function F(e){return N(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var I={high:0,medium:1,low:2};function L(e){let t={scenario:[],dimension:[],other:[]};for(let n of e)n.type===`missing-scenario`?t.scenario.push(n):n.type===`missing-dimension`?t.dimension.push(n):t.other.push(n);let n=e=>[...e].sort((e,t)=>I[e.severity]-I[t.severity]||e.title.localeCompare(t.title,`zh`));return[{key:`scenario`,label:`场景遗漏`,hint:`角色 / 分支 / 失败路径没写到`,gaps:n(t.scenario)},{key:`dimension`,label:`维度缺失`,hint:`六个维度里该覆盖却没提`,gaps:n(t.dimension)},{key:`other`,label:`其它问题`,hint:`验收不可测 / 冲突 / 过度拆分等`,gaps:n(t.other)}].filter(e=>e.gaps.length>0)}function R(e){return{high:e.filter(e=>e.severity===`high`).length,medium:e.filter(e=>e.severity===`medium`).length,low:e.filter(e=>e.severity===`low`).length}}function z(e,t){let a=[];if(a.push(`# 用户故事审查报告 · ${e.title||`未命名分析`}`),a.push(``),a.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 故事 ${e.stories.length} 条`),a.push(``),!t)return a.push(`- 还没有审查结果。`),`${a.join(`
8
- `)}\n`;let o=t.coverage.total?Math.round(t.coverage.rate*100):0;a.push(`## 结论`),a.push(``),a.push(`- 状态:${r[e.status]?.label??e.status}`),a.push(`- 审查时间:${t.at}`),a.push(`- 需求条目覆盖率:${t.coverage.covered}/${t.coverage.total}(${o}%)`),a.push(`- 维度覆盖:${t.dimensions.map(e=>`${e.label}${e.covered?` ✓`:` ✗`}`).join(` · `)||`(无)`}`);let s=R(t.gaps);a.push(`- 缺口:${t.gaps.length} 条(高 ${s.high} / 中 ${s.medium} / 低 ${s.low})`),t.summary&&(a.push(``),a.push(t.summary)),a.push(``);let c=new Map(e.stories.map(e=>[e.id,e.title])),l=L(t.gaps);if(!l.length)return a.push(`## 缺口清单`),a.push(``),a.push(`- 没有发现缺口。`),`${a.join(`
9
- `)}\n`;for(let e of l){a.push(`## ${e.label}(${e.gaps.length})`),a.push(``);for(let t of e.gaps){let e=t.storyId?`${t.storyId}${c.get(t.storyId)?` ${c.get(t.storyId)}`:``}`:`全局`;a.push(`- **[${i[t.severity]}] ${n[t.type]}** · ${e} · ${t.title}`),t.detail&&a.push(` - 原因:${t.detail}`),t.suggestion&&a.push(` - 建议:${t.suggestion}`)}a.push(``)}return`${a.join(`
10
- `).trimEnd()}\n`}function B(e,t){let n=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-审查报告-${new Date().toISOString().slice(0,10)}.md`,r=new Blob([z(e,t)],{type:`text/markdown;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=n,a.click(),URL.revokeObjectURL(i),n}export{T as _,L as a,u as c,s as d,v as f,_ as g,m as h,P as i,d as l,O as m,R as n,F as o,A as p,B as r,f as s,M as t,l as u,h as v,b as y};