@tkpdx01/ccc 1.3.5 → 1.3.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.
package/index.js CHANGED
@@ -27,7 +27,7 @@ const program = new Command();
27
27
  program
28
28
  .name('ccc')
29
29
  .description('Claude Code Settings Launcher - 管理多个 Claude Code 配置文件')
30
- .version('1.3.3');
30
+ .version('1.3.7');
31
31
 
32
32
  // 注册所有命令
33
33
  listCommand(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tkpdx01/ccc",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Claude Code Settings Launcher - Manage multiple Claude Code profiles",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -14,7 +14,8 @@ import {
14
14
  getProfileCredentials,
15
15
  getClaudeSettingsTemplate,
16
16
  ensureRequiredClaudeEnvSettings,
17
- ensureClaudeSettingsExtras
17
+ ensureClaudeSettingsExtras,
18
+ applyClaudeSettingsExtras
18
19
  } from '../profiles.js';
19
20
 
20
21
  export function editCommand(program) {
@@ -103,6 +104,7 @@ export function editCommand(program) {
103
104
  currentProfile.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = '1';
104
105
  currentProfile.env.CLAUDE_CODE_ATTRIBUTION_HEADER = '0';
105
106
  currentProfile.env.DISABLE_INSTALLATION_CHECKS = '1';
107
+ applyClaudeSettingsExtras(currentProfile);
106
108
 
107
109
  // 如果重命名
108
110
  if (newName && newName !== profile) {
package/src/profiles.js CHANGED
@@ -150,30 +150,28 @@ function getCclineCommand() {
150
150
  }
151
151
  }
152
152
 
153
- // 确保主配置包含 attribution/includeCoAuthoredBy 和 statusLine 设置
154
- export function ensureClaudeSettingsExtras() {
155
- const template = getClaudeSettingsTemplate();
156
- if (!template) {
157
- return null;
153
+ export function applyClaudeSettingsExtras(target) {
154
+ if (!target || typeof target !== 'object') {
155
+ return false;
158
156
  }
159
157
 
160
158
  let changed = false;
161
159
 
162
160
  // 确保 attribution 禁用(commit/pr 为空字符串)
163
- if (!template.attribution || typeof template.attribution !== 'object' || Array.isArray(template.attribution)) {
164
- template.attribution = { commit: '', pr: '' };
161
+ if (!target.attribution || typeof target.attribution !== 'object' || Array.isArray(target.attribution)) {
162
+ target.attribution = { commit: '', pr: '' };
165
163
  changed = true;
166
164
  } else {
167
- if (template.attribution.commit !== '' || template.attribution.pr !== '') {
168
- template.attribution.commit = '';
169
- template.attribution.pr = '';
165
+ if (target.attribution.commit !== '' || target.attribution.pr !== '') {
166
+ target.attribution.commit = '';
167
+ target.attribution.pr = '';
170
168
  changed = true;
171
169
  }
172
170
  }
173
171
 
174
172
  // 兼容旧版本:确保 includeCoAuthoredBy: false
175
- if (template.includeCoAuthoredBy !== false) {
176
- template.includeCoAuthoredBy = false;
173
+ if (target.includeCoAuthoredBy !== false) {
174
+ target.includeCoAuthoredBy = false;
177
175
  changed = true;
178
176
  }
179
177
 
@@ -185,14 +183,26 @@ export function ensureClaudeSettingsExtras() {
185
183
  padding: 0
186
184
  };
187
185
 
188
- if (!template.statusLine ||
189
- template.statusLine.type !== 'command' ||
190
- template.statusLine.command !== expectedCommand ||
191
- template.statusLine.padding !== 0) {
192
- template.statusLine = expectedStatusLine;
186
+ if (!target.statusLine ||
187
+ target.statusLine.type !== 'command' ||
188
+ target.statusLine.command !== expectedCommand ||
189
+ target.statusLine.padding !== 0) {
190
+ target.statusLine = expectedStatusLine;
193
191
  changed = true;
194
192
  }
195
193
 
194
+ return changed;
195
+ }
196
+
197
+ // 确保主配置包含 attribution/includeCoAuthoredBy 和 statusLine 设置
198
+ export function ensureClaudeSettingsExtras() {
199
+ const template = getClaudeSettingsTemplate();
200
+ if (!template) {
201
+ return null;
202
+ }
203
+
204
+ const changed = applyClaudeSettingsExtras(template);
205
+
196
206
  if (changed) {
197
207
  fs.writeFileSync(CLAUDE_SETTINGS_PATH, stringifyClaudeSettings(template));
198
208
  }
@@ -225,6 +235,7 @@ export function createProfileFromTemplate(name, apiUrl, apiKey) {
225
235
  // 先确保主配置包含必要 env 设置(也会写回 ~/.claude/settings.json)
226
236
  const ensuredTemplate = ensureRequiredClaudeEnvSettings();
227
237
  const template = ensuredTemplate || getClaudeSettingsTemplate() || {};
238
+ applyClaudeSettingsExtras(template);
228
239
 
229
240
  // 确保 env 对象存在
230
241
  if (!template.env) {
@@ -251,6 +262,7 @@ export function syncProfileWithTemplate(name) {
251
262
  if (!template) {
252
263
  return null;
253
264
  }
265
+ applyClaudeSettingsExtras(template);
254
266
 
255
267
  const currentProfile = readProfile(name);
256
268
  if (!currentProfile) {
@@ -272,6 +284,7 @@ export function syncProfileWithTemplate(name) {
272
284
  newProfile.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = '1';
273
285
  newProfile.env.CLAUDE_CODE_ATTRIBUTION_HEADER = '0';
274
286
  newProfile.env.DISABLE_INSTALLATION_CHECKS = '1';
287
+ applyClaudeSettingsExtras(newProfile);
275
288
 
276
289
  saveProfile(name, newProfile);
277
290
  return newProfile;