ccjk 2.0.20 → 2.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 (71) hide show
  1. package/README.md +601 -35
  2. package/README.zh-CN.md +651 -0
  3. package/dist/chunks/api.mjs +100 -0
  4. package/dist/chunks/auto-updater.mjs +252 -0
  5. package/dist/chunks/ccjk-config.mjs +261 -0
  6. package/dist/chunks/ccr.mjs +77 -0
  7. package/dist/chunks/ccu.mjs +36 -0
  8. package/dist/chunks/check-updates.mjs +93 -0
  9. package/dist/chunks/claude-code-config-manager.mjs +28 -21
  10. package/dist/chunks/claude-code-incremental-manager.mjs +26 -18
  11. package/dist/chunks/claude-config.mjs +228 -0
  12. package/dist/chunks/codex.mjs +2134 -0
  13. package/dist/chunks/commands.mjs +2 -15
  14. package/dist/chunks/commit.mjs +119 -0
  15. package/dist/chunks/config-consolidator.mjs +281 -0
  16. package/dist/chunks/config-switch.mjs +302 -0
  17. package/dist/chunks/constants.mjs +156 -0
  18. package/dist/chunks/doctor.mjs +708 -0
  19. package/dist/chunks/features.mjs +35 -640
  20. package/dist/chunks/features2.mjs +661 -0
  21. package/dist/chunks/fs-operations.mjs +180 -0
  22. package/dist/chunks/index.mjs +3082 -0
  23. package/dist/chunks/index2.mjs +145 -0
  24. package/dist/chunks/init.mjs +2468 -0
  25. package/dist/chunks/interview.mjs +2916 -0
  26. package/dist/chunks/json-config.mjs +59 -0
  27. package/dist/chunks/marketplace.mjs +258 -0
  28. package/dist/chunks/mcp-doctor.mjs +160 -0
  29. package/dist/chunks/mcp-market.mjs +475 -0
  30. package/dist/chunks/mcp-performance.mjs +110 -0
  31. package/dist/chunks/mcp-profile.mjs +220 -0
  32. package/dist/chunks/mcp-release.mjs +138 -0
  33. package/dist/chunks/menu.mjs +3599 -0
  34. package/dist/chunks/notification.mjs +2336 -0
  35. package/dist/chunks/onboarding.mjs +711 -0
  36. package/dist/chunks/package.mjs +4 -0
  37. package/dist/chunks/permission-manager.mjs +210 -0
  38. package/dist/chunks/platform.mjs +321 -0
  39. package/dist/chunks/prompts.mjs +228 -0
  40. package/dist/chunks/session.mjs +355 -0
  41. package/dist/chunks/shencha.mjs +320 -0
  42. package/dist/chunks/skills-sync.mjs +4 -13
  43. package/dist/chunks/team.mjs +51 -0
  44. package/dist/chunks/tools.mjs +169 -0
  45. package/dist/chunks/uninstall.mjs +784 -0
  46. package/dist/chunks/update.mjs +104 -0
  47. package/dist/chunks/upgrade-manager.mjs +197 -0
  48. package/dist/chunks/workflows.mjs +100 -0
  49. package/dist/cli.mjs +581 -15348
  50. package/dist/i18n/locales/zh-CN/cli.json +1 -1
  51. package/dist/i18n/locales/zh-CN/common.json +1 -1
  52. package/dist/index.mjs +43 -2062
  53. package/dist/shared/ccjk.-FoZ3zat.mjs +761 -0
  54. package/dist/shared/ccjk.B7169qud.mjs +25 -0
  55. package/dist/shared/ccjk.BhKlRJ0h.mjs +114 -0
  56. package/dist/shared/ccjk.Bi-m3LKY.mjs +357 -0
  57. package/dist/shared/ccjk.COdsoe-Y.mjs +64 -0
  58. package/dist/shared/ccjk.CUdzQluX.mjs +46 -0
  59. package/dist/shared/ccjk.Cy-RH2qV.mjs +506 -0
  60. package/dist/shared/ccjk.DGjQxTq_.mjs +34 -0
  61. package/dist/shared/ccjk.DJM5aVQJ.mjs +586 -0
  62. package/dist/shared/ccjk.DhBeLRzf.mjs +28 -0
  63. package/dist/shared/ccjk.DwDtZ5cK.mjs +266 -0
  64. package/dist/shared/ccjk.n_AtlHzB.mjs +186 -0
  65. package/dist/shared/ccjk.qYAnUMuy.mjs +749 -0
  66. package/package.json +29 -25
  67. package/dist/chunks/codex-config-switch.mjs +0 -429
  68. package/dist/chunks/codex-provider-manager.mjs +0 -234
  69. package/dist/chunks/codex-uninstaller.mjs +0 -406
  70. package/dist/chunks/plugin-recommendation.mjs +0 -575
  71. package/dist/chunks/simple-config.mjs +0 -10950
@@ -0,0 +1,180 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { writeFileSync, renameSync, existsSync, unlinkSync, readFileSync, mkdirSync, copyFileSync, readdirSync, statSync } from 'node:fs';
3
+ import { mkdir, writeFile as writeFile$1, rename, unlink } from 'node:fs/promises';
4
+ import { dirname, join } from 'pathe';
5
+
6
+ class FileSystemError extends Error {
7
+ constructor(message, path, cause) {
8
+ super(message);
9
+ this.path = path;
10
+ this.cause = cause;
11
+ this.name = "FileSystemError";
12
+ }
13
+ }
14
+ function exists(path) {
15
+ return existsSync(path);
16
+ }
17
+ function ensureDir(path) {
18
+ if (!existsSync(path)) {
19
+ mkdirSync(path, { recursive: true });
20
+ }
21
+ }
22
+ function ensureFileDir(filePath) {
23
+ const dir = dirname(filePath);
24
+ ensureDir(dir);
25
+ }
26
+ function readFile(path, encoding = "utf-8") {
27
+ try {
28
+ return readFileSync(path, encoding);
29
+ } catch (error) {
30
+ throw new FileSystemError(
31
+ `Failed to read file: ${path}`,
32
+ path,
33
+ error
34
+ );
35
+ }
36
+ }
37
+ function writeFile(path, content, encoding = "utf-8") {
38
+ try {
39
+ ensureFileDir(path);
40
+ writeFileSync(path, content, encoding);
41
+ } catch (error) {
42
+ throw new FileSystemError(
43
+ `Failed to write file: ${path}`,
44
+ path,
45
+ error
46
+ );
47
+ }
48
+ }
49
+ function writeFileAtomic(path, content, options = "utf-8") {
50
+ const dir = dirname(path);
51
+ ensureDir(dir);
52
+ const opts = typeof options === "string" ? { encoding: options } : options;
53
+ const encoding = opts.encoding ?? "utf-8";
54
+ const tempFileName = `.tmp_${randomBytes(8).toString("hex")}_${Date.now()}`;
55
+ const tempPath = join(dir, tempFileName);
56
+ try {
57
+ writeFileSync(tempPath, content, { encoding, mode: opts.mode });
58
+ renameSync(tempPath, path);
59
+ } catch (error) {
60
+ try {
61
+ if (existsSync(tempPath)) {
62
+ unlinkSync(tempPath);
63
+ }
64
+ } catch {
65
+ }
66
+ throw new FileSystemError(
67
+ `Failed to write file atomically: ${path}`,
68
+ path,
69
+ error
70
+ );
71
+ }
72
+ }
73
+ async function writeFileAtomicAsync(path, content, options = "utf-8") {
74
+ const dir = dirname(path);
75
+ await mkdir(dir, { recursive: true });
76
+ const opts = typeof options === "string" ? { encoding: options } : options;
77
+ const encoding = opts.encoding ?? "utf-8";
78
+ const tempFileName = `.tmp_${randomBytes(8).toString("hex")}_${Date.now()}`;
79
+ const tempPath = join(dir, tempFileName);
80
+ try {
81
+ await writeFile$1(tempPath, content, { encoding, mode: opts.mode });
82
+ await rename(tempPath, path);
83
+ } catch (error) {
84
+ try {
85
+ if (existsSync(tempPath)) {
86
+ await unlink(tempPath);
87
+ }
88
+ } catch {
89
+ }
90
+ throw new FileSystemError(
91
+ `Failed to write file atomically: ${path}`,
92
+ path,
93
+ error
94
+ );
95
+ }
96
+ }
97
+ function readJsonFile(path) {
98
+ try {
99
+ const content = readFile(path, "utf-8");
100
+ return JSON.parse(content);
101
+ } catch (error) {
102
+ throw new FileSystemError(
103
+ `Failed to read JSON file: ${path}`,
104
+ path,
105
+ error
106
+ );
107
+ }
108
+ }
109
+ function copyFile(src, dest) {
110
+ try {
111
+ ensureFileDir(dest);
112
+ copyFileSync(src, dest);
113
+ } catch (error) {
114
+ throw new FileSystemError(
115
+ `Failed to copy file from ${src} to ${dest}`,
116
+ src,
117
+ error
118
+ );
119
+ }
120
+ }
121
+ function readDir(path) {
122
+ try {
123
+ return readdirSync(path);
124
+ } catch (error) {
125
+ throw new FileSystemError(
126
+ `Failed to read directory: ${path}`,
127
+ path,
128
+ error
129
+ );
130
+ }
131
+ }
132
+ function getStatsSafe(path) {
133
+ try {
134
+ return statSync(path);
135
+ } catch {
136
+ return null;
137
+ }
138
+ }
139
+ function removeFile(path) {
140
+ try {
141
+ if (exists(path)) {
142
+ unlinkSync(path);
143
+ }
144
+ } catch (error) {
145
+ throw new FileSystemError(
146
+ `Failed to remove file: ${path}`,
147
+ path,
148
+ error
149
+ );
150
+ }
151
+ }
152
+ function copyDir(src, dest, options = {}) {
153
+ const { filter, overwrite = true } = options;
154
+ if (!exists(src)) {
155
+ throw new FileSystemError(`Source directory does not exist: ${src}`, src);
156
+ }
157
+ ensureDir(dest);
158
+ const entries = readDir(src);
159
+ for (const entry of entries) {
160
+ const srcPath = `${src}/${entry}`;
161
+ const destPath = `${dest}/${entry}`;
162
+ const stats = getStatsSafe(srcPath);
163
+ if (!stats) {
164
+ continue;
165
+ }
166
+ if (filter && !filter(srcPath, stats)) {
167
+ continue;
168
+ }
169
+ if (stats.isDirectory()) {
170
+ copyDir(srcPath, destPath, options);
171
+ } else {
172
+ if (!overwrite && exists(destPath)) {
173
+ continue;
174
+ }
175
+ copyFile(srcPath, destPath);
176
+ }
177
+ }
178
+ }
179
+
180
+ export { FileSystemError, copyDir, copyFile, ensureDir, ensureFileDir, exists, getStatsSafe, readDir, readFile, readJsonFile, removeFile, writeFile, writeFileAtomic, writeFileAtomicAsync };