@pi-unipi/utility 2.2.0 → 2.4.0
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.
- package/package.json +2 -2
- package/src/tools/env.ts +1 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/utility",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Utility commands and tools for Pi coding agent — lifecycle, diagnostics, cache, analytics, display, batch execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@pi-unipi/core": "2.
|
|
37
|
+
"@pi-unipi/core": "2.4.0",
|
|
38
38
|
"diff": "^7.0.0",
|
|
39
39
|
"@shikijs/cli": "^4.0.2"
|
|
40
40
|
},
|
package/src/tools/env.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { existsSync, readdirSync } from "node:fs";
|
|
8
8
|
import { join, resolve } from "node:path";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
|
+
import { getPiVersion } from "@pi-unipi/core";
|
|
10
11
|
import type { EnvironmentInfo } from "../types.js";
|
|
11
12
|
|
|
12
13
|
/** Collect environment information */
|
|
@@ -66,28 +67,6 @@ export function getEnvironmentInfo(): EnvironmentInfo {
|
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
/** Try to determine Pi version */
|
|
70
|
-
function getPiVersion(): string {
|
|
71
|
-
try {
|
|
72
|
-
// Try to read from pi's package
|
|
73
|
-
const piPkg = resolve(
|
|
74
|
-
process.cwd(),
|
|
75
|
-
"node_modules",
|
|
76
|
-
"@earendil-works",
|
|
77
|
-
"pi-coding-agent",
|
|
78
|
-
"package.json",
|
|
79
|
-
);
|
|
80
|
-
if (existsSync(piPkg)) {
|
|
81
|
-
const { readFileSync } = require("node:fs");
|
|
82
|
-
const pkg = JSON.parse(readFileSync(piPkg, "utf-8"));
|
|
83
|
-
return pkg.version || "unknown";
|
|
84
|
-
}
|
|
85
|
-
} catch {
|
|
86
|
-
// Best effort
|
|
87
|
-
}
|
|
88
|
-
return "unknown";
|
|
89
|
-
}
|
|
90
|
-
|
|
91
70
|
/** Format environment info as markdown */
|
|
92
71
|
export function formatEnvironmentInfo(info: EnvironmentInfo): string {
|
|
93
72
|
const lines = [
|