ccjk 8.1.4 → 8.1.6

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.
@@ -41,7 +41,7 @@ import './workflows.mjs';
41
41
  import './auto-updater.mjs';
42
42
  import './version-checker.mjs';
43
43
  import 'node:path';
44
- import '../shared/ccjk.BF-4_Yho.mjs';
44
+ import '../shared/ccjk.BWFuYEZc.mjs';
45
45
  import './installer2.mjs';
46
46
  import '../shared/ccjk.DcXM9drZ.mjs';
47
47
  import 'node:stream';
@@ -2,7 +2,7 @@ import dayjs from 'dayjs';
2
2
  import { join } from 'pathe';
3
3
  import { ZCF_CONFIG_FILE, ZCF_CONFIG_DIR, SETTINGS_FILE } from './constants.mjs';
4
4
  import { readDefaultTomlConfig, createDefaultTomlConfig, writeTomlConfig } from './ccjk-config.mjs';
5
- import { c as clearModelEnv } from './config2.mjs';
5
+ import { a as clearModelEnv } from './config2.mjs';
6
6
  import { ensureDir, exists, copyFile } from './fs-operations.mjs';
7
7
  import { readJsonConfig } from './json-config.mjs';
8
8
  import 'node:os';
@@ -4,7 +4,7 @@ import { ensureI18nInitialized, i18n } from './index.mjs';
4
4
  import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
5
5
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
6
6
  import { p as promptBoolean } from '../shared/ccjk.DHbrGcgg.mjs';
7
- import { v as validateApiKey } from '../shared/ccjk.BF-4_Yho.mjs';
7
+ import { v as validateApiKey } from '../shared/ccjk.BWFuYEZc.mjs';
8
8
  import 'node:fs';
9
9
  import 'node:process';
10
10
  import 'node:url';
@@ -11,7 +11,7 @@ import { x } from 'tinyexec';
11
11
  import { SUPPORTED_LANGS, CODEX_DIR, CODEX_AGENTS_FILE, CODEX_CONFIG_FILE, CODEX_PROMPTS_DIR, CODEX_AUTH_FILE, AI_OUTPUT_LANGUAGES, ZCF_CONFIG_FILE } from './constants.mjs';
12
12
  import { ensureI18nInitialized, i18n, format } from './index.mjs';
13
13
  import { updateZcfConfig, readZcfConfig, readDefaultTomlConfig, updateTomlConfig } from './ccjk-config.mjs';
14
- import { a as applyAiLanguageDirective } from './config2.mjs';
14
+ import { d as applyAiLanguageDirective } from './config2.mjs';
15
15
  import { exists, readFile, ensureDir, writeFileAtomic, writeFile, copyFile, copyDir } from './fs-operations.mjs';
16
16
  import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
17
17
  import { k as isWindows, l as getMcpCommand, m as getSystemRoot, w as wrapCommandWithSudo, n as normalizeTomlPath } from './platform.mjs';
@@ -200,10 +200,18 @@ function mergeSettingsFile(templatePath, targetPath) {
200
200
  ...existingSettings.env || {}
201
201
  // User's env vars override (preserving API keys, etc.)
202
202
  };
203
- const mergedSettings = deepMerge(templateSettings, existingSettings, {
204
- mergeArrays: true,
205
- arrayMergeStrategy: "unique"
206
- });
203
+ const mergedSettings = { ...templateSettings };
204
+ const schemaCriticalFields = [
205
+ "$schema",
206
+ "attribution",
207
+ "fileSuggestion",
208
+ "permissions"
209
+ ];
210
+ for (const [key, value] of Object.entries(existingSettings)) {
211
+ if (!schemaCriticalFields.includes(key)) {
212
+ mergedSettings[key] = value;
213
+ }
214
+ }
207
215
  mergedSettings.env = mergedEnv;
208
216
  if (mergedSettings.permissions && mergedSettings.permissions.allow) {
209
217
  mergedSettings.permissions.allow = mergeAndCleanPermissions(
@@ -349,4 +357,4 @@ const config = {
349
357
  updateDefaultModel: updateDefaultModel
350
358
  };
351
359
 
352
- export { applyAiLanguageDirective as a, backupExistingConfig as b, clearModelEnv as c, updateDefaultModel as d, getExistingApiConfig as e, configureApi as f, getExistingModelConfig as g, ensureClaudeDir as h, copyConfigFiles as i, config as j, mergeAndCleanPermissions as m, promptApiConfigurationAction as p, switchToOfficialLogin as s, updateCustomModel as u };
360
+ export { clearModelEnv as a, backupExistingConfig as b, copyConfigFiles as c, applyAiLanguageDirective as d, updateDefaultModel as e, getExistingApiConfig as f, getExistingModelConfig as g, configureApi as h, ensureClaudeDir as i, config as j, mergeAndCleanPermissions as m, promptApiConfigurationAction as p, switchToOfficialLogin as s, updateCustomModel as u };
@@ -1,4 +1,4 @@
1
- import { existsSync, mkdirSync, statSync, writeFileSync, readFileSync, readdirSync } from 'node:fs';
1
+ import { existsSync, mkdirSync, statSync, writeFileSync, readFileSync, copyFileSync, readdirSync } from 'node:fs';
2
2
  import process__default from 'node:process';
3
3
  import ansis from 'ansis';
4
4
  import inquirer from 'inquirer';
@@ -552,15 +552,57 @@ async function checkClaudeDir() {
552
552
  };
553
553
  }
554
554
  async function checkSettings() {
555
- if (existsSync(SETTINGS_FILE)) {
556
- return { name: "settings.json", status: "ok", message: "Configured" };
555
+ if (!existsSync(SETTINGS_FILE)) {
556
+ return {
557
+ name: "settings.json",
558
+ status: "warning",
559
+ message: "Not found",
560
+ fix: "Run: npx ccjk init"
561
+ };
562
+ }
563
+ try {
564
+ const { readFileSync: readFileSync2 } = await import('node:fs');
565
+ const content = readFileSync2(SETTINGS_FILE, "utf-8");
566
+ const settings = JSON.parse(content);
567
+ const issues = [];
568
+ if (settings.$schema && settings.$schema !== "https://json.schemastore.org/claude-code-settings.json") {
569
+ issues.push("Invalid $schema URL");
570
+ }
571
+ if (typeof settings.attribution === "string") {
572
+ issues.push("attribution should be an object, not a string");
573
+ }
574
+ if (settings.fileSuggestion && settings.fileSuggestion.type !== "command") {
575
+ issues.push('fileSuggestion.type must be "command"');
576
+ }
577
+ if (settings.permissions?.allow) {
578
+ const lowerCaseTools = settings.permissions.allow.filter(
579
+ (t) => /^[a-z]/.test(t) && !t.startsWith("Allow")
580
+ );
581
+ if (lowerCaseTools.length > 0) {
582
+ issues.push(`${lowerCaseTools.length} permission(s) with lowercase names`);
583
+ }
584
+ }
585
+ if (settings.plansDirectory === null) {
586
+ issues.push("plansDirectory should not be null");
587
+ }
588
+ if (issues.length > 0) {
589
+ return {
590
+ name: "settings.json",
591
+ status: "error",
592
+ message: `Validation issues: ${issues.length} problem(s)`,
593
+ fix: "Run: npx ccjk doctor --fix-settings",
594
+ details: issues
595
+ };
596
+ }
597
+ return { name: "settings.json", status: "ok", message: "Valid configuration" };
598
+ } catch (error) {
599
+ return {
600
+ name: "settings.json",
601
+ status: "error",
602
+ message: "Invalid JSON",
603
+ fix: "Run: npx ccjk init"
604
+ };
557
605
  }
558
- return {
559
- name: "settings.json",
560
- status: "warning",
561
- message: "Not found",
562
- fix: "Run: npx ccjk init"
563
- };
564
606
  }
565
607
  async function checkWorkflows() {
566
608
  const commandsDir = join(CLAUDE_DIR, "commands");
@@ -589,8 +631,8 @@ async function checkMcp() {
589
631
  const settingsPath = SETTINGS_FILE;
590
632
  if (existsSync(settingsPath)) {
591
633
  try {
592
- const { readFileSync } = await import('node:fs');
593
- const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
634
+ const { readFileSync: readFileSync2 } = await import('node:fs');
635
+ const settings = JSON.parse(readFileSync2(settingsPath, "utf-8"));
594
636
  if (settings.mcpServers && Object.keys(settings.mcpServers).length > 0) {
595
637
  const count = Object.keys(settings.mcpServers).length;
596
638
  return { name: "MCP Services", status: "ok", message: `${count} services configured` };
@@ -755,8 +797,48 @@ async function checkPermissionRules() {
755
797
  };
756
798
  }
757
799
  }
800
+ async function fixSettingsFile() {
801
+ const isZh = i18n.language === "zh-CN";
802
+ const { copyConfigFiles } = await import('./config2.mjs').then(function (n) { return n.j; });
803
+ console.log("");
804
+ console.log(ansis.bold.cyan("\u{1F527} Fixing settings.json"));
805
+ console.log(ansis.dim("\u2500".repeat(50)));
806
+ console.log("");
807
+ const backupPath = join(CLAUDE_DIR, "backup", `settings.backup.${Date.now()}.json`);
808
+ try {
809
+ if (existsSync(SETTINGS_FILE)) {
810
+ mkdirSync(join(CLAUDE_DIR, "backup"), { recursive: true });
811
+ copyFileSync(SETTINGS_FILE, backupPath);
812
+ console.log(ansis.green(`\u2714 ${isZh ? "\u5DF2\u5907\u4EFD\u65E7\u8BBE\u7F6E" : "Backed up settings"}: ${backupPath}`));
813
+ }
814
+ } catch (error) {
815
+ console.log(ansis.yellow(`\u26A0\uFE0F ${isZh ? "\u5907\u4EFD\u5931\u8D25\uFF0C\u7EE7\u7EED..." : "Backup failed, continuing..."}`));
816
+ }
817
+ console.log("");
818
+ console.log(ansis.dim(isZh ? "\u6B63\u5728\u5408\u5E76\u6A21\u677F\u8BBE\u7F6E..." : "Merging template settings..."));
819
+ copyConfigFiles(false);
820
+ const checkResult = await checkSettings();
821
+ console.log("");
822
+ if (checkResult.status === "ok") {
823
+ console.log(ansis.green(`\u2705 ${isZh ? "\u8BBE\u7F6E\u5DF2\u4FEE\u590D\uFF01" : "Settings fixed successfully!"}`));
824
+ } else {
825
+ console.log(ansis.yellow(`\u26A0\uFE0F ${isZh ? "\u4ECD\u6709\u4E00\u4E9B\u95EE\u9898" : "Some issues remain"}:`));
826
+ if (checkResult.details) {
827
+ for (const detail of checkResult.details) {
828
+ console.log(ansis.dim(` \u2022 ${detail}`));
829
+ }
830
+ }
831
+ }
832
+ console.log("");
833
+ console.log(ansis.dim(isZh ? "\u63D0\u793A: \u8BF7\u91CD\u542F Claude Code \u4EE5\u5E94\u7528\u66F4\u6539" : "Tip: Restart Claude Code to apply changes"));
834
+ console.log("");
835
+ }
758
836
  async function doctor(options = {}) {
759
837
  const isZh = i18n.language === "zh-CN";
838
+ if (options.fixSettings) {
839
+ await fixSettingsFile();
840
+ return;
841
+ }
760
842
  console.log("");
761
843
  console.log(ansis.bold.cyan("\u{1F50D} CCJK Health Check"));
762
844
  console.log(ansis.dim("\u2500".repeat(50)));
@@ -7,8 +7,8 @@ import { updateZcfConfig, readZcfConfig } from './ccjk-config.mjs';
7
7
  import { setupCcrConfiguration } from './config3.mjs';
8
8
  import { i as isCcrInstalled, a as installCcr } from './init.mjs';
9
9
  import { r as readMcpConfig, f as fixWindowsMcpConfig, w as writeMcpConfig, b as backupMcpConfig, a as buildMcpServerConfig, m as mergeMcpServers } from './claude-config.mjs';
10
- import { m as mergeAndCleanPermissions, a as applyAiLanguageDirective, g as getExistingModelConfig, u as updateCustomModel, d as updateDefaultModel, e as getExistingApiConfig, p as promptApiConfigurationAction, f as configureApi, s as switchToOfficialLogin } from './config2.mjs';
11
- import { c as configureOutputStyle, a as modifyApiConfigPartially, v as validateApiKey, f as formatApiKeyDisplay } from '../shared/ccjk.BF-4_Yho.mjs';
10
+ import { m as mergeAndCleanPermissions, d as applyAiLanguageDirective, g as getExistingModelConfig, u as updateCustomModel, e as updateDefaultModel, f as getExistingApiConfig, p as promptApiConfigurationAction, h as configureApi, s as switchToOfficialLogin } from './config2.mjs';
11
+ import { c as configureOutputStyle, a as modifyApiConfigPartially, v as validateApiKey, f as formatApiKeyDisplay } from '../shared/ccjk.BWFuYEZc.mjs';
12
12
  import { g as getPlatform, k as isWindows } from './platform.mjs';
13
13
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
14
14
  import { existsSync, readFileSync } from 'node:fs';
@@ -18,8 +18,8 @@ import { c as addCompletedOnboarding, s as setPrimaryApiKey, b as backupMcpConfi
18
18
  import { r as resolveCodeType } from '../shared/ccjk.SIo9I8q3.mjs';
19
19
  import { exists } from './fs-operations.mjs';
20
20
  import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
21
- import { p as promptApiConfigurationAction, h as ensureClaudeDir, e as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig, i as copyConfigFiles, a as applyAiLanguageDirective, f as configureApi } from './config2.mjs';
22
- import { a as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.BF-4_Yho.mjs';
21
+ import { p as promptApiConfigurationAction, i as ensureClaudeDir, f as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig, c as copyConfigFiles, d as applyAiLanguageDirective, h as configureApi } from './config2.mjs';
22
+ import { a as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.BWFuYEZc.mjs';
23
23
  import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.DvIrK0wz.mjs';
24
24
  import { getInstallationStatus, installClaudeCode } from './installer2.mjs';
25
25
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
@@ -1,4 +1,4 @@
1
- const version = "8.1.4";
1
+ const version = "8.1.6";
2
2
  const homepage = "https://github.com/miounet11/ccjk";
3
3
 
4
4
  export { homepage, version };
@@ -6,10 +6,11 @@ import { i18n } from './index.mjs';
6
6
  import { a as displayBanner } from '../shared/ccjk.BpHTUkb8.mjs';
7
7
  import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
8
8
  import { r as runCodexUpdate } from './codex.mjs';
9
- import { n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, u as updatePromptOnly, s as selectAndInstallWorkflows } from '../shared/ccjk.BF-4_Yho.mjs';
9
+ import { n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, u as updatePromptOnly, s as selectAndInstallWorkflows } from '../shared/ccjk.BWFuYEZc.mjs';
10
10
  import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.DvIrK0wz.mjs';
11
11
  import { resolveAiOutputLanguage } from './prompts.mjs';
12
12
  import { checkClaudeCodeVersionAndPrompt } from './version-checker.mjs';
13
+ import { c as copyConfigFiles } from './config2.mjs';
13
14
  import 'node:os';
14
15
  import 'pathe';
15
16
  import 'node:process';
@@ -26,8 +27,6 @@ import 'inquirer';
26
27
  import 'ora';
27
28
  import 'semver';
28
29
  import 'tinyexec';
29
- import './config2.mjs';
30
- import './claude-config.mjs';
31
30
  import './platform.mjs';
32
31
  import '../shared/ccjk.BFQ7yr5S.mjs';
33
32
  import '../shared/ccjk.DHbrGcgg.mjs';
@@ -36,6 +35,7 @@ import 'node:child_process';
36
35
  import './workflows.mjs';
37
36
  import 'node:path';
38
37
  import 'node:util';
38
+ import './claude-config.mjs';
39
39
 
40
40
  function resolveCodeToolType(optionValue, savedValue) {
41
41
  if (optionValue !== void 0) {
@@ -99,6 +99,8 @@ async function update(options = {}) {
99
99
  console.log(ansis.green(`
100
100
  ${i18n.t("configuration:updatingPrompts")}
101
101
  `));
102
+ console.log(ansis.dim("\u2714 Checking and fixing configuration format...\n"));
103
+ copyConfigFiles(false);
102
104
  await updatePromptOnly(aiOutputLang);
103
105
  await selectAndInstallWorkflows(configLang);
104
106
  await checkClaudeCodeVersionAndPrompt(false);
package/dist/cli.mjs CHANGED
@@ -65,14 +65,16 @@ const COMMANDS = [
65
65
  tier: "core",
66
66
  options: [
67
67
  { flags: "--check-providers", description: "Check API provider health" },
68
- { flags: "--code-type, -T <type>", description: "Code tool type" }
68
+ { flags: "--code-type, -T <type>", description: "Code tool type" },
69
+ { flags: "--fix-settings", description: "Fix settings.json validation issues" }
69
70
  ],
70
71
  loader: async () => {
71
72
  const { doctor } = await import('./chunks/doctor.mjs');
72
73
  return async (options) => {
73
74
  await doctor({
74
75
  checkProviders: options.checkProviders,
75
- codeType: options.codeType
76
+ codeType: options.codeType,
77
+ fixSettings: options.fixSettings
76
78
  });
77
79
  };
78
80
  }
package/dist/index.d.mts CHANGED
@@ -1090,6 +1090,7 @@ declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'sonnet[1m]' | 'd
1090
1090
  /**
1091
1091
  * Merge settings.json intelligently
1092
1092
  * Preserves user's environment variables and custom configurations
1093
+ * BUT ensures schema-critical fields use template values for validation
1093
1094
  */
1094
1095
  declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
1095
1096
  /**
package/dist/index.d.ts CHANGED
@@ -1090,6 +1090,7 @@ declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'sonnet[1m]' | 'd
1090
1090
  /**
1091
1091
  * Merge settings.json intelligently
1092
1092
  * Preserves user's environment variables and custom configurations
1093
+ * BUT ensures schema-critical fields use template values for validation
1093
1094
  */
1094
1095
  declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
1095
1096
  /**
@@ -2,7 +2,7 @@ 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/index.mjs';
5
- import { e as getExistingApiConfig, f as configureApi, s as switchToOfficialLogin, b as backupExistingConfig, a as applyAiLanguageDirective } from '../chunks/config2.mjs';
5
+ import { f as getExistingApiConfig, h as configureApi, s as switchToOfficialLogin, b as backupExistingConfig, d as applyAiLanguageDirective } from '../chunks/config2.mjs';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { join, dirname } from 'pathe';
8
8
  import { updateZcfConfig } from '../chunks/ccjk-config.mjs';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "8.1.4",
4
+ "version": "8.1.6",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "Ultimate AI Development Tool - Code Tool Abstraction Layer with 83% Token Savings - Now with Cloud Sync, Hot-Reload Skills, Multi-Agent Orchestration, and Full Claude Code CLI 2.1+ Compatibility",
7
7
  "author": {
@@ -174,4 +174,4 @@
174
174
  "unbuild": "^3.6.1",
175
175
  "vitest": "^3.2.4"
176
176
  }
177
- }
177
+ }