ocx-cursor 0.3.0 → 0.3.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.
@@ -112,7 +112,7 @@ async function main() {
112
112
  }
113
113
  if (command === "update") {
114
114
  process.stdout.write("Updating OpenCodex Cursor Bridge from npm...\n");
115
- updateService();
115
+ await updateService();
116
116
  return;
117
117
  }
118
118
  if (command === "sync") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocx-cursor",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "OpenCodex companion service for Cursor custom models",
5
5
  "keywords": [
6
6
  "opencodex",
package/src/install.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { execFileSync } from "node:child_process";
2
2
  import { randomBytes } from "node:crypto";
3
- import { access, chmod, copyFile, cp, lstat, mkdir, readFile, readlink, rename, rm, symlink, writeFile } from "node:fs/promises";
3
+ import { access, chmod, copyFile, cp, lstat, mkdir, mkdtemp, readFile, readlink, rename, rm, symlink, writeFile } from "node:fs/promises";
4
+ import { tmpdir } from "node:os";
4
5
  import { dirname, join, resolve } from "node:path";
5
6
  import { fileURLToPath } from "node:url";
6
7
  import {
@@ -176,16 +177,22 @@ export async function installService() {
176
177
  return { installRoot, launchAgentFile, cliLinkFile, secretStatus };
177
178
  }
178
179
 
179
- export function updateService(options = {}) {
180
+ export async function updateService(options = {}) {
180
181
  const execute = options.execFileSync || execFileSync;
181
- execute(options.npmCommand || "npm", [
182
- "exec",
183
- "--yes",
184
- "--package=ocx-cursor@latest",
185
- "--",
186
- "ocx-cursor",
187
- "install",
188
- ], { stdio: "inherit" });
182
+ const ownsTemporaryDirectory = !options.temporaryDirectory;
183
+ const temporaryDirectory = options.temporaryDirectory || await mkdtemp(join(tmpdir(), "ocx-cursor-update-"));
184
+ try {
185
+ execute(options.npmCommand || "npm", [
186
+ "exec",
187
+ "--yes",
188
+ "--package=ocx-cursor@latest",
189
+ "--",
190
+ "ocx-cursor",
191
+ "install",
192
+ ], { cwd: temporaryDirectory, stdio: "inherit" });
193
+ } finally {
194
+ if (ownsTemporaryDirectory) await rm(temporaryDirectory, { recursive: true, force: true });
195
+ }
189
196
  }
190
197
 
191
198
  export async function uninstallService() {