Plandex计划配置:任务参数与执行选项设置
Plandex作为一款先进的AI编码引擎,其核心优势在于灵活可配置的计划执行系统。本文将深入解析Plandex的计划配置功能,帮助开发者根据项目需求精准控制AI任务的执行行为。
配置系统概览
Plandex提供多层次的配置体系,包括:
- 计划级别配置:针对单个任务的个性化设置
- 用户默认配置:全局默认参数设置
- 命令行覆盖:单次执行的临时参数
核心配置参数详解
自动化控制参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
auto-mode | string | semi | 整体自动化级别(none/basic/plus/semi/full) |
auto-continue | bool | true | 自动继续计划直到完成 |
auto-build | bool | true | 自动将变更构建为待处理更新 |
auto-apply | bool | false | 自动将变更应用到项目文件 |
can-exec | bool | true | 允许命令执行(安全设置) |
auto-exec | bool | true | 自动执行命令 |
auto-debug | bool | false | 自动调试失败的命令 |
auto-debug-tries | int | 5 | 自动调试尝试次数 |
上下文管理参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
auto-update-context | bool | true | 文件变更时自动更新上下文 |
auto-load-context | bool | true | 使用项目映射自动加载上下文 |
smart-context | bool | true | 智能上下文加载(仅加载必要文件) |
版本控制参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
auto-commit | bool | true | 应用变更后自动提交到git |
auto-revert-on-rewind | bool | true | 回滚时恢复项目文件 |
自动化级别矩阵
Plandex提供5种预设的自动化级别,每种级别对应不同的配置组合:
功能 | None | Basic | Plus | Semi | Full |
---|---|---|---|---|---|
auto-continue | ❌ | ✅ | ✅ | ✅ | ✅ |
auto-build | ❌ | ✅ | ✅ | ✅ | ✅ |
auto-load-context | ❌ | ❌ | ❌ | ✅ | ✅ |
smart-context | ❌ | ❌ | ✅ | ✅ | ✅ |
auto-update-context | ❌ | ❌ | ✅ | ✅ | ✅ |
auto-apply | ❌ | ❌ | ❌ | ❌ | ✅ |
can-exec | ❌ | ❌ | ✅ | ✅ | ✅ |
auto-exec | ❌ | ❌ | ❌ | ❌ | ✅ |
auto-debug | ❌ | ❌ | ❌ | ❌ | ✅ |
auto-commit | ❌ | ❌ | ✅ | ✅ | ✅ |
配置管理命令
查看配置
# 查看当前计划配置
plandex config
# 查看新计划的默认配置
plandex config default
# REPL环境中查看配置
\config
\config default
修改配置
# 交互式设置配置选项
plandex set-config
# 设置特定选项
plandex set-config auto-apply true
plandex set-config default auto-mode basic
# REPL环境中设置配置
\set-config
\set-config default
设置自动化级别
# 设置当前计划自动化级别
plandex set-auto none # 无自动化
plandex set-auto basic # 基础自动化
plandex set-auto plus # 增强自动化
plandex set-auto semi # 半自动化(默认)
plandex set-auto full # 全自动化
# 设置新计划默认自动化级别
plandex set-auto default basic
命令行参数覆盖
多数配置可以通过命令行标志临时覆盖:
# 单次执行时覆盖配置参数
plandex tell "添加新功能" --apply --auto-exec --debug
# 创建新计划时指定自动化级别
plandex new --no-auto # 无自动化
plandex new --basic # 基础自动化
plandex new --plus # 增强自动化
plandex new --semi # 半自动化
plandex new --full # 全自动化
这些覆盖仅对当前命令有效,不会修改保存的配置。
配置应用场景
安全开发模式
# 禁用命令执行,确保安全
plandex set-config can-exec false
plandex set-config auto-apply false
快速原型开发
# 启用全自动化,快速迭代
plandex set-auto full
代码审查场景
# 仅生成变更,不自动应用
plandex set-config auto-apply false
plandex set-config auto-commit false
最佳实践建议
安全性考虑
- 新项目开始时使用
semi
模式,平衡自动化与控制 - 重要项目禁用
auto-apply
,手动审查所有变更 - 生产环境禁用
can-exec
,防止意外命令执行 - 定期检查git状态,确保变更可控
性能优化配置
# 启用智能上下文加载,提升性能
plandex set-config smart-context true
plandex set-config auto-update-context true
团队协作配置
# 统一团队默认配置
plandex set-config default auto-mode semi
plandex set-config default auto-commit true
故障排除
配置不生效
检查配置层级优先级:
- 命令行参数(最高优先级)
- 计划级别配置
- 用户默认配置(最低优先级)
恢复默认配置
# 重置为默认值
plandex set-config auto-apply
plandex set-config auto-exec
总结
Plandex的计划配置系统提供了精细化的任务控制能力,开发者可以根据项目需求、安全要求和团队规范灵活调整自动化级别。通过合理配置,可以在开发效率和安全控制之间找到最佳平衡点。
记住:全自动化模式(Full)虽然高效,但需要谨慎使用。建议在独立分支上测试全自动化功能,确保git状态清洁,避免对系统造成意外影响。
通过掌握Plandex的配置系统,您将能够充分发挥AI编码引擎的潜力,同时保持对开发过程的完全控制。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考