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
|
@@ -0,0 +1,31 @@
|
|
|
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{b as t}from"./settings.BojKNwUC.js";import{t as n}from"./app-version.CkDFkv4s.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(`#4176e6`,`#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(`#4176e6`,`#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 t(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:n},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 re=`/__tb_reqanalysis`,ie=`需求分析提示词.md`,ae=`需求分析`,oe=12e3,se=2e4,ce={draft:{label:`待拆解`,tone:`gray`},decomposed:{label:`已拆解`,tone:`blue`},checked:{label:`已审查`,tone:`amber`},accepted:{label:`已验收`,tone:`green`}},le={P0:`red`,P1:`amber`,P2:`gray`},ue={"uncovered-outline":`待确认·未覆盖`,"pending-confirm":`待确认`,"missing-field":`字段缺失`,"missing-scenario":`场景遗漏`,"missing-dimension":`维度缺失`,"untestable-acceptance":`验收不可测`,conflict:`与原文冲突`,"over-split":`过度拆分`,other:`其它`},de=new Set([`uncovered-outline`,`pending-confirm`,`conflict`,`other`]);function fe(e){return de.has(e.type)}function pe(e){return e.filter(fe)}var me={high:`高`,medium:`中`,low:`低`},he={high:`red`,medium:`amber`,low:`gray`},ge=[{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:`补充跨时区时间展示、多语言文案与本地化格式。`}],_e=/创建|新增|新建|保存|提交|删除|编辑|修改|更新|上传|导入|导出|发布|审批|撤回|绑定|解绑|发送|支付|下单|配置|启停|启用|停用/;async function m(e,t){let n=await fetch(`${re}${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 ve(){try{return(await fetch(`${re}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function ye(){return(await m(`/list`)).docs??[]}async function be(e){return(await m(`/create`,{method:`POST`,body:JSON.stringify(e)})).doc}async function xe(e,t){return(await m(`/`,{method:`PUT`,body:JSON.stringify({id:e,...t})})).doc}async function Se(e){await m(`/delete`,{method:`POST`,body:JSON.stringify({id:e})})}async function Ce(){try{let e=await m(`/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:ie,exists:!1,decompose:``,stories:``,structure:``,audit:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function we(e){return await m(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}async function Te(e){return(await Oe(e)).content}async function Ee(e,t=se){try{let n=(await Te(e)).trim();return{text:n.slice(0,t),total:n.length,truncated:n.length>t}}catch{return{text:``,total:0,truncated:!1}}}async function De(){return(await m(`/sources`)).files??[]}async function Oe(e){return m(`/source?path=${encodeURIComponent(e)}`)}var ke=/[\s\p{P}\p{S}]+/gu;function h(e){return String(e??``).toLowerCase().replace(ke,``)}function g(e){return Array.from(new Set(e.map(e=>String(e??``).trim()).filter(Boolean)))}function _(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function v(e,t=30,n=500){return Array.isArray(e)?e.map(e=>_(e,n)).filter(Boolean).slice(0,t):[]}function Ae(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 je(e){return Ae(String(e??``))}function y(e,t=80){return String(e??``).replace(/\s+/g,` `).trim().slice(0,t)}function b(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 Me(e){return y((String(e??``).split(/[/\\]/).pop()?.replace(/\.[^.]+$/,``).trim()||``).replace(/_?需求文档$/u,``).replace(/_?需求说明$/u,``).replace(/_?需求$/u,``).trim())||`未命名需求`}function x(e){return String(e.sourceTitle||e.title||``).trim()||Me(e.sourcePath)}function Ne(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 Pe(e){let t=Ne(e);return t=t.replace(/v?\d+(?:\.\d+)*/gi,``),t.replace(/[\s_\-—·()()[\]【】]+/gu,``).toLowerCase()}function S(e){let t=Ne(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 Fe(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 Ie(e,t){let n=x(e),r=Pe(n),i=S(n);return!r||!i?[]:t.filter(t=>{if(t.id===e.id)return!1;let n=x(t);if(Pe(n)!==r)return!1;let a=S(n);return a?Fe(a,i)<0:!1}).sort((e,t)=>Fe(S(x(e))??[],S(x(t))??[]))}function Le(e){let t=[];for(let n of e){let e=x(n);for(let r of B(n.outline))t.push({docId:n.id,docLabel:e,point:r})}return t}function Re(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 ze=40,Be=7e3;function Ve(e,t,n){if(!t.length)return[];let r=Math.max(1,n?.maxItems??ze),i=Math.max(200,n?.maxChars??Be),a=Re(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=Re(`${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=C(e);if(c.length>0&&l+t.length+1>i)break;c.push(e),l+=t.length+1}return c}function C(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(C)].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=y(t.match(/【([^】\n]{1,40})】/)?.[1]||e.title||e.small);return{...e,title:n||e.small,body:t||`【${n||e.small}】`}}function w(e){return String(e??``).toLowerCase().replace(/[\s\p{P}\p{S}]+/gu,``)}function T(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 qe(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?y(r,14):``}function Je(e){let t=new Set,n=new Map;return e.map(e=>{let r=e.title||e.small,i=w(r),a=(n.get(i)??0)+1;if(n.set(i,a),a===1&&!t.has(i))return t.add(i),e;let o=qe(e.body,r),s=a,c=y(o?`${r} · ${o}`:`${r}(${s})`);for(;t.has(w(c));)s+=1,c=y(o?`${r} · ${o}(${s})`:`${r}(${s})`);return t.add(w(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=[`小模块`,`功能点`,`需求点`,`二级模块`,`子模块`],Ye=[`优化/问题内容`,`优化问题内容`,`问题内容`,`需求描述`,`需求内容`,`需求说明`,`功能描述`,`描述`,`优化内容`],Xe=[`模块`,`功能模块`,`所属模块`],j=[`需求内容`,`需求点`,`功能点`,`需求说明`,`功能说明`],Ze=[`字段名称`,`字段类型`,`字段定义`,`校验规则`,`输入方式`];function Qe(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 $e(e){return Ze.filter(t=>e.some(e=>D(e,[t]))).length>=2||e.some(e=>D(e,[`字段名称`]))}function et(e){if($e(e))return!1;let t=O(e,Xe),n=O(e,j);return!(t<0||n<0||t===n||M(e))}function tt(e){let t=e=>{let t=e.findIndex(M);return t<0?null:{headers:e[t],rows:e.slice(t+1)}};return t(T(e))??t(Qe(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=tt(t);if(!r)continue;let i=O(r.headers,k),a=O(r.headers,A),o=O(r.headers,Ye);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 Je(n)}function P(e,t){let n=y(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})$`),nt=RegExp(`(?:^|[||。;;\\s])(?:无\\s*)?(?:${F})(?=\\s*[||]|\\s*$)`);function rt(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 it(e,t){return e.length>=t?e.slice(0,t):[...Array(t-e.length).fill(``),...e]}function at(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(!et(i))continue;let a=i.map(E).join(`,`);if(r.has(a))continue;r.add(a);let o=O(i,Xe),s=O(i,j),c=``,l=t+1;for(;l<e.length;l+=1){let t=e[l];if(et(t)||M(t)||$e(t)||t.every(e=>!e.trim()))break;t=it(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(T(t)),i(Qe(t)),L(n)}function L(e){let t=new Set,n=new Map;return e.map(e=>{let r=e.title,i=w(r),a=(n.get(i)??0)+1;if(n.set(i,a),a===1&&!t.has(i))return t.add(i),e;let o=qe(e.body,r),s=a,c=y(o?`${r} · ${o}`:`${r}(${s})`);for(;t.has(w(c));)s+=1,c=y(o?`${r} · ${o}(${s})`:`${r}(${s})`);return t.add(w(c)),{...e,title:c}})}function ot(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=rt(e);if(n.length>=3)return{schema:`feature-kv`,entries:n};let r=at(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 st(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=y(n[1]??``);if(!r)continue;let a=e.replace(RegExp(`^#{${i}}\\s+.+?\\s*\\n?`),``).trim().slice(0,4e3);if(!a)continue;let o=w(r);t.has(o)||t.set(o,a);let s=r.replace(/^功能[-—–]\s*/,``).trim();if(s&&s!==r){let e=w(s);t.has(e)||t.set(e,a)}}return t}function R(e,t){let n=st(t);return n.size?e.map(e=>{if((e.body||``).replace(/\s+/g,``).length>=40)return e;let t=[w(e.title),w(e.title.split(` · `)[0]??``),w(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 ct(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=y(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 lt(e){let t=ot(e);if(t&&t.entries.length>=3)return z(t.schema===`module-content`?R(t.entries,e):t.entries);let n=ct(e);return n.length?z(n):t?.entries.length?z(t.schema===`module-content`?R(t.entries,e):t.entries):z(Y(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 ut(e,t=[]){let n=lt(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 dt(e,t){let n=new Set(t.flatMap(e=>e.sourceRefs));return B(e).filter(e=>!n.has(e.id))}function ft(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 pt(e,t){let n=String(e??``);if(!n)return 2**53-1;let r=K(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:pt(n,e)})).sort((e,t)=>e.rank===t.rank?e.index-t.index:e.rank-t.rank).map(e=>e.p)}function mt(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=mt(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 ht(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 gt(e){let t=[...e],n=new Map,r=t.filter(e=>!e.parentId&&!e.kind);for(let e of r){let r=ht(t,e);t=r.outline;for(let[e,t]of r.idMap)n.set(e,t)}return{outline:t,idMap:n}}function _t(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=ht(e,r),a=i.idMap.get(t)??t;return{outline:i.outline,pointId:a,idMap:i.idMap,parentId:r.id}}function vt(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 yt(e,t,n){let r=_t(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)=>mt(i,o+2+t));return{outline:l.outline,idMap:vt(r.idMap,l.idMap),addedIds:u}}function bt(e,t){let n=_t(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:vt(c,s.idMap),removedId:i,removedIds:a}}function xt(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 St(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=>g(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 Ct(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=Ct(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 G(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 K(e,t){let n=G(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 q(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=G(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=q(i,a,Math.min(o,s));return i.slice(a,Math.min(o,s,e)).trim()}let c=q(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)?q(e,t,r):q(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:K(e,a)})),c=i?G(i,a):-1,l=r?G(r,a):-1,u=c>=0?c:l>=0?l:K(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=h(e.title??``);return`${e.type}|${e.storyId||``}|${e.outlineId||``}|${t}`}function J(e,t){if(Ht(e)===Ht(t))return!0;if(e.type!==t.type||(e.storyId||``)!==(t.storyId||``))return!1;let n=h(e.title??``),r=h(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=>J(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)&&J(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=>J(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?cn(e)&&e.exceptions.length<2&&t.push({key:`write-exceptions`,label:`写操作异常不足`}):t.push({key:`exceptions`,label:`缺异常场景`}),!e.altFlows.length&&cn(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=w(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=w(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=y(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=y(e[1]??``);!t||t.length>40||a.has(t)||(a.add(t),i.push(t))}return i}function Y(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=Y(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=y(e[1]??``);!t||t.length>24||i.has(t)||(i.add(t),r.push(t))}return r}function X(e,t,n){return`g_${Ae(`${e}|${t}|${n}`)}`}function en(e){let t=e&&typeof e==`object`?e:{},n=_(t.priority,4);return{id:_(t.id,20),title:_(t.title,200),role:_(t.role,120),goal:_(t.goal,500),value:_(t.value,500),sourceRefs:v(t.sourceRefs,20,40),priority:n===`P0`||n===`P1`||n===`P2`?n:`P1`,preconditions:v(t.preconditions),mainFlow:(Array.isArray(t.mainFlow)?t.mainFlow:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{actor:_(t.actor,80),action:_(t.action,500),result:_(t.result,500)}}).filter(e=>e.action).slice(0,40),altFlows:(Array.isArray(t.altFlows)?t.altFlows:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{name:_(t.name,120)||`替代流程`,trigger:_(t.trigger,500),steps:v(t.steps,20)}}).slice(0,20),exceptions:(Array.isArray(t.exceptions)?t.exceptions:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{scenario:_(t.scenario,500),expected:_(t.expected,500)}}).filter(e=>e.scenario).slice(0,30),postconditions:v(t.postconditions),acceptance:(Array.isArray(t.acceptance)?t.acceptance:[]).map(e=>{let t=e&&typeof e==`object`?e:{};return{given:_(t.given,500),when:_(t.when,500),then:_(t.then,500)}}).filter(e=>e.given||e.when||e.then).slice(0,30),dimensions:v(t.dimensions,12,40)}}function tn(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`${h(e.title)}|${t?h(`${t.action}${t.result??``}`):``}`}function nn(e,t){let n=e.map(tn),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=en(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=g([...a.sourceRefs,...t.sourceRefs]),a.dimensions=g([...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 rn(e,t){let n=h(e),r=h(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 an=4;function on(e,t){let n=e.map(tn);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=rn(e.title,r.title);i>n&&(n=i,t=r)}!t||n<an||(e.sourceRefs=[t.id],a.add(t.id),o+=1)}return{stories:n,filled:o}}function sn(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 cn(e){return e.mainFlow.some(e=>_e.test(e.action))}function ln(e,t,n,r,i,a,o=``){return{id:X(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 un=new Set([`缺少角色`,`缺少目标`,`缺少前置条件`,`缺少主流程`,`没有异常场景`,`写操作缺少异常分支`,`缺少验收标准`,`验收标准缺 then`,`没有关联需求条目`,`只写了主流程`]);function dn(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(ln(`uncovered-outline`,``,`${n}:还没有用户故事挂上`,`需求点「${n}」在文档里有,但目前没有任何故事引用它。可能是漏拆了,也可能这块其实不用测。`,`跟业务确认要不要覆盖:要的话补一条故事(或在已有故事里挂上这个点);不要的话直接忽略。`,`high`,e.id))}let o=ge.map(e=>{let t=n.filter(t=>{let n=sn(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 fn(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?un.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):h(a.title)!==h(e.title)&&(n.push({...e}),i.add(e.id)):(n.push({...e}),r.set(t,e),i.add(e.id))}return n}function pn(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 mn(e,t=oe){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?pn(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 hn(e){return e.filter(Boolean).map(e=>`- ${e}`)}function gn(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(...hn(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(...hn(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 _n(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||`(未指定)`}\` · 状态:${ce[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(...gn(t,e.outline));return i.join(`
|
|
29
|
+
`)}function vn(e){return(b(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 yn(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 bn(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 xn(e,t){let n=String(e??``);if(!n.trim())return null;let r=[],i=[];for(let e of bn(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 Sn(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 Cn=/(?:需求编号|编号)\s*[||::]\s*([A-Za-z]{1,8}(?:-\d+)+)/,wn=/(?:^|[\s。;;||])(\d{1,2}(?:[、.]|\.(?=\s)))/g;function Tn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function En(e,t){if(!t)return e.trim();let n=RegExp(`(?:需求编号|编号)\\s*[||::]\\s*${Tn(t)}(?:\\s*功能名称\\s*[||][\\s\\S]*?功能描述\\s*[||]\\s*)?`);return e.replace(n,``).replace(/^[\s||::]+/,``).trim()}function Dn(e){let t=nt.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 On(e){let t=[];for(let n of e.matchAll(wn)){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 kn(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{id:``,parts:[]};let n=Cn.exec(t)?.[1]??``,r=On(t),i=[],a=e=>{let t=Dn(En(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?En(t,n):t);return{id:n,parts:i}}function An(e,t){return t.map((t,n)=>({id:`${e}-${n+1}`,title:t,role:`body`,children:[]}))}function jn(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}=kn(e.body),o=An(`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 Mn(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 Nn(e){let t=b(e)||e.title||`需求分析`,n=e.sourceExport?.groups??[];return n.length?Mn(jn(t,n)):`# ${t} · 需求原文\n\n- (还没有原文结构,请先拆解需求)\n`}function Pn(e){let t=new Date().toISOString().slice(0,10),n=`${vn(e)}-需求原文-${t}.md`;return p(new Blob([Nn(e)],{type:`text/markdown;charset=utf-8`}),n),n}export{je as $,ye as A,Ot as B,Et as C,W as D,X as E,gt as F,St as G,Te as H,B as I,b as J,bt as K,Ct as L,fn as M,Sn as N,yt as O,nn as P,Dt as Q,kt as R,Gt as S,Qt as T,Ee as U,yn as V,Wt as W,Ve as X,Ue as Y,ut as Z,ve as _,ie as a,xt as at,Ut as b,xn as c,f as ct,Le as d,p as dt,mn as et,be as f,ne as ft,Y as g,$t as h,ae as i,dt as it,De as j,Ie as k,dn as l,d as lt,Pn as m,l as mt,he as n,Kt as nt,le as o,xe as ot,Se as p,te as pt,x as q,ue as r,we as rt,ce as s,r as st,me as t,_n as tt,ft as u,ee as ut,Ce as v,He as w,pe as x,on as y,Vt as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`/__tb_req_breakdowns`;async function t(t=``,n={}){let r=await fetch(`${e}${t}`,n),i=await r.json().catch(()=>({}));if(!r.ok||i.ok===!1)throw Error(i.error||`HTTP ${r.status}`);return i}function n(e){return{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}}async function r(){try{return(await fetch(`${e}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function i(){let e=await t(`/list`);return{revision:Number(e.revision)||0,entries:e.entries||[]}}async function a(e,n=!1){let r=await t(`/entries/${encodeURIComponent(e)}${n?`?includeContent=1`:``}`);return{revision:Number(r.revision)||0,entry:r.entry,content:r.content||null}}async function o(e){await t(`/entries/${encodeURIComponent(e)}/open`,n({}))}async function s(e,r){let i=await t(`/entries/${encodeURIComponent(e)}/retry`,n({expectedRevision:r}));return{revision:Number(i.revision)||0,entry:i.entry}}async function c(e,n,r){let i=await t(`/entries/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({expectedRevision:n,...r})});return{revision:Number(i.revision)||0,entry:i.entry}}async function l(e,n){let r=await t(`/entries/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({expectedRevision:n})});return Number(r.revision)||0}async function u(e,r,i={}){let a=new Uint8Array(await e.arrayBuffer()),o=``;for(let e=0;e<a.length;e+=1)o+=String.fromCharCode(a[e]);let s=await t(`/import`,n({name:e.name,contentBase64:btoa(o),expectedRevision:r,...i}));return{revision:Number(s.revision)||0,entry:s.entry}}async function d(){let e=await t(`/backfill`);return{revision:Number(e.revision)||0,candidates:e.candidates||[]}}async function f(e,r){let i=await t(`/backfill`,n({analysisIds:e,expectedRevision:r}));return{revision:Number(i.revision)||0,created:i.created||[],failed:i.failed||[]}}export{u as a,o as c,a as i,s as l,l as n,d as o,r,i as s,f as t,c as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/i18n.
|
|
2
|
-
import{c as e,l as t,o as n,r,s as i,t as a,u as o}from"./app-config.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/i18n.CEWjL5GX.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.BSO5r82v.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)})};function p(){let e=r(),t=e.model.providers.find(t=>t.id===e.model.activeId);return{contextWindow:typeof t?.contextWindow==`number`&&t.contextWindow>0?Math.floor(t.contextWindow):void 0,supportsTools:t?.supportsTools!==!1,supportsVision:t?.supportsVision===!0}}var m=[{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:``}],h=`tw-settings-changed`,g=`tw-open-settings`;function _(){return t()}function v(){return n()}function y(){return r().model.activeId}function b(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(h))}function x(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(h)),i}function S(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(h)),n}function C(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(h)))}function w(e){let t=_();t&&b({...t,...e})}var T=`tw-access-changed`;function E(){return r().access}function D(e){o({access:e}),a(),typeof window<`u`&&window.dispatchEvent(new CustomEvent(T,{detail:e}))}function O(e){if(typeof window>`u`)return()=>{};let t=t=>{let n=t.detail;e(n??E())};return window.addEventListener(T,t),()=>window.removeEventListener(T,t)}function k(e){return window.addEventListener(h,e),()=>window.removeEventListener(h,e)}function A(e=`general`){window.dispatchEvent(new CustomEvent(g,{detail:{tab:e}}))}var j=`tw-general-prefs-changed`;function M(){return{...r().general}}function N(e){let t={...M(),...e};return t.sessionFontSize<12&&(t.sessionFontSize=12),t.sessionFontSize>22&&(t.sessionFontSize=22),o({general:t}),a(),R(t),typeof window<`u`&&window.dispatchEvent(new CustomEvent(j,{detail:t})),t}function P(e){if(typeof window>`u`)return()=>{};let t=t=>{e(t.detail??M())};return window.addEventListener(j,t),()=>window.removeEventListener(j,t)}var F=null,I=null;function L(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function R(e=M()){if(typeof document>`u`)return;let t=document.documentElement,n=L(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=``,F&&I&&(F.removeEventListener(`change`,I),F=null,I=null),e.appearance===`system`&&(F=window.matchMedia(`(prefers-color-scheme: dark)`),I=()=>{let e=L(`system`);t.dataset.theme=e,t.style.colorScheme=e},F.addEventListener(`change`,I));try{f(()=>import(`./i18n.CEWjL5GX.js`).then(e=>e.t).then(t=>t.applyDomI18n(e.language)),__vite__mapDeps([0,1]))}catch{}}export{N as _,p as a,f as b,M as c,O as d,P as f,D as g,w as h,S as i,v as l,A as m,m as n,y as o,k as p,R as r,E as s,g as t,_ as u,C as v,x as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function e(e,t={}){let n=await fetch(`/__tb_fs/skill-store`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e,...t}),signal:AbortSignal.timeout(3e4)}),r=await n.json();if(!n.ok||r.error)throw Error(r.error||`HTTP ${n.status}`);return r}var t=(t,n)=>e(`lifecycle`,{owner:t,enabled:n});async function n(){await e(`migrate`);let t=await e(`list`);return new Set(t.skills.map(e=>e.group)).size}async function r(t,n,r){return(await e(`ensure-seed`,{name:t,content:n,owner:r})).legacyPath}async function i(t){await e(`migrate`);let n=(await e(`list`)).skills.find(e=>e.legacyPath===t);if(!n)throw Error(`默认技能不存在,请重新打开插件或到技能页启用`);return(await e(`read`,{id:n.id})).skill.content}async function a(t){return await e(`migrate`),(await e(`list`)).skills.filter(e=>e.enabled&&(e.owner===t||e.pluginRefs.includes(t)))}async function o(t,n=[]){let r=await a(t);if(!r.length)return null;let i=new Set(n.map(e=>e.trim()).filter(Boolean)),o=r.find(e=>i.has(e.legacyPath))||r.find(e=>i.has(e.name))||r[0];return o?{skill:o,content:(await e(`read`,{id:o.id})).skill.content}:null}export{o as a,i,n,e as o,a as r,t as s,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,t}from"./app-config.
|
|
1
|
+
import{f as e,t}from"./app-config.BSO5r82v.js";import{n}from"./i18n.CEWjL5GX.js";var r=`/__tb_spaces`;async function i(e,t){try{let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})}),r=await n.json();return n.ok?r:{ok:!1,error:r?.error||`请求失败(HTTP ${n.status})`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function a(e){try{return(await fetch(r,{signal:e??AbortSignal.timeout(2e3)})).ok}catch{return!1}}async function o(t){try{let n=t?.stats?`${r}?stats=1`:r,i=await fetch(n);if(!i.ok)return null;let a=await i.json();return a?.activeId&&e(a.activeId),a}catch{return null}}async function s(n){await t();let a=await i(`${r}/switch`,{id:n});return a.ok&&e(n),a}function c(e,t){return i(`${r}/create`,{name:e,managedParent:t?.managedParent,switch:t?.switch===!0,systemPrompt:t?.systemPrompt,promptBrief:t?.promptBrief})}function l(e){let t=e instanceof Error?e.message:String(e??``);return!t.trim()||/^not found$/i.test(t.trim())?`本地服务版本较旧,还没有空间编辑接口;请重启本地服务后再试`:t}async function u(e){try{let t=await fetch(`${r}/detail?id=${encodeURIComponent(e)}`),n=await t.json();return t.ok?n:{ok:!1,error:l(n?.error??`HTTP ${t.status}`)}}catch(e){return{ok:!1,error:l(e)}}}async function d(e,t){let n=await i(`${r}/update`,{id:e,...t});return n.ok?n:{...n,error:l(n.error)}}function f(e,t){return i(`${r}/copy`,{id:e,name:t})}function p(e,t){return i(`${r}/delete`,{id:e,purge:t,confirm:t===!0})}function m(e,t=`full`){return`${r}/export?id=${encodeURIComponent(e)}${t===`content`?`&scope=content`:``}`}function h(e){return i(`${r}/discover`,Array.isArray(e)&&e.length?{adopt:e}:{})}async function g(e,t){let n=await e.arrayBuffer(),a=new Uint8Array(n),o=``,s=32768;for(let e=0;e<a.length;e+=s)o+=String.fromCharCode(...a.subarray(e,e+s));let c=btoa(o);return i(`${r}/import`,{zipBase64:c,name:t})}function _(e){return e.isPublic?n(`space.publicName`):e.name}function v(e,t){let n=e.includes(`\\`)?`\\`:`/`,r=t.replace(/[/\\]+$/,``),i=`${r}${n}空间池`;if(e===i)return r;let a=`${i}${n}`;return e.startsWith(a)?`${r}${n}${e.slice(a.length)}`:e}function y(e){if(!e||e<=0)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n+=1;return`${r<10&&n>0?r.toFixed(1):Math.round(r)} ${t[n]}`}export{_ as a,u as c,o as d,a as f,h as i,y as l,d as m,c as n,v as o,s as p,p as r,m as s,f as t,g as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as e,s as t,t as n}from"./req-analysis.BLvcktvQ.js";var r=`/__tb_storyreview`,i=`用户故事审查提示词.md`;async function a(e,t){let n=await fetch(`${r}${e}`,{...t,headers:t?.body===void 0?void 0:{"Content-Type":`application/json`,...t?.headers}}),i=await n.json().catch(()=>({}));if(!n.ok||i.ok===!1)throw Error(i.error||`HTTP ${n.status}`);return i}async function o(){try{let e=await a(`/prompt`);return{file:i,exists:e.exists===!0,review:e.review??``,fix:e.fix??``}}catch(e){return{file:i,exists:!1,review:``,fix:``,error:e instanceof Error?e.message:String(e)}}}async function s(e){return a(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var c={high:0,medium:1,low:2};function l(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)=>c[e.severity]-c[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 u(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 d(r,i){let a=[];if(a.push(`# 用户故事审查报告 · ${r.title||`未命名分析`}`),a.push(``),a.push(`> 来源:\`${r.sourcePath||`(未指定)`}\` · 故事 ${r.stories.length} 条`),a.push(``),!i)return a.push(`- 还没有审查结果。`),`${a.join(`
|
|
2
|
+
`)}\n`;let o=i.coverage.total?Math.round(i.coverage.rate*100):0;a.push(`## 结论`),a.push(``),a.push(`- 状态:${t[r.status]?.label??r.status}`),a.push(`- 审查时间:${i.at}`),a.push(`- 需求条目覆盖率:${i.coverage.covered}/${i.coverage.total}(${o}%)`),a.push(`- 维度覆盖:${i.dimensions.map(e=>`${e.label}${e.covered?` ✓`:` ✗`}`).join(` · `)||`(无)`}`);let s=u(i.gaps);a.push(`- 缺口:${i.gaps.length} 条(高 ${s.high} / 中 ${s.medium} / 低 ${s.low})`),i.summary&&(a.push(``),a.push(i.summary)),a.push(``);let c=new Map(r.stories.map(e=>[e.id,e.title])),d=l(i.gaps);if(!d.length)return a.push(`## 缺口清单`),a.push(``),a.push(`- 没有发现缺口。`),`${a.join(`
|
|
3
|
+
`)}\n`;for(let t of d){a.push(`## ${t.label}(${t.gaps.length})`),a.push(``);for(let r of t.gaps){let t=r.storyId?`${r.storyId}${c.get(r.storyId)?` ${c.get(r.storyId)}`:``}`:`全局`;a.push(`- **[${n[r.severity]}] ${e[r.type]}** · ${t} · ${r.title}`),r.detail&&a.push(` - 原因:${r.detail}`),r.suggestion&&a.push(` - 建议:${r.suggestion}`)}a.push(``)}return`${a.join(`
|
|
4
|
+
`).trimEnd()}\n`}function f(e,t){let n=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-审查报告-${new Date().toISOString().slice(0,10)}.md`,r=new Blob([d(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 p(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 m(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(`
|
|
5
|
+
`)}\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(`
|
|
6
|
+
`)}\n`;let o=l(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(`需求内容:${p(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(`
|
|
7
|
+
`).trimEnd()}\n`}function h(e,t,n){let r=`${(e.title||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}-待确认-${new Date().toISOString().slice(0,10)}.md`,i=new Blob([m(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{l as a,o as i,h as n,s as o,f as r,u as t};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{J as e,ct as t,dt as n,ft as r,lt as i,mt as a,pt as o,st as s,ut as c}from"./req-analysis.BLvcktvQ.js";function l(t){return e(t)}var u=`/__tb_testpoints`,d=`测试点生成提示词.md`,f=[`functional`,`boundary`,`exception`,`business`,`nonfunctional`],p=[`P0`,`P1`,`P2`,`P3`],m={functional:{label:`功能`,hint:`主流程 / 替代流程 / 每个功能点`,tone:`blue`,accent:`bg-[#4176e6]`},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]`}},h={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`}},g=Object.fromEntries(f.map(e=>[e,m[e].label]));async function _(e,t){let n=await fetch(`${u}${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 v(){try{let e=await _(`/prompt`);return{file:d,exists:e.exists===!0,generate:e.generate??``}}catch(e){return{file:d,exists:!1,generate:``,error:e instanceof Error?e.message:String(e)}}}async function y(e){return _(`/prompt/sync`,{method:`POST`,body:JSON.stringify({enabled:e})})}var b={P0:0,P1:1,P2:2,P3:3};function x(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:f.filter(e=>t.some(t=>t.dimension===e)).length}}function S(e){return[...e].sort((e,t)=>Number(!!e.supplemental)-Number(!!t.supplemental)||f.indexOf(e.dimension)-f.indexOf(t.dimension)||b[e.priority]-b[t.priority]||e.title.localeCompare(t.title,`zh`))}function C(e,t=[]){if(!e.length)return``;let n=w(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(` - 维度:${m[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 w(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 T(e){return(e||`需求分析`).replace(/[\\/:*?"<>|]/g,`_`).slice(0,60)}function E(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 D(e){return{id:a(`tp`,e.id),title:`[${e.priority}] ${e.title}`,labels:[m[e.dimension].label],markers:[{markerId:h[e.priority].markerId}],notes:{plain:{content:E(e)}}}}var O=[{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 k(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 A(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 O){if(!e.re.test(i))continue;let t=k(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 j(e){let t=S(e);return f.map(e=>({key:e,label:m[e].label,hint:m[e].hint,points:t.filter(t=>t.dimension===e)}))}function M(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?A(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:S(t.points),dimensions:j(t.points)})}return u}var N=s;function P(e,t){return t.map(t=>{let n=t.points.map(D);return{id:a(`dim`,`${e}:${t.key}`),title:`${t.label}(${t.points.length})`,structureClass:n.length?N:void 0,style:c,notes:{plain:{content:`${m[t.key].hint}\n测试点 ${t.points.length} 条`}},children:{attached:n}}})}function F(e){let n=P(e.key,e.dimensions);return{id:a(`req`,e.key),title:`${e.title}(${e.points.length})`,structureClass:N,style:t,notes:{plain:{content:[e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
|
|
4
|
+
`)}},children:{attached:n}}}function I(e,t=[]){let n=e.testPoints,r=M(e,t).filter(e=>e.points.length>0),s=l(e);if(!r.length)return[{id:`sheet-1`,class:`sheet`,title:s,theme:o(),rootTopic:{id:`root-topic`,title:`${s}(0)`,structureClass:N,style:i,notes:{plain:{content:n?.summary||`还没有测试点。`}},children:{attached:f.map(e=>({id:a(`dim`,e),title:`${m[e].label}(0)`,style:c,notes:{plain:{content:`${m[e].hint}\n测试点 0 条`}},children:{attached:[]}}))}}}];if(r.length===1){let e=r[0];return[{id:`sheet-1`,class:`sheet`,title:e.title,theme:o(),rootTopic:{id:a(`root`,e.key),title:`${e.title}(${e.points.length})`,structureClass:N,style:i,notes:{plain:{content:[n?.summary||``,e.storyIds.length?`来源故事:${e.storyIds.join(`、`)}`:``,`测试点 ${e.points.length} 条`].filter(Boolean).join(`
|
|
5
|
+
`)}},children:{attached:P(e.key,e.dimensions)}}}]}let u=r.reduce((e,t)=>e+t.points.length,0);return[{id:`sheet-1`,class:`sheet`,title:s,theme:o(),rootTopic:{id:`root-topic`,title:s,structureClass:N,style:i,notes:{plain:{content:[n?.summary||``,`测试点 ${u} 条`].filter(Boolean).join(`
|
|
6
|
+
`)}},children:{attached:r.map(F)}}}]}async function L(e,t=[]){return r(I(e,t))}async function R(e,t=[]){let r=new Date().toISOString().slice(0,10),i=`${T(l(e))}-测试点-${r}.xmind`,a=await L(e,t);return n(a,i),i}function z(e,t=[]){let n=e.testPoints,r=l(e),i=[];i.push(`# ${r}`),i.push(``);let a=M(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=x(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 B(e,t=[]){let n=new Date().toISOString().slice(0,10),r=`${T(l(e))}-测试点-${n}.md`,i=new Blob([z(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}export{x as a,v as c,y as d,C as f,p as i,M as l,m as n,B as o,h as r,R as s,g as t,w as u};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{t as e}from"./space-skills.CPucW8zt.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
|
+
`;async function r(){for(let r of t)await e(r.defaultPrompt,n,`testReports`)}function i(e){let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).split(`/`).filter(Boolean)[0]??``;return t.find(e=>e.folder===n)?.id??null}function a(e){return t.find(t=>t.id===e)??t[0]}export{i,r as n,a as r,t};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{i as e}from"./space-skills.CPucW8zt.js";var t=`/__tb_uiauto`,n=`自动化执行提示词.md`,r=`自动化项目提示词.md`;function i(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 a(e,t){let n=String(e??``),r={plan:``,agent:``,code:``,skeleton:``};if(!n.trim())return r;let a=``,o=[],s=()=>{let e=o.join(`
|
|
7
|
+
`).trim();a&&(r[a]=e),o=[]};for(let e of n.split(`
|
|
8
|
+
`)){let t=/^##\s+(.+?)\s*$/.exec(e);if(t){s();let e=t[1];a=/骨架/.test(e)?`skeleton`:/规划/.test(e)?`plan`:/探索/.test(e)?`agent`:/代码|出码/.test(e)?`code`:``}else(a||!/^#\s/.test(e)&&!/^>\s?/.test(e))&&a&&o.push(e)}return s(),r.skeleton=i(r.skeleton,t),r}async function o(e){let n=await fetch(`${t}/prompt/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!n.ok)throw Error(`同步 UI 自动化测试提示词失败(${n.status})`);return await n.json()}async function s(t,n){let r=String(t??``).trim()||`自动化执行提示词.md`,i={ok:!1,file:r,exists:!1,plan:``,agent:``,code:``};try{let t=await e(r);return{ok:!0,file:r,exists:!!t.trim(),...a(t,n)}}catch(e){return{...i,error:e instanceof Error?e.message:String(e)}}}export{o as i,n,s as r,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
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(e){return l(`/detect`,{method:`POST`,body:JSON.stringify({dir:e})})}async function m(){return(await l(`/scaffold/stacks`)).stacks??[]}async function h(e){return l(`/scaffold/preview`,{method:`POST`,body:JSON.stringify(e)})}async function g(e=`playwright`){return l(`/skeleton?stack=${encodeURIComponent(e)}`)}async function _(e){return l(`/scaffold/check`,{method:`POST`,body:JSON.stringify(e)})}async function v(e){return l(`/scaffold`,{method:`POST`,body:JSON.stringify(e)})}async function y(e){return l(`/scaffold/update`,{method:`POST`,body:JSON.stringify(e)})}async function b(){let e=await l(`/pick-directory`,{method:`POST`});return e.canceled?``:e.dir??``}async function x(e,t=``,n){return(await l(`/projects`,{method:`POST`,body:JSON.stringify({dir:e,name:t,framework:n})})).project}async function S(e){return(await l(`/projects`,{method:`PATCH`,body:JSON.stringify(e)})).project}async function C(e){await l(`/projects?id=${encodeURIComponent(e)}`,{method:`DELETE`})}async function w(e,t={}){let n=await l(`/run`,{method:`POST`,body:JSON.stringify({projectId:e,...t})});return{run:n.run,envWarning:n.envWarning??``}}async function T(e){await l(`/stop`,{method:`POST`,body:JSON.stringify({runId:e})})}async function E(e){return l(`/run/allure`,{method:`POST`,body:JSON.stringify({runId:e})})}async function D(e,t=0){return l(`/run?${new URLSearchParams({id:e,offset:String(t)}).toString()}`)}async function O(e){return l(`/project/setup`,{method:`POST`,body:JSON.stringify({projectId:e})})}async function k(e,t=0){return l(`/project/setup?${new URLSearchParams({projectId:e,offset:String(t)}).toString()}`)}async function A(e){await l(`/project/setup/stop`,{method:`POST`,body:JSON.stringify({projectId:e})})}async function j(e){return l(`/project/sso-login`,{method:`POST`,body:JSON.stringify(e)})}async function M(e){return l(`/project/auth-setup`,{method:`POST`,body:JSON.stringify(e)})}async function N(e){return(await l(`/scaffold/record?projectId=${encodeURIComponent(e)}`)).record}async function P(e){return(await l(`/runs?projectId=${encodeURIComponent(e)}`)).runs}async function F(e){await l(`/run?id=${encodeURIComponent(e)}`,{method:`DELETE`})}export{A,b as C,j as D,M as E,c as M,S as N,O,y as P,f as S,C as T,a as _,v as a,E as b,p as c,u as d,D as f,g,m as h,_ as i,T as j,w as k,s as l,N as m,e as n,F as o,P as p,x as r,o as s,n as t,k as u,i as v,h as w,r as x,t as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./app-config.
|
|
1
|
+
import{p as e}from"./app-config.BSO5r82v.js";var t=`tw.view.`;function n(n,r,i){try{let a=localStorage.getItem(e(`${t}${n}.v1`));return a&&r.includes(a)?a:i}catch{return i}}function r(n,r){try{localStorage.setItem(e(`${t}${n}.v1`),r)}catch{}}var i=200;function a(n,r=``){try{return localStorage.getItem(e(`${t}${n}.v1`))??r}catch{return r}}function o(n,r){try{let a=e(`${t}${n}.v1`),o=r.slice(0,i);o?localStorage.setItem(a,o):localStorage.removeItem(a)}catch{}}var s=2e4;function c(n,r){try{let i=localStorage.getItem(e(`${t}${n}.v1`));return!i||i.length>s?r:JSON.parse(i)}catch{return r}}function l(n,r){try{let i=e(`${t}${n}.v1`);if(r===``||r==null){localStorage.removeItem(i);return}let a=JSON.stringify(r);if(typeof a!=`string`||a.length>s)return;localStorage.setItem(i,a)}catch{}}function u(n){try{localStorage.removeItem(e(`${t}${n}.v1`))}catch{}}export{l as a,u as i,n,r as o,a as r,o as s,c as t};
|