ccjk 12.1.0 → 12.2.1

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.
Files changed (45) hide show
  1. package/dist/chunks/api-cli.mjs +1 -1
  2. package/dist/chunks/auto-memory-bridge.mjs +215 -0
  3. package/dist/chunks/boost.mjs +8 -1
  4. package/dist/chunks/ccjk-mcp.mjs +2 -2
  5. package/dist/chunks/ccr.mjs +2 -3
  6. package/dist/chunks/claude-code-config-manager.mjs +1 -1
  7. package/dist/chunks/claude-code-incremental-manager.mjs +4 -4
  8. package/dist/chunks/claude-config.mjs +2 -2
  9. package/dist/chunks/claude-wrapper.mjs +1 -1
  10. package/dist/chunks/cli-hook.mjs +827 -25
  11. package/dist/chunks/codex-config-switch.mjs +1 -1
  12. package/dist/chunks/codex-provider-manager.mjs +1 -1
  13. package/dist/chunks/codex.mjs +3 -3
  14. package/dist/chunks/config.mjs +2 -2
  15. package/dist/chunks/config2.mjs +1 -1
  16. package/dist/chunks/doctor.mjs +1 -1
  17. package/dist/chunks/index4.mjs +9 -1
  18. package/dist/chunks/index5.mjs +2 -0
  19. package/dist/chunks/init.mjs +5 -5
  20. package/dist/chunks/installer.mjs +1 -1
  21. package/dist/chunks/linux.mjs +9 -9
  22. package/dist/chunks/mcp-cli.mjs +1 -1
  23. package/dist/chunks/mcp.mjs +2 -2
  24. package/dist/chunks/memory.mjs +231 -0
  25. package/dist/chunks/menu-hierarchical.mjs +2 -3
  26. package/dist/chunks/menu.mjs +759 -12
  27. package/dist/chunks/onboarding-wizard.mjs +9 -2
  28. package/dist/chunks/package.mjs +1 -1
  29. package/dist/chunks/platform.mjs +1 -1
  30. package/dist/chunks/quick-actions.mjs +8 -1
  31. package/dist/chunks/quick-provider.mjs +2 -0
  32. package/dist/chunks/quick-setup.mjs +1 -1
  33. package/dist/chunks/status.mjs +8 -1
  34. package/dist/chunks/update.mjs +2 -2
  35. package/dist/cli.mjs +37 -0
  36. package/dist/i18n/locales/en/memory.json +21 -90
  37. package/dist/i18n/locales/en/menu.json +3 -2
  38. package/dist/i18n/locales/zh-CN/memory.json +21 -90
  39. package/dist/i18n/locales/zh-CN/menu.json +3 -2
  40. package/dist/shared/ccjk.CfrpIIKy.mjs +3361 -0
  41. package/dist/shared/{ccjk.Dx-O9dWz.mjs → ccjk.DOBWBkFR.mjs} +1 -1
  42. package/dist/shared/{ccjk.waa2ikKJ.mjs → ccjk.KpFl2RDA.mjs} +3 -3
  43. package/package.json +2 -2
  44. package/dist/chunks/features.mjs +0 -699
  45. package/dist/shared/ccjk.CNMWk_mE.mjs +0 -400
@@ -1,6 +1,6 @@
1
1
  import a from './index2.mjs';
2
2
  import { i18n } from './index5.mjs';
3
- import { f as configureApi, e as getExistingApiConfig } from './config.mjs';
3
+ import { d as configureApi, g as getExistingApiConfig } from './config.mjs';
4
4
  import { g as getAllPresets } from '../shared/ccjk.CL4Yat0G.mjs';
5
5
  import '../shared/ccjk.BAGoDD49.mjs';
6
6
  import 'node:fs';
@@ -0,0 +1,215 @@
1
+ import { stat, writeFile, readdir, readFile } from 'node:fs/promises';
2
+ import { homedir } from 'node:os';
3
+ import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
4
+
5
+ function parseAutoMemory(content) {
6
+ const lines = content.split("\n");
7
+ const entries = [];
8
+ let currentEntry = null;
9
+ for (const line of lines) {
10
+ const headerMatch = line.match(/^(#{1,6})\s+(.+)$/);
11
+ if (headerMatch) {
12
+ if (currentEntry && currentEntry.content.length > 0) {
13
+ entries.push(currentEntry);
14
+ }
15
+ currentEntry = {
16
+ title: headerMatch[2].trim(),
17
+ content: [],
18
+ level: headerMatch[1].length
19
+ };
20
+ } else if (currentEntry && line.trim()) {
21
+ currentEntry.content.push(line);
22
+ }
23
+ }
24
+ if (currentEntry && currentEntry.content.length > 0) {
25
+ entries.push(currentEntry);
26
+ }
27
+ return entries;
28
+ }
29
+ function autoMemoryToBrainContext(entries, projectPath) {
30
+ const context = {
31
+ facts: [],
32
+ patterns: [],
33
+ decisions: [],
34
+ metadata: {
35
+ source: "auto-memory",
36
+ projectPath,
37
+ syncedAt: (/* @__PURE__ */ new Date()).toISOString()
38
+ }
39
+ };
40
+ for (const entry of entries) {
41
+ const contentText = entry.content.join("\n").trim();
42
+ const titleLower = entry.title.toLowerCase();
43
+ if (titleLower.includes("architecture") || titleLower.includes("pattern") || titleLower.includes("design")) {
44
+ context.patterns.push({
45
+ name: entry.title,
46
+ description: contentText,
47
+ category: "architecture"
48
+ });
49
+ } else if (titleLower.includes("decision") || titleLower.includes("choice") || titleLower.includes("why")) {
50
+ context.decisions.push({
51
+ decision: entry.title,
52
+ rationale: contentText,
53
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
54
+ });
55
+ } else {
56
+ context.facts.push({
57
+ key: entry.title,
58
+ value: contentText,
59
+ confidence: 0.9
60
+ });
61
+ }
62
+ }
63
+ return context;
64
+ }
65
+ function brainContextToAutoMemory(context) {
66
+ const lines = [];
67
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
68
+ lines.push("# CCJK Brain Memory");
69
+ lines.push("");
70
+ lines.push(`Last synced: ${timestamp}`);
71
+ lines.push("");
72
+ if (context.facts.length > 0) {
73
+ lines.push("## Key Facts");
74
+ lines.push("");
75
+ for (const fact of context.facts) {
76
+ lines.push(`### ${fact.key}`);
77
+ lines.push(fact.value);
78
+ lines.push("");
79
+ }
80
+ }
81
+ if (context.patterns.length > 0) {
82
+ lines.push("## Patterns & Architecture");
83
+ lines.push("");
84
+ for (const pattern of context.patterns) {
85
+ lines.push(`### ${pattern.name}`);
86
+ lines.push(pattern.description);
87
+ if (pattern.category) {
88
+ lines.push(`Category: ${pattern.category}`);
89
+ }
90
+ lines.push("");
91
+ }
92
+ }
93
+ if (context.decisions.length > 0) {
94
+ lines.push("## Decisions");
95
+ lines.push("");
96
+ for (const decision of context.decisions) {
97
+ lines.push(`### ${decision.decision}`);
98
+ lines.push(decision.rationale);
99
+ if (decision.timestamp) {
100
+ lines.push(`Decided: ${decision.timestamp}`);
101
+ }
102
+ lines.push("");
103
+ }
104
+ }
105
+ return lines.join("\n");
106
+ }
107
+ async function findAutoMemoryFiles(claudeProjectsDir) {
108
+ const baseDir = claudeProjectsDir || join(homedir(), ".claude", "projects");
109
+ const documents = [];
110
+ try {
111
+ const projectDirs = await readdir(baseDir);
112
+ for (const projectDir of projectDirs) {
113
+ const memoryPath = join(baseDir, projectDir, "memory", "MEMORY.md");
114
+ try {
115
+ const content = await readFile(memoryPath, "utf-8");
116
+ const entries = parseAutoMemory(content);
117
+ const projectPath = projectDir.startsWith("-") ? projectDir.slice(1).replace(/-/g, "/") : projectDir;
118
+ documents.push({
119
+ projectPath,
120
+ entries,
121
+ rawContent: content
122
+ });
123
+ } catch (err) {
124
+ continue;
125
+ }
126
+ }
127
+ } catch (err) {
128
+ return [];
129
+ }
130
+ return documents;
131
+ }
132
+ async function syncAutoMemoryToBrain(session, config) {
133
+ const documents = await findAutoMemoryFiles(config?.claudeProjectsDir);
134
+ for (const doc of documents) {
135
+ if (session.metadata?.projectPath === doc.projectPath) {
136
+ const brainContext = autoMemoryToBrainContext(doc.entries, doc.projectPath);
137
+ session.context.facts.push(...brainContext.facts);
138
+ session.context.patterns.push(...brainContext.patterns);
139
+ session.context.decisions.push(...brainContext.decisions);
140
+ session.metadata = {
141
+ ...session.metadata,
142
+ autoMemorySyncedAt: (/* @__PURE__ */ new Date()).toISOString()
143
+ };
144
+ }
145
+ }
146
+ }
147
+ async function syncBrainToAutoMemory(session, config) {
148
+ if (!config?.bidirectional) {
149
+ return;
150
+ }
151
+ const projectPath = session.metadata?.projectPath;
152
+ if (!projectPath) {
153
+ return;
154
+ }
155
+ const baseDir = config.claudeProjectsDir || join(homedir(), ".claude", "projects");
156
+ const projectDirName = "-" + projectPath.replace(/\//g, "-");
157
+ const memoryDir = join(baseDir, projectDirName, "memory");
158
+ const memoryPath = join(memoryDir, "MEMORY.md");
159
+ const content = brainContextToAutoMemory(session.context);
160
+ try {
161
+ await stat(memoryDir);
162
+ } catch {
163
+ return;
164
+ }
165
+ await writeFile(memoryPath, content, "utf-8");
166
+ }
167
+ class AutoMemoryBridge {
168
+ config;
169
+ syncTimer;
170
+ constructor(config) {
171
+ this.config = {
172
+ claudeProjectsDir: config?.claudeProjectsDir || join(homedir(), ".claude", "projects"),
173
+ syncInterval: config?.syncInterval ?? 0,
174
+ bidirectional: config?.bidirectional ?? false
175
+ };
176
+ }
177
+ /**
178
+ * Start periodic sync
179
+ */
180
+ startSync(session) {
181
+ if (this.config.syncInterval <= 0) {
182
+ return;
183
+ }
184
+ this.syncTimer = setInterval(async () => {
185
+ try {
186
+ await syncAutoMemoryToBrain(session, this.config);
187
+ if (this.config.bidirectional) {
188
+ await syncBrainToAutoMemory(session, this.config);
189
+ }
190
+ } catch (err) {
191
+ console.error("Auto-memory sync failed:", err);
192
+ }
193
+ }, this.config.syncInterval);
194
+ }
195
+ /**
196
+ * Stop periodic sync
197
+ */
198
+ stopSync() {
199
+ if (this.syncTimer) {
200
+ clearInterval(this.syncTimer);
201
+ this.syncTimer = void 0;
202
+ }
203
+ }
204
+ /**
205
+ * Perform one-time sync
206
+ */
207
+ async sync(session) {
208
+ await syncAutoMemoryToBrain(session, this.config);
209
+ if (this.config.bidirectional) {
210
+ await syncBrainToAutoMemory(session, this.config);
211
+ }
212
+ }
213
+ }
214
+
215
+ export { AutoMemoryBridge, autoMemoryToBrainContext, brainContextToAutoMemory, findAutoMemoryFiles, parseAutoMemory, syncAutoMemoryToBrain, syncBrainToAutoMemory };
@@ -3,11 +3,18 @@ import { existsSync, readFileSync } from 'node:fs';
3
3
  import process__default from 'node:process';
4
4
  import { SETTINGS_FILE } from './constants.mjs';
5
5
  import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
6
- import { r as runHealthCheck } from '../shared/ccjk.CNMWk_mE.mjs';
6
+ import { r as runHealthCheck } from '../shared/ccjk.CfrpIIKy.mjs';
7
7
  import '../shared/ccjk.BAGoDD49.mjs';
8
8
  import 'node:os';
9
9
  import './index5.mjs';
10
10
  import 'node:url';
11
+ import 'fs';
12
+ import 'constants';
13
+ import 'stream';
14
+ import 'util';
15
+ import 'assert';
16
+ import 'path';
17
+ import 'node:path';
11
18
 
12
19
  function analyzeProject(root) {
13
20
  const cwd = process__default.cwd();
@@ -6,8 +6,8 @@ import { i as inquirer } from './index3.mjs';
6
6
  import { a as analyzeProject } from '../shared/ccjk.DS7UESmF.mjs';
7
7
  import { CLAUDE_DIR } from './constants.mjs';
8
8
  import { ensureI18nInitialized, i18n } from './index5.mjs';
9
- import { b as backupMcpConfig, r as readMcpConfig, m as mergeMcpServers, w as writeMcpConfig } from './claude-config.mjs';
10
- import { h as commandExists } from './platform.mjs';
9
+ import { c as backupMcpConfig, r as readMcpConfig, m as mergeMcpServers, w as writeMcpConfig } from './claude-config.mjs';
10
+ import { e as commandExists } from './platform.mjs';
11
11
  import '../shared/ccjk.BAGoDD49.mjs';
12
12
  import 'node:readline';
13
13
  import 'stream';
@@ -50,10 +50,9 @@ import '../shared/ccjk.BWFpnOr3.mjs';
50
50
  import '../shared/ccjk.Cjj8SVrn.mjs';
51
51
  import './smart-defaults.mjs';
52
52
  import '../shared/ccjk.BrPUmTqm.mjs';
53
- import './features.mjs';
54
53
  import './config2.mjs';
55
54
  import './init.mjs';
56
- import '../shared/ccjk.Dx-O9dWz.mjs';
55
+ import '../shared/ccjk.DOBWBkFR.mjs';
57
56
  import './auto-updater.mjs';
58
57
  import './version-checker.mjs';
59
58
  import './installer.mjs';
@@ -78,7 +77,7 @@ import './uninstall.mjs';
78
77
  import '../shared/ccjk.CvChMYvB.mjs';
79
78
  import 'globby';
80
79
  import './update.mjs';
81
- import '../shared/ccjk.waa2ikKJ.mjs';
80
+ import '../shared/ccjk.KpFl2RDA.mjs';
82
81
 
83
82
  async function ccr(options = {}) {
84
83
  try {
@@ -1,7 +1,7 @@
1
1
  import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
2
2
  import { ZCF_CONFIG_FILE, ZCF_CONFIG_DIR, SETTINGS_FILE } from './constants.mjs';
3
3
  import { readDefaultTomlConfig, createDefaultTomlConfig, writeTomlConfig } from './ccjk-config.mjs';
4
- import { h as clearModelEnv } from './config.mjs';
4
+ import { a as clearModelEnv } from './config.mjs';
5
5
  import { ensureDir, exists, copyFile } from './fs-operations.mjs';
6
6
  import { readJsonConfig } from './json-config.mjs';
7
7
  import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
@@ -4,7 +4,7 @@ import { ensureI18nInitialized, i18n } from './index5.mjs';
4
4
  import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
5
5
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
6
6
  import { p as promptBoolean } from '../shared/ccjk.BWFpnOr3.mjs';
7
- import { v as validateApiKey } from '../shared/ccjk.Dx-O9dWz.mjs';
7
+ import { v as validateApiKey } from '../shared/ccjk.DOBWBkFR.mjs';
8
8
  import '../shared/ccjk.BAGoDD49.mjs';
9
9
  import 'node:readline';
10
10
  import 'stream';
@@ -202,7 +202,7 @@ ${i18n.t("multi-config:addingNewProfile")}`));
202
202
  ]);
203
203
  let modelConfig = null;
204
204
  if (selectedProvider === "custom") {
205
- const { promptCustomModels } = await import('./features.mjs');
205
+ const { promptCustomModels } = await import('./menu.mjs').then(function (n) { return n.f; });
206
206
  modelConfig = await promptCustomModels();
207
207
  }
208
208
  const setAsDefault = await promptBoolean({
@@ -385,7 +385,7 @@ ${i18n.t("multi-config:editingProfile", { name: selectedProfile.name })}`));
385
385
  ]);
386
386
  let modelConfig = null;
387
387
  if (selectedProfile.authType !== "ccr_proxy") {
388
- const { promptCustomModels } = await import('./features.mjs');
388
+ const { promptCustomModels } = await import('./menu.mjs').then(function (n) { return n.f; });
389
389
  modelConfig = await promptCustomModels(
390
390
  selectedProfile.primaryModel,
391
391
  selectedProfile.defaultHaikuModel,
@@ -512,7 +512,7 @@ ${i18n.t("multi-config:copyingProfile", { name: selectedProfile.name })}`));
512
512
  const answers = await inquirer.prompt(questions);
513
513
  let modelConfig = null;
514
514
  if (selectedProfile.authType !== "ccr_proxy") {
515
- const { promptCustomModels } = await import('./features.mjs');
515
+ const { promptCustomModels } = await import('./menu.mjs').then(function (n) { return n.f; });
516
516
  modelConfig = await promptCustomModels(
517
517
  selectedProfile.primaryModel,
518
518
  selectedProfile.defaultHaikuModel,
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { CLAUDE_VSC_CONFIG_FILE, CLAUDE_DIR, ClAUDE_CONFIG_FILE } from './constants.mjs';
3
3
  import { ensureI18nInitialized, i18n } from './index5.mjs';
4
4
  import { readJsonConfig, writeJsonConfig, backupJsonConfig } from './json-config.mjs';
5
- import { i as isWindows, m as getMcpCommand } from './platform.mjs';
5
+ import { k as isWindows, m as getMcpCommand } from './platform.mjs';
6
6
  import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
7
7
 
8
8
  function mergeArraysUnique(arr1, arr2) {
@@ -233,4 +233,4 @@ const claudeConfig = {
233
233
  writeMcpConfig: writeMcpConfig
234
234
  };
235
235
 
236
- export { buildMcpServerConfig as a, backupMcpConfig as b, addCompletedOnboarding as c, deepMerge as d, replaceMcpServers as e, fixWindowsMcpConfig as f, syncMcpPermissions as g, claudeConfig as h, mergeMcpServers as m, readMcpConfig as r, setPrimaryApiKey as s, writeMcpConfig as w };
236
+ export { addCompletedOnboarding as a, buildMcpServerConfig as b, backupMcpConfig as c, deepMerge as d, replaceMcpServers as e, fixWindowsMcpConfig as f, syncMcpPermissions as g, claudeConfig as h, mergeMcpServers as m, readMcpConfig as r, setPrimaryApiKey as s, writeMcpConfig as w };
@@ -1,7 +1,7 @@
1
1
  import process__default from 'node:process';
2
2
  import { exec as q } from './main.mjs';
3
3
  import { i18n, initI18n } from './index5.mjs';
4
- import { k as findRealCommandPath } from './platform.mjs';
4
+ import { j as findRealCommandPath } from './platform.mjs';
5
5
  import 'module';
6
6
  import 'node:child_process';
7
7
  import 'node:path';