skilld 0.2.1 → 0.3.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 +13 -8
- package/dist/_chunks/config.mjs +1 -2
- package/dist/_chunks/config.mjs.map +1 -1
- package/dist/_chunks/{llm.mjs → detect-imports.mjs} +935 -480
- package/dist/_chunks/detect-imports.mjs.map +1 -0
- package/dist/_chunks/releases.mjs +102 -126
- package/dist/_chunks/releases.mjs.map +1 -1
- package/dist/_chunks/storage.mjs +5 -38
- package/dist/_chunks/storage.mjs.map +1 -1
- package/dist/_chunks/sync-parallel.mjs +4 -4
- package/dist/_chunks/sync-parallel.mjs.map +1 -1
- package/dist/_chunks/utils.d.mts.map +1 -1
- package/dist/_chunks/version.d.mts +5 -36
- package/dist/_chunks/version.d.mts.map +1 -1
- package/dist/agent/index.d.mts +143 -100
- package/dist/agent/index.d.mts.map +1 -1
- package/dist/agent/index.mjs +2 -2
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +3 -3
- package/dist/cli.mjs +73 -71
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/types.d.mts +1 -1
- package/package.json +1 -1
- package/dist/_chunks/llm.mjs.map +0 -1
package/dist/agent/index.d.mts
CHANGED
|
@@ -1,99 +1,3 @@
|
|
|
1
|
-
//#region src/agent/types.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Agent types and interfaces
|
|
4
|
-
*/
|
|
5
|
-
type AgentType = 'claude-code' | 'cursor' | 'windsurf' | 'cline' | 'codex' | 'github-copilot' | 'gemini-cli' | 'goose' | 'amp' | 'opencode' | 'roo';
|
|
6
|
-
interface AgentConfig {
|
|
7
|
-
name: AgentType;
|
|
8
|
-
displayName: string;
|
|
9
|
-
/** Project-level skills directory (e.g., .claude/skills) */
|
|
10
|
-
skillsDir: string;
|
|
11
|
-
/** Global skills directory (e.g., ~/.claude/skills) */
|
|
12
|
-
globalSkillsDir: string | undefined;
|
|
13
|
-
/** Check if agent is installed on the system */
|
|
14
|
-
detectInstalled: () => boolean;
|
|
15
|
-
/** CLI command name (if agent has a CLI) */
|
|
16
|
-
cli?: string;
|
|
17
|
-
}
|
|
18
|
-
interface SkillMetadata {
|
|
19
|
-
name: string;
|
|
20
|
-
version?: string;
|
|
21
|
-
/** ISO date string when this version was released */
|
|
22
|
-
releasedAt?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
/** File patterns this skill applies to (e.g., ["*.vue", "*.ts"]) */
|
|
25
|
-
globs?: string[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Mapping of packages to file patterns they process.
|
|
29
|
-
* Used to generate skill descriptions with file extension triggers.
|
|
30
|
-
*/
|
|
31
|
-
declare const FILE_PATTERN_MAP: Record<string, string[]>;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/agent/detect.d.ts
|
|
34
|
-
/**
|
|
35
|
-
* Detect which agents are installed on the system
|
|
36
|
-
*/
|
|
37
|
-
declare function detectInstalledAgents(): AgentType[];
|
|
38
|
-
/**
|
|
39
|
-
* Detect the target agent (where skills are installed) from env vars and cwd.
|
|
40
|
-
* This is NOT the generator LLM — it determines the skills directory.
|
|
41
|
-
*/
|
|
42
|
-
declare function detectTargetAgent(): AgentType | null;
|
|
43
|
-
/**
|
|
44
|
-
* Get the version of an agent's CLI (if available)
|
|
45
|
-
*/
|
|
46
|
-
declare function getAgentVersion(agentType: AgentType): string | null;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/agent/detect-imports.d.ts
|
|
49
|
-
/**
|
|
50
|
-
* Detect directly-used npm packages by scanning source files
|
|
51
|
-
* Uses mlly for proper ES module parsing + globby for gitignore support
|
|
52
|
-
*/
|
|
53
|
-
interface PackageUsage {
|
|
54
|
-
name: string;
|
|
55
|
-
count: number;
|
|
56
|
-
source?: 'import' | 'preset';
|
|
57
|
-
}
|
|
58
|
-
interface DetectResult {
|
|
59
|
-
packages: PackageUsage[];
|
|
60
|
-
error?: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Scan source files to detect all directly-imported npm packages
|
|
64
|
-
* Async with gitignore support for proper spinner animation
|
|
65
|
-
*/
|
|
66
|
-
declare function detectImportedPackages(cwd?: string): Promise<DetectResult>;
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/agent/install.d.ts
|
|
69
|
-
/**
|
|
70
|
-
* Sanitize skill name for filesystem
|
|
71
|
-
*/
|
|
72
|
-
declare function sanitizeName(name: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Compute skill directory name from GitHub owner/repo when available,
|
|
75
|
-
* falling back to sanitized package name.
|
|
76
|
-
*
|
|
77
|
-
* Examples:
|
|
78
|
-
* vue (vuejs/core) → vuejs-core
|
|
79
|
-
* @nuxt/ui (nuxt/ui) → nuxt-ui
|
|
80
|
-
* vue-router (vuejs/router) → vuejs-router
|
|
81
|
-
*/
|
|
82
|
-
declare function computeSkillDirName(packageName: string, repoUrl?: string): string;
|
|
83
|
-
/**
|
|
84
|
-
* Install a skill directly to agent skill directories
|
|
85
|
-
* Writes to each agent's skill folder in the project (e.g., .claude/skills/package-name/)
|
|
86
|
-
*/
|
|
87
|
-
declare function installSkillForAgents(skillName: string, skillContent: string, options?: {
|
|
88
|
-
global?: boolean;
|
|
89
|
-
cwd?: string;
|
|
90
|
-
agents?: AgentType[]; /** Additional files to write (filename -> content) */
|
|
91
|
-
files?: Record<string, string>;
|
|
92
|
-
}): {
|
|
93
|
-
installed: AgentType[];
|
|
94
|
-
paths: string[];
|
|
95
|
-
};
|
|
96
|
-
//#endregion
|
|
97
1
|
//#region src/agent/prompts/optional/types.d.ts
|
|
98
2
|
interface CustomPrompt {
|
|
99
3
|
heading: string;
|
|
@@ -183,7 +87,25 @@ interface SkillOptions {
|
|
|
183
87
|
}
|
|
184
88
|
declare function generateSkillMd(opts: SkillOptions): string;
|
|
185
89
|
//#endregion
|
|
186
|
-
//#region src/agent/
|
|
90
|
+
//#region src/agent/types.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Agent types and interfaces
|
|
93
|
+
*/
|
|
94
|
+
type AgentType = 'claude-code' | 'cursor' | 'windsurf' | 'cline' | 'codex' | 'github-copilot' | 'gemini-cli' | 'goose' | 'amp' | 'opencode' | 'roo';
|
|
95
|
+
interface SkillMetadata {
|
|
96
|
+
name: string;
|
|
97
|
+
version?: string;
|
|
98
|
+
/** ISO date string when this version was released */
|
|
99
|
+
releasedAt?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Mapping of packages to file patterns they process.
|
|
104
|
+
* Used to generate skill descriptions with file extension triggers.
|
|
105
|
+
*/
|
|
106
|
+
declare const FILE_PATTERN_MAP: Record<string, string[]>;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/agent/clis/types.d.ts
|
|
187
109
|
type OptimizeModel = 'opus' | 'sonnet' | 'haiku' | 'gemini-3-pro' | 'gemini-3-flash' | 'gpt-5.2-codex' | 'gpt-5.1-codex-max' | 'gpt-5.2' | 'gpt-5.1-codex-mini';
|
|
188
110
|
interface ModelInfo {
|
|
189
111
|
id: OptimizeModel;
|
|
@@ -236,13 +158,134 @@ interface OptimizeResult {
|
|
|
236
158
|
cost?: number;
|
|
237
159
|
debugLogsDir?: string;
|
|
238
160
|
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/agent/clis/index.d.ts
|
|
239
163
|
declare function getModelName(id: OptimizeModel): string;
|
|
240
164
|
declare function getModelLabel(id: OptimizeModel): string;
|
|
241
165
|
declare function getAvailableModels(): Promise<ModelInfo[]>;
|
|
242
166
|
declare function optimizeDocs(opts: OptimizeDocsOptions): Promise<OptimizeResult>;
|
|
243
167
|
//#endregion
|
|
244
|
-
//#region src/agent/
|
|
245
|
-
|
|
168
|
+
//#region src/agent/detect.d.ts
|
|
169
|
+
/**
|
|
170
|
+
* Detect which agents are installed on the system
|
|
171
|
+
*/
|
|
172
|
+
declare function detectInstalledAgents(): AgentType[];
|
|
173
|
+
/**
|
|
174
|
+
* Detect the target agent (where skills are installed) from env vars and cwd.
|
|
175
|
+
* This is NOT the generator LLM — it determines the skills directory.
|
|
176
|
+
*
|
|
177
|
+
* Priority: env vars first (running inside agent), then project dirs.
|
|
178
|
+
* Iteration order of the agents record determines priority.
|
|
179
|
+
*/
|
|
180
|
+
declare function detectTargetAgent(): AgentType | null;
|
|
181
|
+
/**
|
|
182
|
+
* Get the version of an agent's CLI (if available)
|
|
183
|
+
*/
|
|
184
|
+
declare function getAgentVersion(agentType: AgentType): string | null;
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/agent/detect-imports.d.ts
|
|
187
|
+
/**
|
|
188
|
+
* Detect directly-used npm packages by scanning source files
|
|
189
|
+
* Uses mlly for proper ES module parsing + globby for gitignore support
|
|
190
|
+
*/
|
|
191
|
+
interface PackageUsage {
|
|
192
|
+
name: string;
|
|
193
|
+
count: number;
|
|
194
|
+
source?: 'import' | 'preset';
|
|
195
|
+
}
|
|
196
|
+
interface DetectResult {
|
|
197
|
+
packages: PackageUsage[];
|
|
198
|
+
error?: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Scan source files to detect all directly-imported npm packages
|
|
202
|
+
* Async with gitignore support for proper spinner animation
|
|
203
|
+
*/
|
|
204
|
+
declare function detectImportedPackages(cwd?: string): Promise<DetectResult>;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/agent/install.d.ts
|
|
207
|
+
/**
|
|
208
|
+
* Sanitize skill name for filesystem
|
|
209
|
+
*/
|
|
210
|
+
declare function sanitizeName(name: string): string;
|
|
211
|
+
/**
|
|
212
|
+
* Compute skill directory name from GitHub owner/repo when available,
|
|
213
|
+
* falling back to sanitized package name.
|
|
214
|
+
*
|
|
215
|
+
* Examples:
|
|
216
|
+
* vue (vuejs/core) → vuejs-core
|
|
217
|
+
* @nuxt/ui (nuxt/ui) → nuxt-ui
|
|
218
|
+
* vue-router (vuejs/router) → vuejs-router
|
|
219
|
+
*/
|
|
220
|
+
declare function computeSkillDirName(packageName: string, repoUrl?: string): string;
|
|
221
|
+
/**
|
|
222
|
+
* Install a skill directly to agent skill directories
|
|
223
|
+
* Writes to each agent's skill folder in the project (e.g., .claude/skills/package-name/)
|
|
224
|
+
*/
|
|
225
|
+
declare function installSkillForAgents(skillName: string, skillContent: string, options?: {
|
|
226
|
+
global?: boolean;
|
|
227
|
+
cwd?: string;
|
|
228
|
+
agents?: AgentType[]; /** Additional files to write (filename -> content) */
|
|
229
|
+
files?: Record<string, string>;
|
|
230
|
+
}): {
|
|
231
|
+
installed: AgentType[];
|
|
232
|
+
paths: string[];
|
|
233
|
+
};
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/agent/targets/types.d.ts
|
|
236
|
+
interface FrontmatterField {
|
|
237
|
+
/** Field name in YAML frontmatter */
|
|
238
|
+
name: string;
|
|
239
|
+
/** Whether the field is required by the agent */
|
|
240
|
+
required: boolean;
|
|
241
|
+
/** Description of what the field does */
|
|
242
|
+
description: string;
|
|
243
|
+
/** Constraints (max length, regex, etc.) */
|
|
244
|
+
constraints?: string;
|
|
245
|
+
}
|
|
246
|
+
interface AgentTarget {
|
|
247
|
+
/** Agent identifier */
|
|
248
|
+
agent: AgentType;
|
|
249
|
+
/** Human-readable agent name */
|
|
250
|
+
displayName: string;
|
|
251
|
+
/** Check if agent is installed on the system */
|
|
252
|
+
detectInstalled: () => boolean;
|
|
253
|
+
/** Check env vars to detect if running inside this agent */
|
|
254
|
+
detectEnv: () => boolean;
|
|
255
|
+
/** Check project-level config dirs/files to detect this agent */
|
|
256
|
+
detectProject: (cwd: string) => boolean;
|
|
257
|
+
/** CLI command name (if agent has a CLI for skill generation) */
|
|
258
|
+
cli?: string;
|
|
259
|
+
/** Required skill filename (always SKILL.md for Agent Skills spec agents) */
|
|
260
|
+
skillFilename: string;
|
|
261
|
+
/** Project-level skill directory */
|
|
262
|
+
skillsDir: string;
|
|
263
|
+
/** Global (user-level) skill directory (resolved absolute path) */
|
|
264
|
+
globalSkillsDir: string;
|
|
265
|
+
/** Additional directories this agent scans for skills (cross-compat) */
|
|
266
|
+
additionalSkillsDirs: string[];
|
|
267
|
+
/** Supported frontmatter fields */
|
|
268
|
+
frontmatter: FrontmatterField[];
|
|
269
|
+
/** Whether `name` must exactly match the parent directory name */
|
|
270
|
+
nameMatchesDir: boolean;
|
|
271
|
+
/** Name field regex constraint */
|
|
272
|
+
namePattern: string;
|
|
273
|
+
/** How skills are discovered: 'eager' (startup scan) or 'lazy' (on-demand) */
|
|
274
|
+
discoveryStrategy: 'eager' | 'lazy';
|
|
275
|
+
/** Brief description of how discovery works */
|
|
276
|
+
discoveryNotes: string;
|
|
277
|
+
/** Whether this agent follows the agentskills.io spec */
|
|
278
|
+
agentSkillsSpec: boolean;
|
|
279
|
+
/** Agent-specific extensions beyond the spec */
|
|
280
|
+
extensions: string[];
|
|
281
|
+
/** Link to official documentation */
|
|
282
|
+
docs: string;
|
|
283
|
+
/** Additional notes, quirks, known issues */
|
|
284
|
+
notes: string[];
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/agent/targets/registry.d.ts
|
|
288
|
+
declare const targets: Record<AgentType, AgentTarget>;
|
|
246
289
|
//#endregion
|
|
247
|
-
export { type
|
|
290
|
+
export { type AgentTarget, type AgentType, type CustomPrompt, FILE_PATTERN_MAP, type FrontmatterField, type ModelInfo, type OptimizeDocsOptions, type OptimizeModel, type OptimizeResult, SECTION_MERGE_ORDER, SECTION_OUTPUT_FILES, type SkillMetadata, type SkillOptions, type SkillSection, type StreamProgress, targets as agents, buildAllSectionPrompts, buildSectionPrompt, computeSkillDirName, detectImportedPackages, detectInstalledAgents, detectTargetAgent, generateSkillMd, getAgentVersion, getAvailableModels, getModelLabel, getModelName, installSkillForAgents, optimizeDocs, sanitizeName };
|
|
248
291
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/agent/types.ts","../../src/agent/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/agent/prompts/optional/types.ts","../../src/agent/prompts/prompt.ts","../../src/agent/prompts/skill.ts","../../src/agent/types.ts","../../src/agent/clis/types.ts","../../src/agent/clis/index.ts","../../src/agent/detect.ts","../../src/agent/detect-imports.ts","../../src/agent/install.ts","../../src/agent/targets/types.ts","../../src/agent/targets/registry.ts"],"mappings":";UAciB,YAAA;EACf,OAAA;EACA,IAAA;AAAA;;;KCRU,YAAA;;cAGC,oBAAA,EAAsB,MAAA,CAAO,YAAA;;cAQ7B,mBAAA,EAAqB,YAAA;AAAA,UAEjB,uBAAA;EACf,WAAA;;EAEA,QAAA;EAhBsB;EAkBtB,OAAA;EAVD;EAYC,SAAA;EAjBiC;EAmBjC,cAAA;EAXW;EAaX,WAAA;;EAEA,YAAA;EAf4C;EAiB5C,QAAA;EAfsC;EAiBtC,QAAA;EAI2B;EAF3B,cAAA;EAhBA;EAkBA,YAAA,GAAe,YAAA;AAAA;;;;iBAgHD,kBAAA,CAAmB,IAAA,EAAM,uBAAA;EAA4B,OAAA,EAAS,YAAA;AAAA;;;;iBA8C9D,sBAAA,CAAuB,IAAA,EAAM,uBAAA;EAA4B,QAAA,EAAU,YAAA;AAAA,IAAmB,GAAA,CAAI,YAAA;;;;AD1L1G;;UELiB,YAAA;EACf,IAAA;EACA,OAAA;EACA,UAAA;;EAEA,YAAA,GAAe,MAAA;EDNL;ECQV,QAAA,GAAW,MAAA;IAAiB,OAAA;IAAiB,UAAA;EAAA;EAC7C,KAAA;EACA,WAAA;;EAEA,IAAA;EACA,aAAA;EACA,SAAA;EACA,cAAA;EACA,WAAA;EACA,YAAA;EACA,QAAA;EACA,cAAA;EDNsC;ECQtC,QAAA;EDa2B;ECX3B,WAAA;EDPA;ECSA,OAAA;EDLA;ECOA,QAAA,GAAW,KAAA;IAAQ,IAAA;EAAA;EDCnB;ECCA,OAAA;AAAA;AAAA,iBAGc,eAAA,CAAgB,IAAA,EAAM,YAAA;;;;AF1BtC;;KGVY,SAAA;AAAA,UAaK,aAAA;EACf,IAAA;EACA,OAAA;;EAEA,UAAA;EACA,WAAA;AAAA;;;;AFXF;cEkBa,gBAAA,EAAkB,MAAA;;;KCLnB,aAAA;AAAA,UAWK,SAAA;EACf,EAAA,EAAI,aAAA;EACJ,IAAA;EACA,IAAA;EACA,WAAA;EACA,OAAA;EACA,SAAA;AAAA;AAAA,UAGe,cAAA;EACf,KAAA;EACA,IAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA,GAAU,YAAA;AAAA;AAAA,UAGK,mBAAA;EACf,WAAA;EACA,QAAA;EACA,KAAA,GAAQ,aAAA;EACR,OAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA;EACA,QAAA;EACA,QAAA;EACA,cAAA;EACA,UAAA,IAAc,QAAA,EAAU,cAAA;EACxB,OAAA;EACA,OAAA;EACA,KAAA;EACA,OAAA;EHqIwG;EGnIxG,QAAA,GAAW,YAAA;EHmI4F;EGjIvG,YAAA,GAAe,YAAA;AAAA;AAAA,UAGA,cAAA;EACf,SAAA;EACA,YAAA;EACA,KAAA;EACA,QAAA;EACA,SAAA;EACA,YAAA;EACA,KAAA;IAAU,WAAA;IAAqB,YAAA;IAAsB,WAAA;EAAA;EACrD,IAAA;EACA,YAAA;AAAA;;;iBC5Bc,YAAA,CAAa,EAAA,EAAI,aAAA;AAAA,iBAIjB,aAAA,CAAc,EAAA,EAAI,aAAA;AAAA,iBAQZ,kBAAA,CAAA,GAAsB,OAAA,CAAJ,SAAA;AAAA,iBAgQlB,YAAA,CAAa,IAAA,EAAM,mBAAA,GAAsB,OAAA,CAAQ,cAAA;;;;;;iBCxTvD,qBAAA,CAAA,GAAyB,SAAA;;ALHzC;;;;;AAGA;iBKagB,iBAAA,CAAA,GAAqB,SAAA;;;;iBAkBrB,eAAA,CAAgB,SAAA,EAAW,SAAA;;;;AN5B3C;;;UOJiB,YAAA;EACf,IAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,UAGe,YAAA;EACf,QAAA,EAAU,YAAA;EACV,KAAA;AAAA;;ANPF;;;iBM+BsB,sBAAA,CAAuB,GAAA,YAA8B,OAAA,CAAQ,YAAA;;;;;;iBC5BnE,YAAA,CAAa,IAAA;;APN7B;;;;;AAGA;;;iBOoBgB,mBAAA,CAAoB,WAAA,UAAqB,OAAA;;APZzD;;;iBOyBgB,qBAAA,CACd,SAAA,UACA,YAAA,UACA,OAAA;EACE,MAAA;EACA,GAAA;EACA,MAAA,GAAS,SAAA;EAET,KAAA,GAAQ,MAAA;AAAA;EAEP,SAAA,EAAW,SAAA;EAAa,KAAA;AAAA;;;UChDZ,gBAAA;ETUX;ESRJ,IAAA;;EAEA,QAAA;ERFU;EQIV,WAAA;;EAEA,WAAA;AAAA;AAAA,UAGe,WAAA;ERDhB;EQGC,KAAA,EAAO,SAAA;ERR0B;EQUjC,WAAA;ERFW;EQOX,eAAA;;EAEA,SAAA;ERT4C;EQW5C,aAAA,GAAgB,GAAA;ERTsB;EQWtC,GAAA;ERU2B;EQL3B,aAAA;ERbA;EQeA,SAAA;ERXA;EQaA,eAAA;ERTA;EQWA,oBAAA;ERPA;EQYA,WAAA,EAAa,gBAAA;ERRb;EQUA,cAAA;ERRe;EQUf,WAAA;ERV2B;EQe3B,iBAAA;ERiGgC;EQ/FhC,cAAA;ER+FwF;EQ1FxF,eAAA;ER0FmE;EQxFnE,UAAA;ERwFiC;EQnFjC,IAAA;ERmF0F;EQjF1F,KAAA;AAAA;;;cCvDW,OAAA,EAAS,MAAA,CAAO,SAAA,EAAW,WAAA"}
|
package/dist/agent/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { _ as buildSectionPrompt, a as optimizeDocs, b as getAgentVersion, c as computeSkillDirName, g as buildAllSectionPrompts, h as SECTION_OUTPUT_FILES, i as getModelName, l as installSkillForAgents, m as SECTION_MERGE_ORDER, n as getAvailableModels, o as generateSkillMd, r as getModelLabel, s as FILE_PATTERN_MAP, t as detectImportedPackages, u as sanitizeName, v as detectInstalledAgents, x as targets, y as detectTargetAgent } from "../_chunks/detect-imports.mjs";
|
|
1
2
|
import "../_chunks/config.mjs";
|
|
2
3
|
import "../_chunks/storage.mjs";
|
|
3
|
-
|
|
4
|
-
export { FILE_PATTERN_MAP, SECTION_MERGE_ORDER, SECTION_OUTPUT_FILES, agents, buildAllSectionPrompts, buildSectionPrompt, computeSkillDirName, detectImportedPackages, detectInstalledAgents, detectTargetAgent, generateSkillMd, getAgentVersion, getAvailableModels, getModelLabel, getModelName, installSkillForAgents, optimizeDocs, sanitizeName };
|
|
4
|
+
export { FILE_PATTERN_MAP, SECTION_MERGE_ORDER, SECTION_OUTPUT_FILES, targets as agents, buildAllSectionPrompts, buildSectionPrompt, computeSkillDirName, detectImportedPackages, detectInstalledAgents, detectTargetAgent, generateSkillMd, getAgentVersion, getAvailableModels, getModelLabel, getModelName, installSkillForAgents, optimizeDocs, sanitizeName };
|
package/dist/cache/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { CACHE_DIR, type CacheConfig, type CachedDoc, type CachedPackage, REFERENCES_DIR,
|
|
1
|
+
import { C as CacheConfig, D as REFERENCES_DIR, E as CACHE_DIR, O as getPackageDbPath, S as writeToCache, T as CachedPackage, _ as listReferenceFiles, a as clearAllCache, b as resolvePkgDir, c as getPkgKeyFiles, d as isCached, f as linkCachedDir, g as listCached, h as linkShippedSkill, i as ShippedSkill, l as getShippedSkills, m as linkPkgNamed, n as getCacheKey, o as clearCache, p as linkPkg, r as getVersionKey, s as ensureCacheDir, t as getCacheDir, u as hasShippedDocs, v as readCachedDocs, w as CachedDoc, x as writeSections, y as readCachedSection } from "../_chunks/version.mjs";
|
|
2
|
+
export { CACHE_DIR, type CacheConfig, type CachedDoc, type CachedPackage, REFERENCES_DIR, type ShippedSkill, clearAllCache, clearCache, ensureCacheDir, getCacheDir, getCacheKey, getPackageDbPath, getPkgKeyFiles, getShippedSkills, getVersionKey, hasShippedDocs, isCached, linkCachedDir, linkPkg, linkPkgNamed, linkShippedSkill, listCached, listReferenceFiles, readCachedDocs, readCachedSection, resolvePkgDir, writeSections, writeToCache };
|
package/dist/cache/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
export { CACHE_DIR, REFERENCES_DIR,
|
|
1
|
+
import { a as getCacheKey, i as getCacheDir, n as REFERENCES_DIR, o as getVersionKey, r as getPackageDbPath, t as CACHE_DIR } from "../_chunks/config.mjs";
|
|
2
|
+
import { _ as writeSections, a as getShippedSkills, c as linkCachedDir, d as linkShippedSkill, f as listCached, g as resolvePkgDir, h as readCachedSection, i as getPkgKeyFiles, l as linkPkg, m as readCachedDocs, n as clearCache, o as hasShippedDocs, p as listReferenceFiles, r as ensureCacheDir, s as isCached, t as clearAllCache, u as linkPkgNamed, v as writeToCache } from "../_chunks/storage.mjs";
|
|
3
|
+
export { CACHE_DIR, REFERENCES_DIR, clearAllCache, clearCache, ensureCacheDir, getCacheDir, getCacheKey, getPackageDbPath, getPkgKeyFiles, getShippedSkills, getVersionKey, hasShippedDocs, isCached, linkCachedDir, linkPkg, linkPkgNamed, linkShippedSkill, listCached, listReferenceFiles, readCachedDocs, readCachedSection, resolvePkgDir, writeSections, writeToCache };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
2
|
+
import { S as __require, a as optimizeDocs, b as getAgentVersion, c as computeSkillDirName, d as yamlEscape, f as yamlParseKV, i as getModelName, n as getAvailableModels, o as generateSkillMd, p as yamlUnescape, r as getModelLabel, t as detectImportedPackages, v as detectInstalledAgents, x as targets, y as detectTargetAgent } from "./_chunks/detect-imports.mjs";
|
|
3
|
+
import { i as getCacheDir, o as getVersionKey, r as getPackageDbPath, t as CACHE_DIR } from "./_chunks/config.mjs";
|
|
4
|
+
import { a as getShippedSkills, b as sanitizeMarkdown, c as linkCachedDir, d as linkShippedSkill, g as resolvePkgDir, i as getPkgKeyFiles, l as linkPkg, m as readCachedDocs, n as clearCache, o as hasShippedDocs, p as listReferenceFiles, r as ensureCacheDir, s as isCached, u as linkPkgNamed, v as writeToCache } from "./_chunks/storage.mjs";
|
|
4
5
|
import "./cache/index.mjs";
|
|
5
6
|
import { closePool, createIndex, openPool, searchPooled, searchSnippets } from "./retriv/index.mjs";
|
|
6
7
|
import { B as formatDiscussionAsMarkdown, C as fetchGitDocs, D as isShallowGitDocs, E as fetchReadmeContent, G as isGhAvailable, H as fetchGitHubIssues, P as parseGitHubUrl, R as resolveEntryFiles, U as formatIssueAsMarkdown, V as generateDiscussionIndex, W as generateIssueIndex, a as fetchNpmRegistryMeta, b as normalizeLlmsLinks, f as resolveLocalPackageDocs, g as downloadLlmsDocs, h as searchNpmPackages, i as fetchNpmPackage, k as $fetch, l as readLocalDependencies, m as resolvePackageDocsWithAttempts, o as fetchPkgDist, p as resolvePackageDocs, r as fetchLatestVersion, t as fetchReleaseNotes, v as fetchLlmsTxt, z as fetchGitHubDiscussions } from "./_chunks/releases.mjs";
|
|
7
8
|
import "./sources/index.mjs";
|
|
8
|
-
import { _ as detectImportedPackages, a as generateSkillMd, b as getAgentVersion, c as yamlParseKV, i as optimizeDocs, l as yamlUnescape, m as computeSkillDirName, n as getModelLabel, r as getModelName, s as yamlEscape, t as getAvailableModels, v as detectInstalledAgents, x as agents, y as detectTargetAgent } from "./_chunks/llm.mjs";
|
|
9
9
|
import "./agent/index.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { homedir } from "node:os";
|
|
@@ -15,9 +15,7 @@ import { execSync } from "node:child_process";
|
|
|
15
15
|
import pLimit from "p-limit";
|
|
16
16
|
import * as p from "@clack/prompts";
|
|
17
17
|
import { defineCommand, runMain } from "citty";
|
|
18
|
-
import { resolve as resolve$1 } from "node:path";
|
|
19
18
|
import { detectCurrentAgent } from "unagent/env";
|
|
20
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
21
19
|
const LLM_CACHE_DIR = join(CACHE_DIR, "llm-cache");
|
|
22
20
|
const LLM_CACHE_MAX_AGE = 10080 * 60 * 1e3;
|
|
23
21
|
async function cacheCleanCommand() {
|
|
@@ -249,7 +247,7 @@ async function configCommand() {
|
|
|
249
247
|
options: [{
|
|
250
248
|
label: "Auto-detect",
|
|
251
249
|
value: ""
|
|
252
|
-
}, ...Object.entries(
|
|
250
|
+
}, ...Object.entries(targets).map(([id, a]) => ({
|
|
253
251
|
label: a.displayName,
|
|
254
252
|
value: id,
|
|
255
253
|
hint: a.skillsDir
|
|
@@ -263,6 +261,23 @@ async function configCommand() {
|
|
|
263
261
|
}
|
|
264
262
|
}
|
|
265
263
|
}
|
|
264
|
+
function timeAgo(iso) {
|
|
265
|
+
if (!iso) return "";
|
|
266
|
+
const diff = Date.now() - new Date(iso).getTime();
|
|
267
|
+
const days = Math.floor(diff / 864e5);
|
|
268
|
+
if (days <= 0) return "today";
|
|
269
|
+
if (days === 1) return "1d ago";
|
|
270
|
+
if (days < 7) return `${days}d ago`;
|
|
271
|
+
if (days < 30) return `${Math.floor(days / 7)}w ago`;
|
|
272
|
+
return `${Math.floor(days / 30)}mo ago`;
|
|
273
|
+
}
|
|
274
|
+
function formatSource(source) {
|
|
275
|
+
if (!source) return "";
|
|
276
|
+
if (source === "shipped") return "shipped";
|
|
277
|
+
if (source.includes("llms.txt")) return "llms.txt";
|
|
278
|
+
if (source.includes("github.com")) return source.replace(/https?:\/\/github\.com\//, "");
|
|
279
|
+
return source;
|
|
280
|
+
}
|
|
266
281
|
function formatDuration(ms) {
|
|
267
282
|
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
268
283
|
return `${(ms / 1e3).toFixed(1)}s`;
|
|
@@ -414,6 +429,23 @@ function writeLock(skillsDir, skillName, info) {
|
|
|
414
429
|
lock.skills[skillName] = info;
|
|
415
430
|
writeFileSync(lockPath, serializeLock(lock));
|
|
416
431
|
}
|
|
432
|
+
function mergeLocks(locks) {
|
|
433
|
+
const merged = {};
|
|
434
|
+
for (const lock of locks) for (const [name, info] of Object.entries(lock.skills)) {
|
|
435
|
+
const existing = merged[name];
|
|
436
|
+
if (!existing || info.syncedAt && (!existing.syncedAt || info.syncedAt > existing.syncedAt)) merged[name] = info;
|
|
437
|
+
}
|
|
438
|
+
return { skills: merged };
|
|
439
|
+
}
|
|
440
|
+
function syncLockfilesToDirs(sourceLock, dirs) {
|
|
441
|
+
for (const dir of dirs) {
|
|
442
|
+
const lockPath = join(dir, "skilld-lock.yaml");
|
|
443
|
+
if (!existsSync(lockPath)) continue;
|
|
444
|
+
const existing = readLock(dir);
|
|
445
|
+
if (!existing) continue;
|
|
446
|
+
writeFileSync(lockPath, serializeLock(mergeLocks([existing, sourceLock])));
|
|
447
|
+
}
|
|
448
|
+
}
|
|
417
449
|
function removeLockEntry(skillsDir, skillName) {
|
|
418
450
|
const lockPath = join(skillsDir, "skilld-lock.yaml");
|
|
419
451
|
const lock = readLock(skillsDir);
|
|
@@ -480,11 +512,11 @@ function linkAllReferences(skillDir, packageName, cwd, version, docsType, extraP
|
|
|
480
512
|
try {
|
|
481
513
|
linkPkg(skillDir, packageName, cwd, version);
|
|
482
514
|
linkPkgNamed(skillDir, packageName, cwd, version);
|
|
483
|
-
if (!hasShippedDocs(packageName, cwd, version) && docsType !== "readme")
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
515
|
+
if (!hasShippedDocs(packageName, cwd, version) && docsType !== "readme") linkCachedDir(skillDir, packageName, version, "docs");
|
|
516
|
+
linkCachedDir(skillDir, packageName, version, "issues");
|
|
517
|
+
linkCachedDir(skillDir, packageName, version, "discussions");
|
|
518
|
+
linkCachedDir(skillDir, packageName, version, "releases");
|
|
519
|
+
linkCachedDir(skillDir, packageName, version, "sections");
|
|
488
520
|
if (extraPackages) {
|
|
489
521
|
for (const pkg of extraPackages) if (pkg.name !== packageName) linkPkgNamed(skillDir, pkg.name, cwd, pkg.version);
|
|
490
522
|
}
|
|
@@ -506,7 +538,7 @@ function detectDocsType(packageName, version, repoUrl, llmsUrl) {
|
|
|
506
538
|
function handleShippedSkills(packageName, version, cwd, agent, global) {
|
|
507
539
|
const shippedSkills = getShippedSkills(packageName, cwd, version);
|
|
508
540
|
if (shippedSkills.length === 0) return null;
|
|
509
|
-
const agentConfig =
|
|
541
|
+
const agentConfig = targets[agent];
|
|
510
542
|
const baseDir = global ? join(CACHE_DIR, "skills") : join(cwd, agentConfig.skillsDir);
|
|
511
543
|
mkdirSync(baseDir, { recursive: true });
|
|
512
544
|
for (const shipped of shippedSkills) {
|
|
@@ -526,7 +558,7 @@ function handleShippedSkills(packageName, version, cwd, agent, global) {
|
|
|
526
558
|
};
|
|
527
559
|
}
|
|
528
560
|
function resolveBaseDir(cwd, agent, global) {
|
|
529
|
-
const agentConfig =
|
|
561
|
+
const agentConfig = targets[agent];
|
|
530
562
|
return global ? join(CACHE_DIR, "skills") : join(cwd, agentConfig.skillsDir);
|
|
531
563
|
}
|
|
532
564
|
async function resolveLocalDep(packageName, cwd) {
|
|
@@ -538,7 +570,7 @@ async function resolveLocalDep(packageName, cwd) {
|
|
|
538
570
|
...pkg.devDependencies
|
|
539
571
|
}[packageName];
|
|
540
572
|
if (!depVersion?.startsWith("link:")) return null;
|
|
541
|
-
return resolveLocalPackageDocs(resolve
|
|
573
|
+
return resolveLocalPackageDocs(resolve(cwd, depVersion.slice(5)));
|
|
542
574
|
}
|
|
543
575
|
function detectChangelog(pkgDir) {
|
|
544
576
|
if (!pkgDir) return false;
|
|
@@ -1240,7 +1272,7 @@ async function syncSinglePackage(packageName, config) {
|
|
|
1240
1272
|
}
|
|
1241
1273
|
}
|
|
1242
1274
|
if (!config.global) registerProject(cwd);
|
|
1243
|
-
await ensureGitignore(
|
|
1275
|
+
await ensureGitignore(targets[config.agent].skillsDir, cwd, config.global);
|
|
1244
1276
|
const { shutdownWorker } = await import("./_chunks/pool.mjs");
|
|
1245
1277
|
await shutdownWorker();
|
|
1246
1278
|
p.outro(`Synced ${packageName} to ${relative(cwd, skillDir)}`);
|
|
@@ -1307,13 +1339,15 @@ async function enhanceSkillWithLLM(opts) {
|
|
|
1307
1339
|
}
|
|
1308
1340
|
async function installCommand(opts) {
|
|
1309
1341
|
const cwd = process.cwd();
|
|
1310
|
-
const agent =
|
|
1342
|
+
const agent = targets[opts.agent];
|
|
1311
1343
|
const skillsDir = opts.global ? join(__require("node:os").homedir(), ".skilld", "skills") : join(cwd, agent.skillsDir);
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1344
|
+
const allSkillsDirs = Object.values(targets).map((t) => opts.global ? t.globalSkillsDir : join(cwd, t.skillsDir));
|
|
1345
|
+
const allLocks = allSkillsDirs.map((dir) => readLock(dir)).filter((l) => !!l && Object.keys(l.skills).length > 0);
|
|
1346
|
+
if (allLocks.length === 0) {
|
|
1314
1347
|
p.log.warn("No skilld-lock.yaml found. Run `skilld` to sync skills first.");
|
|
1315
1348
|
return;
|
|
1316
1349
|
}
|
|
1350
|
+
const lock = mergeLocks(allLocks);
|
|
1317
1351
|
const skills = Object.entries(lock.skills);
|
|
1318
1352
|
const toRestore = [];
|
|
1319
1353
|
for (const [name, info] of skills) {
|
|
@@ -1547,6 +1581,8 @@ async function installCommand(opts) {
|
|
|
1547
1581
|
for (const { pkgName, version, skillDir, packages: pkgPackages } of regenerated) await enhanceRegenerated(pkgName, version, skillDir, llmConfig.model, llmConfig.sections, llmConfig.customPrompt, pkgPackages);
|
|
1548
1582
|
}
|
|
1549
1583
|
}
|
|
1584
|
+
for (const [name, info] of Object.entries(lock.skills)) writeLock(skillsDir, name, info);
|
|
1585
|
+
syncLockfilesToDirs(lock, allSkillsDirs.filter((d) => d !== skillsDir));
|
|
1550
1586
|
const { shutdownWorker } = await import("./_chunks/pool.mjs");
|
|
1551
1587
|
await shutdownWorker();
|
|
1552
1588
|
p.outro("Install complete");
|
|
@@ -1694,9 +1730,9 @@ function regenerateBaseSkillMd(skillDir, pkgName, version, cwd, allSkillNames, s
|
|
|
1694
1730
|
}
|
|
1695
1731
|
function* iterateSkills(opts = {}) {
|
|
1696
1732
|
const { scope = "all", cwd = process.cwd() } = opts;
|
|
1697
|
-
const agentTypes = opts.agents ?? Object.keys(
|
|
1733
|
+
const agentTypes = opts.agents ?? Object.keys(targets);
|
|
1698
1734
|
for (const agentType of agentTypes) {
|
|
1699
|
-
const agent =
|
|
1735
|
+
const agent = targets[agentType];
|
|
1700
1736
|
if (scope === "local" || scope === "all") {
|
|
1701
1737
|
const localDir = join(cwd, agent.skillsDir);
|
|
1702
1738
|
if (existsSync(localDir)) {
|
|
@@ -1802,30 +1838,13 @@ async function getProjectState(cwd = process.cwd()) {
|
|
|
1802
1838
|
};
|
|
1803
1839
|
}
|
|
1804
1840
|
function getSkillsDir(agent, scope, cwd = process.cwd()) {
|
|
1805
|
-
const agentConfig =
|
|
1841
|
+
const agentConfig = targets[agent];
|
|
1806
1842
|
if (scope === "global") {
|
|
1807
1843
|
if (!agentConfig.globalSkillsDir) throw new Error(`Agent ${agent} does not support global skills`);
|
|
1808
1844
|
return agentConfig.globalSkillsDir;
|
|
1809
1845
|
}
|
|
1810
1846
|
return join(cwd, agentConfig.skillsDir);
|
|
1811
1847
|
}
|
|
1812
|
-
function formatSource$1(source) {
|
|
1813
|
-
if (!source) return "";
|
|
1814
|
-
if (source === "shipped") return "shipped";
|
|
1815
|
-
if (source.includes("llms.txt")) return "llms.txt";
|
|
1816
|
-
if (source.includes("github.com")) return source.replace(/https?:\/\/github\.com\//, "");
|
|
1817
|
-
return source;
|
|
1818
|
-
}
|
|
1819
|
-
function timeAgo$1(iso) {
|
|
1820
|
-
if (!iso) return "";
|
|
1821
|
-
const diff = Date.now() - new Date(iso).getTime();
|
|
1822
|
-
const days = Math.floor(diff / 864e5);
|
|
1823
|
-
if (days <= 0) return "today";
|
|
1824
|
-
if (days === 1) return "1d ago";
|
|
1825
|
-
if (days < 7) return `${days}d ago`;
|
|
1826
|
-
if (days < 30) return `${Math.floor(days / 7)}w ago`;
|
|
1827
|
-
return `${Math.floor(days / 30)}mo ago`;
|
|
1828
|
-
}
|
|
1829
1848
|
function listCommand(opts = {}) {
|
|
1830
1849
|
const skills = [...iterateSkills({ scope: opts.global ? "global" : "all" })];
|
|
1831
1850
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1837,8 +1856,8 @@ function listCommand(opts = {}) {
|
|
|
1837
1856
|
entries.push({
|
|
1838
1857
|
name: skill.name,
|
|
1839
1858
|
version: skill.info?.version || "",
|
|
1840
|
-
source: formatSource
|
|
1841
|
-
synced: timeAgo
|
|
1859
|
+
source: formatSource(skill.info?.source),
|
|
1860
|
+
synced: timeAgo(skill.info?.syncedAt)
|
|
1842
1861
|
});
|
|
1843
1862
|
}
|
|
1844
1863
|
if (opts.json) {
|
|
@@ -1915,7 +1934,7 @@ async function pickSkillsToRemove(skills, scope) {
|
|
|
1915
1934
|
function findPackageDbs(packageFilter) {
|
|
1916
1935
|
const agent = detectTargetAgent();
|
|
1917
1936
|
if (!agent) return [];
|
|
1918
|
-
const lock = readLock(`${process.cwd()}/${
|
|
1937
|
+
const lock = readLock(`${process.cwd()}/${targets[agent].skillsDir}`);
|
|
1919
1938
|
if (!lock) return [];
|
|
1920
1939
|
const normalize = (s) => s.toLowerCase().replace(/[-_@/]/g, "");
|
|
1921
1940
|
return Object.values(lock.skills).filter((info) => {
|
|
@@ -2247,23 +2266,6 @@ function countRefDocs(skillDir) {
|
|
|
2247
2266
|
walk(refsDir);
|
|
2248
2267
|
return count;
|
|
2249
2268
|
}
|
|
2250
|
-
function timeAgo(iso) {
|
|
2251
|
-
if (!iso) return "";
|
|
2252
|
-
const diff = Date.now() - new Date(iso).getTime();
|
|
2253
|
-
const days = Math.floor(diff / 864e5);
|
|
2254
|
-
if (days <= 0) return "today";
|
|
2255
|
-
if (days === 1) return "1d ago";
|
|
2256
|
-
if (days < 7) return `${days}d ago`;
|
|
2257
|
-
if (days < 30) return `${Math.floor(days / 7)}w ago`;
|
|
2258
|
-
return `${Math.floor(days / 30)}mo ago`;
|
|
2259
|
-
}
|
|
2260
|
-
function formatSource(source) {
|
|
2261
|
-
if (!source) return "";
|
|
2262
|
-
if (source === "shipped") return "shipped";
|
|
2263
|
-
if (source.includes("llms.txt")) return "llms.txt";
|
|
2264
|
-
if (source.includes("github.com")) return source.replace(/https?:\/\/github\.com\//, "");
|
|
2265
|
-
return source;
|
|
2266
|
-
}
|
|
2267
2269
|
const dim = (s) => `\x1B[90m${s}\x1B[0m`;
|
|
2268
2270
|
const bold = (s) => `\x1B[1m${s}\x1B[0m`;
|
|
2269
2271
|
const green = (s) => `\x1B[32m${s}\x1B[0m`;
|
|
@@ -2284,7 +2286,7 @@ function buildConfigLines() {
|
|
|
2284
2286
|
if (lastSynced) lines.push(`Synced ${dim(lastSynced)}`);
|
|
2285
2287
|
lines.push(`Config ${dim(join(CACHE_DIR, "config.yaml"))}${hasConfig() ? "" : dim(" (not created)")}`);
|
|
2286
2288
|
lines.push(`Cache ${dim(CACHE_DIR)}`);
|
|
2287
|
-
const withCli = Object.entries(
|
|
2289
|
+
const withCli = Object.entries(targets).filter(([_, a]) => a.cli);
|
|
2288
2290
|
const installed = [];
|
|
2289
2291
|
for (const [id, agent] of withCli) {
|
|
2290
2292
|
const ver = getAgentVersion(id);
|
|
@@ -2336,14 +2338,14 @@ function statusCommand(opts = {}) {
|
|
|
2336
2338
|
lines.push(parts.join(" "));
|
|
2337
2339
|
const meta = [];
|
|
2338
2340
|
const pkgName = info.packageName || pkg.name;
|
|
2339
|
-
const docs = countDocs(pkgName, info.version) || countRefDocs(join(pkg.scope === "global" ?
|
|
2341
|
+
const docs = countDocs(pkgName, info.version) || countRefDocs(join(pkg.scope === "global" ? targets[pkg.agents.values().next().value].globalSkillsDir : join(process.cwd(), targets[pkg.agents.values().next().value].skillsDir), pkg.name));
|
|
2340
2342
|
if (docs > 0) meta.push(`${docs} docs`);
|
|
2341
2343
|
const embeddings = countEmbeddings(pkgName, info.version);
|
|
2342
2344
|
if (embeddings !== null) meta.push(`${embeddings} chunks`);
|
|
2343
2345
|
const ago = timeAgo(info.syncedAt);
|
|
2344
2346
|
if (ago) meta.push(`synced ${ago}`);
|
|
2345
2347
|
if (pkg.agents.size > 0) {
|
|
2346
|
-
const agentNames = [...pkg.agents].map((a) =>
|
|
2348
|
+
const agentNames = [...pkg.agents].map((a) => targets[a].displayName);
|
|
2347
2349
|
meta.push(agentNames.join(", "));
|
|
2348
2350
|
}
|
|
2349
2351
|
if (meta.length > 0) lines.push(` ${dim(meta.join(" · "))}`);
|
|
@@ -2435,7 +2437,7 @@ async function uninstallCommand(opts) {
|
|
|
2435
2437
|
});
|
|
2436
2438
|
};
|
|
2437
2439
|
if (scope === "project") {
|
|
2438
|
-
for (const [name, agent] of Object.entries(
|
|
2440
|
+
for (const [name, agent] of Object.entries(targets)) {
|
|
2439
2441
|
if (agentFilter && !agentFilter.includes(name)) continue;
|
|
2440
2442
|
processSkillsDir(join(process.cwd(), agent.skillsDir), "project");
|
|
2441
2443
|
}
|
|
@@ -2450,13 +2452,13 @@ async function uninstallCommand(opts) {
|
|
|
2450
2452
|
for (const projectPath of projectPaths) {
|
|
2451
2453
|
if (!existsSync(projectPath)) continue;
|
|
2452
2454
|
const shortPath = projectPath.replace(process.env.HOME || "", "~");
|
|
2453
|
-
for (const [name, agent] of Object.entries(
|
|
2455
|
+
for (const [name, agent] of Object.entries(targets)) {
|
|
2454
2456
|
if (agentFilter && !agentFilter.includes(name)) continue;
|
|
2455
2457
|
processSkillsDir(join(projectPath, agent.skillsDir), shortPath);
|
|
2456
2458
|
}
|
|
2457
2459
|
projectsToUnregister.push(projectPath);
|
|
2458
2460
|
}
|
|
2459
|
-
for (const [name, agent] of Object.entries(
|
|
2461
|
+
for (const [name, agent] of Object.entries(targets)) {
|
|
2460
2462
|
if (agentFilter && !agentFilter.includes(name)) continue;
|
|
2461
2463
|
if (!agent.globalSkillsDir) continue;
|
|
2462
2464
|
processSkillsDir(agent.globalSkillsDir, "user");
|
|
@@ -2727,10 +2729,10 @@ function introLine({ state, generators, modelId }) {
|
|
|
2727
2729
|
return `${name} ${ver}${synced}${genStr ? `\n\x1B[90m↳ ${genStr}${modelStr}\x1B[0m` : ""}`;
|
|
2728
2730
|
}
|
|
2729
2731
|
function getInstalledGenerators() {
|
|
2730
|
-
return detectInstalledAgents().filter((id) =>
|
|
2732
|
+
return detectInstalledAgents().filter((id) => targets[id].cli).map((id) => {
|
|
2731
2733
|
const version = getAgentVersion(id);
|
|
2732
2734
|
return version ? {
|
|
2733
|
-
name:
|
|
2735
|
+
name: targets[id].displayName,
|
|
2734
2736
|
version
|
|
2735
2737
|
} : null;
|
|
2736
2738
|
}).filter((a) => a !== null);
|
|
@@ -2755,12 +2757,12 @@ function resolveAgent(agentFlag) {
|
|
|
2755
2757
|
}
|
|
2756
2758
|
async function promptForAgent() {
|
|
2757
2759
|
const installed = detectInstalledAgents();
|
|
2758
|
-
const options = (installed.length ? installed : Object.keys(
|
|
2759
|
-
label:
|
|
2760
|
+
const options = (installed.length ? installed : Object.keys(targets)).map((id) => ({
|
|
2761
|
+
label: targets[id].displayName,
|
|
2760
2762
|
value: id,
|
|
2761
|
-
hint:
|
|
2763
|
+
hint: targets[id].skillsDir
|
|
2762
2764
|
}));
|
|
2763
|
-
const hint = installed.length ? `Detected ${installed.map((t) =>
|
|
2765
|
+
const hint = installed.length ? `Detected ${installed.map((t) => targets[t].displayName).join(", ")} but couldn't determine which to use` : "No agents auto-detected";
|
|
2764
2766
|
p.log.warn(`Could not detect which coding agent to install skills for.\n ${hint}`);
|
|
2765
2767
|
const choice = await p.select({
|
|
2766
2768
|
message: "Which coding agent should skills be installed for?",
|
|
@@ -2768,7 +2770,7 @@ async function promptForAgent() {
|
|
|
2768
2770
|
});
|
|
2769
2771
|
if (p.isCancel(choice)) return null;
|
|
2770
2772
|
updateConfig({ agent: choice });
|
|
2771
|
-
p.log.success(`Default agent set to ${
|
|
2773
|
+
p.log.success(`Default agent set to ${targets[choice].displayName}`);
|
|
2772
2774
|
return choice;
|
|
2773
2775
|
}
|
|
2774
2776
|
const sharedArgs = {
|