huanbao commited on
Commit
c5db69a
·
verified ·
1 Parent(s): 5d17973

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +18 -18
entrypoint.sh CHANGED
@@ -1,6 +1,9 @@
1
  #!/bin/bash
2
  set -e
3
 
 
 
 
4
  # 1. 创建持久化挂载目录
5
  mkdir -p /data/.claude /data/.codex /data/.cloudcli /data/app /data/.taskmaster /data/.cursor /data/.config/cursor
6
 
@@ -30,14 +33,13 @@ if [ ! -L "$HOME/.cursor" ]; then
30
  ln -s /data/.cursor "$HOME/.cursor"
31
  fi
32
 
33
- # 增加对 Linux 配置目录 ~/.config/cursor 的软链接映射
34
  mkdir -p "$HOME/.config"
35
  if [ ! -L "$HOME/.config/cursor" ]; then
36
  rm -rf "$HOME/.config/cursor"
37
  ln -s /data/.config/cursor "$HOME/.config/cursor"
38
  fi
39
 
40
- # 3. 自动生成 settings.json (Claude)
41
  mkdir -p "$HOME/.claude"
42
  cat <<EOF > "$HOME/.claude/settings.json"
43
  {
@@ -51,12 +53,7 @@ cat <<EOF > "$HOME/.claude/settings.json"
51
  "CLAUDE_CODE_PROXY_RESOLVES_HOSTS": "1",
52
  "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
53
  "ENABLE_TOOL_SEARCH": "true",
54
- "DISABLE_AUTOUPDATER": "1",
55
- "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-x[1m]",
56
- "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-sonnet-x[1m]",
57
- "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-x[1m]",
58
- "ANTHROPIC_MODEL": "claude-sonnet-x[1m]",
59
- "ANTHROPIC_REASONING_MODEL": "claude-sonnet-x[1m]"
60
  },
61
  "permissions": {
62
  "allow": [
@@ -65,8 +62,7 @@ cat <<EOF > "$HOME/.claude/settings.json"
65
  },
66
  "model": "sonnet[1m]",
67
  "skipWebFetchPreflight": true,
68
- "effortLevel": "high",
69
- "autoUpdatesChannel": "latest"
70
  }
71
  EOF
72
 
@@ -89,19 +85,23 @@ cat <<EOF > "$HOME/.codex/auth.json"
89
  }
90
  EOF
91
 
92
- # 5. 自动生成 Cursor 凭证与基础配置(关键点!)
93
- mkdir -p "$HOME/.cursor" "$HOME/.config/cursor"
94
 
95
- # 5.1 写入 Linux 认证凭证文件 auth.json
96
- cat <<EOF > "$HOME/.config/cursor/auth.json"
97
  {
98
- "accessToken": "${CURSOR_API_KEY:-}",
99
- "apiKey": "${CURSOR_API_KEY:-}"
100
  }
101
  EOF
102
- cp -f "$HOME/.config/cursor/auth.json" "$HOME/.cursor/auth.json"
 
 
 
 
 
103
 
104
- # 5.2 写入基础 cli-config.json
105
  cat <<EOF > "$HOME/.cursor/cli-config.json"
106
  {
107
  "permissions": {
 
1
  #!/bin/bash
2
  set -e
3
 
4
+ # 导出环境变量供子进程使用
5
+ export CURSOR_API_KEY="${CURSOR_API_KEY:-}"
6
+
7
  # 1. 创建持久化挂载目录
8
  mkdir -p /data/.claude /data/.codex /data/.cloudcli /data/app /data/.taskmaster /data/.cursor /data/.config/cursor
9
 
 
33
  ln -s /data/.cursor "$HOME/.cursor"
34
  fi
35
 
 
36
  mkdir -p "$HOME/.config"
37
  if [ ! -L "$HOME/.config/cursor" ]; then
38
  rm -rf "$HOME/.config/cursor"
39
  ln -s /data/.config/cursor "$HOME/.config/cursor"
40
  fi
41
 
42
+ # 3. 自动生成 Claude 配置
43
  mkdir -p "$HOME/.claude"
44
  cat <<EOF > "$HOME/.claude/settings.json"
45
  {
 
53
  "CLAUDE_CODE_PROXY_RESOLVES_HOSTS": "1",
54
  "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
55
  "ENABLE_TOOL_SEARCH": "true",
56
+ "DISABLE_AUTOUPDATER": "1"
 
 
 
 
 
57
  },
58
  "permissions": {
59
  "allow": [
 
62
  },
63
  "model": "sonnet[1m]",
64
  "skipWebFetchPreflight": true,
65
+ "effortLevel": "high"
 
66
  }
67
  EOF
68
 
 
85
  }
86
  EOF
87
 
88
+ # 5. 生成 Cursor 全路径凭证 (核心修复点)
89
+ mkdir -p "$HOME/.cursor/sdk" "$HOME/.config/cursor"
90
 
91
+ AUTH_JSON_CONTENT=$(cat <<EOF
 
92
  {
93
+ "accessToken": "${CURSOR_API_KEY}",
94
+ "apiKey": "${CURSOR_API_KEY}"
95
  }
96
  EOF
97
+ )
98
+
99
+ # 一口气写入 Cursor 所有可能的读取路径
100
+ echo "$AUTH_JSON_CONTENT" > "$HOME/.cursor/auth.json"
101
+ echo "$AUTH_JSON_CONTENT" > "$HOME/.cursor/sdk/auth.json"
102
+ echo "$AUTH_JSON_CONTENT" > "$HOME/.config/cursor/auth.json"
103
 
104
+ # 写入 cli-config.json 权限配置
105
  cat <<EOF > "$HOME/.cursor/cli-config.json"
106
  {
107
  "permissions": {