@opencangjie/skills 0.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.
package/README.md ADDED
@@ -0,0 +1,413 @@
1
+ # @opencangjie/skills
2
+
3
+ JavaScript/TypeScript SDK for AgentSkills Runtime - Install, manage, and execute AI agent skills with built-in runtime support.
4
+
5
+ ## Features
6
+
7
+ - **Complete Runtime Management**: Download, install, start, and stop the AgentSkills runtime
8
+ - **Skill Management**: Install, list, execute, and remove skills
9
+ - **CLI & Programmatic API**: Use via command line or integrate into your applications
10
+ - **Cross-Platform**: Supports Windows, macOS, and Linux
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @opencangjie/skills
16
+ ```
17
+
18
+ Or use directly with npx:
19
+
20
+ ```bash
21
+ npx @opencangjie/skills find react
22
+ npx @opencangjie/skills list
23
+ npx @opencangjie/skills add ./my-skill
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ### 1. Install the Runtime
29
+
30
+ ```bash
31
+ # Download and install the AgentSkills runtime
32
+ npx skills install-runtime
33
+
34
+ # Or specify a version
35
+ npx skills install-runtime --version 0.0.1
36
+ ```
37
+
38
+ ### 2. Start the Runtime
39
+
40
+ ```bash
41
+ # Start in foreground
42
+ npx skills start
43
+
44
+ # Start in background
45
+ npx skills start --detached
46
+
47
+ # Custom port and host
48
+ npx skills start --port 3000 --host 0.0.0.0
49
+ ```
50
+
51
+ ### 3. Manage Skills
52
+
53
+ ```bash
54
+ # Find and install skills
55
+ npx skills find react
56
+ npx skills add ./my-skill
57
+
58
+ # List installed skills
59
+ npx skills list
60
+
61
+ # Execute a skill
62
+ npx skills run my-skill -p '{"input": "data"}'
63
+ ```
64
+
65
+ ## CLI Commands
66
+
67
+ ### Runtime Management
68
+
69
+ #### `skills install-runtime`
70
+
71
+ Download and install the AgentSkills runtime binary.
72
+
73
+ ```bash
74
+ skills install-runtime
75
+ skills install-runtime --version 0.0.1
76
+ ```
77
+
78
+ #### `skills start`
79
+
80
+ Start the AgentSkills runtime server.
81
+
82
+ ```bash
83
+ # Start in foreground
84
+ skills start
85
+
86
+ # Start in background
87
+ skills start --detached
88
+
89
+ # Custom configuration
90
+ skills start --port 3000 --host 0.0.0.0
91
+ ```
92
+
93
+ #### `skills stop`
94
+
95
+ Stop the AgentSkills runtime server.
96
+
97
+ ```bash
98
+ skills stop
99
+ ```
100
+
101
+ #### `skills status`
102
+
103
+ Check the status of the skills runtime server.
104
+
105
+ ```bash
106
+ skills status
107
+ ```
108
+
109
+ ### Skill Management
110
+
111
+ #### `skills find [query]`
112
+
113
+ Search for skills interactively or by keyword.
114
+
115
+ ```bash
116
+ skills find
117
+ skills find react testing
118
+ skills find "pdf generation"
119
+ ```
120
+
121
+ #### `skills add <source>`
122
+
123
+ Install a skill from GitHub or local path.
124
+
125
+ ```bash
126
+ skills add ./my-skill
127
+ skills add github.com/user/skill-repo
128
+ skills add github.com/user/skill-repo --branch develop
129
+ ```
130
+
131
+ #### `skills list`
132
+
133
+ List installed skills.
134
+
135
+ ```bash
136
+ skills list
137
+ skills list --limit 50 --page 1
138
+ skills list --json
139
+ ```
140
+
141
+ #### `skills run <skillId>`
142
+
143
+ Execute a skill.
144
+
145
+ ```bash
146
+ skills run my-skill -p '{"param1": "value"}'
147
+ skills run my-skill --tool tool-name -p '{"param1": "value"}'
148
+ skills run my-skill -i # Interactive mode
149
+ ```
150
+
151
+ #### `skills remove <skillId>`
152
+
153
+ Remove an installed skill.
154
+
155
+ ```bash
156
+ skills remove my-skill
157
+ skills rm my-skill -y
158
+ ```
159
+
160
+ #### `skills info <skillId>`
161
+
162
+ Show detailed information about a skill.
163
+
164
+ ```bash
165
+ skills info my-skill
166
+ ```
167
+
168
+ #### `skills init [name]`
169
+
170
+ Initialize a new skill project.
171
+
172
+ ```bash
173
+ skills init my-new-skill
174
+ skills init my-new-skill --directory ./skills
175
+ ```
176
+
177
+ #### `skills check`
178
+
179
+ Check for skill updates.
180
+
181
+ ```bash
182
+ skills check
183
+ ```
184
+
185
+ #### `skills update [skillId]`
186
+
187
+ Update skills to their latest versions.
188
+
189
+ ```bash
190
+ skills update my-skill
191
+ skills update --all
192
+ ```
193
+
194
+ #### `skills config <skillId>`
195
+
196
+ Manage skill configuration.
197
+
198
+ ```bash
199
+ skills config my-skill --list
200
+ skills config my-skill --get API_KEY
201
+ skills config my-skill --set API_KEY=abc123
202
+ ```
203
+
204
+ ## Programmatic API
205
+
206
+ ### Basic Usage
207
+
208
+ ```typescript
209
+ import { createClient, SkillsClient, RuntimeManager } from '@opencangjie/skills';
210
+
211
+ const client = createClient({
212
+ baseUrl: 'http://127.0.0.1:8080',
213
+ authToken: 'your-jwt-token' // optional
214
+ });
215
+
216
+ // Check runtime status
217
+ const status = await client.runtime.status();
218
+ console.log(`Runtime running: ${status.running}`);
219
+
220
+ // List skills
221
+ const result = await client.listSkills({ limit: 10 });
222
+ console.log(result.skills);
223
+
224
+ // Execute a skill
225
+ const execResult = await client.executeSkill('my-skill', {
226
+ param1: 'value'
227
+ });
228
+ console.log(execResult.output);
229
+ ```
230
+
231
+ ### Runtime Management
232
+
233
+ ```typescript
234
+ import { RuntimeManager } from '@opencangjie/skills';
235
+
236
+ const runtime = new RuntimeManager();
237
+
238
+ // Check if runtime is installed
239
+ if (!runtime.isInstalled()) {
240
+ // Download and install
241
+ await runtime.downloadRuntime('1.0.0');
242
+ }
243
+
244
+ // Check status
245
+ const status = await runtime.status();
246
+ if (!status.running) {
247
+ // Start the runtime
248
+ runtime.start({
249
+ port: 8080,
250
+ host: '127.0.0.1',
251
+ detached: true
252
+ });
253
+ }
254
+
255
+ // Stop the runtime
256
+ runtime.stop();
257
+ ```
258
+
259
+ ### Skill Management
260
+
261
+ ```typescript
262
+ // Install from local path
263
+ const installResult = await client.installSkill({
264
+ source: './my-skill',
265
+ validate: true
266
+ });
267
+
268
+ // Install from Git
269
+ const gitInstallResult = await client.installSkill({
270
+ source: 'https://github.com/user/skill.git',
271
+ branch: 'main'
272
+ });
273
+
274
+ // Uninstall
275
+ await client.uninstallSkill('my-skill');
276
+
277
+ // Update
278
+ await client.updateSkill('my-skill', { version: '2.0.0' });
279
+ ```
280
+
281
+ ### Execute Skills
282
+
283
+ ```typescript
284
+ // Execute skill with parameters
285
+ const result = await client.executeSkill('my-skill', {
286
+ input: 'data'
287
+ });
288
+
289
+ if (result.success) {
290
+ console.log(result.output);
291
+ } else {
292
+ console.error(result.errorMessage);
293
+ }
294
+
295
+ // Execute specific tool
296
+ const toolResult = await client.executeSkillTool('my-skill', 'tool-name', {
297
+ param1: 'value'
298
+ });
299
+ ```
300
+
301
+ ## Defining Skills
302
+
303
+ You can also use this SDK to define skills programmatically:
304
+
305
+ ```typescript
306
+ import { defineSkill, getConfig } from '@opencangjie/skills';
307
+
308
+ export default defineSkill({
309
+ metadata: {
310
+ name: 'my-skill',
311
+ version: '1.0.0',
312
+ description: 'My awesome skill',
313
+ author: 'Your Name'
314
+ },
315
+ tools: [
316
+ {
317
+ name: 'greet',
318
+ description: 'Greet someone by name',
319
+ parameters: [
320
+ {
321
+ name: 'name',
322
+ paramType: 'string',
323
+ description: 'Name to greet',
324
+ required: true
325
+ }
326
+ ]
327
+ }
328
+ ],
329
+ validateConfig: (config) => {
330
+ if (!config.API_KEY) {
331
+ return { err: 'API_KEY is required' };
332
+ }
333
+ return { ok: null };
334
+ }
335
+ });
336
+
337
+ // Access configuration
338
+ const config = getConfig();
339
+ const apiKey = config.API_KEY;
340
+ ```
341
+
342
+ ## Architecture
343
+
344
+ ```
345
+ ┌─────────────────────────────────────┐
346
+ │ Language Ecosystem │
347
+ │ (npm, pip, maven, cargo, etc.) │
348
+ ├─────────────────────────────────────┤
349
+ │ CLI Commands (skills find/add/run) │
350
+ ├─────────────────────────────────────┤
351
+ │ SDK Programmatic API │
352
+ │ (SkillsClient, RuntimeManager) │
353
+ ├─────────────────────────────────────┤
354
+ │ Standard API Interface Layer │
355
+ │ (RESTful + JWT Auth) │
356
+ ├─────────────────────────────────────┤
357
+ │ Agent Skill Runtime Kernel │
358
+ │ (Cangjie Binary) │
359
+ └─────────────────────────────────────┘
360
+ ```
361
+
362
+ ## Environment Variables
363
+
364
+ | Variable | Description | Default |
365
+ |----------|-------------|---------|
366
+ | `SKILL_RUNTIME_API_URL` | API server URL | `http://127.0.0.1:8080` |
367
+ | `SKILL_*` | Skill configuration (accessible via `getConfig()`) | - |
368
+
369
+ ## API Reference
370
+
371
+ ### SkillsClient
372
+
373
+ | Method | Description |
374
+ |--------|-------------|
375
+ | `runtime` | Access RuntimeManager instance |
376
+ | `healthCheck()` | Check server status |
377
+ | `listSkills(options)` | List installed skills |
378
+ | `getSkill(skillId)` | Get skill details |
379
+ | `installSkill(options)` | Install a skill |
380
+ | `uninstallSkill(skillId)` | Uninstall a skill |
381
+ | `executeSkill(skillId, params)` | Execute a skill |
382
+ | `executeSkillTool(skillId, toolName, args)` | Execute a specific tool |
383
+ | `searchSkills(query)` | Search for skills |
384
+ | `updateSkill(skillId, updates)` | Update a skill |
385
+ | `getSkillConfig(skillId)` | Get skill configuration |
386
+ | `setSkillConfig(skillId, config)` | Set skill configuration |
387
+ | `listSkillTools(skillId)` | List tools in a skill |
388
+
389
+ ### RuntimeManager
390
+
391
+ | Method | Description |
392
+ |--------|-------------|
393
+ | `isInstalled()` | Check if runtime is installed |
394
+ | `getRuntimePath()` | Get runtime binary path |
395
+ | `downloadRuntime(version)` | Download and install runtime |
396
+ | `start(options)` | Start the runtime server |
397
+ | `stop()` | Stop the runtime server |
398
+ | `status()` | Check runtime status |
399
+
400
+ ## Comparison with Vercel Labs Skills CLI
401
+
402
+ | Feature | @opencangjie/skills | Vercel Labs Skills CLI |
403
+ |---------|---------------------|------------------------|
404
+ | Runtime Management | Built-in | External |
405
+ | Installation | npm install | npm install -g skills |
406
+ | Language | TypeScript/JavaScript | TypeScript |
407
+ | Runtime | Cangjie (native) | Node.js |
408
+ | Platform Support | Win/Mac/Linux | Win/Mac/Linux |
409
+ | API Protocol | RESTful + MCP | RESTful |
410
+
411
+ ## License
412
+
413
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}