返回顶部
g

gsd-orchestratorGSD编排器

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
144
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

gsd-orchestrator

GSD Orchestrator

通过 gsd headless 以子进程方式运行 GSD 命令。无需 SDK,无需 RPC——仅需 shell 执行、退出码和标准输出的 JSON。

快速开始

bash

全局安装 GSD


npm install -g gsd-pi

验证安装

gsd --version

根据规范创建里程碑并执行

gsd headless --output-format json new-milestone --context spec.md --auto

命令语法

bash
gsd headless [flags] [command] [args...]

默认命令为 auto(运行所有排队的单元)。

标志

标志描述
--output-format <fmt>输出格式:text(默认)、json(退出时输出结构化结果)、stream-json(JSONL 事件)
--json
--output-format stream-json 的别名——JSONL 事件流输出到标准输出 | | --bare | 最小上下文:跳过 CLAUDE.md、AGENTS.md、用户设置、用户技能。适用于 CI/生态系统运行。 | | --resume | 通过会话 ID 恢复之前的 headless 会话 | | --timeout N | 总体超时时间(毫秒,默认:300000) | | --model ID | 覆盖 LLM 模型 | | --supervised | 通过标准输出/标准输入将交互式 UI 请求转发给编排器 | | --response-timeout N | 监督模式下编排器响应的超时时间(毫秒,默认:30000) | | --answers | 从 JSON 文件预提供答案和密钥 | | --events | 将 JSONL 输出过滤到特定事件类型(逗号分隔,隐含 --json) | | --verbose | 在进度输出中显示工具调用 |

退出码

含义常量
0成功——单元/里程碑完成EXITSUCCESS
1
错误或超时 | EXITERROR | | 10 | 阻塞——需要人工干预 | EXIT_BLOCKED | | 11 | 被用户或编排器取消 | EXIT_CANCELLED |

这些代码是稳定的,适用于 CI 流水线和编排器逻辑。

输出格式

格式行为
text标准错误输出上的人类可读进度。默认。
json
静默收集事件。退出时向标准输出发出单个 HeadlessJsonResult JSON 对象。 | | stream-json | 实时向标准输出流式传输 JSONL 事件(与 --json 相同)。 |

当需要结构化结果进行决策时,使用 --output-format json。完整字段参考请参见 references/json-result.md

核心工作流

1. 创建 + 执行里程碑(端到端)

bash
gsd headless --output-format json new-milestone --context spec.md --auto

读取规范文件,引导 .gsd/,创建里程碑,然后链接到自动模式执行所有阶段(讨论 → 研究 → 计划 → 执行 → 总结 → 完成)。退出时在标准输出上发出 JSON 结果。

new-milestone 的额外标志:

  • - --context — 规范/PRD 文件路径(使用 - 表示标准输入)
  • --context-text — 内联规范文本
  • --auto — 创建里程碑后启动自动模式
  • --verbose — 在进度输出中显示工具调用

bash

从标准输入


cat spec.md | gsd headless --output-format json new-milestone --context - --auto

内联文本

gsd headless new-milestone --context-text 构建一个用户管理的 REST API --auto

2. 运行所有排队的工作

bash
gsd headless --output-format json auto

循环处理所有待处理的单元,直到里程碑完成或阻塞。

3. 运行一个单元(逐步)

bash
gsd headless --output-format json next

精确执行一个单元(任务/切片/里程碑步骤),然后退出。这是需要在步骤之间进行控制的编排器的推荐模式。

4. 即时状态快照(无 LLM)

bash
gsd headless query

返回包含完整项目快照的单个 JSON 对象——无 LLM 会话,即时(约 50 毫秒)。这是编排器检查状态的推荐方式。

json
{
state: {
phase: executing,
activeMilestone: { id: M001, title: ... },
activeSlice: { id: S01, title: ... },
progress: { completed: 3, total: 7 },
registry: [...]
},
next: { action: dispatch, unitType: execute-task, unitId: M001/S01/T01 },
cost: { workers: [{ milestoneId: M001, cost: 1.50 }], total: 1.50 }
}

5. 调度特定阶段

bash
gsd headless dispatch research|plan|execute|complete|reassess|uat|replan

强制路由到特定阶段,绕过正常的状态机路由。

6. 恢复会话

bash
gsd headless --resume auto

恢复之前的 headless 会话。会话 ID 可在之前 --output-format json 运行的 HeadlessJsonResult.sessionId 字段中获得。

编排器模式

解析结构化 JSON 结果

使用 --output-format json 时,进程在退出时向标准输出发出单个 HeadlessJsonResult。解析它以进行决策:

bash
RESULT=$(gsd headless --output-format json next 2>/dev/null)
EXIT=$?

STATUS=$(echo $RESULT | jq -r .status)
COST=$(echo $RESULT | jq -r .cost.total)
PHASE=$(echo $RESULT | jq -r .phase)
NEXT=$(echo $RESULT | jq -r .nextAction)
SESSION_ID=$(echo $RESULT | jq -r .sessionId)

echo 状态:$STATUS,成本:\$${COST},阶段:$PHASE,下一步:$NEXT

完整字段参考请参见 references/json-result.md

阻塞检测与处理

退出码 10 表示执行遇到了需要人工干预的阻塞:

bash
gsd headless --output-format json next 2>/dev/null
EXIT=$?

if [ $EXIT -eq 10 ]; then
# 检查阻塞
BLOCKER=$(gsd headless query | jq .state.phase)
echo 阻塞:$BLOCKER

# 选项 1:使用 --supervised 模式进行交互式处理
gsd headless --supervised auto

# 选项 2:预提供答案以解决阻塞
gsd headless --answers blocker-answers.json auto

# 选项 3:调整计划以绕过它
gsd headless steer 跳过阻塞的依赖,改用模拟
fi

成本跟踪与预算执行

bash
MAX_BUDGET=10.00

RESULT=$(gsd headless --output-format json next 2>/dev/null)
COST=$(echo $RESULT | jq -r .cost.total)

通过查询检查累计成本(包括所有工作器)

TOTAL_COST=$(gsd headless query | jq -r .cost.total)

if (( $(echo $TOTALCOST > $MAXBUDGET | bc -l) )); then
echo 超出预算:\$$TOTALCOST > \$$MAXBUDGET
gsd headless stop
exit 1
fi

带监控的逐步执行

完全控制的推荐模式。一次运行一个单元,在步骤之间检查状态:

bash
while true; do
RESULT=$(gsd headless --output-format json next 2>/dev/null)
EXIT=$?

STATUS=$(echo $RESULT | jq -r .status)
COST=$(echo $RESULT | jq -r .cost.total)

echo 退出:$EXIT,状态:$STATUS,成本:\$$COST

# 处理终端状态
[ $EXIT -eq 0 ] || break

# 检查里程碑是否完成
PHASE=$(gsd headless query

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 gsd-orchestrator-1775997373 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 gsd-orchestrator-1775997373 技能

通过命令行安装

skillhub install gsd-orchestrator-1775997373

下载

⬇ 下载 gsd-orchestrator v1.0.0(免费)

文件大小: 10.89 KB | 发布时间: 2026-4-13 10:31

v1.0.0 最新 2026-4-13 10:31
gsd-orchestrator 1.0.0 – Initial release.

- Provides shell-based orchestration for GSD projects using the `gsd headless` command.
- Supports creation, execution, status monitoring, blocker handling, and cost tracking for software development workflows.
- Multiple output formats: plain text, structured JSON, or real-time JSONL event streams.
- Stable exit codes for CI integration and reliability.
- Includes instant project state querying for fast, stateless inspection.
- Extensive CLI documentation and practical orchestrator usage patterns.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部