feat: 拆分 environment-setup 为 Python/Node.js 运行时双核心 + 父级路由

新增双核心 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>
This commit is contained in:
2026-05-02 13:30:23 +08:00
parent 5472359814
commit 1a50969b93
29 changed files with 3310 additions and 1386 deletions

View File

@@ -0,0 +1,66 @@
# dev-environment-setup probe (Windows)
# 协议:见 ..\references\probe-snapshot.md
$ErrorActionPreference = 'SilentlyContinue'
function Test-Tool {
param([string]$Name, [string]$VersionFlag = '--version')
$cmd = Get-Command $Name -ErrorAction SilentlyContinue
if (-not $cmd) {
return @{ available = $false }
}
$output = & $Name $VersionFlag 2>&1 | Select-Object -First 1
$version = ''
if ($output -match '(\d+\.\d+(?:\.\d+)?)') { $version = $Matches[1] }
return @{ available = $true; path = $cmd.Source; version = $version }
}
# DesireCore API 探测
$portFile = Join-Path $env:USERPROFILE '.desirecore\agent-service.port'
$desirecoreApi = ''
$portFileExists = Test-Path $portFile
if ($portFileExists) {
$port = (Get-Content $portFile -Raw).Trim()
if ($port) {
try {
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
$resp = Invoke-WebRequest -Uri "https://127.0.0.1:$port/api/runtime/environment" `
-TimeoutSec 1 -UseBasicParsing -ErrorAction Stop
if ($resp.StatusCode -eq 200) { $desirecoreApi = "https://127.0.0.1:$port" }
} catch { }
}
}
# WSL 检测
$wsl = $null
$wslOut = wsl --status 2>&1
if ($LASTEXITCODE -eq 0) {
$version = ''
$defaultDistro = ''
if ($wslOut -match '(\d+)') { $version = $Matches[1] }
$wsl = @{ installed = $true; version = $version; defaultDistro = $defaultDistro }
} else {
$wsl = @{ installed = $false }
}
$arch = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' }
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'arm64' }
$result = @{
platform = 'win32'
arch = $arch
desirecore_api = $desirecoreApi
desirecore_port_file = $portFileExists
tools = @{
python3 = (Test-Tool python)
pip3 = (Test-Tool pip)
node = (Test-Tool node)
npm = (Test-Tool npm)
docker = (Test-Tool docker)
podman = (Test-Tool podman)
git = (Test-Tool git)
}
wsl = $wsl
}
$result | ConvertTo-Json -Depth 5 -Compress:$false

View File

@@ -0,0 +1,77 @@
#!/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