ccski 0.0.0 → 1.0.1

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.
@@ -0,0 +1,340 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/types/skill.d.ts
4
+ /**
5
+ * Skill location types
6
+ */
7
+ type SkillLocation = "user" | "project" | "plugin";
8
+ /**
9
+ * Core skill metadata interface
10
+ */
11
+ interface SkillMetadata {
12
+ /** Skill name (from frontmatter) */
13
+ name: string;
14
+ /** Skill description (from frontmatter) */
15
+ description: string;
16
+ /** Whether the skill is disabled (.SKILL.md) */
17
+ disabled?: boolean;
18
+ /** Location type */
19
+ location: SkillLocation;
20
+ /** Absolute path to skill directory */
21
+ path: string;
22
+ /** Whether the skill has a references/ directory */
23
+ hasReferences: boolean;
24
+ /** Whether the skill has a scripts/ directory */
25
+ hasScripts: boolean;
26
+ /** Whether the skill has an assets/ directory */
27
+ hasAssets: boolean;
28
+ /** Plugin information (only for plugin skills) */
29
+ pluginInfo?: {
30
+ pluginName: string;
31
+ marketplace: string;
32
+ version: string;
33
+ };
34
+ }
35
+ /**
36
+ * Complete skill interface with content
37
+ */
38
+ interface Skill extends SkillMetadata {
39
+ /** Full markdown content (including frontmatter) */
40
+ content: string;
41
+ /** Full qualified name (e.g., "plugin:skill" for plugin skills) */
42
+ fullName: string;
43
+ }
44
+ /**
45
+ * SKILL.md frontmatter interface
46
+ */
47
+ interface SkillFrontmatter {
48
+ name: string;
49
+ description: string;
50
+ [key: string]: unknown;
51
+ }
52
+ /**
53
+ * Plugin registry entry from installed_plugins.json
54
+ */
55
+ interface PluginEntry {
56
+ version: string;
57
+ installedAt: string;
58
+ lastUpdated: string;
59
+ installPath: string;
60
+ gitCommitSha: string;
61
+ isLocal: boolean;
62
+ }
63
+ /**
64
+ * Installed plugins JSON structure
65
+ */
66
+ interface InstalledPlugins {
67
+ version: number;
68
+ plugins: Record<string, PluginEntry>;
69
+ }
70
+ //#endregion
71
+ //#region src/types/errors.d.ts
72
+ /**
73
+ * Base error class for ccski errors
74
+ */
75
+ declare class CcskiError extends Error {
76
+ readonly suggestions: string[];
77
+ constructor(message: string, suggestions?: string[]);
78
+ }
79
+ /**
80
+ * Error thrown when a skill is not found
81
+ */
82
+ declare class SkillNotFoundError extends CcskiError {
83
+ skillName: string;
84
+ constructor(skillName: string, suggestions?: string[]);
85
+ }
86
+ /**
87
+ * Error thrown when a skill name is ambiguous
88
+ */
89
+ declare class AmbiguousSkillNameError extends CcskiError {
90
+ skillName: string;
91
+ matches: string[];
92
+ constructor(skillName: string, matches: string[]);
93
+ }
94
+ /**
95
+ * Error thrown when skill validation fails
96
+ */
97
+ declare class ValidationError extends CcskiError {
98
+ filePath: string;
99
+ issues: string[];
100
+ constructor(filePath: string, issues: string[], suggestions?: string[]);
101
+ }
102
+ /**
103
+ * Error thrown when parsing SKILL.md fails
104
+ */
105
+ declare class ParseError extends CcskiError {
106
+ filePath: string;
107
+ reason: string;
108
+ constructor(filePath: string, reason: string, suggestions?: string[]);
109
+ }
110
+ //#endregion
111
+ //#region src/types/schemas.d.ts
112
+ /**
113
+ * Schema for SKILL.md frontmatter
114
+ */
115
+ declare const SkillFrontmatterSchema: z.ZodObject<{
116
+ name: z.ZodString;
117
+ description: z.ZodString;
118
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
119
+ name: z.ZodString;
120
+ description: z.ZodString;
121
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
122
+ name: z.ZodString;
123
+ description: z.ZodString;
124
+ }, z.ZodTypeAny, "passthrough">>;
125
+ /**
126
+ * Schema for plugin entry in installed_plugins.json
127
+ */
128
+ declare const PluginEntrySchema: z.ZodObject<{
129
+ version: z.ZodString;
130
+ installedAt: z.ZodString;
131
+ lastUpdated: z.ZodString;
132
+ installPath: z.ZodString;
133
+ gitCommitSha: z.ZodString;
134
+ isLocal: z.ZodBoolean;
135
+ }, "strip", z.ZodTypeAny, {
136
+ version: string;
137
+ installedAt: string;
138
+ lastUpdated: string;
139
+ installPath: string;
140
+ gitCommitSha: string;
141
+ isLocal: boolean;
142
+ }, {
143
+ version: string;
144
+ installedAt: string;
145
+ lastUpdated: string;
146
+ installPath: string;
147
+ gitCommitSha: string;
148
+ isLocal: boolean;
149
+ }>;
150
+ /**
151
+ * Schema for installed_plugins.json
152
+ */
153
+ declare const InstalledPluginsSchema: z.ZodObject<{
154
+ version: z.ZodNumber;
155
+ plugins: z.ZodRecord<z.ZodString, z.ZodObject<{
156
+ version: z.ZodString;
157
+ installedAt: z.ZodString;
158
+ lastUpdated: z.ZodString;
159
+ installPath: z.ZodString;
160
+ gitCommitSha: z.ZodString;
161
+ isLocal: z.ZodBoolean;
162
+ }, "strip", z.ZodTypeAny, {
163
+ version: string;
164
+ installedAt: string;
165
+ lastUpdated: string;
166
+ installPath: string;
167
+ gitCommitSha: string;
168
+ isLocal: boolean;
169
+ }, {
170
+ version: string;
171
+ installedAt: string;
172
+ lastUpdated: string;
173
+ installPath: string;
174
+ gitCommitSha: string;
175
+ isLocal: boolean;
176
+ }>>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ version: number;
179
+ plugins: Record<string, {
180
+ version: string;
181
+ installedAt: string;
182
+ lastUpdated: string;
183
+ installPath: string;
184
+ gitCommitSha: string;
185
+ isLocal: boolean;
186
+ }>;
187
+ }, {
188
+ version: number;
189
+ plugins: Record<string, {
190
+ version: string;
191
+ installedAt: string;
192
+ lastUpdated: string;
193
+ installPath: string;
194
+ gitCommitSha: string;
195
+ isLocal: boolean;
196
+ }>;
197
+ }>;
198
+ /**
199
+ * Infer TypeScript types from Zod schemas
200
+ */
201
+ type SkillFrontmatterType = z.infer<typeof SkillFrontmatterSchema>;
202
+ type PluginEntryType = z.infer<typeof PluginEntrySchema>;
203
+ type InstalledPluginsType = z.infer<typeof InstalledPluginsSchema>;
204
+ //#endregion
205
+ //#region src/core/parser.d.ts
206
+ /**
207
+ * Parse result from parseSkillFile
208
+ */
209
+ interface ParseResult {
210
+ frontmatter: SkillFrontmatter;
211
+ content: string;
212
+ fullContent: string;
213
+ }
214
+ /**
215
+ * Parse a SKILL.md file and extract frontmatter and content
216
+ *
217
+ * @param filePath - Absolute path to SKILL.md file
218
+ * @returns Parsed frontmatter and content
219
+ * @throws {ParseError} If file cannot be read or parsed
220
+ * @throws {ValidationError} If frontmatter validation fails
221
+ */
222
+ declare function parseSkillFile(filePath: string): ParseResult;
223
+ /**
224
+ * Validate a SKILL.md file without throwing errors
225
+ *
226
+ * @param filePath - Absolute path to SKILL.md file
227
+ * @returns Validation result with success flag and error messages
228
+ */
229
+ declare function validateSkillFile(filePath: string): {
230
+ success: boolean;
231
+ errors: string[];
232
+ suggestions: string[];
233
+ };
234
+ //#endregion
235
+ //#region src/core/discovery.d.ts
236
+ /**
237
+ * Skill directories in priority order (highest to lowest)
238
+ */
239
+ declare const SKILL_DIRECTORIES: readonly [".agent/skills", ".claude/skills", `${string}/.agent/skills`, `${string}/.claude/skills`];
240
+ interface DiscoveryDiagnostics {
241
+ scannedDirectories: string[];
242
+ warnings: string[];
243
+ conflicts: string[];
244
+ }
245
+ interface DiscoveryResult {
246
+ skills: SkillMetadata[];
247
+ diagnostics: DiscoveryDiagnostics;
248
+ }
249
+ /**
250
+ * Options for skill discovery
251
+ */
252
+ interface DiscoveryOptions {
253
+ /** Additional custom directories to scan */
254
+ customDirs?: string[];
255
+ /** Skip plugin skills */
256
+ skipPlugins?: boolean;
257
+ /** Whether to scan built-in directories (.agent/.claude). Defaults to true. */
258
+ scanDefaultDirs?: boolean;
259
+ /** Include disabled skills (.SKILL.md) in results */
260
+ includeDisabled?: boolean;
261
+ }
262
+ interface ScanOptions {
263
+ location?: SkillLocation;
264
+ recursive?: boolean;
265
+ diagnostics: DiscoveryDiagnostics;
266
+ includeDisabled?: boolean;
267
+ }
268
+ /**
269
+ * Scan a single skill directory and return found skills
270
+ */
271
+ declare function scanSkillDirectory(dirPath: string, {
272
+ location,
273
+ recursive,
274
+ diagnostics,
275
+ includeDisabled
276
+ }: ScanOptions): SkillMetadata[];
277
+ /**
278
+ * Discover all skills from standard directories
279
+ */
280
+ declare function discoverSkills(options?: DiscoveryOptions): DiscoveryResult;
281
+ /**
282
+ * Load full skill content
283
+ */
284
+ declare function loadSkill(metadata: SkillMetadata): Skill;
285
+ //#endregion
286
+ //#region src/core/plugins.d.ts
287
+ interface PluginDiscoveryOptions {
288
+ pluginsFile?: string;
289
+ pluginsRoot?: string;
290
+ }
291
+ //#endregion
292
+ //#region src/core/registry.d.ts
293
+ type SkillRegistryOptions = DiscoveryOptions & PluginDiscoveryOptions;
294
+ /**
295
+ * Skill registry for managing discovered skills
296
+ */
297
+ declare class SkillRegistry {
298
+ private options;
299
+ private skills;
300
+ private diagnostics;
301
+ constructor(options?: SkillRegistryOptions);
302
+ /**
303
+ * Refresh the skill registry by rescanning directories
304
+ */
305
+ refresh(): void;
306
+ /**
307
+ * Get all skills
308
+ */
309
+ getAll(): SkillMetadata[];
310
+ /**
311
+ * Find a skill by name (case-insensitive, supports full and short names)
312
+ */
313
+ find(name: string): SkillMetadata;
314
+ /**
315
+ * Check if a skill exists
316
+ */
317
+ has(name: string): boolean;
318
+ /**
319
+ * Load full skill content
320
+ */
321
+ load(name: string): Skill;
322
+ /**
323
+ * Get suggestions for similar skill names (fuzzy matching)
324
+ */
325
+ private getSuggestions;
326
+ /**
327
+ * Get diagnostic information
328
+ */
329
+ getDiagnostics(): {
330
+ totalSkills: number;
331
+ byLocation: Record<string, number>;
332
+ directoriesScanned: string[];
333
+ pluginSources: string[];
334
+ warnings: string[];
335
+ conflicts: string[];
336
+ };
337
+ }
338
+ //#endregion
339
+ export { AmbiguousSkillNameError, CcskiError, DiscoveryDiagnostics, DiscoveryOptions, DiscoveryResult, InstalledPlugins, InstalledPluginsSchema, InstalledPluginsType, ParseError, ParseResult, PluginEntry, PluginEntrySchema, PluginEntryType, SKILL_DIRECTORIES, Skill, SkillFrontmatter, SkillFrontmatterSchema, SkillFrontmatterType, SkillLocation, SkillMetadata, SkillNotFoundError, SkillRegistry, SkillRegistryOptions, ValidationError, discoverSkills, loadSkill, parseSkillFile, scanSkillDirectory, validateSkillFile };
340
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/skill.ts","../src/types/errors.ts","../src/types/schemas.ts","../src/core/parser.ts","../src/core/discovery.ts","../src/core/plugins.ts","../src/core/registry.ts"],"sourcesContent":[],"mappings":";;;;;;AAGY,KAAA,aAAA,GAAa,MAAA,GAAA,SAAA,GAAA,QAAA;AAKzB;AA4BA;AAUA;AASiB,UA/CA,aAAA,CA+CW;EAYX;;;;EChEJ;EAaA,QAAA,CAAA,EAAA,OAAA;EAaA;EAeA,QAAA,ED5BD,aC4BiB;EAchB;;;;ECrDA;;;;;;;;;;;;;;AAQA,UFuBI,KAAA,SAAc,aEhB7B,CAAA;;;;;;;;;AAP4B,UFiCb,gBAAA,CEjCa;EAYjB,IAAA,EAAA,MAAA;;;;;;;UF8BI,WAAA;;;;;;;;;;AEtBjB;AACY,UFiCK,gBAAA,CEjC4B;EACjC,OAAA,EAAA,MAAA;WFkCD,eAAe;;;;;;;AAlEd,cCAC,UAAA,SAAmB,KAAA,CDAP;EAKR,SAAA,WAAa,EAAA,MAQlB,EAAA;EAoBK,WAAM,CAAA,OAAA,EAAQ,MAAA,EAAA,WAAa,CAAA,EAAA,MAAA,EAAA;AAU5C;AASA;AAYA;;cCnDa,kBAAA,SAA2B,UAAA;;EAb3B,WAAA,CAAA,SAAW,EAAA,MAAQ,EAAK,WAAA,CAAA,EAAA,MAAA,EAAA;AAarC;AAaA;AAeA;AAcA;cA7Ba,uBAAA,SAAgC,UAAA;;;ECxBhC,WAAA,CAAA,SAAA,EAAA,MAGG,EAAA,OAAA,EAAA,MAAA,EAAA;;;;;cDoCH,eAAA,SAAwB,UAAA;;;;;;;;ACvCF,cDqDtB,UAAA,SAAmB,UAAA,CCrDG;EAQtB,QAAA,E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AA,EAAA,MAAA,EAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { B as CcskiError, C as PluginEntrySchema, H as SkillNotFoundError, S as InstalledPluginsSchema, U as ValidationError, V as ParseError, a as discoverSkills, b as parseSkillFile, i as SKILL_DIRECTORIES, o as loadSkill, s as scanSkillDirectory, t as SkillRegistry, w as SkillFrontmatterSchema, x as validateSkillFile, z as AmbiguousSkillNameError } from "./registry-ChUc2356.mjs";
2
+
3
+ export { AmbiguousSkillNameError, CcskiError, InstalledPluginsSchema, ParseError, PluginEntrySchema, SKILL_DIRECTORIES, SkillFrontmatterSchema, SkillNotFoundError, SkillRegistry, ValidationError, discoverSkills, loadSkill, parseSkillFile, scanSkillDirectory, validateSkillFile };