@xcanwin/manyoyo 3.8.3 → 3.8.4
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 +77 -394
- package/bin/manyoyo.js +21 -6
- package/config.example.json +1 -1
- package/package.json +7 -4
- package/docs/README_EN.md +0 -470
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/manyoyo-logo-09-cyberpunk-terminal.svg" alt="MANYOYO logo" width="560" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# <p align="center"><a href="https://github.com/xcanwin/manyoyo">MANYOYO(慢悠悠)</a></p>
|
|
2
6
|
<p align="center">一款AI智能体安全沙箱,保障PC安全,可以随心所欲运行YOLO/SOLO模式。</p>
|
|
3
7
|
<p align="center">
|
|
@@ -8,29 +12,15 @@
|
|
|
8
12
|
|
|
9
13
|
<p align="center">
|
|
10
14
|
<a href="README.md"><b>中文</b></a> |
|
|
11
|
-
<a href="
|
|
15
|
+
<a href="https://xcanwin.github.io/manyoyo/en/">English</a>
|
|
16
|
+
</p>
|
|
17
|
+
<p align="center">
|
|
18
|
+
📚 在线文档:<a href="https://xcanwin.github.io/manyoyo/">https://xcanwin.github.io/manyoyo/</a>
|
|
12
19
|
</p>
|
|
13
20
|
|
|
14
21
|
---
|
|
15
22
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
**Docker 用户:**
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g @xcanwin/manyoyo # 安装
|
|
21
|
-
manyoyo --ib --iv 1.7.0 # 构建镜像
|
|
22
|
-
manyoyo -y c # 运行 Claude Code YOLO 模式
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Podman 用户:**
|
|
26
|
-
```bash
|
|
27
|
-
npm install -g @xcanwin/manyoyo # 安装
|
|
28
|
-
podman pull ubuntu:24.04 # 拉取基础镜像
|
|
29
|
-
manyoyo --ib --iv 1.7.0 # 构建镜像
|
|
30
|
-
manyoyo -y c # 运行 Claude Code YOLO 模式
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
23
|
+
## 项目简介
|
|
34
24
|
|
|
35
25
|
**MANYOYO** 是一款 AI 智能体提效安全沙箱,安全、高效、省 token,专为 Agent YOLO 模式设计,保障宿主机安全。
|
|
36
26
|
|
|
@@ -45,426 +35,119 @@ manyoyo -y c # 运行 Claude Code YOLO 模式
|
|
|
45
35
|
- **快速启动**:快捷开启常见 Agent YOLO / SOLO 模式(例如 claude --dangerously-skip-permissions)
|
|
46
36
|
- **便捷操作**:快速进入 `/bin/bash`
|
|
47
37
|
- **会话恢复**:安装 Skills Marketplace 可快速恢复会话
|
|
48
|
-
-
|
|
38
|
+
- **灵活自定义**:支持配置各 CLI 的 `*_BASE_URL` / `*_AUTH_TOKEN` / `*_API_KEY` 等变量
|
|
49
39
|
- **配置管理**:快捷导入配置文件
|
|
50
40
|
- **高级模式**:支持危险容器嵌套(mount-docker-socket)、自定义沙箱镜像
|
|
51
41
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## 1. 安装 manyoyo
|
|
55
|
-
|
|
56
|
-
### 全局安装(推荐)
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm install -g @xcanwin/manyoyo
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### 本地开发
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm install -g .
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 2. 安装 podman
|
|
69
|
-
|
|
70
|
-
2.1 安装 [podman](https://podman.io/docs/installation)
|
|
71
|
-
|
|
72
|
-
2.2 拉取基础镜像
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
podman pull ubuntu:24.04
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## 3. 编译镜像
|
|
79
|
-
|
|
80
|
-
以下命令只需执行一条:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# 使用 manyoyo 构建镜像(推荐,自动使用缓存加速)
|
|
84
|
-
manyoyo --ib --iv 1.7.0 # 默认构建 full 版本(推荐,建议指定版本号)
|
|
85
|
-
manyoyo --ib --iba TOOL=common # 构建常见组件版本(python,nodejs,claude)
|
|
86
|
-
manyoyo --ib --iba TOOL=go,codex,java,gemini # 构建自定义组件版本
|
|
87
|
-
manyoyo --ib --iba GIT_SSL_NO_VERIFY=true # 构建 full 版本且跳过git的ssl验证
|
|
88
|
-
manyoyo --ib --in myimage --iv 2.0.0 # 自定义镜像名称和版本,得到 myimage:2.0.0-full
|
|
89
|
-
# 工作原理:
|
|
90
|
-
# - 首次构建:自动下载 Node.js、JDT LSP、gopls 等到 docker/cache/
|
|
91
|
-
# - 2天内再次构建:直接使用本地缓存,速度提升约 5 倍
|
|
92
|
-
# - 缓存过期后:自动重新下载最新版本
|
|
93
|
-
|
|
94
|
-
# 或手动构建(不推荐)
|
|
95
|
-
iv=1.0.0 && podman build -t localhost/xcanwin/manyoyo:$iv-full -f docker/manyoyo.Dockerfile . --build-arg TOOL=full --no-cache
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## 4. 使用方法
|
|
99
|
-
|
|
100
|
-
### 基础命令
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# 显示帮助
|
|
104
|
-
manyoyo -h
|
|
105
|
-
|
|
106
|
-
# 显示版本
|
|
107
|
-
manyoyo -V
|
|
108
|
-
|
|
109
|
-
# 列出所有容器
|
|
110
|
-
manyoyo -l
|
|
111
|
-
|
|
112
|
-
# 创建新容器并使用环境文件
|
|
113
|
-
manyoyo -n test --ef .env -y c
|
|
114
|
-
|
|
115
|
-
# 恢复现有会话
|
|
116
|
-
manyoyo -n test -- -c # Claude Code
|
|
117
|
-
manyoyo -n test -- resume --last # Codex
|
|
118
|
-
manyoyo -n test -- -r # Gemini
|
|
119
|
-
manyoyo -n test -- -c # OpenCode
|
|
120
|
-
|
|
121
|
-
# 在交互式 shell 中执行命令
|
|
122
|
-
manyoyo -n test -x /bin/bash
|
|
123
|
-
|
|
124
|
-
# 执行自定义命令
|
|
125
|
-
manyoyo -n test -x echo "hello world"
|
|
126
|
-
|
|
127
|
-
# 删除容器
|
|
128
|
-
manyoyo -n test --crm
|
|
129
|
-
|
|
130
|
-
# 清理悬空镜像和 <none> 镜像
|
|
131
|
-
manyoyo --irm
|
|
132
|
-
|
|
133
|
-
# 静默显示执行命令
|
|
134
|
-
manyoyo -q full -x echo "hello world"
|
|
135
|
-
manyoyo -q tip -q cmd -x echo "hello world" # 多次使用静默选项
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 环境变量
|
|
139
|
-
|
|
140
|
-
给容器内CLI传递BASE_URL和TOKEN等。
|
|
141
|
-
|
|
142
|
-
#### 字符串形式
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
manyoyo -e "ANTHROPIC_BASE_URL=https://xxxx" -e "ANTHROPIC_AUTH_TOKEN=your-key" -x claude
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
#### 文件形式
|
|
149
|
-
|
|
150
|
-
环境文件使用 `.env` 格式,支持注释(以 `#` 开头的行):
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
export ANTHROPIC_BASE_URL="https://xxxx"
|
|
154
|
-
AUTH_TOANTHROPIC_AUTH_TOKEN=your-key
|
|
155
|
-
# MESSAGE="Hello World" # 注释会被忽略
|
|
156
|
-
TESTPATH='/usr/local/bin'
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**环境文件路径规则**:
|
|
160
|
-
- `manyoyo --ef myconfig` → 加载 `~/.manyoyo/env/myconfig.env`
|
|
161
|
-
- `manyoyo --ef ./myconfig.env` → 加载当前目录的 `myconfig.env`
|
|
162
|
-
|
|
163
|
-
#### 常用样例-Claude Code
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# 创建环境文件目录
|
|
167
|
-
mkdir -p ~/.manyoyo/env/
|
|
168
|
-
|
|
169
|
-
# 示例:创建 Claude 环境文件
|
|
170
|
-
cat > ~/.manyoyo/env/anthropic_[claudecode]_claudecode.env << 'EOF'
|
|
171
|
-
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
|
|
172
|
-
# export CLAUDE_CODE_OAUTH_TOKEN="sk-xxxxxxxx"
|
|
173
|
-
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"
|
|
174
|
-
export API_TIMEOUT_MS=3000000
|
|
175
|
-
export ANTHROPIC_MODEL="claude-sonnet-4-5"
|
|
176
|
-
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-5"
|
|
177
|
-
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-5"
|
|
178
|
-
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
|
|
179
|
-
export CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-5"
|
|
180
|
-
EOF
|
|
181
|
-
|
|
182
|
-
# 在任意目录下使用环境文件
|
|
183
|
-
manyoyo --ef anthropic_[claudecode]_claudecode -x claude
|
|
184
|
-
```
|
|
42
|
+
---
|
|
185
43
|
|
|
186
|
-
|
|
44
|
+
## 快速开始
|
|
187
45
|
|
|
188
46
|
```bash
|
|
189
|
-
#
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
#
|
|
193
|
-
cat > ~/.manyoyo/env/openai_[gpt]_codex.env << 'EOF'
|
|
194
|
-
export OPENAI_BASE_URL=https://chatgpt.com/backend-api/codex
|
|
195
|
-
export OTEL_SDK_DISABLED=true
|
|
196
|
-
EOF
|
|
197
|
-
|
|
198
|
-
# 在任意目录下使用环境文件
|
|
199
|
-
manyoyo --ef openai_[gpt]_codex -x codex
|
|
47
|
+
npm install -g @xcanwin/manyoyo # 安装
|
|
48
|
+
podman pull ubuntu:24.04 # 仅 Podman 需要
|
|
49
|
+
manyoyo --ib --iv 1.7.0 # 构建镜像
|
|
50
|
+
manyoyo -y c # 运行 Claude Code YOLO 模式
|
|
200
51
|
```
|
|
201
52
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
简化MANYOYO命令行操作。配置文件使用 **JSON5 格式**,支持注释、尾随逗号等特性。
|
|
205
|
-
|
|
206
|
-
#### 配置文件路径规则
|
|
53
|
+
注意:YOLO/SOLO 会跳过权限确认,请确保在可控环境中使用。
|
|
207
54
|
|
|
208
|
-
|
|
209
|
-
- `manyoyo -r ./myconfig.json` → 加载当前目录的 `myconfig.json`
|
|
210
|
-
- `manyoyo [任何选项]` → 始终会加载全局配置 `~/.manyoyo/manyoyo.json`
|
|
211
|
-
|
|
212
|
-
#### 配置选项
|
|
213
|
-
|
|
214
|
-
参考 `config.example.json` 文件查看所有可配置项:
|
|
215
|
-
|
|
216
|
-
```json5
|
|
217
|
-
{
|
|
218
|
-
// 容器基础配置
|
|
219
|
-
"containerName": "myy-dev", // 默认容器名称
|
|
220
|
-
"hostPath": "/path/to/project", // 默认宿主机工作目录
|
|
221
|
-
"containerPath": "/path/to/project", // 默认容器工作目录
|
|
222
|
-
"imageName": "localhost/xcanwin/manyoyo", // 默认镜像名称
|
|
223
|
-
"imageVersion": "1.7.0-full", // 默认镜像版本
|
|
224
|
-
"containerMode": "common", // 容器嵌套模式 (common, dind, sock)
|
|
225
|
-
|
|
226
|
-
// 环境变量配置
|
|
227
|
-
"envFile": [
|
|
228
|
-
"claude" // 对应 ~/.manyoyo/env/claude.env
|
|
229
|
-
],
|
|
230
|
-
"env": [], // 默认环境变量数组
|
|
231
|
-
|
|
232
|
-
// 其他配置
|
|
233
|
-
"volumes": [], // 默认挂载卷数组
|
|
234
|
-
"shellPrefix": "", // 默认命令前缀
|
|
235
|
-
"shell": "", // 默认执行命令
|
|
236
|
-
"yolo": "", // 默认 YOLO 模式 (c, gm, cx, oc)
|
|
237
|
-
"quiet": [], // 默认静默选项数组 (支持 ["tip", "cmd"] 格式)
|
|
238
|
-
"imageBuildArgs": [] // 默认镜像构建参数
|
|
239
|
-
}
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
#### 优先级
|
|
55
|
+
---
|
|
243
56
|
|
|
244
|
-
|
|
245
|
-
- **合并型参数**:全局配置 + 运行配置 + 命令行(按顺序累加)
|
|
57
|
+
## 安全提示
|
|
246
58
|
|
|
247
|
-
|
|
59
|
+
- **YOLO/SOLO 模式**:跳过权限确认,存在误删或执行危险命令风险。详见:[AI 智能体](https://xcanwin.github.io/manyoyo/zh/reference/agents)
|
|
60
|
+
- **sock 容器模式**:挂载宿主机 Docker socket,容器可完全控制宿主机容器。详见:[容器模式](https://xcanwin.github.io/manyoyo/zh/reference/container-modes)
|
|
248
61
|
|
|
249
|
-
|
|
250
|
-
|---------|--------|---------|------|
|
|
251
|
-
| 覆盖型 | `containerName` | 取最高优先级的值 | CLI `-n test` 覆盖配置文件中的值 |
|
|
252
|
-
| 覆盖型 | `hostPath` | 取最高优先级的值 | 默认为当前目录 |
|
|
253
|
-
| 覆盖型 | `containerPath` | 取最高优先级的值 | 默认与 hostPath 相同 |
|
|
254
|
-
| 覆盖型 | `imageName` | 取最高优先级的值 | 默认 `localhost/xcanwin/manyoyo` |
|
|
255
|
-
| 覆盖型 | `imageVersion` | 取最高优先级的值 | 如 `1.7.0-full` |
|
|
256
|
-
| 覆盖型 | `containerMode` | 取最高优先级的值 | `common`, `dind`, `sock` |
|
|
257
|
-
| 覆盖型 | `yolo` | 取最高优先级的值 | `c`, `gm`, `cx`, `oc` |
|
|
258
|
-
| 合并型 | `env` | 数组累加合并 | 全局 + 运行配置 + CLI 的所有值 |
|
|
259
|
-
| 合并型 | `envFile` | 数组累加合并 | 所有环境文件依次加载 |
|
|
260
|
-
| 合并型 | `volumes` | 数组累加合并 | 所有挂载卷生效 |
|
|
261
|
-
| 合并型 | `imageBuildArgs` | 数组累加合并 | 所有构建参数生效 |
|
|
62
|
+
## 安装
|
|
262
63
|
|
|
263
|
-
|
|
64
|
+
### 全局安装(推荐)
|
|
264
65
|
|
|
265
66
|
```bash
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
cat > ~/.manyoyo/manyoyo.json << 'EOF'
|
|
269
|
-
{
|
|
270
|
-
"imageName": "localhost/xcanwin/manyoyo",
|
|
271
|
-
"imageVersion": "1.7.0-full"
|
|
272
|
-
}
|
|
273
|
-
EOF
|
|
67
|
+
npm install -g @xcanwin/manyoyo
|
|
274
68
|
```
|
|
275
69
|
|
|
276
|
-
|
|
70
|
+
### 系统要求
|
|
277
71
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
cat > ~/.manyoyo/run/claude.json << 'EOF'
|
|
282
|
-
{
|
|
283
|
-
"envFile": [
|
|
284
|
-
"anthropic_[claudecode]_claudecode" // 自动加载 ~/.manyoyo/env/claude.env
|
|
285
|
-
],
|
|
286
|
-
"yolo": "c"
|
|
287
|
-
}
|
|
288
|
-
EOF
|
|
289
|
-
|
|
290
|
-
# 在任意目录下使用运行配置
|
|
291
|
-
manyoyo -r claude
|
|
292
|
-
```
|
|
72
|
+
- Node.js >= 22.0.0
|
|
73
|
+
- Podman(推荐) 或 Docker
|
|
293
74
|
|
|
294
|
-
|
|
75
|
+
详细安装指南请参考:[安装详解](https://xcanwin.github.io/manyoyo/zh/guide/installation)
|
|
295
76
|
|
|
296
|
-
|
|
297
|
-
mkdir -p ~/.manyoyo/run/
|
|
298
|
-
|
|
299
|
-
cat > ~/.manyoyo/run/codex.json << 'EOF'
|
|
300
|
-
{
|
|
301
|
-
"envFile": [
|
|
302
|
-
"openai_[gpt]_codex"
|
|
303
|
-
],
|
|
304
|
-
"volumes": [
|
|
305
|
-
"/Users/pc_user/.codex/auth.json:/root/.codex/auth.json"
|
|
306
|
-
],
|
|
307
|
-
"yolo": "cx"
|
|
308
|
-
}
|
|
309
|
-
EOF
|
|
310
|
-
|
|
311
|
-
# 在任意目录下使用运行配置
|
|
312
|
-
manyoyo -r codex
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### AI CLI 快捷方式(跳过权限确认)
|
|
77
|
+
## 构建镜像
|
|
316
78
|
|
|
317
79
|
```bash
|
|
318
|
-
#
|
|
319
|
-
manyoyo
|
|
80
|
+
# 构建完整版本(推荐)
|
|
81
|
+
manyoyo --ib --iv 1.7.0
|
|
320
82
|
|
|
321
|
-
#
|
|
322
|
-
manyoyo
|
|
83
|
+
# 构建精简版本
|
|
84
|
+
manyoyo --ib --iba TOOL=common
|
|
323
85
|
|
|
324
|
-
#
|
|
325
|
-
manyoyo
|
|
326
|
-
|
|
327
|
-
# OpenCode
|
|
328
|
-
manyoyo -y oc # 或: opencode
|
|
86
|
+
# 构建自定义版本
|
|
87
|
+
manyoyo --ib --iba TOOL=go,codex,java,gemini
|
|
329
88
|
```
|
|
330
89
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
退出容器会话后,系统将提示您选择操作:
|
|
90
|
+
- 首次构建会自动下载依赖到 `docker/cache/`,2天内再次构建会使用缓存,速度提升约 **5 倍**
|
|
334
91
|
|
|
335
|
-
|
|
336
|
-
- `n` - 删除容器
|
|
337
|
-
- `1` - 使用首次命令重新进入
|
|
338
|
-
- `x` - 执行新命令
|
|
339
|
-
- `i` - 进入交互式 shell
|
|
340
|
-
|
|
341
|
-
### 容器模式
|
|
342
|
-
|
|
343
|
-
#### Docker-in-Docker 开发
|
|
92
|
+
## 常用命令
|
|
344
93
|
|
|
345
94
|
```bash
|
|
346
|
-
#
|
|
347
|
-
#
|
|
348
|
-
manyoyo -
|
|
95
|
+
# 启动常见智能体
|
|
96
|
+
manyoyo -y c # Claude Code(或 claude / cc)
|
|
97
|
+
manyoyo -y gm # Gemini(或 gemini / g)
|
|
98
|
+
manyoyo -y cx # Codex(或 codex)
|
|
99
|
+
manyoyo -y oc # OpenCode(或 opencode)
|
|
349
100
|
|
|
350
|
-
|
|
101
|
+
# 容器管理
|
|
102
|
+
manyoyo -l
|
|
103
|
+
manyoyo -n myy-dev -x /bin/bash
|
|
104
|
+
manyoyo -n myy-dev --crm
|
|
351
105
|
|
|
352
|
-
|
|
353
|
-
|
|
106
|
+
# 调试配置与命令拼装
|
|
107
|
+
manyoyo --show-config
|
|
108
|
+
manyoyo --show-command
|
|
354
109
|
```
|
|
355
110
|
|
|
356
|
-
|
|
111
|
+
## 配置
|
|
357
112
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
113
|
+
配置优先级:命令行参数 > 运行配置 > 全局配置 > 默认值
|
|
114
|
+
详细说明请参考:
|
|
115
|
+
- [配置系统概览](https://xcanwin.github.io/manyoyo/zh/configuration/)
|
|
116
|
+
- [环境变量详解](https://xcanwin.github.io/manyoyo/zh/configuration/environment)
|
|
117
|
+
- [配置文件详解](https://xcanwin.github.io/manyoyo/zh/configuration/config-files)
|
|
362
118
|
|
|
363
|
-
|
|
119
|
+
## 📚 完整文档
|
|
364
120
|
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### 命令行选项
|
|
369
|
-
|
|
370
|
-
| 选项 | 别名 | 描述 |
|
|
371
|
-
|------|------|------|
|
|
372
|
-
| `--hp PATH` | `--host-path` | 设置宿主机工作目录(默认:当前路径) |
|
|
373
|
-
| `-n NAME` | `--cont-name` | 设置容器名称 |
|
|
374
|
-
| `--cp PATH` | `--cont-path` | 设置容器工作目录 |
|
|
375
|
-
| `-l` | `--cont-list` | 列出所有 manyoyo 容器 |
|
|
376
|
-
| `--crm` | `--cont-remove` | 删除容器 |
|
|
377
|
-
| `-m MODE` | `--cont-mode` | 设置容器模式(common, dind, sock) |
|
|
378
|
-
| `--in NAME` | `--image-name` | 指定镜像名称 |
|
|
379
|
-
| `--iv VERSION` | `--image-ver` | 指定镜像版本 |
|
|
380
|
-
| `--ib` | `--image-build` | 构建镜像 |
|
|
381
|
-
| `--iba XXX=YYY` | `--image-build-arg` | 构建镜像时传参给dockerfile |
|
|
382
|
-
| `--irm` | `--image-remove` | 清理悬空镜像和 `<none>` 镜像 |
|
|
383
|
-
| `-e STRING` | `--env` | 设置环境变量 |
|
|
384
|
-
| `--ef FILE` | `--env-file` | 从文件加载环境变量(支持 `name` 或 `./path.env`) |
|
|
385
|
-
| `-v STRING` | `--volume` | 绑定挂载卷 |
|
|
386
|
-
| `--sp CMD` | `--shell-prefix` | 临时环境变量(作为 -s 的前缀) |
|
|
387
|
-
| `-s CMD` | `--shell` | 指定要执行的命令 |
|
|
388
|
-
| `--` | `--ss`, `--shell-suffix` | 命令参数(作为 -s 的后缀) |
|
|
389
|
-
| `-x CMD` | `--sf`, `--shell-full` | 完整命令(替代 --sp, -s 和 --) |
|
|
390
|
-
| `-y CLI` | `--yolo` | 无需确认运行 AI 智能体 |
|
|
391
|
-
| `--show-config` | | 显示最终生效配置并退出 |
|
|
392
|
-
| `--show-command` | | 显示将执行的命令并退出(存在容器时为 docker exec,不存在时为 docker run) |
|
|
393
|
-
| `--yes` | | 所有提示自动确认(用于CI/脚本) |
|
|
394
|
-
| `--rm-on-exit` | | 退出后自动删除容器(一次性模式) |
|
|
395
|
-
| `--install NAME` | | 安装 manyoyo 命令 |
|
|
396
|
-
| `-q LIST` | `--quiet` | 静默显示 |
|
|
397
|
-
| `-r NAME` | `--run` | 加载运行配置(支持 `name` 或 `./path.json`) |
|
|
398
|
-
| `-V` | `--version` | 显示版本 |
|
|
399
|
-
| `-h` | `--help` | 显示帮助 |
|
|
400
|
-
|
|
401
|
-
## 其他说明
|
|
402
|
-
|
|
403
|
-
### 默认配置
|
|
404
|
-
|
|
405
|
-
- **容器名称**:`myy-{月日-时分}`(基于当前时间自动生成)
|
|
406
|
-
- **宿主机路径**:当前工作目录
|
|
407
|
-
- **容器路径**:与宿主机路径相同
|
|
408
|
-
- **镜像**:`localhost/xcanwin/manyoyo:xxx`
|
|
121
|
+
在线文档:**https://xcanwin.github.io/manyoyo/**
|
|
409
122
|
|
|
410
|
-
|
|
123
|
+
**中文文档:**
|
|
124
|
+
- [快速开始](https://xcanwin.github.io/manyoyo/zh/guide/quick-start)
|
|
125
|
+
- [安装详解](https://xcanwin.github.io/manyoyo/zh/guide/installation)
|
|
126
|
+
- [配置系统](https://xcanwin.github.io/manyoyo/zh/configuration/)
|
|
127
|
+
- [故障排查](https://xcanwin.github.io/manyoyo/zh/troubleshooting/)
|
|
411
128
|
|
|
412
|
-
|
|
413
|
-
-
|
|
129
|
+
**English Documentation:**
|
|
130
|
+
- [Quick Start](https://xcanwin.github.io/manyoyo/en/guide/quick-start)
|
|
131
|
+
- [Installation](https://xcanwin.github.io/manyoyo/en/guide/installation)
|
|
132
|
+
- [Configuration](https://xcanwin.github.io/manyoyo/en/configuration/)
|
|
133
|
+
- [Troubleshooting](https://xcanwin.github.io/manyoyo/en/troubleshooting/)
|
|
414
134
|
|
|
415
|
-
|
|
135
|
+
## 卸载
|
|
416
136
|
|
|
417
137
|
```bash
|
|
138
|
+
# 卸载全局安装
|
|
418
139
|
npm uninstall -g @xcanwin/manyoyo
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
## 故障排查 FAQ
|
|
422
|
-
|
|
423
|
-
### 镜像构建失败
|
|
424
140
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
1. 检查网络连接:`curl -I https://mirrors.tencent.com`
|
|
429
|
-
2. 检查磁盘空间:`df -h`(需要至少 10GB 可用空间)
|
|
430
|
-
3. 使用 `--yes` 跳过确认:`manyoyo --ib --iv 1.7.0 --yes`
|
|
431
|
-
4. 如果在国外,可能需要修改镜像源(配置文件中设置 `nodeMirror`)
|
|
432
|
-
|
|
433
|
-
### 镜像拉取失败
|
|
434
|
-
|
|
435
|
-
**问题**:提示 `pinging container registry localhost failed`
|
|
436
|
-
|
|
437
|
-
**解决方案**:
|
|
438
|
-
1. 本地镜像需要先构建:`manyoyo --ib --iv 1.7.0`
|
|
439
|
-
2. 或修改配置文件 `~/.manyoyo/manyoyo.json` 中的 `imageVersion`
|
|
440
|
-
|
|
441
|
-
### 容器启动失败
|
|
442
|
-
|
|
443
|
-
**问题**:容器无法启动或立即退出
|
|
444
|
-
|
|
445
|
-
**解决方案**:
|
|
446
|
-
1. 查看容器日志:`docker logs <容器名>`
|
|
447
|
-
2. 检查端口冲突:`docker ps -a`
|
|
448
|
-
3. 检查权限问题:确保当前用户有 Docker/Podman 权限
|
|
449
|
-
|
|
450
|
-
### 权限不足
|
|
451
|
-
|
|
452
|
-
**问题**:提示 `permission denied` 或无法访问 Docker
|
|
453
|
-
|
|
454
|
-
**解决方案**:
|
|
455
|
-
1. 将用户添加到 docker 组:`sudo usermod -aG docker $USER`
|
|
456
|
-
2. 重新登录或运行:`newgrp docker`
|
|
457
|
-
3. 或使用 `sudo` 运行命令
|
|
141
|
+
# 清理配置(可选)
|
|
142
|
+
rm -rf ~/.manyoyo/
|
|
143
|
+
```
|
|
458
144
|
|
|
459
|
-
|
|
145
|
+
## 许可证
|
|
460
146
|
|
|
461
|
-
|
|
147
|
+
MIT
|
|
462
148
|
|
|
463
|
-
|
|
464
|
-
1. 检查环境文件格式(支持 `KEY=VALUE` 或 `export KEY=VALUE`)
|
|
465
|
-
2. 确认文件路径正确(`--ef name` 对应 `~/.manyoyo/env/name.env`)
|
|
466
|
-
3. 使用 `--show-config` 查看最终生效的配置
|
|
149
|
+
## 贡献
|
|
467
150
|
|
|
468
|
-
|
|
151
|
+
欢迎提交 Issue 和 Pull Request!
|
|
469
152
|
|
|
470
|
-
|
|
153
|
+
访问 [GitHub Issues](https://github.com/xcanwin/manyoyo/issues) 报告问题或提出建议。
|
package/bin/manyoyo.js
CHANGED
|
@@ -70,7 +70,7 @@ const NC = '\x1b[0m'; // No Color
|
|
|
70
70
|
let DOCKER_CMD = 'docker';
|
|
71
71
|
|
|
72
72
|
// ==============================================================================
|
|
73
|
-
// Utility Functions
|
|
73
|
+
// SECTION: Utility Functions
|
|
74
74
|
// ==============================================================================
|
|
75
75
|
|
|
76
76
|
function sleep(ms) {
|
|
@@ -133,7 +133,7 @@ function sanitizeSensitiveData(obj) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// ==============================================================================
|
|
136
|
-
// Configuration
|
|
136
|
+
// SECTION: Configuration Management
|
|
137
137
|
// ==============================================================================
|
|
138
138
|
|
|
139
139
|
/**
|
|
@@ -204,10 +204,9 @@ function loadRunConfig(name) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
// ==============================================================================
|
|
207
|
-
// UI Functions
|
|
207
|
+
// SECTION: UI Functions
|
|
208
208
|
// ==============================================================================
|
|
209
209
|
|
|
210
|
-
|
|
211
210
|
function getHelloTip(containerName, defaultCommand) {
|
|
212
211
|
if ( !(QUIET.tip || QUIET.full) ) {
|
|
213
212
|
console.log("");
|
|
@@ -259,6 +258,10 @@ function validateName(label, value, pattern) {
|
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
260
|
|
|
261
|
+
// ==============================================================================
|
|
262
|
+
// SECTION: Environment Variables and Volume Handling
|
|
263
|
+
// ==============================================================================
|
|
264
|
+
|
|
262
265
|
async function askQuestion(prompt) {
|
|
263
266
|
const rl = readline.createInterface({
|
|
264
267
|
input: process.stdin,
|
|
@@ -352,6 +355,10 @@ function addVolume(volume) {
|
|
|
352
355
|
CONTAINER_VOLUMES.push("--volume", volume);
|
|
353
356
|
}
|
|
354
357
|
|
|
358
|
+
// ==============================================================================
|
|
359
|
+
// SECTION: YOLO Mode and Container Mode Configuration
|
|
360
|
+
// ==============================================================================
|
|
361
|
+
|
|
355
362
|
function setYolo(cli) {
|
|
356
363
|
switch (cli) {
|
|
357
364
|
case 'claude':
|
|
@@ -479,7 +486,7 @@ function removeContainer(name) {
|
|
|
479
486
|
}
|
|
480
487
|
|
|
481
488
|
// ==============================================================================
|
|
482
|
-
// Docker Operations
|
|
489
|
+
// SECTION: Docker Operations
|
|
483
490
|
// ==============================================================================
|
|
484
491
|
|
|
485
492
|
function ensureDocker() {
|
|
@@ -549,6 +556,10 @@ function pruneDanglingImages() {
|
|
|
549
556
|
console.log(`${GREEN}✅ 清理完成${NC}`);
|
|
550
557
|
}
|
|
551
558
|
|
|
559
|
+
// ==============================================================================
|
|
560
|
+
// SECTION: Image Build System
|
|
561
|
+
// ==============================================================================
|
|
562
|
+
|
|
552
563
|
/**
|
|
553
564
|
* 准备构建缓存(Node.js、JDT LSP、gopls)
|
|
554
565
|
* @param {string} imageTool - 构建工具类型
|
|
@@ -806,7 +817,7 @@ async function buildImage(IMAGE_BUILD_ARGS, imageName, imageVersion) {
|
|
|
806
817
|
}
|
|
807
818
|
|
|
808
819
|
// ==============================================================================
|
|
809
|
-
//
|
|
820
|
+
// SECTION: Command Line Interface
|
|
810
821
|
// ==============================================================================
|
|
811
822
|
|
|
812
823
|
function setupCommander() {
|
|
@@ -1078,6 +1089,10 @@ async function waitForContainerReady(containerName) {
|
|
|
1078
1089
|
process.exit(1);
|
|
1079
1090
|
}
|
|
1080
1091
|
|
|
1092
|
+
// ==============================================================================
|
|
1093
|
+
// SECTION: Container Lifecycle Management
|
|
1094
|
+
// ==============================================================================
|
|
1095
|
+
|
|
1081
1096
|
/**
|
|
1082
1097
|
* 创建新容器
|
|
1083
1098
|
* @returns {Promise<string>} 默认命令
|
package/config.example.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcanwin/manyoyo",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.4",
|
|
4
4
|
"imageVersion": "1.7.0",
|
|
5
5
|
"description": "AI Agent CLI Security Sandbox",
|
|
6
6
|
"keywords": [
|
|
@@ -22,7 +22,10 @@
|
|
|
22
22
|
"install-link": "npm link",
|
|
23
23
|
"test": "jest --coverage",
|
|
24
24
|
"test:unit": "jest test/",
|
|
25
|
-
"lint": "echo 'Lint check passed'"
|
|
25
|
+
"lint": "echo 'Lint check passed'",
|
|
26
|
+
"docs:dev": "vitepress dev docs --host --port 5173",
|
|
27
|
+
"docs:build": "vitepress build docs",
|
|
28
|
+
"docs:preview": "vitepress preview docs --host --port 4173"
|
|
26
29
|
},
|
|
27
30
|
"homepage": "https://github.com/xcanwin/manyoyo",
|
|
28
31
|
"engines": {
|
|
@@ -31,7 +34,6 @@
|
|
|
31
34
|
"files": [
|
|
32
35
|
"bin/manyoyo.js",
|
|
33
36
|
"README.md",
|
|
34
|
-
"docs/README_EN.md",
|
|
35
37
|
"LICENSE",
|
|
36
38
|
"docker/manyoyo.Dockerfile",
|
|
37
39
|
"config.example.json"
|
|
@@ -41,7 +43,8 @@
|
|
|
41
43
|
"json5": "^2.2.3"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"jest": "^29.7.0"
|
|
46
|
+
"jest": "^29.7.0",
|
|
47
|
+
"vitepress": "^1.6.4"
|
|
45
48
|
},
|
|
46
49
|
"jest": {
|
|
47
50
|
"testMatch": ["**/test/**/*.test.js"],
|
package/docs/README_EN.md
DELETED
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
# <p align="center"><a href="https://github.com/xcanwin/manyoyo">MANYOYO (Man-Yo-Yo)</a></p>
|
|
2
|
-
<p align="center">AI Agent CLI Security Sandbox.</p>
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://www.npmjs.com/package/@xcanwin/manyoyo"><img alt="npm" src="https://img.shields.io/npm/v/@xcanwin/manyoyo?style=flat-square" /></a>
|
|
5
|
-
<a href="https://github.com/xcanwin/manyoyo/actions/workflows/npm-publish.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/xcanwin/manyoyo/npm-publish.yml?style=flat-square" /></a>
|
|
6
|
-
<a href="https://github.com/xcanwin/manyoyo/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/badge/License-MIT-yellow.svg" /></a>
|
|
7
|
-
</p>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="../README.md">中文</a> |
|
|
11
|
-
<a href="README_EN.md"><b>English</b></a>
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## 2-Minute Quick Start
|
|
17
|
-
|
|
18
|
-
**Docker users:**
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g @xcanwin/manyoyo # Install
|
|
21
|
-
manyoyo --ib --iv 1.7.0 # Build image
|
|
22
|
-
manyoyo -y c # Run Claude Code YOLO mode
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Podman users:**
|
|
26
|
-
```bash
|
|
27
|
-
npm install -g @xcanwin/manyoyo # Install
|
|
28
|
-
podman pull ubuntu:24.04 # Pull base image
|
|
29
|
-
manyoyo --ib --iv 1.7.0 # Build image
|
|
30
|
-
manyoyo -y c # Run Claude Code YOLO mode
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
**MANYOYO** is an AI agent security sandbox that is safe, efficient, and token-saving. Designed specifically for Agent YOLO mode to protect the host machine.
|
|
36
|
-
|
|
37
|
-
Pre-installed with common agents and tools to further save tokens. Freely switch between agents and `/bin/bash` in a loop for enhanced efficiency.
|
|
38
|
-
|
|
39
|
-
**MANYOYO** provides an isolated Docker/Podman container environment for running AI agent CLIs safely.
|
|
40
|
-
|
|
41
|
-
## Key Features
|
|
42
|
-
|
|
43
|
-
- **Multi-Agent Support**: Supports claude code, gemini, codex, opencode
|
|
44
|
-
- **Security Isolation**: Protects host machine, supports safe nested containers (Docker-in-Docker)
|
|
45
|
-
- **Quick Launch**: Quickly enable common Agent YOLO / SOLO mode (e.g., claude --dangerously-skip-permissions)
|
|
46
|
-
- **Convenient Operations**: Quick access to `/bin/bash`
|
|
47
|
-
- **Session Recovery**: Install Skills Marketplace to quickly resume sessions
|
|
48
|
-
- **Flexible Customization**: Support custom `BASEURL`, `AUTH_TOKEN`, and other variables
|
|
49
|
-
- **Configuration Management**: Quick import of configuration files
|
|
50
|
-
- **Advanced Mode**: Supports dangerous nested containers (mount-docker-socket), custom sandbox images
|
|
51
|
-
|
|
52
|
-
# Usage
|
|
53
|
-
|
|
54
|
-
## 1. Install manyoyo
|
|
55
|
-
|
|
56
|
-
### Global Installation (Recommended)
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm install -g @xcanwin/manyoyo
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Local Development
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm install -g .
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## 2. Install podman
|
|
69
|
-
|
|
70
|
-
2.1 Install [podman](https://podman.io/docs/installation)
|
|
71
|
-
|
|
72
|
-
2.2 Pull base image
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
podman pull ubuntu:24.04
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## 3. Build Image
|
|
79
|
-
|
|
80
|
-
Only one of the following commands needs to be executed:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# Build using manyoyo (Recommended, auto-cache enabled)
|
|
84
|
-
manyoyo --ib --iv 1.7.0 # Build full version by default (Recommended, specify version)
|
|
85
|
-
manyoyo --ib --iba TOOL=common # Build common version (python,nodejs,claude)
|
|
86
|
-
manyoyo --ib --iba TOOL=go,codex,java,gemini # Build custom combination
|
|
87
|
-
manyoyo --ib --iba GIT_SSL_NO_VERIFY=true # Build the full version and skip Git SSL verification
|
|
88
|
-
manyoyo --ib --in myimage --iv 2.0.0 # Customize the image name and version to produce myimage:2.0.0-full
|
|
89
|
-
# How it works:
|
|
90
|
-
# - First build: Auto-downloads Node.js, JDT LSP, gopls etc. to docker/cache/
|
|
91
|
-
# - Rebuild within 2 days: Uses local cache, ~5x faster
|
|
92
|
-
# - After cache expires: Auto-downloads latest versions
|
|
93
|
-
|
|
94
|
-
# Or build manually (Not recommended)
|
|
95
|
-
iv=1.0.0 && podman build -t localhost/xcanwin/manyoyo:$iv-full -f docker/manyoyo.Dockerfile . --build-arg TOOL=full --no-cache
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## 4. Usage
|
|
99
|
-
|
|
100
|
-
### Basic Commands
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# Show help
|
|
104
|
-
manyoyo -h
|
|
105
|
-
|
|
106
|
-
# Show version
|
|
107
|
-
manyoyo -V
|
|
108
|
-
|
|
109
|
-
# List all containers
|
|
110
|
-
manyoyo -l
|
|
111
|
-
|
|
112
|
-
# Create new container with environment file
|
|
113
|
-
manyoyo -n test --ef .env -y c
|
|
114
|
-
|
|
115
|
-
# Resume existing session
|
|
116
|
-
manyoyo -n test -- -c # Claude Code
|
|
117
|
-
manyoyo -n test -- resume --last # Codex
|
|
118
|
-
manyoyo -n test -- -r # Gemini
|
|
119
|
-
manyoyo -n test -- -c # OpenCode
|
|
120
|
-
|
|
121
|
-
# Execute command in interactive shell
|
|
122
|
-
manyoyo -n test -x /bin/bash
|
|
123
|
-
|
|
124
|
-
# Execute custom command
|
|
125
|
-
manyoyo -n test -x echo "hello world"
|
|
126
|
-
|
|
127
|
-
# Remove container
|
|
128
|
-
manyoyo -n test --crm
|
|
129
|
-
|
|
130
|
-
# Clean dangling images and <none> images
|
|
131
|
-
manyoyo --irm
|
|
132
|
-
|
|
133
|
-
# Execute custom command with quiet output
|
|
134
|
-
manyoyo -q full -x echo "hello world"
|
|
135
|
-
manyoyo -q tip -q cmd -x echo "hello world" # Multiple quiet options
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Environment Variables
|
|
139
|
-
|
|
140
|
-
Send BASE_URL, TOKEN, etc. to the CLI in the container.
|
|
141
|
-
|
|
142
|
-
#### String Format
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
manyoyo -e "ANTHROPIC_BASE_URL=https://xxxx" -e "ANTHROPIC_AUTH_TOKEN=your-key" -x claude
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
#### File Format
|
|
149
|
-
|
|
150
|
-
Environment files use `.env` format and support comments (lines starting with `#`):
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
export ANTHROPIC_BASE_URL="https://xxxx"
|
|
154
|
-
ANTHROPIC_AUTH_TOKEN=your-key
|
|
155
|
-
# MESSAGE="Hello World" # Comments will be ignored
|
|
156
|
-
TESTPATH='/usr/local/bin'
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**Environment file path rules**:
|
|
160
|
-
- `manyoyo --ef myconfig` → loads `~/.manyoyo/env/myconfig.env`
|
|
161
|
-
- `manyoyo --ef ./myconfig.env` → loads `myconfig.env` from current directory
|
|
162
|
-
|
|
163
|
-
#### Common Examples-Claude Code
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# Create environment file directory
|
|
167
|
-
mkdir -p ~/.manyoyo/env/
|
|
168
|
-
|
|
169
|
-
# Example: Create Claude environment file
|
|
170
|
-
cat > ~/.manyoyo/env/anthropic_[claudecode]_claudecode.env << 'EOF'
|
|
171
|
-
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
|
|
172
|
-
# export CLAUDE_CODE_OAUTH_TOKEN="sk-xxxxxxxx"
|
|
173
|
-
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"
|
|
174
|
-
export API_TIMEOUT_MS=3000000
|
|
175
|
-
export ANTHROPIC_MODEL="claude-sonnet-4-5"
|
|
176
|
-
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-5"
|
|
177
|
-
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-5"
|
|
178
|
-
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
|
|
179
|
-
export CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-5"
|
|
180
|
-
EOF
|
|
181
|
-
|
|
182
|
-
# Use environment file from any directory
|
|
183
|
-
manyoyo --ef anthropic_[claudecode]_claudecode -x claude
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
#### Common Examples-Codex
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
# Create environment file directory
|
|
190
|
-
mkdir -p ~/.manyoyo/env/
|
|
191
|
-
|
|
192
|
-
# Example: Create Codex environment file
|
|
193
|
-
cat > ~/.manyoyo/env/openai_[gpt]_codex.env << 'EOF'
|
|
194
|
-
export OPENAI_BASE_URL=https://chatgpt.com/backend-api/codex
|
|
195
|
-
export OTEL_SDK_DISABLED=true
|
|
196
|
-
EOF
|
|
197
|
-
|
|
198
|
-
# Use environment file from any directory
|
|
199
|
-
manyoyo --ef openai_[gpt]_codex -x codex
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### Configuration Files
|
|
203
|
-
|
|
204
|
-
Simplify MANYOYO command-line operations. Configuration files use **JSON5 format**, which supports comments, trailing commas, and other features.
|
|
205
|
-
|
|
206
|
-
#### Configuration file path rules
|
|
207
|
-
|
|
208
|
-
- `manyoyo -r myconfig` → loads `~/.manyoyo/run/myconfig.json`
|
|
209
|
-
- `manyoyo -r ./myconfig.json` → loads `myconfig.json` from current directory
|
|
210
|
-
- `manyoyo [any option]` → always loads global configuration `~/.manyoyo/manyoyo.json`
|
|
211
|
-
|
|
212
|
-
#### Configuration Options
|
|
213
|
-
|
|
214
|
-
Refer to `config.example.json` for all available options:
|
|
215
|
-
|
|
216
|
-
```json5
|
|
217
|
-
{
|
|
218
|
-
// Container basic configuration
|
|
219
|
-
"containerName": "myy-dev", // Default container name
|
|
220
|
-
"hostPath": "/path/to/project", // Default host working directory
|
|
221
|
-
"containerPath": "/path/to/project", // Default container working directory
|
|
222
|
-
"imageName": "localhost/xcanwin/manyoyo", // Default image name
|
|
223
|
-
"imageVersion": "1.7.0-full", // Default image version
|
|
224
|
-
"containerMode": "common", // Container nesting mode (common, dind, sock)
|
|
225
|
-
|
|
226
|
-
// Environment variable configuration
|
|
227
|
-
"envFile": [
|
|
228
|
-
"claude" // Corresponds to ~/.manyoyo/env/claude.env
|
|
229
|
-
],
|
|
230
|
-
"env": [], // Default environment variables array
|
|
231
|
-
|
|
232
|
-
// Other configuration
|
|
233
|
-
"volumes": [], // Default volume mounts array
|
|
234
|
-
"shellPrefix": "", // Default command prefix
|
|
235
|
-
"shell": "", // Default execute command
|
|
236
|
-
"yolo": "", // Default YOLO mode (c, gm, cx, oc)
|
|
237
|
-
"quiet": [], // Default quiet options array (supports ["tip", "cmd"] format)
|
|
238
|
-
"imageBuildArgs": [] // Default image build arguments
|
|
239
|
-
}
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
#### Priority
|
|
243
|
-
|
|
244
|
-
- **Override parameters**: Command line > Run config > Global config > Defaults
|
|
245
|
-
- **Merge parameters**: Global config + Run config + Command line (concatenated in order)
|
|
246
|
-
|
|
247
|
-
#### Configuration Merge Rules
|
|
248
|
-
|
|
249
|
-
| Type | Parameter | Behavior | Example |
|
|
250
|
-
|------|-----------|----------|---------|
|
|
251
|
-
| Override | `containerName` | Use highest priority value | CLI `-n test` overrides config file |
|
|
252
|
-
| Override | `hostPath` | Use highest priority value | Defaults to current directory |
|
|
253
|
-
| Override | `containerPath` | Use highest priority value | Defaults to same as hostPath |
|
|
254
|
-
| Override | `imageName` | Use highest priority value | Default `localhost/xcanwin/manyoyo` |
|
|
255
|
-
| Override | `imageVersion` | Use highest priority value | e.g., `1.7.0-full` |
|
|
256
|
-
| Override | `containerMode` | Use highest priority value | `common`, `dind`, `sock` |
|
|
257
|
-
| Override | `yolo` | Use highest priority value | `c`, `gm`, `cx`, `oc` |
|
|
258
|
-
| Merge | `env` | Array concatenation | All values from global + run + CLI |
|
|
259
|
-
| Merge | `envFile` | Array concatenation | All env files loaded in order |
|
|
260
|
-
| Merge | `volumes` | Array concatenation | All volume mounts apply |
|
|
261
|
-
| Merge | `imageBuildArgs` | Array concatenation | All build args apply |
|
|
262
|
-
|
|
263
|
-
#### Common Examples-Global
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
mkdir -p ~/.manyoyo/
|
|
267
|
-
|
|
268
|
-
cat > ~/.manyoyo/manyoyo.json << 'EOF'
|
|
269
|
-
{
|
|
270
|
-
"imageName": "localhost/xcanwin/manyoyo",
|
|
271
|
-
"imageVersion": "1.7.0-full"
|
|
272
|
-
}
|
|
273
|
-
EOF
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
#### Common Examples-Claude Code
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
mkdir -p ~/.manyoyo/run/
|
|
280
|
-
|
|
281
|
-
cat > ~/.manyoyo/run/c.json << 'EOF'
|
|
282
|
-
{
|
|
283
|
-
"envFile": [
|
|
284
|
-
"anthropic_[claudecode]_claudecode" // Automatically loads ~/.manyoyo/env/claude.env
|
|
285
|
-
],
|
|
286
|
-
"yolo": "c"
|
|
287
|
-
}
|
|
288
|
-
EOF
|
|
289
|
-
|
|
290
|
-
# Use run configuration from any directory
|
|
291
|
-
manyoyo -r claude
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
#### Common Examples-Codex
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
mkdir -p ~/.manyoyo/run/
|
|
298
|
-
|
|
299
|
-
cat > ~/.manyoyo/run/codex.json << 'EOF'
|
|
300
|
-
{
|
|
301
|
-
"envFile": [
|
|
302
|
-
"openai_[gpt]_codex"
|
|
303
|
-
],
|
|
304
|
-
"volumes": [
|
|
305
|
-
"/Users/pc_user/.codex/auth.json:/root/.codex/auth.json"
|
|
306
|
-
],
|
|
307
|
-
"yolo": "cx"
|
|
308
|
-
}
|
|
309
|
-
EOF
|
|
310
|
-
|
|
311
|
-
# Use run configuration from any directory
|
|
312
|
-
manyoyo -r codex
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
### AI CLI Shortcuts (skip permissions)
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
# Claude Code
|
|
319
|
-
manyoyo -y c # or: claude, cc
|
|
320
|
-
|
|
321
|
-
# Gemini
|
|
322
|
-
manyoyo -y gm # or: gemini, g
|
|
323
|
-
|
|
324
|
-
# Codex
|
|
325
|
-
manyoyo -y cx # or: codex
|
|
326
|
-
|
|
327
|
-
# OpenCode
|
|
328
|
-
manyoyo -y oc # or: opencode
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Interactive Session Management
|
|
332
|
-
|
|
333
|
-
After exiting a container session, you'll be prompted with options:
|
|
334
|
-
|
|
335
|
-
- `y` - Keep container running in background (default)
|
|
336
|
-
- `n` - Delete the container
|
|
337
|
-
- `1` - Re-enter with the original command
|
|
338
|
-
- `x` - Execute a new command
|
|
339
|
-
- `i` - Enter interactive shell
|
|
340
|
-
|
|
341
|
-
### Container Modes
|
|
342
|
-
|
|
343
|
-
#### Docker-in-Docker Development
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
# Docker-in-Docker (safe nested containers)
|
|
347
|
-
# Create a container with Docker-in-Docker support
|
|
348
|
-
manyoyo -n docker-dev -m dind -x /bin/bash
|
|
349
|
-
|
|
350
|
-
podman ps -a # Now you can use podman commands inside the container
|
|
351
|
-
|
|
352
|
-
nohup dockerd & # Inside the container, start dockerd
|
|
353
|
-
docker ps -a # Now you can use docker commands inside the container
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
#### Mount Docker socket Development
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
# Mount Docker socket (dangerous!!! containers can access and execute everything on the host)
|
|
360
|
-
# Create a container mounting /var/run/docker.sock
|
|
361
|
-
manyoyo -n socket-dev -m sock -x /bin/bash
|
|
362
|
-
|
|
363
|
-
podman ps -a # Now you can use podman commands inside the container
|
|
364
|
-
|
|
365
|
-
docker ps -a # Now you can use docker commands inside the container
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### Command-Line Options
|
|
369
|
-
|
|
370
|
-
| Option | Aliases | Description |
|
|
371
|
-
|--------|---------|-------------|
|
|
372
|
-
| `--hp PATH` | `--host-path` | Set host working directory (default: current path) |
|
|
373
|
-
| `-n NAME` | `--cont-name` | Set container name |
|
|
374
|
-
| `--cp PATH` | `--cont-path` | Set container working directory |
|
|
375
|
-
| `-l` | `--cont-list` | List all manyoyo containers |
|
|
376
|
-
| `--crm` | `--cont-remove` | Remove container |
|
|
377
|
-
| `-m MODE` | `--cont-mode` | Set container mode (common, dind, sock) |
|
|
378
|
-
| `--in NAME` | `--image-name` | Specify image name |
|
|
379
|
-
| `--iv VERSION` | `--image-ver` | Specify image version |
|
|
380
|
-
| `--ib` | `--image-build` | Build image |
|
|
381
|
-
| `--iba` | `--image-build-arg` | Pass arguments to a Dockerfile during image build |
|
|
382
|
-
| `--irm` | `--image-remove` | Clean dangling images and `<none>` images |
|
|
383
|
-
| `-e STRING` | `--env` | Set environment variable |
|
|
384
|
-
| `--ef FILE` | `--env-file` | Load environment variables from file (supports `name` or `./path.env`) |
|
|
385
|
-
| `-v STRING` | `--volume` | Bind mount volume |
|
|
386
|
-
| `--sp CMD` | `--shell-prefix` | Temporary environment variable (prefix for -s) |
|
|
387
|
-
| `-s CMD` | `--shell` | Specify command to execute |
|
|
388
|
-
| `--` | `--ss`, `--shell-suffix` | Command arguments (suffix for -s) |
|
|
389
|
-
| `-x CMD` | `--sf`, `--shell-full` | Full command (replaces --sp, -s, and --) |
|
|
390
|
-
| `-y CLI` | `--yolo` | Run AI agent without confirmation |
|
|
391
|
-
| `--show-config` | | Print final effective config and exit |
|
|
392
|
-
| `--show-command` | | Print the command to be executed and exit (docker exec if container exists, otherwise docker run) |
|
|
393
|
-
| `--yes` | | Auto-confirm all prompts (for CI/scripts) |
|
|
394
|
-
| `--rm-on-exit` | | Auto-remove container on exit (one-time mode) |
|
|
395
|
-
| `--install NAME` | | Install manyoyo command |
|
|
396
|
-
| `-q LIST` | `--quiet` | Quiet output |
|
|
397
|
-
| `-r NAME` | `--run` | Load run configuration (supports `name` or `./path.json`) |
|
|
398
|
-
| `-V` | `--version` | Show version |
|
|
399
|
-
| `-h` | `--help` | Show help |
|
|
400
|
-
|
|
401
|
-
## Additional Information
|
|
402
|
-
|
|
403
|
-
### Default Configuration
|
|
404
|
-
|
|
405
|
-
- **Container Name**: `myy-{MMDD-HHMM}` (auto-generated based on current time)
|
|
406
|
-
- **Host Path**: Current working directory
|
|
407
|
-
- **Container Path**: Same as host path
|
|
408
|
-
- **Image**: `localhost/xcanwin/manyoyo:xxx`
|
|
409
|
-
|
|
410
|
-
### Requirements
|
|
411
|
-
|
|
412
|
-
- Node.js >= 22.0.0
|
|
413
|
-
- Podman or Docker
|
|
414
|
-
|
|
415
|
-
### Uninstall
|
|
416
|
-
|
|
417
|
-
```bash
|
|
418
|
-
npm uninstall -g @xcanwin/manyoyo
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
## Troubleshooting FAQ
|
|
422
|
-
|
|
423
|
-
### Image Build Failed
|
|
424
|
-
|
|
425
|
-
**Problem**: Error when running `manyoyo --ib`
|
|
426
|
-
|
|
427
|
-
**Solutions**:
|
|
428
|
-
1. Check network connection: `curl -I https://mirrors.tencent.com`
|
|
429
|
-
2. Check disk space: `df -h` (need at least 10GB free space)
|
|
430
|
-
3. Use `--yes` to skip confirmation: `manyoyo --ib --iv 1.7.0 --yes`
|
|
431
|
-
4. If outside China, you may need to change mirror source (set `nodeMirror` in config file)
|
|
432
|
-
|
|
433
|
-
### Image Pull Failed
|
|
434
|
-
|
|
435
|
-
**Problem**: Error `pinging container registry localhost failed`
|
|
436
|
-
|
|
437
|
-
**Solutions**:
|
|
438
|
-
1. Local images need to be built first: `manyoyo --ib --iv 1.7.0`
|
|
439
|
-
2. Or modify `imageVersion` in config file `~/.manyoyo/manyoyo.json`
|
|
440
|
-
|
|
441
|
-
### Container Startup Failed
|
|
442
|
-
|
|
443
|
-
**Problem**: Container won't start or exits immediately
|
|
444
|
-
|
|
445
|
-
**Solutions**:
|
|
446
|
-
1. View container logs: `docker logs <container-name>`
|
|
447
|
-
2. Check port conflicts: `docker ps -a`
|
|
448
|
-
3. Check permission issues: Ensure current user has Docker/Podman permissions
|
|
449
|
-
|
|
450
|
-
### Permission Denied
|
|
451
|
-
|
|
452
|
-
**Problem**: Error `permission denied` or cannot access Docker
|
|
453
|
-
|
|
454
|
-
**Solutions**:
|
|
455
|
-
1. Add user to docker group: `sudo usermod -aG docker $USER`
|
|
456
|
-
2. Re-login or run: `newgrp docker`
|
|
457
|
-
3. Or run commands with `sudo`
|
|
458
|
-
|
|
459
|
-
### Environment Variables Not Working
|
|
460
|
-
|
|
461
|
-
**Problem**: Container cannot read configured environment variables
|
|
462
|
-
|
|
463
|
-
**Solutions**:
|
|
464
|
-
1. Check env file format (supports `KEY=VALUE` or `export KEY=VALUE`)
|
|
465
|
-
2. Verify file path is correct (`--ef name` corresponds to `~/.manyoyo/env/name.env`)
|
|
466
|
-
3. Use `--show-config` to view final effective configuration
|
|
467
|
-
|
|
468
|
-
## License
|
|
469
|
-
|
|
470
|
-
MIT
|