ccjk 12.0.6 → 12.0.7

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.
Files changed (62) hide show
  1. package/README.md +14 -0
  2. package/README.zh-CN.md +13 -0
  3. package/dist/chunks/api-cli.mjs +1 -1
  4. package/dist/chunks/ccjk-agents.mjs +3 -2
  5. package/dist/chunks/ccjk-all.mjs +129 -1764
  6. package/dist/chunks/ccjk-hooks.mjs +5 -4
  7. package/dist/chunks/ccjk-mcp.mjs +7 -6
  8. package/dist/chunks/ccjk-setup.mjs +3 -2
  9. package/dist/chunks/ccjk-skills.mjs +6 -5
  10. package/dist/chunks/ccr.mjs +6 -5
  11. package/dist/chunks/check-updates.mjs +8 -8
  12. package/dist/chunks/claude-code-config-manager.mjs +1 -1
  13. package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
  14. package/dist/chunks/codex-config-switch.mjs +1 -1
  15. package/dist/chunks/codex-provider-manager.mjs +1 -1
  16. package/dist/chunks/config-switch.mjs +1 -1
  17. package/dist/chunks/config.mjs +1 -1
  18. package/dist/chunks/config2.mjs +1 -1
  19. package/dist/chunks/config3.mjs +1 -1
  20. package/dist/chunks/constants.mjs +33 -2
  21. package/dist/chunks/dashboard.mjs +115 -3
  22. package/dist/chunks/features.mjs +3 -3
  23. package/dist/chunks/init.mjs +108 -4
  24. package/dist/chunks/installer2.mjs +7 -7
  25. package/dist/chunks/manager.mjs +1048 -0
  26. package/dist/chunks/mcp-cli.mjs +1 -1
  27. package/dist/chunks/mcp.mjs +1 -1
  28. package/dist/chunks/menu.mjs +22 -1
  29. package/dist/chunks/notification.mjs +5 -2
  30. package/dist/chunks/package.mjs +1 -1
  31. package/dist/chunks/quick-provider.mjs +1 -269
  32. package/dist/chunks/quick-setup.mjs +10 -10
  33. package/dist/chunks/remote.mjs +4 -1
  34. package/dist/chunks/simple-config.mjs +1 -1
  35. package/dist/chunks/skill.mjs +117 -9003
  36. package/dist/chunks/skill2.mjs +9003 -0
  37. package/dist/chunks/skills-sync.mjs +536 -55
  38. package/dist/chunks/skills.mjs +7 -1156
  39. package/dist/chunks/smart-defaults.mjs +87 -9
  40. package/dist/chunks/status.mjs +1 -1
  41. package/dist/chunks/uninstall.mjs +1 -1
  42. package/dist/chunks/update.mjs +2 -2
  43. package/dist/chunks/zero-config.mjs +6 -2
  44. package/dist/cli.mjs +3 -1
  45. package/dist/i18n/locales/en/cloud.json +40 -0
  46. package/dist/i18n/locales/zh-CN/cloud.json +40 -0
  47. package/dist/index.d.mts +2586 -2
  48. package/dist/index.d.ts +2586 -2
  49. package/dist/index.mjs +1340 -7
  50. package/dist/shared/ccjk.B364Fu0N.mjs +1819 -0
  51. package/dist/shared/ccjk.BtB1e5jm.mjs +171 -0
  52. package/dist/shared/{ccjk.BnpWvs9V.mjs → ccjk.BwfbSKN2.mjs} +1 -1
  53. package/dist/shared/{ccjk.AqnXPAzw.mjs → ccjk.C2jHOZVP.mjs} +1 -1
  54. package/dist/shared/{ccjk.BSYWk9ML.mjs → ccjk.Cjj8SVrn.mjs} +1 -1
  55. package/dist/shared/ccjk.D6ycHbak.mjs +270 -0
  56. package/dist/shared/ccjk.D8ZLYSZZ.mjs +299 -0
  57. package/dist/shared/{ccjk.s7OCVzdd.mjs → ccjk.DS7UESmF.mjs} +2 -1483
  58. package/dist/shared/{ccjk.BiCrMV5O.mjs → ccjk.DXRAZcix.mjs} +0 -28
  59. package/dist/shared/ccjk.UIvifqNE.mjs +1486 -0
  60. package/dist/shared/{ccjk.BDKUdmLk.mjs → ccjk.c-ETfBZ_.mjs} +208 -86
  61. package/package.json +5 -1
  62. package/templates/claude-code/common/settings.json +3 -1
@@ -10,7 +10,9 @@ import { readFile, stat } from 'node:fs/promises';
10
10
  import { g as getDefaultExportFromCjs } from '../shared/ccjk.BAGoDD49.mjs';
11
11
  import require$$0 from 'fs';
12
12
  import { c as commonjsRequire } from '../shared/ccjk.COweQ1RR.mjs';
13
+ import { a as createGateway } from '../shared/ccjk.BtB1e5jm.mjs';
13
14
  import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
15
+ import { b as CloudErrorFactory, C as CloudError } from '../shared/ccjk.D8ZLYSZZ.mjs';
14
16
  import 'node:readline';
15
17
  import 'stream';
16
18
  import 'node:tty';
@@ -24,6 +26,374 @@ import 'node:os';
24
26
  import 'buffer';
25
27
  import 'string_decoder';
26
28
  import 'node:url';
29
+ import '../shared/ccjk.D6ycHbak.mjs';
30
+
31
+ function validateSkillListResponse(data) {
32
+ if (!data || typeof data !== "object")
33
+ return false;
34
+ const obj = data;
35
+ return Array.isArray(obj.skills) && typeof obj.total === "number" && typeof obj.page === "number" && typeof obj.pageSize === "number" && typeof obj.totalPages === "number";
36
+ }
37
+ function validateSkillGetResponse(data) {
38
+ if (!data || typeof data !== "object")
39
+ return false;
40
+ const obj = data;
41
+ return obj.skill !== void 0 && typeof obj.skill === "object" && obj.skill !== null;
42
+ }
43
+ function validateSkillUploadResponse(data) {
44
+ if (!data || typeof data !== "object")
45
+ return false;
46
+ const obj = data;
47
+ return obj.skill !== void 0 && typeof obj.skill === "object" && obj.skill !== null;
48
+ }
49
+ function validateSkillDownloadResponse(data) {
50
+ if (!data || typeof data !== "object")
51
+ return false;
52
+ const obj = data;
53
+ return obj.skill !== void 0 && typeof obj.skill === "object" && obj.skill !== null;
54
+ }
55
+
56
+ class SkillsApiClient {
57
+ gateway;
58
+ constructor(gateway) {
59
+ this.gateway = gateway;
60
+ }
61
+ // ==========================================================================
62
+ // List Skills
63
+ // ==========================================================================
64
+ /**
65
+ * List skills from cloud
66
+ *
67
+ * @param request - List request parameters
68
+ * @returns List response with skills array
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const response = await client.list({
73
+ * privacy: 'public',
74
+ * page: 1,
75
+ * pageSize: 20
76
+ * })
77
+ * ```
78
+ */
79
+ async list(request = {}) {
80
+ try {
81
+ const response = await this.gateway.request(
82
+ "skills.list",
83
+ {
84
+ method: "GET",
85
+ query: this.buildListQuery(request)
86
+ }
87
+ );
88
+ if (response.success && response.data) {
89
+ if (!validateSkillListResponse(response.data)) {
90
+ throw CloudErrorFactory.schemaMismatch(
91
+ "Invalid skill list response format",
92
+ { context: { request } }
93
+ );
94
+ }
95
+ }
96
+ return response;
97
+ } catch (error) {
98
+ if (error instanceof CloudError) {
99
+ throw error;
100
+ }
101
+ throw CloudErrorFactory.unknown(error, {
102
+ context: { operation: "skills.list", request }
103
+ });
104
+ }
105
+ }
106
+ // ==========================================================================
107
+ // Get Skill
108
+ // ==========================================================================
109
+ /**
110
+ * Get skill details by ID
111
+ *
112
+ * @param request - Get request with skill ID
113
+ * @returns Skill details
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * const response = await client.get({
118
+ * skillId: 'my-skill',
119
+ * version: '1.0.0'
120
+ * })
121
+ * ```
122
+ */
123
+ async get(request) {
124
+ try {
125
+ if (!request.skillId || request.skillId.trim() === "") {
126
+ throw CloudErrorFactory.validation("Skill ID is required");
127
+ }
128
+ const query = {};
129
+ if (request.version) {
130
+ query.version = request.version;
131
+ }
132
+ const response = await this.gateway.request(
133
+ "skills.download",
134
+ {
135
+ method: "GET",
136
+ query: {
137
+ skillId: request.skillId,
138
+ ...query
139
+ }
140
+ }
141
+ );
142
+ if (response.success && response.data) {
143
+ if (!validateSkillGetResponse(response.data)) {
144
+ throw CloudErrorFactory.schemaMismatch(
145
+ "Invalid skill get response format",
146
+ { context: { request } }
147
+ );
148
+ }
149
+ }
150
+ return response;
151
+ } catch (error) {
152
+ if (error instanceof CloudError) {
153
+ throw error;
154
+ }
155
+ throw CloudErrorFactory.unknown(error, {
156
+ context: { operation: "skills.get", request }
157
+ });
158
+ }
159
+ }
160
+ // ==========================================================================
161
+ // Upload Skill
162
+ // ==========================================================================
163
+ /**
164
+ * Upload skill to cloud
165
+ *
166
+ * @param request - Upload request with skill data
167
+ * @returns Upload response with skill details
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const response = await client.upload({
172
+ * name: 'my-skill',
173
+ * version: '1.0.0',
174
+ * content: '# My Skill...',
175
+ * metadata: { author: 'me', description: 'A skill' },
176
+ * privacy: 'private',
177
+ * checksum: 'abc123'
178
+ * })
179
+ * ```
180
+ */
181
+ async upload(request) {
182
+ try {
183
+ this.validateUploadRequest(request);
184
+ const response = await this.gateway.request(
185
+ "skills.upload",
186
+ {
187
+ method: "POST",
188
+ body: request
189
+ }
190
+ );
191
+ if (response.success && response.data) {
192
+ if (!validateSkillUploadResponse(response.data)) {
193
+ throw CloudErrorFactory.schemaMismatch(
194
+ "Invalid skill upload response format",
195
+ { context: { request } }
196
+ );
197
+ }
198
+ }
199
+ return response;
200
+ } catch (error) {
201
+ if (error instanceof CloudError) {
202
+ throw error;
203
+ }
204
+ throw CloudErrorFactory.unknown(error, {
205
+ context: { operation: "skills.upload", request }
206
+ });
207
+ }
208
+ }
209
+ // ==========================================================================
210
+ // Download Skill
211
+ // ==========================================================================
212
+ /**
213
+ * Download skill from cloud
214
+ *
215
+ * @param request - Download request with skill ID
216
+ * @returns Download response with skill content
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * const response = await client.download({
221
+ * skillId: 'my-skill',
222
+ * version: '1.0.0'
223
+ * })
224
+ * ```
225
+ */
226
+ async download(request) {
227
+ try {
228
+ if (!request.skillId || request.skillId.trim() === "") {
229
+ throw CloudErrorFactory.validation("Skill ID is required");
230
+ }
231
+ const query = {
232
+ skillId: request.skillId
233
+ };
234
+ if (request.version) {
235
+ query.version = request.version;
236
+ }
237
+ const response = await this.gateway.request(
238
+ "skills.download",
239
+ {
240
+ method: "GET",
241
+ query
242
+ }
243
+ );
244
+ if (response.success && response.data) {
245
+ if (!validateSkillDownloadResponse(response.data)) {
246
+ throw CloudErrorFactory.schemaMismatch(
247
+ "Invalid skill download response format",
248
+ { context: { request } }
249
+ );
250
+ }
251
+ }
252
+ return response;
253
+ } catch (error) {
254
+ if (error instanceof CloudError) {
255
+ throw error;
256
+ }
257
+ throw CloudErrorFactory.unknown(error, {
258
+ context: { operation: "skills.download", request }
259
+ });
260
+ }
261
+ }
262
+ // ==========================================================================
263
+ // Update Skill
264
+ // ==========================================================================
265
+ /**
266
+ * Update skill in cloud
267
+ *
268
+ * @param request - Update request with skill ID and changes
269
+ * @returns Update response with updated skill
270
+ *
271
+ * @example
272
+ * ```typescript
273
+ * const response = await client.update({
274
+ * skillId: 'my-skill',
275
+ * version: '1.1.0',
276
+ * content: '# Updated content...'
277
+ * })
278
+ * ```
279
+ */
280
+ async update(request) {
281
+ try {
282
+ if (!request.skillId || request.skillId.trim() === "") {
283
+ throw CloudErrorFactory.validation("Skill ID is required");
284
+ }
285
+ const response = await this.gateway.request(
286
+ "skills.upload",
287
+ {
288
+ method: "PUT",
289
+ body: request
290
+ }
291
+ );
292
+ return response;
293
+ } catch (error) {
294
+ if (error instanceof CloudError) {
295
+ throw error;
296
+ }
297
+ throw CloudErrorFactory.unknown(error, {
298
+ context: { operation: "skills.update", request }
299
+ });
300
+ }
301
+ }
302
+ // ==========================================================================
303
+ // Delete Skill
304
+ // ==========================================================================
305
+ /**
306
+ * Delete skill from cloud
307
+ *
308
+ * @param request - Delete request with skill ID
309
+ * @returns Delete response
310
+ *
311
+ * @example
312
+ * ```typescript
313
+ * const response = await client.delete({
314
+ * skillId: 'my-skill'
315
+ * })
316
+ * ```
317
+ */
318
+ async delete(request) {
319
+ try {
320
+ if (!request.skillId || request.skillId.trim() === "") {
321
+ throw CloudErrorFactory.validation("Skill ID is required");
322
+ }
323
+ const response = await this.gateway.request(
324
+ "skills.upload",
325
+ {
326
+ method: "DELETE",
327
+ query: {
328
+ skillId: request.skillId
329
+ }
330
+ }
331
+ );
332
+ return response;
333
+ } catch (error) {
334
+ if (error instanceof CloudError) {
335
+ throw error;
336
+ }
337
+ throw CloudErrorFactory.unknown(error, {
338
+ context: { operation: "skills.delete", request }
339
+ });
340
+ }
341
+ }
342
+ // ==========================================================================
343
+ // Helper Methods
344
+ // ==========================================================================
345
+ /**
346
+ * Build query parameters for list request
347
+ */
348
+ buildListQuery(request) {
349
+ const query = {};
350
+ if (request.privacy)
351
+ query.privacy = request.privacy;
352
+ if (request.author)
353
+ query.author = request.author;
354
+ if (request.tags && request.tags.length > 0)
355
+ query.tags = request.tags.join(",");
356
+ if (request.query)
357
+ query.query = request.query;
358
+ if (request.page)
359
+ query.page = request.page;
360
+ if (request.pageSize)
361
+ query.pageSize = request.pageSize;
362
+ if (request.sortBy)
363
+ query.sortBy = request.sortBy;
364
+ if (request.sortDir)
365
+ query.sortDir = request.sortDir;
366
+ return query;
367
+ }
368
+ /**
369
+ * Validate upload request
370
+ */
371
+ validateUploadRequest(request) {
372
+ const errors = [];
373
+ if (!request.name || request.name.trim() === "")
374
+ errors.push("Skill name is required");
375
+ if (!request.version || request.version.trim() === "")
376
+ errors.push("Skill version is required");
377
+ if (!request.content || request.content.trim() === "")
378
+ errors.push("Skill content is required");
379
+ if (!request.metadata)
380
+ errors.push("Skill metadata is required");
381
+ else if (!request.metadata.author || request.metadata.author.trim() === "")
382
+ errors.push("Skill author is required");
383
+ if (!request.privacy)
384
+ errors.push("Skill privacy level is required");
385
+ if (!request.checksum || request.checksum.trim() === "")
386
+ errors.push("Skill checksum is required");
387
+ if (errors.length > 0) {
388
+ throw CloudErrorFactory.validation(
389
+ `Invalid upload request: ${errors.join(", ")}`
390
+ );
391
+ }
392
+ }
393
+ }
394
+ function createSkillsClient(gateway) {
395
+ return new SkillsApiClient(gateway);
396
+ }
27
397
 
28
398
  var kindOf;
29
399
  var hasRequiredKindOf;
@@ -5254,7 +5624,7 @@ function extractMetadata(data, filePath) {
5254
5624
  return metadata;
5255
5625
  }
5256
5626
 
5257
- const CLOUD_API_BASE_URL = process__default.env.CCJK_CLOUD_API_URL || "https://api.api.claudehome.cn/v1";
5627
+ process__default.env.CCJK_CLOUD_API_URL || "https://api.api.claudehome.cn/v1";
5258
5628
  const SYNC_STATE_FILE = join(CCJK_CONFIG_DIR, "skills-sync-state.json");
5259
5629
  const DEFAULT_TIMEOUT = 3e4;
5260
5630
  function loadSyncState() {
@@ -5370,38 +5740,62 @@ function getAuthToken() {
5370
5740
  return null;
5371
5741
  }
5372
5742
  }
5373
- async function apiRequest(endpoint, options = {}) {
5374
- const token = getAuthToken();
5375
- if (!token) {
5376
- throw new Error("Not authenticated. Please bind device first using: npx ccjk notification bind");
5743
+ let skillsClient = null;
5744
+ function getSkillsClient() {
5745
+ if (!skillsClient) {
5746
+ const token = getAuthToken();
5747
+ if (!token) {
5748
+ throw new Error("Not authenticated. Please bind device first using: npx ccjk notification bind");
5749
+ }
5750
+ const gateway = createGateway({
5751
+ authToken: token,
5752
+ timeout: DEFAULT_TIMEOUT
5753
+ });
5754
+ skillsClient = createSkillsClient(gateway);
5377
5755
  }
5378
- const url = `${CLOUD_API_BASE_URL}${endpoint}`;
5379
- const headers = {
5380
- "Content-Type": "application/json",
5381
- "Authorization": `Bearer ${token}`,
5382
- ...options.headers
5383
- };
5756
+ return skillsClient;
5757
+ }
5758
+ async function listCloudSkills(options = {}) {
5384
5759
  try {
5385
- const controller = new AbortController();
5386
- const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
5387
- const response = await fetch(url, {
5388
- ...options,
5389
- headers,
5390
- signal: controller.signal
5760
+ const client = getSkillsClient();
5761
+ const response = await client.list({
5762
+ privacy: options.privacy,
5763
+ author: options.author,
5764
+ tags: options.tags,
5765
+ query: options.query,
5766
+ page: options.page,
5767
+ pageSize: options.pageSize,
5768
+ sortBy: options.sortBy,
5769
+ sortDir: options.sortDir
5391
5770
  });
5392
- clearTimeout(timeoutId);
5393
- const data = await response.json();
5394
- if (!response.ok) {
5771
+ if (!response.success || !response.data) {
5395
5772
  return {
5396
5773
  success: false,
5397
- error: data.error || `HTTP ${response.status}: ${response.statusText}`,
5398
- code: data.code || String(response.status),
5774
+ error: response.error || "Failed to list skills",
5775
+ code: response.code,
5399
5776
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
5400
5777
  };
5401
5778
  }
5779
+ const skills = response.data.skills.map((skill) => ({
5780
+ id: skill.id,
5781
+ name: skill.name,
5782
+ version: skill.version,
5783
+ content: skill.content,
5784
+ metadata: skill.metadata,
5785
+ privacy: skill.privacy,
5786
+ checksum: skill.checksum,
5787
+ createdAt: skill.createdAt,
5788
+ updatedAt: skill.updatedAt
5789
+ }));
5402
5790
  return {
5403
5791
  success: true,
5404
- data,
5792
+ data: {
5793
+ skills,
5794
+ total: response.data.total,
5795
+ page: response.data.page,
5796
+ pageSize: response.data.pageSize,
5797
+ totalPages: response.data.totalPages
5798
+ },
5405
5799
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
5406
5800
  };
5407
5801
  } catch (error) {
@@ -5412,43 +5806,130 @@ async function apiRequest(endpoint, options = {}) {
5412
5806
  };
5413
5807
  }
5414
5808
  }
5415
- async function listCloudSkills(options = {}) {
5416
- const params = new URLSearchParams();
5417
- if (options.privacy)
5418
- params.append("privacy", options.privacy);
5419
- if (options.author)
5420
- params.append("author", options.author);
5421
- if (options.tags)
5422
- params.append("tags", options.tags.join(","));
5423
- if (options.query)
5424
- params.append("query", options.query);
5425
- if (options.page)
5426
- params.append("page", String(options.page));
5427
- if (options.pageSize)
5428
- params.append("pageSize", String(options.pageSize));
5429
- if (options.sortBy)
5430
- params.append("sortBy", options.sortBy);
5431
- if (options.sortDir)
5432
- params.append("sortDir", options.sortDir);
5433
- const queryString = params.toString();
5434
- const endpoint = `/skills${queryString ? `?${queryString}` : ""}`;
5435
- return apiRequest(endpoint, { method: "GET" });
5436
- }
5437
5809
  async function getCloudSkill(skillId, version) {
5438
- const endpoint = `/skills/${skillId}`;
5439
- return apiRequest(endpoint, { method: "GET" });
5810
+ try {
5811
+ const client = getSkillsClient();
5812
+ const response = await client.get({
5813
+ skillId,
5814
+ version
5815
+ });
5816
+ if (!response.success || !response.data) {
5817
+ return {
5818
+ success: false,
5819
+ error: response.error || "Failed to get skill",
5820
+ code: response.code,
5821
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5822
+ };
5823
+ }
5824
+ const skill = response.data.skill;
5825
+ return {
5826
+ success: true,
5827
+ data: {
5828
+ id: skill.id,
5829
+ name: skill.name,
5830
+ version: skill.version,
5831
+ content: skill.content,
5832
+ checksum: skill.checksum,
5833
+ privacy: skill.privacy,
5834
+ metadata: skill.metadata,
5835
+ createdAt: skill.createdAt,
5836
+ updatedAt: skill.updatedAt
5837
+ },
5838
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5839
+ };
5840
+ } catch (error) {
5841
+ return {
5842
+ success: false,
5843
+ error: error instanceof Error ? error.message : String(error),
5844
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5845
+ };
5846
+ }
5440
5847
  }
5441
5848
  async function uploadSkill(request) {
5442
- return apiRequest("/skills", {
5443
- method: "POST",
5444
- body: JSON.stringify(request)
5445
- });
5849
+ try {
5850
+ const client = getSkillsClient();
5851
+ const response = await client.upload({
5852
+ name: request.name,
5853
+ version: request.version,
5854
+ content: request.content,
5855
+ metadata: request.metadata,
5856
+ privacy: request.privacy,
5857
+ checksum: request.checksum
5858
+ });
5859
+ if (!response.success || !response.data) {
5860
+ return {
5861
+ success: false,
5862
+ error: response.error || "Failed to upload skill",
5863
+ code: response.code,
5864
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5865
+ };
5866
+ }
5867
+ const skill = response.data.skill;
5868
+ return {
5869
+ success: true,
5870
+ data: {
5871
+ id: skill.id,
5872
+ name: skill.name,
5873
+ version: skill.version,
5874
+ content: skill.content,
5875
+ checksum: skill.checksum,
5876
+ privacy: skill.privacy,
5877
+ metadata: skill.metadata,
5878
+ createdAt: skill.createdAt,
5879
+ updatedAt: skill.updatedAt
5880
+ },
5881
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5882
+ };
5883
+ } catch (error) {
5884
+ return {
5885
+ success: false,
5886
+ error: error instanceof Error ? error.message : String(error),
5887
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5888
+ };
5889
+ }
5446
5890
  }
5447
5891
  async function updateCloudSkill(skillId, request) {
5448
- return apiRequest(`/skills/${skillId}`, {
5449
- method: "PUT",
5450
- body: JSON.stringify(request)
5451
- });
5892
+ try {
5893
+ const client = getSkillsClient();
5894
+ const response = await client.update({
5895
+ skillId,
5896
+ version: request.version,
5897
+ content: request.content,
5898
+ metadata: request.metadata,
5899
+ privacy: request.privacy,
5900
+ checksum: request.checksum
5901
+ });
5902
+ if (!response.success || !response.data) {
5903
+ return {
5904
+ success: false,
5905
+ error: response.error || "Failed to update skill",
5906
+ code: response.code,
5907
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5908
+ };
5909
+ }
5910
+ const skill = response.data.skill;
5911
+ return {
5912
+ success: true,
5913
+ data: {
5914
+ id: skill.id,
5915
+ name: skill.name,
5916
+ version: skill.version,
5917
+ content: skill.content,
5918
+ checksum: skill.checksum,
5919
+ privacy: skill.privacy,
5920
+ metadata: skill.metadata,
5921
+ createdAt: skill.createdAt,
5922
+ updatedAt: skill.updatedAt
5923
+ },
5924
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5925
+ };
5926
+ } catch (error) {
5927
+ return {
5928
+ success: false,
5929
+ error: error instanceof Error ? error.message : String(error),
5930
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
5931
+ };
5932
+ }
5452
5933
  }
5453
5934
  async function syncSkill(skillId, options = {}) {
5454
5935
  try {