ccjk 2.4.4 → 2.6.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.
Files changed (55) hide show
  1. package/dist/chunks/api-providers.mjs +73 -1
  2. package/dist/chunks/ccjk-config.mjs +13 -77
  3. package/dist/chunks/ccr.mjs +9 -4
  4. package/dist/chunks/check-updates.mjs +4 -2
  5. package/dist/chunks/claude-code-config-manager.mjs +9 -15
  6. package/dist/chunks/claude-code-incremental-manager.mjs +5 -8
  7. package/dist/chunks/codex.mjs +10 -569
  8. package/dist/chunks/config-switch.mjs +7 -5
  9. package/dist/chunks/config.mjs +573 -0
  10. package/dist/chunks/config2.mjs +454 -0
  11. package/dist/chunks/doctor.mjs +89 -1
  12. package/dist/chunks/features.mjs +13 -10
  13. package/dist/chunks/index.mjs +10 -1164
  14. package/dist/chunks/index2.mjs +10 -2
  15. package/dist/chunks/init.mjs +14 -11
  16. package/dist/chunks/json-config.mjs +59 -0
  17. package/dist/chunks/mcp-server.mjs +776 -0
  18. package/dist/chunks/mcp.mjs +10 -8
  19. package/dist/chunks/menu.mjs +5 -5
  20. package/dist/chunks/package.mjs +1 -1
  21. package/dist/chunks/permissions.mjs +428 -0
  22. package/dist/chunks/prompts.mjs +2 -1
  23. package/dist/chunks/providers.mjs +261 -0
  24. package/dist/chunks/session.mjs +484 -41
  25. package/dist/chunks/skills.mjs +553 -0
  26. package/dist/chunks/stats.mjs +411 -0
  27. package/dist/chunks/uninstall.mjs +4 -3
  28. package/dist/chunks/update.mjs +6 -3
  29. package/dist/chunks/workflows2.mjs +140 -0
  30. package/dist/cli.mjs +290 -10
  31. package/dist/i18n/locales/en/hooks.json +47 -0
  32. package/dist/i18n/locales/en/mcp.json +55 -0
  33. package/dist/i18n/locales/en/permissions.json +43 -0
  34. package/dist/i18n/locales/en/registry.json +54 -0
  35. package/dist/i18n/locales/en/sandbox.json +44 -0
  36. package/dist/i18n/locales/en/skills.json +89 -129
  37. package/dist/i18n/locales/en/stats.json +20 -0
  38. package/dist/i18n/locales/zh-CN/hooks.json +47 -0
  39. package/dist/i18n/locales/zh-CN/mcp.json +55 -0
  40. package/dist/i18n/locales/zh-CN/permissions.json +43 -0
  41. package/dist/i18n/locales/zh-CN/registry.json +54 -0
  42. package/dist/i18n/locales/zh-CN/sandbox.json +44 -0
  43. package/dist/i18n/locales/zh-CN/skills.json +88 -128
  44. package/dist/i18n/locales/zh-CN/stats.json +20 -0
  45. package/dist/index.mjs +12 -8
  46. package/dist/shared/ccjk.B-lZxV2u.mjs +1162 -0
  47. package/dist/shared/{ccjk.CURU8gbR.mjs → ccjk.CUdzQluX.mjs} +1 -1
  48. package/dist/shared/{ccjk.ByTIGCUC.mjs → ccjk.Dut3wyoP.mjs} +1 -1
  49. package/dist/shared/ccjk.J8YiPsOw.mjs +259 -0
  50. package/dist/shared/{ccjk.CGTmRqsu.mjs → ccjk.rLRHmcqD.mjs} +5 -134
  51. package/dist/shared/{ccjk.QbS8EAOd.mjs → ccjk.uVUeWAt8.mjs} +2 -1
  52. package/package.json +1 -1
  53. package/templates/common/skills/code-review.md +343 -0
  54. package/templates/common/skills/summarize.md +312 -0
  55. package/templates/common/skills/translate.md +202 -0
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_CODE_TOOL_TYPE } from '../chunks/constants.mjs';
2
2
  import { i18n } from '../chunks/index2.mjs';
3
- import { e as readZcfConfigAsync } from '../chunks/ccjk-config.mjs';
3
+ import { readZcfConfigAsync } from '../chunks/ccjk-config.mjs';
4
4
 
5
5
  const CODE_TYPE_ABBREVIATIONS = {
6
6
  cc: "claude-code",
@@ -6,7 +6,7 @@ import { readFile, writeFileAtomic, ensureDir } from '../chunks/fs-operations.mj
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { exec } from 'tinyexec';
8
8
  import { CLAUDE_DIR, SETTINGS_FILE } from '../chunks/constants.mjs';
9
- import { m as mergeAndCleanPermissions } from '../chunks/codex.mjs';
9
+ import { m as mergeAndCleanPermissions } from '../chunks/config.mjs';
10
10
  import { getPlatform } from '../chunks/platform.mjs';
11
11
 
12
12
  function detectProjectContext(projectPath = process__default.cwd()) {
@@ -0,0 +1,259 @@
1
+ const DEFAULT_CONFIG = {
2
+ checkInterval: 5 * 60 * 1e3,
3
+ // 5 minutes
4
+ timeout: 1e4,
5
+ // 10 seconds
6
+ degradedLatencyThreshold: 2e3,
7
+ // 2 seconds
8
+ unhealthyLatencyThreshold: 5e3,
9
+ // 5 seconds
10
+ degradedSuccessRateThreshold: 0.8,
11
+ // 80%
12
+ unhealthySuccessRateThreshold: 0.5,
13
+ // 50%
14
+ maxConsecutiveFailures: 3
15
+ };
16
+ class ProviderHealthMonitor {
17
+ healthData = /* @__PURE__ */ new Map();
18
+ monitoringInterval = null;
19
+ config;
20
+ providers = [];
21
+ constructor(config) {
22
+ this.config = { ...DEFAULT_CONFIG, ...config };
23
+ }
24
+ /**
25
+ * Set providers to monitor
26
+ */
27
+ setProviders(providers) {
28
+ this.providers = providers;
29
+ for (const provider of providers) {
30
+ if (!this.healthData.has(provider.id)) {
31
+ this.healthData.set(provider.id, {
32
+ providerId: provider.id,
33
+ latency: 0,
34
+ successRate: 1,
35
+ lastCheck: 0,
36
+ status: "unknown",
37
+ consecutiveFailures: 0,
38
+ totalRequests: 0,
39
+ successfulRequests: 0
40
+ });
41
+ }
42
+ }
43
+ }
44
+ /**
45
+ * Check health of a single provider
46
+ */
47
+ async checkHealth(provider) {
48
+ const startTime = Date.now();
49
+ try {
50
+ const baseUrl = provider.claudeCode?.baseUrl || provider.codex?.baseUrl;
51
+ if (!baseUrl) {
52
+ return {
53
+ success: false,
54
+ latency: 0,
55
+ error: "No base URL configured",
56
+ timestamp: Date.now()
57
+ };
58
+ }
59
+ const controller = new AbortController();
60
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
61
+ try {
62
+ const response = await fetch(baseUrl, {
63
+ method: "HEAD",
64
+ signal: controller.signal,
65
+ headers: {
66
+ "User-Agent": "CCJK-Health-Monitor/1.0"
67
+ }
68
+ });
69
+ clearTimeout(timeoutId);
70
+ const latency = Date.now() - startTime;
71
+ const success = response.ok || response.status === 404;
72
+ return {
73
+ success,
74
+ latency,
75
+ timestamp: Date.now()
76
+ };
77
+ } catch (error) {
78
+ clearTimeout(timeoutId);
79
+ if (error instanceof Error && error.name === "AbortError") {
80
+ return {
81
+ success: false,
82
+ latency: this.config.timeout,
83
+ error: "Request timeout",
84
+ timestamp: Date.now()
85
+ };
86
+ }
87
+ return {
88
+ success: false,
89
+ latency: Date.now() - startTime,
90
+ error: error instanceof Error ? error.message : "Unknown error",
91
+ timestamp: Date.now()
92
+ };
93
+ }
94
+ } catch (error) {
95
+ return {
96
+ success: false,
97
+ latency: Date.now() - startTime,
98
+ error: error instanceof Error ? error.message : "Unknown error",
99
+ timestamp: Date.now()
100
+ };
101
+ }
102
+ }
103
+ /**
104
+ * Update health data based on check result
105
+ */
106
+ updateHealthData(providerId, result) {
107
+ const health = this.healthData.get(providerId);
108
+ if (!health) {
109
+ return;
110
+ }
111
+ health.totalRequests++;
112
+ if (result.success) {
113
+ health.successfulRequests++;
114
+ health.consecutiveFailures = 0;
115
+ } else {
116
+ health.consecutiveFailures++;
117
+ }
118
+ health.successRate = health.successfulRequests / health.totalRequests;
119
+ if (result.success) {
120
+ health.latency = health.latency === 0 ? result.latency : health.latency * 0.7 + result.latency * 0.3;
121
+ }
122
+ health.lastCheck = result.timestamp;
123
+ health.status = this.determineStatus(health);
124
+ this.healthData.set(providerId, health);
125
+ }
126
+ /**
127
+ * Determine provider status based on health metrics
128
+ */
129
+ determineStatus(health) {
130
+ if (health.consecutiveFailures >= this.config.maxConsecutiveFailures) {
131
+ return "unhealthy";
132
+ }
133
+ if (health.successRate < this.config.unhealthySuccessRateThreshold) {
134
+ return "unhealthy";
135
+ }
136
+ if (health.successRate < this.config.degradedSuccessRateThreshold) {
137
+ return "degraded";
138
+ }
139
+ if (health.successfulRequests > 0) {
140
+ if (health.latency > this.config.unhealthyLatencyThreshold) {
141
+ return "unhealthy";
142
+ }
143
+ if (health.latency > this.config.degradedLatencyThreshold) {
144
+ return "degraded";
145
+ }
146
+ }
147
+ return "healthy";
148
+ }
149
+ /**
150
+ * Get health data for a specific provider
151
+ */
152
+ getProviderHealth(providerId) {
153
+ return this.healthData.get(providerId);
154
+ }
155
+ /**
156
+ * Get all healthy providers
157
+ */
158
+ getHealthyProviders() {
159
+ return this.providers.filter((provider) => {
160
+ const health = this.healthData.get(provider.id);
161
+ return health && health.status === "healthy";
162
+ });
163
+ }
164
+ /**
165
+ * Get all providers sorted by health score
166
+ */
167
+ getProvidersByHealth() {
168
+ return [...this.providers].sort((a, b) => {
169
+ const healthA = this.healthData.get(a.id);
170
+ const healthB = this.healthData.get(b.id);
171
+ if (!healthA || !healthB) {
172
+ return 0;
173
+ }
174
+ const scoreA = this.calculateHealthScore(healthA);
175
+ const scoreB = this.calculateHealthScore(healthB);
176
+ return scoreB - scoreA;
177
+ });
178
+ }
179
+ /**
180
+ * Calculate health score for a provider
181
+ */
182
+ calculateHealthScore(health) {
183
+ const statusWeight = {
184
+ healthy: 1,
185
+ degraded: 0.6,
186
+ unhealthy: 0.2,
187
+ unknown: 0.5
188
+ };
189
+ const normalizedLatency = Math.max(0, 1 - health.latency / 1e4);
190
+ return statusWeight[health.status] * 0.4 + health.successRate * 0.4 + normalizedLatency * 0.2;
191
+ }
192
+ /**
193
+ * Get the best provider based on health metrics
194
+ */
195
+ getBestProvider() {
196
+ const sortedProviders = this.getProvidersByHealth();
197
+ return sortedProviders.length > 0 ? sortedProviders[0] : null;
198
+ }
199
+ /**
200
+ * Start monitoring all providers
201
+ */
202
+ async startMonitoring() {
203
+ if (this.monitoringInterval) {
204
+ return;
205
+ }
206
+ await this.checkAllProviders();
207
+ this.monitoringInterval = setInterval(async () => {
208
+ await this.checkAllProviders();
209
+ }, this.config.checkInterval);
210
+ }
211
+ /**
212
+ * Stop monitoring
213
+ */
214
+ stopMonitoring() {
215
+ if (this.monitoringInterval) {
216
+ clearInterval(this.monitoringInterval);
217
+ this.monitoringInterval = null;
218
+ }
219
+ }
220
+ /**
221
+ * Check health of all providers
222
+ */
223
+ async checkAllProviders() {
224
+ const checks = this.providers.map(async (provider) => {
225
+ const result = await this.checkHealth(provider);
226
+ this.updateHealthData(provider.id, result);
227
+ });
228
+ await Promise.all(checks);
229
+ }
230
+ /**
231
+ * Get all health data
232
+ */
233
+ getAllHealthData() {
234
+ return new Map(this.healthData);
235
+ }
236
+ /**
237
+ * Reset health data for a provider
238
+ */
239
+ resetProviderHealth(providerId) {
240
+ const health = this.healthData.get(providerId);
241
+ if (health) {
242
+ health.consecutiveFailures = 0;
243
+ health.totalRequests = 0;
244
+ health.successfulRequests = 0;
245
+ health.successRate = 1;
246
+ health.latency = 0;
247
+ health.status = "unknown";
248
+ this.healthData.set(providerId, health);
249
+ }
250
+ }
251
+ /**
252
+ * Clear all health data
253
+ */
254
+ clearAllHealthData() {
255
+ this.healthData.clear();
256
+ }
257
+ }
258
+
259
+ export { ProviderHealthMonitor as P };
@@ -2,145 +2,16 @@ import ansis from 'ansis';
2
2
  import inquirer from 'inquirer';
3
3
  import { CLAUDE_DIR, SETTINGS_FILE } from '../chunks/constants.mjs';
4
4
  import { ensureI18nInitialized, i18n } from '../chunks/index2.mjs';
5
- import { a7 as getExistingApiConfig, a1 as configureApi, a9 as switchToOfficialLogin, $ as backupExistingConfig, a8 as applyAiLanguageDirective } from '../chunks/codex.mjs';
5
+ import { x as getExistingApiConfig, o as configureApi, z as switchToOfficialLogin, l as backupExistingConfig, y as applyAiLanguageDirective } from '../chunks/config.mjs';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { join, dirname } from 'pathe';
8
- import { u as updateZcfConfig, r as readJsonConfig, w as writeJsonConfig } from '../chunks/ccjk-config.mjs';
8
+ import { updateZcfConfig } from '../chunks/ccjk-config.mjs';
9
9
  import { exists, removeFile, ensureDir, copyFile } from '../chunks/fs-operations.mjs';
10
+ import { readJsonConfig, writeJsonConfig } from '../chunks/json-config.mjs';
10
11
  import { p as promptBoolean, a as addNumbersToChoices } from './ccjk.DhBeLRzf.mjs';
11
12
  import { existsSync } from 'node:fs';
12
13
  import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
13
-
14
- const WORKFLOW_CONFIG_BASE = [
15
- {
16
- id: "interviewWorkflow",
17
- defaultSelected: true,
18
- order: 1,
19
- commands: ["interview.md"],
20
- agents: [],
21
- autoInstallAgents: false,
22
- category: "interview",
23
- displayCategory: "planning",
24
- outputDir: "interview",
25
- metadata: {
26
- version: "1.0.0",
27
- addedDate: "2025-01",
28
- tags: ["recommended", "popular"],
29
- difficulty: "beginner"
30
- }
31
- },
32
- {
33
- id: "essentialTools",
34
- defaultSelected: true,
35
- order: 2,
36
- commands: ["init-project.md", "feat.md"],
37
- agents: [
38
- { id: "init-architect", filename: "init-architect.md", required: true },
39
- { id: "get-current-datetime", filename: "get-current-datetime.md", required: true },
40
- { id: "planner", filename: "planner.md", required: true },
41
- { id: "ui-ux-designer", filename: "ui-ux-designer.md", required: true }
42
- ],
43
- autoInstallAgents: true,
44
- category: "essential",
45
- displayCategory: "planning",
46
- outputDir: "essential",
47
- metadata: {
48
- version: "1.0.0",
49
- addedDate: "2025-01",
50
- tags: ["essential"],
51
- difficulty: "beginner"
52
- }
53
- },
54
- {
55
- id: "gitWorkflow",
56
- defaultSelected: true,
57
- order: 3,
58
- commands: ["git-commit.md", "git-rollback.md", "git-cleanBranches.md", "git-worktree.md"],
59
- agents: [],
60
- autoInstallAgents: false,
61
- category: "git",
62
- displayCategory: "versionControl",
63
- outputDir: "git",
64
- metadata: {
65
- version: "1.0.0",
66
- addedDate: "2025-01",
67
- tags: ["popular"],
68
- difficulty: "beginner"
69
- }
70
- },
71
- {
72
- id: "sixStepsWorkflow",
73
- defaultSelected: false,
74
- order: 4,
75
- commands: ["workflow.md"],
76
- agents: [],
77
- autoInstallAgents: false,
78
- category: "sixStep",
79
- displayCategory: "development",
80
- outputDir: "workflow",
81
- metadata: {
82
- version: "1.0.0",
83
- addedDate: "2025-01",
84
- tags: ["professional"],
85
- difficulty: "intermediate"
86
- }
87
- }
88
- ];
89
- function getWorkflowConfigs() {
90
- ensureI18nInitialized();
91
- const workflowTranslations = [
92
- {
93
- id: "interviewWorkflow",
94
- name: i18n.t("workflow:workflowOption.interviewWorkflow"),
95
- description: i18n.t("workflow:workflowDescription.interviewWorkflow"),
96
- stats: i18n.t("workflow:workflowStats.interviewWorkflow")
97
- },
98
- {
99
- id: "essentialTools",
100
- name: i18n.t("workflow:workflowOption.essentialTools"),
101
- description: i18n.t("workflow:workflowDescription.essentialTools"),
102
- stats: i18n.t("workflow:workflowStats.essentialTools")
103
- },
104
- {
105
- id: "gitWorkflow",
106
- name: i18n.t("workflow:workflowOption.gitWorkflow"),
107
- description: i18n.t("workflow:workflowDescription.gitWorkflow"),
108
- stats: i18n.t("workflow:workflowStats.gitWorkflow")
109
- },
110
- {
111
- id: "sixStepsWorkflow",
112
- name: i18n.t("workflow:workflowOption.sixStepsWorkflow"),
113
- description: i18n.t("workflow:workflowDescription.sixStepsWorkflow"),
114
- stats: i18n.t("workflow:workflowStats.sixStepsWorkflow")
115
- }
116
- ];
117
- return WORKFLOW_CONFIG_BASE.map((baseConfig) => {
118
- const translation = workflowTranslations.find((t) => t.id === baseConfig.id);
119
- return {
120
- ...baseConfig,
121
- name: translation?.name || baseConfig.id,
122
- description: translation?.description,
123
- stats: translation?.stats
124
- };
125
- });
126
- }
127
- function getWorkflowConfig(workflowId) {
128
- return getWorkflowConfigs().find((config) => config.id === workflowId);
129
- }
130
- function getOrderedWorkflows() {
131
- return getWorkflowConfigs().sort((a, b) => a.order - b.order);
132
- }
133
- function getTagLabel(tag) {
134
- ensureI18nInitialized();
135
- const tagKeys = {
136
- recommended: "workflow:tags.recommended",
137
- popular: "workflow:tags.popular",
138
- new: "workflow:tags.new",
139
- essential: "workflow:tags.essential",
140
- professional: "workflow:tags.professional"
141
- };
142
- return i18n.t(tagKeys[tag]);
143
- }
14
+ import { getOrderedWorkflows, getWorkflowConfig, getTagLabel } from '../chunks/workflows2.mjs';
144
15
 
145
16
  const OUTPUT_STYLES = [
146
17
  // Custom styles (have template files) - Efficiency-focused styles
@@ -745,4 +616,4 @@ async function cleanupOldVersionFiles() {
745
616
  }
746
617
  }
747
618
 
748
- export { WORKFLOW_CONFIG_BASE as W, configureOutputStyle as a, configureApiCompletely as c, formatApiKeyDisplay as f, modifyApiConfigPartially as m, selectAndInstallWorkflows as s, updatePromptOnly as u, validateApiKey as v };
619
+ export { configureOutputStyle as a, configureApiCompletely as c, formatApiKeyDisplay as f, modifyApiConfigPartially as m, selectAndInstallWorkflows as s, updatePromptOnly as u, validateApiKey as v };
@@ -1,8 +1,9 @@
1
1
  import ansis from 'ansis';
2
2
  import inquirer from 'inquirer';
3
- import { af as getMcpService, r as readCodexConfig, Z as applyCodexPlatformCommand, w as writeCodexConfig, e as readMcpConfig, j as buildMcpServerConfig, f as writeMcpConfig, ab as MCP_SERVICE_CONFIGS } from '../chunks/codex.mjs';
3
+ import { P as getMcpService, r as readCodexConfig, L as applyCodexPlatformCommand, w as writeCodexConfig, M as MCP_SERVICE_CONFIGS } from '../chunks/codex.mjs';
4
4
  import { ensureI18nInitialized, i18n } from '../chunks/index2.mjs';
5
5
  import { ClAUDE_CONFIG_FILE, CODEX_CONFIG_FILE } from '../chunks/constants.mjs';
6
+ import { r as readMcpConfig, d as buildMcpServerConfig, w as writeMcpConfig } from '../chunks/config.mjs';
6
7
  import { writeFileAtomic, exists } from '../chunks/fs-operations.mjs';
7
8
  import { isWindows, getSystemRoot } from '../chunks/platform.mjs';
8
9
  import { existsSync, unlinkSync, statSync, mkdirSync, readFileSync } from 'node:fs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "2.4.4",
4
+ "version": "2.6.0",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "Claude Code JinKu - Advanced AI-powered development assistant with skills, agents, and LLM-driven audit",
7
7
  "author": {