@myclaw163/clawclaw-cli 0.9.2 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/QUICKSTART.md +1 -1
  2. package/QUICKSTART_OTHER.md +13 -12
  3. package/README.md +7 -8
  4. package/bin/clawclaw-channel.mjs +2 -2
  5. package/bin/clawclaw-cli.mjs +2 -2
  6. package/docs/configuration.md +27 -101
  7. package/docs/custom-modules/README.md +23 -35
  8. package/docs/custom-modules/api-reference.md +95 -273
  9. package/docs/custom-modules/behavior.md +94 -78
  10. package/docs/custom-modules/examples/auto-escape.ts +5 -5
  11. package/docs/custom-modules/examples/go-to-point.ts +11 -11
  12. package/docs/custom-modules/examples/nearby-reflex.ts +2 -2
  13. package/docs/custom-modules/examples/task-reminder.ts +4 -5
  14. package/docs/custom-modules/perception.md +42 -603
  15. package/docs/custom-modules/skill.md +12 -10
  16. package/docs/desktop-event-push.md +3 -3
  17. package/docs/runtime/README.md +16 -17
  18. package/docs/runtime/agent-notifications.md +42 -12
  19. package/docs/runtime/behavior-runtime.md +47 -46
  20. package/docs/runtime/components-and-boundaries.md +70 -28
  21. package/docs/runtime/events-and-state.md +41 -18
  22. package/docs/runtime/framework-package.md +73 -0
  23. package/docs/runtime/official-perception-modules.md +5 -5
  24. package/docs/runtime/owner-lifecycle-and-observability.md +6 -6
  25. package/docs/runtime/short-commands-and-capabilities.md +8 -9
  26. package/docs/user-guide/README.md +10 -7
  27. package/docs/user-guide/api-reference.md +81 -164
  28. package/docs/user-guide/behavior.md +84 -68
  29. package/docs/user-guide/installation.md +7 -7
  30. package/docs/user-guide/perception.md +42 -586
  31. package/docs/user-guide/skill.md +12 -10
  32. package/package.json +24 -9
  33. package/scripts/check-framework-boundaries.mjs +27 -0
  34. package/scripts/check-skill-command-surface.mjs +20 -23
  35. package/scripts/enable_ccl_permissions.cjs +4 -0
  36. package/scripts/install-local-runtime.mjs +35 -0
  37. package/scripts/postinstall.mjs +1 -1
  38. package/scripts/qa-install.mjs +105 -0
  39. package/scripts/sync-bundled-skill.mjs +35 -28
  40. package/skills/clawclaw/SKILL.md +53 -57
  41. package/skills/clawclaw/references/BEHAVIORS.md +43 -83
  42. package/skills/clawclaw/references/CHANNELS.md +2 -2
  43. package/skills/clawclaw/references/COMMANDS.md +62 -103
  44. package/skills/clawclaw/references/HUB.md +2 -2
  45. package/skills/clawclaw/references/STREAM.md +8 -8
  46. package/skills/clawclaw/references/TACTICS.md +1 -1
  47. package/skills/clawclaw-creator/SKILL.md +82 -0
  48. package/skills/{clawclaw → clawclaw-creator}/references/CUSTOM-BEHAVIOR-DEVELOPMENT.md +95 -79
  49. package/skills/{clawclaw → clawclaw-creator}/references/CUSTOM-MODULE-API.md +95 -180
  50. package/skills/{clawclaw → clawclaw-creator}/references/CUSTOM-MODULES.md +26 -24
  51. package/skills/clawclaw-creator/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +126 -0
  52. package/skills/clawclaw-creator/references/CUSTOM-PERSONA-DEVELOPMENT.md +29 -0
  53. package/skills/clawclaw-creator/references/CUSTOM-SKILL-DEVELOPMENT.md +69 -0
  54. package/skills/clawclaw-creator/references/SYNC-AND-REPORT.md +36 -0
  55. package/src/channel/claude-channel-ipc-server.ts +1 -0
  56. package/src/cli.ts +4 -2
  57. package/src/commands/behavior.ts +26 -10
  58. package/src/commands/capability.ts +17 -14
  59. package/src/commands/load.ts +5 -3
  60. package/src/commands/perception.ts +5 -0
  61. package/src/commands/skill.ts +34 -29
  62. package/src/commands/strategy.ts +2 -0
  63. package/src/commands/upgrade.ts +2 -2
  64. package/src/lib/agent-workspace-skills.ts +20 -13
  65. package/src/lib/capability-cloud-sync.ts +2 -1
  66. package/src/lib/capability-discovery.ts +2 -1
  67. package/src/lib/capability-load-diagnostics.ts +3 -3
  68. package/src/lib/capability-workspace.ts +2 -1
  69. package/src/lib/game-client.ts +7 -1
  70. package/src/lib/package-skills.ts +4 -0
  71. package/src/lib/perception-config.ts +18 -6
  72. package/src/lib/runtime-cadence-config.ts +16 -0
  73. package/src/lib/skill-host.ts +1 -1
  74. package/src/lib/workspace-runtime-lock.ts +3 -46
  75. package/src/pipeline/canonical-event-presentation.ts +23 -124
  76. package/src/pipeline/event-format.ts +12 -21
  77. package/src/pipeline/event-hints.ts +6 -6
  78. package/src/pipeline/game-sync-event-normalization.ts +57 -63
  79. package/src/runtime/clawclaw/behavior-decision.ts +7 -3
  80. package/src/runtime/clawclaw/behavior-input.ts +8 -4
  81. package/src/runtime/clawclaw/behavior-observation-memory.ts +3 -2
  82. package/src/runtime/clawclaw/notification-policy.ts +42 -0
  83. package/src/runtime/clawclaw/notification-turn.ts +19 -0
  84. package/src/runtime/clawclaw/observation-frame-projector.ts +3 -3
  85. package/src/runtime/clawclaw/owner.ts +47 -9
  86. package/src/runtime/clawclaw/perception-module-manifest.ts +8 -3
  87. package/src/runtime/clawclaw/perception-strategy-names.ts +17 -0
  88. package/src/runtime/clawclaw/persistence-compatibility.ts +36 -0
  89. package/src/runtime/clawclaw/plugins/action/action-plugin.ts +3 -3
  90. package/src/runtime/clawclaw/plugins/assembly.ts +7 -9
  91. package/src/runtime/clawclaw/plugins/behavior/activation-manager.ts +1 -495
  92. package/src/runtime/clawclaw/plugins/behavior/behavior-analysis-thread-host.ts +17 -190
  93. package/src/runtime/clawclaw/plugins/behavior/behavior-instance-snapshot.ts +1 -123
  94. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +126 -1779
  95. package/src/runtime/clawclaw/plugins/behavior/behavior-runner.ts +13 -276
  96. package/src/runtime/clawclaw/plugins/behavior/behavior-source.ts +2 -2
  97. package/src/runtime/clawclaw/plugins/behavior/behavior-worker-bridge.ts +8 -0
  98. package/src/runtime/clawclaw/plugins/behavior/control-driver.ts +3 -180
  99. package/src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.ts +13 -972
  100. package/src/runtime/clawclaw/plugins/derived-event/derived-event-plugin.ts +8 -109
  101. package/src/runtime/clawclaw/plugins/derived-event/derived-event-rules.ts +2 -2
  102. package/src/runtime/clawclaw/plugins/derived-event/reminder-plugin.ts +27 -17
  103. package/src/runtime/clawclaw/plugins/derived-event/reminder-runner.ts +1 -0
  104. package/src/runtime/clawclaw/plugins/derived-event/state-change-rules.ts +3 -3
  105. package/src/runtime/clawclaw/plugins/derived-event/task-change-tracker.ts +1 -259
  106. package/src/runtime/clawclaw/plugins/game-query/game-query-plugin.ts +4 -4
  107. package/src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-adapter.ts +9 -97
  108. package/src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-socket.ts +8 -343
  109. package/src/runtime/clawclaw/plugins/mailbox/adapters/game-sync-perception-report-adapter.ts +15 -20
  110. package/src/runtime/clawclaw/plugins/mailbox/adapters/game-sync-runtime-report-adapter.ts +59 -0
  111. package/src/runtime/clawclaw/plugins/mailbox/agent-mailbox-coordinator.ts +60 -572
  112. package/src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.ts +6 -434
  113. package/src/runtime/clawclaw/plugins/mailbox/index.ts +1 -0
  114. package/src/runtime/clawclaw/plugins/mailbox/mailbox-event-batch-delivery.ts +1 -266
  115. package/src/runtime/clawclaw/plugins/mailbox/mailbox-plugin.ts +6 -161
  116. package/src/runtime/clawclaw/plugins/mailbox/mailbox-presentation.ts +4 -23
  117. package/src/runtime/clawclaw/plugins/mailbox/mailbox-service.ts +49 -752
  118. package/src/runtime/clawclaw/plugins/perception/map-concurrent.ts +1 -0
  119. package/src/runtime/clawclaw/plugins/perception/notification-content.ts +60 -0
  120. package/src/runtime/clawclaw/plugins/perception/perception-module-plugin.ts +125 -297
  121. package/src/runtime/clawclaw/plugins/perception/perception-module-runner.ts +7 -56
  122. package/src/runtime/clawclaw/plugins/perception/perception-module-worker.ts +11 -33
  123. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +25 -10
  124. package/src/runtime/clawclaw/plugins/perception/perception-source.ts +12 -6
  125. package/src/runtime/clawclaw/plugins/perception/report-content.ts +50 -0
  126. package/src/runtime/clawclaw/plugins/perception/task-baseline.ts +29 -0
  127. package/src/runtime/clawclaw/plugins/source/source-plugin.ts +6 -0
  128. package/src/runtime/clawclaw/plugins/system-perception/rule-runner.ts +107 -0
  129. package/src/runtime/clawclaw/plugins/system-perception/system-perceptions.ts +107 -0
  130. package/src/runtime/clawclaw/plugins/trigger/trigger-plugin.ts +8 -3
  131. package/src/runtime/clawclaw/reaction-behavior-resolution.ts +1 -23
  132. package/src/runtime/clawclaw/reminder-manifest.ts +5 -2
  133. package/src/runtime/clawclaw/runtime-cadence.ts +24 -0
  134. package/src/runtime/clawclaw/runtime-state.ts +11 -0
  135. package/src/runtime/clawclaw/runtime.ts +8 -0
  136. package/src/runtime/clawclaw/strategy-memory-rpc.ts +1 -63
  137. package/src/runtime/clawclaw/strategy-memory.ts +1 -77
  138. package/src/runtime/clawclaw-event-catalog.ts +12 -12
  139. package/src/runtime/framework/action-diagnostics.ts +3 -83
  140. package/src/runtime/framework/capability-registry.ts +2 -395
  141. package/src/runtime/framework/contracts.ts +2 -144
  142. package/src/runtime/framework/control/control-scheduler.ts +2 -1268
  143. package/src/runtime/framework/control/domain-set.ts +2 -81
  144. package/src/runtime/framework/control/index.ts +1 -3
  145. package/src/runtime/framework/control/types.ts +2 -191
  146. package/src/runtime/framework/control-coordinator.ts +2 -11
  147. package/src/runtime/framework/events/event-catalog.ts +2 -74
  148. package/src/runtime/framework/events/event-delivery-service.ts +2 -200
  149. package/src/runtime/framework/events/event-ingress.ts +2 -99
  150. package/src/runtime/framework/events/event-repository.ts +2 -82
  151. package/src/runtime/framework/events/index.ts +2 -7
  152. package/src/runtime/framework/events/memory-event-repository.ts +2 -1100
  153. package/src/runtime/framework/events/runtime-resume.ts +2 -20
  154. package/src/runtime/framework/events/sqlite-event-repository.ts +5 -2280
  155. package/src/runtime/framework/events/test-helpers.ts +1 -1
  156. package/src/runtime/framework/events/types.ts +2 -312
  157. package/src/runtime/framework/index.ts +3 -7
  158. package/src/runtime/framework/load-node-sqlite.ts +2 -17
  159. package/src/runtime/framework/mailbox/coalescer.ts +2 -83
  160. package/src/runtime/framework/mailbox/host-notification-sink.ts +2 -44
  161. package/src/runtime/framework/mailbox/identity.ts +2 -38
  162. package/src/runtime/framework/mailbox/index.ts +1 -7
  163. package/src/runtime/framework/mailbox/mailbox-dispatcher.ts +2 -282
  164. package/src/runtime/framework/mailbox/mailbox-repository.ts +2 -44
  165. package/src/runtime/framework/mailbox/notification-projector.ts +2 -65
  166. package/src/runtime/framework/mailbox/types.ts +2 -145
  167. package/src/runtime/framework/modules/runtime-module-loader-hooks.mjs +2 -154
  168. package/src/runtime/framework/modules/runtime-module-loader.ts +7 -51
  169. package/src/runtime/framework/modules/runtime-module-output.ts +2 -24
  170. package/src/runtime/framework/modules/runtime-module-worker-bootstrap.mjs +3 -23
  171. package/src/runtime/framework/participation-manager.ts +2 -253
  172. package/src/runtime/framework/persistence/async-sqlite-persistence-worker.ts +2 -77
  173. package/src/runtime/framework/persistence/memory-first-persistence.ts +4 -489
  174. package/src/runtime/framework/plugins/contracts.ts +2 -396
  175. package/src/runtime/framework/plugins/index.ts +1 -4
  176. package/src/runtime/framework/plugins/runtime-event-identity.ts +2 -17
  177. package/src/runtime/framework/plugins/runtime-input-journal.ts +2 -866
  178. package/src/runtime/framework/plugins/runtime-plugin-scheduler.ts +2 -2071
  179. package/src/runtime/framework/runtime.ts +5 -1843
  180. package/src/runtime/framework/serial-task-queue.ts +2 -14
  181. package/src/runtime/framework/state/contracts.ts +2 -49
  182. package/src/runtime/framework/state/current-state-store.ts +2 -184
  183. package/src/runtime/framework/state/durable-agent-state-snapshot.ts +2 -209
  184. package/src/runtime/framework/state/freshness.ts +2 -72
  185. package/src/runtime/framework/state/history/contracts.ts +2 -158
  186. package/src/runtime/framework/state/history/history-writer.ts +2 -194
  187. package/src/runtime/framework/state/history/memory-state-history-repository.ts +2 -230
  188. package/src/runtime/framework/state/history/sqlite-state-history-repository.ts +2 -648
  189. package/src/runtime/framework/state/history/trajectory-projector.ts +2 -209
  190. package/src/runtime/framework/state/index.ts +1 -13
  191. package/src/runtime/framework/state/state-ingress.ts +2 -95
  192. package/src/runtime/framework/state/state-provider.ts +2 -62
  193. package/src/runtime/framework/state/types.ts +2 -155
  194. package/src/runtime/game-sync-ingress-protocol.ts +3 -2
  195. package/src/runtime/game-sync-ingress-worker.ts +7 -1
  196. package/src/runtime/game-sync-protocol.ts +64 -4
  197. package/src/runtime/host-monitor-rate-gate.ts +1 -123
  198. package/src/runtime/mailbox-host-relay.ts +1 -326
  199. package/src/runtime/observability/detail-capture.ts +4 -108
  200. package/src/runtime/observability/process-timing.ts +2 -59
  201. package/src/runtime/observability/recorder.ts +2 -238
  202. package/src/runtime/observability/redaction.ts +2 -181
  203. package/src/runtime/observability/reporter.ts +2 -154
  204. package/src/runtime/observability/sinks.ts +2 -135
  205. package/src/runtime/observability/types.ts +2 -92
  206. package/src/runtime/owner-control.ts +45 -320
  207. package/src/runtime/parent-process-watch.ts +1 -51
  208. package/src/runtime/process-identity.ts +1 -72
  209. package/src/runtime/threaded-ws-client.ts +11 -2
  210. package/src/runtime/ws-client.ts +6 -0
  211. package/src/sdk/behavior-plugin/index.ts +9 -3
  212. package/src/sdk/index.ts +40 -2
  213. package/src/sdk/module-input/index.ts +5 -0
  214. package/src/sdk/perception-plugin/index.ts +3 -1
  215. package/src/sdk/perception-plugin/module.ts +12 -2
  216. package/src/sdk/perception-plugin/reminder-rules.ts +8 -42
  217. package/src/sdk/perception-plugin/reminder.ts +2 -1
  218. package/src/sdk/perception-plugin/task-change-tracker.ts +258 -0
  219. package/src/sdk/strategy-memory.ts +1 -12
  220. package/src/sdk/strategy-plugin/index.ts +36 -0
  221. package/src/sdk/trigger-plugin/index.ts +1 -0
  222. package/docs/custom-modules/trigger.md +0 -295
  223. package/skills/clawclaw/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +0 -692
  224. package/skills/clawclaw/references/CUSTOM-SKILL-DEVELOPMENT.md +0 -67
@@ -17,9 +17,9 @@
17
17
 
18
18
  只有 `SKILL.md` 是必需的;附属目录按需创建。正文通过相对路径引用资料。脚本不是自动执行入口,必须说明用途、参数、依赖及何时运行。
19
19
 
20
- 先用 `ccl workspace` 确认工作目录。通过当前账号 `ccl behavior list` 或 `ccl perception --list` 返回的 `working_copy_path` 定位同一账号的 `capabilities` 根目录;已有技能也可用 `ccl capability list` 查看登记信息。不能把其他账号的目录当作当前账号,不能猜测 account-hash;没有可确认的账号路径时,先确认路径再写入。`ccl data path` 只返回总 user-data 目录,不是当前账号技能目录。
20
+ 先按 [创作流程](../../skills/clawclaw-creator/SKILL.md) 用 `ccl perception -h` 确认当前账号的 `capabilities` 根目录;这不依赖已有资源。`ccl capability list` 的 `relativePath` 相对于此根目录。不要猜 account-hash;`ccl data path` 只返回总 user-data 目录。
21
21
 
22
- 不要直接在 `.agents/skills`、`.claude/skills`、`.codex/skills` 或 `.openclaw/skills` 下创建游戏技能实体。这些宿主入口由 CCL 建立目录链接,指向账号工作副本。不要修改 Hub revision cache,也不要覆盖官方 `clawclaw` 技能。修改现有技能应找到原工作副本,不另建同名副本。
22
+ 不要直接在 `.agents/skills`、`.claude/skills`、`.codex/skills` 或 `.openclaw/skills` 下创建游戏技能实体。这些宿主入口由 CCL 建立目录链接,指向账号工作副本。不要修改 Hub revision cache,也不要覆盖随 CCL 安装的 `clawclaw` 和 `clawclaw-creator` 技能。修改现有技能应找到原工作副本,不另建同名副本。
23
23
 
24
24
  最小示例:
25
25
 
@@ -37,18 +37,20 @@ description: Organize visible meeting evidence before speaking.
37
37
  不要推断不可见身份,不要把动作请求当作执行成功。
38
38
  ```
39
39
 
40
- 目录名与 `name` 保持一致。使用唯一名称;名称以字母或数字开头,后续只使用字母、数字、点、下划线或连字符,总长度不超过 128 字符。不要使用保留名称 `clawclaw`。描述说明适用场景,正文写清执行步骤、信息边界和完成条件;不要复制过时的游戏命令、写入凭据或要求绕过官方开局流程。
40
+ 目录名与 `name` 保持一致。使用唯一名称;名称以字母或数字开头,后续只使用字母、数字、点、下划线或连字符,总长度不超过 128 字符。不要占用官方技能名称 `clawclaw` 或 `clawclaw-creator`。描述说明适用场景,正文写清执行步骤、信息边界和完成条件;不要复制过时的游戏命令、写入凭据或要求绕过官方开局流程。
41
41
 
42
- ## 本地装配
42
+ ## 本地装配与汇报
43
43
 
44
- 保存后运行 `ccl load`。首次发现纯本地技能时,按玩家选择执行其中一条:
44
+ 写好后运行 `ccl capability list`,按文件路径识别本次新建的技能,并使用返回的完整选择器:
45
45
 
46
46
  ```powershell
47
- ccl capability equip skill/my-game-helper
48
- ccl capability unequip skill/my-game-helper
47
+ ccl capability equip <selection_ref>
48
+ ccl load
49
49
  ```
50
50
 
51
- 之后重新完整运行 `ccl load`,依据最终结果继续游戏。已保存的选择无需反复询问。合法账号工作副本会参与 CCL 自动云端同步;未装配不等于不上传。尚不希望参与同步的草稿放在账号的 `drafts`,不要放进 `skills` 主目录。
51
+ 新建技能默认装配,不重复询问。CCL 负责建立宿主链接和自动私有同步;不要把仅注册宿主技能的安装命令当作账号入库流程,也不要手工创建宿主目录链接。核对最终 `capabilities.skills`、同步和宿主链接结果后,通过宿主正常技能入口按名称实际加载一次,再向用户汇报创建/编辑、入库、装配和生效状态。仅用文件工具读取源码不证明宿主已发现它;宿主入口不可用或找不到目标时,说明当前会话尚未确认可用,需要刷新技能列表或开启新会话。不要猜当前项目 `.agents/skills` 就是 CCL 的链接位置。更新已有技能可能需要新会话,不能统一承诺“下次开局生效”。
52
+
53
+ 编辑已有技能前先完整 `ccl load`,同步远端装配与内容,处理目标冲突后重新定位、读取工作副本。编辑后再 load 同步核验并汇报,保持同步后的资源身份和装配选择;用户要求改好使用时显式 equip。只保存草稿时放在账号 `drafts/`;未装配不等于不上传。发现其它不属于本次创作的纯本地技能仍由玩家选择,不顺带装配。
52
54
 
53
55
  ## 网页导入与公开分享
54
56
 
@@ -58,9 +60,9 @@ ccl capability unequip skill/my-game-helper
58
60
 
59
61
  ## 同名真实目录
60
62
 
61
- 如果任一宿主同名位置已存在真实目录,CCL 保留原文件,跳过该技能在所有宿主上的链接装配,并清理对应的既有 CCL 链接;不会迁移、覆盖或删除真实目录,也不会因此修改 Hub 装配选择。
63
+ 如果某个宿主同名位置已存在真实目录,CCL 保留原文件,只跳过该目录的链接装配;其他宿主照常建立或更新链接,不会因这个冲突移除既有链接。切换账号也按目录分别处理。CCL 不会迁移、覆盖或删除真实目录,也不会因此修改 Hub 装配选择。
62
64
 
63
- 命令以英文结构化提示返回 `reason: local_skill_directory_exists`、具体 `paths` 和 `blocking: false`。每次 `ccl load` 仍遇到此情况都会在 `changes.skills.skipped` 返回提示;Agent 每次应向玩家简短说明,但不能将它当作开局阻塞或再次询问是否装配。
65
+ 命令以英文结构化提示返回 `reason: local_skill_directory_exists`、仅包含冲突目录的 `paths` 和 `blocking: false`。每次 `ccl load` 仍遇到此情况都会在 `changes.skills.skipped` 返回提示;Agent 每次应向玩家简短说明这些目录被跳过,其他目录独立处理,不能将它当作整个技能装配失败、开局阻塞或再次询问是否装配。equip 只在所有宿主目录都冲突时返回 `effective: skipped`,部分目录冲突时返回 `effective: immediate` 并附上 `skipped` 提示。
64
66
 
65
67
  取消装配只移除 CCL 管理的链接,真实目录仍保留,仍返回提示。宿主可能继续读取这个本地技能,因此不能承诺技能已从 Agent 完全禁用。玩家以后自行移走真实目录,且该技能仍被选择装配时,下次 `ccl load` 会恢复链接。
66
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myclaw163/clawclaw-cli",
3
- "version": "0.9.2",
3
+ "version": "0.10.2",
4
4
  "type": "module",
5
5
  "description": "ClawClaw social deduction game CLI",
6
6
  "bin": {
@@ -15,10 +15,11 @@
15
15
  "./module-input": "./src/sdk/module-input/index.ts",
16
16
  "./behavior-plugin": "./src/sdk/behavior-plugin/index.ts",
17
17
  "./trigger-plugin": "./src/sdk/trigger-plugin/index.ts",
18
- "./perception-plugin": "./src/sdk/perception-plugin/index.ts"
18
+ "./perception-plugin": "./src/sdk/perception-plugin/index.ts",
19
+ "./strategy-plugin": "./src/sdk/strategy-plugin/index.ts"
19
20
  },
20
21
  "engines": {
21
- "node": ">=22.15.0"
22
+ "node": ">=24.12.0"
22
23
  },
23
24
  "files": [
24
25
  "bin/",
@@ -48,7 +49,9 @@
48
49
  "docs/desktop-event-push.md",
49
50
  "docs/configuration.md",
50
51
  "docs/custom-modules/",
51
- "docs/user-guide/"
52
+ "docs/user-guide/",
53
+ "!scripts/release.mjs",
54
+ "!scripts/release-support.mjs"
52
55
  ],
53
56
  "scripts": {
54
57
  "typecheck": "tsc --noEmit",
@@ -62,9 +65,16 @@
62
65
  "prepack": "node scripts/package-readme.mjs prepare",
63
66
  "postpack": "node scripts/package-readme.mjs restore",
64
67
  "postinstall": "node scripts/postinstall.mjs",
65
- "release:patch": "npm version patch && npm publish --registry https://registry.npmjs.org --access public",
66
- "release:minor": "npm version minor && npm publish --registry https://registry.npmjs.org --access public",
67
- "release:major": "npm version major && npm publish --registry https://registry.npmjs.org --access public"
68
+ "release:patch": "node scripts/release.mjs patch",
69
+ "release:minor": "node scripts/release.mjs minor",
70
+ "release:major": "node scripts/release.mjs major",
71
+ "setup:local": "node scripts/install-local-runtime.mjs",
72
+ "qa:install": "node scripts/qa-install.mjs",
73
+ "check:framework": "node scripts/check-framework-boundaries.mjs",
74
+ "build:framework": "npm --prefix packages/game-agent-runtime run build",
75
+ "typecheck:framework": "npm --prefix packages/game-agent-runtime run typecheck",
76
+ "test:framework": "npm --prefix packages/game-agent-runtime test",
77
+ "check:framework-package": "npm --prefix packages/game-agent-runtime run check:boundaries"
68
78
  },
69
79
  "dependencies": {
70
80
  "@modelcontextprotocol/sdk": "^1.30.0",
@@ -74,13 +84,18 @@
74
84
  "skills": "1.5.1",
75
85
  "tsx": "^4.23.12",
76
86
  "undici": "^6.28.0",
77
- "ws": "^8.21.3"
87
+ "ws": "^8.21.3",
88
+ "@myclaw163/game-agent-runtime": "0.1.1"
78
89
  },
79
90
  "devDependencies": {
80
- "@types/node": "^22.20.1",
91
+ "@types/node": "^24.19.2",
81
92
  "@types/ws": "^8.5.10",
82
93
  "esbuild": "^0.28.2",
83
94
  "typescript": "^5.4.0",
84
95
  "vitest": "^3.1.0"
96
+ },
97
+ "publishConfig": {
98
+ "access": "public",
99
+ "registry": "https://registry.npmjs.org/"
85
100
  }
86
101
  }
@@ -0,0 +1,27 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ const adapters = [
3
+ 'src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.ts',
4
+ 'src/runtime/clawclaw/plugins/behavior/behavior-runner.ts',
5
+ 'src/runtime/clawclaw/plugins/behavior/behavior-analysis-thread-host.ts',
6
+ 'src/runtime/clawclaw/plugins/perception/perception-module-runner.ts',
7
+ 'src/runtime/clawclaw/plugins/perception/perception-module-worker.ts',
8
+ 'src/runtime/clawclaw/plugins/mailbox/desktop-event-socket.ts',
9
+ 'src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-socket.ts',
10
+ 'src/runtime/clawclaw/plugins/mailbox/adapters/claude-channel-adapter.ts',
11
+ 'src/runtime/mailbox-host-relay.ts',
12
+ 'src/runtime/host-monitor-rate-gate.ts',
13
+ ];
14
+ const failures = [];
15
+ for (const path of adapters) {
16
+ const code = await readFile(path, 'utf8');
17
+ if (!code.includes('@myclaw163/game-agent-runtime/')) failures.push(`${path}: does not delegate to the framework`);
18
+ if (/\bnew\s+Worker\s*\(|\bcreateConnection\s*\(|\bsetTimeout\s*\(/.test(code)) {
19
+ failures.push(`${path}: execution/transport scheduling leaked into the game adapter`);
20
+ }
21
+ }
22
+ const pkg = JSON.parse(await readFile('package.json', 'utf8'));
23
+ if (!/^\d+\.\d+\.\d+$/.test(pkg.dependencies?.['@myclaw163/game-agent-runtime'] ?? '')) {
24
+ failures.push('CCL must depend on a versioned framework package, not an adjacent source directory.');
25
+ }
26
+ if (failures.length) throw new Error(failures.join('\n'));
27
+ console.log(JSON.stringify({ adaptersChecked: adapters.length, executionOrTransportLeaks: 0 }));
@@ -7,12 +7,12 @@ const root = process.cwd();
7
7
  const skillDir = join(root, 'skills', 'clawclaw');
8
8
  const referenceDir = join(skillDir, 'references');
9
9
 
10
- const sources = [
11
- join(skillDir, 'SKILL.md'),
12
- ...readdirSync(referenceDir)
13
- .filter((name) => name.endsWith('.md'))
14
- .map((name) => join(referenceDir, name)),
15
- ];
10
+ const sources = ['clawclaw', 'clawclaw-creator'].flatMap(name => {
11
+ const directory = join(root, 'skills', name);
12
+ const references = join(directory, 'references');
13
+ return [join(directory, 'SKILL.md'), ...readdirSync(references)
14
+ .filter(file => file.endsWith('.md')).map(file => join(references, file))];
15
+ });
16
16
 
17
17
  const text = sources.map((file) => readFileSync(file, 'utf8')).join('\n');
18
18
 
@@ -28,7 +28,7 @@ const banned = [
28
28
  /ccl\s+memory\s+load\b/,
29
29
  /ccl\s+account\s+(leaderboard|history)\b/,
30
30
  /ccl\s+knowledge\b/,
31
- /ccl\s+(?:strategy|intent)\b/,
31
+ /ccl\s+(?:behavior|trigger|intent)\b/,
32
32
  /--no-watch\b/,
33
33
  /--think\b/,
34
34
  /\bvote_cast\b/,
@@ -73,23 +73,19 @@ function commandPath(raw) {
73
73
  if (first === 'start') return second ? `start ${second}` : 'start';
74
74
  if (first === 'join') return 'join';
75
75
  if (first === 'events') return 'events';
76
- if (first === 'behavior') {
77
- if (!second || second.startsWith('-') || /^<[^>]+>$/.test(second)) return 'behavior';
78
- if (second.includes('/')) return 'behavior';
76
+ if (first === 'strategy') {
77
+ if (!second || second.startsWith('-') || /^<[^>]+>$/.test(second)) return 'strategy';
78
+ if (second.includes('/')) return 'strategy';
79
79
  if (second === 'fallback') {
80
80
  const third = tokens[3];
81
- return third && !third.startsWith('-') ? `behavior ${second} ${third}` : `behavior ${second}`;
81
+ return third && !third.startsWith('-') ? `strategy ${second} ${third}` : `strategy ${second}`;
82
82
  }
83
- return `behavior ${second}`;
84
- }
85
- if (first === 'trigger') {
86
- if (!second || second.startsWith('-') || /^<[^>]+>$/.test(second)) return 'trigger';
87
- if (second.includes('/')) return 'trigger';
88
- return `trigger ${second}`;
83
+ return `strategy ${second}`;
89
84
  }
90
85
  if (first === 'perception') return ['rename', 'update', 'status'].includes(second) ? `perception ${second}` : 'perception';
91
86
  if (first === 'speak' || first === 'vote' || first === 'aside') return first;
92
87
  if (first === 'load') return 'load';
88
+ if (first === 'workspace') return 'workspace';
93
89
  return null;
94
90
  }
95
91
 
@@ -127,16 +123,17 @@ function walk(node) {
127
123
  }
128
124
  walk(schema);
129
125
 
130
- // Agent-facing docs intentionally omit owner process entry points.
131
- // Every supported host reaches these lifecycle paths through Channel tools instead.
132
- const channelOwnedCommands = new Set([
126
+ // Gameplay uses top-level start/join. Creator writes Persona Markdown directly
127
+ // and explicitly selects it with persona use, rather than creating an empty file.
128
+ const intentionallyUntaughtCommands = new Set([
133
129
  'game start',
134
130
  'game create-room',
135
131
  'game join-room',
136
132
  'game training create',
133
+ 'persona create',
137
134
  ]);
138
135
  const missingFromDocs = leaves.filter((path) => (
139
- !channelOwnedCommands.has(path) && !mentioned.has(path)
136
+ !intentionallyUntaughtCommands.has(path) && !mentioned.has(path)
140
137
  ));
141
138
  const mentionedMissingFromSchema = [...mentioned].filter((path) => (
142
139
  path !== 'ccl'
@@ -144,7 +141,7 @@ const mentionedMissingFromSchema = [...mentioned].filter((path) => (
144
141
  && !leaves.some((leaf) => leaf === path || leaf.startsWith(`${path} `))
145
142
  ));
146
143
  const moduleLeavesMissingFromCommandsReference = leaves.filter((path) => (
147
- (path.startsWith('behavior ') || path.startsWith('trigger '))
144
+ path.startsWith('strategy ')
148
145
  && !commandsReferenceMentioned.has(path)
149
146
  ));
150
147
 
@@ -168,7 +165,7 @@ console.log(JSON.stringify({
168
165
  ok: true,
169
166
  documented_commands: [...mentioned].sort(),
170
167
  commands_reference_module_commands: [...commandsReferenceMentioned]
171
- .filter((path) => path.startsWith('behavior ') || path.startsWith('trigger '))
168
+ .filter((path) => path.startsWith('strategy ') || path.startsWith('trigger '))
172
169
  .sort(),
173
170
  schema_leaf_commands: leaves.sort(),
174
171
  }, null, 2));
@@ -35,6 +35,10 @@ const REQUIRED_ALLOW = [
35
35
  "Skill(clawclaw *)",
36
36
  "Read(~/.claude/skills/clawclaw/**)",
37
37
  "Read(~/.agents/skills/clawclaw/**)",
38
+ "Skill(clawclaw-creator)",
39
+ "Skill(clawclaw-creator *)",
40
+ "Read(~/.claude/skills/clawclaw-creator/**)",
41
+ "Read(~/.agents/skills/clawclaw-creator/**)",
38
42
  "Edit(~/.clawclaw/user-data/accounts/**/personas/local/**)",
39
43
  "Edit(~/.clawclaw/user-data/accounts/**/personas/hub/**)",
40
44
  "Edit(~/.clawclaw/user-data/accounts/**/memory.md)",
@@ -0,0 +1,35 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile, writeFile, open, unlink } from 'node:fs/promises';
3
+ import { resolve } from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+ import { spawn } from 'node:child_process';
6
+
7
+ // The source lockfile retains a registry dependency. Only this local npm-ci invocation
8
+ // substitutes a verified tarball, then restores the exact original lockfile.
9
+ const tarball = process.argv[2];
10
+ if (!tarball || !process.env.npm_execpath) throw Error('Usage: npm run setup:local -- <game-agent-runtime.tgz>');
11
+ const original = await readFile('package-lock.json', 'utf8');
12
+ const lock = JSON.parse(original);
13
+ const dependency = lock.packages['node_modules/@myclaw163/game-agent-runtime'];
14
+ if (!dependency) throw Error('The source lockfile has no game-agent-runtime dependency.');
15
+ dependency.resolved = pathToFileURL(resolve(tarball)).href;
16
+ dependency.integrity = `sha512-${createHash('sha512').update(await readFile(resolve(tarball))).digest('base64')}`;
17
+ const temporary = JSON.stringify(lock, null, 2) + '\n';
18
+ const guard = await open('.runtime-install.lock', 'wx');
19
+ try {
20
+ await writeFile('package-lock.json', temporary);
21
+ const status = await new Promise((done, reject) => {
22
+ const child = spawn(process.execPath, [process.env.npm_execpath, 'ci', '--ignore-scripts', '--no-audit', '--no-fund'], { stdio: 'inherit' });
23
+ child.once('error', reject); child.once('exit', code => done(code ?? 1));
24
+ });
25
+ if (status !== 0) process.exitCode = status;
26
+ } finally {
27
+ const current = await readFile('package-lock.json', 'utf8');
28
+ if (current === temporary || current === original) await writeFile('package-lock.json', original);
29
+ else {
30
+ await writeFile('.runtime-install-lockfile-backup.json', original);
31
+ process.stderr.write('Lockfile changed concurrently; retained it and saved the original backup.\n');
32
+ process.exitCode = 1;
33
+ }
34
+ await guard.close(); await unlink('.runtime-install.lock');
35
+ }
@@ -8,7 +8,7 @@ function main() {
8
8
  try {
9
9
  syncBundledSkill();
10
10
  } catch (err) {
11
- console.warn('[clawclaw-cli] CLI installed, but bundled agent skill was not updated.');
11
+ console.warn('[clawclaw-cli] CLI installed, but bundled agent skills were not fully updated.');
12
12
  console.warn('[clawclaw-cli] Run: ccl upgrade skill');
13
13
  console.warn(`[clawclaw-cli] Error: ${err?.message ?? String(err)}`);
14
14
  }
@@ -0,0 +1,105 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { createHash } from 'node:crypto';
3
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
4
+ import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+
7
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
8
+ const args = process.argv.slice(2);
9
+ const usage = 'npm run qa:install -- --pack-dir <workspace-tmp-dir> [--prefix <test-install-dir>] [--pack-only] [--skip-tests] [--allow-dirty]';
10
+ if (args.includes('--help')) { console.log(usage); process.exit(0); }
11
+ const options = {};
12
+ for (let i = 0; i < args.length; i++) {
13
+ const key = args[i];
14
+ if (['--pack-only', '--skip-tests', '--allow-dirty'].includes(key)) options[key] = true;
15
+ else if (['--pack-dir', '--prefix'].includes(key) && args[i + 1] && !args[i + 1].startsWith('--')) options[key] = args[++i];
16
+ else throw Error(`Unknown or incomplete option: ${key}\n${usage}`);
17
+ }
18
+ if (!options['--pack-dir']) throw Error(usage);
19
+ if (!process.env.npm_execpath) throw Error('Run this entry through npm run qa:install.');
20
+ const [major, minor] = process.versions.node.split('.').map(Number);
21
+ if (major < 24 || major === 24 && minor < 12) throw Error(`Node.js >= 24.12.0 is required (current: ${process.versions.node}). Upgrade Node.js before installing CCL.`);
22
+ if (process.platform === 'win32' && /[^\x00-\x7f]/.test(root)) {
23
+ throw Error('For Windows QA, clone into an ASCII path such as C:/ccl-qa/clawclaw-cli.');
24
+ }
25
+ const outsideSource = value => {
26
+ const absolute = resolve(value), rel = relative(root, absolute);
27
+ if (rel === '' || !isAbsolute(rel) && rel !== '..' && !rel.startsWith('..' + (process.platform === 'win32' ? '\\' : '/'))) {
28
+ throw Error(`Use a directory outside the source repository: ${absolute}`);
29
+ }
30
+ return absolute;
31
+ };
32
+ const packParent = outsideSource(options['--pack-dir']);
33
+ const prefix = options['--prefix'] ? outsideSource(options['--prefix']) : undefined;
34
+ const git = (...argv) => {
35
+ const result = spawnSync('git', ['-C', root, ...argv], { encoding: 'utf8', windowsHide: true });
36
+ if (result.error || result.status !== 0) throw Error('Run QA from a Git checkout; git must be on PATH.');
37
+ return result.stdout.trim();
38
+ };
39
+ const commit = git('rev-parse', 'HEAD'), dirty = git('status', '--porcelain').length > 0;
40
+ if (dirty && !options['--allow-dirty']) throw Error('Source has uncommitted changes. Commit them, or explicitly pass --allow-dirty for a local iteration.');
41
+ if (existsSync(join(root, '.npm-readme-backup'))) throw Error('An earlier pack was interrupted. Run node scripts/package-readme.mjs restore first.');
42
+ const env = { ...process.env, CLAWCLAW_SKIP_AUTO_UPGRADE: '1', CLAWCLAW_SKIP_SKILL_SYNC: '1', CLAWCLAW_NO_SKILL_SYNC: '1' };
43
+ function run(executable, argv, cwd, capture = false, childEnv = env) {
44
+ const result = spawnSync(executable, argv, { cwd, env: childEnv, windowsHide: true, encoding: 'utf8',
45
+ stdio: capture ? ['ignore', 'pipe', 'inherit'] : 'inherit', maxBuffer: 16 * 1024 * 1024 });
46
+ if (result.error) throw result.error;
47
+ if (result.status !== 0) throw Error(`Command failed (${result.status}): ${executable} ${argv.join(' ')}`);
48
+ return result.stdout?.trim() ?? '';
49
+ }
50
+ const npm = (argv, cwd = root, capture = false, childEnv = env) => run(process.execPath, [process.env.npm_execpath, ...argv], cwd, capture, childEnv);
51
+ // Unit tests exercise sync against their own fixtures. Installation guards must
52
+ // not turn the module under test into a no-op; keep guards on real installs.
53
+ const testEnv = { ...env };
54
+ delete testEnv.CLAWCLAW_NO_SKILL_SYNC;
55
+ delete testEnv.CLAWCLAW_SKIP_SKILL_SYNC;
56
+ mkdirSync(packParent, { recursive: true });
57
+ const artifacts = mkdtempSync(join(packParent, 'ccl-qa-'));
58
+ const framework = join(root, 'packages/game-agent-runtime');
59
+ const manifest = directory => JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8'));
60
+ const gamePackage = manifest(root), corePackage = manifest(framework);
61
+ if (gamePackage.dependencies?.[corePackage.name] !== corePackage.version) throw Error('CCL must depend on the exact local framework version.');
62
+ const sha256 = file => createHash('sha256').update(readFileSync(file)).digest('hex');
63
+ function pack(directory) {
64
+ try {
65
+ const result = JSON.parse(npm(['pack', '--json', '--pack-destination', artifacts], directory, true));
66
+ if (result.length !== 1) throw Error('Expected one npm package.');
67
+ return join(artifacts, result[0].filename);
68
+ } finally {
69
+ if (directory === root && existsSync(join(root, '.npm-readme-backup'))) {
70
+ run(process.execPath, ['scripts/package-readme.mjs', 'restore'], root);
71
+ }
72
+ }
73
+ }
74
+ npm(['ci', '--ignore-scripts', '--no-audit', '--no-fund'], framework);
75
+ npm(['run', 'typecheck'], framework);
76
+ npm(['run', 'check:boundaries'], framework);
77
+ // pack runs the framework's build hook; Worker assets must exist before tests.
78
+ const frameworkTarball = pack(framework);
79
+ if (!options['--skip-tests']) npm(['test'], framework, false, testEnv);
80
+ const lockHash = sha256(join(root, 'package-lock.json'));
81
+ npm(['run', 'setup:local', '--', frameworkTarball]);
82
+ if (sha256(join(root, 'package-lock.json')) !== lockHash) throw Error('The source lockfile was not restored.');
83
+ npm(['run', 'typecheck']);
84
+ npm(['run', 'check:framework']);
85
+ if (!options['--skip-tests']) npm(['test'], root, false, testEnv);
86
+ const cclTarball = pack(root);
87
+ let installed;
88
+ if (!options['--pack-only']) {
89
+ const destination = prefix ? ['--prefix', prefix] : [];
90
+ npm(['install', '--global', ...destination, '--no-audit', '--no-fund', frameworkTarball, cclTarball]);
91
+ const modules = npm(['root', '--global', ...destination], root, true);
92
+ const cclRoot = join(modules, '@myclaw163/clawclaw-cli');
93
+ const runtimeRoot = join(modules, '@myclaw163/game-agent-runtime');
94
+ if (manifest(cclRoot).version !== gamePackage.version || manifest(runtimeRoot).version !== corePackage.version) throw Error('Installed package versions do not match source.');
95
+ const cclEntry = join(cclRoot, 'bin/clawclaw-cli.mjs');
96
+ const version = run(process.execPath, [cclEntry, '--version'], root, true);
97
+ if (version !== gamePackage.version) throw Error('Installed ccl --version does not match source.');
98
+ installed = { modules, cclEntry, version, frameworkVersion: corePackage.version };
99
+ }
100
+ const report = { sourceCommit: commit, sourceDirty: dirty, node: process.version, platform: process.platform,
101
+ testsRun: !options['--skip-tests'], artifacts, tarballs: [frameworkTarball, cclTarball].map(file => ({ file, sha256: sha256(file) })),
102
+ installed: installed ?? null, skillSync: false, registryPublication: false };
103
+ writeFileSync(join(artifacts, 'qa-install.json'), JSON.stringify(report, null, 2) + '\n');
104
+ console.log(JSON.stringify(report, null, 2));
105
+ console.log('For every QA shell or Agent host, keep CLAWCLAW_SKIP_AUTO_UPGRADE=1 and use this installed CCL. No game was started.');
@@ -3,16 +3,17 @@ import {
3
3
  existsSync,
4
4
  mkdirSync,
5
5
  readFileSync,
6
+ readdirSync,
6
7
  renameSync,
7
8
  rmSync,
8
9
  } from 'node:fs';
9
10
  import { spawnSync } from 'node:child_process';
10
11
  import { randomUUID } from 'node:crypto';
11
12
  import { homedir } from 'node:os';
13
+ import { createRequire } from 'node:module';
12
14
  import { basename, dirname, join, resolve } from 'node:path';
13
15
  import { fileURLToPath, pathToFileURL } from 'node:url';
14
16
 
15
- const SKILL_NAME = 'clawclaw';
16
17
  const SKILLS_ADD_TIMEOUT_MS = 60_000;
17
18
 
18
19
  function getOpenClawSkillsDir(homeDir = homedir()) {
@@ -23,15 +24,15 @@ function getOpenClawSkillsDir(homeDir = homedir()) {
23
24
  return join(homeDir, '.openclaw', 'skills');
24
25
  }
25
26
 
26
- function defaultCandidateSkillDirs() {
27
+ function defaultCandidateSkillDirs(skillName) {
27
28
  const homeDir = homedir();
28
29
  const claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || join(homeDir, '.claude');
29
30
  const codexHome = process.env.CODEX_HOME?.trim() || join(homeDir, '.codex');
30
31
  return [
31
- join(homeDir, '.agents', 'skills', SKILL_NAME),
32
- join(claudeHome, 'skills', SKILL_NAME),
33
- join(codexHome, 'skills', SKILL_NAME),
34
- join(getOpenClawSkillsDir(homeDir), SKILL_NAME),
32
+ join(homeDir, '.agents', 'skills', skillName),
33
+ join(claudeHome, 'skills', skillName),
34
+ join(codexHome, 'skills', skillName),
35
+ join(getOpenClawSkillsDir(homeDir), skillName),
35
36
  ];
36
37
  }
37
38
 
@@ -58,12 +59,11 @@ function replaceTarget(source, target) {
58
59
  }
59
60
 
60
61
  function resolveSkillsBin(installDir) {
61
- const packagePath = resolve(installDir, 'node_modules', 'skills', 'package.json');
62
- if (!existsSync(packagePath)) throw new Error(`skills package not found: ${packagePath}`);
62
+ const packagePath = createRequire(join(installDir, 'package.json')).resolve('skills/package.json');
63
63
  const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
64
64
  const entry = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.skills;
65
65
  if (!entry) throw new Error('skills package has no bin entry');
66
- return resolve(installDir, 'node_modules', 'skills', entry);
66
+ return resolve(dirname(packagePath), entry);
67
67
  }
68
68
 
69
69
  export function syncBundledSkill(options = {}) {
@@ -72,26 +72,33 @@ export function syncBundledSkill(options = {}) {
72
72
  }
73
73
  const scriptDir = dirname(fileURLToPath(import.meta.url));
74
74
  const installDir = resolve(options.installDir ?? join(scriptDir, '..'));
75
- const sourceDir = resolve(installDir, 'skills', SKILL_NAME);
76
- if (!existsSync(sourceDir)) throw new Error(`bundled skill dir not found: ${sourceDir}`);
75
+ const skillsDir = resolve(installDir, 'skills');
76
+ const names = readdirSync(skillsDir, { withFileTypes: true })
77
+ .filter(entry => entry.isDirectory() && existsSync(join(skillsDir, entry.name, 'SKILL.md')))
78
+ .map(entry => entry.name).sort();
79
+ if (!names.length) throw new Error(`no bundled skills found: ${skillsDir}`);
77
80
  const spawn = options.spawnSync ?? spawnSync;
78
- const result = spawn(
79
- process.execPath,
80
- [resolveSkillsBin(installDir), 'add', sourceDir, '-y', '-g'],
81
- {
82
- cwd: installDir,
83
- timeout: SKILLS_ADD_TIMEOUT_MS,
84
- windowsHide: true,
85
- stdio: options.stdio ?? 'inherit',
86
- },
87
- );
88
- if (result.error) throw result.error;
89
- if (typeof result.status === 'number' && result.status !== 0) {
90
- throw new Error(`skills add exited with code ${result.status}`);
81
+ const binary = resolveSkillsBin(installDir);
82
+ let updatedTargets = 0;
83
+ for (const name of names) {
84
+ const sourceDir = join(skillsDir, name);
85
+ const result = spawn(
86
+ process.execPath,
87
+ [binary, 'add', sourceDir, '-y', '-g'],
88
+ {
89
+ cwd: installDir,
90
+ timeout: SKILLS_ADD_TIMEOUT_MS,
91
+ windowsHide: true,
92
+ stdio: options.stdio ?? 'inherit',
93
+ },
94
+ );
95
+ if (result.error) throw result.error;
96
+ if (result.status !== 0) throw new Error(`skills add ${name} exited with code ${result.status}`);
97
+ const targets = (options.candidateDirs ?? defaultCandidateSkillDirs)(name);
98
+ for (const target of targets) replaceTarget(sourceDir, resolve(target));
99
+ updatedTargets += targets.length;
91
100
  }
92
- const targets = options.candidateDirs ?? defaultCandidateSkillDirs();
93
- for (const target of targets) replaceTarget(sourceDir, resolve(target));
94
- return { skipped: false, updatedTargets: targets.length };
101
+ return { skipped: false, updatedTargets };
95
102
  }
96
103
 
97
104
  function formatFailure(error) {
@@ -105,7 +112,7 @@ function main() {
105
112
  console.error(`[clawclaw-cli] skill sync skipped (${result.reason})`);
106
113
  }
107
114
  } catch (error) {
108
- console.error('[clawclaw-cli] Bundled agent skill was not updated.');
115
+ console.error('[clawclaw-cli] Bundled agent skills were not fully updated.');
109
116
  console.error(`[clawclaw-cli] Error: ${formatFailure(error)}`);
110
117
  process.exit(1);
111
118
  }