lantern-harness 0.1.45 → 0.2.3
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 +242 -0
- package/README.md +25 -8
- package/builtin/case-backup-contract.mjs +27 -0
- package/builtin/case-workflow-contract.mjs +158 -0
- package/builtin/session/lh-fs.mjs +93 -4
- package/builtin/session/lh-nav-groups.mjs +36 -1
- package/builtin/session/mcp-client.mjs +7 -3
- package/builtin/session/session-runs.mjs +5 -1
- package/builtin/session/skill-validation.mjs +72 -0
- package/builtin/session/space-layout.mjs +8 -1
- package/builtin/session/space-skills.mjs +758 -0
- package/cli/data-root.mjs +21 -4
- package/cli/lantern.mjs +26 -1
- package/cli/mcp-server.mjs +3733 -0
- package/cli/server.mjs +10 -2
- package/config/app.defaults.json +4 -2
- package/dist/500.html +14 -6
- package/dist/_astro/Base.BQf1tZMl.css +1 -0
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.Dm3O_y-S.js +2 -0
- package/dist/_astro/BusinessMapBoard.CYxHcku_.js +5 -0
- package/dist/_astro/CaseExecBoard.CK9aGPmH.js +1 -0
- package/dist/_astro/CaseExecutionBoard.C94pmIMQ.js +5 -0
- package/dist/_astro/CaseGenerateApp.D5xlk9At.js +10 -0
- package/dist/_astro/CasesLibrary.BHQC955x.js +21 -0
- package/dist/_astro/ChatApp.CIt15w_1.js +1 -0
- package/dist/_astro/ChatApp.d4a9R3YS.js +262 -0
- package/dist/_astro/{ConfirmDialog.DrrPf1MB.js → ConfirmDialog.DQFd6g2r.js} +1 -1
- package/dist/_astro/DashboardBoard.qgc1s7pG.js +5 -0
- package/dist/_astro/{DatePicker.Bkl71M49.js → DatePicker.BRO_CjVQ.js} +1 -1
- package/dist/_astro/DefectSubmitEntry.JI85N1-i.js +2 -0
- package/dist/_astro/DocsFileBrowser.z5JZ74cy.js +1 -0
- package/dist/_astro/{DocsPager.Duf4I68E.js → DocsPager.Dg765uHW.js} +1 -1
- package/dist/_astro/{DrawerField.BH3p4Q4D.js → DrawerField.CLdvmHc6.js} +1 -1
- package/dist/_astro/KnowledgeLibrary.mkShtVun.js +1 -0
- package/dist/_astro/LifeKrTasksBoard.DpAwQffE.js +1 -0
- package/dist/_astro/LifeKrTodosBoard.BIjPiZ8H.js +1 -0
- package/dist/_astro/LifeObjectivesBoard.DYwLHPEG.js +1 -0
- package/dist/_astro/LifePlanTypeSelect.CYaziESp.js +1 -0
- package/dist/_astro/{LifeReviewsBoard.BPXeVpg1.js → LifeReviewsBoard.DIxoWBDA.js} +3 -3
- package/dist/_astro/{LifeShared.tnT7aQON.js → LifeShared.DuFQsMEx.js} +2 -2
- package/dist/_astro/LifeStagesBoard.DtOri9EW.js +1 -0
- package/dist/_astro/LifeYearCycleSelect.ByJ9-PGg.js +1 -0
- package/dist/_astro/LifeYearPlansBoard.BQN07wcv.js +1 -0
- package/dist/_astro/MultiSelectDropdown.D-rbpivp.js +1 -0
- package/dist/_astro/{NamePromptDialog.Csfnh5eM.js → NamePromptDialog.KPCeXmri.js} +1 -1
- package/dist/_astro/NavLibraries.BO4ezcUc.js +1 -0
- package/dist/_astro/PluginsPage.B1VeDtLx.js +18 -0
- package/dist/_astro/PmBugsBoard.Ddl3kqqt.js +1 -0
- package/dist/_astro/PmIterationsBoard.BJN7disI.js +1 -0
- package/dist/_astro/{PmProjectDetail.DneFVBpy.js → PmProjectDetail.D78gWhqk.js} +1 -1
- package/dist/_astro/PmProjectsBoard.Bf8VB3t6.js +1 -0
- package/dist/_astro/PmRequirementsBoard.CDyNHN2a.js +1 -0
- package/dist/_astro/PmRequirementsBoard.DarfGIrL.js +1 -0
- package/dist/_astro/PmShared.TOjBbtV8.js +1 -0
- package/dist/_astro/ReportsPage.BXGduuY3.js +1 -0
- package/dist/_astro/ReqAnalysisBoard.WLtIfBg8.js +39 -0
- package/dist/_astro/RequirementBreakdownLibrary.DMoeTeqX.js +2 -0
- package/dist/_astro/RequirementsLibrary.Iv7zOqWe.js +1 -0
- package/dist/_astro/SearchableSelect.DXclLMJI.js +1 -0
- package/dist/_astro/SelectDropdown.D7IeyHDI.js +1 -0
- package/dist/_astro/SettingsDialog.BvDU9EU6.js +1 -0
- package/dist/_astro/SlideOverDrawer.CvyB-quk.js +1 -0
- package/dist/_astro/SpaceSwitcher.D9bBNQBZ.js +7 -0
- package/dist/_astro/{TableFieldConfig.C7O-mL-p.js → TableFieldConfig.DHj25OKN.js} +1 -1
- package/dist/_astro/{TagSelect.UUXgkMqJ.js → TagSelect.B_r2p0fp.js} +1 -1
- package/dist/_astro/TasksBoard.CXmGdylV.js +1 -0
- package/dist/_astro/TemplatesLibrary.DsL2q-wp.js +1 -0
- package/dist/_astro/TestReportsLibrary.BBC1TYgP.js +1 -0
- package/dist/_astro/TestStatsBoard.VXjP4hu6.js +1 -0
- package/dist/_astro/Toast.BydY-X7T.js +1 -0
- package/dist/_astro/TodosBoard.-yKgp06M.js +1 -0
- package/dist/_astro/UiAutoBoard.BD5ZyLHj.js +3 -0
- package/dist/_astro/UiAutoEnvPanel.DrHUOlmH.js +10 -0
- package/dist/_astro/UiAutoGenerationDialog.gypq1zP9.js +12 -0
- package/dist/_astro/UiAutoProjectsPage.Dhzr09E9.js +3 -0
- package/dist/_astro/app-config.BSO5r82v.js +1 -0
- package/dist/_astro/app-version.CkDFkv4s.js +1 -0
- package/dist/_astro/{bash-tools.D9HCzC_7.js → bash-tools.C4DJiRJs.js} +1 -1
- package/dist/_astro/business-map.BiJ85oxm.js +1 -0
- package/dist/_astro/business-map.DKwdW1VL.css +1 -0
- package/dist/_astro/case-fields.C03NY3zC.js +148 -0
- package/dist/_astro/case-gen-run.C4p8uyU3.js +26 -0
- package/dist/_astro/case-prompt.ByLTgz4r.js +2 -0
- package/dist/_astro/{case-review.TdDs1WFM.js → case-review.BodP2jKm.js} +2 -2
- package/dist/_astro/{case-template.Cd2xNbgy.js → case-template.CC2eXegU.js} +2 -2
- package/dist/_astro/case-types.BjF1BivA.js +1 -0
- package/dist/_astro/case-workflow-contract.BBQ9bbKL.js +1 -0
- package/dist/_astro/defect-submit.Dc49lFjm.css +1 -0
- package/dist/_astro/defect-workbench.DBmohR-y.js +6 -0
- package/dist/_astro/dialog.XgRGNF_Q.js +1 -0
- package/dist/_astro/doc-roots.C-20VD0x.js +1 -0
- package/dist/_astro/{hydrate-cache.B15Nrpq0.js → hydrate-cache.CMMErx63.js} +1 -1
- package/dist/_astro/i18n.CEWjL5GX.js +7 -0
- package/dist/_astro/{llm.DN5S1KBK.js → llm.BCYNgppW.js} +1 -1
- package/dist/_astro/mcp-tools.Kf-lupGn.js +7 -0
- package/dist/_astro/{open-docs-in-session.CRiZT022.js → open-docs-in-session.BoyV6R2A.js} +1 -1
- package/dist/_astro/plugins.ChGmBEkF.js +1 -0
- package/dist/_astro/project-docs.BRgNjXhG.js +1 -0
- package/dist/_astro/prompts-meta.VAjE4OET.js +2 -0
- package/dist/_astro/report-prompt.CwHuOcRN.js +1 -0
- package/dist/_astro/req-analysis.BLvcktvQ.js +31 -0
- package/dist/_astro/requirement-breakdown-library.l0rPd7b3.js +1 -0
- package/dist/_astro/{settings.38J2uD5M.js → settings.BojKNwUC.js} +2 -2
- package/dist/_astro/space-skills.CPucW8zt.js +1 -0
- package/dist/_astro/{spaces-client.DV04tRyD.js → spaces-client.B28rzu8J.js} +1 -1
- package/dist/_astro/story-review.dEBWTeOW.js +7 -0
- package/dist/_astro/test-points.BuNgdNcU.js +8 -0
- package/dist/_astro/test-reports.0gr6-c_0.js +19 -0
- package/dist/_astro/ui-auto-prompt.BmO3ja2m.js +8 -0
- package/dist/_astro/ui-auto.LUcREUMe.js +1 -0
- package/dist/_astro/{view-prefs.DhdLZjGh.js → view-prefs.CWc5cQ2q.js} +1 -1
- package/dist/business-map/index.html +988 -0
- package/dist/case-exec/index.html +15 -7
- package/dist/{prompts → case-execution}/index.html +17 -9
- package/dist/cases/api/index.html +988 -0
- package/dist/cases/automation/index.html +988 -0
- package/dist/cases/functional/index.html +988 -0
- package/dist/cases/generate/index.html +14 -6
- package/dist/cases/index.html +1 -1
- package/dist/cases/library/index.html +1 -980
- package/dist/cases/other/index.html +988 -0
- package/dist/cases/performance/index.html +988 -0
- package/dist/dashboard/index.html +15 -7
- package/dist/defect-rules/index.html +695 -0
- package/dist/defect-submit/index.html +695 -0
- package/dist/defect-submit/templates/index.html +695 -0
- package/dist/docs/changelog/index.html +289 -52
- package/dist/docs/install/index.html +50 -12
- package/dist/docs/manual/index.html +230 -82
- package/dist/knowledge/index.html +15 -7
- package/dist/life/kr-tasks/index.html +15 -7
- package/dist/life/kr-todos/index.html +15 -7
- package/dist/life/objectives/index.html +15 -7
- package/dist/life/reviews/index.html +15 -7
- package/dist/life/stages/index.html +15 -7
- package/dist/life/year-plans/index.html +15 -7
- package/dist/plugins/index.html +15 -7
- package/dist/pm/bugs/index.html +15 -7
- package/dist/pm/iterations/index.html +15 -7
- package/dist/pm/projects/detail/index.html +15 -7
- package/dist/pm/projects/index.html +15 -7
- package/dist/pm/requirements/index.html +15 -7
- package/dist/reports/index.html +15 -7
- package/dist/requirement-analysis/index.html +15 -7
- package/dist/requirement-breakdowns/index.html +988 -0
- package/dist/requirements/index.html +15 -7
- package/dist/tasks/index.html +15 -7
- package/dist/templates/index.html +15 -7
- package/dist/test-automation/index.html +15 -7
- package/dist/test-automation/projects/index.html +15 -7
- package/dist/test-reports/index.html +15 -7
- package/dist/test-stats/index.html +15 -7
- package/dist/todos/index.html +15 -7
- package/dist/workbench/index.html +14 -6
- package/docs/Codex-MCP/351/233/206/346/210/220.md +340 -0
- package/docs//344/270/232/345/212/241/345/234/260/345/233/276/350/257/204/344/274/260.md +39 -0
- package/docs//344/270/232/345/212/241/345/234/260/345/233/276/350/257/206/345/210/253/351/207/215/346/236/204/346/226/271/346/241/210.md +88 -0
- package/docs//344/274/232/350/257/235/346/217/222/344/273/266.md +28 -3
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +41 -1
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +65 -17
- package/docs//346/217/222/344/273/266/344/273/223/345/272/223/344/270/216/346/212/200/350/203/275/346/225/264/345/220/210/346/226/271/346/241/210.md +187 -0
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +219 -74
- package/lh-plugins/business-map/assistant.mjs +958 -0
- package/lh-plugins/business-map/auth-paths.mjs +61 -0
- package/lh-plugins/business-map/jobs.mjs +749 -0
- package/lh-plugins/business-map/login.mjs +295 -0
- package/lh-plugins/business-map/sources.mjs +1014 -0
- package/lh-plugins/case-automation/service.mjs +921 -0
- package/lh-plugins/case-automation/store.mjs +231 -0
- package/lh-plugins/case-automation/tables.mjs +115 -0
- package/lh-plugins/case-automation-prompt.mjs +57 -0
- package/lh-plugins/case-execution/assets.mjs +180 -0
- package/lh-plugins/case-execution/files.mjs +829 -0
- package/lh-plugins/case-execution/plans.mjs +318 -0
- package/lh-plugins/case-execution/service.mjs +1026 -0
- package/lh-plugins/case-execution-prompt.mjs +36 -0
- package/lh-plugins/lh-business-map.mjs +2431 -0
- package/lh-plugins/lh-case-automation.mjs +169 -0
- package/lh-plugins/lh-case-design.mjs +456 -0
- package/lh-plugins/lh-case-execution.mjs +356 -0
- package/lh-plugins/lh-case-review.mjs +29 -11
- package/lh-plugins/lh-config.mjs +13 -0
- package/lh-plugins/lh-defect-submit.mjs +989 -0
- package/lh-plugins/lh-project-docs.mjs +55 -140
- package/lh-plugins/lh-reports.mjs +29 -57
- package/lh-plugins/lh-req-analysis.mjs +32 -3
- package/lh-plugins/lh-req-breakdown-library.mjs +1084 -0
- package/lh-plugins/lh-uiauto.mjs +625 -24
- package/lh-plugins/plugin-prompts.mjs +20 -15
- package/lh-plugins/req-analysis-revision.mjs +24 -0
- package/lh-plugins/test-points-prompt.mjs +2 -3
- package/lh-plugins/uiauto-adapters/playwright.mjs +44 -4
- package/lh-plugins/uiauto-adapters/shared.mjs +4 -0
- package/lh-plugins/uiauto-auth-setup.mjs +218 -0
- package/lh-plugins/uiauto-explorer/apps.mjs +13 -2
- package/lh-plugins/uiauto-explorer/emit-files.mjs +16 -2
- package/lh-plugins/uiauto-explorer/ir.mjs +3 -0
- package/lh-plugins/uiauto-explorer/merge.mjs +37 -1
- package/lh-plugins/uiauto-explorer/navigation-guard.mjs +255 -0
- package/lh-plugins/uiauto-explorer/runner.mjs +80 -5
- package/lh-plugins/uiauto-explorer/sessions.mjs +334 -18
- package/lh-plugins/uiauto-node.mjs +102 -11
- package/lh-plugins/uiauto-prompt.mjs +20 -15
- package/lh-plugins/uiauto-sso.mjs +407 -0
- package/package.json +5 -2
- package/skills/case-automation-bridge/SKILL.md +27 -0
- package/skills/case-execution/SKILL.md +41 -0
- package/skills/lantern-defect-submit/SKILL.md +15 -0
- package/skills/lantern-workflow/SKILL.md +95 -0
- package/skills/office/SKILL.md +26 -0
- package/dist/_astro/Base.Bkt1lrgu.css +0 -1
- package/dist/_astro/Base.astro_astro_type_script_index_0_lang.UKTVQqk7.js +0 -2
- package/dist/_astro/CaseExecBoard.DICluCbK.js +0 -1
- package/dist/_astro/CaseGenerateApp.Be3h5XPG.js +0 -10
- package/dist/_astro/CasesLibrary.Buys7Cy-.js +0 -21
- package/dist/_astro/ChatApp.D3BheKci.js +0 -227
- package/dist/_astro/DashboardBoard.Qvf8o4v1.js +0 -5
- package/dist/_astro/DocsFileBrowser.DwKBffbM.js +0 -1
- package/dist/_astro/KnowledgeLibrary.MDpMqeOd.js +0 -1
- package/dist/_astro/LifeKrTasksBoard.DsvW_S66.js +0 -1
- package/dist/_astro/LifeKrTodosBoard.D2KTqvg1.js +0 -1
- package/dist/_astro/LifeObjectivesBoard.B0cDK934.js +0 -1
- package/dist/_astro/LifePlanTypeSelect.BELDvMWU.js +0 -1
- package/dist/_astro/LifeStagesBoard.CZftLR9K.js +0 -1
- package/dist/_astro/LifeYearCycleSelect.Bw2eRbSm.js +0 -1
- package/dist/_astro/LifeYearPlansBoard.DB-RJFEl.js +0 -1
- package/dist/_astro/MultiSelectDropdown.CBC7aNOv.js +0 -1
- package/dist/_astro/NavLibraries.DdQYsZbe.js +0 -1
- package/dist/_astro/OverflowHint.CHZeFfUj.js +0 -1
- package/dist/_astro/PluginsPage.C1JnInH4.js +0 -17
- package/dist/_astro/PluginsPage.C3eEwy3K.js +0 -1
- package/dist/_astro/PmBugsBoard.CGpXUTPu.js +0 -1
- package/dist/_astro/PmIterationsBoard.BaKiFIam.js +0 -1
- package/dist/_astro/PmProjectsBoard.BxoMF9gK.js +0 -1
- package/dist/_astro/PmRequirementsBoard.-SI8VZXI.js +0 -1
- package/dist/_astro/PmRequirementsBoard.DsK6RF7Q.js +0 -1
- package/dist/_astro/PmShared.BK8kWRSV.js +0 -1
- package/dist/_astro/PromptMountDialog.mrTx3U5T.js +0 -1
- package/dist/_astro/PromptsLibrary.B_SUf47p.js +0 -1
- package/dist/_astro/ReportsPage.B9lGg1_s.js +0 -16
- package/dist/_astro/ReqAnalysisBoard.CIZKnCQH.js +0 -39
- package/dist/_astro/RequirementsLibrary.cJc-bnGQ.js +0 -1
- package/dist/_astro/SearchableSelect.SyLRS-Jj.js +0 -1
- package/dist/_astro/SelectDropdown.T3CKHaLt.js +0 -1
- package/dist/_astro/SettingsDialog.DYdtCvLc.js +0 -1
- package/dist/_astro/SpaceSwitcher.C47_S1g9.js +0 -7
- package/dist/_astro/TasksBoard.BUEg2BYk.js +0 -1
- package/dist/_astro/TemplatesLibrary.BLVIphXO.js +0 -1
- package/dist/_astro/TestReportsLibrary.DVq30Jae.js +0 -1
- package/dist/_astro/TestStatsBoard.-5BWQ6bI.js +0 -1
- package/dist/_astro/Toast.BO2NFckG.js +0 -1
- package/dist/_astro/TodosBoard.DI_lTp2e.js +0 -1
- package/dist/_astro/UiAutoBoard.ChFdgv7s.js +0 -2
- package/dist/_astro/UiAutoEnvPanel.B50q4kYb.js +0 -19
- package/dist/_astro/UiAutoGenerationDialog.CLkFAHrm.js +0 -1
- package/dist/_astro/UiAutoProjectsPage.DCsDeN5d.js +0 -3
- package/dist/_astro/app-config.DkyjuL-S.js +0 -1
- package/dist/_astro/app-version.Cy-5oZO2.js +0 -1
- package/dist/_astro/case-fields.CmePqYfh.js +0 -148
- package/dist/_astro/case-gen-run.BklG1H8k.js +0 -22
- package/dist/_astro/case-types.DlFkbZJN.js +0 -1
- package/dist/_astro/dialog.DZHZCe_T.js +0 -1
- package/dist/_astro/doc-roots.CO3IBiY6.js +0 -1
- package/dist/_astro/i18n.D_aOCHSN.js +0 -7
- package/dist/_astro/markdown-client.BS19nLL3.js +0 -62
- package/dist/_astro/plugins.BRvXWHLe.js +0 -1
- package/dist/_astro/project-docs.CCjtiFjB.js +0 -1
- package/dist/_astro/prompts-meta.BUGutlsk.js +0 -2
- package/dist/_astro/report-prompt.B9C4cv84.js +0 -1
- package/dist/_astro/req-analysis.B12_MGMQ.js +0 -31
- package/dist/_astro/story-review.D2W5tEOY.js +0 -14
- package/dist/_astro/test-reports.CuIjlEyK.js +0 -19
- package/dist/_astro/ui-auto-prompt.H9_yhau9.js +0 -9
- package/dist/_astro/ui-auto.DMv940x4.js +0 -1
|
@@ -1,31 +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{t}from"./app-version.Cy-5oZO2.js";import{b as n}from"./settings.38J2uD5M.js";var r=`org.xmind.ui.logic.right`,i=`org.xmind.topicShape.roundedRect`,a=`org.xmind.branchConnection.elbow`,o=`#94a3b8`,s=`#d0d5dd`,c=`#1c3d5a`;function l(e,t){let n=2166136261;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);let r=(n>>>0).toString(36),i=t.replace(/[^A-Za-z0-9_-]/g,``).slice(0,24);return i?`${e}-${i}-${r}`:`${e}-${r}`}function u(e,t){return{id:l(`st`,`${i}-${e}-${t}`),properties:{"shape-class":i,"line-class":a,"line-color":o,"line-width":`1`,"svg:fill":e,"fo:color":t,"border-line-color":s,"border-line-width":`1`}}}var d=u(`#1c3d5a`,`#ffffff`),f=u(`#3370ff`,`#ffffff`),ee=u(`#ffffff`,c);function te(){let e=(e,t)=>({properties:{"shape-class":i,"line-class":a,"line-color":o,"line-width":`1`,"svg:fill":e,"fo:color":t,"border-line-color":s,"border-line-width":`1`}});return{centralTopic:e(`#1c3d5a`,`#ffffff`),mainTopic:e(`#3370ff`,`#ffffff`),subTopic:{properties:{"line-class":a,"svg:fill":`#ffffff`,"fo:color":c,"line-color":o,"line-width":`1`}},map:{properties:{"svg:fill":`#ffffff`,"line-color":o}}}}async function ne(r){let{default:i}=await n(async()=>{let{default:t}=await import(`./jszip.min.Bh2Mgo40.js`).then(t=>e(t.t(),1));return{default:t}},__vite__mapDeps([0,1])),a=new i;a.file(`content.json`,JSON.stringify(r));let o=Array.isArray(r)?r:[],s=o[0]&&typeof o[0]==`object`&&o[0].id||`sheet-1`;return a.file(`metadata.json`,JSON.stringify({creator:{name:`Lantern Harness`,version:t},activeSheetId:s})),a.file(`manifest.json`,JSON.stringify({"file-entries":{"content.json":{},"metadata.json":{}}})),a.generateAsync({type:`blob`,compression:`DEFLATE`})}function p(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}var m=`/__tb_reqanalysis`,h=`需求分析提示词.md`,re=`原文结构提示词.md`,ie=`需求分析`,ae=12e3,oe=2e4,se={draft:{label:`待拆解`,tone:`gray`},decomposed:{label:`已拆解`,tone:`blue`},checked:{label:`已审查`,tone:`amber`},accepted:{label:`已验收`,tone:`green`}},ce={P0:`red`,P1:`amber`,P2:`gray`},le={"uncovered-outline":`待确认·未覆盖`,"pending-confirm":`待确认`,"missing-field":`字段缺失`,"missing-scenario":`场景遗漏`,"missing-dimension":`维度缺失`,"untestable-acceptance":`验收不可测`,conflict:`与原文冲突`,"over-split":`过度拆分`,other:`其它`},ue=new Set([`uncovered-outline`,`pending-confirm`,`conflict`,`other`]);function de(e){return ue.has(e.type)}function fe(e){return e.filter(de)}var pe={high:`高`,medium:`中`,low:`低`},me={high:`red`,medium:`amber`,low:`gray`},he=[{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:`补充跨时区时间展示、多语言文案与本地化格式。`}],ge=/创建|新增|新建|保存|提交|删除|编辑|修改|更新|上传|导入|导出|发布|审批|撤回|绑定|解绑|发送|支付|下单|配置|启停|启用|停用/;async function g(e,t){let n=await fetch(`${m}${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 _e(){try{return(await fetch(`${m}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function ve(){return(await g(`/list`)).docs??[]}async function ye(e){return(await g(`/create`,{method:`POST`,body:JSON.stringify(e)})).doc}async function be(e,t){return(await g(`/`,{method:`PUT`,body:JSON.stringify({id:e,...t})})).doc}async function xe(e){await g(`/delete`,{method:`POST`,body:JSON.stringify({id:e})})}async function Se(){try{let e=await g(`/prompt`),t=e.decompose??``,n=e.stories??``;return{file:e.file||`需求分析提示词.md`,exists:e.exists===!0,decompose:t,stories:n||t,structure:e.structure??``,audit:e.audit??``,fix:e.fix??``}}catch(e){return{file:h,exists:!1,decompose:``,stories:``,structure:``,audit:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function Ce(e){return await g(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function we(e){return(await De(e)).content}async function Te(e,t=oe){try{let n=(await we(e)).trim();return{text:n.slice(0,t),total:n.length,truncated:n.length>t}}catch{return{text:``,total:0,truncated:!1}}}async function Ee(){return(await g(`/sources`)).files??[]}async function De(e){return g(`/source?path=${encodeURIComponent(e)}`)}var Oe=/[\s\p{P}\p{S}]+/gu;function _(e){return String(e??``).toLowerCase().replace(Oe,``)}function v(e){return Array.from(new Set(e.map(e=>String(e??``).trim()).filter(Boolean)))}function y(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function b(e,t=30,n=500){return Array.isArray(e)?e.map(e=>y(e,n)).filter(Boolean).slice(0,t):[]}function ke(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 Ae(e){return ke(String(e??``))}function x(e,t=80){return String(e??``).replace(/\s+/g,` `).trim().slice(0,t)}function S(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 je(e){return x((String(e??``).split(/[/\\]/).pop()?.replace(/\.[^.]+$/,``).trim()||``).replace(/_?需求文档$/u,``).replace(/_?需求说明$/u,``).replace(/_?需求$/u,``).trim())||`未命名需求`}function C(e){return String(e.sourceTitle||e.title||``).trim()||je(e.sourcePath)}function Me(e){let t=String(e??``).split(/[/\\]/).pop()?.trim()||``;return t=t.replace(/\.(xlsx|xls|docx|doc|md|txt|csv)$/i,``),t.replace(/_?需求文档$/u,``).replace(/_?需求说明$/u,``).replace(/_?需求$/u,``).replace(/迭代版本$/u,``).replace(/版本$/u,``).trim()}function Ne(e){let t=Me(e);return t=t.replace(/v?\d+(?:\.\d+)*/gi,``),t.replace(/[\s_\-—·()()[\]【】]+/gu,``).toLowerCase()}function w(e){let t=Me(e),n=/v(\d+(?:\.\d+)*)/i.exec(t)||/(\d+(?:\.\d+)+)/.exec(t);return n?.[1]?n[1].split(`.`).map(e=>{let t=Number(e);return Number.isFinite(t)?t:0}):null}function Pe(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r]??0,i=t[r]??0;if(n!==i)return n-i}return 0}function Fe(e,t){let n=C(e),r=Ne(n),i=w(n);return!r||!i?[]:t.filter(t=>{if(t.id===e.id)return!1;let n=C(t);if(Ne(n)!==r)return!1;let a=w(n);return a?Pe(a,i)<0:!1}).sort((e,t)=>Pe(w(C(e))??[],w(C(t))??[]))}function Ie(e){let t=[];for(let n of e){let e=C(n);for(let r of B(n.outline))t.push({docId:n.id,docLabel:e,point:r})}return t}function Le(e){let t=String(e??``).toLowerCase().replace(/\s+/g,` `).trim();if(!t)return[];let n=[];for(let e of t.matchAll(/[a-z0-9_]{2,}|[\u4e00-\u9fff]{2}/gu))n.push(e[0]);let r=t.replace(/[^\u4e00-\u9fff]/g,``);for(let e=0;e<r.length-1;e++)n.push(r.slice(e,e+2));return[...new Set(n)].slice(0,80)}var Re=40,ze=7e3;function Be(e,t,n){if(!t.length)return[];let r=Math.max(1,n?.maxItems??Re),i=Math.max(200,n?.maxChars??ze),a=Le(e),o=String(e??``).toLowerCase();if(!a.length&&!o.trim())return[];let s=[];for(let e of t){let t=e.point.title||``,n=(e.point.quote||e.point.body||``).slice(0,200),r=0;t&&o.includes(t.toLowerCase())&&(r+=8),n&&n.length>=4&&o.includes(n.toLowerCase().slice(0,40))&&(r+=5);let i=Le(`${t} ${n}`);for(let e of i)a.includes(e)&&(r+=e.length>=3?2:1);r<=0||s.push({...e,score:r})}s.sort((e,t)=>t.score-e.score||e.docLabel.localeCompare(t.docLabel,`zh`)||e.point.id.localeCompare(t.point.id));let c=[],l=0;for(let e of s){if(c.length>=r)break;let t=Ve(e);if(c.length>0&&l+t.length+1>i)break;c.push(e),l+=t.length+1}return c}function Ve(e){let t=e.point.kind===`query`?`查询`:e.point.kind===`mutate`?`修改`:`子点`,n=(e.point.quote||e.point.body||``).replace(/\s+/g,` `).trim().slice(0,120);return`- [${e.docLabel}] ${e.point.id} [${t}] ${e.point.title}${n?`(${n})`:``}`}function He(e){return e.length?[`## 历史迭代需求条目(检索参考,勿当作本版文档条目 id)`,`来源版本:${[...new Set(e.map(e=>e.docLabel))].join(`、`)}。下列 id 属于历史分析,禁止写入本版 sourceRefs;仅作能力对照与延伸参考。`,...e.map(Ve)].join(`
|
|
3
|
-
`):``}function Ue(e,t){if(!e?.length)return[];let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t);e&&B(e.outline).length&&r.push(e)}return r}function We(e){let t=String(e??``).trim();return t?!!(/^"+,{2,}/.test(t)||/^,{2,}/.test(t)&&/(待开发|已开发|需求\s*,\s*高|v\d+\.\d+)/.test(t)||!/【/.test(t)&&!/^\d+[、.]/.test(t)&&/,/.test(t)&&/(待开发|已关闭|已完成|需求\s*,\s*[高低中]|v\d+\.\d+|^\d{4}年\d{1,2}月)/.test(t)):!1}function Ge(e){let t=String(e??``),n=t.search(/"\s*,{2,}/);n>=0&&(t=t.slice(0,n));let r=t.split(`
|
|
4
|
-
`),i=[];for(let e of r){if(We(e))break;let t=e.search(/"\s*,{2,}/);if(t>=0){i.push(e.slice(0,t));break}i.push(e)}return i.join(`
|
|
5
|
-
`).replace(/^"/,``).replace(/"$/,``).trim()}function Ke(e){let t=Ge(e.body).slice(0,4e3),n=x(t.match(/【([^】\n]{1,40})】/)?.[1]||e.title||e.small);return{...e,title:n||e.small,body:t||`【${n||e.small}】`}}function T(e){return String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``)}function qe(e){let t=[],n=[],r=``,i=!1,a=!0;for(let o=0;o<e.length;o+=1){let s=e[o];i?s===`"`?e[o+1]===`"`?(r+=`"`,o+=1):i=!1:r+=s:s===`"`&&a?(i=!0,a=!1):s===`,`?(n.push(r),r=``,a=!0):s===`
|
|
6
|
-
`?(n.push(r),t.push(n),n=[],r=``,a=!0):(r+=s,a=!1)}return n.push(r),(n.length>1||n[0]!==``)&&t.push(n),t}function Je(e,t){let n=String(e??``).trim(),r=((n.startsWith(`【${t}】`)?n.slice(t.length+2).trim():n.replace(/^【[^】]{1,40}】/,``).trim()).split(`
|
|
7
|
-
`).find(e=>e.trim())??``).split(/[。;;::,,、\s]/)[0]?.trim()??``;return r.length>=2?x(r,14):``}function Ye(e){let t=new Set,n=new Map;return e.map(e=>{let r=e.title||e.small,i=T(r),a=(n.get(i)??0)+1;if(n.set(i,a),a===1&&!t.has(i))return t.add(i),e;let o=Je(e.body,r),s=a,c=x(o?`${r} · ${o}`:`${r}(${s})`);for(;t.has(T(c));)s+=1,c=x(o?`${r} · ${o}(${s})`:`${r}(${s})`);return t.add(T(c)),{...e,title:c}})}function E(e){return String(e??``).toLowerCase().replace(/[\s\u3000_//||·•]+/g,``).trim()}function D(e,t){let n=E(e);return n?t.some(e=>{let t=E(e);return t&&(n===t||n.includes(t))}):!1}function O(e,t){return e.findIndex(e=>D(e,t))}var k=[`大模块`,`大类`,`一级模块`,`模块分类`],A=[`小模块`,`功能点`,`需求点`,`二级模块`,`子模块`],Xe=[`优化/问题内容`,`优化问题内容`,`问题内容`,`需求描述`,`需求内容`,`需求说明`,`功能描述`,`描述`,`优化内容`],Ze=[`模块`,`功能模块`,`所属模块`],j=[`需求内容`,`需求点`,`功能点`,`需求说明`,`功能说明`],Qe=[`字段名称`,`字段类型`,`字段定义`,`校验规则`,`输入方式`];function $e(e){return e.split(`
|
|
8
|
-
`).map(e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(/\s*\|\s*/).map(e=>e.trim())).filter(e=>e.length>=2&&e.some(e=>e))}function M(e){let t=O(e,k),n=O(e,A);return t>=0&&n>=0&&t!==n}function et(e){return Qe.filter(t=>e.some(e=>D(e,[t]))).length>=2||e.some(e=>D(e,[`字段名称`]))}function tt(e){if(et(e))return!1;let t=O(e,Ze),n=O(e,j);return!(t<0||n<0||t===n||M(e))}function nt(e){let t=e=>{let t=e.findIndex(M);return t<0?null:{headers:e[t],rows:e.slice(t+1)}};return t(qe(e))??t($e(e))}function N(e){let t=String(e??``).replace(/\r\n?/g,`
|
|
9
|
-
`).trim();if(!t)return[];let n=[];for(let e of t.split(/^(?=##\s+)/m)){let t=e.replace(/^##\s+.*\n?/,``);if(!k.some(e=>t.includes(e))||!A.some(e=>t.includes(e)))continue;let r=nt(t);if(!r)continue;let i=O(r.headers,k),a=O(r.headers,A),o=O(r.headers,Xe);o<0&&(o=Math.max(a,i)+1);for(let e of r.rows){let t=(e[i]??``).trim(),r=(e[a]??``).trim(),s=(e[o]??``).trim();r&&!D(r,A)&&(D(t,k)||/[。;;]/.test(r)||r.length>40||s&&n.push(Ke({big:t,small:r,title:r,body:s})))}}return Ye(n)}function P(e,t){let n=x(e),r=String(t??``).trim().slice(0,4e3)||n;return{title:n||e,body:r,quote:r.replace(/\s+/g,` `).slice(0,80)}}var F=`输入参数|输出参数|正常流程|扩展流程|补充说明|前置条件|优先级|提出人|附件|备注`,I=RegExp(`^(?:${F})$`),rt=RegExp(`(?:^|[||。;;\\s])(?:无\\s*)?(?:${F})(?=\\s*[||]|\\s*$)`);function it(e){let t=String(e??``).replace(/\r\n?/g,`
|
|
10
|
-
`).split(`
|
|
11
|
-
`),n=[],r=null,i=()=>{if(!r?.title){r=null;return}let e=[r.id&&`编号:${r.id}`,r.body].filter(Boolean).join(`
|
|
12
|
-
`);n.push(P(r.title,e||r.title)),r=null};for(let e of t){let t=e.trim();if(!t)continue;if(/^#{1,6}\s/.test(t)){i();continue}let n=t.match(/^([^||]{1,20})\s*[||]\s*(.*?)\s*$/);if(!n){r?.title&&t.length>4&&(r.body=r.body?`${r.body}\n${t}`:t);continue}let a=n[1].trim(),o=n[2].replace(/\s*[||]\s*$/,``).trim(),s=E(a);I.test(a)||I.test(s)?r?.title&&i():s===`编号`||s===`需求编号`||s===`功能编号`?(i(),r={title:``,body:``,id:o}):s===`功能名称`||s===`需求名称`||s===`功能点名称`?(r?.title&&i(),r??={title:``,body:``,id:``},r.title=o):(s===`功能描述`||s===`需求描述`||s===`功能说明`||s===`需求说明`)&&(r??={title:``,body:``,id:``},r.body=r.body?`${r.body}\n${o}`:o)}return i(),L(n)}function at(e,t){return e.length>=t?e.slice(0,t):[...Array(t-e.length).fill(``),...e]}function ot(e){let t=String(e??``).replace(/\r\n?/g,`
|
|
13
|
-
`).trim();if(!t)return[];let n=[],r=new Set,i=e=>{for(let t=0;t<e.length;t+=1){let i=e[t];if(!tt(i))continue;let a=i.map(E).join(`,`);if(r.has(a))continue;r.add(a);let o=O(i,Ze),s=O(i,j),c=``,l=t+1;for(;l<e.length;l+=1){let t=e[l];if(tt(t)||M(t)||et(t)||t.every(e=>!e.trim()))break;t=at(t,i.length);let r=(t[o]??``).trim(),a=(t[s]??``).trim();r?c=r:r=c;let u=a||r;if(!u||D(u,j)||/^(创建|修改|删除|优化|\d+(\.\d+)*)$/.test(u))continue;let d=a&&r&&a!==r?`${r} · ${a}`:u,f=a&&r?`【${r}】${a}`:u;n.push(P(d,f))}t=Math.max(t,l-1)}};return i(qe(t)),i($e(t)),L(n)}function L(e){let t=new Set,n=new Map;return e.map(e=>{let r=e.title,i=T(r),a=(n.get(i)??0)+1;if(n.set(i,a),a===1&&!t.has(i))return t.add(i),e;let o=Je(e.body,r),s=a,c=x(o?`${r} · ${o}`:`${r}(${s})`);for(;t.has(T(c));)s+=1,c=x(o?`${r} · ${o}(${s})`:`${r}(${s})`);return t.add(T(c)),{...e,title:c}})}function st(e){let t=N(e);if(t.length)return{schema:`ideal`,entries:t.map(e=>P(e.title||e.small,e.body||`【${e.title||e.small}】`))};let n=it(e);if(n.length>=3)return{schema:`feature-kv`,entries:n};let r=ot(e);return r.length>=3?{schema:`module-content`,entries:r}:n.length?{schema:`feature-kv`,entries:n}:r.length?{schema:`module-content`,entries:r}:null}function ct(e){let t=new Map,n=String(e??``).replace(/\r\n?/g,`
|
|
14
|
-
`),r=[...n.matchAll(/^(#{2,3})\s+\S/gm)].map(e=>e[1].length);if(!r.length)return t;let i=r.includes(3)?3:2,a=n.split(RegExp(`(?=^#{${i}}\\s+)`,`m`)).filter(e=>e.trim());for(let e of a){let n=e.match(RegExp(`^#{${i}}\\s+(.+?)\\s*$`,`m`));if(!n)continue;let r=x(n[1]??``);if(!r)continue;let a=e.replace(RegExp(`^#{${i}}\\s+.+?\\s*\\n?`),``).trim().slice(0,4e3);if(!a)continue;let o=T(r);t.has(o)||t.set(o,a);let s=r.replace(/^功能[-—–]\s*/,``).trim();if(s&&s!==r){let e=T(s);t.has(e)||t.set(e,a)}}return t}function R(e,t){let n=ct(t);return n.size?e.map(e=>{if((e.body||``).replace(/\s+/g,``).length>=40)return e;let t=[T(e.title),T(e.title.split(` · `)[0]??``),T(e.title.replace(/^【[^】]+】/,``))].filter(Boolean);for(let r of t){let t=n.get(r);if(!t)continue;let i=`${e.body}\n\n${t}`.trim().slice(0,4e3);return{...e,body:i,quote:i.replace(/\s+/g,` `).slice(0,80)}}return e}):e}function lt(e){let t=String(e??``).replace(/\r\n/g,`
|
|
15
|
-
`).trim();if(!t)return[];let n=[],r=/^(概述|简介|目录|修订|附录|背景|术语|参考|全局性说明|文档修订|需求确认)/,i=[...t.matchAll(/^(#{2,3})\s+\S/gm)].map(e=>e[1].length).includes(3)?3:2,a=t.split(RegExp(`(?=^#{${i}}\\s+)`,`m`)).filter(e=>e.trim());if(a.length>1||RegExp(`^#{${i}}\\s+`,`m`).test(t))for(let e of a){let t=e.match(RegExp(`^#{${i}}\\s+(.+?)\\s*$`,`m`));if(!t)continue;let a=x(t[1]??``);if(!a||a.length>40||r.test(a))continue;let o=e.replace(RegExp(`^#{${i}}\\s+.+?\\s*\\n?`),``).trim().slice(0,4e3);(o||!n.some(e=>e.title===a))&&n.push(P(a,o||a))}return n}function ut(e){let t=st(e);if(t&&t.entries.length>=3)return z(t.schema===`module-content`?R(t.entries,e):t.entries);let n=lt(e);return n.length?z(n):t?.entries.length?z(t.schema===`module-content`?R(t.entries,e):t.entries):z(X(e).map(e=>({title:e,body:e,quote:e.slice(0,80)})))}function z(e){let t=new Set,n=[];for(let r of e){let e=r.title.toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``);e&&!t.has(e)&&(t.add(e),n.push(r))}return n}function dt(e,t=[]){let n=ut(e);if(!n.length)return t.filter(e=>!e.kind);let r=new Map(t.filter(e=>!e.kind&&!e.parentId).map(e=>[e.title.toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``),e])),i=new Set(t.map(e=>e.id)),a=[];n.forEach((e,t)=>{let n=e.title.toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``),o=r.get(n);if(o){a.push({...o,title:e.title,quote:e.quote||o.quote,body:e.body||o.body,kind:void 0,parentId:void 0});return}let s=`RO-E-${t+1}`,c=1;for(;i.has(s);)s=`RO-E-${t+1}-${c++}`;i.add(s),a.push({id:s,title:e.title,quote:e.quote,body:e.body})});let o=new Set(a.map(e=>e.id)),s=t.filter(e=>e.parentId&&o.has(e.parentId));return[...a,...s]}function B(e){let t=e.filter(e=>e.kind&&e.parentId);return t.length?t:e.filter(e=>!e.parentId)}function ft(e,t){let n=new Set(t.flatMap(e=>e.sourceRefs));return B(e).filter(e=>!n.has(e.id))}function pt(e,t=12){let n=Math.max(1,Math.floor(t)||12),r=B(e);if(!r.length)return[];let i=e.filter(e=>!e.parentId&&!e.kind),a=new Map(i.map(e=>[e.id,e])),o=new Map,s=[];for(let e of r){let t=e.parentId||``;if(t&&a.has(t)){let n=o.get(t)??[];n.push(e),o.set(t,n)}else s.push(e)}let c=[],l=(e,t)=>{for(let r=0;r<t.length;r+=n)c.push({parent:e,mustCover:t.slice(r,r+n)})};for(let e of i){let t=o.get(e.id);t?.length&&l(e,t)}return s.length&&l(null,s),c}function mt(e,t){let n=String(e??``);if(!n)return 2**53-1;let r=q(t,n);return r>=0?r:2**53-1}function V(e,t){if(t.length<=1)return[...t];let n=e.body||e.quote||``;return[...t].map((e,t)=>({p:e,index:t,rank:mt(n,e)})).sort((e,t)=>e.rank===t.rank?e.index-t.index:e.rank-t.rank).map(e=>e.p)}function ht(e,t){return`${e}-${t}`}function H(e,t){return e.filter(e=>e.parentId===t)}function U(e,t,n){let r=new Map,i=n.map((e,n)=>{let i=ht(t,n+1),a=e.id;a&&!a.startsWith(`__new_`)&&a!==i&&r.set(a,i);let o={id:i,title:e.title,quote:e.quote,kind:e.kind,parentId:t};return e.body&&(o.body=e.body),o}),a=e.filter(e=>e.parentId!==t),o=a.findIndex(e=>e.id===t);return{outline:o<0?[...a,...i]:[...a.slice(0,o+1),...i,...a.slice(o+1)],idMap:r}}function gt(e,t){let n=H(e,t.id);if(!n.length)return{outline:[...e],idMap:new Map};let r=V(t,n);return U(e,t.id,r)}function _t(e){let t=[...e],n=new Map,r=t.filter(e=>!e.parentId&&!e.kind);for(let e of r){let r=gt(t,e);t=r.outline;for(let[e,t]of r.idMap)n.set(e,t)}return{outline:t,idMap:n}}function vt(e,t){let n=e.find(e=>e.id===t);if(!n?.parentId||!n.kind)return{outline:[...e],pointId:t,idMap:new Map,parentId:``,error:`必须是已有的查询/修改子点`};let r=e.find(e=>e.id===n.parentId&&!e.parentId&&!e.kind);if(!r)return{outline:[...e],pointId:t,idMap:new Map,parentId:n.parentId,error:`找不到所属需求条目`};if(H(e,r.id).every(e=>e.id.startsWith(`${r.id}-`)))return{outline:[...e],pointId:t,idMap:new Map,parentId:r.id};let i=gt(e,r),a=i.idMap.get(t)??t;return{outline:i.outline,pointId:a,idMap:i.idMap,parentId:r.id}}function yt(e,t){let n=new Map;for(let[r,i]of e)n.set(r,t.get(i)??i);for(let[e,r]of t)n.has(e)||n.set(e,r);return n}function bt(e,t,n){let r=vt(e,t);if(r.error)return{outline:[...e],idMap:new Map,addedIds:[],error:r.error.includes(`必须是`)?`afterId 必须是已有的查询/修改子点`:r.error};if(!n.length)return{outline:r.outline,idMap:r.idMap,addedIds:[]};let i=r.parentId,a=H(r.outline,i),o=a.findIndex(e=>e.id===r.pointId);if(o<0)return{outline:r.outline,idMap:r.idMap,addedIds:[],error:`找不到锚点子点`};let s=n.map((e,t)=>{let n={id:`__new_${t}`,title:e.title,quote:e.quote,kind:e.kind,parentId:i};return e.body&&(n.body=e.body),n}),c=[...a.slice(0,o+1),...s,...a.slice(o+1)],l=U(r.outline,i,c),u=n.map((e,t)=>ht(i,o+2+t));return{outline:l.outline,idMap:yt(r.idMap,l.idMap),addedIds:u}}function xt(e,t){let n=vt(e,t);if(n.error)return{outline:[...e],idMap:new Map,removedId:t,removedIds:new Set([t]),error:n.error.includes(`必须是`)?`只能删除查询/修改子点`:n.error};let r=n.parentId,i=n.pointId,a=new Set([t,i]);for(let[e,t]of n.idMap)(t===i||e===i)&&a.add(e);let o=H(n.outline,r).filter(e=>e.id!==i),s=U(n.outline,r,o),c=new Map([...n.idMap].filter(([e,t])=>!a.has(e)&&!a.has(t)));return{outline:s.outline,idMap:yt(c,s.idMap),removedId:i,removedIds:a}}function St(e,t,n){let r=e.findIndex(e=>e.id===t);if(r<0)return{outline:[...e],error:`找不到需求点`};let i=e[r];if(!i.parentId||!i.kind)return{outline:[...e],error:`只能修改查询/修改子点的原文`};if(n.kind&&n.kind!==`query`&&n.kind!==`mutate`)return{outline:[...e],error:`kind 只能是 query 或 mutate`};let a=[...e],o={...i,quote:n.quote};return n.title!==void 0&&n.title.trim()&&(o.title=n.title.trim()),n.kind&&(o.kind=n.kind),n.body!==void 0&&(n.body?o.body=n.body:delete o.body),a[r]=o,{outline:a}}function Ct(e,t,n=new Set){if(!t.size&&!n.size)return e;let r=e=>n.has(e)?null:t.get(e)??e,i=e=>v(e.map(r).filter(e=>!!e)),a=e.stories.map(e=>({...e,sourceRefs:i(e.sourceRefs)})),o=e=>{if(!e.outlineId)return e;let t=r(e.outlineId);return t===e.outlineId?e:t==null?{...e,outlineId:void 0}:{...e,outlineId:t}},s=e.check?{...e.check,gaps:e.check.gaps.map(o)}:e.check,c=e.ignoredGaps?.map(o);return{...e,stories:a,check:s,ignoredGaps:c}}function W(e,t=[]){let n=e.filter(e=>!e.parentId&&!e.kind),r=e.filter(e=>e.kind&&!e.parentId),i=new Set(t.flatMap(e=>e.sourceRefs)),a=new Map;for(let t of e){if(!t.parentId)continue;let e=a.get(t.parentId)??[];e.push(t),a.set(t.parentId,e)}let o=n.map(e=>{let n=a.get(e.id)??[],r=n.length>0&&n.every(t=>t.id.startsWith(`${e.id}-`))?n:V(e,n),o=r.length?r:[e],s=o.filter(e=>i.has(e.id)).length,c=t.filter(t=>t.sourceRefs.some(t=>t===e.id||r.some(e=>e.id===t)));return{parent:e,points:r,coveredCount:s,totalPoints:o.length,coveringStories:c}});if(r.length&&!n.length)for(let n of e)o.push({parent:n,points:n.kind?[n]:[],coveredCount:+!!i.has(n.id),totalPoints:1,coveringStories:t.filter(e=>e.sourceRefs.includes(n.id))});else r.length&&o.push({parent:{id:`__orphan__`,title:`其它需求点`,quote:``,body:``},points:r,coveredCount:r.filter(e=>i.has(e.id)).length,totalPoints:r.length,coveringStories:t.filter(e=>r.some(t=>e.sourceRefs.includes(t.id)))});return o}function G(e){let t=new Map,n=0;for(let r of W(e)){t.has(r.parent.id)||t.set(r.parent.id,n++);for(let e of r.points)t.has(e.id)||t.set(e.id,n++)}return t}var wt=500,Tt=12e3;function Et(e,t){if(!e.length)return`(无需求点)`;let n=Math.max(40,t?.excerptMax??wt),r=Math.max(40,t?.blockMax??Tt),i=W(e);if(!i.length)return`(无需求点)`;let a=[];for(let e of i){let t=e.parent.id===`__orphan__`?`- ${e.parent.title}`:`- ${e.parent.id} ${e.parent.title}`;if(a.push({kind:`parent`,text:t,shrinkable:!1}),!e.points.length)a.push({kind:`empty`,text:` (尚无查/改子点)`,shrinkable:!1});else for(let t of e.points){let e=t.kind===`query`?`查询`:t.kind===`mutate`?`修改`:`子点`;a.push({kind:`point`,text:` - ${t.id} [${e}] ${t.title}`,shrinkable:!1});let r=(t.body||t.quote||``).replace(/\s+/g,` `).trim();if(r){let e=r.length>n?`${r.slice(0,n).trimEnd()}…`:r;a.push({kind:`excerpt`,text:` 原文:${e}`,shrinkable:!0})}}}let o=e=>e.map(e=>e.text).join(`
|
|
16
|
-
`),s=e=>e.length<=r?e:e.slice(0,r),c=o(a);if(c.length<=r)return c;let l=a.map(e=>({...e}));for(let e=0;e<3&&o(l).length>r;e++){let t=Math.max(40,Math.floor(n/(e+2)));for(let e=0;e<l.length;e++){let n=l[e];if(!n.shrinkable||n.kind!==`excerpt`)continue;let r=n.text.replace(/^ {4}原文:/,``);r.length<=t||(l[e]={...n,text:` 原文:${r.slice(0,t).trimEnd()}…`})}}return c=o(l),c.length<=r?c:s(o(l.filter(e=>!e.shrinkable)))}function Dt(e,t){if(e.length<=1)return[...e];let n=G(t),r=e=>{if(!e.sourceRefs.length)return 2**53-1;let t=2**53-1;for(let r of e.sourceRefs){let e=n.get(r);e!=null&&e<t&&(t=e)}return t};return[...e].map((e,t)=>({s:e,index:t,r:r(e)})).sort((e,t)=>e.r===t.r?e.index-t.index:e.r-t.r).map(e=>e.s)}function Ot(e){let t=new Map;for(let n of e){let e=n.kind===`query`?`查询`:n.kind===`mutate`?`修改`:``;t.set(n.id,e?`${n.title}(${e})`:n.title)}return t}function kt(e){let t=Ot(e),n=new Map;for(let r of e){let e=t.get(r.id)||r.title;n.set(r.id,`${r.id} ${e}`.trim())}return n}function At(e,t){if(!e.length)return``;let n=kt(t);return e.map(e=>n.get(e)||e).join(`;`)}var jt=2e3,Mt=800;function Nt(e,t){let n=0;for(let r=0;r<e.length;r++)if(!/\s/.test(e[r])){if(n===t)return r;n+=1}return-1}function Pt(e,t,n){if(!n||n.length<4)return-1;let r=t.indexOf(n);return r<0||t.indexOf(n,r+n.length)>=0?-1:Nt(e,r)}function K(e,t){let n=String(e??``).trim(),r=String(t??``);if(!n||!r)return-1;let i=r.indexOf(n),a=n.replace(/\s+/g,``),o=r.replace(/\s+/g,``);if(i<0&&a&&(i=Pt(r,o,a)),i<0){let e=Math.min(4,a.length);for(let t of[64,48,32,24,16,12,8,4]){if(t<e)continue;let s=t<=8;if(n.length>=t){let e=n.slice(0,t),a=s?Ft(r,e):r.indexOf(e);if(a>=0){i=a;break}}let c=a.slice(0,Math.min(t,a.length));if(c.length<e)continue;let l=s?Pt(r,o,c):(()=>{let e=o.indexOf(c);return e>=0?Nt(r,e):-1})();if(l>=0){i=l;break}}}if(i<0){let e=/^(【[^】]{2,30}】)/u.exec(n);e&&n.slice(e[0].length).replace(/\s+/g,``).length<4&&(i=r.indexOf(e[1]))}if(i<0)return-1;let s=r.slice(Math.max(0,i-80),i),c=s.lastIndexOf(`
|
|
17
|
-
`);return c>=0&&(i-=s.length-c-1),i}function Ft(e,t){if(!t||t.length<4)return-1;let n=e.indexOf(t);return n<0||e.indexOf(t,n+t.length)>=0?-1:n}function It(e){let t=String(e??``).replace(/[((]?(查询|修改)[))]?$/u,``).replace(/^(政企通页面管理|政企通)/,``).trim();if(!t)return[];let n=[t,...t.split(/[与、及]/u).map(e=>e.trim()).filter(e=>e.length>=4)];t.length>12&&n.push(t.slice(-12));let r=new Set,i=[];for(let e of n)r.has(e)||e.length<4||(r.add(e),i.push(e));return i.sort((e,t)=>t.length-e.length),i}function q(e,t){let n=K(e.quote||e.body||``,t);if(n>=0)return n;for(let n of It(e.title??``)){let e=Ft(t,n);if(e>=0)return e}return-1}function J(e,t,n){let r=/^\d+[、.]/.test(e.slice(t,Math.min(e.length,t+24)).trimStart()),i=t;for(;i<n;){let t=e.indexOf(`
|
|
18
|
-
`,i);if(t<0||t>=n)return n;let a=t+1;for(;a<n&&(e[a]===`
|
|
19
|
-
`||e[a]===`\r`||e[a]===` `);)a+=1;if(a>=n)return t;let o=e.slice(a,Math.min(n,a+40));if(/^【|^#{2,3}\s|^-{3,}/.test(o)||r&&/^\d+[、.]/.test(o)||a>t+1&&!/^\d+[、.]/.test(o))return t;i=t+1}return n}function Lt(e,t,n){if(n<=t||n>=e.length)return!1;let r=e.slice(t,n),i=e.slice(n,Math.min(e.length,n+48)).trimStart();if(!/^\d+[、.]/.test(i)||/^\d+[、.]/.test(r.trimStart()))return!1;if(/\d+[、.]/.test(r))return!0;let a=r.trimEnd().split(/\n/).pop()?.trim()??``;return/下面分|如下|包括|分别为|计有|默认字段/u.test(a)||/[::))]\s*$/u.test(a)}function Rt(e,t,n=jt,r){let i=String(t??``),a=K(e,i);if(a<0)return``;let o=Math.min(i.length,a+n),s=r?.endBefore!=null&&r.endBefore>a?r.endBefore:void 0;if(s!=null&&!Lt(i,a,s)){let e=J(i,a,Math.min(o,s));return i.slice(a,Math.min(o,s,e)).trim()}let c=J(i,a,o);return i.slice(a,Math.max(c,a+1)).trim()}function zt(e,t,n){let r=Math.min(e.length,t+Mt),i=n==null?r:Math.min(r,n);return i=n!=null&&Lt(e,t,n)?J(e,t,r):J(e,t,i),e.slice(t,i).trim()}function Bt(e,t,n,r,i){if(!e||i<0||!r.length)return e;let a=r.filter(e=>e.id!==t.id&&e.start>i).sort((e,t)=>e.start-t.start)[0]?.id;if(!a)return e;let o=n.find(e=>e.id===a);if(!o)return e;let s=[(o.quote||``).trim(),(o.body||``).trim().split(/\n/)[0]?.trim()||``].filter(e=>e.length>=4);for(let t of s){let n=e.indexOf(t);if(n>0)return e.slice(0,n).trim();let r=t.split(/\n/)[0]?.trim()||``;if(r.length>=4&&r!==t){let t=e.indexOf(r);if(t>0)return e.slice(0,t).trim()}}return e}function Vt(e,t,n){let r=(e.body||``).trim(),i=(e.quote||``).trim(),a=(t?.body||t?.quote||``).trim();if(!a)return{text:r||i||`(无原文切片)`,fromParent:!1};let o=n&&n.length?V(t??{id:``,title:``,quote:``},n):[],s=o.map(e=>({id:e.id,start:q(e,a)})),c=i?K(i,a):-1,l=r?K(r,a):-1,u=c>=0?c:l>=0?l:q(e,a),d;if(u>=0&&s.length){let t=s.filter(t=>t.id!==e.id&&t.start>u).sort((e,t)=>e.start-t.start);t[0]&&(d=t[0].start)}let f=u>=0&&s.some(t=>t.id!==e.id&&t.start===u);if(r)return{text:o.length?Bt(r,e,o,s,u):r,fromParent:!1};if(o.length&&u>=0&&!f&&d!=null){let e=zt(a,u,d);if(e)return{text:e,fromParent:!1}}if(i){if(f)return{text:i,fromParent:!1};if(i.length<400||i.length<a.length*.35){let e=Rt(i,a,Mt,{endBefore:d});if(e&&(e.length>i.length||d!=null))return{text:e,fromParent:!1}}return{text:i,fromParent:!1}}if(u>=0&&!f){let e=zt(a,u,d);if(e)return{text:e,fromParent:!1}}return{text:`(未定位到该需求点对应原文)`,fromParent:!1}}function Ht(e){let t=_(e.title??``);return`${e.type}|${e.storyId||``}|${e.outlineId||``}|${t}`}function Y(e,t){if(Ht(e)===Ht(t))return!0;if(e.type!==t.type||(e.storyId||``)!==(t.storyId||``))return!1;let n=_(e.title??``),r=_(t.title??``);if(!n||!r)return!1;if(n===r)return!0;let i=n.length<=r.length?n:r,a=n.length<=r.length?r:n;return i.length>=8&&a.includes(i)}function Ut(e,t){return t?.length?e.filter(e=>!t.some(t=>Y(e,t))):[...e]}function Wt(e,t,n,r){let i=r?.allowNew!==!1,a=Ut(t,n),o=new Set,s=[],c=0,l=e=>i?!0:e.type===`uncovered-outline`;for(let t of a){let n=e.length?e.find(e=>e.id===t.id&&!o.has(e.id))||e.find(e=>!o.has(e.id)&&Y(e,t)):void 0;if(n)o.add(n.id),s.push({...t,id:n.id,title:n.title,selected:n.selected||t.selected,conclusion:t.conclusion?.trim()||n.conclusion});else{if(!l(t)){c+=1;continue}s.push({...t})}}if(!i)for(let t of e)o.has(t.id)||t.type!==`uncovered-outline`&&(n?.some(e=>Y(t,e))||s.push({...t}));return{gaps:s,suppressed:c}}function Gt(e){let t=e.pending??[],n=e.ignored??[];if(!t.length&&!n.length)return``;let r=[];if(t.length){r.push(`## 上轮待确认(复审底稿:只更新/收敛,禁止新开条;问题仍在则沿用原 title)`);for(let e of t)r.push(`- id=${e.id} type=${e.type} storyId=${e.storyId||`-`} outlineId=${e.outlineId||`-`}`),r.push(` title: ${e.title}`),e.detail?.trim()&&r.push(` detail: ${e.detail.trim()}`),e.conclusion?.trim()&&r.push(` conclusion: ${e.conclusion.trim()}(已有结论待补写,勿另开一条)`);r.push(``)}if(n.length){r.push(`## 已忽略(禁止再报同类,不要求标题字面一致)`);for(let e of n)r.push(`- type=${e.type} storyId=${e.storyId||`-`} outlineId=${e.outlineId||`-`} title: ${e.title}`)}return r.join(`
|
|
20
|
-
`).trim()}function Kt(e){let t=[];return e.role||t.push({key:`role`,label:`缺角色`}),e.goal||t.push({key:`goal`,label:`缺目标`}),e.preconditions.length||t.push({key:`preconditions`,label:`缺前置条件`}),e.mainFlow.length||t.push({key:`mainFlow`,label:`缺主流程`}),e.sourceRefs.length||t.push({key:`sourceRefs`,label:`未挂需求点`}),e.exceptions.length?ln(e)&&e.exceptions.length<2&&t.push({key:`write-exceptions`,label:`写操作异常不足`}):t.push({key:`exceptions`,label:`缺异常场景`}),!e.altFlows.length&&ln(e)&&t.push({key:`altFlows`,label:`缺替代流程`}),e.acceptance.length?e.acceptance.some(e=>!e.then)&&t.push({key:`acceptance-then`,label:`验收缺 then`}):t.push({key:`acceptance`,label:`缺验收标准`}),t}function qt(e){let t=new Set,n=[];for(let r of N(e)){let e=T(r.small);e&&!t.has(e)&&(t.add(e),n.push(r.small))}return n}function Jt(e){let t=N(e);if(!t.length)return``;let n=e=>/[,"\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=[`Ideal 小模块行序(用例「子模块 / 小模块」填下列原文:层级路径取最后一段;最终文件按「需求条目 → 条目内测试点」排序,此序只做兜底):`,`大模块,小模块,优化/问题内容`],i=new Set;for(let e of t){let t=T(e.small);t&&!i.has(t)&&(i.add(t),r.push(`${n(e.big)},${n(e.small)},【${e.title}】`))}return r.join(`
|
|
21
|
-
`)}var Yt=`需求章节顺序`;function Xt(e){let t=String(e??``).replace(/\r\n/g,`
|
|
22
|
-
`).trim();if(!t)return[];let n=[],r=new Set,i=/^(概述|简介|目录|修订|附录|背景|术语|参考)/;for(let e of t.matchAll(/^#{2,3}\s+(.+?)\s*$/gm)){let t=x(e[1]??``);!t||t.length>40||i.test(t)||r.has(t)||(r.add(t),n.push(t))}return n}function Zt(e){let t=String(e??``).replace(/\r\n/g,`
|
|
23
|
-
`),n=t.indexOf(Yt);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=x(e[1]??``);!t||t.length>40||a.has(t)||(a.add(t),i.push(t))}return i}function X(e){let t=qt(e);if(t.length)return t;let n=Zt(e);if(n.length)return n;let r=$t(e);return r.length?r:Xt(e)}function Qt(e){let t=Jt(e);if(t)return t;let n=X(e);return n.length<2?``:[`${Yt}(用例「模块 / 子模块 / 标题」应对齐下列原文;最终文件按此序排列,优先于用户故事 US 编号):`,...n.map((e,t)=>`${t+1}. ${e}`)].join(`
|
|
24
|
-
`)}function $t(e){let t=N(e);if(t.length)return t.map(e=>e.title);let n=String(e??``).replace(/\r\n/g,`
|
|
25
|
-
`).trim(),r=[],i=new Set;for(let e of n.matchAll(/【([^】\n]{1,40})】/g)){let t=x(e[1]??``);!t||t.length>24||i.has(t)||(i.add(t),r.push(t))}return r}function en(e,t,n){return`g_${ke(`${e}|${t}|${n}`)}`}function tn(e){let t=e&&typeof e==`object`?e:{},n=y(t.priority,4);return{id:y(t.id,20),title:y(t.title,200),role:y(t.role,120),goal:y(t.goal,500),value:y(t.value,500),sourceRefs:b(t.sourceRefs,20,40),priority:n===`P0`||n===`P1`||n===`P2`?n:`P1`,preconditions:b(t.preconditions),mainFlow:(Array.isArray(t.mainFlow)?t.mainFlow:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{actor:y(t.actor,80),action:y(t.action,500),result:y(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:y(t.name,120)||`替代流程`,trigger:y(t.trigger,500),steps:b(t.steps,20)}}).slice(0,20),exceptions:(Array.isArray(t.exceptions)?t.exceptions:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{scenario:y(t.scenario,500),expected:y(t.expected,500)}}).filter(e=>e.scenario).slice(0,30),postconditions:b(t.postconditions),acceptance:(Array.isArray(t.acceptance)?t.acceptance:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{given:y(t.given,500),when:y(t.when,500),then:y(t.then,500)}}).filter(e=>e.given||e.when||e.then).slice(0,30),dimensions:b(t.dimensions,12,40)}}function nn(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 Z(e){let t=e.mainFlow?.[0];return`${_(e.title)}|${t?_(`${t.action}${t.result??``}`):``}`}function rn(e,t){let n=e.map(nn),r=new Map(n.filter(e=>e.id).map(e=>[e.id,e])),i=new Map(n.map(e=>[Z(e),e]));for(let e of t){let t=tn(e);if(!t.title)continue;let a=t.id&&r.get(t.id)||i.get(Z(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=v([...a.sourceRefs,...t.sourceRefs]),a.dimensions=v([...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(Z(e),e)}}return n}function an(e,t){let n=_(e),r=_(t);if(!n||!r)return 0;if(n===r)return 1e3;if(n.includes(r)||r.includes(n))return 800+Math.min(n.length,r.length);let i=n.length<=r.length?n:r,a=n.length<=r.length?r:n,o=0;for(let e=0;e<i.length-1;e++)a.includes(i.slice(e,e+2))&&(o+=1);let s=Math.max(1,i.length-1);return o+Math.round(o/s*10)}var on=4;function sn(e,t){let n=e.map(nn);if(!t.length)return{stories:n,filled:0};let r=new Set(t.filter(e=>e.parentId).map(e=>e.parentId)),i=[...t.filter(e=>e.kind===`query`||e.kind===`mutate`),...t.filter(e=>!e.kind&&!e.parentId&&!r.has(e.id))];if(!i.length)return{stories:n,filled:0};let a=new Set(n.flatMap(e=>e.sourceRefs).filter(e=>i.some(t=>t.id===e))),o=0;for(let e of n){if(e.sourceRefs.length)continue;let t=null,n=0;for(let r of i){if(a.has(r.id))continue;let i=an(e.title,r.title);i>n&&(n=i,t=r)}!t||n<on||(e.sourceRefs=[t.id],a.add(t.id),o+=1)}return{stories:n,filled:o}}function cn(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 ln(e){return e.mainFlow.some(e=>ge.test(e.action))}function un(e,t,n,r,i,a,o=``){return{id:en(e,t||o,n),storyId:t,outlineId:o||void 0,type:e,severity:a,title:n,detail:r,suggestion:i,origin:`rule`,selected:!1}}var dn=new Set([`缺少角色`,`缺少目标`,`缺少前置条件`,`缺少主流程`,`没有异常场景`,`写操作缺少异常分支`,`缺少验收标准`,`验收标准缺 then`,`没有关联需求条目`,`只写了主流程`]);function fn(e){let t=e.outline??[],n=e.stories??[],r=[],i=B(t),a=new Set(n.flatMap(e=>e.sourceRefs));for(let e of i){if(a.has(e.id))continue;let t=e.kind===`query`?`查询`:e.kind===`mutate`?`修改`:``,n=t?`${e.title}(${t})`:e.title;r.push(un(`uncovered-outline`,``,`${n}:还没有用户故事挂上`,`需求点「${n}」在文档里有,但目前没有任何故事引用它。可能是漏拆了,也可能这块其实不用测。`,`跟业务确认要不要覆盖:要的话补一条故事(或在已有故事里挂上这个点);不要的话直接忽略。`,`high`,e.id))}let o=he.map(e=>{let t=n.filter(t=>{let n=cn(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}}),s=i.filter(e=>a.has(e.id)).length,c={total:i.length,covered:s,rate:i.length?s/i.length:0};return{at:new Date().toISOString(),summary:`规则检查:${n.length} 个故事、${i.length} 个需求点,覆盖率 ${i.length?Math.round(c.rate*100):0}%,${r.length} 项待确认未覆盖。`,coverage:c,dimensions:o,gaps:r}}function pn(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?dn.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):_(a.title)!==_(e.title)&&(n.push({...e}),i.add(e.id)):(n.push({...e}),r.set(t,e),i.add(e.id))}return n}function mn(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 hn(e,t=ae){let n=String(e??``).replace(/\r\n/g,`
|
|
26
|
-
`).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(`
|
|
27
|
-
`).trim();e&&i.push({title:a,text:e}),o=[]};for(let e of n.split(`
|
|
28
|
-
`)){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?mn(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 Q(e,t){return t?`- **${e}**:${t}`:``}function gn(e){return e.filter(Boolean).map(e=>`- ${e}`)}function _n(e,t=[]){let n=[];n.push(`### ${e.id} ${e.title}`),n.push(``);let r=t.length?At(e.sourceRefs,t):e.sourceRefs.join(`、`),i=[Q(`角色`,e.role),Q(`目标`,e.goal),Q(`价值`,e.value),Q(`优先级`,e.priority),Q(`来源条目`,r)].filter(Boolean);if(n.push(...i),i.length&&n.push(``),e.preconditions.length&&(n.push(`**前置条件**`),n.push(...gn(e.preconditions)),n.push(``)),e.mainFlow.length&&(n.push(`**主流程**`),e.mainFlow.forEach((e,t)=>{let r=e.actor?`${e.actor}:`:``;n.push(`${t+1}. ${r}${e.action}${e.result?` → ${e.result}`:``}`)}),n.push(``)),e.altFlows.length){n.push(`**替代流程**`);for(let t of e.altFlows)n.push(`- **${t.name}**${t.trigger?`(触发:${t.trigger})`:``}`),t.steps.forEach((e,t)=>n.push(` ${t+1}. ${e}`));n.push(``)}if(e.exceptions.length){n.push(`**异常场景**`);for(let t of e.exceptions)n.push(`- ${t.scenario}${t.expected?` → ${t.expected}`:``}`);n.push(``)}if(e.postconditions.length&&(n.push(`**后置条件**`),n.push(...gn(e.postconditions)),n.push(``)),e.acceptance.length){n.push(`**验收标准**`);for(let t of e.acceptance)n.push(`- Given ${t.given||`(未写)`};When ${t.when||`(未写)`};Then ${t.then||`(未写)`}`);n.push(``)}return e.dimensions.length&&(n.push(`**覆盖维度**:${e.dimensions.join(`、`)}`),n.push(``)),n[n.length-1]!==``&&n.push(``),n}function vn(e,t){let n=new Set((t??[]).filter(Boolean)),r=n.size?e.stories.filter(e=>n.has(e.id)):e.stories,i=[];if(i.push(`# ${e.title||`需求分析`} · 用户故事`),i.push(``),i.push(`> 来源需求文档:\`${e.sourcePath||`(未指定)`}\` · 状态:${se[e.status].label} · 更新:${e.updatedAt}`),i.push(``),e.outline.length){i.push(`## 需求条目`),i.push(``),i.push(`> 「引用需求点」请填下列真实 RO id,格式「RO-id 标题」;不要填 US-…。`),i.push(``);for(let t of W(e.outline,r)){if(i.push(`### ${t.parent.id} ${t.parent.title}`),t.parent.quote||t.parent.body){let e=(t.parent.quote||t.parent.body||``).replace(/\s+/g,` `).slice(0,200);i.push(`> ${e}`)}if(t.points.length)for(let e of t.points){let t=e.kind===`query`?`查询`:e.kind===`mutate`?`修改`:``;i.push(`- **${e.id}** ${e.title}${t?`(${t})`:``}`),e.quote&&i.push(` > ${e.quote.replace(/\n+/g,` `)}`)}i.push(``)}}i.push(`## 用户故事`),i.push(``),r.length||(i.push(`- (暂无)`),i.push(``));let a=Dt(r,e.outline);for(let t of a)i.push(..._n(t,e.outline));return i.join(`
|
|
29
|
-
`)}function yn(e){return(S(e)||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function $(e,t){let n=String(t??``).trim();if(n.length<2)return null;let r=e.indexOf(n);if(r>=0)return e.slice(r,r+n.length).replace(/\s+/g,` `).trim();let i=n.replace(/\s+/g,``);if(i.length<4)return null;let a=``,o=[];for(let t=0;t<e.length;t+=1)/\s/.test(e[t])||(o.push(t),a+=e[t]);let s=a.indexOf(i);if(s<0)return null;let c=o[s],l=o[s+i.length-1]+1;return e.slice(c,l).replace(/\s+/g,` `).trim()}function bn(e){let t=String(e??``),n=(t.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1]??t).trim(),r=n.indexOf(`{`),i=n.lastIndexOf(`}`);if(r<0||i<=r)return null;try{return JSON.parse(n.slice(r,i+1))}catch{return null}}function xn(e){let t=Array.isArray(e)?e:e&&typeof e==`object`&&Array.isArray(e.groups)?e.groups:[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=String(e.category??``).trim(),r=e.items,i=[];for(let e of Array.isArray(r)?r:[]){if(!e||typeof e!=`object`)continue;let t=String(e.title??``).trim(),n=String(e.body??``).trim();(t||n)&&i.push({title:t,body:n})}t&&i.length&&n.push({category:t,items:i})}return n}function Sn(e,t){let n=String(e??``);if(!n.trim())return null;let r=[],i=[];for(let e of xn(t)){let t=$(n,e.category),a=[];for(let t of e.items){let e=$(n,t.body||t.title);if(!e)continue;let r=$(n,t.title)||e.slice(0,40);a.push({title:r,body:e})}a.length&&(t?i.push({category:t,items:a}):r.push(...a))}return r.length&&i.push({category:`未分大类`,items:r}),i.length?i:null}function Cn(e){let t=[],n=new Map;for(let r of e)for(let e of r)n.has(e.category)||(n.set(e.category,[]),t.push(e.category)),n.get(e.category).push(...e.items);return t.map(e=>({category:e,items:n.get(e)}))}var wn=/(?:需求编号|编号)\s*[||::]\s*([A-Za-z]{1,8}(?:-\d+)+)/,Tn=/(?:^|[\s。;;||])(\d{1,2}(?:[、.]|\.(?=\s)))/g;function En(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Dn(e,t){if(!t)return e.trim();let n=RegExp(`(?:需求编号|编号)\\s*[||::]\\s*${En(t)}(?:\\s*功能名称\\s*[||][\\s\\S]*?功能描述\\s*[||]\\s*)?`);return e.replace(n,``).replace(/^[\s||::]+/,``).trim()}function On(e){let t=rt.exec(e);if(!t||t.index==null)return e.trim();let n=t.index,r=t[0].match(/^[。;;]/);return r&&(n+=r[0].length),e.slice(0,n).replace(/[\s||]+$/,``).trim()}function kn(e){let t=[];for(let n of e.matchAll(Tn)){let e=n[1];e&&n.index!=null&&t.push(n.index+n[0].length-e.length)}return t.map((n,r)=>({start:n,text:e.slice(n,t[r+1]??e.length).trim()}))}function An(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{id:``,parts:[]};let n=wn.exec(t)?.[1]??``,r=kn(t),i=[],a=e=>{let t=On(Dn(e,n));t&&i.push(t)};if(r.length){a(t.slice(0,r[0].start));for(let e of r)a(e.text)}else a(n?Dn(t,n):t);return{id:n,parts:i}}function jn(e,t){return t.map((t,n)=>({id:`${e}-${n+1}`,title:t,role:`body`,children:[]}))}function Mn(e,t){return{id:`root`,title:e,role:`root`,children:t.map((e,t)=>({id:`cat-${t+1}`,title:e.category,role:`group`,children:e.items.map((e,n)=>{let r=e.title.replace(/\s+/g,` `).trim(),{id:i,parts:a}=An(e.body),o=jn(`body-${t+1}-${n+1}`,a.filter(e=>e!==r&&e!==i));return{id:`title-${t+1}-${n+1}`,title:e.title,role:`step`,children:i?[{id:`code-${t+1}-${n+1}`,title:i,role:`code`,children:o}]:o}})}))}}function Nn(e){let t=[`# ${e.title} · 需求原文`,``];if(!e.children.length)return t.push(`- (还没有原文结构,请先拆解需求)`,``),`${t.join(`
|
|
30
|
-
`).trimEnd()}\n`;for(let n of e.children){t.push(`## ${n.title}`,``);for(let e of n.children){t.push(`### ${e.title}`,``);for(let n of e.children)if(n.role===`code`){t.push(n.title,``);for(let e of n.children)t.push(`- ${e.title}`,``);n.children.length&&t.push(``)}else t.push(n.title,``)}}return`${t.join(`
|
|
31
|
-
`).trimEnd()}\n`}function Pn(e){let t=S(e)||e.title||`需求分析`,n=e.sourceExport?.groups??[];return n.length?Nn(Mn(t,n)):`# ${t} · 需求原文\n\n- (还没有原文结构,请先拆解需求)\n`}function Fn(e){let t=new Date().toISOString().slice(0,10),n=`${yn(e)}-需求原文-${t}.md`;return p(new Blob([Pn(e)],{type:`text/markdown;charset=utf-8`}),n),n}function In(e){let t=e.role===`group`?f:e.role===`code`||e.role===`step`?ee:void 0,n=e.children.map(In);return{id:l(`src`,e.id),title:e.title,structureClass:n.length?r:void 0,style:t,children:n.length?{attached:n}:void 0}}function Ln(e){let t=Mn(S(e)||e.title||`需求分析`,e.sourceExport?.groups??[]);return[{id:`sheet-1`,class:`sheet`,title:t.title,theme:te(),rootTopic:{id:`root-topic`,title:t.title,structureClass:r,style:d,children:{attached:t.children.map(In)}}}]}async function Rn(e){let t=new Date().toISOString().slice(0,10),n=`${yn(e)}-需求原文-${t}.xmind`;return p(await ne(Ln(e)),n),n}export{dt as $,bt as A,kt as B,fe as C,Qt as D,He as E,Cn as F,Te as G,Ot as H,rn as I,xt as J,Wt as K,_t as L,ve as M,Ee as N,en as O,pn as P,Be as Q,B as R,Ut as S,Et as T,bn as U,Vt as V,we as W,S as X,C as Y,Ue as Z,$t as _,h as a,Ce as at,Se as b,re as c,be as ct,pt as d,d as dt,Dt as et,Ie as f,ee as ft,Rn as g,l as gt,Fn as h,te as ht,ie as i,Kt as it,Fe as j,W as k,Sn as l,r as lt,xe as m,ne as mt,me as n,hn as nt,ce as o,ft as ot,ye as p,p as pt,Ct as q,le as r,vn as rt,se as s,St as st,pe as t,Ae as tt,fn as u,f as ut,X as v,Gt as w,sn as x,_e as y,G as z};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{X as e,dt as t,ft as n,gt as r,ht as i,lt as a,mt as o,pt as s,r as c,s as l,t as u,ut as d}from"./req-analysis.B12_MGMQ.js";function f(t){return e(t)}var p=`/__tb_testpoints`,m=`测试点生成提示词.md`,h=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`],g=[`P0`,`P1`,`P2`,`P3`],_={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]`}},v={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`}},y=Object.fromEntries(h.map(e=>[e,_[e].label]));async function b(e,t){let n=await fetch(`${p}${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 x(){try{let e=await b(`/prompt`);return{file:m,exists:e.exists===!0,generate:e.generate??``}}catch(e){return{file:m,exists:!1,generate:``,error:e instanceof Error?e.message:String(e)}}}async function S(e){return b(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var C={P0:0,P1:1,P2:2,P3:3};function w(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:h.filter(e=>t.some(t=>t.dimension===e)).length}}function T(e){return[...e].sort((e,t)=>Number(!!e.supplemental)-Number(!!t.supplemental)||h.indexOf(e.dimension)-h.indexOf(t.dimension)||C[e.priority]-C[t.priority]||e.title.localeCompare(t.title,`zh`))}function E(e,t=[]){if(!e.length)return``;let n=D(e,t),r=[],i=`\0`;for(let e of n){let t=e.storyId||``;t!==i&&(i=t,r.push(t?`#### ${t}`:`#### 全局测试点`)),r.push(`- **[${e.priority}]** ${e.title}(${e.id})`),e.storyId&&r.push(` - 来源故事:${e.storyId}`),r.push(` - 维度:${_[e.dimension].label}`),e.precondition&&r.push(` - 前置:${e.precondition}`),e.steps.length&&r.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&r.push(` - 预期:${e.expected}`)}return r.join(`
|
|
2
|
-
`)}function D(e,t=[]){if(!e.length)return[];if(!t.length)return[...e];let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({point:e,index:t})).sort((e,r)=>(e.point.storyId?n.get(e.point.storyId)??t.length+1:t.length)-(r.point.storyId?n.get(r.point.storyId)??t.length+1:t.length)||e.index-r.index).map(e=>e.point)}function O(e){return(e||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function k(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(`
|
|
3
|
-
`)}function A(e){return{id:r(`tp`,e.id),title:`[${e.priority}] ${e.title}`,labels:[_[e.dimension].label],markers:[{markerId:v[e.priority].markerId}],notes:{plain:{content:k(e)}}}}var j=[{re:/ai\s*拆解|推送ai|回写拆解/i,title:`ai拆解`},{re:/ai自动同步|知识信息列表.*开关|知识信息管理/i,title:`知识信息管理`},{re:/信息审核|审核倒计时|出具审核结论|待审核信息/i,title:`政企通信息审核`},{re:/信息确认|确认无误|待确认信息/i,title:`政企通信息确认`},{re:/开通确认|确认开通/i,title:`政企通开通确认`},{re:/信息管理列表|承办单位修改|查看详情|政企通路径|关联信息标题/i,title:`政企通信息管理`},{re:/页面管理|页面树|节点|前台预览|本级节点布局|暂存|发给承办|信息列表|展示类型/i,title:`政企通页面管理`},{re:/菜单|子菜单|文案本地化|时间展示/i,title:`政企通`}];function M(e,t){return t.find(t=>t===e)||t.find(t=>e.length>=t.length&&e.includes(t))||t.find(t=>t.length>e.length&&t.includes(e))||null}function N(e,t,n){if(!n.length)return e.title||e.id;let r=e.title||``,i=`${r} ${e.sourceRefs.map(e=>t.get(e)||e).join(` `)}`,a=[...n].sort((e,t)=>t.length-e.length||e.localeCompare(t,`zh`));for(let e of j){if(!e.re.test(i))continue;let t=M(e.title,a);if(t)return t}for(let e of a)if(e&&r.includes(e))return e;for(let e of a)if(e&&i.includes(e))return e;for(let e of a){let t=e.split(` · `)[0]?.trim()??``;if(t&&r.includes(t))return e}for(let e of a){let t=e.split(` · `)[0]?.trim()??``;if(t&&i.includes(t))return e}return e.title||e.id}function P(e){let t=T(e);return h.map(e=>({key:e,label:_[e].label,hint:_[e].hint,points:t.filter(t=>t.dimension===e)}))}function F(e,t=[]){let n=e.testPoints?.points??[];if(!n.length)return[];let r=new Map(e.outline.map(e=>[e.id,e.title])),i=new Map(e.stories.map(e=>[e.id,e])),a=t.filter(Boolean),o=new Map,s=e=>{let t=o.get(e);return t||(t={title:e,storyIds:new Set,points:[]},o.set(e,t)),t};for(let e of a)s(e);for(let e of n){let t=e.storyId?i.get(e.storyId):void 0,n;n=t&&a.length?N(t,r,a):t?t.title||t.id:`全局测试点`;let o=s(n);o.points.push(e),e.storyId&&o.storyIds.add(e.storyId)}let c=[...a,...[...o.keys()].filter(e=>!a.includes(e)&&e!==`全局测试点`),...o.has(`全局测试点`)?[`全局测试点`]:[]],l=new Set,u=[];for(let e of c){if(l.has(e))continue;l.add(e);let t=o.get(e);t&&(t.points.length||a.includes(e))&&u.push({key:e,title:e,storyIds:[...t.storyIds],points:T(t.points),dimensions:P(t.points)})}return u}var I=a;function L(e,t){return t.map(t=>{let i=t.points.map(A);return{id:r(`dim`,`${e}:${t.key}`),title:`${t.label}(${t.points.length})`,structureClass:i.length?I:void 0,style:n,notes:{plain:{content:`${_[t.key].hint}\n测试点 ${t.points.length} 条`}},children:{attached:i}}})}function R(e){let t=L(e.key,e.dimensions);return{id:r(`req`,e.key),title:`${e.title}(${e.points.length})`,structureClass:I,style:d,notes:{plain:{content:[e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
|
|
4
|
-
`)}},children:{attached:t}}}function z(e,a=[]){let o=e.testPoints,s=F(e,a).filter(e=>e.points.length>0),c=f(e);if(!s.length)return[{id:`sheet-1`,class:`sheet`,title:c,theme:i(),rootTopic:{id:`root-topic`,title:`${c}(0)`,structureClass:I,style:t,notes:{plain:{content:o?.summary||`还没有测试点。`}},children:{attached:h.map(e=>({id:r(`dim`,e),title:`${_[e].label}(0)`,style:n,notes:{plain:{content:`${_[e].hint}\n测试点 0 条`}},children:{attached:[]}}))}}}];if(s.length===1){let e=s[0];return[{id:`sheet-1`,class:`sheet`,title:e.title,theme:i(),rootTopic:{id:r(`root`,e.key),title:`${e.title}(${e.points.length})`,structureClass:I,style:t,notes:{plain:{content:[o?.summary||``,e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
|
|
5
|
-
`)}},children:{attached:L(e.key,e.dimensions)}}}]}let l=s.reduce((e,t)=>e+t.points.length,0);return[{id:`sheet-1`,class:`sheet`,title:c,theme:i(),rootTopic:{id:`root-topic`,title:c,structureClass:I,style:t,notes:{plain:{content:[o?.summary||``,`测试点 ${l} 条`].filter(Boolean).join(`
|
|
6
|
-
`)}},children:{attached:s.map(R)}}}]}async function B(e,t=[]){return o(z(e,t))}async function V(e,t=[]){let n=new Date().toISOString().slice(0,10),r=`${O(f(e))}-测试点-${n}.xmind`,i=await B(e,t);return s(i,r),r}function H(e,t=[]){let n=e.testPoints,r=f(e),i=[];i.push(`# ${r}`),i.push(``);let a=F(e,t);if(i.push(`> 需求测试点 · 来源:\`${e.sourcePath||`(未指定)`}\` · 需求 ${a.length||e.stories.length} 条 · 测试点 ${n?.points.length??0} 条`),i.push(``),!n?.points.length)return i.push(`- 还没有生成测试点。`),`${i.join(`
|
|
7
|
-
`).trimEnd()}\n`;let o=w(n);i.push(`- 生成时间:${n.at}`),i.push(`- 共 ${o.total} 条(P0 ${o.byPriority.P0} / P1 ${o.byPriority.P1} / P2 ${o.byPriority.P2} / P3 ${o.byPriority.P3})`),i.push(`- 需求 ${a.length} 条 · 维度覆盖 ${o.coveredDimensions}/5`),n.summary&&(i.push(``),i.push(n.summary)),i.push(``);for(let e of a){i.push(`## ${e.title} · ${e.points.length} 条`),i.push(``);for(let t of e.dimensions)if(i.push(`### ${t.label}(${t.points.length})`),i.push(``),!t.points.length)i.push(`- (无)`),i.push(``);else{for(let e of t.points)i.push(`- **[${e.priority}]** ${e.title}`),e.precondition&&i.push(` - 前置:${e.precondition}`),e.steps.length&&i.push(` - 步骤:${e.steps.join(`;`)}`),e.expected&&i.push(` - 预期:${e.expected}`);i.push(``)}}return`${i.join(`
|
|
8
|
-
`).trimEnd()}\n`}function U(e,t=[]){let n=new Date().toISOString().slice(0,10),r=`${O(f(e))}-测试点-${n}.md`,i=new Blob([H(e,t)],{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}var W=`/__tb_storyreview`,G=`用户故事审查提示词.md`;async function K(e,t){let n=await fetch(`${W}${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 q(){try{let e=await K(`/prompt`);return{file:G,exists:e.exists===!0,review:e.review??``,fix:e.fix??``}}catch(e){return{file:G,exists:!1,review:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function J(e){return K(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var Y={high:0,medium:1,low:2};function X(e){let t={pending:[],uncovered:[],other:[]};for(let n of e)n.type===`uncovered-outline`?t.uncovered.push(n):n.type===`pending-confirm`||n.type===`conflict`?t.pending.push(n):t.other.push(n);let n=e=>[...e].sort((e,t)=>Y[e.severity]-Y[t.severity]||e.title.localeCompare(t.title,`zh`));return[{key:`pending`,label:`待确认`,hint:`原文不清或需业务拍板`,gaps:n(t.pending)},{key:`uncovered`,label:`需求点未覆盖`,hint:`文档点还没有故事挂接`,gaps:n(t.uncovered)},{key:`other`,label:`其它`,hint:`其余待处理项`,gaps:n(t.other)}].filter(e=>e.gaps.length>0)}function Z(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 Q(e,t){let n=[];if(n.push(`# 用户故事审查报告 · ${e.title||`未命名分析`}`),n.push(``),n.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 故事 ${e.stories.length} 条`),n.push(``),!t)return n.push(`- 还没有审查结果。`),`${n.join(`
|
|
9
|
-
`)}\n`;let r=t.coverage.total?Math.round(t.coverage.rate*100):0;n.push(`## 结论`),n.push(``),n.push(`- 状态:${l[e.status]?.label??e.status}`),n.push(`- 审查时间:${t.at}`),n.push(`- 需求条目覆盖率:${t.coverage.covered}/${t.coverage.total}(${r}%)`),n.push(`- 维度覆盖:${t.dimensions.map(e=>`${e.label}${e.covered?` ✓`:` ✗`}`).join(` · `)||`(无)`}`);let i=Z(t.gaps);n.push(`- 缺口:${t.gaps.length} 条(高 ${i.high} / 中 ${i.medium} / 低 ${i.low})`),t.summary&&(n.push(``),n.push(t.summary)),n.push(``);let a=new Map(e.stories.map(e=>[e.id,e.title])),o=X(t.gaps);if(!o.length)return n.push(`## 缺口清单`),n.push(``),n.push(`- 没有发现缺口。`),`${n.join(`
|
|
10
|
-
`)}\n`;for(let e of o){n.push(`## ${e.label}(${e.gaps.length})`),n.push(``);for(let t of e.gaps){let e=t.storyId?`${t.storyId}${a.get(t.storyId)?` ${a.get(t.storyId)}`:``}`:`全局`;n.push(`- **[${u[t.severity]}] ${c[t.type]}** · ${e} · ${t.title}`),t.detail&&n.push(` - 原因:${t.detail}`),t.suggestion&&n.push(` - 建议:${t.suggestion}`)}n.push(``)}return`${n.join(`
|
|
11
|
-
`).trimEnd()}\n`}function $(e,t){let n=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-审查报告-${new Date().toISOString().slice(0,10)}.md`,r=new Blob([Q(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}function ee(e,t,n){if(e.outlineId){let r=t?.get(e.outlineId)?.trim();if(r)return r;let i=n?.get(e.outlineId)?.trim();if(i)return i}return e.detail?.trim()||e.title?.trim()||`(无原文摘录)`}function te(e,t,n){let r=[];if(r.push(`# 待确认事项 · ${e.title||`未命名分析`}`),r.push(``),r.push(`> 来源:\`${e.sourcePath||`(未指定)`}\` · 请在每条「结论」里回填后交回,便于补写用户故事。`),r.push(``),!t?.gaps.length)return r.push(`(当前没有待确认项。)`),`${r.join(`
|
|
12
|
-
`)}\n`;let i=n?.gapIds?.length?new Set(n.gapIds):null,a=i?t.gaps.filter(e=>i.has(e.id)):[...t.gaps];if(!a.length)return r.push(`(未勾选任何项;请先勾选或清空选择后导出全部。)`),`${r.join(`
|
|
13
|
-
`)}\n`;let o=X(a),s=0;for(let e of o)for(let t of e.gaps){s+=1,r.push(`## ${s}. ${t.title}`),r.push(``),r.push(`需求内容:${ee(t,n?.outlineBodies,n?.outlineTitles)}`),r.push(``);let e=t.detail?.trim()||t.title;r.push(`疑问:${e}`),r.push(``),r.push(`结论:${t.conclusion?.trim()||``}`),r.push(``)}return`${r.join(`
|
|
14
|
-
`).trimEnd()}\n`}function ne(e,t,n){let r=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-待确认-${new Date().toISOString().slice(0,10)}.md`,i=new Blob([te(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}export{F as _,q as a,E as b,y as c,g as d,m as f,x as g,V as h,$ as i,_ as l,U as m,Z as n,X as o,w as p,ne as r,J as s,G as t,v as u,D as v,S as y};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./app-config.DkyjuL-S.js";var t=[{id:`functional`,folder:`功能测试报告`,label:`功能测试报告`,defaultPrompt:`功能测试报告提示词.md`},{id:`api`,folder:`接口测试报告`,label:`接口测试报告`,defaultPrompt:`接口测试报告提示词.md`},{id:`perf`,folder:`性能测试报告`,label:`性能测试报告`,defaultPrompt:`性能测试报告提示词.md`}],n=`# 测试报告提示词
|
|
2
|
-
|
|
3
|
-
> 由「报告管理」插件按报告类型挂载。日常增删改请只改本空间「提示词管理」里的本文件。
|
|
4
|
-
|
|
5
|
-
## 角色
|
|
6
|
-
|
|
7
|
-
你协助修改已挂载的测试报告正文,保持原有章节结构与口径。
|
|
8
|
-
|
|
9
|
-
## 要求
|
|
10
|
-
|
|
11
|
-
1. 只改作曲区挂载的那份报告文件,其它文件不要动。
|
|
12
|
-
2. 保留原有标题层级与章节顺序;缺段再补,不要整篇重写成别的模板。
|
|
13
|
-
3. 不要编造未提供的测试数据、结论或通过率;缺信息时标明待补充。
|
|
14
|
-
4. 改完说明改了哪些章节。
|
|
15
|
-
|
|
16
|
-
## 限制
|
|
17
|
-
|
|
18
|
-
不要输出与报告无关的闲聊;不要擅自改成日报 / 周报口径。
|
|
19
|
-
`;function r(){let t=e();return t?`tw.testReports.promptMounts.v1:${t}`:`tw.testReports.promptMounts.v1`}function i(){if(typeof localStorage>`u`)return{};try{let e=localStorage.getItem(r());if(!e)return{};let t=JSON.parse(e);return t&&typeof t==`object`?t:{}}catch{return{}}}function a(e){if(typeof localStorage<`u`)try{localStorage.setItem(r(),JSON.stringify(e))}catch{}}function o(e,t){let n={...i()},r=t.trim();return r?n[e]=r:delete n[e],a(n),n}function s(e){return i()[e]?.trim()||(t.find(t=>t.id===e)?.defaultPrompt??``)}function c(e){let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).split(`/`).filter(Boolean)[0]??``;return t.find(e=>e.folder===n)?.id??null}function l(e){return t.find(t=>t.id===e)??t[0]}export{c as a,l as i,n,i as o,o as r,s,t};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{p as e,v as t}from"./project-docs.CCjtiFjB.js";var n=`/__tb_uiauto`,r=`自动化执行提示词.md`,i=`自动化项目提示词.md`;function a(e,t){let n=String(e??``).trim();if(!n)return``;let r=n.split(`
|
|
2
|
-
`),i=[];if(r.forEach((e,t)=>{/^###\s+\S/.test(e)&&i.push(t)}),!i.length)return n;let a=r.slice(0,i[0]).join(`
|
|
3
|
-
`).trim(),o=String(t??``).trim().toLowerCase();if(!o)return a;for(let e=0;e<i.length;e+=1){let t=i[e],n=e+1<i.length?i[e+1]:r.length;if(r[t].replace(/^###\s+/,``).trim().toLowerCase().includes(o))return[a,r.slice(t+1,n).join(`
|
|
4
|
-
`).trim()].filter(Boolean).join(`
|
|
5
|
-
|
|
6
|
-
`)}return a}function o(e,t){let n=String(e??``),r={plan:``,agent:``,code:``,skeleton:``};if(!n.trim())return r;let i=``,o=[],s=()=>{let e=o.join(`
|
|
7
|
-
`).trim();i&&(r[i]=e),o=[]};for(let e of n.split(`
|
|
8
|
-
`)){let t=/^##\s+(.+?)\s*$/.exec(e);if(t){s();let e=t[1];i=/骨架/.test(e)?`skeleton`:/规划/.test(e)?`plan`:/探索/.test(e)?`agent`:/代码|出码/.test(e)?`code`:``}else(i||!/^#\s/.test(e)&&!/^>\s?/.test(e))&&i&&o.push(e)}return s(),r.skeleton=a(r.skeleton,t),r}function s(e){return[`# ${e.replace(/\.md$/i,``).trim()||`自动化执行提示词.md`.replace(/\.md$/i,``)}`,``,`> 自动化测试提示词:生成时按下面三段分别作为「规划 / 探索 / 出码」的系统提示词。`,``,`## 规划阶段`,``,`- 一行一步,只写「动作 + 目标」;`,`- 覆盖:打开页面、关键前置(登录 / 导航)、核心操作、至少一条结果断言。`,``,`## 探索阶段`,``,`- 每一步先用可读描述定位目标,再回填真实定位器;`,`- 关键节点截一张图,方便人确认;`,"- 账号 / 密码等占位数据写成 `${ENV_NAME}`,不要写死。",``,`## 生成代码`,``,`- 复用项目已有的 page object / fixture / 登录态,不要另起一套;`,`- 选择器用探索阶段确认过的定位器,不加与断言无关的 sleep。`,``].join(`
|
|
9
|
-
`)}function c(e){let t=Array.from(String(e??``)).map(e=>e.charCodeAt(0)<32||`\\/:*?"<>|`.includes(e)?` `:e).join(``).replace(/\s+/g,` `).trim();if(!t)return``;let n=/\.md$/i.test(t)?t:`${t}.md`;return n.length>120?``:n}async function l(n,r){let i=c(n);if(!i)throw Error(`文件名不合法:不能包含 / \\ : * ? " < > |`);let a=``;if(r)try{a=(await e(`prompts`,r)).content}catch{a=``}return await t(`prompts`,i,a.trim()?a:s(i)),i}async function u(e){let t=await fetch(`${n}/prompt/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`同步 UI 自动化测试提示词失败(${t.status})`);return await t.json()}async function d(t,n){let r=String(t??``).trim()||`自动化执行提示词.md`,i={ok:!1,file:r,exists:!1,plan:``,agent:``,code:``};try{let{content:t}=await e(`prompts`,r);return{ok:!0,file:r,exists:!!t.trim(),...o(t,n)}}catch(e){return{...i,error:e instanceof Error?e.message:String(e)}}}export{c as a,d as i,r as n,u as o,l as r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`/__tb_uiauto`;function t(e){return e===`ui`?`UI`:e===`api`?`接口`:e===`test`?`测试`:``}var n={running:{label:`运行中`,tone:`blue`},passed:{label:`通过`,tone:`green`},failed:{label:`失败`,tone:`red`},cancelled:{label:`已取消`,tone:`gray`},error:{label:`错误`,tone:`red`},interrupted:{label:`已中断`,tone:`amber`}};function r(e){return e!==`running`}function i(e){if(!Number.isFinite(e)||e<=0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function a(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(`zh-CN`,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}):`—`}function o(e,t=`playwright`){if(!e)return`全量`;let n=[];return e.file&&n.push(e.file),e.grep&&(t===`pytest`?n.push(`-k ${e.grep}`):t===`selenium`?n.push(e.grep):n.push(`grep: ${e.grep}`)),t===`pytest`?(e.marker&&n.push(`-m ${e.marker}`),e.lastFailed&&n.push(`--lf`),e.bail&&n.push(`-x`),e.maxFail>0&&n.push(`--maxfail=${e.maxFail}`)):t===`playwright`&&(e.project&&n.push(e.project),e.headed&&n.push(`headed`),e.workers>0&&n.push(`workers=${e.workers}`),e.lastFailed&&n.push(`--last-failed`),e.bail&&n.push(`--max-failures=1`)),n.length?n.join(` · `):`全量`}function s(e){let t=(e??``).trim();if(!t)return``;let n=t[0]===`"`||t[0]===`'`?t[0]:``,r=t,i=``;if(n){let e=t.indexOf(n,1);r=e>0?t.slice(1,e):t.slice(1),i=e>0?t.slice(e+1).trim():``}else{let e=t.search(/\s/);r=e>0?t.slice(0,e):t,i=e>0?t.slice(e+1).trim():``}let a=/[\\/]/.test(r)?r.split(/[\\/]/).pop()??r:r;return i?`${a} ${i}`:a}function c(e){let t=[`共 ${e.total}`,`通过 ${e.passed}`,`失败 ${e.failed}`,`跳过 ${e.skipped}`];return e.flaky>0&&t.push(`不稳定 ${e.flaky}`),t.join(` · `)}async function l(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(){let e=await l(`/projects`);return{projects:e.projects,frameworks:e.frameworks??[]}}function d(e){let t=String(e??``).trim().replace(/\\/g,`/`).replace(/\/+$/,``);return t?(/^[a-zA-Z]:$/.test(t)&&(t+=`/`),t):``}function f(e,t){let n=d(t);if(!n)return null;let r=e.find(e=>d(e.dir)===n);if(r)return r;let i=n.toLowerCase();return e.find(e=>d(e.dir).toLowerCase()===i)??null}async function p(){try{let{projects:e}=await u();return e.map(e=>(e.promptFile??``).trim()).filter(Boolean)}catch{return null}}async function m(e){return l(`/detect`,{method:`POST`,body:JSON.stringify({dir:e})})}async function h(){return(await l(`/scaffold/stacks`)).stacks??[]}async function g(e){return l(`/scaffold/preview`,{method:`POST`,body:JSON.stringify(e)})}async function _(e=`playwright`){return l(`/skeleton?stack=${encodeURIComponent(e)}`)}async function v(e){return l(`/scaffold/check`,{method:`POST`,body:JSON.stringify(e)})}async function y(e){return l(`/scaffold`,{method:`POST`,body:JSON.stringify(e)})}async function b(e){return l(`/scaffold/update`,{method:`POST`,body:JSON.stringify(e)})}var x=`lantern:uiauto:prompt-mounts`;function S(){typeof window<`u`&&window.dispatchEvent(new Event(x))}function C(e){return typeof window>`u`?()=>void 0:(window.addEventListener(x,e),()=>window.removeEventListener(x,e))}async function w(){let e=await l(`/pick-directory`,{method:`POST`});return e.canceled?``:e.dir??``}async function T(e,t=``,n){return(await l(`/projects`,{method:`POST`,body:JSON.stringify({dir:e,name:t,framework:n})})).project}async function E(e){return(await l(`/projects`,{method:`PATCH`,body:JSON.stringify(e)})).project}async function D(e){await l(`/projects?id=${encodeURIComponent(e)}`,{method:`DELETE`})}async function O(e,t={}){let n=await l(`/run`,{method:`POST`,body:JSON.stringify({projectId:e,...t})});return{run:n.run,envWarning:n.envWarning??``}}async function k(e){await l(`/stop`,{method:`POST`,body:JSON.stringify({runId:e})})}async function A(e){return l(`/run/allure`,{method:`POST`,body:JSON.stringify({runId:e})})}async function j(e,t=0){return l(`/run?${new URLSearchParams({id:e,offset:String(t)}).toString()}`)}async function M(e){return l(`/project/setup`,{method:`POST`,body:JSON.stringify({projectId:e})})}async function N(e,t=0){return l(`/project/setup?${new URLSearchParams({projectId:e,offset:String(t)}).toString()}`)}async function P(e){await l(`/project/setup/stop`,{method:`POST`,body:JSON.stringify({projectId:e})})}async function F(e){return(await l(`/scaffold/record?projectId=${encodeURIComponent(e)}`)).record}async function I(e){return(await l(`/runs?projectId=${encodeURIComponent(e)}`)).runs}async function L(e){await l(`/run?id=${encodeURIComponent(e)}`,{method:`DELETE`})}export{O as A,f as C,g as D,w as E,b as F,k as M,c as N,D as O,E as P,r as S,C as T,_,y as a,t as b,m as c,N as d,u as f,h as g,F as h,v as i,P as j,M as k,s as l,I as m,e as n,L as o,j as p,T as r,o as s,n as t,p as u,a as v,S as w,A as x,i as y};
|