Files
market/skills/dev-environment-setup/scripts/probe.ps1
yi-ge 1a50969b93 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>
2026-05-02 13:30:23 +08:00

67 lines
2.0 KiB
PowerShell

# 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