@nozomioai/nia 0.0.7 → 0.0.9
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 +4 -0
- package/bin/nia.js +113 -0
- package/package.json +9 -8
- package/bin/nia +0 -65
- package/bin/nia.cmd +0 -45
package/README.md
CHANGED
package/bin/nia.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Auto-generated by crust build --package -- do not edit
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { chmodSync, existsSync } from "node:fs";
|
|
5
|
+
import { dirname, resolve } from "node:path";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const PLATFORMS = {
|
|
10
|
+
"linux-x64": {
|
|
11
|
+
"packagePathSegment": "nia-linux-x64",
|
|
12
|
+
"packageName": "@nozomioai/nia-linux-x64",
|
|
13
|
+
"binaryFilename": "nia-bun-linux-x64-baseline"
|
|
14
|
+
},
|
|
15
|
+
"linux-arm64": {
|
|
16
|
+
"packagePathSegment": "nia-linux-arm64",
|
|
17
|
+
"packageName": "@nozomioai/nia-linux-arm64",
|
|
18
|
+
"binaryFilename": "nia-bun-linux-arm64"
|
|
19
|
+
},
|
|
20
|
+
"darwin-x64": {
|
|
21
|
+
"packagePathSegment": "nia-darwin-x64",
|
|
22
|
+
"packageName": "@nozomioai/nia-darwin-x64",
|
|
23
|
+
"binaryFilename": "nia-bun-darwin-x64"
|
|
24
|
+
},
|
|
25
|
+
"darwin-arm64": {
|
|
26
|
+
"packagePathSegment": "nia-darwin-arm64",
|
|
27
|
+
"packageName": "@nozomioai/nia-darwin-arm64",
|
|
28
|
+
"binaryFilename": "nia-bun-darwin-arm64"
|
|
29
|
+
},
|
|
30
|
+
"win32-x64": {
|
|
31
|
+
"packagePathSegment": "nia-windows-x64",
|
|
32
|
+
"packageName": "@nozomioai/nia-windows-x64",
|
|
33
|
+
"binaryFilename": "nia-bun-windows-x64-baseline.exe"
|
|
34
|
+
},
|
|
35
|
+
"win32-arm64": {
|
|
36
|
+
"packagePathSegment": "nia-windows-arm64",
|
|
37
|
+
"packageName": "@nozomioai/nia-windows-arm64",
|
|
38
|
+
"binaryFilename": "nia-bun-windows-arm64.exe"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
43
|
+
const target = PLATFORMS[platformKey];
|
|
44
|
+
|
|
45
|
+
if (!target) {
|
|
46
|
+
console.error("[nia] Unsupported platform: " + platformKey);
|
|
47
|
+
console.error("[nia] Supported platforms: linux-x64, linux-arm64, darwin-x64, darwin-arm64, windows-x64, windows-arm64");
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const candidateOne = resolve(
|
|
52
|
+
dir,
|
|
53
|
+
"..",
|
|
54
|
+
"..",
|
|
55
|
+
target.packagePathSegment,
|
|
56
|
+
"bin",
|
|
57
|
+
target.binaryFilename,
|
|
58
|
+
);
|
|
59
|
+
const candidateTwo = resolve(
|
|
60
|
+
dir,
|
|
61
|
+
"..",
|
|
62
|
+
"node_modules",
|
|
63
|
+
target.packageName,
|
|
64
|
+
"bin",
|
|
65
|
+
target.binaryFilename,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const binPath = existsSync(candidateOne)
|
|
69
|
+
? candidateOne
|
|
70
|
+
: existsSync(candidateTwo)
|
|
71
|
+
? candidateTwo
|
|
72
|
+
: null;
|
|
73
|
+
|
|
74
|
+
if (!binPath) {
|
|
75
|
+
console.error("[nia] Missing platform package for " + platformKey);
|
|
76
|
+
console.error("[nia] Tried:");
|
|
77
|
+
console.error(" " + candidateOne);
|
|
78
|
+
console.error(" " + candidateTwo);
|
|
79
|
+
console.error(
|
|
80
|
+
"[nia] Reinstall dependencies on this platform and ensure optional dependencies are enabled.",
|
|
81
|
+
);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (process.platform !== "win32") {
|
|
86
|
+
try {
|
|
87
|
+
chmodSync(binPath, 0o755);
|
|
88
|
+
} catch {
|
|
89
|
+
// Ignore permission adjustment failures and let spawn surface real errors.
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
94
|
+
stdio: "inherit",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
child.on("error", (error) => {
|
|
98
|
+
console.error("[nia] Failed to launch binary: " + error.message);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
child.on("exit", (code, signal) => {
|
|
103
|
+
if (signal) {
|
|
104
|
+
try {
|
|
105
|
+
process.kill(process.pid, signal);
|
|
106
|
+
} catch {
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
process.exit(code ?? 0);
|
|
113
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nozomioai/nia",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "CLI for the Nia — search code, docs, and research from the terminal",
|
|
5
|
+
"license": "Apache-2.0",
|
|
5
6
|
"homepage": "https://github.com/nozomio-labs/nia-cli#readme",
|
|
6
7
|
"bugs": {
|
|
7
8
|
"url": "https://github.com/nozomio-labs/nia-cli/issues"
|
|
@@ -24,14 +25,14 @@
|
|
|
24
25
|
"bin"
|
|
25
26
|
],
|
|
26
27
|
"bin": {
|
|
27
|
-
"nia": "bin/nia"
|
|
28
|
+
"nia": "bin/nia.js"
|
|
28
29
|
},
|
|
29
30
|
"optionalDependencies": {
|
|
30
|
-
"@nozomioai/nia-linux-x64": "0.0.
|
|
31
|
-
"@nozomioai/nia-linux-arm64": "0.0.
|
|
32
|
-
"@nozomioai/nia-darwin-x64": "0.0.
|
|
33
|
-
"@nozomioai/nia-darwin-arm64": "0.0.
|
|
34
|
-
"@nozomioai/nia-windows-x64": "0.0.
|
|
35
|
-
"@nozomioai/nia-windows-arm64": "0.0.
|
|
31
|
+
"@nozomioai/nia-linux-x64": "0.0.9",
|
|
32
|
+
"@nozomioai/nia-linux-arm64": "0.0.9",
|
|
33
|
+
"@nozomioai/nia-darwin-x64": "0.0.9",
|
|
34
|
+
"@nozomioai/nia-darwin-arm64": "0.0.9",
|
|
35
|
+
"@nozomioai/nia-windows-x64": "0.0.9",
|
|
36
|
+
"@nozomioai/nia-windows-arm64": "0.0.9"
|
|
36
37
|
}
|
|
37
38
|
}
|
package/bin/nia
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Auto-generated by crust build --package -- do not edit
|
|
3
|
-
set -e
|
|
4
|
-
|
|
5
|
-
source="$0"
|
|
6
|
-
while [ -L "$source" ]; do
|
|
7
|
-
link_dir="$(cd "$(dirname "$source")" && pwd)"
|
|
8
|
-
source="$(readlink "$source")"
|
|
9
|
-
case "$source" in
|
|
10
|
-
/*) ;;
|
|
11
|
-
*) source="$link_dir/$source" ;;
|
|
12
|
-
esac
|
|
13
|
-
done
|
|
14
|
-
|
|
15
|
-
dir="$(cd "$(dirname "$source")" && pwd)"
|
|
16
|
-
platform="$(uname -s)-$(uname -m)"
|
|
17
|
-
platform_pkg=""
|
|
18
|
-
fallback_pkg=""
|
|
19
|
-
binary=""
|
|
20
|
-
|
|
21
|
-
case "$platform" in
|
|
22
|
-
Linux-x86_64)
|
|
23
|
-
platform_pkg="nia-linux-x64"
|
|
24
|
-
fallback_pkg="@nozomioai/nia-linux-x64"
|
|
25
|
-
binary="nia-bun-linux-x64-baseline"
|
|
26
|
-
;;
|
|
27
|
-
Linux-aarch64)
|
|
28
|
-
platform_pkg="nia-linux-arm64"
|
|
29
|
-
fallback_pkg="@nozomioai/nia-linux-arm64"
|
|
30
|
-
binary="nia-bun-linux-arm64"
|
|
31
|
-
;;
|
|
32
|
-
Darwin-x86_64)
|
|
33
|
-
platform_pkg="nia-darwin-x64"
|
|
34
|
-
fallback_pkg="@nozomioai/nia-darwin-x64"
|
|
35
|
-
binary="nia-bun-darwin-x64"
|
|
36
|
-
;;
|
|
37
|
-
Darwin-arm64)
|
|
38
|
-
platform_pkg="nia-darwin-arm64"
|
|
39
|
-
fallback_pkg="@nozomioai/nia-darwin-arm64"
|
|
40
|
-
binary="nia-bun-darwin-arm64"
|
|
41
|
-
;;
|
|
42
|
-
*)
|
|
43
|
-
echo "[nia] Unsupported platform: $platform" >&2
|
|
44
|
-
echo "[nia] Supported platforms: linux-x64, linux-arm64, darwin-x64, darwin-arm64" >&2
|
|
45
|
-
exit 1
|
|
46
|
-
;;
|
|
47
|
-
esac
|
|
48
|
-
|
|
49
|
-
candidate_one="$dir/../../$platform_pkg/bin/$binary"
|
|
50
|
-
candidate_two="$dir/../node_modules/$fallback_pkg/bin/$binary"
|
|
51
|
-
|
|
52
|
-
if [ -f "$candidate_one" ]; then
|
|
53
|
-
exec "$candidate_one" "$@"
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
if [ -f "$candidate_two" ]; then
|
|
57
|
-
exec "$candidate_two" "$@"
|
|
58
|
-
fi
|
|
59
|
-
|
|
60
|
-
echo "[nia] Missing platform package for $platform" >&2
|
|
61
|
-
echo "[nia] Tried:" >&2
|
|
62
|
-
echo " $candidate_one" >&2
|
|
63
|
-
echo " $candidate_two" >&2
|
|
64
|
-
echo "[nia] Reinstall dependencies on this platform and ensure optional dependencies are enabled." >&2
|
|
65
|
-
exit 1
|
package/bin/nia.cmd
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
rem Auto-generated by crust build --package -- do not edit
|
|
3
|
-
setlocal
|
|
4
|
-
set "dir=%~dp0"
|
|
5
|
-
set "host_arch=%PROCESSOR_ARCHITECTURE%"
|
|
6
|
-
set "pkg_segment="
|
|
7
|
-
set "fallback_pkg="
|
|
8
|
-
set "binary="
|
|
9
|
-
|
|
10
|
-
if /I "%PROCESSOR_ARCHITEW6432%"=="ARM64" set "host_arch=ARM64"
|
|
11
|
-
|
|
12
|
-
if /I "%host_arch%"=="AMD64" (
|
|
13
|
-
set "pkg_segment=nia-windows-x64"
|
|
14
|
-
set "fallback_pkg=@nozomioai\nia-windows-x64"
|
|
15
|
-
set "binary=nia-bun-windows-x64-baseline.exe"
|
|
16
|
-
)
|
|
17
|
-
if /I "%host_arch%"=="ARM64" (
|
|
18
|
-
set "pkg_segment=nia-windows-arm64"
|
|
19
|
-
set "fallback_pkg=@nozomioai\nia-windows-arm64"
|
|
20
|
-
set "binary=nia-bun-windows-arm64.exe"
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
if "%binary%"=="" (
|
|
24
|
-
echo [nia] Unsupported Windows architecture: %host_arch% >&2
|
|
25
|
-
exit /b 1
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
set "candidate_one=%dir%..\..\%pkg_segment%\bin\%binary%"
|
|
29
|
-
set "candidate_two=%dir%..\node_modules\%fallback_pkg%\bin\%binary%"
|
|
30
|
-
|
|
31
|
-
if exist "%candidate_one%" (
|
|
32
|
-
"%candidate_one%" %*
|
|
33
|
-
exit /b %ERRORLEVEL%
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
if exist "%candidate_two%" (
|
|
37
|
-
"%candidate_two%" %*
|
|
38
|
-
exit /b %ERRORLEVEL%
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
echo [nia] Missing platform package for Windows %host_arch% >&2
|
|
42
|
-
echo [nia] Tried: %candidate_one% >&2
|
|
43
|
-
echo [nia] Tried: %candidate_two% >&2
|
|
44
|
-
echo [nia] Reinstall dependencies on this platform and ensure optional dependencies are enabled. >&2
|
|
45
|
-
exit /b 1
|