@vibe-agent-toolkit/utils 0.1.26 → 0.1.27
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/skill-targets.d.ts +37 -0
- package/dist/skill-targets.d.ts.map +1 -0
- package/dist/skill-targets.js +65 -0
- package/dist/skill-targets.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,gBAAgB,CAAC;AAG/B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,eAAe,CAAC;AAG9B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,gBAAgB,CAAC;AAG/B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,eAAe,CAAC;AAG9B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,eAAe,CAAC;AAG9B,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -26,4 +26,6 @@ export * from './test-helpers.js';
|
|
|
26
26
|
export * from './zod-introspection.js';
|
|
27
27
|
// Handlebars template rendering (cached, no HTML escaping)
|
|
28
28
|
export * from './template.js';
|
|
29
|
+
// Skill target resolution (cross-platform flat skill install paths)
|
|
30
|
+
export * from './skill-targets.js';
|
|
29
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8DAA8D;AAC9D,cAAc,gBAAgB,CAAC;AAE/B,gCAAgC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,uBAAuB;AACvB,cAAc,eAAe,CAAC;AAE9B,wCAAwC;AACxC,cAAc,mBAAmB,CAAC;AAElC,sBAAsB;AACtB,cAAc,wBAAwB,CAAC;AAEvC,8CAA8C;AAC9C,cAAc,gBAAgB,CAAC;AAE/B,kEAAkE;AAClE,cAAc,oBAAoB,CAAC;AAEnC,yDAAyD;AACzD,cAAc,kBAAkB,CAAC;AAEjC,oDAAoD;AACpD,cAAc,mBAAmB,CAAC;AAElC,4CAA4C;AAC5C,cAAc,wBAAwB,CAAC;AAEvC,2DAA2D;AAC3D,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8DAA8D;AAC9D,cAAc,gBAAgB,CAAC;AAE/B,gCAAgC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,uBAAuB;AACvB,cAAc,eAAe,CAAC;AAE9B,wCAAwC;AACxC,cAAc,mBAAmB,CAAC;AAElC,sBAAsB;AACtB,cAAc,wBAAwB,CAAC;AAEvC,8CAA8C;AAC9C,cAAc,gBAAgB,CAAC;AAE/B,kEAAkE;AAClE,cAAc,oBAAoB,CAAC;AAEnC,yDAAyD;AACzD,cAAc,kBAAkB,CAAC;AAEjC,oDAAoD;AACpD,cAAc,mBAAmB,CAAC;AAElC,4CAA4C;AAC5C,cAAc,wBAAwB,CAAC;AAEvC,2DAA2D;AAC3D,cAAc,eAAe,CAAC;AAE9B,oEAAoE;AACpE,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill target resolution — map (target, scope) to an installation directory.
|
|
3
|
+
*
|
|
4
|
+
* This is a pure lookup table with no vendor-specific logic. Adding new targets
|
|
5
|
+
* is just adding entries to the SKILL_TARGETS constant.
|
|
6
|
+
*
|
|
7
|
+
* Paths use forward slashes on all platforms (see utils/CLAUDE.md).
|
|
8
|
+
*/
|
|
9
|
+
export declare const SKILL_TARGET_NAMES: readonly ["claude", "codex", "copilot", "gemini", "cursor", "windsurf", "agents"];
|
|
10
|
+
export type SkillTarget = (typeof SKILL_TARGET_NAMES)[number];
|
|
11
|
+
export declare const SKILL_SCOPE_NAMES: readonly ["user", "project"];
|
|
12
|
+
export type SkillScope = (typeof SKILL_SCOPE_NAMES)[number];
|
|
13
|
+
interface SkillTargetPaths {
|
|
14
|
+
/** Path relative to the user home directory (without leading ~/) */
|
|
15
|
+
readonly userRel: string;
|
|
16
|
+
/** Path relative to the project root (current working directory) */
|
|
17
|
+
readonly projectRel: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Target → {userRel, projectRel} lookup table.
|
|
21
|
+
*
|
|
22
|
+
* These paths are based on the 2026-04-08 ecosystem analysis. Update this table
|
|
23
|
+
* when platforms change their conventions. See docs/plans/2026-04-08-agent-skills-ecosystem-analysis.md.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SKILL_TARGETS: Readonly<Record<SkillTarget, SkillTargetPaths>>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a (target, scope, cwd) triple to an absolute skills directory.
|
|
28
|
+
*
|
|
29
|
+
* @param target - Platform target (claude, codex, copilot, gemini, cursor, windsurf, agents)
|
|
30
|
+
* @param scope - user (home dir) or project (cwd)
|
|
31
|
+
* @param cwd - Current working directory for project scope. Pass explicitly for testability.
|
|
32
|
+
* @returns Absolute path to the skills directory using forward slashes
|
|
33
|
+
* @throws Error with a helpful message listing valid values if target or scope is invalid
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveSkillTarget(target: SkillTarget, scope: SkillScope, cwd: string): string;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=skill-targets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-targets.d.ts","sourceRoot":"","sources":["../src/skill-targets.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,eAAO,MAAM,kBAAkB,mFAQrB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,eAAO,MAAM,iBAAiB,8BAA+B,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,UAAU,gBAAgB;IACxB,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAKD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAQzE,CAAC;AAUF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,MAAM,GACV,MAAM,CAgBR"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill target resolution — map (target, scope) to an installation directory.
|
|
3
|
+
*
|
|
4
|
+
* This is a pure lookup table with no vendor-specific logic. Adding new targets
|
|
5
|
+
* is just adding entries to the SKILL_TARGETS constant.
|
|
6
|
+
*
|
|
7
|
+
* Paths use forward slashes on all platforms (see utils/CLAUDE.md).
|
|
8
|
+
*/
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { safePath } from './path-utils.js';
|
|
11
|
+
export const SKILL_TARGET_NAMES = [
|
|
12
|
+
'claude',
|
|
13
|
+
'codex',
|
|
14
|
+
'copilot',
|
|
15
|
+
'gemini',
|
|
16
|
+
'cursor',
|
|
17
|
+
'windsurf',
|
|
18
|
+
'agents',
|
|
19
|
+
];
|
|
20
|
+
export const SKILL_SCOPE_NAMES = ['user', 'project'];
|
|
21
|
+
/** Shared path used by both codex and agents targets (and their user/project scopes). */
|
|
22
|
+
const AGENTS_SKILLS_PATH = '.agents/skills';
|
|
23
|
+
/**
|
|
24
|
+
* Target → {userRel, projectRel} lookup table.
|
|
25
|
+
*
|
|
26
|
+
* These paths are based on the 2026-04-08 ecosystem analysis. Update this table
|
|
27
|
+
* when platforms change their conventions. See docs/plans/2026-04-08-agent-skills-ecosystem-analysis.md.
|
|
28
|
+
*/
|
|
29
|
+
export const SKILL_TARGETS = {
|
|
30
|
+
claude: { userRel: '.claude/skills', projectRel: '.claude/skills' },
|
|
31
|
+
codex: { userRel: AGENTS_SKILLS_PATH, projectRel: AGENTS_SKILLS_PATH },
|
|
32
|
+
copilot: { userRel: '.copilot/skills', projectRel: '.github/skills' },
|
|
33
|
+
gemini: { userRel: '.gemini/skills', projectRel: '.gemini/skills' },
|
|
34
|
+
cursor: { userRel: '.cursor/skills', projectRel: '.cursor/skills' },
|
|
35
|
+
windsurf: { userRel: '.codeium/windsurf/skills', projectRel: '.windsurf/skills' },
|
|
36
|
+
agents: { userRel: AGENTS_SKILLS_PATH, projectRel: AGENTS_SKILLS_PATH },
|
|
37
|
+
};
|
|
38
|
+
function isSkillTarget(value) {
|
|
39
|
+
return SKILL_TARGET_NAMES.includes(value);
|
|
40
|
+
}
|
|
41
|
+
function isSkillScope(value) {
|
|
42
|
+
return SKILL_SCOPE_NAMES.includes(value);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve a (target, scope, cwd) triple to an absolute skills directory.
|
|
46
|
+
*
|
|
47
|
+
* @param target - Platform target (claude, codex, copilot, gemini, cursor, windsurf, agents)
|
|
48
|
+
* @param scope - user (home dir) or project (cwd)
|
|
49
|
+
* @param cwd - Current working directory for project scope. Pass explicitly for testability.
|
|
50
|
+
* @returns Absolute path to the skills directory using forward slashes
|
|
51
|
+
* @throws Error with a helpful message listing valid values if target or scope is invalid
|
|
52
|
+
*/
|
|
53
|
+
export function resolveSkillTarget(target, scope, cwd) {
|
|
54
|
+
if (!isSkillTarget(target)) {
|
|
55
|
+
throw new Error(`Invalid target "${String(target)}". Valid targets: ${SKILL_TARGET_NAMES.join(', ')}`);
|
|
56
|
+
}
|
|
57
|
+
if (!isSkillScope(scope)) {
|
|
58
|
+
throw new Error(`Invalid scope "${String(scope)}". Valid scopes: ${SKILL_SCOPE_NAMES.join(', ')}`);
|
|
59
|
+
}
|
|
60
|
+
const entry = SKILL_TARGETS[target];
|
|
61
|
+
const base = scope === 'user' ? homedir() : cwd;
|
|
62
|
+
const rel = scope === 'user' ? entry.userRel : entry.projectRel;
|
|
63
|
+
return safePath.join(base, rel);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=skill-targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-targets.js","sourceRoot":"","sources":["../src/skill-targets.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;CACA,CAAC;AAIX,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,SAAS,C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