Update plugin 进程端口管理 v1.0.1#297
Conversation
- feat: process port manager plugin - search processes by PID/port/name/path, kill with one click - chore: add plugin description - chore: readme - feat: 使用 react-icons 库替换文本字符图标 - style: 自定义滚动条样式匹配主窗体风格 - feat: 将 Kill 确认弹窗改为页面级别模态框 - chore: readme - style: 将主容器背景设为全透明 - fix: 修复透明背景下的颜色协调问题 - fix: 修复 hover 高亮边距不一致问题 - fix: 确保 pm-body 占满全部宽度 - fix: 修复滚动条与背景融合问题 - fix: 仅修改滚动条颜色不改变背景 - feat: 替换 logo 为 SVG 格式,更新截图和插件配置 - docs: 在 README 中展示 logo - docs: 添加 MIT 协议文件 - docs: 添加与常见进程管理工具的对比优势 - docs: 简化优势描述为纯要点 - feat: 移除 Kill 按钮,改为右键直接 Kill,结果提示移至顶部 - feat: 右键弹出确认弹窗后再 Kill - feat: 顶部改为操作提示「右键可 Kill 进程」,Kill 结果用 toast - fix: 修复 JSX 结构导致的构建报错 - fix: 缩短弹窗动画时间,消除右键弹窗延迟感 - optimize: 优化界面和文档 - optimize: 优化文档 - chore: 填充作者信息 - optimize: 优化命令注入安全问题 - docs: CHANGELOG.md - optimize: improve process management UX and search sorting - fix: 搜索逻辑改为字符串模糊匹配,支持 PID/端口部分匹配 - ci: add release workflow - ci: add tag input for workflow_dispatch - ci: read version from package.json - ci: fix quote nesting for node -p - fix: pnpm run build fail - fix: 修复进程路径中文乱码 + 清理死代码 - chore: bump version to 1.0.1 + update changelog
There was a problem hiding this comment.
Code Review
This pull request updates the process manager plugin to version 1.0.1, addressing Chinese path encoding issues on Windows by decoding command output with gbk via iconv-lite. It also removes unused route state in App.tsx and unifies the CACHE_TTL constant definition. Feedback on these changes suggests a more portable approach to handle Windows encoding: prefixing commands with chcp 65001 to force UTF-8 output, which allows using native utf8 decoding and avoids introducing the iconv-lite dependency entirely.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const iconv = require('iconv-lite') | ||
|
|
||
| function execAsync(cmd, timeout) { | ||
| return new Promise((resolve) => { | ||
| exec(cmd, { timeout }, (err, stdout) => { | ||
| resolve(err ? '' : stdout) | ||
| exec(cmd, { timeout, encoding: 'buffer' }, (err, stdout) => { | ||
| resolve(err ? '' : iconv.decode(stdout, 'gbk')) | ||
| }) | ||
| }) | ||
| } |
There was a problem hiding this comment.
硬编码 gbk 编码会导致在非简体中文 Windows 系统(如繁体中文、日文、韩文或英文系统)下,如果进程路径或名称包含非 ASCII 字符,解码时会出现乱码。\n\n更优雅且通用的解决方案是在 Windows 下执行命令前先通过 chcp 65001 将控制台编码切换为 UTF-8,这样可以直接使用 Node.js 默认的 utf8 编码进行解析,不仅能完美支持所有语言系统,还能避免引入第三方依赖 iconv-lite。
function execAsync(cmd, timeout) {
return new Promise((resolve) => {
const formattedCmd = process.platform === 'win32' ? 'chcp 65001 > nul && ' + cmd : cmd
exec(formattedCmd, { timeout, encoding: 'utf8' }, (err, stdout) => {
resolve(err ? '' : stdout)
})
})
}There was a problem hiding this comment.
这个无法处理 wmic的输出
| "iconv-lite": "^0.7.3", | ||
| "react": "^19.0.0", |
插件信息
本次变更
🐛 修复
wmic输出的 GBK 编码转换为 UTF-8,修复中文 Windows 下进程路径显示乱码的问题🧹 优化
App.tsx中未使用的routestateCACHE_TTL常量定义,消除重复代码截图 / 演示
自检清单
plugins/process-manager/目录此 PR 由 ztools-plugin-cli 自动管理:每次
ztools publish在分支上追加一个 commit,PR 链接保持不变。