Skip to content

Releases

dsh-rtk v1.5.0 — /rtk doctor 与 /rtk gain

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 16:00

dsh-rtk v1.5.0 — /rtk doctor 与 /rtk gain

v1.4.0 的 /rtk 只回答"生效没有"。这一版把它补成完整的会话内自检面:

  • /rtk doctor:完整自检(二进制、各 profile 安装版本、运行中的宿主进程、状态记录),
    与 npm run doctor 共用同一个 runDoctor(),两条路径不可能给出不一致的结论。
    区别只是它使用插件自己进程内的解析结果,并把来源标注为「插件进程内解析」。
  • /rtk gain [summary|daily|weekly|monthly|history|project|json]:读取 RTK 节省统计。
    用户输入映射到固定的只读参数,不转发原始文本——避免误触 rtk gain --reset 这类
    会清空统计的开关。输出超过 40 行会截断并提示到终端查看完整版。
  • 重构:自检逻辑从 scripts/doctor.mjs 抽到 dsh-rtk/lib/doctor.js(并随包发布),
    CLI 变成薄壳;runDoctor() 的输入(环境、平台、宿主列表、profile 列表、状态记录、
    解析结果)全部可注入,测试无需触碰真实机器。
  • 运行时新增 run(subcommand, args),用于以已解析的二进制执行只读子命令。
  • 测试:/rtk 四种输入 + gain 白名单拒绝 + doctor 复用报告文本;其余用例保持。
  • 文档:README 的自检对照表扩到四项,新增 /rtk gain 输出示例与设计约定;
    Windows 说明补充子命令表。

dsh-rtk v1.4.0 — 会话内自检 /rtk

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 15:45

dsh-rtk v1.4.0 — 会话内自检 /rtk

问题:此前想知道"到底生效没有",要么翻启动日志(桌面版看不到宿主 stdout)、要么跑 npm run doctor(只知道静态环境)。人在会话里,却拿不到当前这一进程的实时状态。

  • 新增人类命令 /rtk(ctx.commands.register(),不产生模型消息):
    • /rtk、/rtk status:版本、平台、挂载的 shell 工具与引用方言、RTK 路径与来源、改写/无等价/未改写计数、生效配置、状态文件路径、最近错误;未生效时附带原因与修复步骤。
    • /rtk recheck:丢弃解析缓存重新探测 RTK —— 刚装好 rtk、又不想重启 DSH 时即刻生效。
    • 其他输入返回用法;命令结果分为 success/error。
  • commands 服务按可选依赖注入(ctx.inject(['commands'], …)):未组合该服务的 profile 里插件行为不变,不会因缺服务而报错。
  • 运行时新增 recheck();snapshot() 增补 pluginVersion、timeoutMs、hint、platform,供命令与测试复用。
  • 测试:test/resolve.mjs 覆盖命令定义与三种输入;test/runtime.mjs 组合真实的 @deepseek-ai/dsh-commands(新增 devDependency),验证定义能通过真实注册表校验、出现在 commands.list() 中,并随插件卸载而消失。
  • 文档:README 重排(平台矩阵 → 本版功能 → 更新记录表 → 安装 → 配置 → 自检与排障),新增「三层自检」对照表;Windows 说明补充 /rtk 与 /rtk recheck。

dsh-rtk v1.3.2 — Windows 使用说明

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 15:38

dsh-rtk v1.3.2 — Windows 使用说明

纯文档版本,运行时逻辑与 v1.3.1 一致;无需为此升级(装与不装都不影响 Windows 上的功能)。

  • 新增 docs/windows.md:
    • 四种 RTK 安装方式(winget / scoop / cargo / release zip)与各自的 rtk.exe 落点;
    • 默认自动发现的五条 Windows 候选路径;
    • 显式指定的两种方式:注册表用户环境变量(setx / [Environment]::SetEnvironmentVariable)与 profile 里 config.bin(含 YAML 反斜杠转义陷阱);
    • 重启与验证步骤(doctor + 会话内 $env:DSH_RTK_DISABLE='1' 对照);
    • Windows 专有排障:$PROFILE 无效、.cmd/.bat 被拒、路径含空格、doctor 看不到子进程 RTK_BIN 等。
  • 明确标注平台差异:Windows 上 DSH 继承注册表环境而不读 shell 配置,且加载的是 pwsh 而非 bash。
  • 该文档随包发布(package.json 的 files 增加 docs/windows.md)。

dsh-rtk v1.3.1 — 升级后不再谎报

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 15:28

dsh-rtk v1.3.1 — 升级后不再谎报"已生效"

问题:装完新版本但还没重启时,运行中的宿主仍是旧版本,而 doctor 只检查"状态文件的 pid 是否还活着",于是照旧输出「配置就绪」——正是它最该提醒的场景。

  • 状态文件新增 pluginVersion(插件从自身 package.json 读取)。
  • doctor 把该版本与 profile 里实际安装的版本比对:不一致时报 ❌「运行中的宿主加载的是 vX,而 profile 里已安装 vY → 完全重启 DSH 后新版本才生效」。
  • 对 1.3.1 之前的旧记录(不含版本标记)退化为时间判据:宿主启动时间早于已安装包的写入时间,同样报 ❌ 并提示重启后精确核对。
  • 运行时行为与 1.3.0 一致,无配置变更。

dsh-rtk v1.3.0 — 多平台支持

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 15:24

dsh-rtk v1.3.0 — 多平台

问题:插件此前只适配 macOS/Linux。最致命的一条是 Windows 上完全不触发——DSH 在 dsh-base 里按平台开关 shell 工具(tool-bash 在 win32 被禁用,Windows 用的是 tool-pwsh),而插件只匹配 exec.name === 'bash',在 Windows 上没有任何触发机会。此外 POSIX 单引号转义、POSIX 权限位校验、POSIX 候选路径在 Windows 上均不成立(其中 world-writable 判定会把每一个 Windows 可执行文件都拒掉)。

  • 按方言匹配工具:bash/sh/dash/zsh/ksh → POSIX,pwsh/powershell → PowerShell,并容忍 bash-persistent、tool:pwsh 这类前后缀变体;非 shell 工具(fs、read…)永不改写。
  • 按 shell 引用二进制路径:POSIX 用 '…'(内部单引号转义为 '\''),PowerShell 用 '…'(内部单引号双写为 '')。
  • 按 shell 识别单条命令跳过语法:DSH_RTK_DISABLE=1 <cmd> 与 $env:DSH_RTK_DISABLE='1'; <cmd>。
  • 平台化候选路径:Windows 新增 %USERPROFILE%\.cargo\bin\rtk.exe、%LOCALAPPDATA%\Microsoft\WinGet\Links\rtk.exe、%USERPROFILE%\scoop\shims\rtk.exe、%ProgramData%\chocolatey\bin\rtk.exe、%ProgramFiles%\rtk\rtk.exe;支持 %VAR% 展开(含大小写不敏感的备用映射)。
  • 平台化可信校验:Windows 只接受 .exe/.com(.cmd/.bat 需要经 shell 转发命令文本,存在注入风险,直接拒绝),不再套用 POSIX 权限位;POSIX 规则保持不变。
  • 环境变量大小写不敏感读取:Windows 常见 ProgramFiles 与 PROGRAMFILES 混用;RTK_BIN、DSH_RTK_DISABLE、DSH_HOME 都走同一套查找。
  • 可测性重构:createRtkRuntime 支持注入 spawn,钩子拆出为 createToolHook,测试不再依赖 #!/bin/sh 假二进制,三平台都能完整运行。
  • doctor 跨平台:Windows 用 Win32_Process 列宿主进程、tasklist 判断存活;状态文件改为「pid 必须存活或与宿主匹配」才算生效证据;输出当前平台实际加载的 shell 工具名。
  • 新增 CI:.github/workflows/ci.yml 在 ubuntu / macos / windows × Node 22/24 上跑 npm test。
  • README 增加平台矩阵与 Windows 安装、配置、排障说明。

dsh-rtk v1.2.1 — 自检不撒谎

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 14:09

dsh-rtk v1.2.1 — 自检不撒谎

  • npm run doctor 用 pid 交叉核对状态文件:只有状态文件的 pid 与运行中的宿主进程一致,才算"本次运行确实加载了插件"。
  • 陈旧记录(上一次运行、手动 import 插件副本等)现在会明确报「状态文件来自 pid X,不在当前运行中的宿主里」,并计入失败结论,不再被误当成生效证据。
  • README 排障表补充对应条目;运行时逻辑与 v1.2.0 一致。

dsh-rtk v1.2.0 — 安装即生效

Choose a tag to compare

@robbin810130 robbin810130 released this 04 Oct 14:05

dsh-rtk v1.2.0 — 安装即生效

问题:1.1.0 通过 tools/execute 钩子接入,但如果 DSH 服务进程的环境里没有 RTK_BIN,插件会静默地什么都不做——装好了、也加载了,却一个字节都不压缩,日志里也查不到原因。

  • 新增零配置自动发现:config.bin → RTK_BIN → 固定候选列表(Homebrew / Linuxbrew / /usr/local / ~/.local / ~/.cargo)。仍然不搜索 PATH。
  • 每个自动发现的候选都要通过可信校验(常规文件、非 world-writable、属主为 root 或当前用户、目录不可被他人写、可执行)并返回 rtk <版本>;不满足则跳过并记录原因。
  • 新增显式配置不回退契约:bin / RTK_BIN 一旦设置即为唯一来源,不可用时报警并停止改写,不再静默换成别的二进制。
  • 新增启动与故障日志:成功打一行「已生效 — rtk x.y.z @ 路径(来源:…,profile:…)」;失败打带修复步骤的警告;运行中同类错误只报一次。
  • 新增 $DSH_HOME/dsh-rtk/status.json 状态文件(解析结果、改写/跳过计数、最近错误)与 npm run doctor(--json 可用)自检命令。
  • 新增配置项:bin、autoDiscover、timeoutMs、statusFile;enabled、verbose 行为不变,旧配置向后兼容。
  • 二进制被删除/替换后自动失效缓存并重新解析;未找到 RTK 时每 30 秒重试一次,装好 RTK 无需重启 DSH。
  • 新增 test/resolve.mjs 覆盖解析、可信校验、诊断与状态文件;test/runtime.mjs 与打包冒烟检查同步扩展;测试不再写入真实 ~/.dsh 状态文件。

dsh-rtk v1.1.0

Choose a tag to compare

@robbin810130 robbin810130 released this 30 Sep 16:34

DSH 0.2.0-rc.2 desktop installations now use the supported tools/execute hook. RTK no longer patches host source files or depends on global npm installation paths.

Preserves bash sandbox checks, workdir and timeout settings, supports frozen argument snapshots and disable switches, and removes its listener on unload. Handles RTK rewrite exit codes 0 and 3 and quotes the configured absolute binary path.

Validation: npm test; macOS desktop bundled DSH 0.2.0-rc.2 ToolRuntime; RTK 0.45.0. Windows and Linux desktop runtime acceptance remains unverified.

Install the attached tarball or github:robbin810130/dsh-rtk#v1.1.0 into your active profile. Set RTK_BIN in the DSH process environment and restart the application. See README for migration from host-patching versions.

dsh-rtk v1.0.3

Choose a tag to compare

@robbin810130 robbin810130 released this 16 Sep 06:40

dsh-rtk v1.0.3 — unscoped package identity

  • Rename actual package to dsh-rtk, including manifests, bundle identity, installation instructions and regression tests.
  • Preserve node IDs, configuration and state/backup paths. GitHub ownership/URLs remain unchanged; no npm publication.
  • Stop DSH and back up the complete profile and state before migrating. Remove the old scoped package before adding the new one; never load both. Restore unrelated plugin data stored inside node_modules before restarting. See README.
  • Runtime logic is unchanged from repository version 1.0.2. Host bash-tool patching requires exact anchors; the restart helper remains repository-only.

@robbin810130/dsh-rtk v1.0.1

Choose a tag to compare

@robbin810130 robbin810130 released this 24 Aug 14:56

Marketplace-ready package

This release restructures the plugin for public DSH Plugin Hub discovery.

What changed

  • Published package entry is now the repository root: @robbin810130/dsh-rtk.
  • Added a GitHub-direct installation command:
    dsh plugin --profile web add github:robbin810130/dsh-rtk#v1.0.1
  • Added MIT LICENSE, package metadata, engines, test, and prepack validation.
  • Removed author-machine paths and diagnostic /tmp heartbeat writes.
  • Replaced in-package backups with user-state backups under ~/.dsh/dsh-rtk/ (or $XDG_STATE_HOME/dsh-rtk/).
  • Added atomic replacement for patched host files.
  • Changed RTK resolution to require explicit RTK_BIN; the plugin no longer executes a PATH-discovered rtk binary.
  • Added public documentation covering permissions, host-file mutation, compatibility constraints, rollback, and external-process exposure.

Important compatibility note

DSH currently exposes no public pre-bash-command interception point. This plugin uses content-anchored patches against the two DSH bash tool packages; it refuses to write when its known upstream anchors do not match. Review the README's 权限、风险与兼容性 section before installation.