uasp-skills 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/bin/skills.js +6 -0
- package/dist/cli/commands/add.d.ts +6 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +81 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +28 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +6 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +39 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +6 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +44 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/search.d.ts +6 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +46 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +26 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/github.d.ts +39 -0
- package/dist/core/github.d.ts.map +1 -0
- package/dist/core/github.js +91 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/installer.d.ts +88 -0
- package/dist/core/installer.d.ts.map +1 -0
- package/dist/core/installer.js +493 -0
- package/dist/core/installer.js.map +1 -0
- package/dist/core/registry.d.ts +26 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +69 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/validator.d.ts +17 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +318 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/registry.d.ts +43 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/registry.js +5 -0
- package/dist/types/registry.js.map +1 -0
- package/dist/types/skill.d.ts +128 -0
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/skill.js +6 -0
- package/dist/types/skill.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub integration for fetching skills
|
|
3
|
+
*/
|
|
4
|
+
import fetch from 'node-fetch';
|
|
5
|
+
import fs from 'fs/promises';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
/**
|
|
8
|
+
* Parse a GitHub URL or local path into components
|
|
9
|
+
* Supports formats:
|
|
10
|
+
* - https://github.com/owner/repo/tree/branch/path
|
|
11
|
+
* - https://github.com/owner/repo/path (assumes main branch)
|
|
12
|
+
* - github:owner/repo/path
|
|
13
|
+
* - file:///absolute/path (local file)
|
|
14
|
+
* - /absolute/path (local file)
|
|
15
|
+
* - ./relative/path (local file)
|
|
16
|
+
*/
|
|
17
|
+
export function parseGitHubUrl(url) {
|
|
18
|
+
// Handle local file paths
|
|
19
|
+
if (url.startsWith('file://') || url.startsWith('/') || url.startsWith('./') || url.startsWith('../')) {
|
|
20
|
+
const localPath = url.startsWith('file://') ? url.slice(7) : url;
|
|
21
|
+
return {
|
|
22
|
+
owner: 'local',
|
|
23
|
+
repo: 'local',
|
|
24
|
+
path: '',
|
|
25
|
+
ref: 'local',
|
|
26
|
+
isLocal: true,
|
|
27
|
+
localPath: path.resolve(localPath),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Handle github: shorthand
|
|
31
|
+
if (url.startsWith('github:')) {
|
|
32
|
+
const parts = url.slice(7).split('/');
|
|
33
|
+
if (parts.length < 2)
|
|
34
|
+
return null;
|
|
35
|
+
const [owner, repo, ...pathParts] = parts;
|
|
36
|
+
return {
|
|
37
|
+
owner,
|
|
38
|
+
repo,
|
|
39
|
+
path: pathParts.join('/') || '',
|
|
40
|
+
ref: 'main',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Handle full GitHub URLs
|
|
44
|
+
const match = url.match(/github\.com\/([^/]+)\/([^/]+)(?:\/tree\/([^/]+))?(?:\/(.*))?/);
|
|
45
|
+
if (!match)
|
|
46
|
+
return null;
|
|
47
|
+
const [, owner, repo, ref = 'main', pathStr = ''] = match;
|
|
48
|
+
return { owner, repo, path: pathStr, ref };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build a raw GitHub URL for fetching file content
|
|
52
|
+
*/
|
|
53
|
+
export function buildRawUrl(source, filePath) {
|
|
54
|
+
const fullPath = source.path ? `${source.path}/${filePath}` : filePath;
|
|
55
|
+
return `https://raw.githubusercontent.com/${source.owner}/${source.repo}/${source.ref}/${fullPath}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Fetch a file from GitHub or local filesystem
|
|
59
|
+
*/
|
|
60
|
+
export async function fetchFromGitHub(source, filePath) {
|
|
61
|
+
// Handle local files
|
|
62
|
+
if (source.isLocal && source.localPath) {
|
|
63
|
+
const fullPath = path.join(source.localPath, filePath);
|
|
64
|
+
try {
|
|
65
|
+
return await fs.readFile(fullPath, 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw new Error(`Failed to read local file ${fullPath}: ${error.message}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Handle remote files
|
|
72
|
+
const url = buildRawUrl(source, filePath);
|
|
73
|
+
const response = await fetch(url);
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
|
76
|
+
}
|
|
77
|
+
return response.text();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fetch the registry.json from a GitHub repository
|
|
81
|
+
*/
|
|
82
|
+
export async function fetchRegistry(source) {
|
|
83
|
+
return fetchFromGitHub(source, 'registry.json');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Fetch a skill file from a GitHub repository
|
|
87
|
+
*/
|
|
88
|
+
export async function fetchSkillFile(source, skillPath) {
|
|
89
|
+
return fetchFromGitHub(source, skillPath);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/core/github.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAWxB;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,0BAA0B;IAC1B,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtG,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACjE,OAAO;YACL,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,OAAO;YACZ,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,IAAI,CAAC,OAAO,C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,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill installation management
|
|
3
|
+
*/
|
|
4
|
+
import type { InstalledSkill, RegistrySkill, SkillsConfig, Skill } from '../types/index.js';
|
|
5
|
+
import { type GitHubSource } from './github.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get the .agent directory path (project-local, new format)
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAgentDir(projectDir?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get the ~/.agents directory path (Claude Code global skills)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getClaudeAgentsDir(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the ~/.agents/skills directory path
|
|
16
|
+
*/
|
|
17
|
+
export declare function getClaudeSkillsDir(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get the ~/.claude directory path
|
|
20
|
+
*/
|
|
21
|
+
export declare function getClaudeDir(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the ~/.claude/skills directory path (symlinks)
|
|
24
|
+
*/
|
|
25
|
+
export declare function getClaudeSymlinksDir(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get the ~/.agents/.skill-lock.json path
|
|
28
|
+
*/
|
|
29
|
+
export declare function getClaudeLockFilePath(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get the skills directory within .agent
|
|
32
|
+
*/
|
|
33
|
+
export declare function getSkillsDir(projectDir?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Convert a UASP skill to Claude Code SKILL.md format
|
|
36
|
+
*/
|
|
37
|
+
export declare function convertToSkillMd(skill: Skill, registrySkill: RegistrySkill): string;
|
|
38
|
+
/**
|
|
39
|
+
* Get the settings.json path
|
|
40
|
+
*/
|
|
41
|
+
export declare function getSettingsPath(projectDir?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Load or create settings.json
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadSettings(projectDir?: string): Promise<SkillsConfig>;
|
|
46
|
+
/**
|
|
47
|
+
* Save settings.json
|
|
48
|
+
*/
|
|
49
|
+
export declare function saveSettings(config: SkillsConfig, projectDir?: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Initialize .agent directory structure
|
|
52
|
+
*/
|
|
53
|
+
export declare function initAgentDir(projectDir?: string): Promise<void>;
|
|
54
|
+
export interface InstallResult {
|
|
55
|
+
success: boolean;
|
|
56
|
+
skill?: InstalledSkill;
|
|
57
|
+
error?: string;
|
|
58
|
+
claudeCodeInstalled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface InstallOptions {
|
|
61
|
+
projectDir?: string;
|
|
62
|
+
claudeCode?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Install a skill from a GitHub registry
|
|
66
|
+
*
|
|
67
|
+
* Installs to:
|
|
68
|
+
* 1. .agent/skills/ (project-local, UASP format)
|
|
69
|
+
* 2. ~/.agents/skills/ (Claude Code compatible, SKILL.md format) - if claudeCode option is true
|
|
70
|
+
*/
|
|
71
|
+
export declare function installSkill(source: GitHubSource, registrySkill: RegistrySkill, options?: InstallOptions): Promise<InstallResult>;
|
|
72
|
+
export interface RemoveOptions {
|
|
73
|
+
projectDir?: string;
|
|
74
|
+
claudeCode?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Remove an installed skill
|
|
78
|
+
*
|
|
79
|
+
* Removes from:
|
|
80
|
+
* 1. .agent/skills/ (project-local)
|
|
81
|
+
* 2. ~/.agents/skills/ (Claude Code) - if claudeCode option is true
|
|
82
|
+
*/
|
|
83
|
+
export declare function removeSkill(skillName: string, options?: RemoveOptions): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* List installed skills
|
|
86
|
+
*/
|
|
87
|
+
export declare function listInstalledSkills(projectDir?: string): Promise<InstalledSkill[]>;
|
|
88
|
+
//# sourceMappingURL=installer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/core/installer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhE;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,GAAE,MAAsB,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,GAAE,MAAsB,GAAG,MAAM,CAEvE;AAmDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM,CA4KnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,MAAsB,GAAG,MAAM,CAE1E;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,UAAU,GAAE,MAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,CAmB5F;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,YAAY,EACpB,UAAU,GAAE,MAAsB,G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