Files
Agent-n8n/.serena/memories/05_运行命令和部署.md

309 lines
6.1 KiB
Markdown
Raw Permalink Normal View History

# 运行命令和部署 (2025-10-03)
## 🚀 快速启动
### 1. n8n工作流平台
```bash
# 进入n8n目录
cd n8n-n8n-1.109.2
# 安装依赖(首次运行)
pnpm install
# 启动n8n两种方式
pnpm start
# 或
./start.sh
# 访问地址
http://localhost:5678
```
### 2. 展会演示系统
```bash
# 进入展示系统目录
cd web_frontend/exhibition-demo
# 安装依赖(首次运行)
pnpm install
#开发模式
pnpm dev
# 预览模式(推荐)
pnpm preview
# 访问地址
http://localhost:4173
```
### 3. Web结果展示系统
```bash
# 进入web_result目录
cd web_frontend/web_result
# 启动路由服务器端口4155
./start-router.sh
# 访问地址
http://localhost:4155/
http://localhost:4155/order-class/wenlu
http://localhost:4155/order-class/food
```
### 4. 食品订单班独立系统
```bash
# 进入食品订单班目录
cd web_frontend/food-order-demo
# 开发模式
pnpm dev
# 访问地址
http://localhost:4174
```
## 🛠️ 开发命令
### 代码质量检查
```bash
cd web_frontend/exhibition-demo
# TypeScript类型检查
pnpm type-check
# ESLint代码检查
pnpm lint
# 代码格式化
pnpm format
# 构建生产版本
pnpm build
```
### n8n项目命令
```bash
cd n8n-n8n-1.109.2
# 构建所有包
pnpm build > build.log 2>&1
tail -n 20 build.log
# 运行测试
pnpm test
# 类型检查
pnpm typecheck
```
## 🔌 端口配置
### 系统端口分配(硬约束)⚠️
```yaml
n8n平台: 5678 # n8n工作流编辑器
展会演示: 4173 # exhibition-demo主入口
食品订单班: 4174 # food-order-demo独立系统
Web结果展示: 4155 # web_result展示系统禁止使用8080
```
### 端口冲突解决
```bash
# 查看端口占用
lsof -i :4155
lsof -i :4173
# 杀死占用端口的进程
kill -9 <PID>
# 检查是否释放
lsof -i :4155
```
## 📂 项目路径
### 核心目录
```
/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/
├── n8n-n8n-1.109.2/ # n8n源代码
├── web_frontend/
│ ├── exhibition-demo/ # 主演示系统 ⭐
│ ├── food-order-demo/ # 食品订单班
│ └── web_result/ # 结果展示
├── data/订单班文档资料/ # 数据文件
└── .serena/memories/ # 记忆系统
```
### 软链接配置
```bash
# 创建软链接(如不存在)
ln -s \
"/Users/xiaoqi/Documents/Dev/Project/2025-09-08_n8nDEMO演示/data/订单班文档资料" \
"web_frontend/exhibition-demo/public/data/订单班文档资料"
# 验证软链接
ls -la web_frontend/exhibition-demo/public/data/
```
## 🔄 Git操作
### 当前分支
```bash
# 查看当前分支
git branch
# 当前分支: duoduo_Multiple_Agents
```
### 提交代码
```bash
# 查看状态
git status
# 添加更改
git add .
# 提交(使用规范化消息)
git commit -m "feat: 描述
详细说明:
- 完成的工作
- 修改的文件
- 影响的功能
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>"
# 推送到远程
git push origin duoduo_Multiple_Agents
```
### Git规范
- ⚠️ 提交前必须运行 lint 和 typecheck
- ⚠️ 使用规范化的提交消息格式
- ⚠️ 提交到对应分支当前duoduo_Multiple_Agents
## 🎬 完整演示流程
### 启动所有系统
```bash
# 1. 启动n8n (终端1)
cd n8n-n8n-1.109.2 && pnpm start
# 2. 启动展会演示 (终端2)
cd web_frontend/exhibition-demo && pnpm preview
# 3. 启动Web结果展示 (终端3)
cd web_frontend/web_result && ./start-router.sh
```
### 访问演示
1. 打开浏览器访问: http://localhost:4173
2. 点击"输入需求"按钮
3. 选择订单班(如:财经商贸)
4. 查看Agent协作过程
5. 完成后自动跳转结果页面
## 📦 依赖管理
### pnpm命令
```bash
# 安装依赖
pnpm install
# 添加依赖
pnpm add <package>
# 添加开发依赖
pnpm add -D <package>
# 更新依赖
pnpm update
# 清理依赖
pnpm store prune
```
### 重要提醒
- ✅ 必须使用 pnpm不能用 npm/yarn
- ✅ Node.js 版本: 18+
- ✅ pnpm 版本: 8+
## 🚢 部署流程
### SuperDesign部署
```bash
# 1. 选定最优版本如food v5
# 位置: .superdesign/design_iterations/food_qingshi_v5.html
# 2. 部署到生产环境
cp .superdesign/design_iterations/food_qingshi_v5.html \
web_frontend/web_result/order-classes/food/index.html
# 3. 确保图片软链接正确
ls -la web_frontend/web_result/order-classes/food/images
# 4. 归档设计文件
mkdir -p .superdesign/archive_食品_$(date +%Y%m%d)/
mv .superdesign/design_iterations/food_* \
.superdesign/archive_食品_$(date +%Y%m%d)/
```
### 生产环境检查清单
- [ ] TypeScript编译无错误
- [ ] ESLint检查通过
- [ ] 所有端口配置正确
- [ ] 软链接正常工作
- [ ] 图片资源可访问
- [ ] 浏览器测试通过
- [ ] Git提交完成
## 🔧 常用工具命令
### 查看文件结构
```bash
# 查看订单班文档结构
ls -la data/订单班文档资料/财经商贸/
# 查看图片文件
ls -la data/订单班文档资料/财经商贸/notion文稿/image/
# 查看agent头像
ls -la data/订单班文档资料/财经商贸/agent头像/
```
### 查看配置
```bash
# 查看订单班配置
cat web_frontend/exhibition-demo/src/data/orderClasses.json | jq '.[] | {id, name, agentCount}'
# 查看终端模拟列表
ls -la web_frontend/exhibition-demo/src/data/terminalSimulations/
```
### 日志查看
```bash
# 查看构建日志
tail -f build.log
# 查看n8n日志
cd n8n-n8n-1.109.2 && tail -f logs/n8n.log
```
## 🌐 访问地址汇总
### 开发环境
| 系统 | 地址 | 用途 |
|------|------|------|
| n8n工作流 | http://localhost:5678 | 工作流编辑器 |
| 展会演示 | http://localhost:4173 | 主入口 |
| 食品订单班 | http://localhost:4174 | 独立系统 |
| Web结果展示 | http://localhost:4155/ | 结果页面 |
| 文旅订单班 | http://localhost:4155/order-class/wenlu | 文旅结果 |
| 食品订单班 | http://localhost:4155/order-class/food | 食品结果 |
---
**最后更新**: 2025-10-03
**重要提醒**: Web结果展示必须使用端口4155禁止使用8080或其他端口