ccski 2.2.0 → 2.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 CHANGED
@@ -1,9 +1,21 @@
1
1
  # ccski – Claude Code Skills Manager
2
2
 
3
- ccski is a CLI + MCP server to discover, install, enable/disable, and serve Claude/Codex-compatible skills. This README covers install and usage. For architecture and UX philosophy, see `SPEC.md`.
3
+ ccski is a CLI + MCP server to discover, install, enable/disable, and serve Claude/Codex-compatible skills. It also exports a small “kernel” API so you can embed discovery/validation in your own scripts. This README covers install and usage. For architecture and UX philosophy, see `SPEC.md`.
4
4
 
5
5
  Documentation site: https://jixoai-labs.github.io/ccski/
6
6
 
7
+ ## Table of contents
8
+
9
+ - [Install](#install)
10
+ - [Quick start](#quick-start)
11
+ - [Run MCP server](#run-mcp-server)
12
+ - [Core CLI commands](#core-cli-commands)
13
+ - [Install examples](#install-examples)
14
+ - [Enable/disable](#enabledisable)
15
+ - [More](#more)
16
+ - [Acknowledgements](#acknowledgements)
17
+ - [API Reference](#api-reference)
18
+
7
19
  ## Install
8
20
 
9
21
  Requires Node.js >= 20.
@@ -43,15 +55,15 @@ MCP plugin config example (Codex/Cursor/Windsurf/VS Code):
43
55
 
44
56
  ### Core CLI commands
45
57
 
46
- | Command | Purpose |
47
- | --- | --- |
48
- | `ccski list` | List discovered skills (project, user, plugin) |
49
- | `ccski info <name>` | Show metadata and content preview |
50
- | `ccski install <source> [-i|--all|--path]` | Install from git/dir/marketplace/SKILL.md; interactive picker available |
51
- | `ccski enable [names...] [-i|--all]` | Enable skills (`.SKILL.md` -> `SKILL.md`) |
52
- | `ccski disable [names...] [-i|--all]` | Disable skills (`SKILL.md` -> `.SKILL.md`) |
53
- | `ccski validate <path>` | Validate SKILL.md or skill directory |
54
- | `ccski mcp` | Start MCP server (stdio/http/sse) |
58
+ | Command | Purpose |
59
+ | ----------------------------------------------- | ------------------------------------------------------------------------------ |
60
+ | `ccski list` | List discovered skills (project, user, plugin) |
61
+ | `ccski info <name>` | Show metadata and content preview |
62
+ | `ccski install <source> [-i\|--all\|--path]` | Install from git/dir/marketplace/SKILL.md; interactive picker available |
63
+ | `ccski enable [names...] [-i\|--all]` | Enable skills (`.SKILL.md` -> `SKILL.md`) |
64
+ | `ccski disable [names...] [-i\|--all]` | Disable skills (`SKILL.md` -> `.SKILL.md`) |
65
+ | `ccski validate <path>` | Validate SKILL.md or skill directory |
66
+ | `ccski mcp` | Start MCP server (stdio/http/sse) |
55
67
 
56
68
  ### Install examples
57
69
 
@@ -77,7 +89,7 @@ ccski disable --all
77
89
 
78
90
  ## More
79
91
 
80
- - Programmatic API is available from the package export; see the docs site for API usage examples.
92
+ - Programmatic API is available from the package export; see [API Reference](#api-reference) (or the docs site) for usage examples.
81
93
  - Claude users: prefer `ccski mcp --exclude=claude` to avoid echoing built-in Claude skills.
82
94
  - Codex users: prefer `ccski mcp --exclude=codex` when avoid echoing built-in Codex skills.
83
95
  - All commands support `--json` for scripting.
@@ -88,3 +100,158 @@ ccski disable --all
88
100
 
89
101
  - [openskills](https://github.com/numman-ali/openskills) — established the SKILL.md authoring pattern; ccski aligns with that spec.
90
102
  - [universal-skills](https://github.com/klaudworks/universal-skills) — MCP-first skill set; ccski focuses on management, not bundling content.
103
+
104
+ ## API Reference
105
+
106
+ Public exports from `import ... from "ccski"`.
107
+
108
+ Notes:
109
+
110
+ - Package is ESM (`"type": "module"`). Use `import` in Node.js >= 20.
111
+ - `discoverSkills()` / `SkillRegistry.getAll()` return **metadata**. Use `loadSkill()` / `SkillRegistry.load()` to read full SKILL.md content.
112
+
113
+ ### Importing
114
+
115
+ ```ts
116
+ import { discoverSkills, SkillRegistry, validateSkillFile } from "ccski";
117
+ import type { Skill, SkillMetadata } from "ccski";
118
+ ```
119
+
120
+ ### Types
121
+
122
+ - `SkillProvider`: built-ins `"agents" | "claude" | "codex" | "gemini" | "openclaw" | "file"` plus discovered `.<agent>/skills` providers
123
+ - `SkillLocation`: `"user" | "project" | "plugin"`
124
+ - `SkillFrontmatter`: required SKILL.md frontmatter shape (`name`, `description`, plus extra fields)
125
+ - `SkillMetadata`: discovered skill summary (name/description/provider/location/path + bundled resources flags)
126
+ - `Skill`: `SkillMetadata` + `content` (full markdown, including frontmatter) + `fullName`
127
+ - `ParseResult`: `{ frontmatter, content, fullContent }`
128
+ - `DiscoveryOptions`: configure default roots, custom directories, provider tagging, and disabled-skill handling
129
+ - `SkillRegistryOptions`: `DiscoveryOptions` + plugin discovery options (`pluginsFile`, `pluginsRoot`, `settingsFile`, `userDir`)
130
+
131
+ Reference shapes (simplified):
132
+
133
+ ```ts
134
+ export interface SkillMetadata {
135
+ name: string;
136
+ description: string;
137
+ disabled?: boolean;
138
+ provider: "claude" | "codex" | "file";
139
+ location: "user" | "project" | "plugin";
140
+ path: string;
141
+ hasReferences: boolean;
142
+ hasScripts: boolean;
143
+ hasAssets: boolean;
144
+ pluginInfo?: { pluginName: string; marketplace: string; version: string };
145
+ }
146
+
147
+ export interface Skill extends SkillMetadata {
148
+ content: string; // full markdown (including frontmatter)
149
+ fullName: string;
150
+ }
151
+ ```
152
+
153
+ ### Errors
154
+
155
+ All errors extend `CcskiError` and include a `suggestions: string[]` field for UX-friendly guidance.
156
+
157
+ - `SkillNotFoundError`: thrown when a skill name cannot be resolved
158
+ - `AmbiguousSkillNameError`: thrown when multiple skills match; includes `matches: string[]`
159
+ - `ParseError`: SKILL.md read/UTF-8/frontmatter parsing failures; includes `filePath`, `reason`
160
+ - `ValidationError`: frontmatter schema validation failures; includes `filePath`, `issues: string[]`
161
+
162
+ ### Parser
163
+
164
+ #### `parseSkillFile(filePath: string): ParseResult`
165
+
166
+ Parse a `SKILL.md` (or `.SKILL.md`) file and return:
167
+
168
+ - `frontmatter`: validated & normalized (`description` whitespace is normalized)
169
+ - `content`: markdown body **without** frontmatter
170
+ - `fullContent`: original file content **including** frontmatter
171
+
172
+ Throws `ParseError` (IO/encoding/YAML) and `ValidationError` (schema).
173
+
174
+ #### `validateSkillFile(filePath: string): { success; errors; suggestions }`
175
+
176
+ Safe validator wrapper around `parseSkillFile()`:
177
+
178
+ - `success: true` when file is valid
179
+ - otherwise returns `errors` and `suggestions` without throwing
180
+
181
+ ```ts
182
+ import { validateSkillFile } from "ccski";
183
+
184
+ const result = validateSkillFile("/abs/path/to/SKILL.md");
185
+ if (!result.success) {
186
+ console.error(result.errors);
187
+ console.error(result.suggestions);
188
+ }
189
+ ```
190
+
191
+ ### Discovery
192
+
193
+ #### `getDefaultSkillDirectories(userDir: string)`
194
+
195
+ Return the default search roots (project + user) with provider tagging (Claude/Codex).
196
+
197
+ #### `discoverSkills(options?: DiscoveryOptions): { skills; diagnostics }`
198
+
199
+ Scan built-in directories (unless `scanDefaultDirs: false`) plus `customDirs`.
200
+
201
+ - `skills`: `SkillMetadata[]`
202
+ - `diagnostics`: scanned paths, warnings, conflicts, and counts by provider
203
+
204
+ ```ts
205
+ import { discoverSkills } from "ccski";
206
+
207
+ const { skills, diagnostics } = discoverSkills({
208
+ includeDisabled: true,
209
+ customDirs: ["/extra/skills"],
210
+ customProvider: "file",
211
+ });
212
+ ```
213
+
214
+ #### `loadSkill(metadata: SkillMetadata): Skill`
215
+
216
+ Load a discovered skill’s full content (reads `SKILL.md` or `.SKILL.md` based on `metadata.disabled`).
217
+
218
+ #### `scanSkillDirectory(dirPath, options, provider, userDir?, scope?)`
219
+
220
+ Lower-level scanner used by `discoverSkills()`. Useful when you want full control over:
221
+
222
+ - root path + recursion
223
+ - provider tagging (`"claude" | "codex" | "file"`)
224
+ - optional `scope` prefixing for names
225
+
226
+ ### Registry
227
+
228
+ #### `new SkillRegistry(options?: SkillRegistryOptions)`
229
+
230
+ Convenience wrapper around discovery + fuzzy resolution.
231
+
232
+ ```ts
233
+ import { SkillRegistry } from "ccski";
234
+
235
+ const registry = new SkillRegistry({ includeDisabled: true });
236
+
237
+ const all = registry.getAll(); // SkillMetadata[]
238
+ const full = registry.load("some-skill"); // Skill (with content)
239
+ ```
240
+
241
+ Methods:
242
+
243
+ - `refresh()`: rescan directories (and plugins unless `skipPlugins: true`)
244
+ - `getAll()`: list all discovered skills
245
+ - `find(name)`: resolve a name (case-insensitive, supports short name and `provider:name`)
246
+ - `has(name)`: boolean existence check
247
+ - `load(name)`: resolve + read full content
248
+ - `getDiagnostics()`: totals + scanned roots + warnings/conflicts
249
+
250
+ ### Schemas (Zod)
251
+
252
+ These are exported for validating/parsing external JSON and frontmatter in a type-safe way:
253
+
254
+ - `SkillFrontmatterSchema` / `SkillFrontmatterType`
255
+ - `PluginEntrySchema` / `PluginEntryType`
256
+ - `InstalledPluginsSchema` / `InstalledPluginsType`
257
+ - `ClaudeSettingsSchema` / `ClaudeSettingsType`