lantern-harness 0.1.23 → 0.1.24
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.
- package/CHANGELOG.md +27 -0
- package/builtin/session/bash-session.mjs +91 -0
- package/builtin/session/lh-bash.mjs +67 -1
- package/builtin/session/lh-web.mjs +103 -52
- package/builtin/session/mcp-client.mjs +290 -0
- package/builtin/session/pwsh-session.mjs +90 -0
- package/builtin/session/session-runs.mjs +6 -1
- package/builtin/session/tool-run-policy.mjs +32 -0
- package/builtin/session/web-fetch-policy.mjs +79 -0
- package/cli/acp-server.mjs +19 -9
- package/cli/agent-policy.mjs +60 -0
- package/cli/headless.mjs +30 -6
- package/cli/jsonrpc-server.mjs +9 -3
- package/cli/lantern.mjs +40 -5
- package/cli/server.mjs +2 -0
- package/dist/500.html +4 -4
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.CWRCetQl.js → Base.astro_astro_type_script_index_0_lang.DHRjA0au.js} +1 -1
- package/dist/_astro/Base.nGl8De0W.css +1 -0
- package/dist/_astro/{CaseExecBoard.Dnb8oP5i.js → CaseExecBoard.Xd7KUpkU.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.ci_JowEk.js → CaseGenerateApp.BgIi4YGn.js} +2 -2
- package/dist/_astro/CasesLibrary.B2VCAoTt.js +21 -0
- package/dist/_astro/ChatApp.CeSatNSf.js +220 -0
- package/dist/_astro/ConfirmDialog.D5qXeML0.js +1 -0
- package/dist/_astro/{DashboardBoard.D-zHXRds.js → DashboardBoard.CmxqpmzI.js} +2 -2
- package/dist/_astro/{DocsFileBrowser.BM3nH4VD.js → DocsFileBrowser.Diq5zuSt.js} +1 -1
- package/dist/_astro/{DocsPager.B9VhI6E3.js → DocsPager.WMztSW4O.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.D9KnqXzr.js → KnowledgeLibrary.CYutSepl.js} +1 -1
- package/dist/_astro/MultiSelectDropdown.BHxW9XLR.js +1 -0
- package/dist/_astro/NamePromptDialog.5XFIvdqv.js +1 -0
- package/dist/_astro/{NavLibraries.RH3Sinuh.js → NavLibraries.BybmHnXn.js} +1 -1
- package/dist/_astro/{PluginsPage.DBRfSxtq.js → PluginsPage.CgcXB7Ap.js} +2 -2
- package/dist/_astro/PluginsPage.pgN80K8r.js +1 -0
- package/dist/_astro/{PmBugsBoard.BnnaNP1y.js → PmBugsBoard.Ceyt3pp6.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.phiyhQVA.js → PmIterationsBoard.Dwsntvw6.js} +1 -1
- package/dist/_astro/{PmProjectDetail.C8kRX5lu.js → PmProjectDetail.5tybGC46.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.CFApEGPo.js → PmProjectsBoard.X2LZfFff.js} +1 -1
- package/dist/_astro/{PmRequirementsBoard.DR9egcgA.js → PmRequirementsBoard.CXaGeFl9.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.CYbicBqS.js +1 -0
- package/dist/_astro/{PmShared.BrBicDMN.js → PmShared.Bzn6AGsN.js} +1 -1
- package/dist/_astro/{PromptsLibrary.sz6MivVn.js → PromptsLibrary.DydrgeIw.js} +1 -1
- package/dist/_astro/{ReportsPage.CYZtpeiv.js → ReportsPage.BRVCnzL-.js} +1 -1
- package/dist/_astro/ReqAnalysisBoard.BCq_OoRo.js +39 -0
- package/dist/_astro/{RequirementsLibrary.R4dNZa9y.js → RequirementsLibrary.DtbFESBh.js} +1 -1
- package/dist/_astro/SearchableSelect.D3ODywC4.js +1 -0
- package/dist/_astro/SettingsDialog.DtEJLxtx.js +1 -0
- package/dist/_astro/SpaceSwitcher.Cdveup1T.js +7 -0
- package/dist/_astro/{TasksBoard.D0HwS5hd.js → TasksBoard.rwdPWLAh.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.CVv5Ef30.js → TemplatesLibrary.Bg-MFL57.js} +1 -1
- package/dist/_astro/{TestStatsBoard._qNcNorG.js → TestStatsBoard.eiMbNGpn.js} +1 -1
- package/dist/_astro/{TodosBoard.CF5wbJy7.js → TodosBoard.CrZMl6Ei.js} +1 -1
- package/dist/_astro/{UiAutoBoard.B-7mL3ez.js → UiAutoBoard.CLi9vmuE.js} +3 -3
- package/dist/_astro/{app-config.CF1xVPmo.js → app-config.DAIyT--R.js} +1 -1
- package/dist/_astro/app-version.XPYyWuno.js +1 -0
- package/dist/_astro/bash-tools.D4DBYc9k.js +27 -0
- package/dist/_astro/case-fields.Dqkws1iX.js +1 -0
- package/dist/_astro/case-gen-run.BbI2iGo9.js +21 -0
- package/dist/_astro/case-review.D1E3ldss.js +3 -0
- package/dist/_astro/{case-types.DS1EQ5yP.js → case-types.B6MLX3iE.js} +1 -1
- package/dist/_astro/{hydrate-cache.CmC22o_H.js → hydrate-cache.C0F0L04c.js} +1 -1
- package/dist/_astro/i18n.ele1lM9e.js +7 -0
- package/dist/_astro/open-docs-in-session.D608wzlx.js +1 -0
- package/dist/_astro/{plugins.CVM1IaoC.js → plugins.Di6uuouN.js} +1 -1
- package/dist/_astro/req-analysis.CIZ_cIJQ.js +23 -0
- package/dist/_astro/settings.DbhUT6Ao.js +2 -0
- package/dist/_astro/{spaces-client.DnS6MgGy.js → spaces-client.OuJPy3GP.js} +1 -1
- package/dist/_astro/{story-review.BbdIf5zg.js → story-review.BRcUdixS.js} +6 -3
- package/dist/_astro/{view-prefs.D1snIG5o.js → view-prefs.DkS1ldnh.js} +1 -1
- package/dist/case-exec/index.html +5 -5
- package/dist/cases/generate/index.html +5 -5
- package/dist/cases/library/index.html +5 -5
- package/dist/dashboard/index.html +5 -5
- package/dist/docs/changelog/index.html +30 -5
- package/dist/docs/install/index.html +48 -4
- package/dist/docs/manual/index.html +37 -30
- package/dist/knowledge/index.html +5 -5
- package/dist/plugins/index.html +5 -5
- package/dist/pm/bugs/index.html +5 -5
- package/dist/pm/iterations/index.html +5 -5
- package/dist/pm/projects/detail/index.html +5 -5
- package/dist/pm/projects/index.html +5 -5
- package/dist/pm/requirements/index.html +5 -5
- package/dist/prompts/index.html +5 -5
- package/dist/reports/index.html +5 -5
- package/dist/requirement-analysis/index.html +5 -5
- package/dist/requirements/index.html +5 -5
- package/dist/tasks/index.html +5 -5
- package/dist/templates/index.html +5 -5
- package/dist/test-automation/index.html +5 -5
- package/dist/test-stats/index.html +5 -5
- package/dist/todos/index.html +5 -5
- package/dist/workbench/index.html +5 -5
- package/docs//344/274/232/350/257/235/346/217/222/344/273/266.md +9 -7
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +14 -2
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +23 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +32 -24
- package/lh-plugins/case-review-prompt.mjs +12 -106
- package/lh-plugins/lh-case-review.mjs +3 -0
- package/lh-plugins/lh-mcp.mjs +79 -0
- package/lh-plugins/lh-reports.mjs +11 -29
- package/lh-plugins/lh-req-analysis.mjs +59 -6
- package/lh-plugins/req-analysis-prompt.mjs +34 -44
- package/lh-plugins/story-review-prompt.mjs +8 -52
- package/lh-plugins/uiauto-prompt.mjs +9 -65
- package/package.json +3 -1
- package/dist/_astro/Base.GThhapKd.css +0 -1
- package/dist/_astro/CasesLibrary.CDjuLV_E.js +0 -21
- package/dist/_astro/ChatApp.Td2xCiQG.js +0 -216
- package/dist/_astro/ConfirmDialog.CsMwWevK.js +0 -1
- package/dist/_astro/NamePromptDialog.CS1pTTVl.js +0 -1
- package/dist/_astro/PluginsPage.DMDyUktn.js +0 -1
- package/dist/_astro/PmRequirementsBoard.B-AI9iZX.js +0 -1
- package/dist/_astro/ReqAnalysisBoard.CazI9SU-.js +0 -29
- package/dist/_astro/SearchableSelect.Cbb8jMnP.js +0 -1
- package/dist/_astro/SettingsDialog.Bs1I8b27.js +0 -1
- package/dist/_astro/SpaceSwitcher.Dw9LjKiJ.js +0 -7
- package/dist/_astro/app-version.yT2l6J8H.js +0 -1
- package/dist/_astro/bash-tools.CPS0ZiKi.js +0 -25
- package/dist/_astro/case-fields.h0roo2br.js +0 -1
- package/dist/_astro/case-gen-run.D8DGX0mr.js +0 -19
- package/dist/_astro/case-review.C1hQRbQ2.js +0 -3
- package/dist/_astro/i18n.CjqQGCAI.js +0 -7
- package/dist/_astro/open-docs-in-session.Cj0J2-XT.js +0 -1
- package/dist/_astro/req-analysis.dhgy4p2f.js +0 -14
- package/dist/_astro/settings.B1yetppp.js +0 -2
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{p as e}from"./app-config.CF1xVPmo.js";import{i as t,s as n}from"./plugins.CVM1IaoC.js";import{i as r,r as i}from"./case-types.DS1EQ5yP.js";import{t as a}from"./export.joBT53eb.js";import{a as o,o as s,s as c,t as l}from"./case-template.F1Nv08GV.js";import{r as u,t as d}from"./case-fields.h0roo2br.js";import{p as f}from"./req-analysis.dhgy4p2f.js";import{_ as p,v as m}from"./project-docs.DAw9bzgk.js";var h=`/__tb_case_sessions`,g=`tw.case.sessions.v1`,_=!1;function v(){return`csess_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function y(e){if(typeof e==`string`&&e.trim()){let t=e.trim();return r().some(e=>e.id===t),t}return r()[0]?.id??`functional`}function b(e){if(!e||!Array.isArray(e.sessions))return{sessions:[],activeId:``};let t=e.sessions.filter(e=>e&&typeof e==`object`&&e.id).map(e=>({...e,caseType:y(e.caseType)})),n=typeof e.activeId==`string`?e.activeId:``;return t.length&&!t.some(e=>e.id===n)&&(n=t[0].id),t.length||(n=``),{sessions:t,activeId:n}}function x(){try{let t=localStorage.getItem(e(g));return t?b(JSON.parse(t)):{sessions:[],activeId:``}}catch{return{sessions:[],activeId:``}}}function S(t){try{localStorage.setItem(e(g),JSON.stringify(t))}catch{}}async function C(){try{let e=await fetch(h,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json();_=!0;let n=b(t.store);return S(n),n}}catch{}return _=!1,x()}function w(){return x()}async function T(e){if(S(e),_)try{await fetch(h,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({store:e})})}catch{}}function E(e){S(e),T(e)}function D(e){let t=Date.now(),n={id:v(),title:e.title?.trim()||`用例生成`,createdAt:t,updatedAt:t,caseType:e.caseType,outputFormat:e.outputFormat,reqPaths:e.reqPaths,templateId:e.templateId,templateTitle:e.templateTitle,promptPath:e.promptPath,knowledgePaths:e.knowledgePaths?.length?[...e.knowledgePaths]:void 0,messages:[]};return E({sessions:[n,...x().sessions],activeId:n.id}),n}function O(e,t){let n=x(),r=n.sessions.map(n=>n.id===e?{...n,...t,updatedAt:Date.now()}:n),i={...n,sessions:r};return E(i),i}function k(e){return e.reqSource?e.reqSource:e.reqPath?{kind:`doc`,path:e.reqPath}:void 0}function A(e){let t=[e.templateTitle||e.templateId?.split(`/`).pop()||`默认模板`,e.outputFormat.toUpperCase()],n=k(e);return n?.kind===`stories`?t.push(`${e.docTitle||`用户故事`} · ${n.storyIds.length} 条故事`):n?.kind===`doc`&&t.push(n.path.split(`/`).pop()||n.path),e.testPointIds?.length&&t.push(`${e.testPointIds.length} 条测试点`),t.join(` · `)}function j(e){let t=e.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1]??e.match(/\{[\s\S]*\}/)?.[0]??e.match(/\[[\s\S]*\]/)?.[0];if(!t)return null;try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0)return{docTitle:``,cases:e,coverageRate:null,uncovered:[],writeNote:``};if(e&&typeof e==`object`){let t=e,n=t.用例??t.cases??t.items;if(!Array.isArray(n)||n.length===0)return null;let r=t.需求名称??t.文档名称??t.docTitle??t.title,i=typeof r==`string`?r.trim():``,a=t.覆盖需求率??t.coverageRate??t.coverage,o=null;if(typeof a==`number`&&Number.isFinite(a))o=Math.max(0,Math.min(100,Math.round(a)));else if(typeof a==`string`&&a.trim()){let e=parseInt(a.replace(/%/g,``),10);Number.isFinite(e)&&(o=Math.max(0,Math.min(100,e)))}let s=t.未覆盖说明??t.uncovered??t.omissions,c=Array.isArray(s)?s.map(e=>String(e).trim()).filter(Boolean):typeof s==`string`&&s.trim()?[s.trim()]:[],l=t.编写说明??t.note??t.summary,u=typeof l==`string`?l.trim():``;return{docTitle:i,cases:n,coverageRate:o,uncovered:c,writeNote:u}}}catch{return null}return null}function M(e){return e.replace(/[\\/:*?"<>|]/g,`_`).replace(/\s+/g,`-`).slice(0,64)||`cases`}function N(e){let t=String(e??``).trim().split(/[/\\]/).pop()?.trim()||``;t=t.replace(/\.(xlsx|xls|docx|doc|md|txt|csv)$/i,``),t=t.replace(/_?需求文档$/u,``).replace(/_?需求说明$/u,``).replace(/_?需求$/u,``).trim(),t=t.replace(/_\d{8}-\d{6}$/,``);for(let e of r()){let n=`_${e.label}用例`;if(t.endsWith(n)){t=t.slice(0,-n.length);break}}return/迭代版本$/u.test(t)?M(t):/v?\d+(?:\.\d+)*版本$/iu.test(t)?M(t.replace(/版本$/u,`迭代版本`)):/v\d+(?:\.\d+)+$/i.test(t)?M(`${t}迭代版本`):M(t)}function P(e){let t=N(e).replace(/迭代版本$/u,``).replace(/版本$/u,``).trim();return t=t.replace(/[\s_\-—·()()[\]【】]/g,``).toLowerCase(),t}function F(e,t){let n=P(e),r=P(t);return n.length<4||r.length<4?!1:n===r||n.includes(r)||r.includes(n)}function I(e=new Date){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}${t(e.getMonth()+1)}${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}${t(e.getSeconds())}`}function L(e,t,n=new Date){let r=`_${i(t).label}用例`;return`${N(e)||`cases`}${r}_${I(n)}`}function R(e,t){let n=String(e||``).match(RegExp(`${t}-\\d+`,`i`));return n?n[0].toUpperCase():``}function z(e,t){if(e===t)return 0;if(!e)return 1;if(!t)return-1;let n=e.match(/^(.*?)(\d+)$/),r=t.match(/^(.*?)(\d+)$/);return n&&r&&n[1]===r[1]?Number(n[2])-Number(r[2]):e.localeCompare(t,`zh`)}function B(e){return f(e??``)}function V(e,t,n){if(!t.length)return 0;let r=t.length+1,i=-1,a=!1,o=[n.submodule&&e[n.submodule],n.module&&e[n.module],n.title&&e[n.title]];for(let e of o){let n=String(e??``).trim();if(n)for(let e=0;e<t.length;e++){let o=t[e];o&&(n===o||n.includes(o))&&o.length>i&&(i=o.length,r=e,a=!0)}}return a?r:t.length+1}function H(e,t,n){if(e.length<=1)return e;let r=u(t),i=r.requirement||d.requirement,a=r.no||d.no,o=r.title||d.title,s=n?.idealOrder??[],c={submodule:r.submodule,module:r.module,title:o},l=new Map((n?.storyIds??[]).map((e,t)=>[e.toUpperCase(),t])),f=new Map((n?.testPointIds??[]).map((e,t)=>[e.toUpperCase(),t]));return[...e].map((e,t)=>({row:e,index:t})).sort((e,t)=>{if(s.length){let n=V(e.row,s,c),r=V(t.row,s,c);if(n!==r)return n-r;if(n<s.length)return e.index-t.index}let n=R(e.row[i]??``,`US`)||R(e.row[o]??``,`US`),r=R(t.row[i]??``,`US`)||R(t.row[o]??``,`US`);if(l.size){let e=n?l.get(n)??l.size+1:l.size+2,t=r?l.get(r)??l.size+1:l.size+2;if(e!==t)return e-t}let u=z(n,r);if(u)return u;let d=R(e.row[o]??``,`TP`)||R(e.row[a]??``,`TP`),p=R(t.row[o]??``,`TP`)||R(t.row[a]??``,`TP`);if(f.size&&(d||p)){let e=d?f.get(d)??f.size+1:f.size+2,t=p?f.get(p)??f.size+1:f.size+2;if(e!==t)return e-t}return z(d,p)||z(String(e.row[a]??``),String(t.row[a]??``))||e.index-t.index}).map(e=>e.row)}function U(e,t){let n=[];for(let r of t){let t=e.filter(e=>!String(e[r]??``).trim()).length;t===e.length?n.push(`字段「${r}」全部为空`):t>Math.max(2,Math.floor(e.length*.3))&&n.push(`字段「${r}」有 ${t}/${e.length} 条为空`)}return n}function W(e,t=``){let n=i(e.caseType).label,r=e.templateHeaders.length>0?e.templateHeaders:[...a],o=e.outputFormat===`md`?`最终结果将保存为 Markdown 表格文件`:e.outputFormat===`csv`?`最终结果将保存为 CSV 文件`:`最终结果将保存为 Excel 文件`,s=e.promptBody.trim();if(!s)throw Error(`请先在生成测试用例插件中选择提示词`);let c=e.templateBody?`\n\n### 用例模板:${e.templateTitle||e.templateId||``}\n${e.templateBody}`:`\n\n### 模板字段:${r.join(`、`)}`,l=e.reqBlock?`\n\n${e.reqBlock}`:``,d=e.testPointIds?.length??0,f=e.testPointBlock?`\n\n### 测试点(逐条覆盖,别合并成一条用例;共 ${d||`全部`} 条,下文为完整清单)\n${e.testPointBlock}`:``,p=e.testPointBlock?`- 已选测试点共 ${d||`全部`} 条,正文已完整注入,须逐条落到用例里;测试点的前置 / 步骤 / 预期分别对应用例的对应字段。不要声称「材料未提供后半段测试点」\n`:``,m=r.includes(`备注`)?r:[...r,`备注`],h=u(r),g=h.module,_=h.submodule,v=[];g&&v.push(`「${g}」对齐需求大模块 / 章节(Ideal 表填大模块原文;普通文档填对应章节名)`),_&&v.push(`「${_}」对齐需求小模块 / 小节原文,不要自造更细的名称`);let y=v.length>0?`- 字段对齐:${v.join(`;`)};用例数组严格按需求文档章节 / Ideal 小模块出现顺序输出\n`:`- 用例数组严格按需求文档章节 / 段落 / Ideal 小模块出现顺序输出(系统入库还会按此序重排)
|
|
2
|
-
`;return`${s}
|
|
3
|
-
${c}${l}${f}
|
|
4
|
-
|
|
5
|
-
【运行时约束 · 生成测试用例插件已启用】
|
|
6
|
-
- 本轮以「生成测试用例」插件所选提示词为准,不要再遵循工作台闲聊/系统提示词风格
|
|
7
|
-
- 用例类型:${n}
|
|
8
|
-
- ${o}
|
|
9
|
-
${p}- 需求名称默认可用「${t||`未命名需求`}」
|
|
10
|
-
- 「用例」数组必须按上文材料的需求顺序输出(Ideal 小模块行序 / 需求章节 / 文档段落 / 用户故事 / 测试点清单),不要按自造模块名、优先级或维度重排
|
|
11
|
-
${y}- 「用例」对象键必须与当前模板字段完全一致(另可多写「备注」列):${m.join(`、`)}
|
|
12
|
-
- 仅输出一个 JSON 对象(可无代码围栏),结构为:
|
|
13
|
-
{"需求名称":"...","覆盖需求率":0-100,"未覆盖说明":["..."],"编写说明":"...","用例":[...]}
|
|
14
|
-
- 「待业务确认 / 待确认」类不确定项也要写成用例,不要只丢进「未覆盖说明」:步骤写可执行操作,预期写「记录实际行为,规则待业务确认后回填判定口径」,并在「备注」写「待业务确认:…」(把不确定点写清楚)
|
|
15
|
-
- 「未覆盖说明」只写确实没写成用例的缺口(例如材料完全缺失、与测试无关);已注入的测试点不得再报「未提供」;已用备注标过待业务确认的不要再重复列进「未覆盖说明」
|
|
16
|
-
- 不要输出 JSON 以外的解释性正文;界面只会展示执行摘要,用例由系统静默入库`}function G(e=0){return`正在编写用例…\n\n已用 ${Math.max(0,Math.floor(e))}s · 通常约 30–120 秒\n完成后将给出覆盖率与入库结果。`}function K(e){if(!e.ok)return[`**执行失败**`,``,e.error||`未知错误`,``,`可调整插件中的需求 / 模板 / 提示词后重试。`].join(`
|
|
17
|
-
`);let t=[`**执行成功**`,``,`- 需求名称:${e.title||`—`}`,`- 共编写:${e.count??0} 条用例`,`- 覆盖需求率:${e.coverageRate==null?`未给出(已按用例入库)`:`${e.coverageRate}%`}`];e.path&&t.push(`- 入库文件:用例管理/${e.path}`),e.writeNote&&t.push(``,`**编写说明**`,e.writeNote);let n=e.uncovered??[];if(t.push(``,`**未覆盖 / 未编写原因**`),n.length)for(let e of n)t.push(`- ${e}`);else t.push(`- 无(模型未声明未覆盖项;待业务确认项已写入用例「备注」)`);let r=e.fieldGaps??[];if(r.length){t.push(``,`**字段完整性检测**`);for(let e of r)t.push(`- ${e}`)}return t.join(`
|
|
18
|
-
`)}async function q(e){if(!t(`cases`))throw Error(n(`cases`));let r=i(e.caseType),l=`${L(e.title,e.caseType)}${e.outputFormat===`md`?`.md`:e.outputFormat===`csv`?`.csv`:`.xlsx`}`,u=e.headers.length?e.headers:[...a];return e.outputFormat===`md`?await m(`cases`,l,s(e.cases,e.title,u)):e.outputFormat===`csv`?await m(`cases`,l,o(e.cases,u)):await p(`cases`,l,await c(e.cases,u,r.label)),l}function J(e){return e.some(e=>/备注/.test(e))?e:[...e,`备注`]}var Y=/待业务确|待确认|业务确认/;function X(e){return e.find(e=>/备注/.test(e))??`备注`}function Z(e){return e.find(e=>/用例标题|测试分项目|用例名称|标题/.test(e))??e.find(e=>e.includes(`标题`))??`用例标题`}function Q(e){for(let t of[`备注`,`备注说明`,`说明`,`remark`,`note`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}return``}function $(e,t,n){let r=X(n),i=Z(n),a=[],o=[];for(let e of t){let t=String(e??``).trim();if(!t||!Y.test(t)){t&&a.push(t);continue}let s=t.replace(/^[-*·\s]+/,``).split(/[。;;\n]/)[0]?.trim()||t,c=(s.length>48?`${s.slice(0,48)}…`:s).replace(/^待业务确认[::]\s*/u,``),l={};for(let e of n)l[e]=``;l[i]=c||`待业务确认项`,n.includes(`优先级`)&&(l.优先级=`P2`),n.includes(`用例类型`)&&(l.用例类型=`功能测试`);let u=n.find(e=>/步骤/.test(e)),d=n.find(e=>/预期|期望|结果标准/.test(e));u&&(l[u]=`1、按需求描述完成相关操作
|
|
19
|
-
2、记录系统实际行为与提示文案`),d&&(l[d]=`记录实际行为;业务规则确认前不做通过/失败判定,确认后回填判定口径`),l[r]=t.startsWith(`待业务确认`)?t:`待业务确认:${t}`,o.push(l)}return{cases:[...e,...o],uncovered:a}}function ee(e,t){let n=X(t);return e.map(e=>{if(!e||typeof e!=`object`)return e;let t={...e};if(!String(t[n]??``).trim()){let e=Q(t);e&&(t[n]=e)}return t})}async function te(e,t,n){let r=j(e);if(!r){let e=`未能解析出用例结果,未写入文件`;return{ok:!1,error:e,summary:K({ok:!1,error:e})}}let o=J(t.templateHeaders.length>0?t.templateHeaders:[...a]),s=$(r.cases,r.uncovered,o),c=ee(s.cases,o),f=k(t),p=f?.kind===`stories`?f.storyIds:void 0,m=B(t.reqBlock),h=H(l(c,o),o,{storyIds:p,testPointIds:t.testPointIds,idealOrder:m});if(m.length){let e=u(o).no||d.no;o.includes(e)&&h.forEach((t,n)=>{t[e]=String(n+1)})}let g=(n||t.docTitle||``).trim()||r.docTitle||i(t.caseType).label,_=U(h,o);try{let e=await q({cases:h,headers:o,caseType:t.caseType,outputFormat:t.outputFormat,title:g}),n=K({ok:!0,title:g,path:e,count:h.length,coverageRate:r.coverageRate,uncovered:s.uncovered,writeNote:r.writeNote,fieldGaps:_});return{ok:!0,path:e,count:h.length,title:g,coverageRate:r.coverageRate,uncovered:s.uncovered,writeNote:r.writeNote,fieldGaps:_,summary:n}}catch(e){let t=e instanceof Error?e.message:String(e);return{ok:!1,error:t,summary:K({ok:!1,error:t})}}}export{G as a,D as c,E as d,O as f,P as i,C as l,F as n,te as o,L as r,A as s,W as t,w as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./export.joBT53eb.js";import{n as t,t as n}from"./case-fields.h0roo2br.js";var r=`/__tb_casereview`,i=`/__tb_caseblindspot`,a=`用例质量评审提示词.md`,o=`场景遗漏补全提示词.md`,s=[`coverage`,`steps`,`expected`,`data`,`convention`],c={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`}},l=[`usable`,`revise`,`invalid`],u={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`}},d=[`nonfunctional`,`security`,`compatibility`,`business`],f={nonfunctional:{label:`非功能`,hint:`响应时间、并发、大数量、断网与重试`,tone:`purple`,mark:`非功能`},security:{label:`安全边界与容错`,hint:`越权、注入、重复提交、竞态与篡改`,tone:`amber`,mark:`安全`},compatibility:{label:`兼容性`,hint:`分辨率、浏览器 / 端、深浅色、时区与格式`,tone:`blue`,mark:`兼容`},business:{label:`隐藏业务规则`,hint:`金额精度、状态互斥、唯一性、跨模块联动`,tone:`green`,mark:`业务`}},p={high:{label:`高`,tone:`red`},medium:{label:`中`,tone:`amber`},low:{label:`低`,tone:`gray`}},m={usable:85,revise:60},h=/^(正常|正确|成功|符合预期|无异常|没问题|ok|okay|通过|显示正常)的?$/i,g=/(提示|跳转|弹窗|状态|变为|变成|显示|返回|报错|错误码|http\s*\d|\d+%|金额|数量|\d+\s*(ms|s|秒|条|元|位|个|行|次))|「[^」]+」|"[^"]+"/i,_=/^(验证|测试|检查)[^,。]{0,4}(功能|流程|是否正确)?$/;function v(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 y(e){let t=String(e??``).trim();return!t||h.test(t)?!1:g.test(t)&&t.length>=6}function b(e){let t=`${e.用例类型??``} ${e.用例标题??``} ${e.测试步骤??``}`;return/(边界|异常|失败|为空|超时|越界|并发|重复|非法|错误)/.test(t)}function x(e){let t=e=>String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``);return`${t(e.用例标题??``)}|${t(e.测试步骤??``)}`}function S(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 C(n,r=``){let i=t(n),a=i.length,o=S(r),s=i.map(e=>{let t=String(e.用例编号??``).trim(),n=String(e.用例标题??``).trim(),r=v(e.测试步骤??``),i=String(e.预期结果??``).trim(),a=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(o.length){let t=o.some(e=>u.includes(e));e+=t?40:0}else e+=30;return w(e)})(),steps:(()=>{if(!r.length)return 0;let e=r.length>=3?100:r.length===2?80:50;return r.some(e=>_.test(e))&&(e-=25),r.length===1&&r[0].length>80&&(e-=15),w(e)})(),expected:i?h.test(i)?45:y(i)?i.length>=12?100:90:65:0,data:(()=>{let t=a?60:20;return b(e)?t+=40:t+=15,w(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),w(e)})()},p=[];n||p.push({dimension:`convention`,points:15,reason:`用例标题为空,无法从列表里认出这条用例测什么`,suggestion:`补一句「动词 + 对象 + 条件」的标题,例如「未登录用户提交订单时提示先登录」`}),r.length||p.push({dimension:`steps`,points:25,reason:`测试步骤为空,无法执行`,suggestion:`按「一步一个动作」补步骤,从进入路径写到触发动作`}),i?y(i)||p.push({dimension:`expected`,points:8,reason:`预期结果不够可判定:「${i.slice(0,30)}」`,suggestion:`写成具体状态或文案,例如「提示『手机号格式不正确』,输入框标红且不提交」`}):p.push({dimension:`expected`,points:20,reason:`预期结果为空,无法判定是否通过`,suggestion:`补可判定的结果:页面 / 状态 / 文案 / 数值`}),a||p.push({dimension:`data`,points:6,reason:`没有前置条件,执行者不知道该用什么账号 / 数据 / 状态`,suggestion:`补上需要的角色、数据量与初始状态(如「已登录普通用户,购物车有 1 件商品」)`}),b(e)||p.push({dimension:`data`,points:5,reason:`这条用例没有体现边界或异常路径`,suggestion:`确认是否需要补一条空值 / 上下限 / 失败路径的用例`}),t||p.push({dimension:`convention`,points:5,reason:`缺少用例编号,无法在报告或缺陷里互相引用`,suggestion:`按项目规则补编号(如 TC-模块-001)`});let g=T(f);return{no:t,title:n,verdict:d.length?`invalid`:g>=m.usable?`usable`:g>=m.revise?`revise`:`invalid`,score:g,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 i){let t=x(e);t!==`|`&&l.set(t,(l.get(t)??0)+1)}let u=[...l.values()].reduce((e,t)=>e+(t>1?t:0),0),d=E(s),f=T(d),p=e.filter(e=>i.some(t=>e in t)),g=D(i,p);return{metrics:[{key:`total`,label:`用例总数`,value:a,text:`${a}`,hint:`本文件里的用例条数`},{key:`fieldComplete`,label:`字段完整率`,value:a?g/a:0,text:O(a?g/a:0),hint:`文件里的 ${p.length} 个字段是否都有内容`},{key:`stepExecutable`,label:`步骤可执行率`,value:a?i.filter(e=>v(e.测试步骤??``).length>=2).length/a:0,text:O(a?i.filter(e=>v(e.测试步骤??``).length>=2).length/a:0),hint:`有编号且至少两步`},{key:`expectedTestable`,label:`预期可判定率`,value:a?i.filter(e=>y(e.预期结果??``)).length/a:0,text:O(a?i.filter(e=>y(e.预期结果??``)).length/a:0),hint:`排除「正常 / 符合预期」这类模糊表述`},{key:`coverage`,label:`需求覆盖率`,value:o.length?Math.min(1,d.coverage/100):-1,text:o.length?O(Math.min(1,d.coverage/100)):`—`,hint:o.length?`与对照需求的关键点做匹配`:`未挂对照需求,不计算`},{key:`duplicate`,label:`重复用例率`,value:a?u/a:0,text:O(a?u/a:0),hint:`标题 + 步骤完全相同`},{key:`priority`,label:`优先级合规率`,value:a?i.filter(e=>[`P0`,`P1`,`P2`,`P3`].includes(String(e.优先级??``).toUpperCase())).length/a:0,text:O(a?i.filter(e=>[`P0`,`P1`,`P2`,`P3`].includes(String(e.优先级??``).toUpperCase())).length/a: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 w(e){return Math.min(100,Math.max(0,Math.round(e)))}function T(e){let t=0;for(let n of s)t+=e[n]*(c[n].weight/100);return w(t)}function E(e){let t={};for(let n of s)t[n]=e.length?w(e.reduce((e,t)=>e+(t.dimensions[n]??0),0)/e.length):0;return t}function D(t,n){let r=n.length?n:e;return t.filter(e=>r.every(t=>String(e[t]??``).trim())).length}function O(e){return Number.isFinite(e)?`${Math.round(Math.max(0,Math.min(1,e))*100)}%`:`—`}function k(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 A(e){return s.map(t=>({key:t,label:c[t].label,score:w(e[t]??0),weight:c[t].weight}))}function j(e){return String(e.no??``).trim()||String(e.title??``).trim()}function M(e){return`${e.category}|${e.title.trim()}`}function N(e,t,n,r,i){let a=new Map(t.cases.map(e=>[j(e),e]).filter(([e])=>e)),o=e.map(e=>{let t=j(e);if(t&&n.has(t)){let n=r.get(t)??e,i={...n,verdict:`usable`,score:Math.max(n.score,m.usable),fixed:!1};return delete i.hard,i}return a.get(t)??e}),s={usable:0,revise:0,invalid:0};for(let e of o)s[e.verdict]+=1;let c=E(o),l=e.filter(e=>{let t=j(e);return!!(t&&n.has(t))}).length,u=t.modelCovered??t.cases.length;return{...t,metrics:i??t.metrics,score:T(c),counts:s,dimensions:A(c),cases:o,modelCovered:Math.min(o.length,u+l)}}function P(e){let t=0;for(let n of e)n.fixed||(n.verdict===`revise`||n.verdict===`invalid`)&&(t+=1);return t}function F(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 s){let r=t.dimensions?.[e];typeof r==`number`&&Number.isFinite(r)&&(n[e]=w(r))}let a=Array.isArray(t.deductions)?t.deductions.filter(e=>e&&e.reason).map(e=>({dimension:s.includes(e.dimension)?e.dimension:`expected`,points:w(Number(e.points)||0),reason:String(e.reason??``).slice(0,1e3),suggestion:String(e.suggestion??``).slice(0,1e3)})):[],o=T(n),c=e.hard||String(t.hard??``).trim()||void 0,l=c?`invalid`:o>=m.usable?`usable`:o>=m.revise?`revise`:`invalid`,u={...e,verdict:l,score:o,dimensions:n,deductions:a.length?a:e.deductions,fixed:!1};return c?u.hard=c:delete u.hard,u}),o={usable:0,revise:0,invalid:0};for(let e of a)o[e.verdict]+=1;let c=E(a);return{at:new Date().toISOString(),score:T(c),counts:o,dimensions:A(c),metrics:e.metrics,cases:a,summary:n.trim(),modeled:!0,modelCovered:i}}function I(e,r){let i=new Map;if(r?.length)for(let e of t(r)){let t=String(e[n.no]??``).trim(),r=String(e[n.title]??``).trim();t&&r&&i.set(t,r)}let a=!1,o=e.cases.map(e=>{let t=e.title||i.get(String(e.no??``).trim())||``;if(e.fixed)return t===e.title?e:(a=!0,{...e,title:t});let n=e.hard?`invalid`:e.score>=m.usable?`usable`:e.score>=m.revise?`revise`:`invalid`;return t===e.title&&n===e.verdict?e:(a=!0,{...e,title:t,verdict:n})});if(!a)return e;let s={usable:0,revise:0,invalid:0};for(let e of o)s[e.verdict]+=1;return{...e,cases:o,counts:s}}function L(e,t=``){return{at:new Date().toISOString(),score:e.score,counts:e.counts,dimensions:A(e.dimensions),metrics:e.metrics,cases:e.cases,summary:t||`规则判定:可用 ${e.counts.usable} · 待修改 ${e.counts.revise} · 错误无效 ${e.counts.invalid}。未接入模型,语义类问题(与需求冲突、预期与步骤无关)未计入。`,modeled:!1}}function R(e){return d.map(t=>({key:t,items:e.filter(e=>e.category===t)})).filter(e=>e.items.length>0)}function z(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||`(无标题)`} · ${u[e.verdict].label} ${e.score}`),e.hard&&r.push(`- 硬伤:${e.hard}`);for(let t of e.deductions)r.push(`- [${c[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 R(n.items)){let t=f[e.key];r.push(`### ${t.label}(${e.items.length})`),r.push(``);for(let t of e.items)r.push(`- **[${p[t.severity].label}] ${t.title}**${t.added?`(已补全 ${t.caseNo})`:``}`),t.reqAnchor&&r.push(` - 归属需求:${t.reqAnchor}`),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 B(e,t,n){let r=`${e.replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-用例评审-${new Date().toISOString().slice(0,10)}.md`,i=new Blob([z(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 V(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 H(e){try{return(await fetch(`${e}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}function U(){return H(r)}function W(){return H(i)}async function G(){try{let e=await V(r,`/prompt`);return{file:e.file||`用例质量评审提示词.md`,exists:e.exists===!0,review:e.review??``}}catch(e){return{file:a,exists:!1,review:``,error:e instanceof Error?e.message:String(e)}}}async function K(){try{let e=await V(i,`/prompt`);return{file:e.file||`场景遗漏补全提示词.md`,exists:e.exists===!0,detect:e.detect??``,complete:e.complete??``}}catch(e){return{file:o,exists:!1,detect:``,complete:``,error:e instanceof Error?e.message:String(e)}}}function q(e){return V(r,`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}function J(e){return V(i,`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function Y(){return(await V(`/__tb_casereview`,`/summaries`)).files??[]}async function X(e){let t=await V(r,`/report?path=${encodeURIComponent(e)}`);return{entry:t.entry??null,stale:t.stale===!0}}async function Z(e,t){return(await V(r,`/report`,{method:`PUT`,body:JSON.stringify({path:e,...t})})).entry}async function Q(){return(await V(`/__tb_casereview`,`/backups`)).items??[]}async function $(e){return{deleted:(await V(`/__tb_casereview`,`/backups/delete`,{method:`POST`,body:JSON.stringify({names:e})})).deleted??[]}}export{N as A,G as C,I as D,F as E,q as M,L as O,U as S,R as T,B as _,c as a,Q as b,u as c,C as d,M as f,$ as g,P as h,a as i,J as j,Z as k,l,k as m,d as n,s as o,j as p,o as r,p as s,f as t,m as u,W as v,Y as w,X as x,K as y};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./react.Blvh0GOs.js";import{s as t}from"./settings.B1yetppp.js";var n=e({applyDomI18n:()=>o,t:()=>a}),r={"nav.home":`我的工作台`,"nav.dashboard":`仪表盘`,"nav.tasks":`任务管理`,"nav.todos":`待办事项`,"nav.projects":`项目列表`,"nav.iterations":`迭代管理`,"nav.requirementsMgmt":`需求管理`,"nav.bugs":`缺陷管理`,"nav.reports":`工作汇报`,"nav.testStats":`测试统计`,"nav.caseExec":`用例执行统计`,"nav.uiAuto":`自动化测试`,"nav.reqAnalysis":`需求分析`,"nav.requirements":`需求文档库`,"nav.caseManage":`用例管理`,"nav.cases":`用例`,"nav.templates":`测试模板库`,"nav.docs":`文档库`,"nav.createGroup":`创建分组`,"nav.createSubgroup":`创建子分组`,"nav.assignGroup":`加入分组`,"nav.more":`更多操作`,"nav.groupActions":`分组操作`,"nav.addSubgroup":`添加子分组`,"nav.addToGroup":`添加到分组`,"nav.chooseIcon":`选择图标`,"nav.leaveGroup":`移出分组`,"nav.currentGroup":`当前`,"nav.noGroups":`还没有分组`,"nav.noOtherGroups":`没有其它分组`,"nav.noAddableItems":`没有可添加的菜单项`,"nav.editGroup":`编辑`,"nav.editGroupTitle":`编辑分组`,"nav.sortMenu":`排序`,"nav.sortMenuTitle":`菜单排序`,"nav.sortHint":`按住拖动调整顺序`,"nav.subgroups":`子分组`,"nav.sortUp":`上移`,"nav.sortDown":`下移`,"nav.done":`完成`,"nav.deleteGroup":`取消分组`,"nav.deleteGroupMsg":`取消分组后,其中的菜单项会在菜单栏平铺显示。`,"nav.deleteSubgroupMsg":`取消子分组后,其中的菜单项会回到上级分组。`,"nav.groupName":`分组名称`,"nav.groupItems":`选择菜单项`,"nav.groupItemsHint":`已加入其他分组的菜单不会列出。`,"nav.groupNameRequired":`请填写分组名称`,"nav.groupItemsRequired":`请至少选择一项`,"nav.groupSave":`保存`,"nav.groupCancel":`取消`,"nav.prompts":`提示词管理`,"nav.knowledge":`知识库管理`,"nav.plugins":`我的插件`,"nav.brand":`Lantern Harness`,"nav.settings":`设置`,"nav.changelog":`变更日志`,"nav.changelogShort":`版本日志`,"nav.helpCenter":`帮助中心`,"docs.nav.title":`文档`,"docs.nav.changelog":`版本日志`,"docs.nav.manual":`操作手册`,"docs.nav.install":`安装手册`,"nav.repo":`GitHub 仓库`,"nav.repoShort":`仓库`,"nav.npm":`npm 包`,"nav.npmShort":`npm`,"nav.site":`炊烟小站`,"nav.siteShort":`小站`,"nav.board":`问题与建议`,"nav.boardShort":`问题与建议`,"space.label":`数据空间`,"space.current":`当前空间`,"space.switchTo":`切换到该空间`,"space.manage":`管理空间`,"space.others":`其他空间`,"space.manageTitle":`空间管理`,"space.manageDesc":`每个数据空间是一份相互隔离的数据目录:需求 / 用例 / 提示词 / 知识库 / 模板、会话与配置互不影响。列表会展示本机已登记的全部空间(含其它数据目录下的),可直接切换。`,"space.listTitle":`全部空间`,"space.newTitle":`新建空间`,"space.newDesc":`新建一份独立的数据目录;默认提示词会随空间一起创建,之后可在「提示词管理」继续修改。`,"space.addNew":`+ 新增空间`,"space.edit":`编辑`,"space.editTitle":`编辑空间`,"space.save":`保存`,"space.cancel":`取消`,"space.loading":`加载中…`,"space.detailFailed":`读取空间信息失败`,"space.updateFailed":`保存失败`,"space.updated":`已保存「{name}」`,"space.publicNameLocked":`公共空间名称不可修改`,"space.switch":`切换`,"space.nameLabel":`空间名称`,"space.namePlaceholder":`输入空间名称`,"space.create":`新建`,"space.promptBriefLabel":`提示词要求`,"space.promptBriefPlaceholder":`描述这个空间里的助手应怎样工作,Enter 或点发送生成提示词;Shift+Enter 换行`,"space.promptGenerate":`生成提示词`,"space.promptGenerating":`生成中…`,"space.promptGeneratingStatus":`正在生成提示词`,"space.promptStop":`停止生成`,"space.promptBodyLabel":`默认提示词`,"space.promptBodyPlaceholder":`将写入该空间的 默认提示词.md`,"space.promptHint":`创建后写入该空间的提示词管理,作为默认提示词。`,"space.promptBriefHint":`这段要求会随空间保存,便于之后重新生成提示词。`,"space.promptEditHint":`保存后覆盖该空间的 默认提示词.md,工作台会立即使用新提示词。`,"space.promptNeedReq":`请先填写提示词要求,再生成。`,"space.promptNeedBody":`请先填写默认提示词。`,"space.promptNeedModel":`请先在设置里配置可用的模型后再生成。`,"space.promptGenEmpty":`模型没有给出可用提示词,请重试或直接手写。`,"space.needName":`请先填写空间名称。`,"space.created":`已创建「{name}」`,"space.createdWithPrompt":`已创建「{name}」,默认提示词已写入该空间的提示词管理`,"space.name":`名称`,"space.location":`位置`,"space.size":`体积`,"space.sizeTitle":`统计各空间占用的磁盘大小`,"space.sizing":`统计中…`,"space.status":`状态`,"space.builtin":`默认`,"space.publicName":`公共空间`,"space.activeTag":`当前`,"space.missing":`目录不存在`,"space.rename":`重命名`,"space.copy":`复制`,"space.export":`导出`,"space.exportContent":`导出内容库`,"space.exportContentTitle":`不含密钥、会话、记忆与缓存,适合分享内容`,"space.exportFull":`导出备份`,"space.exportFullTitle":`含密钥、会话与全部本机状态,适合自己备份`,"space.discover":`扫描文件夹`,"space.discoverTitle":`扫描托管目录,纳入带 .lantern/space.json 清单的空间文件夹;其它文件夹列出来等你确认`,"space.discovering":`扫描中…`,"space.discoverAdded":`已纳入 {n} 个空间`,"space.discoverNone":`没有发现可纳入的空间文件夹`,"space.discoverBackfilled":`并为 {n} 个已有空间补写了 space.json 清单`,"space.discoverSkipped":`跳过 {n} 个(重名、名称非法或缺空间元数据)`,"space.candidatesTitle":`扫描到 {n} 个不是数据空间的文件夹,要纳入吗?`,"space.candidatesHint":`勾选后纳入列表;不会写入空间清单(.lantern/space.json),文件夹内容保持原样。`,"space.candidatesSelectAll":`全选`,"space.candidatesClear":`全不选`,"space.candidatesIgnore":`忽略`,"space.candidatesIgnored":`已忽略,未纳入任何文件夹`,"space.candidatesAdopt":`纳入所选`,"space.candidatesAdopted":`已纳入 {n} 个文件夹`,"space.candidatesRejected":`未纳入:{names}`,"space.removeList":`移出列表`,"space.deleteDisk":`删除数据`,"space.import":`导入`,"space.refresh":`刷新`,"space.empty":`还没有自定义空间,点「+ 新增空间」开始。`,"space.newParentHint":`新建的空间会落在:`,"space.switching":`正在切换…`,"space.reloadHint":`切换后页面会自动重载。`,"space.confirmRemoveTitle":`移出列表`,"space.confirmRemoveMsg":`将从列表中移除「{name}」,磁盘数据保留在:
|
|
2
|
-
{path}
|
|
3
|
-
之后可在管理界面重新纳入。`,"space.confirmDeleteTitle":`删除数据`,"space.confirmDeleteMsg":`将永久删除「{name}」及其全部数据,无法恢复:
|
|
4
|
-
{path}`,"space.confirmCopyTitle":`复制空间`,"space.confirmCopyMsg":`将复制「{name}」的全部内容到新空间,文件较多时可能耗时较久。`,"space.done":`完成`,"space.copyName":`副本名称`,"space.importPick":`选择要导入的 zip 备份`,"space.othersEmpty":`还没有其他空间。可点下方「管理空间」新建或导入。`,"space.busyRuns":`仍有会话在运行,请先停止后再切换空间。`,"space.publicLocked":`公共空间不支持重命名或删除。`,"space.offline":`工作区不可用`,"space.offlineCap":`未连接本地服务`,"settings.general":`通用设置`,"settings.model":`模型`,"settings.builtin":`内置插件`,"settings.builtinDesc":`由平台按会话或全局提供,默认常开,不需要开关。`,"settings.close":`关闭`,"settings.access":`权限`,"settings.accessDesc":`选择新会话的默认权限模式`,"settings.language":`语言`,"settings.appearance":`外观`,"settings.appear.light":`浅色`,"settings.appear.dark":`深色`,"settings.appear.system":`跟随系统`,"settings.fontSize":`字号大小`,"settings.fontSizeDesc":`调整正文与会话内容的字号(不影响侧栏布局)`,"settings.toolSteps":`工作步骤展示`,"settings.toolStepsDesc":`选择希望看到多少工具调用细节`,"settings.busySend":`繁忙时的发送行为`,"settings.busySendDesc":`智能体运行时 Enter 键和发送按钮的行为;Cmd/Ctrl+Enter 使用另一行为`,"settings.busySend.queue":`排队发送`,"settings.busySend.interrupt":`插话发送`,"settings.subagentModel":`子代理模型`,"settings.subagentModelDesc":`子代理默认跟随主会话模型;可改为当前提供商下的其它模型`,"settings.subagentModel.inherit":`跟随主会话`,"settings.platformVersion":`平台版本`,"settings.updateCheck":`检查更新`,"settings.updateChecking":`检查中`,"settings.updateLatest":`已是最新版本`,"settings.updateAvailable":`有新版本可用`,"settings.updateNow":`更新并重启`,"settings.updateInstalling":`正在安装 v{v},完成后服务会自动重启…`,"settings.updateWorking":`更新中…`,"settings.updateRestarting":`正在重启服务…`,"settings.updateDone":`已更新到 v{v}`,"settings.updateReload":`刷新页面`,"settings.updateFailed":`更新失败`,"settings.updateRetry":`重试`,"settings.updateDevMode":`源码模式不支持页面内更新,请 git pull 后重新构建`,"settings.updateNpxHint":`将通过全局安装后重启(不再使用 npx 缓存)`,"settings.updateUnavailable":`无法检查更新`,"settings.updateCheckedAt":`上次检查 {time}`,"settings.updateLog":`日志:{path}`,"settings.updateTimeout":`等待服务重启超时,请刷新页面确认版本`,"settings.updateConfirm":`更新会停止当前服务、全局安装新版本后自动重启,页面会短暂断开。`,"settings.access.readonly":`仅可查看`,"settings.access.readwrite":`工作区内修改`,"settings.access.full":`完全权限`,"settings.step.concise":`简洁`,"settings.step.standard":`标准`,"settings.step.detailed":`详细`,"settings.step.full":`完全展开`,"settings.modelIntro":`填入各提供商的 API 密钥即可使用其模型。`,"settings.edit":`编辑`,"settings.delete":`删除`,"settings.addProvider":`+ 添加模型提供商`,"settings.back":`返回`,"settings.editProvider":`编辑提供商`,"settings.addProviderTitle":`添加提供商`,"settings.cancel":`取消`,"settings.save":`保存`,"settings.displayName":`显示名称`,"settings.preset":`服务商预设`,"settings.baseUrl":`Base URL`,"settings.apiKey":`API Key`,"settings.modelField":`模型`,"settings.keyHint":`模型保存在本机 ~/.config/lantern-harness/models.json,所有空间共用,不会上传 GitHub。`,"settings.modelPlaceholder":`请输入模型名`,"settings.recognizing":`识别中…`,"settings.recognized":`已识别 {n} 个`,"settings.recognizeFail":`识别失败,可手动填模型名`,"settings.recognizeKeep":`刷新失败,沿用已有列表`,"settings.deleteConfirm":`确定删除该模型提供商?`,"chat.emptyTitle":`提灯的人不问路`,"chat.emptyNoModel":`使用前请先配置模型。`,"chat.configureModel":`配置模型`,"chat.workbench":`我的工作台`,"chat.newSession":`新会话`,"chat.workspace":`工作区`,"tool.running":`工具执行中…`,"tool.callingKind":`正在调用{kind}`,"tool.doneKind":`{kind}完成`,"tool.callingNamed":`正在调用{kind}:{name}`,"tool.doneNamed":`{kind}完成:{name}`,"tool.callingFull":`正在调用{kind}({name})…`,"tool.doneFull":`{kind}已完成({name})`,"tool.kind.kb":`知识库`,"tool.kind.fs":`本地文件`,"tool.kind.memory":`会话记忆`,"tool.kind.webSearch":`网页搜索`,"tool.kind.webFetch":`网页获取`},i={"zh-CN":r,en:{"nav.home":`My Workbench`,"nav.dashboard":`Dashboard`,"nav.tasks":`Tasks`,"nav.todos":`Todos`,"nav.projects":`Projects`,"nav.iterations":`Iterations`,"nav.requirementsMgmt":`Requirements Mgmt`,"nav.bugs":`Bugs`,"nav.reports":`Work Report`,"nav.testStats":`Test Statistics`,"nav.caseExec":`Case Execution`,"nav.uiAuto":`Automation Testing`,"nav.reqAnalysis":`Requirement Analysis`,"nav.requirements":`Requirements`,"nav.caseManage":`Test Cases`,"nav.cases":`Cases`,"nav.templates":`Test Templates`,"nav.docs":`Documents`,"nav.createGroup":`New group`,"nav.createSubgroup":`New subgroup`,"nav.assignGroup":`Join group`,"nav.more":`More actions`,"nav.groupActions":`Group actions`,"nav.addSubgroup":`Add subgroup`,"nav.addToGroup":`Add to group`,"nav.chooseIcon":`Choose icon`,"nav.leaveGroup":`Remove from group`,"nav.currentGroup":`Current`,"nav.noGroups":`No groups yet`,"nav.noOtherGroups":`No other groups`,"nav.noAddableItems":`Nothing to add`,"nav.editGroup":`Edit`,"nav.editGroupTitle":`Edit group`,"nav.sortMenu":`Sort`,"nav.sortMenuTitle":`Sort menu`,"nav.sortHint":`Drag to reorder`,"nav.subgroups":`Subgroups`,"nav.sortUp":`Move up`,"nav.sortDown":`Move down`,"nav.done":`Done`,"nav.deleteGroup":`Ungroup`,"nav.deleteGroupMsg":`Ungrouped items will be shown flat in the menu.`,"nav.deleteSubgroupMsg":`Ungrouping this subgroup returns its items to the parent group.`,"nav.groupName":`Group name`,"nav.groupItems":`Choose menu items`,"nav.groupItemsHint":`Items already in another group are hidden.`,"nav.groupNameRequired":`Enter a group name`,"nav.groupItemsRequired":`Select at least one item`,"nav.groupSave":`Save`,"nav.groupCancel":`Cancel`,"nav.prompts":`Prompts`,"nav.knowledge":`Knowledge Mgmt`,"nav.plugins":`My Plugins`,"nav.brand":`Lantern Harness`,"nav.settings":`Settings`,"nav.changelog":`Changelog`,"nav.changelogShort":`Changelog`,"nav.helpCenter":`Help Center`,"docs.nav.title":`Docs`,"docs.nav.changelog":`Changelog`,"docs.nav.manual":`User Guide`,"docs.nav.install":`Install Guide`,"nav.repo":`GitHub`,"nav.repoShort":`Repo`,"nav.npm":`npm package`,"nav.npmShort":`npm`,"nav.site":`Yycy Docs`,"nav.siteShort":`Site`,"nav.board":`Questions & suggestions`,"nav.boardShort":`Suggestions`,"space.label":`Data space`,"space.current":`Current space`,"space.switchTo":`Switch to this space`,"space.manage":`Manage spaces`,"space.others":`Other spaces`,"space.manageTitle":`Spaces`,"space.manageDesc":`Each data space is a fully isolated data directory: requirements, cases, prompts, knowledge, templates, sessions and config never leak across spaces.`,"space.listTitle":`All spaces`,"space.newTitle":`New space`,"space.newDesc":`Create an isolated data directory. The default prompt is created with the space and can be edited later in Prompt management.`,"space.addNew":`+ New space`,"space.edit":`Edit`,"space.editTitle":`Edit space`,"space.save":`Save`,"space.cancel":`Cancel`,"space.loading":`Loading…`,"space.detailFailed":`Failed to load space info`,"space.updateFailed":`Save failed`,"space.updated":`Saved "{name}"`,"space.publicNameLocked":`The public space name cannot be changed`,"space.switch":`Switch`,"space.nameLabel":`Space name`,"space.namePlaceholder":`Enter a space name`,"space.create":`Create`,"space.promptBriefLabel":`Prompt requirements`,"space.promptBriefPlaceholder":`Describe how the assistant should work. Enter or send to generate; Shift+Enter for a new line`,"space.promptGenerate":`Generate prompt`,"space.promptGenerating":`Generating…`,"space.promptGeneratingStatus":`Generating prompt`,"space.promptStop":`Stop generating`,"space.promptBodyLabel":`Default prompt`,"space.promptBodyPlaceholder":`Saved as 默认提示词.md in this space`,"space.promptHint":`Saved to this space’s Prompt management as the default prompt.`,"space.promptBriefHint":`Saved with the space so you can regenerate the prompt later.`,"space.promptEditHint":`Saving overwrites this space’s 默认提示词.md; the workbench uses it immediately.`,"space.promptNeedReq":`Write prompt requirements before generating.`,"space.promptNeedBody":`Fill in the default prompt first.`,"space.promptNeedModel":`Configure a working model in Settings before generating.`,"space.promptGenEmpty":`The model returned an empty prompt. Retry, or write one yourself.`,"space.needName":`Enter a space name first.`,"space.created":`Created "{name}"`,"space.createdWithPrompt":`Created "{name}". The default prompt is in Prompt management.`,"space.name":`Name`,"space.location":`Location`,"space.size":`Size`,"space.sizeTitle":`Measure disk usage for each space`,"space.sizing":`Measuring…`,"space.status":`Status`,"space.builtin":`Default`,"space.publicName":`Public space`,"space.activeTag":`Active`,"space.missing":`Directory missing`,"space.rename":`Rename`,"space.copy":`Copy`,"space.export":`Export`,"space.exportContent":`Export content`,"space.exportContentTitle":`Excludes keys, sessions, memories and caches — safe to share`,"space.exportFull":`Export backup`,"space.exportFullTitle":`Includes keys, sessions and all local state — for your own backup`,"space.discover":`Scan folder`,"space.discoverTitle":`Scan the managed folder for space folders carrying a .lantern/space.json manifest; other folders are listed for your confirmation`,"space.discovering":`Scanning…`,"space.discoverAdded":`Adopted {n} space(s)`,"space.discoverNone":`No adoptable space folder found`,"space.discoverBackfilled":`Wrote space.json manifests for {n} existing space(s)`,"space.discoverSkipped":`Skipped {n} (name conflict, invalid name, or missing space metadata)`,"space.candidatesTitle":`Found {n} folder(s) that are not spaces. Adopt them?`,"space.candidatesHint":`Checked folders are added to the list. No space manifest (.lantern/space.json) is written; folder contents stay untouched.`,"space.candidatesSelectAll":`Select all`,"space.candidatesClear":`Select none`,"space.candidatesIgnore":`Ignore`,"space.candidatesIgnored":`Ignored — nothing was adopted`,"space.candidatesAdopt":`Adopt selected`,"space.candidatesAdopted":`Adopted {n} folder(s)`,"space.candidatesRejected":`Not adopted: {names}`,"space.removeList":`Unlist`,"space.deleteDisk":`Delete data`,"space.import":`Import`,"space.refresh":`Refresh`,"space.empty":`No custom space yet — click "New space" to start.`,"space.newParentHint":`New spaces are created under:`,"space.switching":`Switching…`,"space.reloadHint":`The page reloads automatically after switching.`,"space.confirmRemoveTitle":`Remove from list`,"space.confirmRemoveMsg":`This removes "{name}" from the list but keeps its data on disk:
|
|
5
|
-
{path}
|
|
6
|
-
It can be added back later.`,"space.confirmDeleteTitle":`Delete data`,"space.confirmDeleteMsg":`This permanently deletes "{name}" and all of its data, with no way to undo:
|
|
7
|
-
{path}`,"space.confirmCopyTitle":`Copy space`,"space.confirmCopyMsg":`All content of "{name}" will be copied into a new space. This can take a while for large spaces.`,"space.done":`Done`,"space.copyName":`New copy name`,"space.importPick":`Choose a zip backup to import`,"space.othersEmpty":`No other spaces yet. Open Manage spaces below to create or import one.`,"space.busyRuns":`A session is still running. Stop it before switching spaces.`,"space.publicLocked":`The built-in public space cannot be renamed or deleted.`,"space.offline":`Workspace unavailable`,"space.offlineCap":`Local service offline`,"settings.general":`General`,"settings.model":`Models`,"settings.builtin":`Built-in`,"settings.builtinDesc":`Provided by the platform per session or globally; always on, no toggle.`,"settings.close":`Close`,"settings.access":`Permissions`,"settings.accessDesc":`Default permission mode for new sessions`,"settings.language":`Language`,"settings.appearance":`Appearance`,"settings.appear.light":`Light`,"settings.appear.dark":`Dark`,"settings.appear.system":`System`,"settings.fontSize":`Font size`,"settings.fontSizeDesc":`Body and session text size (sidebar layout stays fixed)`,"settings.toolSteps":`Tool step detail`,"settings.toolStepsDesc":`How much tool-call detail to show`,"settings.busySend":`Send while busy`,"settings.busySendDesc":`Enter / Send while the agent is running; Cmd/Ctrl+Enter uses the other action`,"settings.busySend.queue":`Queue`,"settings.busySend.interrupt":`Interrupt`,"settings.subagentModel":`Subagent model`,"settings.subagentModelDesc":`Subagents inherit the main chat model by default; pick another from the active provider`,"settings.subagentModel.inherit":`Follow main chat`,"settings.platformVersion":`Platform version`,"settings.updateCheck":`Check for updates`,"settings.updateChecking":`Checking`,"settings.updateLatest":`Up to date`,"settings.updateAvailable":`Update available`,"settings.updateNow":`Update & restart`,"settings.updateInstalling":`Installing v{v}, the service will restart automatically…`,"settings.updateWorking":`Updating…`,"settings.updateRestarting":`Restarting service…`,"settings.updateDone":`Updated to v{v}`,"settings.updateReload":`Reload page`,"settings.updateFailed":`Update failed`,"settings.updateRetry":`Retry`,"settings.updateDevMode":`Source mode cannot update in-page; run git pull and rebuild`,"settings.updateNpxHint":`Will install globally and restart (stop using the npx cache)`,"settings.updateUnavailable":`Unable to check for updates`,"settings.updateCheckedAt":`Last checked: {time}`,"settings.updateLog":`Log: {path}`,"settings.updateTimeout":`Timed out waiting for restart; reload the page to confirm the version`,"settings.updateConfirm":`Updating stops the current service, installs globally and restarts; the page disconnects briefly.`,"settings.access.readonly":`View only`,"settings.access.readwrite":`Edit in workspace`,"settings.access.full":`Full access`,"settings.step.concise":`Concise`,"settings.step.standard":`Standard`,"settings.step.detailed":`Detailed`,"settings.step.full":`Full`,"settings.modelIntro":`Add each provider’s API key to use its models.`,"settings.edit":`Edit`,"settings.delete":`Delete`,"settings.addProvider":`+ Add model provider`,"settings.back":`Back`,"settings.editProvider":`Edit provider`,"settings.addProviderTitle":`Add provider`,"settings.cancel":`Cancel`,"settings.save":`Save`,"settings.displayName":`Display name`,"settings.preset":`Provider preset`,"settings.baseUrl":`Base URL`,"settings.apiKey":`API Key`,"settings.modelField":`Model`,"settings.keyHint":`Models are saved in ~/.config/lantern-harness/models.json and shared across spaces; never pushed to GitHub.`,"settings.modelPlaceholder":`Enter model id`,"settings.recognizing":`Detecting…`,"settings.recognized":`{n} models found`,"settings.recognizeFail":`Detection failed — enter a model id manually`,"settings.recognizeKeep":`Refresh failed — keeping previous list`,"settings.deleteConfirm":`Delete this model provider?`,"chat.emptyTitle":`Those who carry the lantern do not ask the way.`,"chat.emptyNoModel":`Configure a model to get started.`,"chat.configureModel":`Configure model`,"chat.workbench":`My Workbench`,"chat.newSession":`New chat`,"chat.workspace":`Workspace`,"tool.running":`Running tool…`,"tool.callingKind":`Calling {kind}`,"tool.doneKind":`{kind} done`,"tool.callingNamed":`Calling {kind}: {name}`,"tool.doneNamed":`{kind} done: {name}`,"tool.callingFull":`Calling {kind} ({name})…`,"tool.doneFull":`{kind} finished ({name})`,"tool.kind.kb":`knowledge base`,"tool.kind.fs":`local files`,"tool.kind.memory":`memory`,"tool.kind.webSearch":`web search`,"tool.kind.webFetch":`web fetch`}};function a(e,n,r){let a=i[r??(typeof window<`u`?t().language:`zh-CN`)]?.[e]??i[`zh-CN`][e]??e;if(n)for(let[e,t]of Object.entries(n))a=a.replaceAll(`{${e}}`,String(t));return a}function o(e){if(typeof document>`u`)return;let n=e??t().language;document.documentElement.lang=n===`en`?`en`:`zh-CN`,document.querySelectorAll(`[data-i18n]`).forEach(e=>{let t=e.dataset.i18n;t&&t in r&&(e.textContent=a(t,void 0,n))}),document.querySelectorAll(`[data-i18n-hint]`).forEach(e=>{let t=e.dataset.i18nHint;t&&t in r&&(e.dataset.hint=a(t,void 0,n))})}export{a as n,n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,i as t,p as n}from"./app-config.CF1xVPmo.js";import{o as r}from"./settings.B1yetppp.js";var i=`/__tb_sessions`,a=`tw-chat-sessions`,o=`tw-chat-active-id`,s=`tw-chat-history`,c=`tw-session-rail-open`,l=!1,u=null;function d(){return`s_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function f(e){let t=Date.now();return{id:d(),title:`新对话`,createdAt:t,updatedAt:t,archived:!1,pinned:!1,messages:[],...e}}function p(e){let t=(e.find(e=>e.role===`user`&&(e.content??``).trim())?.content??``).trim().replace(/\s+/g,` `);return t?t.length>24?`${t.slice(0,24)}…`:t:`新对话`}function m(){try{let e=localStorage.getItem(s);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function h(e){if(!e)return null;let t=(Array.isArray(e.sessions)?e.sessions:[]).filter(e=>!e.deleted);return t.length?{sessions:t,activeId:typeof e.activeId==`string`&&t.some(t=>t.id===e.activeId)?e.activeId:t.find(e=>!e.archived)?.id??t[0].id}:null}function g(){return n(a)}function _(){return n(o)}function v(){try{let e=localStorage.getItem(g());return e?h(JSON.parse(e)):null}catch{return null}}function y(e){try{localStorage.setItem(g(),JSON.stringify(e)),localStorage.setItem(_(),e.activeId)}catch{}}function b(){let e=m(),t=f({title:e.length?p(e):`新对话`,messages:e}),n={sessions:[t],activeId:t.id};try{localStorage.removeItem(s)}catch{}return n}async function x(e){let t=e?.preferSessionId?.trim()||``,n=v();try{let e=await fetch(i,{signal:AbortSignal.timeout(2e3)});if(e.ok){let r=await e.json();l=!0;let i=h(r.store??null);if(!i){let e=t&&n?n.sessions.find(e=>e.id===t):void 0;i=e?{sessions:[e],activeId:t}:b(),await C(i)}else if(t&&n&&!i.sessions.some(e=>e.id===t)){let e=n.sessions.find(e=>e.id===t);e?(i={...i,sessions:[e,...i.sessions],activeId:t},await C(i)):y(i)}else t&&i.sessions.some(e=>e.id===t)&&(i={...i,activeId:t}),y(i);return i}}catch{}return l=!1,n??b()}function S(){return v()??b()}async function C(e){if(y(e),l)try{await fetch(i,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({store:e})})}catch{}}function w(e){y(e),u&&clearTimeout(u),u=setTimeout(()=>{u=null,C(e)},320)}async function T(e){u&&=(clearTimeout(u),null),await C(e)}async function E(){if(!l)return null;try{let e=await fetch(i,{signal:AbortSignal.timeout(2e3)});return e.ok?h((await e.json()).store??null):null}catch{return null}}function D(e,t){let n=/<!--tb-schedule:([^>]+)-->/,r=!1,i=e.sessions.map(e=>{let i=t.sessions.find(t=>t.id===e.id);if(!i||!Array.isArray(i.messages))return e;let a=Array.isArray(e.messages)?[...e.messages]:[],o=new Set;for(let e of a){let t=e&&typeof e==`object`&&`content`in e?String(e.content??``):``,r=n.exec(t);r?.[1]&&o.add(r[1]);let i=e&&typeof e==`object`&&`scheduleId`in e?String(e.scheduleId??``):``;i&&o.add(i)}let s=!1;for(let e of i.messages){let t=e&&typeof e==`object`&&`content`in e?String(e.content??``):``,r=n.exec(t);r?.[1]&&!o.has(r[1])&&(a.push(e),o.add(r[1]),s=!0)}return s?(r=!0,{...e,messages:a,updatedAt:Date.now()}):e});return r?{...e,sessions:i}:e}function O(e,t){let n=f({workspacePath:t?.workspacePath,access:t?.access});return{sessions:[n,...e.sessions],activeId:n.id}}function k(e,t,n){return{...e,sessions:e.sessions.map(e=>e.id===t?{...e,workspacePath:n||void 0,updatedAt:Date.now()}:e)}}function A(e,t,n){let r=n.trim()||`未命名`;return{...e,sessions:e.sessions.map(e=>e.id===t?{...e,title:r,updatedAt:Date.now()}:e)}}function j(e,t,n=!0){return{...e,sessions:e.sessions.map(e=>e.id===t?n&&e.archived?{...e,pinned:!0,archived:!1,updatedAt:Date.now()}:{...e,pinned:n,updatedAt:Date.now()}:e)}}function M(e,t){let n=e.sessions.filter(e=>e.id!==t);if(!n.length){let e=f();return{sessions:[e],activeId:e.id}}return{sessions:n,activeId:e.activeId===t?n.find(e=>!e.archived&&!e.deleted)?.id??n[0].id:e.activeId}}function N(e,t,n=!0){let r=e.sessions.map(e=>e.id===t?{...e,archived:n,deleted:!n&&e.deleted,pinned:!n&&e.pinned,updatedAt:Date.now()}:e),i=e.activeId;return n&&i===t&&(i=r.find(e=>!e.archived&&!e.deleted)?.id??r[0].id),{sessions:r,activeId:i}}function P(e,t){return{...e,sessions:e.sessions.map(e=>e.workspacePath===t?{...e,workspacePath:void 0,updatedAt:Date.now()}:e)}}function F(e){return!(e.archived||e.deleted||e.pinned||Array.isArray(e.messages)&&e.messages.length>0)}function I(e,t,n){let r=e;for(let i of e.sessions)t&&i.id===t||F(i)&&(n?.(i.id)||(r=M(r,i.id)));return t&&r.sessions.some(e=>e.id===t)&&r.activeId!==t&&(r={...r,activeId:t}),r}function L(e,t,n,r){let i=r?.touchUpdatedAt!==!1;return{...e,sessions:e.sessions.map(e=>{if(e.id!==t)return e;let a=r?.touchTitle&&(e.title===`新对话`||!e.title)||e.title===`新对话`?p(n):e.title;return{...e,messages:n.slice(-80),title:a,updatedAt:i?Date.now():e.updatedAt}})}}function R(e,t,n){return L(e,e.activeId,t,n)}function z(e){return Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.role!==`assistant`||!Array.isArray(t.activitySteps)||!t.activitySteps.some(e=>e.status===`running`)?e:{...t,activitySteps:t.activitySteps.map(e=>e.status===`running`?{...e,status:`done`}:e)}}):e}function B(e){let t=!1,n=e.sessions.map(e=>{let n=z(e.messages);return n===e.messages?e:(t=!0,{...e,messages:n})});return t?{...e,sessions:n}:e}function V(e,t,n){return{...e,sessions:e.sessions.map(e=>{if(e.id!==t)return e;let r=[...Array.isArray(e.messages)?e.messages:[],n].slice(-80);return{...e,messages:r,updatedAt:Date.now()}})}}function H(e,t,n){return{...e,sessions:e.sessions.map(e=>e.id===t?{...e,...n,updatedAt:Date.now()}:e)}}function U(e,t){return H(e,e.activeId,t)}function W(e,t){return e.sessions.some(e=>e.id===t)?{...e,activeId:t}:e}function G(e){return[...e].sort((e,t)=>{let n=+!!e.pinned,r=+!!t.pinned;return n===r?t.updatedAt-e.updatedAt:r-n})}function K(){try{return localStorage.getItem(n(c))!==`0`}catch{return!0}}function q(e){try{localStorage.setItem(n(c),e?`1`:`0`)}catch{}}function J(t){let n=e();return n?`tb:session-handoff:${n}:${t}`:`tb:session-handoff:${t}`}function Y(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/^\/+/,``)}function X(e,t,n){return e.sessions.find(e=>{if(t===`cases`){let t=e.caseGen?.linkedCasePath;return!!(t&&Y(t)===n)}let r=t===`prompts`?e.promptGen?.linkedPromptPath:e.knowledgeGen?.linkedKnowledgePath;return!!(r&&Y(r)===n)})}async function Z(e,n){await x().catch(()=>null),await t().catch(()=>null);let i=S(),a=Y(n.path),o=X(i,e,a);if(o||=(i=O(i,{access:r()}),await T(i),i.sessions.find(e=>e.id===i.activeId)),!o)throw Error(`无法创建或定位会话`);try{let e=i.sessions.find(e=>e.id===o.id)??o;sessionStorage.setItem(J(o.id),JSON.stringify({session:e}))}catch{}let s=new URLSearchParams({session:o.id,focusRoot:e,focusPath:a,attachRoot:e,attachPath:a,attachName:n.name});window.location.href=`/workbench/?${s.toString()}`}export{W as C,U as D,R as E,L as O,G as S,P as T,A as _,k as a,z as b,E as c,F as d,K as f,I as g,j as h,N as i,H as k,T as l,D as m,J as n,O as o,S as p,V as r,M as s,Z as t,x as u,q as v,p as w,B as x,w as y};
|
|
@@ -1,14 +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 ee(){return(await u(`/list`)).docs??[]}async function f(e){return(await u(`/create`,{method:`POST`,body:JSON.stringify(e)})).doc}async function p(e,t){return(await u(`/`,{method:`PUT`,body:JSON.stringify({id:e,...t})})).doc}async function m(e){await u(`/delete`,{method:`POST`,body:JSON.stringify({id:e})})}async function h(){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 g(e){return await u(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function _(e){return(await b(e)).content}async function v(e,t=2e4){try{let n=(await _(e)).trim();return{text:n.slice(0,t),total:n.length,truncated:n.length>t}}catch{return{text:``,total:0,truncated:!1}}}async function y(){return(await u(`/sources`)).files??[]}async function b(e){return u(`/source?path=${encodeURIComponent(e)}`)}var x=/[\s\p{P}\p{S}]+/gu;function S(e){return String(e??``).toLowerCase().replace(x,``)}function C(e){return Array.from(new Set(e.map(e=>String(e??``).trim()).filter(Boolean)))}function w(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function T(e,t=30,n=500){return Array.isArray(e)?e.map(e=>w(e,n)).filter(Boolean).slice(0,t):[]}function E(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 te(e){return E(String(e??``))}function D(e,t=80){return String(e??``).replace(/\s+/g,` `).trim().slice(0,t)}function ne(e){let t=String(e.sourceTitle||e.sourcePath||``).trim();if(t){let e=t.split(/[/\\]/).pop()?.trim();if(e)return e}return String(e.title||``).trim()||`未命名文档`}function O(e){let t=String(e??``).replace(/\r\n/g,`
|
|
2
|
-
`).trim();if(!t||!t.split(`
|
|
3
|
-
`).find(e=>/大模块/.test(e)&&/小模块/.test(e)))return[];let n=[],r=new Set;for(let e of t.split(`
|
|
4
|
-
`)){if(/^大模块/.test(e))continue;let t=e.match(/^"?([^,"\n]{1,40})"?,"?([^,"\n]{1,40})"?,("?[^,\n]*)/);if(!t)continue;let i=t[1].trim(),a=t[2].trim();if(!a||a===`小模块`||i===`大模块`||/[。;;]/.test(a)||a.length>30||r.has(a))continue;r.add(a);let o=D((t[3]||``).replace(/^"/,``).match(/【([^】\n]{1,40})】/)?.[1]||a);o&&n.push({big:i,small:a,title:o})}return n}function k(e){return O(e).map(e=>e.small)}function A(e){let t=O(e);if(!t.length)return``;let n=e=>/[,"\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=[`Ideal 小模块行序(用例「子模块 / 小模块」填下列原文;最终文件按此序排列,优先于用户故事 US 编号):`,`大模块,小模块,优化/问题内容`];for(let e of t)r.push(`${n(e.big)},${n(e.small)},【${e.title}】`);return r.join(`
|
|
5
|
-
`)}var j=`需求章节顺序`;function M(e){let t=String(e??``).replace(/\r\n/g,`
|
|
6
|
-
`).trim();if(!t)return[];let n=[],r=new Set,i=/^(概述|简介|目录|修订|附录|背景|术语|参考)/;for(let e of t.matchAll(/^#{2,3}\s+(.+?)\s*$/gm)){let t=D(e[1]??``);!t||t.length>40||i.test(t)||r.has(t)||(r.add(t),n.push(t))}return n}function N(e){let t=String(e??``).replace(/\r\n/g,`
|
|
7
|
-
`),n=t.indexOf(j);if(n<0)return[];let r=t.slice(n,n+4e3),i=[],a=new Set;for(let e of r.matchAll(/^\s*\d+[.)、]\s*(.+?)\s*$/gm)){let t=D(e[1]??``);!t||t.length>40||a.has(t)||(a.add(t),i.push(t))}return i}function P(e){let t=k(e);if(t.length)return t;let n=N(e);if(n.length)return n;let r=I(e);return r.length?r:M(e)}function F(e){let t=A(e);if(t)return t;let n=P(e);return n.length<2?``:[`${j}(用例「模块 / 子模块 / 标题」应对齐下列原文;最终文件按此序排列,优先于用户故事 US 编号):`,...n.map((e,t)=>`${t+1}. ${e}`)].join(`
|
|
8
|
-
`)}function I(e){let t=O(e);if(t.length)return t.map(e=>e.title);let n=String(e??``).replace(/\r\n/g,`
|
|
9
|
-
`).trim(),r=[],i=new Set;for(let e of n.matchAll(/【([^】\n]{1,40})】/g)){let t=D(e[1]??``);!t||t.length>24||i.has(t)||(i.add(t),r.push(t))}return r}function L(e,t,n){return`g_${E(`${e}|${t}|${n}`)}`}function R(e){let t=e&&typeof e==`object`?e:{},n=w(t.priority,4);return{id:w(t.id,20),title:w(t.title,200),role:w(t.role,120),goal:w(t.goal,500),value:w(t.value,500),sourceRefs:T(t.sourceRefs,20,40),priority:n===`P0`||n===`P1`||n===`P2`?n:`P1`,preconditions:T(t.preconditions),mainFlow:(Array.isArray(t.mainFlow)?t.mainFlow:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{actor:w(t.actor,80),action:w(t.action,500),result:w(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:w(t.name,120)||`替代流程`,trigger:w(t.trigger,500),steps:T(t.steps,20)}}).slice(0,20),exceptions:(Array.isArray(t.exceptions)?t.exceptions:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{scenario:w(t.scenario,500),expected:w(t.expected,500)}}).filter(e=>e.scenario).slice(0,30),postconditions:T(t.postconditions),acceptance:(Array.isArray(t.acceptance)?t.acceptance:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{given:w(t.given,500),when:w(t.when,500),then:w(t.then,500)}}).filter(e=>e.given||e.when||e.then).slice(0,30),dimensions:T(t.dimensions,12,40)}}function z(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 B(e){let t=e.mainFlow?.[0];return`${S(e.title)}|${t?S(`${t.action}${t.result??``}`):``}`}function V(e,t){let n=e.map(z),r=new Map(n.filter(e=>e.id).map(e=>[e.id,e])),i=new Map(n.map(e=>[B(e),e]));for(let e of t){let t=R(e);if(!t.title)continue;let a=t.id&&r.get(t.id)||i.get(B(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=C([...a.sourceRefs,...t.sourceRefs]),a.dimensions=C([...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(B(e),e)}}return n}function H(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 U(e){return e.mainFlow.some(e=>l.test(e.action))}function W(e,t,n,r,i,a){return{id:L(e,t,n),storyId:t,type:e,severity:a,title:n,detail:r,suggestion:i,origin:`rule`,selected:!1}}var G=new Set([`缺少角色`,`缺少目标`,`缺少前置条件`,`缺少主流程`,`没有异常场景`,`写操作缺少异常分支`,`缺少验收标准`,`验收标准缺 then`,`没有关联需求条目`,`只写了主流程`]);function K(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(W(`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(W(`missing-field`,e.id,`缺少角色`,`${t} 没有写清谁在用这个功能。`,`补一个来自原文的角色;原文没写就标注「推断」。`,`medium`)),e.goal||r.push(W(`missing-field`,e.id,`缺少目标`,`${t} 没有写用户要达成什么。`,`补一句用户目标(想要什么结果)。`,`medium`)),e.preconditions.length||r.push(W(`missing-field`,e.id,`缺少前置条件`,`${t} 没有前置条件。`,`补进入这条流程前必须成立的状态。`,`low`)),e.mainFlow.length||r.push(W(`missing-field`,e.id,`缺少主流程`,`${t} 没有主流程步骤。`,`按「动作 + 结果」补主流程。`,`high`)),e.sourceRefs.length||r.push(W(`missing-field`,e.id,`没有关联需求条目`,`${t} 的 sourceRefs 为空,覆盖率无法统计。`,`把这条故事挂到对应的需求条目 id 上。`,`low`)),e.exceptions.length?U(e)&&e.exceptions.length<2&&r.push(W(`missing-scenario`,e.id,`写操作缺少异常分支`,`${t} 包含写操作,但只写了 ${e.exceptions.length} 条异常。`,`补重复提交 / 并发修改 / 保存失败时的表现与回滚。`,`medium`)):r.push(W(`missing-scenario`,e.id,`没有异常场景`,`${t} 只写了顺利路径,没有异常分支。`,`至少补 3 条:输入非法、权限不足、依赖失败 / 超时。`,`high`)),!e.altFlows.length&&U(e)&&r.push(W(`missing-scenario`,e.id,`只写了主流程`,`${t} 没有替代流程:分支条件、可跳过步骤、不同入口都没覆盖。`,`按触发条件补至少一条替代路径。`,`low`)),e.acceptance.length?e.acceptance.some(e=>!e.then)&&r.push(W(`untestable-acceptance`,e.id,`验收标准缺 then`,`${t} 有 ${e.acceptance.filter(e=>!e.then).length} 条验收没有写 then。`,`补上「应该看到什么 / 查到什么」,不要停在操作步骤。`,`high`)):r.push(W(`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=H(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(W(`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 q(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?G.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):S(a.title)!==S(e.title)&&(n.push({...e}),i.add(e.id)):(n.push({...e}),r.set(t,e),i.add(e.id))}return n}function J(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 Y(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 X(e,t=12e3){let n=String(e??``).replace(/\r\n/g,`
|
|
10
|
-
`).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(`
|
|
11
|
-
`).trim();e&&i.push({title:a,text:e}),o=[]};for(let e of n.split(`
|
|
12
|
-
`)){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?Y(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 Z(e,t){return t?`- **${e}**:${t}`:``}function Q(e){return e.filter(Boolean).map(e=>`- ${e}`)}function $(e){let t=[];t.push(`### ${e.id} ${e.title}`),t.push(``);let n=[Z(`角色`,e.role),Z(`目标`,e.goal),Z(`价值`,e.value),Z(`优先级`,e.priority),Z(`来源条目`,e.sourceRefs.join(`、`))].filter(Boolean);if(t.push(...n),n.length&&t.push(``),e.preconditions.length&&(t.push(`**前置条件**`),t.push(...Q(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(...Q(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 re(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(...$(e));return a.join(`
|
|
13
|
-
`)}function ie(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(...$(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(`
|
|
14
|
-
`)}function ae(e){return`${(e.title||e.sourcePath.split(`/`).pop()||`需求分析`).replace(/\.(md|markdown|txt)$/i,``).replace(/[\\/:*?"<>|]/g,` `).trim()||`需求分析`}-用户故事.md`}export{ie as A,_ as C,X as D,te as E,re as O,J as S,ne as T,L as _,t as a,q as b,K as c,ae as d,I as f,F as g,h,n as i,p as j,g as k,f as l,d as m,s as n,i as o,P as p,a as r,r as s,o as t,m as u,ee as v,v as w,V as x,y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/i18n.CjqQGCAI.js","_astro/react.Blvh0GOs.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as e,l as t,o as n,r,s as i,t as a,u as o}from"./app-config.CF1xVPmo.js";var s=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),c=function(e){return`/`+e},l={},u=function(e){return e.pathname.endsWith(`.css`)},d=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},f=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function f(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=c(t,n);let r=f(t),i=u(r);return d(l,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:s,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},p=[{label:`DeepSeek`,baseURL:`https://api.deepseek.com/v1`,model:``},{label:`通义千问`,baseURL:`https://dashscope.aliyuncs.com/compatible-mode/v1`,model:`qwen-plus`},{label:`OpenAI`,baseURL:`https://api.openai.com/v1`,model:`gpt-4o-mini`},{label:`自定义`,baseURL:``,model:``}],m=`tw-settings-changed`,h=`tw-open-settings`;function g(){return t()}function _(){return n()}function v(){return r().model.activeId}function y(t){let n=r(),s=[...n.model.providers],c=n.model.activeId,l=s.findIndex(e=>e.id===c);if(l<0){let e=i();s.push({id:e,name:`默认`,baseURL:t.baseURL.trim(),apiKey:t.apiKey.trim()||void 0,model:t.model.trim(),availableModels:t.availableModels}),c=e}else s[l]={...s[l],baseURL:t.baseURL.trim(),apiKey:t.apiKey.trim()||void 0,model:t.model.trim(),availableModels:t.availableModels};e(t.apiKey),o({model:{...n.model,activeId:c,reasoningEffort:t.reasoningEffort??n.model.reasoningEffort,providers:s}}),a(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(m))}function b(e,t){let n=r(),i=[...n.model.providers],s=i.findIndex(t=>t.id===e.id),c={...e,name:e.name.trim()||`未命名提供商`,baseURL:e.baseURL.trim(),model:e.model.trim(),apiKey:e.apiKey?.trim()||void 0};s>=0?i[s]=c:i.push(c);let l=t?.activate===!1&&n.model.activeId||c.id;return o({model:{...n.model,providers:i,activeId:l}}),a(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(m)),i}function x(e){let t=r(),n=t.model.providers.filter(t=>t.id!==e),i=t.model.activeId;return i===e&&(i=n[0]?.id??``),o({model:{...t.model,providers:n,activeId:i}}),a(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(m)),n}function S(e){let t=r();t.model.providers.some(t=>t.id===e)&&(o({model:{...t.model,activeId:e}}),a(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(m)))}function C(e){let t=g();t&&y({...t,...e})}var w=`tw-access-changed`;function T(){return r().access}function E(e){o({access:e}),a(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(w,{detail:e}))}function D(e){if(typeof window>`u`)return()=>{};let t=t=>{let n=t.detail;e(n??T())};return window.addEventListener(w,t),()=>window.removeEventListener(w,t)}function O(e){return window.addEventListener(m,e),()=>window.removeEventListener(m,e)}function k(e=`general`){window.dispatchEvent(new CustomEvent(h,{detail:{tab:e}}))}var A=`tw-general-prefs-changed`;function j(){return{...r().general}}function M(e){let t={...j(),...e};return t.sessionFontSize<12&&(t.sessionFontSize=12),t.sessionFontSize>22&&(t.sessionFontSize=22),o({general:t}),a(),L(t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(A,{detail:t})),t}function N(e){if(typeof window>`u`)return()=>{};let t=t=>{e(t.detail??j())};return window.addEventListener(A,t),()=>window.removeEventListener(A,t)}var P=null,F=null;function I(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function L(e=j()){if(typeof document>`u`)return;let t=document.documentElement,n=I(e.appearance);t.dataset.theme=n,t.style.colorScheme=n,t.lang=e.language===`en`?`en`:`zh-CN`;let r=`${e.sessionFontSize}px`;t.style.setProperty(`--tw-ui-font-size`,r),t.style.setProperty(`--tw-session-font-size`,r),t.style.fontSize=``,P&&F&&(P.removeEventListener(`change`,F),P=null,F=null),e.appearance===`system`&&(P=window.matchMedia(`(prefers-color-scheme: dark)`),F=()=>{let e=I(`system`);t.dataset.theme=e,t.style.colorScheme=e},P.addEventListener(`change`,F));try{f(()=>import(`./i18n.CjqQGCAI.js`).then(e=>e.t).then(t=>t.applyDomI18n(e.language)),__vite__mapDeps([0,1]))}catch{}}export{S as _,v as a,_ as c,N as d,O as f,M as g,E as h,x as i,g as l,C as m,p as n,T as o,k as p,L as r,j as s,h as t,D as u,b as v,f as y};
|