ccjk 9.10.2 → 9.12.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.
- package/dist/chunks/agent-teams.mjs +137 -0
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/migrator.mjs +179 -0
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/quick-provider.mjs +2 -0
- package/dist/cli.mjs +23 -0
- package/package.json +1 -1
- package/templates/claude-code/common/settings.json +7 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import ansis from 'ansis';
|
|
3
|
+
import { SETTINGS_FILE } from './constants.mjs';
|
|
4
|
+
import { ensureI18nInitialized, i18n } from './index.mjs';
|
|
5
|
+
import { writeJsonConfig } from './json-config.mjs';
|
|
6
|
+
import 'node:os';
|
|
7
|
+
import 'pathe';
|
|
8
|
+
import 'node:process';
|
|
9
|
+
import 'node:url';
|
|
10
|
+
import 'i18next';
|
|
11
|
+
import 'i18next-fs-backend';
|
|
12
|
+
import 'dayjs';
|
|
13
|
+
import './fs-operations.mjs';
|
|
14
|
+
import 'node:crypto';
|
|
15
|
+
import 'node:fs/promises';
|
|
16
|
+
|
|
17
|
+
const ENV_KEY = "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS";
|
|
18
|
+
function readSettings() {
|
|
19
|
+
if (!existsSync(SETTINGS_FILE)) return {};
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
|
|
22
|
+
} catch {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function isAgentTeamsEnabled() {
|
|
27
|
+
const settings = readSettings();
|
|
28
|
+
return settings?.env?.[ENV_KEY] === "1";
|
|
29
|
+
}
|
|
30
|
+
function setAgentTeams(enabled) {
|
|
31
|
+
const settings = readSettings();
|
|
32
|
+
if (!settings.env) settings.env = {};
|
|
33
|
+
if (enabled) {
|
|
34
|
+
settings.env[ENV_KEY] = "1";
|
|
35
|
+
} else {
|
|
36
|
+
delete settings.env[ENV_KEY];
|
|
37
|
+
}
|
|
38
|
+
writeJsonConfig(SETTINGS_FILE, settings);
|
|
39
|
+
}
|
|
40
|
+
function getTeammateMode() {
|
|
41
|
+
const settings = readSettings();
|
|
42
|
+
return settings?.teammateMode || "auto";
|
|
43
|
+
}
|
|
44
|
+
function setTeammateMode(mode) {
|
|
45
|
+
const settings = readSettings();
|
|
46
|
+
settings.teammateMode = mode;
|
|
47
|
+
writeJsonConfig(SETTINGS_FILE, settings);
|
|
48
|
+
}
|
|
49
|
+
async function agentTeamsCommand(options) {
|
|
50
|
+
ensureI18nInitialized();
|
|
51
|
+
const isZh = i18n.language === "zh-CN";
|
|
52
|
+
if (options.status) {
|
|
53
|
+
printStatus(isZh);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (options.on !== void 0 || options.off !== void 0) {
|
|
57
|
+
const enable = options.on === true;
|
|
58
|
+
setAgentTeams(enable);
|
|
59
|
+
const label = enable ? isZh ? "\u2705 Agent Teams \u5DF2\u542F\u7528" : "\u2705 Agent Teams enabled" : isZh ? "\u2B1C Agent Teams \u5DF2\u7981\u7528" : "\u2B1C Agent Teams disabled";
|
|
60
|
+
console.log(ansis.green(label));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (options.mode) {
|
|
64
|
+
const valid = ["auto", "in-process", "tmux"];
|
|
65
|
+
if (!valid.includes(options.mode)) {
|
|
66
|
+
console.log(ansis.red(`Invalid mode. Use: ${valid.join(", ")}`));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setTeammateMode(options.mode);
|
|
70
|
+
console.log(ansis.green(`Teammate mode set to: ${options.mode}`));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const current = isAgentTeamsEnabled();
|
|
74
|
+
const { default: inquirer } = await import('inquirer');
|
|
75
|
+
const { action } = await inquirer.prompt([{
|
|
76
|
+
type: "list",
|
|
77
|
+
name: "action",
|
|
78
|
+
message: isZh ? "Agent Teams \u8BBE\u7F6E" : "Agent Teams Settings",
|
|
79
|
+
choices: [
|
|
80
|
+
{
|
|
81
|
+
name: current ? isZh ? "\u{1F534} \u5173\u95ED Agent Teams" : "\u{1F534} Disable Agent Teams" : isZh ? "\u{1F7E2} \u542F\u7528 Agent Teams" : "\u{1F7E2} Enable Agent Teams",
|
|
82
|
+
value: "toggle"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: isZh ? "\u{1F5A5}\uFE0F \u8BBE\u7F6E Teammate \u663E\u793A\u6A21\u5F0F" : "\u{1F5A5}\uFE0F Set teammate display mode",
|
|
86
|
+
value: "mode"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: isZh ? "\u{1F4CA} \u67E5\u770B\u72B6\u6001" : "\u{1F4CA} View status",
|
|
90
|
+
value: "status"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: isZh ? "\u21A9\uFE0F \u8FD4\u56DE" : "\u21A9\uFE0F Back",
|
|
94
|
+
value: "back"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}]);
|
|
98
|
+
if (action === "toggle") {
|
|
99
|
+
setAgentTeams(!current);
|
|
100
|
+
const label = !current ? isZh ? "\u2705 Agent Teams \u5DF2\u542F\u7528" : "\u2705 Agent Teams enabled" : isZh ? "\u2B1C Agent Teams \u5DF2\u7981\u7528" : "\u2B1C Agent Teams disabled";
|
|
101
|
+
console.log(ansis.green(label));
|
|
102
|
+
} else if (action === "mode") {
|
|
103
|
+
const currentMode = getTeammateMode();
|
|
104
|
+
const { mode } = await inquirer.prompt([{
|
|
105
|
+
type: "list",
|
|
106
|
+
name: "mode",
|
|
107
|
+
message: isZh ? "\u9009\u62E9 Teammate \u663E\u793A\u6A21\u5F0F" : "Select teammate display mode",
|
|
108
|
+
choices: [
|
|
109
|
+
{ name: `auto ${currentMode === "auto" ? "(current)" : ""}`, value: "auto" },
|
|
110
|
+
{ name: `in-process ${currentMode === "in-process" ? "(current)" : ""}`, value: "in-process" },
|
|
111
|
+
{ name: `tmux ${currentMode === "tmux" ? "(current)" : ""}`, value: "tmux" }
|
|
112
|
+
]
|
|
113
|
+
}]);
|
|
114
|
+
setTeammateMode(mode);
|
|
115
|
+
console.log(ansis.green(`Teammate mode: ${mode}`));
|
|
116
|
+
} else if (action === "status") {
|
|
117
|
+
printStatus(isZh);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function printStatus(isZh) {
|
|
121
|
+
const enabled = isAgentTeamsEnabled();
|
|
122
|
+
const mode = getTeammateMode();
|
|
123
|
+
console.log();
|
|
124
|
+
console.log(ansis.bold(isZh ? "\u{1F916} Agent Teams \u72B6\u6001" : "\u{1F916} Agent Teams Status"));
|
|
125
|
+
console.log(ansis.gray("\u2500".repeat(40)));
|
|
126
|
+
console.log(` ${isZh ? "\u72B6\u6001" : "Status"}: ${enabled ? ansis.green("\u2705 Enabled") : ansis.dim("\u2B1C Disabled")}`);
|
|
127
|
+
console.log(` ${isZh ? "\u6A21\u5F0F" : "Mode"}: ${ansis.cyan(mode)}`);
|
|
128
|
+
console.log();
|
|
129
|
+
if (!enabled) {
|
|
130
|
+
console.log(ansis.dim(isZh ? " \u542F\u7528: ccjk agent-teams --on" : " Enable: ccjk agent-teams --on"));
|
|
131
|
+
} else {
|
|
132
|
+
console.log(ansis.dim(isZh ? ' \u4F7F\u7528: \u5728 Claude Code \u4E2D\u8BF4 "Create an agent team to..."' : ' Usage: Tell Claude "Create an agent team to..."'));
|
|
133
|
+
}
|
|
134
|
+
console.log();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { agentTeamsCommand, getTeammateMode, isAgentTeamsEnabled, setAgentTeams, setTeammateMode };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
|
-
import {
|
|
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 };
|
package/dist/chunks/package.mjs
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -715,6 +715,24 @@ const COMMANDS = [
|
|
|
715
715
|
}
|
|
716
716
|
},
|
|
717
717
|
// ==================== Thinking Mode Commands ====================
|
|
718
|
+
{
|
|
719
|
+
name: "agent-teams",
|
|
720
|
+
description: "Toggle Claude Code Agent Teams (experimental)",
|
|
721
|
+
aliases: ["teams"],
|
|
722
|
+
tier: "extended",
|
|
723
|
+
options: [
|
|
724
|
+
{ flags: "--on", description: "Enable Agent Teams" },
|
|
725
|
+
{ flags: "--off", description: "Disable Agent Teams" },
|
|
726
|
+
{ flags: "--status", description: "Show current status" },
|
|
727
|
+
{ flags: "--mode <mode>", description: "Set teammate mode (auto/in-process/tmux)" }
|
|
728
|
+
],
|
|
729
|
+
loader: async () => {
|
|
730
|
+
const { agentTeamsCommand } = await import('./chunks/agent-teams.mjs');
|
|
731
|
+
return async (options) => {
|
|
732
|
+
await agentTeamsCommand(options);
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
},
|
|
718
736
|
{
|
|
719
737
|
name: "thinking [action] [...args]",
|
|
720
738
|
description: "Thinking Mode (Opus 4.5+ extended reasoning)",
|
|
@@ -1621,6 +1639,11 @@ function customizeHelpLazy(_sections, version) {
|
|
|
1621
1639
|
async function runLazyCli() {
|
|
1622
1640
|
const spinner = await showStartupSpinner();
|
|
1623
1641
|
try {
|
|
1642
|
+
try {
|
|
1643
|
+
const { runMigration } = await import('./chunks/migrator.mjs');
|
|
1644
|
+
runMigration();
|
|
1645
|
+
} catch {
|
|
1646
|
+
}
|
|
1624
1647
|
bootstrapCloudServices();
|
|
1625
1648
|
const handled = await tryQuickProviderLaunch();
|
|
1626
1649
|
if (handled) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccjk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.12.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": "
|
|
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":
|
|
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
|
|