codexdb-sdk 0.1.20 → 0.1.23

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/index.js +7 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,6 +1,12 @@
1
1
  const { execFile } = require('child_process');
2
2
  const path = require('path');
3
3
  const fs = require('fs/promises');
4
+ const fsSync = require('fs');
5
+
6
+ function defaultCliPath() {
7
+ const localBinary = path.join(__dirname, 'codex-cli' + (process.platform === 'win32' ? '.exe' : ''));
8
+ return fsSync.existsSync(localBinary) ? localBinary : 'codex-cli';
9
+ }
4
10
 
5
11
  function execCodexCli(cliPath, args, env = {}) {
6
12
  return new Promise((resolve, reject) => {
@@ -37,7 +43,7 @@ class CodexClient {
37
43
  file = path.resolve(process.cwd(), file);
38
44
  }
39
45
 
40
- this.cliPath = options.cliPath || 'codex-cli';
46
+ this.cliPath = options.cliPath || defaultCliPath();
41
47
  this.file = file;
42
48
  this.dataDir = path.dirname(this.file);
43
49
  this.ledger = options.ledger ? '--ledger' : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexdb-sdk",
3
- "version": "0.1.20",
3
+ "version": "0.1.23",
4
4
  "description": "Node.js SDK for CodexDB (wrapper around codex-cli)",
5
5
  "main": "index.js",
6
6
  "scripts": {