shennian 0.2.7 → 0.2.8

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.
@@ -33,6 +33,7 @@ type UpgradeAttempt = {
33
33
  attemptAt: number;
34
34
  };
35
35
  export declare function getCurrentVersion(): string;
36
+ export declare function findPackageJson(startFilePath?: string): string | null;
36
37
  export declare function fetchLatestVersion(): Promise<string>;
37
38
  /**
38
39
  * Compare semver strings. Returns:
@@ -3,6 +3,7 @@ import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { execSync, exec as execCb } from 'node:child_process';
5
5
  import { promisify } from 'node:util';
6
+ import { fileURLToPath } from 'node:url';
6
7
  import { getShennianDir, resolveShennianPath } from '../config/index.js';
7
8
  const exec = promisify(execCb);
8
9
  const SHENNIAN_DIR = getShennianDir();
@@ -22,9 +23,9 @@ export function getCurrentVersion() {
22
23
  catch { /* noop */ }
23
24
  return '0.0.0';
24
25
  }
25
- function findPackageJson() {
26
+ export function findPackageJson(startFilePath = fileURLToPath(import.meta.url)) {
26
27
  // Walk up from this file's location to find package.json
27
- let dir = path.dirname(new URL(import.meta.url).pathname);
28
+ let dir = path.dirname(startFilePath);
28
29
  for (let i = 0; i < 6; i++) {
29
30
  const candidate = path.join(dir, 'package.json');
30
31
  if (fs.existsSync(candidate)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shennian",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Shennian — AI Agent Mobile Console CLI",
5
5
  "type": "module",
6
6
  "bin": {