Skip to content

feat: persist /rtk set config into profile cordis.patch.yml - #3

Open
xelr233 wants to merge 13 commits into
sleepinginsummer:mainfrom
xelr233:pr/persist-config
Open

feat: persist /rtk set config into profile cordis.patch.yml#3
xelr233 wants to merge 13 commits into
sleepinginsummer:mainfrom
xelr233:pr/persist-config

Conversation

@xelr233

@xelr233 xelr233 commented Aug 15, 2026

Copy link
Copy Markdown

摘要

/rtk set/rtk reset 的配置改动自动持久化到 profile 的 cordis.patch.yml(id-targeted override 块),重启 DSH 后保持生效——不再每次重启丢状态。

本 PR 基于 #2(hook-mode)之上,链式依赖:先合入 #1#2 → 本 PR。

变更

  • apply(ctx, injected):合并 patch 注入的 config({...DEFAULT_CONFIG, ...injected}),重启后模式等配置直接生效
  • persistConfig():通过 ctx.fs 读写 patch 文件,行级更新 - id: dsh-rtk-optimizer 块的 config: 键(无重复、保留注释与其他条目)
  • 持久化键:modeenabledguardWhenRtkMissingreadCompactiondebug
  • patch 文件不可写时降级为内存修改并提示 (not persisted)
  • README 新增「配置持久化」章节

测试

  • node --test test/*.test.js → 46 pass / 0 fail(注入合并、块内加键、键原地更新无重复、追加新块、降级)
  • E2E 模拟:set mode hook → 追加块 → set debug true → 追加键 → set mode suggest → mode 原地更新且唯一,token-panel 保留

xelr233 added 13 commits August 15, 2026 23:30
verify/show only read the cached probe state, which stays undefined
until the first bash call, so an installed rtk was always reported as
"not probed yet" (the verify hint even told users to re-run a command
that never probes). Force a fresh probe (cache bypass) in both commands
and report the resolved path or NOT FOUND.

Also fix the npm test script for Node 24 (node --test test/ fails with
MODULE_NOT_FOUND) and add command tests covering verify/show probing.
…EADME, fix mode comment

F1: bound state.hookPlan / state.hookExecuted to HOOK_PLAN_MAX (64) entries,
evicting the oldest beyond the cap, plus defensive hookPlan cleanup in
tools/post-execute so a planned-but-never-executed call leaks nothing.
F2: propagate readStream spillPath into bash stdout/stderr objects.
F3: reconcile README blockquote with the hook-mode exception.
F4: update stale DEFAULT_CONFIG.mode comment to include 'hook'.
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.

1 participant