feat: 添加增量下载和断点续传功能(晚上新增了一个commit:支持用户访问令牌(User Access Token)鉴权方式下载知识库)#176
Open
sujianjob wants to merge 5 commits intoWsine:mainfrom
Open
feat: 添加增量下载和断点续传功能(晚上新增了一个commit:支持用户访问令牌(User Access Token)鉴权方式下载知识库)#176sujianjob wants to merge 5 commits intoWsine:mainfrom
sujianjob wants to merge 5 commits intoWsine:mainfrom
Conversation
新增功能: - 基于飞书 API 的 revision_id 实现文档版本追踪 - 支持跳过未修改的文档,避免重复下载 - 自动识别旧版本下载的文件,无缝建立缓存映射 - 提供 --incremental/-i 参数启用增量下载模式 - 提供 --force/-f 参数强制重新下载并更新缓存 实现细节: - 新增 core/cache.go 缓存管理模块,支持并发安全的版本追踪 - 在输出目录下维护 .feishu2md.cache.json 缓存文件 - 智能判断:版本号变化 + 文件存在性检查 - 原子写入机制防止缓存文件损坏 - 完全向后兼容,默认行为不变 改进点: - 支持从旧版本平滑过渡,首次增量下载自动建立已存在文件的缓存映射 - 缓存损坏时自动恢复,不影响下载流程 - 文件被删除时自动重新下载 适用场景: - 定期同步大型知识库,只下载更新的文档 - 下载中断后继续,跳过已下载的文件 - 批量文件夹和 Wiki 的增量同步
- 新增 auth_type 配置项,支持 "app" 和 "user" 两种鉴权方式 - 新增 --userAccessToken/--uat 和 --authType 命令行参数 - 添加配置验证逻辑确保鉴权凭证完整 - 更新 README 文档说明两种鉴权方式的使用方法
Author
|
新增了一个功能
|
Owner
|
我建议把这部份功能迁移到feishu2md sync的新子命令中,同时我想知道新用户从旧配置迁移到新工具是否会有问题? |
Author
好的,我研究一下。另外还昨天还做了下载知识库类型的下载命令中加了过滤功能,不知道这部分你有没有其他的建议 |
Owner
|
过滤功能不确定指什么,但希望能尽量设计得通用一点,感谢贡献。 |
- 新增 --include 参数:仅下载匹配的目录(白名单,支持通配符) - 新增 --exclude 参数:排除匹配的目录(黑名单,支持通配符) - 支持 include 和 exclude 组合使用,父目录排除后子目录自动跳过 - 添加 make cross-build 跨平台编译命令(Linux/Windows/macOS) - 更新 README 文档,添加新功能说明和开发指南 Co-Authored-By: Claude Opus 4.5 <[email protected]>
重构内容: - 新增 `feishu2md sync` 子命令,专门用于批量同步场景 - sync 命令支持自动检测 URL 类型(wiki/folder) - sync 命令默认开启增量模式,支持目录过滤和并发控制 - sync 命令支持同步配置持久化(.feishu2md.sync.json) 从 download 命令移除的功能: - 移除 --incremental/-i 参数 - 移除 --force/-f 参数 - 移除 --include/--exclude 参数 - download 命令回归简洁,仅保留基本下载功能 新增文件: - cmd/sync.go: sync 命令实现 - core/sync_config.go: 同步配置管理 - core/sync_config_test.go: 同步配置测试 配置迁移: - 新增配置版本号(version: "2.0") - 支持旧配置自动迁移 - 新增 Migrate() 方法和相关测试 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
Author
refactor: 将增量下载、目录过滤功能迁移到新的 sync 子命令
从 download 命令移除的功能:
新增文件:
配置迁移:
|
当使用 --include 参数时,匹配的目录下的子目录(即使子目录名称不匹配 include 模式) 现在会自动被包含并下载。exclude 模式仍然会被检查,可用于排除特定子目录。 修改内容: - ShouldIncludeNode: 检查父目录是否已被包含,若是则子目录自动包含 - 添加 TestNodeFilter_ChildDirectoriesAutoIncluded 测试用例
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.
新增功能:
实现细节:
改进点:
适用场景:
本次 PR 中的代码均是使用 AI 修改的,因为自己用到知识库下载且在过程中遇到过限制,所以才有这个修改
