lantern-harness 0.1.32 → 0.1.34
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 +43 -0
- package/builtin/session/mcp-client.mjs +291 -2
- package/dist/500.html +4 -4
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.4j--gBo-.js → Base.astro_astro_type_script_index_0_lang.CuCwv2e7.js} +2 -2
- package/dist/_astro/Base.huFPH3Mp.css +1 -0
- package/dist/_astro/{CaseExecBoard.CTuf_Nom.js → CaseExecBoard.CTVdi8MV.js} +1 -1
- package/dist/_astro/CaseGenerateApp.BONj-skB.js +10 -0
- package/dist/_astro/{CasesLibrary.C-T3VrPa.js → CasesLibrary.e6nFqhN3.js} +10 -10
- package/dist/_astro/ChatApp.XcaVtt7c.js +226 -0
- package/dist/_astro/{ColumnResize.BgYkV9Iy.js → ColumnResize._Iq05ix_.js} +1 -1
- package/dist/_astro/{DashboardBoard.B5Qo5Y3e.js → DashboardBoard.BaJyXPXA.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.DnxVsmed.js → DocsFileBrowser.D2Cff2LP.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.DARUegK8.js → KnowledgeLibrary.CWxIHa8I.js} +1 -1
- package/dist/_astro/{NavLibraries.FAj9zUuq.js → NavLibraries.CZlA6Z1w.js} +1 -1
- package/dist/_astro/PluginsPage.Ch3rrYRF.js +1 -0
- package/dist/_astro/PluginsPage.DOGWQcVc.js +17 -0
- package/dist/_astro/{PmBugsBoard.uNPzbw-N.js → PmBugsBoard.ChL0RBVn.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.CjR8L71i.js → PmIterationsBoard.hTKVnMgh.js} +1 -1
- package/dist/_astro/{PmProjectDetail.Cpug99Lt.js → PmProjectDetail.Saj76lNM.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.VLqrwucj.js → PmProjectsBoard.CCtClGM1.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.BNNq671Z.js +1 -0
- package/dist/_astro/{PmRequirementsBoard.CdP4gEzq.js → PmRequirementsBoard.DGXYC1Te.js} +1 -1
- package/dist/_astro/{PmShared.ChKKU3Ww.js → PmShared.BuhrL7Gb.js} +1 -1
- package/dist/_astro/PromptsLibrary.C9F9RVpz.js +1 -0
- package/dist/_astro/{ReportsPage.iSM5TWMq.js → ReportsPage.BjD8w0zS.js} +1 -1
- package/dist/_astro/ReqAnalysisBoard.JfmIK2Bb.js +39 -0
- package/dist/_astro/{RequirementsLibrary.X89V8-QF.js → RequirementsLibrary.WxAFCP3X.js} +1 -1
- package/dist/_astro/{SettingsDialog.BlokCWBn.js → SettingsDialog.BpKHIbID.js} +1 -1
- package/dist/_astro/SpaceSwitcher.BCZbiL7o.js +7 -0
- package/dist/_astro/{TasksBoard.Z8rBCO1F.js → TasksBoard.CdWQSwlg.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.DBHSAPQ0.js → TemplatesLibrary.y_RtSjYC.js} +1 -1
- package/dist/_astro/{TestStatsBoard.BtqoPuLc.js → TestStatsBoard.C3vkF9vc.js} +1 -1
- package/dist/_astro/{TodosBoard.ETI63YgA.js → TodosBoard.CSupMlTp.js} +1 -1
- package/dist/_astro/{UiAutoBoard.DxrlgvI7.js → UiAutoBoard._og5jRon.js} +3 -3
- package/dist/_astro/app-version.trTEbNVs.js +1 -0
- package/dist/_astro/{case-gen-run.BNNfA12U.js → case-gen-run.BSJ0o4Zq.js} +1 -1
- package/dist/_astro/{plugins.SqANn3ZB.js → plugins.CVnHeKyf.js} +1 -1
- package/dist/_astro/prompts-meta.Dnmq-SnF.js +2 -0
- package/dist/_astro/req-analysis.D-dTIxXF.js +31 -0
- package/dist/_astro/story-review.CvXvtZ90.js +14 -0
- package/dist/case-exec/index.html +5 -5
- package/dist/cases/generate/index.html +5 -5
- package/dist/cases/library/index.html +5 -5
- package/dist/dashboard/index.html +5 -5
- package/dist/docs/changelog/index.html +77 -38
- package/dist/docs/install/index.html +13 -7
- package/dist/docs/manual/index.html +29 -19
- package/dist/knowledge/index.html +5 -5
- package/dist/plugins/index.html +5 -5
- package/dist/pm/bugs/index.html +5 -5
- package/dist/pm/iterations/index.html +5 -5
- package/dist/pm/projects/detail/index.html +5 -5
- package/dist/pm/projects/index.html +5 -5
- package/dist/pm/requirements/index.html +5 -5
- package/dist/prompts/index.html +5 -5
- package/dist/reports/index.html +5 -5
- package/dist/requirement-analysis/index.html +5 -5
- package/dist/requirements/index.html +5 -5
- package/dist/tasks/index.html +5 -5
- package/dist/templates/index.html +5 -5
- package/dist/test-automation/index.html +5 -5
- package/dist/test-stats/index.html +5 -5
- package/dist/todos/index.html +5 -5
- package/dist/workbench/index.html +5 -5
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +3 -3
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +9 -3
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +32 -20
- package/lh-plugins/lh-mcp.mjs +67 -2
- package/lh-plugins/lh-req-analysis.mjs +60 -3
- package/lh-plugins/plugin-prompts.mjs +2 -0
- package/lh-plugins/req-analysis-prompt.mjs +30 -4
- package/package.json +1 -1
- package/dist/_astro/Base.9LLJ6KVG.css +0 -1
- package/dist/_astro/CaseGenerateApp.18SE0dLJ.js +0 -10
- package/dist/_astro/ChatApp.BpFXgd8K.js +0 -226
- package/dist/_astro/PluginsPage.DKPA2zw8.js +0 -1
- package/dist/_astro/PluginsPage.F0oMYJri.js +0 -7
- package/dist/_astro/PmRequirementsBoard.B5ypu68O.js +0 -1
- package/dist/_astro/PromptsLibrary.BlWPVm1Z.js +0 -1
- package/dist/_astro/ReqAnalysisBoard.CeQbq7Qh.js +0 -39
- package/dist/_astro/SpaceSwitcher.MmSkP3wb.js +0 -7
- package/dist/_astro/app-version.CLOjRiPN.js +0 -1
- package/dist/_astro/prompts-meta.C_MeYq8G.js +0 -2
- package/dist/_astro/req-analysis.Dbe_gqPz.js +0 -24
- package/dist/_astro/story-review.CNZnYMvW.js +0 -15
|
@@ -19,6 +19,8 @@ import { ensurePluginPrompt, isPluginOnInSpace, readPluginPrompt } from './plugi
|
|
|
19
19
|
import {
|
|
20
20
|
REQ_ANALYSIS_PROMPT_FILE,
|
|
21
21
|
REQ_ANALYSIS_PROMPT_TEMPLATE,
|
|
22
|
+
SOURCE_STRUCTURE_PROMPT_FILE,
|
|
23
|
+
SOURCE_STRUCTURE_PROMPT_TEMPLATE,
|
|
22
24
|
parseReqPromptSections,
|
|
23
25
|
} from './req-analysis-prompt.mjs';
|
|
24
26
|
|
|
@@ -126,6 +128,23 @@ function headingToMarkdown(level, inner) {
|
|
|
126
128
|
return `\n\n${hashes} ${text}\n`;
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
/**
|
|
132
|
+
* 整张 HTML 表先压成「一行一条、单元格用 ` | `」——必须在把 `</p>` 换成换行之前做,
|
|
133
|
+
* 否则单元格里的段落会把一行拆成「键\n| 值\n|」,表头解析全失效。
|
|
134
|
+
*/
|
|
135
|
+
function htmlTableToMarkdown(tableHtml) {
|
|
136
|
+
const rows = [];
|
|
137
|
+
for (const tr of String(tableHtml ?? '').matchAll(/<tr[^>]*>([\s\S]*?)<\/tr>/gi)) {
|
|
138
|
+
const cells = [...tr[1].matchAll(/<t[dh][^>]*>([\s\S]*?)<\/t[dh]>/gi)].map((m) =>
|
|
139
|
+
htmlInlineText(m[1]),
|
|
140
|
+
);
|
|
141
|
+
// 保留空单元格占位,避免竖表 / 清单表列错位
|
|
142
|
+
if (!cells.length || cells.every((c) => !c)) continue;
|
|
143
|
+
rows.push(cells.join(' | '));
|
|
144
|
+
}
|
|
145
|
+
return rows.length ? `\n\n${rows.join('\n')}\n\n` : '\n\n';
|
|
146
|
+
}
|
|
147
|
+
|
|
129
148
|
/**
|
|
130
149
|
* Word(docx)正文抽取:按标题 / 段落 / 表格拼成纯文本,标题层级压成 `#` / `##` / `###`。
|
|
131
150
|
* 用 `convertToHtml` 而不是 `extractRawText`:后者会丢掉标题样式,文档结构一没了,
|
|
@@ -146,9 +165,8 @@ async function extractDocx(fileAbs) {
|
|
|
146
165
|
const line = htmlInlineText(inner);
|
|
147
166
|
return line ? `\n- ${line}` : '';
|
|
148
167
|
})
|
|
149
|
-
//
|
|
150
|
-
.replace(
|
|
151
|
-
.replace(/<\/t[dh]>/g, ' | ')
|
|
168
|
+
// 表格整段替换(先于 </p>→换行),保证「功能名称 | xxx」落在同一行
|
|
169
|
+
.replace(/<table[^>]*>[\s\S]*?<\/table>/gi, (table) => htmlTableToMarkdown(table))
|
|
152
170
|
.replace(/<br\s*\/?>/g, '\n')
|
|
153
171
|
.replace(/<\/(p|div|section)>/g, '\n')
|
|
154
172
|
.replace(/<[^>]+>/g, '')
|
|
@@ -545,6 +563,7 @@ function normalizeDoc(raw) {
|
|
|
545
563
|
.filter(Boolean)
|
|
546
564
|
.slice(0, 50);
|
|
547
565
|
}
|
|
566
|
+
doc.sourceExport = normalizeSourceExport(raw.sourceExport);
|
|
548
567
|
|
|
549
568
|
const seenOutline = new Set();
|
|
550
569
|
const outline = (Array.isArray(raw.outline) ? raw.outline : [])
|
|
@@ -688,9 +707,33 @@ function normalizePatch(base, raw) {
|
|
|
688
707
|
.filter(Boolean)
|
|
689
708
|
.slice(0, 50);
|
|
690
709
|
}
|
|
710
|
+
if ('sourceExport' in raw) patch.sourceExport = normalizeSourceExport(raw.sourceExport);
|
|
691
711
|
return patch;
|
|
692
712
|
}
|
|
693
713
|
|
|
714
|
+
function normalizeSourceExport(raw) {
|
|
715
|
+
if (!raw || typeof raw !== 'object') return null;
|
|
716
|
+
const groups = [];
|
|
717
|
+
for (const group of Array.isArray(raw.groups) ? raw.groups : []) {
|
|
718
|
+
if (!group || typeof group !== 'object') continue;
|
|
719
|
+
const category = text(group.category, 200);
|
|
720
|
+
const items = [];
|
|
721
|
+
for (const item of Array.isArray(group.items) ? group.items : []) {
|
|
722
|
+
if (!item || typeof item !== 'object') continue;
|
|
723
|
+
const title = text(item.title, 200);
|
|
724
|
+
const body = text(item.body, 4000);
|
|
725
|
+
if (!title && !body) continue;
|
|
726
|
+
items.push({ title: title || body.slice(0, 40), body: body || title });
|
|
727
|
+
if (items.length >= 80) break;
|
|
728
|
+
}
|
|
729
|
+
if (!category || !items.length) continue;
|
|
730
|
+
groups.push({ category, items });
|
|
731
|
+
if (groups.length >= 40) break;
|
|
732
|
+
}
|
|
733
|
+
if (!groups.length) return null;
|
|
734
|
+
return { at: text(raw.at, 40) || new Date().toISOString(), groups };
|
|
735
|
+
}
|
|
736
|
+
|
|
694
737
|
/**
|
|
695
738
|
* @returns {import('vite').Plugin}
|
|
696
739
|
*/
|
|
@@ -722,14 +765,23 @@ export function lhReqAnalysisPlugin() {
|
|
|
722
765
|
// 「重新打开插件会重新生成」不能只靠开关那一下,这里也兜一层
|
|
723
766
|
if (isPluginOnInSpace('reqAnalysis', root)) {
|
|
724
767
|
ensurePluginPrompt(REQ_ANALYSIS_PROMPT_FILE, REQ_ANALYSIS_PROMPT_TEMPLATE, root);
|
|
768
|
+
ensurePluginPrompt(
|
|
769
|
+
SOURCE_STRUCTURE_PROMPT_FILE,
|
|
770
|
+
SOURCE_STRUCTURE_PROMPT_TEMPLATE,
|
|
771
|
+
root,
|
|
772
|
+
);
|
|
725
773
|
}
|
|
726
774
|
const content = readPluginPrompt(REQ_ANALYSIS_PROMPT_FILE, root);
|
|
727
775
|
const sections = parseReqPromptSections(content);
|
|
776
|
+
const structure = readPluginPrompt(SOURCE_STRUCTURE_PROMPT_FILE, root);
|
|
728
777
|
return sendJson(res, 200, {
|
|
729
778
|
ok: true,
|
|
730
779
|
file: REQ_ANALYSIS_PROMPT_FILE,
|
|
731
780
|
exists: Boolean(content.trim()),
|
|
781
|
+
structureFile: SOURCE_STRUCTURE_PROMPT_FILE,
|
|
732
782
|
...sections,
|
|
783
|
+
// 整理原文结构用单独的「原文结构提示词.md」,不读需求分析提示词里的段落
|
|
784
|
+
structure,
|
|
733
785
|
});
|
|
734
786
|
}
|
|
735
787
|
|
|
@@ -750,6 +802,11 @@ export function lhReqAnalysisPlugin() {
|
|
|
750
802
|
REQ_ANALYSIS_PROMPT_TEMPLATE,
|
|
751
803
|
root,
|
|
752
804
|
);
|
|
805
|
+
ensurePluginPrompt(
|
|
806
|
+
SOURCE_STRUCTURE_PROMPT_FILE,
|
|
807
|
+
SOURCE_STRUCTURE_PROMPT_TEMPLATE,
|
|
808
|
+
root,
|
|
809
|
+
);
|
|
753
810
|
return sendJson(res, 200, { ok: true, enabled: true, ...out });
|
|
754
811
|
}
|
|
755
812
|
|
|
@@ -57,6 +57,7 @@ export const PLUGIN_PROMPT_FILES = Object.freeze({
|
|
|
57
57
|
'工作汇报提示词.md': 'reports',
|
|
58
58
|
'Playwright提示词.md': 'uiAuto',
|
|
59
59
|
'需求分析提示词.md': 'reqAnalysis',
|
|
60
|
+
'原文结构提示词.md': 'reqAnalysis',
|
|
60
61
|
'用户故事审查提示词.md': 'storyReview',
|
|
61
62
|
'测试点生成提示词.md': 'testPoints',
|
|
62
63
|
'用例质量评审提示词.md': 'caseReview',
|
|
@@ -65,6 +66,7 @@ export const PLUGIN_PROMPT_FILES = Object.freeze({
|
|
|
65
66
|
|
|
66
67
|
export const UI_AUTO_PROMPT_FILE = 'Playwright提示词.md';
|
|
67
68
|
export const REQ_ANALYSIS_PROMPT_FILE = '需求分析提示词.md';
|
|
69
|
+
export const SOURCE_STRUCTURE_PROMPT_FILE = '原文结构提示词.md';
|
|
68
70
|
export const STORY_REVIEW_PROMPT_FILE = '用户故事审查提示词.md';
|
|
69
71
|
export const TEST_POINTS_PROMPT_FILE = '测试点生成提示词.md';
|
|
70
72
|
export const CASE_REVIEW_PROMPT_FILE = '用例质量评审提示词.md';
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* 打开插件时缺文件才写入下方短 TEMPLATE;两段为 `## 拆解需求` / `## 生成用户故事`。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { REQ_ANALYSIS_PROMPT_FILE } from './plugin-prompts.mjs';
|
|
9
|
+
import { REQ_ANALYSIS_PROMPT_FILE, SOURCE_STRUCTURE_PROMPT_FILE } from './plugin-prompts.mjs';
|
|
10
10
|
|
|
11
|
-
export { REQ_ANALYSIS_PROMPT_FILE };
|
|
11
|
+
export { REQ_ANALYSIS_PROMPT_FILE, SOURCE_STRUCTURE_PROMPT_FILE };
|
|
12
12
|
|
|
13
13
|
export const DECOMPOSE_SECTION = '拆解需求';
|
|
14
14
|
export const STORIES_SECTION = '生成用户故事';
|
|
@@ -40,7 +40,7 @@ export const REQ_ANALYSIS_PROMPT_TEMPLATE = `# 需求分析提示词
|
|
|
40
40
|
*/
|
|
41
41
|
export function parseReqPromptSections(text) {
|
|
42
42
|
const raw = String(text ?? '');
|
|
43
|
-
const out = { decompose: '', stories: '', audit: '', fix: '' };
|
|
43
|
+
const out = { decompose: '', stories: '', structure: '', audit: '', fix: '' };
|
|
44
44
|
if (!raw.trim()) return out;
|
|
45
45
|
let current = '';
|
|
46
46
|
let buffer = [];
|
|
@@ -48,6 +48,7 @@ export function parseReqPromptSections(text) {
|
|
|
48
48
|
const body = buffer.join('\n').trim();
|
|
49
49
|
if (current === 'decompose') out.decompose = body;
|
|
50
50
|
else if (current === 'stories') out.stories = body;
|
|
51
|
+
else if (current === 'structure') out.structure = body;
|
|
51
52
|
else if (current === 'legacy') {
|
|
52
53
|
// 旧单段「## 拆解」:两边都用,靠运行时工具白名单限权
|
|
53
54
|
if (body) {
|
|
@@ -63,7 +64,8 @@ export function parseReqPromptSections(text) {
|
|
|
63
64
|
if (heading) {
|
|
64
65
|
flush();
|
|
65
66
|
const name = heading[1].trim();
|
|
66
|
-
if (
|
|
67
|
+
if (/原文结构/.test(name)) current = 'structure';
|
|
68
|
+
else if (/拆解需求|整理需求|整理条目/.test(name)) current = 'decompose';
|
|
67
69
|
else if (/生成用户故事/.test(name)) current = 'stories';
|
|
68
70
|
else if (/^拆解$/.test(name) || /^(拆分|分析)$/.test(name)) current = 'legacy';
|
|
69
71
|
else if (/拆解|拆分/.test(name) && !/需求|故事|审查|补写/.test(name)) current = 'legacy';
|
|
@@ -80,3 +82,27 @@ export function parseReqPromptSections(text) {
|
|
|
80
82
|
if (out.stories && !out.decompose) out.decompose = out.stories;
|
|
81
83
|
return out;
|
|
82
84
|
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 缺文件时写入「提示词管理/原文结构提示词.md」。
|
|
88
|
+
* 日常只改空间里那一份;这里只在文件不存在、或用户没改过种子时补上。
|
|
89
|
+
*/
|
|
90
|
+
export const SOURCE_STRUCTURE_PROMPT_TEMPLATE = `# 原文结构提示词
|
|
91
|
+
|
|
92
|
+
整理需求原文的目录,方便按大类阅读。只输出 JSON,不要解释。
|
|
93
|
+
|
|
94
|
+
## 规则
|
|
95
|
+
|
|
96
|
+
- 只做分组。\`category\`、\`title\`、\`body\` 都必须是原文里连续出现的原句,一个字都不要改写。
|
|
97
|
+
- \`category\` 是大类或模块(例如「工单系统」)。文档没有单独写出大类时,用原文里最接近的模块名;实在没有就不要编。
|
|
98
|
+
- \`title\` 是该条需求的短标题,用原文标题,不要自己起名。
|
|
99
|
+
- \`body\` 是这条标题下面的原文段落。标题行本身不要再写进 body。
|
|
100
|
+
- 不同文档的标题层级不一样,按语义归组,不要假设「# 一定是大类、## 一定是标题」。
|
|
101
|
+
- 对不上原文的条目不要输出。
|
|
102
|
+
|
|
103
|
+
## 输出
|
|
104
|
+
|
|
105
|
+
\`\`\`json
|
|
106
|
+
{"groups":[{"category":"原文中的大类","items":[{"title":"原文中的需求标题","body":"标题下的原文段落"}]}]}
|
|
107
|
+
\`\`\`
|
|
108
|
+
`;
|