mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 23:19: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.
|
||||
|
||||
@@ -110,7 +110,7 @@ ManageAgent({
|
||||
|
||||
每个技能目录(全局技能逐个;私有技能为工作区 `skills/` 下的每个子目录)按以下顺序处理,处理完一个再处理下一个:
|
||||
|
||||
1. **查残留**:列出目标父目录里以 `.<目标目录名>.openclaw-import-` 开头的目录。它们是之前中断留下的临时目录,告诉用户,用户同意后删除并在回执记为「已清理」。不删除其他前缀的点目录(例如平台自己的 `.<名>.import-…`、`.<名>.install-…` 临时目录)。
|
||||
1. **查残留**:在复制之前,用 Shell 列出目标父目录里以 `.<目标目录名>.openclaw-import-` 开头的目录(macOS/Linux:`ls -a <父目录>`;Windows PowerShell:`Get-ChildItem -Force -LiteralPath <父目录>`)。文件搜索工具可能不返回以点开头的目录,不能用它的结果判断没有残留。它们是之前中断留下的临时目录,告诉用户,用户同意后删除并在回执记为「已清理」。不删除其他前缀的点目录(例如平台自己的 `.<名>.import-…`、`.<名>.install-…` 临时目录)。
|
||||
2. **复制到临时目录**:临时目录与目标在**同一父目录**,名称为 `.<目标目录名>.openclaw-import-<随机串>`(随机串用 8 位以上字母数字)。以点开头的目录不会被技能发现读到,复制到一半时不会出现半成品技能。macOS/Linux:`cp -R <源目录> <临时目录>`;Windows PowerShell:`Copy-Item -Recurse -LiteralPath <源目录> -Destination <临时目录>`;没有 Shell 时用 Read + Write 逐个文件写进临时目录。
|
||||
3. **检查**:临时目录里必须有普通文件 `SKILL.md`,开头是以 `---` 行开始和结束的 YAML frontmatter,能解析,且 `description` 非空。不满足就**拒绝**:删除这个临时目录,不发布,回执写明原因。检查通过后,全局技能按第 3 节在临时目录里补版本号;私有技能不改。
|
||||
4. **发布**:先确认目标目录不存在。已存在时不覆盖:全局技能按第 4 节换下一个名称,私有技能停下询问。然后在同一父目录内改名发布:macOS/Linux `test ! -e <目标目录> && mv <临时目录> <目标目录>`(目标是已有目录时 `mv` 会把临时目录移进去,所以不能省掉前面的检查);Windows PowerShell `Rename-Item -LiteralPath <临时目录> -NewName <目标目录名>`,也可以用 `Move-Item -LiteralPath <临时目录> -Destination <目标目录>`,两者都要先用 `Test-Path -LiteralPath <目标目录>` 确认目标不存在。Windows 报文件被占用或拒绝访问时,等几秒重试,最多 3 次;仍失败就按第 5 步清理,并在回执里请用户关闭占用该目录的程序(如编辑器、文件管理器、杀毒扫描)后重新迁移这一项。不要改用复制覆盖。
|
||||
|
||||
Reference in new issue
Block a user