c456-cli 0.3.0 → 0.5.0

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 CHANGED
@@ -18,7 +18,7 @@ C456 命令行工具:通过 **HTTP API v1** 读写收录、打法等数据,
18
18
 
19
19
  **[私人知识库:用 AI 客户端使用 C456](https://github.com/xiaohui-zhangxh/c456-cli/blob/main/docs/private-knowledge-base.md)**(克隆仓库后也可打开 [`docs/private-knowledge-base.md`](./docs/private-knowledge-base.md))
20
20
 
21
- 该流程会串联:**注册 C456 → 安装配置 c456-cli → 安装 [Karpathy Wiki](https://github.com/baklib-tools/skills/tree/main/skills/karpathy-wiki) 技能 → 安装 [c456-llm-wiki](https://github.com/xiaohui-zhangxh/c456-cli/tree/main/skills/c456-llm-wiki) 双向同步规范**。
21
+ 该流程会串联:**注册 C456 → 安装配置 c456-cli → 安装三个 Agent 技能**(`karpathy-wiki`、`c456-llm-wiki`、`c456-cli`,详见 [`docs/private-knowledge-base.md`](./docs/private-knowledge-base.md) §3)→ 初始化知识库目录。
22
22
 
23
23
  ## 安装
24
24
 
@@ -35,6 +35,24 @@ npx c456-cli --help
35
35
  bunx c456-cli --help
36
36
  ```
37
37
 
38
+ ### Agent 技能(`c456 skill install`)
39
+
40
+ 已全局安装 **c456-cli** 且本机可用 **`npx`** 后,在**目标项目根**执行:
41
+
42
+ ```bash
43
+ c456 skill install
44
+ ```
45
+
46
+ 封装 **`npx skills add`** 从 GitHub 拉取技能。默认只装 **c456-cli**,**`--with-wiki`** 会依次装 **karpathy-wiki**、**c456-llm-wiki** 与 **c456-cli**,适合私人知识库一条命令装齐(见 [private-knowledge-base.md §3](./docs/private-knowledge-base.md))。
47
+
48
+ 常用参数(透传给 `skills add`):
49
+
50
+ - **`--with-wiki`**:额外安装 karpathy-wiki + c456-llm-wiki
51
+ - **`-C, --cwd <path>`**:在哪个目录下解析「项目级」安装(默认当前目录;具体路径由 skills CLI 决定)
52
+ - **`-g, --global`**:用户级技能目录
53
+ - **`-a, --agent`**:目标 Agent(如 `cursor`、`claude-code` 等),默认 `cursor`;与 `skills add` 一致
54
+ - **`--copy`**:复制文件而非 symlink
55
+
38
56
  ## 配置
39
57
 
40
58
  ### API Key
@@ -77,7 +95,7 @@ c456 -B https://your-c456.example.com intake list
77
95
  c456 config show
78
96
  ```
79
97
 
80
- 配置文件遵循 XDG:默认 `~/.config/c456/config.json`(可通过 `XDG_CONFIG_HOME` 调整)。**请勿将含密钥的文件提交到仓库**;密钥等效于账户凭据。
98
+ 配置文件分两层:**用户全局**(XDG,默认 `~/.config/c456/config.json`,可用 `XDG_CONFIG_HOME` 调整)与**项目目录**(自当前工作目录向上查找 `.c456-cli/config.json`,命中则与全局合并,项目覆盖全局)。`c456 config set-key` / `set-url` 默认写入当前解析到的项目文件;若未找到 `.c456-cli` 则写入**当前目录**下新建的 `.c456-cli/config.json`。写入全局请加 **`c456 config … -g`**。可用环境变量 **`C456_WORKSPACE`** 指定工作区根(绝对路径),无需依赖目录遍历。**请勿将含密钥的文件提交到仓库**;密钥等效于账户凭据。
81
99
 
82
100
  ## 全局选项
83
101
 
@@ -132,6 +150,55 @@ c456 asset fingerprint --body-file ./note.md
132
150
 
133
151
  规格见 C456 主仓 [`docs/20-engineering/specs/api-v1.md`](https://github.com/xiaohui-zhangxh/c456/blob/main/docs/20-engineering/specs/api-v1.md) 与 [`docs/10-product/experience/media-library-v1.md`](https://github.com/xiaohui-zhangxh/c456/blob/main/docs/10-product/experience/media-library-v1.md)。
134
152
 
153
+ ## 浏览器与截图(系统 Chrome,不强制 Chromium 模块)
154
+
155
+ c456-cli 依赖 **`playwright-core`** 通过 **Chrome DevTools Protocol** 连接**本机已安装的 Google Chrome / Chromium**,**不会**在安装 CLI 时自动下载 Playwright 自带的浏览器二进制。适合为工具/渠道介绍截产品页:先长期会话登录,再多次截图。
156
+
157
+ ### 你需要什么
158
+
159
+ - **推荐**:安装 [Google Chrome](https://www.google.com/chrome/)(macOS / Windows / Linux 常见路径会自动探测)。
160
+ - **可选**:若无系统 Chrome,可自行安装 Playwright 提供的 Chromium,并把可执行路径设为环境变量 **`CHROME_PATH`**(详见 `c456 screenshot --help` 失败时的终端提示)。文档建议:`npx playwright install chromium` 后,用 `node -e "console.log(require('playwright').chromium.executablePath())"` 取路径再 `export CHROME_PATH=...`(需额外安装 npm 包 **`playwright`** 才能调用 `executablePath`,**非** `c456-cli` 的硬依赖)。
161
+
162
+ ### 持久会话(保留登录态)
163
+
164
+ 用户数据目录默认 **`~/.cache/c456-cli/chrome-profile`**(若设置 **`XDG_CACHE_HOME`**,则为 `$XDG_CACHE_HOME/c456-cli/chrome-profile`)。同一目录多次 `browser start` 可复用 Cookie。
165
+
166
+ ```bash
167
+ # 选空闲端口启动有头 Chrome,并写入 ~/.cache/c456-cli/browser-daemon.json
168
+ c456 browser start
169
+
170
+ # 在弹出的窗口里登录目标站点(若需要)
171
+
172
+ # 复用该实例截图(默认加载后再等 3s 再截,可用 --wait-after-load 0 取消)
173
+ c456 screenshot "https://example.com/app" -o ./.tmp/example.png
174
+
175
+ # github.com 仓库页:默认隐藏 README 上方的「文件与目录」表格,便于首屏突出说明文档;需要保留表格时加 --keep-github-files-table
176
+ c456 screenshot "https://github.com/owner/repo" -o ./.tmp/repo.png
177
+
178
+ # 调试:截图前后在终端按 Enter,期间保留标签页便于在 DevTools 里看 DOM(需交互式终端)
179
+ c456 screenshot "https://github.com/owner/repo" -o ./.tmp/repo.png --pause
180
+
181
+ # 用完关闭并释放记录
182
+ c456 browser stop
183
+ ```
184
+
185
+ 查看是否在运行:`c456 browser status`。
186
+
187
+ ### 一次性截图(临时 profile,用完即删)
188
+
189
+ 未执行 `browser start` 或希望强制独立会话时:
190
+
191
+ ```bash
192
+ c456 screenshot "https://example.com" -o ./.tmp/once.png --viewport 1280x720
193
+ # 加载后等待毫秒数(默认 3000;不需要等待时传 0)
194
+ c456 screenshot "https://example.com" -o ./.tmp/once.png --wait-after-load 0
195
+ c456 screenshot "https://example.com" -o ./.tmp/once.png --no-reuse
196
+ # 省略 -o:按 URL 生成安全文件名 + 本地时间戳,写入当前目录(如 example.com-app_20260512-153045.png)
197
+ c456 screenshot "https://example.com/app/dashboard"
198
+ ```
199
+
200
+ 随后照常 `c456 asset upload -f ./.tmp/once.png` 取得 `markdownSnippet`,写入收录正文的 `--body-file`。
201
+
135
202
  ### 资料抓取(fetch)
136
203
 
137
204
  ```bash