@liuzijian625/code-cli 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "@liuzijian625/code-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "AI CLI 配置管理工具 - 管理 Codex、Claude Code、Gemini CLI 的配置",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
7
7
  "code-cli": "bin/cli.js"
8
8
  },
9
+ "files": [
10
+ "bin/",
11
+ "lib/",
12
+ "remote-server/main.go",
13
+ "remote-server/go.mod",
14
+ "remote-server/README.md"
15
+ ],
9
16
  "scripts": {
10
17
  "test": "echo \"Error: no test specified\" && exit 1"
11
18
  },
@@ -0,0 +1,56 @@
1
+ # code-cli 远程预设服务(Go 单二进制)
2
+
3
+ 这个服务用于在一台公网服务器上集中维护加密后的 `presets.enc`,并提供网页在线预览/编辑;各台机器的 `code-cli` 每次从远程拉取 `presets.enc`,用同一套密码解密后应用配置。
4
+
5
+ ## 构建
6
+
7
+ 在有 Go 的机器上构建出单个可执行文件:
8
+
9
+ ```bash
10
+ cd remote-server
11
+ go build -o code-cli-remote .
12
+ ```
13
+
14
+ 把 `code-cli-remote` 拷贝到服务器即可部署(运行时不依赖其它文件,只有你指定的 `config` / `data` 会落盘)。
15
+
16
+ ## 启动
17
+
18
+ ```bash
19
+ ./code-cli-remote -listen :8080
20
+ ```
21
+
22
+ 打开浏览器访问 `http://<服务器>:8080/`:
23
+
24
+ - 第一次打开:会提示你设置密码(同一套密码:网页登录 + presets 文件加密),并自动创建 `config` 和加密后的 `presets.enc`(默认写在可执行文件同目录)
25
+ - 之后:使用该密码登录即可预览/编辑/保存
26
+
27
+ 页面会显示并提供“一键复制”远程拉取 URL:`http(s)://<服务器>:8080/presets.enc`
28
+
29
+ 如需自定义文件路径:
30
+
31
+ ```bash
32
+ ./code-cli-remote -listen :8080 -config /path/to/code-cli-remote.json -data /path/to/presets.enc
33
+ ```
34
+
35
+ ## (可选)命令行初始化
36
+
37
+ 如果你不想通过网页初始化,也可以用命令行初始化:
38
+
39
+ ```bash
40
+ export CODECLI_REMOTE_PASSWORD='your-strong-password'
41
+ ./code-cli-remote -init -config ./code-cli-remote.json -data ./presets.enc
42
+ ```
43
+
44
+ ## 配置到各台机器(code-cli)
45
+
46
+ 在每台机器运行 `code-cli`:
47
+
48
+ - 进入 `远程配置`
49
+ - 设置远程 URL 为上面的 `.../presets.enc`
50
+ - 设置/保存密码(本机加密保存)
51
+ - 然后用 `应用远程配置` 来选择预设并应用
52
+
53
+ ## 安全建议
54
+
55
+ - 强烈建议配合 HTTPS(例如用 Nginx/Caddy 反代到 `:8080`),避免密码在公网明文传输。
56
+ - `presets.enc` 本身是密文(即使被下载也需要密码解密),但仍建议使用强密码并限制服务器访问来源(防火墙/安全组)。
@@ -0,0 +1,3 @@
1
+ module code-cli-remote
2
+
3
+ go 1.22