ccjk 2.4.3 → 2.5.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 (53) 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 +451 -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 +8 -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 +420 -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 +316 -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/sandbox.json +44 -0
  35. package/dist/i18n/locales/en/skills.json +89 -129
  36. package/dist/i18n/locales/en/stats.json +20 -0
  37. package/dist/i18n/locales/zh-CN/hooks.json +47 -0
  38. package/dist/i18n/locales/zh-CN/mcp.json +55 -0
  39. package/dist/i18n/locales/zh-CN/permissions.json +43 -0
  40. package/dist/i18n/locales/zh-CN/sandbox.json +44 -0
  41. package/dist/i18n/locales/zh-CN/skills.json +88 -128
  42. package/dist/i18n/locales/zh-CN/stats.json +20 -0
  43. package/dist/index.mjs +12 -8
  44. package/dist/shared/ccjk.B-lZxV2u.mjs +1162 -0
  45. package/dist/shared/{ccjk.CURU8gbR.mjs → ccjk.CUdzQluX.mjs} +1 -1
  46. package/dist/shared/{ccjk.ByTIGCUC.mjs → ccjk.Dut3wyoP.mjs} +1 -1
  47. package/dist/shared/ccjk.J8YiPsOw.mjs +259 -0
  48. package/dist/shared/{ccjk.CGTmRqsu.mjs → ccjk.rLRHmcqD.mjs} +5 -134
  49. package/dist/shared/{ccjk.QbS8EAOd.mjs → ccjk.uVUeWAt8.mjs} +2 -1
  50. package/package.json +1 -1
  51. package/templates/common/skills/code-review.md +343 -0
  52. package/templates/common/skills/summarize.md +312 -0
  53. package/templates/common/skills/translate.md +202 -0
@@ -32,8 +32,12 @@ const NAMESPACES = [
32
32
  "multi-config",
33
33
  "notification",
34
34
  // Task completion notifications
35
+ "permissions",
36
+ // Permission system for API providers, models, and tools
35
37
  "plugins",
36
38
  // Cloud plugins management
39
+ "sandbox",
40
+ // Sandbox mode for secure request/response handling
37
41
  "shencha",
38
42
  "skills",
39
43
  // Skills management system
@@ -41,6 +45,8 @@ const NAMESPACES = [
41
45
  // Skills cloud synchronization
42
46
  "smartGuide",
43
47
  // Smart Guide for quick actions
48
+ "stats",
49
+ // Usage statistics
44
50
  "superpowers",
45
51
  // Superpowers plugin integration
46
52
  "team",
@@ -114,8 +120,8 @@ async function initI18n(language = "zh-CN") {
114
120
  escapeValue: false
115
121
  // Not needed for server-side usage
116
122
  },
117
- // Disable key separator for flat keys, enable namespace separator
118
- keySeparator: false,
123
+ // Enable key separator for nested keys, enable namespace separator
124
+ keySeparator: ".",
119
125
  nsSeparator: ":",
120
126
  // Debugging (disable for clean output)
121
127
  debug: false
@@ -4,22 +4,25 @@ import process__default from 'node:process';
4
4
  import ansis from 'ansis';
5
5
  import inquirer from 'inquirer';
6
6
  import { version } from './package.mjs';
7
- import { s as setPrimaryApiKey, l as addCompletedOnboarding, $ as backupExistingConfig, aa as promptApiConfigurationAction, N as runCodexFullInit, _ as ensureClaudeDir, a7 as getExistingApiConfig, a9 as switchToOfficialLogin, a0 as copyConfigFiles, a8 as applyAiLanguageDirective, a1 as configureApi, ac as selectMcpServices, h as backupMcpConfig, ad as getMcpServices, j as buildMcpServerConfig, e as readMcpConfig, i as mergeMcpServers, k as fixWindowsMcpConfig, f as writeMcpConfig, ab as MCP_SERVICE_CONFIGS } from './codex.mjs';
8
- import { m as modifyApiConfigPartially, c as configureApiCompletely, s as selectAndInstallWorkflows, a as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.CGTmRqsu.mjs';
7
+ import { z as runCodexFullInit, N as selectMcpServices, O as getMcpServices, M as MCP_SERVICE_CONFIGS } from './codex.mjs';
8
+ import { WORKFLOW_CONFIG_BASE } from './workflows2.mjs';
9
9
  import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS, API_DEFAULT_URL } from './constants.mjs';
10
10
  import { ensureI18nInitialized, i18n } from './index2.mjs';
11
11
  import { a as displayBannerWithInfo, p as padToDisplayWidth } from '../shared/ccjk.BhKlRJ0h.mjs';
12
- import { r as readJsonConfig, w as writeJsonConfig, a as readZcfConfig, u as updateZcfConfig } from './ccjk-config.mjs';
12
+ import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
13
13
  import { exec } from 'node:child_process';
14
14
  import { homedir } from 'node:os';
15
15
  import { promisify } from 'node:util';
16
16
  import dayjs from 'dayjs';
17
17
  import { join } from 'pathe';
18
+ import { s as setPrimaryApiKey, e as addCompletedOnboarding, l as backupExistingConfig, A as promptApiConfigurationAction, k as ensureClaudeDir, x as getExistingApiConfig, z as switchToOfficialLogin, n as copyConfigFiles, y as applyAiLanguageDirective, o as configureApi, b as backupMcpConfig, d as buildMcpServerConfig, r as readMcpConfig, a as mergeMcpServers, f as fixWindowsMcpConfig, w as writeMcpConfig } from './config.mjs';
19
+ import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
18
20
  import { p as promptBoolean, a as addNumbersToChoices } from '../shared/ccjk.DhBeLRzf.mjs';
19
21
  import { updateCcr, updateClaudeCode } from './auto-updater.mjs';
20
22
  import { wrapCommandWithSudo, isWindows, findCommandPath, getPlatform, getHomebrewCommandPaths, isTermux, getTermuxPrefix, isWSL, getWSLInfo, commandExists, getRecommendedInstallMethods } from './platform.mjs';
21
- import { r as resolveCodeType } from '../shared/ccjk.CURU8gbR.mjs';
23
+ import { r as resolveCodeType } from '../shared/ccjk.CUdzQluX.mjs';
22
24
  import { exists } from './fs-operations.mjs';
25
+ import { m as modifyApiConfigPartially, c as configureApiCompletely, s as selectAndInstallWorkflows, a as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.rLRHmcqD.mjs';
23
26
  import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.tB4-Y4Qb.mjs';
24
27
  import ora from 'ora';
25
28
  import { exec as exec$1 } from 'tinyexec';
@@ -406,7 +409,7 @@ async function setupCcrConfiguration() {
406
409
  console.log(ansis.yellow(`${i18n.t("ccr:keepingExistingConfig")}`));
407
410
  await configureCcrProxy(existingConfig);
408
411
  try {
409
- const { manageApiKeyApproval } = await import('./codex.mjs').then(function (n) { return n.ag; });
412
+ const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.C; });
410
413
  const apiKey = existingConfig.APIKEY || "sk-ccjk-x-ccr";
411
414
  manageApiKeyApproval(apiKey);
412
415
  console.log(ansis.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
@@ -440,7 +443,7 @@ async function setupCcrConfiguration() {
440
443
  console.error(ansis.red(i18n.t("errors:failedToSetOnboarding")), error);
441
444
  }
442
445
  try {
443
- const { manageApiKeyApproval } = await import('./codex.mjs').then(function (n) { return n.ag; });
446
+ const { manageApiKeyApproval } = await import('./config.mjs').then(function (n) { return n.C; });
444
447
  const apiKey = config.APIKEY || "sk-ccjk-x-ccr";
445
448
  manageApiKeyApproval(apiKey);
446
449
  console.log(ansis.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
@@ -805,7 +808,7 @@ async function isLocalClaudeCodeInstalled() {
805
808
  async function getInstallMethodFromConfig(codeType) {
806
809
  try {
807
810
  if (codeType === "claude-code") {
808
- const { readMcpConfig } = await import('./codex.mjs').then(function (n) { return n.ag; });
811
+ const { readMcpConfig } = await import('./config.mjs').then(function (n) { return n.C; });
809
812
  const config = readMcpConfig();
810
813
  return config?.installMethod || null;
811
814
  }
@@ -919,7 +922,7 @@ async function uninstallCodeTool(codeType) {
919
922
  async function setInstallMethod(method, codeType = "claude-code") {
920
923
  try {
921
924
  if (codeType === "claude-code") {
922
- const { readMcpConfig, writeMcpConfig } = await import('./codex.mjs').then(function (n) { return n.ag; });
925
+ const { readMcpConfig, writeMcpConfig } = await import('./config.mjs').then(function (n) { return n.C; });
923
926
  let config = readMcpConfig();
924
927
  if (!config) {
925
928
  config = { mcpServers: {} };
@@ -2079,7 +2082,7 @@ async function init(options = {}) {
2079
2082
  const hasModelParams = options.apiModel || options.apiHaikuModel || options.apiSonnetModel || options.apiOpusModel;
2080
2083
  if (hasModelParams && action !== "docs-only" && codeToolType === "claude-code") {
2081
2084
  if (options.skipPrompt) {
2082
- const { updateCustomModel } = await import('./codex.mjs').then(function (n) { return n.ah; });
2085
+ const { updateCustomModel } = await import('./config.mjs').then(function (n) { return n.D; });
2083
2086
  updateCustomModel(
2084
2087
  options.apiModel || void 0,
2085
2088
  options.apiHaikuModel || void 0,
@@ -2352,7 +2355,7 @@ async function handleClaudeCodeConfigs(configs) {
2352
2355
  await ClaudeCodeConfigManager.syncCcrProfile();
2353
2356
  }
2354
2357
  async function handleCodexConfigs(configs) {
2355
- const { addProviderToExisting } = await import('./index.mjs').then(function (n) { return n.aF; });
2358
+ const { addProviderToExisting } = await import('./index.mjs').then(function (n) { return n.ap; });
2356
2359
  const addedProviderIds = [];
2357
2360
  for (const config of configs) {
2358
2361
  try {
@@ -2373,7 +2376,7 @@ async function handleCodexConfigs(configs) {
2373
2376
  }
2374
2377
  const defaultConfig = configs.find((c) => c.default);
2375
2378
  if (defaultConfig) {
2376
- const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.ai; });
2379
+ const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.Q; });
2377
2380
  const displayName = defaultConfig.name || defaultConfig.provider || "custom";
2378
2381
  const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
2379
2382
  if (addedProviderIds.includes(providerId)) {
@@ -0,0 +1,59 @@
1
+ import dayjs from 'dayjs';
2
+ import { join } from 'pathe';
3
+ import { exists, readFile, writeFileAtomic, writeFile, ensureDir, copyFile } from './fs-operations.mjs';
4
+ import 'node:crypto';
5
+ import 'node:fs';
6
+ import 'node:fs/promises';
7
+
8
+ function readJsonConfig(path, options = {}) {
9
+ const { defaultValue = null, validate, sanitize } = options;
10
+ if (!exists(path)) {
11
+ return defaultValue;
12
+ }
13
+ try {
14
+ const content = readFile(path);
15
+ const data = JSON.parse(content);
16
+ if (validate && !validate(data)) {
17
+ console.log(`Invalid configuration: ${path}`);
18
+ return defaultValue;
19
+ }
20
+ if (sanitize) {
21
+ return sanitize(data);
22
+ }
23
+ return data;
24
+ } catch (error) {
25
+ console.error(`Failed to parse JSON: ${path}`, error);
26
+ return defaultValue;
27
+ }
28
+ }
29
+ function writeJsonConfig(path, data, options = {}) {
30
+ const { pretty = true, backup = false, backupDir, atomic = true } = options;
31
+ if (backup && exists(path)) {
32
+ backupJsonConfig(path, backupDir);
33
+ }
34
+ const content = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
35
+ if (atomic) {
36
+ writeFileAtomic(path, content);
37
+ } else {
38
+ writeFile(path, content);
39
+ }
40
+ }
41
+ function backupJsonConfig(path, backupDir) {
42
+ if (!exists(path)) {
43
+ return null;
44
+ }
45
+ const timestamp = dayjs().format("YYYY-MM-DD_HH-mm-ss");
46
+ const fileName = path.split("/").pop() || "config.json";
47
+ const baseDir = backupDir || join(path, "..", "backup");
48
+ const backupPath = join(baseDir, `${fileName}.backup_${timestamp}`);
49
+ try {
50
+ ensureDir(baseDir);
51
+ copyFile(path, backupPath);
52
+ return backupPath;
53
+ } catch (error) {
54
+ console.error("Failed to backup config", error);
55
+ return null;
56
+ }
57
+ }
58
+
59
+ export { backupJsonConfig, readJsonConfig, writeJsonConfig };