mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-06-06 05:30:39 +08:00
## Summary
- 将所有技能文件中的硬编码 `~/.desirecore/` 和 `$HOME/.desirecore/` 路径替换为
`${DESIRECORE_ROOT}/` 变量
- 递增 manifest.json version 至 1.2.1
## Why
dev 模式下 `DESIRECORE_HOME=~/.desirecore-dev`,硬编码路径导致技能读取错误的端口文件和目录。主仓库的
`variable-substitutor.ts` 会在运行时将 `${DESIRECORE_ROOT}` 替换为实际根目录。
## Test plan
- [ ] `npm run dev` 启动后触发任意技能,确认端口路径解析为
`~/.desirecore-dev/agent-service.port`
- [ ] prod 模式确认路径为 `~/.desirecore/agent-service.port`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
78 lines
2.3 KiB
Bash
Executable File
78 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# dev-environment-setup probe: 输出系统级环境快照(JSON)
|
||
# 协议:见 ../references/probe-snapshot.md
|
||
|
||
set +e
|
||
|
||
# ── 工具检测 ─────────────────────────────
|
||
detect_tool() {
|
||
local name="$1"
|
||
local version_flag="${2:---version}"
|
||
local path
|
||
path=$(command -v "$name" 2>/dev/null)
|
||
if [ -z "$path" ]; then
|
||
printf '{"available":false}'
|
||
return
|
||
fi
|
||
local version
|
||
version=$("$name" $version_flag 2>&1 | head -n1 | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n1)
|
||
printf '{"available":true,"path":"%s","version":"%s"}' "$path" "${version:-}"
|
||
}
|
||
|
||
# ── 平台 ────────────────────────────────
|
||
case "$(uname -s)" in
|
||
Darwin) PLATFORM="darwin" ;;
|
||
Linux) PLATFORM="linux" ;;
|
||
*) PLATFORM="other" ;;
|
||
esac
|
||
ARCH=$(uname -m)
|
||
case "$ARCH" in
|
||
arm64|aarch64) ARCH="arm64" ;;
|
||
x86_64|amd64) ARCH="x64" ;;
|
||
esac
|
||
|
||
# ── DesireCore API 探测 ─────────────────
|
||
PORT_FILE="${DESIRECORE_ROOT}/agent-service.port"
|
||
DESIRECORE_API=""
|
||
PORT_FILE_EXISTS="false"
|
||
if [ -r "$PORT_FILE" ]; then
|
||
PORT_FILE_EXISTS="true"
|
||
PORT=$(cat "$PORT_FILE" 2>/dev/null | tr -d '[:space:]')
|
||
if [ -n "$PORT" ]; then
|
||
if curl -sk --max-time 0.5 "https://127.0.0.1:${PORT}/api/runtime/environment" >/dev/null 2>&1; then
|
||
DESIRECORE_API="https://127.0.0.1:${PORT}"
|
||
fi
|
||
fi
|
||
fi
|
||
|
||
# ── 工具检测结果 ────────────────────────
|
||
PY=$(detect_tool python3)
|
||
[ "$(echo "$PY" | grep -o false)" = "false" ] && PY=$(detect_tool python)
|
||
PIP=$(detect_tool pip3)
|
||
[ "$(echo "$PIP" | grep -o false)" = "false" ] && PIP=$(detect_tool pip)
|
||
NODE=$(detect_tool node)
|
||
NPM=$(detect_tool npm)
|
||
DOCKER=$(detect_tool docker)
|
||
PODMAN=$(detect_tool podman)
|
||
GIT=$(detect_tool git)
|
||
|
||
# ── 输出 JSON ───────────────────────────
|
||
cat <<EOF
|
||
{
|
||
"platform": "${PLATFORM}",
|
||
"arch": "${ARCH}",
|
||
"desirecore_api": "${DESIRECORE_API}",
|
||
"desirecore_port_file": ${PORT_FILE_EXISTS},
|
||
"tools": {
|
||
"python3": ${PY},
|
||
"pip3": ${PIP},
|
||
"node": ${NODE},
|
||
"npm": ${NPM},
|
||
"docker": ${DOCKER},
|
||
"podman": ${PODMAN},
|
||
"git": ${GIT}
|
||
},
|
||
"wsl": null
|
||
}
|
||
EOF
|