intention-coding 0.0.7 → 0.0.9
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 +272 -124
- package/dist/index.js +274 -126
- package/dist/prompt/tech.d.ts +1 -0
- package/dist/utils/common.d.ts +4 -0
- package/dist/utils/pack.d.ts +5 -0
- package/dist/utils/storage.d.ts +0 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -148,13 +148,11 @@ const external_winston_namespaceObject = require("winston");
|
|
|
148
148
|
var external_winston_default = /*#__PURE__*/ __webpack_require__.n(external_winston_namespaceObject);
|
|
149
149
|
const external_winston_daily_rotate_file_namespaceObject = require("winston-daily-rotate-file");
|
|
150
150
|
var external_winston_daily_rotate_file_default = /*#__PURE__*/ __webpack_require__.n(external_winston_daily_rotate_file_namespaceObject);
|
|
151
|
-
const external_path_namespaceObject = require("path");
|
|
152
|
-
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
153
151
|
const external_fs_namespaceObject = require("fs");
|
|
154
152
|
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
155
|
-
|
|
153
|
+
const config_PROJECT_ROOT = process.env.MCP_STORAGE_DIR || process.cwd();
|
|
156
154
|
const getStorageDir = ()=>{
|
|
157
|
-
const envDir =
|
|
155
|
+
const envDir = config_PROJECT_ROOT + "/.aico";
|
|
158
156
|
if (!external_fs_namespaceObject.existsSync(envDir)) external_fs_namespaceObject.mkdirSync(envDir, {
|
|
159
157
|
recursive: true
|
|
160
158
|
});
|
|
@@ -165,6 +163,8 @@ const SERVICE_CONFIG = {
|
|
|
165
163
|
version: "0.0.1",
|
|
166
164
|
description: "\u8F6F\u4EF6\u5DE5\u7A0B\u5316\u7684\u9700\u6C42\u5206\u6790\uFF0C\u529F\u80FD\u8BBE\u8BA1\uFF0C\u4EE3\u7801\u7F16\u5199\uFF0C\u6D4B\u8BD5\u8FD0\u884C\u548C\u53D1\u5E03\u90E8\u7F72"
|
|
167
165
|
};
|
|
166
|
+
const external_path_namespaceObject = require("path");
|
|
167
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
168
168
|
const logDir = getStorageDir() + '/logs';
|
|
169
169
|
const levels = {
|
|
170
170
|
error: 0,
|
|
@@ -194,8 +194,8 @@ const transports = [
|
|
|
194
194
|
filename: external_path_default().join(logDir, 'application-%DATE%.log'),
|
|
195
195
|
datePattern: 'YYYY-MM-DD',
|
|
196
196
|
zippedArchive: true,
|
|
197
|
-
maxSize: '
|
|
198
|
-
maxFiles: '
|
|
197
|
+
maxSize: '2m',
|
|
198
|
+
maxFiles: '7d',
|
|
199
199
|
format: fileFormat,
|
|
200
200
|
level: 'info'
|
|
201
201
|
})
|
|
@@ -213,7 +213,7 @@ const logger_logger = external_winston_default().createLogger({
|
|
|
213
213
|
datePattern: 'YYYY-MM-DD',
|
|
214
214
|
zippedArchive: true,
|
|
215
215
|
maxSize: '1m',
|
|
216
|
-
maxFiles: '
|
|
216
|
+
maxFiles: '7d',
|
|
217
217
|
format: fileFormat
|
|
218
218
|
})
|
|
219
219
|
],
|
|
@@ -223,7 +223,7 @@ const logger_logger = external_winston_default().createLogger({
|
|
|
223
223
|
datePattern: 'YYYY-MM-DD',
|
|
224
224
|
zippedArchive: true,
|
|
225
225
|
maxSize: '1m',
|
|
226
|
-
maxFiles: '
|
|
226
|
+
maxFiles: '7d',
|
|
227
227
|
format: fileFormat
|
|
228
228
|
})
|
|
229
229
|
]
|
|
@@ -3917,7 +3917,7 @@ const RequirementManagerParams = objectType({
|
|
|
3917
3917
|
]).describe("\u9700\u6C42\u5206\u7C7B")
|
|
3918
3918
|
});
|
|
3919
3919
|
const ArchitectureDesignerParams = objectType({
|
|
3920
|
-
design_focus: stringType().optional().default("full_architecture").describe("\u8BBE\u8BA1\u91CD\u70B9")
|
|
3920
|
+
design_focus: stringType().optional().default("full_architecture").describe("\u8BBE\u8BA1\u91CD\u70B9,\u9879\u76EE\u67B6\u6784\u8BBE\u8BA1")
|
|
3921
3921
|
});
|
|
3922
3922
|
async function invokeFlow(params, streamCb) {
|
|
3923
3923
|
const { appid = 'app-ESTcrkOPOmkxdrO0120mE4s1', data, timeout = 1800000 } = params;
|
|
@@ -4090,6 +4090,27 @@ function removeImagesFromMarkdown(content) {
|
|
|
4090
4090
|
cleaned = cleaned.replace(/\n{3,}/g, '\n\n');
|
|
4091
4091
|
return cleaned.trim();
|
|
4092
4092
|
}
|
|
4093
|
+
async function validateAndResolvePath(filePath) {
|
|
4094
|
+
if ('win32' === process.platform && filePath.startsWith('\\\\')) filePath = '\\\\?\\UNC\\' + filePath.substring(2);
|
|
4095
|
+
const normalized = external_path_default().normalize(filePath);
|
|
4096
|
+
const resolved = external_path_default().resolve(normalized);
|
|
4097
|
+
const cwd = process.cwd();
|
|
4098
|
+
if (!resolved.startsWith(cwd)) {
|
|
4099
|
+
logger_logger.warn(`\u{6587}\u{4EF6}\u{8BBF}\u{95EE}\u{8D85}\u{51FA}\u{5DE5}\u{4F5C}\u{76EE}\u{5F55}: ${filePath}`);
|
|
4100
|
+
throw new Error(`\u{6587}\u{4EF6}\u{8BBF}\u{95EE}\u{8D85}\u{51FA}\u{5DE5}\u{4F5C}\u{76EE}\u{5F55}: ${filePath}`);
|
|
4101
|
+
}
|
|
4102
|
+
if (!resolved.toLowerCase().endsWith('.docx')) {
|
|
4103
|
+
logger_logger.warn(`\u{4EC5}\u{652F}\u{6301}.docx\u{683C}\u{5F0F}\u{6587}\u{4EF6}: ${filePath}`);
|
|
4104
|
+
throw new Error(`\u{4EC5}\u{652F}\u{6301}.docx\u{683C}\u{5F0F}\u{6587}\u{4EF6}: ${filePath}`);
|
|
4105
|
+
}
|
|
4106
|
+
try {
|
|
4107
|
+
await external_fs_namespaceObject.promises.access(resolved, external_fs_namespaceObject.promises.constants.R_OK);
|
|
4108
|
+
} catch (error) {
|
|
4109
|
+
logger_logger.warn(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`, error);
|
|
4110
|
+
throw new Error(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`);
|
|
4111
|
+
}
|
|
4112
|
+
return resolved;
|
|
4113
|
+
}
|
|
4093
4114
|
const promises_namespaceObject = require("fs/promises");
|
|
4094
4115
|
var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
|
|
4095
4116
|
const requirementClarifier = {
|
|
@@ -4120,19 +4141,35 @@ const requirementClarifier = {
|
|
|
4120
4141
|
user_input
|
|
4121
4142
|
});
|
|
4122
4143
|
const fileName = sanitizeFileName(analysisContent.length > 10 ? analysisContent.substring(0, 10) : `analysis_${Date.now()}`);
|
|
4123
|
-
const mdDir = external_path_default().join(getStorageDir(), '
|
|
4144
|
+
const mdDir = external_path_default().join(getStorageDir(), 'prd');
|
|
4124
4145
|
await promises_default().mkdir(mdDir, {
|
|
4125
4146
|
recursive: true
|
|
4126
4147
|
});
|
|
4127
4148
|
const mdPath = external_path_default().join(mdDir, `${fileName}.md`);
|
|
4128
4149
|
const mdPathResolved = external_path_default().resolve(mdPath);
|
|
4129
|
-
await
|
|
4150
|
+
const subContents = await getSubAnalysis(analysisContent);
|
|
4151
|
+
let finalContent = analysisContent;
|
|
4152
|
+
let jumpLinks = [];
|
|
4153
|
+
if (subContents.length > 0) {
|
|
4154
|
+
jumpLinks = await saveSubAnalysisFiles(mdDir, subContents);
|
|
4155
|
+
finalContent = addJumpLinks(analysisContent, jumpLinks);
|
|
4156
|
+
logger_logger.info({
|
|
4157
|
+
module: 'requirement_clarifier',
|
|
4158
|
+
message: `\u{6210}\u{529F}\u{5904}\u{7406}${subContents.length}\u{4E2A}\u{7EC6}\u{5206}\u{9879}`,
|
|
4159
|
+
jumpLinks: jumpLinks.map((link)=>({
|
|
4160
|
+
title: link.title,
|
|
4161
|
+
file: external_path_default().basename(link.path)
|
|
4162
|
+
}))
|
|
4163
|
+
});
|
|
4164
|
+
}
|
|
4165
|
+
await promises_default().writeFile(mdPath, finalContent, 'utf8');
|
|
4130
4166
|
logger_logger.info({
|
|
4131
4167
|
module: 'requirement_clarifier',
|
|
4132
4168
|
message: "\u9700\u6C42\u5206\u6790\u6587\u4EF6\u5DF2\u4FDD\u5B58",
|
|
4133
|
-
path: mdPathResolved
|
|
4169
|
+
path: mdPathResolved,
|
|
4170
|
+
hasSubFiles: jumpLinks.length > 0
|
|
4134
4171
|
});
|
|
4135
|
-
return formatAnalysisPrompt(user_input,
|
|
4172
|
+
return formatAnalysisPrompt(user_input, finalContent, mdPathResolved);
|
|
4136
4173
|
} catch (error) {
|
|
4137
4174
|
const errorMsg = `\u{9700}\u{6C42}\u{5206}\u{6790}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`;
|
|
4138
4175
|
logger_logger.error({
|
|
@@ -4167,13 +4204,98 @@ const getAiAnalysis = async (input)=>{
|
|
|
4167
4204
|
throw new Error(`AI\u{5206}\u{6790}\u{8BF7}\u{6C42}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`);
|
|
4168
4205
|
}
|
|
4169
4206
|
};
|
|
4170
|
-
const
|
|
4207
|
+
const getSubAnalysis = async (content)=>{
|
|
4208
|
+
try {
|
|
4209
|
+
const response = await invokeFlow({
|
|
4210
|
+
appid: 'app-aiEw80lPBus0DfybAGbW8PvX',
|
|
4211
|
+
data: {
|
|
4212
|
+
content
|
|
4213
|
+
}
|
|
4214
|
+
});
|
|
4215
|
+
return response.outputs.result;
|
|
4216
|
+
} catch (error) {
|
|
4217
|
+
const errorMsg = `\u{7EC6}\u{5206}\u{5206}\u{6790}\u{8BF7}\u{6C42}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`;
|
|
4218
|
+
logger_logger.error({
|
|
4219
|
+
module: 'requirement_clarifier',
|
|
4220
|
+
message: errorMsg,
|
|
4221
|
+
stack: error instanceof Error ? error.stack : void 0
|
|
4222
|
+
});
|
|
4223
|
+
return [];
|
|
4224
|
+
}
|
|
4225
|
+
};
|
|
4226
|
+
const saveSubAnalysisFiles = async (mainDir, contentArray)=>{
|
|
4227
|
+
const subFiles = [];
|
|
4228
|
+
for(let i = 0; i < contentArray.length; i++){
|
|
4229
|
+
const content = contentArray[i];
|
|
4230
|
+
let title = `\u{5B50}\u{529F}\u{80FD}-${i + 1}`;
|
|
4231
|
+
const titleMatch = content.replace(/\n/g, '').match(/^###\s+([\s\S]*?)(?=#|$)/);
|
|
4232
|
+
if (titleMatch) title = titleMatch[1].trim();
|
|
4233
|
+
const safeFileName = `${sanitizeFileName(title)}.md`;
|
|
4234
|
+
const filePath = external_path_default().join(mainDir, safeFileName);
|
|
4235
|
+
try {
|
|
4236
|
+
await promises_default().writeFile(filePath, content, 'utf8');
|
|
4237
|
+
subFiles.push({
|
|
4238
|
+
title,
|
|
4239
|
+
path: filePath
|
|
4240
|
+
});
|
|
4241
|
+
logger_logger.debug({
|
|
4242
|
+
module: 'requirement_clarifier',
|
|
4243
|
+
message: "\u7EC6\u5206\u5206\u6790\u6587\u4EF6\u5DF2\u4FDD\u5B58",
|
|
4244
|
+
path: filePath,
|
|
4245
|
+
title
|
|
4246
|
+
});
|
|
4247
|
+
} catch (error) {
|
|
4248
|
+
logger_logger.error({
|
|
4249
|
+
module: 'requirement_clarifier',
|
|
4250
|
+
message: `\u{4FDD}\u{5B58}\u{7EC6}\u{5206}\u{6587}\u{4EF6}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`,
|
|
4251
|
+
filePath,
|
|
4252
|
+
contentPreview: content.substring(0, 50) + '...'
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
return subFiles;
|
|
4257
|
+
};
|
|
4258
|
+
const addJumpLinks = (mainContent, subFiles)=>{
|
|
4259
|
+
if (!subFiles.length) return mainContent;
|
|
4260
|
+
const titleMap = new Map();
|
|
4261
|
+
subFiles.forEach((file)=>{
|
|
4262
|
+
const simpleTitle = file.title.replace(/[^\w\u4e00-\u9fa5]+/g, '').toLowerCase();
|
|
4263
|
+
titleMap.set(simpleTitle, external_path_default().basename(file.path));
|
|
4264
|
+
});
|
|
4265
|
+
const sections = mainContent.split(/(\n###\s+[^\n]+\n)/);
|
|
4266
|
+
const processedSections = [];
|
|
4267
|
+
for(let i = 0; i < sections.length; i++){
|
|
4268
|
+
const section = sections[i];
|
|
4269
|
+
if (section.startsWith('\n### ')) {
|
|
4270
|
+
const titleMatch = section.match(/###\s+([\s\S]+?)\n/);
|
|
4271
|
+
if (!titleMatch) {
|
|
4272
|
+
processedSections.push(section);
|
|
4273
|
+
continue;
|
|
4274
|
+
}
|
|
4275
|
+
const rawTitle = titleMatch[1].trim();
|
|
4276
|
+
const simpleTitle = rawTitle.replace(/[^\w\u4e00-\u9fa5]+/g, '').toLowerCase();
|
|
4277
|
+
const fileName = titleMap.get(simpleTitle);
|
|
4278
|
+
if (fileName) {
|
|
4279
|
+
const linkedSection = section.replace(/(###\s+)([\s\S]+?)(\n)/, `$1$2 <a href="./${fileName}" style="float:right;">\u{1F4CE}</a>$3`);
|
|
4280
|
+
processedSections.push(linkedSection);
|
|
4281
|
+
titleMap.delete(simpleTitle);
|
|
4282
|
+
continue;
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
processedSections.push(section);
|
|
4286
|
+
}
|
|
4287
|
+
if (titleMap.size > 0) {
|
|
4288
|
+
processedSections.push("\n\n### \u8BE6\u7EC6\u5206\u6790\n");
|
|
4289
|
+
titleMap.forEach((fileName, title)=>{
|
|
4290
|
+
processedSections.push(`- [\u{67E5}\u{770B}${title}\u{5206}\u{6790}](./${fileName})\n`);
|
|
4291
|
+
});
|
|
4292
|
+
}
|
|
4293
|
+
return processedSections.join('');
|
|
4294
|
+
};
|
|
4295
|
+
const formatAnalysisPrompt = (userInput, content, filePath)=>`# \u{1F50D} AI\u{9700}\u{6C42}\u{5206}\u{6790}\u{5B8C}\u{6210}
|
|
4171
4296
|
|
|
4172
4297
|
## \u{1F4DD} \u{7528}\u{6237}\u{539F}\u{59CB}\u{9700}\u{6C42}
|
|
4173
4298
|
${userInput}
|
|
4174
|
-
|
|
4175
|
-
## \u{1F4CB} \u{5F53}\u{524D}\u{4E0A}\u{4E0B}\u{6587}
|
|
4176
|
-
${context}
|
|
4177
4299
|
------------------------------
|
|
4178
4300
|
## \u{1F52C} \u{9700}\u{6C42}\u{5206}\u{6790}\u{7ED3}\u{679C}
|
|
4179
4301
|
${content}
|
|
@@ -4231,26 +4353,6 @@ class RequirementStorage {
|
|
|
4231
4353
|
console.error(`\u{274C} \u{4FDD}\u{5B58}\u{9700}\u{6C42}\u{6587}\u{6863}\u{5931}\u{8D25}: ${e}`);
|
|
4232
4354
|
}
|
|
4233
4355
|
}
|
|
4234
|
-
saveHistoryEntry(entryType, content, metadata = {}) {
|
|
4235
|
-
try {
|
|
4236
|
-
const historyEntry = {
|
|
4237
|
-
timestamp: new Date().toISOString(),
|
|
4238
|
-
type: entryType,
|
|
4239
|
-
content,
|
|
4240
|
-
metadata
|
|
4241
|
-
};
|
|
4242
|
-
let history = [];
|
|
4243
|
-
if (external_fs_namespaceObject.existsSync(this.historyFile)) {
|
|
4244
|
-
const data = external_fs_namespaceObject.readFileSync(this.historyFile, "utf8");
|
|
4245
|
-
history = JSON.parse(data);
|
|
4246
|
-
}
|
|
4247
|
-
history.push(historyEntry);
|
|
4248
|
-
external_fs_namespaceObject.writeFileSync(this.historyFile, JSON.stringify(history, null, 2), "utf8");
|
|
4249
|
-
console.log(`\u{2705} \u{5386}\u{53F2}\u{8BB0}\u{5F55}\u{5DF2}\u{4FDD}\u{5B58}: ${entryType}`);
|
|
4250
|
-
} catch (e) {
|
|
4251
|
-
console.error(`\u{274C} \u{4FDD}\u{5B58}\u{5386}\u{53F2}\u{8BB0}\u{5F55}\u{5931}\u{8D25}: ${e}`);
|
|
4252
|
-
}
|
|
4253
|
-
}
|
|
4254
4356
|
exportFinalDocument(currentRequirements) {
|
|
4255
4357
|
try {
|
|
4256
4358
|
const finalDoc = {
|
|
@@ -4363,9 +4465,6 @@ function addRequirementEntry(type, category, content) {
|
|
|
4363
4465
|
requirements_utils_currentRequirements[type] = [
|
|
4364
4466
|
requirementEntry
|
|
4365
4467
|
];
|
|
4366
|
-
requirements_utils_storage.saveHistoryEntry(type, content, {
|
|
4367
|
-
category
|
|
4368
|
-
});
|
|
4369
4468
|
requirements_utils_storage.saveRequirements(requirements_utils_currentRequirements);
|
|
4370
4469
|
return requirements_utils_currentRequirements;
|
|
4371
4470
|
}
|
|
@@ -4404,123 +4503,173 @@ const requirementManagerTool = {
|
|
|
4404
4503
|
return formatRequirementUpdateResponse(category, clarified_info, requirements_utils_currentRequirements, storage.requirementsFile, storage.historyFile);
|
|
4405
4504
|
}
|
|
4406
4505
|
};
|
|
4506
|
+
const external_aico_pack_namespaceObject = require("aico-pack");
|
|
4507
|
+
async function packProject() {
|
|
4508
|
+
const mdDir = external_path_default().join(getStorageDir(), 'tech');
|
|
4509
|
+
await promises_default().mkdir(mdDir, {
|
|
4510
|
+
recursive: true
|
|
4511
|
+
});
|
|
4512
|
+
logger_logger.info(`\u{1F4C2} \u{6B63}\u{5728}\u{5206}\u{6790}\u{5F53}\u{524D}\u{672C}\u{5730}\u{9879}\u{76EE}`);
|
|
4513
|
+
const mdPath = external_path_default().join(mdDir, `\u{9879}\u{76EE}\u{67B6}\u{6784}\u{5206}\u{6790}.md`);
|
|
4514
|
+
const options = {
|
|
4515
|
+
output: mdPath,
|
|
4516
|
+
style: 'markdown',
|
|
4517
|
+
headerText: "\u667A\u80FD\u8F6F\u4EF6\u661F\u5DE5\u5382",
|
|
4518
|
+
fileSummary: true,
|
|
4519
|
+
removeEmptyLines: true,
|
|
4520
|
+
removeComments: true,
|
|
4521
|
+
showLineNumbers: true,
|
|
4522
|
+
compress: true,
|
|
4523
|
+
quiet: true,
|
|
4524
|
+
customPatterns: [
|
|
4525
|
+
"**/*.md",
|
|
4526
|
+
"**/*.log",
|
|
4527
|
+
"**/*.json",
|
|
4528
|
+
"**/*.dockerfile",
|
|
4529
|
+
"**/*.yml",
|
|
4530
|
+
"**/*.yaml",
|
|
4531
|
+
"**/*.sh",
|
|
4532
|
+
"**/*.env",
|
|
4533
|
+
"**/*.env.example",
|
|
4534
|
+
"**/LICENSE"
|
|
4535
|
+
]
|
|
4536
|
+
};
|
|
4537
|
+
await (0, external_aico_pack_namespaceObject.runCli)([
|
|
4538
|
+
config_PROJECT_ROOT
|
|
4539
|
+
], process.cwd(), options);
|
|
4540
|
+
return mdPath;
|
|
4541
|
+
}
|
|
4407
4542
|
const architectureDesignerTool = {
|
|
4408
4543
|
name: "architecture_designer",
|
|
4409
|
-
description: "\u67B6\u6784\u8BBE\u8BA1\
|
|
4544
|
+
description: "\u9879\u76EE\u67B6\u6784\u8BBE\u8BA1\u5E08 - \u57FA\u4E8E\u5B8C\u6574\u9700\u6C42\u751F\u6210\u6700\u4F18\u6280\u672F\u67B6\u6784\u65B9\u6848",
|
|
4410
4545
|
parameters: ArchitectureDesignerParams,
|
|
4411
4546
|
execute: async (args)=>{
|
|
4412
4547
|
const { design_focus = "full_architecture" } = args;
|
|
4413
4548
|
const storage = new RequirementStorage();
|
|
4414
|
-
|
|
4549
|
+
try {
|
|
4550
|
+
const mdPath = await packProject();
|
|
4551
|
+
const architecture_design = `# \u{1F3D7}\u{FE0F} \u{9879}\u{76EE}\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{65B9}\u{6848}
|
|
4415
4552
|
|
|
4416
4553
|
## \u{1F3AF} \u{8BBE}\u{8BA1}\u{76EE}\u{6807}
|
|
4417
4554
|
- **\u{8BBE}\u{8BA1}\u{91CD}\u{70B9}**\u{FF1A}${design_focus}
|
|
4418
4555
|
- **\u{4F18}\u{5316}\u{76EE}\u{6807}**\u{FF1A}AI\u{53CB}\u{597D}\u{3001}\u{4F4E}\u{8026}\u{5408}\u{3001}\u{53EF}\u{7EF4}\u{62A4}
|
|
4419
4556
|
|
|
4420
|
-
## \u{
|
|
4557
|
+
## \u{1F4C4} \u{5173}\u{952E}\u{6587}\u{6863}
|
|
4558
|
+
- [\u{1F517} \u{5B8C}\u{6574}\u{67B6}\u{6784}\u{5206}\u{6790}\u{62A5}\u{544A}](${mdPath})
|
|
4421
4559
|
|
|
4422
|
-
|
|
4423
|
-
- **\u{6A21}\u{5757}\u{72EC}\u{7ACB}\u{6027}**\u{FF1A}\u{6BCF}\u{4E2A}\u{6A21}\u{5757}\u{529F}\u{80FD}\u{5355}\u{4E00}\u{FF0C}\u{8FB9}\u{754C}\u{6E05}\u{6670}
|
|
4424
|
-
- **\u{63A5}\u{53E3}\u{6807}\u{51C6}\u{5316}**\u{FF1A}\u{7EDF}\u{4E00}\u{7684}API\u{63A5}\u{53E3}\u{89C4}\u{8303}
|
|
4425
|
-
- **\u{4F9D}\u{8D56}\u{6700}\u{5C0F}\u{5316}**\u{FF1A}\u{51CF}\u{5C11}\u{6A21}\u{5757}\u{95F4}\u{7684}\u{5F3A}\u{4F9D}\u{8D56}\u{5173}\u{7CFB}
|
|
4426
|
-
- **\u{9519}\u{8BEF}\u{9694}\u{79BB}**\u{FF1A}\u{5355}\u{4E2A}\u{6A21}\u{5757}\u{95EE}\u{9898}\u{4E0D}\u{5F71}\u{54CD}\u{6574}\u{4F53}\u{7CFB}\u{7EDF}
|
|
4560
|
+
## \u{1F916} AI\u{5F00}\u{53D1}\u{6700}\u{4F73}\u{5B9E}\u{8DF5}
|
|
4427
4561
|
|
|
4428
|
-
###
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
- **\u{6E10}\u{8FDB}\u{5F0F}\u{5F00}\u{53D1}**\u{FF1A}\u{652F}\u{6301}\u{5206}\u{9636}\u{6BB5}\u{5B9E}\u{73B0}\u{548C}\u{6D4B}\u{8BD5}
|
|
4562
|
+
### \u{6A21}\u{5757}\u{5F00}\u{53D1}\u{6307}\u{5BFC}
|
|
4563
|
+
1. **\u{5148}\u{5B9E}\u{73B0}\u{6838}\u{5FC3}\u{903B}\u{8F91}**\u{FF1A}\u{4E13}\u{6CE8}\u{4E3B}\u{8981}\u{529F}\u{80FD}
|
|
4564
|
+
2. **\u{518D}\u{6DFB}\u{52A0}\u{9519}\u{8BEF}\u{5904}\u{7406}**\u{FF1A}\u{5B8C}\u{5584}\u{5F02}\u{5E38}\u{5904}\u{7406}
|
|
4565
|
+
3. **\u{6700}\u{540E}\u{8FDB}\u{884C}\u{4F18}\u{5316}**\u{FF1A}\u{6027}\u{80FD}\u{4F18}\u{5316}\u{548C}\u{4EE3}\u{7801}\u{91CD}\u{6784}
|
|
4433
4566
|
|
|
4434
|
-
|
|
4567
|
+
### \u{80FD}\u{529B}\u{4F7F}\u{7528}\u{6307}\u{5357}
|
|
4568
|
+
> \u{5C06}\u{5B8C}\u{6574}\u{67B6}\u{6784}\u{5206}\u{6790}\u{62A5}\u{544A}\u{4F5C}\u{4E3A}\u{9644}\u{4EF6}\u{53D1}\u{9001}\u{7ED9}AI\u{FF0C}\u{53EF}\u{7528}\u{4E8E}\u{5B8C}\u{6210}\u{5982}\u{4E0B}\u{80FD}\u{529B}\u{FF1A}
|
|
4435
4569
|
|
|
4436
|
-
|
|
4437
|
-
**\u{
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4570
|
+
#### \u{5F00}\u{53D1}\u{8005}\u{6307}\u{5357}
|
|
4571
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4572
|
+
\u{521B}\u{5EFA}\u{5305}\u{542B}\u{4EE5}\u{4E0B}\u{5185}\u{5BB9}\u{7684}\u{5F00}\u{53D1}\u{8005}\u{6307}\u{5357}\u{FF1A}
|
|
4573
|
+
1. \u{73AF}\u{5883}\u{642D}\u{5EFA}\u{8BF4}\u{660E}
|
|
4574
|
+
2. \u{9879}\u{76EE}\u{7ED3}\u{6784}\u{6982}\u{89C8}
|
|
4575
|
+
3. \u{5F00}\u{53D1}\u{5DE5}\u{4F5C}\u{6D41}\u{7A0B}
|
|
4576
|
+
4. \u{6D4B}\u{8BD5}\u{65B9}\u{6CD5}
|
|
4577
|
+
5. \u{5E38}\u{89C1}\u{95EE}\u{9898}\u{6392}\u{67E5}\u{6B65}\u{9AA4}
|
|
4441
4578
|
|
|
4442
|
-
|
|
4443
|
-
**\u{
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4579
|
+
#### API \u{6587}\u{6863}
|
|
4580
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4581
|
+
\u{751F}\u{6210}\u{5168}\u{9762}\u{7684} API \u{6587}\u{6863}\u{FF1A}
|
|
4582
|
+
1. \u{5217}\u{51FA}\u{5E76}\u{63CF}\u{8FF0}\u{6240}\u{6709}\u{516C}\u{5171}\u{7AEF}\u{70B9}
|
|
4583
|
+
2. \u{8BB0}\u{5F55}\u{8BF7}\u{6C42}/\u{54CD}\u{5E94}\u{683C}\u{5F0F}
|
|
4584
|
+
3. \u{5305}\u{542B}\u{4F7F}\u{7528}\u{793A}\u{4F8B}
|
|
4585
|
+
4. \u{8BF4}\u{660E}\u{9650}\u{5236}\u{548C}\u{7EA6}\u{675F}
|
|
4447
4586
|
|
|
4448
|
-
|
|
4587
|
+
#### \u{67B6}\u{6784}\u{6587}\u{6863}
|
|
4588
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4589
|
+
\u{8BB0}\u{5F55}\u{7CFB}\u{7EDF}\u{67B6}\u{6784}\u{FF1A}
|
|
4590
|
+
1. \u{9AD8}\u{5C42}\u{6982}\u{8FF0}
|
|
4591
|
+
2. \u{7EC4}\u{4EF6}\u{4EA4}\u{4E92}
|
|
4592
|
+
3. \u{6570}\u{636E}\u{6D41}\u{7A0B}\u{56FE}
|
|
4593
|
+
4. \u{8BBE}\u{8BA1}\u{51B3}\u{7B56}\u{53CA}\u{7406}\u{7531}
|
|
4594
|
+
5. \u{7CFB}\u{7EDF}\u{9650}\u{5236}\u{548C}\u{7EA6}\u{675F}
|
|
4449
4595
|
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4596
|
+
#### \u{4F9D}\u{8D56}\u{9879}\u{5206}\u{6790}
|
|
4597
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4598
|
+
\u{5206}\u{6790}\u{9879}\u{76EE}\u{4F9D}\u{8D56}\u{FF1A}
|
|
4599
|
+
1. \u{8BC6}\u{522B}\u{8FC7}\u{65F6}\u{7684}\u{5305}
|
|
4600
|
+
2. \u{68C0}\u{67E5}\u{5B89}\u{5168}\u{6F0F}\u{6D1E}
|
|
4601
|
+
3. \u{5EFA}\u{8BAE}\u{66FF}\u{4EE3}\u{5305}
|
|
4602
|
+
4. \u{8BC4}\u{5BA1}\u{4F9D}\u{8D56}\u{4F7F}\u{7528}\u{6A21}\u{5F0F}
|
|
4455
4603
|
|
|
4456
|
-
|
|
4457
|
-
- \u{529F}\u{80FD}\u{FF1A}[\u{6839}\u{636E}\u{5177}\u{4F53}\u{9700}\u{6C42}\u{5B9A}\u{5236}]
|
|
4458
|
-
- \u{63A5}\u{53E3}\u{FF1A}\u{4E1A}\u{52A1}\u{903B}\u{8F91}API\u{3001}\u{6570}\u{636E}\u{5904}\u{7406}\u{63A5}\u{53E3}
|
|
4459
|
-
- AI\u{5F00}\u{53D1}\u{63D0}\u{793A}\u{FF1A}\u{6309}\u{529F}\u{80FD}\u{4F18}\u{5148}\u{7EA7}\u{9010}\u{6B65}\u{5B9E}\u{73B0}
|
|
4604
|
+
\u{5305}\u{542B}\u{5177}\u{4F53}\u{7684}\u{5347}\u{7EA7}\u{5EFA}\u{8BAE}\u{3002}
|
|
4460
4605
|
|
|
4461
|
-
|
|
4606
|
+
#### \u{6D4B}\u{8BD5}\u{8986}\u{76D6}\u{7387}
|
|
4607
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4608
|
+
\u{8BC4}\u{5BA1}\u{6D4B}\u{8BD5}\u{8986}\u{76D6}\u{7387}\u{FF1A}
|
|
4609
|
+
1. \u{8BC6}\u{522B}\u{672A}\u{6D4B}\u{8BD5}\u{7684}\u{7EC4}\u{4EF6}
|
|
4610
|
+
2. \u{5EFA}\u{8BAE}\u{989D}\u{5916}\u{7684}\u{6D4B}\u{8BD5}\u{7528}\u{4F8B}
|
|
4611
|
+
3. \u{8BC4}\u{5BA1}\u{6D4B}\u{8BD5}\u{8D28}\u{91CF}
|
|
4612
|
+
4. \u{63A8}\u{8350}\u{6D4B}\u{8BD5}\u{7B56}\u{7565}
|
|
4462
4613
|
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4614
|
+
#### \u{4EE3}\u{7801}\u{8D28}\u{91CF}
|
|
4615
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4616
|
+
\u{8BC4}\u{4F30}\u{4EE3}\u{7801}\u{8D28}\u{91CF}\u{5E76}\u{63D0}\u{51FA}\u{6539}\u{8FDB}\u{5EFA}\u{8BAE}\u{FF1A}
|
|
4617
|
+
1. \u{8BC4}\u{5BA1}\u{547D}\u{540D}\u{89C4}\u{8303}
|
|
4618
|
+
2. \u{68C0}\u{67E5}\u{4EE3}\u{7801}\u{7EC4}\u{7EC7}
|
|
4619
|
+
3. \u{8BC4}\u{4F30}\u{9519}\u{8BEF}\u{5904}\u{7406}
|
|
4620
|
+
4. \u{8BC4}\u{5BA1}\u{6CE8}\u{91CA}\u{5B9E}\u{8DF5}
|
|
4467
4621
|
|
|
4468
|
-
|
|
4469
|
-
- \u{7528}\u{6237}\u{7BA1}\u{7406}\u{529F}\u{80FD}\u{5B9E}\u{73B0}
|
|
4470
|
-
- \u{6838}\u{5FC3}\u{4E1A}\u{52A1}\u{903B}\u{8F91}\u{5F00}\u{53D1}
|
|
4471
|
-
- \u{524D}\u{7AEF}\u{4E3B}\u{8981}\u{9875}\u{9762}\u{5B9E}\u{73B0}
|
|
4622
|
+
\u{63D0}\u{4F9B}\u{5177}\u{4F53}\u{7684}\u{826F}\u{597D}\u{548C}\u{95EE}\u{9898}\u{6A21}\u{5F0F}\u{793A}\u{4F8B}\u{3002}
|
|
4472
4623
|
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4624
|
+
#### \u{67B6}\u{6784}\u{8BC4}\u{5BA1}
|
|
4625
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4626
|
+
\u{5206}\u{6790}\u{6B64}\u{4EE3}\u{7801}\u{5E93}\u{7684}\u{67B6}\u{6784}\u{FF1A}
|
|
4627
|
+
1. \u{8BC4}\u{4F30}\u{6574}\u{4F53}\u{7ED3}\u{6784}\u{548C}\u{6A21}\u{5F0F}
|
|
4628
|
+
2. \u{8BC6}\u{522B}\u{6F5C}\u{5728}\u{7684}\u{67B6}\u{6784}\u{95EE}\u{9898}
|
|
4629
|
+
3. \u{63D0}\u{51FA}\u{6539}\u{8FDB}\u{53EF}\u{6269}\u{5C55}\u{6027}\u{7684}\u{5EFA}\u{8BAE}
|
|
4630
|
+
4. \u{6807}\u{6CE8}\u{9075}\u{5FAA}\u{6700}\u{4F73}\u{5B9E}\u{8DF5}\u{7684}\u{90E8}\u{5206}
|
|
4477
4631
|
|
|
4478
|
-
|
|
4632
|
+
\u{91CD}\u{70B9}\u{5173}\u{6CE8}\u{53EF}\u{7EF4}\u{62A4}\u{6027}\u{548C}\u{6A21}\u{5757}\u{5316}\u{3002}
|
|
4479
4633
|
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4634
|
+
#### \u{5B89}\u{5168}\u{6027}\u{8BC4}\u{5BA1}
|
|
4635
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4636
|
+
\u{5BF9}\u{6B64}\u{4EE3}\u{7801}\u{5E93}\u{8FDB}\u{884C}\u{5B89}\u{5168}\u{6027}\u{8BC4}\u{5BA1}\u{FF1A}
|
|
4637
|
+
1. \u{8BC6}\u{522B}\u{6F5C}\u{5728}\u{7684}\u{5B89}\u{5168}\u{6F0F}\u{6D1E}
|
|
4638
|
+
2. \u{68C0}\u{67E5}\u{5E38}\u{89C1}\u{7684}\u{5B89}\u{5168}\u{53CD}\u{6A21}\u{5F0F}
|
|
4639
|
+
3. \u{8BC4}\u{5BA1}\u{9519}\u{8BEF}\u{5904}\u{7406}\u{548C}\u{8F93}\u{5165}\u{9A8C}\u{8BC1}
|
|
4640
|
+
4. \u{8BC4}\u{4F30}\u{4F9D}\u{8D56}\u{9879}\u{7684}\u{5B89}\u{5168}\u{6027}
|
|
4484
4641
|
|
|
4485
|
-
|
|
4486
|
-
- GET /api/users - \u{83B7}\u{53D6}\u{7528}\u{6237}\u{5217}\u{8868}
|
|
4487
|
-
- POST /api/users - \u{521B}\u{5EFA}\u{7528}\u{6237}
|
|
4488
|
-
- PUT /api/users/:id - \u{66F4}\u{65B0}\u{7528}\u{6237}
|
|
4489
|
-
- DELETE /api/users/:id - \u{5220}\u{9664}\u{7528}\u{6237}
|
|
4642
|
+
\u{8BF7}\u{63D0}\u{4F9B}\u{5177}\u{4F53}\u{793A}\u{4F8B}\u{548C}\u{4FEE}\u{590D}\u{6B65}\u{9AA4}\u{3002}
|
|
4490
4643
|
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
1.
|
|
4495
|
-
2.
|
|
4496
|
-
3.
|
|
4497
|
-
|
|
4498
|
-
### \u{5B9E}\u{65BD}\u{5EFA}\u{8BAE}
|
|
4499
|
-
1. **\u{5206}\u{9636}\u{6BB5}\u{5B9E}\u{65BD}**\u{FF1A}\u{6309}\u{8BA1}\u{5212}\u{9010}\u{6B65}\u{5B9E}\u{73B0}
|
|
4500
|
-
2. **\u{6301}\u{7EED}\u{6D4B}\u{8BD5}**\u{FF1A}\u{6BCF}\u{4E2A}\u{9636}\u{6BB5}\u{90FD}\u{8981}\u{8FDB}\u{884C}\u{5145}\u{5206}\u{6D4B}\u{8BD5}
|
|
4501
|
-
3. **\u{6587}\u{6863}\u{540C}\u{6B65}**\u{FF1A}\u{53CA}\u{65F6}\u{66F4}\u{65B0}\u{6587}\u{6863}
|
|
4644
|
+
#### \u{6027}\u{80FD}\u{8BC4}\u{5BA1}
|
|
4645
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4646
|
+
\u{4ECE}\u{6027}\u{80FD}\u{89D2}\u{5EA6}\u{8BC4}\u{5BA1}\u{4EE3}\u{7801}\u{5E93}\u{FF1A}
|
|
4647
|
+
1. \u{8BC6}\u{522B}\u{6027}\u{80FD}\u{74F6}\u{9888}
|
|
4648
|
+
2. \u{68C0}\u{67E5}\u{8D44}\u{6E90}\u{4F7F}\u{7528}\u{60C5}\u{51B5}
|
|
4649
|
+
3. \u{8BC4}\u{5BA1}\u{7B97}\u{6CD5}\u{6548}\u{7387}
|
|
4650
|
+
4. \u{8BC4}\u{4F30}\u{7F13}\u{5B58}\u{7B56}\u{7565}
|
|
4502
4651
|
|
|
4652
|
+
\u{5305}\u{542B}\u{5177}\u{4F53}\u{7684}\u{4F18}\u{5316}\u{5EFA}\u{8BAE}\u{3002}
|
|
4503
4653
|
---
|
|
4504
4654
|
|
|
4505
4655
|
**\u{1F389} \u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{5B8C}\u{6210}\u{FF01}**
|
|
4506
4656
|
|
|
4507
|
-
\u{8FD9}\u{4E2A}\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{65B9}\u{6848}\u{4E13}\u{95E8}\u{9488}\u{5BF9}AI\u{5F00}\u{53D1}\u{8FDB}\u{884C}\u{4E86}\u{4F18}\u{5316}\u{FF0C}\u{786E}\u{4FDD}\u{4F4E}\u{8026}\u{5408}\u{3001}AI\u{53CB}\u{597D}\u{7684}\u{5F00}\u{53D1}\u{4F53}\u{9A8C}\u{FF01}
|
|
4508
|
-
|
|
4509
4657
|
## \u{1F4BE} \u{6587}\u{6863}\u{5B58}\u{50A8}\u{4FE1}\u{606F}
|
|
4510
4658
|
- **\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{5DF2}\u{4FDD}\u{5B58}\u{5230}**: \`${storage.requirementsFile}\`
|
|
4511
4659
|
- **\u{5B8C}\u{6574}\u{6587}\u{6863}\u{5BFC}\u{51FA}**: \u{4F7F}\u{7528} \`export_final_document\` \u{5DE5}\u{5177}\u{5BFC}\u{51FA}\u{5B8C}\u{6574}\u{9879}\u{76EE}\u{6587}\u{6863}
|
|
4512
4660
|
`;
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
})
|
|
4522
|
-
|
|
4523
|
-
|
|
4661
|
+
requirements_utils_currentRequirements.architecture_designs = requirements_utils_currentRequirements.architecture_designs || [];
|
|
4662
|
+
requirements_utils_currentRequirements.architecture_designs.push({
|
|
4663
|
+
timestamp: new Date().toISOString(),
|
|
4664
|
+
design_focus,
|
|
4665
|
+
content: architecture_design
|
|
4666
|
+
});
|
|
4667
|
+
storage.saveRequirements(requirements_utils_currentRequirements);
|
|
4668
|
+
return architecture_design;
|
|
4669
|
+
} catch (error) {
|
|
4670
|
+
logger_logger.error(`\u{274C} \u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{751F}\u{6210}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`);
|
|
4671
|
+
throw new Error(`\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{751F}\u{6210}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`);
|
|
4672
|
+
}
|
|
4524
4673
|
}
|
|
4525
4674
|
};
|
|
4526
4675
|
const exportFinalDocumentTool = {
|
|
@@ -4701,9 +4850,8 @@ const word2mdTool = {
|
|
|
4701
4850
|
const { file_path } = args;
|
|
4702
4851
|
try {
|
|
4703
4852
|
if (!word2md_validateFilePath(file_path)) throw new Error(`\u{6587}\u{4EF6}\u{8DEF}\u{5F84}\u{65E0}\u{6548}: ${file_path}`);
|
|
4704
|
-
const
|
|
4705
|
-
|
|
4706
|
-
const buffer = await promises_namespaceObject.readFile(file_path);
|
|
4853
|
+
const resolvedPath = await validateAndResolvePath(file_path);
|
|
4854
|
+
const buffer = await promises_namespaceObject.readFile(resolvedPath);
|
|
4707
4855
|
const htmlResult = await external_mammoth_namespaceObject.convertToHtml({
|
|
4708
4856
|
buffer
|
|
4709
4857
|
});
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { FastMCP } from "fastmcp";
|
|
3
3
|
import winston from "winston";
|
|
4
4
|
import winston_daily_rotate_file from "winston-daily-rotate-file";
|
|
5
|
+
import fs_0, { existsSync, mkdirSync, promises, readFileSync, writeFileSync } from "fs";
|
|
5
6
|
import path_0, { join } from "path";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
7
|
+
import fs_promises, { mkdir, readFile, writeFile } from "fs/promises";
|
|
8
|
+
import { runCli as external_aico_pack_runCli } from "aico-pack";
|
|
8
9
|
import { convertToHtml } from "mammoth";
|
|
9
10
|
import html_to_md from "html-to-md";
|
|
10
11
|
var __webpack_require__ = {};
|
|
@@ -140,9 +141,9 @@ __webpack_require__.d(external_namespaceObject, {
|
|
|
140
141
|
util: ()=>util_util,
|
|
141
142
|
void: ()=>voidType
|
|
142
143
|
});
|
|
143
|
-
|
|
144
|
+
const config_PROJECT_ROOT = process.env.MCP_STORAGE_DIR || process.cwd();
|
|
144
145
|
const getStorageDir = ()=>{
|
|
145
|
-
const envDir =
|
|
146
|
+
const envDir = config_PROJECT_ROOT + "/.aico";
|
|
146
147
|
if (!existsSync(envDir)) mkdirSync(envDir, {
|
|
147
148
|
recursive: true
|
|
148
149
|
});
|
|
@@ -182,8 +183,8 @@ const transports = [
|
|
|
182
183
|
filename: path_0.join(logDir, 'application-%DATE%.log'),
|
|
183
184
|
datePattern: 'YYYY-MM-DD',
|
|
184
185
|
zippedArchive: true,
|
|
185
|
-
maxSize: '
|
|
186
|
-
maxFiles: '
|
|
186
|
+
maxSize: '2m',
|
|
187
|
+
maxFiles: '7d',
|
|
187
188
|
format: fileFormat,
|
|
188
189
|
level: 'info'
|
|
189
190
|
})
|
|
@@ -201,7 +202,7 @@ const logger_logger = winston.createLogger({
|
|
|
201
202
|
datePattern: 'YYYY-MM-DD',
|
|
202
203
|
zippedArchive: true,
|
|
203
204
|
maxSize: '1m',
|
|
204
|
-
maxFiles: '
|
|
205
|
+
maxFiles: '7d',
|
|
205
206
|
format: fileFormat
|
|
206
207
|
})
|
|
207
208
|
],
|
|
@@ -211,7 +212,7 @@ const logger_logger = winston.createLogger({
|
|
|
211
212
|
datePattern: 'YYYY-MM-DD',
|
|
212
213
|
zippedArchive: true,
|
|
213
214
|
maxSize: '1m',
|
|
214
|
-
maxFiles: '
|
|
215
|
+
maxFiles: '7d',
|
|
215
216
|
format: fileFormat
|
|
216
217
|
})
|
|
217
218
|
]
|
|
@@ -3905,7 +3906,7 @@ const RequirementManagerParams = objectType({
|
|
|
3905
3906
|
]).describe("\u9700\u6C42\u5206\u7C7B")
|
|
3906
3907
|
});
|
|
3907
3908
|
const ArchitectureDesignerParams = objectType({
|
|
3908
|
-
design_focus: stringType().optional().default("full_architecture").describe("\u8BBE\u8BA1\u91CD\u70B9")
|
|
3909
|
+
design_focus: stringType().optional().default("full_architecture").describe("\u8BBE\u8BA1\u91CD\u70B9,\u9879\u76EE\u67B6\u6784\u8BBE\u8BA1")
|
|
3909
3910
|
});
|
|
3910
3911
|
async function invokeFlow(params, streamCb) {
|
|
3911
3912
|
const { appid = 'app-ESTcrkOPOmkxdrO0120mE4s1', data, timeout = 1800000 } = params;
|
|
@@ -4078,6 +4079,27 @@ function removeImagesFromMarkdown(content) {
|
|
|
4078
4079
|
cleaned = cleaned.replace(/\n{3,}/g, '\n\n');
|
|
4079
4080
|
return cleaned.trim();
|
|
4080
4081
|
}
|
|
4082
|
+
async function validateAndResolvePath(filePath) {
|
|
4083
|
+
if ('win32' === process.platform && filePath.startsWith('\\\\')) filePath = '\\\\?\\UNC\\' + filePath.substring(2);
|
|
4084
|
+
const normalized = path_0.normalize(filePath);
|
|
4085
|
+
const resolved = path_0.resolve(normalized);
|
|
4086
|
+
const cwd = process.cwd();
|
|
4087
|
+
if (!resolved.startsWith(cwd)) {
|
|
4088
|
+
logger_logger.warn(`\u{6587}\u{4EF6}\u{8BBF}\u{95EE}\u{8D85}\u{51FA}\u{5DE5}\u{4F5C}\u{76EE}\u{5F55}: ${filePath}`);
|
|
4089
|
+
throw new Error(`\u{6587}\u{4EF6}\u{8BBF}\u{95EE}\u{8D85}\u{51FA}\u{5DE5}\u{4F5C}\u{76EE}\u{5F55}: ${filePath}`);
|
|
4090
|
+
}
|
|
4091
|
+
if (!resolved.toLowerCase().endsWith('.docx')) {
|
|
4092
|
+
logger_logger.warn(`\u{4EC5}\u{652F}\u{6301}.docx\u{683C}\u{5F0F}\u{6587}\u{4EF6}: ${filePath}`);
|
|
4093
|
+
throw new Error(`\u{4EC5}\u{652F}\u{6301}.docx\u{683C}\u{5F0F}\u{6587}\u{4EF6}: ${filePath}`);
|
|
4094
|
+
}
|
|
4095
|
+
try {
|
|
4096
|
+
await promises.access(resolved, promises.constants.R_OK);
|
|
4097
|
+
} catch (error) {
|
|
4098
|
+
logger_logger.warn(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`, error);
|
|
4099
|
+
throw new Error(`\u{6587}\u{4EF6}\u{4E0D}\u{5B58}\u{5728}\u{6216}\u{4E0D}\u{53EF}\u{8BFB}: ${resolved}`);
|
|
4100
|
+
}
|
|
4101
|
+
return resolved;
|
|
4102
|
+
}
|
|
4081
4103
|
const requirementClarifier = {
|
|
4082
4104
|
name: "requirement_clarifier",
|
|
4083
4105
|
description: "\u9700\u6C42\u5DE5\u7A0B\u5E08 - \u5206\u6790\u7528\u6237\u9700\u6C42\u5B8C\u6574\u6027\uFF0C\u4E3B\u52A8\u53D1\u73B0\u4E0D\u660E\u786E\u7684\u5730\u65B9",
|
|
@@ -4095,7 +4117,7 @@ const requirementClarifier = {
|
|
|
4095
4117
|
});
|
|
4096
4118
|
let context = user_input;
|
|
4097
4119
|
if (file_path) {
|
|
4098
|
-
const markdownContent = await
|
|
4120
|
+
const markdownContent = await fs_promises.readFile(file_path, 'utf8');
|
|
4099
4121
|
context = removeImagesFromMarkdown(markdownContent);
|
|
4100
4122
|
}
|
|
4101
4123
|
const analysisContent = await getAiAnalysis(context);
|
|
@@ -4106,19 +4128,35 @@ const requirementClarifier = {
|
|
|
4106
4128
|
user_input
|
|
4107
4129
|
});
|
|
4108
4130
|
const fileName = sanitizeFileName(analysisContent.length > 10 ? analysisContent.substring(0, 10) : `analysis_${Date.now()}`);
|
|
4109
|
-
const mdDir = path_0.join(getStorageDir(), '
|
|
4110
|
-
await
|
|
4131
|
+
const mdDir = path_0.join(getStorageDir(), 'prd');
|
|
4132
|
+
await fs_promises.mkdir(mdDir, {
|
|
4111
4133
|
recursive: true
|
|
4112
4134
|
});
|
|
4113
4135
|
const mdPath = path_0.join(mdDir, `${fileName}.md`);
|
|
4114
4136
|
const mdPathResolved = path_0.resolve(mdPath);
|
|
4115
|
-
await
|
|
4137
|
+
const subContents = await getSubAnalysis(analysisContent);
|
|
4138
|
+
let finalContent = analysisContent;
|
|
4139
|
+
let jumpLinks = [];
|
|
4140
|
+
if (subContents.length > 0) {
|
|
4141
|
+
jumpLinks = await saveSubAnalysisFiles(mdDir, subContents);
|
|
4142
|
+
finalContent = addJumpLinks(analysisContent, jumpLinks);
|
|
4143
|
+
logger_logger.info({
|
|
4144
|
+
module: 'requirement_clarifier',
|
|
4145
|
+
message: `\u{6210}\u{529F}\u{5904}\u{7406}${subContents.length}\u{4E2A}\u{7EC6}\u{5206}\u{9879}`,
|
|
4146
|
+
jumpLinks: jumpLinks.map((link)=>({
|
|
4147
|
+
title: link.title,
|
|
4148
|
+
file: path_0.basename(link.path)
|
|
4149
|
+
}))
|
|
4150
|
+
});
|
|
4151
|
+
}
|
|
4152
|
+
await fs_promises.writeFile(mdPath, finalContent, 'utf8');
|
|
4116
4153
|
logger_logger.info({
|
|
4117
4154
|
module: 'requirement_clarifier',
|
|
4118
4155
|
message: "\u9700\u6C42\u5206\u6790\u6587\u4EF6\u5DF2\u4FDD\u5B58",
|
|
4119
|
-
path: mdPathResolved
|
|
4156
|
+
path: mdPathResolved,
|
|
4157
|
+
hasSubFiles: jumpLinks.length > 0
|
|
4120
4158
|
});
|
|
4121
|
-
return formatAnalysisPrompt(user_input,
|
|
4159
|
+
return formatAnalysisPrompt(user_input, finalContent, mdPathResolved);
|
|
4122
4160
|
} catch (error) {
|
|
4123
4161
|
const errorMsg = `\u{9700}\u{6C42}\u{5206}\u{6790}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`;
|
|
4124
4162
|
logger_logger.error({
|
|
@@ -4153,13 +4191,98 @@ const getAiAnalysis = async (input)=>{
|
|
|
4153
4191
|
throw new Error(`AI\u{5206}\u{6790}\u{8BF7}\u{6C42}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`);
|
|
4154
4192
|
}
|
|
4155
4193
|
};
|
|
4156
|
-
const
|
|
4194
|
+
const getSubAnalysis = async (content)=>{
|
|
4195
|
+
try {
|
|
4196
|
+
const response = await invokeFlow({
|
|
4197
|
+
appid: 'app-aiEw80lPBus0DfybAGbW8PvX',
|
|
4198
|
+
data: {
|
|
4199
|
+
content
|
|
4200
|
+
}
|
|
4201
|
+
});
|
|
4202
|
+
return response.outputs.result;
|
|
4203
|
+
} catch (error) {
|
|
4204
|
+
const errorMsg = `\u{7EC6}\u{5206}\u{5206}\u{6790}\u{8BF7}\u{6C42}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`;
|
|
4205
|
+
logger_logger.error({
|
|
4206
|
+
module: 'requirement_clarifier',
|
|
4207
|
+
message: errorMsg,
|
|
4208
|
+
stack: error instanceof Error ? error.stack : void 0
|
|
4209
|
+
});
|
|
4210
|
+
return [];
|
|
4211
|
+
}
|
|
4212
|
+
};
|
|
4213
|
+
const saveSubAnalysisFiles = async (mainDir, contentArray)=>{
|
|
4214
|
+
const subFiles = [];
|
|
4215
|
+
for(let i = 0; i < contentArray.length; i++){
|
|
4216
|
+
const content = contentArray[i];
|
|
4217
|
+
let title = `\u{5B50}\u{529F}\u{80FD}-${i + 1}`;
|
|
4218
|
+
const titleMatch = content.replace(/\n/g, '').match(/^###\s+([\s\S]*?)(?=#|$)/);
|
|
4219
|
+
if (titleMatch) title = titleMatch[1].trim();
|
|
4220
|
+
const safeFileName = `${sanitizeFileName(title)}.md`;
|
|
4221
|
+
const filePath = path_0.join(mainDir, safeFileName);
|
|
4222
|
+
try {
|
|
4223
|
+
await fs_promises.writeFile(filePath, content, 'utf8');
|
|
4224
|
+
subFiles.push({
|
|
4225
|
+
title,
|
|
4226
|
+
path: filePath
|
|
4227
|
+
});
|
|
4228
|
+
logger_logger.debug({
|
|
4229
|
+
module: 'requirement_clarifier',
|
|
4230
|
+
message: "\u7EC6\u5206\u5206\u6790\u6587\u4EF6\u5DF2\u4FDD\u5B58",
|
|
4231
|
+
path: filePath,
|
|
4232
|
+
title
|
|
4233
|
+
});
|
|
4234
|
+
} catch (error) {
|
|
4235
|
+
logger_logger.error({
|
|
4236
|
+
module: 'requirement_clarifier',
|
|
4237
|
+
message: `\u{4FDD}\u{5B58}\u{7EC6}\u{5206}\u{6587}\u{4EF6}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`,
|
|
4238
|
+
filePath,
|
|
4239
|
+
contentPreview: content.substring(0, 50) + '...'
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
return subFiles;
|
|
4244
|
+
};
|
|
4245
|
+
const addJumpLinks = (mainContent, subFiles)=>{
|
|
4246
|
+
if (!subFiles.length) return mainContent;
|
|
4247
|
+
const titleMap = new Map();
|
|
4248
|
+
subFiles.forEach((file)=>{
|
|
4249
|
+
const simpleTitle = file.title.replace(/[^\w\u4e00-\u9fa5]+/g, '').toLowerCase();
|
|
4250
|
+
titleMap.set(simpleTitle, path_0.basename(file.path));
|
|
4251
|
+
});
|
|
4252
|
+
const sections = mainContent.split(/(\n###\s+[^\n]+\n)/);
|
|
4253
|
+
const processedSections = [];
|
|
4254
|
+
for(let i = 0; i < sections.length; i++){
|
|
4255
|
+
const section = sections[i];
|
|
4256
|
+
if (section.startsWith('\n### ')) {
|
|
4257
|
+
const titleMatch = section.match(/###\s+([\s\S]+?)\n/);
|
|
4258
|
+
if (!titleMatch) {
|
|
4259
|
+
processedSections.push(section);
|
|
4260
|
+
continue;
|
|
4261
|
+
}
|
|
4262
|
+
const rawTitle = titleMatch[1].trim();
|
|
4263
|
+
const simpleTitle = rawTitle.replace(/[^\w\u4e00-\u9fa5]+/g, '').toLowerCase();
|
|
4264
|
+
const fileName = titleMap.get(simpleTitle);
|
|
4265
|
+
if (fileName) {
|
|
4266
|
+
const linkedSection = section.replace(/(###\s+)([\s\S]+?)(\n)/, `$1$2 <a href="./${fileName}" style="float:right;">\u{1F4CE}</a>$3`);
|
|
4267
|
+
processedSections.push(linkedSection);
|
|
4268
|
+
titleMap.delete(simpleTitle);
|
|
4269
|
+
continue;
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
processedSections.push(section);
|
|
4273
|
+
}
|
|
4274
|
+
if (titleMap.size > 0) {
|
|
4275
|
+
processedSections.push("\n\n### \u8BE6\u7EC6\u5206\u6790\n");
|
|
4276
|
+
titleMap.forEach((fileName, title)=>{
|
|
4277
|
+
processedSections.push(`- [\u{67E5}\u{770B}${title}\u{5206}\u{6790}](./${fileName})\n`);
|
|
4278
|
+
});
|
|
4279
|
+
}
|
|
4280
|
+
return processedSections.join('');
|
|
4281
|
+
};
|
|
4282
|
+
const formatAnalysisPrompt = (userInput, content, filePath)=>`# \u{1F50D} AI\u{9700}\u{6C42}\u{5206}\u{6790}\u{5B8C}\u{6210}
|
|
4157
4283
|
|
|
4158
4284
|
## \u{1F4DD} \u{7528}\u{6237}\u{539F}\u{59CB}\u{9700}\u{6C42}
|
|
4159
4285
|
${userInput}
|
|
4160
|
-
|
|
4161
|
-
## \u{1F4CB} \u{5F53}\u{524D}\u{4E0A}\u{4E0B}\u{6587}
|
|
4162
|
-
${context}
|
|
4163
4286
|
------------------------------
|
|
4164
4287
|
## \u{1F52C} \u{9700}\u{6C42}\u{5206}\u{6790}\u{7ED3}\u{679C}
|
|
4165
4288
|
${content}
|
|
@@ -4217,26 +4340,6 @@ class RequirementStorage {
|
|
|
4217
4340
|
console.error(`\u{274C} \u{4FDD}\u{5B58}\u{9700}\u{6C42}\u{6587}\u{6863}\u{5931}\u{8D25}: ${e}`);
|
|
4218
4341
|
}
|
|
4219
4342
|
}
|
|
4220
|
-
saveHistoryEntry(entryType, content, metadata = {}) {
|
|
4221
|
-
try {
|
|
4222
|
-
const historyEntry = {
|
|
4223
|
-
timestamp: new Date().toISOString(),
|
|
4224
|
-
type: entryType,
|
|
4225
|
-
content,
|
|
4226
|
-
metadata
|
|
4227
|
-
};
|
|
4228
|
-
let history = [];
|
|
4229
|
-
if (existsSync(this.historyFile)) {
|
|
4230
|
-
const data = readFileSync(this.historyFile, "utf8");
|
|
4231
|
-
history = JSON.parse(data);
|
|
4232
|
-
}
|
|
4233
|
-
history.push(historyEntry);
|
|
4234
|
-
writeFileSync(this.historyFile, JSON.stringify(history, null, 2), "utf8");
|
|
4235
|
-
console.log(`\u{2705} \u{5386}\u{53F2}\u{8BB0}\u{5F55}\u{5DF2}\u{4FDD}\u{5B58}: ${entryType}`);
|
|
4236
|
-
} catch (e) {
|
|
4237
|
-
console.error(`\u{274C} \u{4FDD}\u{5B58}\u{5386}\u{53F2}\u{8BB0}\u{5F55}\u{5931}\u{8D25}: ${e}`);
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
4343
|
exportFinalDocument(currentRequirements) {
|
|
4241
4344
|
try {
|
|
4242
4345
|
const finalDoc = {
|
|
@@ -4349,9 +4452,6 @@ function addRequirementEntry(type, category, content) {
|
|
|
4349
4452
|
requirements_utils_currentRequirements[type] = [
|
|
4350
4453
|
requirementEntry
|
|
4351
4454
|
];
|
|
4352
|
-
requirements_utils_storage.saveHistoryEntry(type, content, {
|
|
4353
|
-
category
|
|
4354
|
-
});
|
|
4355
4455
|
requirements_utils_storage.saveRequirements(requirements_utils_currentRequirements);
|
|
4356
4456
|
return requirements_utils_currentRequirements;
|
|
4357
4457
|
}
|
|
@@ -4390,123 +4490,172 @@ const requirementManagerTool = {
|
|
|
4390
4490
|
return formatRequirementUpdateResponse(category, clarified_info, requirements_utils_currentRequirements, storage.requirementsFile, storage.historyFile);
|
|
4391
4491
|
}
|
|
4392
4492
|
};
|
|
4493
|
+
async function packProject() {
|
|
4494
|
+
const mdDir = path_0.join(getStorageDir(), 'tech');
|
|
4495
|
+
await fs_promises.mkdir(mdDir, {
|
|
4496
|
+
recursive: true
|
|
4497
|
+
});
|
|
4498
|
+
logger_logger.info(`\u{1F4C2} \u{6B63}\u{5728}\u{5206}\u{6790}\u{5F53}\u{524D}\u{672C}\u{5730}\u{9879}\u{76EE}`);
|
|
4499
|
+
const mdPath = path_0.join(mdDir, `\u{9879}\u{76EE}\u{67B6}\u{6784}\u{5206}\u{6790}.md`);
|
|
4500
|
+
const options = {
|
|
4501
|
+
output: mdPath,
|
|
4502
|
+
style: 'markdown',
|
|
4503
|
+
headerText: "\u667A\u80FD\u8F6F\u4EF6\u661F\u5DE5\u5382",
|
|
4504
|
+
fileSummary: true,
|
|
4505
|
+
removeEmptyLines: true,
|
|
4506
|
+
removeComments: true,
|
|
4507
|
+
showLineNumbers: true,
|
|
4508
|
+
compress: true,
|
|
4509
|
+
quiet: true,
|
|
4510
|
+
customPatterns: [
|
|
4511
|
+
"**/*.md",
|
|
4512
|
+
"**/*.log",
|
|
4513
|
+
"**/*.json",
|
|
4514
|
+
"**/*.dockerfile",
|
|
4515
|
+
"**/*.yml",
|
|
4516
|
+
"**/*.yaml",
|
|
4517
|
+
"**/*.sh",
|
|
4518
|
+
"**/*.env",
|
|
4519
|
+
"**/*.env.example",
|
|
4520
|
+
"**/LICENSE"
|
|
4521
|
+
]
|
|
4522
|
+
};
|
|
4523
|
+
await external_aico_pack_runCli([
|
|
4524
|
+
config_PROJECT_ROOT
|
|
4525
|
+
], process.cwd(), options);
|
|
4526
|
+
return mdPath;
|
|
4527
|
+
}
|
|
4393
4528
|
const architectureDesignerTool = {
|
|
4394
4529
|
name: "architecture_designer",
|
|
4395
|
-
description: "\u67B6\u6784\u8BBE\u8BA1\
|
|
4530
|
+
description: "\u9879\u76EE\u67B6\u6784\u8BBE\u8BA1\u5E08 - \u57FA\u4E8E\u5B8C\u6574\u9700\u6C42\u751F\u6210\u6700\u4F18\u6280\u672F\u67B6\u6784\u65B9\u6848",
|
|
4396
4531
|
parameters: ArchitectureDesignerParams,
|
|
4397
4532
|
execute: async (args)=>{
|
|
4398
4533
|
const { design_focus = "full_architecture" } = args;
|
|
4399
4534
|
const storage = new RequirementStorage();
|
|
4400
|
-
|
|
4535
|
+
try {
|
|
4536
|
+
const mdPath = await packProject();
|
|
4537
|
+
const architecture_design = `# \u{1F3D7}\u{FE0F} \u{9879}\u{76EE}\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{65B9}\u{6848}
|
|
4401
4538
|
|
|
4402
4539
|
## \u{1F3AF} \u{8BBE}\u{8BA1}\u{76EE}\u{6807}
|
|
4403
4540
|
- **\u{8BBE}\u{8BA1}\u{91CD}\u{70B9}**\u{FF1A}${design_focus}
|
|
4404
4541
|
- **\u{4F18}\u{5316}\u{76EE}\u{6807}**\u{FF1A}AI\u{53CB}\u{597D}\u{3001}\u{4F4E}\u{8026}\u{5408}\u{3001}\u{53EF}\u{7EF4}\u{62A4}
|
|
4405
4542
|
|
|
4406
|
-
## \u{
|
|
4407
|
-
|
|
4408
|
-
### 1. \u{4F4E}\u{8026}\u{5408}\u{8BBE}\u{8BA1}\u{539F}\u{5219}
|
|
4409
|
-
- **\u{6A21}\u{5757}\u{72EC}\u{7ACB}\u{6027}**\u{FF1A}\u{6BCF}\u{4E2A}\u{6A21}\u{5757}\u{529F}\u{80FD}\u{5355}\u{4E00}\u{FF0C}\u{8FB9}\u{754C}\u{6E05}\u{6670}
|
|
4410
|
-
- **\u{63A5}\u{53E3}\u{6807}\u{51C6}\u{5316}**\u{FF1A}\u{7EDF}\u{4E00}\u{7684}API\u{63A5}\u{53E3}\u{89C4}\u{8303}
|
|
4411
|
-
- **\u{4F9D}\u{8D56}\u{6700}\u{5C0F}\u{5316}**\u{FF1A}\u{51CF}\u{5C11}\u{6A21}\u{5757}\u{95F4}\u{7684}\u{5F3A}\u{4F9D}\u{8D56}\u{5173}\u{7CFB}
|
|
4412
|
-
- **\u{9519}\u{8BEF}\u{9694}\u{79BB}**\u{FF1A}\u{5355}\u{4E2A}\u{6A21}\u{5757}\u{95EE}\u{9898}\u{4E0D}\u{5F71}\u{54CD}\u{6574}\u{4F53}\u{7CFB}\u{7EDF}
|
|
4543
|
+
## \u{1F4C4} \u{5173}\u{952E}\u{6587}\u{6863}
|
|
4544
|
+
- [\u{1F517} \u{5B8C}\u{6574}\u{67B6}\u{6784}\u{5206}\u{6790}\u{62A5}\u{544A}](${mdPath})
|
|
4413
4545
|
|
|
4414
|
-
|
|
4415
|
-
- **\u{4EE3}\u{7801}\u{53EF}\u{7406}\u{89E3}\u{6027}**\u{FF1A}\u{6E05}\u{6670}\u{7684}\u{547D}\u{540D}\u{548C}\u{6CE8}\u{91CA}\u{89C4}\u{8303}
|
|
4416
|
-
- **\u{6A21}\u{5757}\u{5316}\u{5F00}\u{53D1}**\u{FF1A}\u{907F}\u{514D}\u{5927}\u{6587}\u{4EF6}\u{FF0C}\u{4FBF}\u{4E8E}AI\u{7406}\u{89E3}\u{548C}\u{4FEE}\u{6539}
|
|
4417
|
-
- **\u{6807}\u{51C6}\u{5316}\u{7ED3}\u{6784}**\u{FF1A}\u{7EDF}\u{4E00}\u{7684}\u{9879}\u{76EE}\u{7ED3}\u{6784}\u{548C}\u{4EE3}\u{7801}\u{7EC4}\u{7EC7}
|
|
4418
|
-
- **\u{6E10}\u{8FDB}\u{5F0F}\u{5F00}\u{53D1}**\u{FF1A}\u{652F}\u{6301}\u{5206}\u{9636}\u{6BB5}\u{5B9E}\u{73B0}\u{548C}\u{6D4B}\u{8BD5}
|
|
4419
|
-
|
|
4420
|
-
## \u{1F527} \u{6280}\u{672F}\u{67B6}\u{6784}\u{5EFA}\u{8BAE}
|
|
4546
|
+
## \u{1F916} AI\u{5F00}\u{53D1}\u{6700}\u{4F73}\u{5B9E}\u{8DF5}
|
|
4421
4547
|
|
|
4422
|
-
### \u{
|
|
4423
|
-
**\u{
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
- UI\u{7EC4}\u{4EF6}\u{FF1A}Ant Design / Material-UI / Tailwind CSS
|
|
4548
|
+
### \u{6A21}\u{5757}\u{5F00}\u{53D1}\u{6307}\u{5BFC}
|
|
4549
|
+
1. **\u{5148}\u{5B9E}\u{73B0}\u{6838}\u{5FC3}\u{903B}\u{8F91}**\u{FF1A}\u{4E13}\u{6CE8}\u{4E3B}\u{8981}\u{529F}\u{80FD}
|
|
4550
|
+
2. **\u{518D}\u{6DFB}\u{52A0}\u{9519}\u{8BEF}\u{5904}\u{7406}**\u{FF1A}\u{5B8C}\u{5584}\u{5F02}\u{5E38}\u{5904}\u{7406}
|
|
4551
|
+
3. **\u{6700}\u{540E}\u{8FDB}\u{884C}\u{4F18}\u{5316}**\u{FF1A}\u{6027}\u{80FD}\u{4F18}\u{5316}\u{548C}\u{4EE3}\u{7801}\u{91CD}\u{6784}
|
|
4427
4552
|
|
|
4428
|
-
### \u{
|
|
4429
|
-
|
|
4430
|
-
- \u{6846}\u{67B6}\u{FF1A}FastAPI / Express.js / Spring Boot
|
|
4431
|
-
- \u{6570}\u{636E}\u{5E93}\u{FF1A}PostgreSQL / MySQL / MongoDB
|
|
4432
|
-
- \u{7F13}\u{5B58}\u{FF1A}Redis / Memcached
|
|
4553
|
+
### \u{80FD}\u{529B}\u{4F7F}\u{7528}\u{6307}\u{5357}
|
|
4554
|
+
> \u{5C06}\u{5B8C}\u{6574}\u{67B6}\u{6784}\u{5206}\u{6790}\u{62A5}\u{544A}\u{4F5C}\u{4E3A}\u{9644}\u{4EF6}\u{53D1}\u{9001}\u{7ED9}AI\u{FF0C}\u{53EF}\u{7528}\u{4E8E}\u{5B8C}\u{6210}\u{5982}\u{4E0B}\u{80FD}\u{529B}\u{FF1A}
|
|
4433
4555
|
|
|
4434
|
-
|
|
4556
|
+
#### \u{5F00}\u{53D1}\u{8005}\u{6307}\u{5357}
|
|
4557
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4558
|
+
\u{521B}\u{5EFA}\u{5305}\u{542B}\u{4EE5}\u{4E0B}\u{5185}\u{5BB9}\u{7684}\u{5F00}\u{53D1}\u{8005}\u{6307}\u{5357}\u{FF1A}
|
|
4559
|
+
1. \u{73AF}\u{5883}\u{642D}\u{5EFA}\u{8BF4}\u{660E}
|
|
4560
|
+
2. \u{9879}\u{76EE}\u{7ED3}\u{6784}\u{6982}\u{89C8}
|
|
4561
|
+
3. \u{5F00}\u{53D1}\u{5DE5}\u{4F5C}\u{6D41}\u{7A0B}
|
|
4562
|
+
4. \u{6D4B}\u{8BD5}\u{65B9}\u{6CD5}
|
|
4563
|
+
5. \u{5E38}\u{89C1}\u{95EE}\u{9898}\u{6392}\u{67E5}\u{6B65}\u{9AA4}
|
|
4435
4564
|
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4565
|
+
#### API \u{6587}\u{6863}
|
|
4566
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4567
|
+
\u{751F}\u{6210}\u{5168}\u{9762}\u{7684} API \u{6587}\u{6863}\u{FF1A}
|
|
4568
|
+
1. \u{5217}\u{51FA}\u{5E76}\u{63CF}\u{8FF0}\u{6240}\u{6709}\u{516C}\u{5171}\u{7AEF}\u{70B9}
|
|
4569
|
+
2. \u{8BB0}\u{5F55}\u{8BF7}\u{6C42}/\u{54CD}\u{5E94}\u{683C}\u{5F0F}
|
|
4570
|
+
3. \u{5305}\u{542B}\u{4F7F}\u{7528}\u{793A}\u{4F8B}
|
|
4571
|
+
4. \u{8BF4}\u{660E}\u{9650}\u{5236}\u{548C}\u{7EA6}\u{675F}
|
|
4441
4572
|
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4573
|
+
#### \u{67B6}\u{6784}\u{6587}\u{6863}
|
|
4574
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4575
|
+
\u{8BB0}\u{5F55}\u{7CFB}\u{7EDF}\u{67B6}\u{6784}\u{FF1A}
|
|
4576
|
+
1. \u{9AD8}\u{5C42}\u{6982}\u{8FF0}
|
|
4577
|
+
2. \u{7EC4}\u{4EF6}\u{4EA4}\u{4E92}
|
|
4578
|
+
3. \u{6570}\u{636E}\u{6D41}\u{7A0B}\u{56FE}
|
|
4579
|
+
4. \u{8BBE}\u{8BA1}\u{51B3}\u{7B56}\u{53CA}\u{7406}\u{7531}
|
|
4580
|
+
5. \u{7CFB}\u{7EDF}\u{9650}\u{5236}\u{548C}\u{7EA6}\u{675F}
|
|
4446
4581
|
|
|
4447
|
-
|
|
4582
|
+
#### \u{4F9D}\u{8D56}\u{9879}\u{5206}\u{6790}
|
|
4583
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4584
|
+
\u{5206}\u{6790}\u{9879}\u{76EE}\u{4F9D}\u{8D56}\u{FF1A}
|
|
4585
|
+
1. \u{8BC6}\u{522B}\u{8FC7}\u{65F6}\u{7684}\u{5305}
|
|
4586
|
+
2. \u{68C0}\u{67E5}\u{5B89}\u{5168}\u{6F0F}\u{6D1E}
|
|
4587
|
+
3. \u{5EFA}\u{8BAE}\u{66FF}\u{4EE3}\u{5305}
|
|
4588
|
+
4. \u{8BC4}\u{5BA1}\u{4F9D}\u{8D56}\u{4F7F}\u{7528}\u{6A21}\u{5F0F}
|
|
4448
4589
|
|
|
4449
|
-
|
|
4450
|
-
- \u{9879}\u{76EE}\u{521D}\u{59CB}\u{5316}\u{548C}\u{73AF}\u{5883}\u{914D}\u{7F6E}
|
|
4451
|
-
- \u{57FA}\u{7840}\u{6846}\u{67B6}\u{4EE3}\u{7801}\u{642D}\u{5EFA}
|
|
4452
|
-
- \u{6570}\u{636E}\u{5E93}\u{8BBE}\u{8BA1}\u{548C}\u{521D}\u{59CB}\u{5316}
|
|
4590
|
+
\u{5305}\u{542B}\u{5177}\u{4F53}\u{7684}\u{5347}\u{7EA7}\u{5EFA}\u{8BAE}\u{3002}
|
|
4453
4591
|
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4592
|
+
#### \u{6D4B}\u{8BD5}\u{8986}\u{76D6}\u{7387}
|
|
4593
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4594
|
+
\u{8BC4}\u{5BA1}\u{6D4B}\u{8BD5}\u{8986}\u{76D6}\u{7387}\u{FF1A}
|
|
4595
|
+
1. \u{8BC6}\u{522B}\u{672A}\u{6D4B}\u{8BD5}\u{7684}\u{7EC4}\u{4EF6}
|
|
4596
|
+
2. \u{5EFA}\u{8BAE}\u{989D}\u{5916}\u{7684}\u{6D4B}\u{8BD5}\u{7528}\u{4F8B}
|
|
4597
|
+
3. \u{8BC4}\u{5BA1}\u{6D4B}\u{8BD5}\u{8D28}\u{91CF}
|
|
4598
|
+
4. \u{63A8}\u{8350}\u{6D4B}\u{8BD5}\u{7B56}\u{7565}
|
|
4458
4599
|
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4600
|
+
#### \u{4EE3}\u{7801}\u{8D28}\u{91CF}
|
|
4601
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4602
|
+
\u{8BC4}\u{4F30}\u{4EE3}\u{7801}\u{8D28}\u{91CF}\u{5E76}\u{63D0}\u{51FA}\u{6539}\u{8FDB}\u{5EFA}\u{8BAE}\u{FF1A}
|
|
4603
|
+
1. \u{8BC4}\u{5BA1}\u{547D}\u{540D}\u{89C4}\u{8303}
|
|
4604
|
+
2. \u{68C0}\u{67E5}\u{4EE3}\u{7801}\u{7EC4}\u{7EC7}
|
|
4605
|
+
3. \u{8BC4}\u{4F30}\u{9519}\u{8BEF}\u{5904}\u{7406}
|
|
4606
|
+
4. \u{8BC4}\u{5BA1}\u{6CE8}\u{91CA}\u{5B9E}\u{8DF5}
|
|
4463
4607
|
|
|
4464
|
-
|
|
4608
|
+
\u{63D0}\u{4F9B}\u{5177}\u{4F53}\u{7684}\u{826F}\u{597D}\u{548C}\u{95EE}\u{9898}\u{6A21}\u{5F0F}\u{793A}\u{4F8B}\u{3002}
|
|
4465
4609
|
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4610
|
+
#### \u{67B6}\u{6784}\u{8BC4}\u{5BA1}
|
|
4611
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4612
|
+
\u{5206}\u{6790}\u{6B64}\u{4EE3}\u{7801}\u{5E93}\u{7684}\u{67B6}\u{6784}\u{FF1A}
|
|
4613
|
+
1. \u{8BC4}\u{4F30}\u{6574}\u{4F53}\u{7ED3}\u{6784}\u{548C}\u{6A21}\u{5F0F}
|
|
4614
|
+
2. \u{8BC6}\u{522B}\u{6F5C}\u{5728}\u{7684}\u{67B6}\u{6784}\u{95EE}\u{9898}
|
|
4615
|
+
3. \u{63D0}\u{51FA}\u{6539}\u{8FDB}\u{53EF}\u{6269}\u{5C55}\u{6027}\u{7684}\u{5EFA}\u{8BAE}
|
|
4616
|
+
4. \u{6807}\u{6CE8}\u{9075}\u{5FAA}\u{6700}\u{4F73}\u{5B9E}\u{8DF5}\u{7684}\u{90E8}\u{5206}
|
|
4470
4617
|
|
|
4471
|
-
|
|
4472
|
-
- GET /api/users - \u{83B7}\u{53D6}\u{7528}\u{6237}\u{5217}\u{8868}
|
|
4473
|
-
- POST /api/users - \u{521B}\u{5EFA}\u{7528}\u{6237}
|
|
4474
|
-
- PUT /api/users/:id - \u{66F4}\u{65B0}\u{7528}\u{6237}
|
|
4475
|
-
- DELETE /api/users/:id - \u{5220}\u{9664}\u{7528}\u{6237}
|
|
4618
|
+
\u{91CD}\u{70B9}\u{5173}\u{6CE8}\u{53EF}\u{7EF4}\u{62A4}\u{6027}\u{548C}\u{6A21}\u{5757}\u{5316}\u{3002}
|
|
4476
4619
|
|
|
4477
|
-
|
|
4620
|
+
#### \u{5B89}\u{5168}\u{6027}\u{8BC4}\u{5BA1}
|
|
4621
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4622
|
+
\u{5BF9}\u{6B64}\u{4EE3}\u{7801}\u{5E93}\u{8FDB}\u{884C}\u{5B89}\u{5168}\u{6027}\u{8BC4}\u{5BA1}\u{FF1A}
|
|
4623
|
+
1. \u{8BC6}\u{522B}\u{6F5C}\u{5728}\u{7684}\u{5B89}\u{5168}\u{6F0F}\u{6D1E}
|
|
4624
|
+
2. \u{68C0}\u{67E5}\u{5E38}\u{89C1}\u{7684}\u{5B89}\u{5168}\u{53CD}\u{6A21}\u{5F0F}
|
|
4625
|
+
3. \u{8BC4}\u{5BA1}\u{9519}\u{8BEF}\u{5904}\u{7406}\u{548C}\u{8F93}\u{5165}\u{9A8C}\u{8BC1}
|
|
4626
|
+
4. \u{8BC4}\u{4F30}\u{4F9D}\u{8D56}\u{9879}\u{7684}\u{5B89}\u{5168}\u{6027}
|
|
4478
4627
|
|
|
4479
|
-
|
|
4480
|
-
1. **\u{4F4E}\u{8026}\u{5408}\u{8BBE}\u{8BA1}**\u{FF1A}\u{6A21}\u{5757}\u{72EC}\u{7ACB}\u{FF0C}\u{4FBF}\u{4E8E}\u{7EF4}\u{62A4}\u{548C}\u{6269}\u{5C55}
|
|
4481
|
-
2. **AI\u{53CB}\u{597D}**\u{FF1A}\u{6E05}\u{6670}\u{7684}\u{7ED3}\u{6784}\u{FF0C}\u{4FBF}\u{4E8E}AI\u{7406}\u{89E3}\u{548C}\u{5F00}\u{53D1}
|
|
4482
|
-
3. **\u{53EF}\u{6269}\u{5C55}\u{6027}**\u{FF1A}\u{652F}\u{6301}\u{4E1A}\u{52A1}\u{589E}\u{957F}\u{548C}\u{529F}\u{80FD}\u{6269}\u{5C55}
|
|
4628
|
+
\u{8BF7}\u{63D0}\u{4F9B}\u{5177}\u{4F53}\u{793A}\u{4F8B}\u{548C}\u{4FEE}\u{590D}\u{6B65}\u{9AA4}\u{3002}
|
|
4483
4629
|
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4630
|
+
#### \u{6027}\u{80FD}\u{8BC4}\u{5BA1}
|
|
4631
|
+
**\u{63D0}\u{793A}\u{8BCD}**\u{FF1A}
|
|
4632
|
+
\u{4ECE}\u{6027}\u{80FD}\u{89D2}\u{5EA6}\u{8BC4}\u{5BA1}\u{4EE3}\u{7801}\u{5E93}\u{FF1A}
|
|
4633
|
+
1. \u{8BC6}\u{522B}\u{6027}\u{80FD}\u{74F6}\u{9888}
|
|
4634
|
+
2. \u{68C0}\u{67E5}\u{8D44}\u{6E90}\u{4F7F}\u{7528}\u{60C5}\u{51B5}
|
|
4635
|
+
3. \u{8BC4}\u{5BA1}\u{7B97}\u{6CD5}\u{6548}\u{7387}
|
|
4636
|
+
4. \u{8BC4}\u{4F30}\u{7F13}\u{5B58}\u{7B56}\u{7565}
|
|
4488
4637
|
|
|
4638
|
+
\u{5305}\u{542B}\u{5177}\u{4F53}\u{7684}\u{4F18}\u{5316}\u{5EFA}\u{8BAE}\u{3002}
|
|
4489
4639
|
---
|
|
4490
4640
|
|
|
4491
4641
|
**\u{1F389} \u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{5B8C}\u{6210}\u{FF01}**
|
|
4492
4642
|
|
|
4493
|
-
\u{8FD9}\u{4E2A}\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{65B9}\u{6848}\u{4E13}\u{95E8}\u{9488}\u{5BF9}AI\u{5F00}\u{53D1}\u{8FDB}\u{884C}\u{4E86}\u{4F18}\u{5316}\u{FF0C}\u{786E}\u{4FDD}\u{4F4E}\u{8026}\u{5408}\u{3001}AI\u{53CB}\u{597D}\u{7684}\u{5F00}\u{53D1}\u{4F53}\u{9A8C}\u{FF01}
|
|
4494
|
-
|
|
4495
4643
|
## \u{1F4BE} \u{6587}\u{6863}\u{5B58}\u{50A8}\u{4FE1}\u{606F}
|
|
4496
4644
|
- **\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{5DF2}\u{4FDD}\u{5B58}\u{5230}**: \`${storage.requirementsFile}\`
|
|
4497
4645
|
- **\u{5B8C}\u{6574}\u{6587}\u{6863}\u{5BFC}\u{51FA}**: \u{4F7F}\u{7528} \`export_final_document\` \u{5DE5}\u{5177}\u{5BFC}\u{51FA}\u{5B8C}\u{6574}\u{9879}\u{76EE}\u{6587}\u{6863}
|
|
4498
4646
|
`;
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
})
|
|
4508
|
-
|
|
4509
|
-
|
|
4647
|
+
requirements_utils_currentRequirements.architecture_designs = requirements_utils_currentRequirements.architecture_designs || [];
|
|
4648
|
+
requirements_utils_currentRequirements.architecture_designs.push({
|
|
4649
|
+
timestamp: new Date().toISOString(),
|
|
4650
|
+
design_focus,
|
|
4651
|
+
content: architecture_design
|
|
4652
|
+
});
|
|
4653
|
+
storage.saveRequirements(requirements_utils_currentRequirements);
|
|
4654
|
+
return architecture_design;
|
|
4655
|
+
} catch (error) {
|
|
4656
|
+
logger_logger.error(`\u{274C} \u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{751F}\u{6210}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`);
|
|
4657
|
+
throw new Error(`\u{67B6}\u{6784}\u{8BBE}\u{8BA1}\u{751F}\u{6210}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : String(error)}`);
|
|
4658
|
+
}
|
|
4510
4659
|
}
|
|
4511
4660
|
};
|
|
4512
4661
|
const exportFinalDocumentTool = {
|
|
@@ -4684,9 +4833,8 @@ const word2mdTool = {
|
|
|
4684
4833
|
const { file_path } = args;
|
|
4685
4834
|
try {
|
|
4686
4835
|
if (!word2md_validateFilePath(file_path)) throw new Error(`\u{6587}\u{4EF6}\u{8DEF}\u{5F84}\u{65E0}\u{6548}: ${file_path}`);
|
|
4687
|
-
const
|
|
4688
|
-
|
|
4689
|
-
const buffer = await readFile(file_path);
|
|
4836
|
+
const resolvedPath = await validateAndResolvePath(file_path);
|
|
4837
|
+
const buffer = await readFile(resolvedPath);
|
|
4690
4838
|
const htmlResult = await convertToHtml({
|
|
4691
4839
|
buffer
|
|
4692
4840
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const apiPrompt: (path: string) => Promise<string>;
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -10,3 +10,7 @@ export declare function removeImagesFromMarkdown(content: string): string;
|
|
|
10
10
|
* 验证文件路径安全性
|
|
11
11
|
*/
|
|
12
12
|
export declare function validateFilePath(filePath: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 安全验证并标准化路径 (新增)
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateAndResolvePath(filePath: string): Promise<string>;
|
package/dist/utils/storage.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export declare class RequirementStorage {
|
|
|
9
9
|
get storageDirectory(): string;
|
|
10
10
|
loadRequirements(): void;
|
|
11
11
|
saveRequirements(currentRequirements: Requirements): void;
|
|
12
|
-
saveHistoryEntry(entryType: string, content: string, metadata?: Record<string, any>): void;
|
|
13
12
|
exportFinalDocument(currentRequirements: Requirements): string | null;
|
|
14
13
|
private generateMarkdownReport;
|
|
15
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intention-coding",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "软件工程化的需求分析,功能设计,代码编写,测试运行和发布部署",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,10 +39,12 @@
|
|
|
39
39
|
"zod": "3.25.64"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"aico-pack": "2.1.0",
|
|
42
43
|
"fastmcp": "^3.3.0",
|
|
43
44
|
"html-to-md": "^0.8.8",
|
|
44
45
|
"lru-cache": "^11.1.0",
|
|
45
46
|
"mammoth": "^1.9.1",
|
|
47
|
+
"repomix": "^0.3.9",
|
|
46
48
|
"winston": "^3.17.0",
|
|
47
49
|
"winston-daily-rotate-file": "^5.0.0"
|
|
48
50
|
},
|