CLI 参考
migrate-workspace
apothem migrate-workspace 命令的 CLI 参考。
将每harness的旧式工作区迁移到共享的 .apothem 布局。
概要
apothem migrate-workspace [--project PATH] [--dry-run]
[--quiet|-q] [--verbose|-v]
[--format plain|json] [--json] [--no-color]migrate-workspace 会将每harness的旧式数据主目录(.apothem/<harness>/...)和旧式
.plans/ 树合并到单个共享工作目录 .apothem/{plans,memory,learning,contexts} 中。基准目录在提供时为
解析后的 --project 根目录,否则为当前工作目录(项目本地默认值)。
每harness的内存、上下文和学习存储会按 id 并集合并到共享存储中;学习信号会连接并去重;
冲突记录(id 相同、内容不同)会被跳过,绝不覆盖。旧式 .plans/ 树会被移动到
.apothem/plans/ 之下。每个被消费的来源都会先行备份。该迁移是幂等的——在已迁移的树上
重新运行是一个无操作。
选项
| 选项 | 描述 |
|---|---|
--project PATH | 用于项目范围适配器的项目根目录,这些适配器物化到项目树中,而非用户范围的配置目录。 |
--dry-run | 检测旧式布局并报告将迁移的内容,但不写入。 |
--quiet, -q | 抑制信息性输出;仅发出错误。 |
--verbose, -v | 发出额外的诊断输出。 |
--format plain|json | 输出格式(默认:plain)。 |
--json | --format json 的简写。 |
--no-color | 在输出中禁用 ANSI 颜色码。 |
-h, --help | 显示帮助并退出。 |
JSON 输出
--json 信封携带迁移结果。在迁移完成时,status 为 success,载荷会报告合并的记录计数、
是否重新放置了 .plans/ 树、备份根目录,以及任何被跳过的冲突。--dry-run 调用则改为报告
legacy_layout_detected。
{
"command": "migrate-workspace",
"status": "success",
"base": "/home/example/project",
"migrated": true,
"backup_root": "/home/example/project/.apothem/.backups/01J9Z…",
"memory_merged": 12,
"contexts_merged": 4,
"learning_merged": 7,
"conflicts": [],
"plans_moved": true,
"notes": []
}当不存在旧式布局时,migrated 为 false 且不写入任何内容。--dry-run 信封会省略结果
计数,仅报告检测结果:
{
"command": "migrate-workspace",
"base": "/home/example/project",
"dry_run": true,
"legacy_layout_detected": false
}示例
apothem migrate-workspace
apothem migrate-workspace --project .
apothem migrate-workspace --dry-run --json退出码
| 码 | 含义 |
|---|---|
| 0 | 迁移完成,或未找到旧式布局(无需迁移) |
| 1 | 预期错误——校验或项目根目录错误,或迁移失败 |
另请参阅
- apothem install — 从共享配置文件物化某个harness
- apothem status — 报告安装、校验和漂移状态
- 计划纪律 — 共享的
.apothem/plans/布局