12.4 非交互模式
12.4.1 run 子命令:Pipeline / CI 场景
# 直接传入提示词
opencode run "Fix the TypeScript errors in src/utils.ts"
# 通过管道传入
cat bug_report.md | opencode run
# 组合使用
echo "Add unit tests for the auth module" | opencode run --model anthropic/claude-sonnet-4
# 继续上一个会话
opencode run -c "Now fix the remaining two test failures"
# 指定输出格式
opencode run --format json "What files were modified?"实现解析
工具调用的格式化输出
JSON 输出格式
管道输入支持
12.4.2 generate 子命令:代码生成模式
12.4.3 serve 子命令:无头 Server
12.4.4 其他非交互命令
12.4.5 小结
Last updated
