pgai 0.14.0-dev.67 → 0.14.0-dev.69
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/bin/pgai.ts +7 -9
- package/dist/bin/pgai.js +4 -6
- package/package.json +2 -2
package/bin/pgai.ts
CHANGED
|
@@ -16,17 +16,15 @@ function die(msg: string): never {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
let target: string;
|
|
19
|
+
// isTsFile determines runtime: true = use bun (for .ts), false = use node (for .js)
|
|
20
|
+
let isTsFile = false;
|
|
19
21
|
|
|
20
22
|
// Try to find the postgresai package
|
|
21
23
|
try {
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
target = resolve(
|
|
25
|
-
|
|
26
|
-
// Fallback to source TS if dist doesn't exist (development)
|
|
27
|
-
if (!existsSync(target)) {
|
|
28
|
-
target = resolve(dirname(postgresaiPkg), "bin", "postgres-ai.ts");
|
|
29
|
-
}
|
|
24
|
+
// Resolve the exported "cli" entry point from the postgresai package.
|
|
25
|
+
// This uses the exports field which is the proper way to resolve ESM packages.
|
|
26
|
+
target = require.resolve("postgresai/cli");
|
|
27
|
+
isTsFile = target.endsWith(".ts");
|
|
30
28
|
} catch {
|
|
31
29
|
// Dev-friendly fallback when running from the monorepo checkout (postgresai lives under ../cli).
|
|
32
30
|
const fallbackJs = resolve(__dirname, "..", "..", "cli", "dist", "bin", "postgres-ai.js");
|
|
@@ -36,6 +34,7 @@ try {
|
|
|
36
34
|
target = fallbackJs;
|
|
37
35
|
} else if (existsSync(fallbackTs)) {
|
|
38
36
|
target = fallbackTs;
|
|
37
|
+
isTsFile = true;
|
|
39
38
|
} else {
|
|
40
39
|
die(
|
|
41
40
|
[
|
|
@@ -48,7 +47,6 @@ try {
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
// Determine if we should use node or bun based on the file extension
|
|
51
|
-
const isTsFile = target.endsWith(".ts");
|
|
52
50
|
const runtime = isTsFile ? "bun" : process.execPath;
|
|
53
51
|
|
|
54
52
|
const child = spawn(runtime, [target, ...process.argv.slice(2)], {
|
package/dist/bin/pgai.js
CHANGED
|
@@ -16,12 +16,10 @@ function die(msg) {
|
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
var target;
|
|
19
|
+
var isTsFile = false;
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (!existsSync(target)) {
|
|
23
|
-
target = resolve(dirname(postgresaiPkg), "bin", "postgres-ai.ts");
|
|
24
|
-
}
|
|
21
|
+
target = require2.resolve("postgresai/cli");
|
|
22
|
+
isTsFile = target.endsWith(".ts");
|
|
25
23
|
} catch {
|
|
26
24
|
const fallbackJs = resolve(__dirname2, "..", "..", "cli", "dist", "bin", "postgres-ai.js");
|
|
27
25
|
const fallbackTs = resolve(__dirname2, "..", "..", "cli", "bin", "postgres-ai.ts");
|
|
@@ -29,6 +27,7 @@ try {
|
|
|
29
27
|
target = fallbackJs;
|
|
30
28
|
} else if (existsSync(fallbackTs)) {
|
|
31
29
|
target = fallbackTs;
|
|
30
|
+
isTsFile = true;
|
|
32
31
|
} else {
|
|
33
32
|
die([
|
|
34
33
|
"pgai: failed to locate postgresai package.",
|
|
@@ -38,7 +37,6 @@ try {
|
|
|
38
37
|
`));
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
var isTsFile = target.endsWith(".ts");
|
|
42
40
|
var runtime = isTsFile ? "bun" : process.execPath;
|
|
43
41
|
var child = spawn(runtime, [target, ...process.argv.slice(2)], {
|
|
44
42
|
stdio: "inherit"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgai",
|
|
3
|
-
"version": "0.14.0-dev.
|
|
3
|
+
"version": "0.14.0-dev.69",
|
|
4
4
|
"description": "Thin wrapper for postgresai CLI (provides `npx pgai ...` or `bunx pgai ...`)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"private": false,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"prepublishOnly": "npm run build"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"postgresai": "0.14.0-dev.
|
|
27
|
+
"postgresai": "0.14.0-dev.69"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/bun": "^1.1.14"
|