@remnic/cli 9.3.556 → 9.3.558

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/dist/index.js +53 -8
  2. package/package.json +22 -22
package/dist/index.js CHANGED
@@ -184,6 +184,7 @@ async function loadWecloneExportModule() {
184
184
  // src/bench-build-freshness.ts
185
185
  import {
186
186
  existsSync,
187
+ lstatSync,
187
188
  readdirSync,
188
189
  readFileSync,
189
190
  statSync
@@ -273,7 +274,10 @@ function newestMtime(roots) {
273
274
  if (!existsSync(entryPath)) {
274
275
  return;
275
276
  }
276
- const stat = statSync(entryPath);
277
+ const stat = lstatSync(entryPath);
278
+ if (stat.isSymbolicLink()) {
279
+ return;
280
+ }
277
281
  if (stat.isDirectory()) {
278
282
  for (const child of readdirSync(entryPath)) {
279
283
  visit(path.join(entryPath, child));
@@ -1983,6 +1987,7 @@ function readVerifiedDaemonPid(options) {
1983
1987
  const readFileSync3 = options.readFileSync ?? fs4.readFileSync;
1984
1988
  const unlinkSync = options.unlinkSync ?? fs4.unlinkSync;
1985
1989
  const processKill = options.processKill ?? process.kill;
1990
+ const platform = options.platform ?? process.platform;
1986
1991
  const execFileSync3 = options.execFileSync ?? ((command, args, execOptions) => childProcess.execFileSync(command, args, execOptions));
1987
1992
  for (const file of options.pidFiles) {
1988
1993
  let pid;
@@ -2001,9 +2006,10 @@ function readVerifiedDaemonPid(options) {
2001
2006
  removePidFileBestEffort(file, unlinkSync);
2002
2007
  continue;
2003
2008
  }
2004
- const command = readProcessCommand(pid, execFileSync3);
2009
+ const command = readProcessCommand(pid, execFileSync3, platform);
2005
2010
  if (command === void 0) {
2006
- return pid;
2011
+ removePidFileBestEffort(file, unlinkSync);
2012
+ continue;
2007
2013
  }
2008
2014
  if (doesProcessCommandLookLikeRemnicDaemon(command, options.expectedServerBin)) {
2009
2015
  return pid;
@@ -2023,7 +2029,13 @@ function parseDaemonPid(raw) {
2023
2029
  const pid = Number(trimmed);
2024
2030
  return Number.isSafeInteger(pid) && pid > 0 ? pid : void 0;
2025
2031
  }
2026
- function readProcessCommand(pid, execFileSync3) {
2032
+ function readProcessCommand(pid, execFileSync3, platform) {
2033
+ if (platform === "win32") {
2034
+ return readWindowsProcessCommand(pid, execFileSync3);
2035
+ }
2036
+ return readPosixProcessCommand(pid, execFileSync3);
2037
+ }
2038
+ function readPosixProcessCommand(pid, execFileSync3) {
2027
2039
  try {
2028
2040
  return execFileSync3("ps", ["-p", String(pid), "-o", "command="], {
2029
2041
  encoding: "utf8",
@@ -2033,6 +2045,39 @@ function readProcessCommand(pid, execFileSync3) {
2033
2045
  return void 0;
2034
2046
  }
2035
2047
  }
2048
+ function readWindowsProcessCommand(pid, execFileSync3) {
2049
+ const powerShellCommand = `$process = Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}"; if ($null -ne $process) { $process.CommandLine }`;
2050
+ for (const command of ["powershell.exe", "powershell", "pwsh"]) {
2051
+ try {
2052
+ const output = execFileSync3(
2053
+ command,
2054
+ ["-NoProfile", "-NonInteractive", "-Command", powerShellCommand],
2055
+ {
2056
+ encoding: "utf8",
2057
+ stdio: "pipe"
2058
+ }
2059
+ );
2060
+ if (output.trim() !== "") {
2061
+ return output;
2062
+ }
2063
+ } catch {
2064
+ }
2065
+ }
2066
+ try {
2067
+ const output = execFileSync3(
2068
+ "wmic",
2069
+ ["process", "where", ["processid", String(pid)].join("="), "get", "CommandLine", "/value"],
2070
+ {
2071
+ encoding: "utf8",
2072
+ stdio: "pipe"
2073
+ }
2074
+ );
2075
+ const match = /^CommandLine=(.*)$/m.exec(output);
2076
+ return match?.[1];
2077
+ } catch {
2078
+ return void 0;
2079
+ }
2080
+ }
2036
2081
  function removePidFileBestEffort(file, unlinkSync) {
2037
2082
  try {
2038
2083
  unlinkSync(file);
@@ -2283,7 +2328,7 @@ import {
2283
2328
  } from "@remnic/core";
2284
2329
 
2285
2330
  // src/import-bundle-detect.ts
2286
- import { lstatSync, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "fs";
2331
+ import { lstatSync as lstatSync2, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "fs";
2287
2332
  import path9 from "path";
2288
2333
  function detectBundleEntries(bundleDir, options = {}) {
2289
2334
  const readdir2 = options.readdirImpl ?? defaultReaddir;
@@ -2292,7 +2337,7 @@ function detectBundleEntries(bundleDir, options = {}) {
2292
2337
  const isRegularFile = options.isRegularFileImpl ?? (options.readdirImpl !== void 0 || options.isDirectoryImpl !== void 0 ? (p) => !isDirectory2(p) : defaultIsRegularFile);
2293
2338
  if (options.readdirImpl === void 0 && options.isDirectoryImpl === void 0) {
2294
2339
  try {
2295
- const rootStat = lstatSync(bundleDir);
2340
+ const rootStat = lstatSync2(bundleDir);
2296
2341
  if (rootStat.isSymbolicLink()) {
2297
2342
  throw new Error(
2298
2343
  `Bundle directory '${bundleDir}' is a symbolic link. Pass the resolved directory path instead.`
@@ -2409,7 +2454,7 @@ function defaultReadFile(p) {
2409
2454
  }
2410
2455
  function defaultIsDirectory(p) {
2411
2456
  try {
2412
- const s = lstatSync(p);
2457
+ const s = lstatSync2(p);
2413
2458
  if (s.isSymbolicLink()) return false;
2414
2459
  return s.isDirectory();
2415
2460
  } catch {
@@ -2418,7 +2463,7 @@ function defaultIsDirectory(p) {
2418
2463
  }
2419
2464
  function defaultIsRegularFile(p) {
2420
2465
  try {
2421
- const s = lstatSync(p);
2466
+ const s = lstatSync2(p);
2422
2467
  if (s.isSymbolicLink()) return false;
2423
2468
  return s.isFile();
2424
2469
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/cli",
3
- "version": "9.3.556",
3
+ "version": "9.3.558",
4
4
  "description": "CLI for Remnic memory — init, query, doctor, daemon management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,20 +26,20 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "yaml": "^2.4.2",
29
- "@remnic/server": "^9.3.556",
30
- "@remnic/plugin-pi": "^9.3.556",
31
- "@remnic/core": "^9.3.556"
29
+ "@remnic/plugin-pi": "^9.3.558",
30
+ "@remnic/core": "^9.3.558",
31
+ "@remnic/server": "^9.3.558"
32
32
  },
33
33
  "peerDependencies": {
34
- "@remnic/bench": "^9.3.556",
35
- "@remnic/export-weclone": "^9.3.556",
36
- "@remnic/import-weclone": "^9.3.556",
37
- "@remnic/import-chatgpt": "^9.3.556",
38
- "@remnic/import-claude": "^9.3.556",
39
- "@remnic/import-gemini": "^9.3.556",
40
- "@remnic/import-lossless-claw": "^9.3.556",
41
- "@remnic/import-mem0": "^9.3.556",
42
- "@remnic/import-supermemory": "^9.3.556"
34
+ "@remnic/bench": "^9.3.558",
35
+ "@remnic/export-weclone": "^9.3.558",
36
+ "@remnic/import-weclone": "^9.3.558",
37
+ "@remnic/import-chatgpt": "^9.3.558",
38
+ "@remnic/import-claude": "^9.3.558",
39
+ "@remnic/import-gemini": "^9.3.558",
40
+ "@remnic/import-lossless-claw": "^9.3.558",
41
+ "@remnic/import-mem0": "^9.3.558",
42
+ "@remnic/import-supermemory": "^9.3.558"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
45
  "@remnic/bench": {
@@ -73,15 +73,15 @@
73
73
  "devDependencies": {
74
74
  "tsup": "^8.5.1",
75
75
  "typescript": "^5.9.3",
76
- "@remnic/bench": "9.3.556",
77
- "@remnic/export-weclone": "9.3.556",
78
- "@remnic/import-weclone": "9.3.556",
79
- "@remnic/import-claude": "9.3.556",
80
- "@remnic/import-gemini": "9.3.556",
81
- "@remnic/import-lossless-claw": "9.3.556",
82
- "@remnic/import-mem0": "9.3.556",
83
- "@remnic/import-chatgpt": "9.3.556",
84
- "@remnic/import-supermemory": "9.3.556"
76
+ "@remnic/bench": "9.3.558",
77
+ "@remnic/export-weclone": "9.3.558",
78
+ "@remnic/import-chatgpt": "9.3.558",
79
+ "@remnic/import-weclone": "9.3.558",
80
+ "@remnic/import-claude": "9.3.558",
81
+ "@remnic/import-gemini": "9.3.558",
82
+ "@remnic/import-lossless-claw": "9.3.558",
83
+ "@remnic/import-supermemory": "9.3.558",
84
+ "@remnic/import-mem0": "9.3.558"
85
85
  },
86
86
  "license": "MIT",
87
87
  "repository": {