ccjk 14.1.11 → 14.2.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/config.mjs +17 -2
- package/dist/chunks/doctor.mjs +171 -2
- package/dist/chunks/index10.mjs +18 -4
- package/dist/chunks/mcp-cli.mjs +1 -1
- package/dist/chunks/package.mjs +1 -1
- package/dist/cli.mjs +0 -0
- package/dist/templates/agents/README.md +78 -0
- package/dist/templates/common/error-prevention.md +267 -0
- package/dist/templates/common/karpathy-baseline.md +83 -0
- package/dist/templates/common/output-styles/zh-CN/carmack-mode.md +381 -0
- package/dist/templates/common/output-styles/zh-CN/dhh-mode.md +265 -0
- package/dist/templates/common/output-styles/zh-CN/evan-you-mode.md +539 -0
- package/dist/templates/common/output-styles/zh-CN/jobs-mode.md +369 -0
- package/dist/templates/common/output-styles/zh-CN/linus-mode.md +135 -0
- package/dist/templates/common/output-styles/zh-CN/uncle-bob-mode.md +221 -0
- package/dist/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +628 -0
- package/dist/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +628 -0
- package/dist/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +187 -0
- package/dist/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +191 -0
- package/dist/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +249 -0
- package/dist/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +277 -0
- package/dist/templates/common/workflow/essential/en/agents/get-current-datetime.md +29 -0
- package/dist/templates/common/workflow/essential/en/agents/init-architect.md +115 -0
- package/dist/templates/common/workflow/essential/en/agents/ui-ux-designer.md +91 -0
- package/dist/templates/common/workflow/essential/en/feat.md +92 -0
- package/dist/templates/common/workflow/essential/en/goal.md +147 -0
- package/dist/templates/common/workflow/essential/en/init-project.md +53 -0
- package/dist/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +29 -0
- package/dist/templates/common/workflow/essential/zh-CN/agents/init-architect.md +115 -0
- package/dist/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +91 -0
- package/dist/templates/common/workflow/essential/zh-CN/feat.md +315 -0
- package/dist/templates/common/workflow/essential/zh-CN/goal.md +146 -0
- package/dist/templates/common/workflow/essential/zh-CN/init-project.md +53 -0
- package/dist/templates/common/workflow/git/en/git-cleanBranches.md +102 -0
- package/dist/templates/common/workflow/git/en/git-commit.md +205 -0
- package/dist/templates/common/workflow/git/en/git-rollback.md +90 -0
- package/dist/templates/common/workflow/git/en/git-worktree.md +276 -0
- package/dist/templates/common/workflow/git/zh-CN/git-cleanBranches.md +102 -0
- package/dist/templates/common/workflow/git/zh-CN/git-commit.md +205 -0
- package/dist/templates/common/workflow/git/zh-CN/git-rollback.md +90 -0
- package/dist/templates/common/workflow/git/zh-CN/git-worktree.md +276 -0
- package/dist/templates/common/workflow/interview/en/interview.md +67 -0
- package/dist/templates/common/workflow/interview/zh-CN/interview.md +67 -0
- package/dist/templates/common/workflow/linearMethod/en/linear-method.md +651 -0
- package/dist/templates/common/workflow/linearMethod/zh-CN/linear-method.md +752 -0
- package/dist/templates/common/workflow/refactoringMaster/en/refactoring-master.md +516 -0
- package/dist/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +812 -0
- package/dist/templates/common/workflow/sixStep/en/workflow.md +83 -0
- package/dist/templates/common/workflow/sixStep/zh-CN/workflow.md +359 -0
- package/dist/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +364 -0
- package/dist/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +366 -0
- package/dist/templates/hooks/README.md +212 -0
- package/dist/templates/hooks/git-workflow-hooks.md +551 -0
- package/dist/templates/hooks/post-test-coverage.md +434 -0
- package/dist/templates/hooks/pre-commit-black.md +274 -0
- package/dist/templates/hooks/pre-commit-eslint.md +153 -0
- package/dist/templates/hooks/pre-commit-gofmt.md +284 -0
- package/dist/templates/hooks/pre-commit-prettier.md +212 -0
- package/dist/templates/hooks/pre-commit-type-check.md +377 -0
- package/dist/templates/skills/ccjk-init.md +154 -0
- package/dist/templates/skills/ccjk-mcp-setup.md +205 -0
- package/dist/templates/skills/ccjk-troubleshoot.md +228 -0
- package/dist/templates/skills/django-patterns.md +1016 -0
- package/dist/templates/skills/git-workflow.md +748 -0
- package/dist/templates/skills/go-idioms.md +963 -0
- package/dist/templates/skills/nextjs-optimization.md +694 -0
- package/dist/templates/skills/python-pep8.md +852 -0
- package/dist/templates/skills/react-patterns.md +686 -0
- package/dist/templates/skills/rust-patterns.md +1057 -0
- package/dist/templates/skills/security-best-practices.md +1413 -0
- package/dist/templates/skills/testing-best-practices.md +1315 -0
- package/dist/templates/skills/ts-best-practices.md +354 -0
- package/package.json +40 -43
- package/templates/common/karpathy-baseline.md +83 -0
- package/templates/common/output-styles/zh-CN/carmack-mode.md +14 -0
- package/templates/common/output-styles/zh-CN/dhh-mode.md +14 -0
- package/templates/common/output-styles/zh-CN/evan-you-mode.md +14 -0
- package/templates/common/output-styles/zh-CN/jobs-mode.md +14 -0
- package/templates/common/output-styles/zh-CN/linus-mode.md +14 -0
- package/templates/common/output-styles/zh-CN/uncle-bob-mode.md +14 -0
- package/templates/common/workflow/linearMethod/zh-CN/linear-method.md +2 -0
- package/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +2 -0
- package/templates/common/workflow/sixStep/zh-CN/workflow.md +2 -0
- package/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +2 -0
package/dist/chunks/config.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import a from './index5.mjs';
|
|
3
3
|
import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
|
|
4
4
|
import { i as inquirer } from './index6.mjs';
|
|
5
|
+
import { chmodSync, readFileSync } from 'node:fs';
|
|
5
6
|
import { ZCF_CONFIG_FILE, ZCF_CONFIG_DIR, CLAUDE_VSC_CONFIG_FILE, CLAVUE_CONFIG_FILE, CLAVUE_CREDENTIALS_FILE, CLAVUE_SETTINGS_FILE, AI_OUTPUT_LANGUAGES, SETTINGS_FILE } from './constants.mjs';
|
|
6
7
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
7
|
-
import { chmodSync } from 'node:fs';
|
|
8
8
|
import { execSync } from 'node:child_process';
|
|
9
9
|
import process__default from 'node:process';
|
|
10
10
|
import { readDefaultTomlConfig, createDefaultTomlConfig, writeTomlConfig } from './ccjk-config.mjs';
|
|
@@ -2421,8 +2421,23 @@ function applyAiLanguageDirective(aiOutputLang, codeTool) {
|
|
|
2421
2421
|
} else {
|
|
2422
2422
|
directive = `Always respond in ${aiOutputLang}`;
|
|
2423
2423
|
}
|
|
2424
|
+
let baseline = "";
|
|
2425
|
+
try {
|
|
2426
|
+
const currentFilePath = fileURLToPath(import.meta.url);
|
|
2427
|
+
const distDir = dirname(dirname(currentFilePath));
|
|
2428
|
+
const rootDir = dirname(distDir);
|
|
2429
|
+
const baselinePath = join(rootDir, "templates", "common", "karpathy-baseline.md");
|
|
2430
|
+
if (exists(baselinePath)) {
|
|
2431
|
+
baseline = readFileSync(baselinePath, "utf-8").trim();
|
|
2432
|
+
}
|
|
2433
|
+
} catch {
|
|
2434
|
+
}
|
|
2424
2435
|
const frontmatter = target.codeTool === "clavue" ? "" : "---\nscope: user\n---\n\n";
|
|
2425
|
-
|
|
2436
|
+
const body = baseline ? `${directive}
|
|
2437
|
+
|
|
2438
|
+
${baseline}
|
|
2439
|
+
` : directive;
|
|
2440
|
+
writeFileAtomic(instructionsFile, `${frontmatter}${body}`);
|
|
2426
2441
|
}
|
|
2427
2442
|
function switchToOfficialLogin(codeTool) {
|
|
2428
2443
|
try {
|
package/dist/chunks/doctor.mjs
CHANGED
|
@@ -622,6 +622,26 @@ async function checkSettings(codeType) {
|
|
|
622
622
|
if (settings.plansDirectory === null) {
|
|
623
623
|
issues.push("plansDirectory should not be null");
|
|
624
624
|
}
|
|
625
|
+
const env = settings.env || {};
|
|
626
|
+
const hasAnthropicModelVars = Boolean(
|
|
627
|
+
env.ANTHROPIC_MODEL || env.ANTHROPIC_DEFAULT_OPUS_MODEL || env.ANTHROPIC_DEFAULT_SONNET_MODEL || env.ANTHROPIC_DEFAULT_HAIKU_MODEL
|
|
628
|
+
);
|
|
629
|
+
if (settings.model && hasAnthropicModelVars) {
|
|
630
|
+
issues.push(`settings.model="${settings.model}" overrides ANTHROPIC_* env vars (custom model selection broken)`);
|
|
631
|
+
}
|
|
632
|
+
const sonnet = env.ANTHROPIC_DEFAULT_SONNET_MODEL;
|
|
633
|
+
if (typeof sonnet === "string" && /opus/i.test(sonnet)) {
|
|
634
|
+
issues.push(`ANTHROPIC_DEFAULT_SONNET_MODEL="${sonnet}" looks like an Opus model (slot misrouted)`);
|
|
635
|
+
}
|
|
636
|
+
const preToolUse = settings.hooks?.PreToolUse;
|
|
637
|
+
if (Array.isArray(preToolUse)) {
|
|
638
|
+
const hasGatekeeper = preToolUse.some(
|
|
639
|
+
(h) => h?.matcher === "mcp__.*" && Array.isArray(h?.hooks) && h.hooks.some((c) => typeof c?.command === "string" && c.command.includes("mcp-gatekeeper"))
|
|
640
|
+
);
|
|
641
|
+
if (hasGatekeeper) {
|
|
642
|
+
issues.push("mcp-gatekeeper PreToolUse hook is enabled (forks bash+node per MCP call; disabled by default)");
|
|
643
|
+
}
|
|
644
|
+
}
|
|
625
645
|
if (issues.length > 0) {
|
|
626
646
|
return {
|
|
627
647
|
name: "settings.json",
|
|
@@ -717,6 +737,50 @@ async function checkCcr() {
|
|
|
717
737
|
fix: "Run: npx ccjk zero-config dev"
|
|
718
738
|
};
|
|
719
739
|
}
|
|
740
|
+
async function checkDisciplineBaseline(codeType) {
|
|
741
|
+
const target = resolveClaudeFamilySettingsTarget(codeType);
|
|
742
|
+
const memoryFile = target.instructionsFile;
|
|
743
|
+
if (!existsSync(memoryFile)) {
|
|
744
|
+
return {
|
|
745
|
+
name: "Discipline Baseline",
|
|
746
|
+
status: "warning",
|
|
747
|
+
message: "No memory file found",
|
|
748
|
+
fix: "Run: npx ccjk init"
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
const { readFileSync } = await import('node:fs');
|
|
752
|
+
const text = readFileSync(memoryFile, "utf-8");
|
|
753
|
+
const required = [
|
|
754
|
+
"# Coding Discipline Baseline",
|
|
755
|
+
"Think before coding",
|
|
756
|
+
"Simplicity first",
|
|
757
|
+
"Surgical changes",
|
|
758
|
+
"Goal-driven execution"
|
|
759
|
+
];
|
|
760
|
+
const missing = required.filter((m) => !text.includes(m));
|
|
761
|
+
if (missing.length === 0) {
|
|
762
|
+
return {
|
|
763
|
+
name: "Discipline Baseline",
|
|
764
|
+
status: "ok",
|
|
765
|
+
message: "All 4 principles present"
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
if (missing.length === required.length) {
|
|
769
|
+
return {
|
|
770
|
+
name: "Discipline Baseline",
|
|
771
|
+
status: "warning",
|
|
772
|
+
message: "Baseline not installed (memory file exists but has no discipline section)",
|
|
773
|
+
fix: "Run: npx ccjk init"
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
return {
|
|
777
|
+
name: "Discipline Baseline",
|
|
778
|
+
status: "error",
|
|
779
|
+
message: `Baseline partially missing: ${missing.length}/${required.length} markers absent`,
|
|
780
|
+
fix: "Run: npx ccjk init (will rewrite CLAUDE.md with full baseline)",
|
|
781
|
+
details: missing
|
|
782
|
+
};
|
|
783
|
+
}
|
|
720
784
|
async function checkOutputStyles(codeType) {
|
|
721
785
|
const target = resolveClaudeFamilySettingsTarget(codeType);
|
|
722
786
|
const stylesDir = join(target.configDir, "output-styles");
|
|
@@ -794,6 +858,62 @@ async function checkCodexToml() {
|
|
|
794
858
|
message: "Valid configuration"
|
|
795
859
|
};
|
|
796
860
|
}
|
|
861
|
+
async function checkCodexFieldValues() {
|
|
862
|
+
if (!existsSync(CODEX_CONFIG_FILE)) {
|
|
863
|
+
return { name: "Codex Field Values", status: "ok", message: "Skipped (no config)" };
|
|
864
|
+
}
|
|
865
|
+
const { readFileSync } = await import('node:fs');
|
|
866
|
+
const text = readFileSync(CODEX_CONFIG_FILE, "utf-8");
|
|
867
|
+
const issues = [];
|
|
868
|
+
const validEffort = /* @__PURE__ */ new Set(["minimal", "low", "medium", "high"]);
|
|
869
|
+
const validTier = /* @__PURE__ */ new Set(["default", "flex", "priority"]);
|
|
870
|
+
const effortMatch = text.match(/^model_reasoning_effort\s*=\s*"([^"]+)"/m);
|
|
871
|
+
if (effortMatch && !validEffort.has(effortMatch[1])) {
|
|
872
|
+
issues.push(`model_reasoning_effort="${effortMatch[1]}" (valid: ${[...validEffort].join("/")})`);
|
|
873
|
+
}
|
|
874
|
+
const tierMatch = text.match(/^service_tier\s*=\s*"([^"]+)"/m);
|
|
875
|
+
if (tierMatch && !validTier.has(tierMatch[1])) {
|
|
876
|
+
issues.push(`service_tier="${tierMatch[1]}" (valid: ${[...validTier].join("/")})`);
|
|
877
|
+
}
|
|
878
|
+
if (issues.length === 0) {
|
|
879
|
+
return { name: "Codex Field Values", status: "ok", message: "All fields valid" };
|
|
880
|
+
}
|
|
881
|
+
return {
|
|
882
|
+
name: "Codex Field Values",
|
|
883
|
+
status: "warning",
|
|
884
|
+
message: `${issues.length} non-standard value(s) \u2014 Codex silently uses defaults`,
|
|
885
|
+
fix: "Edit ~/.codex/config.toml",
|
|
886
|
+
details: issues
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
async function checkCodexTrustedProjects() {
|
|
890
|
+
if (!existsSync(CODEX_CONFIG_FILE)) {
|
|
891
|
+
return { name: "Codex Trusted Projects", status: "ok", message: "Skipped (no config)" };
|
|
892
|
+
}
|
|
893
|
+
const { readFileSync } = await import('node:fs');
|
|
894
|
+
const text = readFileSync(CODEX_CONFIG_FILE, "utf-8");
|
|
895
|
+
const trusted = [];
|
|
896
|
+
const re = /\[projects\."([^"]+)"\]/g;
|
|
897
|
+
let m;
|
|
898
|
+
while ((m = re.exec(text)) !== null) {
|
|
899
|
+
trusted.push(m[1]);
|
|
900
|
+
}
|
|
901
|
+
const stale = trusted.filter((p) => !existsSync(p));
|
|
902
|
+
if (stale.length === 0) {
|
|
903
|
+
return {
|
|
904
|
+
name: "Codex Trusted Projects",
|
|
905
|
+
status: "ok",
|
|
906
|
+
message: `${trusted.length} entries, all paths exist`
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
return {
|
|
910
|
+
name: "Codex Trusted Projects",
|
|
911
|
+
status: "warning",
|
|
912
|
+
message: `${stale.length} of ${trusted.length} trusted paths no longer exist on disk`,
|
|
913
|
+
fix: "Edit ~/.codex/config.toml to remove dead entries",
|
|
914
|
+
details: stale.slice(0, 10)
|
|
915
|
+
};
|
|
916
|
+
}
|
|
797
917
|
async function checkCodexMcp() {
|
|
798
918
|
const config = readCodexConfig();
|
|
799
919
|
const count = config?.mcpServices.length || 0;
|
|
@@ -843,6 +963,50 @@ async function checkClavueNativeGoals() {
|
|
|
843
963
|
fix: "Run: npm install -g clavue"
|
|
844
964
|
};
|
|
845
965
|
}
|
|
966
|
+
async function checkCcjkProfiles() {
|
|
967
|
+
const { homedir } = await import('node:os');
|
|
968
|
+
const ccjkConfigPath = join(homedir(), ".ccjk", "config.toml");
|
|
969
|
+
if (!existsSync(ccjkConfigPath)) {
|
|
970
|
+
return { name: "CCJK Profiles", status: "ok", message: "Skipped (no config)" };
|
|
971
|
+
}
|
|
972
|
+
const { readFileSync } = await import('node:fs');
|
|
973
|
+
const text = readFileSync(ccjkConfigPath, "utf-8");
|
|
974
|
+
const suspicious = [];
|
|
975
|
+
const sectionRe = /^\[claudeCode\.profiles\.([^\]]+)\]$([\s\S]*?)(?=^\[|\z)/gm;
|
|
976
|
+
let m;
|
|
977
|
+
while ((m = sectionRe.exec(text)) !== null) {
|
|
978
|
+
const name = m[1];
|
|
979
|
+
const body = m[2];
|
|
980
|
+
const apiKey = body.match(/apiKey\s*=\s*"([^"]*)"/)?.[1] ?? "";
|
|
981
|
+
const baseUrl = body.match(/baseUrl\s*=\s*"([^"]*)"/)?.[1] ?? "";
|
|
982
|
+
const reasons = [];
|
|
983
|
+
if (/^\d+$/.test(name)) {
|
|
984
|
+
reasons.push("numeric-only name");
|
|
985
|
+
}
|
|
986
|
+
if (apiKey && apiKey.length < 10) {
|
|
987
|
+
reasons.push(`apiKey too short (${apiKey.length} chars)`);
|
|
988
|
+
}
|
|
989
|
+
if (baseUrl && !/^https?:\/\/[^\s/]+\.[^\s/]/.test(baseUrl)) {
|
|
990
|
+
reasons.push(`baseUrl looks invalid: ${baseUrl}`);
|
|
991
|
+
}
|
|
992
|
+
if (apiKey.startsWith("sk-ant-test-") || /test-?\d+/i.test(apiKey)) {
|
|
993
|
+
reasons.push("apiKey looks like a test placeholder");
|
|
994
|
+
}
|
|
995
|
+
if (reasons.length > 0) {
|
|
996
|
+
suspicious.push(`${name}: ${reasons.join("; ")}`);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
if (suspicious.length === 0) {
|
|
1000
|
+
return { name: "CCJK Profiles", status: "ok", message: "No junk profiles detected" };
|
|
1001
|
+
}
|
|
1002
|
+
return {
|
|
1003
|
+
name: "CCJK Profiles",
|
|
1004
|
+
status: "warning",
|
|
1005
|
+
message: `${suspicious.length} suspicious profile(s) in ~/.ccjk/config.toml`,
|
|
1006
|
+
fix: "Use ccjk menu to remove or rename them",
|
|
1007
|
+
details: suspicious
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
846
1010
|
async function checkCodexProviders() {
|
|
847
1011
|
const config = readCodexConfig();
|
|
848
1012
|
if (!config) {
|
|
@@ -1017,18 +1181,23 @@ async function doctor(options = {}) {
|
|
|
1017
1181
|
checkCodexCli,
|
|
1018
1182
|
checkCodexDir,
|
|
1019
1183
|
checkCodexToml,
|
|
1184
|
+
checkCodexFieldValues,
|
|
1185
|
+
checkCodexTrustedProjects,
|
|
1020
1186
|
checkCodexMcp,
|
|
1021
|
-
checkCodexNativeGoals
|
|
1187
|
+
checkCodexNativeGoals,
|
|
1188
|
+
checkCcjkProfiles
|
|
1022
1189
|
] : [
|
|
1023
1190
|
() => checkClaudeCode(options.codeType),
|
|
1024
1191
|
() => checkClaudeDir(options.codeType),
|
|
1025
1192
|
() => checkSettings(options.codeType),
|
|
1193
|
+
() => checkDisciplineBaseline(options.codeType),
|
|
1026
1194
|
() => checkWorkflows(options.codeType),
|
|
1027
1195
|
() => checkMcp(options.codeType),
|
|
1028
1196
|
() => checkPermissionRules(options.codeType),
|
|
1029
1197
|
checkCcr,
|
|
1030
1198
|
() => checkOutputStyles(options.codeType),
|
|
1031
|
-
...options.codeType === "clavue" ? [checkClavueNativeGoals] : []
|
|
1199
|
+
...options.codeType === "clavue" ? [checkClavueNativeGoals] : [],
|
|
1200
|
+
checkCcjkProfiles
|
|
1032
1201
|
];
|
|
1033
1202
|
if (options.checkProviders) {
|
|
1034
1203
|
checks.push(options.codeType === "codex" ? checkCodexProviders : () => checkProviders(options.codeType));
|
package/dist/chunks/index10.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { i as inquirer } from './index6.mjs';
|
|
|
3
3
|
import { CLOUD_ENDPOINTS, CCJK_CONFIG_DIR, SUPPORTED_LANGS, LANG_LABELS, CODE_TOOL_BANNERS, isCodeToolType, DEFAULT_CODE_TOOL_TYPE } from './constants.mjs';
|
|
4
4
|
import { ensureI18nInitialized, i18n, resolveSupportedLanguage, changeLanguage } from './index2.mjs';
|
|
5
5
|
import { displayBannerWithInfo } from './banner.mjs';
|
|
6
|
-
import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
|
|
6
|
+
import { readZcfConfig, updateZcfConfig, readDefaultTomlConfig } from './ccjk-config.mjs';
|
|
7
7
|
import { L as buildMyclaudeProviderPresentation } from './config.mjs';
|
|
8
8
|
import { b as runCodexUpdate, j as runCodexUninstall, k as configureCodexAiMemoryFeature, m as configureCodexDefaultModelFeature, n as configureCodexMcp, o as configureCodexApi, p as configureCodexPresetFeature, q as runCodexWorkflowImportWithLanguageSelection, i as runCodexFullInit } from './codex.mjs';
|
|
9
9
|
import { S as STARTUP_CODE_TOOL_CHOICES, a as resolveStartupCodeType } from './code-type-resolver.mjs';
|
|
@@ -4462,8 +4462,8 @@ function getMenuShellConfig(codeTool) {
|
|
|
4462
4462
|
return {
|
|
4463
4463
|
allowMore: true,
|
|
4464
4464
|
footerCommands: [],
|
|
4465
|
-
menuTitle:
|
|
4466
|
-
showHero:
|
|
4465
|
+
menuTitle: getToolModeMenuTitle(codeTool),
|
|
4466
|
+
showHero: true
|
|
4467
4467
|
};
|
|
4468
4468
|
}
|
|
4469
4469
|
async function showProgressiveMenu(codeTool, runtimeSyncResult) {
|
|
@@ -4482,6 +4482,10 @@ async function showProgressiveMenu(codeTool, runtimeSyncResult) {
|
|
|
4482
4482
|
}
|
|
4483
4483
|
];
|
|
4484
4484
|
const allowedCommands2 = ["0", "q", "m", "s"];
|
|
4485
|
+
const tomlCfg = readDefaultTomlConfig();
|
|
4486
|
+
const profile = tomlCfg?.claudeCode?.currentProfile;
|
|
4487
|
+
console.log(renderToolModeHero(codeTool, 76, profile ? { profileLabel: profile } : void 0));
|
|
4488
|
+
console.log("");
|
|
4485
4489
|
const menuOutput2 = renderMenu(
|
|
4486
4490
|
"menu:oneClick.title",
|
|
4487
4491
|
visibleItems2,
|
|
@@ -4556,7 +4560,17 @@ async function showProgressiveMenu(codeTool, runtimeSyncResult) {
|
|
|
4556
4560
|
const menuShell = getMenuShellConfig(codeTool);
|
|
4557
4561
|
const allowedCommands = ["0", "q", ...menuShell.allowMore ? ["m"] : [], ...menuShell.footerCommands.map((command) => command.key)];
|
|
4558
4562
|
if (menuShell.showHero) {
|
|
4559
|
-
|
|
4563
|
+
let runtimeSummary;
|
|
4564
|
+
if (codeTool === "clavue") {
|
|
4565
|
+
runtimeSummary = buildMyclaudeRuntimeSummary(runtimeSyncResult);
|
|
4566
|
+
} else {
|
|
4567
|
+
const tomlCfg = readDefaultTomlConfig();
|
|
4568
|
+
const profile = tomlCfg?.claudeCode?.currentProfile;
|
|
4569
|
+
if (profile) {
|
|
4570
|
+
runtimeSummary = { profileLabel: profile };
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4573
|
+
console.log(renderToolModeHero(codeTool, 76, runtimeSummary));
|
|
4560
4574
|
console.log("");
|
|
4561
4575
|
}
|
|
4562
4576
|
const menuOutput = renderMenu(
|
package/dist/chunks/mcp-cli.mjs
CHANGED
|
@@ -21,9 +21,9 @@ import 'node:os';
|
|
|
21
21
|
import 'node:crypto';
|
|
22
22
|
import 'buffer';
|
|
23
23
|
import 'string_decoder';
|
|
24
|
+
import 'node:fs';
|
|
24
25
|
import './constants.mjs';
|
|
25
26
|
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
26
|
-
import 'node:fs';
|
|
27
27
|
import 'node:child_process';
|
|
28
28
|
import './ccjk-config.mjs';
|
|
29
29
|
import '../shared/ccjk.BBtCGd_g.mjs';
|
package/dist/chunks/package.mjs
CHANGED
package/dist/cli.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Agent Templates
|
|
2
|
+
|
|
3
|
+
This directory contains agent definition templates for CCJK v8.0.0's multi-agent orchestration system.
|
|
4
|
+
|
|
5
|
+
## Available Agents
|
|
6
|
+
|
|
7
|
+
| Agent ID | Name | Model | Category | Complexity |
|
|
8
|
+
|----------|------|-------|----------|------------|
|
|
9
|
+
| `typescript-architect` | TypeScript Architect | sonnet | development | advanced |
|
|
10
|
+
| `react-specialist` | React Specialist | sonnet | development | intermediate-advanced |
|
|
11
|
+
| `python-expert` | Python Expert | sonnet | development | intermediate-advanced |
|
|
12
|
+
| `go-expert` | Go Expert | sonnet | development | intermediate-advanced |
|
|
13
|
+
| `fullstack-developer` | Full-Stack Developer | sonnet | development | intermediate-advanced |
|
|
14
|
+
| `testing-automation-expert` | Testing Automation Expert | opus | quality-assurance | advanced |
|
|
15
|
+
|
|
16
|
+
## Agent Template Structure
|
|
17
|
+
|
|
18
|
+
Each agent template follows this JSON structure:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"id": "unique-agent-id",
|
|
23
|
+
"name": {
|
|
24
|
+
"en": "English Name",
|
|
25
|
+
"zh-CN": "中文名称"
|
|
26
|
+
},
|
|
27
|
+
"description": {
|
|
28
|
+
"en": "English description",
|
|
29
|
+
"zh-CN": "中文描述"
|
|
30
|
+
},
|
|
31
|
+
"persona": "Detailed persona description (100+ words)",
|
|
32
|
+
"capabilities": ["list", "of", "capabilities"],
|
|
33
|
+
"skills": ["skill-id-1", "skill-id-2"],
|
|
34
|
+
"mcpServers": ["mcp-server-1", "mcp-server-2"],
|
|
35
|
+
"systemPrompt": "System prompt for the agent",
|
|
36
|
+
"instructions": [
|
|
37
|
+
"Specific instruction 1",
|
|
38
|
+
"Specific instruction 2"
|
|
39
|
+
],
|
|
40
|
+
"triggers": [
|
|
41
|
+
"condition that triggers this agent",
|
|
42
|
+
"another trigger condition"
|
|
43
|
+
],
|
|
44
|
+
"model": "sonnet|opus|haiku",
|
|
45
|
+
"metadata": {
|
|
46
|
+
"version": "1.0.0",
|
|
47
|
+
"author": "ccjk-team",
|
|
48
|
+
"category": "development|quality-assurance|devops",
|
|
49
|
+
"tags": ["tag1", "tag2"],
|
|
50
|
+
"complexity": "beginner|intermediate|advanced",
|
|
51
|
+
"experience_level": "beginner|intermediate|senior"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
These templates are used by CCJK's agent orchestration system to:
|
|
59
|
+
|
|
60
|
+
1. **Agent Selection**: Choose the most appropriate agent based on user queries and triggers
|
|
61
|
+
2. **Context Setup**: Configure the agent with proper persona, skills, and MCP servers
|
|
62
|
+
3. **Instruction Following**: Provide specific guidelines for each agent's behavior
|
|
63
|
+
4. **Model Assignment**: Use the optimal Claude model for each agent's complexity
|
|
64
|
+
|
|
65
|
+
## Model Selection Strategy
|
|
66
|
+
|
|
67
|
+
- **Opus**: Complex reasoning tasks, advanced architecture decisions
|
|
68
|
+
- **Sonnet**: Balanced performance for most development tasks
|
|
69
|
+
- **Haiku**: Fast responses for simple operations and templates
|
|
70
|
+
|
|
71
|
+
## Extending the System
|
|
72
|
+
|
|
73
|
+
To add new agents:
|
|
74
|
+
|
|
75
|
+
1. Create a new JSON file following the template structure
|
|
76
|
+
2. Define clear triggers and capabilities
|
|
77
|
+
3. Choose appropriate MCP servers for the agent's domain
|
|
78
|
+
4. Update this README with the new agent information
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# CCJK Error Prevention System
|
|
2
|
+
|
|
3
|
+
**IMPORTANT**: This project uses the CCJK Error Prevention System to automatically prevent and fix common Claude Code CLI errors.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🛡️ Automatic Error Prevention
|
|
8
|
+
|
|
9
|
+
All file operations and commands are automatically protected by CCJK's intelligent error prevention system.
|
|
10
|
+
|
|
11
|
+
### What It Does
|
|
12
|
+
|
|
13
|
+
The Error Prevention System operates in 5 layers:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
17
|
+
│ CCJK Error Prevention System │
|
|
18
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
19
|
+
│ │
|
|
20
|
+
│ Layer 1: Pre-Execution Validation │
|
|
21
|
+
│ ├─ Parameter format validation │
|
|
22
|
+
│ ├─ Path validity checks │
|
|
23
|
+
│ ├─ Permission verification │
|
|
24
|
+
│ └─ Command existence validation │
|
|
25
|
+
│ │
|
|
26
|
+
│ Layer 2: Intelligent Wrappers │
|
|
27
|
+
│ ├─ Smart Write: Handles existing files automatically │
|
|
28
|
+
│ ├─ Smart Bash: Validates and retries commands │
|
|
29
|
+
│ ├─ Smart Path: Resolves cross-platform paths │
|
|
30
|
+
│ └─ Smart Edit: Detects content changes before editing │
|
|
31
|
+
│ │
|
|
32
|
+
│ Layer 3: Auto-Recovery │
|
|
33
|
+
│ ├─ Retry with exponential backoff │
|
|
34
|
+
│ ├─ Automatic error correction │
|
|
35
|
+
│ ├─ Rollback support │
|
|
36
|
+
│ └─ Fallback mechanisms │
|
|
37
|
+
│ │
|
|
38
|
+
│ Layer 4: Real-time Monitoring │
|
|
39
|
+
│ ├─ Error detection and classification │
|
|
40
|
+
│ ├─ Pattern analysis │
|
|
41
|
+
│ └─ Alert system │
|
|
42
|
+
│ │
|
|
43
|
+
│ Layer 5: Learning System │
|
|
44
|
+
│ ├─ Error history tracking │
|
|
45
|
+
│ └─ Solution database │
|
|
46
|
+
│ │
|
|
47
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📋 Errors That Are Automatically Prevented
|
|
53
|
+
|
|
54
|
+
### 1. Error Writing File
|
|
55
|
+
|
|
56
|
+
**Causes**: File already exists, permission denied, path errors
|
|
57
|
+
|
|
58
|
+
**CCJK Auto-Fix**:
|
|
59
|
+
- ✅ Checks if file exists before writing
|
|
60
|
+
- ✅ Automatically backs up existing files
|
|
61
|
+
- ✅ Uses Edit instead of Write when file exists
|
|
62
|
+
- ✅ Creates missing directories automatically
|
|
63
|
+
- ✅ Retries on transient failures
|
|
64
|
+
|
|
65
|
+
### 2. Invalid Tool Parameters
|
|
66
|
+
|
|
67
|
+
**Causes**: Wrong parameter format, missing required parameters, type mismatch
|
|
68
|
+
|
|
69
|
+
**CCJK Auto-Fix**:
|
|
70
|
+
- ✅ Validates parameter format before execution
|
|
71
|
+
- ✅ Checks for unclosed quotes
|
|
72
|
+
- ✅ Validates file paths
|
|
73
|
+
- ✅ Provides specific error messages
|
|
74
|
+
|
|
75
|
+
### 3. Bash Command Failures (Exit Code 1)
|
|
76
|
+
|
|
77
|
+
**Causes**: Command not found, syntax errors, missing environment variables
|
|
78
|
+
|
|
79
|
+
**CCJK Auto-Fix**:
|
|
80
|
+
- ✅ Validates command exists before execution
|
|
81
|
+
- ✅ Checks parameter format
|
|
82
|
+
- ✅ Sets up environment automatically
|
|
83
|
+
- ✅ Retries on failures with exponential backoff
|
|
84
|
+
- ✅ Suggests alternative commands
|
|
85
|
+
|
|
86
|
+
### 4. Path Resolution Issues
|
|
87
|
+
|
|
88
|
+
**Causes**: Relative path errors, symlinks, cross-platform differences
|
|
89
|
+
|
|
90
|
+
**CCJK Auto-Fix**:
|
|
91
|
+
- ✅ Handles ~ (home directory)
|
|
92
|
+
- ✅ Expands environment variables
|
|
93
|
+
- ✅ Resolves symlinks
|
|
94
|
+
- ✅ Cross-platform path normalization
|
|
95
|
+
- ✅ Provides path fix suggestions
|
|
96
|
+
|
|
97
|
+
### 5. Permission Denied Errors
|
|
98
|
+
|
|
99
|
+
**Causes**: File permissions, directory permissions, read-only filesystem
|
|
100
|
+
|
|
101
|
+
**CCJK Auto-Fix**:
|
|
102
|
+
- ✅ Checks permissions before operations
|
|
103
|
+
- ✅ Attempts to fix script permissions (chmod +x)
|
|
104
|
+
- ✅ Provides specific permission error messages
|
|
105
|
+
- ✅ Suggests appropriate fixes
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🚀 Best Practices
|
|
110
|
+
|
|
111
|
+
### When Writing Files
|
|
112
|
+
|
|
113
|
+
**❌ Don't worry about**:
|
|
114
|
+
- File already existing → CCJK handles it
|
|
115
|
+
- Creating directories → CCJK does it automatically
|
|
116
|
+
- Backing up files → CCJK backs up automatically
|
|
117
|
+
- Content validation → CCJK checks before writing
|
|
118
|
+
|
|
119
|
+
**✅ Just write**:
|
|
120
|
+
- CCJK will detect if file exists
|
|
121
|
+
- CCJK will use Edit tool if appropriate
|
|
122
|
+
- CCJK will create directories if needed
|
|
123
|
+
- CCJK will retry if write fails
|
|
124
|
+
|
|
125
|
+
### When Running Commands
|
|
126
|
+
|
|
127
|
+
**❌ Don't worry about**:
|
|
128
|
+
- Command not existing → CCJK checks first
|
|
129
|
+
- Parameter format → CCJK validates
|
|
130
|
+
- Environment setup → CCJK sets up automatically
|
|
131
|
+
- Command failing → CCJK retries with auto-fix
|
|
132
|
+
|
|
133
|
+
**✅ Just run**:
|
|
134
|
+
- CCJK will validate command exists
|
|
135
|
+
- CCJK will check parameters
|
|
136
|
+
- CCJK will handle dangerous command warnings
|
|
137
|
+
- CCJK will retry on failures
|
|
138
|
+
|
|
139
|
+
### When Reading Files
|
|
140
|
+
|
|
141
|
+
**❌ Don't worry about**:
|
|
142
|
+
- Path resolution → CCJK resolves paths
|
|
143
|
+
- File not found → CCJK provides clear error
|
|
144
|
+
- Permission issues → CCJK checks permissions
|
|
145
|
+
|
|
146
|
+
**✅ Just read**:
|
|
147
|
+
- CCJK will resolve relative paths
|
|
148
|
+
- CCJK will handle symlinks
|
|
149
|
+
- CCJK will provide helpful error messages
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 💡 Error Recovery Flow
|
|
154
|
+
|
|
155
|
+
When an error occurs, CCJK follows this process:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
1. Detect → Classify error type
|
|
159
|
+
2. Analyze → Determine if retryable
|
|
160
|
+
3. Auto-fix → Apply automatic correction if possible
|
|
161
|
+
4. Retry → Retry with exponential backoff
|
|
162
|
+
5. Fallback → Suggest alternative approach
|
|
163
|
+
6. Report → Provide detailed error and suggestion
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🔧 Debugging
|
|
169
|
+
|
|
170
|
+
### Enable Debug Logging
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Enable error prevention debug output
|
|
174
|
+
export CCJK_ERROR_PREVENTION_DEBUG=1
|
|
175
|
+
|
|
176
|
+
# Or enable all CCJK debug output
|
|
177
|
+
export CCJK_DEBUG=1
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### View Error Statistics
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import { getMiddleware } from 'ccjk/error-prevention'
|
|
184
|
+
|
|
185
|
+
const middleware = getMiddleware()
|
|
186
|
+
const errorStats = middleware.getErrorStats()
|
|
187
|
+
const fixStats = middleware.getFixStats()
|
|
188
|
+
|
|
189
|
+
console.log('Error Stats:', errorStats)
|
|
190
|
+
console.log('Fix Stats:', fixStats)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 📊 Expected Impact
|
|
196
|
+
|
|
197
|
+
| Error Type | Before CCJK | After CCJK | Reduction |
|
|
198
|
+
|------------|-------------|------------|-----------|
|
|
199
|
+
| Error writing file | ⭐⭐⭐⭐⭐ | ⭐ | **80%** |
|
|
200
|
+
| Invalid tool parameters | ⭐⭐⭐⭐ | ⭐ | **75%** |
|
|
201
|
+
| Bash command failures | ⭐⭐⭐⭐ | ⭐ | **70%** |
|
|
202
|
+
| Path resolution issues | ⭐⭐⭐ | ⭐ | **85%** |
|
|
203
|
+
| Permission denied | ⭐⭐⭐ | ⭐ | **90%** |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 🎯 Tips
|
|
208
|
+
|
|
209
|
+
1. **Trust CCJK's automatic handling** - Let the system prevent errors
|
|
210
|
+
2. **Check console for CCJK messages** - Look for `[CCJK ErrorPrevention]` prefix
|
|
211
|
+
3. **Review suggestions when errors occur** - CCJK provides specific fix suggestions
|
|
212
|
+
4. **Report persistent errors** - Help improve the system
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 📖 API Reference
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import {
|
|
220
|
+
getMiddleware,
|
|
221
|
+
SmartWriteTool,
|
|
222
|
+
SmartBashTool,
|
|
223
|
+
SmartPathResolver,
|
|
224
|
+
} from 'ccjk/error-prevention'
|
|
225
|
+
|
|
226
|
+
// Use middleware (recommended)
|
|
227
|
+
const middleware = getMiddleware()
|
|
228
|
+
|
|
229
|
+
// Write files
|
|
230
|
+
const writeResult = await middleware.interceptWrite(path, content)
|
|
231
|
+
|
|
232
|
+
// Execute commands
|
|
233
|
+
const bashResult = await middleware.interceptBash(command, options)
|
|
234
|
+
|
|
235
|
+
// Read files
|
|
236
|
+
const readResult = await middleware.interceptRead(path)
|
|
237
|
+
|
|
238
|
+
// Edit files
|
|
239
|
+
const editResult = await middleware.interceptEdit(path, oldString, newString)
|
|
240
|
+
|
|
241
|
+
// Get path info
|
|
242
|
+
const pathInfo = await middleware.getPathInfo(path)
|
|
243
|
+
|
|
244
|
+
// Get statistics
|
|
245
|
+
const errors = middleware.getErrorStats()
|
|
246
|
+
const fixes = middleware.getFixStats()
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🎉 Summary
|
|
252
|
+
|
|
253
|
+
**Before CCJK Error Prevention**:
|
|
254
|
+
- ❌ Frequent errors
|
|
255
|
+
- ❌ Manual debugging
|
|
256
|
+
- ❌ Time wasted
|
|
257
|
+
- ❌ Frustration
|
|
258
|
+
|
|
259
|
+
**After CCJK Error Prevention**:
|
|
260
|
+
- ✅ Automatic prevention
|
|
261
|
+
- ✅ Intelligent fixes
|
|
262
|
+
- ✅ Efficient development
|
|
263
|
+
- ✅ Peace of mind
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
**Let CCJK handle the errors, focus on your code! 🚀**
|