feat: 添加DACP服务启动脚本和测试命令,更新相关依赖,优化配置文件路径处理
This commit is contained in:
@ -8,6 +8,9 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "PROMPTX_ENV=development node src/bin/promptx.js",
|
"start": "PROMPTX_ENV=development node src/bin/promptx.js",
|
||||||
|
"dacp:start": "node src/dacp/dacp-promptx-service/server.js",
|
||||||
|
"dacp:dev": "node src/dacp/dacp-promptx-service/server.js",
|
||||||
|
"dacp:test": "jest src/dacp/",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:unit": "jest --selectProjects unit",
|
"test:unit": "jest --selectProjects unit",
|
||||||
"test:integration": "jest --selectProjects integration",
|
"test:integration": "jest --selectProjects integration",
|
||||||
@ -50,9 +53,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.12.1",
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
||||||
"@reaxi/node-detect-runtime": "^0.1.0",
|
"@reaxi/node-detect-runtime": "^0.1.0",
|
||||||
|
"body-parser": "^1.20.2",
|
||||||
"boxen": "^5.1.2",
|
"boxen": "^5.1.2",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
"commander": "^11.0.0",
|
"commander": "^11.0.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"env-paths": "2.2.1",
|
"env-paths": "2.2.1",
|
||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
"find-monorepo-root": "^1.0.3",
|
"find-monorepo-root": "^1.0.3",
|
||||||
@ -61,6 +66,8 @@
|
|||||||
"fs-extra": "^11.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"glob": "^10.3.0",
|
"glob": "^10.3.0",
|
||||||
"inquirer": "^8.2.4",
|
"inquirer": "^8.2.4",
|
||||||
|
"joi": "^17.11.0",
|
||||||
|
"nodemailer": "^7.0.3",
|
||||||
"ora": "^5.4.1",
|
"ora": "^5.4.1",
|
||||||
"pkg-dir": "^8.0.0",
|
"pkg-dir": "^8.0.0",
|
||||||
"resolve": "^1.22.10",
|
"resolve": "^1.22.10",
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "dacp-promptx-service",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Unified DACP service with multiple demo actions for PromptX",
|
|
||||||
"main": "server.js",
|
|
||||||
"scripts": {
|
|
||||||
"start": "node server.js",
|
|
||||||
"dev": "node server.js",
|
|
||||||
"test": "jest"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"body-parser": "^1.20.2",
|
|
||||||
"cors": "^2.8.5",
|
|
||||||
"express": "^4.18.2",
|
|
||||||
"joi": "^17.11.0",
|
|
||||||
"nodemailer": "^7.0.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"jest": "^29.7.0",
|
|
||||||
"supertest": "^6.3.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -5,7 +5,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const config = JSON.parse(fs.readFileSync('./dacp.config.json', 'utf8'));
|
const config = JSON.parse(fs.readFileSync(path.join(__dirname, 'dacp.config.json'), 'utf8'));
|
||||||
const PORT = process.env.PORT || config.deployment.port || 3002;
|
const PORT = process.env.PORT || config.deployment.port || 3002;
|
||||||
|
|
||||||
// Middleware
|
// Middleware
|
||||||
|
|||||||
@ -311,7 +311,7 @@ class MCPServerCommand {
|
|||||||
// 启动DACP服务作为子进程
|
// 启动DACP服务作为子进程
|
||||||
// 注意:不能直接使用 'inherit',因为会干扰MCP的stdio通信
|
// 注意:不能直接使用 'inherit',因为会干扰MCP的stdio通信
|
||||||
// 但我们需要看到DACP的启动信息
|
// 但我们需要看到DACP的启动信息
|
||||||
this.dacpProcess = spawn('npm', ['start'], {
|
this.dacpProcess = spawn('node', ['server.js'], {
|
||||||
cwd: dacpPath,
|
cwd: dacpPath,
|
||||||
stdio: ['ignore', 'pipe', 'pipe'], // stdin忽略, stdout和stderr都输出到pipe
|
stdio: ['ignore', 'pipe', 'pipe'], // stdin忽略, stdout和stderr都输出到pipe
|
||||||
shell: true,
|
shell: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user