@lovrabet/lovrabet-cli 2.3.13-beta.1 → 2.4.0-beta.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 (208) hide show
  1. package/README.md +22 -14
  2. package/lib/cli.js +4 -1
  3. package/lib/commands/api-doc/index.js +11 -1
  4. package/lib/commands/app/cache.js +2 -1
  5. package/lib/commands/app/definitions.js +7 -1
  6. package/lib/commands/app/eligibility.js +2 -1
  7. package/lib/commands/app/mock-loader.js +1 -1
  8. package/lib/commands/app/remote-source.js +2 -1
  9. package/lib/commands/app/shared.js +1 -1
  10. package/lib/commands/app-config/get.js +1 -1
  11. package/lib/commands/app-config/index.js +1 -1
  12. package/lib/commands/approval/index.js +7 -1
  13. package/lib/commands/artifact/index.js +11 -1
  14. package/lib/commands/auth/device.js +8 -1
  15. package/lib/commands/auth/index.js +9 -1
  16. package/lib/commands/auth/prompt.js +2 -1
  17. package/lib/commands/bff/detail.js +1 -1
  18. package/lib/commands/bff/exec.js +1 -1
  19. package/lib/commands/bff/index.js +1 -1
  20. package/lib/commands/cli-skill/index.js +2 -1
  21. package/lib/commands/common/config-policy.js +2 -1
  22. package/lib/commands/common/constraints.js +2 -1
  23. package/lib/commands/common/flags.js +2 -1
  24. package/lib/commands/common/local-file.js +1 -1
  25. package/lib/commands/config/definitions.js +8 -1
  26. package/lib/commands/config/init.js +4 -1
  27. package/lib/commands/config/shared.js +1 -1
  28. package/lib/commands/data/import-excel.js +10 -1
  29. package/lib/commands/data/index.js +10 -1
  30. package/lib/commands/dataset/detail.js +6 -1
  31. package/lib/commands/dataset/index.js +1 -1
  32. package/lib/commands/dataset/list.js +2 -1
  33. package/lib/commands/dataset/sdk-doc.js +1 -1
  34. package/lib/commands/doctor.js +9 -1
  35. package/lib/commands/file/index.js +3 -1
  36. package/lib/commands/init.js +4 -1
  37. package/lib/commands/issue/context.js +1 -1
  38. package/lib/commands/issue/index.js +1 -1
  39. package/lib/commands/issue/report.js +5 -1
  40. package/lib/commands/kb/index.js +7 -1
  41. package/lib/commands/logs/index.js +1 -1
  42. package/lib/commands/metric/contract.js +5 -1
  43. package/lib/commands/metric/definition.js +4 -1
  44. package/lib/commands/metric/detail.js +1 -1
  45. package/lib/commands/metric/exec.js +3 -1
  46. package/lib/commands/metric/index.js +1 -1
  47. package/lib/commands/metric/list.js +2 -1
  48. package/lib/commands/metric/shared.js +2 -1
  49. package/lib/commands/notification/config-list.js +1 -1
  50. package/lib/commands/notification/index.js +1 -1
  51. package/lib/commands/notification/shared.js +2 -1
  52. package/lib/commands/ocr/index.js +4 -1
  53. package/lib/commands/permit/dataset-get.js +1 -1
  54. package/lib/commands/permit/dataset-set.js +5 -1
  55. package/lib/commands/permit/index.js +1 -1
  56. package/lib/commands/permit/page-get.js +1 -1
  57. package/lib/commands/permit/page-set.js +3 -1
  58. package/lib/commands/permit/role-menus-set.js +4 -1
  59. package/lib/commands/permit/role-menus.js +1 -1
  60. package/lib/commands/permit/shared.js +7 -1
  61. package/lib/commands/personal-bff/index.js +7 -1
  62. package/lib/commands/registry.js +6 -1
  63. package/lib/commands/role/create.js +2 -1
  64. package/lib/commands/role/delete.js +2 -1
  65. package/lib/commands/role/detail.js +1 -1
  66. package/lib/commands/role/index.js +1 -1
  67. package/lib/commands/role/list.js +2 -1
  68. package/lib/commands/role/shared.js +8 -1
  69. package/lib/commands/role/update.js +3 -1
  70. package/lib/commands/role/user-add.js +2 -1
  71. package/lib/commands/role/user-remove.js +2 -1
  72. package/lib/commands/schedule/index.js +7 -1
  73. package/lib/commands/schema.js +1 -1
  74. package/lib/commands/service/dynamic.js +10 -1
  75. package/lib/commands/service/function-name-adapter.js +3 -1
  76. package/lib/commands/service/index.js +8 -1
  77. package/lib/commands/service/registry.js +12 -1
  78. package/lib/commands/skill/commands/create.js +3 -1
  79. package/lib/commands/skill/commands/diagram.js +4 -1
  80. package/lib/commands/skill/commands/install.js +6 -1
  81. package/lib/commands/skill/commands/list.js +3 -1
  82. package/lib/commands/skill/commands/push.js +1 -1
  83. package/lib/commands/skill/commands/validate.js +1 -1
  84. package/lib/commands/skill/diagram.js +3 -1
  85. package/lib/commands/skill/flags.js +4 -1
  86. package/lib/commands/skill/index.js +1 -1
  87. package/lib/commands/skill/manifest-helpers.js +1 -1
  88. package/lib/commands/skill/push-execute.js +11 -1
  89. package/lib/commands/skill/push-flow-helpers.js +4 -1
  90. package/lib/commands/skill/push-retarget.js +1 -1
  91. package/lib/commands/skill/scopes.js +1 -1
  92. package/lib/commands/skill/summary.js +1 -1
  93. package/lib/commands/skill/templates.js +8 -1
  94. package/lib/commands/skill/validate.js +8 -1
  95. package/lib/commands/sql/detail.js +1 -1
  96. package/lib/commands/sql/exec.js +2 -1
  97. package/lib/commands/sql/index.js +1 -1
  98. package/lib/commands/update.d.ts +2 -1
  99. package/lib/commands/update.js +8 -1
  100. package/lib/commands/user-account/bind.js +3 -1
  101. package/lib/commands/user-account/index.js +1 -1
  102. package/lib/commands/workspace/index.js +7 -1
  103. package/lib/config/domain-config.js +6 -1
  104. package/lib/config/schema.js +5 -1
  105. package/lib/constant/app.js +1 -1
  106. package/lib/constant/auth-mode.js +1 -1
  107. package/lib/constant/cli.js +3 -1
  108. package/lib/constant/defaults.js +1 -1
  109. package/lib/constant/distribution.js +1 -1
  110. package/lib/constant/domain.js +2 -1
  111. package/lib/constant/env.js +1 -1
  112. package/lib/constant/output.js +1 -1
  113. package/lib/constant/product.js +2 -1
  114. package/lib/constant/region.js +2 -1
  115. package/lib/constant/risk.js +1 -1
  116. package/lib/constant/url.js +1 -1
  117. package/lib/context.js +11 -1
  118. package/lib/core/api-client.js +38 -1
  119. package/lib/core/db-resolver.js +1 -1
  120. package/lib/core/kb-management-client.js +6 -1
  121. package/lib/core/kb-sdk-errors.js +2 -1
  122. package/lib/core/kb-search-client.js +2 -1
  123. package/lib/core/sdk-client.js +5 -1
  124. package/lib/errors.js +2 -1
  125. package/lib/framework/access-error.js +1 -1
  126. package/lib/framework/build-all-flags.js +1 -1
  127. package/lib/framework/dryrun.js +1 -1
  128. package/lib/framework/flags.js +1 -1
  129. package/lib/framework/help.js +2 -1
  130. package/lib/framework/index.js +1 -1
  131. package/lib/framework/output.js +1 -1
  132. package/lib/framework/preparse.js +3 -1
  133. package/lib/framework/rate-limit.js +2 -1
  134. package/lib/framework/raw-flags.js +2 -1
  135. package/lib/framework/response.js +1 -1
  136. package/lib/framework/runner-confirmation.js +2 -1
  137. package/lib/framework/runner-error.js +2 -1
  138. package/lib/framework/runner.js +9 -1
  139. package/lib/framework/schema-export.js +2 -1
  140. package/lib/framework/service-order.js +1 -1
  141. package/lib/framework/types.js +1 -1
  142. package/lib/generated/build-info.d.ts +4 -4
  143. package/lib/generated/build-info.js +1 -1
  144. package/lib/generated/official-routing.js +2 -1
  145. package/lib/generated/routing-contract.js +1 -1
  146. package/lib/help.js +1 -1
  147. package/lib/runtime/confirmation.js +1 -1
  148. package/lib/runtime/event.js +1 -1
  149. package/lib/runtime/index.js +4 -1
  150. package/lib/runtime/queue.js +1 -1
  151. package/lib/runtime/resolve.js +2 -1
  152. package/lib/runtime/types.js +1 -1
  153. package/lib/services/dataset-import/auto-id-runner.js +9 -1
  154. package/lib/services/dataset-import/excel-reader.js +25 -1
  155. package/lib/services/dataset-import/image-bytes.js +6 -1
  156. package/lib/services/dataset-import/image-ooxml.js +15 -1
  157. package/lib/services/dataset-import/image-runner.js +9 -1
  158. package/lib/services/dataset-import/metadata.js +1 -1
  159. package/lib/services/dataset-import/preview.js +1 -1
  160. package/lib/services/dataset-import/runner.js +13 -1
  161. package/lib/services/dataset-import/types.js +1 -1
  162. package/lib/skills/builtin-skill.js +8 -1
  163. package/lib/skills/install-updated-skill.d.ts +8 -0
  164. package/lib/skills/install-updated-skill.js +3 -0
  165. package/lib/skills/local-skills-installer.d.ts +2 -0
  166. package/lib/skills/local-skills-installer.js +1 -0
  167. package/lib/skills/npx-skills-add.d.ts +2 -2
  168. package/lib/skills/npx-skills-add.js +4 -1
  169. package/lib/skills/runtime-skill-sync/constants.js +1 -1
  170. package/lib/skills/runtime-skill-sync/fs-utils.js +3 -1
  171. package/lib/skills/runtime-skill-sync/hashing.js +1 -1
  172. package/lib/skills/runtime-skill-sync/install-target.js +1 -1
  173. package/lib/skills/runtime-skill-sync/links.js +9 -1
  174. package/lib/skills/runtime-skill-sync/list-local.js +4 -1
  175. package/lib/skills/runtime-skill-sync/local-files.js +5 -1
  176. package/lib/skills/runtime-skill-sync/materialize.js +9 -1
  177. package/lib/skills/runtime-skill-sync/metadata.js +3 -1
  178. package/lib/skills/runtime-skill-sync/paths.js +2 -1
  179. package/lib/skills/runtime-skill-sync/push.js +8 -1
  180. package/lib/skills/runtime-skill-sync/scopes.js +1 -1
  181. package/lib/skills/runtime-skill-sync/types.js +1 -1
  182. package/lib/skills/runtime-skill-sync/zip-codec.js +2 -1
  183. package/lib/skills/runtime-skill-sync/zip-package.js +6 -1
  184. package/lib/skills/runtime-skill-sync.js +1 -1
  185. package/lib/skills/skill-presence.d.ts +1 -34
  186. package/lib/skills/skill-presence.js +2 -1
  187. package/lib/utils/access-key-redaction.js +2 -1
  188. package/lib/utils/apply-jq-filter.js +1 -1
  189. package/lib/utils/cli-version-check.js +2 -1
  190. package/lib/utils/cli-version-policy.js +3 -1
  191. package/lib/utils/logger.js +3 -1
  192. package/lib/utils/lossless-json.js +3 -1
  193. package/lib/utils/params.js +3 -1
  194. package/lib/utils/positive-safe-integer.js +1 -1
  195. package/lib/utils/redaction.js +2 -1
  196. package/lib/utils/runtime-user-id.js +1 -1
  197. package/lib/utils/update-notice.js +3 -1
  198. package/lib/utils/version.js +1 -1
  199. package/lib/utils/write-cli-side-channel.js +1 -1
  200. package/package.json +5 -7
  201. package/skills/lovrabet/SKILL.md +3 -3
  202. package/skills/lovrabet/references/lovrabet-skill-install.md +1 -1
  203. package/skills/lovrabet/references/lovrabet-update.md +6 -4
  204. package/skills/lovrabet-report-generation/SKILL.md +1 -1
  205. package/skills/lovrabet.manifest.json +3 -3
  206. package/lib/postinstall.d.ts +0 -2
  207. package/lib/postinstall.js +0 -1
  208. package/scripts/postinstall.mjs +0 -24
@@ -1 +1,8 @@
1
- const a159_0x1f4135=a159_0x3304;(function(_0x4d1ff8,_0x4e3b47){const _0x4ef296=a159_0x3304,_0x591032=_0x4d1ff8();while(!![]){try{const _0x388054=parseInt(_0x4ef296(0xb4))/0x1*(parseInt(_0x4ef296(0x98))/0x2)+parseInt(_0x4ef296(0xc9))/0x3*(parseInt(_0x4ef296(0x99))/0x4)+-parseInt(_0x4ef296(0xb1))/0x5*(-parseInt(_0x4ef296(0xab))/0x6)+parseInt(_0x4ef296(0xce))/0x7*(parseInt(_0x4ef296(0x92))/0x8)+parseInt(_0x4ef296(0xd1))/0x9+parseInt(_0x4ef296(0xc6))/0xa*(-parseInt(_0x4ef296(0xc5))/0xb)+parseInt(_0x4ef296(0xa5))/0xc*(-parseInt(_0x4ef296(0xd2))/0xd);if(_0x388054===_0x4e3b47)break;else _0x591032['push'](_0x591032['shift']());}catch(_0x15b9fd){_0x591032['push'](_0x591032['shift']());}}}(a159_0x4d14,0x4ed79));import{createHash}from'node:crypto';import{lstatSync,readFileSync,readdirSync}from'node:fs';import{homedir}from'node:os';import{dirname,join,relative,resolve,sep}from'node:path';import{fileURLToPath}from'node:url';import{debuglog}from'node:util';import{runNpxSkillsAddGlobal}from'../skills/npx-skills-add.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';const DEFAULT_PACKAGE_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..','..'),REPAIR_COMMAND='lovrabet\x20cli-skill\x20install',SKILL_NAME=a159_0x1f4135(0x95),debug=debuglog(a159_0x1f4135(0xb3));function frontmatterValue(_0x5b4e31,_0x4ae5af){const _0x226a8e=a159_0x1f4135;return _0x5b4e31[_0x226a8e(0xca)](new RegExp('^'+_0x4ae5af+_0x226a8e(0xb2),'m'))?.[0x1]?.[_0x226a8e(0xa0)]()??'';}function listFiles(_0x134556,_0x3b80d1=_0x134556){return readdirSync(_0x3b80d1,{'withFileTypes':!![]})['flatMap'](_0x54bdc5=>{const _0x535b39=a159_0x3304,_0x162a18=join(_0x3b80d1,_0x54bdc5[_0x535b39(0x93)]),_0x3af3c2=lstatSync(_0x162a18);if(_0x3af3c2[_0x535b39(0xc1)]())throw new Error(_0x535b39(0xaf)+_0x162a18);if(_0x3af3c2[_0x535b39(0x94)]())return listFiles(_0x134556,_0x162a18);if(!_0x3af3c2[_0x535b39(0xcd)]())throw new Error(_0x535b39(0x9a)+_0x162a18);return[relative(_0x134556,_0x162a18)[_0x535b39(0x9b)](sep)['join']('/')];})['sort']((_0x51f47a,_0x33c199)=>_0x51f47a<_0x33c199?-0x1:_0x51f47a>_0x33c199?0x1:0x0);}function digestFiles(_0x5987cc,_0x2e1c57){const _0x6b2d0a=a159_0x1f4135,_0x5c9d50=createHash(_0x6b2d0a(0xb7));for(const _0x3f38c9 of _0x2e1c57){if(_0x3f38c9['startsWith']('/')||_0x3f38c9[_0x6b2d0a(0x9b)]('/')['includes']('..')||_0x3f38c9[_0x6b2d0a(0xa3)]('\x5c'))throw new Error(_0x6b2d0a(0xae)+_0x3f38c9);_0x5c9d50[_0x6b2d0a(0x96)](_0x3f38c9),_0x5c9d50[_0x6b2d0a(0x96)]('\x00'),_0x5c9d50[_0x6b2d0a(0x96)](readFileSync(join(_0x5987cc,..._0x3f38c9[_0x6b2d0a(0x9b)]('/')))),_0x5c9d50[_0x6b2d0a(0x96)]('\x00');}return _0x5c9d50[_0x6b2d0a(0xa6)](_0x6b2d0a(0xa8));}function sameFiles(_0x392aa6,_0x5f5bc8){const _0x4d754f=a159_0x1f4135;return _0x392aa6[_0x4d754f(0xc4)]===_0x5f5bc8['length']&&_0x392aa6[_0x4d754f(0xd4)]((_0x3a2f6a,_0x54c5eb)=>_0x3a2f6a===_0x5f5bc8[_0x54c5eb]);}function a159_0x4d14(){const _0x4c1c6f=['match','home','output','isFile','126TONvXq','present','lovrabet.manifest.json','2082645wfxXog','1627379toCplH','CLI\x20Built-in\x20Skill\x20','every','version_mismatch','schemaVersion','files','partialFailure','84848hRsCJf','name','isDirectory','lovrabet','update','packageRoot','44580UKlXmy','904VNjEoA','Unsupported\x20Skill\x20entry:\x20','split','SOURCE_INVALID','unverifiable','skills','status','trim','Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest','installedPath','includes','state','132znerKs','digest','parse','hex','root','current','720246MNMgen','Installer\x20reported\x20partial\x20target\x20failures:\x0a%s','SKILL.md','Unsafe\x20manifest\x20path:\x20','Symbolic\x20link\x20is\x20not\x20allowed:\x20','missing','20pWLHhx',':\x5cs*(.+)$','lovrabet-skills','11bbpeQy','version','unknown','sha256','log','message','stdio','utf8','packageVersion','VERIFY_FAILED','skipped','count','path','isSymbolicLink','Installed\x20Skill\x20state\x20is\x20','skillVersion','length','858341lTCPXW','10xwRqom','reason','INSTALL_FAILED','8367sDbcLw'];a159_0x4d14=function(){return _0x4c1c6f;};return a159_0x4d14();}function readSource(_0xf1188d){const _0x26852d=a159_0x1f4135,_0x8a3bd=JSON['parse'](readFileSync(join(_0xf1188d,'package.json'),_0x26852d(0xbb))),_0x3c04b7=JSON[_0x26852d(0xa7)](readFileSync(join(_0xf1188d,_0x26852d(0x9e),_0x26852d(0xd0)),_0x26852d(0xbb))),_0x3692f6=join(_0xf1188d,_0x26852d(0x9e),SKILL_NAME),_0x208c83=frontmatterValue(readFileSync(join(_0x3692f6,_0x26852d(0xad)),_0x26852d(0xbb)),_0x26852d(0xb5)),_0x2300a8=listFiles(_0x3692f6);if(_0x3c04b7[_0x26852d(0x8f)]!==0x1||_0x3c04b7[_0x26852d(0x93)]!==SKILL_NAME||!_0x8a3bd[_0x26852d(0xb5)]||_0x3c04b7['packageVersion']!==_0x8a3bd[_0x26852d(0xb5)]||_0x3c04b7[_0x26852d(0xc3)]!==_0x8a3bd[_0x26852d(0xb5)]||_0x208c83!==_0x8a3bd[_0x26852d(0xb5)]||!sameFiles(_0x2300a8,_0x3c04b7[_0x26852d(0x90)])||digestFiles(_0x3692f6,_0x2300a8)!==_0x3c04b7[_0x26852d(0xa6)])throw new Error(_0x26852d(0xa1));return{'packageVersion':_0x8a3bd['version'],'skillVersion':_0x208c83,'root':_0x3692f6,'manifest':_0x3c04b7};}function installedSkillPath(_0xd5266f){const _0x44ff48=a159_0x1f4135,_0x4ef0a7=resolveInstalledSkill(SKILL_NAME,{'home':_0xd5266f});if(_0x4ef0a7[_0x44ff48(0xa4)]===_0x44ff48(0xcf))return{'state':_0x44ff48(0xcf),'path':dirname(_0x4ef0a7[_0x44ff48(0xc0)])};if(_0x4ef0a7[_0x44ff48(0xa4)]==='absent')return{'state':_0x44ff48(0xb0)};return{'state':_0x44ff48(0x9d),'reason':_0x4ef0a7[_0x44ff48(0xc7)]};}export function inspectInstalledBuiltinSkillVersion(_0x4bb58e,_0x3a3c4f={}){const _0x127afe=a159_0x1f4135,_0xeb7bbb=installedSkillPath(_0x3a3c4f[_0x127afe(0xcb)]??homedir());if(_0xeb7bbb[_0x127afe(0xa4)]===_0x127afe(0xb0))return{'state':_0x127afe(0xb0),'expectedVersion':_0x4bb58e,'repairCommand':REPAIR_COMMAND};if(_0xeb7bbb[_0x127afe(0xa4)]===_0x127afe(0x9d))return{'state':'unverifiable','expectedVersion':_0x4bb58e,'reason':_0xeb7bbb[_0x127afe(0xc7)],'repairCommand':REPAIR_COMMAND};try{const _0x41d6ee=frontmatterValue(readFileSync(join(_0xeb7bbb[_0x127afe(0xc0)],_0x127afe(0xad)),_0x127afe(0xbb)),_0x127afe(0xb5));return{'state':_0x41d6ee===_0x4bb58e?'current':_0x127afe(0x8e),'expectedVersion':_0x4bb58e,'skillVersion':_0x41d6ee,'installedPath':_0xeb7bbb[_0x127afe(0xc0)],'repairCommand':REPAIR_COMMAND};}catch(_0x1f2dc0){return{'state':_0x127afe(0x9d),'expectedVersion':_0x4bb58e,'installedPath':_0xeb7bbb[_0x127afe(0xc0)],'reason':_0x1f2dc0 instanceof Error?_0x1f2dc0[_0x127afe(0xb9)]:String(_0x1f2dc0),'repairCommand':REPAIR_COMMAND};}}function a159_0x3304(_0x250ea9,_0x1c0cf2){_0x250ea9=_0x250ea9-0x8e;const _0x4d1472=a159_0x4d14();let _0x330478=_0x4d1472[_0x250ea9];return _0x330478;}export function inspectBuiltinSkill(_0x44a4e0={}){const _0x340e9d=a159_0x1f4135,_0x5dd452=_0x44a4e0[_0x340e9d(0x97)]??DEFAULT_PACKAGE_ROOT;let _0x2d4b41;try{_0x2d4b41=readSource(_0x5dd452);}catch(_0x2c904c){return{'state':_0x340e9d(0x9d),'packageVersion':_0x340e9d(0xb6),'reason':_0x2c904c instanceof Error?_0x2c904c[_0x340e9d(0xb9)]:String(_0x2c904c),'repairCommand':REPAIR_COMMAND};}const _0x2053e5=installedSkillPath(_0x44a4e0[_0x340e9d(0xcb)]??homedir());if(_0x2053e5[_0x340e9d(0xa4)]===_0x340e9d(0xb0))return{'state':_0x340e9d(0xb0),'packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'repairCommand':REPAIR_COMMAND};if(_0x2053e5['state']==='unverifiable')return{'state':'unverifiable','packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'reason':_0x2053e5[_0x340e9d(0xc7)],'repairCommand':REPAIR_COMMAND};try{const _0x367808=frontmatterValue(readFileSync(join(_0x2053e5[_0x340e9d(0xc0)],_0x340e9d(0xad)),_0x340e9d(0xbb)),_0x340e9d(0xb5));if(_0x367808!==_0x2d4b41[_0x340e9d(0xc3)])return{'state':_0x340e9d(0x8e),'packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'skillVersion':_0x367808,'installedPath':_0x2053e5[_0x340e9d(0xc0)],'repairCommand':REPAIR_COMMAND};const _0x4c2efa=listFiles(_0x2053e5['path']),_0x69e786=digestFiles(_0x2053e5[_0x340e9d(0xc0)],_0x4c2efa);return{'state':sameFiles(_0x4c2efa,_0x2d4b41['manifest'][_0x340e9d(0x90)])&&_0x69e786===_0x2d4b41['manifest']['digest']?_0x340e9d(0xaa):'content_mismatch','packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'skillVersion':_0x367808,'installedPath':_0x2053e5['path'],'digest':_0x69e786,'repairCommand':REPAIR_COMMAND};}catch(_0x7403a0){return{'state':_0x340e9d(0x9d),'packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'installedPath':_0x2053e5[_0x340e9d(0xc0)],'reason':_0x7403a0 instanceof Error?_0x7403a0[_0x340e9d(0xb9)]:String(_0x7403a0),'repairCommand':REPAIR_COMMAND};}}function failure(_0x11c83f,_0x20f1d9,_0x393167,_0x292351){const _0x2ef86e=a159_0x1f4135;return{'ok':![],'code':_0x11c83f,'packageVersion':_0x20f1d9['packageVersion'],'skillVersion':_0x20f1d9[_0x2ef86e(0xc3)],'installedPath':_0x292351,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0x393167 instanceof Error?_0x393167[_0x2ef86e(0xb9)]:String(_0x393167)};}export function installBuiltinSkill(_0x8f884f={}){const _0x59e007=a159_0x1f4135,_0x13d065=_0x8f884f[_0x59e007(0x97)]??DEFAULT_PACKAGE_ROOT,_0x5020ac=_0x8f884f[_0x59e007(0xcb)]??homedir();let _0x152e9d;try{_0x152e9d=readSource(_0x13d065);}catch(_0x4903bd){return failure(_0x59e007(0x9c),{'packageVersion':_0x59e007(0xb6),'skillVersion':'unknown'},_0x4903bd);}const _0x4817a4=inspectBuiltinSkill({'packageRoot':_0x13d065,'home':_0x5020ac}),_0x551aee=runNpxSkillsAddGlobal(_0x13d065,_0x152e9d[_0x59e007(0xa9)],{'stdio':_0x8f884f[_0x59e007(0xba)]??'pipe','expectedSkillName':SKILL_NAME,'presence':{'home':_0x5020ac}});if(_0x551aee[_0x59e007(0xbe)])return{'ok':!![],'packageVersion':_0x152e9d['packageVersion'],'skillVersion':_0x152e9d[_0x59e007(0xc3)],'installedPath':_0x4817a4[_0x59e007(0xa2)],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0x551aee['ok'])return failure(_0x59e007(0xc8),_0x152e9d,_0x551aee['error']??'skills@latest\x20exited\x20'+_0x551aee[_0x59e007(0x9f)]);const _0x478784=inspectBuiltinSkill({'packageRoot':_0x13d065,'home':_0x5020ac});if(_0x478784[_0x59e007(0xa4)]!==_0x59e007(0xaa)){const _0x5afbf5=_0x478784[_0x59e007(0xc7)]??_0x59e007(0xc2)+_0x478784['state'];return failure(_0x59e007(0xbd),_0x152e9d,_0x551aee[_0x59e007(0x91)]?_0x5afbf5+'\x0a'+_0x551aee['partialFailure'][_0x59e007(0xcc)]:_0x5afbf5,_0x478784[_0x59e007(0xa2)]);}return _0x551aee['partialFailure']&&(debug(_0x59e007(0xac),_0x551aee[_0x59e007(0x91)]['output']),console[_0x59e007(0xb8)](_0x59e007(0xd3)+_0x152e9d[_0x59e007(0xc3)]+'\x20verified;\x20'+_0x551aee[_0x59e007(0x91)][_0x59e007(0xbf)]+'\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.')),{'ok':!![],'packageVersion':_0x152e9d[_0x59e007(0xbc)],'skillVersion':_0x152e9d[_0x59e007(0xc3)],'installedPath':_0x478784[_0x59e007(0xa2)],'changed':_0x4817a4[_0x59e007(0xa4)]!==_0x59e007(0xaa),'repairCommand':REPAIR_COMMAND};}
1
+ import{createHash}from"node:crypto";import{lstatSync,readFileSync,readdirSync}from"node:fs";import{homedir}from"node:os";import{dirname,join,relative,resolve,sep}from"node:path";import{fileURLToPath}from"node:url";import{debuglog,stripVTControlCharacters}from"node:util";import{runNpxSkillsAddGlobal}from"../skills/npx-skills-add.js";import{resolveInstalledSkill}from"../skills/skill-presence.js";const DEFAULT_PACKAGE_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),"..","..");const REPAIR_COMMAND="lovrabet cli-skill install";const SKILL_NAME="lovrabet";const debug=debuglog("lovrabet-skills");function frontmatterValue(content,key){return content.match(new RegExp(`^${key}:\\s*(.+)$`,"m"))?.[1]?.trim()??""}function listFiles(root,current=root){return readdirSync(current,{withFileTypes:true}).flatMap(entry=>{const absolute=join(current,entry.name);const stat=lstatSync(absolute);if(stat.isSymbolicLink())throw new Error(`Symbolic link is not allowed: ${absolute}`)
2
+ ;if(stat.isDirectory())return listFiles(root,absolute);if(!stat.isFile())throw new Error(`Unsupported Skill entry: ${absolute}`);return[relative(root,absolute).split(sep).join("/")]}).sort((left,right)=>left<right?-1:left>right?1:0)}function digestFiles(root,files){const aggregate=createHash("sha256");for(const file of files){if(file.startsWith("/")||file.split("/").includes("..")||file.includes("\\")){throw new Error(`Unsafe manifest path: ${file}`)}aggregate.update(file);aggregate.update("\0");aggregate.update(readFileSync(join(root,...file.split("/"))));aggregate.update("\0")}return aggregate.digest("hex")}function sameFiles(actual,expected){return actual.length===expected.length&&actual.every((file,index)=>file===expected[index])}function readSource(packageRoot){const pkg=JSON.parse(readFileSync(join(packageRoot,"package.json"),"utf8"));const manifest=JSON.parse(readFileSync(join(packageRoot,"skills","lovrabet.manifest.json"),"utf8"))
3
+ ;const root=join(packageRoot,"skills",SKILL_NAME);const skillVersion=frontmatterValue(readFileSync(join(root,"SKILL.md"),"utf8"),"version");const files=listFiles(root);if(manifest.schemaVersion!==1||manifest.name!==SKILL_NAME||!pkg.version||manifest.packageVersion!==pkg.version||manifest.skillVersion!==pkg.version||skillVersion!==pkg.version||!sameFiles(files,manifest.files)||digestFiles(root,files)!==manifest.digest){throw new Error("Built-in Skill source does not match its package manifest")}return{packageVersion:pkg.version,skillVersion:skillVersion,root:root,manifest:manifest}}function installedSkillPath(home){const presence=resolveInstalledSkill(SKILL_NAME,{home:home});if(presence.state==="present")return{state:"present",path:dirname(presence.path)};if(presence.state==="absent")return{state:"missing"};return{state:"unverifiable",reason:presence.reason}}export function inspectInstalledBuiltinSkillVersion(expectedVersion,options={}){
4
+ const installed=installedSkillPath(options.home??homedir());if(installed.state==="missing"){return{state:"missing",expectedVersion:expectedVersion,repairCommand:REPAIR_COMMAND}}if(installed.state==="unverifiable"){return{state:"unverifiable",expectedVersion:expectedVersion,reason:installed.reason,repairCommand:REPAIR_COMMAND}}try{const skillVersion=frontmatterValue(readFileSync(join(installed.path,"SKILL.md"),"utf8"),"version");return{state:skillVersion===expectedVersion?"current":"version_mismatch",expectedVersion:expectedVersion,skillVersion:skillVersion,installedPath:installed.path,repairCommand:REPAIR_COMMAND}}catch(error){return{state:"unverifiable",expectedVersion:expectedVersion,installedPath:installed.path,reason:error instanceof Error?error.message:String(error),repairCommand:REPAIR_COMMAND}}}export function inspectBuiltinSkill(options={}){const packageRoot=options.packageRoot??DEFAULT_PACKAGE_ROOT;let source;try{source=readSource(packageRoot)}catch(error){return{
5
+ state:"unverifiable",packageVersion:"unknown",reason:error instanceof Error?error.message:String(error),repairCommand:REPAIR_COMMAND}}const installed=installedSkillPath(options.home??homedir());if(installed.state==="missing"){return{state:"missing",packageVersion:source.packageVersion,repairCommand:REPAIR_COMMAND}}if(installed.state==="unverifiable"){return{state:"unverifiable",packageVersion:source.packageVersion,reason:installed.reason,repairCommand:REPAIR_COMMAND}}try{const skillVersion=frontmatterValue(readFileSync(join(installed.path,"SKILL.md"),"utf8"),"version");if(skillVersion!==source.skillVersion){return{state:"version_mismatch",packageVersion:source.packageVersion,skillVersion:skillVersion,installedPath:installed.path,repairCommand:REPAIR_COMMAND}}const files=listFiles(installed.path);const digest=digestFiles(installed.path,files);return{state:sameFiles(files,source.manifest.files)&&digest===source.manifest.digest?"current":"content_mismatch",
6
+ packageVersion:source.packageVersion,skillVersion:skillVersion,installedPath:installed.path,digest:digest,repairCommand:REPAIR_COMMAND}}catch(error){return{state:"unverifiable",packageVersion:source.packageVersion,installedPath:installed.path,reason:error instanceof Error?error.message:String(error),repairCommand:REPAIR_COMMAND}}}function failure(code,source,error,installedPath){return{ok:false,code:code,packageVersion:source.packageVersion,skillVersion:source.skillVersion,installedPath:installedPath,changed:false,repairCommand:REPAIR_COMMAND,error:error instanceof Error?error.message:String(error)}}function actionableTargetFailureCount(count,output){const details=[...stripVTControlCharacters(output).matchAll(/^[ \t│]*✗ [^\r\n]+ → ([^:\r\n]+): ([^\r\n]+)$/gm)];if(details.length!==count)return count;return details.filter(([,agent,reason])=>reason.trim()!==`${agent.trim()} does not support global skill installation`).length}export function installBuiltinSkill(options={}){
7
+ const packageRoot=options.packageRoot??DEFAULT_PACKAGE_ROOT;const home=options.home??homedir();let source;try{source=readSource(packageRoot)}catch(error){return failure("SOURCE_INVALID",{packageVersion:"unknown",skillVersion:"unknown"},error)}const before=inspectBuiltinSkill({packageRoot:packageRoot,home:home});const result=runNpxSkillsAddGlobal(packageRoot,source.root,{stdio:options.stdio??"pipe",expectedSkillName:SKILL_NAME,presence:{home:home}});if(result.skipped){return{ok:true,packageVersion:source.packageVersion,skillVersion:source.skillVersion,installedPath:before.installedPath,changed:false,repairCommand:REPAIR_COMMAND}}if(!result.ok){return failure("INSTALL_FAILED",source,result.error??`local skills installer exited ${result.status}`)}const after=inspectBuiltinSkill({packageRoot:packageRoot,home:home});if(after.state!=="current"){const reason=after.reason??`Installed Skill state is ${after.state}`
8
+ ;return failure("VERIFY_FAILED",source,result.partialFailure?`${reason}\n${result.partialFailure.output}`:reason,after.installedPath)}if(result.partialFailure){debug("Installer reported partial target failures:\n%s",result.partialFailure.output);const count=actionableTargetFailureCount(result.partialFailure.count,result.partialFailure.output);if(count>0){console.log(`CLI Built-in Skill ${source.skillVersion} verified; ${count} automatically selected installation target(s) could not be installed.`)}}return{ok:true,packageVersion:source.packageVersion,skillVersion:source.skillVersion,installedPath:after.installedPath,changed:before.state!=="current",repairCommand:REPAIR_COMMAND}}
@@ -0,0 +1,8 @@
1
+ export interface UpdatedSkillOptions {
2
+ version: string;
3
+ packageManager: "npm" | "bun";
4
+ packageManagerCommand: string;
5
+ /** Only set when installation used an explicit npm prefix. */
6
+ prefix?: string;
7
+ }
8
+ export declare function installUpdatedBuiltinSkill(options: UpdatedSkillOptions): void;
@@ -0,0 +1,3 @@
1
+ import{readFileSync,realpathSync}from"node:fs";import{dirname,isAbsolute,join,relative,resolve}from"node:path";import{execaSync}from"execa";function run(command,args){const result=execaSync(command,args,{stdio:"pipe",shell:false,reject:false,env:{...process.env,DO_NOT_TRACK:"1",LOVRABET_NO_UPDATE_NOTICE:"1"},extendEnv:false});if(result.exitCode!==0){throw new Error(String(result.stderr||result.stdout||result.shortMessage||"Command failed").trim())}return String(result.stdout).trim()}export function installUpdatedBuiltinSkill(options){let packageRoot;if(options.packageManager==="bun"){const binDirectory=run(options.packageManagerCommand,["pm","bin","-g"]);if(!isAbsolute(binDirectory))throw new Error("Unable to resolve Bun global bin directory");packageRoot=dirname(dirname(realpathSync(join(binDirectory,"lovrabet"))))}else{const modules=run(options.packageManagerCommand,["root","-g",...options.prefix?["--prefix",options.prefix]:[]])
2
+ ;if(!isAbsolute(modules))throw new Error("Unable to resolve npm global package directory");packageRoot=join(modules,"@lovrabet/lovrabet-cli")}const pkg=JSON.parse(readFileSync(join(packageRoot,"package.json"),"utf8"));if(pkg.name!=="@lovrabet/lovrabet-cli"||pkg.version!==options.version){throw new Error(`Installed lovrabet package/version mismatch: expected @lovrabet/lovrabet-cli@${options.version}, found ${pkg.name}@${pkg.version}`)}const bin=pkg.bin?.lovrabet;if(!bin)throw new Error("Installed lovrabet has no executable entry");const entry=resolve(packageRoot,bin);if(relative(packageRoot,entry).startsWith("..")||isAbsolute(relative(packageRoot,entry))){throw new Error("Installed lovrabet executable is outside its package")}const versionOutput=run(process.execPath,[entry,"--version"]);if(versionOutput.split(/\s+/)[0]!==options.version){throw new Error(`Installed lovrabet executable version mismatch: expected ${options.version}, found ${versionOutput}`)}
3
+ run(process.execPath,[entry,"cli-skill","install"])}
@@ -0,0 +1,2 @@
1
+ /** Resolve the official installer from this CLI, never from the caller's cwd or PATH. */
2
+ export declare function resolveLocalSkillsInstaller(): string;
@@ -0,0 +1 @@
1
+ import{createRequire}from"node:module";export function resolveLocalSkillsInstaller(){try{const require=createRequire(import.meta.url);const expected=require("../../package.json").dependencies?.skills;const actual=require("skills/package.json").version;if(!expected||!/^\d+\.\d+\.\d+$/.test(expected)||actual!==expected){throw new Error(`Local skills installer version mismatch: expected ${expected??"an exact dependency"}, found ${actual??"unknown"}`)}return require.resolve("skills/bin/cli.mjs")}catch(error){const reason=error instanceof Error?error.message:String(error);throw new Error(`Local skills installer unavailable: ${reason}. Reinstall this CLI package.`)}}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Official `skills` CLI integration used by `lovrabet cli-skill install`.
3
3
  *
4
- * The runtime CLI currently only needs the `npx -y skills@latest add <source> -g -y`
4
+ * The runtime CLI only needs the package-local `skills add <source> -g -y`
5
5
  * flow, so this module intentionally keeps the surface area narrow.
6
6
  */
7
7
  import { type ResolveSkillPresenceOptions } from "../skills/skill-presence.js";
@@ -61,7 +61,7 @@ export interface RunNpxSkillsAddOptions {
61
61
  * output-derived classification is the installer's `Failed to install N` summary;
62
62
  * all other installer text is attached to `error` as diagnostics.
63
63
  */
64
- export type NpxSkillsErrorCode = "NPX_NOT_FOUND" | "PERMISSION_DENIED" | "SPAWN_FAILED" | "CHILD_TERMINATED" | "CHILD_EXIT_NONZERO" | "INSTALL_PARTIAL" | "SKILL_NOT_INSTALLED";
64
+ export type NpxSkillsErrorCode = "NODE_NOT_FOUND" | "INSTALLER_UNAVAILABLE" | "PERMISSION_DENIED" | "SPAWN_FAILED" | "CHILD_TERMINATED" | "CHILD_EXIT_NONZERO" | "INSTALL_PARTIAL" | "SKILL_NOT_INSTALLED";
65
65
  /**
66
66
  * Returns whether the external `skills` invocation should be skipped.
67
67
  *
@@ -1 +1,4 @@
1
- const a160_0x2b3079=a160_0x3842;(function(_0x2e1bc2,_0x3d7e99){const _0x4e9ee5=a160_0x3842,_0x19175f=_0x2e1bc2();while(!![]){try{const _0x5a6f0a=-parseInt(_0x4e9ee5(0xc7))/0x1*(parseInt(_0x4e9ee5(0xe9))/0x2)+-parseInt(_0x4e9ee5(0xbf))/0x3+-parseInt(_0x4e9ee5(0xb8))/0x4*(parseInt(_0x4e9ee5(0xc9))/0x5)+-parseInt(_0x4e9ee5(0xc2))/0x6+parseInt(_0x4e9ee5(0xe0))/0x7*(parseInt(_0x4e9ee5(0xe4))/0x8)+parseInt(_0x4e9ee5(0xce))/0x9*(parseInt(_0x4e9ee5(0xe2))/0xa)+parseInt(_0x4e9ee5(0xc5))/0xb;if(_0x5a6f0a===_0x3d7e99)break;else _0x19175f['push'](_0x19175f['shift']());}catch(_0x394705){_0x19175f['push'](_0x19175f['shift']());}}}(a160_0xb100,0x25211));import{execaSync}from'execa';function a160_0x3842(_0x53cc53,_0x19fbb0){_0x53cc53=_0x53cc53-0xb7;const _0xb1008e=a160_0xb100();let _0x384238=_0xb1008e[_0x53cc53];return _0x384238;}import{LOVRABET_SKILL_SOURCE as a160_0x4fee5b}from'../constant/distribution.js';import{PRODUCT_CONFIG,productEnvName}from'../constant/product.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';export const LOVRABET_SKILL_SOURCE=a160_0x4fee5b;export const LOVRABET_SKILL_GIT_SOURCE=PRODUCT_CONFIG[a160_0x2b3079(0xed)];function a160_0xb100(){const _0x1fddd0=['code','absent','stdout','\x22\x20install\x20state:\x20','14DgOTnX','log','40uDEecY','present','687168nCFtIa','failed','globalSkillName','pipe','\x22\x20not\x20found\x20after\x20install\x20(checked\x20','93026ueAOJz','shortMessage','!\x20Could\x20not\x20verify\x20\x22','stderr','internalSkillSource','exit\x20','NPX_NOT_FOUND','159884eoJcRn','npx\x20terminated\x20by\x20signal\x20','message','partialFailure','SPAWN_FAILED','npx\x20failed\x20to\x20start','state','200598oEjkgL','unknown','SKILL_NOT_INSTALLED','1343490ZlZtvc','join','exitCode','5224054kIGgyk','trim','5SWnzxv','Installer\x20reported\x20','25GyXJtj','checked','skipNpxSkillsEnvSuffix','ENOENT','EACCES','514296sQsIWT','unverifiable','INSTALL_PARTIAL','PERMISSION_DENIED','NPM_CONFIG_GLOBAL','CHILD_EXIT_NONZERO','npm_config_global','warn','Skill\x20\x22','CHILD_TERMINATED','npx','signal','filter','match'];a160_0xb100=function(){return _0x1fddd0;};return a160_0xb100();}export const LOVRABET_GLOBAL_SKILL_NAME=PRODUCT_CONFIG[a160_0x2b3079(0xe6)];export function resolveGlobalSkillName(_0x35a474){const _0x20c4b8=a160_0x2b3079;switch(_0x35a474[_0x20c4b8(0xc6)]()){case LOVRABET_SKILL_SOURCE:case LOVRABET_SKILL_GIT_SOURCE:return LOVRABET_GLOBAL_SKILL_NAME;default:return undefined;}}export const LOVRABET_SKIP_NPX_SKILLS_ENV=productEnvName(PRODUCT_CONFIG[a160_0x2b3079(0xcb)]);const CHILD_OUTPUT_MAX_BUFFER=0x10*0x400*0x400;function failure(_0x4e04bb,_0x27447a,_0x3a1129){return{'ok':![],'status':_0x27447a,'code':_0x4e04bb,'error':'['+_0x4e04bb+']\x20'+_0x3a1129};}export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==='1';}export function runNpxSkillsAddGlobal(_0x37ed25,_0x40756b=LOVRABET_SKILL_SOURCE,_0xb9d250){const _0x154a5c=a160_0x2b3079;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x32c774=['-y','skills@latest','add',_0x40756b,'-g','-y'],_0x25bf66=['npx',..._0x32c774][_0x154a5c(0xc3)]('\x20');console[_0x154a5c(0xe1)]('*\x20'+_0x25bf66);const _0x3aae8e={...process.env};delete _0x3aae8e[_0x154a5c(0xd4)],delete _0x3aae8e[_0x154a5c(0xd2)];const _0x1b97df=execaSync(_0x154a5c(0xd8),_0x32c774,{'cwd':_0x37ed25,'stdio':_0x154a5c(0xe7),'env':_0x3aae8e,'extendEnv':![],'shell':![],'reject':![],'maxBuffer':CHILD_OUTPUT_MAX_BUFFER}),_0x4d8973=[_0x1b97df['stdout']?String(_0x1b97df[_0x154a5c(0xde)]):'',_0x1b97df['stderr']?String(_0x1b97df[_0x154a5c(0xec)]):''][_0x154a5c(0xda)](Boolean)[_0x154a5c(0xc3)]('\x0a')[_0x154a5c(0xc6)](),_0x4addee=_0x1b97df[_0x154a5c(0xc4)]??null,_0x5c1b67=_0x2e414a=>{const _0x3472a3=_0x154a5c;return _0xb9d250?.['stdio']!==_0x3472a3(0xe7)&&!_0x2e414a[_0x3472a3(0xbb)]&&_0x4d8973&&console[_0x3472a3(0xe1)](_0x4d8973),_0x2e414a;};if(_0x1b97df[_0x154a5c(0xdc)]){const _0x5c4d9a=_0x1b97df[_0x154a5c(0xdc)]===_0x154a5c(0xcc)?_0x154a5c(0xb7):_0x1b97df[_0x154a5c(0xdc)]==='EPERM'||_0x1b97df[_0x154a5c(0xdc)]===_0x154a5c(0xcd)?_0x154a5c(0xd1):_0x154a5c(0xbc);return _0x5c1b67(failure(_0x5c4d9a,_0x4addee,_0x1b97df[_0x154a5c(0xea)]??_0x1b97df[_0x154a5c(0xba)]??_0x1b97df['code']));}if(_0x1b97df[_0x154a5c(0xd9)])return _0x5c1b67(failure(_0x154a5c(0xd7),_0x4addee,_0x154a5c(0xb9)+_0x1b97df['signal']));if(_0x1b97df[_0x154a5c(0xe5)]&&_0x4addee===null)return _0x5c1b67(failure(_0x154a5c(0xbc),_0x4addee,_0x1b97df['shortMessage']??_0x1b97df[_0x154a5c(0xba)]??_0x154a5c(0xbd)));if(_0x4addee!==0x0)return _0x5c1b67(failure(_0x154a5c(0xd3),_0x4addee,_0x4d8973||_0x1b97df[_0x154a5c(0xea)]||_0x154a5c(0xee)+(_0x4addee??_0x154a5c(0xc0))));const _0x16b661=_0xb9d250?.['expectedSkillName']??resolveGlobalSkillName(_0x40756b),_0x1eeda5=_0x16b661?resolveInstalledSkill(_0x16b661,_0xb9d250?.['presence']):undefined,_0xb5d1b1=_0x4d8973[_0x154a5c(0xdb)](/Failed to install\s+(\d+)/i);if(_0xb5d1b1&&Number(_0xb5d1b1[0x1])>0x0){const _0x1aa0a7=_0x154a5c(0xc8)+_0xb5d1b1[0x1]+'\x20failed\x20target(s)'+(_0x4d8973?':\x0a'+_0x4d8973:'');if(_0x1eeda5?.[_0x154a5c(0xbe)]===_0x154a5c(0xe3))return{'ok':!![],'status':0x0,'partialFailure':{'count':Number(_0xb5d1b1[0x1]),'output':_0x4d8973}};return _0x5c1b67(failure(_0x154a5c(0xd0),0x0,_0x1aa0a7));}if(_0x16b661&&_0x1eeda5){if(_0x1eeda5[_0x154a5c(0xbe)]===_0x154a5c(0xdd))return _0x5c1b67(failure(_0x154a5c(0xc1),0x0,_0x154a5c(0xd6)+_0x16b661+_0x154a5c(0xe8)+_0x1eeda5[_0x154a5c(0xca)]['join'](',\x20')+')'));_0x1eeda5['state']===_0x154a5c(0xcf)&&console[_0x154a5c(0xd5)](_0x154a5c(0xeb)+_0x16b661+_0x154a5c(0xdf)+_0x1eeda5['reason']);}return _0x5c1b67({'ok':!![],'status':0x0});}
1
+ import{execaSync}from"execa";import{resolveLocalSkillsInstaller}from"../skills/local-skills-installer.js";import{LOVRABET_SKILL_SOURCE as OFFICIAL_LOVRABET_SKILL_SOURCE}from"../constant/distribution.js";import{PRODUCT_CONFIG,productEnvName}from"../constant/product.js";import{resolveInstalledSkill}from"../skills/skill-presence.js";export const LOVRABET_SKILL_SOURCE=OFFICIAL_LOVRABET_SKILL_SOURCE;export const LOVRABET_SKILL_GIT_SOURCE=PRODUCT_CONFIG.internalSkillSource;export const LOVRABET_GLOBAL_SKILL_NAME=PRODUCT_CONFIG.globalSkillName;export function resolveGlobalSkillName(source){switch(source.trim()){case LOVRABET_SKILL_SOURCE:case LOVRABET_SKILL_GIT_SOURCE:return LOVRABET_GLOBAL_SKILL_NAME;default:return undefined}}export const LOVRABET_SKIP_NPX_SKILLS_ENV=productEnvName(PRODUCT_CONFIG.skipNpxSkillsEnvSuffix);const CHILD_OUTPUT_MAX_BUFFER=16*1024*1024;function failure(code,status,detail){return{ok:false,status:status,code:code,error:`[${code}] ${detail}`}}
2
+ export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==="1"}export function runNpxSkillsAddGlobal(projectRoot,source=LOVRABET_SKILL_SOURCE,options){if(shouldSkipNpxSkillsAdd()){return{ok:true,status:0,skipped:true}}let installer;try{installer=resolveLocalSkillsInstaller()}catch(error){return failure("INSTALLER_UNAVAILABLE",null,error instanceof Error?error.message:String(error))}const args=[installer,"add",source,"-g","-y"];console.log(`* ${["skills",...args.slice(1)].join(" ")}`);const env={...process.env,DISABLE_TELEMETRY:"1"};delete env.npm_config_global;delete env.NPM_CONFIG_GLOBAL;const result=execaSync(process.execPath,args,{cwd:projectRoot,stdio:"pipe",env:env,extendEnv:false,shell:false,reject:false,maxBuffer:CHILD_OUTPUT_MAX_BUFFER});const output=[result.stdout?String(result.stdout):"",result.stderr?String(result.stderr):""].filter(Boolean).join("\n").trim();const status=result.exitCode??null;const finalize=normalized=>{
3
+ if(options?.stdio!=="pipe"&&!normalized.partialFailure&&output){console.log(output)}return normalized};if(result.code){const code=result.code==="ENOENT"?"NODE_NOT_FOUND":result.code==="EPERM"||result.code==="EACCES"?"PERMISSION_DENIED":"SPAWN_FAILED";return finalize(failure(code,status,result.shortMessage??result.message??result.code))}if(result.signal){return finalize(failure("CHILD_TERMINATED",status,`Skills installer terminated by signal ${result.signal}`))}if(result.failed&&status===null){return finalize(failure("SPAWN_FAILED",status,result.shortMessage??result.message??"Skills installer failed to start"))}if(status!==0){return finalize(failure("CHILD_EXIT_NONZERO",status,output||result.shortMessage||`exit ${status??"unknown"}`))}const skillName=options?.expectedSkillName??resolveGlobalSkillName(source);const presence=skillName?resolveInstalledSkill(skillName,options?.presence):undefined;const failedCount=output.match(/Failed to install\s+(\d+)/i)
4
+ ;if(failedCount&&Number(failedCount[1])>0){const detail=`Installer reported ${failedCount[1]} failed target(s)${output?`:\n${output}`:""}`;if(presence?.state==="present"){return{ok:true,status:0,partialFailure:{count:Number(failedCount[1]),output:output}}}return finalize(failure("INSTALL_PARTIAL",0,detail))}if(skillName&&presence){if(presence.state==="absent"){return finalize(failure("SKILL_NOT_INSTALLED",0,`Skill "${skillName}" not listed as installed by Skills CLI`))}if(presence.state==="unverifiable"){console.warn(`! Could not verify "${skillName}" install state: ${presence.reason}`)}}return finalize({ok:true,status:0})}
@@ -1 +1 @@
1
- function a161_0x1b7c(_0x502c21,_0x55ed2b){_0x502c21=_0x502c21-0x15a;const _0x3fd9b5=a161_0x3fd9();let _0x1b7cec=_0x3fd9b5[_0x502c21];return _0x1b7cec;}const a161_0x5167d9=a161_0x1b7c;(function(_0x41253e,_0x41bdee){const _0xa9561b=a161_0x1b7c,_0x256be0=_0x41253e();while(!![]){try{const _0x4aec41=-parseInt(_0xa9561b(0x166))/0x1+-parseInt(_0xa9561b(0x161))/0x2*(parseInt(_0xa9561b(0x16b))/0x3)+-parseInt(_0xa9561b(0x15a))/0x4*(parseInt(_0xa9561b(0x16d))/0x5)+parseInt(_0xa9561b(0x167))/0x6+-parseInt(_0xa9561b(0x16a))/0x7*(parseInt(_0xa9561b(0x168))/0x8)+parseInt(_0xa9561b(0x163))/0x9*(parseInt(_0xa9561b(0x15f))/0xa)+parseInt(_0xa9561b(0x16c))/0xb;if(_0x4aec41===_0x41bdee)break;else _0x256be0['push'](_0x256be0['shift']());}catch(_0x2c59cb){_0x256be0['push'](_0x256be0['shift']());}}}(a161_0x3fd9,0xc4bc5));function a161_0x3fd9(){const _0x39bd1a=['node_modules','lovrabet.skill.json','dist','90YIkkuW','.next','1548982GvOWeM','SKILL.md','953658kQHeUj','.DS_Store','.cache','493043YoHQkB','6240390aGZJhS','1817992jSsHvU','build','35CXjcKK','3kIhGPZ','30564512OjWFzo','7813535lMfpOt','4ioIBCg','.git'];a161_0x3fd9=function(){return _0x39bd1a;};return a161_0x3fd9();}export const METADATA_FILE=a161_0x5167d9(0x15d);export const SKILL_FILE=a161_0x5167d9(0x162);export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,a161_0x5167d9(0x164)]);export const IGNORED_DIR_NAMES=new Set([a161_0x5167d9(0x15b),'.hg','.svn',a161_0x5167d9(0x15c),a161_0x5167d9(0x160),a161_0x5167d9(0x15e),a161_0x5167d9(0x169),'coverage','.turbo',a161_0x5167d9(0x165)]);
1
+ export const METADATA_FILE="lovrabet.skill.json";export const SKILL_FILE="SKILL.md";export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,".DS_Store"]);export const IGNORED_DIR_NAMES=new Set([".git",".hg",".svn","node_modules",".next","dist","build","coverage",".turbo",".cache"]);
@@ -1 +1,3 @@
1
- (function(_0x4688c6,_0x29401b){const _0x658930=a162_0x20bf,_0x4e4745=_0x4688c6();while(!![]){try{const _0x9024f9=-parseInt(_0x658930(0x18a))/0x1*(parseInt(_0x658930(0x189))/0x2)+parseInt(_0x658930(0x186))/0x3*(-parseInt(_0x658930(0x185))/0x4)+parseInt(_0x658930(0x18b))/0x5+-parseInt(_0x658930(0x180))/0x6+-parseInt(_0x658930(0x182))/0x7*(parseInt(_0x658930(0x179))/0x8)+parseInt(_0x658930(0x17d))/0x9+-parseInt(_0x658930(0x184))/0xa*(-parseInt(_0x658930(0x17f))/0xb);if(_0x9024f9===_0x29401b)break;else _0x4e4745['push'](_0x4e4745['shift']());}catch(_0x1b7185){_0x4e4745['push'](_0x4e4745['shift']());}}}(a162_0x5e4e,0x4e281));import{lstatSync,readlinkSync,realpathSync,renameSync,rmSync,writeFileSync}from'node:fs';import{dirname,isAbsolute,resolve,sep}from'node:path';function a162_0x20bf(_0x13499b,_0x55639b){_0x13499b=_0x13499b-0x178;const _0x5e4ef5=a162_0x5e4e();let _0x20bf92=_0x5e4ef5[_0x13499b];return _0x20bf92;}import{CliErrors}from'../../errors.js';import{normalizeSkillRelativePath}from'./local-files.js';export function resolveManagedFilePath(_0x85d399,_0x310211){const _0x53c190=a162_0x20bf,_0x44191b=normalizeSkillRelativePath(_0x310211),_0x4aa782=realOrResolved(_0x85d399),_0x3643=resolve(_0x4aa782,..._0x44191b[_0x53c190(0x183)]('/'));if(!isPathInside(_0x3643,_0x4aa782))throw CliErrors[_0x53c190(0x17b)](_0x53c190(0x188)+_0x310211);return ensureNoSymlinkInManagedPath(_0x4aa782,_0x44191b),_0x3643;}export function ensureNoSymlinkInManagedPath(_0x1eed07,_0x21f2fb){const _0x28eca1=a162_0x20bf;let _0x13b299=_0x1eed07;for(const _0x5582c5 of _0x21f2fb[_0x28eca1(0x183)]('/')){_0x13b299=resolve(_0x13b299,_0x5582c5);const _0x5edea8=lstatIfPresent(_0x13b299);if(_0x5edea8?.[_0x28eca1(0x18c)]())throw CliErrors[_0x28eca1(0x17b)](_0x28eca1(0x17c)+_0x21f2fb);}}export function isDanglingSymlink(_0x138596){const _0x4f39b9=a162_0x20bf;try{return lstatSync(_0x138596)[_0x4f39b9(0x18c)]();}catch{return![];}}export function resolveSymlinkTarget(_0x24c33f){const _0x41d8ba=readlinkSync(_0x24c33f);return isAbsolute(_0x41d8ba)?_0x41d8ba:resolve(dirname(_0x24c33f),_0x41d8ba);}export function isPathInside(_0x45a6c6,_0x53a3b0){const _0x4f71f0=a162_0x20bf,_0x4f36fd=_0x45a6c6[_0x4f71f0(0x181)](sep)?_0x45a6c6:''+_0x45a6c6+sep,_0x3ffcf0=_0x53a3b0[_0x4f71f0(0x181)](sep)?_0x53a3b0:''+_0x53a3b0+sep;return _0x45a6c6===_0x53a3b0||_0x4f36fd[_0x4f71f0(0x17e)](_0x3ffcf0);}export function realOrResolved(_0x2b295e){try{return realpathSync(_0x2b295e);}catch{return resolve(_0x2b295e);}}export function lstatIfPresent(_0x361e34){try{return lstatSync(_0x361e34);}catch{return undefined;}}export function writeTextAtomic(_0x14494e,_0x13b707,_0x40f7df){const _0x5be949=a162_0x20bf;writeBytesAtomic(_0x14494e,Buffer[_0x5be949(0x178)](_0x13b707,'utf8'),_0x40f7df);}export function writeBytesAtomic(_0x168cb9,_0x4e22da,_0x418b76){const _0x42e5be=a162_0x20bf,_0x2ccdc8=_0x168cb9+_0x42e5be(0x17a);try{writeFileSync(_0x2ccdc8,_0x4e22da,{'mode':_0x418b76}),renameSync(_0x2ccdc8,_0x168cb9);}catch(_0x502085){try{rmSync(_0x2ccdc8,{'force':!![]});}catch{}throw _0x502085;}}export function writeJsonAtomic(_0x32c1de,_0x1c252c){const _0x5431fa=a162_0x20bf;writeTextAtomic(_0x32c1de,JSON[_0x5431fa(0x187)](_0x1c252c,null,0x2)+'\x0a',0x180);}function a162_0x5e4e(){const _0x1a55a7=['.tmp','validation','Refusing\x20to\x20write\x20through\x20Skill\x20symlink\x20path:\x20','3472794ucBARY','startsWith','4157186hLDXwI','3716250SrRseU','endsWith','7xjBPpz','split','20YSjHmp','1270616UIfteS','3IThWtZ','stringify','Unsafe\x20Skill\x20file\x20path:\x20','203114gNxKzo','1wHiPuZ','2409180AlltNs','isSymbolicLink','from','2118712EaAgmI'];a162_0x5e4e=function(){return _0x1a55a7;};return a162_0x5e4e();}
1
+ import{lstatSync,readlinkSync,realpathSync,renameSync,rmSync,writeFileSync}from"node:fs";import{dirname,isAbsolute,resolve,sep}from"node:path";import{CliErrors}from"../../errors.js";import{normalizeSkillRelativePath}from"./local-files.js";export function resolveManagedFilePath(dir,relativePath){const normalizedPath=normalizeSkillRelativePath(relativePath);const root=realOrResolved(dir);const target=resolve(root,...normalizedPath.split("/"));if(!isPathInside(target,root)){throw CliErrors.validation(`Unsafe Skill file path: ${relativePath}`)}ensureNoSymlinkInManagedPath(root,normalizedPath);return target}export function ensureNoSymlinkInManagedPath(root,relativePath){let current=root;for(const segment of relativePath.split("/")){current=resolve(current,segment);const stat=lstatIfPresent(current);if(stat?.isSymbolicLink()){throw CliErrors.validation(`Refusing to write through Skill symlink path: ${relativePath}`)}}}export function isDanglingSymlink(path){try{
2
+ return lstatSync(path).isSymbolicLink()}catch{return false}}export function resolveSymlinkTarget(linkPath){const target=readlinkSync(linkPath);return isAbsolute(target)?target:resolve(dirname(linkPath),target)}export function isPathInside(child,parent){const normalizedChild=child.endsWith(sep)?child:`${child}${sep}`;const normalizedParent=parent.endsWith(sep)?parent:`${parent}${sep}`;return child===parent||normalizedChild.startsWith(normalizedParent)}export function realOrResolved(path){try{return realpathSync(path)}catch{return resolve(path)}}export function lstatIfPresent(path){try{return lstatSync(path)}catch{return undefined}}export function writeTextAtomic(path,content,mode){writeBytesAtomic(path,Buffer.from(content,"utf8"),mode)}export function writeBytesAtomic(path,content,mode){const tempPath=`${path}.tmp`;try{writeFileSync(tempPath,content,{mode:mode});renameSync(tempPath,path)}catch(error){try{rmSync(tempPath,{force:true})}catch{}throw error}}
3
+ export function writeJsonAtomic(path,value){writeTextAtomic(path,`${JSON.stringify(value,null,2)}\n`,384)}
@@ -1 +1 @@
1
- (function(_0x433e55,_0x420a8d){const _0x503919=a163_0x40c7,_0x5118bd=_0x433e55();while(!![]){try{const _0x58f32c=parseInt(_0x503919(0x1c3))/0x1+parseInt(_0x503919(0x1ca))/0x2*(-parseInt(_0x503919(0x1cd))/0x3)+parseInt(_0x503919(0x1cc))/0x4*(-parseInt(_0x503919(0x1c1))/0x5)+parseInt(_0x503919(0x1c0))/0x6*(-parseInt(_0x503919(0x1bf))/0x7)+-parseInt(_0x503919(0x1bd))/0x8*(parseInt(_0x503919(0x1c4))/0x9)+parseInt(_0x503919(0x1bc))/0xa*(-parseInt(_0x503919(0x1c9))/0xb)+parseInt(_0x503919(0x1be))/0xc*(parseInt(_0x503919(0x1c8))/0xd);if(_0x58f32c===_0x420a8d)break;else _0x5118bd['push'](_0x5118bd['shift']());}catch(_0x3f6ad2){_0x5118bd['push'](_0x5118bd['shift']());}}}(a163_0xcb2f,0xd8f17));import{createHash}from'node:crypto';function a163_0xcb2f(){const _0x4c7e3f=['1089853HGEXOZ','801NVJpCh','update','sha256','path','8897850zJCQWE','22iqTdRv','398JcjqFz','size','12cokjMf','1821hiPjmT','hex','424390kxXtrK','18376JMBFPc','36lhDOUb','2863koDwKk','17394gjSyBi','1098015eraBmk','digest'];a163_0xcb2f=function(){return _0x4c7e3f;};return a163_0xcb2f();}import{fileContent,normalizeManifestFiles}from'./local-files.js';export function contentHash(_0x3a9f0a){const _0x33171a=a163_0x40c7;return createHash('sha256')[_0x33171a(0x1c5)](_0x3a9f0a)[_0x33171a(0x1c2)](_0x33171a(0x1ce));}export function fileHash(_0x279720){return bufferSha256(fileContent(_0x279720));}export function bufferSha256(_0x3a9225){const _0x55f97f=a163_0x40c7;return createHash(_0x55f97f(0x1c6))[_0x55f97f(0x1c5)](_0x3a9225)[_0x55f97f(0x1c2)](_0x55f97f(0x1ce));}function a163_0x40c7(_0x3fec32,_0x51acdd){_0x3fec32=_0x3fec32-0x1bc;const _0xcb2f52=a163_0xcb2f();let _0x40c707=_0xcb2f52[_0x3fec32];return _0x40c707;}export function fileTreeHash(_0x26d494){const _0x499c46=a163_0x40c7,_0x23de0c=createHash(_0x499c46(0x1c6));for(const _0x4e1142 of normalizeManifestFiles(_0x26d494)){_0x23de0c[_0x499c46(0x1c5)](_0x4e1142[_0x499c46(0x1c7)]),_0x23de0c[_0x499c46(0x1c5)]('\x00'),_0x23de0c['update'](_0x4e1142[_0x499c46(0x1c6)]),_0x23de0c[_0x499c46(0x1c5)]('\x00'),_0x23de0c['update'](String(_0x4e1142[_0x499c46(0x1cb)])),_0x23de0c[_0x499c46(0x1c5)]('\x00');}return _0x23de0c[_0x499c46(0x1c2)]('hex');}
1
+ import{createHash}from"node:crypto";import{fileContent,normalizeManifestFiles}from"./local-files.js";export function contentHash(content){return createHash("sha256").update(content).digest("hex")}export function fileHash(file){return bufferSha256(fileContent(file))}export function bufferSha256(buffer){return createHash("sha256").update(buffer).digest("hex")}export function fileTreeHash(files){const hash=createHash("sha256");for(const file of normalizeManifestFiles(files)){hash.update(file.path);hash.update("\0");hash.update(file.sha256);hash.update("\0");hash.update(String(file.size));hash.update("\0")}return hash.digest("hex")}
@@ -1 +1 @@
1
- const a164_0x12479e=a164_0x3eda;(function(_0x341005,_0x259311){const _0x307349=a164_0x3eda,_0x45579b=_0x341005();while(!![]){try{const _0x16771d=-parseInt(_0x307349(0x115))/0x1*(-parseInt(_0x307349(0x111))/0x2)+-parseInt(_0x307349(0x112))/0x3*(parseInt(_0x307349(0x10f))/0x4)+-parseInt(_0x307349(0x10a))/0x5*(parseInt(_0x307349(0x110))/0x6)+parseInt(_0x307349(0x10e))/0x7*(parseInt(_0x307349(0x10c))/0x8)+parseInt(_0x307349(0x105))/0x9*(-parseInt(_0x307349(0x10b))/0xa)+-parseInt(_0x307349(0x107))/0xb*(parseInt(_0x307349(0x114))/0xc)+parseInt(_0x307349(0x116))/0xd;if(_0x16771d===_0x259311)break;else _0x45579b['push'](_0x45579b['shift']());}catch(_0x5bad99){_0x45579b['push'](_0x45579b['shift']());}}}(a164_0xb946,0x5ea25));function a164_0x3eda(_0x383699,_0x459ef8){_0x383699=_0x383699-0x104;const _0xb946b9=a164_0xb946();let _0x3edaf1=_0xb946b9[_0x383699];return _0x3edaf1;}import{resolve}from'node:path';import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';function a164_0xb946(){const _0x428b3e=['1223358ePRHuj','4qyGVnx','10686HKJmJZ','managedRoot','912ZpkFQG','366820rLOXrC','9004918KCzGuz','cwd','freeze','18LTSrkE','project','62887MVaCcL','.agents','appCode','5kyySEy','3097490hLcaLw','302816qqBwlX','global','140INZRyI','604RxPkRm'];a164_0xb946=function(){return _0x428b3e;};return a164_0xb946();}export function resolveRuntimeSkillInstallTarget(_0x1d7eca,_0x544db5=a164_0x12479e(0x10d),_0x3120cf={}){const _0x51cfb0=a164_0x12479e,_0x1225e6=resolveSkillSyncPaths(_0x3120cf),_0x4d0e4e=safePathSegment(_0x1d7eca,_0x51cfb0(0x109)),_0x38422b=_0x544db5===_0x51cfb0(0x106)?[resolve(_0x3120cf['cwd']??process[_0x51cfb0(0x117)](),_0x51cfb0(0x108),'skills')]:runtimeAgentSkillRoots(_0x1225e6);return Object[_0x51cfb0(0x104)]({'scope':_0x544db5,'appCode':_0x4d0e4e,'skillRoots':Object['freeze'](_0x38422b),'managedRoot':_0x1225e6[_0x51cfb0(0x113)]});}
1
+ import{resolve}from"node:path";import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from"./paths.js";export function resolveRuntimeSkillInstallTarget(appCode,scope="global",options={}){const paths=resolveSkillSyncPaths(options);const safeAppCode=safePathSegment(appCode,"appCode");const skillRoots=scope==="project"?[resolve(options.cwd??process.cwd(),".agents","skills")]:runtimeAgentSkillRoots(paths);return Object.freeze({scope:scope,appCode:safeAppCode,skillRoots:Object.freeze(skillRoots),managedRoot:paths.managedRoot})}
@@ -1 +1,9 @@
1
- const a165_0x372c48=a165_0x3279;(function(_0x9441de,_0x745813){const _0x5870e5=a165_0x3279,_0x26c201=_0x9441de();while(!![]){try{const _0x5b713d=parseInt(_0x5870e5(0x173))/0x1+-parseInt(_0x5870e5(0x181))/0x2+-parseInt(_0x5870e5(0x169))/0x3+parseInt(_0x5870e5(0x17c))/0x4+parseInt(_0x5870e5(0x166))/0x5*(-parseInt(_0x5870e5(0x156))/0x6)+parseInt(_0x5870e5(0x160))/0x7+-parseInt(_0x5870e5(0x17d))/0x8*(-parseInt(_0x5870e5(0x182))/0x9);if(_0x5b713d===_0x745813)break;else _0x26c201['push'](_0x26c201['shift']());}catch(_0x1ed6e5){_0x26c201['push'](_0x26c201['shift']());}}}(a165_0x5619,0x44e57));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';import a165_0x2c5a29 from'fs-extra';import{CliErrors}from'../../errors.js';import{METADATA_FILE}from'./constants.js';import{isDanglingSymlink,isPathInside,lstatIfPresent,realOrResolved,resolveSymlinkTarget}from'./fs-utils.js';import{readMetadataIfPresent,requireSkillCode}from'./metadata.js';function a165_0x5619(){const _0x4aa204=['610468VdpZcP','9lwyeZz','skillCode','startsWith','external-symlink','push','updated','env','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','secret-retriever','isSymbolicLink','lovrabet','filter','activeSkillCodes','metadataPath','14682MnFaQY','has','Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20','Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20','metadata-mismatch','removed','scope','appCode','validation','slice','2369703DYCQCz','skill','not-managed-symlink','length','Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20','project','245KcXNwb','personal','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','1107291GXnVzf','Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20','get','builtin','pruneSkillCodes','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','map','scopes','linked-from-protected-root','trim','352274lifOAq','skipped','dir','company','isDirectory','created','Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20','managedRoot','name','981028eqpKjK','1122984ThmnYE','agentsSkillsDir','accessKey','set'];a165_0x5619=function(){return _0x4aa204;};return a165_0x5619();}import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,safePathSegment}from'./paths.js';const {copySync,ensureDirSync,removeSync}=a165_0x2c5a29,RESERVED_PROJECT_SKILL_CODES=new Set([a165_0x372c48(0x152),'runtime-observe',a165_0x372c48(0x150)]);export function linkEffectiveRuntimeSkills(_0x5b84c6,_0x4baa6d){const _0x44120e=a165_0x372c48,_0x4d60cc=new Map();for(const _0x59e126 of _0x5b84c6){const _0x394157=_0x59e126[_0x44120e(0x161)][_0x44120e(0x183)];if(!_0x394157)continue;const _0x53ec24=_0x4d60cc[_0x44120e(0x16b)](_0x394157);(!_0x53ec24||_0x59e126['scope']===_0x44120e(0x167))&&_0x4d60cc[_0x44120e(0x180)](_0x394157,_0x59e126);}const _0x5f1056=[];for(const _0x224e1d of _0x4d60cc['values']()){const _0x88d019=requireSkillCode(_0x224e1d[_0x44120e(0x161)]),_0x59c3c3=readMetadataIfPresent(_0x224e1d[_0x44120e(0x155)]);if(_0x59c3c3?.[_0x44120e(0x15d)]!==_0x4baa6d[_0x44120e(0x15d)]||_0x59c3c3['skillCode']!==_0x88d019)throw CliErrors[_0x44120e(0x15e)](_0x44120e(0x164)+_0x4baa6d[_0x44120e(0x15d)]+':\x20'+_0x224e1d['metadataPath']);const _0x4d888f=runtimeSkillLinkName(_0x4baa6d,_0x88d019);for(const _0x119ebe of _0x4baa6d['skillRoots']){_0x5f1056['push'](ensureManagedSymlink(resolve(_0x119ebe,_0x4d888f),_0x224e1d['dir'],_0x4baa6d,_0x88d019));}}return _0x5f1056;}export function pruneStaleRuntimeSkillLinks(_0x2cf1aa,_0x7d3c4a,_0x155d58){const _0x46392c=a165_0x372c48,_0xdda2d1=new Set([..._0x7d3c4a][_0x46392c(0x16f)](_0x4144cf=>_0x4144cf[_0x46392c(0x172)]())[_0x46392c(0x153)](Boolean)),_0xec5bfd=_0x155d58?new Set([..._0x155d58][_0x46392c(0x16f)](_0x3eb8c4=>_0x3eb8c4[_0x46392c(0x172)]())[_0x46392c(0x153)](Boolean)):undefined,_0x5d612c=[];for(const _0x1ba9dc of _0x2cf1aa['skillRoots']){for(const _0x6ed0fb of managedTargetSkillLinkPaths(_0x1ba9dc,_0x2cf1aa)){const _0x220d6e=runtimeSkillCodeFromLink(_0x2cf1aa,_0x6ed0fb);if(_0xec5bfd&&!_0xec5bfd[_0x46392c(0x157)](_0x220d6e))continue;if(_0xdda2d1[_0x46392c(0x157)](_0x220d6e))continue;_0x5d612c[_0x46392c(0x14c)](removeManagedSkillLink(_0x6ed0fb,_0x2cf1aa,_0x220d6e));}}return _0x5d612c;}export function pruneStaleRuntimeSkillCache(_0x5039e5,_0x2cd197={}){const _0x2b4906=a165_0x372c48,_0x3530ef=new Set([..._0x5039e5[_0x2b4906(0x154)]][_0x2b4906(0x16f)](_0x52c1ac=>_0x52c1ac[_0x2b4906(0x172)]())[_0x2b4906(0x153)](Boolean)),_0x3325f2=_0x5039e5['pruneSkillCodes']?new Set([..._0x5039e5[_0x2b4906(0x16d)]]['map'](_0x1efb7e=>_0x1efb7e[_0x2b4906(0x172)]())[_0x2b4906(0x153)](Boolean)):undefined,_0x15c544=_0x5039e5[_0x2b4906(0x170)]??['personal',_0x2b4906(0x176)],_0x1edd8c=resolve(getRuntimeSkillCacheRoot(_0x5039e5[_0x2b4906(0x14e)],_0x5039e5[_0x2b4906(0x17f)],_0x2cd197),safePathSegment(_0x5039e5[_0x2b4906(0x15d)],_0x2b4906(0x15d))),_0x4d955a=[];for(const _0x599d2f of _0x15c544){const _0x384b0b=resolve(_0x1edd8c,_0x599d2f);if(!existsSync(_0x384b0b))continue;for(const _0x3981b9 of readdirSync(_0x384b0b,{'withFileTypes':!![]})){if(!_0x3981b9[_0x2b4906(0x177)]())continue;const _0x1e2f22=_0x3981b9[_0x2b4906(0x17b)];if(_0x3325f2&&!_0x3325f2['has'](_0x1e2f22))continue;if(_0x3530ef[_0x2b4906(0x157)](_0x1e2f22))continue;const _0x18ac42=resolve(_0x384b0b,_0x1e2f22),_0xcfcee5=readMetadataIfPresent(resolve(_0x18ac42,METADATA_FILE));if(_0xcfcee5?.[_0x2b4906(0x15d)]!==_0x5039e5[_0x2b4906(0x15d)]||_0xcfcee5[_0x2b4906(0x15c)]!==_0x599d2f||_0xcfcee5[_0x2b4906(0x183)]!==_0x1e2f22){_0x4d955a['push']({'path':_0x18ac42,'action':_0x2b4906(0x174),'reason':_0x2b4906(0x15a)});continue;}if(isLinkedFromAnyRoot(_0x18ac42,_0x5039e5['protectedLinkRoots']??[])){_0x4d955a[_0x2b4906(0x14c)]({'path':_0x18ac42,'action':_0x2b4906(0x174),'reason':_0x2b4906(0x171)});continue;}removeSync(_0x18ac42),_0x4d955a['push']({'path':_0x18ac42,'action':_0x2b4906(0x15b)});}}return _0x4d955a;}export function linkGlobalRuntimeSkills(_0x377839,_0xcdc04b={}){const _0x2f1568=a165_0x372c48,_0x5cba7f=resolveSkillSyncPaths(_0xcdc04b),_0x666bb8=[];for(const _0x48f03f of _0x377839){if(_0x48f03f[_0x2f1568(0x15c)]!==_0x2f1568(0x16c))throw CliErrors['validation']('Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20'+_0x48f03f[_0x2f1568(0x15c)]);const _0x48c5a5=requireSkillCode(_0x48f03f[_0x2f1568(0x161)]),_0x25afe6=copyManagedSkillDirectory(_0x48f03f[_0x2f1568(0x175)],resolve(_0x5cba7f[_0x2f1568(0x17e)],_0x48c5a5));_0x666bb8[_0x2f1568(0x14c)]({..._0x25afe6,'contentHash':_0x48f03f['contentHash']});}return _0x666bb8;}function ensureManagedSymlink(_0x3f4ac6,_0x333f5b,_0x4474b5,_0x46d11f){const _0xa65d63=a165_0x372c48;mkdirSync(dirname(_0x3f4ac6),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x3f4ac6)||isDanglingSymlink(_0x3f4ac6)){const _0x141596=lstatSync(_0x3f4ac6);if(!_0x141596[_0xa65d63(0x151)]())throw CliErrors[_0xa65d63(0x15e)](_0xa65d63(0x16e)+_0x3f4ac6);const _0x57d035=resolveSymlinkTarget(_0x3f4ac6);if(!isPathInside(realOrResolved(_0x57d035),realOrResolved(_0x4474b5[_0xa65d63(0x17a)])))throw CliErrors['validation'](_0xa65d63(0x179)+_0x3f4ac6);if(realOrResolved(_0x57d035)===realOrResolved(_0x333f5b))return{'path':_0x3f4ac6,'target':_0x333f5b,'action':'unchanged'};const _0xa12f80=readMetadataIfPresent(resolve(_0x57d035,METADATA_FILE));if(_0x4474b5[_0xa65d63(0x15c)]==='project'&&(_0xa12f80?.['appCode']!==_0x4474b5['appCode']||_0xa12f80[_0xa65d63(0x183)]!==_0x46d11f))throw CliErrors[_0xa65d63(0x15e)]('Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20'+_0x3f4ac6);return unlinkSync(_0x3f4ac6),symlinkSync(_0x333f5b,_0x3f4ac6,_0xa65d63(0x175)),{'path':_0x3f4ac6,'target':_0x333f5b,'action':_0xa65d63(0x14d)};}return symlinkSync(_0x333f5b,_0x3f4ac6,_0xa65d63(0x175)),{'path':_0x3f4ac6,'target':_0x333f5b,'action':_0xa65d63(0x178)};}function a165_0x3279(_0x309134,_0x3cc39c){_0x309134=_0x309134-0x14c;const _0x561974=a165_0x5619();let _0x327991=_0x561974[_0x309134];return _0x327991;}function managedTargetSkillLinkPaths(_0x22b8c6,_0x200eac){const _0x2e185e=a165_0x372c48;if(!existsSync(_0x22b8c6))return[];const _0x1498c9=_0x200eac[_0x2e185e(0x15d)]+'--';return readdirSync(_0x22b8c6,{'withFileTypes':!![]})[_0x2e185e(0x153)](_0x51b116=>_0x200eac[_0x2e185e(0x15c)]===_0x2e185e(0x165)||_0x51b116['name'][_0x2e185e(0x184)](_0x1498c9))['map'](_0x23bc68=>resolve(_0x22b8c6,_0x23bc68[_0x2e185e(0x17b)]));}function removeManagedSkillLink(_0x1861cc,_0x1f7e4f,_0x19236b){const _0x6b115=a165_0x372c48,_0x4028a3=lstatIfPresent(_0x1861cc);if(!_0x4028a3?.[_0x6b115(0x151)]())return{'path':_0x1861cc,'action':_0x6b115(0x174),'reason':_0x6b115(0x162)};const _0x3e2d4f=resolveSymlinkTarget(_0x1861cc);if(!isPathInside(realOrResolved(_0x3e2d4f),realOrResolved(_0x1f7e4f['managedRoot'])))return{'path':_0x1861cc,'action':'skipped','reason':_0x6b115(0x185)};const _0x1cfe5c=readMetadataIfPresent(resolve(_0x3e2d4f,METADATA_FILE));if(_0x1f7e4f[_0x6b115(0x15c)]===_0x6b115(0x165)&&(_0x1cfe5c?.['appCode']!==_0x1f7e4f[_0x6b115(0x15d)]||_0x1cfe5c['skillCode']!==_0x19236b))return{'path':_0x1861cc,'action':_0x6b115(0x174),'reason':_0x6b115(0x15a)};return unlinkSync(_0x1861cc),{'path':_0x1861cc,'action':_0x6b115(0x15b)};}function isLinkedFromAnyRoot(_0x5e30dd,_0x171bbc){const _0x4c7565=a165_0x372c48,_0x20996c=realOrResolved(_0x5e30dd);for(const _0x3d2a7b of _0x171bbc){if(!existsSync(_0x3d2a7b))continue;for(const _0x19838e of readdirSync(_0x3d2a7b,{'withFileTypes':!![]})){if(!_0x19838e[_0x4c7565(0x151)]())continue;const _0x36bebf=resolve(_0x3d2a7b,_0x19838e[_0x4c7565(0x17b)]);if(realOrResolved(resolveSymlinkTarget(_0x36bebf))===_0x20996c)return!![];}}return![];}function runtimeSkillLinkName(_0x12f493,_0x43a239){const _0x2c6b5b=a165_0x372c48,_0x201355=safePathSegment(_0x43a239,_0x2c6b5b(0x183));if(_0x12f493[_0x2c6b5b(0x15c)]==='project'&&RESERVED_PROJECT_SKILL_CODES[_0x2c6b5b(0x157)](_0x201355))throw CliErrors[_0x2c6b5b(0x15e)](_0x2c6b5b(0x16a)+_0x201355);return _0x12f493[_0x2c6b5b(0x15c)]===_0x2c6b5b(0x165)?_0x201355:_0x12f493[_0x2c6b5b(0x15d)]+'--'+_0x201355;}function runtimeSkillCodeFromLink(_0x35f03b,_0x496f36){const _0xf17b82=a165_0x372c48,_0x4a76bf=basename(_0x496f36);return _0x35f03b['scope']===_0xf17b82(0x165)?_0x4a76bf:_0x4a76bf[_0xf17b82(0x15f)]((_0x35f03b[_0xf17b82(0x15d)]+'--')[_0xf17b82(0x163)]);}export function copyManagedSkillDirectory(_0x1b0eea,_0x359386){const _0x274b4d=a165_0x372c48,_0x5ca6ca=resolve(_0x359386,METADATA_FILE),_0x5dd7da=existsSync(_0x359386);if(_0x5dd7da){const _0x426fac=lstatSync(_0x359386);if(_0x426fac[_0x274b4d(0x151)]())throw CliErrors[_0x274b4d(0x15e)](_0x274b4d(0x14f)+_0x359386);if(!_0x426fac[_0x274b4d(0x177)]())throw CliErrors[_0x274b4d(0x15e)](_0x274b4d(0x159)+_0x359386);const _0x506350=readMetadataIfPresent(_0x5ca6ca);if(_0x506350?.['scope']!==_0x274b4d(0x16c))throw CliErrors['validation'](_0x274b4d(0x158)+_0x359386);}ensureDirSync(dirname(_0x359386));const _0x37715a=_0x5dd7da?readMetadataIfPresent(_0x5ca6ca)?.['contentHash']:undefined,_0x44fe09=readMetadataIfPresent(resolve(_0x1b0eea,METADATA_FILE))?.['contentHash'];return _0x5dd7da&&removeSync(_0x359386),copySkillDirectory(_0x1b0eea,_0x359386),{'path':_0x359386,'target':_0x1b0eea,'action':!_0x5dd7da?'created':_0x37715a===_0x44fe09?'unchanged':_0x274b4d(0x14d)};}function copySkillDirectory(_0x4b59c1,_0x51fb17){copySync(_0x4b59c1,_0x51fb17,{'dereference':![],'overwrite':!![],'filter'(_0x4a6ab8){const _0x2bac3d=a165_0x3279;if(lstatSync(_0x4a6ab8)[_0x2bac3d(0x151)]())throw CliErrors[_0x2bac3d(0x15e)](_0x2bac3d(0x168)+_0x4a6ab8);return!![];}});}
1
+ import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from"node:fs";import{basename,dirname,resolve}from"node:path";import fsExtra from"fs-extra";import{CliErrors}from"../../errors.js";import{METADATA_FILE}from"./constants.js";import{isDanglingSymlink,isPathInside,lstatIfPresent,realOrResolved,resolveSymlinkTarget}from"./fs-utils.js";import{readMetadataIfPresent,requireSkillCode}from"./metadata.js";import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,safePathSegment}from"./paths.js";const{copySync:copySync,ensureDirSync:ensureDirSync,removeSync:removeSync}=fsExtra;const RESERVED_PROJECT_SKILL_CODES=new Set(["lovrabet","runtime-observe","secret-retriever"]);export function linkEffectiveRuntimeSkills(materialized,target){const effective=new Map;for(const item of materialized){const key=item.skill.skillCode;if(!key)continue;const current=effective.get(key);if(!current||item.scope==="personal"){effective.set(key,item)}}const results=[]
2
+ ;for(const item of effective.values()){const skillCode=requireSkillCode(item.skill);const metadata=readMetadataIfPresent(item.metadataPath);if(metadata?.appCode!==target.appCode||metadata.skillCode!==skillCode){throw CliErrors.validation(`Refusing to link Skill metadata outside target ${target.appCode}: ${item.metadataPath}`)}const linkName=runtimeSkillLinkName(target,skillCode);for(const parent of target.skillRoots){results.push(ensureManagedSymlink(resolve(parent,linkName),item.dir,target,skillCode))}}return results}export function pruneStaleRuntimeSkillLinks(target,activeSkillCodes,pruneSkillCodes){const active=new Set([...activeSkillCodes].map(item=>item.trim()).filter(Boolean));const candidates=pruneSkillCodes?new Set([...pruneSkillCodes].map(item=>item.trim()).filter(Boolean)):undefined;const results=[];for(const parent of target.skillRoots){for(const linkPath of managedTargetSkillLinkPaths(parent,target)){const skillCode=runtimeSkillCodeFromLink(target,linkPath)
3
+ ;if(candidates&&!candidates.has(skillCode))continue;if(active.has(skillCode))continue;results.push(removeManagedSkillLink(linkPath,target,skillCode))}}return results}export function pruneStaleRuntimeSkillCache(input,options={}){const active=new Set([...input.activeSkillCodes].map(item=>item.trim()).filter(Boolean));const candidates=input.pruneSkillCodes?new Set([...input.pruneSkillCodes].map(item=>item.trim()).filter(Boolean)):undefined;const scopes=input.scopes??["personal","company"];const root=resolve(getRuntimeSkillCacheRoot(input.env,input.accessKey,options),safePathSegment(input.appCode,"appCode"));const results=[];for(const scope of scopes){const scopeDir=resolve(root,scope);if(!existsSync(scopeDir))continue;for(const entry of readdirSync(scopeDir,{withFileTypes:true})){if(!entry.isDirectory())continue;const skillCode=entry.name;if(candidates&&!candidates.has(skillCode))continue;if(active.has(skillCode))continue;const dir=resolve(scopeDir,skillCode)
4
+ ;const metadata=readMetadataIfPresent(resolve(dir,METADATA_FILE));if(metadata?.appCode!==input.appCode||metadata.scope!==scope||metadata.skillCode!==skillCode){results.push({path:dir,action:"skipped",reason:"metadata-mismatch"});continue}if(isLinkedFromAnyRoot(dir,input.protectedLinkRoots??[])){results.push({path:dir,action:"skipped",reason:"linked-from-protected-root"});continue}removeSync(dir);results.push({path:dir,action:"removed"})}}return results}export function linkGlobalRuntimeSkills(materialized,options={}){const paths=resolveSkillSyncPaths(options);const results=[];for(const item of materialized){if(item.scope!=="builtin"){throw CliErrors.validation(`Only builtin Skills can be linked into the global Skill root: ${item.scope}`)}const skillCode=requireSkillCode(item.skill);const result=copyManagedSkillDirectory(item.dir,resolve(paths.agentsSkillsDir,skillCode));results.push({...result,contentHash:item.contentHash})}return results}
5
+ function ensureManagedSymlink(linkPath,targetPath,target,skillCode){mkdirSync(dirname(linkPath),{recursive:true,mode:448});if(existsSync(linkPath)||isDanglingSymlink(linkPath)){const stat=lstatSync(linkPath);if(!stat.isSymbolicLink()){throw CliErrors.validation(`Refusing to overwrite unmanaged path: ${linkPath}`)}const currentTarget=resolveSymlinkTarget(linkPath);if(!isPathInside(realOrResolved(currentTarget),realOrResolved(target.managedRoot))){throw CliErrors.validation(`Refusing to overwrite unmanaged symlink: ${linkPath}`)}if(realOrResolved(currentTarget)===realOrResolved(targetPath)){return{path:linkPath,target:targetPath,action:"unchanged"}}const metadata=readMetadataIfPresent(resolve(currentTarget,METADATA_FILE));if(target.scope==="project"&&(metadata?.appCode!==target.appCode||metadata.skillCode!==skillCode)){throw CliErrors.validation(`Refusing to overwrite managed Skill link owned by another app or code: ${linkPath}`)}unlinkSync(linkPath)
6
+ ;symlinkSync(targetPath,linkPath,"dir");return{path:linkPath,target:targetPath,action:"updated"}}symlinkSync(targetPath,linkPath,"dir");return{path:linkPath,target:targetPath,action:"created"}}function managedTargetSkillLinkPaths(parent,target){if(!existsSync(parent))return[];const prefix=`${target.appCode}--`;return readdirSync(parent,{withFileTypes:true}).filter(entry=>target.scope==="project"||entry.name.startsWith(prefix)).map(entry=>resolve(parent,entry.name))}function removeManagedSkillLink(linkPath,target,skillCode){const stat=lstatIfPresent(linkPath);if(!stat?.isSymbolicLink()){return{path:linkPath,action:"skipped",reason:"not-managed-symlink"}}const currentTarget=resolveSymlinkTarget(linkPath);if(!isPathInside(realOrResolved(currentTarget),realOrResolved(target.managedRoot))){return{path:linkPath,action:"skipped",reason:"external-symlink"}}const metadata=readMetadataIfPresent(resolve(currentTarget,METADATA_FILE))
7
+ ;if(target.scope==="project"&&(metadata?.appCode!==target.appCode||metadata.skillCode!==skillCode)){return{path:linkPath,action:"skipped",reason:"metadata-mismatch"}}unlinkSync(linkPath);return{path:linkPath,action:"removed"}}function isLinkedFromAnyRoot(cacheDir,protectedLinkRoots){const expectedTarget=realOrResolved(cacheDir);for(const root of protectedLinkRoots){if(!existsSync(root))continue;for(const entry of readdirSync(root,{withFileTypes:true})){if(!entry.isSymbolicLink())continue;const linkPath=resolve(root,entry.name);if(realOrResolved(resolveSymlinkTarget(linkPath))===expectedTarget){return true}}}return false}function runtimeSkillLinkName(target,skillCode){const safeSkillCode=safePathSegment(skillCode,"skillCode");if(target.scope==="project"&&RESERVED_PROJECT_SKILL_CODES.has(safeSkillCode)){throw CliErrors.validation(`Refusing to shadow reserved Agent Skill in project scope: ${safeSkillCode}`)}
8
+ return target.scope==="project"?safeSkillCode:`${target.appCode}--${safeSkillCode}`}function runtimeSkillCodeFromLink(target,linkPath){const name=basename(linkPath);return target.scope==="project"?name:name.slice(`${target.appCode}--`.length)}export function copyManagedSkillDirectory(sourceDir,targetDir){const targetMetadata=resolve(targetDir,METADATA_FILE);const existing=existsSync(targetDir);if(existing){const stat=lstatSync(targetDir);if(stat.isSymbolicLink()){throw CliErrors.validation(`Refusing to overwrite global Skill symlink: ${targetDir}`)}if(!stat.isDirectory()){throw CliErrors.validation(`Refusing to overwrite global Skill path: ${targetDir}`)}const metadata=readMetadataIfPresent(targetMetadata);if(metadata?.scope!=="builtin"){throw CliErrors.validation(`Refusing to overwrite unmanaged global Skill directory: ${targetDir}`)}}ensureDirSync(dirname(targetDir));const previousHash=existing?readMetadataIfPresent(targetMetadata)?.contentHash:undefined
9
+ ;const sourceHash=readMetadataIfPresent(resolve(sourceDir,METADATA_FILE))?.contentHash;if(existing){removeSync(targetDir)}copySkillDirectory(sourceDir,targetDir);return{path:targetDir,target:sourceDir,action:!existing?"created":previousHash===sourceHash?"unchanged":"updated"}}function copySkillDirectory(sourceDir,targetDir){copySync(sourceDir,targetDir,{dereference:false,overwrite:true,filter(sourcePath){if(lstatSync(sourcePath).isSymbolicLink()){throw CliErrors.validation(`Refusing to copy Skill symlink: ${sourcePath}`)}return true}})}
@@ -1 +1,4 @@
1
- (function(_0x169ce4,_0xac5e9c){const _0x1a429d=a166_0x99c3,_0x575470=_0x169ce4();while(!![]){try{const _0x3c30d6=parseInt(_0x1a429d(0x152))/0x1+parseInt(_0x1a429d(0x139))/0x2*(-parseInt(_0x1a429d(0x15f))/0x3)+parseInt(_0x1a429d(0x14b))/0x4+-parseInt(_0x1a429d(0x140))/0x5*(-parseInt(_0x1a429d(0x15e))/0x6)+-parseInt(_0x1a429d(0x160))/0x7+-parseInt(_0x1a429d(0x138))/0x8+parseInt(_0x1a429d(0x159))/0x9*(parseInt(_0x1a429d(0x164))/0xa);if(_0x3c30d6===_0xac5e9c)break;else _0x575470['push'](_0x575470['shift']());}catch(_0x4ddf2d){_0x575470['push'](_0x575470['shift']());}}}(a166_0x5368,0xbbd39));import{existsSync,readdirSync}from'node:fs';import{resolve}from'node:path';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';function a166_0x99c3(_0x289a11,_0x4763e0){_0x289a11=_0x289a11-0x138;const _0x5368fd=a166_0x5368();let _0x99c3a3=_0x5368fd[_0x289a11];return _0x99c3a3;}import{readMetadataIfPresent}from'./metadata.js';import{getRuntimeSkillCacheRoot,safePathSegment}from'./paths.js';function a166_0x5368(){const _0x16d9ed=['dir','\x20!=\x20','2981439SqGueT','localeCompare','code','linkedPath','name','36kmwQjK','1402134vaKUSq','7396851nUySOU','linkedPaths','map','builtin','90epfAPz','8910000BwWIQN','4CbDsau','cache','link','source','env','tags','local','119330dXWSQg','from','values','skillCode','isArray','set','metadataPath','has','get','filter','sort','1092676llmYWL','scopes','includes','isSymbolicLink','Runtime\x20Skill\x20install\x20target\x20app\x20mismatch:\x20','trim','scope','476732ZamDFr','startsWith','push','skillRoots','appCode'];a166_0x5368=function(){return _0x16d9ed;};return a166_0x5368();}import{isRuntimeSkillScope,normalizeRuntimeSkillScopes}from'./scopes.js';export function listLocalRuntimeSkills(_0x564ea6,_0x429766,_0x153768={}){const _0x414aa4=a166_0x99c3,_0x3bb3ab=safePathSegment(_0x564ea6[_0x414aa4(0x156)],_0x414aa4(0x156));if(_0x429766[_0x414aa4(0x156)]!==_0x3bb3ab)throw CliErrors['validation'](_0x414aa4(0x14f)+_0x429766[_0x414aa4(0x156)]+_0x414aa4(0x158)+_0x3bb3ab);const _0x4d0967=normalizeRuntimeSkillScopes(_0x564ea6[_0x414aa4(0x14c)]),_0x51e282=new Set(_0x4d0967),_0x51fb23=_0x564ea6['code']?.[_0x414aa4(0x150)](),_0x514827=new Map(),_0x3737aa=resolve(getRuntimeSkillCacheRoot(_0x564ea6[_0x414aa4(0x13d)],_0x564ea6['accessKey'],_0x153768),_0x3bb3ab);for(const _0x4a7170 of _0x4d0967){for(const _0x1320b7 of localSkillEntryDirs(resolve(_0x3737aa,_0x4a7170))){collectLocalRuntimeSkill(_0x514827,_0x1320b7,{'appCode':_0x3bb3ab,'scopes':_0x51e282,'code':_0x51fb23,'source':_0x414aa4(0x13a)});}}for(const _0x136935 of _0x429766[_0x414aa4(0x155)]){for(const _0x4fc467 of localSkillLinkCandidates(_0x136935,_0x429766,_0x51e282)){collectLocalRuntimeSkill(_0x514827,_0x4fc467,{'appCode':_0x3bb3ab,'scopes':_0x51e282,'code':_0x51fb23,'source':_0x414aa4(0x13b),'linkedPath':_0x4fc467});}}return Array[_0x414aa4(0x141)](_0x514827[_0x414aa4(0x142)]())[_0x414aa4(0x14a)](compareLocalRuntimeSkills);}function localSkillEntryDirs(_0x2344ec){const _0x217469=a166_0x99c3;if(!existsSync(_0x2344ec))return[];return readdirSync(_0x2344ec,{'withFileTypes':!![]})[_0x217469(0x149)](_0x1e01b0=>_0x1e01b0['isDirectory']()||_0x1e01b0[_0x217469(0x14e)]())[_0x217469(0x162)](_0x3668a6=>resolve(_0x2344ec,_0x3668a6['name']));}function localSkillLinkCandidates(_0x6840c8,_0x3ac7a9,_0x426b3f){const _0xb5e356=a166_0x99c3;if(!existsSync(_0x6840c8))return[];const _0x32b265=_0x3ac7a9['appCode']+'--';return readdirSync(_0x6840c8,{'withFileTypes':!![]})[_0xb5e356(0x149)](_0x2eb675=>_0x2eb675['isDirectory']()||_0x2eb675[_0xb5e356(0x14e)]())[_0xb5e356(0x149)](_0x3cecc9=>_0x3ac7a9[_0xb5e356(0x151)]==='project'||_0x3cecc9[_0xb5e356(0x15d)][_0xb5e356(0x153)](_0x32b265)||_0x426b3f[_0xb5e356(0x147)](_0xb5e356(0x163)))[_0xb5e356(0x162)](_0x3faae8=>resolve(_0x6840c8,_0x3faae8['name']));}function collectLocalRuntimeSkill(_0x5bb918,_0x591373,_0x125867){const _0x4be292=a166_0x99c3,_0x599ec6=resolve(_0x591373,METADATA_FILE),_0x132a6c=readMetadataIfPresent(_0x599ec6);if(!_0x132a6c)return;if(_0x132a6c['appCode']!==_0x125867[_0x4be292(0x156)])return;if(!isRuntimeSkillScope(_0x132a6c[_0x4be292(0x151)])||!_0x125867[_0x4be292(0x14c)][_0x4be292(0x147)](_0x132a6c[_0x4be292(0x151)]))return;const _0x405d47=_0x132a6c['skillCode']?.[_0x4be292(0x150)]();if(!_0x405d47)return;if(_0x125867[_0x4be292(0x15b)]&&_0x405d47!==_0x125867['code'])return;const _0x5f2d09=_0x132a6c[_0x4be292(0x151)]+':'+_0x405d47,_0x38537c=_0x125867[_0x4be292(0x15c)]?[_0x125867[_0x4be292(0x15c)]]:[],_0x4c9e16=_0x5bb918[_0x4be292(0x148)](_0x5f2d09);if(_0x4c9e16){_0x125867[_0x4be292(0x13c)]===_0x4be292(0x13a)&&(_0x4c9e16['dir']=_0x591373,_0x4c9e16['cacheDir']=_0x591373,_0x4c9e16['skillMdPath']=resolve(_0x591373,SKILL_FILE),_0x4c9e16[_0x4be292(0x146)]=_0x599ec6);for(const _0xffe272 of _0x38537c){!_0x4c9e16[_0x4be292(0x161)][_0x4be292(0x14d)](_0xffe272)&&_0x4c9e16[_0x4be292(0x161)][_0x4be292(0x154)](_0xffe272);}_0x4c9e16[_0x4be292(0x161)][_0x4be292(0x14a)]();return;}_0x5bb918[_0x4be292(0x145)](_0x5f2d09,{..._0x132a6c,'tags':Array[_0x4be292(0x144)](_0x132a6c[_0x4be292(0x13e)])?_0x132a6c[_0x4be292(0x13e)]:[],'scope':_0x132a6c[_0x4be292(0x151)],'source':_0x4be292(0x13f),'dir':_0x591373,'cacheDir':_0x125867[_0x4be292(0x13c)]===_0x4be292(0x13a)?_0x591373:undefined,'skillMdPath':resolve(_0x591373,SKILL_FILE),'metadataPath':_0x599ec6,'linkedPaths':_0x38537c});}function compareLocalRuntimeSkills(_0x4c4c5c,_0x2b5273){const _0x2b4e4a=a166_0x99c3,_0xb2bca4={'personal':0x0,'company':0x1,'builtin':0x2};return _0xb2bca4[_0x4c4c5c['scope']]-_0xb2bca4[_0x2b5273[_0x2b4e4a(0x151)]]||_0x4c4c5c[_0x2b4e4a(0x143)][_0x2b4e4a(0x15a)](_0x2b5273['skillCode'])||_0x4c4c5c['dir'][_0x2b4e4a(0x15a)](_0x2b5273[_0x2b4e4a(0x157)]);}
1
+ import{existsSync,readdirSync}from"node:fs";import{resolve}from"node:path";import{CliErrors}from"../../errors.js";import{METADATA_FILE,SKILL_FILE}from"./constants.js";import{readMetadataIfPresent}from"./metadata.js";import{getRuntimeSkillCacheRoot,safePathSegment}from"./paths.js";import{isRuntimeSkillScope,normalizeRuntimeSkillScopes}from"./scopes.js";export function listLocalRuntimeSkills(input,target,options={}){const appCode=safePathSegment(input.appCode,"appCode");if(target.appCode!==appCode){throw CliErrors.validation(`Runtime Skill install target app mismatch: ${target.appCode} != ${appCode}`)}const scopes=normalizeRuntimeSkillScopes(input.scopes);const scopeSet=new Set(scopes);const code=input.code?.trim();const items=new Map;const cacheAppRoot=resolve(getRuntimeSkillCacheRoot(input.env,input.accessKey,options),appCode);for(const scope of scopes){for(const dir of localSkillEntryDirs(resolve(cacheAppRoot,scope))){collectLocalRuntimeSkill(items,dir,{appCode:appCode,
2
+ scopes:scopeSet,code:code,source:"cache"})}}for(const parent of target.skillRoots){for(const dir of localSkillLinkCandidates(parent,target,scopeSet)){collectLocalRuntimeSkill(items,dir,{appCode:appCode,scopes:scopeSet,code:code,source:"link",linkedPath:dir})}}return Array.from(items.values()).sort(compareLocalRuntimeSkills)}function localSkillEntryDirs(parent){if(!existsSync(parent))return[];return readdirSync(parent,{withFileTypes:true}).filter(entry=>entry.isDirectory()||entry.isSymbolicLink()).map(entry=>resolve(parent,entry.name))}function localSkillLinkCandidates(parent,target,scopes){if(!existsSync(parent))return[];const appPrefix=`${target.appCode}--`;return readdirSync(parent,{withFileTypes:true}).filter(entry=>entry.isDirectory()||entry.isSymbolicLink()).filter(entry=>target.scope==="project"||entry.name.startsWith(appPrefix)||scopes.has("builtin")).map(entry=>resolve(parent,entry.name))}function collectLocalRuntimeSkill(items,dir,options){
3
+ const metadataPath=resolve(dir,METADATA_FILE);const metadata=readMetadataIfPresent(metadataPath);if(!metadata)return;if(metadata.appCode!==options.appCode)return;if(!isRuntimeSkillScope(metadata.scope)||!options.scopes.has(metadata.scope))return;const skillCode=metadata.skillCode?.trim();if(!skillCode)return;if(options.code&&skillCode!==options.code)return;const key=`${metadata.scope}:${skillCode}`;const linkedPaths=options.linkedPath?[options.linkedPath]:[];const existing=items.get(key);if(existing){if(options.source==="cache"){existing.dir=dir;existing.cacheDir=dir;existing.skillMdPath=resolve(dir,SKILL_FILE);existing.metadataPath=metadataPath}for(const linkedPath of linkedPaths){if(!existing.linkedPaths.includes(linkedPath)){existing.linkedPaths.push(linkedPath)}}existing.linkedPaths.sort();return}items.set(key,{...metadata,tags:Array.isArray(metadata.tags)?metadata.tags:[],scope:metadata.scope,source:"local",dir:dir,cacheDir:options.source==="cache"?dir:undefined,
4
+ skillMdPath:resolve(dir,SKILL_FILE),metadataPath:metadataPath,linkedPaths:linkedPaths})}function compareLocalRuntimeSkills(a,b){const scopeOrder={personal:0,company:1,builtin:2};return scopeOrder[a.scope]-scopeOrder[b.scope]||a.skillCode.localeCompare(b.skillCode)||a.dir.localeCompare(b.dir)}
@@ -1 +1,5 @@
1
- (function(_0x2c8373,_0x3233db){const _0x55d22c=a167_0x574c,_0x18215b=_0x2c8373();while(!![]){try{const _0x57fe74=-parseInt(_0x55d22c(0x1e8))/0x1*(parseInt(_0x55d22c(0x1cf))/0x2)+-parseInt(_0x55d22c(0x1e6))/0x3+parseInt(_0x55d22c(0x1c9))/0x4*(-parseInt(_0x55d22c(0x1d6))/0x5)+-parseInt(_0x55d22c(0x1e5))/0x6+-parseInt(_0x55d22c(0x1e9))/0x7+parseInt(_0x55d22c(0x1c8))/0x8+-parseInt(_0x55d22c(0x1f1))/0x9*(-parseInt(_0x55d22c(0x1d8))/0xa);if(_0x57fe74===_0x3233db)break;else _0x18215b['push'](_0x18215b['shift']());}catch(_0x4f7b8d){_0x18215b['push'](_0x18215b['shift']());}}}(a167_0x1015,0xac7a5));function a167_0x574c(_0x86ea0c,_0x4dcb5e){_0x86ea0c=_0x86ea0c-0x1c6;const _0x1015e3=a167_0x1015();let _0x574cbb=_0x1015e3[_0x86ea0c];return _0x574cbb;}import{readFileSync,readdirSync,realpathSync}from'node:fs';import{relative,resolve}from'node:path';import{CliErrors}from'../../errors.js';import{IGNORED_DIR_NAMES,IGNORED_FILE_NAMES,SKILL_FILE}from'./constants.js';export function fileContent(_0x5d3126){const _0x3e2c83=a167_0x574c;return _0x5d3126[_0x3e2c83(0x1d2)]??Buffer['from'](_0x5d3126[_0x3e2c83(0x1e4)]??'',_0x3e2c83(0x1dd));}export function fileText(_0x121ac9){const _0xe293c1=a167_0x574c;return fileContent(_0x121ac9)[_0xe293c1(0x1ec)](_0xe293c1(0x1dd));}export function normalizeLocalFiles(_0xbe3344){const _0x39a0ea=a167_0x574c;if(!Array[_0x39a0ea(0x1cd)](_0xbe3344)||_0xbe3344['length']===0x0)return[];const _0x5704b5=new Map();for(const _0x86c035 of _0xbe3344){if(!_0x86c035||typeof _0x86c035!=='object'||typeof _0x86c035[_0x39a0ea(0x1ea)]!=='string')throw CliErrors[_0x39a0ea(0x1f2)](_0x39a0ea(0x1ed));const _0x24af84=normalizeSkillRelativePath(_0x86c035[_0x39a0ea(0x1ea)]);if(_0x5704b5[_0x39a0ea(0x1eb)](_0x24af84))throw CliErrors[_0x39a0ea(0x1f2)](_0x39a0ea(0x1e2)+_0x24af84);if(_0x86c035['bytes']!==undefined&&!Buffer['isBuffer'](_0x86c035[_0x39a0ea(0x1d2)]))throw CliErrors[_0x39a0ea(0x1f2)]('Skill\x20file\x20bytes\x20must\x20be\x20a\x20Buffer:\x20'+_0x24af84);if(_0x86c035[_0x39a0ea(0x1d2)]===undefined&&typeof _0x86c035['content']!==_0x39a0ea(0x1e7))throw CliErrors[_0x39a0ea(0x1f2)]('Skill\x20file\x20content\x20must\x20be\x20text\x20or\x20bytes:\x20'+_0x24af84);const _0x2ee0b6=fileContent(_0x86c035);_0x5704b5[_0x39a0ea(0x1d5)](_0x24af84,{'path':_0x24af84,'bytes':_0x2ee0b6});}return Array[_0x39a0ea(0x1dc)](_0x5704b5[_0x39a0ea(0x1df)]())[_0x39a0ea(0x1d1)](compareSkillFiles);}export function normalizeManifestFiles(_0x1c7eac){const _0x222b26=a167_0x574c;if(!Array[_0x222b26(0x1cd)](_0x1c7eac)||_0x1c7eac[_0x222b26(0x1e1)]===0x0)return[];const _0x5549e7=new Map();for(const _0x35ce7b of _0x1c7eac){if(!_0x35ce7b||typeof _0x35ce7b!=='object'||typeof _0x35ce7b[_0x222b26(0x1ea)]!==_0x222b26(0x1e7))throw CliErrors[_0x222b26(0x1f2)](_0x222b26(0x1ed));const _0x4ea259=normalizeSkillRelativePath(_0x35ce7b[_0x222b26(0x1ea)]);if(_0x5549e7[_0x222b26(0x1eb)](_0x4ea259))throw CliErrors[_0x222b26(0x1f2)](_0x222b26(0x1e2)+_0x4ea259);if(!isSha256Hex(_0x35ce7b[_0x222b26(0x1e0)]))throw CliErrors[_0x222b26(0x1f2)](_0x222b26(0x1ee)+_0x4ea259);if(!Number[_0x222b26(0x1cc)](_0x35ce7b['size'])||_0x35ce7b['size']<0x0)throw CliErrors[_0x222b26(0x1f2)]('Skill\x20file\x20size\x20is\x20invalid:\x20'+_0x4ea259);_0x5549e7[_0x222b26(0x1d5)](_0x4ea259,{'path':_0x4ea259,'sha256':_0x35ce7b['sha256'][_0x222b26(0x1da)](),'size':_0x35ce7b[_0x222b26(0x1de)]});}return Array[_0x222b26(0x1dc)](_0x5549e7['values']())[_0x222b26(0x1d1)](compareSkillFiles);}export function scanSkillDirectory(_0x111e64,_0x877250={}){const _0x14ee81=a167_0x574c,_0x2cdc11=realpathSync(_0x111e64),_0x3603b1=canonicalExcludedFilePaths(_0x877250[_0x14ee81(0x1d9)]),_0x3187ec=[];function _0x51360a(_0x4f46ec){const _0x303578=_0x14ee81,_0x23114f=readdirSync(_0x4f46ec,{'withFileTypes':!![]})[_0x303578(0x1d1)]((_0xf8a46a,_0xcd2f7b)=>_0xf8a46a['name'][_0x303578(0x1c7)](_0xcd2f7b[_0x303578(0x1d0)]));for(const _0x461f28 of _0x23114f){if(_0x461f28[_0x303578(0x1f3)]()&&IGNORED_DIR_NAMES[_0x303578(0x1eb)](_0x461f28[_0x303578(0x1d0)]))continue;if(IGNORED_FILE_NAMES[_0x303578(0x1eb)](_0x461f28['name']))continue;const _0x404215=resolve(_0x4f46ec,_0x461f28['name']);if(isExcludedFilePath(_0x404215,_0x3603b1))continue;if(_0x461f28[_0x303578(0x1d3)]())throw CliErrors[_0x303578(0x1f2)](_0x303578(0x1e3)+_0x404215);const _0x29957f=toPosixPath(relative(_0x2cdc11,_0x404215));if(_0x461f28[_0x303578(0x1f3)]()){_0x51360a(_0x404215);continue;}if(!_0x461f28[_0x303578(0x1d7)]())continue;validateSkillRelativePath(_0x29957f);const _0x550a54=readFileSync(_0x404215);_0x3187ec[_0x303578(0x1ce)]({'path':_0x29957f,'bytes':_0x550a54});}}return _0x51360a(_0x2cdc11),normalizeLocalFiles(_0x3187ec);}function canonicalExcludedFilePaths(_0x19f46d){const _0x1c777c=a167_0x574c,_0x2fa203=new Set();for(const _0x13a47f of _0x19f46d??[]){const _0x3c0f3c=resolve(_0x13a47f);_0x2fa203[_0x1c777c(0x1ef)](_0x3c0f3c);try{_0x2fa203[_0x1c777c(0x1ef)](realpathSync(_0x3c0f3c));}catch{}}return _0x2fa203;}function isExcludedFilePath(_0x4a44a4,_0x26642f){const _0x11fbe3=a167_0x574c;if(_0x26642f['has'](_0x4a44a4))return!![];if(_0x26642f['size']===0x0)return![];try{return _0x26642f[_0x11fbe3(0x1eb)](realpathSync(_0x4a44a4));}catch{return![];}}export function compareSkillFiles(_0x86a636,_0x3c7b7e){const _0x4dd3d9=a167_0x574c;if(_0x86a636[_0x4dd3d9(0x1ea)]===SKILL_FILE)return _0x3c7b7e[_0x4dd3d9(0x1ea)]===SKILL_FILE?0x0:-0x1;if(_0x3c7b7e[_0x4dd3d9(0x1ea)]===SKILL_FILE)return 0x1;return Buffer[_0x4dd3d9(0x1cb)](Buffer[_0x4dd3d9(0x1dc)](_0x86a636['path'],_0x4dd3d9(0x1dd)),Buffer[_0x4dd3d9(0x1dc)](_0x3c7b7e[_0x4dd3d9(0x1ea)],'utf8'));}export function normalizeSkillRelativePath(_0x375c8b){const _0x75295c=toPosixPath(_0x375c8b['trim']());return validateSkillRelativePath(_0x75295c),_0x75295c;}export function validateSkillRelativePath(_0x1ffaba){const _0xa029ad=a167_0x574c;if(!_0x1ffaba||_0x1ffaba[_0xa029ad(0x1f0)]('/')||_0x1ffaba[_0xa029ad(0x1d4)]('//'))throw CliErrors[_0xa029ad(0x1f2)](_0xa029ad(0x1db)+_0x1ffaba);for(const _0x42366a of _0x1ffaba[_0xa029ad(0x1ca)]('/')){if(!_0x42366a||_0x42366a==='.'||_0x42366a==='..')throw CliErrors[_0xa029ad(0x1f2)]('Unsafe\x20Skill\x20file\x20path:\x20'+_0x1ffaba);}}function a167_0x1015(){const _0x51e2b5=['isSymbolicLink','includes','set','555jKWngK','isFile','10CcPvOO','excludedFilePaths','toLowerCase','Unsafe\x20Skill\x20file\x20path:\x20','from','utf8','size','values','sha256','length','Duplicate\x20Skill\x20file\x20path:\x20','Skill\x20directory\x20contains\x20unsupported\x20symlink:\x20','content','5039268WKhImU','2257542HZxvJv','string','20ycbneT','8327823BLRKfB','path','has','toString','Skill\x20file\x20path\x20must\x20be\x20text.','Skill\x20file\x20sha256\x20is\x20invalid:\x20','add','startsWith','51523677ywQyXe','validation','isDirectory','test','localeCompare','515504LZCHQx','46204nmxwJE','split','compare','isSafeInteger','isArray','push','101858mfexqy','name','sort','bytes'];a167_0x1015=function(){return _0x51e2b5;};return a167_0x1015();}export function toPosixPath(_0x515376){return _0x515376['replace'](/\\/g,'/');}export function isSha256Hex(_0x2a7a3f){const _0x3f0cac=a167_0x574c;return typeof _0x2a7a3f==='string'&&/^[a-fA-F0-9]{64}$/[_0x3f0cac(0x1c6)](_0x2a7a3f);}
1
+ import{readFileSync,readdirSync,realpathSync}from"node:fs";import{relative,resolve}from"node:path";import{CliErrors}from"../../errors.js";import{IGNORED_DIR_NAMES,IGNORED_FILE_NAMES,SKILL_FILE}from"./constants.js";export function fileContent(file){return file.bytes??Buffer.from(file.content??"","utf8")}export function fileText(file){return fileContent(file).toString("utf8")}export function normalizeLocalFiles(files){if(!Array.isArray(files)||files.length===0){return[]}const normalized=new Map;for(const file of files){if(!file||typeof file!=="object"||typeof file.path!=="string"){throw CliErrors.validation("Skill file path must be text.")}const path=normalizeSkillRelativePath(file.path);if(normalized.has(path)){throw CliErrors.validation(`Duplicate Skill file path: ${path}`)}if(file.bytes!==undefined&&!Buffer.isBuffer(file.bytes)){throw CliErrors.validation(`Skill file bytes must be a Buffer: ${path}`)}if(file.bytes===undefined&&typeof file.content!=="string"){
2
+ throw CliErrors.validation(`Skill file content must be text or bytes: ${path}`)}const bytes=fileContent(file);normalized.set(path,{path:path,bytes:bytes})}return Array.from(normalized.values()).sort(compareSkillFiles)}export function normalizeManifestFiles(files){if(!Array.isArray(files)||files.length===0){return[]}const normalized=new Map;for(const file of files){if(!file||typeof file!=="object"||typeof file.path!=="string"){throw CliErrors.validation("Skill file path must be text.")}const path=normalizeSkillRelativePath(file.path);if(normalized.has(path)){throw CliErrors.validation(`Duplicate Skill file path: ${path}`)}if(!isSha256Hex(file.sha256)){throw CliErrors.validation(`Skill file sha256 is invalid: ${path}`)}if(!Number.isSafeInteger(file.size)||file.size<0){throw CliErrors.validation(`Skill file size is invalid: ${path}`)}normalized.set(path,{path:path,sha256:file.sha256.toLowerCase(),size:file.size})}return Array.from(normalized.values()).sort(compareSkillFiles)}
3
+ export function scanSkillDirectory(dir,options={}){const root=realpathSync(dir);const excludedFilePaths=canonicalExcludedFilePaths(options.excludedFilePaths);const files=[];function visit(current){const entries=readdirSync(current,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name));for(const entry of entries){if(entry.isDirectory()&&IGNORED_DIR_NAMES.has(entry.name)){continue}if(IGNORED_FILE_NAMES.has(entry.name)){continue}const absolutePath=resolve(current,entry.name);if(isExcludedFilePath(absolutePath,excludedFilePaths)){continue}if(entry.isSymbolicLink()){throw CliErrors.validation(`Skill directory contains unsupported symlink: ${absolutePath}`)}const relativePath=toPosixPath(relative(root,absolutePath));if(entry.isDirectory()){visit(absolutePath);continue}if(!entry.isFile()){continue}validateSkillRelativePath(relativePath);const buffer=readFileSync(absolutePath);files.push({path:relativePath,bytes:buffer})}}visit(root);return normalizeLocalFiles(files)}
4
+ function canonicalExcludedFilePaths(paths){const excluded=new Set;for(const path of paths??[]){const absolutePath=resolve(path);excluded.add(absolutePath);try{excluded.add(realpathSync(absolutePath))}catch{}}return excluded}function isExcludedFilePath(absolutePath,excluded){if(excluded.has(absolutePath))return true;if(excluded.size===0)return false;try{return excluded.has(realpathSync(absolutePath))}catch{return false}}export function compareSkillFiles(a,b){if(a.path===SKILL_FILE)return b.path===SKILL_FILE?0:-1;if(b.path===SKILL_FILE)return 1;return Buffer.compare(Buffer.from(a.path,"utf8"),Buffer.from(b.path,"utf8"))}export function normalizeSkillRelativePath(path){const normalized=toPosixPath(path.trim());validateSkillRelativePath(normalized);return normalized}export function validateSkillRelativePath(path){if(!path||path.startsWith("/")||path.includes("//")){throw CliErrors.validation(`Unsafe Skill file path: ${path}`)}for(const segment of path.split("/")){
5
+ if(!segment||segment==="."||segment===".."){throw CliErrors.validation(`Unsafe Skill file path: ${path}`)}}}export function toPosixPath(path){return path.replace(/\\/g,"/")}export function isSha256Hex(value){return typeof value==="string"&&/^[a-fA-F0-9]{64}$/.test(value)}
@@ -1 +1,9 @@
1
- function a168_0x54c2(_0x277423,_0xc95375){_0x277423=_0x277423-0x152;const _0x5c2431=a168_0x5c24();let _0x54c24e=_0x5c2431[_0x277423];return _0x54c24e;}(function(_0x5d8288,_0x48be12){const _0x97792e=a168_0x54c2,_0x143466=_0x5d8288();while(!![]){try{const _0x430ab8=parseInt(_0x97792e(0x172))/0x1*(parseInt(_0x97792e(0x183))/0x2)+parseInt(_0x97792e(0x162))/0x3+-parseInt(_0x97792e(0x18c))/0x4*(parseInt(_0x97792e(0x163))/0x5)+parseInt(_0x97792e(0x153))/0x6*(parseInt(_0x97792e(0x186))/0x7)+parseInt(_0x97792e(0x161))/0x8*(-parseInt(_0x97792e(0x190))/0x9)+-parseInt(_0x97792e(0x191))/0xa+-parseInt(_0x97792e(0x16e))/0xb*(parseInt(_0x97792e(0x18d))/0xc);if(_0x430ab8===_0x48be12)break;else _0x143466['push'](_0x143466['shift']());}catch(_0x2f5271){_0x143466['push'](_0x143466['shift']());}}}(a168_0x5c24,0x96be5));import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from'node:fs';import{dirname,resolve}from'node:path';import{isCollection,isMap,isNode,parseDocument,visit}from'yaml';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{resolveManagedFilePath,writeBytesAtomic,writeJsonAtomic}from'./fs-utils.js';import{bufferSha256,contentHash,fileHash}from'./hashing.js';import{fileContent,fileText,normalizeLocalFiles}from'./local-files.js';import{buildMetadata,readMetadataIfPresent,requireSkillCode}from'./metadata.js';import{getRuntimeSkillDir}from'./paths.js';import{extractDownloadedPackage,requirePackageBytes}from'./zip-package.js';export function materializeRuntimeSkill(_0x208596,_0x286599,_0x5ed435){const _0x29a489=a168_0x54c2,_0x45e19e=requireSkillCode(_0x208596),_0x5cb1c4=requirePackageBytes(_0x45e19e,_0x5ed435[_0x29a489(0x17a)]),_0x17834e=extractDownloadedPackage(_0x5cb1c4),_0x422cb5=_0x17834e[_0x29a489(0x16c)](_0x371863=>_0x371863[_0x29a489(0x155)]===SKILL_FILE);if(!_0x422cb5)throw CliErrors[_0x29a489(0x169)](_0x29a489(0x189)+SKILL_FILE+':\x20'+_0x45e19e);const _0x336742=withMaterializedSkillFrontmatter(_0x17834e,_0x208596,_0x45e19e),_0x3b1cd6=_0x336742[_0x29a489(0x16c)](_0x12cf52=>_0x12cf52['path']===SKILL_FILE),_0x2e944e=fileText(_0x3b1cd6),_0x39917e=getRuntimeSkillDir(_0x5ed435[_0x29a489(0x15f)],_0x5ed435[_0x29a489(0x179)],_0x5ed435[_0x29a489(0x174)],_0x286599,_0x45e19e,_0x5ed435['paths']),_0x568c74=resolve(_0x39917e,SKILL_FILE),_0x21c1f4=resolve(_0x39917e,METADATA_FILE),_0x44813d=contentHash(_0x2e944e),_0x3259d8=readMetadataIfPresent(_0x21c1f4)?.['fileHashes'];ensurePulledFilesCanBeOverwritten(_0x39917e,_0x21c1f4,_0x336742,_0x5ed435['force']===!![]),mkdirSync(_0x39917e,{'recursive':!![],'mode':0x1c0});const _0xcb959=existsSync(_0x568c74)?readFileSync(_0x568c74,_0x29a489(0x192)):undefined;return materializeFiles(_0x39917e,_0x336742),removeStaleManagedFiles(_0x39917e,_0x3259d8,_0x336742),writeJsonAtomic(_0x21c1f4,buildMetadata(_0x208596,_0x286599,_0x5ed435[_0x29a489(0x174)],_0x44813d,_0x5ed435[_0x29a489(0x175)],_0x336742,_0x5cb1c4)),{'skill':_0x208596,'scope':_0x286599,'dir':_0x39917e,'skillMdPath':_0x568c74,'metadataPath':_0x21c1f4,'contentHash':_0x44813d,'changed':_0xcb959!==_0x2e944e};}function a168_0x5c24(){const _0x529f9f=['.\x20Changed\x20file:\x20','827lugwTm','version','appCode','pulledAt','keys','join','filter','accessKey','packageBytes','displayName','stringify','example','status','Managed\x20file\x20was\x20removed\x20locally:\x20','hasOwn','name:\x20','skillName','2586TTVQeF','Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','11123HRZTul','schemaVersion','---\x0a','Runtime\x20Skill\x20package\x20is\x20missing\x20','replace','entries','136144ZkRMJF','912HFVrXD','contentHash','scope','945vtBNAs','2951560gcWYjK','utf8','length','toString','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.','2058HWbOFQ','description','path','Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20','contents','---','match','trim','map','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20','isFile','test','env','Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20','39016AqqWrV','1909068xkDVAp','110QVLFEA','description:\x20','fileHashes','name','slice','skillCode','validation','trimEnd','errors','find','has','11176oaQqoV','displayName:\x20','flow'];a168_0x5c24=function(){return _0x529f9f;};return a168_0x5c24();}export function reuseMaterializedRuntimeSkill(_0x1b7d99,_0xa58299,_0x566962){const _0x4ebb08=a168_0x54c2,_0x3c64fc=_0x1b7d99[_0x4ebb08(0x173)]?.[_0x4ebb08(0x15a)]();if(!_0x3c64fc)return undefined;const _0x2dbc6b=requireSkillCode(_0x1b7d99),_0x31678d=getRuntimeSkillDir(_0x566962[_0x4ebb08(0x15f)],_0x566962[_0x4ebb08(0x179)],_0x566962['appCode'],_0xa58299,_0x2dbc6b,_0x566962['paths']),_0x543fce=resolve(_0x31678d,SKILL_FILE),_0x969cc3=resolve(_0x31678d,METADATA_FILE),_0x1c28e9=readMetadataIfPresent(_0x969cc3);if(!_0x1c28e9||_0x1c28e9[_0x4ebb08(0x187)]!==0x2||_0x1c28e9[_0x4ebb08(0x174)]!==_0x566962['appCode']||_0x1c28e9[_0x4ebb08(0x18f)]!==_0xa58299||_0x1c28e9[_0x4ebb08(0x168)]!==_0x2dbc6b||_0x1c28e9['version']!==_0x3c64fc||_0x1c28e9['id']!==_0x1b7d99['id']||_0x1c28e9[_0x4ebb08(0x182)]!==_0x1b7d99['skillName']||_0x1c28e9[_0x4ebb08(0x154)]!==_0x1b7d99[_0x4ebb08(0x154)]||_0x1c28e9[_0x4ebb08(0x17d)]!==_0x1b7d99['example']||_0x1c28e9[_0x4ebb08(0x17e)]!==_0x1b7d99['status']||!_0x1c28e9[_0x4ebb08(0x18e)]||!_0x1c28e9[_0x4ebb08(0x165)]||!Object[_0x4ebb08(0x180)](_0x1c28e9[_0x4ebb08(0x165)],SKILL_FILE))return undefined;for(const [_0x3e53f2,_0x5009f1]of Object[_0x4ebb08(0x18b)](_0x1c28e9[_0x4ebb08(0x165)])){if(!/^[a-f0-9]{64}$/[_0x4ebb08(0x15e)](_0x5009f1))return undefined;const _0x11b036=resolveManagedFilePath(_0x31678d,_0x3e53f2);if(!existsSync(_0x11b036)||!lstatSync(_0x11b036)[_0x4ebb08(0x15d)]())return undefined;if(bufferSha256(readFileSync(_0x11b036))!==_0x5009f1)return undefined;}return{'skill':_0x1b7d99,'scope':_0xa58299,'dir':_0x31678d,'skillMdPath':_0x543fce,'metadataPath':_0x969cc3,'contentHash':_0x1c28e9[_0x4ebb08(0x18e)],'changed':![]};}function withMaterializedSkillFrontmatter(_0x574a2a,_0x64b3f5,_0x2f97a7){const _0x472a4b=a168_0x54c2,_0x4cfe29=skillDisplayName(_0x64b3f5,_0x2f97a7),_0x22ff35=_0x64b3f5[_0x472a4b(0x154)]?.[_0x472a4b(0x15a)]()||_0x4cfe29||_0x2f97a7;return normalizeLocalFiles(_0x574a2a)[_0x472a4b(0x15b)](_0x3565cc=>{const _0x20e759=_0x472a4b,_0x31fbf8=fileText(_0x3565cc);if(_0x3565cc['path']!==SKILL_FILE)return _0x3565cc;if(hasYamlFrontmatter(_0x31fbf8))return{'path':_0x3565cc[_0x20e759(0x155)],'content':withSyncedDisplayName(_0x31fbf8,_0x4cfe29)};return{'path':_0x3565cc[_0x20e759(0x155)],'content':prependSkillFrontmatter(_0x31fbf8,{'name':_0x2f97a7,'displayName':_0x4cfe29,'description':_0x22ff35})};});}function hasYamlFrontmatter(_0x67c02b){return/^\uFEFF?---\s*\r?\n/['test'](_0x67c02b);}function prependSkillFrontmatter(_0x4b5de6,_0x2dd018){const _0x5cbf12=a168_0x54c2,_0xc55e8b=_0x4b5de6['replace'](/^\uFEFF/,'');return[_0x5cbf12(0x158),_0x5cbf12(0x181)+yamlString(_0x2dd018[_0x5cbf12(0x166)]),_0x2dd018[_0x5cbf12(0x17b)]?_0x5cbf12(0x16f)+yamlString(_0x2dd018['displayName']):undefined,_0x5cbf12(0x164)+yamlString(_0x2dd018[_0x5cbf12(0x154)]),_0x5cbf12(0x158),'',_0xc55e8b][_0x5cbf12(0x178)](_0x44cc58=>_0x44cc58!==undefined)[_0x5cbf12(0x177)]('\x0a');}function yamlString(_0x74addb){const _0x5b8523=a168_0x54c2;return JSON[_0x5b8523(0x17c)](_0x74addb[_0x5b8523(0x18a)](/\r/g,'')[_0x5b8523(0x15a)]());}function skillDisplayName(_0x109126,_0x2ed62b){const _0x9f6ca6=a168_0x54c2,_0x2557fe=_0x109126['skillName']?.[_0x9f6ca6(0x15a)]();return _0x2557fe||_0x2ed62b;}function withSyncedDisplayName(_0x2a99d2,_0x5115ba){const _0x6d9db4=a168_0x54c2,_0x3b3896=_0x2a99d2[_0x6d9db4(0x159)](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x3b3896)return _0x2a99d2;const _0x9ee41d=_0x3b3896[0x1]??'',_0x16f6c4=_0x3b3896[0x2]??'',_0xea90ea=parseDocument(_0x16f6c4);if(_0xea90ea[_0x6d9db4(0x16b)][_0x6d9db4(0x193)]>0x0||!isMap(_0xea90ea[_0x6d9db4(0x157)]))return _0x2a99d2;if(_0x5115ba)_0xea90ea['set'](_0x6d9db4(0x17b),_0x5115ba);else{if(_0xea90ea[_0x6d9db4(0x16d)](_0x6d9db4(0x17b)))_0xea90ea['delete'](_0x6d9db4(0x17b));else return _0x2a99d2;}forceBlockCollections(_0xea90ea['contents']);const _0xbeca9d=_0xea90ea[_0x6d9db4(0x194)]({'lineWidth':0x0})[_0x6d9db4(0x16a)](),_0x450abb=_0x2a99d2[_0x6d9db4(0x167)](_0x3b3896[0x0]['length'])['replace'](/^\r?\n/,'');return _0x9ee41d+_0x6d9db4(0x188)+_0xbeca9d+'\x0a---\x0a\x0a'+_0x450abb;}function forceBlockCollections(_0x26daa2){if(!isNode(_0x26daa2))return;visit(_0x26daa2,(_0x5617d4,_0x5d4152)=>{const _0x34ebe2=a168_0x54c2;isCollection(_0x5d4152)&&(_0x5d4152[_0x34ebe2(0x170)]=![]);});}function ensurePulledFilesCanBeOverwritten(_0x14fe2e,_0x5c6cfb,_0x5afabf,_0x51fd8b){const _0x167714=a168_0x54c2;if(_0x51fd8b||!existsSync(_0x5c6cfb))return;const _0x380bb7=readMetadataIfPresent(_0x5c6cfb);if(!_0x380bb7)return;const _0x54acdb=_0x380bb7['fileHashes']&&Object[_0x167714(0x176)](_0x380bb7[_0x167714(0x165)])[_0x167714(0x193)]>0x0?_0x380bb7[_0x167714(0x165)]:undefined;if(_0x54acdb)for(const [_0x5f2242,_0x2fb184]of Object[_0x167714(0x18b)](_0x54acdb)){const _0x278b2e=resolveManagedFilePath(_0x14fe2e,_0x5f2242);if(!existsSync(_0x278b2e))throw CliErrors[_0x167714(0x169)](_0x167714(0x15c)+_0x14fe2e,_0x167714(0x17f)+_0x5f2242);const _0x382c07=lstatSync(_0x278b2e);if(!_0x382c07[_0x167714(0x15d)]())throw CliErrors[_0x167714(0x169)](_0x167714(0x15c)+_0x14fe2e,'Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20'+_0x5f2242);const _0x3b458b=bufferSha256(readFileSync(_0x278b2e));if(_0x3b458b!==_0x2fb184)throw CliErrors[_0x167714(0x169)]('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x14fe2e+_0x167714(0x171)+_0x5f2242,_0x167714(0x185)+_0x5f2242);}else{const _0x2d8470=resolve(_0x14fe2e,SKILL_FILE);if(existsSync(_0x2d8470)&&_0x380bb7['contentHash']){const _0x256896=contentHash(readFileSync(_0x2d8470,_0x167714(0x192)));if(_0x256896!==_0x380bb7['contentHash'])throw CliErrors[_0x167714(0x169)](_0x167714(0x156)+_0x2d8470,_0x167714(0x152));}}for(const _0x3bcdbf of normalizeLocalFiles(_0x5afabf)){if(_0x54acdb?.[_0x3bcdbf[_0x167714(0x155)]])continue;if(!_0x54acdb&&_0x3bcdbf[_0x167714(0x155)]===SKILL_FILE)continue;const _0xd093b0=resolveManagedFilePath(_0x14fe2e,_0x3bcdbf[_0x167714(0x155)]);if(!existsSync(_0xd093b0))continue;const _0x535885=lstatSync(_0xd093b0);if(!_0x535885[_0x167714(0x15d)]())throw CliErrors['validation'](_0x167714(0x15c)+_0x14fe2e,_0x167714(0x160)+_0x3bcdbf[_0x167714(0x155)]);const _0x5480fe=bufferSha256(readFileSync(_0xd093b0));if(_0x5480fe!==fileHash(_0x3bcdbf))throw CliErrors[_0x167714(0x169)]('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x14fe2e,_0x167714(0x184)+_0x3bcdbf['path']);}}function materializeFiles(_0x1651ab,_0x3f99be){for(const _0x1b08db of normalizeLocalFiles(_0x3f99be)){const _0x19a9c2=resolveManagedFilePath(_0x1651ab,_0x1b08db['path']);mkdirSync(dirname(_0x19a9c2),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x19a9c2,fileContent(_0x1b08db),0x180);}}function removeStaleManagedFiles(_0x46c99b,_0x3839dd,_0x51a58b){const _0x145725=a168_0x54c2;if(!_0x3839dd)return;const _0x2e8571=new Set(normalizeLocalFiles(_0x51a58b)['map'](_0x1de735=>_0x1de735[_0x145725(0x155)]));for(const _0x7b2276 of Object[_0x145725(0x176)](_0x3839dd)){if(_0x2e8571[_0x145725(0x16d)](_0x7b2276))continue;const _0x37cd45=resolveManagedFilePath(_0x46c99b,_0x7b2276);existsSync(_0x37cd45)&&lstatSync(_0x37cd45)[_0x145725(0x15d)]()&&rmSync(_0x37cd45,{'force':!![]});}}
1
+ import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from"node:fs";import{dirname,resolve}from"node:path";import{isCollection,isMap,isNode,parseDocument,visit}from"yaml";import{CliErrors}from"../../errors.js";import{METADATA_FILE,SKILL_FILE}from"./constants.js";import{resolveManagedFilePath,writeBytesAtomic,writeJsonAtomic}from"./fs-utils.js";import{bufferSha256,contentHash,fileHash}from"./hashing.js";import{fileContent,fileText,normalizeLocalFiles}from"./local-files.js";import{buildMetadata,readMetadataIfPresent,requireSkillCode}from"./metadata.js";import{getRuntimeSkillDir}from"./paths.js";import{extractDownloadedPackage,requirePackageBytes}from"./zip-package.js";export function materializeRuntimeSkill(skill,scope,options){const skillCode=requireSkillCode(skill);const packageBytes=requirePackageBytes(skillCode,options.packageBytes);const effectiveFiles=extractDownloadedPackage(packageBytes);const mainFile=effectiveFiles.find(file=>file.path===SKILL_FILE);if(!mainFile){
2
+ throw CliErrors.validation(`Runtime Skill package is missing ${SKILL_FILE}: ${skillCode}`)}const materializedFiles=withMaterializedSkillFrontmatter(effectiveFiles,skill,skillCode);const materializedMainFile=materializedFiles.find(file=>file.path===SKILL_FILE);const content=fileText(materializedMainFile);const dir=getRuntimeSkillDir(options.env,options.accessKey,options.appCode,scope,skillCode,options.paths);const skillMdPath=resolve(dir,SKILL_FILE);const metadataPath=resolve(dir,METADATA_FILE);const hash=contentHash(content);const previousFiles=readMetadataIfPresent(metadataPath)?.fileHashes;ensurePulledFilesCanBeOverwritten(dir,metadataPath,materializedFiles,options.force===true);mkdirSync(dir,{recursive:true,mode:448});const previous=existsSync(skillMdPath)?readFileSync(skillMdPath,"utf8"):undefined;materializeFiles(dir,materializedFiles);removeStaleManagedFiles(dir,previousFiles,materializedFiles)
3
+ ;writeJsonAtomic(metadataPath,buildMetadata(skill,scope,options.appCode,hash,options.pulledAt,materializedFiles,packageBytes));return{skill:skill,scope:scope,dir:dir,skillMdPath:skillMdPath,metadataPath:metadataPath,contentHash:hash,changed:previous!==content}}export function reuseMaterializedRuntimeSkill(skill,scope,options){const version=skill.version?.trim();if(!version)return undefined;const skillCode=requireSkillCode(skill);const dir=getRuntimeSkillDir(options.env,options.accessKey,options.appCode,scope,skillCode,options.paths);const skillMdPath=resolve(dir,SKILL_FILE);const metadataPath=resolve(dir,METADATA_FILE);const metadata=readMetadataIfPresent(metadataPath)
4
+ ;if(!metadata||metadata.schemaVersion!==2||metadata.appCode!==options.appCode||metadata.scope!==scope||metadata.skillCode!==skillCode||metadata.version!==version||metadata.id!==skill.id||metadata.skillName!==skill.skillName||metadata.description!==skill.description||metadata.example!==skill.example||metadata.status!==skill.status||!metadata.contentHash||!metadata.fileHashes||!Object.hasOwn(metadata.fileHashes,SKILL_FILE)){return undefined}for(const[path,expectedHash]of Object.entries(metadata.fileHashes)){if(!/^[a-f0-9]{64}$/.test(expectedHash))return undefined;const filePath=resolveManagedFilePath(dir,path);if(!existsSync(filePath)||!lstatSync(filePath).isFile())return undefined;if(bufferSha256(readFileSync(filePath))!==expectedHash)return undefined}return{skill:skill,scope:scope,dir:dir,skillMdPath:skillMdPath,metadataPath:metadataPath,contentHash:metadata.contentHash,changed:false}}function withMaterializedSkillFrontmatter(files,skill,skillCode){
5
+ const displayName=skillDisplayName(skill,skillCode);const description=skill.description?.trim()||displayName||skillCode;return normalizeLocalFiles(files).map(file=>{const content=fileText(file);if(file.path!==SKILL_FILE)return file;if(hasYamlFrontmatter(content)){return{path:file.path,content:withSyncedDisplayName(content,displayName)}}return{path:file.path,content:prependSkillFrontmatter(content,{name:skillCode,displayName:displayName,description:description})}})}function hasYamlFrontmatter(content){return/^\uFEFF?---\s*\r?\n/.test(content)}function prependSkillFrontmatter(content,frontmatter){const body=content.replace(/^\uFEFF/,"");return["---",`name: ${yamlString(frontmatter.name)}`,frontmatter.displayName?`displayName: ${yamlString(frontmatter.displayName)}`:undefined,`description: ${yamlString(frontmatter.description)}`,"---","",body].filter(line=>line!==undefined).join("\n")}function yamlString(value){return JSON.stringify(value.replace(/\r/g,"").trim())}
6
+ function skillDisplayName(skill,skillCode){const skillName=skill.skillName?.trim();return skillName||skillCode}function withSyncedDisplayName(content,displayName){const match=content.match(/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!match)return content;const bom=match[1]??"";const yaml=match[2]??"";const document=parseDocument(yaml);if(document.errors.length>0||!isMap(document.contents)){return content}if(displayName){document.set("displayName",displayName)}else if(document.has("displayName")){document.delete("displayName")}else{return content}forceBlockCollections(document.contents);const frontmatter=document.toString({lineWidth:0}).trimEnd();const body=content.slice(match[0].length).replace(/^\r?\n/,"");return`${bom}---\n${frontmatter}\n---\n\n${body}`}function forceBlockCollections(node){if(!isNode(node))return;visit(node,(_key,value)=>{if(isCollection(value)){value.flow=false}})}function ensurePulledFilesCanBeOverwritten(dir,metadataPath,nextFiles,force){
7
+ if(force||!existsSync(metadataPath)){return}const metadata=readMetadataIfPresent(metadataPath);if(!metadata)return;const previousFileHashes=metadata.fileHashes&&Object.keys(metadata.fileHashes).length>0?metadata.fileHashes:undefined;if(previousFileHashes){for(const[path,expectedHash]of Object.entries(previousFileHashes)){const filePath=resolveManagedFilePath(dir,path);if(!existsSync(filePath)){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Managed file was removed locally: ${path}`)}const stat=lstatSync(filePath);if(!stat.isFile()){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Managed file is no longer a regular file: ${path}`)}const currentHash=bufferSha256(readFileSync(filePath));if(currentHash!==expectedHash){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}. Changed file: ${path}`,`Push the directory first, then rerun skill install. Changed file: ${path}`)}}}else{
8
+ const skillMdPath=resolve(dir,SKILL_FILE);if(existsSync(skillMdPath)&&metadata.contentHash){const currentHash=contentHash(readFileSync(skillMdPath,"utf8"));if(currentHash!==metadata.contentHash){throw CliErrors.validation(`Local SKILL.md has unpushed edits: ${skillMdPath}`,"Push the directory first, then rerun skill install.")}}}for(const nextFile of normalizeLocalFiles(nextFiles)){if(previousFileHashes?.[nextFile.path])continue;if(!previousFileHashes&&nextFile.path===SKILL_FILE)continue;const filePath=resolveManagedFilePath(dir,nextFile.path);if(!existsSync(filePath))continue;const stat=lstatSync(filePath);if(!stat.isFile()){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Remote Skill would overwrite a local non-file path: ${nextFile.path}`)}const currentHash=bufferSha256(readFileSync(filePath));if(currentHash!==fileHash(nextFile)){
9
+ throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Remote Skill would overwrite an unmanaged local file: ${nextFile.path}`)}}}function materializeFiles(dir,files){for(const file of normalizeLocalFiles(files)){const filePath=resolveManagedFilePath(dir,file.path);mkdirSync(dirname(filePath),{recursive:true,mode:448});writeBytesAtomic(filePath,fileContent(file),384)}}function removeStaleManagedFiles(dir,previousFileHashes,nextFiles){if(!previousFileHashes)return;const nextPaths=new Set(normalizeLocalFiles(nextFiles).map(file=>file.path));for(const previousPath of Object.keys(previousFileHashes)){if(nextPaths.has(previousPath))continue;const filePath=resolveManagedFilePath(dir,previousPath);if(existsSync(filePath)&&lstatSync(filePath).isFile()){rmSync(filePath,{force:true})}}}
@@ -1 +1,3 @@
1
- (function(_0x35d8c9,_0x20212a){const _0x2291d3=a169_0x3e9c,_0x185418=_0x35d8c9();while(!![]){try{const _0x3b17d1=parseInt(_0x2291d3(0x179))/0x1+parseInt(_0x2291d3(0x18c))/0x2+-parseInt(_0x2291d3(0x198))/0x3*(-parseInt(_0x2291d3(0x18e))/0x4)+-parseInt(_0x2291d3(0x184))/0x5+-parseInt(_0x2291d3(0x190))/0x6+-parseInt(_0x2291d3(0x17b))/0x7*(parseInt(_0x2291d3(0x191))/0x8)+parseInt(_0x2291d3(0x192))/0x9;if(_0x3b17d1===_0x20212a)break;else _0x185418['push'](_0x185418['shift']());}catch(_0x2c57c0){_0x185418['push'](_0x185418['shift']());}}}(a169_0x801c,0x79ff4));import{existsSync,readFileSync}from'node:fs';import{CliErrors}from'../../errors.js';import{METADATA_FILE}from'./constants.js';import{bufferSha256,fileHash,fileTreeHash}from'./hashing.js';import{fileContent,normalizeLocalFiles}from'./local-files.js';import{buildSkillPackage,localFilesToManifestFiles}from'./zip-package.js';function a169_0x3e9c(_0x3e8f3e,_0x2ad079){_0x3e8f3e=_0x3e8f3e-0x177;const _0x801c71=a169_0x801c();let _0x3e9c3c=_0x801c71[_0x3e8f3e];return _0x3e9c3c;}export function buildMetadata(_0x1e65ba,_0x3f841d,_0x3dc769,_0x1b82a1,_0x3224a6,_0x5eab39,_0x4568c2){const _0x351ba0=a169_0x3e9c,_0x508eef=_0x5eab39?normalizeLocalFiles(_0x5eab39):[],_0x51787b=!_0x4568c2&&_0x508eef[_0x351ba0(0x183)]>0x0?buildSkillPackage(_0x508eef):undefined,_0x52c724=_0x4568c2?bufferSha256(_0x4568c2):_0x51787b?.[_0x351ba0(0x182)]['zipSha256'],_0x40c2d1=_0x4568c2?.['length']??_0x51787b?.[_0x351ba0(0x182)][_0x351ba0(0x194)],_0x2dd1e8=_0x508eef[_0x351ba0(0x183)]>0x0?Object[_0x351ba0(0x181)](_0x508eef[_0x351ba0(0x185)](_0x39b347=>[_0x39b347['path'],fileHash(_0x39b347)])):undefined;return{'schemaVersion':_0x508eef[_0x351ba0(0x183)]>0x0?0x2:0x1,'id':_0x1e65ba['id'],'appCode':_0x3dc769,'skillCode':requireSkillCode(_0x1e65ba),'skillName':_0x1e65ba['skillName'],'description':_0x1e65ba['description'],'example':_0x1e65ba['example'],'scope':_0x3f841d,'readonly':_0x3f841d!==_0x351ba0(0x178)||_0x1e65ba[_0x351ba0(0x17e)]===!![],'tenantCode':_0x1e65ba[_0x351ba0(0x187)],'userId':_0x1e65ba[_0x351ba0(0x177)],'version':_0x1e65ba[_0x351ba0(0x17f)],'status':_0x1e65ba[_0x351ba0(0x197)],'tags':Array[_0x351ba0(0x18a)](_0x1e65ba['tags'])?_0x1e65ba[_0x351ba0(0x196)]:[],'hasUpstreamUpdate':_0x1e65ba[_0x351ba0(0x180)],'forkedFromSkillId':_0x1e65ba[_0x351ba0(0x189)],'forkedFromVersion':_0x1e65ba['forkedFromVersion'],'sourceSessionId':_0x1e65ba['sourceSessionId'],'contentHash':_0x1b82a1,'fileHashes':_0x2dd1e8,'treeHash':_0x508eef['length']>0x0?fileTreeHash(localFilesToManifestFiles(_0x508eef)):undefined,'ossPath':remoteManifestOssPath(_0x1e65ba[_0x351ba0(0x195)]),'zipSha256':_0x52c724,'zipSize':_0x40c2d1,'files':_0x508eef[_0x351ba0(0x183)]>0x0?_0x508eef['map'](_0x1f4eaa=>({'path':_0x1f4eaa['path'],'hash':fileHash(_0x1f4eaa),'size':fileContent(_0x1f4eaa)[_0x351ba0(0x183)]})):undefined,'pulledAt':_0x3224a6??new Date()[_0x351ba0(0x193)]()};}export function requireSkillCode(_0x11985b){const _0x325822=a169_0x3e9c,_0x8eb8c8=_0x11985b[_0x325822(0x18b)]?.[_0x325822(0x17d)]();if(!_0x8eb8c8)throw CliErrors[_0x325822(0x18f)]('Runtime\x20Skill\x20is\x20missing\x20skillCode.');return _0x8eb8c8;}function a169_0x801c(){const _0x2d7a87=['35Opucim','Invalid\x20','trim','readonly','version','hasUpstreamUpdate','fromEntries','manifest','length','2792200maYaJl','map','object','tenantCode','utf8','forkedFromSkillId','isArray','skillCode','523090tXSDWe','string','9956iLcQOt','validation','5855538jhpvzc','522720GoDuEi','6748749VquiVK','toISOString','zipSize','files','tags','status','609mdqKne','userId','personal','844090iUKFgm','parse'];a169_0x801c=function(){return _0x2d7a87;};return a169_0x801c();}export function readMetadataIfPresent(_0x45323a){const _0xe7a84e=a169_0x3e9c;if(!existsSync(_0x45323a))return undefined;try{const _0x4de162=JSON[_0xe7a84e(0x17a)](readFileSync(_0x45323a,_0xe7a84e(0x188)));return _0x4de162;}catch{throw CliErrors['validation'](_0xe7a84e(0x17c)+METADATA_FILE+':\x20'+_0x45323a);}}function remoteManifestOssPath(_0x6d1169){const _0x189889=a169_0x3e9c;if(!_0x6d1169||typeof _0x6d1169!==_0x189889(0x186)||Array[_0x189889(0x18a)](_0x6d1169))return undefined;const _0x1a2b98=_0x6d1169['ossPath'];return typeof _0x1a2b98===_0x189889(0x18d)&&_0x1a2b98[_0x189889(0x17d)]()?_0x1a2b98[_0x189889(0x17d)]():undefined;}
1
+ import{existsSync,readFileSync}from"node:fs";import{CliErrors}from"../../errors.js";import{METADATA_FILE}from"./constants.js";import{bufferSha256,fileHash,fileTreeHash}from"./hashing.js";import{fileContent,normalizeLocalFiles}from"./local-files.js";import{buildSkillPackage,localFilesToManifestFiles}from"./zip-package.js";export function buildMetadata(skill,scope,appCode,hash,pulledAt,files,packageBytes){const normalizedFiles=files?normalizeLocalFiles(files):[];const localPackage=!packageBytes&&normalizedFiles.length>0?buildSkillPackage(normalizedFiles):undefined;const packageSha256=packageBytes?bufferSha256(packageBytes):localPackage?.manifest.zipSha256;const packageSize=packageBytes?.length??localPackage?.manifest.zipSize;const fileHashes=normalizedFiles.length>0?Object.fromEntries(normalizedFiles.map(file=>[file.path,fileHash(file)])):undefined;return{schemaVersion:normalizedFiles.length>0?2:1,id:skill.id,appCode:appCode,skillCode:requireSkillCode(skill),skillName:skill.skillName,
2
+ description:skill.description,example:skill.example,scope:scope,readonly:scope!=="personal"||skill.readonly===true,tenantCode:skill.tenantCode,userId:skill.userId,version:skill.version,status:skill.status,tags:Array.isArray(skill.tags)?skill.tags:[],hasUpstreamUpdate:skill.hasUpstreamUpdate,forkedFromSkillId:skill.forkedFromSkillId,forkedFromVersion:skill.forkedFromVersion,sourceSessionId:skill.sourceSessionId,contentHash:hash,fileHashes:fileHashes,treeHash:normalizedFiles.length>0?fileTreeHash(localFilesToManifestFiles(normalizedFiles)):undefined,ossPath:remoteManifestOssPath(skill.files),zipSha256:packageSha256,zipSize:packageSize,files:normalizedFiles.length>0?normalizedFiles.map(file=>({path:file.path,hash:fileHash(file),size:fileContent(file).length})):undefined,pulledAt:pulledAt??(new Date).toISOString()}}export function requireSkillCode(skill){const skillCode=skill.skillCode?.trim();if(!skillCode){throw CliErrors.validation("Runtime Skill is missing skillCode.")}return skillCode
3
+ }export function readMetadataIfPresent(path){if(!existsSync(path))return undefined;try{const data=JSON.parse(readFileSync(path,"utf8"));return data}catch{throw CliErrors.validation(`Invalid ${METADATA_FILE}: ${path}`)}}function remoteManifestOssPath(manifest){if(!manifest||typeof manifest!=="object"||Array.isArray(manifest)){return undefined}const value=manifest.ossPath;return typeof value==="string"&&value.trim()?value.trim():undefined}
@@ -1 +1,2 @@
1
- (function(_0x2ac00d,_0x3cbab3){const _0x2fb8e6=a170_0x2787,_0x240d07=_0x2ac00d();while(!![]){try{const _0x1eced0=parseInt(_0x2fb8e6(0x1a0))/0x1+-parseInt(_0x2fb8e6(0x19e))/0x2+-parseInt(_0x2fb8e6(0x18f))/0x3+-parseInt(_0x2fb8e6(0x1a5))/0x4+-parseInt(_0x2fb8e6(0x19c))/0x5*(-parseInt(_0x2fb8e6(0x196))/0x6)+-parseInt(_0x2fb8e6(0x1a2))/0x7*(-parseInt(_0x2fb8e6(0x1a1))/0x8)+parseInt(_0x2fb8e6(0x19b))/0x9*(parseInt(_0x2fb8e6(0x198))/0xa);if(_0x1eced0===_0x3cbab3)break;else _0x240d07['push'](_0x240d07['shift']());}catch(_0x58a8b2){_0x240d07['push'](_0x240d07['shift']());}}}(a170_0x44e4,0xc15e5));import{existsSync}from'node:fs';import{homedir}from'node:os';import{resolve}from'node:path';function a170_0x2787(_0x35b086,_0x36e3ab){_0x35b086=_0x35b086-0x18e;const _0x44e495=a170_0x44e4();let _0x27878f=_0x44e495[_0x35b086];return _0x27878f;}import{fingerprintAccessKey}from'../../commands/app/cache.js';import{PRODUCT_CONFIG,productEnv}from'../../constant/product.js';import{CliErrors}from'../../errors.js';export function resolveSkillSyncPaths(_0xfbb924={}){const _0xb749f0=a170_0x2787,_0x17da3c=_0xfbb924['homeDir']??homedir(),_0x3c315=resolve(_0x17da3c,PRODUCT_CONFIG[_0xb749f0(0x199)],_0xb749f0(0x1a3)),_0x40d324=trimmedEnv(_0xb749f0(0x190)),_0x313c7b=trimmedEnv(_0xb749f0(0x1a4)),_0x50230a=resolve(_0x17da3c,_0xb749f0(0x192)),_0x3dea00=_0xfbb924['workbuddySkillsDir']??(existsSync(_0x50230a)?resolve(_0x50230a,_0xb749f0(0x191)):undefined);return{'homeDir':_0x17da3c,'cacheRoot':_0x3c315,'managedRoot':resolve(_0x17da3c,PRODUCT_CONFIG[_0xb749f0(0x199)]),'agentsSkillsDir':_0xfbb924[_0xb749f0(0x19a)]??_0x40d324??resolve(_0x17da3c,'.agents',_0xb749f0(0x191)),'claudeSkillsDir':_0xfbb924['claudeSkillsDir']??_0x313c7b??resolve(_0x17da3c,'.claude',_0xb749f0(0x191)),'workbuddySkillsDir':_0x3dea00};}export function runtimeAgentSkillRoots(_0x388f84){const _0x5d7f98=a170_0x2787;return[_0x388f84[_0x5d7f98(0x19a)],_0x388f84[_0x5d7f98(0x197)],_0x388f84[_0x5d7f98(0x1a6)]]['filter'](_0x3f22ec=>Boolean(_0x3f22ec));}export function getRuntimeSkillCacheRoot(_0x579470,_0x119c13,_0x5ebe02={}){const _0x281aad=a170_0x2787,_0x2c48c9=resolveSkillSyncPaths(_0x5ebe02);return resolve(_0x2c48c9['cacheRoot'],_0x579470,fingerprintAccessKey(_0x119c13),_0x281aad(0x191));}function a170_0x44e4(){const _0x487b19=['agentsSkillsDir','1531485JKLMxy','55ovjKbH','includes','1663902sWmzTV','Unsafe\x20','478762ESmBMV','144oLMEIm','339752YGtlnC','cache','CLAUDE_SKILL_ROOT','4146100ziDGek','workbuddySkillsDir','validation','3728493XeyOua','SKILL_ROOT','skills','.workbuddy','\x20for\x20local\x20path:\x20','trim','appCode','184794MtgOiK','claudeSkillsDir','130SXxnpB','homeDirName'];a170_0x44e4=function(){return _0x487b19;};return a170_0x44e4();}export function getRuntimeSkillDir(_0x1f188f,_0x5c9d25,_0x353ccc,_0x42706e,_0xabc54,_0x20218c={}){const _0xfa0508=a170_0x2787;return resolve(getRuntimeSkillCacheRoot(_0x1f188f,_0x5c9d25,_0x20218c),safePathSegment(_0x353ccc,_0xfa0508(0x195)),_0x42706e,safePathSegment(_0xabc54,'skillCode'));}export function safePathSegment(_0x4dcff8,_0x50fa2d='path\x20segment'){const _0x564061=a170_0x2787;if(!_0x4dcff8||_0x4dcff8['includes']('/')||_0x4dcff8['includes']('\x5c')||_0x4dcff8[_0x564061(0x19d)]('..'))throw CliErrors[_0x564061(0x18e)](_0x564061(0x19f)+_0x50fa2d+_0x564061(0x193)+_0x4dcff8);return _0x4dcff8;}function trimmedEnv(_0x157e43){const _0x4bc29f=a170_0x2787,_0x2d808b=productEnv(_0x157e43)?.[_0x4bc29f(0x194)]();return _0x2d808b?_0x2d808b:undefined;}
1
+ import{existsSync}from"node:fs";import{homedir}from"node:os";import{resolve}from"node:path";import{fingerprintAccessKey}from"../../commands/app/cache.js";import{PRODUCT_CONFIG,productEnv}from"../../constant/product.js";import{CliErrors}from"../../errors.js";export function resolveSkillSyncPaths(options={}){const home=options.homeDir??homedir();const cacheRoot=resolve(home,PRODUCT_CONFIG.homeDirName,"cache");const envAgentsSkillsDir=trimmedEnv("SKILL_ROOT");const envClaudeSkillsDir=trimmedEnv("CLAUDE_SKILL_ROOT");const workbuddyHome=resolve(home,".workbuddy");const workbuddySkillsDir=options.workbuddySkillsDir??(existsSync(workbuddyHome)?resolve(workbuddyHome,"skills"):undefined);return{homeDir:home,cacheRoot:cacheRoot,managedRoot:resolve(home,PRODUCT_CONFIG.homeDirName),agentsSkillsDir:options.agentsSkillsDir??envAgentsSkillsDir??resolve(home,".agents","skills"),claudeSkillsDir:options.claudeSkillsDir??envClaudeSkillsDir??resolve(home,".claude","skills"),
2
+ workbuddySkillsDir:workbuddySkillsDir}}export function runtimeAgentSkillRoots(paths){return[paths.agentsSkillsDir,paths.claudeSkillsDir,paths.workbuddySkillsDir].filter(path=>Boolean(path))}export function getRuntimeSkillCacheRoot(env,accessKey,options={}){const paths=resolveSkillSyncPaths(options);return resolve(paths.cacheRoot,env,fingerprintAccessKey(accessKey),"skills")}export function getRuntimeSkillDir(env,accessKey,appCode,scope,skillCode,options={}){return resolve(getRuntimeSkillCacheRoot(env,accessKey,options),safePathSegment(appCode,"appCode"),scope,safePathSegment(skillCode,"skillCode"))}export function safePathSegment(value,label="path segment"){if(!value||value.includes("/")||value.includes("\\")||value.includes("..")){throw CliErrors.validation(`Unsafe ${label} for local path: ${value}`)}return value}function trimmedEnv(name){const value=productEnv(name)?.trim();return value?value:undefined}
@@ -1 +1,8 @@
1
- (function(_0x591b9d,_0x14c1b2){const _0x56ddb1=a171_0x3a13,_0xea79cb=_0x591b9d();while(!![]){try{const _0x2aac47=-parseInt(_0x56ddb1(0x129))/0x1+parseInt(_0x56ddb1(0x153))/0x2+-parseInt(_0x56ddb1(0x13d))/0x3*(parseInt(_0x56ddb1(0x13f))/0x4)+parseInt(_0x56ddb1(0x15b))/0x5*(-parseInt(_0x56ddb1(0x155))/0x6)+-parseInt(_0x56ddb1(0x15e))/0x7*(-parseInt(_0x56ddb1(0x161))/0x8)+parseInt(_0x56ddb1(0x15f))/0x9*(-parseInt(_0x56ddb1(0x14a))/0xa)+parseInt(_0x56ddb1(0x14c))/0xb*(parseInt(_0x56ddb1(0x156))/0xc);if(_0x2aac47===_0x14c1b2)break;else _0xea79cb['push'](_0xea79cb['shift']());}catch(_0x1c7eca){_0xea79cb['push'](_0xea79cb['shift']());}}}(a171_0x326e,0x836c0));import{existsSync,lstatSync,readFileSync,realpathSync}from'node:fs';import{basename,resolve}from'node:path';import{parse as a171_0xec42c9}from'yaml';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{writeJsonAtomic}from'./fs-utils.js';import{contentHash}from'./hashing.js';import{fileText,normalizeLocalFiles,scanSkillDirectory}from'./local-files.js';import{buildMetadata,readMetadataIfPresent}from'./metadata.js';import{buildSkillPackage,tryNormalizePackageManifest}from'./zip-package.js';export function resolvePushDirectoryIdentity(_0x512bc4,_0x2b45ed,_0x12bf71={}){const _0x1660d9=a171_0x3a13,_0x91689=resolvePushDirectoryRoot(_0x512bc4),_0x3086d4=readPushMetadataIfPresent(resolve(_0x91689,METADATA_FILE),{'ignoreInvalidMetadata':_0x12bf71[_0x1660d9(0x127)]});if(_0x3086d4?.['appCode']&&_0x3086d4[_0x1660d9(0x123)]!==_0x2b45ed&&!_0x12bf71[_0x1660d9(0x14d)]&&!_0x12bf71[_0x1660d9(0x139)])throw CliErrors['validation'](_0x1660d9(0x121)+_0x3086d4[_0x1660d9(0x123)]+_0x1660d9(0x158)+_0x2b45ed+'\x22.');const _0x517324=resolvePushSkillCode(_0x91689,_0x2b45ed,_0x3086d4,_0x12bf71);if(!_0x517324)throw CliErrors['validation']('Unable\x20to\x20resolve\x20skillCode\x20from\x20'+SKILL_FILE+',\x20'+METADATA_FILE+_0x1660d9(0x124));return{'dir':_0x91689,'skillCode':_0x517324,'metadata':_0x3086d4};}export function readPushDirectory(_0x3ac1f6,_0xe6569e,_0x1c35df={}){const _0x1d5dac=a171_0x3a13,_0xc0a76a=resolvePushDirectoryIdentity(_0x3ac1f6,_0xe6569e,_0x1c35df),_0x456051=_0xc0a76a[_0x1d5dac(0x128)],_0x4abb27=resolve(_0x456051,SKILL_FILE);if(!existsSync(_0x4abb27)||!lstatSync(_0x4abb27)['isFile']())throw CliErrors[_0x1d5dac(0x138)](_0x1d5dac(0x13b)+SKILL_FILE+':\x20'+_0x4abb27);const _0x480abf=_0xc0a76a[_0x1d5dac(0x133)],_0x578b62=_0x1c35df[_0x1d5dac(0x157)]??'personal';if(!_0x1c35df[_0x1d5dac(0x154)]&&_0x480abf?.[_0x1d5dac(0x151)]===_0x1d5dac(0x12d))throw CliErrors[_0x1d5dac(0x138)]('Builtin\x20Skills\x20cannot\x20be\x20pushed;\x20'+METADATA_FILE+_0x1d5dac(0x12a)+_0x480abf[_0x1d5dac(0x151)]+'\x22.');if(!_0x1c35df[_0x1d5dac(0x154)]&&_0x578b62===_0x1d5dac(0x15d)&&_0x480abf?.[_0x1d5dac(0x151)]&&_0x480abf[_0x1d5dac(0x151)]!==_0x1d5dac(0x15d))throw CliErrors[_0x1d5dac(0x138)](_0x1d5dac(0x140)+METADATA_FILE+_0x1d5dac(0x12a)+_0x480abf['scope']+'\x22.','Use\x20lovrabet\x20skill\x20push\x20--scope\x20company\x20--dir\x20'+_0x456051+'\x20to\x20submit\x20company\x20Skills\x20for\x20review.');const _0x4ca426=scanSkillDirectory(_0x456051,{'excludedFilePaths':_0x1c35df[_0x1d5dac(0x148)]}),_0x4737ff=buildSkillPackage(_0x4ca426),_0x16f40e=readFileSync(_0x4abb27,_0x1d5dac(0x164)),_0x2c8a0b=_0xc0a76a['skillCode'],_0x44bb1b=_0x1c35df[_0x1d5dac(0x15c)]?undefined:_0x480abf,_0x24f8e4=readSkillDisplayName(_0x16f40e);return{'skillCode':_0x2c8a0b,'metadata':_0x480abf,'frontmatterDisplayName':_0x24f8e4,'input':{'skillCode':_0x2c8a0b,'skillName':_0x24f8e4??_0x44bb1b?.[_0x1d5dac(0x141)],'description':_0x44bb1b?.[_0x1d5dac(0x134)],'content':_0x16f40e,'files':_0x4737ff['manifest'],'packageBase64':_0x4737ff[_0x1d5dac(0x122)],'tags':_0x44bb1b?.['tags'],'version':_0x44bb1b?.['version'],'sourceSessionId':_0x44bb1b?.[_0x1d5dac(0x137)]}};}export function refreshPushDirectoryMetadataFromRemote(_0x4a0b42,_0x3e905a,_0x35d605,_0x1d4618={}){const _0x4b94cd=a171_0x3a13,_0x2aceeb=resolvePushDirectoryRoot(_0x4a0b42),_0x5a7ac6=readPushMetadataIfPresent(resolve(_0x2aceeb,METADATA_FILE),{'ignoreInvalidMetadata':!![]}),_0x59ad77=requireRemoteScope(_0x3e905a),_0x40ffed=readLocalSkillContent(_0x2aceeb),_0x201574={..._0x3e905a,'appCode':_0x3e905a[_0x4b94cd(0x123)]??_0x35d605,'skillName':_0x3e905a[_0x4b94cd(0x141)]??_0x5a7ac6?.[_0x4b94cd(0x141)],'description':_0x3e905a['description']??_0x5a7ac6?.[_0x4b94cd(0x134)],'example':_0x3e905a['example']??_0x5a7ac6?.[_0x4b94cd(0x147)],'tags':Array['isArray'](_0x3e905a['tags'])?_0x3e905a[_0x4b94cd(0x135)]:_0x5a7ac6?.[_0x4b94cd(0x135)],'sourceSessionId':_0x3e905a['sourceSessionId']??_0x5a7ac6?.[_0x4b94cd(0x137)],'content':_0x3e905a[_0x4b94cd(0x13a)]??_0x40ffed},_0x516ebc=buildMetadata(_0x201574,_0x59ad77,_0x35d605,contentHash(_0x40ffed),_0x1d4618[_0x4b94cd(0x162)]);writeJsonAtomic(resolve(_0x2aceeb,METADATA_FILE),_0x516ebc);}export function recordPushedRuntimeSkill(_0x35e90f,_0x384e53,_0x49a82e,_0x3139af={}){const _0x2a277a=a171_0x3a13,_0x3ae310=resolvePushDirectoryRoot(_0x35e90f),_0x52d183=scanSkillDirectory(_0x3ae310),_0x2a824f=_0x52d183['find'](_0x42cc8a=>_0x42cc8a['path']===SKILL_FILE),_0x243ef4=_0x2a824f?fileText(_0x2a824f):'',_0x4a4a5e=tryNormalizePackageManifest(_0x384e53[_0x2a277a(0x131)]),_0x5b23a7={..._0x384e53,'content':_0x384e53[_0x2a277a(0x13a)]??_0x243ef4,'files':_0x4a4a5e},_0x558e1c=_0x4a4a5e?normalizeLocalFiles(_0x52d183)['filter'](_0x54f2e8=>_0x4a4a5e[_0x2a277a(0x131)]['some'](_0x3bf3cb=>_0x3bf3cb['path']===_0x54f2e8[_0x2a277a(0x163)])):undefined,_0x574216=buildMetadata(_0x5b23a7,_0x3139af['scope']??_0x2a277a(0x15d),_0x49a82e,contentHash(_0x5b23a7['content']??''),_0x3139af[_0x2a277a(0x12c)],_0x558e1c);writeJsonAtomic(resolve(_0x3ae310,METADATA_FILE),_0x574216);}export function deriveSkillCodeFromDirectory(_0xdb698f,_0x184d31){const _0x2f3d69=a171_0x3a13,_0x49bd33=basename(resolve(_0xdb698f)),_0x1bc2d7=_0x184d31+'--';return _0x49bd33['startsWith'](_0x1bc2d7)?_0x49bd33[_0x2f3d69(0x14e)](_0x1bc2d7[_0x2f3d69(0x160)]):_0x49bd33;}function resolvePushSkillCode(_0xd56943,_0x4afc5c,_0x7f7090,_0x214b96){const _0x323bff=a171_0x3a13,_0xce08be=deriveSkillCodeFromSkillFile(_0xd56943)||deriveSkillCodeFromDirectory(_0xd56943,_0x4afc5c);if(_0x214b96['ignoreMetadataSkillCode'])return _0xce08be;return _0x7f7090?.['skillCode']?.[_0x323bff(0x150)]()||_0xce08be;}function deriveSkillCodeFromSkillFile(_0x14cb3b){const _0x5ecd04=a171_0x3a13,_0x26cb50=resolve(_0x14cb3b,SKILL_FILE);if(!existsSync(_0x26cb50)||!lstatSync(_0x26cb50)[_0x5ecd04(0x14f)]())return undefined;const _0x7c9c2=readFileSync(_0x26cb50,_0x5ecd04(0x164)),_0x4fed32=_0x7c9c2[_0x5ecd04(0x13e)](/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x4fed32)return undefined;const _0x22c8fd=parseFrontmatterObject(_0x4fed32[0x1]??''),_0x3a0f1f=scalarToString(_0x22c8fd?.[_0x5ecd04(0x132)]);return _0x3a0f1f?slugifySkillName(_0x3a0f1f):undefined;}function readSkillDisplayName(_0xbdc52b){const _0xa2f30d=a171_0x3a13,_0x279860=_0xbdc52b[_0xa2f30d(0x13e)](/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x279860)return undefined;const _0x362bbf=parseFrontmatterObject(_0x279860[0x1]??'');return scalarToString(_0x362bbf?.[_0xa2f30d(0x146)]);}function a171_0x326e(){const _0x4af778=['Invalid\x20','198kxDnzH','allowAppCodeRetarget','slice','isFile','trim','scope','isArray','1545748DcLVuv','ignoreMetadataScope','18jEHmKn','801120dYqQsy','targetScope','\x22\x20does\x20not\x20match\x20current\x20appCode\x20\x22','\x20has\x20unsupported\x20scope\x20\x22','number','388655RmcwgL','ignoreMetadataForPayload','personal','742zGaghL','1175337DlHBIV','length','14232lQhgAm','refreshedAt','path','utf8','Skill\x20metadata\x20appCode\x20\x22','packageBase64','appCode',',\x20or\x20directory\x20name.','object','isDirectory','ignoreInvalidMetadata','dir','117782pAcDRG','\x20has\x20scope=\x22','company','pushedAt','builtin','Remote\x20Skill\x20','string','toLowerCase','files','name','metadata','description','tags','(unknown)','sourceSessionId','validation','ignoreMetadataAppCodeMismatch','content','Missing\x20','replace','3037989NJWwgD','match','4MddFyt','Only\x20personal\x20Skills\x20can\x20be\x20pushed;\x20','skillName','isSymbolicLink','unknown','Skill\x20directory\x20not\x20found:\x20','skillCode','displayName','example','excludedFilePaths','boolean','20zRyNiE'];a171_0x326e=function(){return _0x4af778;};return a171_0x326e();}function slugifySkillName(_0x4b17b9){const _0x6a063f=a171_0x3a13,_0x372da6=_0x4b17b9[_0x6a063f(0x150)]()[_0x6a063f(0x130)]()[_0x6a063f(0x13c)](/[^\p{L}\p{N}\p{So}]+/gu,'-')[_0x6a063f(0x13c)](/^-+/,'')['replace'](/-+$/,'')[_0x6a063f(0x13c)](/-{2,}/g,'-');if(!_0x372da6)throw CliErrors['validation'](_0x6a063f(0x14b)+SKILL_FILE+'\x20name\x20for\x20SkillHub\x20slug\x20generation.');return _0x372da6;}function parseFrontmatterObject(_0x2eaf53){const _0xb92ce1=a171_0x3a13;try{const _0xab4b2d=a171_0xec42c9(_0x2eaf53);return _0xab4b2d&&typeof _0xab4b2d===_0xb92ce1(0x125)&&!Array[_0xb92ce1(0x152)](_0xab4b2d)?_0xab4b2d:undefined;}catch{return undefined;}}function scalarToString(_0x152639){const _0x3cdb3c=a171_0x3a13;if(typeof _0x152639===_0x3cdb3c(0x12f))return _0x152639[_0x3cdb3c(0x150)]();if(typeof _0x152639===_0x3cdb3c(0x15a)||typeof _0x152639===_0x3cdb3c(0x149))return String(_0x152639);return undefined;}function resolvePushDirectoryRoot(_0x995795){const _0x2067ea=a171_0x3a13,_0x11c8dd=resolve(_0x995795);if(!existsSync(_0x11c8dd))throw CliErrors[_0x2067ea(0x138)](_0x2067ea(0x144)+_0x995795);const _0x588d83=lstatSync(_0x11c8dd);if(_0x588d83['isDirectory']())return _0x11c8dd;if(_0x588d83[_0x2067ea(0x142)]()){const _0xd4b5f8=realpathSync(_0x11c8dd);if(lstatSync(_0xd4b5f8)[_0x2067ea(0x126)]())return _0xd4b5f8;}throw CliErrors[_0x2067ea(0x138)]('Skill\x20directory\x20not\x20found:\x20'+_0x995795);}function requireRemoteScope(_0xa81967){const _0x4cd938=a171_0x3a13;if(_0xa81967[_0x4cd938(0x151)]===_0x4cd938(0x15d)||_0xa81967[_0x4cd938(0x151)]===_0x4cd938(0x12b)||_0xa81967[_0x4cd938(0x151)]===_0x4cd938(0x12d))return _0xa81967[_0x4cd938(0x151)];throw CliErrors[_0x4cd938(0x138)](_0x4cd938(0x12e)+(_0xa81967[_0x4cd938(0x145)]||_0x4cd938(0x136))+_0x4cd938(0x159)+(_0xa81967['scope']??_0x4cd938(0x143))+'\x22.');}function readLocalSkillContent(_0xc25561){const _0x4daf2f=a171_0x3a13,_0x55bd95=resolve(_0xc25561,SKILL_FILE);return existsSync(_0x55bd95)&&lstatSync(_0x55bd95)[_0x4daf2f(0x14f)]()?readFileSync(_0x55bd95,_0x4daf2f(0x164)):'';}function a171_0x3a13(_0x4beb73,_0x375753){_0x4beb73=_0x4beb73-0x121;const _0x326e06=a171_0x326e();let _0x3a13d5=_0x326e06[_0x4beb73];return _0x3a13d5;}function readPushMetadataIfPresent(_0x27ae8c,_0x4bf56a={}){try{return readMetadataIfPresent(_0x27ae8c);}catch(_0x5d166d){if(_0x4bf56a['ignoreInvalidMetadata'])return undefined;throw _0x5d166d;}}
1
+ import{existsSync,lstatSync,readFileSync,realpathSync}from"node:fs";import{basename,resolve}from"node:path";import{parse as parseYaml}from"yaml";import{CliErrors}from"../../errors.js";import{METADATA_FILE,SKILL_FILE}from"./constants.js";import{writeJsonAtomic}from"./fs-utils.js";import{contentHash}from"./hashing.js";import{fileText,normalizeLocalFiles,scanSkillDirectory}from"./local-files.js";import{buildMetadata,readMetadataIfPresent}from"./metadata.js";import{buildSkillPackage,tryNormalizePackageManifest}from"./zip-package.js";export function resolvePushDirectoryIdentity(dir,appCode,options={}){const resolvedDir=resolvePushDirectoryRoot(dir);const metadata=readPushMetadataIfPresent(resolve(resolvedDir,METADATA_FILE),{ignoreInvalidMetadata:options.ignoreInvalidMetadata});if(metadata?.appCode&&metadata.appCode!==appCode&&!options.allowAppCodeRetarget&&!options.ignoreMetadataAppCodeMismatch){
2
+ throw CliErrors.validation(`Skill metadata appCode "${metadata.appCode}" does not match current appCode "${appCode}".`)}const skillCode=resolvePushSkillCode(resolvedDir,appCode,metadata,options);if(!skillCode){throw CliErrors.validation(`Unable to resolve skillCode from ${SKILL_FILE}, ${METADATA_FILE}, or directory name.`)}return{dir:resolvedDir,skillCode:skillCode,metadata:metadata}}export function readPushDirectory(dir,appCode,options={}){const identity=resolvePushDirectoryIdentity(dir,appCode,options);const resolvedDir=identity.dir;const skillMdPath=resolve(resolvedDir,SKILL_FILE);if(!existsSync(skillMdPath)||!lstatSync(skillMdPath).isFile()){throw CliErrors.validation(`Missing ${SKILL_FILE}: ${skillMdPath}`)}const metadata=identity.metadata;const targetScope=options.targetScope??"personal";if(!options.ignoreMetadataScope&&metadata?.scope==="builtin"){throw CliErrors.validation(`Builtin Skills cannot be pushed; ${METADATA_FILE} has scope="${metadata.scope}".`)}
3
+ if(!options.ignoreMetadataScope&&targetScope==="personal"&&metadata?.scope&&metadata.scope!=="personal"){throw CliErrors.validation(`Only personal Skills can be pushed; ${METADATA_FILE} has scope="${metadata.scope}".`,`Use lovrabet skill push --scope company --dir ${resolvedDir} to submit company Skills for review.`)}const files=scanSkillDirectory(resolvedDir,{excludedFilePaths:options.excludedFilePaths});const skillPackage=buildSkillPackage(files);const content=readFileSync(skillMdPath,"utf8");const skillCode=identity.skillCode;const metadataForPayload=options.ignoreMetadataForPayload?undefined:metadata;const displayName=readSkillDisplayName(content);return{skillCode:skillCode,metadata:metadata,frontmatterDisplayName:displayName,input:{skillCode:skillCode,skillName:displayName??metadataForPayload?.skillName,description:metadataForPayload?.description,content:content,files:skillPackage.manifest,packageBase64:skillPackage.packageBase64,tags:metadataForPayload?.tags,
4
+ version:metadataForPayload?.version,sourceSessionId:metadataForPayload?.sourceSessionId}}}export function refreshPushDirectoryMetadataFromRemote(dir,remote,appCode,options={}){const resolvedDir=resolvePushDirectoryRoot(dir);const metadata=readPushMetadataIfPresent(resolve(resolvedDir,METADATA_FILE),{ignoreInvalidMetadata:true});const scope=requireRemoteScope(remote);const content=readLocalSkillContent(resolvedDir);const mergedRemote={...remote,appCode:remote.appCode??appCode,skillName:remote.skillName??metadata?.skillName,description:remote.description??metadata?.description,example:remote.example??metadata?.example,tags:Array.isArray(remote.tags)?remote.tags:metadata?.tags,sourceSessionId:remote.sourceSessionId??metadata?.sourceSessionId,content:remote.content??content};const refreshed=buildMetadata(mergedRemote,scope,appCode,contentHash(content),options.refreshedAt);writeJsonAtomic(resolve(resolvedDir,METADATA_FILE),refreshed)}
5
+ export function recordPushedRuntimeSkill(dir,saved,appCode,options={}){const resolvedDir=resolvePushDirectoryRoot(dir);const files=scanSkillDirectory(resolvedDir);const localSkillFile=files.find(file=>file.path===SKILL_FILE);const content=localSkillFile?fileText(localSkillFile):"";const savedManifest=tryNormalizePackageManifest(saved.files);const normalizedSaved={...saved,content:saved.content??content,files:savedManifest};const metadataFiles=savedManifest?normalizeLocalFiles(files).filter(file=>savedManifest.files.some(item=>item.path===file.path)):undefined;const metadata=buildMetadata(normalizedSaved,options.scope??"personal",appCode,contentHash(normalizedSaved.content??""),options.pushedAt,metadataFiles);writeJsonAtomic(resolve(resolvedDir,METADATA_FILE),metadata)}export function deriveSkillCodeFromDirectory(dir,appCode){const name=basename(resolve(dir));const prefix=`${appCode}--`;return name.startsWith(prefix)?name.slice(prefix.length):name}
6
+ function resolvePushSkillCode(dir,appCode,metadata,options){const localSkillCode=deriveSkillCodeFromSkillFile(dir)||deriveSkillCodeFromDirectory(dir,appCode);if(options.ignoreMetadataSkillCode){return localSkillCode}return metadata?.skillCode?.trim()||localSkillCode}function deriveSkillCodeFromSkillFile(dir){const skillMdPath=resolve(dir,SKILL_FILE);if(!existsSync(skillMdPath)||!lstatSync(skillMdPath).isFile()){return undefined}const content=readFileSync(skillMdPath,"utf8");const match=content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!match){return undefined}const frontmatter=parseFrontmatterObject(match[1]??"");const name=scalarToString(frontmatter?.name);return name?slugifySkillName(name):undefined}function readSkillDisplayName(content){const match=content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!match){return undefined}const frontmatter=parseFrontmatterObject(match[1]??"");return scalarToString(frontmatter?.displayName)}function slugifySkillName(raw){
7
+ const slug=raw.trim().toLowerCase().replace(/[^\p{L}\p{N}\p{So}]+/gu,"-").replace(/^-+/,"").replace(/-+$/,"").replace(/-{2,}/g,"-");if(!slug){throw CliErrors.validation(`Invalid ${SKILL_FILE} name for SkillHub slug generation.`)}return slug}function parseFrontmatterObject(yaml){try{const value=parseYaml(yaml);return value&&typeof value==="object"&&!Array.isArray(value)?value:undefined}catch{return undefined}}function scalarToString(value){if(typeof value==="string")return value.trim();if(typeof value==="number"||typeof value==="boolean")return String(value);return undefined}function resolvePushDirectoryRoot(dir){const root=resolve(dir);if(!existsSync(root)){throw CliErrors.validation(`Skill directory not found: ${dir}`)}const stat=lstatSync(root);if(stat.isDirectory()){return root}if(stat.isSymbolicLink()){const realRoot=realpathSync(root);if(lstatSync(realRoot).isDirectory()){return realRoot}}throw CliErrors.validation(`Skill directory not found: ${dir}`)}
8
+ function requireRemoteScope(skill){if(skill.scope==="personal"||skill.scope==="company"||skill.scope==="builtin"){return skill.scope}throw CliErrors.validation(`Remote Skill ${skill.skillCode||"(unknown)"} has unsupported scope "${skill.scope??"unknown"}".`)}function readLocalSkillContent(dir){const skillMdPath=resolve(dir,SKILL_FILE);return existsSync(skillMdPath)&&lstatSync(skillMdPath).isFile()?readFileSync(skillMdPath,"utf8"):""}function readPushMetadataIfPresent(path,options={}){try{return readMetadataIfPresent(path)}catch(error){if(options.ignoreInvalidMetadata){return undefined}throw error}}
@@ -1 +1 @@
1
- (function(_0x503bae,_0xd3a6f){const _0xf75088=a172_0x3936,_0x20ebee=_0x503bae();while(!![]){try{const _0xc7414c=-parseInt(_0xf75088(0x82))/0x1+-parseInt(_0xf75088(0x87))/0x2+parseInt(_0xf75088(0x7f))/0x3+-parseInt(_0xf75088(0x89))/0x4+-parseInt(_0xf75088(0x8c))/0x5+-parseInt(_0xf75088(0x81))/0x6*(parseInt(_0xf75088(0x8a))/0x7)+parseInt(_0xf75088(0x84))/0x8;if(_0xc7414c===_0xd3a6f)break;else _0x20ebee['push'](_0x20ebee['shift']());}catch(_0x96fab9){_0x20ebee['push'](_0x20ebee['shift']());}}}(a172_0x3dd1,0xe476d));import{CliErrors}from'../../errors.js';export function normalizeRuntimeSkillScopes(_0xac961e){const _0x33eec2=a172_0x3936,_0x36836a=_0xac961e&&_0xac961e[_0x33eec2(0x86)]>0x0?_0xac961e:[_0x33eec2(0x85),'company',_0x33eec2(0x83)],_0x193e2a=[];for(const _0x98d89e of _0x36836a){if(!isRuntimeSkillScope(_0x98d89e))throw CliErrors['validation'](_0x33eec2(0x8b)+_0x98d89e);!_0x193e2a[_0x33eec2(0x88)](_0x98d89e)&&_0x193e2a['push'](_0x98d89e);}return _0x193e2a;}function a172_0x3936(_0x333418,_0x25a290){_0x333418=_0x333418-0x7f;const _0x3dd1b2=a172_0x3dd1();let _0x39366f=_0x3dd1b2[_0x333418];return _0x39366f;}export function isRuntimeSkillScope(_0x235b5e){const _0x13b677=a172_0x3936;return _0x235b5e===_0x13b677(0x85)||_0x235b5e===_0x13b677(0x80)||_0x235b5e===_0x13b677(0x83);}function a172_0x3dd1(){const _0x30986e=['36334672nDUwNP','personal','length','566200gAJsVb','includes','5234020GkRNDR','1946ALIcKN','Unsupported\x20runtime\x20Skill\x20scope:\x20','7633200NAfqln','5297748SpARVX','company','19614pRtJkj','1344934SKvYgJ','builtin'];a172_0x3dd1=function(){return _0x30986e;};return a172_0x3dd1();}
1
+ import{CliErrors}from"../../errors.js";export function normalizeRuntimeSkillScopes(scopes){const source=scopes&&scopes.length>0?scopes:["personal","company","builtin"];const normalized=[];for(const scope of source){if(!isRuntimeSkillScope(scope)){throw CliErrors.validation(`Unsupported runtime Skill scope: ${scope}`)}if(!normalized.includes(scope)){normalized.push(scope)}}return normalized}export function isRuntimeSkillScope(value){return value==="personal"||value==="company"||value==="builtin"}
@@ -1 +1 @@
1
- export{};
1
+ export{};
@@ -1 +1,2 @@
1
- const a174_0x5e81e5=a174_0xe76b;function a174_0xe76b(_0x45f635,_0x5a3a1e){_0x45f635=_0x45f635-0xd3;const _0x7bca7a=a174_0x7bca();let _0xe76b4=_0x7bca7a[_0x45f635];return _0xe76b4;}(function(_0x5629f6,_0xbdc27d){const _0x32a9ae=a174_0xe76b,_0x2486a3=_0x5629f6();while(!![]){try{const _0x86f5b9=-parseInt(_0x32a9ae(0xe9))/0x1+parseInt(_0x32a9ae(0xd4))/0x2*(-parseInt(_0x32a9ae(0xdc))/0x3)+-parseInt(_0x32a9ae(0xdf))/0x4+parseInt(_0x32a9ae(0xdd))/0x5*(parseInt(_0x32a9ae(0xd3))/0x6)+-parseInt(_0x32a9ae(0xde))/0x7*(parseInt(_0x32a9ae(0xe5))/0x8)+parseInt(_0x32a9ae(0xda))/0x9*(parseInt(_0x32a9ae(0xd6))/0xa)+parseInt(_0x32a9ae(0xe1))/0xb;if(_0x86f5b9===_0xbdc27d)break;else _0x2486a3['push'](_0x2486a3['shift']());}catch(_0x5efab4){_0x2486a3['push'](_0x2486a3['shift']());}}}(a174_0x7bca,0xd6b54));import{unzipSync,zipSync}from'fflate';import{CliErrors}from'../../errors.js';import{compareSkillFiles,fileContent,normalizeLocalFiles,normalizeSkillRelativePath}from'./local-files.js';function a174_0x7bca(){const _0x1cc4fe=['6hYEtUA','6HsIyjn','validation','350ZVSEUE','object','validation_error','1980-01-01T00:00:00.000Z','64215BUxXMX','sort','1473543YdCCPc','5289865GMkanf','21MxtfVZ','6025684jvnWtx','map','58747799nYvJRB','from','length','entries','3281560xQVrww','code','endsWith','Runtime\x20Skill\x20package\x20is\x20not\x20a\x20valid\x20zip\x20file.','1558414fCRgvb'];a174_0x7bca=function(){return _0x1cc4fe;};return a174_0x7bca();}const ZIP_MTIME=new Date(a174_0x5e81e5(0xd9));export function createDeterministicZipPackage(_0x2f081d){const _0xbd4d5e=a174_0x5e81e5,_0x486a4a={};for(const _0x113bde of normalizeLocalFiles(_0x2f081d)){_0x486a4a[_0x113bde['path']]=fileContent(_0x113bde);}return Buffer[_0xbd4d5e(0xe2)](zipSync(_0x486a4a,{'level':0x0,'mtime':ZIP_MTIME}));}export function parseZipPackage(_0x10ae24){const _0x10a64e=a174_0x5e81e5;if(_0x10ae24[_0x10a64e(0xe3)]<0x16)throw CliErrors[_0x10a64e(0xd5)](_0x10a64e(0xe8));let _0x25fe82;try{_0x25fe82=unzipSync(_0x10ae24,{'filter'(_0x12dd41){const _0x408e2a=_0x10a64e,_0x2eb746=normalizeSkillRelativePath(_0x12dd41['name']);if(_0x2eb746[_0x408e2a(0xe7)]('/'))throw CliErrors[_0x408e2a(0xd5)]('Runtime\x20Skill\x20package\x20contains\x20directory\x20entry:\x20'+_0x2eb746);return!![];}});}catch(_0x15de10){if(isRuntimeSkillValidationError(_0x15de10))throw _0x15de10;throw CliErrors[_0x10a64e(0xd5)](_0x10a64e(0xe8));}return Object[_0x10a64e(0xe4)](_0x25fe82)[_0x10a64e(0xe0)](([_0x58016a,_0x59be9a])=>({'path':normalizeSkillRelativePath(_0x58016a),'bytes':Buffer[_0x10a64e(0xe2)](_0x59be9a)}))[_0x10a64e(0xdb)](compareSkillFiles);}function isRuntimeSkillValidationError(_0x26fe97){const _0x5135f7=a174_0x5e81e5;return typeof _0x26fe97===_0x5135f7(0xd7)&&_0x26fe97!==null&&_0x5135f7(0xe6)in _0x26fe97&&_0x26fe97[_0x5135f7(0xe6)]===_0x5135f7(0xd8);}
1
+ import{unzipSync,zipSync}from"fflate";import{CliErrors}from"../../errors.js";import{compareSkillFiles,fileContent,normalizeLocalFiles,normalizeSkillRelativePath}from"./local-files.js";const ZIP_MTIME=new Date("1980-01-01T00:00:00.000Z");export function createDeterministicZipPackage(files){const entries={};for(const file of normalizeLocalFiles(files)){entries[file.path]=fileContent(file)}return Buffer.from(zipSync(entries,{level:0,mtime:ZIP_MTIME}))}export function parseZipPackage(packageBytes){if(packageBytes.length<22){throw CliErrors.validation("Runtime Skill package is not a valid zip file.")}let unzipped;try{unzipped=unzipSync(packageBytes,{filter(file){const path=normalizeSkillRelativePath(file.name);if(path.endsWith("/")){throw CliErrors.validation(`Runtime Skill package contains directory entry: ${path}`)}return true}})}catch(error){if(isRuntimeSkillValidationError(error)){throw error}throw CliErrors.validation("Runtime Skill package is not a valid zip file.")}
2
+ return Object.entries(unzipped).map(([path,bytes])=>({path:normalizeSkillRelativePath(path),bytes:Buffer.from(bytes)})).sort(compareSkillFiles)}function isRuntimeSkillValidationError(error){return typeof error==="object"&&error!==null&&"code"in error&&error.code==="validation_error"}
@@ -1 +1,6 @@
1
- (function(_0x3eb977,_0x37affa){const _0x260c9b=a175_0x36cf,_0x3742a7=_0x3eb977();while(!![]){try{const _0x2a8c5=-parseInt(_0x260c9b(0x12d))/0x1+-parseInt(_0x260c9b(0x13c))/0x2+-parseInt(_0x260c9b(0x130))/0x3*(-parseInt(_0x260c9b(0x13b))/0x4)+parseInt(_0x260c9b(0x137))/0x5+parseInt(_0x260c9b(0x12c))/0x6+-parseInt(_0x260c9b(0x121))/0x7*(parseInt(_0x260c9b(0x120))/0x8)+parseInt(_0x260c9b(0x13f))/0x9;if(_0x2a8c5===_0x37affa)break;else _0x3742a7['push'](_0x3742a7['shift']());}catch(_0x56757){_0x3742a7['push'](_0x3742a7['shift']());}}}(a175_0x1e02,0xbedcb));import{CliErrors}from'../../errors.js';function a175_0x36cf(_0x56b99b,_0xde899a){_0x56b99b=_0x56b99b-0x11c;const _0x1e0236=a175_0x1e02();let _0x36cf0b=_0x1e0236[_0x56b99b];return _0x36cf0b;}import{SKILL_FILE}from'./constants.js';import{bufferSha256,fileHash,fileTreeHash}from'./hashing.js';function a175_0x1e02(){const _0x2ad03d=['zipSize','trim','Runtime\x20Skill\x20package\x20manifest\x20is\x20missing.','Duplicate\x20Skill\x20package\x20entry:\x20','files','Runtime\x20Skill\x20package\x20is\x20required\x20for\x20Skill\x20install:\x20','Runtime\x20Skill\x20package\x20is\x20missing\x20','validation','Runtime\x20Skill\x20package\x20entry\x20list\x20mismatch.','isArray','Runtime\x20Skill\x20package\x20is\x20missing\x20entry:\x20','556408yCehGW','119nqGnWx','has','some','map','isSafeInteger','Runtime\x20Skill\x20package\x20file\x20size\x20mismatch:\x20','Runtime\x20Skill\x20file\x20tree\x20sha256\x20is\x20invalid.','path','Runtime\x20Skill\x20package\x20size\x20is\x20invalid.','Runtime\x20Skill\x20manifest\x20is\x20missing\x20','toString','4991040Zfhkox','649513nIxSan','toLowerCase','zipSha256','821676ajSYXS','size','bytes','length','Runtime\x20Skill\x20package\x20file\x20sha256\x20mismatch:\x20','schemaVersion','ossPath','5636950sqIAzs','Runtime\x20Skill\x20package\x20sha256\x20mismatch.','requireOssPath','set','12jcPzyn','1138068QmFxal','Runtime\x20Skill\x20file\x20tree\x20sha256\x20mismatch.','sha256','3616011jscgPj','Runtime\x20Skill\x20package\x20sha256\x20is\x20invalid.','push','treeSha256','Runtime\x20Skill\x20package\x20size\x20mismatch.','string'];a175_0x1e02=function(){return _0x2ad03d;};return a175_0x1e02();}import{fileContent,isSha256Hex,normalizeLocalFiles,normalizeManifestFiles}from'./local-files.js';import{createDeterministicZipPackage,parseZipPackage}from'./zip-codec.js';export function buildSkillPackage(_0x40bbb3){const _0x4aaf38=a175_0x36cf,_0x29ace9=normalizeLocalFiles(_0x40bbb3);if(!_0x29ace9[_0x4aaf38(0x123)](_0x25e437=>_0x25e437[_0x4aaf38(0x128)]===SKILL_FILE))throw CliErrors['validation']('Missing\x20'+SKILL_FILE+'\x20in\x20Skill\x20file\x20package.');const _0x326711=localFilesToManifestFiles(_0x29ace9),_0x556617=createDeterministicZipPackage(_0x29ace9);return{'manifest':{'schemaVersion':0x2,'treeSha256':fileTreeHash(_0x326711),'zipSha256':bufferSha256(_0x556617),'zipSize':_0x556617['length'],'files':_0x326711},'packageBytes':_0x556617,'packageBase64':_0x556617[_0x4aaf38(0x12b)]('base64')};}export function verifyRuntimeSkillPackage(_0x28b356,_0x13ef62){const _0x30825d=a175_0x36cf,_0x12b262=normalizePackageManifest(_0x28b356,{'requireOssPath':![]});if(!_0x12b262)throw CliErrors[_0x30825d(0x11c)](_0x30825d(0x147));return extractAndVerifyPackage(_0x12b262,_0x13ef62);}export function verifyRuntimeSkillBundle(_0x49f951,_0x3bfbcc){const _0x425aa7=a175_0x36cf,_0xcadebe=normalizePackageManifest(_0x49f951,{'requireOssPath':![]});if(!_0xcadebe)throw CliErrors['validation'](_0x425aa7(0x147));return extractAndVerifyPackageFiles(_0xcadebe,_0x3bfbcc);}export function tryNormalizePackageManifest(_0x4e1d77){return normalizePackageManifest(_0x4e1d77,{'requireOssPath':![]});}export function requirePackageBytes(_0x4cd1d6,_0x239bb3){const _0x316c33=a175_0x36cf;if(!_0x239bb3||_0x239bb3[_0x316c33(0x133)]===0x0)throw CliErrors[_0x316c33(0x11c)](_0x316c33(0x14a)+_0x4cd1d6);return _0x239bb3;}export function extractDownloadedPackage(_0x232331){const _0x42c629=a175_0x36cf,_0x300e70=parseZipPackage(_0x232331)[_0x42c629(0x124)](_0x19d936=>({'path':_0x19d936['path'],'bytes':_0x19d936['bytes']}));if(!_0x300e70[_0x42c629(0x123)](_0x4ee574=>_0x4ee574[_0x42c629(0x128)]===SKILL_FILE))throw CliErrors[_0x42c629(0x11c)](_0x42c629(0x14b)+SKILL_FILE+'.');return normalizeLocalFiles(_0x300e70);}export function localFilesToManifestFiles(_0x554529){const _0x3c104d=a175_0x36cf;return normalizeLocalFiles(_0x554529)[_0x3c104d(0x124)](_0x435dc7=>({'path':_0x435dc7[_0x3c104d(0x128)],'sha256':fileHash(_0x435dc7),'size':fileContent(_0x435dc7)[_0x3c104d(0x133)]}));}function normalizePackageManifest(_0x24910a,_0x150cc7){const _0x3b9a39=a175_0x36cf;if(!_0x24910a||typeof _0x24910a!=='object'||Array[_0x3b9a39(0x11e)](_0x24910a))return undefined;const _0x3f11fe=_0x24910a,_0x3b3046=typeof _0x3f11fe[_0x3b9a39(0x136)]===_0x3b9a39(0x144)?_0x3f11fe[_0x3b9a39(0x136)][_0x3b9a39(0x146)]():undefined;if(_0x150cc7[_0x3b9a39(0x139)]&&!_0x3b3046)return undefined;if(!Array['isArray'](_0x3f11fe[_0x3b9a39(0x149)])||_0x3f11fe[_0x3b9a39(0x149)][_0x3b9a39(0x133)]===0x0)return undefined;if(!isSha256Hex(_0x3f11fe['treeSha256']))throw CliErrors[_0x3b9a39(0x11c)](_0x3b9a39(0x127));if(!isSha256Hex(_0x3f11fe[_0x3b9a39(0x12f)]))throw CliErrors[_0x3b9a39(0x11c)](_0x3b9a39(0x140));if(!Number[_0x3b9a39(0x125)](_0x3f11fe[_0x3b9a39(0x145)])||_0x3f11fe['zipSize']<0x0)throw CliErrors[_0x3b9a39(0x11c)](_0x3b9a39(0x129));const _0x5057b1=normalizeManifestFiles(_0x3f11fe['files']);if(!_0x5057b1[_0x3b9a39(0x123)](_0x340821=>_0x340821[_0x3b9a39(0x128)]===SKILL_FILE))throw CliErrors['validation'](_0x3b9a39(0x12a)+SKILL_FILE+'.');const _0x3f589c=fileTreeHash(_0x5057b1);if(_0x3f589c!==_0x3f11fe[_0x3b9a39(0x142)][_0x3b9a39(0x12e)]())throw CliErrors['validation'](_0x3b9a39(0x13d));return{'schemaVersion':Number[_0x3b9a39(0x125)](_0x3f11fe[_0x3b9a39(0x135)])?_0x3f11fe['schemaVersion']:0x2,'ossPath':_0x3b3046,'treeSha256':_0x3f589c,'zipSha256':_0x3f11fe[_0x3b9a39(0x12f)][_0x3b9a39(0x12e)](),'zipSize':_0x3f11fe[_0x3b9a39(0x145)],'files':_0x5057b1};}function extractAndVerifyPackage(_0x52ecca,_0x22047d){const _0x218476=a175_0x36cf,_0x34b757=normalizePackageManifest(_0x52ecca,{'requireOssPath':![]});if(!_0x34b757)throw CliErrors[_0x218476(0x11c)](_0x218476(0x147));if(_0x22047d[_0x218476(0x133)]!==_0x34b757[_0x218476(0x145)])throw CliErrors[_0x218476(0x11c)](_0x218476(0x143));const _0x31056d=bufferSha256(_0x22047d);if(_0x31056d!==_0x34b757[_0x218476(0x12f)])throw CliErrors[_0x218476(0x11c)](_0x218476(0x138));return extractAndVerifyPackageFiles(_0x34b757,_0x22047d);}function extractAndVerifyPackageFiles(_0x487a3c,_0x9f74b3){const _0x3f8f9c=a175_0x36cf,_0x186b71=parseZipPackage(_0x9f74b3);if(_0x186b71['length']!==_0x487a3c['files'][_0x3f8f9c(0x133)])throw CliErrors[_0x3f8f9c(0x11c)](_0x3f8f9c(0x11d));const _0x428678=new Map();for(const _0x2d90fa of _0x186b71){if(_0x428678[_0x3f8f9c(0x122)](_0x2d90fa[_0x3f8f9c(0x128)]))throw CliErrors[_0x3f8f9c(0x11c)](_0x3f8f9c(0x148)+_0x2d90fa['path']);_0x428678[_0x3f8f9c(0x13a)](_0x2d90fa[_0x3f8f9c(0x128)],_0x2d90fa);}const _0x4938e8=[];for(const _0xea36bb of _0x487a3c['files']){const _0x475307=_0x428678['get'](_0xea36bb[_0x3f8f9c(0x128)]);if(!_0x475307)throw CliErrors['validation'](_0x3f8f9c(0x11f)+_0xea36bb[_0x3f8f9c(0x128)]);if(_0x475307[_0x3f8f9c(0x132)][_0x3f8f9c(0x133)]!==_0xea36bb[_0x3f8f9c(0x131)])throw CliErrors['validation'](_0x3f8f9c(0x126)+_0xea36bb['path']);const _0x293ddd=bufferSha256(_0x475307[_0x3f8f9c(0x132)]);if(_0x293ddd!==_0xea36bb[_0x3f8f9c(0x13e)])throw CliErrors[_0x3f8f9c(0x11c)](_0x3f8f9c(0x134)+_0xea36bb[_0x3f8f9c(0x128)]);_0x4938e8[_0x3f8f9c(0x141)]({'path':_0xea36bb[_0x3f8f9c(0x128)],'bytes':_0x475307[_0x3f8f9c(0x132)]});}return normalizeLocalFiles(_0x4938e8);}
1
+ import{CliErrors}from"../../errors.js";import{SKILL_FILE}from"./constants.js";import{bufferSha256,fileHash,fileTreeHash}from"./hashing.js";import{fileContent,isSha256Hex,normalizeLocalFiles,normalizeManifestFiles}from"./local-files.js";import{createDeterministicZipPackage,parseZipPackage}from"./zip-codec.js";export function buildSkillPackage(files){const normalizedFiles=normalizeLocalFiles(files);if(!normalizedFiles.some(file=>file.path===SKILL_FILE)){throw CliErrors.validation(`Missing ${SKILL_FILE} in Skill file package.`)}const manifestFiles=localFilesToManifestFiles(normalizedFiles);const packageBytes=createDeterministicZipPackage(normalizedFiles);return{manifest:{schemaVersion:2,treeSha256:fileTreeHash(manifestFiles),zipSha256:bufferSha256(packageBytes),zipSize:packageBytes.length,files:manifestFiles},packageBytes:packageBytes,packageBase64:packageBytes.toString("base64")}}export function verifyRuntimeSkillPackage(manifest,packageBytes){
2
+ const normalizedManifest=normalizePackageManifest(manifest,{requireOssPath:false});if(!normalizedManifest){throw CliErrors.validation("Runtime Skill package manifest is missing.")}return extractAndVerifyPackage(normalizedManifest,packageBytes)}export function verifyRuntimeSkillBundle(manifest,packageBytes){const normalizedManifest=normalizePackageManifest(manifest,{requireOssPath:false});if(!normalizedManifest){throw CliErrors.validation("Runtime Skill package manifest is missing.")}return extractAndVerifyPackageFiles(normalizedManifest,packageBytes)}export function tryNormalizePackageManifest(manifest){return normalizePackageManifest(manifest,{requireOssPath:false})}export function requirePackageBytes(skillCode,packageBytes){if(!packageBytes||packageBytes.length===0){throw CliErrors.validation(`Runtime Skill package is required for Skill install: ${skillCode}`)}return packageBytes}export function extractDownloadedPackage(packageBytes){
3
+ const extracted=parseZipPackage(packageBytes).map(file=>({path:file.path,bytes:file.bytes}));if(!extracted.some(file=>file.path===SKILL_FILE)){throw CliErrors.validation(`Runtime Skill package is missing ${SKILL_FILE}.`)}return normalizeLocalFiles(extracted)}export function localFilesToManifestFiles(files){return normalizeLocalFiles(files).map(file=>({path:file.path,sha256:fileHash(file),size:fileContent(file).length}))}function normalizePackageManifest(manifest,options){if(!manifest||typeof manifest!=="object"||Array.isArray(manifest)){return undefined}const record=manifest;const ossPath=typeof record.ossPath==="string"?record.ossPath.trim():undefined;if(options.requireOssPath&&!ossPath){return undefined}if(!Array.isArray(record.files)||record.files.length===0){return undefined}if(!isSha256Hex(record.treeSha256)){throw CliErrors.validation("Runtime Skill file tree sha256 is invalid.")}if(!isSha256Hex(record.zipSha256)){
4
+ throw CliErrors.validation("Runtime Skill package sha256 is invalid.")}if(!Number.isSafeInteger(record.zipSize)||record.zipSize<0){throw CliErrors.validation("Runtime Skill package size is invalid.")}const files=normalizeManifestFiles(record.files);if(!files.some(file=>file.path===SKILL_FILE)){throw CliErrors.validation(`Runtime Skill manifest is missing ${SKILL_FILE}.`)}const treeSha256=fileTreeHash(files);if(treeSha256!==record.treeSha256.toLowerCase()){throw CliErrors.validation("Runtime Skill file tree sha256 mismatch.")}return{schemaVersion:Number.isSafeInteger(record.schemaVersion)?record.schemaVersion:2,ossPath:ossPath,treeSha256:treeSha256,zipSha256:record.zipSha256.toLowerCase(),zipSize:record.zipSize,files:files}}function extractAndVerifyPackage(manifest,packageBytes){const normalizedManifest=normalizePackageManifest(manifest,{requireOssPath:false});if(!normalizedManifest){throw CliErrors.validation("Runtime Skill package manifest is missing.")}
5
+ if(packageBytes.length!==normalizedManifest.zipSize){throw CliErrors.validation("Runtime Skill package size mismatch.")}const actualZipSha256=bufferSha256(packageBytes);if(actualZipSha256!==normalizedManifest.zipSha256){throw CliErrors.validation("Runtime Skill package sha256 mismatch.")}return extractAndVerifyPackageFiles(normalizedManifest,packageBytes)}function extractAndVerifyPackageFiles(normalizedManifest,packageBytes){const extracted=parseZipPackage(packageBytes);if(extracted.length!==normalizedManifest.files.length){throw CliErrors.validation("Runtime Skill package entry list mismatch.")}const extractedByPath=new Map;for(const file of extracted){if(extractedByPath.has(file.path)){throw CliErrors.validation(`Duplicate Skill package entry: ${file.path}`)}extractedByPath.set(file.path,file)}const materialized=[];for(const expected of normalizedManifest.files){const actual=extractedByPath.get(expected.path);if(!actual){
6
+ throw CliErrors.validation(`Runtime Skill package is missing entry: ${expected.path}`)}if(actual.bytes.length!==expected.size){throw CliErrors.validation(`Runtime Skill package file size mismatch: ${expected.path}`)}const actualSha256=bufferSha256(actual.bytes);if(actualSha256!==expected.sha256){throw CliErrors.validation(`Runtime Skill package file sha256 mismatch: ${expected.path}`)}materialized.push({path:expected.path,bytes:actual.bytes})}return normalizeLocalFiles(materialized)}
@@ -1 +1 @@
1
- (function(_0x47b388,_0xfa4a12){var _0x5f33b1=a176_0x2b54,_0x545ef0=_0x47b388();while(!![]){try{var _0x5a8ae3=-parseInt(_0x5f33b1(0x84))/0x1*(parseInt(_0x5f33b1(0x7d))/0x2)+parseInt(_0x5f33b1(0x7c))/0x3*(-parseInt(_0x5f33b1(0x7a))/0x4)+parseInt(_0x5f33b1(0x81))/0x5*(-parseInt(_0x5f33b1(0x82))/0x6)+-parseInt(_0x5f33b1(0x7e))/0x7+-parseInt(_0x5f33b1(0x7f))/0x8*(-parseInt(_0x5f33b1(0x83))/0x9)+-parseInt(_0x5f33b1(0x7b))/0xa+parseInt(_0x5f33b1(0x79))/0xb*(parseInt(_0x5f33b1(0x80))/0xc);if(_0x5a8ae3===_0xfa4a12)break;else _0x545ef0['push'](_0x545ef0['shift']());}catch(_0x5120c2){_0x545ef0['push'](_0x545ef0['shift']());}}}(a176_0x13c2,0xc243b));export{contentHash,fileTreeHash}from'./runtime-skill-sync/hashing.js';export{linkEffectiveRuntimeSkills,linkGlobalRuntimeSkills,pruneStaleRuntimeSkillCache,pruneStaleRuntimeSkillLinks}from'./runtime-skill-sync/links.js';export{resolveRuntimeSkillInstallTarget}from'./runtime-skill-sync/install-target.js';function a176_0x2b54(_0x1ea7a5,_0x87f325){_0x1ea7a5=_0x1ea7a5-0x79;var _0x13c260=a176_0x13c2();var _0x2b54da=_0x13c260[_0x1ea7a5];return _0x2b54da;}export{listLocalRuntimeSkills}from'./runtime-skill-sync/list-local.js';export{materializeRuntimeSkill,reuseMaterializedRuntimeSkill}from'./runtime-skill-sync/materialize.js';export{readMetadataIfPresent}from'./runtime-skill-sync/metadata.js';export{getRuntimeSkillCacheRoot,getRuntimeSkillDir,resolveSkillSyncPaths,runtimeAgentSkillRoots}from'./runtime-skill-sync/paths.js';export{deriveSkillCodeFromDirectory,readPushDirectory,refreshPushDirectoryMetadataFromRemote,recordPushedRuntimeSkill,resolvePushDirectoryIdentity}from'./runtime-skill-sync/push.js';export{buildSkillPackage,verifyRuntimeSkillBundle,verifyRuntimeSkillPackage}from'./runtime-skill-sync/zip-package.js';function a176_0x13c2(){var _0x2627f8=['12gKmibl','5009885GYtret','6vckRxa','135TnQLcm','5HyrQJk','56500081QaoNsJ','4596dkNtFY','10511940IbybEc','2904WDUHPi','428162dMXIVd','2992752lDbrex','172096umeffl'];a176_0x13c2=function(){return _0x2627f8;};return a176_0x13c2();}
1
+ export{contentHash,fileTreeHash}from"./runtime-skill-sync/hashing.js";export{linkEffectiveRuntimeSkills,linkGlobalRuntimeSkills,pruneStaleRuntimeSkillCache,pruneStaleRuntimeSkillLinks}from"./runtime-skill-sync/links.js";export{resolveRuntimeSkillInstallTarget}from"./runtime-skill-sync/install-target.js";export{listLocalRuntimeSkills}from"./runtime-skill-sync/list-local.js";export{materializeRuntimeSkill,reuseMaterializedRuntimeSkill}from"./runtime-skill-sync/materialize.js";export{readMetadataIfPresent}from"./runtime-skill-sync/metadata.js";export{getRuntimeSkillCacheRoot,getRuntimeSkillDir,resolveSkillSyncPaths,runtimeAgentSkillRoots}from"./runtime-skill-sync/paths.js";export{deriveSkillCodeFromDirectory,readPushDirectory,refreshPushDirectoryMetadataFromRemote,recordPushedRuntimeSkill,resolvePushDirectoryIdentity}from"./runtime-skill-sync/push.js";export{buildSkillPackage,verifyRuntimeSkillBundle,verifyRuntimeSkillPackage}from"./runtime-skill-sync/zip-package.js";