@fclef819/cdx 0.1.6 → 0.1.7

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 (2) hide show
  1. package/bin/cdx.js +12 -22
  2. package/package.json +3 -2
package/bin/cdx.js CHANGED
@@ -166,33 +166,21 @@ function runCodex(args, cwd, verbose) {
166
166
  } catch {
167
167
  // ignore if not supported
168
168
  }
169
- process.stdin.resume();
170
169
  }
171
170
  const result = spawnSync("codex", args, { stdio: "inherit", cwd });
172
171
  if (result.error) {
173
172
  if (result.error.code === "ENOENT" && process.platform === "win32") {
174
- logVerbose("codex not found directly; trying where.exe lookup", verbose);
175
- const whereResult = spawnSync("where.exe", ["codex"], { encoding: "utf8" });
176
- const resolved = whereResult.stdout
177
- ? whereResult.stdout.split(/\r?\n/).find(Boolean)
178
- : null;
179
- if (resolved) {
180
- logVerbose(`Resolved codex path: ${resolved}`, verbose);
181
- let resolvedResult;
182
- if (resolved.toLowerCase().endsWith(".cmd") || resolved.toLowerCase().endsWith(".bat")) {
183
- resolvedResult = spawnSync(
184
- "cmd.exe",
185
- ["/d", "/s", "/c", resolved, ...args],
186
- { stdio: "inherit", cwd }
187
- );
188
- } else {
189
- resolvedResult = spawnSync(resolved, args, { stdio: "inherit", cwd });
190
- }
191
- if (!resolvedResult.error) {
192
- return { status: resolvedResult.status ?? 0 };
193
- }
173
+ logVerbose("codex not found directly; trying cmd.exe /c", verbose);
174
+ const cmdResult = spawnSync(
175
+ "cmd.exe",
176
+ ["/d", "/s", "/c", "codex", ...args],
177
+ { stdio: "inherit", cwd }
178
+ );
179
+ if (!cmdResult.error) {
180
+ if (process.stdin.isTTY) process.stdin.pause();
181
+ return { status: cmdResult.status ?? 0 };
194
182
  }
195
- logVerbose("codex not found via where.exe; trying PowerShell fallback", verbose);
183
+ logVerbose("codex not found via cmd.exe; trying PowerShell fallback", verbose);
196
184
  const psArgs = [
197
185
  "-NoProfile",
198
186
  "-Command",
@@ -203,6 +191,7 @@ function runCodex(args, cwd, verbose) {
203
191
  cwd
204
192
  });
205
193
  if (!psResult.error) {
194
+ if (process.stdin.isTTY) process.stdin.pause();
206
195
  return { status: psResult.status ?? 0 };
207
196
  }
208
197
  }
@@ -211,6 +200,7 @@ function runCodex(args, cwd, verbose) {
211
200
  );
212
201
  process.exit(1);
213
202
  }
203
+ if (process.stdin.isTTY) process.stdin.pause();
214
204
  return { status: result.status ?? 0 };
215
205
  }
216
206
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fclef819/cdx",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Codex session wrapper",
5
5
  "keywords": [
6
6
  "codex",
@@ -17,7 +17,8 @@
17
17
  "README.md"
18
18
  ],
19
19
  "scripts": {
20
- "release": "npm login && npm pack && npm publish --access public"
20
+ "release": "npm login && npm pack && npm publish --access public",
21
+ "gh-release": "gh release create v$npm_package_version --generate-notes"
21
22
  },
22
23
  "engines": {
23
24
  "node": ">=18"