@coze-arch/cli 0.0.36-alpha.b293fc → 0.0.36-alpha.dd2af3

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.
@@ -8,6 +8,9 @@ cd "${COZE_WORKSPACE_PATH}"
8
8
  # PID 文件,用于追踪上一次启动的进程树
9
9
  # ---------------------------------------------------------
10
10
  PID_FILE="/tmp/coze-dev-run.pid"
11
+ LOG_DIR="/tmp/coze-logs"
12
+ LOG_FILE="${LOG_DIR}/dev.log"
13
+ DEV_PID=""
11
14
 
12
15
  # ---------------------------------------------------------
13
16
  # 工具函数
@@ -89,7 +92,8 @@ cleanup_previous_run() {
89
92
  # 2. 安装依赖
90
93
  # ---------------------------------------------------------
91
94
  echo "📦 Installing dependencies..."
92
- pnpm install
95
+ PNPM_BIN="$(command -v pnpm)"
96
+ "${PNPM_BIN}" install
93
97
  echo "✅ Dependencies installed successfully!"
94
98
 
95
99
  # ---------------------------------------------------------
@@ -108,11 +112,14 @@ kill_port_if_listening "${SERVER_PORT}"
108
112
  # 4. 退出时自动清理子进程(信号 trap)
109
113
  # ---------------------------------------------------------
110
114
  cleanup_on_exit() {
111
- echo "🛑 dev_run.sh exiting, cleaning up child processes..."
112
- # 杀掉当前脚本的所有子进程
113
- kill -- -$$ 2>/dev/null || true
115
+ local exit_code=$?
116
+ trap - EXIT INT TERM HUP
117
+ if [[ -n "${DEV_PID}" ]] && kill -0 "${DEV_PID}" 2>/dev/null; then
118
+ echo "🛑 dev_run.sh exiting, cleaning up child processes..."
119
+ kill_process_tree "${DEV_PID}"
120
+ fi
114
121
  rm -f "${PID_FILE}"
115
- exit 0
122
+ exit "${exit_code}"
116
123
  }
117
124
  trap cleanup_on_exit EXIT INT TERM HUP
118
125
 
@@ -134,17 +141,16 @@ start_service() {
134
141
  echo "Starting Taro H5 Dev Server and NestJS Server..."
135
142
 
136
143
  export PORT=${DEPLOY_RUN_PORT}
137
- rm -f /tmp/coze-logs/dev.log
138
- mkdir -p /tmp/coze-logs
144
+ mkdir -p "${LOG_DIR}"
145
+ : > "${LOG_FILE}"
139
146
 
140
- # 后台启动并记录 PID
141
- pnpm dev 2>&1 | tee /tmp/coze-logs/dev.log &
142
- local dev_pid=$!
143
- echo "${dev_pid}" > "${PID_FILE}"
144
- echo "📝 Dev process started with PID: ${dev_pid} (saved to ${PID_FILE})"
147
+ # 后台启动以便记录真实 pnpm PID,但脚本持续 wait,保持外层 CLI 生命周期有效。
148
+ "${PNPM_BIN}" dev > >(tee -a "${LOG_FILE}") 2>&1 &
149
+ DEV_PID=$!
150
+ echo "${DEV_PID}" > "${PID_FILE}"
151
+ echo "📝 Dev process started with PID: ${DEV_PID} (saved to ${PID_FILE})"
145
152
 
146
- # 前台等待,保证 trap 能正常捕获信号
147
- wait "${dev_pid}" || true
153
+ wait "${DEV_PID}"
148
154
  }
149
155
 
150
156
  echo "Starting HTTP services on port ${DEPLOY_RUN_PORT} (web) and ${SERVER_PORT} (server)..."
@@ -204,8 +204,8 @@ importers:
204
204
  specifier: 2.95.3
205
205
  version: 2.95.3
206
206
  coze-coding-dev-sdk:
207
- specifier: ^0.7.24
208
- version: 0.7.24(openai@6.16.0(ws@8.19.0)(zod@4.3.5))(ws@8.19.0)
207
+ specifier: ^0.7.25-beta.4
208
+ version: 0.7.25-beta.4(openai@6.16.0(ws@8.19.0)(zod@4.3.5))(ws@8.19.0)
209
209
  dotenv:
210
210
  specifier: ^17.2.3
211
211
  version: 17.2.3
@@ -5416,8 +5416,8 @@ packages:
5416
5416
  typescript:
5417
5417
  optional: true
5418
5418
 
5419
- coze-coding-dev-sdk@0.7.24:
5420
- resolution: {integrity: sha512-oL9Tg5PwxP6iMixonzzMO4aBjOKWcFUMVM+iz5dPyaqQkG84HP1y9DqK5DJVmtdfJuYdAW7pzOatDqLvgvZiXg==}
5419
+ coze-coding-dev-sdk@0.7.25-beta.4:
5420
+ resolution: {integrity: sha512-+PCoJ8yhsAIlx3YT898bCkB2gx5EMBunJMP7/kI/Jq/8dj7SDU9EUBZ2Z8ZJocSaPBT9T6dVvFHBsDLZh4FN/Q==}
5421
5421
  engines: {node: '>=18.0.0'}
5422
5422
  hasBin: true
5423
5423
 
@@ -17159,7 +17159,7 @@ snapshots:
17159
17159
  optionalDependencies:
17160
17160
  typescript: 5.9.3
17161
17161
 
17162
- coze-coding-dev-sdk@0.7.24(openai@6.16.0(ws@8.19.0)(zod@4.3.5))(ws@8.19.0):
17162
+ coze-coding-dev-sdk@0.7.25-beta.4(openai@6.16.0(ws@8.19.0)(zod@4.3.5))(ws@8.19.0):
17163
17163
  dependencies:
17164
17164
  '@langchain/core': 1.1.16(openai@6.16.0(ws@8.19.0)(zod@4.3.5))
17165
17165
  '@langchain/openai': 1.2.3(@langchain/core@1.1.16(openai@6.16.0(ws@8.19.0)(zod@4.3.5)))(ws@8.19.0)
@@ -17,7 +17,7 @@
17
17
  "@nestjs/core": "^10.4.15",
18
18
  "@nestjs/platform-express": "^10.4.15",
19
19
  "@supabase/supabase-js": "2.95.3",
20
- "coze-coding-dev-sdk": "^0.7.24",
20
+ "coze-coding-dev-sdk": "^0.7.25-beta.4",
21
21
  "dotenv": "^17.2.3",
22
22
  "drizzle-kit": "^0.31.8",
23
23
  "drizzle-orm": "^0.45.1",
@@ -2,6 +2,7 @@
2
2
  import { spawn } from 'child_process';
3
3
  import { resolve, join, basename } from 'path';
4
4
  import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
5
+ import { homedir } from 'os';
5
6
 
6
7
 
7
8
 
@@ -81,7 +82,8 @@ const config = {
81
82
  const projectRoot = resolve(outputPath);
82
83
 
83
84
  // Determine log directory
84
- const logDir = process.env.COZE_LOG_DIR || resolve(__dirname, '../.log');
85
+ const cozeHome = process.env.COZE_HOME || join(homedir(), '.coze');
86
+ const logDir = process.env.COZE_LOG_DIR || join(cozeHome, 'logs');
85
87
  mkdirSync(logDir, { recursive: true });
86
88
 
87
89
  // Use project name in log file to avoid conflicts