# 更新法信 Skill / Update Faxin Skill

从发布站安装的 Codex、WorkBuddy 和 Claude Code 用户，重新运行原客户端的安装命令即可更新。工具不会自动更新，也不通过 `npm update -g faxin-cli` 更新。

本批发布版本为 **0.6.1（安装分发 r1）**，改善连接恢复、部分登录结果保留和经许可的 Skill 代办诊断。实际可安装版本以 [release.json](https://faxin.david-legal.com/release.json) 为准，完整变化见[版本记录](https://faxin.david-legal.com/#changelog)。

更新后可用 `faxin fatong` 检索域外法律中文译本、国内涉外法规、港澳法规、国别指南、涉外法律服务案例、机构、公证员及公开新闻八类资料，读取结构化资料详情与可用 PDF，并查看资源链接、字典和分项统计。法通公开查询无需法信授权，也不读取法信凭据；原有法信查询继续使用本人上海律协授权。译本可能是历史版本，法通服务案例不是裁判文书；AI 对话、咨询提交等写入功能与扫描件 OCR 未接入。

## 让 AI 帮你更新

> 请按 https://faxin.david-legal.com/update.md 更新我当前客户端的 faxin-cli。先确认实际技能目录、操作系统和架构，保留原客户端目录环境变量与自定义安装路径。核对默认授权目录或 FAXIN_CONFIG_DIR 的实际路径不等于技能目录、也不在技能目录内部；若重叠，先在本机将授权目录迁移到独立位置，更新 FAXIN_CONFIG_DIR 并告知我新位置，完成前不要运行安装器。不要读取授权文件内容或上传授权。然后重新运行对应安装命令，用安装器显示的 bin/faxin.cmd 或 bin/faxin 执行 --version 和 help，确认 cli_version 与发布清单一致。不要运行 npm，不要为验证更新而登录，也不要索要密码或令牌。

## 1. 保留原安装位置

使用与原安装相同的客户端。默认目录如下；安装器会显示最终位置。

| 客户端 | 默认技能目录 | 自定义配置目录变量 |
| --- | --- | --- |
| Codex | `~/.codex/skills/faxin-cli` | `CODEX_HOME` |
| WorkBuddy | `~/.workbuddy/skills/faxin-cli` | `WORKBUDDY_CONFIG_DIR` |
| Claude Code | `~/.claude/skills/faxin-cli` | `CLAUDE_CONFIG_DIR` |

若原安装使用环境变量，更新时继续保留相同变量。若使用自定义目标目录，Windows 继续传入相同的 `-Destination`，macOS / Linux 继续传入相同的 `--dest`，否则可能安装到另一个目录。需要自定义运行环境的，也保留原有 `FAXIN_RUNTIME_ROOT` 或 `FAXIN_NODE` 设置。

默认授权目录 `~/.config/faxin-cli` 位于默认技能目录之外。如果设置了 `FAXIN_CONFIG_DIR` 或自定义技能目录，更新前核对两者的实际路径：授权目录不能等于技能目录，也不能位于其中。若重叠，先在本机将授权目录迁移到独立位置，并在实际运行客户端中更新 `FAXIN_CONFIG_DIR`，告知使用者新位置后再更新 Skill；不要读取授权文件内容或上传授权。否则安装器会将授权随旧 Skill 移入备份，原配置路径将不再指向这些授权文件。

## 2. 重新运行对应安装命令

### Windows 11：PowerShell

打开 Windows 终端的 **PowerShell**（5.1 或 7），运行原客户端的命令。无需管理员权限或修改执行策略。

```powershell
# Codex
& ([scriptblock]::Create((irm https://faxin.david-legal.com/install.ps1))) -Client codex

# WorkBuddy
& ([scriptblock]::Create((irm https://faxin.david-legal.com/install.ps1))) -Client workbuddy

# Claude Code
& ([scriptblock]::Create((irm https://faxin.david-legal.com/install.ps1))) -Client claude
```

自定义目录示例：将客户端和路径换成原安装值。

```powershell
& ([scriptblock]::Create((irm https://faxin.david-legal.com/install.ps1))) -Client codex -Destination 'D:\我的技能\faxin-cli'
```

### macOS / Linux：终端

```sh
# Codex
curl -fsSL https://faxin.david-legal.com/install.sh | sh -s -- --client codex

# WorkBuddy Desktop（macOS）
curl -fsSL https://faxin.david-legal.com/install.sh | sh -s -- --client workbuddy

# Claude Code
curl -fsSL https://faxin.david-legal.com/install.sh | sh -s -- --client claude
```

自定义目录示例：将客户端和路径换成原安装值。

```sh
curl -fsSL https://faxin.david-legal.com/install.sh | sh -s -- --client codex --dest '/绝对路径/faxin-cli'
```

安装器验证安装包后，将旧技能目录保存为同级的 `.backup-时间戳` 备份，再启用新版本。无需额外的强制覆盖参数。授权目录位于技能目录之外时，更新不会复制、清除或上传其中的凭据；默认位置为 `~/.config/faxin-cli`，可由 `FAXIN_CONFIG_DIR` 指定。技能目录备份不包含外置授权目录。

## 3. 验证实际使用的入口

使用安装器显示的 **命令入口**，避免误查另一个全局安装。以下路径必须替换成自己的实际路径。

```powershell
# Windows PowerShell
& 'C:\你的技能目录\faxin-cli\bin\faxin.cmd' --version
& 'C:\你的技能目录\faxin-cli\bin\faxin.cmd' help
```

```sh
# macOS / Linux
'/你的技能目录/faxin-cli/bin/faxin' --version
'/你的技能目录/faxin-cli/bin/faxin' help
```

`--version` 返回 `cli_version` 和源文件指纹；安装 0.6.1 批次时应看到 `cli_version: "0.6.1"`，并与当前清单一致。0.4.0 及更早版本不提供版本输出；`help` 只能验证能否启动。如果仍只看到旧版帮助，核对安装器显示的下载版本和实际启动路径，再确认是否更新到了原 Skill 目录，不要把帮助页成功打开当作升级完成。

完成后开启新的 AI 对话，让客户端重新读取 Skill。WorkBuddy 可在「技能」中确认启用状态，必要时重启客户端。安装验证不需要账号、密码或真实检索；仅在你之后请求法信检索时，才按需检查或重新登录自己的授权。法通公开查询无需登录。

## 出错时让 Skill 代办诊断

告诉 Skill：“请先说明检查范围，征得我同意后，替我检查这次错误并解释结果。”无需自己复制终端命令。

Skill 应先保存原错误的运行编号，说明将检查运行环境、用临时合成数据检查存储并整理原故障记录；得到许可后执行检查、读取报告，用普通话说明正常和失败环节、尚不能确定的原因及下一步。检查不读取或提交账号密码、不替换已有授权；没有发生错误环境的访问能力时，应如实说明，不能声称已检查。

默认离线检查。若需要联网，Skill 须说明将向律协和法信入口发送不带登录信息的连接检查并取得许可；仅同意离线检查时不能联网。检查成功不代表账号权限有效，也不能证明法通连接正常。诊断不包含重新登录，不需要为了补日志反复输入密码。

日志只保存在本机，每个日志目录保留最近 20 次运行、单次最多 256 KiB。支持文件经字段筛选，不含密码、Cookie、令牌、检索词、案件正文或完整本机路径，但保留系统、版本和操作时间。先查看文件；分享时须另行说明文件和接收方并征得许可，不自动上传。不要分享整个授权目录、原始终端记录或录屏。Skill 的具体执行流程见安装包内 references/troubleshooting.md。

## English

Users who installed from this site can update by rerunning the installer for the **same client and destination**. Updates are not automatic, and `npm update -g faxin-cli` is not the update method.

This release batch is **0.6.1 (distribution r1)**, improving connection recovery, partial sign-in results and consent-based Skill-assisted diagnostics. The installable version is the one in [release.json](https://faxin.david-legal.com/release.json). See the [version history](https://faxin.david-legal.com/#changelog) for the complete changes.

After updating, `faxin fatong` searches eight public collections: foreign-law translations, Chinese cross-border laws, Hong Kong and Macao laws, country guides, legal-service cases, organizations, notaries and public news. Structured collections provide details and available PDFs; the CLI also lists resource links, platform dictionaries and individual statistics. Public Fatong queries need no Faxin authorization and do not read Faxin credentials. Faxin research still uses each user's own eligible Shanghai Bar account. Translations may be historical, and Fatong legal-service cases are not court judgments. Fatong AI dialogue, consultation submissions and scanned-PDF OCR are not integrated.

### Ask your AI to update

> Follow https://faxin.david-legal.com/update.md to update faxin-cli for my current client. Confirm the actual skill directory, operating system and architecture, and preserve my client-directory environment variables and custom destination. Check that the resolved default credential path or FAXIN_CONFIG_DIR is neither the skill directory nor inside it. If they overlap, first relocate the credential directory locally to a separate location, update FAXIN_CONFIG_DIR and tell me the new location; do not run the installer until that is complete. Do not read credential-file contents or upload credentials. Then rerun the corresponding installer and use the installed bin/faxin.cmd or bin/faxin launcher to run --version and help, confirming cli_version matches the published manifest. Do not run npm, sign in to test the update, or request passwords or tokens.

### Keep the same location and rerun the installer

Use the Windows PowerShell or macOS / Linux commands above, selecting `codex`, `workbuddy` or `claude`. WorkBuddy Desktop supports Windows and macOS. The default skill locations and configuration variables are listed in the table above. Keep any existing `CODEX_HOME`, `WORKBUDDY_CONFIG_DIR` or `CLAUDE_CONFIG_DIR` settings, and pass the same `-Destination 'C:\path\faxin-cli'` on Windows or `--dest '/absolute/path/faxin-cli'` on macOS / Linux if you originally chose a custom directory. Also preserve custom `FAXIN_RUNTIME_ROOT` or `FAXIN_NODE` settings when applicable.

The default credential directory, `~/.config/faxin-cli`, is outside the default skill directories. If you set `FAXIN_CONFIG_DIR` or chose a custom skill folder, check their resolved paths before updating: the credential directory must not equal or be inside the skill folder. If they overlap, first relocate credentials locally to a separate directory, update `FAXIN_CONFIG_DIR` in the client that runs the Skill and tell the user the new location. Do not read credential-file contents or upload credentials. Otherwise, the installer will move those files into the old skill backup and the original credential path will no longer find them.

No npm, force flag, administrator access or execution-policy change is required. After checking the package, the installer saves the previous skill directory beside it with a `.backup-<timestamp>` suffix and activates the new installation. Credentials stored outside the skill directory are not copied, deleted or uploaded during an update. Their default location is `~/.config/faxin-cli`, configurable through `FAXIN_CONFIG_DIR`. A skill backup does not include an external credential directory.

### Verify and reload the Skill

Use the exact **CLI** path printed by the installer: `bin/faxin.cmd` on Windows or `bin/faxin` on macOS / Linux. Run `--version` and `help` using the quoted-path examples above. A 0.6.1 installation should report `cli_version: "0.6.1"`, matching the published manifest; the output also includes a source fingerprint. CLI 0.4.0 and earlier do not provide version output. Their `help` command only checks startup. If you still see the old help output, check the installer's download version and launcher path, and confirm that you updated the original skill directory. Opening help alone does not prove the update succeeded.

Start a new AI conversation after updating. In WorkBuddy, check that the Skill is enabled and restart the client if necessary. Update verification needs no account, password or live query. Faxin authorization is checked only when you later request Faxin research; public Fatong queries need no sign-in.

### Ask the Skill to diagnose an error

Ask: “Explain the checks first, then with my consent diagnose this error and explain the findings.” You do not need to copy terminal commands. The Skill should preserve the original incident run ID, explain the environment and synthetic-storage checks, obtain consent, run the checks, read the reports and explain what passed, what failed, what remains uncertain and the next step. It must disclose missing access rather than claim checks were performed.

Checks are offline by default. Credential-free connectivity probes to Shanghai Bar and Faxin require consent; offline consent does not authorize network checks. Diagnostics do not submit passwords, replace existing credentials, establish account permissions or authorize another sign-in. Current connectivity checks do not cover Fatong.

Diagnostic logs stay local, retaining up to 20 runs per directory and 256 KiB per run. Filtered support files exclude passwords, cookies, tokens, queries, document text and full local paths, but retain system, version and operation-time information. Review files before sharing. Sending a file requires separate permission identifying the file and recipient; nothing is uploaded automatically. Do not share credential folders, raw terminal transcripts or recordings. Skill execution instructions are in the installed references/troubleshooting.md.

For a first installation or removal instructions, see the [installation guide](https://faxin.david-legal.com/install.md).
