@qodercn-ai/qoderclicn 1.1.82 → 1.1.84

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.
@@ -283,5 +283,6 @@ ${u}
283
283
  /**
284
284
  * @license
285
285
  * Copyright 2026 Google LLC
286
+ * Copyright 2026 Qwen Team
286
287
  * SPDX-License-Identifier: Apache-2.0
287
288
  */
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bundle/qoder-worker-runtime.mjs
3
- size: 35379337 bytes
4
- sha256: 5a102b599cfce205f643b2f2aa6d75e24e40f919cd6138870f3b25c8978c3c38
3
+ size: 35360707 bytes
4
+ sha256: 75a660bd084d8640b1eab580e38968e6fa6d04ecf635466191db1b520e1fed25
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bundle/qoderclicn.js
3
- size: 35168668 bytes
4
- sha256: f077a75eae20eeb76a7f6577e04b8b097a516b97d094886b91f80bcb423bae38
3
+ size: 35146374 bytes
4
+ sha256: 936d4037651ab74a8f27b0d792273bf2c349a792b97cb913d5fffb6ebea6e101
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodercn-ai/qoderclicn",
3
- "version": "1.1.82",
3
+ "version": "1.1.84",
4
4
  "description": "Qoder AI CLI - AI-powered coding assistant",
5
5
  "author": "Qoder AI",
6
6
  "type": "module",
@@ -20,12 +20,12 @@
20
20
  "sharp": "^0.34.5"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@qodercn-ai/qoderclicn-ripgrep-darwin-arm64": "1.1.82",
24
- "@qodercn-ai/qoderclicn-ripgrep-darwin-x64": "1.1.82",
25
- "@qodercn-ai/qoderclicn-ripgrep-linux-arm64": "1.1.82",
26
- "@qodercn-ai/qoderclicn-ripgrep-linux-x64": "1.1.82",
27
- "@qodercn-ai/qoderclicn-ripgrep-win32-arm64": "1.1.82",
28
- "@qodercn-ai/qoderclicn-ripgrep-win32-x64": "1.1.82"
23
+ "@qodercn-ai/qoderclicn-ripgrep-darwin-arm64": "1.1.84",
24
+ "@qodercn-ai/qoderclicn-ripgrep-darwin-x64": "1.1.84",
25
+ "@qodercn-ai/qoderclicn-ripgrep-linux-arm64": "1.1.84",
26
+ "@qodercn-ai/qoderclicn-ripgrep-linux-x64": "1.1.84",
27
+ "@qodercn-ai/qoderclicn-ripgrep-win32-arm64": "1.1.84",
28
+ "@qodercn-ai/qoderclicn-ripgrep-win32-x64": "1.1.84"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=20.0.0"
package/postinstall.cjs CHANGED
@@ -1,215 +1,245 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * @license
4
- * Copyright 2026 Google LLC
5
- * SPDX-License-Identifier: Apache-2.0
6
- */
7
- 'use strict';
8
-
9
- /**
10
- * @license
11
- * Copyright 2025 Google LLC
12
- * SPDX-License-Identifier: Apache-2.0
13
- */
14
-
15
- /**
16
- * npm postinstall script for @qoder-ai/qodercli (pure JS bundle).
17
- *
18
- * On all platforms: verifies that either the platform ripgrep package or a
19
- * system rg is available.
20
- * On Windows: ensures npm's global bin directory is on the user's PATH.
21
- *
22
- * IMPORTANT: This script must NEVER cause `npm install` to fail.
23
- * All operations are wrapped in try/catch and errors are silently ignored.
24
- */
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+
24
+ // packages/cli/src/installation/install/windowsRegistryPath.ts
25
+ var windowsRegistryPath_exports = {};
26
+ __export(windowsRegistryPath_exports, {
27
+ readWindowsRegistryPath: () => readWindowsRegistryPath
28
+ });
29
+ function readWindowsRegistryPath(runReg) {
30
+ const directory = (0, import_node_fs.mkdtempSync)((0, import_node_path.join)((0, import_node_os.tmpdir)(), "qoder-registry-path-"));
31
+ try {
32
+ const file = (0, import_node_path.join)(directory, "environment.reg");
33
+ runReg(["export", "HKCU\\Environment", file, "/y"]);
34
+ return parseRegistryPathExport((0, import_node_fs.readFileSync)(file));
35
+ } finally {
36
+ (0, import_node_fs.rmSync)(directory, { recursive: true, force: true });
37
+ }
38
+ }
39
+ function parseRegistryPathExport(bytes) {
40
+ if (bytes.length % 2 !== 0 || bytes[0] !== 255 || bytes[1] !== 254) {
41
+ throw new Error("Registry export is not BOM-marked UTF-16LE");
42
+ }
43
+ const text = new TextDecoder("utf-16le", { fatal: true }).decode(bytes);
44
+ if (!text.startsWith("Windows Registry Editor Version 5.00\r\n") || !text.endsWith("\r\n\r\n")) {
45
+ throw new Error("Unexpected registry export header");
46
+ }
47
+ const lines = text.replace(/\\\r?\n[ \t]*/g, "").split(/\r?\n/);
48
+ let inEnvironment = false;
49
+ let foundEnvironment = false;
50
+ let entry = null;
51
+ for (const line of lines) {
52
+ if (line.startsWith("[")) {
53
+ inEnvironment = /^\[HKEY_CURRENT_USER\\Environment\]$/i.test(line);
54
+ foundEnvironment ||= inEnvironment;
55
+ continue;
56
+ }
57
+ if (!inEnvironment || !/^"Path"/i.test(line)) continue;
58
+ if (!/^"Path"=/i.test(line)) {
59
+ throw new Error("Malformed PATH entry in registry export");
60
+ }
61
+ if (entry !== null) throw new Error("Duplicate PATH in registry export");
62
+ const data = line.slice('"Path"='.length);
63
+ if (data.startsWith('"')) {
64
+ const value2 = JSON.parse(data);
65
+ if (typeof value2 !== "string" || value2.includes("\0")) {
66
+ throw new Error("Invalid registry PATH string");
67
+ }
68
+ entry = { value: value2, type: "REG_SZ" };
69
+ continue;
70
+ }
71
+ const hex = /^hex\(([12])\):((?:[0-9a-f]{2},)*[0-9a-f]{2})$/i.exec(data);
72
+ if (!hex) throw new Error("Unsupported or malformed registry PATH value");
73
+ const valueBytes = Buffer.from(hex[2].replace(/,/g, ""), "hex");
74
+ if (valueBytes.length < 2 || valueBytes.length % 2 !== 0 || valueBytes.readUInt16LE(valueBytes.length - 2) !== 0) {
75
+ throw new Error("Invalid registry PATH string terminator");
76
+ }
77
+ const value = new TextDecoder("utf-16le", {
78
+ fatal: true,
79
+ ignoreBOM: true
80
+ }).decode(valueBytes.subarray(0, -2));
81
+ if (value.includes("\0")) throw new Error("Invalid registry PATH string");
82
+ entry = { value, type: hex[1] === "2" ? "REG_EXPAND_SZ" : "REG_SZ" };
83
+ }
84
+ if (!foundEnvironment) throw new Error("Registry export omitted Environment");
85
+ return entry;
86
+ }
87
+ var import_node_fs, import_node_os, import_node_path;
88
+ var init_windowsRegistryPath = __esm({
89
+ "packages/cli/src/installation/install/windowsRegistryPath.ts"() {
90
+ "use strict";
91
+ import_node_fs = require("node:fs");
92
+ import_node_os = require("node:os");
93
+ import_node_path = require("node:path");
94
+ }
95
+ });
25
96
 
97
+ // scripts/postinstall-npm-bundle.cjs
26
98
  try {
27
99
  warnIfRipgrepUnavailable();
28
100
  } catch {
29
- // Silent — never break npm install
30
101
  }
31
-
32
- // --- Windows PATH registration ---
33
- if (process.platform === 'win32') {
102
+ if (process.platform === "win32") {
34
103
  try {
35
104
  ensureNpmBinOnPath();
36
105
  } catch {
37
- // Silent — never break npm install
38
106
  }
39
107
  }
40
-
41
- // --- Dispatcher + PATH configuration (all platforms) ---
42
- // `qoder` should resolve to the entry-point dispatcher rather than the npm
43
- // shim so multi-channel users (npm + IDE) get consistent routing. We invoke
44
- // the freshly-installed CLI's hidden `configure-path` subcommand which
45
- // writes `~/.qoder/entry/<brand>` and prepends the entry dir onto PATH.
46
- //
47
- // Brand-neutral: we read the CLI bin path from the package's own
48
- // package.json `bin` field so the same script handles Global (qodercli) and
49
- // CN (qoderclicn) without publish-time sed rendering.
50
108
  try {
51
109
  configurePathBestEffort();
52
110
  } catch {
53
- // Never break npm install
54
111
  }
55
-
56
112
  function configurePathBestEffort() {
57
- const fs = require('node:fs');
58
- const path = require('node:path');
59
- const { spawnSync } = require('node:child_process');
60
-
61
- const pkgJsonPath = path.resolve(__dirname, 'package.json');
113
+ const fs = require("node:fs");
114
+ const path = require("node:path");
115
+ const { spawnSync } = require("node:child_process");
116
+ const pkgJsonPath = path.resolve(__dirname, "package.json");
62
117
  if (!fs.existsSync(pkgJsonPath)) return;
63
-
64
- const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
118
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
65
119
  const bins = pkgJson.bin || {};
66
- const cliBinName = ['qodercli', 'qoderclicn'].find((name) => bins[name]);
120
+ const cliBinName = ["qodercli", "qoderclicn"].find((name) => bins[name]);
67
121
  if (!cliBinName) return;
68
-
69
122
  const cliPath = path.resolve(__dirname, bins[cliBinName]);
70
123
  if (!fs.existsSync(cliPath)) return;
71
-
72
- // Run synchronously so the install banner reflects post-config state.
73
- // stdio: 'inherit' is fine here — the CLI's configure-path command always
74
- // returns exit code 0, and its stdout banner is the user-facing signal.
75
- spawnSync(process.execPath, [cliPath, 'configure-path'], {
76
- stdio: 'inherit',
77
- timeout: 30_000,
124
+ spawnSync(process.execPath, [cliPath, "configure-path"], {
125
+ stdio: "inherit",
126
+ timeout: 3e4
78
127
  });
79
128
  }
80
-
81
129
  function warnIfRipgrepUnavailable() {
82
- const { execFileSync } = require('node:child_process');
83
- const { readFileSync } = require('node:fs');
84
- const path = require('node:path');
130
+ const { execFileSync } = require("node:child_process");
131
+ const { readFileSync: readFileSync2 } = require("node:fs");
132
+ const path = require("node:path");
85
133
  const manifest = JSON.parse(
86
- readFileSync(path.join(__dirname, 'package.json'), 'utf8'),
134
+ readFileSync2(path.join(__dirname, "package.json"), "utf8")
87
135
  );
88
136
  const packageSuffix = `-ripgrep-${process.platform}-${process.arch}`;
89
137
  const ripgrepPackage = Object.keys(manifest.optionalDependencies || {}).find(
90
- (packageName) => packageName.endsWith(packageSuffix),
138
+ (packageName) => packageName.endsWith(packageSuffix)
91
139
  );
92
- const binaryName = process.platform === 'win32' ? 'rg.exe' : 'rg';
93
-
140
+ const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
94
141
  if (ripgrepPackage) {
95
142
  try {
96
143
  require.resolve(`${ripgrepPackage}/bin/${binaryName}`, {
97
- paths: [__dirname],
144
+ paths: [__dirname]
98
145
  });
99
146
  return;
100
147
  } catch {
101
- // The optional dependency may have been explicitly omitted.
102
148
  }
103
149
  }
104
-
105
150
  try {
106
- execFileSync('rg', ['--version'], {
107
- stdio: 'ignore',
108
- windowsHide: true,
151
+ execFileSync("rg", ["--version"], {
152
+ stdio: "ignore",
153
+ windowsHide: true
109
154
  });
110
155
  return;
111
156
  } catch {
112
- // Fall through to an actionable, non-fatal warning.
113
157
  }
114
-
115
158
  console.log(
116
- '\n ripgrep is unavailable. Reinstall without --omit=optional, or install rg on PATH.' +
117
- '\n Glob and Grep require ripgrep.\n',
159
+ "\n ripgrep is unavailable. Reinstall without --omit=optional, or install rg on PATH.\n Glob and Grep require ripgrep.\n"
118
160
  );
119
161
  }
120
-
121
162
  function ensureNpmBinOnPath() {
122
- const { execSync } = require('node:child_process');
123
- const path = require('node:path');
124
-
125
- // 1. Determine npm's global bin directory.
126
- // On Windows, npm places .cmd shims directly in the prefix directory
127
- // (not in a /bin subfolder like Unix).
163
+ const { execFileSync, execSync } = require("node:child_process");
164
+ const {
165
+ readWindowsRegistryPath: readWindowsRegistryPath2
166
+ } = (init_windowsRegistryPath(), __toCommonJS(windowsRegistryPath_exports));
167
+ const path = require("node:path");
128
168
  let npmBinDir;
129
169
  if (process.env.npm_config_prefix) {
130
- // npm sets this env var during lifecycle scripts
131
170
  npmBinDir = process.env.npm_config_prefix;
132
171
  } else {
133
- // Fallback: ask npm directly
134
172
  try {
135
- npmBinDir = execSync('npm prefix -g', {
136
- encoding: 'utf-8',
137
- timeout: 10000,
173
+ npmBinDir = execSync("npm prefix -g", {
174
+ encoding: "utf-8",
175
+ timeout: 1e4
138
176
  }).trim();
139
177
  } catch {
140
- return; // Can't determine prefix — bail silently
178
+ return;
141
179
  }
142
180
  }
143
-
144
181
  if (!npmBinDir) return;
145
-
146
- // Normalize path for consistent comparison
147
182
  npmBinDir = path.normalize(npmBinDir);
148
-
149
- // 2. Read current user PATH from Windows Registry (HKCU\Environment)
150
- let currentPath = '';
151
- try {
152
- const output = execSync('reg query "HKCU\\Environment" /v Path', {
153
- encoding: 'utf-8',
154
- timeout: 10000,
155
- });
156
- // Output format:
157
- // HKEY_CURRENT_USER\Environment
158
- // Path REG_EXPAND_SZ value
159
- const match = output.match(/Path\s+REG_(?:EXPAND_SZ|SZ)\s+(.*)/i);
160
- if (match) currentPath = match[1].trim();
161
- } catch {
162
- // Key might not exist — start fresh
163
- }
164
-
165
- // 3. Check if already present (case-insensitive, normalized comparison)
166
- const entries = currentPath
167
- .split(';')
168
- .map((p) => path.normalize(p.trim()).toLowerCase())
169
- .filter((p) => p.length > 0);
170
-
183
+ const registry = readWindowsRegistryPath2(
184
+ (args) => execFileSync("reg.exe", args, {
185
+ timeout: 1e4,
186
+ windowsHide: true,
187
+ stdio: "ignore"
188
+ })
189
+ );
190
+ const currentPath = registry?.value ?? "";
191
+ const entries = currentPath.split(";").map((p) => path.normalize(p.trim()).toLowerCase()).filter((p) => p.length > 0);
171
192
  if (entries.includes(npmBinDir.toLowerCase())) {
172
- return; // Already on PATH — no-op
193
+ return;
173
194
  }
174
-
175
- // 4. Append to PATH (not prepend — preserve existing priority so that
176
- // curl-bash installed versions at ~/.qoder/bin/ remain preferred)
177
- const newPath = currentPath ? currentPath + ';' + npmBinDir : npmBinDir;
178
-
179
- // 5. Write to registry as REG_EXPAND_SZ (preserves %variables%)
180
- const escaped = newPath.replace(/"/g, '\\"');
181
- execSync(
182
- `reg add "HKCU\\Environment" /v Path /t REG_EXPAND_SZ /d "${escaped}" /f`,
183
- { encoding: 'utf-8', timeout: 10000, stdio: 'ignore' },
195
+ const newPath = currentPath ? currentPath + ";" + npmBinDir : npmBinDir;
196
+ execFileSync(
197
+ "reg.exe",
198
+ [
199
+ "add",
200
+ "HKCU\\Environment",
201
+ "/v",
202
+ "Path",
203
+ "/t",
204
+ registry?.type ?? "REG_EXPAND_SZ",
205
+ "/d",
206
+ newPath,
207
+ "/f"
208
+ ],
209
+ { timeout: 1e4, stdio: "ignore", windowsHide: true }
184
210
  );
185
-
186
- // 6. Broadcast WM_SETTINGCHANGE so new Explorer/shell windows pick up
187
- // the change without requiring a reboot.
188
- // Note: Already-open PowerShell/CMD windows will NOT refresh.
189
211
  try {
190
212
  const ps = [
191
213
  "Add-Type -Namespace Win32 -Name NM -MemberDefinition '",
192
214
  '[DllImport("user32.dll",SetLastError=true,CharSet=CharSet.Auto)]',
193
- 'public static extern IntPtr SendMessageTimeout(',
194
- 'IntPtr hWnd,uint Msg,UIntPtr wParam,string lParam,',
215
+ "public static extern IntPtr SendMessageTimeout(",
216
+ "IntPtr hWnd,uint Msg,UIntPtr wParam,string lParam,",
195
217
  "uint fuFlags,uint uTimeout,out UIntPtr lpdwResult);';",
196
- '$r=[UIntPtr]::Zero;',
197
- '[Win32.NM]::SendMessageTimeout(',
218
+ "$r=[UIntPtr]::Zero;",
219
+ "[Win32.NM]::SendMessageTimeout(",
198
220
  '[IntPtr]0xFFFF,0x001A,[UIntPtr]::Zero,"Environment",',
199
- '2,5000,[ref]$r)|Out-Null',
200
- ].join(' ');
221
+ "2,5000,[ref]$r)|Out-Null"
222
+ ].join(" ");
201
223
  execSync(`powershell -NoProfile -Command "${ps}"`, {
202
- encoding: 'utf-8',
203
- timeout: 15000,
204
- stdio: 'ignore',
224
+ encoding: "utf-8",
225
+ timeout: 15e3,
226
+ stdio: "ignore"
205
227
  });
206
228
  } catch {
207
- // Non-fatal — PATH change is persisted in registry regardless
208
229
  }
209
-
210
- // 7. User-facing hint
211
230
  console.log(
212
- '\n \u2713 Added npm global bin directory to PATH.' +
213
- '\n Please restart your terminal to use "qodercli".\n',
231
+ '\n \u2713 Added npm global bin directory to PATH.\n Please restart your terminal to use "qodercli".\n'
214
232
  );
215
233
  }
234
+ /**
235
+ * @license
236
+ * Copyright 2026 Google LLC
237
+ * Copyright 2026 Qwen Team
238
+ * SPDX-License-Identifier: Apache-2.0
239
+ */
240
+ /**
241
+ * @license
242
+ * Copyright 2025 Google LLC
243
+ * Copyright 2026 Qwen Team
244
+ * SPDX-License-Identifier: Apache-2.0
245
+ */