zai-org / zai-org/feedback

[建议 / Feature] 支持非交互式 / 可脚本化的单轮执行模式(对标 codex exec / claude -p)

Open
#29 16 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P1
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复提议 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

其他 / 不确定 · Other / Not sure

涉及的 Agent 框架 · Agent framework

多个 / 通用 · Multiple / General

使用场景 · Use case

在 CI / 脚本 / 自动化里想把 ZCode 当成一个可被 shell 调用的"单次任务执行器":从命令行参数或 stdin 读入一段 prompt,跑完即退出,把结果输出到 stdout。
现在 ZCode 主要是桌面 / 交互式会话,没法被 Makefile、git hook、CI 流水线、shell pipeline 这种"非交互"场景直接调用——这些场景里没有 TTY、也不能让人盯着等输入。

具体例子:

  • zcode exec "把 src 下所有 TODO 注释列出来" —— 跑完打印结果就退
  • cat changed.diff | zcode exec "review 这段 diff,只输出 pass/fail" —— 塞进 pre-commit / CI gate
  • zcode exec --json "生成这周的 changelog" —— 输出 JSON 给后续脚本消费
建议方案 · Proposal

增加一个非交互、单轮、脚本可调用的执行模式(对标 codex exec / claude -p)。期望形态:

  • 从命令行参数或 stdin 读取 prompt;
  • 执行完一次性退出,不进入交互 REPL;
  • 结果写到 stdout(建议支持 --output-format json 之类选项,便于脚本解析);
  • 可配置 --model--cwd / --cd、超时、权限模式等。

说明:这和 #8(Linux 版本和 ZCode Agent CLI)、#26(支持远程编程吗?)方向相关但不重复——那两个 issue 主要诉求是「出一个交互式 CLI / 远程接入能力」(Linux / SSH / REPL 场景);本 issue 聚焦的是「非交互、单轮、可脚本化」这个更窄但很常用的子能力(CI / 自动化 / shell pipeline)。两者可以独立评估、也可以一起规划,但场景不同,单独跟踪更清晰。

预期价值 · Expected value
  • 打通 CI / 自动化场景:pre-commit review、PR 自动检查、批量代码处理、定时任务(与 #27 协同)都能用 ZCode 跑。
  • 让 ZCode 能作为 Unix pipeline 里的一环(stdin 进、stdout 出),复用现有工具链。
  • 降低从 Codex / Claude Code 迁移用户的迁移成本——他们已有大量依赖 codex exec / claude -p 的脚本和流水线。
  • 解锁"无人值守"工作流(无 TTY 的服务器、容器、CI runner),这是纯交互式 CLI 覆盖不到的场景。
你认为的优先级 · Your perceived priority

高 · High

你使用的 ZCode 版本 / 环境 · ZCode version / environment

3.1.2 / Windows 11

补充材料 · Additional context

参考实现:

  • Codex:codex exec "<prompt>"(非交互,可 --json
  • Claude Code:claude -p "<prompt>"(print 模式,非交互)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CONTRIBUTING.md and compare the requested workflows with issues #8, #26, and #27. Define the supported prompt inputs, non-interactive exit behavior, stdout/JSON output contract, and configuration flags; done means a single-run invocation works in CI and shell scripts and its behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
ci-cd, cli, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.