feat: 添加开发模式支持,本地调试不使用 PM2

实现灵活的进程管理模式,支持开发和生产环境切换:

## 新增功能
- 创建开发模式进程管理服务(dev-process.service.ts)
- 使用 Node.js child_process 直接管理 Claude Code 进程
- 添加 USE_PM2 环境变量控制进程管理模式

## 后端更改
- 新增 dev-process.service.ts:开发模式进程管理
- 更新 instance.service.ts:根据 USE_PM2 选择进程管理方式
- 更新 config:添加 usePM2 配置项
- 修复 TypeScript 类型错误

## 配置更新
- backend/.env:设置 USE_PM2=false(开发模式)
- .env.example:添加 USE_PM2 配置说明

## 模式对比
**开发模式**(USE_PM2=false):
- 使用 child_process 管理进程
- 不需要安装 PM2
- 简化的监控功能
- 适合本地开发

**生产模式**(USE_PM2=true):
- 使用 PM2 管理进程
- 完整的监控和自动重启
- 需要安装 PM2
- 适合生产部署

## 文档更新
- README.md:添加开发/生产模式对比说明
- 更新环境变量表格

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuangandClaude Sonnet 4.5 committed 2026-01-02 23:20:19 +08:00
1 parent 903dc1e61f
commit 7dca4e93b1
13 files changed
+287 -72

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@
"Bash(git commit:*)",
"Bash(git remote add:*)",
"Bash(git branch:*)",
"Bash(git push:*)"
"Bash(git push:*)",
"Bash(npm run typecheck:*)"
]
}
}