mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-06-06 07:10:44 +08:00
fix: replace hardcoded ~/.desirecore paths with ${DESIRECORE_ROOT} variable (#16)
## 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)
This commit is contained in:
@@ -51,7 +51,7 @@ metadata:
|
||||
Use this skill when the user needs to install, upgrade, or troubleshoot Node.js, npm, pnpm, yarn, and JavaScript/TypeScript runtime environments. Covers four-tier fallback strategy: (1) DesireCore HTTP API for in-app installation, (2) DesireCore built-in Volta CLI for Node.js + package manager version management, (3) system package managers (brew/apt/dnf/winget/NodeSource), (4) community nvm/fnm as last resort. Also covers global package management, npm registry/proxy configuration, EACCES permission errors, and PATH troubleshooting. Triggers include: "install node", "node not found", "npm not found", "npm EACCES", "pnpm", "yarn", "volta", "nvm", "fnm", "nodejs version", "package-lock", or any Node.js / npm runtime error. Use cases: the user needs to install Node.js, install npm, pnpm, yarn, configure global packages, resolve EACCES, PATH issues, registry mirror / proxy configuration.
|
||||
body: ./SKILL.md
|
||||
source_hash: sha256:2b8a00816c65d71c
|
||||
translated_by: ai:claude-opus-4-7
|
||||
translated_by: human
|
||||
translated_at: '2026-05-03'
|
||||
market:
|
||||
icon: >-
|
||||
@@ -132,7 +132,7 @@ See `../dev-environment-setup/references/probe-snapshot.md` for field definition
|
||||
#### L1: HTTP API (→ `references/volta-desirecore.md`)
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
PORT=$(cat ${DESIRECORE_ROOT}/agent-service.port)
|
||||
BASE="https://127.0.0.1:${PORT}/api/runtime"
|
||||
|
||||
# 列出可装版本
|
||||
@@ -155,8 +155,8 @@ curl -sk -X POST "${BASE}/environment/refresh"
|
||||
#### L2: Volta CLI Absolute Path (→ `references/volta-desirecore.md`)
|
||||
|
||||
```bash
|
||||
VOLTA=~/.desirecore/runtime/volta/volta
|
||||
export VOLTA_HOME=~/.desirecore/runtime/volta
|
||||
VOLTA=${DESIRECORE_ROOT}/runtime/volta/volta
|
||||
export VOLTA_HOME=${DESIRECORE_ROOT}/runtime/volta
|
||||
export VOLTA_FEATURE_PNPM=1
|
||||
|
||||
"$VOLTA" install node@22
|
||||
|
||||
@@ -59,7 +59,7 @@ cat /tmp/node-probe.json | jq .
|
||||
#### L1:HTTP API(→ `references/volta-desirecore.md`)
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
PORT=$(cat ${DESIRECORE_ROOT}/agent-service.port)
|
||||
BASE="https://127.0.0.1:${PORT}/api/runtime"
|
||||
|
||||
# 列出可装版本
|
||||
@@ -82,8 +82,8 @@ curl -sk -X POST "${BASE}/environment/refresh"
|
||||
#### L2:Volta CLI 绝对路径(→ `references/volta-desirecore.md`)
|
||||
|
||||
```bash
|
||||
VOLTA=~/.desirecore/runtime/volta/volta
|
||||
export VOLTA_HOME=~/.desirecore/runtime/volta
|
||||
VOLTA=${DESIRECORE_ROOT}/runtime/volta/volta
|
||||
export VOLTA_HOME=${DESIRECORE_ROOT}/runtime/volta
|
||||
export VOLTA_FEATURE_PNPM=1
|
||||
|
||||
"$VOLTA" install node@22
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
## 通过 DesireCore Volta 安装
|
||||
|
||||
```bash
|
||||
VOLTA=~/.desirecore/runtime/volta/volta
|
||||
VOLTA=${DESIRECORE_ROOT}/runtime/volta/volta
|
||||
export VOLTA_FEATURE_PNPM=1
|
||||
|
||||
"$VOLTA" install pnpm@latest
|
||||
@@ -23,7 +23,7 @@ export VOLTA_FEATURE_PNPM=1
|
||||
或 HTTP API:
|
||||
|
||||
```bash
|
||||
BASE="https://127.0.0.1:$(cat ~/.desirecore/agent-service.port)/api/runtime"
|
||||
BASE="https://127.0.0.1:$(cat ${DESIRECORE_ROOT}/agent-service.port)/api/runtime"
|
||||
curl -sk -X POST "${BASE}/pkg/pnpm/install" -H "Content-Type: application/json" -d '{"version":"latest"}'
|
||||
```
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ export NVM_DIR="$HOME/.nvm"
|
||||
node --version
|
||||
|
||||
# 3. Volta 已装但未在 PATH?
|
||||
ls ~/.desirecore/runtime/volta/volta 2>/dev/null && \
|
||||
echo "运行 ~/.desirecore/runtime/volta/volta 直接调用,无需 PATH"
|
||||
ls ${DESIRECORE_ROOT}/runtime/volta/volta 2>/dev/null && \
|
||||
echo "运行 ${DESIRECORE_ROOT}/runtime/volta/volta 直接调用,无需 PATH"
|
||||
```
|
||||
|
||||
**根治**:按主 SKILL.md 决策树重新执行 L1–L3 安装路径。
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# DesireCore 内置 Volta(L1 / L2 主路径)
|
||||
|
||||
DesireCore 内置 [Volta](https://volta.sh/) v2.0.2(Rust 实现的 Node.js 工具链管理器)。Volta 二进制随应用打包于 `static/volta/`,运行时位于 `~/.desirecore/runtime/volta/`,**用户无需单独安装**。
|
||||
DesireCore 内置 [Volta](https://volta.sh/) v2.0.2(Rust 实现的 Node.js 工具链管理器)。Volta 二进制随应用打包于 `static/volta/`,运行时位于 `${DESIRECORE_ROOT}/runtime/volta/`,**用户无需单独安装**。
|
||||
|
||||
> 与系统 Node.js 完全隔离:Volta 安装的工具位于 `~/.desirecore/runtime/volta/tools/image/`,不修改系统 PATH。
|
||||
> 与系统 Node.js 完全隔离:Volta 安装的工具位于 `${DESIRECORE_ROOT}/runtime/volta/tools/image/`,不修改系统 PATH。
|
||||
|
||||
## L1:通过 HTTP API 操作(推荐,DesireCore 应用内)
|
||||
|
||||
### 探测 API 可用性
|
||||
|
||||
```bash
|
||||
PORT_FILE="$HOME/.desirecore/agent-service.port"
|
||||
PORT_FILE="${DESIRECORE_ROOT}/agent-service.port"
|
||||
[ -r "$PORT_FILE" ] || { echo "API 不可用,降级到 L2"; exit 1; }
|
||||
PORT=$(cat "$PORT_FILE")
|
||||
BASE="https://127.0.0.1:${PORT}/api/runtime"
|
||||
@@ -76,8 +76,8 @@ curl -sk -X POST "${BASE}/environment/refresh" # 安装结束后刷新
|
||||
### macOS / Linux
|
||||
|
||||
```bash
|
||||
VOLTA=~/.desirecore/runtime/volta/volta
|
||||
export VOLTA_HOME=~/.desirecore/runtime/volta
|
||||
VOLTA=${DESIRECORE_ROOT}/runtime/volta/volta
|
||||
export VOLTA_HOME=${DESIRECORE_ROOT}/runtime/volta
|
||||
export VOLTA_FEATURE_PNPM=1
|
||||
# export VOLTA_NODE_MIRROR=https://npmmirror.com/mirrors/node # 中国大陆加速
|
||||
|
||||
@@ -123,7 +123,7 @@ $env:VOLTA_FEATURE_PNPM = "1"
|
||||
Volta 没有 `volta uninstall node`,直接删目录或用 HTTP API:
|
||||
|
||||
```bash
|
||||
rm -rf ~/.desirecore/runtime/volta/tools/image/node/<version>
|
||||
rm -rf ${DESIRECORE_ROOT}/runtime/volta/tools/image/node/<version>
|
||||
```
|
||||
|
||||
或:
|
||||
|
||||
@@ -31,7 +31,7 @@ esac
|
||||
|
||||
# ── DesireCore API ──────────────────────
|
||||
DESIRECORE_API=""
|
||||
PORT_FILE="$HOME/.desirecore/agent-service.port"
|
||||
PORT_FILE="${DESIRECORE_ROOT}/agent-service.port"
|
||||
if [ -r "$PORT_FILE" ]; then
|
||||
PORT=$(cat "$PORT_FILE" 2>/dev/null | tr -d '[:space:]')
|
||||
if [ -n "$PORT" ]; then
|
||||
@@ -46,7 +46,7 @@ SYS_NODE=$(detect_tool node)
|
||||
SYS_NPM=$(detect_tool npm)
|
||||
|
||||
# ── DesireCore Volta ────────────────────
|
||||
VOLTA_BIN="$HOME/.desirecore/runtime/volta/volta"
|
||||
VOLTA_BIN="${DESIRECORE_ROOT}/runtime/volta/volta"
|
||||
VOLTA_PATH=""
|
||||
VOLTA_VERSION=""
|
||||
if [ -x "$VOLTA_BIN" ]; then
|
||||
@@ -55,7 +55,7 @@ if [ -x "$VOLTA_BIN" ]; then
|
||||
fi
|
||||
|
||||
# Volta 已装工具(直接读 image 目录最稳)
|
||||
VOLTA_IMG="$HOME/.desirecore/runtime/volta/tools/image"
|
||||
VOLTA_IMG="${DESIRECORE_ROOT}/runtime/volta/tools/image"
|
||||
list_dir() {
|
||||
local dir="$1"
|
||||
if [ -d "$dir" ]; then
|
||||
|
||||
Reference in New Issue
Block a user