reskill 0.15.0 → 0.16.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/README.md +26 -0
- package/README.zh-CN.md +55 -29
- package/dist/cli/commands/completion.d.ts +13 -0
- package/dist/cli/commands/completion.d.ts.map +1 -0
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/index.js +696 -391
- package/dist/core/cache-manager.d.ts +13 -0
- package/dist/core/cache-manager.d.ts.map +1 -1
- package/dist/core/installer.d.ts +9 -0
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/core/skill-manager.d.ts +8 -0
- package/dist/core/skill-manager.d.ts.map +1 -1
- package/dist/index.js +243 -200
- package/dist/utils/fs.d.ts +6 -0
- package/dist/utils/fs.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -62,6 +62,9 @@ export declare class CacheManager {
|
|
|
62
62
|
}>;
|
|
63
63
|
/**
|
|
64
64
|
* Copy from cache to target directory
|
|
65
|
+
*
|
|
66
|
+
* Uses the same exclude rules as Installer to ensure consistency:
|
|
67
|
+
* - DEFAULT_EXCLUDE_FILES (README.md, metadata.json, .reskill-commit)
|
|
65
68
|
*/
|
|
66
69
|
copyTo(parsed: ParsedSkillRef, version: string, destPath: string): Promise<void>;
|
|
67
70
|
/**
|
|
@@ -79,6 +82,16 @@ export declare class CacheManager {
|
|
|
79
82
|
totalSkills: number;
|
|
80
83
|
registries: string[];
|
|
81
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Get the remote commit hash for a specific ref without cloning
|
|
87
|
+
*
|
|
88
|
+
* Uses `git ls-remote` to fetch the commit hash efficiently.
|
|
89
|
+
*
|
|
90
|
+
* @param repoUrl - Repository URL
|
|
91
|
+
* @param ref - Git reference (branch, tag, or commit)
|
|
92
|
+
* @returns Commit hash string
|
|
93
|
+
*/
|
|
94
|
+
getRemoteCommit(repoUrl: string, ref: string): Promise<string>;
|
|
82
95
|
}
|
|
83
96
|
export default CacheManager;
|
|
84
97
|
//# sourceMappingURL=cache-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../src/core/cache-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../src/core/cache-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAaxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,CAAC,EAAE,MAAM;IAI7B;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;;;OAOG;IACH,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAIlE;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7D;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAK1D;;OAEG;IACG,GAAG,CACP,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAuBnD;;OAEG;IACG,KAAK,CACT,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAyC5C;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtF;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAW1D;;OAEG;IACH,QAAQ,IAAI,IAAI;IAIhB;;OAEG;IACH,QAAQ,IAAI;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE;IA2BzD;;;;;;;;OAQG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAwCrE;AAED,eAAe,YAAY,CAAC"}
|
package/dist/core/installer.d.ts
CHANGED
|
@@ -40,6 +40,15 @@ export interface InstallerOptions {
|
|
|
40
40
|
/** Installation mode */
|
|
41
41
|
mode?: InstallMode;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Default files to exclude when copying skills
|
|
45
|
+
* These files are typically used for repository metadata and should not be copied to agent directories
|
|
46
|
+
*/
|
|
47
|
+
export declare const DEFAULT_EXCLUDE_FILES: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Prefix for files that should be excluded (internal/private files)
|
|
50
|
+
*/
|
|
51
|
+
export declare const EXCLUDE_PREFIX = "_";
|
|
43
52
|
/**
|
|
44
53
|
* Installer class - Multi-Agent installer
|
|
45
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/core/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,gDAAgD;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/core/installer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,gDAAgD;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;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;CAapD;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -68,6 +68,14 @@ export declare class SkillManager {
|
|
|
68
68
|
* Uninstall skill
|
|
69
69
|
*/
|
|
70
70
|
uninstall(name: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Check if a skill needs to be updated by comparing local and remote commits
|
|
73
|
+
*
|
|
74
|
+
* @param name - Skill name
|
|
75
|
+
* @param remoteCommit - Remote commit hash to compare against
|
|
76
|
+
* @returns true if update is needed, false if already up to date
|
|
77
|
+
*/
|
|
78
|
+
checkNeedsUpdate(name: string, remoteCommit: string): boolean;
|
|
71
79
|
/**
|
|
72
80
|
* Update skill
|
|
73
81
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-manager.d.ts","sourceRoot":"","sources":["../../src/core/skill-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAcnF,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAAQ,CAAU;gBAEd,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;IAY/D;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,cAAc,IAAI,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,CAC5B,KAAK,CAAC;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC,CACH;IAwDD;;;;;;OAMG;IACG,eAAe,CACnB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,SAAS,EAAE,EACzB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC;QACT,KAAK,EAAE,cAAc,CAAC;QACtB,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;KACxC,CAAC;IA0FF;;;;;;;OAOG;IACG,sBAAsB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAWpD;;OAEG;IACH,qBAAqB,IAAI,WAAW;IAQpC;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG;QAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;IAenF;;OAEG;IACH,gBAAgB,IAAI,SAAS,EAAE;IAI/B;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC;CAuBtF;AAED,eAAe,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -190,12 +190,13 @@ function remove(targetPath) {
|
|
|
190
190
|
}
|
|
191
191
|
function copyDir(src, dest, options) {
|
|
192
192
|
const exclude = options?.exclude || [];
|
|
193
|
+
const excludePrefix = options?.excludePrefix || '_';
|
|
193
194
|
ensureDir(dest);
|
|
194
195
|
const entries = external_node_fs_.readdirSync(src, {
|
|
195
196
|
withFileTypes: true
|
|
196
197
|
});
|
|
197
198
|
for (const entry of entries){
|
|
198
|
-
if (exclude.includes(entry.name)) continue;
|
|
199
|
+
if (exclude.includes(entry.name) || entry.name.startsWith(excludePrefix)) continue;
|
|
199
200
|
const srcPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(src, entry.name);
|
|
200
201
|
const destPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(dest, entry.name);
|
|
201
202
|
if (entry.isDirectory()) copyDir(srcPath, destPath, options);
|
|
@@ -272,7 +273,7 @@ function sanitizeName(name) {
|
|
|
272
273
|
if (sanitized.length > 255) sanitized = sanitized.substring(0, 255);
|
|
273
274
|
return sanitized;
|
|
274
275
|
}
|
|
275
|
-
const
|
|
276
|
+
const git_execAsync = (0, __WEBPACK_EXTERNAL_MODULE_node_util__.promisify)(__WEBPACK_EXTERNAL_MODULE_node_child_process__.exec);
|
|
276
277
|
class GitCloneError extends Error {
|
|
277
278
|
repoUrl;
|
|
278
279
|
originalError;
|
|
@@ -320,7 +321,7 @@ class GitCloneError extends Error {
|
|
|
320
321
|
}
|
|
321
322
|
}
|
|
322
323
|
async function git(args, cwd) {
|
|
323
|
-
const { stdout } = await
|
|
324
|
+
const { stdout } = await git_execAsync(`git ${args.join(' ')}`, {
|
|
324
325
|
cwd,
|
|
325
326
|
encoding: 'utf-8'
|
|
326
327
|
});
|
|
@@ -454,6 +455,202 @@ function parseGitUrl(url) {
|
|
|
454
455
|
}
|
|
455
456
|
return null;
|
|
456
457
|
}
|
|
458
|
+
const installer_AGENTS_DIR = '.agents';
|
|
459
|
+
const installer_SKILLS_SUBDIR = 'skills';
|
|
460
|
+
const DEFAULT_EXCLUDE_FILES = [
|
|
461
|
+
'README.md',
|
|
462
|
+
'metadata.json',
|
|
463
|
+
'.reskill-commit'
|
|
464
|
+
];
|
|
465
|
+
const EXCLUDE_PREFIX = '_';
|
|
466
|
+
function installer_sanitizeName(name) {
|
|
467
|
+
let sanitized = name.replace(/[/\\:\0]/g, '');
|
|
468
|
+
sanitized = sanitized.replace(/^[.\s]+|[.\s]+$/g, '');
|
|
469
|
+
sanitized = sanitized.replace(/^\.+/, '');
|
|
470
|
+
if (!sanitized || 0 === sanitized.length) sanitized = 'unnamed-skill';
|
|
471
|
+
if (sanitized.length > 255) sanitized = sanitized.substring(0, 255);
|
|
472
|
+
return sanitized;
|
|
473
|
+
}
|
|
474
|
+
function installer_isPathSafe(basePath, targetPath) {
|
|
475
|
+
const normalizedBase = __WEBPACK_EXTERNAL_MODULE_node_path__.normalize(__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(basePath));
|
|
476
|
+
const normalizedTarget = __WEBPACK_EXTERNAL_MODULE_node_path__.normalize(__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(targetPath));
|
|
477
|
+
return normalizedTarget.startsWith(normalizedBase + __WEBPACK_EXTERNAL_MODULE_node_path__.sep) || normalizedTarget === normalizedBase;
|
|
478
|
+
}
|
|
479
|
+
function installer_getCanonicalSkillsDir(isGlobal, cwd) {
|
|
480
|
+
const baseDir = isGlobal ? (0, __WEBPACK_EXTERNAL_MODULE_node_os__.homedir)() : cwd || process.cwd();
|
|
481
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(baseDir, installer_AGENTS_DIR, installer_SKILLS_SUBDIR);
|
|
482
|
+
}
|
|
483
|
+
function installer_ensureDir(dirPath) {
|
|
484
|
+
if (!external_node_fs_.existsSync(dirPath)) external_node_fs_.mkdirSync(dirPath, {
|
|
485
|
+
recursive: true
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function installer_remove(targetPath) {
|
|
489
|
+
if (external_node_fs_.existsSync(targetPath)) external_node_fs_.rmSync(targetPath, {
|
|
490
|
+
recursive: true,
|
|
491
|
+
force: true
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function copyDirectory(src, dest, options) {
|
|
495
|
+
const exclude = new Set(options?.exclude || DEFAULT_EXCLUDE_FILES);
|
|
496
|
+
installer_ensureDir(dest);
|
|
497
|
+
const entries = external_node_fs_.readdirSync(src, {
|
|
498
|
+
withFileTypes: true
|
|
499
|
+
});
|
|
500
|
+
for (const entry of entries){
|
|
501
|
+
if (exclude.has(entry.name) || entry.name.startsWith(EXCLUDE_PREFIX)) continue;
|
|
502
|
+
const srcPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(src, entry.name);
|
|
503
|
+
const destPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(dest, entry.name);
|
|
504
|
+
if (entry.isDirectory()) copyDirectory(srcPath, destPath, options);
|
|
505
|
+
else external_node_fs_.copyFileSync(srcPath, destPath);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
async function installer_createSymlink(target, linkPath) {
|
|
509
|
+
try {
|
|
510
|
+
try {
|
|
511
|
+
const stats = external_node_fs_.lstatSync(linkPath);
|
|
512
|
+
if (stats.isSymbolicLink()) {
|
|
513
|
+
const existingTarget = external_node_fs_.readlinkSync(linkPath);
|
|
514
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(existingTarget) === __WEBPACK_EXTERNAL_MODULE_node_path__.resolve(target)) return true;
|
|
515
|
+
external_node_fs_.rmSync(linkPath);
|
|
516
|
+
} else external_node_fs_.rmSync(linkPath, {
|
|
517
|
+
recursive: true
|
|
518
|
+
});
|
|
519
|
+
} catch (err) {
|
|
520
|
+
if (err && 'object' == typeof err && 'code' in err) {
|
|
521
|
+
if ('ELOOP' === err.code) try {
|
|
522
|
+
external_node_fs_.rmSync(linkPath, {
|
|
523
|
+
force: true
|
|
524
|
+
});
|
|
525
|
+
} catch {}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const linkDir = __WEBPACK_EXTERNAL_MODULE_node_path__.dirname(linkPath);
|
|
529
|
+
installer_ensureDir(linkDir);
|
|
530
|
+
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path__.relative(linkDir, target);
|
|
531
|
+
const symlinkType = 'win32' === (0, __WEBPACK_EXTERNAL_MODULE_node_os__.platform)() ? 'junction' : void 0;
|
|
532
|
+
external_node_fs_.symlinkSync(relativePath, linkPath, symlinkType);
|
|
533
|
+
return true;
|
|
534
|
+
} catch {
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
class Installer {
|
|
539
|
+
cwd;
|
|
540
|
+
isGlobal;
|
|
541
|
+
constructor(options = {}){
|
|
542
|
+
this.cwd = options.cwd || process.cwd();
|
|
543
|
+
this.isGlobal = options.global || false;
|
|
544
|
+
}
|
|
545
|
+
getCanonicalPath(skillName) {
|
|
546
|
+
const sanitized = installer_sanitizeName(skillName);
|
|
547
|
+
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
548
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
549
|
+
}
|
|
550
|
+
getAgentSkillPath(skillName, agentType) {
|
|
551
|
+
const agent = getAgentConfig(agentType);
|
|
552
|
+
const sanitized = installer_sanitizeName(skillName);
|
|
553
|
+
const agentBase = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
554
|
+
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(agentBase, sanitized);
|
|
555
|
+
}
|
|
556
|
+
async installForAgent(sourcePath, skillName, agentType, options = {}) {
|
|
557
|
+
const agent = getAgentConfig(agentType);
|
|
558
|
+
const installMode = options.mode || 'symlink';
|
|
559
|
+
const sanitized = installer_sanitizeName(skillName);
|
|
560
|
+
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
561
|
+
const canonicalDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
562
|
+
const agentBase = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
563
|
+
const agentDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(agentBase, sanitized);
|
|
564
|
+
if (!installer_isPathSafe(canonicalBase, canonicalDir)) return {
|
|
565
|
+
success: false,
|
|
566
|
+
path: agentDir,
|
|
567
|
+
mode: installMode,
|
|
568
|
+
error: 'Invalid skill name: potential path traversal detected'
|
|
569
|
+
};
|
|
570
|
+
if (!installer_isPathSafe(agentBase, agentDir)) return {
|
|
571
|
+
success: false,
|
|
572
|
+
path: agentDir,
|
|
573
|
+
mode: installMode,
|
|
574
|
+
error: 'Invalid skill name: potential path traversal detected'
|
|
575
|
+
};
|
|
576
|
+
try {
|
|
577
|
+
if ('copy' === installMode) {
|
|
578
|
+
installer_ensureDir(agentDir);
|
|
579
|
+
installer_remove(agentDir);
|
|
580
|
+
copyDirectory(sourcePath, agentDir);
|
|
581
|
+
return {
|
|
582
|
+
success: true,
|
|
583
|
+
path: agentDir,
|
|
584
|
+
mode: 'copy'
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
installer_ensureDir(canonicalDir);
|
|
588
|
+
installer_remove(canonicalDir);
|
|
589
|
+
copyDirectory(sourcePath, canonicalDir);
|
|
590
|
+
const symlinkCreated = await installer_createSymlink(canonicalDir, agentDir);
|
|
591
|
+
if (!symlinkCreated) {
|
|
592
|
+
try {
|
|
593
|
+
installer_remove(agentDir);
|
|
594
|
+
} catch {}
|
|
595
|
+
installer_ensureDir(agentDir);
|
|
596
|
+
copyDirectory(sourcePath, agentDir);
|
|
597
|
+
return {
|
|
598
|
+
success: true,
|
|
599
|
+
path: agentDir,
|
|
600
|
+
canonicalPath: canonicalDir,
|
|
601
|
+
mode: 'symlink',
|
|
602
|
+
symlinkFailed: true
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
return {
|
|
606
|
+
success: true,
|
|
607
|
+
path: agentDir,
|
|
608
|
+
canonicalPath: canonicalDir,
|
|
609
|
+
mode: 'symlink'
|
|
610
|
+
};
|
|
611
|
+
} catch (error) {
|
|
612
|
+
return {
|
|
613
|
+
success: false,
|
|
614
|
+
path: agentDir,
|
|
615
|
+
mode: installMode,
|
|
616
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
async installToAgents(sourcePath, skillName, targetAgents, options = {}) {
|
|
621
|
+
const results = new Map();
|
|
622
|
+
for (const agent of targetAgents){
|
|
623
|
+
const result = await this.installForAgent(sourcePath, skillName, agent, options);
|
|
624
|
+
results.set(agent, result);
|
|
625
|
+
}
|
|
626
|
+
return results;
|
|
627
|
+
}
|
|
628
|
+
isInstalled(skillName, agentType) {
|
|
629
|
+
const skillPath = this.getAgentSkillPath(skillName, agentType);
|
|
630
|
+
return external_node_fs_.existsSync(skillPath);
|
|
631
|
+
}
|
|
632
|
+
uninstallFromAgent(skillName, agentType) {
|
|
633
|
+
const skillPath = this.getAgentSkillPath(skillName, agentType);
|
|
634
|
+
if (!external_node_fs_.existsSync(skillPath)) return false;
|
|
635
|
+
installer_remove(skillPath);
|
|
636
|
+
return true;
|
|
637
|
+
}
|
|
638
|
+
uninstallFromAgents(skillName, targetAgents) {
|
|
639
|
+
const results = new Map();
|
|
640
|
+
for (const agent of targetAgents)results.set(agent, this.uninstallFromAgent(skillName, agent));
|
|
641
|
+
const canonicalPath = this.getCanonicalPath(skillName);
|
|
642
|
+
if (external_node_fs_.existsSync(canonicalPath)) installer_remove(canonicalPath);
|
|
643
|
+
return results;
|
|
644
|
+
}
|
|
645
|
+
listInstalledSkills(agentType) {
|
|
646
|
+
const agent = getAgentConfig(agentType);
|
|
647
|
+
const skillsDir = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
648
|
+
if (!external_node_fs_.existsSync(skillsDir)) return [];
|
|
649
|
+
return external_node_fs_.readdirSync(skillsDir, {
|
|
650
|
+
withFileTypes: true
|
|
651
|
+
}).filter((entry)=>entry.isDirectory() || entry.isSymbolicLink()).map((entry)=>entry.name);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
457
654
|
class CacheManager {
|
|
458
655
|
cacheDir;
|
|
459
656
|
constructor(cacheDir){
|
|
@@ -526,9 +723,7 @@ class CacheManager {
|
|
|
526
723
|
if (!cached) throw new Error(`Skill ${parsed.raw} version ${version} not found in cache`);
|
|
527
724
|
if (exists(destPath)) remove(destPath);
|
|
528
725
|
copyDir(cached.path, destPath, {
|
|
529
|
-
exclude:
|
|
530
|
-
'.reskill-commit'
|
|
531
|
-
]
|
|
726
|
+
exclude: DEFAULT_EXCLUDE_FILES
|
|
532
727
|
});
|
|
533
728
|
}
|
|
534
729
|
clearSkill(parsed, version) {
|
|
@@ -564,6 +759,31 @@ class CacheManager {
|
|
|
564
759
|
registries
|
|
565
760
|
};
|
|
566
761
|
}
|
|
762
|
+
async getRemoteCommit(repoUrl, ref) {
|
|
763
|
+
const { exec } = await import("node:child_process");
|
|
764
|
+
const { promisify } = await import("node:util");
|
|
765
|
+
const execAsync = promisify(exec);
|
|
766
|
+
try {
|
|
767
|
+
const { stdout } = await execAsync(`git ls-remote ${repoUrl} ${ref}`, {
|
|
768
|
+
encoding: 'utf-8'
|
|
769
|
+
});
|
|
770
|
+
if (stdout.trim()) {
|
|
771
|
+
const [commit] = stdout.trim().split('\t');
|
|
772
|
+
return commit;
|
|
773
|
+
}
|
|
774
|
+
const { stdout: allRefs } = await execAsync(`git ls-remote ${repoUrl}`, {
|
|
775
|
+
encoding: 'utf-8'
|
|
776
|
+
});
|
|
777
|
+
const lines = allRefs.trim().split('\n');
|
|
778
|
+
for (const line of lines){
|
|
779
|
+
const [commit, refPath] = line.split('\t');
|
|
780
|
+
if (refPath === `refs/heads/${ref}` || refPath === `refs/tags/${ref}` || refPath === ref) return commit;
|
|
781
|
+
}
|
|
782
|
+
return '';
|
|
783
|
+
} catch {
|
|
784
|
+
return '';
|
|
785
|
+
}
|
|
786
|
+
}
|
|
567
787
|
}
|
|
568
788
|
const DEFAULT_SKILLS_JSON = {
|
|
569
789
|
skills: {},
|
|
@@ -870,200 +1090,6 @@ class GitResolver {
|
|
|
870
1090
|
};
|
|
871
1091
|
}
|
|
872
1092
|
}
|
|
873
|
-
const installer_AGENTS_DIR = '.agents';
|
|
874
|
-
const installer_SKILLS_SUBDIR = 'skills';
|
|
875
|
-
function installer_sanitizeName(name) {
|
|
876
|
-
let sanitized = name.replace(/[/\\:\0]/g, '');
|
|
877
|
-
sanitized = sanitized.replace(/^[.\s]+|[.\s]+$/g, '');
|
|
878
|
-
sanitized = sanitized.replace(/^\.+/, '');
|
|
879
|
-
if (!sanitized || 0 === sanitized.length) sanitized = 'unnamed-skill';
|
|
880
|
-
if (sanitized.length > 255) sanitized = sanitized.substring(0, 255);
|
|
881
|
-
return sanitized;
|
|
882
|
-
}
|
|
883
|
-
function installer_isPathSafe(basePath, targetPath) {
|
|
884
|
-
const normalizedBase = __WEBPACK_EXTERNAL_MODULE_node_path__.normalize(__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(basePath));
|
|
885
|
-
const normalizedTarget = __WEBPACK_EXTERNAL_MODULE_node_path__.normalize(__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(targetPath));
|
|
886
|
-
return normalizedTarget.startsWith(normalizedBase + __WEBPACK_EXTERNAL_MODULE_node_path__.sep) || normalizedTarget === normalizedBase;
|
|
887
|
-
}
|
|
888
|
-
function installer_getCanonicalSkillsDir(isGlobal, cwd) {
|
|
889
|
-
const baseDir = isGlobal ? (0, __WEBPACK_EXTERNAL_MODULE_node_os__.homedir)() : cwd || process.cwd();
|
|
890
|
-
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(baseDir, installer_AGENTS_DIR, installer_SKILLS_SUBDIR);
|
|
891
|
-
}
|
|
892
|
-
function installer_ensureDir(dirPath) {
|
|
893
|
-
if (!external_node_fs_.existsSync(dirPath)) external_node_fs_.mkdirSync(dirPath, {
|
|
894
|
-
recursive: true
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
function installer_remove(targetPath) {
|
|
898
|
-
if (external_node_fs_.existsSync(targetPath)) external_node_fs_.rmSync(targetPath, {
|
|
899
|
-
recursive: true,
|
|
900
|
-
force: true
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
function copyDirectory(src, dest, options) {
|
|
904
|
-
const exclude = new Set(options?.exclude || [
|
|
905
|
-
'README.md',
|
|
906
|
-
'metadata.json',
|
|
907
|
-
'.reskill-commit'
|
|
908
|
-
]);
|
|
909
|
-
installer_ensureDir(dest);
|
|
910
|
-
const entries = external_node_fs_.readdirSync(src, {
|
|
911
|
-
withFileTypes: true
|
|
912
|
-
});
|
|
913
|
-
for (const entry of entries){
|
|
914
|
-
if (exclude.has(entry.name) || entry.name.startsWith('_')) continue;
|
|
915
|
-
const srcPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(src, entry.name);
|
|
916
|
-
const destPath = __WEBPACK_EXTERNAL_MODULE_node_path__.join(dest, entry.name);
|
|
917
|
-
if (entry.isDirectory()) copyDirectory(srcPath, destPath, options);
|
|
918
|
-
else external_node_fs_.copyFileSync(srcPath, destPath);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
async function installer_createSymlink(target, linkPath) {
|
|
922
|
-
try {
|
|
923
|
-
try {
|
|
924
|
-
const stats = external_node_fs_.lstatSync(linkPath);
|
|
925
|
-
if (stats.isSymbolicLink()) {
|
|
926
|
-
const existingTarget = external_node_fs_.readlinkSync(linkPath);
|
|
927
|
-
if (__WEBPACK_EXTERNAL_MODULE_node_path__.resolve(existingTarget) === __WEBPACK_EXTERNAL_MODULE_node_path__.resolve(target)) return true;
|
|
928
|
-
external_node_fs_.rmSync(linkPath);
|
|
929
|
-
} else external_node_fs_.rmSync(linkPath, {
|
|
930
|
-
recursive: true
|
|
931
|
-
});
|
|
932
|
-
} catch (err) {
|
|
933
|
-
if (err && 'object' == typeof err && 'code' in err) {
|
|
934
|
-
if ('ELOOP' === err.code) try {
|
|
935
|
-
external_node_fs_.rmSync(linkPath, {
|
|
936
|
-
force: true
|
|
937
|
-
});
|
|
938
|
-
} catch {}
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
const linkDir = __WEBPACK_EXTERNAL_MODULE_node_path__.dirname(linkPath);
|
|
942
|
-
installer_ensureDir(linkDir);
|
|
943
|
-
const relativePath = __WEBPACK_EXTERNAL_MODULE_node_path__.relative(linkDir, target);
|
|
944
|
-
const symlinkType = 'win32' === (0, __WEBPACK_EXTERNAL_MODULE_node_os__.platform)() ? 'junction' : void 0;
|
|
945
|
-
external_node_fs_.symlinkSync(relativePath, linkPath, symlinkType);
|
|
946
|
-
return true;
|
|
947
|
-
} catch {
|
|
948
|
-
return false;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
class Installer {
|
|
952
|
-
cwd;
|
|
953
|
-
isGlobal;
|
|
954
|
-
constructor(options = {}){
|
|
955
|
-
this.cwd = options.cwd || process.cwd();
|
|
956
|
-
this.isGlobal = options.global || false;
|
|
957
|
-
}
|
|
958
|
-
getCanonicalPath(skillName) {
|
|
959
|
-
const sanitized = installer_sanitizeName(skillName);
|
|
960
|
-
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
961
|
-
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
962
|
-
}
|
|
963
|
-
getAgentSkillPath(skillName, agentType) {
|
|
964
|
-
const agent = getAgentConfig(agentType);
|
|
965
|
-
const sanitized = installer_sanitizeName(skillName);
|
|
966
|
-
const agentBase = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
967
|
-
return __WEBPACK_EXTERNAL_MODULE_node_path__.join(agentBase, sanitized);
|
|
968
|
-
}
|
|
969
|
-
async installForAgent(sourcePath, skillName, agentType, options = {}) {
|
|
970
|
-
const agent = getAgentConfig(agentType);
|
|
971
|
-
const installMode = options.mode || 'symlink';
|
|
972
|
-
const sanitized = installer_sanitizeName(skillName);
|
|
973
|
-
const canonicalBase = installer_getCanonicalSkillsDir(this.isGlobal, this.cwd);
|
|
974
|
-
const canonicalDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(canonicalBase, sanitized);
|
|
975
|
-
const agentBase = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
976
|
-
const agentDir = __WEBPACK_EXTERNAL_MODULE_node_path__.join(agentBase, sanitized);
|
|
977
|
-
if (!installer_isPathSafe(canonicalBase, canonicalDir)) return {
|
|
978
|
-
success: false,
|
|
979
|
-
path: agentDir,
|
|
980
|
-
mode: installMode,
|
|
981
|
-
error: 'Invalid skill name: potential path traversal detected'
|
|
982
|
-
};
|
|
983
|
-
if (!installer_isPathSafe(agentBase, agentDir)) return {
|
|
984
|
-
success: false,
|
|
985
|
-
path: agentDir,
|
|
986
|
-
mode: installMode,
|
|
987
|
-
error: 'Invalid skill name: potential path traversal detected'
|
|
988
|
-
};
|
|
989
|
-
try {
|
|
990
|
-
if ('copy' === installMode) {
|
|
991
|
-
installer_ensureDir(agentDir);
|
|
992
|
-
installer_remove(agentDir);
|
|
993
|
-
copyDirectory(sourcePath, agentDir);
|
|
994
|
-
return {
|
|
995
|
-
success: true,
|
|
996
|
-
path: agentDir,
|
|
997
|
-
mode: 'copy'
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
installer_ensureDir(canonicalDir);
|
|
1001
|
-
installer_remove(canonicalDir);
|
|
1002
|
-
copyDirectory(sourcePath, canonicalDir);
|
|
1003
|
-
const symlinkCreated = await installer_createSymlink(canonicalDir, agentDir);
|
|
1004
|
-
if (!symlinkCreated) {
|
|
1005
|
-
try {
|
|
1006
|
-
installer_remove(agentDir);
|
|
1007
|
-
} catch {}
|
|
1008
|
-
installer_ensureDir(agentDir);
|
|
1009
|
-
copyDirectory(sourcePath, agentDir);
|
|
1010
|
-
return {
|
|
1011
|
-
success: true,
|
|
1012
|
-
path: agentDir,
|
|
1013
|
-
canonicalPath: canonicalDir,
|
|
1014
|
-
mode: 'symlink',
|
|
1015
|
-
symlinkFailed: true
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
return {
|
|
1019
|
-
success: true,
|
|
1020
|
-
path: agentDir,
|
|
1021
|
-
canonicalPath: canonicalDir,
|
|
1022
|
-
mode: 'symlink'
|
|
1023
|
-
};
|
|
1024
|
-
} catch (error) {
|
|
1025
|
-
return {
|
|
1026
|
-
success: false,
|
|
1027
|
-
path: agentDir,
|
|
1028
|
-
mode: installMode,
|
|
1029
|
-
error: error instanceof Error ? error.message : 'Unknown error'
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
async installToAgents(sourcePath, skillName, targetAgents, options = {}) {
|
|
1034
|
-
const results = new Map();
|
|
1035
|
-
for (const agent of targetAgents){
|
|
1036
|
-
const result = await this.installForAgent(sourcePath, skillName, agent, options);
|
|
1037
|
-
results.set(agent, result);
|
|
1038
|
-
}
|
|
1039
|
-
return results;
|
|
1040
|
-
}
|
|
1041
|
-
isInstalled(skillName, agentType) {
|
|
1042
|
-
const skillPath = this.getAgentSkillPath(skillName, agentType);
|
|
1043
|
-
return external_node_fs_.existsSync(skillPath);
|
|
1044
|
-
}
|
|
1045
|
-
uninstallFromAgent(skillName, agentType) {
|
|
1046
|
-
const skillPath = this.getAgentSkillPath(skillName, agentType);
|
|
1047
|
-
if (!external_node_fs_.existsSync(skillPath)) return false;
|
|
1048
|
-
installer_remove(skillPath);
|
|
1049
|
-
return true;
|
|
1050
|
-
}
|
|
1051
|
-
uninstallFromAgents(skillName, targetAgents) {
|
|
1052
|
-
const results = new Map();
|
|
1053
|
-
for (const agent of targetAgents)results.set(agent, this.uninstallFromAgent(skillName, agent));
|
|
1054
|
-
const canonicalPath = this.getCanonicalPath(skillName);
|
|
1055
|
-
if (external_node_fs_.existsSync(canonicalPath)) installer_remove(canonicalPath);
|
|
1056
|
-
return results;
|
|
1057
|
-
}
|
|
1058
|
-
listInstalledSkills(agentType) {
|
|
1059
|
-
const agent = getAgentConfig(agentType);
|
|
1060
|
-
const skillsDir = this.isGlobal ? agent.globalSkillsDir : __WEBPACK_EXTERNAL_MODULE_node_path__.join(this.cwd, agent.skillsDir);
|
|
1061
|
-
if (!external_node_fs_.existsSync(skillsDir)) return [];
|
|
1062
|
-
return external_node_fs_.readdirSync(skillsDir, {
|
|
1063
|
-
withFileTypes: true
|
|
1064
|
-
}).filter((entry)=>entry.isDirectory() || entry.isSymbolicLink()).map((entry)=>entry.name);
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
1093
|
const LOCKFILE_VERSION = 1;
|
|
1068
1094
|
class LockManager {
|
|
1069
1095
|
projectRoot;
|
|
@@ -1327,6 +1353,11 @@ class SkillManager {
|
|
|
1327
1353
|
logger_logger.success(`Uninstalled ${name} ${locationHint}`.trim());
|
|
1328
1354
|
return true;
|
|
1329
1355
|
}
|
|
1356
|
+
checkNeedsUpdate(name, remoteCommit) {
|
|
1357
|
+
const locked = this.lockManager.get(name);
|
|
1358
|
+
if (!locked?.commit) return true;
|
|
1359
|
+
return locked.commit !== remoteCommit;
|
|
1360
|
+
}
|
|
1330
1361
|
async update(name) {
|
|
1331
1362
|
const updated = [];
|
|
1332
1363
|
if (name) {
|
|
@@ -1335,6 +1366,12 @@ class SkillManager {
|
|
|
1335
1366
|
logger_logger.error(`Skill ${name} not found in skills.json`);
|
|
1336
1367
|
return [];
|
|
1337
1368
|
}
|
|
1369
|
+
const resolved = await this.resolver.resolve(ref);
|
|
1370
|
+
const remoteCommit = await this.cache.getRemoteCommit(resolved.repoUrl, resolved.ref);
|
|
1371
|
+
if (!this.checkNeedsUpdate(name, remoteCommit)) {
|
|
1372
|
+
logger_logger.info(`${name} is already up to date`);
|
|
1373
|
+
return [];
|
|
1374
|
+
}
|
|
1338
1375
|
const skill = await this.install(ref, {
|
|
1339
1376
|
force: true,
|
|
1340
1377
|
save: false
|
|
@@ -1343,6 +1380,12 @@ class SkillManager {
|
|
|
1343
1380
|
} else {
|
|
1344
1381
|
const skills = this.config.getSkills();
|
|
1345
1382
|
for (const [skillName, ref] of Object.entries(skills))try {
|
|
1383
|
+
const resolved = await this.resolver.resolve(ref);
|
|
1384
|
+
const remoteCommit = await this.cache.getRemoteCommit(resolved.repoUrl, resolved.ref);
|
|
1385
|
+
if (!this.checkNeedsUpdate(skillName, remoteCommit)) {
|
|
1386
|
+
logger_logger.info(`${skillName} is already up to date`);
|
|
1387
|
+
continue;
|
|
1388
|
+
}
|
|
1346
1389
|
const skill = await this.install(ref, {
|
|
1347
1390
|
force: true,
|
|
1348
1391
|
save: false
|
package/dist/utils/fs.d.ts
CHANGED
|
@@ -31,9 +31,15 @@ export declare function ensureDir(dirPath: string): void;
|
|
|
31
31
|
export declare function remove(targetPath: string): void;
|
|
32
32
|
/**
|
|
33
33
|
* Copy directory recursively
|
|
34
|
+
*
|
|
35
|
+
* @param src - Source directory
|
|
36
|
+
* @param dest - Destination directory
|
|
37
|
+
* @param options.exclude - Array of filenames to exclude
|
|
38
|
+
* @param options.excludePrefix - Prefix for files to exclude (e.g., '_' to exclude _private.md)
|
|
34
39
|
*/
|
|
35
40
|
export declare function copyDir(src: string, dest: string, options?: {
|
|
36
41
|
exclude?: string[];
|
|
42
|
+
excludePrefix?: string;
|
|
37
43
|
}): void;
|
|
38
44
|
/**
|
|
39
45
|
* List directory contents
|
package/dist/utils/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAG/C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,SAAI,GAAG,IAAI,CAMxE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM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C,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAWlE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAOxE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reskill",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "AI Skills Package Manager - Git-based skills management for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"degit": "^2.8.4",
|
|
53
53
|
"gray-matter": "^4.0.3",
|
|
54
54
|
"ora": "^8.0.1",
|
|
55
|
-
"semver": "^7.6.3"
|
|
55
|
+
"semver": "^7.6.3",
|
|
56
|
+
"tabtab": "^3.0.2"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@biomejs/biome": "^2.3.11",
|