mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-06-06 10:10:45 +08:00
新增双核心 skill(深度集成 DesireCore Hatch/Volta + HTTP API + Socket.IO): - python-runtime v1.0.1:Python 运行时管理 · 四级降级:HTTP API → Hatch CLI 绝对路径 → 系统包管理器 → pyenv · references:hatch-desirecore / pyenv-fallback / virtualenv / troubleshooting · scripts/probe-python.sh:输出 JSON 快照供 Claude 解析决策 - nodejs-runtime v1.0.1:Node.js 运行时管理 · 四级降级:HTTP API → Volta CLI → 系统包管理器/NodeSource → nvm/fnm · references:volta-desirecore / nvm-fallback / package-managers / troubleshooting · scripts/probe-node.sh:输出 JSON 快照(含 volta_tools / package_json_volta 等) environment-setup → dev-environment-setup v2.0.1(重命名 + 重写为 router): - 从 1380 行手册瘦身为 ~150 行索引 - 仅负责容器(Docker/Podman)/ WSL2 / 办公依赖速查 / 系统工具 - references/desirecore-runtime.md 沉淀 Hatch/Volta 路径表 + HTTP API 速查 + Socket.IO 事件契约,作为两个核心 skill 的共享底座 - references/decision-tree.md 定义四级降级决策树 - scripts/probe.sh + probe.ps1 系统级 JSON 探测 三个 SKILL.md 的 L0 改为场景驱动结构(何时使用 / 何时不要用 / 怎么做), 让 AI 凭名字与 L0 即可判断匹配场景。 注册更新: - builtin-skills.json:新增 python-runtime / nodejs-runtime / dev-environment-setup (原 environment-setup 移除),按字母序,共 21 个 skill - manifest.json:totalSkills 19→21,lastUpdated 2026-05-02 下游同步: - docx / pdf / xlsx / pptx 中的环境引用从 environment-setup 拆分为 python-runtime / nodejs-runtime / dev-environment-setup 三向指引 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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="$HOME/.desirecore/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
|