Files
dth/openspec/changes/chg_0003_dispatch_helpers/spec.md
T
xstudio agentandClaude Opus 4.8 a94f40e42e merge sandbox/dd24a29: chg_0003 dispatch_helpers — A1 prep + A2 setup + A3 wait scripts (3 host tools, 8 cases, gate PASS)
- scripts/prep-sandbox-skills.sh: A1 host-side skill 拷贝 (跳过 symlink/template-boot-jnpf/JNPF_*)
- scripts/setup-xstudio-ai.sh: A2 host-side ai-config writer (python3 merge 不覆盖已有 providers)
- scripts/wait-for-task.sh: A3 host-side completion poller (轮询 /tmp/xstudio-sandbox/*/space/.xstudio-report.md)
- tests/e2e/dispatch_helpers.test.sh: 6 case 自检
- openspec/changes/chg_0003_dispatch_helpers/{5 工件}

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-09-28 11:18:36 +08:00

36 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
change_id: chg_0003
owner: pd@dth
status: draft
requires_human_validation: false
---
# Spec: dispatch_helpers
## Requirement
提供 3 个 host-side bash 脚本,让下次 dispatch 不再需要手动配 ai-config / 手动 cp skill / 手动轮询 task status。
## ADDED Scenarios
### S1 prep_sandbox_skills_copies_skills
- **WHEN** host 跑 `bash scripts/prep-sandbox-skills.sh <wsHash>` 其中 wsHash 是 `/tmp/xstudio-sandbox/<wsHash>/space/` 真实存在的 sandbox
- **THEN** 脚本退出 0,且 `/tmp/xstudio-sandbox/<wsHash>/space/.claude/skills/` 下包含 `ai-collab-framework` + `ssw-jnpf-lite-react` 两个目录
- **AND** 复制过程跳过 symlink + template-boot-jnpf(>50MB)以减少空间占用
### S2 setup_xstudio_ai_writes_provider_config
- **WHEN** host 跑 `bash scripts/setup-xstudio-ai.sh <workspaceRoot>` 其中 `~/.claude/skills/` 或 `~/ssw.ini` 提供 ANTHROPIC_AUTH_TOKEN
- **THEN** `<workspaceRoot>/.xstudio/ai-config.json` 写入含 `claude-process` provider(baseURL / authTokenEnv=ANTHROPIC_AUTH_TOKEN / model=MiniMax-M3 / ccContainer=true)
- **AND** 若 ai-config.json 已有 providers 字段,**不覆盖**已有 provider,只填空缺失字段(幂等)
### S3 wait_for_task_returns_report_when_md_appears
- **WHEN** host 跑 `bash scripts/wait-for-task.sh <taskId>` 默认 timeout = 3000s
- **AND** 在 timeout 内 `/tmp/xstudio-sandbox/<hash>/space/.xstudio-report.md` 出现
- **THEN** 脚本打印报告内容并 exit 0
### S4 wait_for_task_times_out_when_md_missing
- **WHEN** host 跑 `bash scripts/wait-for-task.sh <taskId> 5` (timeout 5s)
- **AND** `.xstudio-report.md` 不存在
- **THEN** 5s 后脚本 exit 1 并打印 `TIMEOUT after 5s; check mcp__xstudio__xstudio_ai_status manually`
## UX / Interaction(UI 类变更填写)
- N/A,纯命令行脚本