Files
DevPack/docs/DEVELOPMENT-PLAN.md
2026-03-04 14:10:30 +08:00

29 KiB
Raw Blame History

DevPack 后续开发详细计划

基于 ROADMAP.md 路线图,细化到每个文件及其所需第三方库 / 标准库
更新日期2026-03-03


依赖库总览

下表列出后续开发中需要引入的所有第三方库go get 命令):

Import Path 用途 引入阶段
zerolog github.com/rs/zerolog 结构化日志 M1
go-yaml gopkg.in/yaml.v3 Profile YAML 解析 M1
uuid github.com/google/uuid Pack ID 生成 M1
color github.com/fatih/color 终端彩色输出 M1
tablewriter github.com/olekukonenko/tablewriter 终端表格渲染 M1
progressbar github.com/schollz/progressbar/v3 终端进度条 M3
survey github.com/AlecAivazis/survey/v2 交互式终端提示 M4
testify github.com/stretchr/testify 测试断言与 Mock M1
archiver github.com/mholt/archiver/v4 tar.gz 高级归档(可选,也可用标准库) M3
x/crypto golang.org/x/crypto Argon2id 密钥派生 v0.3.0

注意:cobraviper 已在 go.mod 中,无需再添加。


M1: 项目基础架构(第 1-2 周)

任务 1.1 — 日志系统

新建文件:

文件 说明
internal/logging/logger.go 全局 Logger 封装、日志级别控制、文件 + 控制台双输出
internal/logging/logger_test.go 日志系统单元测试

所需库:

第三方库:
  github.com/rs/zerolog          — 核心日志引擎

标准库:
  os                             — 日志文件创建
  io                             — MultiWriter (控制台+文件)
  time                           — 时间戳格式
  fmt                            — 格式化
  path/filepath                  — 日志文件路径

实现要点:

  • 导出全局 Logger 实例
  • 支持 --verbose / --quiet / --log-level 全局标志
  • 支持 --log-file 输出到文件
  • 集成到 cmd/devpack/commands/root.goPersistentPreRun

需修改的现有文件:

文件 改动
cmd/devpack/commands/root.go PersistentPreRunE 中初始化 Logger传递 verbose/quiet/log-level/log-file 标志
go.mod 添加 github.com/rs/zerolog 依赖

任务 1.2 — 配置系统

新建文件:

文件 说明
internal/config/config.go 配置结构体定义 (AppConfig)、加载/保存/默认值逻辑
internal/config/config_test.go 配置系统单元测试

所需库:

第三方库:
  github.com/spf13/viper         — 配置文件读取(已有)
  gopkg.in/yaml.v3               — YAML 序列化/反序列化

标准库:
  os                             — 文件操作
  path/filepath                  — 路径拼接
  fmt                            — 格式化

需修改的现有文件:

文件 改动
internal/config/paths.go 增加 ConfigFilePath() 方法返回 config.yaml 路径
go.mod 添加 gopkg.in/yaml.v3 依赖

任务 1.3 — Profile 系统核心

新建文件:

文件 说明
internal/profile/profile.go Profile 结构体、加载/保存/验证/列出/默认模板
internal/profile/profile_test.go Profile 单元测试
internal/profile/templates.go 预设模板: minimal / standard / full

所需库:

第三方库:
  gopkg.in/yaml.v3               — Profile YAML 解析与生成

标准库:
  os                             — 文件操作
  path/filepath                  — Profile 文件路径
  fmt                            — 错误信息
  strings                        — 字符串处理

任务 1.4 — 平台适配层完善

需修改的现有文件:

文件 改动 所需库
internal/platform/platform.go 添加 InstallFont()RunAsAdmin() 方法签名 os/exec
internal/platform/windows.go 实现 InstallFont() (注册表写入)、RunAsAdmin() (runas 动词)、完善 SetEnvVar (使用 golang.org/x/sys/windows/registry) os/exec, golang.org/x/sys/windows/registry
internal/platform/darwin.go 实现 InstallFont() (~/Library/Fonts)、RunAsAdmin() (osascript) os/exec, os
internal/platform/linux.go 实现 InstallFont() (~/.local/share/fonts)、RunAsAdmin() (pkexec/sudo) os/exec, os

新建文件:

文件 说明
internal/platform/platform_test.go 平台层单元测试 (使用 build tags 分平台)

额外库(仅 Windows 构建时需要):

第三方库:
  golang.org/x/sys/windows/registry  — Windows 注册表操作 (设置环境变量、安装字体)

任务 1.5 — init 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/init.go 实现完整的 init 逻辑:创建目录、写入默认 config.yaml、创建默认 Profile、支持 --template / --profile / --force internal/config, internal/profile, internal/logging

依赖的内部包:

internal/config    — DefaultPaths(), EnsureDirs()
internal/profile   — 创建默认/模板 Profile
internal/logging   — 日志记录

标准库:
  os               — 文件/目录创建
  fmt              — 用户输出
  path/filepath    — 路径

任务 1.6 — 终端 UI 工具

新建文件:

文件 说明
internal/ui/printer.go 统一输出工具Success/Error/Warn/Info 打印、Verbose 判断
internal/ui/table.go 表格渲染封装 (基于 tablewriter)
internal/ui/spinner.go 加载动画封装 (用于扫描等操作)

所需库:

第三方库:
  github.com/fatih/color                — 终端颜色 (绿色✓、红色✗、黄色⚠ 等)
  github.com/olekukonenko/tablewriter   — 终端表格

标准库:
  fmt              — 格式化输出
  os               — Stdout/Stderr
  io               — Writer 接口
  strings          — 字符串处理
  time             — 动画定时
  sync             — Spinner 并发控制

需修改的现有文件:

文件 改动
go.mod 添加 github.com/fatih/colorgithub.com/olekukonenko/tablewriter

任务 1.7 — 错误处理系统

新建文件:

文件 说明
internal/errors/errors.go DevPackError 结构体、ErrorLevel 枚举、CollectorError、格式化输出
internal/errors/errors_test.go 错误处理单元测试

所需库:

标准库:
  fmt              — 错误格式化
  errors           — errors.Is / errors.As 兼容
  strings          — 消息拼接

M2: 核心采集器(第 3-5 周)

任务 2.1 — Go 运行时采集器

新建文件:

文件 说明
internal/collector/runtime/go_collector.go Go 采集器: 扫描版本、GOPATH、GOROOT、go env、GOPATH/bin 下的工具
internal/collector/runtime/go_collector_test.go Go 采集器单元测试

所需库:

标准库:
  os/exec          — 执行 `go version`、`go env -json`、`go install`
  encoding/json    — 解析 `go env -json` 输出
  context          — 命令超时控制
  path/filepath    — GOPATH/bin 扫描
  os               — 文件遍历
  strings          — 输出解析
  runtime          — 获取当前 Go 信息
  fmt              — 格式化

实现逻辑:

  • Scan(): go version 获取版本,go env -json 获取环境,遍历 GOPATH/bin 获取安装的工具
  • Capture(): 将 metadata.json (版本+env) + go-tools.json (工具列表) 写入目标目录
  • Restore(): 检测 Go 是否安装 → 安装缺失工具 (go install xxx@latest)
  • Verify(): 验证 Go 版本和工具是否存在

任务 2.2 — Node.js 运行时采集器

新建文件:

文件 说明
internal/collector/runtime/node_collector.go Node.js 采集器: 扫描 node/npm/nvm 版本、全局包
internal/collector/runtime/node_collector_test.go 单元测试

所需库:

标准库:
  os/exec          — 执行 `node --version`、`npm --version`、`npm list -g --json`
  encoding/json    — 解析 npm list JSON
  context          — 超时
  strings          — 版本解析
  fmt              — 格式化

实现逻辑:

  • Scan(): node --versionnpm --versionnpm list -g --json 获取全局包
  • Capture(): 写入 metadata.json + global-packages.json
  • Restore(): npm install -g <package>@<version> 逐个安装
  • Verify(): 验证 node 版本和全局包

任务 2.3 — Python 运行时采集器

新建文件:

文件 说明
internal/collector/runtime/python_collector.go Python 采集器: 版本、pip 包、virtualenv 配置
internal/collector/runtime/python_collector_test.go 单元测试

所需库:

标准库:
  os/exec          — 执行 `python --version`、`pip list --format=json`
  encoding/json    — 解析 pip list JSON
  context          — 超时
  strings          — 解析
  fmt              — 格式化

实现逻辑:

  • Scan(): python --versionpip --versionpip list --format=json
  • Capture(): 写入 metadata.json + pip-packages.json
  • Restore(): pip install <package>==<version> 逐个安装
  • Verify(): 验证安装

任务 2.4 — VS Code 编辑器采集器

新建文件:

文件 说明
internal/collector/editor/vscode_collector.go VS Code 采集器: 版本、扩展列表、settings.json、keybindings.json、代码片段
internal/collector/editor/vscode_collector_test.go 单元测试

所需库:

标准库:
  os/exec          — 执行 `code --version`、`code --list-extensions --show-versions`、`code --install-extension`
  encoding/json    — 解析/生成 settings.json
  os               — 读取 settings.json、keybindings.json 文件
  path/filepath    — VS Code 配置文件路径 (不同平台不同)
  context          — 超时
  strings          — 扩展列表解析
  io               — 文件复制
  fmt              — 格式化

实现逻辑:

  • Scan():
    • code --version 获取版本
    • code --list-extensions --show-versions 获取扩展列表
    • 读取 %APPDATA%/Code/User/settings.json (Windows) 或 ~/Library/Application Support/Code/User/settings.json (macOS)
    • 读取 keybindings.json、snippets 目录
  • Capture(): 复制 settings.json / keybindings.json / snippets/ + 写入 extensions.json
  • Restore(): code --install-extension <id>@<version> 逐个安装扩展、复制配置文件
  • Verify(): 验证扩展已安装

任务 2.5 — PowerShell Shell 采集器

新建文件:

文件 说明
internal/collector/shell/powershell_collector.go PowerShell 采集器: 版本、已安装模块、Profile 脚本
internal/collector/shell/powershell_collector_test.go 单元测试

所需库:

标准库:
  os/exec          — 执行 `pwsh -Command "Get-Module -ListAvailable | ConvertTo-Json"`
  encoding/json    — 解析 PowerShell JSON 输出
  os               — 读取 $PROFILE 文件
  path/filepath    — Profile 路径
  context          — 超时
  strings          — 解析
  io               — 文件复制

实现逻辑:

  • Scan(): PowerShell 版本、Get-Module -ListAvailable、Profile 路径
  • Capture(): 写入 metadata.json + modules.json + profile 文件内容
  • Restore(): Install-Module -Name <name> -Force 安装模块 + 写入 Profile
  • Verify(): 验证模块和 Profile

任务 2.6 — Scoop 包管理器采集器 (Windows)

新建文件:

文件 说明
internal/collector/package/scoop_collector.go Scoop 采集器: 已安装包、bucket 列表
internal/collector/package/scoop_collector_test.go 单元测试

所需库:

标准库:
  os/exec          — 执行 `scoop list`、`scoop bucket list`、`scoop install`
  encoding/json    — 解析 scoop export JSON
  context          — 超时
  strings          — 输出解析
  os               — Scoop 目录检测
  fmt              — 格式化

实现逻辑:

  • Scan(): scoop export (JSON)、scoop bucket list
  • Capture(): 写入 packages.json + buckets.json
  • Restore(): 先 scoop bucket add,再 scoop install <pkg>
  • Verify(): 验证包是否已安装

任务 2.7 — Git 配置采集器

新建文件:

文件 说明
internal/collector/git/git_collector.go Git 采集器: 全局配置、别名
internal/collector/git/git_collector_test.go 单元测试

所需库:

标准库:
  os/exec          — 执行 `git config --global --list`、`git config --global <key> <value>`
  context          — 超时
  strings          — key=value 解析
  bufio            — 逐行读取 .gitconfig
  os               — 读取 ~/.gitconfig 文件
  path/filepath    — 路径
  fmt              — 格式化

任务 2.8 — 环境变量采集器

新建文件:

文件 说明
internal/collector/env/env_collector.go 环境变量采集器: 按 Profile 中定义的 include/exclude pattern 过滤
internal/collector/env/env_collector_test.go 单元测试

所需库:

标准库:
  os               — os.Environ() 获取所有环境变量
  strings          — key=value 拆分、pattern 匹配
  path/filepath    — filepath.Match 用于 glob 匹配
  context          — 超时
  fmt              — 格式化
  encoding/json    — 序列化

内部依赖:
  internal/platform  — SetEnvVar() 设置环境变量 (不同平台不同)

任务 2.9 — 采集器自动注册

需修改的现有文件:

文件 改动 所需库
internal/collector/registry.go 无需修改,现有注册机制已可用
cmd/devpack/main.go 添加 registerCollectors() 函数,创建 Registry 实例并注册所有内置采集器 所有 internal/collector/* 子包

新建文件:

文件 说明
internal/collector/register.go RegisterBuiltins(registry) — 一次性注册所有内置采集器,集中管理

任务 2.10 — scan 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/scan.go 实现完整扫描逻辑:解析 flags → 加载 Profile → 选择采集器 → 并发扫描 → 格式化输出 (table/json/yaml) internal/collector, internal/profile, internal/ui, internal/logging

依赖的内部包:

internal/collector     — Registry.ScanAll() / ListByCategory()
internal/profile       — 加载 Profile 确定启用的采集器
internal/ui            — 表格渲染、颜色输出
internal/logging       — 日志
internal/config        — 路径

标准库:
  encoding/json        — --output json
  context              — 超时控制
  fmt                  — 输出
  strings              — 逗号分隔解析
  time                 — 扫描耗时

M3: 打包引擎(第 6-7 周)

任务 3.1 — Pack 引擎核心

新建文件:

文件 说明
internal/pack/engine.go PackEngine 结构体:创建 Pack 的核心流程控制
internal/pack/engine_test.go Pack 引擎单元测试
internal/pack/archive.go tar.gz 打包/解包实现
internal/pack/archive_test.go 归档单元测试
internal/pack/checksum.go SHA-256 校验和计算与验证
internal/pack/checksum_test.go 校验和单元测试

所需库:

第三方库:
  github.com/google/uuid         — 生成 Pack UUID

标准库:
  archive/tar        — tar 格式写入/读取
  compress/gzip      — gzip 压缩/解压
  crypto/sha256      — SHA-256 校验和
  encoding/hex       — 校验和 hex 编码
  encoding/json      — manifest.json 写入
  io                 — 数据流复制
  os                 — 文件操作
  path/filepath      — 路径遍历
  time               — 时间戳
  fmt                — 格式化
  strings            — 路径处理

需修改的现有文件:

文件 改动
pkg/manifest/manifest.go 添加 Validate() 方法、NewManifest() 构造函数
go.mod 添加 github.com/google/uuidgithub.com/schollz/progressbar/v3

任务 3.2 — capture 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/capture.go 实现完整捕获流程:解析 flags → 加载 Profile → 创建临时目录 → 并发运行 Capture() → 生成 Manifest → 打包 → 输出结果 internal/pack, internal/collector, internal/profile, internal/ui, internal/logging

依赖的内部包:

internal/pack        — PackEngine.CreatePack()
internal/collector   — Registry + 各采集器
internal/profile     — 加载 Profile
internal/ui          — 进度条、表格
internal/logging     — 日志
internal/config      — 路径 (Packs 目录)
pkg/manifest         — Manifest 构建

标准库:
  os                 — 临时目录、文件
  path/filepath      — 路径
  context            — 超时
  fmt                — 输出
  time               — 时间戳

任务 3.3 — export / import 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/export.go export: 从内部 Packs 目录复制 .devpack 到指定路径; import: 从外部路径复制 .devpack 到 Packs 目录并验证 internal/pack, internal/config, internal/ui

所需库:

标准库:
  os                 — 文件复制
  io                 — 数据流
  path/filepath      — 路径
  fmt                — 输出

任务 3.4 — 进度条组件

新建文件或修改:

文件 说明
internal/ui/progress.go 基于 progressbar 库的进度条封装、适配打包/还原等长时操作

所需库:

第三方库:
  github.com/schollz/progressbar/v3  — 进度条渲染

标准库:
  os               — Stderr 输出
  fmt              — 格式化

M4: 还原引擎(第 8-10 周)

任务 4.1 — 还原引擎核心

新建文件:

文件 说明
internal/restore/engine.go RestoreEngine: 解包 → 校验 → 解析 Manifest → 平台检查 → 冲突检测 → 执行还原 → 验证 → 报告
internal/restore/engine_test.go 还原引擎单元测试
internal/restore/plan.go RestorePlan: 还原计划生成、依赖排序 (拓扑排序)
internal/restore/plan_test.go 还原计划单元测试
internal/restore/conflict.go 冲突检测器: 版本对比、已存在检测、策略应用
internal/restore/conflict_test.go 冲突检测单元测试
internal/restore/report.go 还原报告: 成功/失败/跳过/警告 的汇总和输出

所需库:

第三方库:
  github.com/AlecAivazis/survey/v2   — 冲突时交互式提示 (ConflictPrompt 策略)

标准库:
  archive/tar        — 解包
  compress/gzip      — 解压
  crypto/sha256      — 校验和验证
  encoding/hex       — hex 解码
  encoding/json      — Manifest 解析
  os                 — 文件操作
  path/filepath      — 路径
  context            — 超时
  fmt                — 格式化
  sort               — 依赖排序
  strings            — 版本对比
  time               — 时间
  sync               — 并发控制

任务 4.2 — 干运行模式

涉及文件:

文件 改动
internal/restore/engine.go Restore() 中根据 DryRun 标志只模拟操作、输出计划但不执行
internal/restore/report.go DryRun 专用报告格式

所需库: 无额外依赖,使用已有标准库


任务 4.3 — restore 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/restore.go 实现完整还原流程:解析 flags → 加载 Pack → 调用 RestoreEngine → 处理冲突 → 输出报告 internal/restore, internal/pack, internal/ui, internal/logging, internal/collector

依赖的内部包:

internal/restore     — RestoreEngine
internal/pack        — Pack 解包、校验和验证
internal/collector   — 各采集器 Restore() / Verify()
internal/ui          — 进度条、表格、确认提示
internal/logging     — 日志
internal/config      — 路径
internal/profile     — Profile 加载
pkg/manifest         — Manifest 解析

任务 4.4 — 各采集器的 Restore 逻辑

此阶段需回到每个采集器文件实现完整的 Restore()Verify() 方法:

文件 Restore 逻辑 所需命令
internal/collector/runtime/go_collector.go go install <tool>@latest 安装工具 os/exec
internal/collector/runtime/node_collector.go npm install -g <pkg>@<ver> 安装全局包 os/exec
internal/collector/runtime/python_collector.go pip install <pkg>==<ver> 安装包 os/exec
internal/collector/editor/vscode_collector.go code --install-extension <id> + 复制配置文件 os/exec, io, os
internal/collector/shell/powershell_collector.go Install-Module -Name <mod> + 写入 Profile os/exec, os
internal/collector/package/scoop_collector.go scoop bucket add + scoop install os/exec
internal/collector/git/git_collector.go git config --global <key> <value> os/exec
internal/collector/env/env_collector.go 调用 platform.SetEnvVar() internal/platform

M5: 配置与打磨(第 11-12 周)

任务 5.1 — profile 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/profile.go 实现 create/show/list/delete/use 五个子命令的完整逻辑 internal/profile, internal/config, internal/ui, internal/logging

依赖的内部包:

internal/profile     — Profile CRUD 操作
internal/config      — 路径
internal/ui          — 表格、颜色输出
internal/logging     — 日志

标准库:
  fmt                — 输出
  os                 — 文件操作
  path/filepath      — 路径

任务 5.2 — list 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/list.go 实现 packs/profiles/collectors 列表展示,支持 --format 标志 internal/pack, internal/profile, internal/collector, internal/ui

所需标准库:

  encoding/json      — --format json 输出
  fmt                — 格式化
  path/filepath      — 扫描 Packs 目录
  os                 — 读取目录
  time               — Pack 创建时间

任务 5.3 — diff 命令实现

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/diff.go 实现环境对比逻辑Pack vs 当前环境 / Pack vs Pack internal/pack, internal/collector, internal/ui

新建文件:

文件 说明
internal/diff/differ.go 差异计算引擎:逐项对比、输出 added/removed/changed
internal/diff/differ_test.go 差异引擎单元测试

所需库:

标准库:
  encoding/json      — 数据加载
  fmt                — 输出
  strings            — 版本对比
  sort               — 排序

内部依赖:
  internal/ui        — 彩色差异输出 (红色-/绿色+/黄色~)

任务 5.4 — 测试覆盖率提升

新建文件:

文件 说明
internal/pack/engine_integration_test.go Pack 引擎集成测试:完整的打包→解包流程
internal/restore/engine_integration_test.go 还原引擎集成测试
test/e2e/capture_restore_test.go 端到端测试capture → export → import → restore

所需库:

第三方库:
  github.com/stretchr/testify/assert    — 断言
  github.com/stretchr/testify/require   — 必要条件断言
  github.com/stretchr/testify/mock      — Mock (模拟外部命令)

标准库:
  testing            — Go 测试框架
  os                 — 临时目录
  path/filepath      — 路径
  io/fs              — 文件遍历

任务 5.5 — version 命令增强

需修改的现有文件:

文件 改动 所需库
cmd/devpack/commands/version.go 添加 --check-update 标志,从 GitHub API 检查最新版本 net/http, encoding/json
pkg/version/version.go 添加 CheckLatest() 方法 net/http, encoding/json, fmt

文件总览与新增文件清单

新建文件列表 (按模块分组)

internal/
├── logging/
│   ├── logger.go                    # zerolog 封装
│   └── logger_test.go
├── config/
│   ├── config.go                    # AppConfig 配置结构
│   └── config_test.go
├── profile/
│   ├── profile.go                   # Profile CRUD
│   ├── profile_test.go
│   └── templates.go                 # 预设模板
├── ui/
│   ├── printer.go                   # 统一输出工具
│   ├── table.go                     # 表格渲染
│   ├── spinner.go                   # 加载动画
│   └── progress.go                  # 进度条
├── errors/
│   ├── errors.go                    # 错误类型
│   └── errors_test.go
├── collector/
│   ├── register.go                  # RegisterBuiltins()
│   ├── runtime/
│   │   ├── go_collector.go
│   │   ├── go_collector_test.go
│   │   ├── node_collector.go
│   │   ├── node_collector_test.go
│   │   ├── python_collector.go
│   │   └── python_collector_test.go
│   ├── editor/
│   │   ├── vscode_collector.go
│   │   └── vscode_collector_test.go
│   ├── shell/
│   │   ├── powershell_collector.go
│   │   └── powershell_collector_test.go
│   ├── package/
│   │   ├── scoop_collector.go
│   │   └── scoop_collector_test.go
│   ├── git/
│   │   ├── git_collector.go
│   │   └── git_collector_test.go
│   └── env/
│       ├── env_collector.go
│       └── env_collector_test.go
├── pack/
│   ├── engine.go                    # PackEngine
│   ├── engine_test.go
│   ├── engine_integration_test.go
│   ├── archive.go                   # tar.gz 归档
│   ├── archive_test.go
│   ├── checksum.go                  # SHA-256 校验和
│   └── checksum_test.go
├── restore/
│   ├── engine.go                    # RestoreEngine
│   ├── engine_test.go
│   ├── engine_integration_test.go
│   ├── plan.go                      # 还原计划
│   ├── plan_test.go
│   ├── conflict.go                  # 冲突检测
│   ├── conflict_test.go
│   └── report.go                    # 还原报告
├── diff/
│   ├── differ.go                    # 差异引擎
│   └── differ_test.go
├── platform/
│   └── platform_test.go             # 平台层测试
test/
└── e2e/
    └── capture_restore_test.go      # 端到端测试

新增文件总计:约 45 个


go.mod 最终依赖

完成 MVP 后,go.mod 应包含以下直接依赖:

require (
    // CLI 框架 (已有)
    github.com/spf13/cobra v1.8.0
    github.com/spf13/viper v1.18.2

    // 日志
    github.com/rs/zerolog v1.32.0

    // 终端 UI
    github.com/fatih/color v1.16.0
    github.com/olekukonenko/tablewriter v0.0.5
    github.com/schollz/progressbar/v3 v3.14.2

    // 交互式提示
    github.com/AlecAivazis/survey/v2 v2.3.7

    // 数据格式
    gopkg.in/yaml.v3 v3.0.1

    // 工具
    github.com/google/uuid v1.6.0

    // 测试
    github.com/stretchr/testify v1.9.0
)

v0.3.0 版本额外添加:

require (
    golang.org/x/crypto v0.21.0     // Argon2id 密钥派生
    golang.org/x/sys v0.18.0        // Windows 注册表操作
)

开发顺序建议

Week 1-2:  M1 (logging → config → profile → ui → errors → init → 平台完善)
                ↓
Week 3-5:  M2 (go → node → python → vscode → powershell → scoop → git → env → scan)
                ↓
Week 6-7:  M3 (archive → checksum → pack engine → capture → export/import)
                ↓
Week 8-10: M4 (plan → conflict → restore engine → 各采集器 restore → restore cmd)
                ↓
Week 11-12: M5 (profile cmd → list → diff → tests → 打磨)

每完成一个模块就跑 go test ./... 确保不引入回归。