feat: add /reload-skills slash command (CLI + Web UI)#1057
Open
jarvis24young wants to merge 1 commit into
Open
feat: add /reload-skills slash command (CLI + Web UI)#1057jarvis24young wants to merge 1 commit into
jarvis24young wants to merge 1 commit into
Conversation
jarvis24young
added a commit
to jarvis24young/BitFun
that referenced
this pull request
Jun 3, 2026
The CI run for PR GCWing#1057 failed on the i18n audit subtest 'i18n audit can emit a machine-readable governance report': [i18n:audit] ERROR src/web-ui/src/flow_chat/components/ChatInput.tsx has 5 literal i18next defaultValue fallback(s) but is missing from scripts/i18n-literal-fallback-baseline.json. BitFun's i18n governance treats literal defaultValue as a no-growth guard (scripts/i18n-literal-fallback-baseline.json: "Add or repair locale resources instead of raising this baseline"). A literal defaultValue silently masks a missing translation — when the key is absent, i18next returns the hardcoded English string from source instead of failing the build. The fix is therefore never to use a string literal as defaultValue when the key already exists in all locales; the right pattern is plain `t('key')` (see siblings `/usage`, `/init`, `/DeepReview` in the same array). Strip the 5 defaultValue literals from the new /reload-skills calls. The `count` interpolation in `reloadSkillsDone` is kept (it is a real i18next interpolation, not a literal). Verified: - npx tsc --noEmit: 0 errors - npx vitest run: 864/864 pass - node scripts/i18n-contract.test.mjs: 37/37 pass (was 1/37 failing)
Mirrors Claude Code 2.1.152: a slash command that re-scans skill
directories from disk without requiring a session restart.
Both the CLI and the Web UI now expose the same command via a single
shared capability that was already in place end-to-end: the Tauri RPC
get_skill_configs(force_refresh: true) calls
SkillRegistry::global().refresh() and returns the new view, and
configAPI.getSkillConfigs({ forceRefresh: true }) wraps it on the
TS side. The only thing missing was a user-facing entry point on
both surfaces — this PR adds it.
Branch: feat/reload-skills-command, rebased on top of origin/main
(e875565). Single commit containing the full implementation.
---
CLI
- Register /reload-skills in COMMAND_SPECS.
- handle_command dispatches it to a new reload_skills_from_disk
method that calls SkillRegistry::global().refresh() directly
(no Tauri bridge needed in the CLI — it shares the same global
registry as the desktop runtime) and shows a status line with
the reloaded skill count. Not gated on is_processing: the cache
swap is atomic and a held SkillInfo reference is not kept
across the call.
- reload_skills_from_disk takes rt_handle as a parameter and uses
it via rt_handle.block_on, matching the convention used by every
other async CLI helper in this file.
Web UI
- New entry in getFilteredActions: id='reload-skills', command=
'/reload-skills'. Picker-routed.
- selectSlashCommandAction sets the input to the bare command (no
args); user presses Enter to dispatch.
- New submitReloadSkillsFromInput function modeled on
submitUsageFromInput: validates the bare command, clears the
input, calls configAPI.getSkillConfigs with both forceRefresh:
true AND workspacePath so project-level skills (in
.bitfun/skills/, .cursor/skills/, etc.) are included in the
count, and surfaces success / failure via the existing
notificationService toasts.
- New /reload-skills matcher in handleSendOrCancel wrapped in the
localSlashCommandsEnabled guard (matching the existing /usage,
/init, /DeepReview matcher pattern that landed on main while
this branch was in review).
- New 'startsWith' warning for the '/reload-skills foo' case so
the message does not fall through to the agent as a regular
user message.
- i18n defaultValue fallbacks are kept as plain t('key') calls
with no string-literal fallback — i18n audit governance
(scripts/i18n-literal-fallback-baseline.json) treats literal
defaultValue as anti-pattern because it silently masks
missing translations.
i18n (4 keys × 3 locales = 12 insertions):
- chatInput.reloadSkillsAction — picker label
- chatInput.reloadSkillsUsage — arg-validation warning
- chatInput.reloadSkillsDone — success toast (with {{count}})
- chatInput.reloadSkillsFailed — failure toast title
---
Verification:
- cargo check -p bitfun-cli: 0 errors
- npx tsc --noEmit: 0 errors
- npx eslint src/flow_chat/components/ChatInput.tsx: 0 errors
(incl. react-hooks/exhaustive-deps)
- npx vitest run: 921/921 pass
- node scripts/i18n-contract.test.mjs: 37/37 pass
(incl. literal-fallback-baseline check)
596c0de to
fb7996c
Compare
wsp1911
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
对标
Claude Code 2.1.152 changelog:
这个 PR 做什么
在 BitFun 的 CLI 和 Web UI 同时暴露
/reload-skills命令,让用户改完 skill 文件后不必重启 BitFun 即可让改动生效。现状
SkillRegistry::refresh()(src/crates/core/src/agentic/tools/implementations/skills/registry.rs:729)和 Tauri RPCget_skill_configs(force_refresh: true)(src/apps/desktop/src/api/skill_api.rs:467)以及configAPI.getSkillConfigs({ forceRefresh: true })(src/web-ui/src/infrastructure/api/service-api/ConfigAPI.ts:278)全部已就绪——后端+IPC 链路已通。只缺用户入口。 本 PR 仅加 UI 入口(一个 CommandSpec + 一个 match arm + 一个 action item + 一个 submit 函数 + i18n),0 后端改动。
行为
CLI(
/reload-skills)is_processing === false守卫(cheap read,atomic cache swap)SkillRegistry::global()直接调用(CLI 跟 desktop 运行时共享同一 registry,不需要走 Tauri bridge)rt_handle: &tokio::runtime::Handle参数(与其他 async CLI helper 一致)Web UI
/→ 命令 picker 多一项Reload skills/reload-skillsReloaded skills (12 available))Failed to reload skills)/reload-skills foo→ 警告 toastUse /reload-skills without extra arguments.完全复用
/usage和/init的命令路由模式(pick → input → Enter →handleSendOrCancelmatcher → submit 函数)。改动文件
总计 6 文件,+120 行。单 commit
fb7996c0,rebase 在最新origin/main(e8755651) 之上。验证
自动化
cargo check -p bitfun-cli→ 0 错误npx tsc --noEmit→ 0 错误npx eslint src/flow_chat/components/ChatInput.tsx→ 0 错误(含react-hooks/exhaustive-deps)npx vitest run→ 921/921 测试通过node scripts/i18n-contract.test.mjs→ 37/37 通过(i18n 治理契约,含 literal-fallback-baseline 检查)手动(PR 合入后)
/reload-skills+ EnterReloaded skills (N available),N 包含 workspace-level skills/reload-skills foo+ EnterUse /reload-skills without extra arguments.,不发送消息~/.bitfun/skills/或<workspace>/.bitfun/skills/)/reload-skills+ EnterCLI 验证
cargo run -p bitfun-cli > /reload-skills [状态栏] Skills reloaded (N available) [系统消息] Reloaded N skill(s) from disk.Review 历程(4 轮迭代全部合并为这 1 commit)
workspacePath到 useCallback deps 数组(react-hooks/exhaustive-deps)localSlashCommandsEnabled守卫(/usage、/init等也用这个守卫)注意
feat/precise-slash-command-matcher) 仍 OPEN 等待维护者 review,与本 PR 无关SkillRegistry任何后端改动refresh_for_workspace(workspace_root)的workspace_root参数被忽略——已在 PR 描述中提及