Skip to content

fix: 理顺首次使用路径(CLI 提示、recommend 危机转介、hook 精简、文档纠错) - #298

Merged
xr843 merged 12 commits into
mainfrom
fix/first-run-ux
Oct 3, 2026
Merged

xr843 merged 12 commits into
mainfrom
fix/first-run-ux

Conversation

@xr843

@xr843 xr843 commented Oct 3, 2026

Copy link
Copy Markdown
Owner

第一次使用的人遇到的几处断点:README 说三种教学模式在 fojin.app/chat 可用(实际网页只有 15 位祖师的单人对话),「你的状况」表混着并不存在的 /虚云 /印光 等中文命令;install 之后只打印 ✓ name → path,doctor 在什么都没装时报 Status: ok;list 显示给模型看的触发词,三个教学模式的描述还带着一个没剥掉的 ';拼错技能名或命令没有任何提示;recommend 对「最近焦虑睡不着」「家人去世很难过」和英文问题都静默回退到默认配对,对「我不想活了」也照样推荐祖师。

CLI:install 结束时给出下一步(新会话、/master-help 或刚装的祖师、Codex / Gemini 不读 ~/.claude/skills/)。doctor 无安装时打印带安装命令的 warning,status 与退出码仍为 ok(桌面端读 status == "ok" 作 runtime_ok,--json 只新增 warnings)。list 改显示祖师名 · 传统 · 宗派 · 年代(meta.json,即 inspect 的来源)和 catalog 里新加的教学模式 summary;--json 只加 displayName / summary。frontmatter 读取改为正确处理单 / 双引号标量与折行(新测试抓到第一版对 '' 转义的 bug)。未知技能名与命令按编辑距离给 did-you-mean。

recommend:routing.json 新增 crisis 层,最先检查;命中「自杀 / 不想活 / kill myself」等只输出急救与心理援助热线(中国大陆 12356、findahelpline.com、美国 988),不给任何祖师或模式。新增焦虑失眠、丧亲悲伤两个状况行,并附一句专业求助提示。无汉字且无命中的查询明说「按中文关键词匹配」并指向 /master-help。master-help 同步第 0 步与新行,validate-routing.py 校验两者一致。

SessionStart hook:Claude Code 插件实测会把 20 个 skill 的名字与描述交给模型,hook 再列一遍是重复。Claude Code 现在只收到一行指引,由 bash 在查找 Python 之前直接输出;Cursor 的 manifest 只指向 ./prebuilt/(create-master 别处没有宣告,且其发现机制从未实测)以及无法识别的宿主保留完整列表。/master-debate 不再写成固定 4 轮(huineng-vs-tsongkhapa / ouyi-vs-tsongkhapa 默认 5 轮)。

文档:troubleshooting 改为 update --dry-run / --force(不再建议手删目录丢掉安装记录),离线标注改为实际的「FoJin 暂不可达,以下为离线资料」(原文「当前使用离线片段」在 prebuilt 中 0 处),fidelity 下限统一为「至少 5 条、≥1 boundary,现有祖师均 10+」(与 validate-fidelity.py 一致),新增 Codex / Gemini 看不到 skill、缺 pypinyin、命令找不到等条目。桌面管理器一节移到 docs/desktop*.md(macOS 仅 Apple Silicon)。docs/PRD.md 加注已成历史、以 v1-framework-roadmap.md 为准。SECURITY.md 写明安装器威胁模型:已能写入 skills 目录的攻击者不在范围内,不再追加竞态加固。

验证

  • npm test:全部结构门禁(含 validate-routing.py:3 mode rules、6 situations、19 topic pairings)、121 个 CLI 测试、1408 个 Python 测试通过,退出码 0;本地跳过 2 个真实 Promptfoo 集成用例。
  • npm run test:hook:29 + 7 + 2 通过,退出码 0(test_run_hook_cmd.sh 在 WSL 下经 cmd.exe 实跑)。新增 Case 22/23:Claude 载荷等于 Python 中的 CLAUDE_POINTER、< 300 字节、不含祖师列表;Cursor 仍含 /create-master 与 /master-huineng。
  • 新增 11 个 CLI 用例:安装提示、无安装 doctor warning、五种 frontmatter 标量、list 摘要与 --json 兼容、技能名 / 命令 did-you-mean、焦虑 / 丧亲路由、危机输入不出现任何 /master-、英文无命中。
  • hook 实测(CLAUDE_PLUGIN_ROOT 指向仓库):additionalContext 1,548 → 175 UTF-8 字节,整段 JSON 2,134 → 258 字节。
  • 前后对照(main 852c6b4 的 git archive vs 本分支,均用临时 HOME):
# before
  master-debate          'Use when user explicitly asks for an adversarial / multi-round dialectic bet...
  ✗ huineg — not found in skill catalog
Unknown command: instal
Status: ok                                   # 0 个已安装
$ recommend "我不想活了"   → /master-kumarajiva /master-yinguang(默认配对)
$ recommend "how do I meditate" → /master-kumarajiva /master-yinguang(默认配对)

# after
  master-debate          祖师对辩:默认 4 轮(部分配对 5 轮)立论→反驳→回应→综合 / multi-round dialectic
  ✓ huineng → …/master-huineng

Next (Claude Code / OpenCode):
  1. Open a new session if a session that was already running does not list the new skills.
  2. Call it in the chat: /master-huineng
  ✗ huineg — not found in skill catalog — did you mean huineng?
Unknown command: instal
Did you mean: master-skill install?
  ! No master-skill skills are installed in …/.claude/skills — run: npx master-skill install --all (…)
Status: ok, 1 warning(s)
$ recommend "最近焦虑睡不着" → /master-ajahn-chah /master-mahasi-sayadaw /master-zhiyi + 专业求助提示
$ recommend "家人去世很难过" → /master-ajahn-chah /master-yinguang + 专业求助提示
$ recommend "我不想活了"   → 只输出 110/120、12356、findahelpline.com、988,无祖师
$ recommend "how do I meditate" → No match. recommend matches Chinese keywords … ask /master-help

所有安装测试使用临时 HOME,不触碰实际技能安装。未运行付费模型评测,未发布。12356 热线号码与网页版功能范围请维护者再确认一次。

Comment thread tests/cli.test.mjs Fixed
Comment thread tests/cli.test.mjs Fixed
xr843 added 12 commits October 3, 2026 14:24
- list shows a human summary (persona name/tradition/school/era from
  meta.json, catalog summary for modes and the generator) instead of the
  model-facing trigger text; --json adds displayName/summary only
- frontmatter reader unquotes single- and double-quoted scalars and folds
  continuation lines, so descriptions no longer leak a leading quote
- install ends with a next-step hint (new session, /master-help or the
  installed persona, Codex/Gemini pointer)
- doctor with nothing installed prints a warning with the install command;
  status and exit code stay ok
- unknown skill names and commands suggest the closest match
…ments

- crisis keywords (自杀/不想活/kill myself...) are checked first and get a
  referral to emergency and crisis lines, never a master
- new situations rows for anxiety/insomnia and grief, each with a line
  pointing to professional help
- an English query with no keyword hit now says matching is Chinese-based
  and points to /master-help instead of presenting the default pairing
- master-help mirrors the crisis step and new rows; validate-routing checks
  both
Claude Code registers all 20 plugin skills and shows the model their names
and descriptions itself; the SessionStart hook repeated that list in 1,548
UTF-8 bytes of context (2,134 bytes of JSON) at every startup/clear/compact.
Claude Code now gets a 175-byte pointer to /master-help, emitted by the bash
hook before any python interpreter is looked up. Cursor (manifest exposes
only ./prebuilt/, so create-master is announced nowhere else; discovery
never measured) and unidentified hosts keep the full list.

Also stop describing master-debate as fixed 4 rounds: some pairs default
to 5 (master-debate/meta.json per_pair_overrides).
- fojin.app/chat offers single-master conversation; the three teaching
  modes need a terminal install
- 「你的状况」 table uses real /master-<name> commands in both languages,
  plus a crisis-help line
- desktop section moves to docs/desktop*.md (maintainer tool; macOS builds
  are Apple Silicon only)
- replace 'delete ~/.claude/skills/master-<name>/' with update --dry-run /
  --force, which keep install records and local-edit detection
- quote the real offline marker (FoJin 暂不可达,以下为离线资料)
- state the fidelity minimum (5 cases, >=1 boundary; shipped masters 10+)
  the same way in troubleshooting and CONTRIBUTING; link CONTRIBUTING
  instead of a dangling 'see below'
- add Codex/Gemini discovery, missing pypinyin, command-not-found and
  recommend-language entries
- PRD header points to v1-framework-roadmap.md as current
CodeQL js/regex/missing-regexp-anchor flagged the URL pattern.
CodeQL js/incomplete-url-substring-sanitization flagged the includes().
- recommend: romanized terms (nianfo, lamrim, huatou …) expand to Chinese
  keywords; ASCII keywords match whole words so self-harmony no longer
  trips self-harm; kind none carries no command (master-help would loop)
  and master-help now asks a clarifying question for it; crisis output
  adds a pointer for doctrinal questions after the referral
- test every documented recommend example routes somewhere
- install hint names the requested skill, not a pulled-in dependency
- frontmatter: comments after plain scalars, \uXXXX / standard escapes,
  escaped line breaks, block indentation and chomping; cases checked
  against PyYAML
- did-you-mean uses OSA distance (lsit -> list) and answers
  instal --dry-run instead of the dry-run refusal
@xr843
xr843 force-pushed the fix/first-run-ux branch from 3edbe87 to 95b5e60 Compare October 3, 2026 06:26
@xr843

xr843 commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

按复审意见修复并 rebase 到 origin/main(含 #299):罗马字术语扩展(nianfo/lamrim/huatou…)与英文整词匹配(self-harmony 不再命中 self-harm);kind none 不再返回 /master-help,master-help 改为自行澄清;危机输出先转介、再给教理问题的去处;安装提示用用户点名的技能;frontmatter 注释/转义/续行/块缩进按 PyYAML 结果测试;did-you-mean 用 OSA 距离并接住 instal --dry-run;新增文档 recommend 示例全量回归测试。验证:python3 scripts/run-gates.py 23/23、CLI 126/126、hook 29+7+2,均退出码 0;CI 全绿(含 Windows CLI、CodeQL 无告警)。

@xr843
xr843 merged commit 0b2db65 into main Oct 3, 2026
16 checks passed
@xr843
xr843 deleted the fix/first-run-ux branch October 3, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants