nextclaw 0.4.11 → 0.4.12

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/cli/index.js +29 -1
  2. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -83,7 +83,7 @@ import { join, resolve } from "path";
83
83
  import { spawn } from "child_process";
84
84
  import { createServer } from "net";
85
85
  import { fileURLToPath } from "url";
86
- import { getDataDir, getPackageVersion } from "@nextclaw/core";
86
+ import { getDataDir, getPackageVersion as getCorePackageVersion } from "@nextclaw/core";
87
87
  function resolveUiConfig(config, overrides) {
88
88
  const base = config.ui ?? { enabled: false, host: "127.0.0.1", port: 18791, open: false };
89
89
  return { ...base, ...overrides ?? {} };
@@ -234,6 +234,34 @@ function which(binary) {
234
234
  }
235
235
  return false;
236
236
  }
237
+ function resolveVersionFromPackageTree(startDir, expectedName) {
238
+ let current = resolve(startDir);
239
+ while (current.length > 0) {
240
+ const pkgPath = join(current, "package.json");
241
+ if (existsSync(pkgPath)) {
242
+ try {
243
+ const raw = readFileSync(pkgPath, "utf-8");
244
+ const parsed = JSON.parse(raw);
245
+ if (typeof parsed.version === "string") {
246
+ if (!expectedName || parsed.name === expectedName) {
247
+ return parsed.version;
248
+ }
249
+ }
250
+ } catch {
251
+ }
252
+ }
253
+ const parent = resolve(current, "..");
254
+ if (parent === current) {
255
+ break;
256
+ }
257
+ current = parent;
258
+ }
259
+ return null;
260
+ }
261
+ function getPackageVersion() {
262
+ const cliDir = resolve(fileURLToPath(new URL(".", import.meta.url)));
263
+ return resolveVersionFromPackageTree(cliDir, "nextclaw") ?? resolveVersionFromPackageTree(cliDir) ?? getCorePackageVersion();
264
+ }
237
265
  function startUiFrontend(options) {
238
266
  const uiDir = options.dir ?? resolveUiFrontendDir();
239
267
  if (!uiDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "chokidar": "^3.6.0",
40
40
  "commander": "^12.1.0",
41
- "@nextclaw/core": "^0.4.9",
41
+ "@nextclaw/core": "^0.4.10",
42
42
  "@nextclaw/server": "^0.3.5",
43
43
  "@nextclaw/openclaw-compat": "^0.1.2"
44
44
  },