codex-copilot-dx 1.2.0 → 1.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.
@@ -29,7 +29,7 @@ export function createServiceControl({ env = process.env, home, providerRuntime,
29
29
  if (!input || typeof input !== "object" || Array.isArray(input)) throw new Error("Invalid setting action");
30
30
  const allowed = { preference: ["action", "key", "value"], animation: ["action", "theme"],
31
31
  history_limit: ["action", "mib"], history_clean: ["action"], prediction_fix: ["action"],
32
- provider: ["action", "operation", "provider", "model", "auto_review_model"] }[input.action];
32
+ provider: ["action", "operation", "provider", "model", "auto_review_model", "auto_review_effort"] }[input.action];
33
33
  if (!allowed || Object.keys(input).some(key => !allowed.includes(key))) throw new Error("Unknown setting action or field");
34
34
  if (input.action === "preference") {
35
35
  writeServicePreference(input.key, input.value, options);
@@ -49,9 +49,9 @@ export function createServiceControl({ env = process.env, home, providerRuntime,
49
49
  try { writeResponseHistoryLimitMib(input.mib, options); } catch (error) { setHistoryCacheLimit(before);throw error; }
50
50
  } else if (input.action === "history_clean") cleanRuntimeCaches({ history: true });
51
51
  else {
52
- if (!providerRuntime || !["on", "off", "switch"].includes(input.operation)) throw new Error("Invalid provider operation");
52
+ if (!providerRuntime || !["on", "off", "switch", "auto-review"].includes(input.operation)) throw new Error("Invalid provider operation");
53
53
  if (input.operation === "on" && env.CCDX_M365 === "0") throw new Error("Microsoft 365 is disabled by CCDX_M365=0");
54
- await providerRuntime.action({ action: input.operation, provider: input.provider, model: input.model, auto_review_model: input.auto_review_model });
54
+ await providerRuntime.action({ action: input.operation, provider: input.provider, model: input.model, auto_review_model: input.auto_review_model, auto_review_effort: input.auto_review_effort, effort: input.auto_review_effort });
55
55
  }
56
56
  return snapshot();
57
57
  }
package/src/version.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import fs from "node:fs";
2
+ import { stableVersion as githubReleaseVersion } from "./release-install.mjs";
2
3
  import path from "node:path";
3
4
  import { fileURLToPath } from "node:url";
4
5
  import { operationError } from "./operation-error.mjs";
@@ -30,12 +31,7 @@ export function isVersionGreater(a, b) {
30
31
  return false;
31
32
  }
32
33
 
33
- export function githubReleaseVersion(tag) {
34
- if (typeof tag !== "string" || tag.length > 64) return null;
35
- const match = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(tag);
36
- if (!match || !match.slice(1).every((part) => Number.isSafeInteger(Number(part)))) return null;
37
- return match.slice(1).join(".");
38
- }
34
+ export { stableVersion as githubReleaseVersion } from "./release-install.mjs";
39
35
 
40
36
  export async function lookupLatestRelease({ fetchImpl = fetch, timeoutMs = 2000 } = {}) {
41
37
  const controller = new AbortController();
@@ -37,6 +37,16 @@ exit $ret
37
37
  `;
38
38
  }
39
39
 
40
+ export function privateWindowsCommand({ node, cli, prefix }) {
41
+ const relativeNode = path.relative(prefix, node), relativeCli = path.relative(prefix, cli);
42
+ const privateNode = !path.isAbsolute(relativeNode) && !relativeNode.startsWith(`..${path.sep}`);
43
+ // Expand the native batch directory at run time. Embedding a UTF-8 absolute
44
+ // path in a .cmd file breaks Unicode profiles under legacy console code pages.
45
+ const binary = privateNode ? `%~dp0${relativeNode}` : "node.exe";
46
+ const nodePath = privateNode ? `set "PATH=%~dp0${path.dirname(relativeNode)};%PATH%"\r\n` : "";
47
+ return `@echo off\r\nsetlocal DisableDelayedExpansion\r\nset "CCDX_PRIVATE_INSTALL_PREFIX=%~dp0"\r\n${nodePath}if not defined npm_config_prefix set "npm_config_prefix=%~dp0"\r\n"${binary}" "%~dp0${relativeCli}" %*\r\nexit /b %errorlevel%\r\n`;
48
+ }
49
+
40
50
  export function inspectWindowsCommand({ platform = process.platform,
41
51
  packageRoot = fileURLToPath(new URL("../", import.meta.url)), repair = false, locked = false } = {}) {
42
52
  if (platform !== "win32") return { status: "not_applicable", changed: false };
@@ -58,7 +68,9 @@ export function inspectWindowsCommand({ platform = process.platform,
58
68
  try {
59
69
  if (!fs.lstatSync(cmd).isFile() || fs.statSync(cmd).size > 8192) throw new Error();
60
70
  const batch = fs.readFileSync(cmd, "utf8");
61
- if (!batch.startsWith("@ECHO off") || !batch.includes(`"%dp0%\\${target.replaceAll("/", "\\")}" %*`)) throw new Error();
71
+ const ownedNpm = batch.startsWith("@ECHO off") && batch.includes(`"%dp0%\\${target.replaceAll("/", "\\")}" %*`);
72
+ const ownedPrivate = batch === privateWindowsCommand({ node: process.execPath, cli: path.join(root, "bin", script), prefix });
73
+ if (!ownedNpm && !ownedPrivate) throw new Error();
62
74
  let stat;
63
75
  try { stat = fs.lstatSync(ps1); } catch (error) { if (error.code !== "ENOENT") throw error; }
64
76
  if (!stat) { results.push({ name, status: "ready", changed: false });continue; }