pgai 0.14.0-dev.15 → 0.14.0-dev.20
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/README.md +21 -0
- package/bin/pgai.js +16 -9
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# pgai
|
|
2
|
+
|
|
3
|
+
`pgai` is a thin wrapper around the [`postgresai`](../cli/README.md) CLI, intended to provide a short command name.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Run without installing:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx pgai --help
|
|
11
|
+
npx pgai init postgresql://admin@host:5432/dbname
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This is equivalent to:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx postgresai --help
|
|
18
|
+
npx postgresai init postgresql://admin@host:5432/dbname
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
package/bin/pgai.js
CHANGED
|
@@ -2,24 +2,31 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
const { spawn } = require("node:child_process");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const fs = require("node:fs");
|
|
5
7
|
|
|
6
8
|
function die(msg) {
|
|
7
9
|
process.stderr.write(`${msg}\n`);
|
|
8
|
-
process.
|
|
10
|
+
process.exit(1);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
let target;
|
|
12
14
|
try {
|
|
13
15
|
target = require.resolve("postgresai/dist/bin/postgres-ai.js");
|
|
14
16
|
} catch (e) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
// Dev-friendly fallback when running from the monorepo checkout (postgresai lives under ../cli).
|
|
18
|
+
const fallback = path.resolve(__dirname, "..", "..", "cli", "dist", "bin", "postgres-ai.js");
|
|
19
|
+
if (fs.existsSync(fallback)) {
|
|
20
|
+
target = fallback;
|
|
21
|
+
} else {
|
|
22
|
+
die(
|
|
23
|
+
[
|
|
24
|
+
"pgai: failed to locate postgresai package.",
|
|
25
|
+
"",
|
|
26
|
+
"This wrapper expects postgresai to be installed as a dependency.",
|
|
27
|
+
].join("\n")
|
|
28
|
+
);
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
const child = spawn(process.execPath, [target, ...process.argv.slice(2)], {
|
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.20",
|
|
4
4
|
"description": "Thin wrapper for postgresai CLI (provides `npx pgai ...`)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"private": false,
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"node": ">=18"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"postgresai": "0.14.0-dev.
|
|
23
|
+
"postgresai": "0.14.0-dev.20"
|
|
24
24
|
}
|
|
25
25
|
}
|