Serendipity
|
a9b36a6f47
|
重构(应用状态存储): 调整savePaths返回结构化结果并更新所有调用处
- 新增SaveResult类型统一标准化保存操作的结果状态
- 修改savePaths函数返回结构化结果而非布尔值,完善长路径超限、部分失败等场景的处理逻辑,部分失败时重新加载路径避免状态偏移
- 更新useAppActions与ProfileDialog的保存逻辑,适配新API并添加长路径确认弹窗
- 补充相关测试用例,修正导入导出测试的版本号预期
|
2026-05-31 14:48:03 +08:00 |
|
Serendipity
|
21da3b2930
|
fix: v5.1 代码审查修复 — ESLint/CSV/测试隔离/CLI 去重
- ESLint: 迁移到 flat config ignores,删除已废弃的 .eslintignore
- CSV: Rust/TS 格式对齐,统一 type,path,enabled 3 列
- JSON: 导入导出统一为 {path, enabled} 对象格式
- scanner: 移除未使用的 max_threads 死代码 + TempDirGuard 测试清理
- profiles: rename_profile 添加目标存在检查
- CLI: 抽取 load_operate_save helper,简化 cmd_remove/cmd_edit
- PathTable: 抽取 usePathValidation hook,消除 set-state-in-effect
- 测试隔离: disabled/profiles 通过 #[cfg(test)] 重定向到 temp dir
- toolchain: 新增 rust-toolchain.toml 固定 stable-x86_64-pc-windows-gnu
- docs: 更新 CLAUDE.md/README.md 测试计数 + 架构树
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-30 17:31:04 +08:00 |
|
Serendipity
|
cbf99f12fd
|
v5.1: 全面代码审查修复 — 安全加固 + 功能修复 + 测试补全 + 工程化
安全修复 (CRITICAL):
- 启用 CSP (default-src 'self')
- read_text_file 限制文件扩展名白名单 (.json/.csv/.txt)
- capabilities 显式声明窗口权限
- profile 名校验增强 (null 字节/控制字符/长度限制)
功能修复 (HIGH):
- AnalyzeDialog 重新打开时正确刷新数据
- UndoRedoButtons 订阅路径长度变化确保响应性
- 禁用状态持久化错误处理 (.catch → console.warn)
- 硬编码中文全部迁移到 i18n (6 处)
- PATH 长度检查改用 UTF-16 字符计数
- PATH 写入前 null 字节校验
- CLI export 拒绝写入系统目录
- savePaths 职责分离: window.confirm → Tauri ask() 对话框
代码质量 (MEDIUM):
- 导入路径统一过滤 (sanitize_paths: null 字节/分号/空白)
- 原子写入 (atomic_write: disabled.json + profiles)
- 验证缓存自动清理 (PathTable useEffect)
- Scanner 线程错误处理改进 (.unwrap → .map_err)
- Ctrl+F 去重 (移除 use-keyboard 重复处理)
- Profile 路径列表 key 修复 (index → path)
- 生产构建启用日志插件 (Warn 级别)
- export_paths JSON 序列化改 expect
测试:
- Rust: 35 → 48 测试 (+13)
- Frontend: 80 → 85 测试 (+5)
- Vitest 全局 jsdom + 覆盖率阈值 (80%)
- 安装 @vitest/coverage-v8 + test:coverage 脚本
- 移除未使用的 @testing-library/jest-dom
工程化:
- CI 添加 Cargo 缓存 (Swatinem/rust-cache@v2)
- CI 添加 cargo fmt --check
- tsconfig.test.json 覆盖测试文件类型检查
- cargo fmt 全量格式化
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-29 23:17:27 +08:00 |
|
Serendipity
|
5c73321ce6
|
fix: 修复 ESLint set-state-in-effect 错误 — useEffect 加 prevOpen 守卫
CI / Rust 检查 (Check + Clippy + Test) (push) Has been cancelled
CI / 前端检查 (TypeScript + Lint + Test) (push) Has been cancelled
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-29 17:02:55 +08:00 |
|
Serendipity
|
21af2683ac
|
chore: 全面代码审查修复 + 开源标配完善
## 审查修复 (18 项)
- TitleBar 版本号改为动态 import package.json
- CLI profile_apply 加 verify_and_save 原子性保护
- CLI 新增 profile rename 子命令
- cmd_clean 默认清理 system+user 两个 hive
- Rust import_csv 加 BOM/header 处理
- exportToJson/exportToCsv 保留 enabled 状态
- CLI version 使用 env!("CARGO_PKG_VERSION")
- export_paths 返回 Result, 未知格式报错
- importFromContent 未知扩展名 throw Error
- profile 文件名加路径遍历/Win保留字校验
- 数据路径统一到 ~/.patheditor/
## clippy (18 处修复)
- backup/scanner/system/profiles: empty_line_after_doc_comments
- profiles: needless_borrow ×5, unnecessary_map_or
- scanner: collapsible_if
- cli: nonminimal_bool ×6, implicit_saturating_sub, to_string_in_format_args
- 零警告通过
## 测试 (33 条新增)
- Rust: backup(3) + disabled(1) + fs(13) + scanner(4) + profiles(1) = 25 条
- 前端: merge-preview(2) + analyze-dialog(1) + import-parity(5) = 8 条
- Rust 10→35, 前端 72→80
## Scanner 并行化
- std::thread::scope 多线程并行扫描目录,N 倍性能提升
## expand_env_vars UTF-16 修复
- 非法码点编码为 \u{XXXX} 而非静默丢弃
## 开源标配
- CODE_OF_CONDUCT.md (Contributor Covenant 2.1)
- SECURITY.md (漏洞报告流程)
- .github/PULL_REQUEST_TEMPLATE.md
- CONTRIBUTING.md (贡献指南)
- CHANGELOG.md (v4.0~v5.0)
## E2E 测试 (4 条新增)
- keyboard / analyze / profiles / import-export
- IPC mock 扩展 scan/profiles 命令
## CI
- Rust job 目录调整为 workspace 根
## 其他
- rustdoc: 8 个 pub fn 补文档注释
- 帮助文本 v4.0→v5.0
- 前后端导入逻辑加交叉引用注释
- .gitignore 添加 target/
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-29 01:13:21 +08:00 |
|
Serendipity
|
26f6953919
|
fix: ProfileDialog 标题栏添加 ✕ 关闭按钮
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-28 21:29:50 +08:00 |
|
Serendipity
|
5ed15535e7
|
fix: 深色模式下选中行对比度不足 — 新增 CSS 变量分别适配浅色/深色主题
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-28 21:25:54 +08:00 |
|
Serendipity
|
d7d11480b8
|
feat: PATH 配置文件/预设切换 — 保存、加载、一键应用不同场景的 PATH 配置
- 新增 profiles.rs: list/save/load/delete/rename 五个 Rust 命令
- 配置文件存储在 %APPDATA%/.patheditor/profiles/<name>.json
- ProfileDialog: 保存当前 PATH、加载预览、一键应用到注册表
- 工具栏新增「配置」按钮
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-28 21:02:29 +08:00 |
|
Serendipity
|
7869886670
|
feat: 新增 PATH 智能分析功能 — 冲突检测 + 工具清单
CI / 前端检查 (TypeScript + Lint + Test) (push) Has been cancelled
CI / Rust 检查 (Check + Clippy + Test) (push) Has been cancelled
- scan_conflicts: 检测不同目录中的同名可执行文件(遮蔽冲突)
- scan_tools: 扫描各目录提供的可执行文件,支持关键词搜索
- Rust scanner.rs 后端,前端 AnalyzeDialog 弹窗
- 工具栏新增「分析」按钮
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-28 10:02:12 +08:00 |
|
Serendipity
|
d6e535aa98
|
feat: UI 组件适配 PathEntry — 复选框列、禁用行灰显删除线
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-27 13:56:52 +08:00 |
|
Serendipity
|
8ff02fd88b
|
fix: 修复 ESLint 错误 — PathEditDialog/use-keyboard/test 添加规则豁免注释
这些是正当的 React 模式(对话框状态重置、ref 同步避免重复注册、测试 mock)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-27 01:07:57 +08:00 |
|
Serendipity
|
68f4617bda
|
fix: PathTable — 环境变量展开限流20并发、消除useEffect双重触发、类型断言改为常量
- expand useEffect 增加 .slice(0, 20) 批次限制,避免大量路径时并发过高
- validatedRef / expandedRef 替代 validationCache.has / expandedCache.has 过滤,
从 useEffect 依赖数组中移除缓存 state,消除双重触发
- ValidationState 类型提升到模块层级,新增 DEFAULT_VALIDATION_STATE 常量
替代硬编码类型断言
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 22:43:03 +08:00 |
|
Serendipity
|
652280c2dd
|
fix: AppShell 拖拽路径用 TauriFile 接口替代 as any
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 22:41:40 +08:00 |
|
Serendipity
|
613fb51fd7
|
fix: 验证 IPC 异常时返回 unknown 状态,不再错误标记为有效路径
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 22:09:23 +08:00 |
|
Serendipity
|
775a570d31
|
feat: 导入改用原生对话框、新增 app-store 单元测试、修复窗口滚动
- handleImport 从 DOM <input> hack 改为 @tauri-apps/plugin-dialog 原生文件选择
- 新增 Rust read_text_file 命令读取文件内容,零外部依赖
- 新增 tests/unit/app-store.test.ts,25 个测试覆盖 CRUD/undo-redo/loadPaths/savePaths
- 修复 AppShell overflow-hidden 导致无法滚动窗口的问题
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 19:01:56 +08:00 |
|
Serendipity
|
bdbb399ddc
|
refactor: 清理 LOW 问题 — 样式去重、死代码删除、命名修正
- 抽取 buttons.ts 共享按钮样式,消除 3 个组件的重复定义
- store 删除未调用的 canUndo/canRedo 方法
- importFromContent 变量 ext→lower 修正确性
- CSV 导出修复 BOM 重复(exportToCsv 自带 BOM)
- Rust error.rs 添加 allow(dead_code) 消除编译警告
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 08:13:17 +08:00 |
|
Serendipity
|
d28861ff9c
|
refactor: 抽取 Modal 组件、支持 JSON/CSV 导出、清理冗余代码
- 新增 Modal 组件,消除 3 个 Dialog 中重复的遮罩层/Escape/stopPropagation 代码
- PathEditDialog/HelpDialog/ImportDialog 改用 Modal 包裹
- handleExport 支持 JSON/CSV 两种格式(CSV 导出代码之前存在但从未接线)
- App.tsx 移除冗余的 initDarkMode 后重复设 store 的逻辑
- ErrorBoundary 添加 componentDidCatch 日志和 console.error
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 00:51:32 +08:00 |
|
Serendipity
|
b159407773
|
fix: 最终审查修复 — 数据安全、功能缺失、状态管理
Rust:
- save_paths 添加 Windows PATH 32767 字符上限检查防静默截断
- backup_registry 回退路径统一为 backup_base_dir() 三级链
Store:
- 新增 isSaving 并发守卫防止重复保存
- 保存失败详情通过 Promise.allSettled.reason 展示
- isModified 改为与上次保存快照比较(undo/redo 后准确反映状态)
- 批删除合并为单条撤销记录(N 次删除 → 1 次 Ctrl+Z 恢复)
- 保存失败/备份失败使用 i18n 键(消除硬编码中文)
UI:
- 拖拽添加改用 webkitGetAsEntry().isDirectory 校验文件夹
- Ctrl+F 快捷键聚焦搜索框
- handleClean 使用 is_valid_path_format(替代不完整的 inline 函数)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 00:48:43 +08:00 |
|
Serendipity
|
e6a2416271
|
refactor: AppShell 拆分 + savePaths 并行化
- 抽取 useAppActions hook(~160行),AppShell 从 306 行精简至 105 行
- AppShell 现在只负责布局和渲染,操作逻辑全部可单独测试
- savePaths 改为 Promise.allSettled 并行保存 + 并行备份
- useKeyboard 通过 hook 内部集成,不再暴露给 AppShell
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 00:36:59 +08:00 |
|
Serendipity
|
3a21891f84
|
feat: 原生对话框、ErrorBoundary、配置生效、交互打磨
- handleBrowse 改用 @tauri-apps/plugin-dialog 原生目录选择
- handleImport 清理临时 DOM 元素(add input.remove())
- config/default.json 实际导入生效(maxHistory、path 长度限制)
- app-store.ts 长度检查改用配置值
- 删除 AppShell 中与 store 重复的长度检查
- 新增 ErrorBoundary 组件避免单异常白屏
- StatusBar 加载失败时显示重试按钮
- 取消按钮检查 isModified 未保存提示
- lib.rs 注册 tauri-plugin-dialog
- tsconfig 添加 resolveJsonModule
- CLAUDE.md 添加 cargo test 运行时说明
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 00:33:57 +08:00 |
|
Serendipity
|
bfd114d80f
|
refactor: 全面代码质量提升 — StringList→string[], strict 模式, 死代码清理
架构重构:
- StringList 类替换为不可变 string[](消除 dataVersion hack,Zustand 自然检测变化)
- UndoRedoManager.undo/redo 返回新数组而非原地修改
- 删除 dataVersion 字段和 _bumpVersion()
- 启用 TypeScript strict 模式
死代码清理:
- 删除 string-list.ts, string-list.test.ts, use-path-validation.ts
- Rust AppError 保留供未来使用
功能修复:
- importFromJson 添加 try/catch
- handleClean 使用真实格式验证替代 () => true
- savePaths 保存前调用 backup_registry,处理部分保存失败
- importFromJson 校验非 object 类型输入
i18n 完善:
- MergePreview/StatusBar 硬编码中文 → t() 调用
- 新增 merge.* 和 status.* 翻译键
Rust 改进:
- registry.rs 抽取 load_paths/save_paths 通用函数,消除重复
- registry 新增 6 个单元测试(split/join/roundtrip)
- backup.rs 时间戳加毫秒防覆盖,回退路径改为 home_dir
元数据:
- package.json 名称→patheditor, 版本→4.0.0
- 新增 CHANGELOG.md
- 移除 UndoRedoButtons 废弃注释
- tsconfig 添加 strict:true
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-26 00:26:27 +08:00 |
|
Serendipity
|
2ceec54790
|
fix: 全面审查修复 14 个 bug,新增 Rust 单元测试
CRITICAL:
- PathTable/MergePreview 操作后不重新渲染(加 dataVersion 版本号机制)
- moveUp/moveDown 后 selectedIndices 过时(更新到新位置)
HIGH:
- ImportDialog 显示 "true" 而非路径数量(改为 number 类型)
- F1 快捷键无效果(添加 onHelp 回调)
- useKeyboard 每次渲染重复注册事件(改用 ref 模式)
- batch delete 撤销顺序错误(拆分为独立记录)
- importPaths 存储数组引用而非副本
- StringList.all 暴露内部数组(改为返回副本)
- expand_env_vars 静默吞 API 错误(加 log::warn)
- join_path 写入前未修剪路径(加 trim 避免注册表污染)
MEDIUM:
- handleClean 总传 () => true 不验证无效路径
- HelpDialog/ImportDialog 缺 Escape 关闭
- initDarkMode 不同步 Zustand store
- 多处硬编码中文改为 i18n.t()
- Rust unsafe 块补全 SAFETY 注释
新增 Rust 测试: system.rs 4 个单元测试
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-25 23:14:26 +08:00 |
|
Serendipity
|
b1acb3690c
|
feat: 路径验证颜色编码、环境变量 tooltip、长度检查、拖拽添加
- PathTable 异步调用 Rust validate_path 实现红/橙色编码
- 含 %VAR% 的路径悬浮显示展开后的 tooltip
- 保存前检查 PATH 长度(系统2048/用户2048/合并8191),超限弹框确认
- 支持拖放文件夹到列表区域添加路径
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-25 19:24:13 +08:00 |
|
Serendipity
|
8967fe34e5
|
fix: 修复编辑对话框空白及双击编辑无效的问题
- PathEditDialog 添加 useEffect 在打开时同步 initialValue
- AppShell 添加 path-dblclick 事件监听,双击路径行打开编辑
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-25 18:40:53 +08:00 |
|
Serendipity
|
48129a8908
|
feat: 重写为 Tauri + React + TypeScript (v4.0)
完全移除旧 C+IUP 代码,改用 Tauri 2.x + React 19 + TypeScript + Rust 技术栈重写。
功能与 v3.1 完全等价:
- React 前端:Tailwind CSS 4、Zustand 状态管理、i18next 国际化
- Rust 后端:winreg 注册表读写、Win32 API FFI 调用
- 核心逻辑:StringList、UndoRedoManager、PathManager、Import/Export
- 深色模式、中英文切换、键盘快捷键、合并预览
- 66 个 Vitest 单元测试
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-25 18:33:04 +08:00 |
|