ccjk 12.2.2 → 12.3.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 (135) hide show
  1. package/dist/chunks/agent-teams.mjs +3 -3
  2. package/dist/chunks/agent.mjs +2 -2
  3. package/dist/chunks/agents.mjs +4 -5
  4. package/dist/chunks/api-cli.mjs +5 -5
  5. package/dist/chunks/api-providers.mjs +1 -1
  6. package/dist/chunks/api.mjs +4 -4
  7. package/dist/chunks/auto-bootstrap.mjs +1 -1
  8. package/dist/chunks/auto-fixer.mjs +3 -3
  9. package/dist/chunks/auto-init.mjs +3 -3
  10. package/dist/chunks/auto-updater.mjs +9 -9
  11. package/dist/chunks/banner.mjs +2 -2
  12. package/dist/chunks/boost.mjs +4 -4
  13. package/dist/chunks/ccjk-agents.mjs +3 -3
  14. package/dist/chunks/ccjk-all.mjs +6 -6
  15. package/dist/chunks/ccjk-config.mjs +2 -2
  16. package/dist/chunks/ccjk-hooks.mjs +4 -4
  17. package/dist/chunks/ccjk-mcp.mjs +5 -5
  18. package/dist/chunks/ccjk-setup.mjs +5 -5
  19. package/dist/chunks/ccjk-skills.mjs +5 -5
  20. package/dist/chunks/ccr.mjs +14 -14
  21. package/dist/chunks/ccu.mjs +2 -2
  22. package/dist/chunks/check-updates.mjs +6 -6
  23. package/dist/chunks/claude-code-config-manager.mjs +5 -4
  24. package/dist/chunks/claude-code-incremental-manager.mjs +6 -6
  25. package/dist/chunks/claude-config.mjs +1 -1
  26. package/dist/chunks/claude-wrapper.mjs +1 -1
  27. package/dist/chunks/cli-hook.mjs +9 -10
  28. package/dist/chunks/codex-config-switch.mjs +6 -6
  29. package/dist/chunks/codex-provider-manager.mjs +6 -6
  30. package/dist/chunks/codex-uninstaller.mjs +2 -2
  31. package/dist/chunks/codex.mjs +5 -5
  32. package/dist/chunks/commands.mjs +2 -2
  33. package/dist/chunks/commands2.mjs +1 -1
  34. package/dist/chunks/commit.mjs +2 -2
  35. package/dist/chunks/completion.mjs +2 -2
  36. package/dist/chunks/config-consolidator.mjs +2 -2
  37. package/dist/chunks/config-switch.mjs +7 -7
  38. package/dist/chunks/config.mjs +3 -3
  39. package/dist/chunks/config2.mjs +4 -4
  40. package/dist/chunks/config3.mjs +3 -3
  41. package/dist/chunks/constants.mjs +1 -1
  42. package/dist/chunks/context-opt.mjs +442 -0
  43. package/dist/chunks/convoy-manager.mjs +355 -3
  44. package/dist/chunks/dashboard.mjs +2 -2
  45. package/dist/chunks/doctor.mjs +4 -4
  46. package/dist/chunks/evolution.mjs +2 -2
  47. package/dist/chunks/health-alerts.mjs +530 -4
  48. package/dist/chunks/help.mjs +1 -1
  49. package/dist/chunks/index.mjs +0 -23
  50. package/dist/chunks/index10.mjs +571 -634
  51. package/dist/chunks/index11.mjs +569 -1061
  52. package/dist/chunks/index12.mjs +1076 -914
  53. package/dist/chunks/index13.mjs +951 -135
  54. package/dist/chunks/index14.mjs +184 -209
  55. package/dist/chunks/index15.mjs +218 -0
  56. package/dist/chunks/index2.mjs +24 -19
  57. package/dist/chunks/index3.mjs +12 -19085
  58. package/dist/chunks/index4.mjs +19092 -16
  59. package/dist/chunks/index5.mjs +16 -7602
  60. package/dist/chunks/index6.mjs +7590 -159
  61. package/dist/chunks/index7.mjs +171 -1602
  62. package/dist/chunks/index8.mjs +1602 -19
  63. package/dist/chunks/index9.mjs +15 -612
  64. package/dist/chunks/init.mjs +13 -13
  65. package/dist/chunks/installer.mjs +5 -5
  66. package/dist/chunks/installer2.mjs +1 -1
  67. package/dist/chunks/interview.mjs +4 -4
  68. package/dist/chunks/manager.mjs +1 -1
  69. package/dist/chunks/marketplace.mjs +2 -2
  70. package/dist/chunks/mcp-cli.mjs +9 -9
  71. package/dist/chunks/mcp.mjs +7 -7
  72. package/dist/chunks/memory.mjs +3 -3
  73. package/dist/chunks/menu-hierarchical.mjs +14 -14
  74. package/dist/chunks/menu.mjs +12 -12
  75. package/dist/chunks/metrics-display.mjs +1 -1
  76. package/dist/chunks/migrator.mjs +1 -1
  77. package/dist/chunks/monitor.mjs +2 -2
  78. package/dist/chunks/notification.mjs +4 -4
  79. package/dist/chunks/onboarding-wizard.mjs +2 -2
  80. package/dist/chunks/onboarding.mjs +4 -4
  81. package/dist/chunks/package.mjs +1 -1
  82. package/dist/chunks/paradigm.mjs +1 -1
  83. package/dist/chunks/permission-manager.mjs +2 -2
  84. package/dist/chunks/permissions.mjs +3 -3
  85. package/dist/chunks/persistence-manager.mjs +3 -3
  86. package/dist/chunks/plugin.mjs +2 -2
  87. package/dist/chunks/prompts.mjs +5 -5
  88. package/dist/chunks/providers.mjs +2 -2
  89. package/dist/chunks/quick-actions.mjs +2 -2
  90. package/dist/chunks/quick-provider.mjs +6 -5
  91. package/dist/chunks/quick-setup.mjs +10 -10
  92. package/dist/chunks/remote.mjs +5 -5
  93. package/dist/chunks/session.mjs +2 -2
  94. package/dist/chunks/sessions.mjs +1 -1
  95. package/dist/chunks/silent-updater.mjs +1 -1
  96. package/dist/chunks/simple-config.mjs +1 -1
  97. package/dist/chunks/skill2.mjs +3 -3
  98. package/dist/chunks/skills-sync.mjs +4 -4
  99. package/dist/chunks/skills.mjs +3 -3
  100. package/dist/chunks/slash-commands.mjs +3 -3
  101. package/dist/chunks/startup.mjs +1 -1
  102. package/dist/chunks/stats.mjs +2 -2
  103. package/dist/chunks/status.mjs +2 -2
  104. package/dist/chunks/team.mjs +3 -3
  105. package/dist/chunks/thinking.mjs +4 -4
  106. package/dist/chunks/trace.mjs +2 -2
  107. package/dist/chunks/uninstall.mjs +8 -8
  108. package/dist/chunks/update.mjs +9 -9
  109. package/dist/chunks/upgrade-manager.mjs +3 -3
  110. package/dist/chunks/version-checker.mjs +4 -4
  111. package/dist/chunks/vim.mjs +3 -3
  112. package/dist/chunks/workflows.mjs +1 -1
  113. package/dist/chunks/wsl.mjs +1 -1
  114. package/dist/chunks/zero-config.mjs +3 -3
  115. package/dist/cli.mjs +56 -23
  116. package/dist/index.mjs +5 -5
  117. package/dist/shared/{ccjk.CCcQfbni.mjs → ccjk.B1TwPltj.mjs} +1 -1
  118. package/dist/shared/{ccjk.CePkJq2S.mjs → ccjk.BfIpomdz.mjs} +1 -1
  119. package/dist/shared/{ccjk.D8ZLYSZZ.mjs → ccjk.CXzjn01x.mjs} +1 -1
  120. package/dist/shared/{ccjk.Cjj8SVrn.mjs → ccjk.Cot9p9_n.mjs} +1 -1
  121. package/dist/shared/{ccjk.CvChMYvB.mjs → ccjk.DCw2WnZU.mjs} +1 -1
  122. package/dist/shared/{ccjk.DG_o24cZ.mjs → ccjk.DJdmgr2d.mjs} +1 -1
  123. package/dist/shared/{ccjk.BIxuVL3_.mjs → ccjk.DcKLglJQ.mjs} +2 -2
  124. package/dist/shared/{ccjk.DLLw-h4Y.mjs → ccjk.DfXjf8EC.mjs} +2 -2
  125. package/dist/shared/{ccjk.KpFl2RDA.mjs → ccjk.DpstNaeR.mjs} +3 -3
  126. package/dist/shared/{ccjk.DOBWBkFR.mjs → ccjk.XsJWJuQP.mjs} +5 -5
  127. package/dist/shared/{ccjk._dESH4Rk.mjs → ccjk.dYDLfmph.mjs} +1 -1
  128. package/dist/shared/{ccjk.DS7UESmF.mjs → ccjk.hrRv8G6j.mjs} +4 -4
  129. package/dist/shared/{ccjk.BWFpnOr3.mjs → ccjk.mJpVRDZ8.mjs} +1 -1
  130. package/dist/templates/claude-code/common/settings.json +3 -1
  131. package/package.json +20 -18
  132. package/templates/claude-code/common/settings.json +3 -1
  133. package/dist/chunks/context-loader.mjs +0 -351
  134. package/dist/chunks/context.mjs +0 -372
  135. package/dist/chunks/health-check.mjs +0 -532
@@ -1,218 +1,193 @@
1
- import { promisify } from 'node:util';
2
- import childProcess from 'node:child_process';
3
- import fs, { constants } from 'node:fs/promises';
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
4
3
  import process__default from 'node:process';
5
- import os__default from 'node:os';
6
- import fs__default from 'node:fs';
7
- import 'node:buffer';
8
-
9
- let isDockerCached;
10
-
11
- function hasDockerEnv() {
12
- try {
13
- fs__default.statSync('/.dockerenv');
14
- return true;
15
- } catch {
16
- return false;
17
- }
4
+ import { i as installSuperpowers } from '../shared/ccjk.dYDLfmph.mjs';
5
+ import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
6
+ import 'node:child_process';
7
+ import 'node:fs/promises';
8
+ import 'node:util';
9
+ import './index6.mjs';
10
+ import 'node:url';
11
+
12
+ const CORE_SKILLS = [
13
+ "agent-browser",
14
+ "tdd",
15
+ "debugging",
16
+ "code-review",
17
+ "git-worktrees"
18
+ ];
19
+
20
+ function getSuperpowersDir$1() {
21
+ return join(homedir(), ".claude", "plugins", "superpowers");
18
22
  }
19
-
20
- function hasDockerCGroup() {
21
- try {
22
- return fs__default.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
23
- } catch {
24
- return false;
25
- }
23
+ function isSuperpowersInstalled() {
24
+ const superpowersDir = getSuperpowersDir$1();
25
+ return existsSync(superpowersDir) && existsSync(join(superpowersDir, "skills"));
26
26
  }
27
-
28
- function isDocker() {
29
- // TODO: Use `??=` when targeting Node.js 16.
30
- if (isDockerCached === undefined) {
31
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
32
- }
33
-
34
- return isDockerCached;
27
+ function areCoreSkillsInstalled() {
28
+ const skillsDir = join(getSuperpowersDir$1(), "skills");
29
+ if (!existsSync(skillsDir)) {
30
+ return false;
31
+ }
32
+ for (const skill of CORE_SKILLS) {
33
+ const skillPath = join(skillsDir, skill);
34
+ if (!existsSync(skillPath) || !existsSync(join(skillPath, "skill.json"))) {
35
+ return false;
36
+ }
37
+ }
38
+ return true;
35
39
  }
36
-
37
- let cachedResult;
38
-
39
- // Podman detection
40
- const hasContainerEnv = () => {
41
- try {
42
- fs__default.statSync('/run/.containerenv');
43
- return true;
44
- } catch {
45
- return false;
46
- }
47
- };
48
-
49
- function isInsideContainer() {
50
- // TODO: Use `??=` when targeting Node.js 16.
51
- if (cachedResult === undefined) {
52
- cachedResult = hasContainerEnv() || isDocker();
53
- }
54
-
55
- return cachedResult;
40
+ async function autoInstallSuperpowers(lang = "zh-CN") {
41
+ try {
42
+ if (isSuperpowersInstalled() && areCoreSkillsInstalled()) {
43
+ return true;
44
+ }
45
+ const result = await installSuperpowers({
46
+ lang,
47
+ skipPrompt: true
48
+ // Skip user prompts for silent installation
49
+ });
50
+ if (!result.success) {
51
+ if (process__default.env.DEBUG) {
52
+ console.error("[CCJK Zero-Config] Installation failed:", result.error || result.message);
53
+ }
54
+ return false;
55
+ }
56
+ return isSuperpowersInstalled() && areCoreSkillsInstalled();
57
+ } catch (error) {
58
+ if (process__default.env.DEBUG) {
59
+ console.error("[CCJK Zero-Config] Auto-install failed:", error);
60
+ }
61
+ return false;
62
+ }
56
63
  }
57
64
 
58
- const isWsl = () => {
59
- if (process__default.platform !== 'linux') {
60
- return false;
61
- }
62
-
63
- if (os__default.release().toLowerCase().includes('microsoft')) {
64
- if (isInsideContainer()) {
65
- return false;
66
- }
67
-
68
- return true;
69
- }
70
-
71
- try {
72
- if (fs__default.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {
73
- return !isInsideContainer();
74
- }
75
- } catch {}
76
-
77
- // Fallback for custom kernels: check WSL-specific paths.
78
- if (
79
- fs__default.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')
80
- || fs__default.existsSync('/run/WSL')
81
- ) {
82
- return !isInsideContainer();
83
- }
84
-
85
- return false;
86
- };
87
-
88
- const isWsl$1 = process__default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
89
-
90
- promisify(childProcess.execFile);
91
-
92
- const powerShellPath$1 = () => `${process__default.env.SYSTEMROOT || process__default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
93
-
94
- function parseMountPointFromConfig(content) {
95
- for (const line of content.split('\n')) {
96
- // Skip comment lines
97
- if (/^\s*#/.test(line)) {
98
- continue;
99
- }
100
-
101
- // Match root at start of line (after optional whitespace)
102
- const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
103
- if (!match) {
104
- continue;
105
- }
106
-
107
- return match.groups.mountPoint
108
- .trim()
109
- // Strip surrounding quotes
110
- .replaceAll(/^["']|["']$/g, '');
111
- }
65
+ function getSkillsDir() {
66
+ return join(homedir(), ".claude", "plugins", "superpowers", "skills");
67
+ }
68
+ function isSkillInstalled(skillName) {
69
+ const skillPath = join(getSkillsDir(), skillName);
70
+ return existsSync(skillPath) && existsSync(join(skillPath, "skill.json"));
71
+ }
72
+ async function loadSkill(skillName) {
73
+ try {
74
+ if (!isSkillInstalled(skillName)) {
75
+ return {
76
+ skill: skillName,
77
+ success: false,
78
+ error: "Skill not installed"
79
+ };
80
+ }
81
+ const skillJsonPath = join(getSkillsDir(), skillName, "skill.json");
82
+ const skillJson = JSON.parse(readFileSync(skillJsonPath, "utf-8"));
83
+ if (!skillJson.name || !skillJson.version) {
84
+ return {
85
+ skill: skillName,
86
+ success: false,
87
+ error: "Invalid skill.json format"
88
+ };
89
+ }
90
+ return {
91
+ skill: skillName,
92
+ success: true
93
+ };
94
+ } catch (error) {
95
+ return {
96
+ skill: skillName,
97
+ success: false,
98
+ error: error instanceof Error ? error.message : "Unknown error"
99
+ };
100
+ }
101
+ }
102
+ async function loadCoreSkills(_lang = "zh-CN") {
103
+ const results = await Promise.all(
104
+ CORE_SKILLS.map((skill) => loadSkill(skill))
105
+ );
106
+ if (process__default.env.DEBUG) {
107
+ const successful = results.filter((r) => r.success);
108
+ const failed = results.filter((r) => !r.success);
109
+ console.log(`[Zero-Config] Loaded ${successful.length}/${CORE_SKILLS.length} core skills`);
110
+ if (failed.length > 0) {
111
+ console.log(`[Zero-Config] Failed skills: ${failed.map((r) => r.skill).join(", ")}`);
112
+ }
113
+ }
114
+ return results;
112
115
  }
113
116
 
114
- const execFile = promisify(childProcess.execFile);
115
-
116
- const wslDrivesMountPoint = (() => {
117
- // Default value for "root" param
118
- // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
119
- const defaultMountPoint = '/mnt/';
120
-
121
- let mountPoint;
122
-
123
- return async function () {
124
- if (mountPoint) {
125
- // Return memoized mount point value
126
- return mountPoint;
127
- }
128
-
129
- const configFilePath = '/etc/wsl.conf';
130
-
131
- let isConfigFileExists = false;
132
- try {
133
- await fs.access(configFilePath, constants.F_OK);
134
- isConfigFileExists = true;
135
- } catch {}
136
-
137
- if (!isConfigFileExists) {
138
- return defaultMountPoint;
139
- }
140
-
141
- const configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});
142
- const parsedMountPoint = parseMountPointFromConfig(configContent);
143
-
144
- if (parsedMountPoint === undefined) {
145
- return defaultMountPoint;
146
- }
147
-
148
- mountPoint = parsedMountPoint;
149
- mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
150
-
151
- return mountPoint;
152
- };
153
- })();
154
-
155
- const powerShellPathFromWsl = async () => {
156
- const mountPoint = await wslDrivesMountPoint();
157
- return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
158
- };
159
-
160
- const powerShellPath = isWsl$1 ? powerShellPathFromWsl : powerShellPath$1;
161
-
162
- // Cache for PowerShell accessibility check
163
- let canAccessPowerShellPromise;
164
-
165
- const canAccessPowerShell = async () => {
166
- canAccessPowerShellPromise ??= (async () => {
167
- try {
168
- const psPath = await powerShellPath();
169
- await fs.access(psPath, constants.X_OK);
170
- return true;
171
- } catch {
172
- // PowerShell is not accessible (either doesn't exist, no execute permission, or other error)
173
- return false;
174
- }
175
- })();
176
-
177
- return canAccessPowerShellPromise;
178
- };
179
-
180
- const isUrl = path => /^[a-z]+:\/\//i.test(path);
181
-
182
- const convertWslPathToWindows = async paths => {
183
- const isBatch = Array.isArray(paths);
184
- const pathArray = isBatch ? paths : [paths];
185
-
186
- // Find indices of non-URL paths that need conversion
187
- const indicesToConvert = [];
188
- const pathsToConvert = [];
189
-
190
- for (const [index, path] of pathArray.entries()) {
191
- if (!isUrl(path)) {
192
- indicesToConvert.push(index);
193
- pathsToConvert.push(path);
194
- }
195
- }
196
-
197
- // Start with original paths (URLs stay as-is)
198
- const results = [...pathArray];
199
-
200
- if (pathsToConvert.length > 0) {
201
- try {
202
- const {stdout} = await execFile('wslpath', ['-aw', ...pathsToConvert], {encoding: 'utf8'});
203
- const convertedPaths = stdout.split(/\r?\n/).filter(Boolean);
204
-
205
- for (const [index, originalIndex] of indicesToConvert.entries()) {
206
- results[originalIndex] = convertedPaths[index] ?? pathArray[originalIndex];
207
- }
208
- } catch {
209
- // If wslpath fails, keep original paths
210
- }
211
- }
212
-
213
- return isBatch ? results : results[0];
214
- };
215
-
216
- const isUncPath = path => /^\\\\/u.test(path);
117
+ function getActivationStatePath() {
118
+ return join(homedir(), ".claude", "plugins", "superpowers", ".activation-state.json");
119
+ }
120
+ function getSuperpowersDir() {
121
+ return join(homedir(), ".claude", "plugins", "superpowers");
122
+ }
123
+ function loadActivationState() {
124
+ try {
125
+ const statePath = getActivationStatePath();
126
+ if (!existsSync(statePath)) {
127
+ return null;
128
+ }
129
+ const stateJson = readFileSync(statePath, "utf-8");
130
+ return JSON.parse(stateJson);
131
+ } catch (error) {
132
+ if (process__default.env.DEBUG) {
133
+ console.error("[Zero-Config] Failed to load activation state:", error);
134
+ }
135
+ return null;
136
+ }
137
+ }
138
+ function saveActivationState(status) {
139
+ try {
140
+ const statePath = getActivationStatePath();
141
+ writeFileSync(statePath, JSON.stringify(status, null, 2), "utf-8");
142
+ } catch (error) {
143
+ if (process__default.env.DEBUG) {
144
+ console.error("[Zero-Config] Failed to save activation state:", error);
145
+ }
146
+ }
147
+ }
148
+ function checkActivationStatus() {
149
+ const superpowersInstalled = existsSync(getSuperpowersDir());
150
+ const savedState = loadActivationState();
151
+ if (savedState) {
152
+ return savedState;
153
+ }
154
+ return {
155
+ isInstalled: superpowersInstalled,
156
+ coreSkillsLoaded: false,
157
+ loadedSkills: [],
158
+ needsActivation: true,
159
+ lastActivation: void 0
160
+ };
161
+ }
162
+ async function activateSuperpowers(lang = "zh-CN") {
163
+ const currentStatus = checkActivationStatus();
164
+ if (!currentStatus.needsActivation) {
165
+ return currentStatus;
166
+ }
167
+ if (!currentStatus.isInstalled) {
168
+ const installSuccess = await autoInstallSuperpowers(lang);
169
+ if (!installSuccess) {
170
+ return {
171
+ isInstalled: false,
172
+ coreSkillsLoaded: false,
173
+ loadedSkills: [],
174
+ needsActivation: true,
175
+ lastActivation: void 0
176
+ };
177
+ }
178
+ }
179
+ const loadResults = await loadCoreSkills(lang);
180
+ const successfulLoads = loadResults.filter((r) => r.success);
181
+ const allCoreSkillsLoaded = successfulLoads.length === loadResults.length;
182
+ const newStatus = {
183
+ isInstalled: true,
184
+ coreSkillsLoaded: allCoreSkillsLoaded,
185
+ loadedSkills: successfulLoads.map((r) => r.skill),
186
+ needsActivation: false,
187
+ lastActivation: (/* @__PURE__ */ new Date()).toISOString()
188
+ };
189
+ saveActivationState(newStatus);
190
+ return newStatus;
191
+ }
217
192
 
218
- export { canAccessPowerShell, convertWslPathToWindows, isUncPath, isWsl$1 as isWsl, powerShellPath, powerShellPathFromWsl, wslDrivesMountPoint };
193
+ export { activateSuperpowers, autoInstallSuperpowers, checkActivationStatus, loadCoreSkills, loadSkill };
@@ -0,0 +1,218 @@
1
+ import { promisify } from 'node:util';
2
+ import childProcess from 'node:child_process';
3
+ import fs, { constants } from 'node:fs/promises';
4
+ import process__default from 'node:process';
5
+ import os__default from 'node:os';
6
+ import fs__default from 'node:fs';
7
+ import 'node:buffer';
8
+
9
+ let isDockerCached;
10
+
11
+ function hasDockerEnv() {
12
+ try {
13
+ fs__default.statSync('/.dockerenv');
14
+ return true;
15
+ } catch {
16
+ return false;
17
+ }
18
+ }
19
+
20
+ function hasDockerCGroup() {
21
+ try {
22
+ return fs__default.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
23
+ } catch {
24
+ return false;
25
+ }
26
+ }
27
+
28
+ function isDocker() {
29
+ // TODO: Use `??=` when targeting Node.js 16.
30
+ if (isDockerCached === undefined) {
31
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
32
+ }
33
+
34
+ return isDockerCached;
35
+ }
36
+
37
+ let cachedResult;
38
+
39
+ // Podman detection
40
+ const hasContainerEnv = () => {
41
+ try {
42
+ fs__default.statSync('/run/.containerenv');
43
+ return true;
44
+ } catch {
45
+ return false;
46
+ }
47
+ };
48
+
49
+ function isInsideContainer() {
50
+ // TODO: Use `??=` when targeting Node.js 16.
51
+ if (cachedResult === undefined) {
52
+ cachedResult = hasContainerEnv() || isDocker();
53
+ }
54
+
55
+ return cachedResult;
56
+ }
57
+
58
+ const isWsl = () => {
59
+ if (process__default.platform !== 'linux') {
60
+ return false;
61
+ }
62
+
63
+ if (os__default.release().toLowerCase().includes('microsoft')) {
64
+ if (isInsideContainer()) {
65
+ return false;
66
+ }
67
+
68
+ return true;
69
+ }
70
+
71
+ try {
72
+ if (fs__default.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {
73
+ return !isInsideContainer();
74
+ }
75
+ } catch {}
76
+
77
+ // Fallback for custom kernels: check WSL-specific paths.
78
+ if (
79
+ fs__default.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')
80
+ || fs__default.existsSync('/run/WSL')
81
+ ) {
82
+ return !isInsideContainer();
83
+ }
84
+
85
+ return false;
86
+ };
87
+
88
+ const isWsl$1 = process__default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
89
+
90
+ promisify(childProcess.execFile);
91
+
92
+ const powerShellPath$1 = () => `${process__default.env.SYSTEMROOT || process__default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
93
+
94
+ function parseMountPointFromConfig(content) {
95
+ for (const line of content.split('\n')) {
96
+ // Skip comment lines
97
+ if (/^\s*#/.test(line)) {
98
+ continue;
99
+ }
100
+
101
+ // Match root at start of line (after optional whitespace)
102
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
103
+ if (!match) {
104
+ continue;
105
+ }
106
+
107
+ return match.groups.mountPoint
108
+ .trim()
109
+ // Strip surrounding quotes
110
+ .replaceAll(/^["']|["']$/g, '');
111
+ }
112
+ }
113
+
114
+ const execFile = promisify(childProcess.execFile);
115
+
116
+ const wslDrivesMountPoint = (() => {
117
+ // Default value for "root" param
118
+ // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
119
+ const defaultMountPoint = '/mnt/';
120
+
121
+ let mountPoint;
122
+
123
+ return async function () {
124
+ if (mountPoint) {
125
+ // Return memoized mount point value
126
+ return mountPoint;
127
+ }
128
+
129
+ const configFilePath = '/etc/wsl.conf';
130
+
131
+ let isConfigFileExists = false;
132
+ try {
133
+ await fs.access(configFilePath, constants.F_OK);
134
+ isConfigFileExists = true;
135
+ } catch {}
136
+
137
+ if (!isConfigFileExists) {
138
+ return defaultMountPoint;
139
+ }
140
+
141
+ const configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});
142
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
143
+
144
+ if (parsedMountPoint === undefined) {
145
+ return defaultMountPoint;
146
+ }
147
+
148
+ mountPoint = parsedMountPoint;
149
+ mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
150
+
151
+ return mountPoint;
152
+ };
153
+ })();
154
+
155
+ const powerShellPathFromWsl = async () => {
156
+ const mountPoint = await wslDrivesMountPoint();
157
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
158
+ };
159
+
160
+ const powerShellPath = isWsl$1 ? powerShellPathFromWsl : powerShellPath$1;
161
+
162
+ // Cache for PowerShell accessibility check
163
+ let canAccessPowerShellPromise;
164
+
165
+ const canAccessPowerShell = async () => {
166
+ canAccessPowerShellPromise ??= (async () => {
167
+ try {
168
+ const psPath = await powerShellPath();
169
+ await fs.access(psPath, constants.X_OK);
170
+ return true;
171
+ } catch {
172
+ // PowerShell is not accessible (either doesn't exist, no execute permission, or other error)
173
+ return false;
174
+ }
175
+ })();
176
+
177
+ return canAccessPowerShellPromise;
178
+ };
179
+
180
+ const isUrl = path => /^[a-z]+:\/\//i.test(path);
181
+
182
+ const convertWslPathToWindows = async paths => {
183
+ const isBatch = Array.isArray(paths);
184
+ const pathArray = isBatch ? paths : [paths];
185
+
186
+ // Find indices of non-URL paths that need conversion
187
+ const indicesToConvert = [];
188
+ const pathsToConvert = [];
189
+
190
+ for (const [index, path] of pathArray.entries()) {
191
+ if (!isUrl(path)) {
192
+ indicesToConvert.push(index);
193
+ pathsToConvert.push(path);
194
+ }
195
+ }
196
+
197
+ // Start with original paths (URLs stay as-is)
198
+ const results = [...pathArray];
199
+
200
+ if (pathsToConvert.length > 0) {
201
+ try {
202
+ const {stdout} = await execFile('wslpath', ['-aw', ...pathsToConvert], {encoding: 'utf8'});
203
+ const convertedPaths = stdout.split(/\r?\n/).filter(Boolean);
204
+
205
+ for (const [index, originalIndex] of indicesToConvert.entries()) {
206
+ results[originalIndex] = convertedPaths[index] ?? pathArray[originalIndex];
207
+ }
208
+ } catch {
209
+ // If wslpath fails, keep original paths
210
+ }
211
+ }
212
+
213
+ return isBatch ? results : results[0];
214
+ };
215
+
216
+ const isUncPath = path => /^\\\\/u.test(path);
217
+
218
+ export { canAccessPowerShell, convertWslPathToWindows, isUncPath, isWsl$1 as isWsl, powerShellPath, powerShellPathFromWsl, wslDrivesMountPoint };
@@ -1,19 +1,24 @@
1
- import { g as getDefaultExportFromCjs } from '../shared/ccjk.BAGoDD49.mjs';
2
-
3
- var ansis = {exports: {}};
4
-
5
- var hasRequiredAnsis;
6
-
7
- function requireAnsis () {
8
- if (hasRequiredAnsis) return ansis.exports;
9
- hasRequiredAnsis = 1;
10
- let e,t,r,{defineProperty:l,setPrototypeOf:n,create:o,keys:s}=Object,i="",{round:c,max:a}=Math,p=e=>{let t=/([a-f\d]{3,6})/i.exec(e)?.[1],r=t?.length,l=parseInt(6^r?3^r?"0":t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,16);return [l>>16&255,l>>8&255,255&l]},u=(e,t,r)=>e^t||t^r?16+36*c(e/51)+6*c(t/51)+c(r/51):8>e?16:e>248?231:c(24*(e-8)/247)+232,d=e=>{let t,r,l,n,o;return 8>e?30+e:16>e?e-8+90:(232>e?(o=(e-=16)%36,t=(e/36|0)/5,r=(o/6|0)/5,l=o%6/5):t=r=l=(10*(e-232)+8)/255,n=2*a(t,r,l),n?30+(c(l)<<2|c(r)<<1|c(t))+(2^n?0:60):30)},f=(()=>{let r=e=>o.some((t=>e.test(t))),l=globalThis,n=l.process??{},o=n.argv??[],i=n.env??{},c=-1;try{e=","+s(i).join(",");}catch(e){i={},c=0;}let a="FORCE_COLOR",p={false:0,0:0,1:1,2:2,3:3}[i[a]]??-1,u=a in i&&p||r(/^--color=?(true|always)?$/);return u&&(c=p),~c||(c=((r,l,n)=>(t=r.TERM,{"24bit":3,truecolor:3,ansi256:2,ansi:1}[r.COLORTERM]||(r.CI?/,GITHUB/.test(e)?3:1:l&&"dumb"!==t?n?3:/-256/.test(t)?2:1:0)))(i,!!i.PM2_HOME||i.NEXT_RUNTIME?.includes("edge")||!!n.stdout?.isTTY,"win32"===n.platform)),!p||i.NO_COLOR||r(/^--(no-color|color=(false|never))$/)?0:l.window?.chrome||u&&!c?3:c})(),g={open:i,close:i},h=39,b=49,O={},m=({p:e},{open:t,close:l})=>{let o=(e,...r)=>{if(!e){if(t&&t===l)return t;if((e??i)===i)return i}let n,s=e.raw?String.raw({raw:e},...r):i+e,c=o.p,a=c.o,p=c.c;if(s.includes(""))for(;c;c=c.p){let{open:e,close:t}=c,r=t.length,l=i,o=0;if(r)for(;~(n=s.indexOf(t,o));o=n+r)l+=s.slice(o,n)+e;s=l+s.slice(o);}return a+(s.includes("\n")?s.replace(/(\r?\n)/g,p+"$1"+a):s)+p},s=t,c=l;return e&&(s=e.o+t,c=l+e.c),n(o,r),o.p={open:t,close:l,o:s,c,p:e},o.open=s,o.close=c,o};const w=new function e(t=f){let s={Ansis:e,level:t,isSupported:()=>a,strip:e=>e.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,i),extend(e){for(let t in e){let r=e[t],l=(typeof r)[0];"s"===l?(c(t,T(...p(r))),c(_(t),v(...p(r)))):c(t,r,"f"===l);}return r=o({},O),n(s,r),s}},c=(e,t,r)=>{O[e]={get(){let n=r?(...e)=>m(this,t(...e)):m(this,t);return l(this,e,{value:n}),n}};},a=t>0,w=(e,t)=>a?{open:`[${e}m`,close:`[${t}m`}:g,y=e=>t=>e(...p(t)),R=(e,t)=>(r,l,n)=>w(`${e}8;2;${r};${l};${n}`,t),$=(e,t)=>(r,l,n)=>w(((e,t,r)=>d(u(e,t,r)))(r,l,n)+e,t),x=e=>(t,r,l)=>e(u(t,r,l)),T=R(3,h),v=R(4,b),C=e=>w("38;5;"+e,h),E=e=>w("48;5;"+e,b);2===t?(T=x(C),v=x(E)):1===t&&(T=$(0,h),v=$(10,b),C=e=>w(d(e),h),E=e=>w(d(e)+10,b));let M,I={fg:C,bg:E,rgb:T,bgRgb:v,hex:y(T),bgHex:y(v),visible:g,reset:w(0,0),bold:w(1,22),dim:w(2,22),italic:w(3,23),underline:w(4,24),inverse:w(7,27),hidden:w(8,28),strikethrough:w(9,29)},_=e=>"bg"+e[0].toUpperCase()+e.slice(1),k="Bright";return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e,t)=>{M=_(e),8>t?(I[e+k]=w(90+t,h),I[M+k]=w(100+t,b)):t=60,I[e]=w(30+t,h),I[M]=w(40+t,b);})),s.extend(I)};ansis.exports=w,w.default=w;
11
- return ansis.exports;
12
- }
13
-
14
- var ansisExports = /*@__PURE__*/ requireAnsis();
15
- const a = /*@__PURE__*/getDefaultExportFromCjs(ansisExports);
16
-
17
- const {Ansis,fg,bg,rgb,bgRgb,hex,bgHex,reset,inverse,hidden,visible,bold,dim,italic,underline,strikethrough,black,red,green,yellow,blue,magenta,cyan,white,gray,redBright,greenBright,yellowBright,blueBright,magentaBright,cyanBright,whiteBright,bgBlack,bgRed,bgGreen,bgYellow,bgBlue,bgMagenta,bgCyan,bgWhite,bgGray,bgRedBright,bgGreenBright,bgYellowBright,bgBlueBright,bgMagentaBright,bgCyanBright,bgWhiteBright}=a;
18
-
19
- export { Ansis, bg, bgBlack, bgBlue, bgBlueBright, bgCyan, bgCyanBright, bgGray, bgGreen, bgGreenBright, bgHex, bgMagenta, bgMagentaBright, bgRed, bgRedBright, bgRgb, bgWhite, bgWhiteBright, bgYellow, bgYellowBright, black, blue, blueBright, bold, cyan, cyanBright, a as default, dim, fg, gray, green, greenBright, hex, hidden, inverse, italic, magenta, magentaBright, red, redBright, reset, rgb, strikethrough, underline, visible, white, whiteBright, yellow, yellowBright };
1
+ export { c as configureOfficialMode, a as configureSimpleMode, b as configureWithPreset, e as detectCurrentMode, d as displayCurrentStatus, g as getCurrentConfig, q as quickSetup, r as runConfigWizard, t as testApiConnection, v as validateApiKey } from '../shared/ccjk.DfXjf8EC.mjs';
2
+ export { P as PROVIDER_PRESETS, g as getAllPresets, a as getChinesePresets, b as getPresetById, c as getRecommendedPresets } from '../shared/ccjk.CL4Yat0G.mjs';
3
+ import './index3.mjs';
4
+ import '../shared/ccjk.BAGoDD49.mjs';
5
+ import './index4.mjs';
6
+ import 'node:readline';
7
+ import 'stream';
8
+ import 'node:tty';
9
+ import 'node:process';
10
+ import 'node:async_hooks';
11
+ import '../shared/ccjk.Cjgrln_h.mjs';
12
+ import 'node:util';
13
+ import 'tty';
14
+ import 'fs';
15
+ import 'child_process';
16
+ import 'node:path';
17
+ import 'node:os';
18
+ import 'node:crypto';
19
+ import 'buffer';
20
+ import 'string_decoder';
21
+ import 'node:fs';
22
+ import './fs-operations.mjs';
23
+ import 'node:fs/promises';
24
+ import '../shared/ccjk.bQ7Dh1g4.mjs';