@easbot/skills 0.3.12 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.en.md +433 -126
  2. package/README.md +428 -126
  3. package/dist/chunks/blob-SCUVTYVE.cjs +1 -0
  4. package/dist/chunks/blob-WZAGX4RO.mjs +1 -0
  5. package/dist/chunks/chunk-2E6BHPFV.cjs +265 -0
  6. package/dist/chunks/chunk-5BDDXFOF.mjs +1 -0
  7. package/dist/chunks/chunk-5RWSXDNO.cjs +3 -0
  8. package/dist/chunks/chunk-6NTEYECA.mjs +22 -0
  9. package/dist/chunks/chunk-AQYRRXU5.mjs +5 -0
  10. package/dist/chunks/{chunk-2VZUPTI7.cjs → chunk-DFBKA5A6.cjs} +1 -1
  11. package/dist/chunks/chunk-DNE3XPCJ.cjs +2 -0
  12. package/dist/chunks/chunk-E7AHWFZN.cjs +2 -0
  13. package/dist/chunks/chunk-ISMGLHYS.cjs +1 -0
  14. package/dist/chunks/chunk-J6PRUXFG.mjs +265 -0
  15. package/dist/chunks/chunk-JCOXRETY.cjs +22 -0
  16. package/dist/chunks/chunk-ML6B4IQL.mjs +1 -0
  17. package/dist/chunks/chunk-NH4TYEPW.mjs +3 -0
  18. package/dist/chunks/{chunk-S6YNGR7S.cjs → chunk-Q2MOP5ZW.cjs} +2 -2
  19. package/dist/chunks/{chunk-OWG6N2K6.cjs → chunk-UGHF4GOW.cjs} +2 -2
  20. package/dist/chunks/chunk-ZJS7IO5V.mjs +2 -0
  21. package/dist/chunks/chunk-ZYDDQV73.mjs +2 -0
  22. package/dist/chunks/cli-handler-3FSM4C7L.mjs +1 -0
  23. package/dist/chunks/cli-handler-B6H4RZEM.cjs +1 -0
  24. package/dist/chunks/{installer-FB26E7JZ.mjs → installer-NJN3PT5F.mjs} +1 -1
  25. package/dist/chunks/installer-YDJBZTQ7.cjs +1 -0
  26. package/dist/chunks/{interfaces-UIS44Q7A.cjs → interfaces-5BH4K5TM.cjs} +1 -1
  27. package/dist/chunks/local-lock-SPZB3AB7.cjs +1 -0
  28. package/dist/chunks/local-lock-ZHTDWYXF.mjs +1 -0
  29. package/dist/chunks/scan-6W47D2KJ.mjs +1 -0
  30. package/dist/chunks/scan-L6UNVP3V.cjs +1 -0
  31. package/dist/chunks/skill-lock-MNRZ7TIX.mjs +1 -0
  32. package/dist/chunks/skill-lock-VX2HGPTY.cjs +1 -0
  33. package/dist/chunks/store-TSS4BMBF.cjs +1 -0
  34. package/dist/chunks/store-UJPPYDBG.mjs +1 -0
  35. package/dist/chunks/telemetry-B4PS27S5.cjs +1 -0
  36. package/dist/cli.cjs +1 -1
  37. package/dist/cli.mjs +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.cts +53 -9
  40. package/dist/index.d.ts +53 -9
  41. package/dist/index.mjs +1 -1
  42. package/package.json +5 -7
  43. package/dist/chunks/blob-DOVEGVIE.cjs +0 -1
  44. package/dist/chunks/blob-JSMTOYEN.mjs +0 -1
  45. package/dist/chunks/chunk-2YVJ7YP6.mjs +0 -22
  46. package/dist/chunks/chunk-4R6NKPNW.mjs +0 -3
  47. package/dist/chunks/chunk-676OG55M.mjs +0 -5
  48. package/dist/chunks/chunk-6PJ3YQA7.mjs +0 -2
  49. package/dist/chunks/chunk-72DXY4B7.mjs +0 -1
  50. package/dist/chunks/chunk-GR2NJUJ6.mjs +0 -255
  51. package/dist/chunks/chunk-JFEBB5CL.cjs +0 -22
  52. package/dist/chunks/chunk-KV7EP6AW.cjs +0 -255
  53. package/dist/chunks/chunk-RWSBKHQ2.cjs +0 -3
  54. package/dist/chunks/chunk-TCFGU43L.cjs +0 -2
  55. package/dist/chunks/cli-handler-RAJ42VDN.mjs +0 -1
  56. package/dist/chunks/cli-handler-YAJ5J5VA.cjs +0 -1
  57. package/dist/chunks/installer-GOQTCUJ4.cjs +0 -1
  58. package/dist/chunks/local-lock-4AA55ORE.cjs +0 -1
  59. package/dist/chunks/local-lock-LG5YL33V.mjs +0 -1
  60. package/dist/chunks/scan-QEVID2TF.mjs +0 -1
  61. package/dist/chunks/scan-XWU3FCE3.cjs +0 -1
  62. package/dist/chunks/skill-lock-KHPVP7AD.mjs +0 -1
  63. package/dist/chunks/skill-lock-LET33FVT.cjs +0 -1
  64. package/dist/chunks/store-3NRBE47N.mjs +0 -1
  65. package/dist/chunks/store-EHYH46YY.cjs +0 -1
  66. package/dist/chunks/telemetry-LCGTSJDM.cjs +0 -1
  67. /package/dist/chunks/{chunk-VRHWDHQV.cjs → chunk-GWUDKZEH.cjs} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- import { AgentResult } from '@vercel/detect-agent';
2
1
  import { Lang } from '@easbot/utils';
3
2
  import { IGlobal, IInstance, ISubAgentRunner } from '@easbot/types';
4
3
 
@@ -68,7 +67,10 @@ interface DiscoverSkillsOptions {
68
67
  }
69
68
  declare function isSubpathSafe(basePath: string, subpath: string): boolean;
70
69
  declare function discoverSkills(basePath: string, subpath?: string, options?: DiscoverSkillsOptions): Promise<Skill[]>;
71
- declare function getSkillDisplayName(skill: Skill): string;
70
+ declare function getSkillDisplayName(skill: {
71
+ name: string;
72
+ path?: string;
73
+ }): string;
72
74
  declare function filterSkills(skills: Skill[], inputNames: string[]): Skill[];
73
75
 
74
76
  type InstallState = 'absent' | 'symlinked' | 'copied' | 'orphan' | 'divergent';
@@ -370,6 +372,7 @@ interface AddOptions {
370
372
  fullDepth?: boolean;
371
373
  copy?: boolean;
372
374
  subagent?: string[];
375
+ json?: boolean;
373
376
  }
374
377
  declare function runAdd(args: string[], options?: AddOptions): Promise<void>;
375
378
  declare function parseAddOptions(args: string[]): {
@@ -432,7 +435,7 @@ declare function cleanupTempDir(dir: string): Promise<void>;
432
435
 
433
436
  interface SkillSnapshotFile {
434
437
  path: string;
435
- contents: string;
438
+ contents: string | Buffer;
436
439
  }
437
440
  interface SkillDownloadResponse {
438
441
  files: SkillSnapshotFile[];
@@ -442,6 +445,7 @@ interface BlobSkill extends Skill {
442
445
  files: SkillSnapshotFile[];
443
446
  snapshotHash: string;
444
447
  repoPath: string;
448
+ repoSubpath?: string;
445
449
  }
446
450
  declare const BLOB_ALLOWED_REPOS: Record<string, {
447
451
  downloadUrl: (slug: string) => string;
@@ -461,10 +465,16 @@ interface RepoTree {
461
465
  declare function resetRepoTreeAuthState(): void;
462
466
  declare function fetchRepoTree(ownerRepo: string, ref?: string, getToken?: () => string | null): Promise<RepoTree | null>;
463
467
  declare function getSkillFolderHashFromTree(tree: RepoTree, skillPath: string): string | null;
464
- declare function findSkillMdPaths(tree: RepoTree, subpath?: string): string[];
468
+ declare function findSkillMdPaths(tree: RepoTree, options?: {
469
+ subpath?: string;
470
+ maxDepth?: number;
471
+ limit?: number;
472
+ }): string[];
465
473
  interface BlobInstallResult {
466
474
  skills: BlobSkill[];
467
475
  tree: RepoTree;
476
+ subpath?: string;
477
+ snapshotHash?: string;
468
478
  }
469
479
  declare function tryBlobInstall(ownerRepo: string, options?: {
470
480
  subpath?: string;
@@ -511,6 +521,7 @@ interface RemoveOptions {
511
521
  skill?: string[];
512
522
  yes?: boolean;
513
523
  all?: boolean;
524
+ json?: boolean;
514
525
  }
515
526
  declare function removeCommand(skillNames: string[], options: RemoveOptions): Promise<void>;
516
527
  declare function parseRemoveOptions(args: string[]): {
@@ -576,7 +587,6 @@ interface LocalSkillLockFile {
576
587
  declare function getLocalLockPath(cwd?: string): string;
577
588
  declare function readLocalLock(cwd?: string): Promise<LocalSkillLockFile>;
578
589
  declare function writeLocalLock(lock: LocalSkillLockFile, cwd?: string): Promise<void>;
579
- declare function computeSkillFolderHash(skillDir: string): Promise<string>;
580
590
  declare function addSkillToLocalLock(skillName: string, entry: Omit<LocalSkillLockEntry, 'installedAt' | 'updatedAt'>, cwd?: string): Promise<void>;
581
591
  declare function removeSkillFromLocalLock(skillName: string, cwd?: string): Promise<boolean>;
582
592
 
@@ -586,6 +596,7 @@ interface UpdateCheckOptions {
586
596
  global?: boolean;
587
597
  project?: boolean;
588
598
  yes?: boolean;
599
+ json?: boolean;
589
600
  all?: boolean;
590
601
  agent?: string[];
591
602
  force?: boolean;
@@ -617,7 +628,7 @@ declare function parseStoreOptions(args: string[]): {
617
628
  declare function runStore(args: string[], options?: StoreOptions): Promise<number>;
618
629
  declare function runStoreList(keyword: string | undefined, options?: StoreOptions): Promise<number>;
619
630
  declare function runStoreClean(options?: StoreOptions): Promise<number>;
620
- declare function runStoreUpdate(keyword: string | undefined, options?: StoreOptions): Promise<number>;
631
+ declare function runStoreUpdate(sourceKey: string | undefined, options?: StoreOptions): Promise<number>;
621
632
  declare function runStoreRemove(restArgs: string[], options?: StoreOptions): Promise<number>;
622
633
 
623
634
  interface UseOptions {
@@ -626,6 +637,7 @@ interface UseOptions {
626
637
  fullDepth?: boolean;
627
638
  dangerouslyAcceptOpenclawRisks?: boolean;
628
639
  help?: boolean;
640
+ json?: boolean;
629
641
  }
630
642
  interface ParseUseOptionsResult {
631
643
  source: string[];
@@ -639,7 +651,7 @@ type UseSkill = {
639
651
  rawContent: string;
640
652
  files: Array<{
641
653
  path: string;
642
- contents: string;
654
+ contents: string | Buffer;
643
655
  }>;
644
656
  } | {
645
657
  kind: 'disk';
@@ -676,6 +688,12 @@ declare function materializeUseSkill(skill: UseSkill): Promise<MaterializedUseSk
676
688
  declare function runUse(sourceArgs: string[], options?: UseOptions, parseErrors?: string[]): Promise<void>;
677
689
  declare function launchAgentInteractively(agent: AgentType, prompt: string, spawnImpl?: AgentSpawn): Promise<number>;
678
690
 
691
+ declare function computeFromDir(skillDir: string): Promise<string>;
692
+ declare function computeSnapshotHash(files: ReadonlyArray<{
693
+ path: string;
694
+ contents: string | Buffer;
695
+ }>): string;
696
+
679
697
  interface InstallTelemetryData {
680
698
  event: 'install';
681
699
  source: string;
@@ -728,7 +746,7 @@ interface StoreCleanForceTelemetryData {
728
746
  }
729
747
  interface StoreUpdateTelemetryData {
730
748
  event: 'store_update';
731
- keyword?: string;
749
+ sourceKey?: string;
732
750
  sourceCount?: string;
733
751
  successCount?: string;
734
752
  failCount?: string;
@@ -763,6 +781,32 @@ declare function flushTelemetry(timeoutMs?: number): Promise<void>;
763
781
  declare function stripTerminalEscapes(str: string): string;
764
782
  declare function sanitizeMetadata(str: string): string;
765
783
 
784
+ declare const EASBOT: "easbot";
785
+ declare const CURSOR: "cursor";
786
+ declare const CURSOR_CLI: "cursor-cli";
787
+ declare const CLAUDE: "claude";
788
+ declare const COWORK: "cowork";
789
+ declare const DEVIN: "devin";
790
+ declare const REPLIT: "replit";
791
+ declare const GEMINI: "gemini";
792
+ declare const CODEX: "codex";
793
+ declare const ANTIGRAVITY: "antigravity";
794
+ declare const AUGMENT_CLI: "augment-cli";
795
+ declare const OPENCODE: "opencode";
796
+ declare const GITHUB_COPILOT: "github-copilot";
797
+ declare const V0: "v0";
798
+ type KnownAgentNames = typeof EASBOT | typeof CURSOR | typeof CURSOR_CLI | typeof CLAUDE | typeof COWORK | typeof DEVIN | typeof REPLIT | typeof GEMINI | typeof CODEX | typeof ANTIGRAVITY | typeof AUGMENT_CLI | typeof OPENCODE | typeof GITHUB_COPILOT | typeof V0;
799
+ interface KnownAgentDetails {
800
+ name: KnownAgentNames;
801
+ }
802
+ type AgentResult = {
803
+ isAgent: true;
804
+ agent: KnownAgentDetails;
805
+ } | {
806
+ isAgent: false;
807
+ agent: undefined;
808
+ };
809
+
766
810
  declare function detectAgent(): Promise<AgentResult>;
767
811
  declare function isRunningInAgent(): Promise<boolean>;
768
812
  declare function getAgentName(): Promise<string | null>;
@@ -886,4 +930,4 @@ declare function listAllEntries(): Promise<Array<{
886
930
  error: Error;
887
931
  }>>;
888
932
 
889
- export { AGENTS_DIR, type AddOptions, type AgentConfig, type AgentInstallMatrix, type AgentProcess, type AgentSkillDirsResult, type AgentSpawn, type AgentType, type AuditResponse, BLOB_ALLOWED_REPOS, type BlobInstallResult, type BlobSkill, type CellAction, type CellScope, DEFAULT_CLONE_TIMEOUT, type DiscoverSkillsOptions, type DismissedPrompts, EVE_SUBAGENTS_DIR, type FindOptions, GitCloneError, type HostProvider, type InstallCell, type InstallMode, type InstallScope, type InstallState, type InstalledSkill, type LocalPluginSourceOptions, type LocalSkillLockEntry, type LocalSkillLockFile, type MaterializedUseSkill, PROJECT_SKILLS_DIR_PATTERN, type ParseFindOptionsResult, type ParseUseOptionsResult, type ParsedSource, type PartnerAudit, type PluginSource, type PluginSourceCategory, type PluginSourceEntry, type PluginSourceLoadResult, type PostInstallInput, type PostInstallResult, type ProviderMatch, type ProviderRegistry, type RemoteSkill as ProviderRemoteSkill, type RemoteSkill$1 as RemoteSkill, type RemoveOptions, type RepoTree, SKILLS_SUBDIR, type SearchSkill, type Skill, type SkillAuditData, type SkillDownloadResponse, type SkillLockEntry, type SkillLockFile, type SkillSnapshotFile, type SkillsAgentAdapter, type SkillsCliDeps, type SkillsCliResult, type StoreOptions, type TreeEntry, UNIVERSAL_SKILLS_DIR, type UniversalScope, type UpdateCheckOptions, type UpdateScope, type UseOptions, type UseSkill, type WellKnownFileContent, type WellKnownIndex, type WellKnownIndexV1, type WellKnownIndexV2, WellKnownProvider, type WellKnownSkill, type WellKnownSkillEntry, type WellKnownSkillEntryV1, type WellKnownSkillEntryV2, type WellKnownSourceOptions, acquireSourceClone, addSkillToLocalLock, addSkillToLock, agents, applyActions, buildMatrix, buildUsePrompt, cleanCache, cleanCachedRepo, cleanupTempDir, cloneRepo, computeContentHash, computeSkillFolderHash, createLocalPluginSource, createWellKnownSource, detectAgent, detectInstalledAgents, discoverSkills, dismissPrompt, ensureCachedSource, fetchAuditData, fetchRepoTree, fetchSkillFolderHash, filterSkills, findProvider, findSkillMdPaths, findSource, findSourcesByCategory, flushTelemetry, getAgentAdapter, getAgentBaseDir, getAgentConfig, getAgentGlobalSkillDirs, getAgentName, getAgentProjectSkillContainerPrefixes, getAgentProjectSkillDirs, getAgentSkillDirs, getAgentType, getAllLockedSkills, getCacheRepoDir, getCacheRoot, getCanonicalPath, getCanonicalSkillsDir, getEveSubagentSkillsDir, getEveSubagents, getGitHubToken, getGlobal, getHomeDir, getInstallPath, getInstance, getLocalLockPath, getNonUniversalAgents, getOpenClawGlobalSkillsDir, getOwnerRepo, getProjectDirectory, getProviders, getSkillDisplayName, getSkillFolderHashFromTree, getSkillFromLock, getSkillLockPath, getSkillsBySource, getSourceDir, getUniversalAgents, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleSkillsCli, hasAgentAdapter, hasProjectSkills, initTelemetry, installBlobSkillForAgent, installFromCache, installRemoteSkillForAgent, installSkillForAgent, installWellKnownSkillForAgent, isGitHubHttpsCloneUrl, isGitHubSsoAuthError, isPromptDismissed, isRepoPrivate, isRunningInAgent, isSkillInstalled, isSubpathSafe, isUniversalAgent, launchAgentInteractively, listAllEntries, listInstalledSkills, listSources, matchesSkillFilter, matchesUniversalScope, materializeUseSkill, parseAddOptions, parseFindOptions, parseFrontmatter, parseGitHubRepoUrl, parseListOptions, parseOwnerRepo, parseRemoveOptions, parseSkillMd, parseSource, parseStoreOptions, parseUpdateOptions, parseUseOptions, planActions, probeCell, readLocalLock, readSkillLock, registerProvider, registerSource, registry, removeCommand, removeSkillFromLocalLock, removeSkillFromLock, renderBanner, renderHelp, requireAgentAdapter, resetGhAuthWarning, resetGlobalAdapter, resetInstanceAdapter, resetRepoTreeAuthState, resolveUpdateScope, runAdd, runDoctor, runFind, runList, runPostInstallReconcile, runStore, runStoreClean, runStoreList, runStoreRemove, runStoreUpdate, runUpdate, runUse, sanitizeMetadata, sanitizeName, sanitizeSubpath, searchSkillsAPI, setAgentAdapter, setDetectedAgent, setGlobalAdapter, setInstanceAdapter, setVersion, shouldInstallInternalSkills, stripTerminalEscapes, toSkillSlug, track, tryBlobInstall, wellKnownProvider, writeLocalLock, writeSkillLock };
933
+ export { AGENTS_DIR, type AddOptions, type AgentConfig, type AgentInstallMatrix, type AgentProcess, type AgentSkillDirsResult, type AgentSpawn, type AgentType, type AuditResponse, BLOB_ALLOWED_REPOS, type BlobInstallResult, type BlobSkill, type CellAction, type CellScope, DEFAULT_CLONE_TIMEOUT, type DiscoverSkillsOptions, type DismissedPrompts, EVE_SUBAGENTS_DIR, type FindOptions, GitCloneError, type HostProvider, type InstallCell, type InstallMode, type InstallScope, type InstallState, type InstalledSkill, type LocalPluginSourceOptions, type LocalSkillLockEntry, type LocalSkillLockFile, type MaterializedUseSkill, PROJECT_SKILLS_DIR_PATTERN, type ParseFindOptionsResult, type ParseUseOptionsResult, type ParsedSource, type PartnerAudit, type PluginSource, type PluginSourceCategory, type PluginSourceEntry, type PluginSourceLoadResult, type PostInstallInput, type PostInstallResult, type ProviderMatch, type ProviderRegistry, type RemoteSkill as ProviderRemoteSkill, type RemoteSkill$1 as RemoteSkill, type RemoveOptions, type RepoTree, SKILLS_SUBDIR, type SearchSkill, type Skill, type SkillAuditData, type SkillDownloadResponse, type SkillLockEntry, type SkillLockFile, type SkillSnapshotFile, type SkillsAgentAdapter, type SkillsCliDeps, type SkillsCliResult, type StoreOptions, type TreeEntry, UNIVERSAL_SKILLS_DIR, type UniversalScope, type UpdateCheckOptions, type UpdateScope, type UseOptions, type UseSkill, type WellKnownFileContent, type WellKnownIndex, type WellKnownIndexV1, type WellKnownIndexV2, WellKnownProvider, type WellKnownSkill, type WellKnownSkillEntry, type WellKnownSkillEntryV1, type WellKnownSkillEntryV2, type WellKnownSourceOptions, acquireSourceClone, addSkillToLocalLock, addSkillToLock, agents, applyActions, buildMatrix, buildUsePrompt, cleanCache, cleanCachedRepo, cleanupTempDir, cloneRepo, computeContentHash, computeFromDir, computeSnapshotHash, createLocalPluginSource, createWellKnownSource, detectAgent, detectInstalledAgents, discoverSkills, dismissPrompt, ensureCachedSource, fetchAuditData, fetchRepoTree, fetchSkillFolderHash, filterSkills, findProvider, findSkillMdPaths, findSource, findSourcesByCategory, flushTelemetry, getAgentAdapter, getAgentBaseDir, getAgentConfig, getAgentGlobalSkillDirs, getAgentName, getAgentProjectSkillContainerPrefixes, getAgentProjectSkillDirs, getAgentSkillDirs, getAgentType, getAllLockedSkills, getCacheRepoDir, getCacheRoot, getCanonicalPath, getCanonicalSkillsDir, getEveSubagentSkillsDir, getEveSubagents, getGitHubToken, getGlobal, getHomeDir, getInstallPath, getInstance, getLocalLockPath, getNonUniversalAgents, getOpenClawGlobalSkillsDir, getOwnerRepo, getProjectDirectory, getProviders, getSkillDisplayName, getSkillFolderHashFromTree, getSkillFromLock, getSkillLockPath, getSkillsBySource, getSourceDir, getUniversalAgents, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleSkillsCli, hasAgentAdapter, hasProjectSkills, initTelemetry, installBlobSkillForAgent, installFromCache, installRemoteSkillForAgent, installSkillForAgent, installWellKnownSkillForAgent, isGitHubHttpsCloneUrl, isGitHubSsoAuthError, isPromptDismissed, isRepoPrivate, isRunningInAgent, isSkillInstalled, isSubpathSafe, isUniversalAgent, launchAgentInteractively, listAllEntries, listInstalledSkills, listSources, matchesSkillFilter, matchesUniversalScope, materializeUseSkill, parseAddOptions, parseFindOptions, parseFrontmatter, parseGitHubRepoUrl, parseListOptions, parseOwnerRepo, parseRemoveOptions, parseSkillMd, parseSource, parseStoreOptions, parseUpdateOptions, parseUseOptions, planActions, probeCell, readLocalLock, readSkillLock, registerProvider, registerSource, registry, removeCommand, removeSkillFromLocalLock, removeSkillFromLock, renderBanner, renderHelp, requireAgentAdapter, resetGhAuthWarning, resetGlobalAdapter, resetInstanceAdapter, resetRepoTreeAuthState, resolveUpdateScope, runAdd, runDoctor, runFind, runList, runPostInstallReconcile, runStore, runStoreClean, runStoreList, runStoreRemove, runStoreUpdate, runUpdate, runUse, sanitizeMetadata, sanitizeName, sanitizeSubpath, searchSkillsAPI, setAgentAdapter, setDetectedAgent, setGlobalAdapter, setInstanceAdapter, setVersion, shouldInstallInternalSkills, stripTerminalEscapes, toSkillSlug, track, tryBlobInstall, wellKnownProvider, writeLocalLock, writeSkillLock };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { AgentResult } from '@vercel/detect-agent';
2
1
  import { Lang } from '@easbot/utils';
3
2
  import { IGlobal, IInstance, ISubAgentRunner } from '@easbot/types';
4
3
 
@@ -68,7 +67,10 @@ interface DiscoverSkillsOptions {
68
67
  }
69
68
  declare function isSubpathSafe(basePath: string, subpath: string): boolean;
70
69
  declare function discoverSkills(basePath: string, subpath?: string, options?: DiscoverSkillsOptions): Promise<Skill[]>;
71
- declare function getSkillDisplayName(skill: Skill): string;
70
+ declare function getSkillDisplayName(skill: {
71
+ name: string;
72
+ path?: string;
73
+ }): string;
72
74
  declare function filterSkills(skills: Skill[], inputNames: string[]): Skill[];
73
75
 
74
76
  type InstallState = 'absent' | 'symlinked' | 'copied' | 'orphan' | 'divergent';
@@ -370,6 +372,7 @@ interface AddOptions {
370
372
  fullDepth?: boolean;
371
373
  copy?: boolean;
372
374
  subagent?: string[];
375
+ json?: boolean;
373
376
  }
374
377
  declare function runAdd(args: string[], options?: AddOptions): Promise<void>;
375
378
  declare function parseAddOptions(args: string[]): {
@@ -432,7 +435,7 @@ declare function cleanupTempDir(dir: string): Promise<void>;
432
435
 
433
436
  interface SkillSnapshotFile {
434
437
  path: string;
435
- contents: string;
438
+ contents: string | Buffer;
436
439
  }
437
440
  interface SkillDownloadResponse {
438
441
  files: SkillSnapshotFile[];
@@ -442,6 +445,7 @@ interface BlobSkill extends Skill {
442
445
  files: SkillSnapshotFile[];
443
446
  snapshotHash: string;
444
447
  repoPath: string;
448
+ repoSubpath?: string;
445
449
  }
446
450
  declare const BLOB_ALLOWED_REPOS: Record<string, {
447
451
  downloadUrl: (slug: string) => string;
@@ -461,10 +465,16 @@ interface RepoTree {
461
465
  declare function resetRepoTreeAuthState(): void;
462
466
  declare function fetchRepoTree(ownerRepo: string, ref?: string, getToken?: () => string | null): Promise<RepoTree | null>;
463
467
  declare function getSkillFolderHashFromTree(tree: RepoTree, skillPath: string): string | null;
464
- declare function findSkillMdPaths(tree: RepoTree, subpath?: string): string[];
468
+ declare function findSkillMdPaths(tree: RepoTree, options?: {
469
+ subpath?: string;
470
+ maxDepth?: number;
471
+ limit?: number;
472
+ }): string[];
465
473
  interface BlobInstallResult {
466
474
  skills: BlobSkill[];
467
475
  tree: RepoTree;
476
+ subpath?: string;
477
+ snapshotHash?: string;
468
478
  }
469
479
  declare function tryBlobInstall(ownerRepo: string, options?: {
470
480
  subpath?: string;
@@ -511,6 +521,7 @@ interface RemoveOptions {
511
521
  skill?: string[];
512
522
  yes?: boolean;
513
523
  all?: boolean;
524
+ json?: boolean;
514
525
  }
515
526
  declare function removeCommand(skillNames: string[], options: RemoveOptions): Promise<void>;
516
527
  declare function parseRemoveOptions(args: string[]): {
@@ -576,7 +587,6 @@ interface LocalSkillLockFile {
576
587
  declare function getLocalLockPath(cwd?: string): string;
577
588
  declare function readLocalLock(cwd?: string): Promise<LocalSkillLockFile>;
578
589
  declare function writeLocalLock(lock: LocalSkillLockFile, cwd?: string): Promise<void>;
579
- declare function computeSkillFolderHash(skillDir: string): Promise<string>;
580
590
  declare function addSkillToLocalLock(skillName: string, entry: Omit<LocalSkillLockEntry, 'installedAt' | 'updatedAt'>, cwd?: string): Promise<void>;
581
591
  declare function removeSkillFromLocalLock(skillName: string, cwd?: string): Promise<boolean>;
582
592
 
@@ -586,6 +596,7 @@ interface UpdateCheckOptions {
586
596
  global?: boolean;
587
597
  project?: boolean;
588
598
  yes?: boolean;
599
+ json?: boolean;
589
600
  all?: boolean;
590
601
  agent?: string[];
591
602
  force?: boolean;
@@ -617,7 +628,7 @@ declare function parseStoreOptions(args: string[]): {
617
628
  declare function runStore(args: string[], options?: StoreOptions): Promise<number>;
618
629
  declare function runStoreList(keyword: string | undefined, options?: StoreOptions): Promise<number>;
619
630
  declare function runStoreClean(options?: StoreOptions): Promise<number>;
620
- declare function runStoreUpdate(keyword: string | undefined, options?: StoreOptions): Promise<number>;
631
+ declare function runStoreUpdate(sourceKey: string | undefined, options?: StoreOptions): Promise<number>;
621
632
  declare function runStoreRemove(restArgs: string[], options?: StoreOptions): Promise<number>;
622
633
 
623
634
  interface UseOptions {
@@ -626,6 +637,7 @@ interface UseOptions {
626
637
  fullDepth?: boolean;
627
638
  dangerouslyAcceptOpenclawRisks?: boolean;
628
639
  help?: boolean;
640
+ json?: boolean;
629
641
  }
630
642
  interface ParseUseOptionsResult {
631
643
  source: string[];
@@ -639,7 +651,7 @@ type UseSkill = {
639
651
  rawContent: string;
640
652
  files: Array<{
641
653
  path: string;
642
- contents: string;
654
+ contents: string | Buffer;
643
655
  }>;
644
656
  } | {
645
657
  kind: 'disk';
@@ -676,6 +688,12 @@ declare function materializeUseSkill(skill: UseSkill): Promise<MaterializedUseSk
676
688
  declare function runUse(sourceArgs: string[], options?: UseOptions, parseErrors?: string[]): Promise<void>;
677
689
  declare function launchAgentInteractively(agent: AgentType, prompt: string, spawnImpl?: AgentSpawn): Promise<number>;
678
690
 
691
+ declare function computeFromDir(skillDir: string): Promise<string>;
692
+ declare function computeSnapshotHash(files: ReadonlyArray<{
693
+ path: string;
694
+ contents: string | Buffer;
695
+ }>): string;
696
+
679
697
  interface InstallTelemetryData {
680
698
  event: 'install';
681
699
  source: string;
@@ -728,7 +746,7 @@ interface StoreCleanForceTelemetryData {
728
746
  }
729
747
  interface StoreUpdateTelemetryData {
730
748
  event: 'store_update';
731
- keyword?: string;
749
+ sourceKey?: string;
732
750
  sourceCount?: string;
733
751
  successCount?: string;
734
752
  failCount?: string;
@@ -763,6 +781,32 @@ declare function flushTelemetry(timeoutMs?: number): Promise<void>;
763
781
  declare function stripTerminalEscapes(str: string): string;
764
782
  declare function sanitizeMetadata(str: string): string;
765
783
 
784
+ declare const EASBOT: "easbot";
785
+ declare const CURSOR: "cursor";
786
+ declare const CURSOR_CLI: "cursor-cli";
787
+ declare const CLAUDE: "claude";
788
+ declare const COWORK: "cowork";
789
+ declare const DEVIN: "devin";
790
+ declare const REPLIT: "replit";
791
+ declare const GEMINI: "gemini";
792
+ declare const CODEX: "codex";
793
+ declare const ANTIGRAVITY: "antigravity";
794
+ declare const AUGMENT_CLI: "augment-cli";
795
+ declare const OPENCODE: "opencode";
796
+ declare const GITHUB_COPILOT: "github-copilot";
797
+ declare const V0: "v0";
798
+ type KnownAgentNames = typeof EASBOT | typeof CURSOR | typeof CURSOR_CLI | typeof CLAUDE | typeof COWORK | typeof DEVIN | typeof REPLIT | typeof GEMINI | typeof CODEX | typeof ANTIGRAVITY | typeof AUGMENT_CLI | typeof OPENCODE | typeof GITHUB_COPILOT | typeof V0;
799
+ interface KnownAgentDetails {
800
+ name: KnownAgentNames;
801
+ }
802
+ type AgentResult = {
803
+ isAgent: true;
804
+ agent: KnownAgentDetails;
805
+ } | {
806
+ isAgent: false;
807
+ agent: undefined;
808
+ };
809
+
766
810
  declare function detectAgent(): Promise<AgentResult>;
767
811
  declare function isRunningInAgent(): Promise<boolean>;
768
812
  declare function getAgentName(): Promise<string | null>;
@@ -886,4 +930,4 @@ declare function listAllEntries(): Promise<Array<{
886
930
  error: Error;
887
931
  }>>;
888
932
 
889
- export { AGENTS_DIR, type AddOptions, type AgentConfig, type AgentInstallMatrix, type AgentProcess, type AgentSkillDirsResult, type AgentSpawn, type AgentType, type AuditResponse, BLOB_ALLOWED_REPOS, type BlobInstallResult, type BlobSkill, type CellAction, type CellScope, DEFAULT_CLONE_TIMEOUT, type DiscoverSkillsOptions, type DismissedPrompts, EVE_SUBAGENTS_DIR, type FindOptions, GitCloneError, type HostProvider, type InstallCell, type InstallMode, type InstallScope, type InstallState, type InstalledSkill, type LocalPluginSourceOptions, type LocalSkillLockEntry, type LocalSkillLockFile, type MaterializedUseSkill, PROJECT_SKILLS_DIR_PATTERN, type ParseFindOptionsResult, type ParseUseOptionsResult, type ParsedSource, type PartnerAudit, type PluginSource, type PluginSourceCategory, type PluginSourceEntry, type PluginSourceLoadResult, type PostInstallInput, type PostInstallResult, type ProviderMatch, type ProviderRegistry, type RemoteSkill as ProviderRemoteSkill, type RemoteSkill$1 as RemoteSkill, type RemoveOptions, type RepoTree, SKILLS_SUBDIR, type SearchSkill, type Skill, type SkillAuditData, type SkillDownloadResponse, type SkillLockEntry, type SkillLockFile, type SkillSnapshotFile, type SkillsAgentAdapter, type SkillsCliDeps, type SkillsCliResult, type StoreOptions, type TreeEntry, UNIVERSAL_SKILLS_DIR, type UniversalScope, type UpdateCheckOptions, type UpdateScope, type UseOptions, type UseSkill, type WellKnownFileContent, type WellKnownIndex, type WellKnownIndexV1, type WellKnownIndexV2, WellKnownProvider, type WellKnownSkill, type WellKnownSkillEntry, type WellKnownSkillEntryV1, type WellKnownSkillEntryV2, type WellKnownSourceOptions, acquireSourceClone, addSkillToLocalLock, addSkillToLock, agents, applyActions, buildMatrix, buildUsePrompt, cleanCache, cleanCachedRepo, cleanupTempDir, cloneRepo, computeContentHash, computeSkillFolderHash, createLocalPluginSource, createWellKnownSource, detectAgent, detectInstalledAgents, discoverSkills, dismissPrompt, ensureCachedSource, fetchAuditData, fetchRepoTree, fetchSkillFolderHash, filterSkills, findProvider, findSkillMdPaths, findSource, findSourcesByCategory, flushTelemetry, getAgentAdapter, getAgentBaseDir, getAgentConfig, getAgentGlobalSkillDirs, getAgentName, getAgentProjectSkillContainerPrefixes, getAgentProjectSkillDirs, getAgentSkillDirs, getAgentType, getAllLockedSkills, getCacheRepoDir, getCacheRoot, getCanonicalPath, getCanonicalSkillsDir, getEveSubagentSkillsDir, getEveSubagents, getGitHubToken, getGlobal, getHomeDir, getInstallPath, getInstance, getLocalLockPath, getNonUniversalAgents, getOpenClawGlobalSkillsDir, getOwnerRepo, getProjectDirectory, getProviders, getSkillDisplayName, getSkillFolderHashFromTree, getSkillFromLock, getSkillLockPath, getSkillsBySource, getSourceDir, getUniversalAgents, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleSkillsCli, hasAgentAdapter, hasProjectSkills, initTelemetry, installBlobSkillForAgent, installFromCache, installRemoteSkillForAgent, installSkillForAgent, installWellKnownSkillForAgent, isGitHubHttpsCloneUrl, isGitHubSsoAuthError, isPromptDismissed, isRepoPrivate, isRunningInAgent, isSkillInstalled, isSubpathSafe, isUniversalAgent, launchAgentInteractively, listAllEntries, listInstalledSkills, listSources, matchesSkillFilter, matchesUniversalScope, materializeUseSkill, parseAddOptions, parseFindOptions, parseFrontmatter, parseGitHubRepoUrl, parseListOptions, parseOwnerRepo, parseRemoveOptions, parseSkillMd, parseSource, parseStoreOptions, parseUpdateOptions, parseUseOptions, planActions, probeCell, readLocalLock, readSkillLock, registerProvider, registerSource, registry, removeCommand, removeSkillFromLocalLock, removeSkillFromLock, renderBanner, renderHelp, requireAgentAdapter, resetGhAuthWarning, resetGlobalAdapter, resetInstanceAdapter, resetRepoTreeAuthState, resolveUpdateScope, runAdd, runDoctor, runFind, runList, runPostInstallReconcile, runStore, runStoreClean, runStoreList, runStoreRemove, runStoreUpdate, runUpdate, runUse, sanitizeMetadata, sanitizeName, sanitizeSubpath, searchSkillsAPI, setAgentAdapter, setDetectedAgent, setGlobalAdapter, setInstanceAdapter, setVersion, shouldInstallInternalSkills, stripTerminalEscapes, toSkillSlug, track, tryBlobInstall, wellKnownProvider, writeLocalLock, writeSkillLock };
933
+ export { AGENTS_DIR, type AddOptions, type AgentConfig, type AgentInstallMatrix, type AgentProcess, type AgentSkillDirsResult, type AgentSpawn, type AgentType, type AuditResponse, BLOB_ALLOWED_REPOS, type BlobInstallResult, type BlobSkill, type CellAction, type CellScope, DEFAULT_CLONE_TIMEOUT, type DiscoverSkillsOptions, type DismissedPrompts, EVE_SUBAGENTS_DIR, type FindOptions, GitCloneError, type HostProvider, type InstallCell, type InstallMode, type InstallScope, type InstallState, type InstalledSkill, type LocalPluginSourceOptions, type LocalSkillLockEntry, type LocalSkillLockFile, type MaterializedUseSkill, PROJECT_SKILLS_DIR_PATTERN, type ParseFindOptionsResult, type ParseUseOptionsResult, type ParsedSource, type PartnerAudit, type PluginSource, type PluginSourceCategory, type PluginSourceEntry, type PluginSourceLoadResult, type PostInstallInput, type PostInstallResult, type ProviderMatch, type ProviderRegistry, type RemoteSkill as ProviderRemoteSkill, type RemoteSkill$1 as RemoteSkill, type RemoveOptions, type RepoTree, SKILLS_SUBDIR, type SearchSkill, type Skill, type SkillAuditData, type SkillDownloadResponse, type SkillLockEntry, type SkillLockFile, type SkillSnapshotFile, type SkillsAgentAdapter, type SkillsCliDeps, type SkillsCliResult, type StoreOptions, type TreeEntry, UNIVERSAL_SKILLS_DIR, type UniversalScope, type UpdateCheckOptions, type UpdateScope, type UseOptions, type UseSkill, type WellKnownFileContent, type WellKnownIndex, type WellKnownIndexV1, type WellKnownIndexV2, WellKnownProvider, type WellKnownSkill, type WellKnownSkillEntry, type WellKnownSkillEntryV1, type WellKnownSkillEntryV2, type WellKnownSourceOptions, acquireSourceClone, addSkillToLocalLock, addSkillToLock, agents, applyActions, buildMatrix, buildUsePrompt, cleanCache, cleanCachedRepo, cleanupTempDir, cloneRepo, computeContentHash, computeFromDir, computeSnapshotHash, createLocalPluginSource, createWellKnownSource, detectAgent, detectInstalledAgents, discoverSkills, dismissPrompt, ensureCachedSource, fetchAuditData, fetchRepoTree, fetchSkillFolderHash, filterSkills, findProvider, findSkillMdPaths, findSource, findSourcesByCategory, flushTelemetry, getAgentAdapter, getAgentBaseDir, getAgentConfig, getAgentGlobalSkillDirs, getAgentName, getAgentProjectSkillContainerPrefixes, getAgentProjectSkillDirs, getAgentSkillDirs, getAgentType, getAllLockedSkills, getCacheRepoDir, getCacheRoot, getCanonicalPath, getCanonicalSkillsDir, getEveSubagentSkillsDir, getEveSubagents, getGitHubToken, getGlobal, getHomeDir, getInstallPath, getInstance, getLocalLockPath, getNonUniversalAgents, getOpenClawGlobalSkillsDir, getOwnerRepo, getProjectDirectory, getProviders, getSkillDisplayName, getSkillFolderHashFromTree, getSkillFromLock, getSkillLockPath, getSkillsBySource, getSourceDir, getUniversalAgents, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleSkillsCli, hasAgentAdapter, hasProjectSkills, initTelemetry, installBlobSkillForAgent, installFromCache, installRemoteSkillForAgent, installSkillForAgent, installWellKnownSkillForAgent, isGitHubHttpsCloneUrl, isGitHubSsoAuthError, isPromptDismissed, isRepoPrivate, isRunningInAgent, isSkillInstalled, isSubpathSafe, isUniversalAgent, launchAgentInteractively, listAllEntries, listInstalledSkills, listSources, matchesSkillFilter, matchesUniversalScope, materializeUseSkill, parseAddOptions, parseFindOptions, parseFrontmatter, parseGitHubRepoUrl, parseListOptions, parseOwnerRepo, parseRemoveOptions, parseSkillMd, parseSource, parseStoreOptions, parseUpdateOptions, parseUseOptions, planActions, probeCell, readLocalLock, readSkillLock, registerProvider, registerSource, registry, removeCommand, removeSkillFromLocalLock, removeSkillFromLock, renderBanner, renderHelp, requireAgentAdapter, resetGhAuthWarning, resetGlobalAdapter, resetInstanceAdapter, resetRepoTreeAuthState, resolveUpdateScope, runAdd, runDoctor, runFind, runList, runPostInstallReconcile, runStore, runStoreClean, runStoreList, runStoreRemove, runStoreUpdate, runUpdate, runUse, sanitizeMetadata, sanitizeName, sanitizeSubpath, searchSkillsAPI, setAgentAdapter, setDetectedAgent, setGlobalAdapter, setInstanceAdapter, setVersion, shouldInstallInternalSkills, stripTerminalEscapes, toSkillSlug, track, tryBlobInstall, wellKnownProvider, writeLocalLock, writeSkillLock };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{c as applyActions,d as buildMatrix,G as buildUsePrompt,f as detectAgent,h as getAgentName,i as getAgentType,M as handleSkillsCli,k as hasProjectSkills,o as initTelemetry,g as isRunningInAgent,J as launchAgentInteractively,m as matchesSkillFilter,H as materializeUseSkill,q as parseAddOptions,x as parseFindOptions,A as parseListOptions,D as parseRemoveOptions,r as parseStoreOptions,j as parseUpdateOptions,F as parseUseOptions,b as planActions,a as probeCell,C as removeCommand,K as renderBanner,L as renderHelp,l as resolveUpdateScope,p as runAdd,E as runDoctor,z as runFind,B as runList,e as runPostInstallReconcile,s as runStore,u as runStoreClean,t as runStoreList,w as runStoreRemove,v as runStoreUpdate,n as runUpdate,I as runUse,y as searchSkillsAPI}from'./chunks/chunk-GR2NJUJ6.mjs';export{c as fetchAuditData,e as flushTelemetry,a as setDetectedAgent,b as setVersion,d as track}from'./chunks/chunk-CFMOYU7R.mjs';export{i as addSkillToLock,e as computeContentHash,p as dismissPrompt,h as fetchSkillFolderHash,l as getAllLockedSkills,g as getGitHubToken,k as getSkillFromLock,b as getSkillLockPath,m as getSkillsBySource,n as isPromptDismissed,c as readSkillLock,j as removeSkillFromLock,f as resetGhAuthWarning,d as writeSkillLock}from'./chunks/chunk-4R6NKPNW.mjs';import'./chunks/chunk-72DXY4B7.mjs';export{a as AGENTS_DIR,b as SKILLS_SUBDIR,c as UNIVERSAL_SKILLS_DIR,g as getAgentBaseDir,o as getCanonicalPath,e as getCanonicalSkillsDir,f as getEveSubagentSkillsDir,m as getInstallPath,r as installBlobSkillForAgent,p as installRemoteSkillForAgent,h as installSkillForAgent,q as installWellKnownSkillForAgent,k as isSkillInstalled,s as listInstalledSkills,d as sanitizeName}from'./chunks/chunk-676OG55M.mjs';import {n,B}from'./chunks/chunk-2YVJ7YP6.mjs';export{f as DEFAULT_CLONE_TIMEOUT,g as GitCloneError,m as WellKnownProvider,R as acquireSourceClone,w as addSkillToLocalLock,ka as cleanCache,ja as cleanCachedRepo,l as cleanupTempDir,k as cloneRepo,v as computeSkillFolderHash,B as discoverSkills,da as ensureCachedSource,D as filterSkills,Q as getCacheRepoDir,O as getCacheRoot,r as getLocalLockPath,a as getOwnerRepo,C as getSkillDisplayName,J as getSourceDir,ia as installFromCache,i as isGitHubHttpsCloneUrl,j as isGitHubSsoAuthError,c as isRepoPrivate,A as isSubpathSafe,h as parseGitHubRepoUrl,b as parseOwnerRepo,z as parseSkillMd,e as parseSource,t as readLocalLock,x as removeSkillFromLocalLock,d as sanitizeSubpath,y as shouldInstallInternalSkills,n as wellKnownProvider,u as writeLocalLock}from'./chunks/chunk-2YVJ7YP6.mjs';export{w as BLOB_ALLOWED_REPOS,h as EVE_SUBAGENTS_DIR,m as PROJECT_SKILLS_DIR_PATTERN,e as agents,f as detectInstalledAgents,A as fetchRepoTree,C as findSkillMdPaths,g as getAgentConfig,o as getAgentGlobalSkillDirs,q as getAgentProjectSkillContainerPrefixes,n as getAgentProjectSkillDirs,p as getAgentSkillDirs,i as getEveSubagents,l as getNonUniversalAgents,d as getOpenClawGlobalSkillsDir,B as getSkillFolderHashFromTree,k as getUniversalAgents,r as isUniversalAgent,j as matchesUniversalScope,c as parseFrontmatter,z as resetRepoTreeAuthState,b as sanitizeMetadata,a as stripTerminalEscapes,y as toSkillSlug,D as tryBlobInstall}from'./chunks/chunk-6PJ3YQA7.mjs';export{h as getAgentAdapter,c as getGlobal,k as getHomeDir,f as getInstance,p as getProjectDirectory,o as getXdgCache,l as getXdgConfig,m as getXdgData,n as getXdgState,i as hasAgentAdapter,j as requireAgentAdapter,b as resetGlobalAdapter,e as resetInstanceAdapter,g as setAgentAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-RWZ4LFSN.mjs';import {b}from'./chunks/chunk-WQGSYA5D.mjs';import {join}from'path';var d=class{constructor(){b(this,"providers",[]);}register(o){if(this.providers.some(t=>t.id===o.id))throw new Error(`Provider with id "${o.id}" already registered`);this.providers.push(o);}findProvider(o){for(let t of this.providers)if(t.match(o).matches)return t;return null}getProviders(){return [...this.providers]}},p=new d;function at(e){p.register(e);}function ct(e){return p.findProvider(e)}function ut(){return p.getProviders()}var u=new Map;function k(e){if(u.has(e.id))throw new Error(`PluginSource with id "${e.id}" already registered`);u.set(e.id,e);}function S(){return Array.from(u.values()).map(e=>e)}function P(e){return u.get(e)??null}function y(e){return Array.from(u.values()).filter(o=>o.category===e)}async function x(){let e=S();return await Promise.all(e.map(async t=>{try{let r=await t.fetch();return {sourceId:t.id,entries:r}}catch(r){return {sourceId:t.id,error:r instanceof Error?r:new Error(String(r))}}}))}function pt(e){return {name:e.name,description:e.description,scope:"all"}}function h(e){return {id:e.id??`well-known:${new URL(e.url).hostname}`,category:"well-known",async fetch(){return (await n.fetchAllSkills(e.url)).map(r=>({id:r.name,name:r.name,description:r.description,location:r.sourceUrl,category:"well-known",metadata:{installName:r.installName,sourceIdentifier:n.getSourceIdentifier(e.url),sourceUrl:r.sourceUrl}}))},async load(t){let l=(await n.fetchAllSkills(e.url)).find(n=>n.name===t.id);if(!l)throw new Error(`Skill "${t.id}" not found in well-known source ${e.url}`);return {skills:[pt(l)],version:"well-known",author:{name:new URL(e.url).hostname}}}}}async function A(e){try{let t=await(await import('fs/promises')).readFile(e,"utf-8");return JSON.parse(t)}catch{return null}}function w(e){let o=e.basePath.split(/[\\/]/).filter(Boolean).pop()??"local";return {id:e.id??`local:${o}`,category:"file",async fetch(){let r=[],l=await A(join(e.basePath,".claude-plugin/plugin.json"));l?.name&&r.push({id:l.name,name:l.name,description:l.description,location:e.basePath,category:"file",metadata:{skills:l.skills,manifest:"plugin.json"}});let n=await A(join(e.basePath,".claude-plugin/marketplace.json"));if(n?.plugins)for(let i of n.plugins)i.name&&(typeof i.source!="string"&&i.source!==void 0||r.push({id:i.name,name:i.name,description:i.description,location:i.source?join(e.basePath,n.metadata?.pluginRoot??"",i.source):e.basePath,category:"file",metadata:{skills:i.skills,manifest:"marketplace.json",pluginRoot:n.metadata?.pluginRoot}}));return r},async load(r){return {skills:(await B(r.location)).map(i=>({name:i.name,description:i.description,scope:"all"})),version:"local",author:{name:o}}}}}export{w as createLocalPluginSource,h as createWellKnownSource,ct as findProvider,P as findSource,y as findSourcesByCategory,ut as getProviders,x as listAllEntries,S as listSources,at as registerProvider,k as registerSource,p as registry};
1
+ export{c as applyActions,d as buildMatrix,G as buildUsePrompt,f as detectAgent,h as getAgentName,i as getAgentType,M as handleSkillsCli,k as hasProjectSkills,o as initTelemetry,g as isRunningInAgent,J as launchAgentInteractively,m as matchesSkillFilter,H as materializeUseSkill,q as parseAddOptions,x as parseFindOptions,A as parseListOptions,D as parseRemoveOptions,r as parseStoreOptions,j as parseUpdateOptions,F as parseUseOptions,b as planActions,a as probeCell,C as removeCommand,K as renderBanner,L as renderHelp,l as resolveUpdateScope,p as runAdd,E as runDoctor,z as runFind,B as runList,e as runPostInstallReconcile,s as runStore,u as runStoreClean,t as runStoreList,w as runStoreRemove,v as runStoreUpdate,n as runUpdate,I as runUse,y as searchSkillsAPI}from'./chunks/chunk-J6PRUXFG.mjs';export{c as fetchAuditData,e as flushTelemetry,a as setDetectedAgent,b as setVersion,d as track}from'./chunks/chunk-CFMOYU7R.mjs';export{r as addSkillToLock,n as computeContentHash,y as dismissPrompt,q as fetchSkillFolderHash,u as getAllLockedSkills,p as getGitHubToken,t as getSkillFromLock,k as getSkillLockPath,v as getSkillsBySource,w as isPromptDismissed,l as readSkillLock,s as removeSkillFromLock,o as resetGhAuthWarning,m as writeSkillLock}from'./chunks/chunk-NH4TYEPW.mjs';import'./chunks/chunk-5BDDXFOF.mjs';export{a as AGENTS_DIR,b as SKILLS_SUBDIR,c as UNIVERSAL_SKILLS_DIR,g as getAgentBaseDir,o as getCanonicalPath,e as getCanonicalSkillsDir,f as getEveSubagentSkillsDir,m as getInstallPath,r as installBlobSkillForAgent,p as installRemoteSkillForAgent,h as installSkillForAgent,q as installWellKnownSkillForAgent,k as isSkillInstalled,s as listInstalledSkills,d as sanitizeName}from'./chunks/chunk-AQYRRXU5.mjs';import {n,A as A$1}from'./chunks/chunk-6NTEYECA.mjs';export{f as DEFAULT_CLONE_TIMEOUT,g as GitCloneError,m as WellKnownProvider,Q as acquireSourceClone,v as addSkillToLocalLock,ja as cleanCache,ia as cleanCachedRepo,l as cleanupTempDir,k as cloneRepo,A as discoverSkills,ca as ensureCachedSource,C as filterSkills,P as getCacheRepoDir,N as getCacheRoot,r as getLocalLockPath,a as getOwnerRepo,B as getSkillDisplayName,I as getSourceDir,ha as installFromCache,i as isGitHubHttpsCloneUrl,j as isGitHubSsoAuthError,c as isRepoPrivate,z as isSubpathSafe,h as parseGitHubRepoUrl,b as parseOwnerRepo,y as parseSkillMd,e as parseSource,t as readLocalLock,w as removeSkillFromLocalLock,d as sanitizeSubpath,x as shouldInstallInternalSkills,n as wellKnownProvider,u as writeLocalLock}from'./chunks/chunk-6NTEYECA.mjs';export{e as EVE_SUBAGENTS_DIR,j as PROJECT_SKILLS_DIR_PATTERN,b as agents,c as detectInstalledAgents,d as getAgentConfig,l as getAgentGlobalSkillDirs,n as getAgentProjectSkillContainerPrefixes,k as getAgentProjectSkillDirs,m as getAgentSkillDirs,f as getEveSubagents,i as getNonUniversalAgents,a as getOpenClawGlobalSkillsDir,h as getUniversalAgents,o as isUniversalAgent,g as matchesUniversalScope}from'./chunks/chunk-ML6B4IQL.mjs';export{h as getAgentAdapter,c as getGlobal,k as getHomeDir,f as getInstance,p as getProjectDirectory,o as getXdgCache,l as getXdgConfig,m as getXdgData,n as getXdgState,i as hasAgentAdapter,j as requireAgentAdapter,b as resetGlobalAdapter,e as resetInstanceAdapter,g as setAgentAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-RWZ4LFSN.mjs';export{c as BLOB_ALLOWED_REPOS,g as fetchRepoTree,k as findSkillMdPaths,i as getSkillFolderHashFromTree,f as resetRepoTreeAuthState,b as sanitizeMetadata,a as stripTerminalEscapes,e as toSkillSlug,l as tryBlobInstall}from'./chunks/chunk-ZJS7IO5V.mjs';export{b as computeFromDir,c as computeSnapshotHash,a as parseFrontmatter}from'./chunks/chunk-ZYDDQV73.mjs';import {b}from'./chunks/chunk-WQGSYA5D.mjs';import {join}from'path';var d=class{constructor(){b(this,"providers",[]);}register(o){if(this.providers.some(t=>t.id===o.id))throw new Error(`Provider with id "${o.id}" already registered`);this.providers.push(o);}findProvider(o){for(let t of this.providers)if(t.match(o).matches)return t;return null}getProviders(){return [...this.providers]}},p=new d;function ct(e){p.register(e);}function ut(e){return p.findProvider(e)}function pt(){return p.getProviders()}var u=new Map;function k(e){if(u.has(e.id))throw new Error(`PluginSource with id "${e.id}" already registered`);u.set(e.id,e);}function S(){return Array.from(u.values()).map(e=>e)}function P(e){return u.get(e)??null}function y(e){return Array.from(u.values()).filter(o=>o.category===e)}async function x(){let e=S();return await Promise.all(e.map(async t=>{try{let r=await t.fetch();return {sourceId:t.id,entries:r}}catch(r){return {sourceId:t.id,error:r instanceof Error?r:new Error(String(r))}}}))}function gt(e){return {name:e.name,description:e.description,scope:"all"}}function h(e){return {id:e.id??`well-known:${new URL(e.url).hostname}`,category:"well-known",async fetch(){return (await n.fetchAllSkills(e.url)).map(r=>({id:r.name,name:r.name,description:r.description,location:r.sourceUrl,category:"well-known",metadata:{installName:r.installName,sourceIdentifier:n.getSourceIdentifier(e.url),sourceUrl:r.sourceUrl}}))},async load(t){let l=(await n.fetchAllSkills(e.url)).find(n=>n.name===t.id);if(!l)throw new Error(`Skill "${t.id}" not found in well-known source ${e.url}`);return {skills:[gt(l)],version:"well-known",author:{name:new URL(e.url).hostname}}}}}async function A(e){try{let t=await(await import('fs/promises')).readFile(e,"utf-8");return JSON.parse(t)}catch{return null}}function w(e){let o=e.basePath.split(/[\\/]/).filter(Boolean).pop()??"local";return {id:e.id??`local:${o}`,category:"file",async fetch(){let r=[],l=await A(join(e.basePath,".claude-plugin/plugin.json"));l?.name&&r.push({id:l.name,name:l.name,description:l.description,location:e.basePath,category:"file",metadata:{skills:l.skills,manifest:"plugin.json"}});let n=await A(join(e.basePath,".claude-plugin/marketplace.json"));if(n?.plugins)for(let i of n.plugins)i.name&&(typeof i.source!="string"&&i.source!==void 0||r.push({id:i.name,name:i.name,description:i.description,location:i.source?join(e.basePath,n.metadata?.pluginRoot??"",i.source):e.basePath,category:"file",metadata:{skills:i.skills,manifest:"marketplace.json",pluginRoot:n.metadata?.pluginRoot}}));return r},async load(r){return {skills:(await A$1(r.location)).map(i=>({name:i.name,description:i.description,scope:"all"})),version:"local",author:{name:o}}}}}export{w as createLocalPluginSource,h as createWellKnownSource,ut as findProvider,P as findSource,y as findSourcesByCategory,pt as getProviders,x as listAllEntries,S as listSources,ct as registerProvider,k as registerSource,p as registry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easbot/skills",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Skills management system for EAS Agent ecosystem (add / remove / list / find / update / sync / use)",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -47,16 +47,14 @@
47
47
  "LICENSE"
48
48
  ],
49
49
  "dependencies": {
50
- "@vercel/detect-agent": "^1.2.3",
51
- "@clack/prompts": "^1.7.0",
52
- "picocolors": "^1.1.1",
53
50
  "simple-git": "^3.36.0",
54
51
  "xdg-basedir": "^5.1.0",
55
52
  "yaml": "^2.9.0",
56
53
  "zod": "^4.4.3",
57
- "@easbot/utils": "0.3.12",
58
- "@easbot/types": "0.3.12",
59
- "@easbot/mcp": "0.3.12"
54
+ "@easbot/types": "0.3.14",
55
+ "@easbot/utils": "0.3.14",
56
+ "@easbot/mcp": "0.3.14",
57
+ "@easbot/terminal": "0.3.14"
60
58
  },
61
59
  "devDependencies": {
62
60
  "@types/node": "^25.6.2",
@@ -1 +0,0 @@
1
- 'use strict';var chunkTCFGU43L_cjs=require('./chunk-TCFGU43L.cjs');require('./chunk-XGUPIAAF.cjs'),require('./chunk-VRHWDHQV.cjs');Object.defineProperty(exports,"BLOB_ALLOWED_OWNERS",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.x}});Object.defineProperty(exports,"BLOB_ALLOWED_REPOS",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.w}});Object.defineProperty(exports,"fetchRepoTree",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.A}});Object.defineProperty(exports,"findSkillMdPaths",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.C}});Object.defineProperty(exports,"getSkillFolderHashFromTree",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.B}});Object.defineProperty(exports,"resetRepoTreeAuthState",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.z}});Object.defineProperty(exports,"toSkillSlug",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.y}});Object.defineProperty(exports,"tryBlobInstall",{enumerable:true,get:function(){return chunkTCFGU43L_cjs.D}});
@@ -1 +0,0 @@
1
- export{x as BLOB_ALLOWED_OWNERS,w as BLOB_ALLOWED_REPOS,A as fetchRepoTree,C as findSkillMdPaths,B as getSkillFolderHashFromTree,z as resetRepoTreeAuthState,y as toSkillSlug,D as tryBlobInstall}from'./chunk-6PJ3YQA7.mjs';import'./chunk-RWZ4LFSN.mjs';import'./chunk-WQGSYA5D.mjs';
@@ -1,22 +0,0 @@
1
- import {c,b as b$1,n}from'./chunk-6PJ3YQA7.mjs';import {p,m,o}from'./chunk-RWZ4LFSN.mjs';import {b}from'./chunk-WQGSYA5D.mjs';import {rm,mkdtemp,readFile,rename,mkdir,writeFile,rmdir,cp,readdir,stat}from'fs/promises';import {dirname,join,normalize,resolve,sep,basename,relative,isAbsolute}from'path';import {createHash}from'crypto';import {existsSync}from'fs';import fe from'simple-git';import {Filesystem,Glob,Wildcard}from'@easbot/utils';import {tmpdir}from'os';import {execFile}from'child_process';import {promisify}from'util';import {gunzipSync,inflateRawSync}from'zlib';var U=6;function ce(n){let t=n.indexOf(":");return t<0||t===n.length-1?null:{marketId:n.slice(0,t),pluginSlug:n.slice(t+1)}}function ue(n){let t=ce(n);return t?`plugins/${t.pluginSlug}`:null}function St(n,t,e){if(!n.marketId||!n.pluginId)return null;let r=ue(n.pluginId);return r?`${t.replace(/\\/g,"/").replace(/\/+$/,"")}/${n.marketId}/${r}/${e}`:null}var Pt=3e5,Z=(()=>{let n=process.env.SKILLS_CLONE_TIMEOUT;if(!n)return Pt;let t=Number.parseInt(n,10);return Number.isFinite(t)&&t>0?t:Pt})(),bt=promisify(execFile),L=class extends Error{constructor(e,r,i=false,s=false){super(e);b(this,"url");b(this,"isTimeout");b(this,"isAuthError");this.name="GitCloneError",this.url=r,this.isTimeout=i,this.isAuthError=s;}};function Se(n){let t=n.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/i);if(t){let e=t[1],r=t[2];return {owner:e,repo:r,slug:`${e}/${r}`,sshUrl:`git@github.com:${e}/${r}.git`}}try{let e=new URL(n);if(e.hostname!=="github.com")return null;let r=e.pathname.match(/^\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/);if(!r)return null;let i=r[1],s=r[2];return {owner:i,repo:s,slug:`${i}/${s}`,sshUrl:`git@github.com:${i}/${s}.git`}}catch{return null}}function xe(n){try{let t=new URL(n);return t.protocol==="https:"&&t.hostname==="github.com"}catch{return false}}function It(n){let t=n.toLowerCase();return t.includes("saml sso")||t.includes("enforced sso")||t.includes("enabled or enforced saml")||t.includes("re-authorize the oauth application")}function Ee(n){return n.includes("Authentication failed")||n.includes("could not read Username")||n.includes("Permission denied")||n.includes("Repository not found")||n.includes("requested URL returned error: 403")||It(n)}function J(n){let t={...process.env};return delete t.GIT_ASKPASS,delete t.GIT_EDITOR,delete t.GIT_SEQUENCE_EDITOR,delete t.GIT_PAGER,delete t.GIT_SSH_COMMAND,delete t.GIT_CONFIG_GLOBAL,delete t.GIT_CONFIG_SYSTEM,delete t.PAGER,delete t.EDITOR,delete t.VISUAL,t.GIT_TERMINAL_PROMPT="0",t.GIT_LFS_SKIP_SMUDGE="1",Object.assign(t,n),fe({timeout:{block:Z},config:["filter.lfs.required=false","protocol.version=2","remote.origin.promisor=false"]}).env(t)}async function Lt(n){try{await rm(n,{recursive:!0,force:!0});}catch{}await mkdir(n,{recursive:true});}async function Pe(n,t,e){let r=n.slug;try{let{stdout:s,stderr:o}=await bt("gh",["auth","status","-h","github.com"],{timeout:5e3,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),l=`${s}${o}`;/Git operations protocol:\s+ssh/i.test(l)&&(r=n.sshUrl);}catch{return false}return await bt("gh",["repo","clone",r,t,"--",...e?["--depth=1","--branch",e]:["--depth=1"]],{timeout:Z,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),true}function be(n,t,e){return t&&It(e)?`GitHub blocked HTTPS access to ${n} because the organization enforces SAML SSO.
2
- skills tried your existing git credentials and available fallbacks, but none succeeded.
3
- - Re-authorize your GitHub credentials/app for that org's SSO policy
4
- - Or rerun with SSH: easbot skills add ${t.sshUrl}
5
- - Verify access with: gh auth status -h github.com or ssh -T git@github.com`:t?`Authentication failed for ${n}.
6
- - For private repos, ensure you have access
7
- - Retry with SSH: easbot skills add ${t.sshUrl}
8
- - Check access with: gh auth status -h github.com or ssh -T git@github.com`:`Authentication failed for ${n}.
9
- - For private repos, ensure you have access
10
- - For SSH: Check your keys with 'ssh -T git@github.com'
11
- - For HTTPS: Run 'gh auth login' or configure git credentials`}async function $t(n,t,e){if(e){await Filesystem.mkdir(dirname(e),{recursive:true});let o=t?["--depth","1","--branch",t]:["--depth","1"];try{return await J().clone(n,e,o),e}catch(l){throw await rm(e,{recursive:true,force:true}).catch(()=>{}),l}}let r=await mkdtemp(join(tmpdir(),"skills-")),i=t?["--depth","1","--branch",t]:["--depth","1"],s=Se(n);try{return await J().clone(n,r,i),r}catch(o){let l=o instanceof Error?o.message:String(o),a=l.includes("block timeout")||l.includes("timed out"),c=Ee(l);if(a){try{await rm(r,{recursive:!0,force:!0});}catch{}let f=Math.round(Z/1e3);throw new L(`Clone timed out after ${f}s. Common causes:
12
- - Large repository: raise the timeout with SKILLS_CLONE_TIMEOUT=600000 (10m)
13
- - Slow network: retry, or clone manually and pass the local path to 'skills add'
14
- - Private repo without credentials: ensure auth is configured
15
- - For SSH: ssh-add -l (to check loaded keys)
16
- - For HTTPS: gh auth status (if using GitHub CLI)`,n,true,false)}if(c&&s&&xe(n)){try{if(await Lt(r),await Pe(s,r,t))return r}catch{}try{return await Lt(r),await J({GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND??"ssh -o BatchMode=yes"}).clone(s.sshUrl,r,i),r}catch{}}try{await rm(r,{recursive:!0,force:!0});}catch{}if(c)throw new L(be(n,s,l),n,false,true);let u=l.includes("filter.smudge")?`
17
- - The repo defines a smudge/clean filter that Git considers unsafe.
18
- Enable it with: git config --global protocol.allowUnsafeFilter true
19
- Or upgrade Git, or unset filter.<driver>.* in the source repo.`:"";throw new L(`Failed to clone ${n}: ${l}${u}`,n,false,false)}}async function In(n){let t=normalize(resolve(n)),e=normalize(resolve(tmpdir()));if(!t.startsWith(e+sep)&&t!==e)throw new Error("Attempted to clean up directory outside of temp directory");await rm(n,{recursive:true,force:true});}function Q(n){if(n.type==="local")return null;let t=n.url.match(/^git@[^:]+:(.+)$/);if(t){let e=t[1];return e=e.replace(/\.git$/,""),e.includes("/")?e:null}if(n.url.startsWith("ssh://"))try{let r=new URL(n.url).pathname.slice(1);return r=r.replace(/\.git$/,""),r.includes("/")?r:null}catch{return null}if(!n.url.startsWith("http://")&&!n.url.startsWith("https://"))return null;try{let r=new URL(n.url).pathname.slice(1);if(r=r.replace(/\.git$/,""),r.includes("/"))return r}catch{}return null}function Kn(n){let t=n.match(/^([^/]+)\/([^/]+)$/);return t?{owner:t[1],repo:t[2]}:null}async function Un(n,t){try{let e=await fetch(`https://api.github.com/repos/${n}/${t}`);return e.ok?(await e.json()).private===!0:null}catch{return null}}async function Wt(n,t){try{let e=await fetch(`https://api.github.com/repos/${n}/${t}`,{headers:{Accept:"application/vnd.github+json"}});if(!e.ok)return null;let r=await e.json();return typeof r.default_branch=="string"&&r.default_branch.length>0?r.default_branch:null}catch{return null}}function O(n){let e=n.replace(/\\/g,"/").split("/");for(let r of e)if(r==="..")throw new Error(`Unsafe subpath: "${n}" contains path traversal segments. Subpaths must not contain ".." components.`);return n}function Ie(n){return isAbsolute(n)||n.startsWith("./")||n.startsWith("../")||n==="."||n===".."||/^[a-zA-Z]:[/\\]/.test(n)}var $e={"coinbase/agentWallet":"coinbase/agentic-wallet-skills"};function Y(n){try{return decodeURIComponent(n)}catch{return n}}function Ae(n){if(n.startsWith("github:")||n.startsWith("gitlab:")||n.startsWith("git@")||/^ssh:\/\/.+\.git(?:$|[/?])/i.test(n))return true;if(n.startsWith("http://")||n.startsWith("https://"))try{let t=new URL(n),e=t.pathname;if(t.hostname==="github.com")return /^\/[^/]+\/[^/]+(?:\.git)?(?:\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(e);if(t.hostname==="gitlab.com")return /^\/.+?\/[^/]+(?:\.git)?(?:\/-\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(e)}catch{}return /^https?:\/\/.+\.git(?:$|[/?])/i.test(n)?true:!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")&&/^([^/]+)\/([^/]+)(?:\/(.+)|@(.+))?$/.test(n)}function Re(n){let t=n.indexOf("#");if(t<0)return {inputWithoutFragment:n};let e=n.slice(0,t),r=n.slice(t+1);if(!r)return {inputWithoutFragment:e};if(!Ae(e))return {inputWithoutFragment:n};let i=r.indexOf("@");if(i===-1)return {inputWithoutFragment:e,ref:Y(r)};let s=r.slice(0,i),o=r.slice(i+1);return {inputWithoutFragment:e,ref:s?Y(s):void 0,subpath:o?Y(o):void 0}}function At(n,t,e){return t?`${n}#${t}${e?`@${e}`:""}`:n}function Rt(n){if(Ie(n)){let g=resolve(n);return {type:"local",url:g,localPath:g}}let{inputWithoutFragment:t,ref:e,subpath:r}=Re(n);n=t;let i=$e[n];i&&(n=i);let s=n.match(/^github:(.+)$/);if(s)return Rt(At(s[1],e,r));let o=n.match(/^gitlab:(.+)$/);if(o)return Rt(At(`https://gitlab.com/${o[1]}`,e,r));let l=n.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);if(l){let[,g,m,w,S]=l;return {type:"github",url:`https://github.com/${g}/${m}.git`,ref:w||e,subpath:S&&O(S)}}let a=n.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)$/);if(a){let[,g,m,w]=a;return {type:"github",url:`https://github.com/${g}/${m}.git`,ref:w||e}}let c=n.match(/github\.com\/([^/]+)\/([^/]+)/);if(c){let[,g,m]=c,w=m.replace(/\.git$/,"");return {type:"github",url:`https://github.com/${g}/${w}.git`,...e?{ref:e}:{}}}let u=n.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)\/(.+)/);if(u){let[,g,m,w,S,p]=u;if(m!=="github.com"&&w)return {type:"gitlab",url:`${g}://${m}/${w.replace(/\.git$/,"")}.git`,ref:S||e,subpath:p&&O(p)}}let f=n.match(/^(https?):\/\/([^/]+)\/(.+?)\/-\/tree\/([^/]+)$/);if(f){let[,g,m,w,S]=f;if(m!=="github.com"&&w)return {type:"gitlab",url:`${g}://${m}/${w.replace(/\.git$/,"")}.git`,ref:S||e}}let k=n.match(/gitlab\.com\/(.+?)(?:\.git)?\/?$/);if(k){let g=k[1];if(g.includes("/"))return {type:"gitlab",url:`https://gitlab.com/${g}.git`,...e?{ref:e}:{}}}let E=n.match(/^([^/@]+)\/([^/@]+)@(.+)?$/);if(E&&!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")){let g=E[1],m=E[2],w=E[3];if(!w)return {type:"github",url:`https://github.com/${g}/${m}.git`,...e?{ref:e}:{}};let S=O(w);return {type:"github",url:`https://github.com/${g}/${m}.git`,...e?{ref:e}:{},...S?{subpath:S}:{}}}let P=n.match(/^([^/@]+)\/([^/@]+)(?:\/(.+?))?\/?$/);if(P&&!n.includes(":")&&!n.startsWith(".")&&!n.startsWith("/")){let[,g,m,w]=P;return {type:"github",url:`https://github.com/${g}/${m}.git`,...e?{ref:e}:{},subpath:r??(w&&O(w))}}return We(n)?{type:"well-known",url:n}:{type:"git",url:n,...e?{ref:e}:{},...r?{subpath:r}:{}}}function We(n){if(!n.startsWith("http://")&&!n.startsWith("https://"))return false;try{let t=new URL(n);return !(["github.com","gitlab.com","raw.githubusercontent.com"].includes(t.hostname)||n.endsWith(".git"))}catch{return false}}var Kt="https://schemas.agentskills.io/discovery/0.2.0/schema.json",De=/\/schemas\/agent-skills\/index\.v1\.json$/,Fe=50*1024*1024,Ce=1e3;function Te(n,t){let e=n.skillPath;if(typeof e=="string"&&e.trim()!==""&&e!==null)return e.replace(/^\/+/,"").replace(/\/+$/,"");if(typeof n.sourceUrl=="string"&&n.sourceUrl)try{let i=new URL(n.sourceUrl).pathname,s=/\/\.well-known\/(?:agent-skills|skills)\/(.*?)\/SKILL\.md$/,o=i.match(s);if(o?.[1])return o[1];let l=i.match(/^(.*?)\/[^/]+\/SKILL\.md$/);if(l?.[1])return l[1]}catch{}if(typeof n.installName=="string"&&n.installName){let r=n.installName.lastIndexOf("@");if(r>=0){let i=n.installName.slice(r+1);if(i.includes("/"))return i.replace(/^\/+/,"")}}return t}var tt=class{constructor(){b(this,"id","well-known");b(this,"displayName","Well-Known Skills");b(this,"WELL_KNOWN_PATHS",[".well-known/agent-skills",".well-known/skills"]);b(this,"INDEX_FILE","index.json");}match(t){if(!t.startsWith("http://")&&!t.startsWith("https://"))return {matches:false};try{let e=new URL(t);return ["github.com","gitlab.com","huggingface.co"].includes(e.hostname)?{matches:!1}:{matches:!0,sourceIdentifier:`wellknown/${e.hostname}`}}catch{return {matches:false}}}async fetchIndex(t){return (await this.fetchIndexCandidates(t))[0]??null}async fetchIndexCandidates(t){try{let e=new URL(t),r=e.pathname.replace(/\/$/,""),i=[],s=r.match(/\/\.well-known\/(agent-skills|skills)\/?$/);if(s?.[1]){let l=`.well-known/${s[1]}`;i.push({indexUrl:`${e.protocol}//${e.host}${r}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}${r.replace(/\/\.well-known\/(?:agent-skills|skills)$/,"")}`,wellKnownPath:l});}for(let l of this.WELL_KNOWN_PATHS)i.push({indexUrl:`${e.protocol}//${e.host}${r}/${l}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}${r}`,wellKnownPath:l}),r&&r!==""&&i.push({indexUrl:`${e.protocol}//${e.host}/${l}/${this.INDEX_FILE}`,baseUrl:`${e.protocol}//${e.host}`,wellKnownPath:l});let o=[];for(let{indexUrl:l,baseUrl:a,wellKnownPath:c}of i)try{let u=await fetch(l);if(!u.ok)continue;let f=await u.json(),k=this.normalizeIndex(f,l,c);if(!k)continue;o.push({index:k.index,entries:k.entries,resolvedBaseUrl:a,resolvedWellKnownPath:c,indexUrl:l});}catch{}return o}catch{return []}}normalizeIndex(t,e,r){if(!t||typeof t!="object")return null;let i=t;if(!Array.isArray(i.skills))return null;let s=i.$schema;if(s===Kt){let a=[],c=[];for(let u of i.skills){if(!this.isValidSkillEntryV2(u))continue;let f=new URL(u.url,e).toString();a.push({version:"0.2.0",name:u.name,description:u.description,type:u.type,artifactUrl:f,digest:u.digest,indexEntry:u}),c.push(u);}return a.length===0?null:{index:{$schema:Kt,skills:c},entries:a}}if(typeof s=="string"&&De.test(s)){let a=[],c=[];for(let u of i.skills){if(!this.isValidSkillEntryEasbotV1(u))continue;let f=new URL(u.sourceUrl,e).toString();a.push({version:"easbot-v1",name:u.name,description:u.description,skillMdUrl:f,installName:u.installName,indexEntry:u}),c.push(u);}return a.length===0?null:{index:{$schema:s,skills:c},entries:a}}if(s!==void 0)return null;let o=[],l=[];for(let a of i.skills){if(!this.isValidSkillEntryV1(a))return null;o.push(a),l.push({version:"0.1.0",name:a.name,description:a.description,files:a.files,baseUrl:this.getLegacySkillBaseUrl(e,r),wellKnownPath:r,indexEntry:a});}return {index:{skills:o},entries:l}}getLegacySkillBaseUrl(t,e){let r=new URL(t),i=`/${e}/${this.INDEX_FILE}`;return `${r.protocol}//${r.host}${r.pathname.slice(0,-i.length)}`}isValidSkillName(t){return !(typeof t!="string"||t.length===0||t.length>64||!/^[a-z0-9-]+$/.test(t)||t.startsWith("-")||t.endsWith("-")||t.includes("--"))}isSafeLegacyFilePath(t){return !(typeof t!="string"||t.length===0||t.startsWith("/")||t.startsWith("\\")||t.includes("..")||t.includes("\0"))}isValidSkillEntryEasbotV1(t){if(!t||typeof t!="object")return false;let e=t;if(!this.isValidSkillName(e.name)||typeof e.description!="string"||!e.description||e.description.length>1024||typeof e.sourceUrl!="string"||!e.sourceUrl)return false;try{new URL(e.sourceUrl,"https://easbot.cn/.well-known/agent-skills/index.json");}catch{return false}return true}isValidSkillEntryV1(t){if(!t||typeof t!="object")return false;let e=t;if(!this.isValidSkillName(e.name)||typeof e.description!="string"||!e.description||!Array.isArray(e.files)||e.files.length===0)return false;for(let i of e.files)if(!this.isSafeLegacyFilePath(i))return false;return e.files.some(i=>typeof i=="string"&&i.toLowerCase()==="skill.md")}isValidSkillEntryV2(t){if(!t||typeof t!="object")return false;let e=t;if(!this.isValidSkillName(e.name)||typeof e.description!="string"||!e.description||e.description.length>1024||e.type!=="skill-md"&&e.type!=="archive"||typeof e.url!="string"||!e.url||typeof e.digest!="string"||!/^sha256:[a-f0-9]{64}$/.test(e.digest))return false;try{new URL(e.url,"https://example.com/.well-known/agent-skills/index.json");}catch{return false}return true}async fetchSkill(t){try{let e=new URL(t),r=await this.fetchIndexCandidates(t);for(let i of r){let{entries:s}=i,o=null,l=e.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(l?.[1]&&l[1]!=="index.json"?o=l[1]:s.length===1&&(o=s[0].name),!o)continue;let a=s.find(u=>u.name===o);if(!a)continue;let c=await this.fetchSkillByEntry(a);if(c)return c}return null}catch{return null}}async fetchSkillByEntry(t,e,r){return typeof t=="string"?e?this.fetchLegacySkillByEntry({version:"0.1.0",name:e.name,description:e.description,files:e.files,baseUrl:t,wellKnownPath:r??this.WELL_KNOWN_PATHS[0],indexEntry:e}):null:t.version==="0.1.0"?this.fetchLegacySkillByEntry(t):t.version==="easbot-v1"?this.fetchEasbotV1SkillByEntry(t):this.fetchArtifactSkillByEntry(t)}async fetchEasbotV1SkillByEntry(t){try{let e=await fetch(t.skillMdUrl);if(!e.ok)return null;let r=await e.text(),{data:i}=c(r);if(typeof i.name!="string"||typeof i.description!="string")return null;let s=new Map;s.set("SKILL.md",r);let o=Te(t.indexEntry,i.name);return this.createSkill({name:i.name,description:i.description,content:r,installName:o,sourceUrl:t.skillMdUrl,metadata:i.metadata,files:s,indexEntry:t.indexEntry})}catch{return null}}async fetchLegacySkillByEntry(t){try{let e=`${t.baseUrl.replace(/\/$/,"")}/${t.wellKnownPath}/${t.name}`,r=`${e}/SKILL.md`,i=await fetch(r);if(!i.ok)return null;let s=await i.text(),{data:o}=c(s);if(typeof o.name!="string"||typeof o.description!="string")return null;let l=new Map;l.set("SKILL.md",s);let c$1=t.files.filter(f=>f.toLowerCase()!=="skill.md").map(async f=>{try{let k=`${e}/${f}`,E=await fetch(k);if(E.ok){let P=await E.arrayBuffer();return {path:f,content:new Uint8Array(P)}}}catch{}return null}),u=await Promise.all(c$1);for(let f of u)f&&l.set(f.path,f.content);return this.createSkill({name:o.name,description:o.description,content:s,installName:t.name,sourceUrl:r,metadata:o.metadata,files:l,indexEntry:t.indexEntry})}catch{return null}}async fetchArtifactSkillByEntry(t){try{let e=await fetch(t.artifactUrl);if(!e.ok)return null;let r=e.headers.get("content-type")??"",i=new Uint8Array(await e.arrayBuffer());if(this.computeDigest(i)!==t.digest)return null;if(t.type==="skill-md"){let c$1=new TextDecoder().decode(i),{data:u}=c(c$1);if(typeof u.name!="string"||typeof u.description!="string")return null;let f=new Map;return f.set("SKILL.md",c$1),this.createSkill({name:u.name,description:u.description,content:c$1,installName:t.name,sourceUrl:t.artifactUrl,metadata:u.metadata,files:f,indexEntry:t.indexEntry})}let s=this.extractArchive(i,t.artifactUrl,r),o=s.get("SKILL.md");if(!o)return null;let l=typeof o=="string"?o:new TextDecoder().decode(o);s.set("SKILL.md",l);let{data:a}=c(l);return typeof a.name!="string"||typeof a.description!="string"?null:this.createSkill({name:a.name,description:a.description,content:l,installName:t.name,sourceUrl:t.artifactUrl,metadata:a.metadata,files:s,indexEntry:t.indexEntry})}catch{return null}}createSkill(t){return {name:b$1(t.name),description:b$1(t.description),content:t.content,installName:t.installName,sourceUrl:t.sourceUrl,metadata:t.metadata&&typeof t.metadata=="object"?t.metadata:void 0,files:t.files,indexEntry:t.indexEntry}}async fetchAllSkills(t){try{let e=await this.fetchIndexCandidates(t);for(let r of e){let i=r.entries.map(l=>this.fetchSkillByEntry(l)),o=(await Promise.all(i)).filter(l=>l!==null);if(o.length>0)return o}return []}catch{return []}}computeDigest(t){return `sha256:${createHash("sha256").update(t).digest("hex")}`}extractArchive(t,e,r){if(this.isZipArchive(t,e,r))return this.extractZip(t);if(this.isTarGzArchive(t,e,r))return this.extractTarGz(t);throw new Error("Unsupported archive format")}isZipArchive(t,e,r){return r.includes("application/zip")||e.toLowerCase().endsWith(".zip")||t[0]===80&&t[1]===75}isTarGzArchive(t,e,r){let i=e.toLowerCase();return r.includes("application/gzip")||r.includes("application/x-gzip")||i.endsWith(".tar.gz")||i.endsWith(".tgz")||t[0]===31&&t[1]===139}normalizeArchivePath(t){if(!t||t.includes("\0")||t.startsWith("/")||t.startsWith("\\")||/^[A-Za-z]:/.test(t)||t.includes("\\"))return null;let e=t.split("/").filter(Boolean);return e.length===0||e.some(r=>r==="."||r==="..")?null:e.join("/")}addArchiveFile(t,e,r,i){let s=this.normalizeArchivePath(e);if(!s)throw new Error(`Unsafe archive path: ${e}`);if(i.bytes+=r.byteLength,i.bytes>Fe)throw new Error("Archive exceeds maximum unpacked size");if(t.size>=Ce)throw new Error("Archive contains too many files");t.set(s,r);}extractTarGz(t){let e=gunzipSync(Buffer.from(t)),r=new Map,i={bytes:0},s=0;for(;s+512<=e.length;){let o=e.subarray(s,s+512);if(o.every(P=>P===0))break;let l=this.readTarString(o,0,100),a=this.readTarString(o,124,12).trim(),c=o[156],u=this.readTarString(o,345,155),f=u?`${u}/${l}`:l,k=Number.parseInt(a||"0",8);if(!Number.isFinite(k)||k<0)throw new Error("Invalid tar entry size");if(s+=512,c===50||c===49)throw new Error("Archive links are not supported");if(c===0||c===48){let P=e.subarray(s,s+k);this.addArchiveFile(r,f,new Uint8Array(P),i);}s+=Math.ceil(k/512)*512;}if(!r.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return r}readTarString(t,e,r){let i=t.subarray(e,e+r),s=i.indexOf(0);return new TextDecoder().decode(s>=0?i.subarray(0,s):i)}extractZip(t){let e=Buffer.from(t),r=this.findZipEndOfCentralDirectory(e);if(r<0)throw new Error("Invalid zip archive");let i=e.readUInt16LE(r+10),s=e.readUInt32LE(r+16),o=new Map,l={bytes:0},a=s;for(let c=0;c<i;c++){if(e.readUInt32LE(a)!==33639248)throw new Error("Invalid zip directory");let u=e.readUInt16LE(a+8),f=e.readUInt16LE(a+10),k=e.readUInt32LE(a+20),E=e.readUInt32LE(a+24),P=e.readUInt16LE(a+28),g=e.readUInt16LE(a+30),m=e.readUInt16LE(a+32),w=e.readUInt32LE(a+38),S=e.readUInt32LE(a+42),p=a+46,y=e.subarray(p,p+P),x=new TextDecoder(u&2048?"utf-8":void 0).decode(y);if(a=p+P+g+m,x.endsWith("/"))continue;if(u&1)throw new Error("Encrypted zip entries are not supported");let M=w>>>16&61440;if(M===40960||M===4096)throw new Error("Archive links are not supported");if(e.readUInt32LE(S)!==67324752)throw new Error("Invalid zip local header");let z=e.readUInt16LE(S+26),ae=e.readUInt16LE(S+28),ht=S+30+z+ae,mt=e.subarray(ht,ht+k),_;if(f===0)_=mt;else if(f===8)_=inflateRawSync(mt);else throw new Error(`Unsupported zip compression method: ${f}`);if(_.byteLength!==E)throw new Error("Zip entry size mismatch");this.addArchiveFile(o,x,new Uint8Array(_),l);}if(!o.has("SKILL.md"))throw new Error("Archive missing root SKILL.md");return o}findZipEndOfCentralDirectory(t){let e=Math.max(0,t.length-65535-22);for(let r=t.length-22;r>=e;r--)if(t.readUInt32LE(r)===101010256)return r;return -1}toRawUrl(t){try{let e=new URL(t);if(t.toLowerCase().endsWith("/skill.md"))return t;let r=this.WELL_KNOWN_PATHS[0],i=e.pathname.match(/\/.well-known\/(?:agent-skills|skills)\/([^/]+)\/?$/);if(i?.[1]){let o=e.pathname.replace(/\/.well-known\/(?:agent-skills|skills)\/.*$/,"");return `${e.protocol}//${e.host}${o}/${r}/${i[1]}/SKILL.md`}let s=e.pathname.replace(/\/$/,"");return `${e.protocol}//${e.host}${s}/${r}/${this.INDEX_FILE}`}catch{return t}}getSourceIdentifier(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return "unknown"}}async hasSkillsIndex(t){return await this.fetchIndex(t)!==null}},Ut=new tt;function et(n,t){let e=normalize(resolve(t)),r=normalize(resolve(n));return r.startsWith(e+sep)||r===e}function j(n){return n.startsWith("./")}async function Ft(n){let t=new Map;try{let e=await readFile(join(n,".claude-plugin/marketplace.json"),"utf-8"),r=JSON.parse(e),i=r.metadata?.pluginRoot;if(i===void 0||j(i))for(let o of r.plugins??[]){if(!o.name||typeof o.source!="string"&&o.source!==void 0||o.source!==void 0&&!j(o.source))continue;let l=join(n,i??"",o.source??"");if(et(l,n)&&o.skills&&o.skills.length>0)for(let a of o.skills){if(!j(a))continue;let c=join(l,a);et(c,n)&&t.set(resolve(c),o.name);}}}catch{}try{let e=await readFile(join(n,".claude-plugin/plugin.json"),"utf-8"),r=JSON.parse(e);if(r.name&&r.skills&&r.skills.length>0)for(let i of r.skills){if(!j(i))continue;let s=join(n,i);et(s,n)&&t.set(resolve(s),r.name);}}catch{}return t}var je=["node_modules",".git","dist","build","__pycache__"];async function He(n){let t=join(n,".gitignore");try{let e=await readFile(t,"utf-8");return Glob.parseGitignoreContent(e)}catch{return []}}function nt(n){return n.toLowerCase().replace(/[\s_]+/g,"-")}function Ve(n){return n.split(sep).join("/").replace(/\/+/g,"/")}function Ge(){let n=process.env.INSTALL_INTERNAL_SKILLS;return n==="1"||n==="true"}async function jt(n){try{let t=join(n,"SKILL.md");return (await stat(t)).isFile()}catch{return false}}async function Tt(n,t){try{let e=await readFile(n,"utf-8"),{data:r}=c(e);if(!r.name||!r.description||typeof r.name!="string"||typeof r.description!="string")return null;let i=r.metadata&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:void 0;return i?.internal===!0&&!Ge()&&!t?.includeInternal?null:{name:b$1(r.name),description:b$1(r.description),path:dirname(n),rawContent:e,metadata:i}}catch{return null}}async function Ht(n,t=0,e=5){if(t>e)return [];try{let[r,i]=await Promise.all([jt(n),readdir(n,{withFileTypes:!0}).catch(()=>[])]),s=r?[n]:[],o=await Promise.all(i.filter(l=>l.isDirectory()&&!je.includes(l.name)).map(l=>Ht(join(n,l.name),t+1,e)));return [...s,...o.flat()]}catch{return []}}function Be(n,t){let e=normalize(resolve(n)),r=normalize(resolve(join(n,t)));return r.startsWith(e+sep)||r===e}async function st(n$1,t,e){let r=[],i=new Set,s=await G(n$1),o=new Set(Object.keys(s.skills).map(nt));if(t&&!Be(n$1,t))throw new Error(`Invalid subpath: "${t}" resolves outside the repository directory. Subpath must not contain ".." segments that escape the base path.`);let l=t?join(n$1,t):n$1,a=await Ft(l),c=p=>{let y=resolve(p.path);return a.has(y)&&(p.pluginName=a.get(y)),p},u=n(),f=p=>{if(o.size===0)return false;let y=Ve(relative(n$1,p.path));if(!u.some(z=>y===z||y.startsWith(`${z}/`)))return false;let pt=nt(p.name),M=nt(basename(p.path));return o.has(pt)||o.has(M)},k=async p=>{if(!await jt(p))return false;let y=await Tt(join(p,"SKILL.md"),e);return !y||i.has(y.name)||f(y)||(y=c(y),r.push(y),i.add(y.name)),true},E=t?t.replace(/^\/+|\/+$/g,"").split("/").filter(p=>p.length>0):[],P=E.length>0?`**/${E.join("/")}/**/SKILL.md`:"**/SKILL.md",g=await Glob.scan(P,{cwd:l,absolute:true,ignore:[...Glob.DEFAULT_IGNORE_PATTERNS,...await He(l)]}),m="/",w=l.split(sep).join(m);g.sort((p,y)=>p.split(m).length-y.split(m).length);let S=[];for(let p of g){if(S.some(x=>p.startsWith(`${x}${m}`)||p===x))continue;let y=dirname(p);if(await k(y)){let x=y.split(sep).join(m);if(x===w)continue;S.push(x);}}if(r.length===0||e?.fullDepth){let p=await Ht(l);for(let y of p){let x=await Tt(join(y,"SKILL.md"),e);x&&!i.has(x.name)&&!f(x)&&(x=c(x),r.push(x),i.add(x.name));}}return r}function qe(n){return n.name||basename(n.path)}function nr(n,t){let e=t.map(r=>r.toLowerCase());return n.filter(r=>{let i=r.name.toLowerCase(),s=qe(r).toLowerCase();return e.some(o=>o===i||o===s)})}var Vt="*";function rr(n,t){if(!n||n.length===0)return [];let e=new Set(t),r=[];for(let i of n)if(i!==Vt){if(i.includes("/")||i.includes("**")){r.push(i);continue}Gt.test(i)?t.some(s=>Wildcard.match(s,i))||r.push(i):e.has(i)||r.push(i);}return r}function ir(n,t){let e={wildcard:false,matched:[],invalid:[]};if(!n||n.length===0)return e;let r=new Set(t),i=new Set;for(let s of n){if(s===Vt){e.wildcard=true;continue}if(s.includes("/")||s.includes("**")){e.invalid.push(s);continue}if(Gt.test(s))for(let o of t)Wildcard.match(o,s)&&i.add(o);else r.has(s)?i.add(s):e.invalid.push(s);}return e.matched=Array.from(i),e}var Gt=/[*?[{}]/;var ot="houjallen/agent-skills";async function xr(n){let t=n.defaultPlugin;if(!t||typeof t.marketId!="string"||t.marketId.length===0)return ot;let e=n.markets[t.marketId];if(!e)return ot;let r=e.localPath??e.url;if(!r)return ot;let i=r;return e.subpath&&(i=`${i}@${e.subpath}`),e.ref&&(i=`${i}#${e.ref}`),i}function tn(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let t=n;if(typeof t.marketId!="string"||t.marketId.length===0)return null;let e={marketId:t.marketId};return typeof t.pluginId=="string"&&t.pluginId.length>0&&(e.pluginId=t.pluginId),e}function h(n){return Filesystem.normalize(n)}function qt(n){if(n==="general"||n==="coder"||n==="all")return n}function en({scope:n}){let t=n==="project"?p():m(),e=Filesystem.join(t,n==="project"?".easbot":"easbot","skills");return Filesystem.normalize(e)}function T(){return Filesystem.join(m(),"skills","store")}function Yt(){return Filesystem.join(T(),"index.json")}function ct(n){let t=`${n.type}|${n.url}|${n.ref??""}`;return createHash("sha256").update(t).digest("hex")}function Qt(n){let t=ct(n);return Filesystem.join(T(),t)}function D(){return Filesystem.join(o(),"skills","cache")}function nn(n,t,e){if(e&&e.length>0)return N(e);let r=rn(n);if(r)return r;if(t?.includes("/")){let i=t.split("/")[0];if(i)return N(i)}return "default"}function rn(n){let t=n.localPath??n.url;if(!t)return null;if(n.type==="well-known")try{let i=new URL(t),s=i.hostname.replace(/^www\./,"").replace(/\./g,"-"),o=i.pathname.replace(/^\/+/,"").split("/")[0]||"";return o&&!s.endsWith(`-${o}`)?N(`${s}-${o}`):N(s)}catch{return null}let e=t.match(/^(?:https?:\/\/[^/]+\/|git@[^:]+:)([^/]+)\/([^/]+?)(?:\.git)?\/?$/);if(e)return N(e[2]??"");let r=t.split(/[\\/]/).filter(Boolean).pop();return r?N(r.replace(/\.git$/,"")):null}function N(n){let t=n.trim().replace(/[:\\/\0]/g,"-").replace(/\.git$/,"").replace(/\s+/g,"-");return t.length>64&&(t=t.slice(0,64)),t.length>0?t:"default"}function dt(n){if(n.type==="well-known")return sn(n.url);let t=Q(n);if(t)return Filesystem.join(D(),n.type,t);let e=n.url.replace(/^https?:\/\//,"").replace(/^git@[^:]+:/,"").replace(/\.git$/,"").replace(/[/:]/g,"-");return Filesystem.join(D(),n.type,e)}function sn(n){let t,e;try{let r=new URL(n);t=r.hostname.replace(/^www\./,"");let i=r.pathname.match(/\/\.well-known\/(agent-skills|skills)/);i?.[1]?e=`.well-known/${i[1]}`:e=".well-known/agent-skills";}catch{let r=createHash("sha256").update(n).digest("hex").slice(0,16);return Filesystem.join(D(),"wellknown",`unknown-${r}`)}return Filesystem.join(D(),"wellknown",t,e)}async function te(n){n.skillNames??[];if(n.type==="local")return on(n);let e=n.mode??"install",{cacheDir:r,source:i,cloneError:s}=await ln(n,e);return {tempDir:r,cacheHit:false,source:i,cloneError:s}}var ut=class extends Error{constructor(e){super(`Local source path does not exist: ${e}`);b(this,"localPath",e);this.name="LocalPathNotFoundError";}};async function on(n,t){let e=n.localPath??n.url;if(!existsSync(e))throw new ut(e);let r=Qt(n);return existsSync(r)&&await ee(r)?{tempDir:r,cacheHit:true,source:"local-cp",cloneError:null}:{tempDir:e,cacheHit:false,source:"local-cp",cloneError:null}}async function ln(n,t){let e=n.ref;if(!e){let l=Q(n);if(l){let[a,c]=l.split("/");if(a&&c){let u=await Wt(a,c);u&&(e=u);}}}e||(e="HEAD");let r=dt(n);if(n.type==="well-known")return existsSync(r)?{cacheDir:r,source:"cache-pull",cloneError:null}:(await Filesystem.mkdir(h(r),{recursive:true}),await fn(n.url,r),{cacheDir:r,source:"well-known-fetch",cloneError:null});if(existsSync(r))try{let l=fe(r);return t==="update"?(await l.fetch(),await l.checkout(e),{cacheDir:r,source:"cache-pull",cloneError:null}):(await l.checkout(e),{cacheDir:r,source:"cache-pull",cloneError:null})}catch{return {cacheDir:r,source:"cache-pull",cloneError:null}}async function i(l,a,c){return $t(l,a,c)}let s=null,o=null;try{return await Filesystem.mkdir(h(Filesystem.dirname(r)),{recursive:!0}),s=`${r}.clone-tmp`,await i(n.url,e,s),await rename(h(s),h(r)),{cacheDir:r,source:"cache-clone",cloneError:null}}catch(l){return l instanceof L?o=l:l instanceof Error&&(o=new L(`Failed to clone ${n.url}: ${l.message}`,n.url,false,false)),await Filesystem.mkdir(h(r),{recursive:true}).catch(()=>{}),{cacheDir:r,source:"cache-pull",cloneError:o}}finally{if(s)try{await rm(h(s),{recursive:!0,force:!0});}catch{}}}async function W(){let n=h(Yt()),t;try{t=await Filesystem.readText(n);}catch{return {version:6,markets:{}}}let e;try{e=JSON.parse(t);}catch{try{await rename(h(n),`${h(n)}.corrupt-${Date.now()}`);}catch{}return {version:6,markets:{}}}let r=e;if(r.version!==6||!r.markets)return {version:6,markets:{}};let i={version:6,markets:r.markets};if("defaultPlugin"in r){let s=tn(r.defaultPlugin);s&&(i.defaultPlugin=s);}return i}async function q(n){await Filesystem.writeJson(h(Yt()),n);}async function Er(){let n=await W(),t={};for(let e of Object.values(n.markets))for(let r of Object.values(e.plugins))for(let[i,s]of Object.entries(r.skills))t[i]={marketId:e.id,pluginId:r.id,pluginName:r.name,storePath:e.storePath,pluginSlug:r.id.split(":").slice(1).join(":")||r.id,url:e.url,type:e.type,localPath:e.localPath,subpath:e.subpath,ref:e.ref,addedAt:e.addedAt,skillPath:s.skillPath,computedHash:s.computedHash,sourceKey:e.id,sourcePath:e.localPath??e.storePath};return t}async function Pr(n,t,e,r,i){let s=await W(),o=s.markets[n];o||(o={...i,id:n,addedAt:i.addedAt??new Date().toISOString(),plugins:{}},s.markets[n]=o);let l=o.plugins[t];l||(l={id:t,name:t.split(":").slice(1).join(":")||t,skills:{}},o.plugins[t]=l),l.skills[e]=r,await q(s);}async function an(){let n=await W(),t=[];for(let e of Object.values(n.markets))for(let r of Object.values(e.plugins))for(let i of Object.values(r.skills))t.push({skillName:i.name,marketId:e.id,pluginId:r.id,entry:i});return t.sort((e,r)=>{let i=e.marketId.localeCompare(r.marketId);if(i!==0)return i;let s=e.pluginId.localeCompare(r.pluginId);return s!==0?s:e.skillName.localeCompare(r.skillName)}),t}async function cn(n){return (await an()).filter(e=>e.skillName===n)}async function br(n,t,e){let i=(await W()).markets[n];if(!i)return;let s=i.plugins[t];if(!s)return;let o=s.skills[e];if(o)return {skillName:o.name,marketId:n,pluginId:t,entry:o}}async function Lr(n,t,e){let r=await W(),i=r.markets[n];if(!i)return false;let s=i.plugins[t];return !s||!(e in s.skills)?false:(delete s.skills[e],await q(r),true)}async function un(n){let t=await cn(n);if(t.length===0)return [];let e=await W(),r=[];for(let i of t){let s=e.markets[i.marketId]?.plugins[i.pluginId];s&&n in s.skills&&(delete s.skills[n],r.push(i));}return r.length>0&&await q(e),r}async function vr(n,t,e,r,i,s,o){await ft([{skillName:n,parsed:t,sourceKey:e,sourcePath:r,storePath:i,skillPath:s,...o&&{computedHash:o}}]);}async function ft(n){if(n.length===0)return;let t=await W(),e=new Date().toISOString();for(let r of n){let i=r.sourceKey,s=nn(r.parsed,r.skillPath,r.pluginName),o=`${i}:${s}`,l=t.markets[i];if(!l){let u=r.parsed.type==="local"?r.parsed.localPath??r.parsed.url:dt(r.parsed);l={id:i,type:r.parsed.type,url:r.parsed.url,localPath:r.parsed.localPath,subpath:r.parsed.subpath,ref:r.parsed.ref,storePath:r.storePath,cachePath:u,addedAt:e,plugins:{}},t.markets[i]=l;}let a=l.plugins[o];a||(a={id:o,name:s,sourcePath:r.parsed.subpath,skills:{}},l.plugins[o]=a);let c={name:r.skillName,description:r.description??"",skillPath:r.skillPath,computedHash:r.computedHash};r.scope&&(c.scope=r.scope),a.skills[r.skillName]=c;}await q(t);}async function Ir(n){return (await un(n)).length>0}async function fn(n,t){let e;try{e=await Ut.fetchAllSkills(n);}catch{return}if(e.length!==0)for(let r of e)try{await dn(r,t);}catch{}}async function dn(n,t){let e=Filesystem.join(t,n.installName),r=Filesystem.normalize(e),i=Filesystem.normalize(t);if(!r.startsWith(`${i}/`)&&r!==i)throw new Error(`Unsafe skill dir: ${n.installName}`);await mkdir(h(e),{recursive:true});for(let[s,o]of n.files){let l=Filesystem.join(e,s),a=Filesystem.normalize(l);if(!a.startsWith(`${r}/`)&&a!==r||s.includes("\0"))continue;let c=dirname(h(l));c!==h(e)&&await mkdir(c,{recursive:true}),await writeFile(h(l),typeof o=="string"?o:Buffer.from(o));}}async function $r(n){return (await te({type:"git",url:n.url,ref:n.ref})).tempDir}async function Ar(n,t={}){let e=Qt(n),r=false;if(existsSync(e)&&(r=await ee(e),!r))try{await rmdir(h(e));}catch{}if(r){let a=await st(e,void 0,{includeInternal:t.includeInternal,fullDepth:t.fullDepth});if(a.length>0){let u=await Promise.all(a.map(async f=>{let k=lt(e,f.path);return {skillName:f.name,parsed:n,sourceKey:ct(n),sourcePath:e,storePath:e,skillPath:k,description:f.description,scope:qt(f.metadata?.scope),...f.pluginName&&{pluginName:f.pluginName},computedHash:await at(f.path)}}));await ft(u);}let c=n.type==="local"?"local-cp":"cache-pull";return {storeDir:e,cacheHit:true,source:c,skills:a,blobSkills:[],cloneError:null}}let i=await te(n);await Filesystem.mkdir(h(e),{recursive:true}).catch(()=>{});let s=await st(i.tempDir,void 0,{includeInternal:t.includeInternal,fullDepth:t.fullDepth}),o=[],l=Filesystem.normalize(e).replace(/\\/g,"/");for(let a of s){let c=lt(i.tempDir,a.path),u=Filesystem.join(e,c),f=`${lt(i.tempDir,a.path)}/SKILL.md`,k=Filesystem.normalize(u).replace(/\\/g,"/"),E="/",P=l.endsWith(E)?l:l+E;if(!k.startsWith(P)&&k!==l)throw new Error(`[INVARIANT 0048-yyy] cp target escapes storeRoot: target=${k} storeRoot=${l}
20
- source skill path=${a.path} (parsed.type=${n.type})
21
- \u4E1A\u52A1\u4EFB\u4F55\u65F6\u5019\u4E0D\u80FD\u64CD\u4F5C\u7528\u6237\u7684 local \u76EE\u5F55\u6216\u6587\u4EF6\u3002`);let g;try{await Filesystem.mkdir(h(Filesystem.dirname(u)),{recursive:!0}),await cp(h(a.path),h(u),{recursive:!0}),g=await at(u);}catch{}a.path=u,o.push({skill:a,skillRel:c,sourceSkillPath:f,targetPath:u,computedHash:g});}if(o.length>0){let a=o.filter(c=>c.computedHash).map(c=>({skillName:c.skill.name,parsed:n,sourceKey:ct(n),sourcePath:i.tempDir,storePath:e,skillPath:c.skillRel,description:c.skill.description,scope:qt(c.skill.metadata?.scope),...c.skill.pluginName&&{pluginName:c.skill.pluginName},computedHash:c.computedHash}));await ft(a);}return {storeDir:e,cacheHit:i.cacheHit,source:i.source,skills:s,blobSkills:[],cloneError:i.cloneError??null}}function lt(n,t){let r=Filesystem.normalize(n).replace(/\\/g,"/"),i=Filesystem.normalize(t).replace(/\\/g,"/"),s=r.toLowerCase();return i.toLowerCase().startsWith(`${s}/`)?i.slice(s.length+1):""}async function ee(n){try{return (await readdir(h(n))).length>0}catch{return false}}function Rr(n){try{let t=Filesystem.normalize(n);for(let e of [D(),T()]){let r=Filesystem.normalize(e);if(t===r||t.startsWith(`${r}/`))return !0}return !1}catch{return false}}async function Wr({cachePath:n,skillName:t,scope:e}){let r=Filesystem.join(en({scope:e}),t);return existsSync(r)&&await rm(h(r),{recursive:true,force:true}),await cp(h(n),h(r),{recursive:true}),r}async function Kr(n){let t=dt(n);existsSync(t)&&await rm(h(t),{recursive:true,force:true});}async function Ur(){let n=D();existsSync(n)&&await rm(h(n),{recursive:true,force:true});}var kn="skills-lock.json",ie=4;function se(n){return join(n||process.cwd(),kn)}function Or(n,t){return n?St(n,T(),t):null}async function G(n){let t=se(n);try{let e=await readFile(t,"utf-8"),r=JSON.parse(e);return typeof r.version!="number"||!r.skills||r.version<ie?gt():r}catch{return gt()}}async function oe(n,t){let e=se(t),r={};for(let o of Object.keys(n.skills).sort())r[o]=n.skills[o];let i={version:n.version,skills:r},s=JSON.stringify(i,null,2)+`
22
- `;await writeFile(e,s,"utf-8");}async function at(n){let t=[];await le(n,n,t),t.sort((r,i)=>r.relativePath.localeCompare(i.relativePath));let e=createHash("sha256");for(let r of t)e.update(r.relativePath),e.update(r.content);return e.digest("hex")}async function le(n,t,e){let r=await readdir(t,{withFileTypes:true});await Promise.all(r.map(async i=>{let s=join(t,i.name);if(i.isDirectory()){if(i.name===".git"||i.name==="node_modules")return;await le(n,s,e);}else if(i.isFile()){let o=await readFile(s),l=relative(n,s).split("\\").join("/");e.push({relativePath:l,content:o});}}));}async function jr(n,t,e){let r=await G(e),i=new Date().toISOString(),s=r.skills[n];r.skills[n]={...t,installedAt:s?.installedAt??i,updatedAt:i},await oe(r,e);}async function Hr(n,t){let e=await G(t);return n in e.skills?(delete e.skills[n],await oe(e,t),true):false}function gt(){return {version:ie,skills:{}}}export{un as $,Be as A,st as B,qe as C,nr as D,rr as E,ir as F,ot as G,xr as H,tn as I,en as J,T as K,Yt as L,ct as M,Qt as N,D as O,nn as P,dt as Q,te as R,ut as S,W as T,q as U,Er as V,Pr as W,an as X,cn as Y,br as Z,Lr as _,Q as a,vr as aa,Kn as b,ft as ba,Un as c,Ir as ca,O as d,$r as da,Rt as e,Ar as ea,Pt as f,lt as fa,L as g,ee as ga,Se as h,Rr as ha,xe as i,Wr as ia,It as j,Kr as ja,$t as k,Ur as ka,In as l,tt as m,Ut as n,U as o,St as p,ie as q,se as r,Or as s,G as t,oe as u,at as v,jr as w,Hr as x,Ge as y,Tt as z};
@@ -1,3 +0,0 @@
1
- import {p,K as K$1}from'./chunk-2YVJ7YP6.mjs';import {m as m$1}from'./chunk-RWZ4LFSN.mjs';import {readFile,mkdir,writeFile}from'fs/promises';import {join,dirname}from'path';import {createHash}from'crypto';import {execSync}from'child_process';import n from'picocolors';var x=".skill-lock.json",d=6;function m(){return join(m$1(),"skills",x)}async function o(){let t=m();return await E(t)??F()}async function E(t){try{let i=await readFile(t,"utf-8"),e=JSON.parse(i);return typeof e.version!="number"||!e.skills||e.version<d?null:e}catch{return null}}async function c(t){let i=m();await mkdir(dirname(i),{recursive:true});let e=JSON.stringify(t,null,2);await writeFile(i,e,"utf-8");}function _(t){return createHash("sha256").update(t,"utf-8").digest("hex")}var l=false;function D(){l=false;}function $(){if(process.env.GITHUB_TOKEN)return process.env.GITHUB_TOKEN;if(process.env.GH_TOKEN)return process.env.GH_TOKEN;l||(process.stderr.write(`${n.yellow("\u2502")} ${n.yellow("GitHub rate limit reached")} \u2014 using your ${n.cyan("gh")} login to continue.
2
- ${n.yellow("\u2502")} ${n.dim(`Tip: set ${n.cyan("GITHUB_TOKEN")} to avoid this prompt, or use ${n.cyan("--full-depth")} to clone instead.
3
- `)}`),l=true);try{let t=execSync("gh auth token",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t}catch{}return null}async function K(t,i,e,r){let{fetchRepoTree:s,getSkillFolderHashFromTree:f}=await import('./blob-JSMTOYEN.mjs'),a=await s(t,r,e??void 0);return a?f(a,i):null}async function B(t,i){let e=await o(),r=new Date().toISOString(),s=e.skills[t];e.skills[t]={...i,installedAt:s?.installedAt??r,updatedAt:r},await c(e);}async function U(t){let i=await o();return t in i.skills?(delete i.skills[t],await c(i),true):false}async function j(t){return (await o()).skills[t]??null}async function C(){return (await o()).skills}async function J(){let t=await o(),i=new Map;for(let[e,r]of Object.entries(t.skills)){let s=i.get(r.source);s?s.skills.push(e):i.set(r.source,{skills:[e],entry:r});}return i}function F(){return {version:d,skills:{},dismissed:{}}}async function M(t){return (await o()).dismissed?.[t]===true}function W(t,i){return t?p(t,K$1(),i):null}async function V(t){let i=await o();i.dismissed||(i.dismissed={}),i.dismissed[t]=true,await c(i);}export{d as a,m as b,o as c,c as d,_ as e,D as f,$ as g,K as h,B as i,U as j,j as k,C as l,J as m,M as n,W as o,V as p};
@@ -1,5 +0,0 @@
1
- import {v}from'./chunk-2YVJ7YP6.mjs';import {h,r,e,f,c}from'./chunk-6PJ3YQA7.mjs';import {k,p,q}from'./chunk-RWZ4LFSN.mjs';import {mkdir,readdir,writeFile,readFile,cp,lstat,access,rm,realpath,readlink,symlink}from'fs/promises';import {existsSync}from'fs';import {join,basename,dirname,normalize,resolve,sep,relative,extname}from'path';import {homedir,platform}from'os';var V=".agents",X="skills",Se=".agents/skills";async function ge(t){try{return await v(t)}catch{return}}async function G(t,e,a,r,n={}){if(n.expectedMode&&n.agentType){let l=await ne(t,n.agentType,{global:a,cwd:r});if(!l.installed||l.mode!==n.expectedMode)return false}let i=await ge(e);if(!i)return false;let s;if(a){let{readSkillLock:l}=await import('./skill-lock-KHPVP7AD.mjs');s=(await l()).skills[t]?.computedHash;}else {let{readLocalLock:l}=await import('./local-lock-LG5YL33V.mjs');s=(await l(r)).skills[t]?.computedHash;}return s?s===i:false}function P(t){return t.toLowerCase().replace(/[^a-z0-9._]+/g,"-").replace(/^[.-]+|[.-]+$/g,"").substring(0,255)||"unnamed-skill"}function w(t,e){let a=normalize(resolve(t)),r=normalize(resolve(e));return r.startsWith(a+sep)||r===a}function Y(t,e){return w(t,e)||w(e,t)}function N(t,e){let a=t?k()||homedir():e||p()||process.cwd();return join(a,V,X)}function te(t,e){let a=e||p()||process.cwd();return join(a,h,P(t),"skills")}function D(t,e$1,a,r$1){if(r(t,e$1?"global":"project"))return N(e$1,a);if(t==="eve"&&r$1)return te(r$1,a);let n=e[t],i=k()||homedir(),s=e$1?i:a||p()||process.cwd();return e$1?n.globalSkillsDir===void 0?join(s,n.skillsDir):n.globalSkillsDir:join(s,n.skillsDir)}function he(t,e){return resolve(dirname(t),e)}async function S(t){try{await rm(t,{recursive:!0,force:!0});}catch{}await mkdir(t,{recursive:true});}async function j(t,e){try{let a=resolve(t),r=resolve(e),[n,i]=await Promise.all([realpath(a).catch(()=>a),realpath(r).catch(()=>r)]);if(n===i)return !0;let s=q(t),l=q(e);if(s===l)return !0;try{if((await lstat(e)).isSymbolicLink()){let d=await readlink(e);if(he(e,d)===a)return !0;await rm(e);}else await rm(e,{recursive:!0});}catch(k){if(k&&typeof k=="object"&&"code"in k&&k.code==="ELOOP")try{await rm(e,{force:!0});}catch{}}let u=dirname(e);await mkdir(u,{recursive:!0});let h=q(u),g=relative(h,t),f=platform()==="win32"?"junction":void 0;return await symlink(f==="junction"?a:g,e,f),!0}catch{return false}}async function Me(t,e$1,a={}){let r$1=e[e$1],n=a.global??false,i=a.cwd||process.cwd(),s=a.eveSubagent;if(n&&r$1.globalSkillsDir===void 0)return {success:false,path:"",mode:a.mode??"symlink",error:`${r$1.displayName} does not support global skill installation`};let l=t.name||basename(t.path),u=P(l),h=a.mode??"symlink",f=e$1==="eve"&&h==="symlink"?D(e$1,n,i,s):N(n,i),o=join(f,u),k=D(e$1,n,i,s),d=join(k,P(t.name||basename(t.path))),c=q(d),m=q(o);if(!w(f,o))return {success:false,path:d,mode:h,error:"Invalid skill name: potential path traversal detected"};if(!w(k,d))return {success:false,path:d,mode:h,error:"Invalid skill name: potential path traversal detected"};try{if(Y(t.path,c))return {success:!0,path:c,mode:h,skipped:!0};if(h==="copy")return await G(u,t.path,n,i,{expectedMode:"copy",agentType:e$1})&&existsSync(c)?{success:!0,path:c,canonicalPath:m,mode:"copy",skipped:!0,skippedReason:"up-to-date"}:(await S(c),await R(t.path,c,e$1),{success:!0,path:c,canonicalPath:m,mode:"copy"});if(Y(t.path,c))return {success:!0,path:c,canonicalPath:m,mode:"symlink",skipped:!0};if(await G(u,t.path,n,i)&&existsSync(m)||(await S(m),await R(t.path,m,e$1)),!n&&r(e$1,"project"))return {success:!0,path:m,canonicalPath:m,mode:"copy"};if(n&&r(e$1,"global"))return {success:!0,path:m,canonicalPath:m,mode:"symlink"};if(!n){let z=join(i,e[e$1].skillsDir.split("/")[0]);if(!existsSync(z))return {success:!0,path:m,canonicalPath:m,mode:"symlink",skipped:!0}}return o===d?{success:!0,path:d,canonicalPath:o,mode:"copy"}:await j(t.path,c)?{success:!0,path:c,canonicalPath:m,mode:"symlink"}:await G(u,t.path,n,i,{expectedMode:"copy",agentType:e$1})&&existsSync(c)?{success:!0,path:c,canonicalPath:m,mode:"symlink",skipped:!0,skippedReason:"up-to-date"}:(await S(c),await R(t.path,c,e$1),{success:!0,path:c,canonicalPath:m,mode:"symlink",symlinkFailed:!0})}catch(b){return {success:false,path:c,mode:h,error:b instanceof Error?b.message:"Unknown error"}}}async function je(t,e$1,a={}){let{isGlobal:r$1=false,agentType:n,cwd:i,storePath:s}=a,l=q(t),u=q(e$1);if(l===u)return {success:true,path:u,canonicalPath:t,mode:"copy"};if(!r$1&&n&&i&&!r(n,"project")){let f=join(i,e[n].skillsDir.split("/")[0]);if(!existsSync(f))return {success:true,path:e$1,canonicalPath:t,mode:"symlink",skipped:true}}let h=s?q(s):l;return await j(h,u)?{success:true,path:e$1,canonicalPath:t,mode:"symlink"}:{success:true,path:e$1,canonicalPath:t,mode:"symlink",symlinkFailed:true}}async function _e(t,e,a={}){let{agentType:r="easbot"}=a,n=q(t),i=q(e);if(n===i)return {success:true,path:i,canonicalPath:t,mode:"copy"};try{return await S(i),await R(n,i,r),{success:!0,path:i,canonicalPath:t,mode:"copy"}}catch(s){return {success:false,path:e,mode:"copy",error:s instanceof Error?s.message:"Unknown error"}}}var ke=new Set(["metadata.json"]),we=new Set([".git","__pycache__","__pypackages__"]),ye=(t,e=false)=>!!(ke.has(t)||e&&we.has(t));function L(t){let{data:e,content:a}=c(t),r={};if(typeof e.description=="string"&&(r.description=e.description),typeof e.license=="string"&&(r.license=e.license),e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)){let s=Object.fromEntries(Object.entries(e.metadata).filter(l=>typeof l[1]=="string"));Object.keys(s).length>0&&(r.metadata=s);}let n=Object.keys(r);return n.length===0?a.replace(/^\r?\n/u,""):`---
2
- ${n.map(s=>`${s}: ${JSON.stringify(r[s])}`).join(`
3
- `)}
4
- ---
5
- ${a.replace(/^\r?\n/u,"")}`}async function R(t,e,a){await mkdir(e,{recursive:true});let r=await readdir(t,{withFileTypes:true});await Promise.all(r.filter(n=>!ye(n.name,n.isDirectory())).map(async n=>{let i=join(t,n.name),s=join(e,n.name);if(n.isDirectory())await R(i,s,a);else try{if(a==="eve"&&n.name.toLowerCase()==="skill.md"){await writeFile(s,L(await readFile(i,"utf-8")));return}await cp(i,s,{dereference:!0,recursive:!0});}catch(l){if(l instanceof Error&&"code"in l&&l.code==="ENOENT"&&n.isSymbolicLink())console.warn(`Skipping broken symlink: ${i}`);else throw l}}));}function be(t){return t.some(e=>basename(e.path).toLowerCase()==="skill.md")}function U(t){return `${P(t)}.md`}function ve(t){let e=t.find(r=>basename(r.path).toLowerCase()==="skill.md");if(e)return L(e.contents);let a=t.find(r=>extname(r.path).toLowerCase()===".md");return a?L(a.contents):""}async function Ue(t,e,a={}){return (await ne(t,e,a)).installed}async function ne(t,e$1,a={}){let r=e[e$1],n=P(t);if(a.global&&r.globalSkillsDir===void 0)return {installed:false,mode:null,path:""};let i=a.global?r.globalSkillsDir:e$1==="eve"&&a.eveSubagent?te(a.eveSubagent,a.cwd):join(a.cwd||process.cwd(),r.skillsDir),s=join(i,n);if(!w(i,s))return {installed:false,mode:null,path:""};try{let l=await lstat(s);return l.isSymbolicLink()?{installed:!0,mode:"symlink",path:s}:l.isDirectory()?{installed:!0,mode:"copy",path:s}:{installed:!1,mode:null,path:s}}catch{return {installed:false,mode:null,path:s}}}function Be(t,e,a={}){let r=P(t),n=D(e,a.global??false,a.cwd,a.eveSubagent),i=join(n,r);if(!w(n,i))throw new Error("Invalid skill name: potential path traversal detected");return i}async function H(t,e){try{return await access(join(t,"SKILL.md")),{created:!1}}catch{}return await mkdir(t,{recursive:true}),await e(t),{created:true}}function $e(t,e={}){let a=P(t),r=e.agent==="eve"?D("eve",e.global??false,e.cwd,e.eveSubagent):N(e.global??false,e.cwd),n=join(r,a);if(!w(r,n))throw new Error("Invalid skill name: potential path traversal detected");return n}async function ze(t,e$1,a={}){let r$1=e[e$1],n=a.global??false,i=a.cwd||process.cwd(),s=a.mode??"symlink",l=a.eveSubagent;if(n&&r$1.globalSkillsDir===void 0)return {success:false,path:"",mode:s,error:`${r$1.displayName} does not support global skill installation`};let u=P(t.installName),h=e$1==="eve"&&s==="symlink"?D(e$1,n,i,l):N(n,i),g=join(h,u),f=D(e$1,n,i,l),o=join(f,u);if(!w(h,g))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(f,o))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};try{if(s==="copy"){await S(o);let c=e$1==="eve"?U(t.installName):"SKILL.md",m=join(o,c);return await writeFile(m,e$1==="eve"?L(t.content):t.content,"utf-8"),{success:!0,path:o,mode:"copy"}}let k=e$1==="eve"?U(t.installName):"SKILL.md";if(await H(g,async c=>{let m=join(c,k);await writeFile(m,e$1==="eve"?L(t.content):t.content,"utf-8");}),n&&r(e$1,"global"))return {success:!0,path:g,canonicalPath:g,mode:"symlink"};if(!await j(g,o)){await S(o);let c=e$1==="eve"?U(t.installName):"SKILL.md",m=join(o,c);return await writeFile(m,e$1==="eve"?L(t.content):t.content,"utf-8"),{success:!0,path:o,canonicalPath:g,mode:"symlink",symlinkFailed:!0}}return {success:!0,path:o,canonicalPath:g,mode:"symlink"}}catch(k){return {success:false,path:o,mode:s,error:k instanceof Error?k.message:"Unknown error"}}}async function Ke(t,e$1,a={}){let r$1=e[e$1],n=a.global??false,i=a.cwd||process.cwd(),s=a.mode??"symlink",l=a.eveSubagent;if(n&&r$1.globalSkillsDir===void 0)return {success:false,path:"",mode:s,error:`${r$1.displayName} does not support global skill installation`};let u=P(t.installName),h=e$1==="eve"&&s==="symlink"?D(e$1,n,i,l):N(n,i),g=join(h,u),f=D(e$1,n,i,l),o=join(f,u);if(!w(h,g))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(f,o))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};async function k(d){for(let[c,m]of t.files){let b=join(d,c);if(!w(d,b))continue;let $=dirname(b);$!==d&&await mkdir($,{recursive:true}),await writeFile(b,e$1==="eve"&&basename(c).toLowerCase()==="skill.md"&&typeof m=="string"?L(m):m);}}try{return s==="copy"?(await S(o),await k(o),{success:!0,path:o,mode:"copy"}):(await H(g,k),n&&r(e$1,"global")?{success:!0,path:g,canonicalPath:g,mode:"symlink"}:await j(g,o)?{success:!0,path:o,canonicalPath:g,mode:"symlink"}:(await S(o),await k(o),{success:!0,path:o,canonicalPath:g,mode:"symlink",symlinkFailed:!0}))}catch(d){return {success:false,path:o,mode:s,error:d instanceof Error?d.message:"Unknown error"}}}async function Ge(t,e$1,a={}){let r$1=e[e$1],n=a.global??false,i=a.cwd||process.cwd(),s=a.mode??"symlink",l=a.eveSubagent;if(n&&r$1.globalSkillsDir===void 0)return {success:false,path:"",mode:s,error:`${r$1.displayName} does not support global skill installation`};let u=P(t.installName),h=D(e$1,n,i,l);if(e$1==="eve"&&!be(t.files)){let d=join(h,U(t.installName));if(!w(h,d))return {success:false,path:d,mode:s,error:"Invalid skill name: potential path traversal detected"};try{return await mkdir(h,{recursive:!0}),await rm(d,{recursive:!0,force:!0}),await writeFile(d,ve(t.files),"utf-8"),{success:!0,path:d,mode:"copy"}}catch(c){return {success:false,path:d,mode:s,error:c instanceof Error?c.message:"Unknown error"}}}let g=e$1==="eve"&&s==="symlink"?D(e$1,n,i,l):N(n,i),f=join(g,u),o=join(h,u);if(!w(g,f))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};if(!w(h,o))return {success:false,path:o,mode:s,error:"Invalid skill name: potential path traversal detected"};async function k(d){for(let c of t.files){let m=join(d,c.path);if(!w(d,m))continue;let b=dirname(m);b!==d&&await mkdir(b,{recursive:true}),await writeFile(m,e$1==="eve"&&basename(c.path).toLowerCase()==="skill.md"?L(c.contents):c.contents,"utf-8");}}try{if(s==="copy")return await S(o),await k(o),{success:!0,path:o,mode:"copy"};if(await H(f,k),n&&r(e$1,"global"))return {success:!0,path:f,canonicalPath:f,mode:"symlink"};if(!n&&!r(e$1,"project")){let c=join(i,e[e$1].skillsDir.split("/")[0]);if(!existsSync(c))return {success:!0,path:f,canonicalPath:f,mode:"symlink",skipped:!0}}return await j(f,o)?{success:!0,path:o,canonicalPath:f,mode:"symlink"}:(await S(o),await k(o),{success:!0,path:o,canonicalPath:f,mode:"symlink",symlinkFailed:!0})}catch(d){return {success:false,path:o,mode:s,error:d instanceof Error?d.message:"Unknown error"}}}async function He(t={}){let e=t.cwd||process.cwd(),{scanInstalledSkillDirs:a}=await import('./scan-QEVID2TF.mjs'),r=t.agentFilter?null:await f(),n=t.agentFilter??r??void 0,i=await a({scope:t.scope,cwd:e,agentFilter:n}),s=u=>u.replace(/\\/g,"/").replace(/\/[^/]+\/?$/,"").replace(/\/+$/,""),l=new Map;for(let u of i){let h=s(u.skillDir),g=`${u.scope}::${h}::${u.name}`,f=l.get(g);if(f){for(let o of u.agents)f.agents.includes(o)||f.agents.push(o);continue}l.set(g,{name:u.name,description:"",path:u.skillDir,canonicalPath:u.skillDir,scope:u.scope,agents:[...u.agents]});}return Array.from(l.values())}export{V as a,X as b,Se as c,P as d,N as e,te as f,D as g,Me as h,je as i,_e as j,Ue as k,ne as l,Be as m,H as n,$e as o,ze as p,Ke as q,Ge as r,He as s};