@askfaro/cli 0.3.0 → 0.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.
|
@@ -6,7 +6,8 @@ const { existsSync } = require("fs");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
|
|
8
8
|
const PYPI_PACKAGE = "askfaro-cli";
|
|
9
|
-
const MIN_VERSION = "0.
|
|
9
|
+
const MIN_VERSION = "0.4.0";
|
|
10
|
+
const BIN_NAME = "askfaro";
|
|
10
11
|
|
|
11
12
|
function parseVersion(s) {
|
|
12
13
|
const m = String(s).match(/(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -32,15 +33,15 @@ function getVersion(bin) {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
function findFaro() {
|
|
35
|
-
// Check if `
|
|
36
|
-
if (getVersion(
|
|
36
|
+
// Check if `askfaro` is already on PATH (e.g. installed via pip/pipx separately)
|
|
37
|
+
if (getVersion(BIN_NAME) !== null) return BIN_NAME;
|
|
37
38
|
|
|
38
39
|
// Check pipx-installed binary
|
|
39
40
|
const pipxBin = path.join(
|
|
40
41
|
process.env.HOME || "",
|
|
41
42
|
".local",
|
|
42
43
|
"bin",
|
|
43
|
-
|
|
44
|
+
BIN_NAME
|
|
44
45
|
);
|
|
45
46
|
if (existsSync(pipxBin)) return pipxBin;
|
|
46
47
|
|
|
@@ -102,7 +103,7 @@ if (!faroBin) {
|
|
|
102
103
|
faroBin = findFaro();
|
|
103
104
|
if (!faroBin) {
|
|
104
105
|
console.error(
|
|
105
|
-
`Installed ${PYPI_PACKAGE} but could not find the '
|
|
106
|
+
`Installed ${PYPI_PACKAGE} but could not find the '${BIN_NAME}' binary on PATH.\n` +
|
|
106
107
|
"You may need to add ~/.local/bin to your PATH:\n" +
|
|
107
108
|
' export PATH="$HOME/.local/bin:$PATH"'
|
|
108
109
|
);
|
|
@@ -119,6 +120,6 @@ if (!faroBin) {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
// Forward all arguments to the real
|
|
123
|
+
// Forward all arguments to the real askfaro binary
|
|
123
124
|
const result = spawnSync(faroBin, process.argv.slice(2), { stdio: "inherit" });
|
|
124
125
|
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askfaro/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Faro AI
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Faro CLI: the tools your AI agent can't run on its own",
|
|
5
5
|
"bin": {
|
|
6
|
-
"
|
|
6
|
+
"askfaro": "./bin/askfaro.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test": "node bin/
|
|
9
|
+
"test": "node bin/askfaro.js --version"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"faro",
|