mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 22:59:28 +08:00
fix(skill): 残留检查改用 Shell 列目录 / List leftovers with the shell
隔离实例验证中,模型用文件搜索工具查残留没看到点开头的临时目录,预览时误报 「无残留」,到最终核对才用 ls 发现。改为在复制前用 ls -a / Get-ChildItem -Force 列出,并说明文件搜索结果不能证明没有残留。重算 source_hash。 During isolated verification the file search tool missed the dot-prefixed leftover, so the preview wrongly reported none. The check now runs before copying with `ls -a` / `Get-ChildItem -Force`. source_hash recomputed.
This commit is contained in:
1 parent
f067801c72
commit
12d3b76489
2 files changed
+4
-4
No files matched your search
@@ -29,7 +29,7 @@ metadata:
|
||||
description: >-
|
||||
把本机 OpenClaw 数据目录(~/.openclaw/)中的智能体与技能迁移到 DesireCore:按固定映射(SOUL.md→persona.md、AGENTS.md→principles.md、USER.md/MEMORY.md→memory/、workspace skills→智能体私有技能)经 ManageAgent 创建智能体并复制技能,迁移后逐项核对。Use when 用户要求从 OpenClaw 导入、迁移或搬家智能体与技能(migrate / import from OpenClaw)。需要本机已有 OpenClaw 数据目录;不安装、不运行 OpenClaw。
|
||||
body: ./SKILL.zh-CN.md
|
||||
source_hash: sha256:63deff0e68c3f3ea
|
||||
source_hash: sha256:57df4b3436266ee3
|
||||
translated_by: human
|
||||
en-US:
|
||||
name: Migrate from OpenClaw
|
||||
@@ -37,7 +37,7 @@ metadata:
|
||||
description: >-
|
||||
Migrate agents and skills from the local OpenClaw data directory (~/.openclaw/) into DesireCore using a fixed mapping (SOUL.md→persona.md, AGENTS.md→principles.md, USER.md/MEMORY.md→memory/, workspace skills→agent-private skills): create agents with ManageAgent, copy skills, then verify every item. Use when the user asks to import or migrate agents or skills from OpenClaw. Requires an existing local OpenClaw data directory; does not install or run OpenClaw.
|
||||
body: ./SKILL.md
|
||||
source_hash: sha256:63deff0e68c3f3ea
|
||||
source_hash: sha256:57df4b3436266ee3
|
||||
translated_by: human
|
||||
market:
|
||||
icon: >-
|
||||
@@ -161,7 +161,7 @@ ManageAgent({
|
||||
|
||||
Handle each skill directory (each global skill; for private skills, each subdirectory of the workspace `skills/`) in this order, and finish one before starting the next:
|
||||
|
||||
1. **Look for leftovers**: list the directories in the target's parent directory whose names start with `.<target directory name>.openclaw-import-`. They are temporary directories left by an interrupted run. Tell the user, delete them once the user agrees, and record them as "cleaned up" in the receipt. Do not delete dot-directories with any other prefix (for example the platform's own `.<name>.import-…` and `.<name>.install-…` temporary directories).
|
||||
1. **Look for leftovers**: before copying, use the shell to list the directories in the target's parent directory whose names start with `.<target directory name>.openclaw-import-` (macOS/Linux: `ls -a <parent directory>`; Windows PowerShell: `Get-ChildItem -Force -LiteralPath <parent directory>`). File search tools may omit directories whose names start with a dot, so their results cannot show that there are no leftovers. They are temporary directories left by an interrupted run. Tell the user, delete them once the user agrees, and record them as "cleaned up" in the receipt. Do not delete dot-directories with any other prefix (for example the platform's own `.<name>.import-…` and `.<name>.install-…` temporary directories).
|
||||
2. **Copy into a temporary directory**: the temporary directory sits in the **same parent directory** as the target and is named `.<target directory name>.openclaw-import-<random>` (at least 8 random letters and digits). Skill discovery skips directories whose names start with a dot, so a half-finished copy never shows up as a skill. macOS/Linux: `cp -R <source directory> <temporary directory>`; Windows PowerShell: `Copy-Item -Recurse -LiteralPath <source directory> -Destination <temporary directory>`; without a shell, write each file into the temporary directory with Read + Write.
|
||||
3. **Check**: the temporary directory must contain a regular file `SKILL.md` that starts with YAML frontmatter opened and closed by `---` lines, parses, and has a non-empty `description`. Otherwise **reject** it: delete this temporary directory, do not publish, and give the reason in the receipt. Once the check passes, add the version to global skills per section 3 inside the temporary directory; leave private skills unchanged.
|
||||
4. **Publish**: first confirm that the target directory does not exist. If it does, never overwrite: for a global skill take the next name per section 4; for a private skill stop and ask. Then publish by renaming within the same parent directory: macOS/Linux `test ! -e <target directory> && mv <temporary directory> <target directory>` (when the target is an existing directory, `mv` moves the temporary directory inside it, so the check cannot be skipped); Windows PowerShell `Rename-Item -LiteralPath <temporary directory> -NewName <target directory name>`, or `Move-Item -LiteralPath <temporary directory> -Destination <target directory>`, in both cases after `Test-Path -LiteralPath <target directory>` confirms the target does not exist. If Windows reports the files are in use or access is denied, wait a few seconds and retry, at most 3 times; if it still fails, clean up per step 5 and ask the user in the receipt to close whatever holds the directory (an editor, a file manager, an antivirus scan) and migrate this item again. Never fall back to copying over the target.
|
||||
|
||||
Reference in new issue
Block a user