intention-coding 0.6.0 → 0.6.2
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/dist/index.cjs +658 -43
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/requirement-analyzer/core/types.d.ts +2 -0
- package/dist/services/requirement-analyzer/core/types.d.ts.map +1 -1
- package/dist/services/requirement-analyzer/index.d.ts.map +1 -1
- package/dist/services/tech-spec-generator/doc-renderer.d.ts +13 -0
- package/dist/services/tech-spec-generator/doc-renderer.d.ts.map +1 -0
- package/dist/services/tech-spec-generator/index.d.ts +72 -0
- package/dist/services/tech-spec-generator/index.d.ts.map +1 -0
- package/dist/services/tech-spec-generator/types.d.ts +256 -0
- package/dist/services/tech-spec-generator/types.d.ts.map +1 -0
- package/dist//346/212/200/346/234/257/350/247/204/346/240/274/350/257/264/346/230/216/344/271/246/346/250/241/346/235/277.docx +0 -0
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
+
return 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
|
+
}();
|
|
2
5
|
var __webpack_modules__ = {
|
|
3
6
|
"fs/promises": function(module) {
|
|
4
7
|
module.exports = import("fs/promises").then(function(module) {
|
|
@@ -6372,9 +6375,9 @@ Scenario Outline: \u{7528}\u{6237}\u{901A}\u{8FC7}API\u{67E5}\u{8BE2}\u{8BA2}\u{
|
|
|
6372
6375
|
}
|
|
6373
6376
|
return null;
|
|
6374
6377
|
}
|
|
6375
|
-
saveToCache(cacheKey,
|
|
6378
|
+
saveToCache(cacheKey, document1) {
|
|
6376
6379
|
DocumentGenerator.cache.set(cacheKey, {
|
|
6377
|
-
document,
|
|
6380
|
+
document: document1,
|
|
6378
6381
|
timestamp: Date.now()
|
|
6379
6382
|
});
|
|
6380
6383
|
logger.info("\u6587\u6863\u5DF2\u4FDD\u5B58\u5230\u7F13\u5B58", {
|
|
@@ -6608,19 +6611,19 @@ ${combinedFeatureContent}
|
|
|
6608
6611
|
async generateDocument(content, title, requirementType, projectInfo, customPrompt, outputPath) {
|
|
6609
6612
|
try {
|
|
6610
6613
|
const cacheKey = this.generateCacheKey(content, requirementType, customPrompt);
|
|
6611
|
-
let
|
|
6612
|
-
if (
|
|
6614
|
+
let document1 = this.getCachedDocument(cacheKey);
|
|
6615
|
+
if (document1) {
|
|
6613
6616
|
logger.info("\u4F7F\u7528\u7F13\u5B58\u7684\u6587\u6863", {
|
|
6614
6617
|
title,
|
|
6615
6618
|
requirementType
|
|
6616
6619
|
});
|
|
6617
|
-
return
|
|
6620
|
+
return document1;
|
|
6618
6621
|
}
|
|
6619
6622
|
const template = this.templateSelector.selectTemplate(requirementType);
|
|
6620
6623
|
this.templateSelector.validateTemplate(template, requirementType);
|
|
6621
6624
|
const fullPrompt = this.buildDocumentPrompt(template, content, title, projectInfo, customPrompt, requirementType);
|
|
6622
6625
|
if (outputPath) try {
|
|
6623
|
-
|
|
6626
|
+
document1 = await this.generateDocumentStream(fullPrompt, outputPath, title, "", {
|
|
6624
6627
|
realTimeMode: true
|
|
6625
6628
|
});
|
|
6626
6629
|
} catch (streamError) {
|
|
@@ -6628,18 +6631,18 @@ ${combinedFeatureContent}
|
|
|
6628
6631
|
error: streamError,
|
|
6629
6632
|
requirementType
|
|
6630
6633
|
});
|
|
6631
|
-
|
|
6634
|
+
document1 = await openAIService.generateText({
|
|
6632
6635
|
prompt: fullPrompt,
|
|
6633
6636
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u6280\u672F\u6587\u6863\u7F16\u5199\u4E13\u5BB6\uFF0C\u8BF7\u751F\u6210\u5B8C\u6574\u3001\u8BE6\u7EC6\u7684\u6280\u672F\u9700\u6C42\u6587\u6863\u3002"
|
|
6634
6637
|
});
|
|
6635
6638
|
}
|
|
6636
|
-
else
|
|
6639
|
+
else document1 = await openAIService.generateText({
|
|
6637
6640
|
prompt: fullPrompt,
|
|
6638
6641
|
system_prompt: "\u4F60\u662F\u4E00\u4F4D\u4E13\u4E1A\u7684\u6280\u672F\u6587\u6863\u7F16\u5199\u4E13\u5BB6\uFF0C\u8BF7\u751F\u6210\u5B8C\u6574\u3001\u8BE6\u7EC6\u7684\u6280\u672F\u9700\u6C42\u6587\u6863\u3002"
|
|
6639
6642
|
});
|
|
6640
|
-
this.validateGeneratedDocument(
|
|
6641
|
-
this.saveToCache(cacheKey,
|
|
6642
|
-
return
|
|
6643
|
+
this.validateGeneratedDocument(document1, title);
|
|
6644
|
+
this.saveToCache(cacheKey, document1);
|
|
6645
|
+
return document1;
|
|
6643
6646
|
} catch (error) {
|
|
6644
6647
|
logger.error("\u6280\u672F\u6587\u6863\u751F\u6210\u5931\u8D25", {
|
|
6645
6648
|
error,
|
|
@@ -6927,9 +6930,9 @@ ${existingContent}
|
|
|
6927
6930
|
|
|
6928
6931
|
\u{8BF7}\u{7EE7}\u{7EED}\u{751F}\u{6210}\u{FF1A}`;
|
|
6929
6932
|
}
|
|
6930
|
-
isDocumentComplete(
|
|
6931
|
-
const hasEnding =
|
|
6932
|
-
const hasReasonableLength =
|
|
6933
|
+
isDocumentComplete(document1) {
|
|
6934
|
+
const hasEnding = document1.includes("## \u66F4\u65B0\u65E5\u5FD7") || document1.includes("---\n\n**") || document1.trim().endsWith("---") || document1.trim().endsWith("\u3002") || document1.trim().endsWith("\uFF09");
|
|
6935
|
+
const hasReasonableLength = document1.length >= 1000;
|
|
6933
6936
|
return hasEnding && hasReasonableLength;
|
|
6934
6937
|
}
|
|
6935
6938
|
async continueDocumentGeneration(originalPrompt, existingContent, outputPath) {
|
|
@@ -7124,15 +7127,15 @@ ${customPrompt}` : ""}
|
|
|
7124
7127
|
});
|
|
7125
7128
|
}
|
|
7126
7129
|
}
|
|
7127
|
-
validateGeneratedDocument(
|
|
7128
|
-
if (!
|
|
7130
|
+
validateGeneratedDocument(document1, title) {
|
|
7131
|
+
if (!document1 || document1.trim().length < 100) throw new RequirementAnalysisError("\u751F\u6210\u7684\u6280\u672F\u6587\u6863\u5185\u5BB9\u8FC7\u77ED\uFF0C\u53EF\u80FD\u5B58\u5728\u95EE\u9898", types_ErrorCodes.DOCUMENT_GENERATION_FAILED, {
|
|
7129
7132
|
title,
|
|
7130
|
-
documentLength:
|
|
7133
|
+
documentLength: document1?.length || 0
|
|
7131
7134
|
});
|
|
7132
|
-
if (!
|
|
7135
|
+
if (!document1.includes(title)) logger.warn("\u751F\u6210\u7684\u6587\u6863\u53EF\u80FD\u4E0E\u9700\u6C42\u6807\u9898\u4E0D\u5339\u914D", {
|
|
7133
7136
|
title
|
|
7134
7137
|
});
|
|
7135
|
-
if (
|
|
7138
|
+
if (document1.includes("## 3.1 ER\u903B\u8F91\u56FE\u8BBE\u8BA1") && !document1.includes("erDiagram") && !document1.includes("entity")) logger.warn("\u751F\u6210\u7684\u6587\u6863\u53EF\u80FD\u7F3A\u5C11ER\u56FE\u5185\u5BB9", {
|
|
7136
7139
|
title
|
|
7137
7140
|
});
|
|
7138
7141
|
}
|
|
@@ -7531,6 +7534,7 @@ ${generationTasks?.map((task, i)=>`
|
|
|
7531
7534
|
}
|
|
7532
7535
|
}
|
|
7533
7536
|
const apiLimiter = new ConcurrencyLimiter(18);
|
|
7537
|
+
const EXECUTION_TIMEOUT_MS = 40000;
|
|
7534
7538
|
async function generateApiSection(sectionDef, templateVariables) {
|
|
7535
7539
|
return apiLimiter.run(async ()=>{
|
|
7536
7540
|
try {
|
|
@@ -7612,8 +7616,18 @@ ${pageStyle}
|
|
|
7612
7616
|
return cleanHtml.trim();
|
|
7613
7617
|
}
|
|
7614
7618
|
const requirementAnalyzerTool = {
|
|
7615
|
-
name: "
|
|
7616
|
-
description: `\u{
|
|
7619
|
+
name: "generate_design_doc",
|
|
7620
|
+
description: `\u{6839}\u{636E}\u{9700}\u{6C42}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{FF0C}\u{751F}\u{6210} API \u{6280}\u{672F}\u{8BBE}\u{8BA1}\u{6587}\u{6863}\u{548C}\u{53EF}\u{4EA4}\u{4E92} HTML \u{9875}\u{9762}\u{539F}\u{578B}\u{3002}
|
|
7621
|
+
|
|
7622
|
+
\u{89E6}\u{53D1}\u{8BCD}: \u{751F}\u{6210}\u{8BBE}\u{8BA1}\u{6587}\u{6863}\u{3001}\u{751F}\u{6210}API\u{6587}\u{6863}\u{3001}\u{9700}\u{6C42}\u{8F6C}\u{8BBE}\u{8BA1}\u{3001}\u{751F}\u{6210}\u{6280}\u{672F}\u{65B9}\u{6848}\u{3001}\u{751F}\u{6210}\u{9875}\u{9762}\u{539F}\u{578B}
|
|
7623
|
+
|
|
7624
|
+
\u{4F7F}\u{7528}\u{6D41}\u{7A0B}:
|
|
7625
|
+
1. \u{5148}\u{8C03}\u{7528} requirement_identifier \u{5206}\u{6790}\u{539F}\u{59CB}\u{9700}\u{6C42}
|
|
7626
|
+
2. \u{5C06}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{4F20}\u{5165}\u{672C}\u{5DE5}\u{5177}\u{751F}\u{6210}\u{8BBE}\u{8BA1}\u{6587}\u{6863}
|
|
7627
|
+
|
|
7628
|
+
\u{8F93}\u{51FA}:
|
|
7629
|
+
- API \u{6280}\u{672F}\u{9700}\u{6C42}\u{6587}\u{6863} (Markdown)
|
|
7630
|
+
- \u{53EF}\u{4EA4}\u{4E92} HTML \u{9875}\u{9762}\u{539F}\u{578B}`,
|
|
7617
7631
|
inputSchema: {
|
|
7618
7632
|
requirement_analysis: stringType().describe("requirement-identifier\u751F\u6210\u7684\u9700\u6C42\u5206\u6790\u7ED3\u679C\uFF08\u5305\u542B\u5F53\u524D\u9700\u6C42\u4E0E\u9879\u76EE\u60C5\u51B5\u7684\u5B8C\u6574\u5206\u6790\uFF09"),
|
|
7619
7633
|
current_project_path: stringType().describe("\u5F53\u524D\u9879\u76EE\u8DEF\u5F84\uFF08\u5FC5\u586B\uFF09\uFF0C\u9700\u6C42\u62A5\u544A\u5C06\u751F\u6210\u5230\u8BE5\u8DEF\u5F84\u4E0B\u7684.aico/design\u76EE\u5F55"),
|
|
@@ -7663,11 +7677,28 @@ ${pageStyle}
|
|
|
7663
7677
|
],
|
|
7664
7678
|
isError: true
|
|
7665
7679
|
};
|
|
7666
|
-
logger.info(`\u{5F00}\u{59CB}\u{5B8C}\u{5168}\u{5E76}\u{884C}\u{751F}\u{6210} ${generationTasks.length} \u{4EFD}\u{6587}\u{6863}...`);
|
|
7680
|
+
logger.info(`\u{5F00}\u{59CB}\u{5B8C}\u{5168}\u{5E76}\u{884C}\u{751F}\u{6210} ${generationTasks.length} \u{4EFD}\u{6587}\u{6863}\u{FF08}\u{8D85}\u{65F6}: ${EXECUTION_TIMEOUT_MS}ms\u{FF09}...`);
|
|
7667
7681
|
const startTime = Date.now();
|
|
7668
7682
|
const apiTask = generationTasks.find((t)=>"API" === t.requirementType);
|
|
7669
7683
|
const htmlTask = generationTasks.find((t)=>"HTML" === t.requirementType);
|
|
7670
|
-
const
|
|
7684
|
+
const taskStatus = new Map();
|
|
7685
|
+
if (apiTask) taskStatus.set("API", {
|
|
7686
|
+
type: "API",
|
|
7687
|
+
content: "",
|
|
7688
|
+
outputPath: apiTask.outputPath,
|
|
7689
|
+
success: false,
|
|
7690
|
+
completed: false
|
|
7691
|
+
});
|
|
7692
|
+
if (htmlTask) {
|
|
7693
|
+
const htmlOutputPath = htmlTask.outputPath.replace(/\.md$/, ".html");
|
|
7694
|
+
taskStatus.set("HTML", {
|
|
7695
|
+
type: "HTML",
|
|
7696
|
+
content: "",
|
|
7697
|
+
outputPath: htmlOutputPath,
|
|
7698
|
+
success: false,
|
|
7699
|
+
completed: false
|
|
7700
|
+
});
|
|
7701
|
+
}
|
|
7671
7702
|
const parallelTasks = [];
|
|
7672
7703
|
if (apiTask) {
|
|
7673
7704
|
const apiPromise = (async ()=>{
|
|
@@ -7683,28 +7714,30 @@ ${pageStyle}
|
|
|
7683
7714
|
---
|
|
7684
7715
|
|
|
7685
7716
|
`;
|
|
7686
|
-
const
|
|
7717
|
+
const document1 = header + successSections.map((s)=>s.content).join("\n\n---\n\n");
|
|
7687
7718
|
const outputDir = external_path_default().dirname(apiTask.outputPath);
|
|
7688
7719
|
await promises_namespaceObject.mkdir(outputDir, {
|
|
7689
7720
|
recursive: true
|
|
7690
7721
|
});
|
|
7691
|
-
await promises_namespaceObject.writeFile(apiTask.outputPath,
|
|
7692
|
-
|
|
7722
|
+
await promises_namespaceObject.writeFile(apiTask.outputPath, document1, "utf-8");
|
|
7723
|
+
taskStatus.set("API", {
|
|
7693
7724
|
type: "API",
|
|
7694
|
-
content:
|
|
7725
|
+
content: document1,
|
|
7695
7726
|
outputPath: apiTask.outputPath,
|
|
7696
|
-
success: true
|
|
7727
|
+
success: true,
|
|
7728
|
+
completed: true
|
|
7697
7729
|
});
|
|
7698
7730
|
logger.info(`API\u{6587}\u{6863}\u{751F}\u{6210}\u{5B8C}\u{6210}`, {
|
|
7699
|
-
length:
|
|
7731
|
+
length: document1.length
|
|
7700
7732
|
});
|
|
7701
7733
|
} catch (error) {
|
|
7702
|
-
|
|
7734
|
+
taskStatus.set("API", {
|
|
7703
7735
|
type: "API",
|
|
7704
7736
|
content: "",
|
|
7705
7737
|
outputPath: apiTask.outputPath,
|
|
7706
7738
|
success: false,
|
|
7707
|
-
error: error.message
|
|
7739
|
+
error: error.message,
|
|
7740
|
+
completed: true
|
|
7708
7741
|
});
|
|
7709
7742
|
}
|
|
7710
7743
|
})();
|
|
@@ -7721,44 +7754,128 @@ ${pageStyle}
|
|
|
7721
7754
|
recursive: true
|
|
7722
7755
|
});
|
|
7723
7756
|
await promises_namespaceObject.writeFile(htmlOutputPath, htmlContent, "utf-8");
|
|
7724
|
-
|
|
7757
|
+
taskStatus.set("HTML", {
|
|
7725
7758
|
type: "HTML",
|
|
7726
7759
|
content: htmlContent,
|
|
7727
7760
|
outputPath: htmlOutputPath,
|
|
7728
|
-
success: true
|
|
7761
|
+
success: true,
|
|
7762
|
+
completed: true
|
|
7729
7763
|
});
|
|
7730
7764
|
logger.info(`HTML\u{9875}\u{9762}\u{751F}\u{6210}\u{5B8C}\u{6210}`, {
|
|
7731
7765
|
length: htmlContent.length
|
|
7732
7766
|
});
|
|
7733
7767
|
} catch (error) {
|
|
7734
|
-
|
|
7768
|
+
taskStatus.set("HTML", {
|
|
7735
7769
|
type: "HTML",
|
|
7736
7770
|
content: "",
|
|
7737
|
-
outputPath: htmlTask.outputPath,
|
|
7771
|
+
outputPath: htmlTask.outputPath.replace(/\.md$/, ".html"),
|
|
7738
7772
|
success: false,
|
|
7739
|
-
error: error.message
|
|
7773
|
+
error: error.message,
|
|
7774
|
+
completed: true
|
|
7740
7775
|
});
|
|
7741
7776
|
}
|
|
7742
7777
|
})();
|
|
7743
7778
|
parallelTasks.push(htmlPromise);
|
|
7744
7779
|
}
|
|
7745
|
-
|
|
7780
|
+
const timeoutPromise = new Promise((resolve)=>{
|
|
7781
|
+
setTimeout(()=>resolve("timeout"), EXECUTION_TIMEOUT_MS);
|
|
7782
|
+
});
|
|
7783
|
+
const raceResult = await Promise.race([
|
|
7784
|
+
Promise.all(parallelTasks).then(()=>"completed"),
|
|
7785
|
+
timeoutPromise
|
|
7786
|
+
]);
|
|
7746
7787
|
const totalDuration = Date.now() - startTime;
|
|
7747
|
-
const
|
|
7748
|
-
const
|
|
7749
|
-
const
|
|
7750
|
-
|
|
7788
|
+
const isTimeout = "timeout" === raceResult;
|
|
7789
|
+
const results = Array.from(taskStatus.values());
|
|
7790
|
+
const completedResults = results.filter((r)=>r.completed);
|
|
7791
|
+
const pendingResults = results.filter((r)=>!r.completed);
|
|
7792
|
+
const successCount = completedResults.filter((r)=>r.success).length;
|
|
7793
|
+
const failedCount = completedResults.filter((r)=>!r.success && r.completed).length;
|
|
7794
|
+
const generatedFiles = completedResults.filter((r)=>r.success).map((r)=>r.outputPath);
|
|
7795
|
+
logger.info(`\u{5E76}\u{884C}\u{751F}\u{6210}${isTimeout ? "\u8D85\u65F6" : "\u5B8C\u6210"}`, {
|
|
7751
7796
|
total: results.length,
|
|
7797
|
+
completed: completedResults.length,
|
|
7798
|
+
pending: pendingResults.length,
|
|
7752
7799
|
success: successCount,
|
|
7753
7800
|
failed: failedCount,
|
|
7754
|
-
totalDuration: `${totalDuration}ms
|
|
7801
|
+
totalDuration: `${totalDuration}ms`,
|
|
7802
|
+
isTimeout
|
|
7755
7803
|
});
|
|
7804
|
+
if (isTimeout && pendingResults.length > 0) {
|
|
7805
|
+
const pendingPrompts = pendingResults.map((task)=>{
|
|
7806
|
+
if ("API" === task.type && apiTask) return {
|
|
7807
|
+
type: "API",
|
|
7808
|
+
outputPath: task.outputPath,
|
|
7809
|
+
prompt: `\u{8BF7}\u{4E3A}"${apiTask.templateVariables.featureName}"\u{751F}\u{6210}API\u{6280}\u{672F}\u{9700}\u{6C42}\u{6587}\u{6863}\u{FF0C}\u{5305}\u{542B}\u{4EE5}\u{4E0B}\u{7AE0}\u{8282}\u{FF1A}
|
|
7810
|
+
1. \u{6587}\u{6863}\u{5934}\u{90E8}\u{FF08}\u{6807}\u{9898}\u{3001}\u{751F}\u{6210}\u{65F6}\u{95F4}\u{3001}\u{4E1A}\u{52A1}\u{9886}\u{57DF}\u{FF09}
|
|
7811
|
+
2. \u{9700}\u{6C42}\u{80CC}\u{666F}\u{FF08}\u{9700}\u{6C42}\u{80CC}\u{666F}\u{3001}\u{5173}\u{952E}\u{529F}\u{80FD}\u{3001}\u{6D89}\u{53CA}\u{89D2}\u{8272}\u{FF09}
|
|
7812
|
+
3. \u{529F}\u{80FD}\u{8BBE}\u{8BA1}\u{8BF4}\u{660E}\u{FF08}\u{6D41}\u{7A0B}\u{7F16}\u{53F7}\u{3001}\u{524D}\u{7F6E}\u{6761}\u{4EF6}\u{3001}\u{89D2}\u{8272}\u{7B49}\u{8868}\u{683C}\u{FF09}
|
|
7813
|
+
4. \u{6570}\u{636E}\u{5EFA}\u{6A21}\u{FF08}ER\u{903B}\u{8F91}\u{56FE}mermaid erDiagram + \u{6570}\u{636E}\u{8868}\u{5B9E}\u{4F53}\u{8BBE}\u{8BA1}\u{FF09}
|
|
7814
|
+
5. API\u{63A5}\u{53E3}\u{8BBE}\u{8BA1}\u{FF08}\u{63A5}\u{53E3}\u{5217}\u{8868}\u{3001}\u{8BF7}\u{6C42}\u{53C2}\u{6570}\u{3001}\u{54CD}\u{5E94}\u{53C2}\u{6570}\u{3001}\u{9519}\u{8BEF}\u{7801}\u{FF09}
|
|
7815
|
+
6. \u{4E1A}\u{52A1}\u{65F6}\u{5E8F}\u{56FE}\u{FF08}mermaid sequenceDiagram\u{FF09}
|
|
7816
|
+
7. \u{4E1A}\u{52A1}\u{72B6}\u{6001}\u{FF08}\u{72B6}\u{6001}\u{63CF}\u{8FF0}\u{8868}\u{683C}\u{FF09}
|
|
7817
|
+
8. \u{4F2A}\u{4EE3}\u{7801}\u{793A}\u{4F8B}\u{FF08}\u{6838}\u{5FC3}\u{4E1A}\u{52A1}\u{903B}\u{8F91}\u{FF09}
|
|
7818
|
+
|
|
7819
|
+
\u{4E1A}\u{52A1}\u{9886}\u{57DF}: ${apiTask.templateVariables.businessDomain}
|
|
7820
|
+
\u{9700}\u{6C42}\u{8BE6}\u{60C5}: ${apiTask.templateVariables.inputContent?.substring(0, 500) || ''}
|
|
7821
|
+
|
|
7822
|
+
\u{8BF7}\u{751F}\u{6210}\u{5B8C}\u{6574}\u{7684}Markdown\u{6587}\u{6863}\u{5E76}\u{4FDD}\u{5B58}\u{5230}: ${task.outputPath}`
|
|
7823
|
+
};
|
|
7824
|
+
if ("HTML" === task.type && htmlTask) return {
|
|
7825
|
+
type: "HTML",
|
|
7826
|
+
outputPath: task.outputPath,
|
|
7827
|
+
prompt: `\u{8BF7}\u{4E3A}"${htmlTask.templateVariables.featureName}"\u{751F}\u{6210}\u{53EF}\u{4EA4}\u{4E92}\u{7684}HTML\u{9875}\u{9762}\u{FF1A}
|
|
7828
|
+
|
|
7829
|
+
\u{6280}\u{672F}\u{8981}\u{6C42}\u{FF1A}
|
|
7830
|
+
1. \u{5B8C}\u{6574}HTML\u{6587}\u{4EF6}\u{FF08}<!DOCTYPE html>\u{3001}<html>\u{3001}<head>\u{3001}<body>\u{FF09}
|
|
7831
|
+
2. \u{4F7F}\u{7528}TailwindCSS\u{FF08}CDN\u{5F15}\u{5165}\u{FF09}\u{8FDB}\u{884C}\u{6837}\u{5F0F}\u{8BBE}\u{8BA1}
|
|
7832
|
+
3. \u{9875}\u{9762}\u{7C7B}\u{578B}: ${htmlTask.templateVariables.pageType || 'responsive'}\u{5E03}\u{5C40}
|
|
7833
|
+
4. \u{5305}\u{542B}\u{8868}\u{5355}\u{9A8C}\u{8BC1}\u{548C}\u{4EA4}\u{4E92}\u{903B}\u{8F91}\u{FF08}\u{539F}\u{751F}JavaScript\u{FF09}
|
|
7834
|
+
5. \u{5305}\u{542B}\u{52A0}\u{8F7D}\u{72B6}\u{6001}\u{3001}\u{6210}\u{529F}/\u{5931}\u{8D25}\u{63D0}\u{793A}
|
|
7835
|
+
6. \u{6240}\u{6709}\u{6587}\u{672C}\u{4F7F}\u{7528}\u{4E2D}\u{6587}
|
|
7836
|
+
|
|
7837
|
+
\u{9875}\u{9762}\u{98CE}\u{683C}\u{FF1A}
|
|
7838
|
+
${htmlTask.templateVariables.pageStyle || DEFAULT_PAGE_STYLE}
|
|
7839
|
+
|
|
7840
|
+
\u{9700}\u{6C42}\u{8BE6}\u{60C5}: ${htmlTask.templateVariables.inputContent?.substring(0, 500) || ''}
|
|
7841
|
+
|
|
7842
|
+
\u{8BF7}\u{751F}\u{6210}\u{5B8C}\u{6574}\u{7684}HTML\u{4EE3}\u{7801}\u{5E76}\u{4FDD}\u{5B58}\u{5230}: ${task.outputPath}`
|
|
7843
|
+
};
|
|
7844
|
+
return null;
|
|
7845
|
+
}).filter(Boolean);
|
|
7846
|
+
return {
|
|
7847
|
+
content: [
|
|
7848
|
+
{
|
|
7849
|
+
type: "text",
|
|
7850
|
+
text: JSON.stringify({
|
|
7851
|
+
success: successCount > 0,
|
|
7852
|
+
timeout: true,
|
|
7853
|
+
message: `\u{6267}\u{884C}\u{8D85}\u{65F6}(${EXECUTION_TIMEOUT_MS}ms)\u{FF1A}${successCount} \u{5B8C}\u{6210}\u{FF0C}${pendingResults.length} \u{5F85}\u{6267}\u{884C}\u{FF0C}\u{8BF7}\u{7EE7}\u{7EED}\u{6267}\u{884C}\u{4EE5}\u{4E0B}\u{4EFB}\u{52A1}`,
|
|
7854
|
+
data: {
|
|
7855
|
+
outputPath: serviceResult.outputPath,
|
|
7856
|
+
generatedFiles,
|
|
7857
|
+
analysisInfo: serviceResult.analysisInfo || {},
|
|
7858
|
+
completedResults: completedResults.map((r)=>({
|
|
7859
|
+
type: r.type,
|
|
7860
|
+
outputPath: r.outputPath,
|
|
7861
|
+
success: r.success,
|
|
7862
|
+
error: r.error,
|
|
7863
|
+
contentLength: r.content?.length || 0
|
|
7864
|
+
})),
|
|
7865
|
+
pendingTasks: pendingPrompts
|
|
7866
|
+
}
|
|
7867
|
+
})
|
|
7868
|
+
}
|
|
7869
|
+
]
|
|
7870
|
+
};
|
|
7871
|
+
}
|
|
7756
7872
|
return {
|
|
7757
7873
|
content: [
|
|
7758
7874
|
{
|
|
7759
7875
|
type: "text",
|
|
7760
7876
|
text: JSON.stringify({
|
|
7761
7877
|
success: successCount > 0,
|
|
7878
|
+
timeout: false,
|
|
7762
7879
|
message: `\u{6587}\u{6863}\u{751F}\u{6210}\u{5B8C}\u{6210}\u{FF1A}${successCount} \u{6210}\u{529F}\u{FF0C}${failedCount} \u{5931}\u{8D25}\u{FF0C}\u{603B}\u{8017}\u{65F6} ${totalDuration}ms`,
|
|
7763
7880
|
data: {
|
|
7764
7881
|
outputPath: serviceResult.outputPath,
|
|
@@ -10821,6 +10938,503 @@ ${requirement_description}
|
|
|
10821
10938
|
}
|
|
10822
10939
|
}
|
|
10823
10940
|
};
|
|
10941
|
+
const external_url_namespaceObject = require("url");
|
|
10942
|
+
const external_docxtemplater_namespaceObject = require("docxtemplater");
|
|
10943
|
+
var external_docxtemplater_default = /*#__PURE__*/ __webpack_require__.n(external_docxtemplater_namespaceObject);
|
|
10944
|
+
const external_pizzip_namespaceObject = require("pizzip");
|
|
10945
|
+
var external_pizzip_default = /*#__PURE__*/ __webpack_require__.n(external_pizzip_namespaceObject);
|
|
10946
|
+
function getTemplatePath() {
|
|
10947
|
+
let currentDir;
|
|
10948
|
+
try {
|
|
10949
|
+
currentDir = external_path_namespaceObject.dirname((0, external_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__));
|
|
10950
|
+
} catch {
|
|
10951
|
+
currentDir = __dirname;
|
|
10952
|
+
}
|
|
10953
|
+
return external_path_namespaceObject.resolve(currentDir, "\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66\u6A21\u677F.docx");
|
|
10954
|
+
}
|
|
10955
|
+
function prepareRenderData(data) {
|
|
10956
|
+
const renderData = {
|
|
10957
|
+
projectName: data.projectName,
|
|
10958
|
+
moduleName: data.moduleName,
|
|
10959
|
+
year: data.year,
|
|
10960
|
+
month: data.month,
|
|
10961
|
+
referDoc: data.referDoc,
|
|
10962
|
+
serviceInterfaceList: data.serviceInterfaceList || [],
|
|
10963
|
+
designDetailList: data.designDetailList || [],
|
|
10964
|
+
tableInfoList: data.tableInfoList || [],
|
|
10965
|
+
techSolution: data.techSolution || null,
|
|
10966
|
+
businessExceptionList: data.businessExceptionList || [],
|
|
10967
|
+
appendix: data.appendix || null
|
|
10968
|
+
};
|
|
10969
|
+
if (data.techSolution) {
|
|
10970
|
+
const ts = data.techSolution;
|
|
10971
|
+
renderData.trafficEstimation = ts.trafficEstimation || null;
|
|
10972
|
+
renderData.messageQueueList = ts.messageQueueList || [];
|
|
10973
|
+
renderData.databaseSplitList = ts.databaseSplitList || [];
|
|
10974
|
+
renderData.distributedTransactionList = ts.distributedTransactionList || [];
|
|
10975
|
+
renderData.distributedLockList = ts.distributedLockList || [];
|
|
10976
|
+
renderData.scheduledTaskList = ts.scheduledTaskList || [];
|
|
10977
|
+
renderData.delayTaskList = ts.delayTaskList || [];
|
|
10978
|
+
renderData.cacheDesign = ts.cacheDesign || null;
|
|
10979
|
+
if (ts.cacheDesign) {
|
|
10980
|
+
renderData.cacheConstraint = ts.cacheDesign.constraint || "\u4E0D\u6D89\u53CA\u3002";
|
|
10981
|
+
renderData.cacheScenarioList = ts.cacheDesign.cacheScenarioList || [];
|
|
10982
|
+
renderData.cacheDesignDescription = ts.cacheDesign.designDescription || "\u4E0D\u6D89\u53CA\u3002";
|
|
10983
|
+
}
|
|
10984
|
+
}
|
|
10985
|
+
renderData.exceptionCodeList = data.appendix?.exceptionCodeList || [];
|
|
10986
|
+
renderData.codeValueList = data.appendix?.codeValueList || [];
|
|
10987
|
+
return renderData;
|
|
10988
|
+
}
|
|
10989
|
+
async function renderTechSpecDoc(data, outputDir) {
|
|
10990
|
+
try {
|
|
10991
|
+
const templatePath = getTemplatePath();
|
|
10992
|
+
try {
|
|
10993
|
+
await promises_namespaceObject.access(templatePath);
|
|
10994
|
+
} catch {
|
|
10995
|
+
return {
|
|
10996
|
+
success: false,
|
|
10997
|
+
outputPath: null,
|
|
10998
|
+
error: `\u{6A21}\u{677F}\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}: ${templatePath}`
|
|
10999
|
+
};
|
|
11000
|
+
}
|
|
11001
|
+
const templateContent = await promises_namespaceObject.readFile(templatePath);
|
|
11002
|
+
const zip = new (external_pizzip_default())(templateContent);
|
|
11003
|
+
const doc = new (external_docxtemplater_default())(zip, {
|
|
11004
|
+
paragraphLoop: true,
|
|
11005
|
+
linebreaks: true,
|
|
11006
|
+
delimiters: {
|
|
11007
|
+
start: '{',
|
|
11008
|
+
end: '}'
|
|
11009
|
+
}
|
|
11010
|
+
});
|
|
11011
|
+
const renderData = prepareRenderData(data);
|
|
11012
|
+
doc.render(renderData);
|
|
11013
|
+
const output = doc.getZip().generate({
|
|
11014
|
+
type: 'nodebuffer',
|
|
11015
|
+
compression: 'DEFLATE'
|
|
11016
|
+
});
|
|
11017
|
+
await promises_namespaceObject.mkdir(outputDir, {
|
|
11018
|
+
recursive: true
|
|
11019
|
+
});
|
|
11020
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
11021
|
+
const outputFileName = `\u{6280}\u{672F}\u{89C4}\u{683C}\u{8BF4}\u{660E}\u{4E66}_${data.projectName}_${data.moduleName}_${timestamp}.docx`;
|
|
11022
|
+
const outputPath = external_path_namespaceObject.join(outputDir, outputFileName);
|
|
11023
|
+
await promises_namespaceObject.writeFile(outputPath, output);
|
|
11024
|
+
logger.info("\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66\u751F\u6210\u6210\u529F", {
|
|
11025
|
+
outputPath
|
|
11026
|
+
});
|
|
11027
|
+
return {
|
|
11028
|
+
success: true,
|
|
11029
|
+
outputPath
|
|
11030
|
+
};
|
|
11031
|
+
} catch (error) {
|
|
11032
|
+
logger.error("\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66\u751F\u6210\u5931\u8D25", {
|
|
11033
|
+
error: error.message
|
|
11034
|
+
});
|
|
11035
|
+
if (error.properties && error.properties.errors) {
|
|
11036
|
+
const errorMessages = error.properties.errors.map((e)=>e.properties?.explanation || e.message).join('; ');
|
|
11037
|
+
return {
|
|
11038
|
+
success: false,
|
|
11039
|
+
outputPath: null,
|
|
11040
|
+
error: `\u{6A21}\u{677F}\u{6E32}\u{67D3}\u{9519}\u{8BEF}: ${errorMessages}`
|
|
11041
|
+
};
|
|
11042
|
+
}
|
|
11043
|
+
return {
|
|
11044
|
+
success: false,
|
|
11045
|
+
outputPath: null,
|
|
11046
|
+
error: error.message || "\u672A\u77E5\u9519\u8BEF"
|
|
11047
|
+
};
|
|
11048
|
+
}
|
|
11049
|
+
}
|
|
11050
|
+
const TableFieldDetailSchema = objectType({
|
|
11051
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11052
|
+
fieldName: stringType().describe("\u5B57\u6BB5\u540D"),
|
|
11053
|
+
fieldType: stringType().describe("\u5B57\u6BB5\u7C7B\u578B"),
|
|
11054
|
+
fieldDescription: stringType().describe("\u5B57\u6BB5\u63CF\u8FF0"),
|
|
11055
|
+
fieldLength: stringType().describe("\u5B57\u6BB5\u957F\u5EA6")
|
|
11056
|
+
});
|
|
11057
|
+
objectType({
|
|
11058
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11059
|
+
tableName: stringType().describe("\u8868\u540D\u79F0"),
|
|
11060
|
+
entityName: stringType().describe("\u5BF9\u5E94\u5B9E\u4F53\u540D\u79F0"),
|
|
11061
|
+
tableDescription: stringType().describe("\u63CF\u8FF0"),
|
|
11062
|
+
tableDetailList: arrayType(TableFieldDetailSchema).default([]).describe("\u8868\u5B57\u6BB5\u8BE6\u60C5\u5217\u8868")
|
|
11063
|
+
});
|
|
11064
|
+
const ParameterInfoSchema = objectType({
|
|
11065
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11066
|
+
propertyType: stringType().describe("\u7C7B\u578B"),
|
|
11067
|
+
propertyName: stringType().describe("\u5C5E\u6027\u540D"),
|
|
11068
|
+
required: stringType().describe("\u662F\u5426\u5FC5\u586B"),
|
|
11069
|
+
propertyDesc: stringType().describe("\u63CF\u8FF0")
|
|
11070
|
+
});
|
|
11071
|
+
const ReturnResultInfoSchema = objectType({
|
|
11072
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11073
|
+
propertyType: stringType().describe("\u7C7B\u578B"),
|
|
11074
|
+
propertyName: stringType().describe("\u5C5E\u6027\u540D"),
|
|
11075
|
+
propertyDesc: stringType().describe("\u63CF\u8FF0")
|
|
11076
|
+
});
|
|
11077
|
+
const InterfaceDesignDetailSchema = objectType({
|
|
11078
|
+
functionName: stringType().describe("\u529F\u80FD\u540D\u79F0"),
|
|
11079
|
+
interfaceDesc: stringType().describe("\u63A5\u53E3\u63CF\u8FF0"),
|
|
11080
|
+
className: stringType().describe("\u63A5\u53E3\u7C7B\u540D"),
|
|
11081
|
+
methodName: stringType().describe("\u65B9\u6CD5\u540D"),
|
|
11082
|
+
parameterList: arrayType(ParameterInfoSchema).default([]).describe("\u53C2\u6570\u5217\u8868"),
|
|
11083
|
+
returnResultList: arrayType(ReturnResultInfoSchema).default([]).describe("\u8FD4\u56DE\u7ED3\u679C\u5217\u8868"),
|
|
11084
|
+
implementLogic: stringType().describe("\u5B9E\u73B0\u903B\u8F91")
|
|
11085
|
+
});
|
|
11086
|
+
objectType({
|
|
11087
|
+
serviceName: stringType().describe("\u670D\u52A1\u540D\u79F0"),
|
|
11088
|
+
serviceDesc: stringType().describe("\u529F\u80FD\u63CF\u8FF0"),
|
|
11089
|
+
interfaceDesignDetailList: arrayType(InterfaceDesignDetailSchema).default([]).describe("\u63A5\u53E3\u8BBE\u8BA1\u8BE6\u60C5\u5217\u8868")
|
|
11090
|
+
});
|
|
11091
|
+
const InterfaceDetailSchema = objectType({
|
|
11092
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11093
|
+
functionDescription: stringType().describe("\u529F\u80FD\u63CF\u8FF0"),
|
|
11094
|
+
serviceName: stringType().describe("\u670D\u52A1\u540D"),
|
|
11095
|
+
methodName: stringType().describe("\u65B9\u6CD5\u540D")
|
|
11096
|
+
});
|
|
11097
|
+
objectType({
|
|
11098
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11099
|
+
serviceType: stringType().describe("\u670D\u52A1\u7C7B\u578B"),
|
|
11100
|
+
serviceEnglishName: stringType().describe("\u670D\u52A1\u82F1\u6587\u540D\u79F0"),
|
|
11101
|
+
serviceChineseName: stringType().describe("\u670D\u52A1\u4E2D\u6587\u540D\u79F0"),
|
|
11102
|
+
serviceDescription: stringType().describe("\u670D\u52A1\u63CF\u8FF0"),
|
|
11103
|
+
interfaceDetailList: arrayType(InterfaceDetailSchema).default([]).describe("\u63A5\u53E3\u8BE6\u60C5\u5217\u8868")
|
|
11104
|
+
});
|
|
11105
|
+
const TrafficEstimationSchema = objectType({
|
|
11106
|
+
description: stringType().describe("\u63CF\u8FF0"),
|
|
11107
|
+
qps: stringType().describe("\u9884\u4F30QPS"),
|
|
11108
|
+
peakQps: stringType().describe("\u5CF0\u503CQPS"),
|
|
11109
|
+
dailyVolume: stringType().describe("\u65E5\u8BF7\u6C42\u91CF")
|
|
11110
|
+
});
|
|
11111
|
+
const MessageQueueDesignSchema = objectType({
|
|
11112
|
+
topicName: stringType().describe("Topic\u540D\u79F0"),
|
|
11113
|
+
description: stringType().describe("\u63CF\u8FF0"),
|
|
11114
|
+
producer: stringType().describe("\u751F\u4EA7\u8005"),
|
|
11115
|
+
consumer: stringType().describe("\u6D88\u8D39\u8005"),
|
|
11116
|
+
messageType: stringType().describe("\u6D88\u606F\u7C7B\u578B")
|
|
11117
|
+
});
|
|
11118
|
+
const DatabaseSplitDesignSchema = objectType({
|
|
11119
|
+
tableName: stringType().describe("\u8868\u540D"),
|
|
11120
|
+
splitStrategy: stringType().describe("\u62C6\u5206\u7B56\u7565"),
|
|
11121
|
+
splitKey: stringType().describe("\u62C6\u5206\u952E"),
|
|
11122
|
+
description: stringType().describe("\u63CF\u8FF0")
|
|
11123
|
+
});
|
|
11124
|
+
const DistributedTransactionDesignSchema = objectType({
|
|
11125
|
+
sceneName: stringType().describe("\u573A\u666F\u540D\u79F0"),
|
|
11126
|
+
transactionType: stringType().describe("\u4E8B\u52A1\u7C7B\u578B(TCC/SAGA/2PC\u7B49)"),
|
|
11127
|
+
participants: stringType().describe("\u53C2\u4E0E\u65B9"),
|
|
11128
|
+
description: stringType().describe("\u63CF\u8FF0")
|
|
11129
|
+
});
|
|
11130
|
+
const DistributedLockDesignSchema = objectType({
|
|
11131
|
+
lockName: stringType().describe("\u9501\u540D\u79F0"),
|
|
11132
|
+
lockType: stringType().describe("\u9501\u7C7B\u578B"),
|
|
11133
|
+
timeout: stringType().describe("\u8D85\u65F6\u65F6\u95F4"),
|
|
11134
|
+
description: stringType().describe("\u63CF\u8FF0")
|
|
11135
|
+
});
|
|
11136
|
+
const ScheduledTaskDesignSchema = objectType({
|
|
11137
|
+
taskName: stringType().describe("\u4EFB\u52A1\u540D\u79F0"),
|
|
11138
|
+
cronExpression: stringType().describe("Cron\u8868\u8FBE\u5F0F"),
|
|
11139
|
+
description: stringType().describe("\u63CF\u8FF0"),
|
|
11140
|
+
executorClass: stringType().describe("\u6267\u884C\u7C7B")
|
|
11141
|
+
});
|
|
11142
|
+
const DelayTaskDesignSchema = objectType({
|
|
11143
|
+
taskName: stringType().describe("\u4EFB\u52A1\u540D\u79F0"),
|
|
11144
|
+
delayTime: stringType().describe("\u5EF6\u65F6\u65F6\u95F4"),
|
|
11145
|
+
description: stringType().describe("\u63CF\u8FF0"),
|
|
11146
|
+
triggerCondition: stringType().describe("\u89E6\u53D1\u6761\u4EF6")
|
|
11147
|
+
});
|
|
11148
|
+
const CacheScenarioSchema = objectType({
|
|
11149
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11150
|
+
sceneName: stringType().describe("\u573A\u666F\u540D\u79F0"),
|
|
11151
|
+
cacheKey: stringType().describe("\u7F13\u5B58Key"),
|
|
11152
|
+
expireTime: stringType().describe("\u8FC7\u671F\u65F6\u95F4"),
|
|
11153
|
+
description: stringType().describe("\u63CF\u8FF0")
|
|
11154
|
+
});
|
|
11155
|
+
const CacheDesignSchema = objectType({
|
|
11156
|
+
constraint: stringType().describe("\u7EA6\u675F"),
|
|
11157
|
+
cacheScenarioList: arrayType(CacheScenarioSchema).default([]).describe("\u4F7F\u7528\u573A\u666F\u5217\u8868"),
|
|
11158
|
+
designDescription: stringType().describe("\u65B9\u6848\u8BBE\u8BA1\u63CF\u8FF0")
|
|
11159
|
+
});
|
|
11160
|
+
objectType({
|
|
11161
|
+
trafficEstimation: TrafficEstimationSchema.nullable().optional().describe("6.1 \u6D41\u91CF\u4F30\u7B97\u5206\u6790"),
|
|
11162
|
+
messageQueueList: arrayType(MessageQueueDesignSchema).default([]).describe("6.2 \u6D88\u606F\u961F\u5217"),
|
|
11163
|
+
databaseSplitList: arrayType(DatabaseSplitDesignSchema).default([]).describe("6.3 \u6570\u636E\u5E93\u62C6\u5206\u8BBE\u8BA1"),
|
|
11164
|
+
distributedTransactionList: arrayType(DistributedTransactionDesignSchema).default([]).describe("6.4 \u5206\u5E03\u5F0F\u4E8B\u52A1"),
|
|
11165
|
+
distributedLockList: arrayType(DistributedLockDesignSchema).default([]).describe("6.5 \u5206\u5E03\u5F0F\u9501"),
|
|
11166
|
+
scheduledTaskList: arrayType(ScheduledTaskDesignSchema).default([]).describe("6.6 \u5B9A\u65F6\u4EFB\u52A1"),
|
|
11167
|
+
delayTaskList: arrayType(DelayTaskDesignSchema).default([]).describe("6.7 \u5EF6\u65F6\u4EFB\u52A1"),
|
|
11168
|
+
cacheDesign: CacheDesignSchema.nullable().optional().describe("6.8 \u7F13\u5B58\u65B9\u6848")
|
|
11169
|
+
});
|
|
11170
|
+
objectType({
|
|
11171
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11172
|
+
sceneName: stringType().describe("\u5F02\u5E38\u573A\u666F"),
|
|
11173
|
+
exceptionType: stringType().describe("\u5F02\u5E38\u7C7B\u578B"),
|
|
11174
|
+
handleStrategy: stringType().describe("\u5904\u7406\u7B56\u7565"),
|
|
11175
|
+
description: stringType().describe("\u63CF\u8FF0")
|
|
11176
|
+
});
|
|
11177
|
+
const ExceptionCodeSchema = objectType({
|
|
11178
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11179
|
+
exceptionCode: stringType().describe("\u5F02\u5E38\u7F16\u7801"),
|
|
11180
|
+
exceptionDescription: stringType().describe("\u5F02\u5E38\u63CF\u8FF0")
|
|
11181
|
+
});
|
|
11182
|
+
const CodeValueSchema = objectType({
|
|
11183
|
+
id: stringType().describe("\u5E8F\u53F7"),
|
|
11184
|
+
propertyName: stringType().describe("\u5C5E\u6027"),
|
|
11185
|
+
codeValue: stringType().describe("\u7801\u503C")
|
|
11186
|
+
});
|
|
11187
|
+
objectType({
|
|
11188
|
+
exceptionCodeList: arrayType(ExceptionCodeSchema).default([]).describe("8.1 \u5F02\u5E38\u7801\u8868"),
|
|
11189
|
+
codeValueList: arrayType(CodeValueSchema).default([]).describe("8.2 \u7801\u503C")
|
|
11190
|
+
});
|
|
11191
|
+
function normalizeInputData(input) {
|
|
11192
|
+
const result = {
|
|
11193
|
+
...input
|
|
11194
|
+
};
|
|
11195
|
+
if (Array.isArray(input.tableInfoList)) result.tableInfoList = input.tableInfoList.map((table, tableIndex)=>{
|
|
11196
|
+
const normalizedTable = {
|
|
11197
|
+
id: table.id || String(tableIndex + 1),
|
|
11198
|
+
tableName: table.tableName || '',
|
|
11199
|
+
entityName: table.entityName || table.tableName || '',
|
|
11200
|
+
tableDescription: table.tableDescription || table.tableComment || table.comment || '',
|
|
11201
|
+
tableDetailList: []
|
|
11202
|
+
};
|
|
11203
|
+
const fieldList = table.tableDetailList || table.fieldList || [];
|
|
11204
|
+
normalizedTable.tableDetailList = fieldList.map((field, fieldIndex)=>({
|
|
11205
|
+
id: field.id || String(fieldIndex + 1),
|
|
11206
|
+
fieldName: field.fieldName || '',
|
|
11207
|
+
fieldType: field.fieldType || '',
|
|
11208
|
+
fieldDescription: field.fieldDescription || field.fieldComment || field.comment || '',
|
|
11209
|
+
fieldLength: field.fieldLength || '-'
|
|
11210
|
+
}));
|
|
11211
|
+
return normalizedTable;
|
|
11212
|
+
});
|
|
11213
|
+
if (Array.isArray(input.serviceInterfaceList)) result.serviceInterfaceList = input.serviceInterfaceList.map((service, serviceIndex)=>{
|
|
11214
|
+
if (void 0 !== service.serviceEnglishName) return service;
|
|
11215
|
+
const normalizedService = {
|
|
11216
|
+
id: service.id || String(serviceIndex + 1),
|
|
11217
|
+
serviceType: service.serviceType || 'REST',
|
|
11218
|
+
serviceEnglishName: service.interfaceName || service.serviceEnglishName || '',
|
|
11219
|
+
serviceChineseName: service.serviceChineseName || service.interfaceComment || service.interfaceName || '',
|
|
11220
|
+
serviceDescription: service.serviceDescription || service.interfaceComment || '',
|
|
11221
|
+
interfaceDetailList: []
|
|
11222
|
+
};
|
|
11223
|
+
const methodList = service.interfaceDetailList || service.methodList || [];
|
|
11224
|
+
normalizedService.interfaceDetailList = methodList.map((method, methodIndex)=>({
|
|
11225
|
+
id: method.id || String(methodIndex + 1),
|
|
11226
|
+
functionDescription: method.functionDescription || method.methodComment || method.comment || '',
|
|
11227
|
+
serviceName: method.serviceName || service.interfaceName || service.serviceEnglishName || '',
|
|
11228
|
+
methodName: method.methodName || ''
|
|
11229
|
+
}));
|
|
11230
|
+
return normalizedService;
|
|
11231
|
+
});
|
|
11232
|
+
if (Array.isArray(input.designDetailList)) result.designDetailList = input.designDetailList.map((design)=>{
|
|
11233
|
+
if (void 0 !== design.serviceName && void 0 !== design.interfaceDesignDetailList) return design;
|
|
11234
|
+
return {
|
|
11235
|
+
serviceName: design.designName || design.serviceName || '',
|
|
11236
|
+
serviceDesc: design.designDesc || design.serviceDesc || '',
|
|
11237
|
+
interfaceDesignDetailList: design.interfaceDesignDetailList || []
|
|
11238
|
+
};
|
|
11239
|
+
});
|
|
11240
|
+
if (Array.isArray(input.businessExceptionList)) result.businessExceptionList = input.businessExceptionList.map((exception, index)=>{
|
|
11241
|
+
if (void 0 !== exception.sceneName) return exception;
|
|
11242
|
+
return {
|
|
11243
|
+
id: exception.id || String(index + 1),
|
|
11244
|
+
sceneName: exception.exceptionCode || exception.sceneName || '',
|
|
11245
|
+
exceptionType: exception.exceptionType || 'BusinessException',
|
|
11246
|
+
handleStrategy: exception.exceptionSolution || exception.handleStrategy || '',
|
|
11247
|
+
description: exception.exceptionDesc || exception.description || ''
|
|
11248
|
+
};
|
|
11249
|
+
});
|
|
11250
|
+
if ('string' == typeof input.techSolution) result.techSolution = {
|
|
11251
|
+
trafficEstimation: null,
|
|
11252
|
+
messageQueueList: [],
|
|
11253
|
+
databaseSplitList: [],
|
|
11254
|
+
distributedTransactionList: [],
|
|
11255
|
+
distributedLockList: [],
|
|
11256
|
+
scheduledTaskList: [],
|
|
11257
|
+
delayTaskList: [],
|
|
11258
|
+
cacheDesign: {
|
|
11259
|
+
constraint: input.techSolution,
|
|
11260
|
+
cacheScenarioList: [],
|
|
11261
|
+
designDescription: input.techSolution
|
|
11262
|
+
}
|
|
11263
|
+
};
|
|
11264
|
+
return result;
|
|
11265
|
+
}
|
|
11266
|
+
const techSpecGeneratorTool = {
|
|
11267
|
+
name: "generate_tech_spec",
|
|
11268
|
+
description: `\u{6839}\u{636E}\u{4EE3}\u{7801}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{751F}\u{6210}\u{6280}\u{672F}\u{89C4}\u{683C}\u{8BF4}\u{660E}\u{4E66}(Word\u{6587}\u{6863})\u{3002}
|
|
11269
|
+
|
|
11270
|
+
\u{89E6}\u{53D1}\u{8BCD}: \u{751F}\u{6210}\u{6280}\u{672F}\u{89C4}\u{683C}\u{3001}\u{6280}\u{672F}\u{89C4}\u{683C}\u{8BF4}\u{660E}\u{4E66}\u{3001}\u{751F}\u{6210}\u{6280}\u{672F}\u{6587}\u{6863}\u{3001}\u{6280}\u{672F}spec\u{3001}\u{4EE3}\u{7801}\u{6587}\u{6863}\u{5316}\u{3001}\u{751F}\u{6210}\u{89C4}\u{683C}\u{4E66}\u{3001}\u{6280}\u{672F}\u{8BF4}\u{660E}\u{4E66}
|
|
11271
|
+
|
|
11272
|
+
\u{9002}\u{7528}\u{573A}\u{666F}:
|
|
11273
|
+
- \u{9700}\u{8981}\u{4E3A}\u{9879}\u{76EE}/\u{6A21}\u{5757}\u{751F}\u{6210}\u{6B63}\u{5F0F}\u{7684}\u{6280}\u{672F}\u{89C4}\u{683C}\u{8BF4}\u{660E}\u{4E66}
|
|
11274
|
+
- \u{9700}\u{8981}\u{5C06}\u{4EE3}\u{7801}\u{7ED3}\u{6784}\u{6587}\u{6863}\u{5316}\u{4E3A}Word\u{683C}\u{5F0F}
|
|
11275
|
+
- \u{9879}\u{76EE}\u{4EA4}\u{4ED8}\u{9700}\u{8981}\u{6280}\u{672F}\u{6587}\u{6863}
|
|
11276
|
+
|
|
11277
|
+
\u{8F93}\u{5165}\u{8981}\u{6C42}: \u{9700}\u{8981}\u{5148}\u{5206}\u{6790}\u{4EE3}\u{7801}\u{76EE}\u{5F55}\u{FF0C}\u{6536}\u{96C6}\u{6570}\u{636E}\u{8868}\u{8BBE}\u{8BA1}\u{3001}\u{670D}\u{52A1}\u{63A5}\u{53E3}\u{3001}\u{529F}\u{80FD}\u{8BBE}\u{8BA1}\u{7B49}\u{4FE1}\u{606F}
|
|
11278
|
+
\u{8F93}\u{51FA}: Word\u{683C}\u{5F0F}\u{7684}\u{6280}\u{672F}\u{89C4}\u{683C}\u{8BF4}\u{660E}\u{4E66}(.docx)\u{FF0C}\u{4FDD}\u{5B58}\u{5230} .aico/tech/ \u{76EE}\u{5F55}`,
|
|
11279
|
+
inputSchema: {
|
|
11280
|
+
projectPath: stringType().min(1).describe("\u5F53\u524D\u9879\u76EE\u8DEF\u5F84\uFF0C\u751F\u6210\u7684\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66\u4FDD\u5B58\u5230\u8BE5\u8DEF\u5F84\u4E0B\u7684.aico/tech\u76EE\u5F55"),
|
|
11281
|
+
techSpecData: unionType([
|
|
11282
|
+
stringType(),
|
|
11283
|
+
objectType({
|
|
11284
|
+
projectName: stringType().describe("\u9879\u76EE\u540D\u79F0"),
|
|
11285
|
+
moduleName: stringType().describe("\u6A21\u5757\u540D\u79F0"),
|
|
11286
|
+
year: stringType().optional().describe("\u5E74\u4EFD\uFF0C\u9ED8\u8BA4\u5F53\u524D\u5E74\u4EFD"),
|
|
11287
|
+
month: stringType().optional().describe("\u6708\u4EFD\uFF0C\u9ED8\u8BA4\u5F53\u524D\u6708\u4EFD"),
|
|
11288
|
+
referDoc: stringType().optional().describe("\u53C2\u8003\u6587\u6863"),
|
|
11289
|
+
serviceInterfaceList: arrayType(anyType()).default([]).describe("\u670D\u52A1\u63A5\u53E3\u6E05\u5355"),
|
|
11290
|
+
designDetailList: arrayType(anyType()).default([]).describe("\u670D\u52A1\u63A5\u53E3\u8BBE\u8BA1\u8BE6\u60C5"),
|
|
11291
|
+
tableInfoList: arrayType(anyType()).default([]).describe("\u6570\u636E\u5E93\u8868\u4FE1\u606F\u5217\u8868"),
|
|
11292
|
+
techSolution: anyType().optional().describe("\u7B2C6\u7AE0-\u6280\u672F\u65B9\u6848"),
|
|
11293
|
+
businessExceptionList: arrayType(anyType()).default([]).describe("\u7B2C7\u7AE0-\u4E1A\u52A1\u5F02\u5E38\u5904\u7406\u5217\u8868"),
|
|
11294
|
+
appendix: anyType().optional().describe("\u7B2C8\u7AE0-\u9644\u5F55")
|
|
11295
|
+
}).passthrough()
|
|
11296
|
+
]).describe("\u6280\u672F\u89C4\u683C\u6570\u636E(JSON\u5BF9\u8C61\u6216JSON\u5B57\u7B26\u4E32)\uFF0C\u5305\u542B: projectName(\u9879\u76EE\u540D), moduleName(\u6A21\u5757\u540D), tableInfoList(\u6570\u636E\u8868), serviceInterfaceList(\u670D\u52A1\u63A5\u53E3), designDetailList(\u8BBE\u8BA1\u8BE6\u60C5)")
|
|
11297
|
+
},
|
|
11298
|
+
handler: async (args)=>{
|
|
11299
|
+
try {
|
|
11300
|
+
const { projectPath } = args;
|
|
11301
|
+
let { techSpecData } = args;
|
|
11302
|
+
if (!projectPath) return {
|
|
11303
|
+
content: [
|
|
11304
|
+
{
|
|
11305
|
+
type: "text",
|
|
11306
|
+
text: JSON.stringify({
|
|
11307
|
+
success: false,
|
|
11308
|
+
message: "\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570\uFF1AprojectPath",
|
|
11309
|
+
data: null
|
|
11310
|
+
})
|
|
11311
|
+
}
|
|
11312
|
+
],
|
|
11313
|
+
isError: true
|
|
11314
|
+
};
|
|
11315
|
+
if (!techSpecData) return {
|
|
11316
|
+
content: [
|
|
11317
|
+
{
|
|
11318
|
+
type: "text",
|
|
11319
|
+
text: JSON.stringify({
|
|
11320
|
+
success: false,
|
|
11321
|
+
message: "\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570\uFF1AtechSpecData",
|
|
11322
|
+
data: null
|
|
11323
|
+
})
|
|
11324
|
+
}
|
|
11325
|
+
],
|
|
11326
|
+
isError: true
|
|
11327
|
+
};
|
|
11328
|
+
logger.info("\u63A5\u6536\u5230\u7684 techSpecData \u7C7B\u578B", {
|
|
11329
|
+
type: typeof techSpecData
|
|
11330
|
+
});
|
|
11331
|
+
logger.info("\u63A5\u6536\u5230\u7684 techSpecData \u5185\u5BB9", {
|
|
11332
|
+
data: JSON.stringify(techSpecData).substring(0, 500)
|
|
11333
|
+
});
|
|
11334
|
+
if ("string" == typeof techSpecData) try {
|
|
11335
|
+
techSpecData = JSON.parse(techSpecData);
|
|
11336
|
+
logger.info("techSpecData \u4ECE\u5B57\u7B26\u4E32\u89E3\u6790\u4E3A\u5BF9\u8C61");
|
|
11337
|
+
} catch (parseError) {
|
|
11338
|
+
return {
|
|
11339
|
+
content: [
|
|
11340
|
+
{
|
|
11341
|
+
type: "text",
|
|
11342
|
+
text: JSON.stringify({
|
|
11343
|
+
success: false,
|
|
11344
|
+
message: "techSpecData \u53C2\u6570\u683C\u5F0F\u9519\u8BEF\uFF0C\u5E94\u4E3A JSON \u5BF9\u8C61",
|
|
11345
|
+
data: null
|
|
11346
|
+
})
|
|
11347
|
+
}
|
|
11348
|
+
],
|
|
11349
|
+
isError: true
|
|
11350
|
+
};
|
|
11351
|
+
}
|
|
11352
|
+
const now = new Date();
|
|
11353
|
+
const normalizedData = normalizeInputData(techSpecData);
|
|
11354
|
+
const data = {
|
|
11355
|
+
projectName: normalizedData.projectName || "\u672A\u547D\u540D\u9879\u76EE",
|
|
11356
|
+
moduleName: normalizedData.moduleName || "\u672A\u547D\u540D\u6A21\u5757",
|
|
11357
|
+
year: normalizedData.year || String(now.getFullYear()),
|
|
11358
|
+
month: normalizedData.month || String(now.getMonth() + 1).padStart(2, "0"),
|
|
11359
|
+
referDoc: normalizedData.referDoc || "\u65E0",
|
|
11360
|
+
serviceInterfaceList: normalizedData.serviceInterfaceList || [],
|
|
11361
|
+
designDetailList: normalizedData.designDetailList || [],
|
|
11362
|
+
tableInfoList: normalizedData.tableInfoList || [],
|
|
11363
|
+
techSolution: normalizedData.techSolution || void 0,
|
|
11364
|
+
businessExceptionList: normalizedData.businessExceptionList || [],
|
|
11365
|
+
appendix: normalizedData.appendix || void 0
|
|
11366
|
+
};
|
|
11367
|
+
const outputDir = external_path_namespaceObject.join(projectPath, ".aico", "tech");
|
|
11368
|
+
logger.info("\u5F00\u59CB\u751F\u6210\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66", {
|
|
11369
|
+
projectPath,
|
|
11370
|
+
outputDir,
|
|
11371
|
+
projectName: data.projectName,
|
|
11372
|
+
moduleName: data.moduleName,
|
|
11373
|
+
tableCount: data.tableInfoList.length,
|
|
11374
|
+
serviceCount: data.serviceInterfaceList.length,
|
|
11375
|
+
hasTechSolution: !!data.techSolution,
|
|
11376
|
+
businessExceptionCount: data.businessExceptionList?.length || 0,
|
|
11377
|
+
hasAppendix: !!data.appendix
|
|
11378
|
+
});
|
|
11379
|
+
const result = await renderTechSpecDoc(data, outputDir);
|
|
11380
|
+
if (result.success) return {
|
|
11381
|
+
content: [
|
|
11382
|
+
{
|
|
11383
|
+
type: "text",
|
|
11384
|
+
text: JSON.stringify({
|
|
11385
|
+
success: true,
|
|
11386
|
+
message: "\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66\u751F\u6210\u6210\u529F",
|
|
11387
|
+
data: {
|
|
11388
|
+
outputPath: result.outputPath,
|
|
11389
|
+
projectName: data.projectName,
|
|
11390
|
+
moduleName: data.moduleName,
|
|
11391
|
+
statistics: {
|
|
11392
|
+
tableCount: data.tableInfoList.length,
|
|
11393
|
+
serviceCount: data.serviceInterfaceList.length,
|
|
11394
|
+
designCount: data.designDetailList.length,
|
|
11395
|
+
hasTechSolution: !!data.techSolution,
|
|
11396
|
+
businessExceptionCount: data.businessExceptionList?.length || 0,
|
|
11397
|
+
exceptionCodeCount: data.appendix?.exceptionCodeList?.length || 0,
|
|
11398
|
+
codeValueCount: data.appendix?.codeValueList?.length || 0
|
|
11399
|
+
}
|
|
11400
|
+
}
|
|
11401
|
+
})
|
|
11402
|
+
}
|
|
11403
|
+
]
|
|
11404
|
+
};
|
|
11405
|
+
return {
|
|
11406
|
+
content: [
|
|
11407
|
+
{
|
|
11408
|
+
type: "text",
|
|
11409
|
+
text: JSON.stringify({
|
|
11410
|
+
success: false,
|
|
11411
|
+
message: result.error || "\u6587\u6863\u751F\u6210\u5931\u8D25",
|
|
11412
|
+
data: null
|
|
11413
|
+
})
|
|
11414
|
+
}
|
|
11415
|
+
],
|
|
11416
|
+
isError: true
|
|
11417
|
+
};
|
|
11418
|
+
} catch (error) {
|
|
11419
|
+
logger.error("\u6280\u672F\u89C4\u683C\u8BF4\u660E\u4E66\u751F\u6210\u5F02\u5E38", {
|
|
11420
|
+
error: error.message
|
|
11421
|
+
});
|
|
11422
|
+
return {
|
|
11423
|
+
content: [
|
|
11424
|
+
{
|
|
11425
|
+
type: "text",
|
|
11426
|
+
text: JSON.stringify({
|
|
11427
|
+
success: false,
|
|
11428
|
+
message: error.message || "\u751F\u6210\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF",
|
|
11429
|
+
data: null
|
|
11430
|
+
})
|
|
11431
|
+
}
|
|
11432
|
+
],
|
|
11433
|
+
isError: true
|
|
11434
|
+
};
|
|
11435
|
+
}
|
|
11436
|
+
}
|
|
11437
|
+
};
|
|
10824
11438
|
function createMcpServer() {
|
|
10825
11439
|
const server = new mcp_js_namespaceObject.McpServer({
|
|
10826
11440
|
name: SERVICE_CONFIG.name,
|
|
@@ -10838,7 +11452,8 @@ ${requirement_description}
|
|
|
10838
11452
|
exportExcelTool,
|
|
10839
11453
|
requirementIdentifierTool,
|
|
10840
11454
|
requirementAlignerTool,
|
|
10841
|
-
taskExecutorTool
|
|
11455
|
+
taskExecutorTool,
|
|
11456
|
+
techSpecGeneratorTool
|
|
10842
11457
|
];
|
|
10843
11458
|
tools.forEach((tool)=>{
|
|
10844
11459
|
server.tool(tool.name, tool.description, tool.inputSchema, tool.handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAoBpE,wBAAgB,eAAe,cAiC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/requirement-analyzer/core/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,UAAU,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE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ED,MAAM,WAAW,cAAc;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC;CAC5C;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAElB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IAErB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,uBAAuB,EAAE,MAAM,CAAC;QAChC,YAAY,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/requirement-analyzer/core/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,UAAU,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC/B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,kBAA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AC;KACJ,CAAC;IAEF,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AAGD,qBAAa,wBAAyB,SAAQ,KAAK;aAG/B,IAAI,EAAE,MAAM;aACZ,OAAO,CAAC,EAAE,GAAG;gBAF7B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,GAAG,YAAA;CAKhC;AAED,oBAAY,UAAU;IACpB,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;IACjC,uBAAuB,4BAA4B;IACnD,0BAA0B,+BAA+B;IACzD,yBAAyB,8BAA8B;IACvD,0BAA0B,+BAA+B;IACzD,4BAA4B,iCAAiC;CAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/requirement-analyzer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/requirement-analyzer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0KxB;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;oBAyCZ,GAAG;;;;;;;;;;;;;CAwU1B,CAAC;AAGF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文档渲染服务
|
|
3
|
+
* 使用 docxtemplater 将数据渲染到技术规格说明书模板
|
|
4
|
+
*/
|
|
5
|
+
import { TechSpecData, DocGenerationResult } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* 渲染技术规格说明书文档
|
|
8
|
+
* @param data 技术规格数据
|
|
9
|
+
* @param outputDir 输出目录
|
|
10
|
+
* @returns 生成结果
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderTechSpecDoc(data: TechSpecData, outputDir: string): Promise<DocGenerationResult>;
|
|
13
|
+
//# sourceMappingURL=doc-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-renderer.d.ts","sourceRoot":"","sources":["../../../src/services/tech-spec-generator/doc-renderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAiD,MAAM,SAAS,CAAC;AA0E3G;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAiF9B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 技术规格说明书生成工具
|
|
3
|
+
*
|
|
4
|
+
* 该工具用于根据代码目录生成技术规格说明书
|
|
5
|
+
* 工作流程:
|
|
6
|
+
* 1. MCP客户端读取代码目录,收集技术规格数据
|
|
7
|
+
* 2. 将收集的数据传递给该工具
|
|
8
|
+
* 3. 工具使用模板渲染生成技术规格说明书
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/**
|
|
12
|
+
* 技术规格说明书生成工具
|
|
13
|
+
*/
|
|
14
|
+
export declare const techSpecGeneratorTool: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: {
|
|
18
|
+
projectPath: z.ZodString;
|
|
19
|
+
techSpecData: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
20
|
+
projectName: z.ZodString;
|
|
21
|
+
moduleName: z.ZodString;
|
|
22
|
+
year: z.ZodOptional<z.ZodString>;
|
|
23
|
+
month: z.ZodOptional<z.ZodString>;
|
|
24
|
+
referDoc: z.ZodOptional<z.ZodString>;
|
|
25
|
+
serviceInterfaceList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
26
|
+
designDetailList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
27
|
+
tableInfoList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
28
|
+
techSolution: z.ZodOptional<z.ZodAny>;
|
|
29
|
+
businessExceptionList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
30
|
+
appendix: z.ZodOptional<z.ZodAny>;
|
|
31
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
32
|
+
projectName: z.ZodString;
|
|
33
|
+
moduleName: z.ZodString;
|
|
34
|
+
year: z.ZodOptional<z.ZodString>;
|
|
35
|
+
month: z.ZodOptional<z.ZodString>;
|
|
36
|
+
referDoc: z.ZodOptional<z.ZodString>;
|
|
37
|
+
serviceInterfaceList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
38
|
+
designDetailList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
39
|
+
tableInfoList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
40
|
+
techSolution: z.ZodOptional<z.ZodAny>;
|
|
41
|
+
businessExceptionList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
42
|
+
appendix: z.ZodOptional<z.ZodAny>;
|
|
43
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
44
|
+
projectName: z.ZodString;
|
|
45
|
+
moduleName: z.ZodString;
|
|
46
|
+
year: z.ZodOptional<z.ZodString>;
|
|
47
|
+
month: z.ZodOptional<z.ZodString>;
|
|
48
|
+
referDoc: z.ZodOptional<z.ZodString>;
|
|
49
|
+
serviceInterfaceList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
50
|
+
designDetailList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
51
|
+
tableInfoList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
52
|
+
techSolution: z.ZodOptional<z.ZodAny>;
|
|
53
|
+
businessExceptionList: z.ZodDefault<z.ZodArray<z.ZodAny, "many">>;
|
|
54
|
+
appendix: z.ZodOptional<z.ZodAny>;
|
|
55
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
56
|
+
};
|
|
57
|
+
handler: (args: any) => Promise<{
|
|
58
|
+
content: {
|
|
59
|
+
type: string;
|
|
60
|
+
text: string;
|
|
61
|
+
}[];
|
|
62
|
+
isError: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
content: {
|
|
65
|
+
type: string;
|
|
66
|
+
text: string;
|
|
67
|
+
}[];
|
|
68
|
+
isError?: undefined;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
export * from "./types";
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/tech-spec-generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgZxB;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA0CV,GAAG;;;;;;;;;;;;;CAsK1B,CAAC;AAGF,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 技术规格说明书数据类型定义
|
|
3
|
+
* 基于 .aico/create-tect-docs/技术规格说明书模板.docx 中的占位符
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 表字段详情 - 用于 tableDetailList 循环
|
|
7
|
+
*/
|
|
8
|
+
export interface TableFieldDetail {
|
|
9
|
+
id: string;
|
|
10
|
+
fieldName: string;
|
|
11
|
+
fieldType: string;
|
|
12
|
+
fieldDescription: string;
|
|
13
|
+
fieldLength: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 数据表信息 - 用于 tableInfoList 循环
|
|
17
|
+
*/
|
|
18
|
+
export interface TableInfo {
|
|
19
|
+
id: string;
|
|
20
|
+
tableName: string;
|
|
21
|
+
entityName: string;
|
|
22
|
+
tableDescription: string;
|
|
23
|
+
tableDetailList: TableFieldDetail[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 接口参数信息 - 用于 parameterList 循环
|
|
27
|
+
*/
|
|
28
|
+
export interface ParameterInfo {
|
|
29
|
+
id: string;
|
|
30
|
+
propertyType: string;
|
|
31
|
+
propertyName: string;
|
|
32
|
+
required: string;
|
|
33
|
+
propertyDesc: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 返回结果信息 - 用于 returnResultList 循环
|
|
37
|
+
*/
|
|
38
|
+
export interface ReturnResultInfo {
|
|
39
|
+
id: string;
|
|
40
|
+
propertyType: string;
|
|
41
|
+
propertyName: string;
|
|
42
|
+
propertyDesc: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 接口设计详情 - 用于 interfaceDesignDetailList 循环
|
|
46
|
+
*/
|
|
47
|
+
export interface InterfaceDesignDetail {
|
|
48
|
+
functionName: string;
|
|
49
|
+
interfaceDesc: string;
|
|
50
|
+
className: string;
|
|
51
|
+
methodName: string;
|
|
52
|
+
parameterList: ParameterInfo[];
|
|
53
|
+
returnResultList: ReturnResultInfo[];
|
|
54
|
+
implementLogic: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 设计详情 - 用于 designDetailList 循环
|
|
58
|
+
*/
|
|
59
|
+
export interface DesignDetail {
|
|
60
|
+
serviceName: string;
|
|
61
|
+
serviceDesc: string;
|
|
62
|
+
interfaceDesignDetailList: InterfaceDesignDetail[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 接口详情 - 用于 interfaceDetailList 循环
|
|
66
|
+
*/
|
|
67
|
+
export interface InterfaceDetail {
|
|
68
|
+
id: string;
|
|
69
|
+
functionDescription: string;
|
|
70
|
+
serviceName: string;
|
|
71
|
+
methodName: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 服务接口信息 - 用于 serviceInterfaceList 循环
|
|
75
|
+
*/
|
|
76
|
+
export interface ServiceInterface {
|
|
77
|
+
id: string;
|
|
78
|
+
serviceType: string;
|
|
79
|
+
serviceEnglishName: string;
|
|
80
|
+
serviceChineseName: string;
|
|
81
|
+
serviceDescription: string;
|
|
82
|
+
interfaceDetailList: InterfaceDetail[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 流量估算分析
|
|
86
|
+
*/
|
|
87
|
+
export interface TrafficEstimation {
|
|
88
|
+
description: string;
|
|
89
|
+
qps: string;
|
|
90
|
+
peakQps: string;
|
|
91
|
+
dailyVolume: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 消息队列设计
|
|
95
|
+
*/
|
|
96
|
+
export interface MessageQueueDesign {
|
|
97
|
+
topicName: string;
|
|
98
|
+
description: string;
|
|
99
|
+
producer: string;
|
|
100
|
+
consumer: string;
|
|
101
|
+
messageType: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 数据库拆分设计
|
|
105
|
+
*/
|
|
106
|
+
export interface DatabaseSplitDesign {
|
|
107
|
+
tableName: string;
|
|
108
|
+
splitStrategy: string;
|
|
109
|
+
splitKey: string;
|
|
110
|
+
description: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 分布式事务设计
|
|
114
|
+
*/
|
|
115
|
+
export interface DistributedTransactionDesign {
|
|
116
|
+
sceneName: string;
|
|
117
|
+
transactionType: string;
|
|
118
|
+
participants: string;
|
|
119
|
+
description: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 分布式锁设计
|
|
123
|
+
*/
|
|
124
|
+
export interface DistributedLockDesign {
|
|
125
|
+
lockName: string;
|
|
126
|
+
lockType: string;
|
|
127
|
+
timeout: string;
|
|
128
|
+
description: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 定时任务设计
|
|
132
|
+
*/
|
|
133
|
+
export interface ScheduledTaskDesign {
|
|
134
|
+
taskName: string;
|
|
135
|
+
cronExpression: string;
|
|
136
|
+
description: string;
|
|
137
|
+
executorClass: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 延时任务设计
|
|
141
|
+
*/
|
|
142
|
+
export interface DelayTaskDesign {
|
|
143
|
+
taskName: string;
|
|
144
|
+
delayTime: string;
|
|
145
|
+
description: string;
|
|
146
|
+
triggerCondition: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 缓存使用场景
|
|
150
|
+
*/
|
|
151
|
+
export interface CacheScenario {
|
|
152
|
+
id: string;
|
|
153
|
+
sceneName: string;
|
|
154
|
+
cacheKey: string;
|
|
155
|
+
expireTime: string;
|
|
156
|
+
description: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 缓存方案设计
|
|
160
|
+
*/
|
|
161
|
+
export interface CacheDesign {
|
|
162
|
+
constraint: string;
|
|
163
|
+
cacheScenarioList: CacheScenario[];
|
|
164
|
+
designDescription: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* 技术方案 - 第6章
|
|
168
|
+
*/
|
|
169
|
+
export interface TechSolution {
|
|
170
|
+
trafficEstimation: TrafficEstimation | null;
|
|
171
|
+
messageQueueList: MessageQueueDesign[];
|
|
172
|
+
databaseSplitList: DatabaseSplitDesign[];
|
|
173
|
+
distributedTransactionList: DistributedTransactionDesign[];
|
|
174
|
+
distributedLockList: DistributedLockDesign[];
|
|
175
|
+
scheduledTaskList: ScheduledTaskDesign[];
|
|
176
|
+
delayTaskList: DelayTaskDesign[];
|
|
177
|
+
cacheDesign: CacheDesign | null;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 业务异常处理项
|
|
181
|
+
*/
|
|
182
|
+
export interface BusinessExceptionItem {
|
|
183
|
+
id: string;
|
|
184
|
+
sceneName: string;
|
|
185
|
+
exceptionType: string;
|
|
186
|
+
handleStrategy: string;
|
|
187
|
+
description: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 异常码信息 - 用于 exceptionCodeList 循环
|
|
191
|
+
*/
|
|
192
|
+
export interface ExceptionCode {
|
|
193
|
+
id: string;
|
|
194
|
+
exceptionCode: string;
|
|
195
|
+
exceptionDescription: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* 码值信息 - 用于 codeValueList 循环
|
|
199
|
+
*/
|
|
200
|
+
export interface CodeValue {
|
|
201
|
+
id: string;
|
|
202
|
+
propertyName: string;
|
|
203
|
+
codeValue: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 附录 - 第8章
|
|
207
|
+
*/
|
|
208
|
+
export interface Appendix {
|
|
209
|
+
exceptionCodeList: ExceptionCode[];
|
|
210
|
+
codeValueList: CodeValue[];
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 技术规格说明书完整数据结构
|
|
214
|
+
* 模板占位符对应关系:
|
|
215
|
+
* - {projectName} - 项目名称
|
|
216
|
+
* - {moduleName} - 模块名称
|
|
217
|
+
* - {year} - 年份
|
|
218
|
+
* - {month} - 月份
|
|
219
|
+
* - {referDoc} - 参考文档
|
|
220
|
+
* - {#serviceInterfaceList}...{/serviceInterfaceList} - 服务接口列表循环
|
|
221
|
+
* - {#designDetailList}...{/designDetailList} - 设计详情列表循环
|
|
222
|
+
* - {#tableInfoList}...{/tableInfoList} - 数据表信息列表循环
|
|
223
|
+
* - {#techSolution}...{/techSolution} - 技术方案相关
|
|
224
|
+
* - {#businessExceptionList}...{/businessExceptionList} - 业务异常处理列表
|
|
225
|
+
* - {#appendix}...{/appendix} - 附录相关
|
|
226
|
+
*/
|
|
227
|
+
export interface TechSpecData {
|
|
228
|
+
projectName: string;
|
|
229
|
+
moduleName: string;
|
|
230
|
+
year: string;
|
|
231
|
+
month: string;
|
|
232
|
+
referDoc: string;
|
|
233
|
+
serviceInterfaceList: ServiceInterface[];
|
|
234
|
+
designDetailList: DesignDetail[];
|
|
235
|
+
tableInfoList: TableInfo[];
|
|
236
|
+
techSolution?: TechSolution;
|
|
237
|
+
businessExceptionList?: BusinessExceptionItem[];
|
|
238
|
+
appendix?: Appendix;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* 代码分析结果
|
|
242
|
+
*/
|
|
243
|
+
export interface CodeAnalysisResult {
|
|
244
|
+
success: boolean;
|
|
245
|
+
data: TechSpecData | null;
|
|
246
|
+
error?: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 文档生成结果
|
|
250
|
+
*/
|
|
251
|
+
export interface DocGenerationResult {
|
|
252
|
+
success: boolean;
|
|
253
|
+
outputPath: string | null;
|
|
254
|
+
error?: string;
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/tech-spec-generator/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,gBAAgB,EAAE,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,E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I,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IAGjB,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;IAGzC,gBAAgB,EAAE,YAAY,EAAE,CAAC;IAGjC,aAAa,EAAE,SAAS,EAAE,CAAC;IAG3B,YAAY,CAAC,EAAE,YAAY,CAAC;IAG5B,qBAAqB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAGhD,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intention-coding",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "软件工程化的需求分析,功能设计,代码编写,测试运行和发布部署",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.11.0",
|
|
@@ -34,11 +34,13 @@
|
|
|
34
34
|
"@modelcontextprotocol/sdk": "^1.17.5",
|
|
35
35
|
"aico-pack": "2.1.0",
|
|
36
36
|
"axios": "^1.10.0",
|
|
37
|
+
"docxtemplater": "^3.67.6",
|
|
37
38
|
"html-to-md": "^0.8.8",
|
|
38
39
|
"jimp": "^1.6.0",
|
|
39
40
|
"lru-cache": "^11.1.0",
|
|
40
41
|
"mammoth": "^1.9.1",
|
|
41
42
|
"pdf-parse": "^1.1.1",
|
|
43
|
+
"pizzip": "^3.2.0",
|
|
42
44
|
"sharp": "^0.34.3",
|
|
43
45
|
"uuid": "^11.1.0",
|
|
44
46
|
"winston": "^3.17.0",
|
|
@@ -57,6 +59,7 @@
|
|
|
57
59
|
"@types/lodash": "^4.17.16",
|
|
58
60
|
"@types/node": "^24.0.0",
|
|
59
61
|
"@types/pdf-parse": "^1.1.5",
|
|
62
|
+
"@types/pizzip": "^3.0.5",
|
|
60
63
|
"@types/uuid": "^10.0.0",
|
|
61
64
|
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
62
65
|
"@typescript-eslint/parser": "^8.32.1",
|