@lovrabet/lovrabet-cli 2.3.13-beta.1 → 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.
- package/README.md +22 -14
- package/lib/cli.js +4 -1
- package/lib/commands/api-doc/index.js +11 -1
- package/lib/commands/app/cache.js +2 -1
- package/lib/commands/app/definitions.js +7 -1
- package/lib/commands/app/eligibility.js +2 -1
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.js +2 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/approval/index.js +7 -1
- package/lib/commands/artifact/index.js +11 -1
- package/lib/commands/auth/device.js +8 -1
- package/lib/commands/auth/index.js +9 -1
- package/lib/commands/auth/prompt.js +2 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.js +2 -1
- package/lib/commands/common/config-policy.js +2 -1
- package/lib/commands/common/constraints.js +2 -1
- package/lib/commands/common/flags.js +2 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.js +8 -1
- package/lib/commands/config/init.js +4 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/import-excel.js +10 -1
- package/lib/commands/data/index.js +10 -1
- package/lib/commands/dataset/detail.js +6 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +2 -1
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.js +9 -1
- package/lib/commands/file/index.js +3 -1
- package/lib/commands/init.js +4 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/report.js +5 -1
- package/lib/commands/kb/index.js +7 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/metric/contract.js +5 -1
- package/lib/commands/metric/definition.js +4 -1
- package/lib/commands/metric/detail.js +1 -1
- package/lib/commands/metric/exec.js +3 -1
- package/lib/commands/metric/index.js +1 -1
- package/lib/commands/metric/list.js +2 -1
- package/lib/commands/metric/shared.js +2 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +2 -1
- package/lib/commands/ocr/index.js +4 -1
- package/lib/commands/permit/dataset-get.js +1 -1
- package/lib/commands/permit/dataset-set.js +5 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +3 -1
- package/lib/commands/permit/role-menus-set.js +4 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +7 -1
- package/lib/commands/personal-bff/index.js +7 -1
- package/lib/commands/registry.js +6 -1
- package/lib/commands/role/create.js +2 -1
- package/lib/commands/role/delete.js +2 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +2 -1
- package/lib/commands/role/shared.js +8 -1
- package/lib/commands/role/update.js +3 -1
- package/lib/commands/role/user-add.js +2 -1
- package/lib/commands/role/user-remove.js +2 -1
- package/lib/commands/schedule/index.js +7 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.js +10 -1
- package/lib/commands/service/function-name-adapter.js +3 -1
- package/lib/commands/service/index.js +8 -1
- package/lib/commands/service/registry.js +12 -1
- package/lib/commands/skill/commands/create.js +3 -1
- package/lib/commands/skill/commands/diagram.js +4 -1
- package/lib/commands/skill/commands/install.js +6 -1
- package/lib/commands/skill/commands/list.js +3 -1
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/diagram.js +3 -1
- package/lib/commands/skill/flags.js +4 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.js +11 -1
- package/lib/commands/skill/push-flow-helpers.js +4 -1
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.js +8 -1
- package/lib/commands/skill/validate.js +8 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +2 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.d.ts +2 -1
- package/lib/commands/update.js +8 -1
- package/lib/commands/user-account/bind.js +3 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/index.js +7 -1
- package/lib/config/domain-config.js +6 -1
- package/lib/config/schema.js +5 -1
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.js +3 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.js +2 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.js +2 -1
- package/lib/constant/region.js +2 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.js +1 -1
- package/lib/context.js +11 -1
- package/lib/core/api-client.js +38 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/kb-management-client.js +6 -1
- package/lib/core/kb-sdk-errors.js +2 -1
- package/lib/core/kb-search-client.js +2 -1
- package/lib/core/sdk-client.js +5 -1
- package/lib/errors.js +2 -1
- package/lib/framework/access-error.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +2 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.js +3 -1
- package/lib/framework/rate-limit.js +2 -1
- package/lib/framework/raw-flags.js +2 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.js +2 -1
- package/lib/framework/runner-error.js +2 -1
- package/lib/framework/runner.js +9 -1
- package/lib/framework/schema-export.js +2 -1
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +2 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +4 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +2 -1
- package/lib/runtime/types.js +1 -1
- package/lib/services/dataset-import/auto-id-runner.js +9 -1
- package/lib/services/dataset-import/excel-reader.js +25 -1
- package/lib/services/dataset-import/image-bytes.js +6 -1
- package/lib/services/dataset-import/image-ooxml.js +15 -1
- package/lib/services/dataset-import/image-runner.js +9 -1
- package/lib/services/dataset-import/metadata.js +1 -1
- package/lib/services/dataset-import/preview.js +1 -1
- package/lib/services/dataset-import/runner.js +13 -1
- package/lib/services/dataset-import/types.js +1 -1
- package/lib/skills/builtin-skill.js +8 -1
- package/lib/skills/install-updated-skill.d.ts +8 -0
- package/lib/skills/install-updated-skill.js +3 -0
- package/lib/skills/local-skills-installer.d.ts +2 -0
- package/lib/skills/local-skills-installer.js +1 -0
- package/lib/skills/npx-skills-add.d.ts +2 -2
- package/lib/skills/npx-skills-add.js +4 -1
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.js +3 -1
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/install-target.js +1 -1
- package/lib/skills/runtime-skill-sync/links.js +9 -1
- package/lib/skills/runtime-skill-sync/list-local.js +4 -1
- package/lib/skills/runtime-skill-sync/local-files.js +5 -1
- package/lib/skills/runtime-skill-sync/materialize.js +9 -1
- package/lib/skills/runtime-skill-sync/metadata.js +3 -1
- package/lib/skills/runtime-skill-sync/paths.js +2 -1
- package/lib/skills/runtime-skill-sync/push.js +8 -1
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/types.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-codec.js +2 -1
- package/lib/skills/runtime-skill-sync/zip-package.js +6 -1
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/skills/skill-presence.d.ts +1 -34
- package/lib/skills/skill-presence.js +2 -1
- package/lib/utils/access-key-redaction.js +2 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cli-version-check.js +2 -1
- package/lib/utils/cli-version-policy.js +3 -1
- package/lib/utils/logger.js +3 -1
- package/lib/utils/lossless-json.js +3 -1
- package/lib/utils/params.js +3 -1
- package/lib/utils/positive-safe-integer.js +1 -1
- package/lib/utils/redaction.js +2 -1
- package/lib/utils/runtime-user-id.js +1 -1
- package/lib/utils/update-notice.js +3 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +5 -7
- package/skills/lovrabet/SKILL.md +3 -3
- package/skills/lovrabet/references/lovrabet-skill-install.md +1 -1
- package/skills/lovrabet/references/lovrabet-update.md +6 -4
- package/skills/lovrabet-report-generation/SKILL.md +1 -1
- package/skills/lovrabet.manifest.json +3 -3
- package/lib/postinstall.d.ts +0 -2
- package/lib/postinstall.js +0 -1
- package/scripts/postinstall.mjs +0 -24
|
@@ -1 +1,8 @@
|
|
|
1
|
-
const a159_0x1f4135=a159_0x3304;(function(_0x4d1ff8,_0x4e3b47){const _0x4ef296=a159_0x3304,_0x591032=_0x4d1ff8();while(!![]){try{const _0x388054=parseInt(_0x4ef296(0xb4))/0x1*(parseInt(_0x4ef296(0x98))/0x2)+parseInt(_0x4ef296(0xc9))/0x3*(parseInt(_0x4ef296(0x99))/0x4)+-parseInt(_0x4ef296(0xb1))/0x5*(-parseInt(_0x4ef296(0xab))/0x6)+parseInt(_0x4ef296(0xce))/0x7*(parseInt(_0x4ef296(0x92))/0x8)+parseInt(_0x4ef296(0xd1))/0x9+parseInt(_0x4ef296(0xc6))/0xa*(-parseInt(_0x4ef296(0xc5))/0xb)+parseInt(_0x4ef296(0xa5))/0xc*(-parseInt(_0x4ef296(0xd2))/0xd);if(_0x388054===_0x4e3b47)break;else _0x591032['push'](_0x591032['shift']());}catch(_0x15b9fd){_0x591032['push'](_0x591032['shift']());}}}(a159_0x4d14,0x4ed79));import{createHash}from'node:crypto';import{lstatSync,readFileSync,readdirSync}from'node:fs';import{homedir}from'node:os';import{dirname,join,relative,resolve,sep}from'node:path';import{fileURLToPath}from'node:url';import{debuglog}from'node:util';import{runNpxSkillsAddGlobal}from'../skills/npx-skills-add.js';import{resolveInstalledSkill}from'../skills/skill-presence.js';const DEFAULT_PACKAGE_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..','..'),REPAIR_COMMAND='lovrabet\x20cli-skill\x20install',SKILL_NAME=a159_0x1f4135(0x95),debug=debuglog(a159_0x1f4135(0xb3));function frontmatterValue(_0x5b4e31,_0x4ae5af){const _0x226a8e=a159_0x1f4135;return _0x5b4e31[_0x226a8e(0xca)](new RegExp('^'+_0x4ae5af+_0x226a8e(0xb2),'m'))?.[0x1]?.[_0x226a8e(0xa0)]()??'';}function listFiles(_0x134556,_0x3b80d1=_0x134556){return readdirSync(_0x3b80d1,{'withFileTypes':!![]})['flatMap'](_0x54bdc5=>{const _0x535b39=a159_0x3304,_0x162a18=join(_0x3b80d1,_0x54bdc5[_0x535b39(0x93)]),_0x3af3c2=lstatSync(_0x162a18);if(_0x3af3c2[_0x535b39(0xc1)]())throw new Error(_0x535b39(0xaf)+_0x162a18);if(_0x3af3c2[_0x535b39(0x94)]())return listFiles(_0x134556,_0x162a18);if(!_0x3af3c2[_0x535b39(0xcd)]())throw new Error(_0x535b39(0x9a)+_0x162a18);return[relative(_0x134556,_0x162a18)[_0x535b39(0x9b)](sep)['join']('/')];})['sort']((_0x51f47a,_0x33c199)=>_0x51f47a<_0x33c199?-0x1:_0x51f47a>_0x33c199?0x1:0x0);}function digestFiles(_0x5987cc,_0x2e1c57){const _0x6b2d0a=a159_0x1f4135,_0x5c9d50=createHash(_0x6b2d0a(0xb7));for(const _0x3f38c9 of _0x2e1c57){if(_0x3f38c9['startsWith']('/')||_0x3f38c9[_0x6b2d0a(0x9b)]('/')['includes']('..')||_0x3f38c9[_0x6b2d0a(0xa3)]('\x5c'))throw new Error(_0x6b2d0a(0xae)+_0x3f38c9);_0x5c9d50[_0x6b2d0a(0x96)](_0x3f38c9),_0x5c9d50[_0x6b2d0a(0x96)]('\x00'),_0x5c9d50[_0x6b2d0a(0x96)](readFileSync(join(_0x5987cc,..._0x3f38c9[_0x6b2d0a(0x9b)]('/')))),_0x5c9d50[_0x6b2d0a(0x96)]('\x00');}return _0x5c9d50[_0x6b2d0a(0xa6)](_0x6b2d0a(0xa8));}function sameFiles(_0x392aa6,_0x5f5bc8){const _0x4d754f=a159_0x1f4135;return _0x392aa6[_0x4d754f(0xc4)]===_0x5f5bc8['length']&&_0x392aa6[_0x4d754f(0xd4)]((_0x3a2f6a,_0x54c5eb)=>_0x3a2f6a===_0x5f5bc8[_0x54c5eb]);}function a159_0x4d14(){const _0x4c1c6f=['match','home','output','isFile','126TONvXq','present','lovrabet.manifest.json','2082645wfxXog','1627379toCplH','CLI\x20Built-in\x20Skill\x20','every','version_mismatch','schemaVersion','files','partialFailure','84848hRsCJf','name','isDirectory','lovrabet','update','packageRoot','44580UKlXmy','904VNjEoA','Unsupported\x20Skill\x20entry:\x20','split','SOURCE_INVALID','unverifiable','skills','status','trim','Built-in\x20Skill\x20source\x20does\x20not\x20match\x20its\x20package\x20manifest','installedPath','includes','state','132znerKs','digest','parse','hex','root','current','720246MNMgen','Installer\x20reported\x20partial\x20target\x20failures:\x0a%s','SKILL.md','Unsafe\x20manifest\x20path:\x20','Symbolic\x20link\x20is\x20not\x20allowed:\x20','missing','20pWLHhx',':\x5cs*(.+)$','lovrabet-skills','11bbpeQy','version','unknown','sha256','log','message','stdio','utf8','packageVersion','VERIFY_FAILED','skipped','count','path','isSymbolicLink','Installed\x20Skill\x20state\x20is\x20','skillVersion','length','858341lTCPXW','10xwRqom','reason','INSTALL_FAILED','8367sDbcLw'];a159_0x4d14=function(){return _0x4c1c6f;};return a159_0x4d14();}function readSource(_0xf1188d){const _0x26852d=a159_0x1f4135,_0x8a3bd=JSON['parse'](readFileSync(join(_0xf1188d,'package.json'),_0x26852d(0xbb))),_0x3c04b7=JSON[_0x26852d(0xa7)](readFileSync(join(_0xf1188d,_0x26852d(0x9e),_0x26852d(0xd0)),_0x26852d(0xbb))),_0x3692f6=join(_0xf1188d,_0x26852d(0x9e),SKILL_NAME),_0x208c83=frontmatterValue(readFileSync(join(_0x3692f6,_0x26852d(0xad)),_0x26852d(0xbb)),_0x26852d(0xb5)),_0x2300a8=listFiles(_0x3692f6);if(_0x3c04b7[_0x26852d(0x8f)]!==0x1||_0x3c04b7[_0x26852d(0x93)]!==SKILL_NAME||!_0x8a3bd[_0x26852d(0xb5)]||_0x3c04b7['packageVersion']!==_0x8a3bd[_0x26852d(0xb5)]||_0x3c04b7[_0x26852d(0xc3)]!==_0x8a3bd[_0x26852d(0xb5)]||_0x208c83!==_0x8a3bd[_0x26852d(0xb5)]||!sameFiles(_0x2300a8,_0x3c04b7[_0x26852d(0x90)])||digestFiles(_0x3692f6,_0x2300a8)!==_0x3c04b7[_0x26852d(0xa6)])throw new Error(_0x26852d(0xa1));return{'packageVersion':_0x8a3bd['version'],'skillVersion':_0x208c83,'root':_0x3692f6,'manifest':_0x3c04b7};}function installedSkillPath(_0xd5266f){const _0x44ff48=a159_0x1f4135,_0x4ef0a7=resolveInstalledSkill(SKILL_NAME,{'home':_0xd5266f});if(_0x4ef0a7[_0x44ff48(0xa4)]===_0x44ff48(0xcf))return{'state':_0x44ff48(0xcf),'path':dirname(_0x4ef0a7[_0x44ff48(0xc0)])};if(_0x4ef0a7[_0x44ff48(0xa4)]==='absent')return{'state':_0x44ff48(0xb0)};return{'state':_0x44ff48(0x9d),'reason':_0x4ef0a7[_0x44ff48(0xc7)]};}export function inspectInstalledBuiltinSkillVersion(_0x4bb58e,_0x3a3c4f={}){const _0x127afe=a159_0x1f4135,_0xeb7bbb=installedSkillPath(_0x3a3c4f[_0x127afe(0xcb)]??homedir());if(_0xeb7bbb[_0x127afe(0xa4)]===_0x127afe(0xb0))return{'state':_0x127afe(0xb0),'expectedVersion':_0x4bb58e,'repairCommand':REPAIR_COMMAND};if(_0xeb7bbb[_0x127afe(0xa4)]===_0x127afe(0x9d))return{'state':'unverifiable','expectedVersion':_0x4bb58e,'reason':_0xeb7bbb[_0x127afe(0xc7)],'repairCommand':REPAIR_COMMAND};try{const _0x41d6ee=frontmatterValue(readFileSync(join(_0xeb7bbb[_0x127afe(0xc0)],_0x127afe(0xad)),_0x127afe(0xbb)),_0x127afe(0xb5));return{'state':_0x41d6ee===_0x4bb58e?'current':_0x127afe(0x8e),'expectedVersion':_0x4bb58e,'skillVersion':_0x41d6ee,'installedPath':_0xeb7bbb[_0x127afe(0xc0)],'repairCommand':REPAIR_COMMAND};}catch(_0x1f2dc0){return{'state':_0x127afe(0x9d),'expectedVersion':_0x4bb58e,'installedPath':_0xeb7bbb[_0x127afe(0xc0)],'reason':_0x1f2dc0 instanceof Error?_0x1f2dc0[_0x127afe(0xb9)]:String(_0x1f2dc0),'repairCommand':REPAIR_COMMAND};}}function a159_0x3304(_0x250ea9,_0x1c0cf2){_0x250ea9=_0x250ea9-0x8e;const _0x4d1472=a159_0x4d14();let _0x330478=_0x4d1472[_0x250ea9];return _0x330478;}export function inspectBuiltinSkill(_0x44a4e0={}){const _0x340e9d=a159_0x1f4135,_0x5dd452=_0x44a4e0[_0x340e9d(0x97)]??DEFAULT_PACKAGE_ROOT;let _0x2d4b41;try{_0x2d4b41=readSource(_0x5dd452);}catch(_0x2c904c){return{'state':_0x340e9d(0x9d),'packageVersion':_0x340e9d(0xb6),'reason':_0x2c904c instanceof Error?_0x2c904c[_0x340e9d(0xb9)]:String(_0x2c904c),'repairCommand':REPAIR_COMMAND};}const _0x2053e5=installedSkillPath(_0x44a4e0[_0x340e9d(0xcb)]??homedir());if(_0x2053e5[_0x340e9d(0xa4)]===_0x340e9d(0xb0))return{'state':_0x340e9d(0xb0),'packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'repairCommand':REPAIR_COMMAND};if(_0x2053e5['state']==='unverifiable')return{'state':'unverifiable','packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'reason':_0x2053e5[_0x340e9d(0xc7)],'repairCommand':REPAIR_COMMAND};try{const _0x367808=frontmatterValue(readFileSync(join(_0x2053e5[_0x340e9d(0xc0)],_0x340e9d(0xad)),_0x340e9d(0xbb)),_0x340e9d(0xb5));if(_0x367808!==_0x2d4b41[_0x340e9d(0xc3)])return{'state':_0x340e9d(0x8e),'packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'skillVersion':_0x367808,'installedPath':_0x2053e5[_0x340e9d(0xc0)],'repairCommand':REPAIR_COMMAND};const _0x4c2efa=listFiles(_0x2053e5['path']),_0x69e786=digestFiles(_0x2053e5[_0x340e9d(0xc0)],_0x4c2efa);return{'state':sameFiles(_0x4c2efa,_0x2d4b41['manifest'][_0x340e9d(0x90)])&&_0x69e786===_0x2d4b41['manifest']['digest']?_0x340e9d(0xaa):'content_mismatch','packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'skillVersion':_0x367808,'installedPath':_0x2053e5['path'],'digest':_0x69e786,'repairCommand':REPAIR_COMMAND};}catch(_0x7403a0){return{'state':_0x340e9d(0x9d),'packageVersion':_0x2d4b41[_0x340e9d(0xbc)],'installedPath':_0x2053e5[_0x340e9d(0xc0)],'reason':_0x7403a0 instanceof Error?_0x7403a0[_0x340e9d(0xb9)]:String(_0x7403a0),'repairCommand':REPAIR_COMMAND};}}function failure(_0x11c83f,_0x20f1d9,_0x393167,_0x292351){const _0x2ef86e=a159_0x1f4135;return{'ok':![],'code':_0x11c83f,'packageVersion':_0x20f1d9['packageVersion'],'skillVersion':_0x20f1d9[_0x2ef86e(0xc3)],'installedPath':_0x292351,'changed':![],'repairCommand':REPAIR_COMMAND,'error':_0x393167 instanceof Error?_0x393167[_0x2ef86e(0xb9)]:String(_0x393167)};}export function installBuiltinSkill(_0x8f884f={}){const _0x59e007=a159_0x1f4135,_0x13d065=_0x8f884f[_0x59e007(0x97)]??DEFAULT_PACKAGE_ROOT,_0x5020ac=_0x8f884f[_0x59e007(0xcb)]??homedir();let _0x152e9d;try{_0x152e9d=readSource(_0x13d065);}catch(_0x4903bd){return failure(_0x59e007(0x9c),{'packageVersion':_0x59e007(0xb6),'skillVersion':'unknown'},_0x4903bd);}const _0x4817a4=inspectBuiltinSkill({'packageRoot':_0x13d065,'home':_0x5020ac}),_0x551aee=runNpxSkillsAddGlobal(_0x13d065,_0x152e9d[_0x59e007(0xa9)],{'stdio':_0x8f884f[_0x59e007(0xba)]??'pipe','expectedSkillName':SKILL_NAME,'presence':{'home':_0x5020ac}});if(_0x551aee[_0x59e007(0xbe)])return{'ok':!![],'packageVersion':_0x152e9d['packageVersion'],'skillVersion':_0x152e9d[_0x59e007(0xc3)],'installedPath':_0x4817a4[_0x59e007(0xa2)],'changed':![],'repairCommand':REPAIR_COMMAND};if(!_0x551aee['ok'])return failure(_0x59e007(0xc8),_0x152e9d,_0x551aee['error']??'skills@latest\x20exited\x20'+_0x551aee[_0x59e007(0x9f)]);const _0x478784=inspectBuiltinSkill({'packageRoot':_0x13d065,'home':_0x5020ac});if(_0x478784[_0x59e007(0xa4)]!==_0x59e007(0xaa)){const _0x5afbf5=_0x478784[_0x59e007(0xc7)]??_0x59e007(0xc2)+_0x478784['state'];return failure(_0x59e007(0xbd),_0x152e9d,_0x551aee[_0x59e007(0x91)]?_0x5afbf5+'\x0a'+_0x551aee['partialFailure'][_0x59e007(0xcc)]:_0x5afbf5,_0x478784[_0x59e007(0xa2)]);}return _0x551aee['partialFailure']&&(debug(_0x59e007(0xac),_0x551aee[_0x59e007(0x91)]['output']),console[_0x59e007(0xb8)](_0x59e007(0xd3)+_0x152e9d[_0x59e007(0xc3)]+'\x20verified;\x20'+_0x551aee[_0x59e007(0x91)][_0x59e007(0xbf)]+'\x20automatically\x20selected\x20installation\x20target(s)\x20could\x20not\x20be\x20installed.')),{'ok':!![],'packageVersion':_0x152e9d[_0x59e007(0xbc)],'skillVersion':_0x152e9d[_0x59e007(0xc3)],'installedPath':_0x478784[_0x59e007(0xa2)],'changed':_0x4817a4[_0x59e007(0xa4)]!==_0x59e007(0xaa),'repairCommand':REPAIR_COMMAND};}
|
|
1
|
+
import{createHash}from"node:crypto";import{lstatSync,readFileSync,readdirSync}from"node:fs";import{homedir}from"node:os";import{dirname,join,relative,resolve,sep}from"node:path";import{fileURLToPath}from"node:url";import{debuglog}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 @@
|
|
|
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
|
|
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 = "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
import{resolve}from"node:path";import{resolveSkillSyncPaths,runtimeAgentSkillRoots,safePathSegment}from"./paths.js";export function resolveRuntimeSkillInstallTarget(appCode,scope="global",options={}){const paths=resolveSkillSyncPaths(options);const safeAppCode=safePathSegment(appCode,"appCode");const skillRoots=scope==="project"?[resolve(options.cwd??process.cwd(),".agents","skills")]:runtimeAgentSkillRoots(paths);return Object.freeze({scope:scope,appCode:safeAppCode,skillRoots:Object.freeze(skillRoots),managedRoot:paths.managedRoot})}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
const a165_0x372c48=a165_0x3279;(function(_0x9441de,_0x745813){const _0x5870e5=a165_0x3279,_0x26c201=_0x9441de();while(!![]){try{const _0x5b713d=parseInt(_0x5870e5(0x173))/0x1+-parseInt(_0x5870e5(0x181))/0x2+-parseInt(_0x5870e5(0x169))/0x3+parseInt(_0x5870e5(0x17c))/0x4+parseInt(_0x5870e5(0x166))/0x5*(-parseInt(_0x5870e5(0x156))/0x6)+parseInt(_0x5870e5(0x160))/0x7+-parseInt(_0x5870e5(0x17d))/0x8*(-parseInt(_0x5870e5(0x182))/0x9);if(_0x5b713d===_0x745813)break;else _0x26c201['push'](_0x26c201['shift']());}catch(_0x1ed6e5){_0x26c201['push'](_0x26c201['shift']());}}}(a165_0x5619,0x44e57));import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from'node:fs';import{basename,dirname,resolve}from'node:path';import a165_0x2c5a29 from'fs-extra';import{CliErrors}from'../../errors.js';import{METADATA_FILE}from'./constants.js';import{isDanglingSymlink,isPathInside,lstatIfPresent,realOrResolved,resolveSymlinkTarget}from'./fs-utils.js';import{readMetadataIfPresent,requireSkillCode}from'./metadata.js';function a165_0x5619(){const _0x4aa204=['610468VdpZcP','9lwyeZz','skillCode','startsWith','external-symlink','push','updated','env','Refusing\x20to\x20overwrite\x20global\x20Skill\x20symlink:\x20','secret-retriever','isSymbolicLink','lovrabet','filter','activeSkillCodes','metadataPath','14682MnFaQY','has','Refusing\x20to\x20overwrite\x20unmanaged\x20global\x20Skill\x20directory:\x20','Refusing\x20to\x20overwrite\x20global\x20Skill\x20path:\x20','metadata-mismatch','removed','scope','appCode','validation','slice','2369703DYCQCz','skill','not-managed-symlink','length','Refusing\x20to\x20link\x20Skill\x20metadata\x20outside\x20target\x20','project','245KcXNwb','personal','Refusing\x20to\x20copy\x20Skill\x20symlink:\x20','1107291GXnVzf','Refusing\x20to\x20shadow\x20reserved\x20Agent\x20Skill\x20in\x20project\x20scope:\x20','get','builtin','pruneSkillCodes','Refusing\x20to\x20overwrite\x20unmanaged\x20path:\x20','map','scopes','linked-from-protected-root','trim','352274lifOAq','skipped','dir','company','isDirectory','created','Refusing\x20to\x20overwrite\x20unmanaged\x20symlink:\x20','managedRoot','name','981028eqpKjK','1122984ThmnYE','agentsSkillsDir','accessKey','set'];a165_0x5619=function(){return _0x4aa204;};return a165_0x5619();}import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,safePathSegment}from'./paths.js';const {copySync,ensureDirSync,removeSync}=a165_0x2c5a29,RESERVED_PROJECT_SKILL_CODES=new Set([a165_0x372c48(0x152),'runtime-observe',a165_0x372c48(0x150)]);export function linkEffectiveRuntimeSkills(_0x5b84c6,_0x4baa6d){const _0x44120e=a165_0x372c48,_0x4d60cc=new Map();for(const _0x59e126 of _0x5b84c6){const _0x394157=_0x59e126[_0x44120e(0x161)][_0x44120e(0x183)];if(!_0x394157)continue;const _0x53ec24=_0x4d60cc[_0x44120e(0x16b)](_0x394157);(!_0x53ec24||_0x59e126['scope']===_0x44120e(0x167))&&_0x4d60cc[_0x44120e(0x180)](_0x394157,_0x59e126);}const _0x5f1056=[];for(const _0x224e1d of _0x4d60cc['values']()){const _0x88d019=requireSkillCode(_0x224e1d[_0x44120e(0x161)]),_0x59c3c3=readMetadataIfPresent(_0x224e1d[_0x44120e(0x155)]);if(_0x59c3c3?.[_0x44120e(0x15d)]!==_0x4baa6d[_0x44120e(0x15d)]||_0x59c3c3['skillCode']!==_0x88d019)throw CliErrors[_0x44120e(0x15e)](_0x44120e(0x164)+_0x4baa6d[_0x44120e(0x15d)]+':\x20'+_0x224e1d['metadataPath']);const _0x4d888f=runtimeSkillLinkName(_0x4baa6d,_0x88d019);for(const _0x119ebe of _0x4baa6d['skillRoots']){_0x5f1056['push'](ensureManagedSymlink(resolve(_0x119ebe,_0x4d888f),_0x224e1d['dir'],_0x4baa6d,_0x88d019));}}return _0x5f1056;}export function pruneStaleRuntimeSkillLinks(_0x2cf1aa,_0x7d3c4a,_0x155d58){const _0x46392c=a165_0x372c48,_0xdda2d1=new Set([..._0x7d3c4a][_0x46392c(0x16f)](_0x4144cf=>_0x4144cf[_0x46392c(0x172)]())[_0x46392c(0x153)](Boolean)),_0xec5bfd=_0x155d58?new Set([..._0x155d58][_0x46392c(0x16f)](_0x3eb8c4=>_0x3eb8c4[_0x46392c(0x172)]())[_0x46392c(0x153)](Boolean)):undefined,_0x5d612c=[];for(const _0x1ba9dc of _0x2cf1aa['skillRoots']){for(const _0x6ed0fb of managedTargetSkillLinkPaths(_0x1ba9dc,_0x2cf1aa)){const _0x220d6e=runtimeSkillCodeFromLink(_0x2cf1aa,_0x6ed0fb);if(_0xec5bfd&&!_0xec5bfd[_0x46392c(0x157)](_0x220d6e))continue;if(_0xdda2d1[_0x46392c(0x157)](_0x220d6e))continue;_0x5d612c[_0x46392c(0x14c)](removeManagedSkillLink(_0x6ed0fb,_0x2cf1aa,_0x220d6e));}}return _0x5d612c;}export function pruneStaleRuntimeSkillCache(_0x5039e5,_0x2cd197={}){const _0x2b4906=a165_0x372c48,_0x3530ef=new Set([..._0x5039e5[_0x2b4906(0x154)]][_0x2b4906(0x16f)](_0x52c1ac=>_0x52c1ac[_0x2b4906(0x172)]())[_0x2b4906(0x153)](Boolean)),_0x3325f2=_0x5039e5['pruneSkillCodes']?new Set([..._0x5039e5[_0x2b4906(0x16d)]]['map'](_0x1efb7e=>_0x1efb7e[_0x2b4906(0x172)]())[_0x2b4906(0x153)](Boolean)):undefined,_0x15c544=_0x5039e5[_0x2b4906(0x170)]??['personal',_0x2b4906(0x176)],_0x1edd8c=resolve(getRuntimeSkillCacheRoot(_0x5039e5[_0x2b4906(0x14e)],_0x5039e5[_0x2b4906(0x17f)],_0x2cd197),safePathSegment(_0x5039e5[_0x2b4906(0x15d)],_0x2b4906(0x15d))),_0x4d955a=[];for(const _0x599d2f of _0x15c544){const _0x384b0b=resolve(_0x1edd8c,_0x599d2f);if(!existsSync(_0x384b0b))continue;for(const _0x3981b9 of readdirSync(_0x384b0b,{'withFileTypes':!![]})){if(!_0x3981b9[_0x2b4906(0x177)]())continue;const _0x1e2f22=_0x3981b9[_0x2b4906(0x17b)];if(_0x3325f2&&!_0x3325f2['has'](_0x1e2f22))continue;if(_0x3530ef[_0x2b4906(0x157)](_0x1e2f22))continue;const _0x18ac42=resolve(_0x384b0b,_0x1e2f22),_0xcfcee5=readMetadataIfPresent(resolve(_0x18ac42,METADATA_FILE));if(_0xcfcee5?.[_0x2b4906(0x15d)]!==_0x5039e5[_0x2b4906(0x15d)]||_0xcfcee5[_0x2b4906(0x15c)]!==_0x599d2f||_0xcfcee5[_0x2b4906(0x183)]!==_0x1e2f22){_0x4d955a['push']({'path':_0x18ac42,'action':_0x2b4906(0x174),'reason':_0x2b4906(0x15a)});continue;}if(isLinkedFromAnyRoot(_0x18ac42,_0x5039e5['protectedLinkRoots']??[])){_0x4d955a[_0x2b4906(0x14c)]({'path':_0x18ac42,'action':_0x2b4906(0x174),'reason':_0x2b4906(0x171)});continue;}removeSync(_0x18ac42),_0x4d955a['push']({'path':_0x18ac42,'action':_0x2b4906(0x15b)});}}return _0x4d955a;}export function linkGlobalRuntimeSkills(_0x377839,_0xcdc04b={}){const _0x2f1568=a165_0x372c48,_0x5cba7f=resolveSkillSyncPaths(_0xcdc04b),_0x666bb8=[];for(const _0x48f03f of _0x377839){if(_0x48f03f[_0x2f1568(0x15c)]!==_0x2f1568(0x16c))throw CliErrors['validation']('Only\x20builtin\x20Skills\x20can\x20be\x20linked\x20into\x20the\x20global\x20Skill\x20root:\x20'+_0x48f03f[_0x2f1568(0x15c)]);const _0x48c5a5=requireSkillCode(_0x48f03f[_0x2f1568(0x161)]),_0x25afe6=copyManagedSkillDirectory(_0x48f03f[_0x2f1568(0x175)],resolve(_0x5cba7f[_0x2f1568(0x17e)],_0x48c5a5));_0x666bb8[_0x2f1568(0x14c)]({..._0x25afe6,'contentHash':_0x48f03f['contentHash']});}return _0x666bb8;}function ensureManagedSymlink(_0x3f4ac6,_0x333f5b,_0x4474b5,_0x46d11f){const _0xa65d63=a165_0x372c48;mkdirSync(dirname(_0x3f4ac6),{'recursive':!![],'mode':0x1c0});if(existsSync(_0x3f4ac6)||isDanglingSymlink(_0x3f4ac6)){const _0x141596=lstatSync(_0x3f4ac6);if(!_0x141596[_0xa65d63(0x151)]())throw CliErrors[_0xa65d63(0x15e)](_0xa65d63(0x16e)+_0x3f4ac6);const _0x57d035=resolveSymlinkTarget(_0x3f4ac6);if(!isPathInside(realOrResolved(_0x57d035),realOrResolved(_0x4474b5[_0xa65d63(0x17a)])))throw CliErrors['validation'](_0xa65d63(0x179)+_0x3f4ac6);if(realOrResolved(_0x57d035)===realOrResolved(_0x333f5b))return{'path':_0x3f4ac6,'target':_0x333f5b,'action':'unchanged'};const _0xa12f80=readMetadataIfPresent(resolve(_0x57d035,METADATA_FILE));if(_0x4474b5[_0xa65d63(0x15c)]==='project'&&(_0xa12f80?.['appCode']!==_0x4474b5['appCode']||_0xa12f80[_0xa65d63(0x183)]!==_0x46d11f))throw CliErrors[_0xa65d63(0x15e)]('Refusing\x20to\x20overwrite\x20managed\x20Skill\x20link\x20owned\x20by\x20another\x20app\x20or\x20code:\x20'+_0x3f4ac6);return unlinkSync(_0x3f4ac6),symlinkSync(_0x333f5b,_0x3f4ac6,_0xa65d63(0x175)),{'path':_0x3f4ac6,'target':_0x333f5b,'action':_0xa65d63(0x14d)};}return symlinkSync(_0x333f5b,_0x3f4ac6,_0xa65d63(0x175)),{'path':_0x3f4ac6,'target':_0x333f5b,'action':_0xa65d63(0x178)};}function a165_0x3279(_0x309134,_0x3cc39c){_0x309134=_0x309134-0x14c;const _0x561974=a165_0x5619();let _0x327991=_0x561974[_0x309134];return _0x327991;}function managedTargetSkillLinkPaths(_0x22b8c6,_0x200eac){const _0x2e185e=a165_0x372c48;if(!existsSync(_0x22b8c6))return[];const _0x1498c9=_0x200eac[_0x2e185e(0x15d)]+'--';return readdirSync(_0x22b8c6,{'withFileTypes':!![]})[_0x2e185e(0x153)](_0x51b116=>_0x200eac[_0x2e185e(0x15c)]===_0x2e185e(0x165)||_0x51b116['name'][_0x2e185e(0x184)](_0x1498c9))['map'](_0x23bc68=>resolve(_0x22b8c6,_0x23bc68[_0x2e185e(0x17b)]));}function removeManagedSkillLink(_0x1861cc,_0x1f7e4f,_0x19236b){const _0x6b115=a165_0x372c48,_0x4028a3=lstatIfPresent(_0x1861cc);if(!_0x4028a3?.[_0x6b115(0x151)]())return{'path':_0x1861cc,'action':_0x6b115(0x174),'reason':_0x6b115(0x162)};const _0x3e2d4f=resolveSymlinkTarget(_0x1861cc);if(!isPathInside(realOrResolved(_0x3e2d4f),realOrResolved(_0x1f7e4f['managedRoot'])))return{'path':_0x1861cc,'action':'skipped','reason':_0x6b115(0x185)};const _0x1cfe5c=readMetadataIfPresent(resolve(_0x3e2d4f,METADATA_FILE));if(_0x1f7e4f[_0x6b115(0x15c)]===_0x6b115(0x165)&&(_0x1cfe5c?.['appCode']!==_0x1f7e4f[_0x6b115(0x15d)]||_0x1cfe5c['skillCode']!==_0x19236b))return{'path':_0x1861cc,'action':_0x6b115(0x174),'reason':_0x6b115(0x15a)};return unlinkSync(_0x1861cc),{'path':_0x1861cc,'action':_0x6b115(0x15b)};}function isLinkedFromAnyRoot(_0x5e30dd,_0x171bbc){const _0x4c7565=a165_0x372c48,_0x20996c=realOrResolved(_0x5e30dd);for(const _0x3d2a7b of _0x171bbc){if(!existsSync(_0x3d2a7b))continue;for(const _0x19838e of readdirSync(_0x3d2a7b,{'withFileTypes':!![]})){if(!_0x19838e[_0x4c7565(0x151)]())continue;const _0x36bebf=resolve(_0x3d2a7b,_0x19838e[_0x4c7565(0x17b)]);if(realOrResolved(resolveSymlinkTarget(_0x36bebf))===_0x20996c)return!![];}}return![];}function runtimeSkillLinkName(_0x12f493,_0x43a239){const _0x2c6b5b=a165_0x372c48,_0x201355=safePathSegment(_0x43a239,_0x2c6b5b(0x183));if(_0x12f493[_0x2c6b5b(0x15c)]==='project'&&RESERVED_PROJECT_SKILL_CODES[_0x2c6b5b(0x157)](_0x201355))throw CliErrors[_0x2c6b5b(0x15e)](_0x2c6b5b(0x16a)+_0x201355);return _0x12f493[_0x2c6b5b(0x15c)]===_0x2c6b5b(0x165)?_0x201355:_0x12f493[_0x2c6b5b(0x15d)]+'--'+_0x201355;}function runtimeSkillCodeFromLink(_0x35f03b,_0x496f36){const _0xf17b82=a165_0x372c48,_0x4a76bf=basename(_0x496f36);return _0x35f03b['scope']===_0xf17b82(0x165)?_0x4a76bf:_0x4a76bf[_0xf17b82(0x15f)]((_0x35f03b[_0xf17b82(0x15d)]+'--')[_0xf17b82(0x163)]);}export function copyManagedSkillDirectory(_0x1b0eea,_0x359386){const _0x274b4d=a165_0x372c48,_0x5ca6ca=resolve(_0x359386,METADATA_FILE),_0x5dd7da=existsSync(_0x359386);if(_0x5dd7da){const _0x426fac=lstatSync(_0x359386);if(_0x426fac[_0x274b4d(0x151)]())throw CliErrors[_0x274b4d(0x15e)](_0x274b4d(0x14f)+_0x359386);if(!_0x426fac[_0x274b4d(0x177)]())throw CliErrors[_0x274b4d(0x15e)](_0x274b4d(0x159)+_0x359386);const _0x506350=readMetadataIfPresent(_0x5ca6ca);if(_0x506350?.['scope']!==_0x274b4d(0x16c))throw CliErrors['validation'](_0x274b4d(0x158)+_0x359386);}ensureDirSync(dirname(_0x359386));const _0x37715a=_0x5dd7da?readMetadataIfPresent(_0x5ca6ca)?.['contentHash']:undefined,_0x44fe09=readMetadataIfPresent(resolve(_0x1b0eea,METADATA_FILE))?.['contentHash'];return _0x5dd7da&&removeSync(_0x359386),copySkillDirectory(_0x1b0eea,_0x359386),{'path':_0x359386,'target':_0x1b0eea,'action':!_0x5dd7da?'created':_0x37715a===_0x44fe09?'unchanged':_0x274b4d(0x14d)};}function copySkillDirectory(_0x4b59c1,_0x51fb17){copySync(_0x4b59c1,_0x51fb17,{'dereference':![],'overwrite':!![],'filter'(_0x4a6ab8){const _0x2bac3d=a165_0x3279;if(lstatSync(_0x4a6ab8)[_0x2bac3d(0x151)]())throw CliErrors[_0x2bac3d(0x15e)](_0x2bac3d(0x168)+_0x4a6ab8);return!![];}});}
|
|
1
|
+
import{existsSync,lstatSync,mkdirSync,readdirSync,symlinkSync,unlinkSync}from"node:fs";import{basename,dirname,resolve}from"node:path";import fsExtra from"fs-extra";import{CliErrors}from"../../errors.js";import{METADATA_FILE}from"./constants.js";import{isDanglingSymlink,isPathInside,lstatIfPresent,realOrResolved,resolveSymlinkTarget}from"./fs-utils.js";import{readMetadataIfPresent,requireSkillCode}from"./metadata.js";import{getRuntimeSkillCacheRoot,resolveSkillSyncPaths,safePathSegment}from"./paths.js";const{copySync:copySync,ensureDirSync:ensureDirSync,removeSync:removeSync}=fsExtra;const RESERVED_PROJECT_SKILL_CODES=new Set(["lovrabet","runtime-observe","secret-retriever"]);export function linkEffectiveRuntimeSkills(materialized,target){const effective=new Map;for(const item of materialized){const key=item.skill.skillCode;if(!key)continue;const current=effective.get(key);if(!current||item.scope==="personal"){effective.set(key,item)}}const results=[]
|
|
2
|
+
;for(const item of effective.values()){const skillCode=requireSkillCode(item.skill);const metadata=readMetadataIfPresent(item.metadataPath);if(metadata?.appCode!==target.appCode||metadata.skillCode!==skillCode){throw CliErrors.validation(`Refusing to link Skill metadata outside target ${target.appCode}: ${item.metadataPath}`)}const linkName=runtimeSkillLinkName(target,skillCode);for(const parent of target.skillRoots){results.push(ensureManagedSymlink(resolve(parent,linkName),item.dir,target,skillCode))}}return results}export function pruneStaleRuntimeSkillLinks(target,activeSkillCodes,pruneSkillCodes){const active=new Set([...activeSkillCodes].map(item=>item.trim()).filter(Boolean));const candidates=pruneSkillCodes?new Set([...pruneSkillCodes].map(item=>item.trim()).filter(Boolean)):undefined;const results=[];for(const parent of target.skillRoots){for(const linkPath of managedTargetSkillLinkPaths(parent,target)){const skillCode=runtimeSkillCodeFromLink(target,linkPath)
|
|
3
|
+
;if(candidates&&!candidates.has(skillCode))continue;if(active.has(skillCode))continue;results.push(removeManagedSkillLink(linkPath,target,skillCode))}}return results}export function pruneStaleRuntimeSkillCache(input,options={}){const active=new Set([...input.activeSkillCodes].map(item=>item.trim()).filter(Boolean));const candidates=input.pruneSkillCodes?new Set([...input.pruneSkillCodes].map(item=>item.trim()).filter(Boolean)):undefined;const scopes=input.scopes??["personal","company"];const root=resolve(getRuntimeSkillCacheRoot(input.env,input.accessKey,options),safePathSegment(input.appCode,"appCode"));const results=[];for(const scope of scopes){const scopeDir=resolve(root,scope);if(!existsSync(scopeDir))continue;for(const entry of readdirSync(scopeDir,{withFileTypes:true})){if(!entry.isDirectory())continue;const skillCode=entry.name;if(candidates&&!candidates.has(skillCode))continue;if(active.has(skillCode))continue;const dir=resolve(scopeDir,skillCode)
|
|
4
|
+
;const metadata=readMetadataIfPresent(resolve(dir,METADATA_FILE));if(metadata?.appCode!==input.appCode||metadata.scope!==scope||metadata.skillCode!==skillCode){results.push({path:dir,action:"skipped",reason:"metadata-mismatch"});continue}if(isLinkedFromAnyRoot(dir,input.protectedLinkRoots??[])){results.push({path:dir,action:"skipped",reason:"linked-from-protected-root"});continue}removeSync(dir);results.push({path:dir,action:"removed"})}}return results}export function linkGlobalRuntimeSkills(materialized,options={}){const paths=resolveSkillSyncPaths(options);const results=[];for(const item of materialized){if(item.scope!=="builtin"){throw CliErrors.validation(`Only builtin Skills can be linked into the global Skill root: ${item.scope}`)}const skillCode=requireSkillCode(item.skill);const result=copyManagedSkillDirectory(item.dir,resolve(paths.agentsSkillsDir,skillCode));results.push({...result,contentHash:item.contentHash})}return results}
|
|
5
|
+
function ensureManagedSymlink(linkPath,targetPath,target,skillCode){mkdirSync(dirname(linkPath),{recursive:true,mode:448});if(existsSync(linkPath)||isDanglingSymlink(linkPath)){const stat=lstatSync(linkPath);if(!stat.isSymbolicLink()){throw CliErrors.validation(`Refusing to overwrite unmanaged path: ${linkPath}`)}const currentTarget=resolveSymlinkTarget(linkPath);if(!isPathInside(realOrResolved(currentTarget),realOrResolved(target.managedRoot))){throw CliErrors.validation(`Refusing to overwrite unmanaged symlink: ${linkPath}`)}if(realOrResolved(currentTarget)===realOrResolved(targetPath)){return{path:linkPath,target:targetPath,action:"unchanged"}}const metadata=readMetadataIfPresent(resolve(currentTarget,METADATA_FILE));if(target.scope==="project"&&(metadata?.appCode!==target.appCode||metadata.skillCode!==skillCode)){throw CliErrors.validation(`Refusing to overwrite managed Skill link owned by another app or code: ${linkPath}`)}unlinkSync(linkPath)
|
|
6
|
+
;symlinkSync(targetPath,linkPath,"dir");return{path:linkPath,target:targetPath,action:"updated"}}symlinkSync(targetPath,linkPath,"dir");return{path:linkPath,target:targetPath,action:"created"}}function managedTargetSkillLinkPaths(parent,target){if(!existsSync(parent))return[];const prefix=`${target.appCode}--`;return readdirSync(parent,{withFileTypes:true}).filter(entry=>target.scope==="project"||entry.name.startsWith(prefix)).map(entry=>resolve(parent,entry.name))}function removeManagedSkillLink(linkPath,target,skillCode){const stat=lstatIfPresent(linkPath);if(!stat?.isSymbolicLink()){return{path:linkPath,action:"skipped",reason:"not-managed-symlink"}}const currentTarget=resolveSymlinkTarget(linkPath);if(!isPathInside(realOrResolved(currentTarget),realOrResolved(target.managedRoot))){return{path:linkPath,action:"skipped",reason:"external-symlink"}}const metadata=readMetadataIfPresent(resolve(currentTarget,METADATA_FILE))
|
|
7
|
+
;if(target.scope==="project"&&(metadata?.appCode!==target.appCode||metadata.skillCode!==skillCode)){return{path:linkPath,action:"skipped",reason:"metadata-mismatch"}}unlinkSync(linkPath);return{path:linkPath,action:"removed"}}function isLinkedFromAnyRoot(cacheDir,protectedLinkRoots){const expectedTarget=realOrResolved(cacheDir);for(const root of protectedLinkRoots){if(!existsSync(root))continue;for(const entry of readdirSync(root,{withFileTypes:true})){if(!entry.isSymbolicLink())continue;const linkPath=resolve(root,entry.name);if(realOrResolved(resolveSymlinkTarget(linkPath))===expectedTarget){return true}}}return false}function runtimeSkillLinkName(target,skillCode){const safeSkillCode=safePathSegment(skillCode,"skillCode");if(target.scope==="project"&&RESERVED_PROJECT_SKILL_CODES.has(safeSkillCode)){throw CliErrors.validation(`Refusing to shadow reserved Agent Skill in project scope: ${safeSkillCode}`)}
|
|
8
|
+
return target.scope==="project"?safeSkillCode:`${target.appCode}--${safeSkillCode}`}function runtimeSkillCodeFromLink(target,linkPath){const name=basename(linkPath);return target.scope==="project"?name:name.slice(`${target.appCode}--`.length)}export function copyManagedSkillDirectory(sourceDir,targetDir){const targetMetadata=resolve(targetDir,METADATA_FILE);const existing=existsSync(targetDir);if(existing){const stat=lstatSync(targetDir);if(stat.isSymbolicLink()){throw CliErrors.validation(`Refusing to overwrite global Skill symlink: ${targetDir}`)}if(!stat.isDirectory()){throw CliErrors.validation(`Refusing to overwrite global Skill path: ${targetDir}`)}const metadata=readMetadataIfPresent(targetMetadata);if(metadata?.scope!=="builtin"){throw CliErrors.validation(`Refusing to overwrite unmanaged global Skill directory: ${targetDir}`)}}ensureDirSync(dirname(targetDir));const previousHash=existing?readMetadataIfPresent(targetMetadata)?.contentHash:undefined
|
|
9
|
+
;const sourceHash=readMetadataIfPresent(resolve(sourceDir,METADATA_FILE))?.contentHash;if(existing){removeSync(targetDir)}copySkillDirectory(sourceDir,targetDir);return{path:targetDir,target:sourceDir,action:!existing?"created":previousHash===sourceHash?"unchanged":"updated"}}function copySkillDirectory(sourceDir,targetDir){copySync(sourceDir,targetDir,{dereference:false,overwrite:true,filter(sourcePath){if(lstatSync(sourcePath).isSymbolicLink()){throw CliErrors.validation(`Refusing to copy Skill symlink: ${sourcePath}`)}return true}})}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
import{readFileSync,readdirSync,realpathSync}from"node:fs";import{relative,resolve}from"node:path";import{CliErrors}from"../../errors.js";import{IGNORED_DIR_NAMES,IGNORED_FILE_NAMES,SKILL_FILE}from"./constants.js";export function fileContent(file){return file.bytes??Buffer.from(file.content??"","utf8")}export function fileText(file){return fileContent(file).toString("utf8")}export function normalizeLocalFiles(files){if(!Array.isArray(files)||files.length===0){return[]}const normalized=new Map;for(const file of files){if(!file||typeof file!=="object"||typeof file.path!=="string"){throw CliErrors.validation("Skill file path must be text.")}const path=normalizeSkillRelativePath(file.path);if(normalized.has(path)){throw CliErrors.validation(`Duplicate Skill file path: ${path}`)}if(file.bytes!==undefined&&!Buffer.isBuffer(file.bytes)){throw CliErrors.validation(`Skill file bytes must be a Buffer: ${path}`)}if(file.bytes===undefined&&typeof file.content!=="string"){
|
|
2
|
+
throw CliErrors.validation(`Skill file content must be text or bytes: ${path}`)}const bytes=fileContent(file);normalized.set(path,{path:path,bytes:bytes})}return Array.from(normalized.values()).sort(compareSkillFiles)}export function normalizeManifestFiles(files){if(!Array.isArray(files)||files.length===0){return[]}const normalized=new Map;for(const file of files){if(!file||typeof file!=="object"||typeof file.path!=="string"){throw CliErrors.validation("Skill file path must be text.")}const path=normalizeSkillRelativePath(file.path);if(normalized.has(path)){throw CliErrors.validation(`Duplicate Skill file path: ${path}`)}if(!isSha256Hex(file.sha256)){throw CliErrors.validation(`Skill file sha256 is invalid: ${path}`)}if(!Number.isSafeInteger(file.size)||file.size<0){throw CliErrors.validation(`Skill file size is invalid: ${path}`)}normalized.set(path,{path:path,sha256:file.sha256.toLowerCase(),size:file.size})}return Array.from(normalized.values()).sort(compareSkillFiles)}
|
|
3
|
+
export function scanSkillDirectory(dir,options={}){const root=realpathSync(dir);const excludedFilePaths=canonicalExcludedFilePaths(options.excludedFilePaths);const files=[];function visit(current){const entries=readdirSync(current,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name));for(const entry of entries){if(entry.isDirectory()&&IGNORED_DIR_NAMES.has(entry.name)){continue}if(IGNORED_FILE_NAMES.has(entry.name)){continue}const absolutePath=resolve(current,entry.name);if(isExcludedFilePath(absolutePath,excludedFilePaths)){continue}if(entry.isSymbolicLink()){throw CliErrors.validation(`Skill directory contains unsupported symlink: ${absolutePath}`)}const relativePath=toPosixPath(relative(root,absolutePath));if(entry.isDirectory()){visit(absolutePath);continue}if(!entry.isFile()){continue}validateSkillRelativePath(relativePath);const buffer=readFileSync(absolutePath);files.push({path:relativePath,bytes:buffer})}}visit(root);return normalizeLocalFiles(files)}
|
|
4
|
+
function canonicalExcludedFilePaths(paths){const excluded=new Set;for(const path of paths??[]){const absolutePath=resolve(path);excluded.add(absolutePath);try{excluded.add(realpathSync(absolutePath))}catch{}}return excluded}function isExcludedFilePath(absolutePath,excluded){if(excluded.has(absolutePath))return true;if(excluded.size===0)return false;try{return excluded.has(realpathSync(absolutePath))}catch{return false}}export function compareSkillFiles(a,b){if(a.path===SKILL_FILE)return b.path===SKILL_FILE?0:-1;if(b.path===SKILL_FILE)return 1;return Buffer.compare(Buffer.from(a.path,"utf8"),Buffer.from(b.path,"utf8"))}export function normalizeSkillRelativePath(path){const normalized=toPosixPath(path.trim());validateSkillRelativePath(normalized);return normalized}export function validateSkillRelativePath(path){if(!path||path.startsWith("/")||path.includes("//")){throw CliErrors.validation(`Unsafe Skill file path: ${path}`)}for(const segment of path.split("/")){
|
|
5
|
+
if(!segment||segment==="."||segment===".."){throw CliErrors.validation(`Unsafe Skill file path: ${path}`)}}}export function toPosixPath(path){return path.replace(/\\/g,"/")}export function isSha256Hex(value){return typeof value==="string"&&/^[a-fA-F0-9]{64}$/.test(value)}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
function a168_0x54c2(_0x277423,_0xc95375){_0x277423=_0x277423-0x152;const _0x5c2431=a168_0x5c24();let _0x54c24e=_0x5c2431[_0x277423];return _0x54c24e;}(function(_0x5d8288,_0x48be12){const _0x97792e=a168_0x54c2,_0x143466=_0x5d8288();while(!![]){try{const _0x430ab8=parseInt(_0x97792e(0x172))/0x1*(parseInt(_0x97792e(0x183))/0x2)+parseInt(_0x97792e(0x162))/0x3+-parseInt(_0x97792e(0x18c))/0x4*(parseInt(_0x97792e(0x163))/0x5)+parseInt(_0x97792e(0x153))/0x6*(parseInt(_0x97792e(0x186))/0x7)+parseInt(_0x97792e(0x161))/0x8*(-parseInt(_0x97792e(0x190))/0x9)+-parseInt(_0x97792e(0x191))/0xa+-parseInt(_0x97792e(0x16e))/0xb*(parseInt(_0x97792e(0x18d))/0xc);if(_0x430ab8===_0x48be12)break;else _0x143466['push'](_0x143466['shift']());}catch(_0x2f5271){_0x143466['push'](_0x143466['shift']());}}}(a168_0x5c24,0x96be5));import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from'node:fs';import{dirname,resolve}from'node:path';import{isCollection,isMap,isNode,parseDocument,visit}from'yaml';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{resolveManagedFilePath,writeBytesAtomic,writeJsonAtomic}from'./fs-utils.js';import{bufferSha256,contentHash,fileHash}from'./hashing.js';import{fileContent,fileText,normalizeLocalFiles}from'./local-files.js';import{buildMetadata,readMetadataIfPresent,requireSkillCode}from'./metadata.js';import{getRuntimeSkillDir}from'./paths.js';import{extractDownloadedPackage,requirePackageBytes}from'./zip-package.js';export function materializeRuntimeSkill(_0x208596,_0x286599,_0x5ed435){const _0x29a489=a168_0x54c2,_0x45e19e=requireSkillCode(_0x208596),_0x5cb1c4=requirePackageBytes(_0x45e19e,_0x5ed435[_0x29a489(0x17a)]),_0x17834e=extractDownloadedPackage(_0x5cb1c4),_0x422cb5=_0x17834e[_0x29a489(0x16c)](_0x371863=>_0x371863[_0x29a489(0x155)]===SKILL_FILE);if(!_0x422cb5)throw CliErrors[_0x29a489(0x169)](_0x29a489(0x189)+SKILL_FILE+':\x20'+_0x45e19e);const _0x336742=withMaterializedSkillFrontmatter(_0x17834e,_0x208596,_0x45e19e),_0x3b1cd6=_0x336742[_0x29a489(0x16c)](_0x12cf52=>_0x12cf52['path']===SKILL_FILE),_0x2e944e=fileText(_0x3b1cd6),_0x39917e=getRuntimeSkillDir(_0x5ed435[_0x29a489(0x15f)],_0x5ed435[_0x29a489(0x179)],_0x5ed435[_0x29a489(0x174)],_0x286599,_0x45e19e,_0x5ed435['paths']),_0x568c74=resolve(_0x39917e,SKILL_FILE),_0x21c1f4=resolve(_0x39917e,METADATA_FILE),_0x44813d=contentHash(_0x2e944e),_0x3259d8=readMetadataIfPresent(_0x21c1f4)?.['fileHashes'];ensurePulledFilesCanBeOverwritten(_0x39917e,_0x21c1f4,_0x336742,_0x5ed435['force']===!![]),mkdirSync(_0x39917e,{'recursive':!![],'mode':0x1c0});const _0xcb959=existsSync(_0x568c74)?readFileSync(_0x568c74,_0x29a489(0x192)):undefined;return materializeFiles(_0x39917e,_0x336742),removeStaleManagedFiles(_0x39917e,_0x3259d8,_0x336742),writeJsonAtomic(_0x21c1f4,buildMetadata(_0x208596,_0x286599,_0x5ed435[_0x29a489(0x174)],_0x44813d,_0x5ed435[_0x29a489(0x175)],_0x336742,_0x5cb1c4)),{'skill':_0x208596,'scope':_0x286599,'dir':_0x39917e,'skillMdPath':_0x568c74,'metadataPath':_0x21c1f4,'contentHash':_0x44813d,'changed':_0xcb959!==_0x2e944e};}function a168_0x5c24(){const _0x529f9f=['.\x20Changed\x20file:\x20','827lugwTm','version','appCode','pulledAt','keys','join','filter','accessKey','packageBytes','displayName','stringify','example','status','Managed\x20file\x20was\x20removed\x20locally:\x20','hasOwn','name:\x20','skillName','2586TTVQeF','Remote\x20Skill\x20would\x20overwrite\x20an\x20unmanaged\x20local\x20file:\x20','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.\x20Changed\x20file:\x20','11123HRZTul','schemaVersion','---\x0a','Runtime\x20Skill\x20package\x20is\x20missing\x20','replace','entries','136144ZkRMJF','912HFVrXD','contentHash','scope','945vtBNAs','2951560gcWYjK','utf8','length','toString','Push\x20the\x20directory\x20first,\x20then\x20rerun\x20skill\x20install.','2058HWbOFQ','description','path','Local\x20SKILL.md\x20has\x20unpushed\x20edits:\x20','contents','---','match','trim','map','Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20','isFile','test','env','Remote\x20Skill\x20would\x20overwrite\x20a\x20local\x20non-file\x20path:\x20','39016AqqWrV','1909068xkDVAp','110QVLFEA','description:\x20','fileHashes','name','slice','skillCode','validation','trimEnd','errors','find','has','11176oaQqoV','displayName:\x20','flow'];a168_0x5c24=function(){return _0x529f9f;};return a168_0x5c24();}export function reuseMaterializedRuntimeSkill(_0x1b7d99,_0xa58299,_0x566962){const _0x4ebb08=a168_0x54c2,_0x3c64fc=_0x1b7d99[_0x4ebb08(0x173)]?.[_0x4ebb08(0x15a)]();if(!_0x3c64fc)return undefined;const _0x2dbc6b=requireSkillCode(_0x1b7d99),_0x31678d=getRuntimeSkillDir(_0x566962[_0x4ebb08(0x15f)],_0x566962[_0x4ebb08(0x179)],_0x566962['appCode'],_0xa58299,_0x2dbc6b,_0x566962['paths']),_0x543fce=resolve(_0x31678d,SKILL_FILE),_0x969cc3=resolve(_0x31678d,METADATA_FILE),_0x1c28e9=readMetadataIfPresent(_0x969cc3);if(!_0x1c28e9||_0x1c28e9[_0x4ebb08(0x187)]!==0x2||_0x1c28e9[_0x4ebb08(0x174)]!==_0x566962['appCode']||_0x1c28e9[_0x4ebb08(0x18f)]!==_0xa58299||_0x1c28e9[_0x4ebb08(0x168)]!==_0x2dbc6b||_0x1c28e9['version']!==_0x3c64fc||_0x1c28e9['id']!==_0x1b7d99['id']||_0x1c28e9[_0x4ebb08(0x182)]!==_0x1b7d99['skillName']||_0x1c28e9[_0x4ebb08(0x154)]!==_0x1b7d99[_0x4ebb08(0x154)]||_0x1c28e9[_0x4ebb08(0x17d)]!==_0x1b7d99['example']||_0x1c28e9[_0x4ebb08(0x17e)]!==_0x1b7d99['status']||!_0x1c28e9[_0x4ebb08(0x18e)]||!_0x1c28e9[_0x4ebb08(0x165)]||!Object[_0x4ebb08(0x180)](_0x1c28e9[_0x4ebb08(0x165)],SKILL_FILE))return undefined;for(const [_0x3e53f2,_0x5009f1]of Object[_0x4ebb08(0x18b)](_0x1c28e9[_0x4ebb08(0x165)])){if(!/^[a-f0-9]{64}$/[_0x4ebb08(0x15e)](_0x5009f1))return undefined;const _0x11b036=resolveManagedFilePath(_0x31678d,_0x3e53f2);if(!existsSync(_0x11b036)||!lstatSync(_0x11b036)[_0x4ebb08(0x15d)]())return undefined;if(bufferSha256(readFileSync(_0x11b036))!==_0x5009f1)return undefined;}return{'skill':_0x1b7d99,'scope':_0xa58299,'dir':_0x31678d,'skillMdPath':_0x543fce,'metadataPath':_0x969cc3,'contentHash':_0x1c28e9[_0x4ebb08(0x18e)],'changed':![]};}function withMaterializedSkillFrontmatter(_0x574a2a,_0x64b3f5,_0x2f97a7){const _0x472a4b=a168_0x54c2,_0x4cfe29=skillDisplayName(_0x64b3f5,_0x2f97a7),_0x22ff35=_0x64b3f5[_0x472a4b(0x154)]?.[_0x472a4b(0x15a)]()||_0x4cfe29||_0x2f97a7;return normalizeLocalFiles(_0x574a2a)[_0x472a4b(0x15b)](_0x3565cc=>{const _0x20e759=_0x472a4b,_0x31fbf8=fileText(_0x3565cc);if(_0x3565cc['path']!==SKILL_FILE)return _0x3565cc;if(hasYamlFrontmatter(_0x31fbf8))return{'path':_0x3565cc[_0x20e759(0x155)],'content':withSyncedDisplayName(_0x31fbf8,_0x4cfe29)};return{'path':_0x3565cc[_0x20e759(0x155)],'content':prependSkillFrontmatter(_0x31fbf8,{'name':_0x2f97a7,'displayName':_0x4cfe29,'description':_0x22ff35})};});}function hasYamlFrontmatter(_0x67c02b){return/^\uFEFF?---\s*\r?\n/['test'](_0x67c02b);}function prependSkillFrontmatter(_0x4b5de6,_0x2dd018){const _0x5cbf12=a168_0x54c2,_0xc55e8b=_0x4b5de6['replace'](/^\uFEFF/,'');return[_0x5cbf12(0x158),_0x5cbf12(0x181)+yamlString(_0x2dd018[_0x5cbf12(0x166)]),_0x2dd018[_0x5cbf12(0x17b)]?_0x5cbf12(0x16f)+yamlString(_0x2dd018['displayName']):undefined,_0x5cbf12(0x164)+yamlString(_0x2dd018[_0x5cbf12(0x154)]),_0x5cbf12(0x158),'',_0xc55e8b][_0x5cbf12(0x178)](_0x44cc58=>_0x44cc58!==undefined)[_0x5cbf12(0x177)]('\x0a');}function yamlString(_0x74addb){const _0x5b8523=a168_0x54c2;return JSON[_0x5b8523(0x17c)](_0x74addb[_0x5b8523(0x18a)](/\r/g,'')[_0x5b8523(0x15a)]());}function skillDisplayName(_0x109126,_0x2ed62b){const _0x9f6ca6=a168_0x54c2,_0x2557fe=_0x109126['skillName']?.[_0x9f6ca6(0x15a)]();return _0x2557fe||_0x2ed62b;}function withSyncedDisplayName(_0x2a99d2,_0x5115ba){const _0x6d9db4=a168_0x54c2,_0x3b3896=_0x2a99d2[_0x6d9db4(0x159)](/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x3b3896)return _0x2a99d2;const _0x9ee41d=_0x3b3896[0x1]??'',_0x16f6c4=_0x3b3896[0x2]??'',_0xea90ea=parseDocument(_0x16f6c4);if(_0xea90ea[_0x6d9db4(0x16b)][_0x6d9db4(0x193)]>0x0||!isMap(_0xea90ea[_0x6d9db4(0x157)]))return _0x2a99d2;if(_0x5115ba)_0xea90ea['set'](_0x6d9db4(0x17b),_0x5115ba);else{if(_0xea90ea[_0x6d9db4(0x16d)](_0x6d9db4(0x17b)))_0xea90ea['delete'](_0x6d9db4(0x17b));else return _0x2a99d2;}forceBlockCollections(_0xea90ea['contents']);const _0xbeca9d=_0xea90ea[_0x6d9db4(0x194)]({'lineWidth':0x0})[_0x6d9db4(0x16a)](),_0x450abb=_0x2a99d2[_0x6d9db4(0x167)](_0x3b3896[0x0]['length'])['replace'](/^\r?\n/,'');return _0x9ee41d+_0x6d9db4(0x188)+_0xbeca9d+'\x0a---\x0a\x0a'+_0x450abb;}function forceBlockCollections(_0x26daa2){if(!isNode(_0x26daa2))return;visit(_0x26daa2,(_0x5617d4,_0x5d4152)=>{const _0x34ebe2=a168_0x54c2;isCollection(_0x5d4152)&&(_0x5d4152[_0x34ebe2(0x170)]=![]);});}function ensurePulledFilesCanBeOverwritten(_0x14fe2e,_0x5c6cfb,_0x5afabf,_0x51fd8b){const _0x167714=a168_0x54c2;if(_0x51fd8b||!existsSync(_0x5c6cfb))return;const _0x380bb7=readMetadataIfPresent(_0x5c6cfb);if(!_0x380bb7)return;const _0x54acdb=_0x380bb7['fileHashes']&&Object[_0x167714(0x176)](_0x380bb7[_0x167714(0x165)])[_0x167714(0x193)]>0x0?_0x380bb7[_0x167714(0x165)]:undefined;if(_0x54acdb)for(const [_0x5f2242,_0x2fb184]of Object[_0x167714(0x18b)](_0x54acdb)){const _0x278b2e=resolveManagedFilePath(_0x14fe2e,_0x5f2242);if(!existsSync(_0x278b2e))throw CliErrors[_0x167714(0x169)](_0x167714(0x15c)+_0x14fe2e,_0x167714(0x17f)+_0x5f2242);const _0x382c07=lstatSync(_0x278b2e);if(!_0x382c07[_0x167714(0x15d)]())throw CliErrors[_0x167714(0x169)](_0x167714(0x15c)+_0x14fe2e,'Managed\x20file\x20is\x20no\x20longer\x20a\x20regular\x20file:\x20'+_0x5f2242);const _0x3b458b=bufferSha256(readFileSync(_0x278b2e));if(_0x3b458b!==_0x2fb184)throw CliErrors[_0x167714(0x169)]('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x14fe2e+_0x167714(0x171)+_0x5f2242,_0x167714(0x185)+_0x5f2242);}else{const _0x2d8470=resolve(_0x14fe2e,SKILL_FILE);if(existsSync(_0x2d8470)&&_0x380bb7['contentHash']){const _0x256896=contentHash(readFileSync(_0x2d8470,_0x167714(0x192)));if(_0x256896!==_0x380bb7['contentHash'])throw CliErrors[_0x167714(0x169)](_0x167714(0x156)+_0x2d8470,_0x167714(0x152));}}for(const _0x3bcdbf of normalizeLocalFiles(_0x5afabf)){if(_0x54acdb?.[_0x3bcdbf[_0x167714(0x155)]])continue;if(!_0x54acdb&&_0x3bcdbf[_0x167714(0x155)]===SKILL_FILE)continue;const _0xd093b0=resolveManagedFilePath(_0x14fe2e,_0x3bcdbf[_0x167714(0x155)]);if(!existsSync(_0xd093b0))continue;const _0x535885=lstatSync(_0xd093b0);if(!_0x535885[_0x167714(0x15d)]())throw CliErrors['validation'](_0x167714(0x15c)+_0x14fe2e,_0x167714(0x160)+_0x3bcdbf[_0x167714(0x155)]);const _0x5480fe=bufferSha256(readFileSync(_0xd093b0));if(_0x5480fe!==fileHash(_0x3bcdbf))throw CliErrors[_0x167714(0x169)]('Local\x20Skill\x20files\x20have\x20unpushed\x20edits:\x20'+_0x14fe2e,_0x167714(0x184)+_0x3bcdbf['path']);}}function materializeFiles(_0x1651ab,_0x3f99be){for(const _0x1b08db of normalizeLocalFiles(_0x3f99be)){const _0x19a9c2=resolveManagedFilePath(_0x1651ab,_0x1b08db['path']);mkdirSync(dirname(_0x19a9c2),{'recursive':!![],'mode':0x1c0}),writeBytesAtomic(_0x19a9c2,fileContent(_0x1b08db),0x180);}}function removeStaleManagedFiles(_0x46c99b,_0x3839dd,_0x51a58b){const _0x145725=a168_0x54c2;if(!_0x3839dd)return;const _0x2e8571=new Set(normalizeLocalFiles(_0x51a58b)['map'](_0x1de735=>_0x1de735[_0x145725(0x155)]));for(const _0x7b2276 of Object[_0x145725(0x176)](_0x3839dd)){if(_0x2e8571[_0x145725(0x16d)](_0x7b2276))continue;const _0x37cd45=resolveManagedFilePath(_0x46c99b,_0x7b2276);existsSync(_0x37cd45)&&lstatSync(_0x37cd45)[_0x145725(0x15d)]()&&rmSync(_0x37cd45,{'force':!![]});}}
|
|
1
|
+
import{existsSync,lstatSync,mkdirSync,readFileSync,rmSync}from"node:fs";import{dirname,resolve}from"node:path";import{isCollection,isMap,isNode,parseDocument,visit}from"yaml";import{CliErrors}from"../../errors.js";import{METADATA_FILE,SKILL_FILE}from"./constants.js";import{resolveManagedFilePath,writeBytesAtomic,writeJsonAtomic}from"./fs-utils.js";import{bufferSha256,contentHash,fileHash}from"./hashing.js";import{fileContent,fileText,normalizeLocalFiles}from"./local-files.js";import{buildMetadata,readMetadataIfPresent,requireSkillCode}from"./metadata.js";import{getRuntimeSkillDir}from"./paths.js";import{extractDownloadedPackage,requirePackageBytes}from"./zip-package.js";export function materializeRuntimeSkill(skill,scope,options){const skillCode=requireSkillCode(skill);const packageBytes=requirePackageBytes(skillCode,options.packageBytes);const effectiveFiles=extractDownloadedPackage(packageBytes);const mainFile=effectiveFiles.find(file=>file.path===SKILL_FILE);if(!mainFile){
|
|
2
|
+
throw CliErrors.validation(`Runtime Skill package is missing ${SKILL_FILE}: ${skillCode}`)}const materializedFiles=withMaterializedSkillFrontmatter(effectiveFiles,skill,skillCode);const materializedMainFile=materializedFiles.find(file=>file.path===SKILL_FILE);const content=fileText(materializedMainFile);const dir=getRuntimeSkillDir(options.env,options.accessKey,options.appCode,scope,skillCode,options.paths);const skillMdPath=resolve(dir,SKILL_FILE);const metadataPath=resolve(dir,METADATA_FILE);const hash=contentHash(content);const previousFiles=readMetadataIfPresent(metadataPath)?.fileHashes;ensurePulledFilesCanBeOverwritten(dir,metadataPath,materializedFiles,options.force===true);mkdirSync(dir,{recursive:true,mode:448});const previous=existsSync(skillMdPath)?readFileSync(skillMdPath,"utf8"):undefined;materializeFiles(dir,materializedFiles);removeStaleManagedFiles(dir,previousFiles,materializedFiles)
|
|
3
|
+
;writeJsonAtomic(metadataPath,buildMetadata(skill,scope,options.appCode,hash,options.pulledAt,materializedFiles,packageBytes));return{skill:skill,scope:scope,dir:dir,skillMdPath:skillMdPath,metadataPath:metadataPath,contentHash:hash,changed:previous!==content}}export function reuseMaterializedRuntimeSkill(skill,scope,options){const version=skill.version?.trim();if(!version)return undefined;const skillCode=requireSkillCode(skill);const dir=getRuntimeSkillDir(options.env,options.accessKey,options.appCode,scope,skillCode,options.paths);const skillMdPath=resolve(dir,SKILL_FILE);const metadataPath=resolve(dir,METADATA_FILE);const metadata=readMetadataIfPresent(metadataPath)
|
|
4
|
+
;if(!metadata||metadata.schemaVersion!==2||metadata.appCode!==options.appCode||metadata.scope!==scope||metadata.skillCode!==skillCode||metadata.version!==version||metadata.id!==skill.id||metadata.skillName!==skill.skillName||metadata.description!==skill.description||metadata.example!==skill.example||metadata.status!==skill.status||!metadata.contentHash||!metadata.fileHashes||!Object.hasOwn(metadata.fileHashes,SKILL_FILE)){return undefined}for(const[path,expectedHash]of Object.entries(metadata.fileHashes)){if(!/^[a-f0-9]{64}$/.test(expectedHash))return undefined;const filePath=resolveManagedFilePath(dir,path);if(!existsSync(filePath)||!lstatSync(filePath).isFile())return undefined;if(bufferSha256(readFileSync(filePath))!==expectedHash)return undefined}return{skill:skill,scope:scope,dir:dir,skillMdPath:skillMdPath,metadataPath:metadataPath,contentHash:metadata.contentHash,changed:false}}function withMaterializedSkillFrontmatter(files,skill,skillCode){
|
|
5
|
+
const displayName=skillDisplayName(skill,skillCode);const description=skill.description?.trim()||displayName||skillCode;return normalizeLocalFiles(files).map(file=>{const content=fileText(file);if(file.path!==SKILL_FILE)return file;if(hasYamlFrontmatter(content)){return{path:file.path,content:withSyncedDisplayName(content,displayName)}}return{path:file.path,content:prependSkillFrontmatter(content,{name:skillCode,displayName:displayName,description:description})}})}function hasYamlFrontmatter(content){return/^\uFEFF?---\s*\r?\n/.test(content)}function prependSkillFrontmatter(content,frontmatter){const body=content.replace(/^\uFEFF/,"");return["---",`name: ${yamlString(frontmatter.name)}`,frontmatter.displayName?`displayName: ${yamlString(frontmatter.displayName)}`:undefined,`description: ${yamlString(frontmatter.description)}`,"---","",body].filter(line=>line!==undefined).join("\n")}function yamlString(value){return JSON.stringify(value.replace(/\r/g,"").trim())}
|
|
6
|
+
function skillDisplayName(skill,skillCode){const skillName=skill.skillName?.trim();return skillName||skillCode}function withSyncedDisplayName(content,displayName){const match=content.match(/^(\uFEFF?)---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!match)return content;const bom=match[1]??"";const yaml=match[2]??"";const document=parseDocument(yaml);if(document.errors.length>0||!isMap(document.contents)){return content}if(displayName){document.set("displayName",displayName)}else if(document.has("displayName")){document.delete("displayName")}else{return content}forceBlockCollections(document.contents);const frontmatter=document.toString({lineWidth:0}).trimEnd();const body=content.slice(match[0].length).replace(/^\r?\n/,"");return`${bom}---\n${frontmatter}\n---\n\n${body}`}function forceBlockCollections(node){if(!isNode(node))return;visit(node,(_key,value)=>{if(isCollection(value)){value.flow=false}})}function ensurePulledFilesCanBeOverwritten(dir,metadataPath,nextFiles,force){
|
|
7
|
+
if(force||!existsSync(metadataPath)){return}const metadata=readMetadataIfPresent(metadataPath);if(!metadata)return;const previousFileHashes=metadata.fileHashes&&Object.keys(metadata.fileHashes).length>0?metadata.fileHashes:undefined;if(previousFileHashes){for(const[path,expectedHash]of Object.entries(previousFileHashes)){const filePath=resolveManagedFilePath(dir,path);if(!existsSync(filePath)){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Managed file was removed locally: ${path}`)}const stat=lstatSync(filePath);if(!stat.isFile()){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Managed file is no longer a regular file: ${path}`)}const currentHash=bufferSha256(readFileSync(filePath));if(currentHash!==expectedHash){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}. Changed file: ${path}`,`Push the directory first, then rerun skill install. Changed file: ${path}`)}}}else{
|
|
8
|
+
const skillMdPath=resolve(dir,SKILL_FILE);if(existsSync(skillMdPath)&&metadata.contentHash){const currentHash=contentHash(readFileSync(skillMdPath,"utf8"));if(currentHash!==metadata.contentHash){throw CliErrors.validation(`Local SKILL.md has unpushed edits: ${skillMdPath}`,"Push the directory first, then rerun skill install.")}}}for(const nextFile of normalizeLocalFiles(nextFiles)){if(previousFileHashes?.[nextFile.path])continue;if(!previousFileHashes&&nextFile.path===SKILL_FILE)continue;const filePath=resolveManagedFilePath(dir,nextFile.path);if(!existsSync(filePath))continue;const stat=lstatSync(filePath);if(!stat.isFile()){throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Remote Skill would overwrite a local non-file path: ${nextFile.path}`)}const currentHash=bufferSha256(readFileSync(filePath));if(currentHash!==fileHash(nextFile)){
|
|
9
|
+
throw CliErrors.validation(`Local Skill files have unpushed edits: ${dir}`,`Remote Skill would overwrite an unmanaged local file: ${nextFile.path}`)}}}function materializeFiles(dir,files){for(const file of normalizeLocalFiles(files)){const filePath=resolveManagedFilePath(dir,file.path);mkdirSync(dirname(filePath),{recursive:true,mode:448});writeBytesAtomic(filePath,fileContent(file),384)}}function removeStaleManagedFiles(dir,previousFileHashes,nextFiles){if(!previousFileHashes)return;const nextPaths=new Set(normalizeLocalFiles(nextFiles).map(file=>file.path));for(const previousPath of Object.keys(previousFileHashes)){if(nextPaths.has(previousPath))continue;const filePath=resolveManagedFilePath(dir,previousPath);if(existsSync(filePath)&&lstatSync(filePath).isFile()){rmSync(filePath,{force:true})}}}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
import{existsSync}from"node:fs";import{homedir}from"node:os";import{resolve}from"node:path";import{fingerprintAccessKey}from"../../commands/app/cache.js";import{PRODUCT_CONFIG,productEnv}from"../../constant/product.js";import{CliErrors}from"../../errors.js";export function resolveSkillSyncPaths(options={}){const home=options.homeDir??homedir();const cacheRoot=resolve(home,PRODUCT_CONFIG.homeDirName,"cache");const envAgentsSkillsDir=trimmedEnv("SKILL_ROOT");const envClaudeSkillsDir=trimmedEnv("CLAUDE_SKILL_ROOT");const workbuddyHome=resolve(home,".workbuddy");const workbuddySkillsDir=options.workbuddySkillsDir??(existsSync(workbuddyHome)?resolve(workbuddyHome,"skills"):undefined);return{homeDir:home,cacheRoot:cacheRoot,managedRoot:resolve(home,PRODUCT_CONFIG.homeDirName),agentsSkillsDir:options.agentsSkillsDir??envAgentsSkillsDir??resolve(home,".agents","skills"),claudeSkillsDir:options.claudeSkillsDir??envClaudeSkillsDir??resolve(home,".claude","skills"),
|
|
2
|
+
workbuddySkillsDir:workbuddySkillsDir}}export function runtimeAgentSkillRoots(paths){return[paths.agentsSkillsDir,paths.claudeSkillsDir,paths.workbuddySkillsDir].filter(path=>Boolean(path))}export function getRuntimeSkillCacheRoot(env,accessKey,options={}){const paths=resolveSkillSyncPaths(options);return resolve(paths.cacheRoot,env,fingerprintAccessKey(accessKey),"skills")}export function getRuntimeSkillDir(env,accessKey,appCode,scope,skillCode,options={}){return resolve(getRuntimeSkillCacheRoot(env,accessKey,options),safePathSegment(appCode,"appCode"),scope,safePathSegment(skillCode,"skillCode"))}export function safePathSegment(value,label="path segment"){if(!value||value.includes("/")||value.includes("\\")||value.includes("..")){throw CliErrors.validation(`Unsafe ${label} for local path: ${value}`)}return value}function trimmedEnv(name){const value=productEnv(name)?.trim();return value?value:undefined}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
(function(_0x591b9d,_0x14c1b2){const _0x56ddb1=a171_0x3a13,_0xea79cb=_0x591b9d();while(!![]){try{const _0x2aac47=-parseInt(_0x56ddb1(0x129))/0x1+parseInt(_0x56ddb1(0x153))/0x2+-parseInt(_0x56ddb1(0x13d))/0x3*(parseInt(_0x56ddb1(0x13f))/0x4)+parseInt(_0x56ddb1(0x15b))/0x5*(-parseInt(_0x56ddb1(0x155))/0x6)+-parseInt(_0x56ddb1(0x15e))/0x7*(-parseInt(_0x56ddb1(0x161))/0x8)+parseInt(_0x56ddb1(0x15f))/0x9*(-parseInt(_0x56ddb1(0x14a))/0xa)+parseInt(_0x56ddb1(0x14c))/0xb*(parseInt(_0x56ddb1(0x156))/0xc);if(_0x2aac47===_0x14c1b2)break;else _0xea79cb['push'](_0xea79cb['shift']());}catch(_0x1c7eca){_0xea79cb['push'](_0xea79cb['shift']());}}}(a171_0x326e,0x836c0));import{existsSync,lstatSync,readFileSync,realpathSync}from'node:fs';import{basename,resolve}from'node:path';import{parse as a171_0xec42c9}from'yaml';import{CliErrors}from'../../errors.js';import{METADATA_FILE,SKILL_FILE}from'./constants.js';import{writeJsonAtomic}from'./fs-utils.js';import{contentHash}from'./hashing.js';import{fileText,normalizeLocalFiles,scanSkillDirectory}from'./local-files.js';import{buildMetadata,readMetadataIfPresent}from'./metadata.js';import{buildSkillPackage,tryNormalizePackageManifest}from'./zip-package.js';export function resolvePushDirectoryIdentity(_0x512bc4,_0x2b45ed,_0x12bf71={}){const _0x1660d9=a171_0x3a13,_0x91689=resolvePushDirectoryRoot(_0x512bc4),_0x3086d4=readPushMetadataIfPresent(resolve(_0x91689,METADATA_FILE),{'ignoreInvalidMetadata':_0x12bf71[_0x1660d9(0x127)]});if(_0x3086d4?.['appCode']&&_0x3086d4[_0x1660d9(0x123)]!==_0x2b45ed&&!_0x12bf71[_0x1660d9(0x14d)]&&!_0x12bf71[_0x1660d9(0x139)])throw CliErrors['validation'](_0x1660d9(0x121)+_0x3086d4[_0x1660d9(0x123)]+_0x1660d9(0x158)+_0x2b45ed+'\x22.');const _0x517324=resolvePushSkillCode(_0x91689,_0x2b45ed,_0x3086d4,_0x12bf71);if(!_0x517324)throw CliErrors['validation']('Unable\x20to\x20resolve\x20skillCode\x20from\x20'+SKILL_FILE+',\x20'+METADATA_FILE+_0x1660d9(0x124));return{'dir':_0x91689,'skillCode':_0x517324,'metadata':_0x3086d4};}export function readPushDirectory(_0x3ac1f6,_0xe6569e,_0x1c35df={}){const _0x1d5dac=a171_0x3a13,_0xc0a76a=resolvePushDirectoryIdentity(_0x3ac1f6,_0xe6569e,_0x1c35df),_0x456051=_0xc0a76a[_0x1d5dac(0x128)],_0x4abb27=resolve(_0x456051,SKILL_FILE);if(!existsSync(_0x4abb27)||!lstatSync(_0x4abb27)['isFile']())throw CliErrors[_0x1d5dac(0x138)](_0x1d5dac(0x13b)+SKILL_FILE+':\x20'+_0x4abb27);const _0x480abf=_0xc0a76a[_0x1d5dac(0x133)],_0x578b62=_0x1c35df[_0x1d5dac(0x157)]??'personal';if(!_0x1c35df[_0x1d5dac(0x154)]&&_0x480abf?.[_0x1d5dac(0x151)]===_0x1d5dac(0x12d))throw CliErrors[_0x1d5dac(0x138)]('Builtin\x20Skills\x20cannot\x20be\x20pushed;\x20'+METADATA_FILE+_0x1d5dac(0x12a)+_0x480abf[_0x1d5dac(0x151)]+'\x22.');if(!_0x1c35df[_0x1d5dac(0x154)]&&_0x578b62===_0x1d5dac(0x15d)&&_0x480abf?.[_0x1d5dac(0x151)]&&_0x480abf[_0x1d5dac(0x151)]!==_0x1d5dac(0x15d))throw CliErrors[_0x1d5dac(0x138)](_0x1d5dac(0x140)+METADATA_FILE+_0x1d5dac(0x12a)+_0x480abf['scope']+'\x22.','Use\x20lovrabet\x20skill\x20push\x20--scope\x20company\x20--dir\x20'+_0x456051+'\x20to\x20submit\x20company\x20Skills\x20for\x20review.');const _0x4ca426=scanSkillDirectory(_0x456051,{'excludedFilePaths':_0x1c35df[_0x1d5dac(0x148)]}),_0x4737ff=buildSkillPackage(_0x4ca426),_0x16f40e=readFileSync(_0x4abb27,_0x1d5dac(0x164)),_0x2c8a0b=_0xc0a76a['skillCode'],_0x44bb1b=_0x1c35df[_0x1d5dac(0x15c)]?undefined:_0x480abf,_0x24f8e4=readSkillDisplayName(_0x16f40e);return{'skillCode':_0x2c8a0b,'metadata':_0x480abf,'frontmatterDisplayName':_0x24f8e4,'input':{'skillCode':_0x2c8a0b,'skillName':_0x24f8e4??_0x44bb1b?.[_0x1d5dac(0x141)],'description':_0x44bb1b?.[_0x1d5dac(0x134)],'content':_0x16f40e,'files':_0x4737ff['manifest'],'packageBase64':_0x4737ff[_0x1d5dac(0x122)],'tags':_0x44bb1b?.['tags'],'version':_0x44bb1b?.['version'],'sourceSessionId':_0x44bb1b?.[_0x1d5dac(0x137)]}};}export function refreshPushDirectoryMetadataFromRemote(_0x4a0b42,_0x3e905a,_0x35d605,_0x1d4618={}){const _0x4b94cd=a171_0x3a13,_0x2aceeb=resolvePushDirectoryRoot(_0x4a0b42),_0x5a7ac6=readPushMetadataIfPresent(resolve(_0x2aceeb,METADATA_FILE),{'ignoreInvalidMetadata':!![]}),_0x59ad77=requireRemoteScope(_0x3e905a),_0x40ffed=readLocalSkillContent(_0x2aceeb),_0x201574={..._0x3e905a,'appCode':_0x3e905a[_0x4b94cd(0x123)]??_0x35d605,'skillName':_0x3e905a[_0x4b94cd(0x141)]??_0x5a7ac6?.[_0x4b94cd(0x141)],'description':_0x3e905a['description']??_0x5a7ac6?.[_0x4b94cd(0x134)],'example':_0x3e905a['example']??_0x5a7ac6?.[_0x4b94cd(0x147)],'tags':Array['isArray'](_0x3e905a['tags'])?_0x3e905a[_0x4b94cd(0x135)]:_0x5a7ac6?.[_0x4b94cd(0x135)],'sourceSessionId':_0x3e905a['sourceSessionId']??_0x5a7ac6?.[_0x4b94cd(0x137)],'content':_0x3e905a[_0x4b94cd(0x13a)]??_0x40ffed},_0x516ebc=buildMetadata(_0x201574,_0x59ad77,_0x35d605,contentHash(_0x40ffed),_0x1d4618[_0x4b94cd(0x162)]);writeJsonAtomic(resolve(_0x2aceeb,METADATA_FILE),_0x516ebc);}export function recordPushedRuntimeSkill(_0x35e90f,_0x384e53,_0x49a82e,_0x3139af={}){const _0x2a277a=a171_0x3a13,_0x3ae310=resolvePushDirectoryRoot(_0x35e90f),_0x52d183=scanSkillDirectory(_0x3ae310),_0x2a824f=_0x52d183['find'](_0x42cc8a=>_0x42cc8a['path']===SKILL_FILE),_0x243ef4=_0x2a824f?fileText(_0x2a824f):'',_0x4a4a5e=tryNormalizePackageManifest(_0x384e53[_0x2a277a(0x131)]),_0x5b23a7={..._0x384e53,'content':_0x384e53[_0x2a277a(0x13a)]??_0x243ef4,'files':_0x4a4a5e},_0x558e1c=_0x4a4a5e?normalizeLocalFiles(_0x52d183)['filter'](_0x54f2e8=>_0x4a4a5e[_0x2a277a(0x131)]['some'](_0x3bf3cb=>_0x3bf3cb['path']===_0x54f2e8[_0x2a277a(0x163)])):undefined,_0x574216=buildMetadata(_0x5b23a7,_0x3139af['scope']??_0x2a277a(0x15d),_0x49a82e,contentHash(_0x5b23a7['content']??''),_0x3139af[_0x2a277a(0x12c)],_0x558e1c);writeJsonAtomic(resolve(_0x3ae310,METADATA_FILE),_0x574216);}export function deriveSkillCodeFromDirectory(_0xdb698f,_0x184d31){const _0x2f3d69=a171_0x3a13,_0x49bd33=basename(resolve(_0xdb698f)),_0x1bc2d7=_0x184d31+'--';return _0x49bd33['startsWith'](_0x1bc2d7)?_0x49bd33[_0x2f3d69(0x14e)](_0x1bc2d7[_0x2f3d69(0x160)]):_0x49bd33;}function resolvePushSkillCode(_0xd56943,_0x4afc5c,_0x7f7090,_0x214b96){const _0x323bff=a171_0x3a13,_0xce08be=deriveSkillCodeFromSkillFile(_0xd56943)||deriveSkillCodeFromDirectory(_0xd56943,_0x4afc5c);if(_0x214b96['ignoreMetadataSkillCode'])return _0xce08be;return _0x7f7090?.['skillCode']?.[_0x323bff(0x150)]()||_0xce08be;}function deriveSkillCodeFromSkillFile(_0x14cb3b){const _0x5ecd04=a171_0x3a13,_0x26cb50=resolve(_0x14cb3b,SKILL_FILE);if(!existsSync(_0x26cb50)||!lstatSync(_0x26cb50)[_0x5ecd04(0x14f)]())return undefined;const _0x7c9c2=readFileSync(_0x26cb50,_0x5ecd04(0x164)),_0x4fed32=_0x7c9c2[_0x5ecd04(0x13e)](/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x4fed32)return undefined;const _0x22c8fd=parseFrontmatterObject(_0x4fed32[0x1]??''),_0x3a0f1f=scalarToString(_0x22c8fd?.[_0x5ecd04(0x132)]);return _0x3a0f1f?slugifySkillName(_0x3a0f1f):undefined;}function readSkillDisplayName(_0xbdc52b){const _0xa2f30d=a171_0x3a13,_0x279860=_0xbdc52b[_0xa2f30d(0x13e)](/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!_0x279860)return undefined;const _0x362bbf=parseFrontmatterObject(_0x279860[0x1]??'');return scalarToString(_0x362bbf?.[_0xa2f30d(0x146)]);}function a171_0x326e(){const _0x4af778=['Invalid\x20','198kxDnzH','allowAppCodeRetarget','slice','isFile','trim','scope','isArray','1545748DcLVuv','ignoreMetadataScope','18jEHmKn','801120dYqQsy','targetScope','\x22\x20does\x20not\x20match\x20current\x20appCode\x20\x22','\x20has\x20unsupported\x20scope\x20\x22','number','388655RmcwgL','ignoreMetadataForPayload','personal','742zGaghL','1175337DlHBIV','length','14232lQhgAm','refreshedAt','path','utf8','Skill\x20metadata\x20appCode\x20\x22','packageBase64','appCode',',\x20or\x20directory\x20name.','object','isDirectory','ignoreInvalidMetadata','dir','117782pAcDRG','\x20has\x20scope=\x22','company','pushedAt','builtin','Remote\x20Skill\x20','string','toLowerCase','files','name','metadata','description','tags','(unknown)','sourceSessionId','validation','ignoreMetadataAppCodeMismatch','content','Missing\x20','replace','3037989NJWwgD','match','4MddFyt','Only\x20personal\x20Skills\x20can\x20be\x20pushed;\x20','skillName','isSymbolicLink','unknown','Skill\x20directory\x20not\x20found:\x20','skillCode','displayName','example','excludedFilePaths','boolean','20zRyNiE'];a171_0x326e=function(){return _0x4af778;};return a171_0x326e();}function slugifySkillName(_0x4b17b9){const _0x6a063f=a171_0x3a13,_0x372da6=_0x4b17b9[_0x6a063f(0x150)]()[_0x6a063f(0x130)]()[_0x6a063f(0x13c)](/[^\p{L}\p{N}\p{So}]+/gu,'-')[_0x6a063f(0x13c)](/^-+/,'')['replace'](/-+$/,'')[_0x6a063f(0x13c)](/-{2,}/g,'-');if(!_0x372da6)throw CliErrors['validation'](_0x6a063f(0x14b)+SKILL_FILE+'\x20name\x20for\x20SkillHub\x20slug\x20generation.');return _0x372da6;}function parseFrontmatterObject(_0x2eaf53){const _0xb92ce1=a171_0x3a13;try{const _0xab4b2d=a171_0xec42c9(_0x2eaf53);return _0xab4b2d&&typeof _0xab4b2d===_0xb92ce1(0x125)&&!Array[_0xb92ce1(0x152)](_0xab4b2d)?_0xab4b2d:undefined;}catch{return undefined;}}function scalarToString(_0x152639){const _0x3cdb3c=a171_0x3a13;if(typeof _0x152639===_0x3cdb3c(0x12f))return _0x152639[_0x3cdb3c(0x150)]();if(typeof _0x152639===_0x3cdb3c(0x15a)||typeof _0x152639===_0x3cdb3c(0x149))return String(_0x152639);return undefined;}function resolvePushDirectoryRoot(_0x995795){const _0x2067ea=a171_0x3a13,_0x11c8dd=resolve(_0x995795);if(!existsSync(_0x11c8dd))throw CliErrors[_0x2067ea(0x138)](_0x2067ea(0x144)+_0x995795);const _0x588d83=lstatSync(_0x11c8dd);if(_0x588d83['isDirectory']())return _0x11c8dd;if(_0x588d83[_0x2067ea(0x142)]()){const _0xd4b5f8=realpathSync(_0x11c8dd);if(lstatSync(_0xd4b5f8)[_0x2067ea(0x126)]())return _0xd4b5f8;}throw CliErrors[_0x2067ea(0x138)]('Skill\x20directory\x20not\x20found:\x20'+_0x995795);}function requireRemoteScope(_0xa81967){const _0x4cd938=a171_0x3a13;if(_0xa81967[_0x4cd938(0x151)]===_0x4cd938(0x15d)||_0xa81967[_0x4cd938(0x151)]===_0x4cd938(0x12b)||_0xa81967[_0x4cd938(0x151)]===_0x4cd938(0x12d))return _0xa81967[_0x4cd938(0x151)];throw CliErrors[_0x4cd938(0x138)](_0x4cd938(0x12e)+(_0xa81967[_0x4cd938(0x145)]||_0x4cd938(0x136))+_0x4cd938(0x159)+(_0xa81967['scope']??_0x4cd938(0x143))+'\x22.');}function readLocalSkillContent(_0xc25561){const _0x4daf2f=a171_0x3a13,_0x55bd95=resolve(_0xc25561,SKILL_FILE);return existsSync(_0x55bd95)&&lstatSync(_0x55bd95)[_0x4daf2f(0x14f)]()?readFileSync(_0x55bd95,_0x4daf2f(0x164)):'';}function a171_0x3a13(_0x4beb73,_0x375753){_0x4beb73=_0x4beb73-0x121;const _0x326e06=a171_0x326e();let _0x3a13d5=_0x326e06[_0x4beb73];return _0x3a13d5;}function readPushMetadataIfPresent(_0x27ae8c,_0x4bf56a={}){try{return readMetadataIfPresent(_0x27ae8c);}catch(_0x5d166d){if(_0x4bf56a['ignoreInvalidMetadata'])return undefined;throw _0x5d166d;}}
|
|
1
|
+
import{existsSync,lstatSync,readFileSync,realpathSync}from"node:fs";import{basename,resolve}from"node:path";import{parse as parseYaml}from"yaml";import{CliErrors}from"../../errors.js";import{METADATA_FILE,SKILL_FILE}from"./constants.js";import{writeJsonAtomic}from"./fs-utils.js";import{contentHash}from"./hashing.js";import{fileText,normalizeLocalFiles,scanSkillDirectory}from"./local-files.js";import{buildMetadata,readMetadataIfPresent}from"./metadata.js";import{buildSkillPackage,tryNormalizePackageManifest}from"./zip-package.js";export function resolvePushDirectoryIdentity(dir,appCode,options={}){const resolvedDir=resolvePushDirectoryRoot(dir);const metadata=readPushMetadataIfPresent(resolve(resolvedDir,METADATA_FILE),{ignoreInvalidMetadata:options.ignoreInvalidMetadata});if(metadata?.appCode&&metadata.appCode!==appCode&&!options.allowAppCodeRetarget&&!options.ignoreMetadataAppCodeMismatch){
|
|
2
|
+
throw CliErrors.validation(`Skill metadata appCode "${metadata.appCode}" does not match current appCode "${appCode}".`)}const skillCode=resolvePushSkillCode(resolvedDir,appCode,metadata,options);if(!skillCode){throw CliErrors.validation(`Unable to resolve skillCode from ${SKILL_FILE}, ${METADATA_FILE}, or directory name.`)}return{dir:resolvedDir,skillCode:skillCode,metadata:metadata}}export function readPushDirectory(dir,appCode,options={}){const identity=resolvePushDirectoryIdentity(dir,appCode,options);const resolvedDir=identity.dir;const skillMdPath=resolve(resolvedDir,SKILL_FILE);if(!existsSync(skillMdPath)||!lstatSync(skillMdPath).isFile()){throw CliErrors.validation(`Missing ${SKILL_FILE}: ${skillMdPath}`)}const metadata=identity.metadata;const targetScope=options.targetScope??"personal";if(!options.ignoreMetadataScope&&metadata?.scope==="builtin"){throw CliErrors.validation(`Builtin Skills cannot be pushed; ${METADATA_FILE} has scope="${metadata.scope}".`)}
|
|
3
|
+
if(!options.ignoreMetadataScope&&targetScope==="personal"&&metadata?.scope&&metadata.scope!=="personal"){throw CliErrors.validation(`Only personal Skills can be pushed; ${METADATA_FILE} has scope="${metadata.scope}".`,`Use lovrabet skill push --scope company --dir ${resolvedDir} to submit company Skills for review.`)}const files=scanSkillDirectory(resolvedDir,{excludedFilePaths:options.excludedFilePaths});const skillPackage=buildSkillPackage(files);const content=readFileSync(skillMdPath,"utf8");const skillCode=identity.skillCode;const metadataForPayload=options.ignoreMetadataForPayload?undefined:metadata;const displayName=readSkillDisplayName(content);return{skillCode:skillCode,metadata:metadata,frontmatterDisplayName:displayName,input:{skillCode:skillCode,skillName:displayName??metadataForPayload?.skillName,description:metadataForPayload?.description,content:content,files:skillPackage.manifest,packageBase64:skillPackage.packageBase64,tags:metadataForPayload?.tags,
|
|
4
|
+
version:metadataForPayload?.version,sourceSessionId:metadataForPayload?.sourceSessionId}}}export function refreshPushDirectoryMetadataFromRemote(dir,remote,appCode,options={}){const resolvedDir=resolvePushDirectoryRoot(dir);const metadata=readPushMetadataIfPresent(resolve(resolvedDir,METADATA_FILE),{ignoreInvalidMetadata:true});const scope=requireRemoteScope(remote);const content=readLocalSkillContent(resolvedDir);const mergedRemote={...remote,appCode:remote.appCode??appCode,skillName:remote.skillName??metadata?.skillName,description:remote.description??metadata?.description,example:remote.example??metadata?.example,tags:Array.isArray(remote.tags)?remote.tags:metadata?.tags,sourceSessionId:remote.sourceSessionId??metadata?.sourceSessionId,content:remote.content??content};const refreshed=buildMetadata(mergedRemote,scope,appCode,contentHash(content),options.refreshedAt);writeJsonAtomic(resolve(resolvedDir,METADATA_FILE),refreshed)}
|
|
5
|
+
export function recordPushedRuntimeSkill(dir,saved,appCode,options={}){const resolvedDir=resolvePushDirectoryRoot(dir);const files=scanSkillDirectory(resolvedDir);const localSkillFile=files.find(file=>file.path===SKILL_FILE);const content=localSkillFile?fileText(localSkillFile):"";const savedManifest=tryNormalizePackageManifest(saved.files);const normalizedSaved={...saved,content:saved.content??content,files:savedManifest};const metadataFiles=savedManifest?normalizeLocalFiles(files).filter(file=>savedManifest.files.some(item=>item.path===file.path)):undefined;const metadata=buildMetadata(normalizedSaved,options.scope??"personal",appCode,contentHash(normalizedSaved.content??""),options.pushedAt,metadataFiles);writeJsonAtomic(resolve(resolvedDir,METADATA_FILE),metadata)}export function deriveSkillCodeFromDirectory(dir,appCode){const name=basename(resolve(dir));const prefix=`${appCode}--`;return name.startsWith(prefix)?name.slice(prefix.length):name}
|
|
6
|
+
function resolvePushSkillCode(dir,appCode,metadata,options){const localSkillCode=deriveSkillCodeFromSkillFile(dir)||deriveSkillCodeFromDirectory(dir,appCode);if(options.ignoreMetadataSkillCode){return localSkillCode}return metadata?.skillCode?.trim()||localSkillCode}function deriveSkillCodeFromSkillFile(dir){const skillMdPath=resolve(dir,SKILL_FILE);if(!existsSync(skillMdPath)||!lstatSync(skillMdPath).isFile()){return undefined}const content=readFileSync(skillMdPath,"utf8");const match=content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!match){return undefined}const frontmatter=parseFrontmatterObject(match[1]??"");const name=scalarToString(frontmatter?.name);return name?slugifySkillName(name):undefined}function readSkillDisplayName(content){const match=content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!match){return undefined}const frontmatter=parseFrontmatterObject(match[1]??"");return scalarToString(frontmatter?.displayName)}function slugifySkillName(raw){
|
|
7
|
+
const slug=raw.trim().toLowerCase().replace(/[^\p{L}\p{N}\p{So}]+/gu,"-").replace(/^-+/,"").replace(/-+$/,"").replace(/-{2,}/g,"-");if(!slug){throw CliErrors.validation(`Invalid ${SKILL_FILE} name for SkillHub slug generation.`)}return slug}function parseFrontmatterObject(yaml){try{const value=parseYaml(yaml);return value&&typeof value==="object"&&!Array.isArray(value)?value:undefined}catch{return undefined}}function scalarToString(value){if(typeof value==="string")return value.trim();if(typeof value==="number"||typeof value==="boolean")return String(value);return undefined}function resolvePushDirectoryRoot(dir){const root=resolve(dir);if(!existsSync(root)){throw CliErrors.validation(`Skill directory not found: ${dir}`)}const stat=lstatSync(root);if(stat.isDirectory()){return root}if(stat.isSymbolicLink()){const realRoot=realpathSync(root);if(lstatSync(realRoot).isDirectory()){return realRoot}}throw CliErrors.validation(`Skill directory not found: ${dir}`)}
|
|
8
|
+
function requireRemoteScope(skill){if(skill.scope==="personal"||skill.scope==="company"||skill.scope==="builtin"){return skill.scope}throw CliErrors.validation(`Remote Skill ${skill.skillCode||"(unknown)"} has unsupported scope "${skill.scope??"unknown"}".`)}function readLocalSkillContent(dir){const skillMdPath=resolve(dir,SKILL_FILE);return existsSync(skillMdPath)&&lstatSync(skillMdPath).isFile()?readFileSync(skillMdPath,"utf8"):""}function readPushMetadataIfPresent(path,options={}){try{return readMetadataIfPresent(path)}catch(error){if(options.ignoreInvalidMetadata){return undefined}throw error}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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";
|