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
@@ -0,0 +1,171 @@
1
+ import { CLOUD_ENDPOINTS } from '../chunks/constants.mjs';
2
+ import { C as CloudApiClient } from './ccjk.D6ycHbak.mjs';
3
+
4
+ const ROUTE_MAP = {
5
+ // Analysis endpoints
6
+ "analysis.projects": {
7
+ v1: "/api/v1/analysis/projects",
8
+ v8: "/api/v8/analyze"
9
+ // Legacy v8 path
10
+ },
11
+ // Template endpoints
12
+ "templates.get": {
13
+ v1: "/api/v1/templates/:id"
14
+ },
15
+ "templates.batch": {
16
+ v1: "/api/v1/templates/batch",
17
+ v8: "/api/v8/templates"
18
+ // Legacy v8 batch endpoint
19
+ },
20
+ // Telemetry endpoints
21
+ "telemetry.installation": {
22
+ v1: "/api/v1/telemetry/installation"
23
+ },
24
+ // Health check
25
+ "health": {
26
+ v1: "/api/v1/health"
27
+ },
28
+ // Plugin endpoints
29
+ "plugins.list": {
30
+ v1: "/v1/plugins/list"
31
+ },
32
+ "plugins.recommend": {
33
+ v1: "/v1/plugins/recommend"
34
+ },
35
+ // Skills endpoints
36
+ "skills.list": {
37
+ v1: "/v1/skills/list"
38
+ },
39
+ "skills.upload": {
40
+ v1: "/v1/skills/upload"
41
+ },
42
+ "skills.download": {
43
+ v1: "/v1/skills/download"
44
+ },
45
+ // Notification endpoints (remote API)
46
+ "notifications.bind": {
47
+ v1: "/bind/use"
48
+ },
49
+ "notifications.send": {
50
+ v1: "/notify"
51
+ },
52
+ "notifications.poll": {
53
+ v1: "/reply/poll"
54
+ }
55
+ };
56
+ class CloudApiGateway {
57
+ mainClient;
58
+ pluginsClient;
59
+ remoteClient;
60
+ config;
61
+ constructor(config = {}) {
62
+ this.config = {
63
+ timeout: config.timeout || 3e4,
64
+ authToken: config.authToken || "",
65
+ enableVersionFallback: config.enableVersionFallback ?? true
66
+ };
67
+ this.mainClient = new CloudApiClient({
68
+ baseUrl: CLOUD_ENDPOINTS.MAIN.BASE_URL,
69
+ timeout: this.config.timeout,
70
+ authToken: this.config.authToken
71
+ });
72
+ this.pluginsClient = new CloudApiClient({
73
+ baseUrl: CLOUD_ENDPOINTS.PLUGINS.BASE_URL,
74
+ timeout: this.config.timeout,
75
+ authToken: this.config.authToken
76
+ });
77
+ this.remoteClient = new CloudApiClient({
78
+ baseUrl: CLOUD_ENDPOINTS.REMOTE.BASE_URL,
79
+ timeout: this.config.timeout,
80
+ authToken: this.config.authToken
81
+ });
82
+ }
83
+ /**
84
+ * Make a request through the gateway
85
+ *
86
+ * @param route - Semantic route identifier
87
+ * @param options - Request options
88
+ * @returns API response
89
+ */
90
+ async request(route, options) {
91
+ const routeConfig = ROUTE_MAP[route];
92
+ if (!routeConfig) {
93
+ return {
94
+ success: false,
95
+ error: `Unknown route: ${route}`,
96
+ code: "INVALID_ROUTE"
97
+ };
98
+ }
99
+ const client = this.getClientForRoute(route);
100
+ const version = options.preferVersion || "v1";
101
+ const path = this.resolvePath(routeConfig, version);
102
+ const response = await client.request(path, {
103
+ method: options.method,
104
+ body: options.body,
105
+ query: options.query,
106
+ authToken: options.authToken || this.config.authToken,
107
+ timeout: options.timeout || this.config.timeout
108
+ });
109
+ if (!response.success && version === "v1" && routeConfig.v8 && this.config.enableVersionFallback) {
110
+ const v8Path = routeConfig.v8;
111
+ return client.request(v8Path, {
112
+ method: options.method,
113
+ body: options.body,
114
+ query: options.query,
115
+ authToken: options.authToken || this.config.authToken,
116
+ timeout: options.timeout || this.config.timeout
117
+ });
118
+ }
119
+ return response;
120
+ }
121
+ /**
122
+ * Set authentication token for all clients
123
+ */
124
+ setAuthToken(token) {
125
+ this.config.authToken = token;
126
+ this.mainClient.setAuthToken(token);
127
+ this.pluginsClient.setAuthToken(token);
128
+ this.remoteClient.setAuthToken(token);
129
+ }
130
+ /**
131
+ * Get current configuration
132
+ */
133
+ getConfig() {
134
+ return { ...this.config };
135
+ }
136
+ // ==========================================================================
137
+ // Private Methods
138
+ // ==========================================================================
139
+ /**
140
+ * Get appropriate client for a route
141
+ */
142
+ getClientForRoute(route) {
143
+ if (route.startsWith("plugins.")) {
144
+ return this.pluginsClient;
145
+ }
146
+ if (route.startsWith("notifications.")) {
147
+ return this.remoteClient;
148
+ }
149
+ if (route.startsWith("skills.")) {
150
+ return this.pluginsClient;
151
+ }
152
+ return this.mainClient;
153
+ }
154
+ /**
155
+ * Resolve path for specific version
156
+ */
157
+ resolvePath(routeConfig, version) {
158
+ return version === "v8" && routeConfig.v8 ? routeConfig.v8 : routeConfig.v1;
159
+ }
160
+ }
161
+ function createGateway(config) {
162
+ return new CloudApiGateway(config);
163
+ }
164
+ function createDefaultGateway() {
165
+ return new CloudApiGateway({
166
+ timeout: 3e4,
167
+ enableVersionFallback: true
168
+ });
169
+ }
170
+
171
+ export { createGateway as a, createDefaultGateway as c };
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
7
7
  import { updateZcfConfig } from '../chunks/ccjk-config.mjs';
8
8
  import { exists, removeFile, ensureDir, copyFile } from '../chunks/fs-operations.mjs';
9
9
  import { readJsonConfig, writeJsonConfig } from '../chunks/json-config.mjs';
10
- import { m as mergeAndCleanPermissions } from './ccjk.BiCrMV5O.mjs';
10
+ import { m as mergeAndCleanPermissions } from './ccjk.DXRAZcix.mjs';
11
11
  import { a as addNumbersToChoices } from './ccjk.BFQ7yr5S.mjs';
12
12
  import { p as promptBoolean } from './ccjk.DOwtZMk8.mjs';
13
13
  import { j as join, d as dirname } from './ccjk.bQ7Dh1g4.mjs';
@@ -49,4 +49,4 @@ const i18nHelpers = {
49
49
  normalizeRecommendations: normalizeRecommendations
50
50
  };
51
51
 
52
- export { extractString as a, normalizeRecommendations as b, extractDisplayName as e, i18nHelpers as i, normalizeRecommendation as n };
52
+ export { extractDisplayName as a, normalizeRecommendations as b, extractString as e, i18nHelpers as i, normalizeRecommendation as n };
@@ -1,4 +1,4 @@
1
- import { detectCodeToolType } from '../chunks/smart-defaults.mjs';
1
+ import { a as detectCodeToolType } from '../chunks/smart-defaults.mjs';
2
2
  import { DEFAULT_CODE_TOOL_TYPE } from '../chunks/constants.mjs';
3
3
  import { i18n } from '../chunks/index5.mjs';
4
4
  import { readZcfConfigAsync } from '../chunks/ccjk-config.mjs';
@@ -0,0 +1,270 @@
1
+ const DEFAULT_TIMEOUT = 3e4;
2
+ const DEFAULT_RETRY_ATTEMPTS = 3;
3
+ const DEFAULT_RETRY_DELAY = 1e3;
4
+ class CloudApiClient {
5
+ baseUrl;
6
+ timeout;
7
+ authToken;
8
+ userAgent;
9
+ retry;
10
+ /**
11
+ * Create a new CloudApiClient instance
12
+ *
13
+ * @param config - Client configuration
14
+ */
15
+ constructor(config) {
16
+ this.baseUrl = config.baseUrl.replace(/\/$/, "");
17
+ this.timeout = config.timeout || DEFAULT_TIMEOUT;
18
+ this.authToken = config.authToken;
19
+ this.userAgent = config.userAgent || "CCJK-Client/1.0";
20
+ this.retry = config.retry || {
21
+ maxAttempts: DEFAULT_RETRY_ATTEMPTS,
22
+ delay: DEFAULT_RETRY_DELAY
23
+ };
24
+ }
25
+ // ==========================================================================
26
+ // Configuration Methods
27
+ // ==========================================================================
28
+ /**
29
+ * Set authentication token
30
+ *
31
+ * @param token - Authentication token
32
+ */
33
+ setAuthToken(token) {
34
+ this.authToken = token;
35
+ }
36
+ /**
37
+ * Clear authentication token
38
+ */
39
+ clearAuthToken() {
40
+ this.authToken = void 0;
41
+ }
42
+ /**
43
+ * Get current base URL
44
+ */
45
+ getBaseUrl() {
46
+ return this.baseUrl;
47
+ }
48
+ /**
49
+ * Update base URL
50
+ *
51
+ * @param url - New base URL
52
+ */
53
+ setBaseUrl(url) {
54
+ this.baseUrl = url.replace(/\/$/, "");
55
+ }
56
+ // ==========================================================================
57
+ // Request Methods
58
+ // ==========================================================================
59
+ /**
60
+ * Make an HTTP request to the cloud service
61
+ *
62
+ * @param path - API endpoint path (e.g., '/plugins/recommend')
63
+ * @param options - Request options
64
+ * @returns API response
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const response = await client.request<{ data: string }>('/api/endpoint', {
69
+ * method: 'POST',
70
+ * body: { key: 'value' },
71
+ * timeout: 5000
72
+ * })
73
+ * ```
74
+ */
75
+ async request(path, options) {
76
+ const maxAttempts = options.retry?.maxAttempts || this.retry.maxAttempts;
77
+ const retryDelay = options.retry?.delay || this.retry.delay;
78
+ let lastError = null;
79
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
80
+ try {
81
+ return await this.executeRequest(path, options);
82
+ } catch (error) {
83
+ lastError = error instanceof Error ? error : new Error(String(error));
84
+ if (attempt === maxAttempts || this.isClientError(lastError)) {
85
+ break;
86
+ }
87
+ await this.sleep(retryDelay * attempt);
88
+ }
89
+ }
90
+ return {
91
+ success: false,
92
+ error: lastError?.message || "Request failed",
93
+ code: "REQUEST_FAILED"
94
+ };
95
+ }
96
+ /**
97
+ * Execute a single HTTP request
98
+ *
99
+ * @private
100
+ */
101
+ async executeRequest(path, options) {
102
+ const url = this.buildUrl(path, options.query);
103
+ const timeout = options.timeout || this.timeout;
104
+ const controller = new AbortController();
105
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
106
+ try {
107
+ const headers = this.buildHeaders(options);
108
+ const response = await fetch(url, {
109
+ method: options.method,
110
+ headers,
111
+ body: options.body ? JSON.stringify(options.body) : void 0,
112
+ signal: controller.signal
113
+ });
114
+ clearTimeout(timeoutId);
115
+ const data = await response.json();
116
+ if (!response.ok) {
117
+ const errorMsg = typeof data.error === "object" && data.error !== null ? data.error.message || JSON.stringify(data.error) : data.error || `HTTP ${response.status}: ${response.statusText}`;
118
+ const errorCode = typeof data.error === "object" && data.error !== null ? data.error.code || data.code : data.code;
119
+ return {
120
+ success: false,
121
+ error: errorMsg,
122
+ code: errorCode || `HTTP_${response.status}`
123
+ };
124
+ }
125
+ return {
126
+ ...data,
127
+ success: true
128
+ };
129
+ } catch (error) {
130
+ clearTimeout(timeoutId);
131
+ if (error instanceof Error) {
132
+ if (error.name === "AbortError") {
133
+ return {
134
+ success: false,
135
+ error: "Request timeout",
136
+ code: "TIMEOUT"
137
+ };
138
+ }
139
+ return {
140
+ success: false,
141
+ error: error.message,
142
+ code: "NETWORK_ERROR"
143
+ };
144
+ }
145
+ return {
146
+ success: false,
147
+ error: String(error),
148
+ code: "UNKNOWN_ERROR"
149
+ };
150
+ }
151
+ }
152
+ // ==========================================================================
153
+ // Convenience Methods
154
+ // ==========================================================================
155
+ /**
156
+ * Make a GET request
157
+ *
158
+ * @param path - API endpoint path
159
+ * @param query - Query parameters
160
+ * @param options - Additional request options
161
+ * @returns API response
162
+ */
163
+ async get(path, query, options) {
164
+ return this.request(path, {
165
+ method: "GET",
166
+ query,
167
+ ...options
168
+ });
169
+ }
170
+ /**
171
+ * Make a POST request
172
+ *
173
+ * @param path - API endpoint path
174
+ * @param body - Request body
175
+ * @param options - Additional request options
176
+ * @returns API response
177
+ */
178
+ async post(path, body, options) {
179
+ return this.request(path, {
180
+ method: "POST",
181
+ body,
182
+ ...options
183
+ });
184
+ }
185
+ /**
186
+ * Make a PUT request
187
+ *
188
+ * @param path - API endpoint path
189
+ * @param body - Request body
190
+ * @param options - Additional request options
191
+ * @returns API response
192
+ */
193
+ async put(path, body, options) {
194
+ return this.request(path, {
195
+ method: "PUT",
196
+ body,
197
+ ...options
198
+ });
199
+ }
200
+ /**
201
+ * Make a DELETE request
202
+ *
203
+ * @param path - API endpoint path
204
+ * @param options - Additional request options
205
+ * @returns API response
206
+ */
207
+ async delete(path, options) {
208
+ return this.request(path, {
209
+ method: "DELETE",
210
+ ...options
211
+ });
212
+ }
213
+ // ==========================================================================
214
+ // Helper Methods
215
+ // ==========================================================================
216
+ /**
217
+ * Build full URL with query parameters
218
+ *
219
+ * @private
220
+ */
221
+ buildUrl(path, query) {
222
+ const url = `${this.baseUrl}${path}`;
223
+ if (!query || Object.keys(query).length === 0) {
224
+ return url;
225
+ }
226
+ const params = new URLSearchParams();
227
+ for (const [key, value] of Object.entries(query)) {
228
+ params.append(key, String(value));
229
+ }
230
+ return `${url}?${params.toString()}`;
231
+ }
232
+ /**
233
+ * Build request headers
234
+ *
235
+ * @private
236
+ */
237
+ buildHeaders(options) {
238
+ const headers = {
239
+ "Content-Type": "application/json",
240
+ "User-Agent": this.userAgent,
241
+ ...options.headers
242
+ };
243
+ const token = options.authToken || this.authToken;
244
+ if (token) {
245
+ headers.Authorization = `Bearer ${token}`;
246
+ }
247
+ return headers;
248
+ }
249
+ /**
250
+ * Check if error is a client error (4xx)
251
+ *
252
+ * @private
253
+ */
254
+ isClientError(error) {
255
+ return error.message.includes("HTTP 4");
256
+ }
257
+ /**
258
+ * Sleep for specified milliseconds
259
+ *
260
+ * @private
261
+ */
262
+ sleep(ms) {
263
+ return new Promise((resolve) => setTimeout(resolve, ms));
264
+ }
265
+ }
266
+ function createApiClient(config) {
267
+ return new CloudApiClient(config);
268
+ }
269
+
270
+ export { CloudApiClient as C, createApiClient as c };