chore(dth): phase 1 整理 — 归档 4 个 chg + auto-setup-xstudio-ai 包装脚本
- openspec/changes/archive/{4 个 chg}: chg_0001/0002/0003/0004 全部归档(日期前缀)
- scripts/auto-setup-xstudio-ai.sh: 幂等 wrapper,ai-config 已就绪时 no-op,否则调 setup-xstudio-ai.sh
- chg_0003 dispatch_helpers 在 archive 后仍能被 check_spec_coverage 扫描(归档路径仍被列)
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
10acc8114d
commit
640a3562ee
21 files changed
+55
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# auto-setup-xstudio-ai.sh
|
||||
#
|
||||
# Wrap setup-xstudio-ai.sh with auto-detection:
|
||||
# - If ai-config.json already has claude-process provider with non-empty baseURL → no-op
|
||||
# - Else → call setup-xstudio-ai.sh on workspace root
|
||||
#
|
||||
# Usage:
|
||||
# bash scripts/auto-setup-xstudio-ai.sh # use $PWD as workspaceRoot
|
||||
# bash scripts/auto-setup-xstudio-ai.sh <wsRoot> # explicit workspaceRoot
|
||||
#
|
||||
# Returns:
|
||||
# 0 config already present OR written OK
|
||||
# 1 bad arg
|
||||
# 2 setup-xstudio-ai.sh failed
|
||||
# 3 ai-config.json missing after setup
|
||||
set -euo pipefail
|
||||
|
||||
WS_ROOT="${1:-$PWD}"
|
||||
|
||||
if [ ! -d "$WS_ROOT" ]; then
|
||||
echo "ERROR: workspaceRoot $WS_ROOT 不存在" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONFIG="$WS_ROOT/.xstudio/ai-config.json"
|
||||
|
||||
# 检测是否已就绪:claude-process.baseURL 非空
|
||||
if [ -f "$CONFIG" ] && python3 -c "
|
||||
import json, sys
|
||||
try:
|
||||
cfg = json.load(open('$CONFIG'))
|
||||
cp = cfg.get('providers', {}).get('claude-process', {})
|
||||
sys.exit(0 if cp.get('baseURL') else 1)
|
||||
except Exception:
|
||||
sys.exit(1)
|
||||
" 2>/dev/null; then
|
||||
echo "ai-config already has claude-process provider; no-op"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 调 setup-xstudio-ai.sh
|
||||
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if ! bash "$SELF_DIR/setup-xstudio-ai.sh" "$WS_ROOT"; then
|
||||
echo "ERROR: setup-xstudio-ai.sh failed" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# 后置断言
|
||||
if [ ! -f "$CONFIG" ]; then
|
||||
echo "ERROR: $CONFIG 仍不存在" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
echo "ai-config ready: $CONFIG"
|
||||
Reference in new issue
Block a user