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:
2026-05-29 15:36:19 +08:00
committed by GitHub
parent 3015a3ffb8
commit 4f7037a6b6
52 changed files with 192 additions and 192 deletions

View File

@@ -359,7 +359,7 @@ Validates SKILL.md format, the legality of frontmatter fields, and the directory
**Option A: Install via API (recommended; requires the Agent Service to be running)**
```bash
PORT=$(cat ~/.desirecore/agent-service.port 2>/dev/null)
PORT=$(cat ${DESIRECORE_ROOT}/agent-service.port 2>/dev/null)
# Install as a global Skill (visible to all Agents)
curl -k -X POST "https://127.0.0.1:${PORT}/api/skills" \
@@ -376,10 +376,10 @@ curl -k -X POST "https://127.0.0.1:${PORT}/api/agents/<agentId>/skills" \
```bash
# Global Skill
cp -r path/to/skill-name ~/.desirecore/skills/
cp -r path/to/skill-name ${DESIRECORE_ROOT}/skills/
# Agent-scoped Skill
cp -r path/to/skill-name ~/.desirecore/agents/<agentId>/skills/
cp -r path/to/skill-name ${DESIRECORE_ROOT}/agents/<agentId>/skills/
```
**Option C: Package as a .skill file (Claude Code compatible)**
@@ -409,7 +409,7 @@ Skills exist at three scope levels, listed from highest priority to lowest:
| Priority | Scope | Path | Visibility |
|--------|--------|------|---------|
| Highest | Project | `.claude/skills/` | All Agents in the current project |
| Medium | Agent | `~/.desirecore/agents/{agentId}/skills/` | Only that Agent |
| Lowest | Global | `~/.desirecore/skills/` | All Agents |
| Medium | Agent | `${DESIRECORE_ROOT}/agents/{agentId}/skills/` | Only that Agent |
| Lowest | Global | `${DESIRECORE_ROOT}/skills/` | All Agents |
Skills with the same name override each other by priority—a higher-priority Skill shadows a lower-priority one with the same name.

View File

@@ -299,7 +299,7 @@ scripts/quick_validate.py <path/to/skill-folder>
**方式 A通过 API 安装(推荐,需 Agent Service 运行中)**
```bash
PORT=$(cat ~/.desirecore/agent-service.port 2>/dev/null)
PORT=$(cat ${DESIRECORE_ROOT}/agent-service.port 2>/dev/null)
# 安装为全局技能(所有 Agent 可见)
curl -k -X POST "https://127.0.0.1:${PORT}/api/skills" \
@@ -316,10 +316,10 @@ curl -k -X POST "https://127.0.0.1:${PORT}/api/agents/<agentId>/skills" \
```bash
# 全局技能
cp -r path/to/skill-name ~/.desirecore/skills/
cp -r path/to/skill-name ${DESIRECORE_ROOT}/skills/
# Agent 级技能
cp -r path/to/skill-name ~/.desirecore/agents/<agentId>/skills/
cp -r path/to/skill-name ${DESIRECORE_ROOT}/agents/<agentId>/skills/
```
**方式 C打包为 .skill 文件Claude Code 兼容)**
@@ -349,7 +349,7 @@ scripts/package_skill.py <path/to/skill-folder>
| 优先级 | 作用域 | 路径 | 可见范围 |
|--------|--------|------|---------|
| 最高 | Project | `.claude/skills/` | 当前项目所有 Agent |
| 中 | Agent | `~/.desirecore/agents/{agentId}/skills/` | 仅该 Agent |
| 最低 | Global | `~/.desirecore/skills/` | 所有 Agent |
| 中 | Agent | `${DESIRECORE_ROOT}/agents/{agentId}/skills/` | 仅该 Agent |
| 最低 | Global | `${DESIRECORE_ROOT}/skills/` | 所有 Agent |
同名技能按优先级覆盖——高优先级的技能会遮蔽低优先级的同名技能。

View File

@@ -6,8 +6,8 @@ Usage:
init_skill.py <skill-name> --path <path> [--format basic|desirecore]
Examples:
init_skill.py my-new-skill --path ~/.desirecore/skills
init_skill.py my-api-helper --path ~/.desirecore/skills --format basic
init_skill.py my-new-skill --path ${DESIRECORE_ROOT}/skills
init_skill.py my-api-helper --path ${DESIRECORE_ROOT}/skills --format basic
"""
import sys
@@ -230,8 +230,8 @@ def main():
parser = argparse.ArgumentParser(
description='Initialize a new skill from template',
epilog='Examples:\n'
' init_skill.py my-new-skill --path ~/.desirecore/skills\n'
' init_skill.py my-api-helper --path ~/.desirecore/skills --format basic',
' init_skill.py my-new-skill --path ${DESIRECORE_ROOT}/skills\n'
' init_skill.py my-api-helper --path ${DESIRECORE_ROOT}/skills --format basic',
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument('skill_name', help='Skill name (kebab-case, max 64 chars)')

View File

@@ -127,9 +127,9 @@ def install_skill(skill_path, scope='global', agent_id=None):
print("❌ Error: Agent Service not running (port file not found)")
print("\nFallback — install via file system:")
if scope == 'agent' and agent_id:
print(f" cp -r {skill_path} ~/.desirecore/agents/{agent_id}/skills/")
print(f" cp -r {skill_path} ${DESIRECORE_ROOT}/agents/{agent_id}/skills/")
else:
print(f" cp -r {skill_path} ~/.desirecore/skills/")
print(f" cp -r {skill_path} ${DESIRECORE_ROOT}/skills/")
return None
content = skill_md.read_text()