ccjk 8.1.3 → 8.1.5
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/ccjk-agents.mjs +22 -12
- package/dist/chunks/config2.mjs +12 -4
- package/dist/chunks/doctor.mjs +93 -11
- package/dist/chunks/package.mjs +1 -1
- package/dist/cli.mjs +4 -2
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import consola from 'consola';
|
|
2
2
|
import process__default, { cwd } from 'node:process';
|
|
3
3
|
import { P as ProjectAnalyzer } from '../shared/ccjk.CsujU3aC.mjs';
|
|
4
|
-
import { join } from 'pathe';
|
|
4
|
+
import { join, dirname } from 'pathe';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
5
6
|
import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
6
7
|
import { homedir } from 'node:os';
|
|
7
8
|
import { c as createCloudClient } from '../shared/ccjk.DR7dAWAm.mjs';
|
|
@@ -13,27 +14,27 @@ import 'url';
|
|
|
13
14
|
import 'module';
|
|
14
15
|
import 'smol-toml';
|
|
15
16
|
import 'ofetch';
|
|
16
|
-
import 'node:url';
|
|
17
17
|
import 'i18next';
|
|
18
18
|
import 'i18next-fs-backend';
|
|
19
19
|
|
|
20
20
|
async function getCloudRecommendations(analysis) {
|
|
21
21
|
try {
|
|
22
22
|
const client = createCloudClient();
|
|
23
|
-
const response = await client.
|
|
23
|
+
const response = await client.analyzeProject({
|
|
24
|
+
projectRoot: analysis.projectRoot || process.cwd(),
|
|
24
25
|
projectType: analysis.projectType,
|
|
25
26
|
frameworks: analysis.frameworks.map((f) => f.name),
|
|
26
27
|
languages: analysis.languages.map((l) => l.language),
|
|
27
28
|
dependencies: analysis.dependencies?.direct.map((d) => d.name) || []
|
|
28
29
|
});
|
|
29
|
-
return response.recommendations.map((rec) => ({
|
|
30
|
-
name: rec.name,
|
|
31
|
-
description: rec.description,
|
|
30
|
+
return (response.recommendations || []).map((rec) => ({
|
|
31
|
+
name: rec.name || rec.id || "Unknown Agent",
|
|
32
|
+
description: rec.description || "No description available",
|
|
32
33
|
skills: rec.skills || [],
|
|
33
34
|
mcpServers: rec.mcpServers || [],
|
|
34
35
|
persona: rec.persona,
|
|
35
36
|
capabilities: rec.capabilities || [],
|
|
36
|
-
confidence: rec.confidence || 0.8,
|
|
37
|
+
confidence: rec.confidence || rec.relevanceScore || 0.8,
|
|
37
38
|
reason: rec.reason || "Recommended by CCJK Cloud"
|
|
38
39
|
}));
|
|
39
40
|
} catch (error) {
|
|
@@ -42,18 +43,27 @@ async function getCloudRecommendations(analysis) {
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const
|
|
46
|
+
const _dirname = dirname(fileURLToPath(import.meta.url));
|
|
47
|
+
const AGENT_TEMPLATES_DIR = join(_dirname, "..", "templates", "agents");
|
|
48
|
+
const AGENT_TEMPLATES_DIR_FALLBACK = join(process.cwd(), "templates", "agents");
|
|
49
|
+
function getAgentTemplatesDir() {
|
|
50
|
+
if (existsSync(AGENT_TEMPLATES_DIR)) {
|
|
51
|
+
return AGENT_TEMPLATES_DIR;
|
|
52
|
+
}
|
|
53
|
+
return AGENT_TEMPLATES_DIR_FALLBACK;
|
|
54
|
+
}
|
|
46
55
|
async function loadAgentTemplates() {
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
const templatesDir = getAgentTemplatesDir();
|
|
57
|
+
if (!existsSync(templatesDir)) {
|
|
58
|
+
console.warn("Agent templates directory not found:", templatesDir);
|
|
49
59
|
return [];
|
|
50
60
|
}
|
|
51
61
|
const templates = [];
|
|
52
|
-
const files = readdirSync(
|
|
62
|
+
const files = readdirSync(templatesDir);
|
|
53
63
|
for (const file of files) {
|
|
54
64
|
if (!file.endsWith(".json")) continue;
|
|
55
65
|
try {
|
|
56
|
-
const filePath = join(
|
|
66
|
+
const filePath = join(templatesDir, file);
|
|
57
67
|
const content = readFileSync(filePath, "utf-8");
|
|
58
68
|
const template = JSON.parse(content);
|
|
59
69
|
const recommendation = {
|
package/dist/chunks/config2.mjs
CHANGED
|
@@ -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 =
|
|
204
|
-
|
|
205
|
-
|
|
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(
|
package/dist/chunks/doctor.mjs
CHANGED
|
@@ -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 {
|
|
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(
|
|
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)));
|
package/dist/chunks/package.mjs
CHANGED
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
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccjk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.1.
|
|
4
|
+
"version": "8.1.5",
|
|
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
|
+
}
|