ccjk 9.10.2 → 9.11.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.
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from 'node:crypto';
2
- import { writeFileSync, renameSync, existsSync, unlinkSync, readFileSync, mkdirSync, copyFileSync, readdirSync, statSync } from 'node:fs';
2
+ import { existsSync, readFileSync, writeFileSync, renameSync, unlinkSync, mkdirSync, copyFileSync, readdirSync, statSync } from 'node:fs';
3
3
  import { mkdir, writeFile as writeFile$1, rename, unlink } from 'node:fs/promises';
4
4
  import { dirname, join } from 'pathe';
5
5
 
@@ -0,0 +1,179 @@
1
+ import { SETTINGS_FILE } from './constants.mjs';
2
+ import { exists } from './fs-operations.mjs';
3
+ import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
4
+ import 'node:os';
5
+ import 'pathe';
6
+ import './index.mjs';
7
+ import 'node:fs';
8
+ import 'node:process';
9
+ import 'node:url';
10
+ import 'i18next';
11
+ import 'i18next-fs-backend';
12
+ import 'node:crypto';
13
+ import 'node:fs/promises';
14
+ import 'dayjs';
15
+
16
+ const DEFAULT_SETTINGS_V2 = {
17
+ // Response language - empty means use system default
18
+ language: "",
19
+ // Plans directory - undefined means use default location
20
+ plansDirectory: void 0,
21
+ // Show turn duration - default false for cleaner output
22
+ showTurnDuration: false,
23
+ // Respect gitignore - default true for safety
24
+ respectGitignore: true,
25
+ // Auto-enable MCP servers after 5 uses
26
+ auto: {
27
+ mcp: 0
28
+ },
29
+ // Default agent - empty means use Claude's default
30
+ agent: "",
31
+ // Thinking configuration
32
+ thinking: {
33
+ enabled: false,
34
+ budgetTokens: 10240
35
+ },
36
+ // File suggestion using git
37
+ fileSuggestion: {
38
+ command: "git"
39
+ },
40
+ // Security defaults
41
+ allowUnsandboxedCommands: false,
42
+ disallowedTools: [],
43
+ // Attribution - empty means no custom attribution
44
+ attribution: "",
45
+ // Index configuration for context management
46
+ index: {
47
+ maxFiles: 1e4,
48
+ maxFileSize: 2097152
49
+ // 2MB
50
+ },
51
+ // Browser automation - default false for security
52
+ allowBrowser: false
53
+ };
54
+ function validateConfig(config) {
55
+ const errors = [];
56
+ if (config.model && !["opus", "sonnet", "sonnet[1m]", "custom", "default"].includes(config.model)) {
57
+ errors.push(`Invalid model: ${config.model}`);
58
+ }
59
+ if (config.thinking?.budgetTokens !== void 0) {
60
+ if (typeof config.thinking.budgetTokens !== "number" || config.thinking.budgetTokens < 0) {
61
+ errors.push("thinking.budgetTokens must be a positive number");
62
+ }
63
+ }
64
+ if (config.auto?.mcp !== void 0) {
65
+ if (typeof config.auto.mcp !== "number" || config.auto.mcp < 0) {
66
+ errors.push("auto.mcp must be a positive number");
67
+ }
68
+ }
69
+ if (config.index?.maxFiles !== void 0) {
70
+ if (typeof config.index.maxFiles !== "number" || config.index.maxFiles < 0) {
71
+ errors.push("index.maxFiles must be a positive number");
72
+ }
73
+ }
74
+ if (config.index?.maxFileSize !== void 0) {
75
+ if (typeof config.index.maxFileSize !== "number" || config.index.maxFileSize < 0) {
76
+ errors.push("index.maxFileSize must be a positive number");
77
+ }
78
+ }
79
+ if (config.disallowedTools && !Array.isArray(config.disallowedTools)) {
80
+ errors.push("disallowedTools must be an array");
81
+ }
82
+ return errors;
83
+ }
84
+ function migrateConfig(legacy) {
85
+ const migrated = { ...legacy };
86
+ if (migrated.permissions && !migrated.permissions.deny) {
87
+ migrated.permissions.deny = [];
88
+ }
89
+ if (migrated.language === void 0) {
90
+ migrated.language = DEFAULT_SETTINGS_V2.language;
91
+ }
92
+ if (migrated.plansDirectory === void 0) {
93
+ migrated.plansDirectory = DEFAULT_SETTINGS_V2.plansDirectory;
94
+ }
95
+ if (migrated.showTurnDuration === void 0) {
96
+ migrated.showTurnDuration = DEFAULT_SETTINGS_V2.showTurnDuration;
97
+ }
98
+ if (migrated.respectGitignore === void 0) {
99
+ migrated.respectGitignore = DEFAULT_SETTINGS_V2.respectGitignore;
100
+ }
101
+ if (migrated.auto === void 0) {
102
+ migrated.auto = { ...DEFAULT_SETTINGS_V2.auto };
103
+ }
104
+ if (migrated.agent === void 0) {
105
+ migrated.agent = DEFAULT_SETTINGS_V2.agent;
106
+ }
107
+ if (migrated.thinking === void 0) {
108
+ migrated.thinking = { ...DEFAULT_SETTINGS_V2.thinking };
109
+ }
110
+ if (migrated.fileSuggestion === void 0) {
111
+ migrated.fileSuggestion = { ...DEFAULT_SETTINGS_V2.fileSuggestion };
112
+ }
113
+ if (migrated.allowUnsandboxedCommands === void 0) {
114
+ migrated.allowUnsandboxedCommands = DEFAULT_SETTINGS_V2.allowUnsandboxedCommands;
115
+ }
116
+ if (migrated.disallowedTools === void 0) {
117
+ migrated.disallowedTools = [...DEFAULT_SETTINGS_V2.disallowedTools || []];
118
+ }
119
+ if (migrated.attribution === void 0) {
120
+ migrated.attribution = DEFAULT_SETTINGS_V2.attribution;
121
+ }
122
+ if (migrated.index === void 0) {
123
+ migrated.index = { ...DEFAULT_SETTINGS_V2.index };
124
+ }
125
+ if (migrated.allowBrowser === void 0) {
126
+ migrated.allowBrowser = DEFAULT_SETTINGS_V2.allowBrowser;
127
+ }
128
+ const FILE_TOOL_PERMISSIONS = ["Read(*)", "Write(*)", "Edit(*)", "NotebookEdit(*)"];
129
+ if (migrated.permissions?.allow) {
130
+ const missing = FILE_TOOL_PERMISSIONS.filter((p) => !migrated.permissions.allow.includes(p));
131
+ if (missing.length > 0) {
132
+ migrated.permissions.allow = [...migrated.permissions.allow, ...missing];
133
+ }
134
+ }
135
+ return migrated;
136
+ }
137
+ function saveConfigWithMigration(config) {
138
+ const validationErrors = validateConfig(config);
139
+ if (validationErrors.length > 0) {
140
+ return {
141
+ success: false,
142
+ validationErrors
143
+ };
144
+ }
145
+ try {
146
+ writeJsonConfig(SETTINGS_FILE, config);
147
+ return {
148
+ success: true,
149
+ validationErrors: []
150
+ };
151
+ } catch (error) {
152
+ validationErrors.push(`Failed to save config: ${error}`);
153
+ return {
154
+ success: false,
155
+ validationErrors
156
+ };
157
+ }
158
+ }
159
+ function runMigration() {
160
+ if (!exists(SETTINGS_FILE)) {
161
+ return { success: false, wasMigrated: false, validationErrors: ["No configuration file found"] };
162
+ }
163
+ const config = readJsonConfig(SETTINGS_FILE);
164
+ if (!config) {
165
+ return { success: false, wasMigrated: false, validationErrors: ["Failed to parse settings"] };
166
+ }
167
+ const migrated = migrateConfig(config);
168
+ if (JSON.stringify(config) === JSON.stringify(migrated)) {
169
+ return { success: true, wasMigrated: false, validationErrors: [] };
170
+ }
171
+ const result = saveConfigWithMigration(migrated);
172
+ return {
173
+ success: result.success,
174
+ wasMigrated: true,
175
+ validationErrors: result.validationErrors
176
+ };
177
+ }
178
+
179
+ export { DEFAULT_SETTINGS_V2, migrateConfig, runMigration, saveConfigWithMigration, validateConfig };
@@ -1,4 +1,4 @@
1
- const version = "9.10.2";
1
+ const version = "9.11.0";
2
2
  const homepage = "https://github.com/miounet11/ccjk";
3
3
 
4
4
  export { homepage, version };
package/dist/cli.mjs CHANGED
@@ -1621,6 +1621,11 @@ function customizeHelpLazy(_sections, version) {
1621
1621
  async function runLazyCli() {
1622
1622
  const spinner = await showStartupSpinner();
1623
1623
  try {
1624
+ try {
1625
+ const { runMigration } = await import('./chunks/migrator.mjs');
1626
+ runMigration();
1627
+ } catch {
1628
+ }
1624
1629
  bootstrapCloudServices();
1625
1630
  const handled = await tryQuickProviderLaunch();
1626
1631
  if (handled) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "9.10.2",
4
+ "version": "9.11.0",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "CCJK v9.0.0 - Revolutionary AI Development Platform with Enterprise Security, Streaming Cloud Sync, CRDT Conflict Resolution, and Unified V3 Architecture",
7
7
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
- "description": "Default Claude Code settings.json template for CCJK v8.1.2 - Supports Claude Code CLI 2.0-2.1",
3
+ "description": "CCJK settings template auto-migrated on upgrade",
4
4
 
5
5
  "model": "default",
6
6
 
@@ -18,7 +18,7 @@
18
18
  "respectGitignore": true,
19
19
 
20
20
  "auto": {
21
- "mcp": 5
21
+ "mcp": 0
22
22
  },
23
23
 
24
24
  "agent": "",
@@ -81,7 +81,11 @@
81
81
  "Bash(touch *)",
82
82
  "Bash(cp *)",
83
83
  "Bash(mv *)",
84
- "Bash(chmod *)"
84
+ "Bash(chmod *)",
85
+ "Read(*)",
86
+ "Edit(*)",
87
+ "Write(*)",
88
+ "NotebookEdit(*)"
85
89
  ]
86
90
  },
87
91