@lovrabet/lovrabet-cli 2.3.12 → 2.4.0-beta.1

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 (228) hide show
  1. package/README.md +39 -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.d.ts +8 -0
  43. package/lib/commands/metric/contract.js +5 -0
  44. package/lib/commands/metric/definition.d.ts +35 -0
  45. package/lib/commands/metric/definition.js +4 -0
  46. package/lib/commands/metric/detail.d.ts +2 -0
  47. package/lib/commands/metric/detail.js +1 -0
  48. package/lib/commands/metric/exec.d.ts +2 -0
  49. package/lib/commands/metric/exec.js +3 -0
  50. package/lib/commands/metric/index.d.ts +1 -0
  51. package/lib/commands/metric/index.js +1 -0
  52. package/lib/commands/metric/list.d.ts +2 -0
  53. package/lib/commands/metric/list.js +2 -0
  54. package/lib/commands/metric/shared.d.ts +17 -0
  55. package/lib/commands/metric/shared.js +2 -0
  56. package/lib/commands/notification/config-list.js +1 -1
  57. package/lib/commands/notification/index.js +1 -1
  58. package/lib/commands/notification/shared.js +2 -1
  59. package/lib/commands/ocr/index.js +4 -1
  60. package/lib/commands/permit/dataset-get.js +1 -1
  61. package/lib/commands/permit/dataset-set.js +5 -1
  62. package/lib/commands/permit/index.js +1 -1
  63. package/lib/commands/permit/page-get.js +1 -1
  64. package/lib/commands/permit/page-set.js +3 -1
  65. package/lib/commands/permit/role-menus-set.js +4 -1
  66. package/lib/commands/permit/role-menus.js +1 -1
  67. package/lib/commands/permit/shared.js +7 -1
  68. package/lib/commands/personal-bff/index.js +7 -1
  69. package/lib/commands/registry.js +6 -1
  70. package/lib/commands/role/create.js +2 -1
  71. package/lib/commands/role/delete.js +2 -1
  72. package/lib/commands/role/detail.js +1 -1
  73. package/lib/commands/role/index.js +1 -1
  74. package/lib/commands/role/list.js +2 -1
  75. package/lib/commands/role/shared.js +8 -1
  76. package/lib/commands/role/update.js +3 -1
  77. package/lib/commands/role/user-add.js +2 -1
  78. package/lib/commands/role/user-remove.js +2 -1
  79. package/lib/commands/schedule/index.js +7 -1
  80. package/lib/commands/schema.js +1 -1
  81. package/lib/commands/service/dynamic.js +10 -1
  82. package/lib/commands/service/function-name-adapter.js +3 -1
  83. package/lib/commands/service/index.js +8 -1
  84. package/lib/commands/service/registry.js +12 -1
  85. package/lib/commands/skill/commands/create.js +3 -1
  86. package/lib/commands/skill/commands/diagram.js +4 -1
  87. package/lib/commands/skill/commands/install.js +6 -1
  88. package/lib/commands/skill/commands/list.js +3 -1
  89. package/lib/commands/skill/commands/push.js +1 -1
  90. package/lib/commands/skill/commands/validate.js +1 -1
  91. package/lib/commands/skill/diagram.js +3 -1
  92. package/lib/commands/skill/flags.js +4 -1
  93. package/lib/commands/skill/index.js +1 -1
  94. package/lib/commands/skill/manifest-helpers.js +1 -1
  95. package/lib/commands/skill/push-execute.js +11 -1
  96. package/lib/commands/skill/push-flow-helpers.js +4 -1
  97. package/lib/commands/skill/push-retarget.js +1 -1
  98. package/lib/commands/skill/scopes.js +1 -1
  99. package/lib/commands/skill/summary.js +1 -1
  100. package/lib/commands/skill/templates.js +8 -1
  101. package/lib/commands/skill/validate.js +8 -1
  102. package/lib/commands/sql/detail.js +1 -1
  103. package/lib/commands/sql/exec.js +2 -1
  104. package/lib/commands/sql/index.js +1 -1
  105. package/lib/commands/update.d.ts +2 -1
  106. package/lib/commands/update.js +8 -1
  107. package/lib/commands/user-account/bind.js +3 -1
  108. package/lib/commands/user-account/index.js +1 -1
  109. package/lib/commands/workspace/index.js +7 -1
  110. package/lib/config/domain-config.js +6 -1
  111. package/lib/config/schema.js +5 -1
  112. package/lib/constant/app.js +1 -1
  113. package/lib/constant/auth-mode.js +1 -1
  114. package/lib/constant/cli.js +3 -1
  115. package/lib/constant/defaults.js +1 -1
  116. package/lib/constant/distribution.js +1 -1
  117. package/lib/constant/domain.js +2 -1
  118. package/lib/constant/env.js +1 -1
  119. package/lib/constant/output.js +1 -1
  120. package/lib/constant/product.js +2 -1
  121. package/lib/constant/region.js +2 -1
  122. package/lib/constant/risk.js +1 -1
  123. package/lib/constant/url.js +1 -1
  124. package/lib/context.js +11 -1
  125. package/lib/core/api-client.d.ts +4 -0
  126. package/lib/core/api-client.js +38 -1
  127. package/lib/core/db-resolver.js +1 -1
  128. package/lib/core/kb-management-client.js +6 -1
  129. package/lib/core/kb-sdk-errors.js +2 -1
  130. package/lib/core/kb-search-client.js +2 -1
  131. package/lib/core/sdk-client.js +5 -1
  132. package/lib/errors.js +2 -1
  133. package/lib/framework/access-error.js +1 -1
  134. package/lib/framework/build-all-flags.js +1 -1
  135. package/lib/framework/dryrun.js +1 -1
  136. package/lib/framework/flags.js +1 -1
  137. package/lib/framework/help.js +2 -1
  138. package/lib/framework/index.js +1 -1
  139. package/lib/framework/output.js +1 -1
  140. package/lib/framework/preparse.js +3 -1
  141. package/lib/framework/rate-limit.js +2 -1
  142. package/lib/framework/raw-flags.js +2 -1
  143. package/lib/framework/response.js +1 -1
  144. package/lib/framework/runner-confirmation.js +2 -1
  145. package/lib/framework/runner-error.js +2 -1
  146. package/lib/framework/runner.js +9 -1
  147. package/lib/framework/schema-export.js +2 -1
  148. package/lib/framework/service-order.js +1 -1
  149. package/lib/framework/types.js +1 -1
  150. package/lib/generated/build-info.d.ts +4 -4
  151. package/lib/generated/build-info.js +1 -1
  152. package/lib/generated/official-routing.js +2 -1
  153. package/lib/generated/routing-contract.js +1 -1
  154. package/lib/help.js +1 -1
  155. package/lib/runtime/confirmation.js +1 -1
  156. package/lib/runtime/event.js +1 -1
  157. package/lib/runtime/index.js +4 -1
  158. package/lib/runtime/queue.js +1 -1
  159. package/lib/runtime/resolve.js +2 -1
  160. package/lib/runtime/types.js +1 -1
  161. package/lib/services/dataset-import/auto-id-runner.js +9 -1
  162. package/lib/services/dataset-import/excel-reader.js +25 -1
  163. package/lib/services/dataset-import/image-bytes.js +6 -1
  164. package/lib/services/dataset-import/image-ooxml.js +15 -1
  165. package/lib/services/dataset-import/image-runner.js +9 -1
  166. package/lib/services/dataset-import/metadata.js +1 -1
  167. package/lib/services/dataset-import/preview.js +1 -1
  168. package/lib/services/dataset-import/runner.js +13 -1
  169. package/lib/services/dataset-import/types.js +1 -1
  170. package/lib/skills/builtin-skill.js +8 -1
  171. package/lib/skills/install-updated-skill.d.ts +8 -0
  172. package/lib/skills/install-updated-skill.js +3 -0
  173. package/lib/skills/local-skills-installer.d.ts +2 -0
  174. package/lib/skills/local-skills-installer.js +1 -0
  175. package/lib/skills/npx-skills-add.d.ts +2 -2
  176. package/lib/skills/npx-skills-add.js +4 -1
  177. package/lib/skills/runtime-skill-sync/constants.js +1 -1
  178. package/lib/skills/runtime-skill-sync/fs-utils.js +3 -1
  179. package/lib/skills/runtime-skill-sync/hashing.js +1 -1
  180. package/lib/skills/runtime-skill-sync/install-target.js +1 -1
  181. package/lib/skills/runtime-skill-sync/links.js +9 -1
  182. package/lib/skills/runtime-skill-sync/list-local.js +4 -1
  183. package/lib/skills/runtime-skill-sync/local-files.js +5 -1
  184. package/lib/skills/runtime-skill-sync/materialize.js +9 -1
  185. package/lib/skills/runtime-skill-sync/metadata.js +3 -1
  186. package/lib/skills/runtime-skill-sync/paths.js +2 -1
  187. package/lib/skills/runtime-skill-sync/push.js +8 -1
  188. package/lib/skills/runtime-skill-sync/scopes.js +1 -1
  189. package/lib/skills/runtime-skill-sync/types.js +1 -1
  190. package/lib/skills/runtime-skill-sync/zip-codec.js +2 -1
  191. package/lib/skills/runtime-skill-sync/zip-package.js +6 -1
  192. package/lib/skills/runtime-skill-sync.js +1 -1
  193. package/lib/skills/skill-presence.d.ts +1 -34
  194. package/lib/skills/skill-presence.js +2 -1
  195. package/lib/utils/access-key-redaction.js +2 -1
  196. package/lib/utils/apply-jq-filter.js +1 -1
  197. package/lib/utils/cli-version-check.js +2 -1
  198. package/lib/utils/cli-version-policy.js +3 -1
  199. package/lib/utils/logger.js +3 -1
  200. package/lib/utils/lossless-json.js +3 -1
  201. package/lib/utils/params.js +3 -1
  202. package/lib/utils/positive-safe-integer.js +1 -1
  203. package/lib/utils/redaction.js +2 -1
  204. package/lib/utils/runtime-user-id.js +1 -1
  205. package/lib/utils/update-notice.js +3 -1
  206. package/lib/utils/version.js +1 -1
  207. package/lib/utils/write-cli-side-channel.js +1 -1
  208. package/package.json +9 -8
  209. package/skills/lovrabet/SKILL.md +14 -6
  210. package/skills/lovrabet/guides/app-resolution.md +2 -0
  211. package/skills/lovrabet/guides/dataset-and-data-workflow.md +2 -0
  212. package/skills/lovrabet/guides/development-intent-handoff.md +19 -3
  213. package/skills/lovrabet/guides/metric-consumption.md +134 -0
  214. package/skills/lovrabet/guides/sql-and-bff-workflow.md +2 -0
  215. package/skills/lovrabet/references/lovrabet-auth.md +4 -0
  216. package/skills/lovrabet/references/lovrabet-schedule-workflow.md +16 -0
  217. package/skills/lovrabet/references/lovrabet-skill-authoring.md +27 -0
  218. package/skills/lovrabet/references/lovrabet-skill-install.md +1 -1
  219. package/skills/lovrabet/references/lovrabet-update.md +6 -4
  220. package/skills/lovrabet-report-generation/SKILL.md +28 -0
  221. package/skills/lovrabet-report-generation/references/business-skill-reuse.md +19 -0
  222. package/skills/lovrabet-report-generation/references/quality-checks.md +16 -0
  223. package/skills/lovrabet-report-generation/references/report-workflow.md +42 -0
  224. package/skills/lovrabet-report-generation/templates/report-outline.md +10 -0
  225. package/skills/lovrabet.manifest.json +4 -3
  226. package/lib/postinstall.d.ts +0 -2
  227. package/lib/postinstall.js +0 -1
  228. package/scripts/postinstall.mjs +0 -24
@@ -1 +1,8 @@
1
- const a152_0xb79467=a152_0x4c42;(function(_0x55ff5b,_0x3a7572){const _0x240ebb=a152_0x4c42,_0x5c1099=_0x55ff5b();while(!![]){try{const _0xea0f73=parseInt(_0x240ebb(0x89))/0x1+parseInt(_0x240ebb(0xa6))/0x2+parseInt(_0x240ebb(0x97))/0x3*(parseInt(_0x240ebb(0xb0))/0x4)+parseInt(_0x240ebb(0xb1))/0x5+parseInt(_0x240ebb(0xaa))/0x6*(parseInt(_0x240ebb(0xa5))/0x7)+-parseInt(_0x240ebb(0xbb))/0x8*(parseInt(_0x240ebb(0x9c))/0x9)+-parseInt(_0x240ebb(0xb3))/0xa;if(_0xea0f73===_0x3a7572)break;else _0x5c1099['push'](_0x5c1099['shift']());}catch(_0x39e19d){_0x5c1099['push'](_0x5c1099['shift']());}}}(a152_0x5d70,0x6fd38));import{createHash}from'node:crypto';import{lstatSync,readFileSync,readdirSync}from'node:fs';import{homedir}from'node:os';function a152_0x4c42(_0x3d6124,_0x46bb1e){_0x3d6124=_0x3d6124-0x7e;const _0x5d70ce=a152_0x5d70();let _0x4c42fb=_0x5d70ce[_0x3d6124];return _0x4c42fb;}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=a152_0xb79467(0xa1),debug=debuglog('lovrabet-skills');function frontmatterValue(_0x2ff0a7,_0x3c0acf){const _0x586bf8=a152_0xb79467;return _0x2ff0a7[_0x586bf8(0x87)](new RegExp('^'+_0x3c0acf+_0x586bf8(0xb4),'m'))?.[0x1]?.[_0x586bf8(0xa0)]()??'';}function listFiles(_0x180d51,_0x6252f2=_0x180d51){const _0x3915d5=a152_0xb79467;return readdirSync(_0x6252f2,{'withFileTypes':!![]})[_0x3915d5(0xa7)](_0x116a27=>{const _0x2f0232=_0x3915d5,_0x57be1c=join(_0x6252f2,_0x116a27['name']),_0x548f86=lstatSync(_0x57be1c);if(_0x548f86[_0x2f0232(0x86)]())throw new Error(_0x2f0232(0x8c)+_0x57be1c);if(_0x548f86[_0x2f0232(0x94)]())return listFiles(_0x180d51,_0x57be1c);if(!_0x548f86[_0x2f0232(0x83)]())throw new Error(_0x2f0232(0x8f)+_0x57be1c);return[relative(_0x180d51,_0x57be1c)[_0x2f0232(0xc1)](sep)[_0x2f0232(0x9e)]('/')];})[_0x3915d5(0x8d)]((_0x5b6a19,_0x1002f7)=>_0x5b6a19<_0x1002f7?-0x1:_0x5b6a19>_0x1002f7?0x1:0x0);}function digestFiles(_0x2c6c40,_0x132a35){const _0x2d5c06=a152_0xb79467,_0x16fc2d=createHash(_0x2d5c06(0xae));for(const _0xca6059 of _0x132a35){if(_0xca6059[_0x2d5c06(0xb9)]('/')||_0xca6059[_0x2d5c06(0xc1)]('/')[_0x2d5c06(0x9f)]('..')||_0xca6059[_0x2d5c06(0x9f)]('\x5c'))throw new Error(_0x2d5c06(0xa9)+_0xca6059);_0x16fc2d[_0x2d5c06(0x7e)](_0xca6059),_0x16fc2d[_0x2d5c06(0x7e)]('\x00'),_0x16fc2d[_0x2d5c06(0x7e)](readFileSync(join(_0x2c6c40,..._0xca6059[_0x2d5c06(0xc1)]('/')))),_0x16fc2d['update']('\x00');}return _0x16fc2d[_0x2d5c06(0x9d)](_0x2d5c06(0x92));}function sameFiles(_0x31921d,_0x1dfca4){const _0xe5a542=a152_0xb79467;return _0x31921d[_0xe5a542(0x9a)]===_0x1dfca4[_0xe5a542(0x9a)]&&_0x31921d[_0xe5a542(0x91)]((_0x55d690,_0x4e03db)=>_0x55d690===_0x1dfca4[_0x4e03db]);}function readSource(_0x3a46ea){const _0x315021=a152_0xb79467,_0x3e7b98=JSON[_0x315021(0x88)](readFileSync(join(_0x3a46ea,_0x315021(0xc2)),_0x315021(0x82))),_0x2571c0=JSON[_0x315021(0x88)](readFileSync(join(_0x3a46ea,'skills',_0x315021(0x8a)),_0x315021(0x82))),_0xe46e11=join(_0x3a46ea,_0x315021(0xbd),SKILL_NAME),_0x14793e=frontmatterValue(readFileSync(join(_0xe46e11,_0x315021(0xa2)),_0x315021(0x82)),_0x315021(0x9b)),_0x32bebc=listFiles(_0xe46e11);if(_0x2571c0[_0x315021(0x7f)]!==0x1||_0x2571c0['name']!==SKILL_NAME||!_0x3e7b98[_0x315021(0x9b)]||_0x2571c0['packageVersion']!==_0x3e7b98[_0x315021(0x9b)]||_0x2571c0[_0x315021(0xac)]!==_0x3e7b98['version']||_0x14793e!==_0x3e7b98[_0x315021(0x9b)]||!sameFiles(_0x32bebc,_0x2571c0['files'])||digestFiles(_0xe46e11,_0x32bebc)!==_0x2571c0[_0x315021(0x9d)])throw new Error(_0x315021(0xa4));return{'packageVersion':_0x3e7b98['version'],'skillVersion':_0x14793e,'root':_0xe46e11,'manifest':_0x2571c0};}function installedSkillPath(_0x433693){const _0x1ea4ed=a152_0xb79467,_0x1c13ba=resolveInstalledSkill(SKILL_NAME,{'home':_0x433693});if(_0x1c13ba[_0x1ea4ed(0x98)]==='present')return{'state':'present','path':dirname(_0x1c13ba[_0x1ea4ed(0xad)])};if(_0x1c13ba['state']===_0x1ea4ed(0xb8))return{'state':_0x1ea4ed(0xbc)};return{'state':_0x1ea4ed(0xbf),'reason':_0x1c13ba[_0x1ea4ed(0xb7)]};}export function inspectInstalledBuiltinSkillVersion(_0x5b7f5d,_0x29c3bd={}){const _0x116a94=a152_0xb79467,_0x30b153=installedSkillPath(_0x29c3bd[_0x116a94(0xc0)]??homedir());if(_0x30b153['state']===_0x116a94(0xbc))return{'state':'missing','expectedVersion':_0x5b7f5d,'repairCommand':REPAIR_COMMAND};if(_0x30b153[_0x116a94(0x98)]===_0x116a94(0xbf))return{'state':'unverifiable','expectedVersion':_0x5b7f5d,'reason':_0x30b153[_0x116a94(0xb7)],'repairCommand':REPAIR_COMMAND};try{const _0x295320=frontmatterValue(readFileSync(join(_0x30b153[_0x116a94(0xad)],_0x116a94(0xa2)),_0x116a94(0x82)),_0x116a94(0x9b));return{'state':_0x295320===_0x5b7f5d?_0x116a94(0x93):'version_mismatch','expectedVersion':_0x5b7f5d,'skillVersion':_0x295320,'installedPath':_0x30b153[_0x116a94(0xad)],'repairCommand':REPAIR_COMMAND};}catch(_0x4bca64){return{'state':_0x116a94(0xbf),'expectedVersion':_0x5b7f5d,'installedPath':_0x30b153[_0x116a94(0xad)],'reason':_0x4bca64 instanceof Error?_0x4bca64['message']:String(_0x4bca64),'repairCommand':REPAIR_COMMAND};}}function a152_0x5d70(){const _0x25edf9=['length','version','50859EgaoTp','digest','join','includes','trim','lovrabet','SKILL.md','log','Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest','28zJHbAH','424168HcDASY','flatMap','status','Unsafe\x20manifest\x20path:\x20','738810xDVnlp','CLI\x20Built-in\x20Skill\x20','skillVersion','path','sha256','message','4MfwhAB','4420315xJZVCo','pipe','21956920oGljfm',':\x5cs*(.+)$','packageVersion','\x20verified;\x20','reason','absent','startsWith','output','56FrwEHB','missing','skills','files','unverifiable','home','split','package.json','partialFailure','Installer\x20reported\x20partial\x20target\x20failures:\x0a%s','manifest','update','schemaVersion','content_mismatch','skipped','utf8','isFile','packageRoot','count','isSymbolicLink','match','parse','824798rjqAuF','lovrabet.manifest.json','installedPath','Symbolic\x20link\x20is\x20not\x20allowed:\x20','sort','VERIFY_FAILED','Unsupported\x20Skill\x20entry:\x20','unknown','every','hex','current','isDirectory','skills@latest\x20exited\x20','version_mismatch','839412NqROcK','state','Installed\x20Skill\x20state\x20is\x20'];a152_0x5d70=function(){return _0x25edf9;};return a152_0x5d70();}export function inspectBuiltinSkill(_0x3c8e20={}){const _0x1bd34b=a152_0xb79467,_0x2a4aa2=_0x3c8e20[_0x1bd34b(0x84)]??DEFAULT_PACKAGE_ROOT;let _0x4f83dc;try{_0x4f83dc=readSource(_0x2a4aa2);}catch(_0x3c2484){return{'state':_0x1bd34b(0xbf),'packageVersion':_0x1bd34b(0x90),'reason':_0x3c2484 instanceof Error?_0x3c2484[_0x1bd34b(0xaf)]:String(_0x3c2484),'repairCommand':REPAIR_COMMAND};}const _0x5ddf54=installedSkillPath(_0x3c8e20[_0x1bd34b(0xc0)]??homedir());if(_0x5ddf54['state']===_0x1bd34b(0xbc))return{'state':_0x1bd34b(0xbc),'packageVersion':_0x4f83dc['packageVersion'],'repairCommand':REPAIR_COMMAND};if(_0x5ddf54[_0x1bd34b(0x98)]===_0x1bd34b(0xbf))return{'state':'unverifiable','packageVersion':_0x4f83dc['packageVersion'],'reason':_0x5ddf54[_0x1bd34b(0xb7)],'repairCommand':REPAIR_COMMAND};try{const _0x28d2f7=frontmatterValue(readFileSync(join(_0x5ddf54['path'],_0x1bd34b(0xa2)),_0x1bd34b(0x82)),'version');if(_0x28d2f7!==_0x4f83dc[_0x1bd34b(0xac)])return{'state':_0x1bd34b(0x96),'packageVersion':_0x4f83dc['packageVersion'],'skillVersion':_0x28d2f7,'installedPath':_0x5ddf54['path'],'repairCommand':REPAIR_COMMAND};const _0x166f79=listFiles(_0x5ddf54[_0x1bd34b(0xad)]),_0x39fed7=digestFiles(_0x5ddf54[_0x1bd34b(0xad)],_0x166f79);return{'state':sameFiles(_0x166f79,_0x4f83dc[_0x1bd34b(0xc5)][_0x1bd34b(0xbe)])&&_0x39fed7===_0x4f83dc[_0x1bd34b(0xc5)][_0x1bd34b(0x9d)]?_0x1bd34b(0x93):_0x1bd34b(0x80),'packageVersion':_0x4f83dc[_0x1bd34b(0xb5)],'skillVersion':_0x28d2f7,'installedPath':_0x5ddf54[_0x1bd34b(0xad)],'digest':_0x39fed7,'repairCommand':REPAIR_COMMAND};}catch(_0xbcb031){return{'state':'unverifiable','packageVersion':_0x4f83dc['packageVersion'],'installedPath':_0x5ddf54['path'],'reason':_0xbcb031 instanceof Error?_0xbcb031[_0x1bd34b(0xaf)]:String(_0xbcb031),'repairCommand':REPAIR_COMMAND};}}function failure(_0x11816f,_0x505399,_0x2ccc76,_0x25e2cb){const _0x599664=a152_0xb79467;return{'ok':![],'code':_0x11816f,'packageVersion':_0x505399[_0x599664(0xb5)],'skillVersion':_0x505399[_0x599664(0xac)],'installedPath':_0x25e2cb,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0x2ccc76 instanceof Error?_0x2ccc76[_0x599664(0xaf)]:String(_0x2ccc76)};}export function installBuiltinSkill(_0x34b480={}){const _0x1b23bd=a152_0xb79467,_0x3ccf95=_0x34b480[_0x1b23bd(0x84)]??DEFAULT_PACKAGE_ROOT,_0x24a289=_0x34b480[_0x1b23bd(0xc0)]??homedir();let _0x26eeb6;try{_0x26eeb6=readSource(_0x3ccf95);}catch(_0x383a65){return failure('SOURCE_INVALID',{'packageVersion':_0x1b23bd(0x90),'skillVersion':'unknown'},_0x383a65);}const _0x3d71e3=inspectBuiltinSkill({'packageRoot':_0x3ccf95,'home':_0x24a289}),_0x31ec75=runNpxSkillsAddGlobal(_0x3ccf95,_0x26eeb6['root'],{'stdio':_0x34b480['stdio']??_0x1b23bd(0xb2),'expectedSkillName':SKILL_NAME,'presence':{'home':_0x24a289}});if(_0x31ec75[_0x1b23bd(0x81)])return{'ok':!![],'packageVersion':_0x26eeb6[_0x1b23bd(0xb5)],'skillVersion':_0x26eeb6['skillVersion'],'installedPath':_0x3d71e3[_0x1b23bd(0x8b)],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0x31ec75['ok'])return failure('INSTALL_FAILED',_0x26eeb6,_0x31ec75['error']??_0x1b23bd(0x95)+_0x31ec75[_0x1b23bd(0xa8)]);const _0x466db4=inspectBuiltinSkill({'packageRoot':_0x3ccf95,'home':_0x24a289});if(_0x466db4[_0x1b23bd(0x98)]!=='current'){const _0x329d28=_0x466db4['reason']??_0x1b23bd(0x99)+_0x466db4[_0x1b23bd(0x98)];return failure(_0x1b23bd(0x8e),_0x26eeb6,_0x31ec75['partialFailure']?_0x329d28+'\x0a'+_0x31ec75[_0x1b23bd(0xc3)]['output']:_0x329d28,_0x466db4[_0x1b23bd(0x8b)]);}return _0x31ec75[_0x1b23bd(0xc3)]&&(debug(_0x1b23bd(0xc4),_0x31ec75[_0x1b23bd(0xc3)][_0x1b23bd(0xba)]),console[_0x1b23bd(0xa3)](_0x1b23bd(0xab)+_0x26eeb6[_0x1b23bd(0xac)]+_0x1b23bd(0xb6)+_0x31ec75['partialFailure'][_0x1b23bd(0x85)]+'\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.')),{'ok':!![],'packageVersion':_0x26eeb6[_0x1b23bd(0xb5)],'skillVersion':_0x26eeb6[_0x1b23bd(0xac)],'installedPath':_0x466db4[_0x1b23bd(0x8b)],'changed':_0x3d71e3[_0x1b23bd(0x98)]!==_0x1b23bd(0x93),'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}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)}}export function installBuiltinSkill(options={}){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})
7
+ ;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}`;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)
8
+ ;console.log(`CLI Built-in Skill ${source.skillVersion} verified; ${result.partialFailure.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 a153_0x2c9c39=a153_0x23d6;(function(_0x513ed7,_0x37cd61){const _0x32e515=a153_0x23d6,_0x373b55=_0x513ed7();while(!![]){try{const _0x46499f=parseInt(_0x32e515(0x101))/0x1+-parseInt(_0x32e515(0xe4))/0x2+-parseInt(_0x32e515(0xdd))/0x3*(parseInt(_0x32e515(0xfa))/0x4)+parseInt(_0x32e515(0xdb))/0x5*(-parseInt(_0x32e515(0xd5))/0x6)+parseInt(_0x32e515(0xd1))/0x7+-parseInt(_0x32e515(0xdc))/0x8+parseInt(_0x32e515(0xe5))/0x9;if(_0x46499f===_0x37cd61)break;else _0x373b55['push'](_0x373b55['shift']());}catch(_0x1c1aca){_0x373b55['push'](_0x373b55['shift']());}}}(a153_0x5d18,0x796c8));import{execaSync}from'execa';function a153_0x23d6(_0x52538f,_0x27325f){_0x52538f=_0x52538f-0xce;const _0x5d1847=a153_0x5d18();let _0x23d6ee=_0x5d1847[_0x52538f];return _0x23d6ee;}import{LOVRABET_SKILL_SOURCE as a153_0x459203}from'../constant/distribution.js';import{PRODUCT_CONFIG,productEnvName}from'../constant/product.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';export const LOVRABET_SKILL_SOURCE=a153_0x459203;export const LOVRABET_SKILL_GIT_SOURCE=PRODUCT_CONFIG[a153_0x2c9c39(0xfd)];export const LOVRABET_GLOBAL_SKILL_NAME=PRODUCT_CONFIG[a153_0x2c9c39(0xe3)];export function resolveGlobalSkillName(_0x1109ff){const _0x4a5b06=a153_0x2c9c39;switch(_0x1109ff[_0x4a5b06(0xea)]()){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=0x10*0x400*0x400;function failure(_0xc3bde6,_0x4fc10d,_0xcd3232){return{'ok':![],'status':_0x4fc10d,'code':_0xc3bde6,'error':'['+_0xc3bde6+']\x20'+_0xcd3232};}export function shouldSkipNpxSkillsAdd(){return process.env[LOVRABET_SKIP_NPX_SKILLS_ENV]==='1';}function a153_0x5d18(){const _0x263eb6=['code','unverifiable','EPERM','stderr','Skill\x20\x22','SKILL_NOT_INSTALLED','pipe','npx\x20terminated\x20by\x20signal\x20','PERMISSION_DENIED','reason','Installer\x20reported\x20','stdio','4pkBGVH','npx','CHILD_TERMINATED','internalSkillSource','SPAWN_FAILED','partialFailure','unknown','123657HpgZLl','skills@latest','exitCode','npm_config_global','warn','4960578BXOFxQ','log','!\x20Could\x20not\x20verify\x20\x22','message','87798qSxYBP','absent','match','checked','stdout','EACCES','215cSxegP','3884256zNyfqV','2913261wohjFE','shortMessage','\x20failed\x20target(s)','signal','INSTALL_PARTIAL','join','globalSkillName','1544688fjfXnw','22709007rsprzr','presence','expectedSkillName','state','ENOENT','trim','failed','NPX_NOT_FOUND','\x22\x20not\x20found\x20after\x20install\x20(checked\x20'];a153_0x5d18=function(){return _0x263eb6;};return a153_0x5d18();}export function runNpxSkillsAddGlobal(_0x2e2e3e,_0x15d379=LOVRABET_SKILL_SOURCE,_0x2e1b53){const _0x1f2d47=a153_0x2c9c39;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x1bc226=['-y',_0x1f2d47(0x102),'add',_0x15d379,'-g','-y'],_0x172fa9=['npx',..._0x1bc226]['join']('\x20');console[_0x1f2d47(0xd2)]('*\x20'+_0x172fa9);const _0x35d94d={...process.env};delete _0x35d94d[_0x1f2d47(0xcf)],delete _0x35d94d['NPM_CONFIG_GLOBAL'];const _0x152f2a=execaSync(_0x1f2d47(0xfb),_0x1bc226,{'cwd':_0x2e2e3e,'stdio':_0x1f2d47(0xf4),'env':_0x35d94d,'extendEnv':![],'shell':![],'reject':![],'maxBuffer':CHILD_OUTPUT_MAX_BUFFER}),_0x18f5fd=[_0x152f2a[_0x1f2d47(0xd9)]?String(_0x152f2a[_0x1f2d47(0xd9)]):'',_0x152f2a[_0x1f2d47(0xf1)]?String(_0x152f2a[_0x1f2d47(0xf1)]):'']['filter'](Boolean)[_0x1f2d47(0xe2)]('\x0a')[_0x1f2d47(0xea)](),_0xe0f11c=_0x152f2a[_0x1f2d47(0xce)]??null,_0x49b33a=_0x51d396=>{const _0x45aa9d=_0x1f2d47;return _0x2e1b53?.[_0x45aa9d(0xf9)]!==_0x45aa9d(0xf4)&&!_0x51d396[_0x45aa9d(0xff)]&&_0x18f5fd&&console['log'](_0x18f5fd),_0x51d396;};if(_0x152f2a['code']){const _0x2003ea=_0x152f2a[_0x1f2d47(0xee)]===_0x1f2d47(0xe9)?_0x1f2d47(0xec):_0x152f2a['code']===_0x1f2d47(0xf0)||_0x152f2a[_0x1f2d47(0xee)]===_0x1f2d47(0xda)?_0x1f2d47(0xf6):_0x1f2d47(0xfe);return _0x49b33a(failure(_0x2003ea,_0xe0f11c,_0x152f2a[_0x1f2d47(0xde)]??_0x152f2a[_0x1f2d47(0xd4)]??_0x152f2a['code']));}if(_0x152f2a[_0x1f2d47(0xe0)])return _0x49b33a(failure(_0x1f2d47(0xfc),_0xe0f11c,_0x1f2d47(0xf5)+_0x152f2a['signal']));if(_0x152f2a[_0x1f2d47(0xeb)]&&_0xe0f11c===null)return _0x49b33a(failure(_0x1f2d47(0xfe),_0xe0f11c,_0x152f2a[_0x1f2d47(0xde)]??_0x152f2a[_0x1f2d47(0xd4)]??'npx\x20failed\x20to\x20start'));if(_0xe0f11c!==0x0)return _0x49b33a(failure('CHILD_EXIT_NONZERO',_0xe0f11c,_0x18f5fd||_0x152f2a[_0x1f2d47(0xde)]||'exit\x20'+(_0xe0f11c??_0x1f2d47(0x100))));const _0x476008=_0x2e1b53?.[_0x1f2d47(0xe7)]??resolveGlobalSkillName(_0x15d379),_0x5c1551=_0x476008?resolveInstalledSkill(_0x476008,_0x2e1b53?.[_0x1f2d47(0xe6)]):undefined,_0x55e3ad=_0x18f5fd[_0x1f2d47(0xd7)](/Failed to install\s+(\d+)/i);if(_0x55e3ad&&Number(_0x55e3ad[0x1])>0x0){const _0x4319f2=_0x1f2d47(0xf8)+_0x55e3ad[0x1]+_0x1f2d47(0xdf)+(_0x18f5fd?':\x0a'+_0x18f5fd:'');if(_0x5c1551?.[_0x1f2d47(0xe8)]==='present')return{'ok':!![],'status':0x0,'partialFailure':{'count':Number(_0x55e3ad[0x1]),'output':_0x18f5fd}};return _0x49b33a(failure(_0x1f2d47(0xe1),0x0,_0x4319f2));}if(_0x476008&&_0x5c1551){if(_0x5c1551[_0x1f2d47(0xe8)]===_0x1f2d47(0xd6))return _0x49b33a(failure(_0x1f2d47(0xf3),0x0,_0x1f2d47(0xf2)+_0x476008+_0x1f2d47(0xed)+_0x5c1551[_0x1f2d47(0xd8)]['join'](',\x20')+')'));_0x5c1551[_0x1f2d47(0xe8)]===_0x1f2d47(0xef)&&console[_0x1f2d47(0xd0)](_0x1f2d47(0xd3)+_0x476008+'\x22\x20install\x20state:\x20'+_0x5c1551[_0x1f2d47(0xf7)]);}return _0x49b33a({'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
- const a154_0x3c4ab2=a154_0x3e36;(function(_0x29543f,_0x340bf3){const _0x55bc23=a154_0x3e36,_0x2beafe=_0x29543f();while(!![]){try{const _0x2068f8=parseInt(_0x55bc23(0x1c9))/0x1+parseInt(_0x55bc23(0x1cc))/0x2+-parseInt(_0x55bc23(0x1c2))/0x3+-parseInt(_0x55bc23(0x1c1))/0x4+parseInt(_0x55bc23(0x1c0))/0x5+parseInt(_0x55bc23(0x1ca))/0x6*(parseInt(_0x55bc23(0x1c6))/0x7)+-parseInt(_0x55bc23(0x1cd))/0x8;if(_0x2068f8===_0x340bf3)break;else _0x2beafe['push'](_0x2beafe['shift']());}catch(_0x44305f){_0x2beafe['push'](_0x2beafe['shift']());}}}(a154_0x2fd5,0x711a9));function a154_0x3e36(_0x597e34,_0x39c5e0){_0x597e34=_0x597e34-0x1c0;const _0x2fd5cb=a154_0x2fd5();let _0x3e361a=_0x2fd5cb[_0x597e34];return _0x3e361a;}function a154_0x2fd5(){const _0x45b543=['1516848AtDoaI','2980032fWbRuz','dist','.svn','SKILL.md','11565XWbHyp','1134592oLWejW','2075934TImjvr','.next','.DS_Store','.turbo','56bMHOtA','.git','node_modules','621194ZdaxXp','322104muSMXs','.hg'];a154_0x2fd5=function(){return _0x45b543;};return a154_0x2fd5();}export const METADATA_FILE='lovrabet.skill.json';export const SKILL_FILE=a154_0x3c4ab2(0x1d0);export const IGNORED_FILE_NAMES=new Set([METADATA_FILE,a154_0x3c4ab2(0x1c4)]);export const IGNORED_DIR_NAMES=new Set([a154_0x3c4ab2(0x1c7),a154_0x3c4ab2(0x1cb),a154_0x3c4ab2(0x1cf),a154_0x3c4ab2(0x1c8),a154_0x3c4ab2(0x1c3),a154_0x3c4ab2(0x1ce),'build','coverage',a154_0x3c4ab2(0x1c5),'.cache']);
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(_0x5a53fc,_0x3782bd){const _0x1b1ec1=a155_0x4776,_0x5e7630=_0x5a53fc();while(!![]){try{const _0x155383=parseInt(_0x1b1ec1(0xfb))/0x1+parseInt(_0x1b1ec1(0x101))/0x2+parseInt(_0x1b1ec1(0xf5))/0x3*(parseInt(_0x1b1ec1(0xf6))/0x4)+-parseInt(_0x1b1ec1(0xfa))/0x5+parseInt(_0x1b1ec1(0xf1))/0x6+parseInt(_0x1b1ec1(0xf9))/0x7*(parseInt(_0x1b1ec1(0xfd))/0x8)+-parseInt(_0x1b1ec1(0x100))/0x9;if(_0x155383===_0x3782bd)break;else _0x5e7630['push'](_0x5e7630['shift']());}catch(_0x18ded5){_0x5e7630['push'](_0x5e7630['shift']());}}}(a155_0x3970,0xc4bd6));function a155_0x4776(_0x59eba6,_0x3bbcb7){_0x59eba6=_0x59eba6-0xf1;const _0x397080=a155_0x3970();let _0x4776a9=_0x397080[_0x59eba6];return _0x4776a9;}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(_0x15e445,_0x103b1e){const _0x3b8d52=a155_0x4776,_0x694dc5=normalizeSkillRelativePath(_0x103b1e),_0x793fe0=realOrResolved(_0x15e445),_0x3851d9=resolve(_0x793fe0,..._0x694dc5['split']('/'));if(!isPathInside(_0x3851d9,_0x793fe0))throw CliErrors[_0x3b8d52(0xf2)](_0x3b8d52(0xff)+_0x103b1e);return ensureNoSymlinkInManagedPath(_0x793fe0,_0x694dc5),_0x3851d9;}export function ensureNoSymlinkInManagedPath(_0x2bd90a,_0x2581f5){const _0x28abe5=a155_0x4776;let _0x3cc68c=_0x2bd90a;for(const _0x18c762 of _0x2581f5[_0x28abe5(0xfe)]('/')){_0x3cc68c=resolve(_0x3cc68c,_0x18c762);const _0x5568d8=lstatIfPresent(_0x3cc68c);if(_0x5568d8?.[_0x28abe5(0xf3)]())throw CliErrors[_0x28abe5(0xf2)](_0x28abe5(0xf4)+_0x2581f5);}}export function isDanglingSymlink(_0x488031){const _0x246c2f=a155_0x4776;try{return lstatSync(_0x488031)[_0x246c2f(0xf3)]();}catch{return![];}}export function resolveSymlinkTarget(_0x374413){const _0x4ef9b2=readlinkSync(_0x374413);return isAbsolute(_0x4ef9b2)?_0x4ef9b2:resolve(dirname(_0x374413),_0x4ef9b2);}export function isPathInside(_0x560ad8,_0x3b528d){const _0xd103d5=a155_0x4776,_0x19eeb8=_0x560ad8[_0xd103d5(0x104)](sep)?_0x560ad8:''+_0x560ad8+sep,_0x19874e=_0x3b528d['endsWith'](sep)?_0x3b528d:''+_0x3b528d+sep;return _0x560ad8===_0x3b528d||_0x19eeb8[_0xd103d5(0x102)](_0x19874e);}export function realOrResolved(_0x2b08ca){try{return realpathSync(_0x2b08ca);}catch{return resolve(_0x2b08ca);}}export function lstatIfPresent(_0x39c157){try{return lstatSync(_0x39c157);}catch{return undefined;}}export function writeTextAtomic(_0xc32abf,_0x3f5b05,_0x27214e){const _0x55dea6=a155_0x4776;writeBytesAtomic(_0xc32abf,Buffer[_0x55dea6(0xfc)](_0x3f5b05,_0x55dea6(0x103)),_0x27214e);}export function writeBytesAtomic(_0x440e11,_0x1c148a,_0x2f24bb){const _0x2fca1d=a155_0x4776,_0x59f468=_0x440e11+_0x2fca1d(0xf8);try{writeFileSync(_0x59f468,_0x1c148a,{'mode':_0x2f24bb}),renameSync(_0x59f468,_0x440e11);}catch(_0x3d7940){try{rmSync(_0x59f468,{'force':!![]});}catch{}throw _0x3d7940;}}export function writeJsonAtomic(_0x419ef5,_0x47321e){const _0x413eb0=a155_0x4776;writeTextAtomic(_0x419ef5,JSON[_0x413eb0(0xf7)](_0x47321e,null,0x2)+'\x0a',0x180);}function a155_0x3970(){const _0x2740a4=['from','520424ggKEXl','split','Unsafe\x20Skill\x20file\x20path:\x20','15325389jEryvl','2887890lUWmHD','startsWith','utf8','endsWith','1222662gUqLBB','validation','isSymbolicLink','Refusing\x20to\x20write\x20through\x20Skill\x20symlink\x20path:\x20','10485JVVWmG','388SGQmRh','stringify','.tmp','91SaoGPw','7452730yeOEHX','1166787EjurpH'];a155_0x3970=function(){return _0x2740a4;};return a155_0x3970();}
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(_0x5271be,_0x8c5f30){const _0x448b00=a156_0x14f3,_0x3da25f=_0x5271be();while(!![]){try{const _0x535b11=-parseInt(_0x448b00(0x9c))/0x1+-parseInt(_0x448b00(0x9d))/0x2+parseInt(_0x448b00(0x97))/0x3+-parseInt(_0x448b00(0x9f))/0x4*(-parseInt(_0x448b00(0xa0))/0x5)+-parseInt(_0x448b00(0x98))/0x6*(parseInt(_0x448b00(0x9a))/0x7)+parseInt(_0x448b00(0x93))/0x8+-parseInt(_0x448b00(0x96))/0x9*(parseInt(_0x448b00(0xa1))/0xa);if(_0x535b11===_0x8c5f30)break;else _0x3da25f['push'](_0x3da25f['shift']());}catch(_0x3dbc6a){_0x3da25f['push'](_0x3da25f['shift']());}}}(a156_0x4889,0x6f4e4));import{createHash}from'node:crypto';function a156_0x4889(){const _0x14ec1b=['sha256','2177IVKYwa','hex','412905nnxCiO','1367216XyPNiO','size','76ySOAQE','234190gquoaE','20FmkqUO','digest','7080176ZoGAPF','update','path','2165058samqAV','2471064MhiUgy','10902aGjhTs'];a156_0x4889=function(){return _0x14ec1b;};return a156_0x4889();}function a156_0x14f3(_0x108f3b,_0x4ea214){_0x108f3b=_0x108f3b-0x92;const _0x4889e6=a156_0x4889();let _0x14f3b8=_0x4889e6[_0x108f3b];return _0x14f3b8;}import{fileContent,normalizeManifestFiles}from'./local-files.js';export function contentHash(_0x3c4c33){const _0x12daec=a156_0x14f3;return createHash('sha256')['update'](_0x3c4c33)[_0x12daec(0x92)]('hex');}export function fileHash(_0xbf53e){return bufferSha256(fileContent(_0xbf53e));}export function bufferSha256(_0x367f68){const _0x38e509=a156_0x14f3;return createHash('sha256')[_0x38e509(0x94)](_0x367f68)['digest']('hex');}export function fileTreeHash(_0x2d401d){const _0x30c04e=a156_0x14f3,_0x2a8bfb=createHash('sha256');for(const _0x4b878a of normalizeManifestFiles(_0x2d401d)){_0x2a8bfb['update'](_0x4b878a[_0x30c04e(0x95)]),_0x2a8bfb['update']('\x00'),_0x2a8bfb[_0x30c04e(0x94)](_0x4b878a[_0x30c04e(0x99)]),_0x2a8bfb[_0x30c04e(0x94)]('\x00'),_0x2a8bfb[_0x30c04e(0x94)](String(_0x4b878a[_0x30c04e(0x9e)])),_0x2a8bfb['update']('\x00');}return _0x2a8bfb[_0x30c04e(0x92)](_0x30c04e(0x9b));}
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 a157_0xf854bb=a157_0xccab;(function(_0x23bbec,_0x129262){const _0x45ba09=a157_0xccab,_0x3cb1ed=_0x23bbec();while(!![]){try{const _0x1fe576=parseInt(_0x45ba09(0x182))/0x1*(parseInt(_0x45ba09(0x18d))/0x2)+parseInt(_0x45ba09(0x188))/0x3*(parseInt(_0x45ba09(0x184))/0x4)+-parseInt(_0x45ba09(0x181))/0x5+parseInt(_0x45ba09(0x187))/0x6+parseInt(_0x45ba09(0x192))/0x7*(-parseInt(_0x45ba09(0x186))/0x8)+-parseInt(_0x45ba09(0x191))/0x9*(-parseInt(_0x45ba09(0x18a))/0xa)+-parseInt(_0x45ba09(0x18e))/0xb*(-parseInt(_0x45ba09(0x190))/0xc);if(_0x1fe576===_0x129262)break;else _0x3cb1ed['push'](_0x3cb1ed['shift']());}catch(_0x3dcca6){_0x3cb1ed['push'](_0x3cb1ed['shift']());}}}(a157_0x2d64,0x62dba));function a157_0xccab(_0x6e015a,_0x13d6bb){_0x6e015a=_0x6e015a-0x181;const _0x2d6489=a157_0x2d64();let _0xccabb3=_0x2d6489[_0x6e015a];return _0xccabb3;}function a157_0x2d64(){const _0x518232=['managedRoot','165492WigPqV','cwd','472YWqHWj','2311752tjgQSl','51IDvMUk','project','4510jKQfgB','freeze','global','476452GvRaXl','11gspQNs','.agents','5907588PtMmCL','63yMdHMY','80612EmDLZM','3689745CFkbdl','1FXqPWh'];a157_0x2d64=function(){return _0x518232;};return a157_0x2d64();}import{resolve}from'node:path';import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from'./paths.js';export function resolveRuntimeSkillInstallTarget(_0x194e2b,_0x213e94=a157_0xf854bb(0x18c),_0x4c8934={}){const _0x1df7ce=a157_0xf854bb,_0x445e93=resolveSkillSyncPaths(_0x4c8934),_0x33e4f0=safePathSegment(_0x194e2b,'appCode'),_0x291d21=_0x213e94===_0x1df7ce(0x189)?[resolve(_0x4c8934[_0x1df7ce(0x185)]??process['cwd'](),_0x1df7ce(0x18f),'skills')]:runtimeAgentSkillRoots(_0x445e93);return Object[_0x1df7ce(0x18b)]({'scope':_0x213e94,'appCode':_0x33e4f0,'skillRoots':Object[_0x1df7ce(0x18b)](_0x291d21),'managedRoot':_0x445e93[_0x1df7ce(0x183)]});}
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 a158_0x5b06f6=a158_0x389e;(function(_0x1759c9,_0x55e11b){const _0x35bb74=a158_0x389e,_0x34fa6c=_0x1759c9();while(!![]){try{const _0x847707=-parseInt(_0x35bb74(0x179))/0x1*(parseInt(_0x35bb74(0x193))/0x2)+parseInt(_0x35bb74(0x187))/0x3+-parseInt(_0x35bb74(0x185))/0x4+-parseInt(_0x35bb74(0x18d))/0x5*(parseInt(_0x35bb74(0x186))/0x6)+parseInt(_0x35bb74(0x17f))/0x7+parseInt(_0x35bb74(0x17e))/0x8*(parseInt(_0x35bb74(0x195))/0x9)+-parseInt(_0x35bb74(0x18a))/0xa;if(_0x847707===_0x55e11b)break;else _0x34fa6c['push'](_0x34fa6c['shift']());}catch(_0x324d92){_0x34fa6c['push'](_0x34fa6c['shift']());}}}(a158_0x200a,0xd6148));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';import a158_0xc0b92c 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';function a158_0x389e(_0x2dfa3c,_0x5831cb){_0x2dfa3c=_0x2dfa3c-0x164;const _0x200a5d=a158_0x200a();let _0x389ea3=_0x200a5d[_0x2dfa3c];return _0x389ea3;}const {copySync,ensureDirSync,removeSync}=a158_0xc0b92c,RESERVED_PROJECT_SKILL_CODES=new Set([a158_0x5b06f6(0x199),a158_0x5b06f6(0x177),a158_0x5b06f6(0x165)]);export function linkEffectiveRuntimeSkills(_0x2cf057,_0x3590ad){const _0x4a04fe=a158_0x5b06f6,_0x52ce6a=new Map();for(const _0x3ab827 of _0x2cf057){const _0x444905=_0x3ab827['skill'][_0x4a04fe(0x169)];if(!_0x444905)continue;const _0x5efb79=_0x52ce6a[_0x4a04fe(0x197)](_0x444905);(!_0x5efb79||_0x3ab827[_0x4a04fe(0x18c)]==='personal')&&_0x52ce6a['set'](_0x444905,_0x3ab827);}const _0x31c72b=[];for(const _0x27bd3b of _0x52ce6a['values']()){const _0x54610f=requireSkillCode(_0x27bd3b[_0x4a04fe(0x16d)]),_0x1fec6b=readMetadataIfPresent(_0x27bd3b[_0x4a04fe(0x18e)]);if(_0x1fec6b?.['appCode']!==_0x3590ad[_0x4a04fe(0x17c)]||_0x1fec6b[_0x4a04fe(0x169)]!==_0x54610f)throw CliErrors[_0x4a04fe(0x181)]('Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20'+_0x3590ad[_0x4a04fe(0x17c)]+':\x20'+_0x27bd3b[_0x4a04fe(0x18e)]);const _0xa1728f=runtimeSkillLinkName(_0x3590ad,_0x54610f);for(const _0x149f95 of _0x3590ad[_0x4a04fe(0x17a)]){_0x31c72b[_0x4a04fe(0x17b)](ensureManagedSymlink(resolve(_0x149f95,_0xa1728f),_0x27bd3b['dir'],_0x3590ad,_0x54610f));}}return _0x31c72b;}export function pruneStaleRuntimeSkillLinks(_0x5e0de3,_0x2c502f,_0x3d55cb){const _0x390ab2=a158_0x5b06f6,_0x180e7f=new Set([..._0x2c502f][_0x390ab2(0x18b)](_0x4ef42b=>_0x4ef42b[_0x390ab2(0x184)]())[_0x390ab2(0x167)](Boolean)),_0x5b2f04=_0x3d55cb?new Set([..._0x3d55cb]['map'](_0x20ffa9=>_0x20ffa9['trim']())['filter'](Boolean)):undefined,_0x1486af=[];for(const _0xc1ef3c of _0x5e0de3['skillRoots']){for(const _0x2ab468 of managedTargetSkillLinkPaths(_0xc1ef3c,_0x5e0de3)){const _0x5e158c=runtimeSkillCodeFromLink(_0x5e0de3,_0x2ab468);if(_0x5b2f04&&!_0x5b2f04[_0x390ab2(0x166)](_0x5e158c))continue;if(_0x180e7f[_0x390ab2(0x166)](_0x5e158c))continue;_0x1486af[_0x390ab2(0x17b)](removeManagedSkillLink(_0x2ab468,_0x5e0de3,_0x5e158c));}}return _0x1486af;}export function pruneStaleRuntimeSkillCache(_0x243266,_0x559589={}){const _0x1df652=a158_0x5b06f6,_0x32e8d2=new Set([..._0x243266[_0x1df652(0x183)]][_0x1df652(0x18b)](_0x3e8e35=>_0x3e8e35[_0x1df652(0x184)]())[_0x1df652(0x167)](Boolean)),_0x234e9d=_0x243266[_0x1df652(0x190)]?new Set([..._0x243266[_0x1df652(0x190)]]['map'](_0x584f72=>_0x584f72[_0x1df652(0x184)]())[_0x1df652(0x167)](Boolean)):undefined,_0x47a16b=_0x243266[_0x1df652(0x16b)]??[_0x1df652(0x173),_0x1df652(0x188)],_0x271836=resolve(getRuntimeSkillCacheRoot(_0x243266[_0x1df652(0x170)],_0x243266[_0x1df652(0x168)],_0x559589),safePathSegment(_0x243266[_0x1df652(0x17c)],'appCode')),_0x367c67=[];for(const _0x1fdb83 of _0x47a16b){const _0x2bbef4=resolve(_0x271836,_0x1fdb83);if(!existsSync(_0x2bbef4))continue;for(const _0x3d7a3c of readdirSync(_0x2bbef4,{'withFileTypes':!![]})){if(!_0x3d7a3c[_0x1df652(0x196)]())continue;const _0x52da42=_0x3d7a3c[_0x1df652(0x16e)];if(_0x234e9d&&!_0x234e9d['has'](_0x52da42))continue;if(_0x32e8d2[_0x1df652(0x166)](_0x52da42))continue;const _0x1b1ce7=resolve(_0x2bbef4,_0x52da42),_0xc77977=readMetadataIfPresent(resolve(_0x1b1ce7,METADATA_FILE));if(_0xc77977?.['appCode']!==_0x243266[_0x1df652(0x17c)]||_0xc77977[_0x1df652(0x18c)]!==_0x1fdb83||_0xc77977[_0x1df652(0x169)]!==_0x52da42){_0x367c67[_0x1df652(0x17b)]({'path':_0x1b1ce7,'action':'skipped','reason':_0x1df652(0x192)});continue;}if(isLinkedFromAnyRoot(_0x1b1ce7,_0x243266[_0x1df652(0x19a)]??[])){_0x367c67[_0x1df652(0x17b)]({'path':_0x1b1ce7,'action':_0x1df652(0x174),'reason':'linked-from-protected-root'});continue;}removeSync(_0x1b1ce7),_0x367c67['push']({'path':_0x1b1ce7,'action':_0x1df652(0x16a)});}}return _0x367c67;}export function linkGlobalRuntimeSkills(_0x4f68a9,_0x44d7ba={}){const _0x141c9f=a158_0x5b06f6,_0x3275a5=resolveSkillSyncPaths(_0x44d7ba),_0x30263c=[];for(const _0x4726fd of _0x4f68a9){if(_0x4726fd[_0x141c9f(0x18c)]!=='builtin')throw CliErrors['validation']('Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20'+_0x4726fd[_0x141c9f(0x18c)]);const _0x416e6b=requireSkillCode(_0x4726fd['skill']),_0xc02a8d=copyManagedSkillDirectory(_0x4726fd[_0x141c9f(0x16f)],resolve(_0x3275a5[_0x141c9f(0x194)],_0x416e6b));_0x30263c[_0x141c9f(0x17b)]({..._0xc02a8d,'contentHash':_0x4726fd[_0x141c9f(0x18f)]});}return _0x30263c;}function ensureManagedSymlink(_0x97ec02,_0x21f769,_0x92ac2a,_0x3a3d6d){const _0x58bb7e=a158_0x5b06f6;mkdirSync(dirname(_0x97ec02),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x97ec02)||isDanglingSymlink(_0x97ec02)){const _0x4d2e73=lstatSync(_0x97ec02);if(!_0x4d2e73[_0x58bb7e(0x172)]())throw CliErrors[_0x58bb7e(0x181)](_0x58bb7e(0x164)+_0x97ec02);const _0x43ded0=resolveSymlinkTarget(_0x97ec02);if(!isPathInside(realOrResolved(_0x43ded0),realOrResolved(_0x92ac2a[_0x58bb7e(0x19b)])))throw CliErrors[_0x58bb7e(0x181)]('Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20'+_0x97ec02);if(realOrResolved(_0x43ded0)===realOrResolved(_0x21f769))return{'path':_0x97ec02,'target':_0x21f769,'action':_0x58bb7e(0x198)};const _0x1f3821=readMetadataIfPresent(resolve(_0x43ded0,METADATA_FILE));if(_0x92ac2a[_0x58bb7e(0x18c)]===_0x58bb7e(0x180)&&(_0x1f3821?.['appCode']!==_0x92ac2a[_0x58bb7e(0x17c)]||_0x1f3821['skillCode']!==_0x3a3d6d))throw CliErrors[_0x58bb7e(0x181)]('Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20'+_0x97ec02);return unlinkSync(_0x97ec02),symlinkSync(_0x21f769,_0x97ec02,_0x58bb7e(0x16f)),{'path':_0x97ec02,'target':_0x21f769,'action':_0x58bb7e(0x178)};}return symlinkSync(_0x21f769,_0x97ec02,_0x58bb7e(0x16f)),{'path':_0x97ec02,'target':_0x21f769,'action':_0x58bb7e(0x182)};}function managedTargetSkillLinkPaths(_0x502f9d,_0xf3eda){const _0x31ce9b=a158_0x5b06f6;if(!existsSync(_0x502f9d))return[];const _0x5e7143=_0xf3eda[_0x31ce9b(0x17c)]+'--';return readdirSync(_0x502f9d,{'withFileTypes':!![]})[_0x31ce9b(0x167)](_0x3a950c=>_0xf3eda[_0x31ce9b(0x18c)]===_0x31ce9b(0x180)||_0x3a950c['name'][_0x31ce9b(0x189)](_0x5e7143))[_0x31ce9b(0x18b)](_0x4bda3e=>resolve(_0x502f9d,_0x4bda3e[_0x31ce9b(0x16e)]));}function removeManagedSkillLink(_0x5aaefd,_0x2eea9f,_0x4343cb){const _0x4d5039=a158_0x5b06f6,_0x344722=lstatIfPresent(_0x5aaefd);if(!_0x344722?.[_0x4d5039(0x172)]())return{'path':_0x5aaefd,'action':_0x4d5039(0x174),'reason':_0x4d5039(0x175)};const _0x1fbbbd=resolveSymlinkTarget(_0x5aaefd);if(!isPathInside(realOrResolved(_0x1fbbbd),realOrResolved(_0x2eea9f[_0x4d5039(0x19b)])))return{'path':_0x5aaefd,'action':_0x4d5039(0x174),'reason':'external-symlink'};const _0x25c8d0=readMetadataIfPresent(resolve(_0x1fbbbd,METADATA_FILE));if(_0x2eea9f['scope']===_0x4d5039(0x180)&&(_0x25c8d0?.[_0x4d5039(0x17c)]!==_0x2eea9f[_0x4d5039(0x17c)]||_0x25c8d0['skillCode']!==_0x4343cb))return{'path':_0x5aaefd,'action':_0x4d5039(0x174),'reason':_0x4d5039(0x192)};return unlinkSync(_0x5aaefd),{'path':_0x5aaefd,'action':_0x4d5039(0x16a)};}function isLinkedFromAnyRoot(_0x146cf9,_0x327494){const _0x4d1409=a158_0x5b06f6,_0x4902ce=realOrResolved(_0x146cf9);for(const _0x5bad59 of _0x327494){if(!existsSync(_0x5bad59))continue;for(const _0x534f1c of readdirSync(_0x5bad59,{'withFileTypes':!![]})){if(!_0x534f1c[_0x4d1409(0x172)]())continue;const _0x310bf1=resolve(_0x5bad59,_0x534f1c[_0x4d1409(0x16e)]);if(realOrResolved(resolveSymlinkTarget(_0x310bf1))===_0x4902ce)return!![];}}return![];}function runtimeSkillLinkName(_0x542565,_0x2f6425){const _0x1090ab=a158_0x5b06f6,_0x4c7cb2=safePathSegment(_0x2f6425,_0x1090ab(0x169));if(_0x542565[_0x1090ab(0x18c)]===_0x1090ab(0x180)&&RESERVED_PROJECT_SKILL_CODES[_0x1090ab(0x166)](_0x4c7cb2))throw CliErrors['validation']('Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20'+_0x4c7cb2);return _0x542565[_0x1090ab(0x18c)]===_0x1090ab(0x180)?_0x4c7cb2:_0x542565[_0x1090ab(0x17c)]+'--'+_0x4c7cb2;}function runtimeSkillCodeFromLink(_0x4c4f2c,_0x1688d1){const _0x3dc92f=a158_0x5b06f6,_0x3052ee=basename(_0x1688d1);return _0x4c4f2c[_0x3dc92f(0x18c)]==='project'?_0x3052ee:_0x3052ee['slice']((_0x4c4f2c[_0x3dc92f(0x17c)]+'--')[_0x3dc92f(0x17d)]);}function a158_0x200a(){const _0x36935e=['9885780QUhrVf','map','scope','5bLNbNO','metadataPath','contentHash','pruneSkillCodes','Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20','metadata-mismatch','1790AWHPhk','agentsSkillsDir','32229PwxuIz','isDirectory','get','unchanged','lovrabet','protectedLinkRoots','managedRoot','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','secret-retriever','has','filter','accessKey','skillCode','removed','scopes','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','skill','name','dir','env','builtin','isSymbolicLink','personal','skipped','not-managed-symlink','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','runtime-observe','updated','491QgXyOj','skillRoots','push','appCode','length','2920YcZUun','8116563oxvQHB','project','validation','created','activeSkillCodes','trim','2980700bCmQfo','6744834dysbAI','5122905gausmq','company','startsWith'];a158_0x200a=function(){return _0x36935e;};return a158_0x200a();}export function copyManagedSkillDirectory(_0x1370b4,_0x317411){const _0x2c913c=a158_0x5b06f6,_0x59a393=resolve(_0x317411,METADATA_FILE),_0x38b8d2=existsSync(_0x317411);if(_0x38b8d2){const _0x232561=lstatSync(_0x317411);if(_0x232561[_0x2c913c(0x172)]())throw CliErrors[_0x2c913c(0x181)](_0x2c913c(0x16c)+_0x317411);if(!_0x232561[_0x2c913c(0x196)]())throw CliErrors[_0x2c913c(0x181)]('Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20'+_0x317411);const _0x376578=readMetadataIfPresent(_0x59a393);if(_0x376578?.['scope']!==_0x2c913c(0x171))throw CliErrors[_0x2c913c(0x181)](_0x2c913c(0x191)+_0x317411);}ensureDirSync(dirname(_0x317411));const _0x4dc323=_0x38b8d2?readMetadataIfPresent(_0x59a393)?.[_0x2c913c(0x18f)]:undefined,_0x5bb9b3=readMetadataIfPresent(resolve(_0x1370b4,METADATA_FILE))?.['contentHash'];return _0x38b8d2&&removeSync(_0x317411),copySkillDirectory(_0x1370b4,_0x317411),{'path':_0x317411,'target':_0x1370b4,'action':!_0x38b8d2?'created':_0x4dc323===_0x5bb9b3?_0x2c913c(0x198):_0x2c913c(0x178)};}function copySkillDirectory(_0x15dae5,_0x15d00c){copySync(_0x15dae5,_0x15d00c,{'dereference':![],'overwrite':!![],'filter'(_0x3c8b41){const _0x3dad75=a158_0x389e;if(lstatSync(_0x3c8b41)[_0x3dad75(0x172)]())throw CliErrors['validation'](_0x3dad75(0x176)+_0x3c8b41);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(_0x53564c,_0x1afb79){const _0x3ad749=a159_0x10f2,_0x332948=_0x53564c();while(!![]){try{const _0x50e4a0=parseInt(_0x3ad749(0x1bd))/0x1*(-parseInt(_0x3ad749(0x1bb))/0x2)+-parseInt(_0x3ad749(0x1be))/0x3+parseInt(_0x3ad749(0x1aa))/0x4*(parseInt(_0x3ad749(0x1cb))/0x5)+parseInt(_0x3ad749(0x1c7))/0x6*(parseInt(_0x3ad749(0x1b5))/0x7)+-parseInt(_0x3ad749(0x1d5))/0x8*(parseInt(_0x3ad749(0x1a9))/0x9)+parseInt(_0x3ad749(0x1d8))/0xa+-parseInt(_0x3ad749(0x1d7))/0xb*(-parseInt(_0x3ad749(0x1b9))/0xc);if(_0x50e4a0===_0x1afb79)break;else _0x332948['push'](_0x332948['shift']());}catch(_0x12b148){_0x332948['push'](_0x332948['shift']());}}}(a159_0x2366,0xb413f));function a159_0x10f2(_0x3cac13,_0x2e9173){_0x3cac13=_0x3cac13-0x1a9;const _0x236681=a159_0x2366();let _0x10f2b4=_0x236681[_0x3cac13];return _0x10f2b4;}import{existsSync,readdirSync}from'node:fs';import{resolve}from'node:path';function a159_0x2366(){const _0xdb8d32=['local','\x20!=\x20','filter','code','tags','startsWith','7464xbiZLK','sort','118514qesMbx','10554160izILmK','9063cJvssr','20HGOkfQ','skillMdPath','values','localeCompare','linkedPath','set','push','includes','map','trim','scope','1579291pPbPfF','isDirectory','has','get','1476uslxQf','accessKey','112vbFvaW','linkedPaths','8606sbSflW','1862160sYUoyI','skillRoots','metadataPath','builtin','scopes','skillCode','validation','name','isSymbolicLink','6fJYsoo','appCode','isArray','dir','173555zjJbEX','cache','env','source'];a159_0x2366=function(){return _0xdb8d32;};return a159_0x2366();}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(_0x575ebc,_0x3c26b2,_0x233ddc={}){const _0x207667=a159_0x10f2,_0x2dd496=safePathSegment(_0x575ebc[_0x207667(0x1c8)],_0x207667(0x1c8));if(_0x3c26b2[_0x207667(0x1c8)]!==_0x2dd496)throw CliErrors[_0x207667(0x1c4)]('Runtime\x20Skill\x20install\x20target\x20app\x20mismatch:\x20'+_0x3c26b2[_0x207667(0x1c8)]+_0x207667(0x1d0)+_0x2dd496);const _0x3201b1=normalizeRuntimeSkillScopes(_0x575ebc[_0x207667(0x1c2)]),_0x4c411e=new Set(_0x3201b1),_0x341bcc=_0x575ebc[_0x207667(0x1d2)]?.[_0x207667(0x1b3)](),_0x1c6bf2=new Map(),_0x51aa54=resolve(getRuntimeSkillCacheRoot(_0x575ebc[_0x207667(0x1cd)],_0x575ebc[_0x207667(0x1ba)],_0x233ddc),_0x2dd496);for(const _0x510426 of _0x3201b1){for(const _0x3e547d of localSkillEntryDirs(resolve(_0x51aa54,_0x510426))){collectLocalRuntimeSkill(_0x1c6bf2,_0x3e547d,{'appCode':_0x2dd496,'scopes':_0x4c411e,'code':_0x341bcc,'source':'cache'});}}for(const _0x29c148 of _0x3c26b2[_0x207667(0x1bf)]){for(const _0x13bec9 of localSkillLinkCandidates(_0x29c148,_0x3c26b2,_0x4c411e)){collectLocalRuntimeSkill(_0x1c6bf2,_0x13bec9,{'appCode':_0x2dd496,'scopes':_0x4c411e,'code':_0x341bcc,'source':'link','linkedPath':_0x13bec9});}}return Array['from'](_0x1c6bf2[_0x207667(0x1ac)]())[_0x207667(0x1d6)](compareLocalRuntimeSkills);}function localSkillEntryDirs(_0x2b7e52){const _0x43e5f6=a159_0x10f2;if(!existsSync(_0x2b7e52))return[];return readdirSync(_0x2b7e52,{'withFileTypes':!![]})[_0x43e5f6(0x1d1)](_0x4deb28=>_0x4deb28[_0x43e5f6(0x1b6)]()||_0x4deb28[_0x43e5f6(0x1c6)]())[_0x43e5f6(0x1b2)](_0x5dbf97=>resolve(_0x2b7e52,_0x5dbf97[_0x43e5f6(0x1c5)]));}function localSkillLinkCandidates(_0x18138f,_0x38e034,_0x468ef1){const _0x37bf9a=a159_0x10f2;if(!existsSync(_0x18138f))return[];const _0x575f0d=_0x38e034[_0x37bf9a(0x1c8)]+'--';return readdirSync(_0x18138f,{'withFileTypes':!![]})['filter'](_0x519578=>_0x519578[_0x37bf9a(0x1b6)]()||_0x519578['isSymbolicLink']())[_0x37bf9a(0x1d1)](_0x538e44=>_0x38e034['scope']==='project'||_0x538e44[_0x37bf9a(0x1c5)][_0x37bf9a(0x1d4)](_0x575f0d)||_0x468ef1[_0x37bf9a(0x1b7)](_0x37bf9a(0x1c1)))[_0x37bf9a(0x1b2)](_0x553757=>resolve(_0x18138f,_0x553757[_0x37bf9a(0x1c5)]));}function collectLocalRuntimeSkill(_0x3788d1,_0x56a44b,_0x5e0c83){const _0xf1ea1a=a159_0x10f2,_0x4c6c0a=resolve(_0x56a44b,METADATA_FILE),_0x5a0590=readMetadataIfPresent(_0x4c6c0a);if(!_0x5a0590)return;if(_0x5a0590['appCode']!==_0x5e0c83[_0xf1ea1a(0x1c8)])return;if(!isRuntimeSkillScope(_0x5a0590['scope'])||!_0x5e0c83[_0xf1ea1a(0x1c2)][_0xf1ea1a(0x1b7)](_0x5a0590[_0xf1ea1a(0x1b4)]))return;const _0x15595f=_0x5a0590[_0xf1ea1a(0x1c3)]?.[_0xf1ea1a(0x1b3)]();if(!_0x15595f)return;if(_0x5e0c83[_0xf1ea1a(0x1d2)]&&_0x15595f!==_0x5e0c83[_0xf1ea1a(0x1d2)])return;const _0x220154=_0x5a0590[_0xf1ea1a(0x1b4)]+':'+_0x15595f,_0x3b9e6b=_0x5e0c83['linkedPath']?[_0x5e0c83[_0xf1ea1a(0x1ae)]]:[],_0x51595c=_0x3788d1[_0xf1ea1a(0x1b8)](_0x220154);if(_0x51595c){_0x5e0c83[_0xf1ea1a(0x1ce)]===_0xf1ea1a(0x1cc)&&(_0x51595c[_0xf1ea1a(0x1ca)]=_0x56a44b,_0x51595c['cacheDir']=_0x56a44b,_0x51595c[_0xf1ea1a(0x1ab)]=resolve(_0x56a44b,SKILL_FILE),_0x51595c[_0xf1ea1a(0x1c0)]=_0x4c6c0a);for(const _0x10ac19 of _0x3b9e6b){!_0x51595c[_0xf1ea1a(0x1bc)][_0xf1ea1a(0x1b1)](_0x10ac19)&&_0x51595c['linkedPaths'][_0xf1ea1a(0x1b0)](_0x10ac19);}_0x51595c['linkedPaths'][_0xf1ea1a(0x1d6)]();return;}_0x3788d1[_0xf1ea1a(0x1af)](_0x220154,{..._0x5a0590,'tags':Array[_0xf1ea1a(0x1c9)](_0x5a0590['tags'])?_0x5a0590[_0xf1ea1a(0x1d3)]:[],'scope':_0x5a0590['scope'],'source':_0xf1ea1a(0x1cf),'dir':_0x56a44b,'cacheDir':_0x5e0c83[_0xf1ea1a(0x1ce)]==='cache'?_0x56a44b:undefined,'skillMdPath':resolve(_0x56a44b,SKILL_FILE),'metadataPath':_0x4c6c0a,'linkedPaths':_0x3b9e6b});}function compareLocalRuntimeSkills(_0xa8139c,_0x354f72){const _0x51f67d=a159_0x10f2,_0x2dcd70={'personal':0x0,'company':0x1,'builtin':0x2};return _0x2dcd70[_0xa8139c[_0x51f67d(0x1b4)]]-_0x2dcd70[_0x354f72[_0x51f67d(0x1b4)]]||_0xa8139c['skillCode'][_0x51f67d(0x1ad)](_0x354f72['skillCode'])||_0xa8139c[_0x51f67d(0x1ca)][_0x51f67d(0x1ad)](_0x354f72[_0x51f67d(0x1ca)]);}
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(_0x1b24fc,_0x314068){const _0x203d57=a160_0x1dd9,_0x5b1deb=_0x1b24fc();while(!![]){try{const _0x1d8d77=parseInt(_0x203d57(0x1e3))/0x1*(-parseInt(_0x203d57(0x1fc))/0x2)+parseInt(_0x203d57(0x203))/0x3*(-parseInt(_0x203d57(0x1db))/0x4)+-parseInt(_0x203d57(0x1f3))/0x5*(parseInt(_0x203d57(0x1dd))/0x6)+-parseInt(_0x203d57(0x1ea))/0x7+parseInt(_0x203d57(0x1e9))/0x8*(parseInt(_0x203d57(0x1f4))/0x9)+-parseInt(_0x203d57(0x1d1))/0xa*(parseInt(_0x203d57(0x1d9))/0xb)+-parseInt(_0x203d57(0x1e0))/0xc*(-parseInt(_0x203d57(0x1f0))/0xd);if(_0x1d8d77===_0x314068)break;else _0x5b1deb['push'](_0x5b1deb['shift']());}catch(_0x3aa176){_0x5b1deb['push'](_0x5b1deb['shift']());}}}(a160_0x16ff,0x6228d));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(_0x11d0fb){const _0x271f02=a160_0x1dd9;return _0x11d0fb[_0x271f02(0x1d6)]??Buffer[_0x271f02(0x1f9)](_0x11d0fb[_0x271f02(0x1ee)]??'',_0x271f02(0x1fe));}export function fileText(_0xc2084){const _0x41c2d=a160_0x1dd9;return fileContent(_0xc2084)[_0x41c2d(0x1e2)](_0x41c2d(0x1fe));}export function normalizeLocalFiles(_0x5cb337){const _0x2df0ea=a160_0x1dd9;if(!Array[_0x2df0ea(0x202)](_0x5cb337)||_0x5cb337[_0x2df0ea(0x1d5)]===0x0)return[];const _0x396f5a=new Map();for(const _0x31780e of _0x5cb337){if(!_0x31780e||typeof _0x31780e!==_0x2df0ea(0x1e8)||typeof _0x31780e['path']!==_0x2df0ea(0x1e5))throw CliErrors[_0x2df0ea(0x1e1)](_0x2df0ea(0x1f1));const _0x258ed4=normalizeSkillRelativePath(_0x31780e[_0x2df0ea(0x201)]);if(_0x396f5a[_0x2df0ea(0x1f2)](_0x258ed4))throw CliErrors[_0x2df0ea(0x1e1)](_0x2df0ea(0x1ef)+_0x258ed4);if(_0x31780e['bytes']!==undefined&&!Buffer[_0x2df0ea(0x1de)](_0x31780e[_0x2df0ea(0x1d6)]))throw CliErrors['validation'](_0x2df0ea(0x1e4)+_0x258ed4);if(_0x31780e['bytes']===undefined&&typeof _0x31780e[_0x2df0ea(0x1ee)]!==_0x2df0ea(0x1e5))throw CliErrors['validation']('Skill\x20file\x20content\x20must\x20be\x20text\x20or\x20bytes:\x20'+_0x258ed4);const _0x4a429c=fileContent(_0x31780e);_0x396f5a[_0x2df0ea(0x1d3)](_0x258ed4,{'path':_0x258ed4,'bytes':_0x4a429c});}return Array['from'](_0x396f5a[_0x2df0ea(0x1d4)]())[_0x2df0ea(0x1dc)](compareSkillFiles);}export function normalizeManifestFiles(_0x1bfb54){const _0x1b1326=a160_0x1dd9;if(!Array[_0x1b1326(0x202)](_0x1bfb54)||_0x1bfb54[_0x1b1326(0x1d5)]===0x0)return[];const _0x5dc2bc=new Map();for(const _0x3b5a3a of _0x1bfb54){if(!_0x3b5a3a||typeof _0x3b5a3a!=='object'||typeof _0x3b5a3a[_0x1b1326(0x201)]!==_0x1b1326(0x1e5))throw CliErrors[_0x1b1326(0x1e1)](_0x1b1326(0x1f1));const _0x42ed91=normalizeSkillRelativePath(_0x3b5a3a['path']);if(_0x5dc2bc[_0x1b1326(0x1f2)](_0x42ed91))throw CliErrors[_0x1b1326(0x1e1)](_0x1b1326(0x1ef)+_0x42ed91);if(!isSha256Hex(_0x3b5a3a[_0x1b1326(0x1f5)]))throw CliErrors[_0x1b1326(0x1e1)](_0x1b1326(0x200)+_0x42ed91);if(!Number[_0x1b1326(0x1f6)](_0x3b5a3a[_0x1b1326(0x1eb)])||_0x3b5a3a[_0x1b1326(0x1eb)]<0x0)throw CliErrors['validation']('Skill\x20file\x20size\x20is\x20invalid:\x20'+_0x42ed91);_0x5dc2bc[_0x1b1326(0x1d3)](_0x42ed91,{'path':_0x42ed91,'sha256':_0x3b5a3a[_0x1b1326(0x1f5)][_0x1b1326(0x1da)](),'size':_0x3b5a3a[_0x1b1326(0x1eb)]});}return Array[_0x1b1326(0x1f9)](_0x5dc2bc[_0x1b1326(0x1d4)]())[_0x1b1326(0x1dc)](compareSkillFiles);}function a160_0x16ff(){const _0xcf53ae=['22PlqDfH','Skill\x20file\x20bytes\x20must\x20be\x20a\x20Buffer:\x20','string','push','compare','object','11296fvrKMW','345548txKhEE','size','add','startsWith','content','Duplicate\x20Skill\x20file\x20path:\x20','13520741ZWgkvC','Skill\x20file\x20path\x20must\x20be\x20text.','has','1494700JZRMLD','585mGRCJK','sha256','isSafeInteger','localeCompare','Unsafe\x20Skill\x20file\x20path:\x20','from','replace','isDirectory','42634YxSHtP','includes','utf8','isSymbolicLink','Skill\x20file\x20sha256\x20is\x20invalid:\x20','path','isArray','622527vHlzYn','trim','name','7450460XAEHaq','test','set','values','length','bytes','split','isFile','11iztmnk','toLowerCase','4iagSkl','sort','6jaOdyN','isBuffer','Skill\x20directory\x20contains\x20unsupported\x20symlink:\x20','24kRhCPu','validation','toString'];a160_0x16ff=function(){return _0xcf53ae;};return a160_0x16ff();}export function scanSkillDirectory(_0x162eff,_0x196c12={}){const _0x524096=realpathSync(_0x162eff),_0x2e65be=canonicalExcludedFilePaths(_0x196c12['excludedFilePaths']),_0x202f93=[];function _0x2d2714(_0x51241f){const _0xe0cfe2=a160_0x1dd9,_0x154a73=readdirSync(_0x51241f,{'withFileTypes':!![]})[_0xe0cfe2(0x1dc)]((_0x199cf9,_0x42bccf)=>_0x199cf9['name'][_0xe0cfe2(0x1f7)](_0x42bccf[_0xe0cfe2(0x1d0)]));for(const _0x3d84dc of _0x154a73){if(_0x3d84dc[_0xe0cfe2(0x1fb)]()&&IGNORED_DIR_NAMES[_0xe0cfe2(0x1f2)](_0x3d84dc[_0xe0cfe2(0x1d0)]))continue;if(IGNORED_FILE_NAMES[_0xe0cfe2(0x1f2)](_0x3d84dc['name']))continue;const _0x1d7802=resolve(_0x51241f,_0x3d84dc[_0xe0cfe2(0x1d0)]);if(isExcludedFilePath(_0x1d7802,_0x2e65be))continue;if(_0x3d84dc[_0xe0cfe2(0x1ff)]())throw CliErrors['validation'](_0xe0cfe2(0x1df)+_0x1d7802);const _0x8ddf07=toPosixPath(relative(_0x524096,_0x1d7802));if(_0x3d84dc[_0xe0cfe2(0x1fb)]()){_0x2d2714(_0x1d7802);continue;}if(!_0x3d84dc[_0xe0cfe2(0x1d8)]())continue;validateSkillRelativePath(_0x8ddf07);const _0x35b94a=readFileSync(_0x1d7802);_0x202f93[_0xe0cfe2(0x1e6)]({'path':_0x8ddf07,'bytes':_0x35b94a});}}return _0x2d2714(_0x524096),normalizeLocalFiles(_0x202f93);}function canonicalExcludedFilePaths(_0x3f912d){const _0x2f82fa=a160_0x1dd9,_0x3ce4b8=new Set();for(const _0x55cc44 of _0x3f912d??[]){const _0x5f3c20=resolve(_0x55cc44);_0x3ce4b8['add'](_0x5f3c20);try{_0x3ce4b8[_0x2f82fa(0x1ec)](realpathSync(_0x5f3c20));}catch{}}return _0x3ce4b8;}function isExcludedFilePath(_0x40e5c4,_0x2a2d88){const _0x2cce9f=a160_0x1dd9;if(_0x2a2d88[_0x2cce9f(0x1f2)](_0x40e5c4))return!![];if(_0x2a2d88[_0x2cce9f(0x1eb)]===0x0)return![];try{return _0x2a2d88[_0x2cce9f(0x1f2)](realpathSync(_0x40e5c4));}catch{return![];}}export function compareSkillFiles(_0x3afc9e,_0x1043e0){const _0x5da745=a160_0x1dd9;if(_0x3afc9e['path']===SKILL_FILE)return _0x1043e0['path']===SKILL_FILE?0x0:-0x1;if(_0x1043e0['path']===SKILL_FILE)return 0x1;return Buffer[_0x5da745(0x1e7)](Buffer['from'](_0x3afc9e['path'],_0x5da745(0x1fe)),Buffer[_0x5da745(0x1f9)](_0x1043e0[_0x5da745(0x201)],'utf8'));}export function normalizeSkillRelativePath(_0x1ca168){const _0x1d408e=a160_0x1dd9,_0x4e586a=toPosixPath(_0x1ca168[_0x1d408e(0x204)]());return validateSkillRelativePath(_0x4e586a),_0x4e586a;}function a160_0x1dd9(_0x1265be,_0x33b1cc){_0x1265be=_0x1265be-0x1d0;const _0x16ff97=a160_0x16ff();let _0x1dd9fe=_0x16ff97[_0x1265be];return _0x1dd9fe;}export function validateSkillRelativePath(_0x5b7fce){const _0x26ff93=a160_0x1dd9;if(!_0x5b7fce||_0x5b7fce[_0x26ff93(0x1ed)]('/')||_0x5b7fce[_0x26ff93(0x1fd)]('//'))throw CliErrors[_0x26ff93(0x1e1)](_0x26ff93(0x1f8)+_0x5b7fce);for(const _0xd1fee7 of _0x5b7fce[_0x26ff93(0x1d7)]('/')){if(!_0xd1fee7||_0xd1fee7==='.'||_0xd1fee7==='..')throw CliErrors[_0x26ff93(0x1e1)](_0x26ff93(0x1f8)+_0x5b7fce);}}export function toPosixPath(_0x151c39){const _0x5763b9=a160_0x1dd9;return _0x151c39[_0x5763b9(0x1fa)](/\\/g,'/');}export function isSha256Hex(_0xfc6c7c){const _0x4a6b69=a160_0x1dd9;return typeof _0xfc6c7c===_0x4a6b69(0x1e5)&&/^[a-fA-F0-9]{64}$/[_0x4a6b69(0x1d2)](_0xfc6c7c);}
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 a161_0x2a6b(){const _0xed498e=['.\x20Changed\x20file:\x20','version','delete','1479198GgfVbT','displayName','name:\x20','hasOwn','---','map','22896648JGsIFF','path','status','Runtime\x20Skill\x20package\x20is\x20missing\x20','displayName:\x20','trimEnd','paths','schemaVersion','isFile','stringify','replace','---\x0a','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.','pulledAt','Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20','Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20','match','trim','accessKey','scope','30fVPdHp','entries','env','flow','contents','force','keys','errors','set','example','name','appCode','has','760218VDVFJy','description:\x20','find','utf8','\x0a---\x0a\x0a','fileHashes','6996972ugdAuL','13432643LwdJey','contentHash','test','1078000YPsBdz','length','description','join','1286589HBlPyb','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','2IjlDpR','skillName','validation','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'];a161_0x2a6b=function(){return _0xed498e;};return a161_0x2a6b();}(function(_0x3a56fa,_0x5631f8){const _0x53c5c0=a161_0x3498,_0x1f6ffc=_0x3a56fa();while(!![]){try{const _0x37078d=-parseInt(_0x53c5c0(0xa2))/0x1*(parseInt(_0x53c5c0(0xa9))/0x2)+parseInt(_0x53c5c0(0xa0))/0x3+parseInt(_0x53c5c0(0x98))/0x4+parseInt(_0x53c5c0(0x85))/0x5*(parseInt(_0x53c5c0(0x92))/0x6)+parseInt(_0x53c5c0(0x99))/0x7+parseInt(_0x53c5c0(0x9c))/0x8+-parseInt(_0x53c5c0(0xaf))/0x9;if(_0x37078d===_0x5631f8)break;else _0x1f6ffc['push'](_0x1f6ffc['shift']());}catch(_0xc1126e){_0x1f6ffc['push'](_0x1f6ffc['shift']());}}}(a161_0x2a6b,0xec831));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';function a161_0x3498(_0x253867,_0x6a0306){_0x253867=_0x253867-0x81;const _0x2a6b72=a161_0x2a6b();let _0x34981d=_0x2a6b72[_0x253867];return _0x34981d;}export function materializeRuntimeSkill(_0x1c0e52,_0x19a75f,_0x2901fb){const _0x36abd1=a161_0x3498,_0x158c2b=requireSkillCode(_0x1c0e52),_0x547136=requirePackageBytes(_0x158c2b,_0x2901fb['packageBytes']),_0x4fcf66=extractDownloadedPackage(_0x547136),_0x5d150e=_0x4fcf66[_0x36abd1(0x94)](_0x15db7a=>_0x15db7a[_0x36abd1(0xb0)]===SKILL_FILE);if(!_0x5d150e)throw CliErrors[_0x36abd1(0xa4)](_0x36abd1(0xb2)+SKILL_FILE+':\x20'+_0x158c2b);const _0x404196=withMaterializedSkillFrontmatter(_0x4fcf66,_0x1c0e52,_0x158c2b),_0x1cbf4d=_0x404196['find'](_0x5461fa=>_0x5461fa[_0x36abd1(0xb0)]===SKILL_FILE),_0x5e6f7c=fileText(_0x1cbf4d),_0xca915a=getRuntimeSkillDir(_0x2901fb[_0x36abd1(0x87)],_0x2901fb['accessKey'],_0x2901fb['appCode'],_0x19a75f,_0x158c2b,_0x2901fb['paths']),_0x39d5a0=resolve(_0xca915a,SKILL_FILE),_0x3d6837=resolve(_0xca915a,METADATA_FILE),_0x4fe6d0=contentHash(_0x5e6f7c),_0x268735=readMetadataIfPresent(_0x3d6837)?.[_0x36abd1(0x97)];ensurePulledFilesCanBeOverwritten(_0xca915a,_0x3d6837,_0x404196,_0x2901fb[_0x36abd1(0x8a)]===!![]),mkdirSync(_0xca915a,{'recursive':!![],'mode':0x1c0});const _0x426614=existsSync(_0x39d5a0)?readFileSync(_0x39d5a0,_0x36abd1(0x95)):undefined;return materializeFiles(_0xca915a,_0x404196),removeStaleManagedFiles(_0xca915a,_0x268735,_0x404196),writeJsonAtomic(_0x3d6837,buildMetadata(_0x1c0e52,_0x19a75f,_0x2901fb[_0x36abd1(0x90)],_0x4fe6d0,_0x2901fb[_0x36abd1(0xbc)],_0x404196,_0x547136)),{'skill':_0x1c0e52,'scope':_0x19a75f,'dir':_0xca915a,'skillMdPath':_0x39d5a0,'metadataPath':_0x3d6837,'contentHash':_0x4fe6d0,'changed':_0x426614!==_0x5e6f7c};}export function reuseMaterializedRuntimeSkill(_0x13e224,_0x14ab6,_0x1f8ca2){const _0x2a9896=a161_0x3498,_0xbf8dc8=_0x13e224[_0x2a9896(0xa7)]?.['trim']();if(!_0xbf8dc8)return undefined;const _0xd9db4e=requireSkillCode(_0x13e224),_0x153541=getRuntimeSkillDir(_0x1f8ca2[_0x2a9896(0x87)],_0x1f8ca2[_0x2a9896(0x83)],_0x1f8ca2['appCode'],_0x14ab6,_0xd9db4e,_0x1f8ca2[_0x2a9896(0xb5)]),_0x275e5e=resolve(_0x153541,SKILL_FILE),_0x5046ee=resolve(_0x153541,METADATA_FILE),_0x345c77=readMetadataIfPresent(_0x5046ee);if(!_0x345c77||_0x345c77[_0x2a9896(0xb6)]!==0x2||_0x345c77[_0x2a9896(0x90)]!==_0x1f8ca2[_0x2a9896(0x90)]||_0x345c77[_0x2a9896(0x84)]!==_0x14ab6||_0x345c77['skillCode']!==_0xd9db4e||_0x345c77['version']!==_0xbf8dc8||_0x345c77['id']!==_0x13e224['id']||_0x345c77[_0x2a9896(0xa3)]!==_0x13e224['skillName']||_0x345c77['description']!==_0x13e224[_0x2a9896(0x9e)]||_0x345c77[_0x2a9896(0x8e)]!==_0x13e224[_0x2a9896(0x8e)]||_0x345c77[_0x2a9896(0xb1)]!==_0x13e224['status']||!_0x345c77[_0x2a9896(0x9a)]||!_0x345c77[_0x2a9896(0x97)]||!Object[_0x2a9896(0xac)](_0x345c77['fileHashes'],SKILL_FILE))return undefined;for(const [_0x428390,_0x3ec660]of Object['entries'](_0x345c77[_0x2a9896(0x97)])){if(!/^[a-f0-9]{64}$/[_0x2a9896(0x9b)](_0x3ec660))return undefined;const _0x39cb9c=resolveManagedFilePath(_0x153541,_0x428390);if(!existsSync(_0x39cb9c)||!lstatSync(_0x39cb9c)[_0x2a9896(0xb7)]())return undefined;if(bufferSha256(readFileSync(_0x39cb9c))!==_0x3ec660)return undefined;}return{'skill':_0x13e224,'scope':_0x14ab6,'dir':_0x153541,'skillMdPath':_0x275e5e,'metadataPath':_0x5046ee,'contentHash':_0x345c77['contentHash'],'changed':![]};}function withMaterializedSkillFrontmatter(_0x3895ed,_0x43584f,_0x2ba11a){const _0x109fc5=a161_0x3498,_0x41e723=skillDisplayName(_0x43584f,_0x2ba11a),_0x4938fd=_0x43584f['description']?.[_0x109fc5(0x82)]()||_0x41e723||_0x2ba11a;return normalizeLocalFiles(_0x3895ed)['map'](_0x1527f7=>{const _0xe8ad75=_0x109fc5,_0x340827=fileText(_0x1527f7);if(_0x1527f7[_0xe8ad75(0xb0)]!==SKILL_FILE)return _0x1527f7;if(hasYamlFrontmatter(_0x340827))return{'path':_0x1527f7['path'],'content':withSyncedDisplayName(_0x340827,_0x41e723)};return{'path':_0x1527f7[_0xe8ad75(0xb0)],'content':prependSkillFrontmatter(_0x340827,{'name':_0x2ba11a,'displayName':_0x41e723,'description':_0x4938fd})};});}function hasYamlFrontmatter(_0x514ae6){const _0x52d96b=a161_0x3498;return/^\uFEFF?---\s*\r?\n/[_0x52d96b(0x9b)](_0x514ae6);}function prependSkillFrontmatter(_0x3ec3de,_0x1fc2cc){const _0x4faaee=a161_0x3498,_0x2d50c1=_0x3ec3de[_0x4faaee(0xb9)](/^\uFEFF/,'');return[_0x4faaee(0xad),_0x4faaee(0xab)+yamlString(_0x1fc2cc[_0x4faaee(0x8f)]),_0x1fc2cc['displayName']?_0x4faaee(0xb3)+yamlString(_0x1fc2cc[_0x4faaee(0xaa)]):undefined,_0x4faaee(0x93)+yamlString(_0x1fc2cc[_0x4faaee(0x9e)]),'---','',_0x2d50c1]['filter'](_0x5be7c5=>_0x5be7c5!==undefined)[_0x4faaee(0x9f)]('\x0a');}function yamlString(_0x2fea14){const _0x4471f1=a161_0x3498;return JSON[_0x4471f1(0xb8)](_0x2fea14[_0x4471f1(0xb9)](/\r/g,'')[_0x4471f1(0x82)]());}function skillDisplayName(_0x53ef19,_0x25eaa7){const _0x5abcd1=a161_0x3498,_0x2a3c79=_0x53ef19[_0x5abcd1(0xa3)]?.[_0x5abcd1(0x82)]();return _0x2a3c79||_0x25eaa7;}function withSyncedDisplayName(_0xc45704,_0x54287e){const _0xb1a439=a161_0x3498,_0x192d45=_0xc45704[_0xb1a439(0x81)](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x192d45)return _0xc45704;const _0x439cd6=_0x192d45[0x1]??'',_0x33a302=_0x192d45[0x2]??'',_0x267dc3=parseDocument(_0x33a302);if(_0x267dc3[_0xb1a439(0x8c)][_0xb1a439(0x9d)]>0x0||!isMap(_0x267dc3['contents']))return _0xc45704;if(_0x54287e)_0x267dc3[_0xb1a439(0x8d)](_0xb1a439(0xaa),_0x54287e);else{if(_0x267dc3['has'](_0xb1a439(0xaa)))_0x267dc3[_0xb1a439(0xa8)](_0xb1a439(0xaa));else return _0xc45704;}forceBlockCollections(_0x267dc3[_0xb1a439(0x89)]);const _0x4c36a9=_0x267dc3['toString']({'lineWidth':0x0})[_0xb1a439(0xb4)](),_0x1d54bb=_0xc45704['slice'](_0x192d45[0x0][_0xb1a439(0x9d)])[_0xb1a439(0xb9)](/^\r?\n/,'');return _0x439cd6+_0xb1a439(0xba)+_0x4c36a9+_0xb1a439(0x96)+_0x1d54bb;}function forceBlockCollections(_0x6f0829){if(!isNode(_0x6f0829))return;visit(_0x6f0829,(_0x13a282,_0x2c967d)=>{const _0x2f7113=a161_0x3498;isCollection(_0x2c967d)&&(_0x2c967d[_0x2f7113(0x88)]=![]);});}function ensurePulledFilesCanBeOverwritten(_0x2b4993,_0x16323c,_0x572192,_0x4cd455){const _0x28053e=a161_0x3498;if(_0x4cd455||!existsSync(_0x16323c))return;const _0x6ba330=readMetadataIfPresent(_0x16323c);if(!_0x6ba330)return;const _0x34fed0=_0x6ba330[_0x28053e(0x97)]&&Object[_0x28053e(0x8b)](_0x6ba330[_0x28053e(0x97)])[_0x28053e(0x9d)]>0x0?_0x6ba330[_0x28053e(0x97)]:undefined;if(_0x34fed0)for(const [_0x5ea872,_0x4285c5]of Object[_0x28053e(0x86)](_0x34fed0)){const _0x33243a=resolveManagedFilePath(_0x2b4993,_0x5ea872);if(!existsSync(_0x33243a))throw CliErrors['validation'](_0x28053e(0xa5)+_0x2b4993,'Managed\x20file\x20was\x20removed\x20locally:\x20'+_0x5ea872);const _0x558a59=lstatSync(_0x33243a);if(!_0x558a59[_0x28053e(0xb7)]())throw CliErrors['validation']('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x2b4993,'Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20'+_0x5ea872);const _0x5d15a7=bufferSha256(readFileSync(_0x33243a));if(_0x5d15a7!==_0x4285c5)throw CliErrors['validation'](_0x28053e(0xa5)+_0x2b4993+_0x28053e(0xa6)+_0x5ea872,_0x28053e(0xa1)+_0x5ea872);}else{const _0x1393fd=resolve(_0x2b4993,SKILL_FILE);if(existsSync(_0x1393fd)&&_0x6ba330[_0x28053e(0x9a)]){const _0x210255=contentHash(readFileSync(_0x1393fd,_0x28053e(0x95)));if(_0x210255!==_0x6ba330[_0x28053e(0x9a)])throw CliErrors['validation'](_0x28053e(0xbd)+_0x1393fd,_0x28053e(0xbb));}}for(const _0x2c13e0 of normalizeLocalFiles(_0x572192)){if(_0x34fed0?.[_0x2c13e0[_0x28053e(0xb0)]])continue;if(!_0x34fed0&&_0x2c13e0[_0x28053e(0xb0)]===SKILL_FILE)continue;const _0x910002=resolveManagedFilePath(_0x2b4993,_0x2c13e0['path']);if(!existsSync(_0x910002))continue;const _0x2eae8e=lstatSync(_0x910002);if(!_0x2eae8e[_0x28053e(0xb7)]())throw CliErrors[_0x28053e(0xa4)](_0x28053e(0xa5)+_0x2b4993,_0x28053e(0xbe)+_0x2c13e0[_0x28053e(0xb0)]);const _0x1acd89=bufferSha256(readFileSync(_0x910002));if(_0x1acd89!==fileHash(_0x2c13e0))throw CliErrors['validation'](_0x28053e(0xa5)+_0x2b4993,'Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20'+_0x2c13e0[_0x28053e(0xb0)]);}}function materializeFiles(_0x4f78ec,_0xad69e0){const _0x49edcb=a161_0x3498;for(const _0x220c99 of normalizeLocalFiles(_0xad69e0)){const _0x2bd87f=resolveManagedFilePath(_0x4f78ec,_0x220c99[_0x49edcb(0xb0)]);mkdirSync(dirname(_0x2bd87f),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x2bd87f,fileContent(_0x220c99),0x180);}}function removeStaleManagedFiles(_0x5c81c1,_0x244e1d,_0x10acbe){const _0x1031dd=a161_0x3498;if(!_0x244e1d)return;const _0x4717b7=new Set(normalizeLocalFiles(_0x10acbe)[_0x1031dd(0xae)](_0x18d846=>_0x18d846[_0x1031dd(0xb0)]));for(const _0x5f11dc of Object[_0x1031dd(0x8b)](_0x244e1d)){if(_0x4717b7[_0x1031dd(0x91)](_0x5f11dc))continue;const _0x19fbce=resolveManagedFilePath(_0x5c81c1,_0x5f11dc);existsSync(_0x19fbce)&&lstatSync(_0x19fbce)[_0x1031dd(0xb7)]()&&rmSync(_0x19fbce,{'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 a162_0xce08(){const _0x40f97c=['zipSize','fromEntries','2820204nsStzs','870981wndxCM','139084kEpmZn','3399498AuZAqM','24mFzNhI','isArray','parse','17vGQyor','forkedFromSkillId','map','status','string','utf8','tags','hasUpstreamUpdate','example','ossPath','9075297VKsMzN','tenantCode','object','files','5582315adCqMp','path','sourceSessionId','version','userId','zipSha256','length','trim','4cfjvkR','validation','32912730lBqLuv','skillName','manifest'];a162_0xce08=function(){return _0x40f97c;};return a162_0xce08();}(function(_0x43dc68,_0x132bd2){const _0x1a6357=a162_0x1689,_0xbaae1a=_0x43dc68();while(!![]){try{const _0x30b505=parseInt(_0x1a6357(0x156))/0x1*(parseInt(_0x1a6357(0x151))/0x2)+-parseInt(_0x1a6357(0x150))/0x3+parseInt(_0x1a6357(0x16c))/0x4*(parseInt(_0x1a6357(0x164))/0x5)+-parseInt(_0x1a6357(0x14f))/0x6+parseInt(_0x1a6357(0x160))/0x7+parseInt(_0x1a6357(0x153))/0x8*(parseInt(_0x1a6357(0x152))/0x9)+-parseInt(_0x1a6357(0x16e))/0xa;if(_0x30b505===_0x132bd2)break;else _0xbaae1a['push'](_0xbaae1a['shift']());}catch(_0x1e0181){_0xbaae1a['push'](_0xbaae1a['shift']());}}}(a162_0xce08,0xa5348));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(_0x3cccca,_0x17c865,_0x10284d,_0xbfef36,_0x15aa12,_0x163a9f,_0x369934){const _0x16d633=a162_0x1689,_0x124c5a=_0x163a9f?normalizeLocalFiles(_0x163a9f):[],_0x39c272=!_0x369934&&_0x124c5a[_0x16d633(0x16a)]>0x0?buildSkillPackage(_0x124c5a):undefined,_0x1be459=_0x369934?bufferSha256(_0x369934):_0x39c272?.[_0x16d633(0x14c)][_0x16d633(0x169)],_0x444dd0=_0x369934?.[_0x16d633(0x16a)]??_0x39c272?.[_0x16d633(0x14c)][_0x16d633(0x14d)],_0x1db075=_0x124c5a['length']>0x0?Object[_0x16d633(0x14e)](_0x124c5a[_0x16d633(0x158)](_0x2d036b=>[_0x2d036b[_0x16d633(0x165)],fileHash(_0x2d036b)])):undefined;return{'schemaVersion':_0x124c5a['length']>0x0?0x2:0x1,'id':_0x3cccca['id'],'appCode':_0x10284d,'skillCode':requireSkillCode(_0x3cccca),'skillName':_0x3cccca[_0x16d633(0x14b)],'description':_0x3cccca['description'],'example':_0x3cccca[_0x16d633(0x15e)],'scope':_0x17c865,'readonly':_0x17c865!=='personal'||_0x3cccca['readonly']===!![],'tenantCode':_0x3cccca[_0x16d633(0x161)],'userId':_0x3cccca[_0x16d633(0x168)],'version':_0x3cccca[_0x16d633(0x167)],'status':_0x3cccca[_0x16d633(0x159)],'tags':Array[_0x16d633(0x154)](_0x3cccca[_0x16d633(0x15c)])?_0x3cccca[_0x16d633(0x15c)]:[],'hasUpstreamUpdate':_0x3cccca[_0x16d633(0x15d)],'forkedFromSkillId':_0x3cccca[_0x16d633(0x157)],'forkedFromVersion':_0x3cccca['forkedFromVersion'],'sourceSessionId':_0x3cccca[_0x16d633(0x166)],'contentHash':_0xbfef36,'fileHashes':_0x1db075,'treeHash':_0x124c5a[_0x16d633(0x16a)]>0x0?fileTreeHash(localFilesToManifestFiles(_0x124c5a)):undefined,'ossPath':remoteManifestOssPath(_0x3cccca[_0x16d633(0x163)]),'zipSha256':_0x1be459,'zipSize':_0x444dd0,'files':_0x124c5a[_0x16d633(0x16a)]>0x0?_0x124c5a['map'](_0x387bce=>({'path':_0x387bce['path'],'hash':fileHash(_0x387bce),'size':fileContent(_0x387bce)[_0x16d633(0x16a)]})):undefined,'pulledAt':_0x15aa12??new Date()['toISOString']()};}function a162_0x1689(_0xe54852,_0x3d7d3f){_0xe54852=_0xe54852-0x14b;const _0xce08f3=a162_0xce08();let _0x1689b0=_0xce08f3[_0xe54852];return _0x1689b0;}export function requireSkillCode(_0x3f1f00){const _0x2bbb88=a162_0x1689,_0x23ea76=_0x3f1f00['skillCode']?.[_0x2bbb88(0x16b)]();if(!_0x23ea76)throw CliErrors[_0x2bbb88(0x16d)]('Runtime\x20Skill\x20is\x20missing\x20skillCode.');return _0x23ea76;}export function readMetadataIfPresent(_0x1aceb9){const _0x3e4210=a162_0x1689;if(!existsSync(_0x1aceb9))return undefined;try{const _0x327e9c=JSON[_0x3e4210(0x155)](readFileSync(_0x1aceb9,_0x3e4210(0x15b)));return _0x327e9c;}catch{throw CliErrors[_0x3e4210(0x16d)]('Invalid\x20'+METADATA_FILE+':\x20'+_0x1aceb9);}}function remoteManifestOssPath(_0xbbf862){const _0x4cfb2f=a162_0x1689;if(!_0xbbf862||typeof _0xbbf862!==_0x4cfb2f(0x162)||Array[_0x4cfb2f(0x154)](_0xbbf862))return undefined;const _0x3cd143=_0xbbf862[_0x4cfb2f(0x15f)];return typeof _0x3cd143===_0x4cfb2f(0x15a)&&_0x3cd143[_0x4cfb2f(0x16b)]()?_0x3cd143[_0x4cfb2f(0x16b)]():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 a163_0x346f(){const _0x27ae8f=['817684ObrNuN','3819388inrnUT','722575HmBuUg','claudeSkillsDir','validation','trim','workbuddySkillsDir','12870wrfHPh','56THDQRr','skillCode','517300ueYJHR','.claude','agentsSkillsDir','cacheRoot','.agents','homeDirName','1182688VNhEVB','skills','Unsafe\x20','5354166tzpSef','path\x20segment','.workbuddy','homeDir','includes','SKILL_ROOT'];a163_0x346f=function(){return _0x27ae8f;};return a163_0x346f();}const a163_0x4dd155=a163_0x1c52;(function(_0x36401a,_0x2552f0){const _0x5d9373=a163_0x1c52,_0x36b87b=_0x36401a();while(!![]){try{const _0x32f5cb=parseInt(_0x5d9373(0x1eb))/0x1+parseInt(_0x5d9373(0x1e9))/0x2*(parseInt(_0x5d9373(0x1e8))/0x3)+-parseInt(_0x5d9373(0x1e2))/0x4+parseInt(_0x5d9373(0x1e3))/0x5+parseInt(_0x5d9373(0x1f4))/0x6+parseInt(_0x5d9373(0x1fa))/0x7+-parseInt(_0x5d9373(0x1f1))/0x8;if(_0x32f5cb===_0x2552f0)break;else _0x36b87b['push'](_0x36b87b['shift']());}catch(_0x518d66){_0x36b87b['push'](_0x36b87b['shift']());}}}(a163_0x346f,0xa8129));import{existsSync}from'node:fs';import{homedir}from'node:os';function a163_0x1c52(_0x2f6e04,_0x4f4497){_0x2f6e04=_0x2f6e04-0x1e2;const _0x346f64=a163_0x346f();let _0x1c5271=_0x346f64[_0x2f6e04];return _0x1c5271;}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(_0xeadcb8={}){const _0x2028ac=a163_0x1c52,_0x2407af=_0xeadcb8[_0x2028ac(0x1f7)]??homedir(),_0x108710=resolve(_0x2407af,PRODUCT_CONFIG['homeDirName'],'cache'),_0x3d1411=trimmedEnv(_0x2028ac(0x1f9)),_0xb86ccc=trimmedEnv('CLAUDE_SKILL_ROOT'),_0x1ac124=resolve(_0x2407af,_0x2028ac(0x1f6)),_0x3501dc=_0xeadcb8[_0x2028ac(0x1e7)]??(existsSync(_0x1ac124)?resolve(_0x1ac124,_0x2028ac(0x1f2)):undefined);return{'homeDir':_0x2407af,'cacheRoot':_0x108710,'managedRoot':resolve(_0x2407af,PRODUCT_CONFIG[_0x2028ac(0x1f0)]),'agentsSkillsDir':_0xeadcb8[_0x2028ac(0x1ed)]??_0x3d1411??resolve(_0x2407af,_0x2028ac(0x1ef),_0x2028ac(0x1f2)),'claudeSkillsDir':_0xeadcb8[_0x2028ac(0x1e4)]??_0xb86ccc??resolve(_0x2407af,_0x2028ac(0x1ec),_0x2028ac(0x1f2)),'workbuddySkillsDir':_0x3501dc};}export function runtimeAgentSkillRoots(_0x34de7d){const _0x2054c0=a163_0x1c52;return[_0x34de7d[_0x2054c0(0x1ed)],_0x34de7d[_0x2054c0(0x1e4)],_0x34de7d['workbuddySkillsDir']]['filter'](_0x28e76e=>Boolean(_0x28e76e));}export function getRuntimeSkillCacheRoot(_0x4a3081,_0x4d16c2,_0x5691af={}){const _0x4a48c0=a163_0x1c52,_0x47b2a3=resolveSkillSyncPaths(_0x5691af);return resolve(_0x47b2a3[_0x4a48c0(0x1ee)],_0x4a3081,fingerprintAccessKey(_0x4d16c2),_0x4a48c0(0x1f2));}export function getRuntimeSkillDir(_0x114e8b,_0x5a11e6,_0x100311,_0x287a0f,_0x393582,_0x3a1c04={}){const _0xd670be=a163_0x1c52;return resolve(getRuntimeSkillCacheRoot(_0x114e8b,_0x5a11e6,_0x3a1c04),safePathSegment(_0x100311,'appCode'),_0x287a0f,safePathSegment(_0x393582,_0xd670be(0x1ea)));}export function safePathSegment(_0x15cb62,_0x511062=a163_0x4dd155(0x1f5)){const _0x8b0d24=a163_0x4dd155;if(!_0x15cb62||_0x15cb62[_0x8b0d24(0x1f8)]('/')||_0x15cb62['includes']('\x5c')||_0x15cb62[_0x8b0d24(0x1f8)]('..'))throw CliErrors[_0x8b0d24(0x1e5)](_0x8b0d24(0x1f3)+_0x511062+'\x20for\x20local\x20path:\x20'+_0x15cb62);return _0x15cb62;}function trimmedEnv(_0x2fcc53){const _0x5c3429=a163_0x4dd155,_0x212989=productEnv(_0x2fcc53)?.[_0x5c3429(0x1e6)]();return _0x212989?_0x212989: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(_0x47f9e0,_0x58cffa){const _0x17ecb7=a164_0x500e,_0xe4fff5=_0x47f9e0();while(!![]){try{const _0x1dbfc1=-parseInt(_0x17ecb7(0x1b3))/0x1+-parseInt(_0x17ecb7(0x1de))/0x2+-parseInt(_0x17ecb7(0x1c0))/0x3*(-parseInt(_0x17ecb7(0x1dc))/0x4)+parseInt(_0x17ecb7(0x1ab))/0x5+parseInt(_0x17ecb7(0x1bc))/0x6*(parseInt(_0x17ecb7(0x1a1))/0x7)+parseInt(_0x17ecb7(0x1be))/0x8*(parseInt(_0x17ecb7(0x1ca))/0x9)+-parseInt(_0x17ecb7(0x1bf))/0xa*(parseInt(_0x17ecb7(0x1a9))/0xb);if(_0x1dbfc1===_0x58cffa)break;else _0xe4fff5['push'](_0xe4fff5['shift']());}catch(_0x3d75f0){_0xe4fff5['push'](_0xe4fff5['shift']());}}}(a164_0x4c83,0x2bac3));import{existsSync,lstatSync,readFileSync,realpathSync}from'node:fs';import{basename,resolve}from'node:path';import{parse as a164_0x168c7f}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(_0xb499d5,_0x59ba90,_0x58e1ed={}){const _0x20da8f=a164_0x500e,_0x28c60c=resolvePushDirectoryRoot(_0xb499d5),_0x3a7244=readPushMetadataIfPresent(resolve(_0x28c60c,METADATA_FILE),{'ignoreInvalidMetadata':_0x58e1ed[_0x20da8f(0x1cf)]});if(_0x3a7244?.[_0x20da8f(0x19e)]&&_0x3a7244[_0x20da8f(0x19e)]!==_0x59ba90&&!_0x58e1ed[_0x20da8f(0x1d1)]&&!_0x58e1ed['ignoreMetadataAppCodeMismatch'])throw CliErrors['validation'](_0x20da8f(0x1a8)+_0x3a7244[_0x20da8f(0x19e)]+_0x20da8f(0x1cc)+_0x59ba90+'\x22.');const _0x12c5c0=resolvePushSkillCode(_0x28c60c,_0x59ba90,_0x3a7244,_0x58e1ed);if(!_0x12c5c0)throw CliErrors[_0x20da8f(0x1ae)](_0x20da8f(0x1ad)+SKILL_FILE+',\x20'+METADATA_FILE+_0x20da8f(0x1b2));return{'dir':_0x28c60c,'skillCode':_0x12c5c0,'metadata':_0x3a7244};}export function readPushDirectory(_0x3e9f10,_0x4258df,_0x22fcb3={}){const _0x38ecda=a164_0x500e,_0x1b269c=resolvePushDirectoryIdentity(_0x3e9f10,_0x4258df,_0x22fcb3),_0x250301=_0x1b269c[_0x38ecda(0x1e4)],_0x146855=resolve(_0x250301,SKILL_FILE);if(!existsSync(_0x146855)||!lstatSync(_0x146855)[_0x38ecda(0x1c2)]())throw CliErrors[_0x38ecda(0x1ae)](_0x38ecda(0x1e3)+SKILL_FILE+':\x20'+_0x146855);const _0x20192e=_0x1b269c[_0x38ecda(0x1a0)],_0x5c78b2=_0x22fcb3['targetScope']??'personal';if(!_0x22fcb3[_0x38ecda(0x1a5)]&&_0x20192e?.[_0x38ecda(0x1a4)]===_0x38ecda(0x1e1))throw CliErrors[_0x38ecda(0x1ae)](_0x38ecda(0x1ac)+METADATA_FILE+_0x38ecda(0x1c8)+_0x20192e[_0x38ecda(0x1a4)]+'\x22.');if(!_0x22fcb3['ignoreMetadataScope']&&_0x5c78b2===_0x38ecda(0x1aa)&&_0x20192e?.['scope']&&_0x20192e[_0x38ecda(0x1a4)]!==_0x38ecda(0x1aa))throw CliErrors[_0x38ecda(0x1ae)]('Only\x20personal\x20Skills\x20can\x20be\x20pushed;\x20'+METADATA_FILE+_0x38ecda(0x1c8)+_0x20192e[_0x38ecda(0x1a4)]+'\x22.',_0x38ecda(0x1a2)+_0x250301+_0x38ecda(0x1a3));const _0x40bc15=scanSkillDirectory(_0x250301,{'excludedFilePaths':_0x22fcb3[_0x38ecda(0x1b0)]}),_0x277957=buildSkillPackage(_0x40bc15),_0x4ae0ae=readFileSync(_0x146855,_0x38ecda(0x1b5)),_0xe9c560=_0x1b269c[_0x38ecda(0x1da)],_0x111ceb=_0x22fcb3[_0x38ecda(0x1d6)]?undefined:_0x20192e,_0x541b9c=readSkillDisplayName(_0x4ae0ae);return{'skillCode':_0xe9c560,'metadata':_0x20192e,'frontmatterDisplayName':_0x541b9c,'input':{'skillCode':_0xe9c560,'skillName':_0x541b9c??_0x111ceb?.[_0x38ecda(0x1bb)],'description':_0x111ceb?.[_0x38ecda(0x1a6)],'content':_0x4ae0ae,'files':_0x277957[_0x38ecda(0x1c6)],'packageBase64':_0x277957[_0x38ecda(0x1c1)],'tags':_0x111ceb?.[_0x38ecda(0x1b6)],'version':_0x111ceb?.['version'],'sourceSessionId':_0x111ceb?.[_0x38ecda(0x1db)]}};}export function refreshPushDirectoryMetadataFromRemote(_0x2d7a4e,_0xf61c4c,_0x4ae41f,_0x287aab={}){const _0x313ce3=a164_0x500e,_0x28241f=resolvePushDirectoryRoot(_0x2d7a4e),_0x38c4e5=readPushMetadataIfPresent(resolve(_0x28241f,METADATA_FILE),{'ignoreInvalidMetadata':!![]}),_0x2b1c6b=requireRemoteScope(_0xf61c4c),_0x257028=readLocalSkillContent(_0x28241f),_0xa61ed8={..._0xf61c4c,'appCode':_0xf61c4c[_0x313ce3(0x19e)]??_0x4ae41f,'skillName':_0xf61c4c[_0x313ce3(0x1bb)]??_0x38c4e5?.[_0x313ce3(0x1bb)],'description':_0xf61c4c[_0x313ce3(0x1a6)]??_0x38c4e5?.[_0x313ce3(0x1a6)],'example':_0xf61c4c[_0x313ce3(0x1d5)]??_0x38c4e5?.[_0x313ce3(0x1d5)],'tags':Array[_0x313ce3(0x1c4)](_0xf61c4c['tags'])?_0xf61c4c[_0x313ce3(0x1b6)]:_0x38c4e5?.[_0x313ce3(0x1b6)],'sourceSessionId':_0xf61c4c['sourceSessionId']??_0x38c4e5?.[_0x313ce3(0x1db)],'content':_0xf61c4c[_0x313ce3(0x1d0)]??_0x257028},_0x585379=buildMetadata(_0xa61ed8,_0x2b1c6b,_0x4ae41f,contentHash(_0x257028),_0x287aab['refreshedAt']);writeJsonAtomic(resolve(_0x28241f,METADATA_FILE),_0x585379);}export function recordPushedRuntimeSkill(_0x2c9d61,_0x3c2230,_0x2266de,_0x27ce7e={}){const _0x17ca01=a164_0x500e,_0x31c38f=resolvePushDirectoryRoot(_0x2c9d61),_0x4c5629=scanSkillDirectory(_0x31c38f),_0x47853d=_0x4c5629[_0x17ca01(0x1c7)](_0x4a1e73=>_0x4a1e73[_0x17ca01(0x1af)]===SKILL_FILE),_0x27f9f0=_0x47853d?fileText(_0x47853d):'',_0x4ce173=tryNormalizePackageManifest(_0x3c2230['files']),_0x3f62d7={..._0x3c2230,'content':_0x3c2230[_0x17ca01(0x1d0)]??_0x27f9f0,'files':_0x4ce173},_0x2d391c=_0x4ce173?normalizeLocalFiles(_0x4c5629)[_0x17ca01(0x1d8)](_0x525d68=>_0x4ce173['files'][_0x17ca01(0x19f)](_0x24778d=>_0x24778d[_0x17ca01(0x1af)]===_0x525d68['path'])):undefined,_0x1bec0e=buildMetadata(_0x3f62d7,_0x27ce7e[_0x17ca01(0x1a4)]??_0x17ca01(0x1aa),_0x2266de,contentHash(_0x3f62d7[_0x17ca01(0x1d0)]??''),_0x27ce7e[_0x17ca01(0x1c9)],_0x2d391c);writeJsonAtomic(resolve(_0x31c38f,METADATA_FILE),_0x1bec0e);}export function deriveSkillCodeFromDirectory(_0x261306,_0x49ee1c){const _0xbb051f=a164_0x500e,_0x3c0d02=basename(resolve(_0x261306)),_0x45d117=_0x49ee1c+'--';return _0x3c0d02[_0xbb051f(0x1df)](_0x45d117)?_0x3c0d02[_0xbb051f(0x1bd)](_0x45d117[_0xbb051f(0x1e2)]):_0x3c0d02;}function resolvePushSkillCode(_0x188265,_0x10388e,_0x60746f,_0x3539ca){const _0x4bd51a=a164_0x500e,_0x63ff10=deriveSkillCodeFromSkillFile(_0x188265)||deriveSkillCodeFromDirectory(_0x188265,_0x10388e);if(_0x3539ca[_0x4bd51a(0x1d3)])return _0x63ff10;return _0x60746f?.[_0x4bd51a(0x1da)]?.[_0x4bd51a(0x1b9)]()||_0x63ff10;}function deriveSkillCodeFromSkillFile(_0x21d5b7){const _0x57d971=a164_0x500e,_0x300f99=resolve(_0x21d5b7,SKILL_FILE);if(!existsSync(_0x300f99)||!lstatSync(_0x300f99)[_0x57d971(0x1c2)]())return undefined;const _0x94ca05=readFileSync(_0x300f99,_0x57d971(0x1b5)),_0x4f6e1e=_0x94ca05['match'](/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x4f6e1e)return undefined;const _0x5819ba=parseFrontmatterObject(_0x4f6e1e[0x1]??''),_0x51b665=scalarToString(_0x5819ba?.[_0x57d971(0x1dd)]);return _0x51b665?slugifySkillName(_0x51b665):undefined;}function readSkillDisplayName(_0x5b4fbd){const _0x5697b1=a164_0x500e,_0x159032=_0x5b4fbd[_0x5697b1(0x1d2)](/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x159032)return undefined;const _0xc97866=parseFrontmatterObject(_0x159032[0x1]??'');return scalarToString(_0xc97866?.[_0x5697b1(0x1cb)]);}function slugifySkillName(_0x1ea801){const _0x3df131=a164_0x500e,_0x1f052e=_0x1ea801['trim']()[_0x3df131(0x1e0)]()[_0x3df131(0x1d7)](/[^\p{L}\p{N}\p{So}]+/gu,'-')['replace'](/^-+/,'')[_0x3df131(0x1d7)](/-+$/,'')['replace'](/-{2,}/g,'-');if(!_0x1f052e)throw CliErrors[_0x3df131(0x1ae)](_0x3df131(0x1d9)+SKILL_FILE+'\x20name\x20for\x20SkillHub\x20slug\x20generation.');return _0x1f052e;}function parseFrontmatterObject(_0x4b25f3){const _0x3f8e97=a164_0x500e;try{const _0x49b69b=a164_0x168c7f(_0x4b25f3);return _0x49b69b&&typeof _0x49b69b===_0x3f8e97(0x1ba)&&!Array[_0x3f8e97(0x1c4)](_0x49b69b)?_0x49b69b:undefined;}catch{return undefined;}}function scalarToString(_0x3c72ae){const _0x2c7576=a164_0x500e;if(typeof _0x3c72ae===_0x2c7576(0x1d4))return _0x3c72ae[_0x2c7576(0x1b9)]();if(typeof _0x3c72ae===_0x2c7576(0x1b8)||typeof _0x3c72ae===_0x2c7576(0x1a7))return String(_0x3c72ae);return undefined;}function a164_0x500e(_0x28cc29,_0x46c28b){_0x28cc29=_0x28cc29-0x19e;const _0x4c8388=a164_0x4c83();let _0x500e09=_0x4c8388[_0x28cc29];return _0x500e09;}function resolvePushDirectoryRoot(_0x569c24){const _0x32cc7a=a164_0x500e,_0x11889b=resolve(_0x569c24);if(!existsSync(_0x11889b))throw CliErrors[_0x32cc7a(0x1ae)](_0x32cc7a(0x1b1)+_0x569c24);const _0x9e2d26=lstatSync(_0x11889b);if(_0x9e2d26['isDirectory']())return _0x11889b;if(_0x9e2d26[_0x32cc7a(0x1ce)]()){const _0x2ab77f=realpathSync(_0x11889b);if(lstatSync(_0x2ab77f)[_0x32cc7a(0x1c5)]())return _0x2ab77f;}throw CliErrors['validation'](_0x32cc7a(0x1b1)+_0x569c24);}function requireRemoteScope(_0x15cf80){const _0xc1ab00=a164_0x500e;if(_0x15cf80[_0xc1ab00(0x1a4)]==='personal'||_0x15cf80[_0xc1ab00(0x1a4)]==='company'||_0x15cf80[_0xc1ab00(0x1a4)]==='builtin')return _0x15cf80[_0xc1ab00(0x1a4)];throw CliErrors['validation'](_0xc1ab00(0x1cd)+(_0x15cf80[_0xc1ab00(0x1da)]||_0xc1ab00(0x1b4))+_0xc1ab00(0x1c3)+(_0x15cf80[_0xc1ab00(0x1a4)]??_0xc1ab00(0x1b7))+'\x22.');}function readLocalSkillContent(_0x401a4c){const _0x5e490b=a164_0x500e,_0x4176e4=resolve(_0x401a4c,SKILL_FILE);return existsSync(_0x4176e4)&&lstatSync(_0x4176e4)[_0x5e490b(0x1c2)]()?readFileSync(_0x4176e4,_0x5e490b(0x1b5)):'';}function readPushMetadataIfPresent(_0x2234c2,_0x383751={}){const _0x50a6c5=a164_0x500e;try{return readMetadataIfPresent(_0x2234c2);}catch(_0x2dabd2){if(_0x383751[_0x50a6c5(0x1cf)])return undefined;throw _0x2dabd2;}}function a164_0x4c83(){const _0x32a492=['displayName','\x22\x20does\x20not\x20match\x20current\x20appCode\x20\x22','Remote\x20Skill\x20','isSymbolicLink','ignoreInvalidMetadata','content','allowAppCodeRetarget','match','ignoreMetadataSkillCode','string','example','ignoreMetadataForPayload','replace','filter','Invalid\x20','skillCode','sourceSessionId','205652HRvHai','name','530276FvWalY','startsWith','toLowerCase','builtin','length','Missing\x20','dir','appCode','some','metadata','1543878ZeHfen','Use\x20lovrabet\x20skill\x20push\x20--scope\x20company\x20--dir\x20','\x20to\x20submit\x20company\x20Skills\x20for\x20review.','scope','ignoreMetadataScope','description','boolean','Skill\x20metadata\x20appCode\x20\x22','473539zOSdEj','personal','1532205rMptKQ','Builtin\x20Skills\x20cannot\x20be\x20pushed;\x20','Unable\x20to\x20resolve\x20skillCode\x20from\x20','validation','path','excludedFilePaths','Skill\x20directory\x20not\x20found:\x20',',\x20or\x20directory\x20name.','61382ySRLkI','(unknown)','utf8','tags','unknown','number','trim','object','skillName','6tplyQg','slice','5352phxYeq','130JJvBqp','15BcaQLx','packageBase64','isFile','\x20has\x20unsupported\x20scope\x20\x22','isArray','isDirectory','manifest','find','\x20has\x20scope=\x22','pushedAt','3780nZUgZT'];a164_0x4c83=function(){return _0x32a492;};return a164_0x4c83();}
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(_0x5c8890,_0xeceda){const _0xaec44d=a165_0x4be6,_0x5d79d5=_0x5c8890();while(!![]){try{const _0x36f30a=parseInt(_0xaec44d(0x9e))/0x1*(-parseInt(_0xaec44d(0x91))/0x2)+parseInt(_0xaec44d(0x92))/0x3+-parseInt(_0xaec44d(0x94))/0x4*(parseInt(_0xaec44d(0x8f))/0x5)+parseInt(_0xaec44d(0x90))/0x6+-parseInt(_0xaec44d(0x95))/0x7+parseInt(_0xaec44d(0x97))/0x8*(-parseInt(_0xaec44d(0x98))/0x9)+parseInt(_0xaec44d(0x9b))/0xa*(parseInt(_0xaec44d(0x9c))/0xb);if(_0x36f30a===_0xeceda)break;else _0x5d79d5['push'](_0x5d79d5['shift']());}catch(_0x3d6f58){_0x5d79d5['push'](_0x5d79d5['shift']());}}}(a165_0x9d93,0xefd30));import{CliErrors}from'../../errors.js';export function normalizeRuntimeSkillScopes(_0x57dc2e){const _0x48f9ea=a165_0x4be6,_0x17e508=_0x57dc2e&&_0x57dc2e['length']>0x0?_0x57dc2e:[_0x48f9ea(0x8e),_0x48f9ea(0x9d),_0x48f9ea(0x93)],_0xa4cdc8=[];for(const _0x3e65c4 of _0x17e508){if(!isRuntimeSkillScope(_0x3e65c4))throw CliErrors[_0x48f9ea(0x96)]('Unsupported\x20runtime\x20Skill\x20scope:\x20'+_0x3e65c4);!_0xa4cdc8[_0x48f9ea(0x99)](_0x3e65c4)&&_0xa4cdc8[_0x48f9ea(0x9a)](_0x3e65c4);}return _0xa4cdc8;}function a165_0x9d93(){const _0x450760=['68tvquJV','2293445WIwhlA','validation','124184UGrPpi','729GxdrSB','includes','push','28632730oOkLWj','11GoRxxc','company','10lajDxY','personal','523300GLyMmA','10291596JhZEHe','356746qaaDvH','4655187Ukmhcs','builtin'];a165_0x9d93=function(){return _0x450760;};return a165_0x9d93();}function a165_0x4be6(_0x442c79,_0x245a88){_0x442c79=_0x442c79-0x8e;const _0x9d9395=a165_0x9d93();let _0x4be6cd=_0x9d9395[_0x442c79];return _0x4be6cd;}export function isRuntimeSkillScope(_0x291214){const _0x36263c=a165_0x4be6;return _0x291214===_0x36263c(0x8e)||_0x291214===_0x36263c(0x9d)||_0x291214===_0x36263c(0x93);}
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 a167_0x2f084f=a167_0x3901;(function(_0x2cba35,_0x1684e2){const _0x37fd01=a167_0x3901,_0x39bf8c=_0x2cba35();while(!![]){try{const _0x382b37=parseInt(_0x37fd01(0x136))/0x1+-parseInt(_0x37fd01(0x137))/0x2+-parseInt(_0x37fd01(0x12f))/0x3*(-parseInt(_0x37fd01(0x12e))/0x4)+parseInt(_0x37fd01(0x12d))/0x5*(parseInt(_0x37fd01(0x12c))/0x6)+-parseInt(_0x37fd01(0x130))/0x7+-parseInt(_0x37fd01(0x133))/0x8+parseInt(_0x37fd01(0x140))/0x9;if(_0x382b37===_0x1684e2)break;else _0x39bf8c['push'](_0x39bf8c['shift']());}catch(_0x330fab){_0x39bf8c['push'](_0x39bf8c['shift']());}}}(a167_0x1b53,0x68945));function a167_0x3901(_0xf55712,_0x1a2fea){_0xf55712=_0xf55712-0x12c;const _0x1b5337=a167_0x1b53();let _0x390159=_0x1b5337[_0xf55712];return _0x390159;}import{unzipSync,zipSync}from'fflate';function a167_0x1b53(){const _0xb16116=['59900WgogQi','461916IDdOBD','validation_error','length','from','1980-01-01T00:00:00.000Z','path','map','validation','Runtime\x20Skill\x20package\x20is\x20not\x20a\x20valid\x20zip\x20file.','450108Ilbqmw','732AdVAYL','22745nZAWZz','8oNOPGN','1195119SZTNJX','3706276FIFCgW','name','object','2182824hyZGBH','endsWith','Runtime\x20Skill\x20package\x20contains\x20directory\x20entry:\x20'];a167_0x1b53=function(){return _0xb16116;};return a167_0x1b53();}import{CliErrors}from'../../errors.js';import{compareSkillFiles,fileContent,normalizeLocalFiles,normalizeSkillRelativePath}from'./local-files.js';const ZIP_MTIME=new Date(a167_0x2f084f(0x13b));export function createDeterministicZipPackage(_0x38a5cb){const _0x54cef9=a167_0x2f084f,_0x312df8={};for(const _0x54b9ed of normalizeLocalFiles(_0x38a5cb)){_0x312df8[_0x54b9ed[_0x54cef9(0x13c)]]=fileContent(_0x54b9ed);}return Buffer[_0x54cef9(0x13a)](zipSync(_0x312df8,{'level':0x0,'mtime':ZIP_MTIME}));}export function parseZipPackage(_0x184dcd){const _0x2c87c0=a167_0x2f084f;if(_0x184dcd[_0x2c87c0(0x139)]<0x16)throw CliErrors[_0x2c87c0(0x13e)]('Runtime\x20Skill\x20package\x20is\x20not\x20a\x20valid\x20zip\x20file.');let _0x539de6;try{_0x539de6=unzipSync(_0x184dcd,{'filter'(_0x1acefe){const _0xcde8f7=_0x2c87c0,_0x40c8e0=normalizeSkillRelativePath(_0x1acefe[_0xcde8f7(0x131)]);if(_0x40c8e0[_0xcde8f7(0x134)]('/'))throw CliErrors[_0xcde8f7(0x13e)](_0xcde8f7(0x135)+_0x40c8e0);return!![];}});}catch(_0x192591){if(isRuntimeSkillValidationError(_0x192591))throw _0x192591;throw CliErrors[_0x2c87c0(0x13e)](_0x2c87c0(0x13f));}return Object['entries'](_0x539de6)[_0x2c87c0(0x13d)](([_0x246ff5,_0x3f6ef7])=>({'path':normalizeSkillRelativePath(_0x246ff5),'bytes':Buffer['from'](_0x3f6ef7)}))['sort'](compareSkillFiles);}function isRuntimeSkillValidationError(_0x5ee729){const _0x1d0bbb=a167_0x2f084f;return typeof _0x5ee729===_0x1d0bbb(0x132)&&_0x5ee729!==null&&'code'in _0x5ee729&&_0x5ee729['code']===_0x1d0bbb(0x138);}
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(_0x2f0e17,_0x172942){const _0x4745eb=a168_0x4971,_0x3f2f73=_0x2f0e17();while(!![]){try{const _0x171adb=-parseInt(_0x4745eb(0xcb))/0x1+-parseInt(_0x4745eb(0xb0))/0x2+-parseInt(_0x4745eb(0xbb))/0x3*(parseInt(_0x4745eb(0xb8))/0x4)+-parseInt(_0x4745eb(0xbe))/0x5+-parseInt(_0x4745eb(0xca))/0x6*(-parseInt(_0x4745eb(0xad))/0x7)+-parseInt(_0x4745eb(0xc7))/0x8+-parseInt(_0x4745eb(0xb6))/0x9*(-parseInt(_0x4745eb(0xb3))/0xa);if(_0x171adb===_0x172942)break;else _0x3f2f73['push'](_0x3f2f73['shift']());}catch(_0x434da0){_0x3f2f73['push'](_0x3f2f73['shift']());}}}(a168_0x555a,0x3b70b));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(_0x9fd7e7){const _0x254eef=a168_0x4971,_0x5058a6=normalizeLocalFiles(_0x9fd7e7);if(!_0x5058a6[_0x254eef(0xb5)](_0x125689=>_0x125689[_0x254eef(0xc3)]===SKILL_FILE))throw CliErrors[_0x254eef(0xc9)]('Missing\x20'+SKILL_FILE+_0x254eef(0xcd));const _0xd385c2=localFilesToManifestFiles(_0x5058a6),_0x244a25=createDeterministicZipPackage(_0x5058a6);return{'manifest':{'schemaVersion':0x2,'treeSha256':fileTreeHash(_0xd385c2),'zipSha256':bufferSha256(_0x244a25),'zipSize':_0x244a25[_0x254eef(0xc2)],'files':_0xd385c2},'packageBytes':_0x244a25,'packageBase64':_0x244a25[_0x254eef(0xc6)](_0x254eef(0xc5))};}export function verifyRuntimeSkillPackage(_0xafb40f,_0x54e272){const _0x6c30f3=a168_0x4971,_0x336e0a=normalizePackageManifest(_0xafb40f,{'requireOssPath':![]});if(!_0x336e0a)throw CliErrors[_0x6c30f3(0xc9)](_0x6c30f3(0xbc));return extractAndVerifyPackage(_0x336e0a,_0x54e272);}export function verifyRuntimeSkillBundle(_0x5032b4,_0x500ca){const _0x507db3=a168_0x4971,_0x1b8c82=normalizePackageManifest(_0x5032b4,{'requireOssPath':![]});if(!_0x1b8c82)throw CliErrors[_0x507db3(0xc9)]('Runtime\x20Skill\x20package\x20manifest\x20is\x20missing.');return extractAndVerifyPackageFiles(_0x1b8c82,_0x500ca);}export function tryNormalizePackageManifest(_0xf7a173){return normalizePackageManifest(_0xf7a173,{'requireOssPath':![]});}export function requirePackageBytes(_0x4d1526,_0x3435f5){const _0x4b0b0e=a168_0x4971;if(!_0x3435f5||_0x3435f5[_0x4b0b0e(0xc2)]===0x0)throw CliErrors[_0x4b0b0e(0xc9)](_0x4b0b0e(0xb4)+_0x4d1526);return _0x3435f5;}export function extractDownloadedPackage(_0x3ea512){const _0x5119a9=a168_0x4971,_0x1fff5c=parseZipPackage(_0x3ea512)[_0x5119a9(0xa5)](_0xf654d2=>({'path':_0xf654d2[_0x5119a9(0xc3)],'bytes':_0xf654d2[_0x5119a9(0xa6)]}));if(!_0x1fff5c['some'](_0x1f8fd3=>_0x1f8fd3['path']===SKILL_FILE))throw CliErrors[_0x5119a9(0xc9)](_0x5119a9(0xab)+SKILL_FILE+'.');return normalizeLocalFiles(_0x1fff5c);}export function localFilesToManifestFiles(_0x31ec67){const _0x4b5952=a168_0x4971;return normalizeLocalFiles(_0x31ec67)[_0x4b5952(0xa5)](_0x57649d=>({'path':_0x57649d[_0x4b5952(0xc3)],'sha256':fileHash(_0x57649d),'size':fileContent(_0x57649d)[_0x4b5952(0xc2)]}));}function normalizePackageManifest(_0x41f3ca,_0x29aca8){const _0x48fdbc=a168_0x4971;if(!_0x41f3ca||typeof _0x41f3ca!=='object'||Array['isArray'](_0x41f3ca))return undefined;const _0x2f31af=_0x41f3ca,_0x2d0386=typeof _0x2f31af[_0x48fdbc(0xbf)]===_0x48fdbc(0xcf)?_0x2f31af[_0x48fdbc(0xbf)]['trim']():undefined;if(_0x29aca8[_0x48fdbc(0xaf)]&&!_0x2d0386)return undefined;if(!Array['isArray'](_0x2f31af[_0x48fdbc(0xa8)])||_0x2f31af[_0x48fdbc(0xa8)][_0x48fdbc(0xc2)]===0x0)return undefined;if(!isSha256Hex(_0x2f31af[_0x48fdbc(0xa4)]))throw CliErrors[_0x48fdbc(0xc9)](_0x48fdbc(0xb9));if(!isSha256Hex(_0x2f31af[_0x48fdbc(0xaa)]))throw CliErrors['validation'](_0x48fdbc(0xb2));if(!Number[_0x48fdbc(0xbd)](_0x2f31af[_0x48fdbc(0xae)])||_0x2f31af[_0x48fdbc(0xae)]<0x0)throw CliErrors[_0x48fdbc(0xc9)](_0x48fdbc(0xcc));const _0x50798c=normalizeManifestFiles(_0x2f31af[_0x48fdbc(0xa8)]);if(!_0x50798c[_0x48fdbc(0xb5)](_0x8ea506=>_0x8ea506[_0x48fdbc(0xc3)]===SKILL_FILE))throw CliErrors[_0x48fdbc(0xc9)](_0x48fdbc(0xba)+SKILL_FILE+'.');const _0x46cec9=fileTreeHash(_0x50798c);if(_0x46cec9!==_0x2f31af['treeSha256'][_0x48fdbc(0xac)]())throw CliErrors[_0x48fdbc(0xc9)](_0x48fdbc(0xa3));return{'schemaVersion':Number[_0x48fdbc(0xbd)](_0x2f31af[_0x48fdbc(0xb7)])?_0x2f31af['schemaVersion']:0x2,'ossPath':_0x2d0386,'treeSha256':_0x46cec9,'zipSha256':_0x2f31af['zipSha256'][_0x48fdbc(0xac)](),'zipSize':_0x2f31af[_0x48fdbc(0xae)],'files':_0x50798c};}function extractAndVerifyPackage(_0x50d060,_0x261cd2){const _0x11f303=a168_0x4971,_0x2ad315=normalizePackageManifest(_0x50d060,{'requireOssPath':![]});if(!_0x2ad315)throw CliErrors[_0x11f303(0xc9)](_0x11f303(0xbc));if(_0x261cd2[_0x11f303(0xc2)]!==_0x2ad315[_0x11f303(0xae)])throw CliErrors[_0x11f303(0xc9)](_0x11f303(0xc4));const _0x5cebbe=bufferSha256(_0x261cd2);if(_0x5cebbe!==_0x2ad315[_0x11f303(0xaa)])throw CliErrors[_0x11f303(0xc9)](_0x11f303(0xc0));return extractAndVerifyPackageFiles(_0x2ad315,_0x261cd2);}function a168_0x4971(_0x323db3,_0x4676c2){_0x323db3=_0x323db3-0xa3;const _0x555a88=a168_0x555a();let _0x49719e=_0x555a88[_0x323db3];return _0x49719e;}function a168_0x555a(){const _0xdfe294=['Runtime\x20Skill\x20file\x20tree\x20sha256\x20is\x20invalid.','Runtime\x20Skill\x20manifest\x20is\x20missing\x20','5085eRQHcw','Runtime\x20Skill\x20package\x20manifest\x20is\x20missing.','isSafeInteger','341590qnFrBF','ossPath','Runtime\x20Skill\x20package\x20sha256\x20mismatch.','get','length','path','Runtime\x20Skill\x20package\x20size\x20mismatch.','base64','toString','1739200paaMoC','size','validation','1228308JcJjJm','336615IPJNyS','Runtime\x20Skill\x20package\x20size\x20is\x20invalid.','\x20in\x20Skill\x20file\x20package.','set','string','Runtime\x20Skill\x20file\x20tree\x20sha256\x20mismatch.','treeSha256','map','bytes','Runtime\x20Skill\x20package\x20is\x20missing\x20entry:\x20','files','push','zipSha256','Runtime\x20Skill\x20package\x20is\x20missing\x20','toLowerCase','14JKmtgC','zipSize','requireOssPath','134090kKvyJN','Duplicate\x20Skill\x20package\x20entry:\x20','Runtime\x20Skill\x20package\x20sha256\x20is\x20invalid.','10CzpSpO','Runtime\x20Skill\x20package\x20is\x20required\x20for\x20Skill\x20install:\x20','some','7349796tFPixC','schemaVersion','692BtmIzN'];a168_0x555a=function(){return _0xdfe294;};return a168_0x555a();}function extractAndVerifyPackageFiles(_0x39afe5,_0x9501a0){const _0x22da68=a168_0x4971,_0x245780=parseZipPackage(_0x9501a0);if(_0x245780[_0x22da68(0xc2)]!==_0x39afe5[_0x22da68(0xa8)][_0x22da68(0xc2)])throw CliErrors[_0x22da68(0xc9)]('Runtime\x20Skill\x20package\x20entry\x20list\x20mismatch.');const _0x16279b=new Map();for(const _0x5a1033 of _0x245780){if(_0x16279b['has'](_0x5a1033['path']))throw CliErrors['validation'](_0x22da68(0xb1)+_0x5a1033[_0x22da68(0xc3)]);_0x16279b[_0x22da68(0xce)](_0x5a1033[_0x22da68(0xc3)],_0x5a1033);}const _0x40ebad=[];for(const _0x12d814 of _0x39afe5[_0x22da68(0xa8)]){const _0x154b37=_0x16279b[_0x22da68(0xc1)](_0x12d814[_0x22da68(0xc3)]);if(!_0x154b37)throw CliErrors[_0x22da68(0xc9)](_0x22da68(0xa7)+_0x12d814['path']);if(_0x154b37[_0x22da68(0xa6)][_0x22da68(0xc2)]!==_0x12d814[_0x22da68(0xc8)])throw CliErrors[_0x22da68(0xc9)]('Runtime\x20Skill\x20package\x20file\x20size\x20mismatch:\x20'+_0x12d814[_0x22da68(0xc3)]);const _0x46bb42=bufferSha256(_0x154b37['bytes']);if(_0x46bb42!==_0x12d814['sha256'])throw CliErrors[_0x22da68(0xc9)]('Runtime\x20Skill\x20package\x20file\x20sha256\x20mismatch:\x20'+_0x12d814['path']);_0x40ebad[_0x22da68(0xa9)]({'path':_0x12d814[_0x22da68(0xc3)],'bytes':_0x154b37[_0x22da68(0xa6)]});}return normalizeLocalFiles(_0x40ebad);}
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 a169_0x3c7b(){var _0x24cebd=['5120976ioDigl','678kykpJN','757784tAdckr','4323115zgftsf','1462480YpWUMz','3087828IXovSR','48188ysncsg','5769zrlaSr','16lIQKCr'];a169_0x3c7b=function(){return _0x24cebd;};return a169_0x3c7b();}(function(_0xd199fe,_0x2ab3f1){var _0x4b4061=a169_0x3941,_0x27b589=_0xd199fe();while(!![]){try{var _0x51bba5=parseInt(_0x4b4061(0x11d))/0x1+-parseInt(_0x4b4061(0x116))/0x2+parseInt(_0x4b4061(0x11b))/0x3+parseInt(_0x4b4061(0x117))/0x4+-parseInt(_0x4b4061(0x11e))/0x5+-parseInt(_0x4b4061(0x11c))/0x6*(parseInt(_0x4b4061(0x118))/0x7)+-parseInt(_0x4b4061(0x11a))/0x8*(-parseInt(_0x4b4061(0x119))/0x9);if(_0x51bba5===_0x2ab3f1)break;else _0x27b589['push'](_0x27b589['shift']());}catch(_0x625d09){_0x27b589['push'](_0x27b589['shift']());}}}(a169_0x3c7b,0xd3004));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';function a169_0x3941(_0x16f537,_0x35879){_0x16f537=_0x16f537-0x116;var _0x3c7b96=a169_0x3c7b();var _0x394176=_0x3c7b96[_0x16f537];return _0x394176;}export{deriveSkillCodeFromDirectory,readPushDirectory,refreshPushDirectoryMetadataFromRemote,recordPushedRuntimeSkill,resolvePushDirectoryIdentity}from'./runtime-skill-sync/push.js';export{buildSkillPackage,verifyRuntimeSkillBundle,verifyRuntimeSkillPackage}from'./runtime-skill-sync/zip-package.js';
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";