codexdb-sdk 0.1.0 → 0.1.2

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.
@@ -0,0 +1,23 @@
1
+ # GitHub Actions workflow for npm release
2
+ # Triggers on new tags that match v* (e.g., v1.0.0)
3
+
4
+ name: Release Node.js SDK
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - 'v*'
10
+
11
+ jobs:
12
+ publish-npm:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: '18'
19
+ registry-url: 'https://registry.npmjs.org/'
20
+ - run: npm ci
21
+ - run: npm publish
22
+ env:
23
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -31,4 +31,9 @@ client.delete('user:1');
31
31
  ## Requirements
32
32
 
33
33
  - Node.js 14+
34
- - `codex-cli` binary available in your PATH
34
+
35
+ ## codex-cli Binary
36
+
37
+ When you install this package, the correct `codex-cli` binary for your platform will be downloaded automatically from the GitHub releases page. No manual installation is required.
38
+
39
+ If you want to use a custom binary, set the `cliPath` option when creating the client.
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "codexdb-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Node.js SDK for CodexDB (wrapper around codex-cli)",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "node test.js"
7
+ "test": "node test.js",
8
+ "postinstall": "node scripts/postinstall.js"
8
9
  },
9
10
  "keywords": ["codexdb", "sdk", "database"],
10
11
  "license": "MIT"
@@ -0,0 +1,39 @@
1
+ const https = require('https');
2
+ const fs = require('fs');
3
+ const os = require('os');
4
+ const path = require('path');
5
+
6
+ // Map OS/platform to binary URLs
7
+ const BINARIES = {
8
+ darwin: 'https://github.com/evertonmj/codex/releases/latest/download/codex-cli-macos',
9
+ linux: 'https://github.com/evertonmj/codex/releases/latest/download/codex-cli-linux',
10
+ win32: 'https://github.com/evertonmj/codex/releases/latest/download/codex-cli-win.exe'
11
+ };
12
+
13
+ const platform = os.platform();
14
+ const url = BINARIES[platform];
15
+ if (!url) {
16
+ console.error(`No binary available for platform: ${platform}`);
17
+ process.exit(1);
18
+ }
19
+
20
+ const dest = path.join(__dirname, '..', 'codex-cli' + (platform === 'win32' ? '.exe' : ''));
21
+
22
+ console.log(`Downloading codex-cli for ${platform}...`);
23
+
24
+ https.get(url, (res) => {
25
+ if (res.statusCode !== 200) {
26
+ console.error(`Failed to download binary: ${res.statusCode}`);
27
+ process.exit(1);
28
+ }
29
+ const file = fs.createWriteStream(dest, { mode: 0o755 });
30
+ res.pipe(file);
31
+ file.on('finish', () => {
32
+ file.close(() => {
33
+ console.log('codex-cli downloaded to', dest);
34
+ });
35
+ });
36
+ }).on('error', (err) => {
37
+ console.error('Download error:', err);
38
+ process.exit(1);
39
+ });