@coze-arch/cli 0.0.36-alpha.fd6b86 → 0.0.36
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/README.md +0 -11
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +18 -73
- package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
- package/lib/__templates__/expo/server/package.json +1 -1
- package/lib/__templates__/nextjs/package.json +2 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +258 -197
- package/lib/__templates__/nextjs/scripts/dev.sh +1 -82
- package/lib/__templates__/nextjs/template.config.js +1 -3
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +1 -82
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +26 -63
- package/lib/__templates__/taro/pnpm-lock.yaml +5 -5
- package/lib/__templates__/taro/server/package.json +1 -1
- package/lib/__templates__/templates.json +0 -25
- package/lib/__templates__/vite/scripts/dev.sh +1 -82
- package/lib/__templates__/vite/template.config.js +1 -3
- package/lib/cli.js +199 -3446
- package/package.json +3 -5
- package/docs/deploy.md +0 -171
- package/lib/__templates__/phaser/.coze +0 -13
- package/lib/__templates__/phaser/README.md +0 -37
- package/lib/__templates__/phaser/_gitignore +0 -23
- package/lib/__templates__/phaser/_npmrc +0 -14
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
- package/lib/__templates__/phaser/assets/image_sequence/coze-game-loading/manifest.json +0 -11
- package/lib/__templates__/phaser/debug-runtime/flow-graph.json +0 -20
- package/lib/__templates__/phaser/index.html +0 -12
- package/lib/__templates__/phaser/package.json +0 -31
- package/lib/__templates__/phaser/pnpm-lock.yaml +0 -661
- package/lib/__templates__/phaser/scripts/build.sh +0 -8
- package/lib/__templates__/phaser/scripts/dev.sh +0 -82
- package/lib/__templates__/phaser/scripts/prepare.sh +0 -7
- package/lib/__templates__/phaser/scripts/spawn-detached.cjs +0 -29
- package/lib/__templates__/phaser/scripts/start.sh +0 -82
- package/lib/__templates__/phaser/scripts/validate.sh +0 -7
- package/lib/__templates__/phaser/src/assets.ts +0 -15
- package/lib/__templates__/phaser/src/global.d.ts +0 -36
- package/lib/__templates__/phaser/src/main.ts +0 -28
- package/lib/__templates__/phaser/src/scene/BootScene.ts +0 -209
- package/lib/__templates__/phaser/src/scene/DevLoadingScene.ts +0 -66
- package/lib/__templates__/phaser/src/style.css +0 -28
- package/lib/__templates__/phaser/src/types.ts +0 -32
- package/lib/__templates__/phaser/src/utils/asset-loader.ts +0 -319
- package/lib/__templates__/phaser/src/utils/index.ts +0 -2
- package/lib/__templates__/phaser/src/utils/mark-editable.ts +0 -6
- package/lib/__templates__/phaser/template.config.js +0 -43
- package/lib/__templates__/phaser/tsconfig.json +0 -23
- package/lib/__templates__/phaser/vite.config.ts +0 -96
- package/lib/deploy/package-project.js +0 -226
- package/lib/deploy/package-project.py +0 -168
package/README.md
CHANGED
|
@@ -19,17 +19,6 @@ rush update
|
|
|
19
19
|
|
|
20
20
|
## 使用
|
|
21
21
|
|
|
22
|
-
### 部署应用
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
coze-dev deploy auth login
|
|
26
|
-
coze-dev deploy code deploy --source-root . --yes --wait
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
完整命令、参数和示例见 [部署命令文档](./docs/deploy.md)。部署命令与其它
|
|
30
|
-
`coze-dev` 能力共享 `~/.coze/cli/config.json` 登录态,也支持通过
|
|
31
|
-
`COZE_API_TOKEN` 提供固定运行时凭证。
|
|
32
|
-
|
|
33
22
|
### 初始化项目
|
|
34
23
|
|
|
35
24
|
```bash
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
1
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
4
2
|
PREVIEW_DIR="/source/preview"
|
|
5
3
|
LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
|
|
6
4
|
LOG_CLIENT_FILE="$LOG_DIR/client.log"
|
|
7
|
-
LOG_SERVER_FILE="$LOG_DIR/server.log"
|
|
8
5
|
mkdir -p "$LOG_DIR"
|
|
9
6
|
|
|
10
7
|
# ==================== 配置项 ====================
|
|
11
8
|
# Server 服务配置
|
|
12
9
|
SERVER_HOST="0.0.0.0"
|
|
13
|
-
SERVER_PORT="
|
|
10
|
+
SERVER_PORT="9091"
|
|
14
11
|
# Expo 项目配置
|
|
15
12
|
EXPO_HOST="0.0.0.0"
|
|
16
13
|
EXPO_DIR="expo"
|
|
17
|
-
EXPO_PORT="
|
|
14
|
+
EXPO_PORT="5000"
|
|
18
15
|
WEB_URL="${COZE_PROJECT_DOMAIN_DEFAULT:-http://127.0.0.1:${SERVER_PORT}}"
|
|
19
16
|
ASSUME_YES="1"
|
|
20
17
|
EXPO_PUBLIC_BACKEND_BASE_URL="${EXPO_PUBLIC_BACKEND_BASE_URL:-$WEB_URL}"
|
|
@@ -25,7 +22,6 @@ export EXPO_PUBLIC_BACKEND_BASE_URL EXPO_PACKAGER_PROXY_URL EXPO_PUBLIC_COZE_PRO
|
|
|
25
22
|
# 运行时变量(为避免 set -u 的未绑定错误,预置为空)
|
|
26
23
|
SERVER_PID=""
|
|
27
24
|
EXPO_PID=""
|
|
28
|
-
PNPM_BIN=""
|
|
29
25
|
|
|
30
26
|
# ==================== 工具函数 ====================
|
|
31
27
|
check_command() {
|
|
@@ -116,67 +112,22 @@ wait_port_connectable() {
|
|
|
116
112
|
return 1
|
|
117
113
|
}
|
|
118
114
|
|
|
119
|
-
# coze-daemon 会在 runtime shell 退出时清理原进程组。
|
|
120
|
-
# 通过 Node detached spawn 创建独立 session/进程组,并将 stdio 直接写入日志。
|
|
121
|
-
spawn_detached() {
|
|
122
|
-
local cwd="$1"
|
|
123
|
-
local log_file="$2"
|
|
124
|
-
shift 2
|
|
125
|
-
|
|
126
|
-
node - "$cwd" "$log_file" "$@" <<'NODE'
|
|
127
|
-
const fs = require('node:fs');
|
|
128
|
-
const { spawn } = require('node:child_process');
|
|
129
|
-
|
|
130
|
-
const [cwd, logFile, command, ...args] = process.argv.slice(2);
|
|
131
|
-
if (!cwd || !logFile || !command) {
|
|
132
|
-
throw new Error('spawn_detached 缺少 cwd、log_file 或 command');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const logFd = fs.openSync(logFile, 'a');
|
|
136
|
-
try {
|
|
137
|
-
const child = spawn(command, args, {
|
|
138
|
-
cwd,
|
|
139
|
-
detached: true,
|
|
140
|
-
env: process.env,
|
|
141
|
-
stdio: ['ignore', logFd, logFd],
|
|
142
|
-
});
|
|
143
|
-
child.unref();
|
|
144
|
-
process.stdout.write(String(child.pid));
|
|
145
|
-
} finally {
|
|
146
|
-
fs.closeSync(logFd);
|
|
147
|
-
}
|
|
148
|
-
NODE
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
stop_detached() {
|
|
152
|
-
local pid="${1:-}"
|
|
153
|
-
if [ -z "$pid" ]; then
|
|
154
|
-
return
|
|
155
|
-
fi
|
|
156
|
-
|
|
157
|
-
kill -TERM -- "-$pid" 2>/dev/null || kill -TERM "$pid" 2>/dev/null || true
|
|
158
|
-
sleep 1
|
|
159
|
-
kill -KILL -- "-$pid" 2>/dev/null || true
|
|
160
|
-
}
|
|
161
|
-
|
|
162
115
|
start_expo() {
|
|
163
116
|
local offline="${1:-0}"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"EXPO_PUBLIC_BACKEND_BASE_URL=$EXPO_PUBLIC_BACKEND_BASE_URL"
|
|
168
|
-
"EXPO_PACKAGER_PROXY_URL=$EXPO_PACKAGER_PROXY_URL"
|
|
169
|
-
"EXPO_PUBLIC_COZE_PROJECT_ID=$EXPO_PUBLIC_COZE_PROJECT_ID"
|
|
170
|
-
)
|
|
117
|
+
|
|
118
|
+
pushd "$ROOT_DIR/client"
|
|
119
|
+
|
|
171
120
|
if [ "$offline" = "1" ]; then
|
|
172
|
-
|
|
121
|
+
( EXPO_OFFLINE=1 EXPO_NO_DEPENDENCY_VALIDATION=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" EXPO_PUBLIC_COZE_PROJECT_ID="$EXPO_PUBLIC_COZE_PROJECT_ID" \
|
|
122
|
+
nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$LOG_CLIENT_FILE" ) &
|
|
123
|
+
else
|
|
124
|
+
( EXPO_NO_DEPENDENCY_VALIDATION=1 EXPO_PUBLIC_BACKEND_BASE_URL="$EXPO_PUBLIC_BACKEND_BASE_URL" EXPO_PACKAGER_PROXY_URL="$EXPO_PACKAGER_PROXY_URL" EXPO_PUBLIC_COZE_PROJECT_ID="$EXPO_PUBLIC_COZE_PROJECT_ID" \
|
|
125
|
+
nohup npx expo start --clear --port "$EXPO_PORT" 2>&1 | pipe_to_log "CLIENT" "$LOG_CLIENT_FILE" ) &
|
|
173
126
|
fi
|
|
127
|
+
EXPO_PID=$!
|
|
128
|
+
disown $EXPO_PID 2>/dev/null || true
|
|
174
129
|
|
|
175
|
-
|
|
176
|
-
"$ROOT_DIR/client" \
|
|
177
|
-
"$LOG_CLIENT_FILE" \
|
|
178
|
-
/usr/bin/env "${expo_env[@]}" \
|
|
179
|
-
"$PNPM_BIN" exec expo start --clear --port "$EXPO_PORT")"
|
|
130
|
+
popd
|
|
180
131
|
}
|
|
181
132
|
|
|
182
133
|
detect_expo_fetch_failed() {
|
|
@@ -217,8 +168,6 @@ check_command "npm"
|
|
|
217
168
|
check_command "pnpm"
|
|
218
169
|
check_command "lsof"
|
|
219
170
|
check_command "bash"
|
|
220
|
-
check_command "node"
|
|
221
|
-
PNPM_BIN="$(command -v pnpm)"
|
|
222
171
|
|
|
223
172
|
# 端口占用预检查与处理
|
|
224
173
|
ensure_port SERVER_PORT "$SERVER_PORT"
|
|
@@ -226,12 +175,9 @@ ensure_port EXPO_PORT "$EXPO_PORT"
|
|
|
226
175
|
|
|
227
176
|
echo "==================== 启动 server 服务 ===================="
|
|
228
177
|
echo "正在执行:pnpm run dev (server)"
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
SERVER_PID
|
|
232
|
-
"$ROOT_DIR/server" \
|
|
233
|
-
/dev/null \
|
|
234
|
-
"$PNPM_BIN" run dev)"
|
|
178
|
+
( pushd "$ROOT_DIR/server" > /dev/null && SERVER_PORT="$SERVER_PORT" nohup pnpm run dev; popd > /dev/null ) &
|
|
179
|
+
SERVER_PID=$!
|
|
180
|
+
disown $SERVER_PID 2>/dev/null || true
|
|
235
181
|
if [ -z "${SERVER_PID}" ]; then
|
|
236
182
|
echo "无法获取 server 后台进程 PID"
|
|
237
183
|
fi
|
|
@@ -239,12 +185,11 @@ echo "server 服务已启动,进程 ID:${SERVER_PID:-unknown}"
|
|
|
239
185
|
|
|
240
186
|
echo "==================== 启动 Expo 项目 ===================="
|
|
241
187
|
echo "开始启动 Expo 服务,端口 ${EXPO_PORT}"
|
|
242
|
-
: > "$LOG_CLIENT_FILE"
|
|
243
188
|
start_expo 0
|
|
244
189
|
if detect_expo_fetch_failed 8; then
|
|
245
190
|
echo "Expo 启动检测到网络错误:TypeError: fetch failed,启用离线模式重试"
|
|
246
|
-
|
|
247
|
-
: > "$
|
|
191
|
+
if [ -n "${EXPO_PID}" ]; then kill -9 "$EXPO_PID" 2>/dev/null || true; fi
|
|
192
|
+
: > "$ROOT_DIR/logs/client.log"
|
|
248
193
|
start_expo 1
|
|
249
194
|
fi
|
|
250
195
|
# 输出以下环境变量,确保 Expo 项目能正确连接到 Server 服务
|
|
@@ -269,8 +269,8 @@ importers:
|
|
|
269
269
|
specifier: ^2.8.5
|
|
270
270
|
version: 2.8.6
|
|
271
271
|
coze-coding-dev-sdk:
|
|
272
|
-
specifier: ^0.7.
|
|
273
|
-
version: 0.7.
|
|
272
|
+
specifier: ^0.7.24
|
|
273
|
+
version: 0.7.24(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0)
|
|
274
274
|
dayjs:
|
|
275
275
|
specifier: ^1.11.20
|
|
276
276
|
version: 1.11.20
|
|
@@ -2643,8 +2643,8 @@ packages:
|
|
|
2643
2643
|
resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==}
|
|
2644
2644
|
engines: {node: '>=10'}
|
|
2645
2645
|
|
|
2646
|
-
coze-coding-dev-sdk@0.7.
|
|
2647
|
-
resolution: {integrity: sha512
|
|
2646
|
+
coze-coding-dev-sdk@0.7.24:
|
|
2647
|
+
resolution: {integrity: sha512-oL9Tg5PwxP6iMixonzzMO4aBjOKWcFUMVM+iz5dPyaqQkG84HP1y9DqK5DJVmtdfJuYdAW7pzOatDqLvgvZiXg==}
|
|
2648
2648
|
engines: {node: '>=18.0.0'}
|
|
2649
2649
|
hasBin: true
|
|
2650
2650
|
|
|
@@ -9088,7 +9088,7 @@ snapshots:
|
|
|
9088
9088
|
path-type: 4.0.0
|
|
9089
9089
|
yaml: 1.10.2
|
|
9090
9090
|
|
|
9091
|
-
coze-coding-dev-sdk@0.7.
|
|
9091
|
+
coze-coding-dev-sdk@0.7.24(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0):
|
|
9092
9092
|
dependencies:
|
|
9093
9093
|
'@langchain/core': 1.1.17(openai@6.16.0(ws@8.19.0)(zod@4.3.6))
|
|
9094
9094
|
'@langchain/openai': 1.2.3(@langchain/core@1.1.17(openai@6.16.0(ws@8.19.0)(zod@4.3.6)))(ws@8.19.0)
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"embla-carousel-react": "^8.6.0",
|
|
57
57
|
"input-otp": "^1.4.2",
|
|
58
58
|
"lucide-react": "^0.468.0",
|
|
59
|
-
"next": "16.
|
|
59
|
+
"next": "16.3.3",
|
|
60
60
|
"next-themes": "^0.4.6",
|
|
61
61
|
"pg": "^8.16.3",
|
|
62
62
|
"react": "19.2.3",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@types/react": "^19",
|
|
81
81
|
"@types/react-dom": "^19",
|
|
82
82
|
"eslint": "^9",
|
|
83
|
-
"eslint-config-next": "16.
|
|
83
|
+
"eslint-config-next": "16.3.3",
|
|
84
84
|
"only-allow": "^1.2.2",
|
|
85
85
|
"react-dev-inspector": "^2.0.1",
|
|
86
86
|
"shadcn": "latest",
|