@niq.run/niq 0.1.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/bin/niq.js +46 -0
- package/package.json +27 -0
package/bin/niq.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// niq launcher: forwards to the platform-specific binary installed as an
|
|
3
|
+
// optional dependency (@niq.run/niq-<os>-<arch>).
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const os = require('os');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { spawnSync } = require('child_process');
|
|
10
|
+
|
|
11
|
+
const platform = os.platform();
|
|
12
|
+
const arch = os.arch();
|
|
13
|
+
|
|
14
|
+
// npm arch names match Go except x64 (amd64) and arm64.
|
|
15
|
+
const archMap = { x64: 'x64', arm64: 'arm64' };
|
|
16
|
+
const osMap = { darwin: 'darwin', linux: 'linux', win32: 'win32' };
|
|
17
|
+
|
|
18
|
+
const pkgOs = osMap[platform];
|
|
19
|
+
const pkgArch = archMap[arch];
|
|
20
|
+
if (!pkgOs || !pkgArch) {
|
|
21
|
+
console.error(`niq: unsupported platform ${platform}/${arch}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let subpkg;
|
|
26
|
+
try {
|
|
27
|
+
subpkg = require.resolve(`@niq.run/niq-${pkgOs}-${pkgArch}/package.json`);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.error(
|
|
30
|
+
`niq: binary package @niq.run/niq-${pkgOs}-${pkgArch} is not installed.\n` +
|
|
31
|
+
'Try reinstalling with:\n\n npm install @niq.run/niq --force\n'
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const bin = path.join(path.dirname(subpkg), 'bin', 'niq');
|
|
37
|
+
const binExe = platform === 'win32' ? bin + '.exe' : bin;
|
|
38
|
+
|
|
39
|
+
const result = spawnSync(binExe, process.argv.slice(2), {
|
|
40
|
+
stdio: 'inherit',
|
|
41
|
+
});
|
|
42
|
+
if (result.error) {
|
|
43
|
+
console.error(`niq: failed to launch binary: ${result.error.message}`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@niq.run/niq",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "niq - an AI agent",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/niq-run/niq.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"niq": "./bin/niq.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/"
|
|
15
|
+
],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@niq.run/niq-darwin-arm64": "0.1.0",
|
|
18
|
+
"@niq.run/niq-darwin-x64": "0.1.0",
|
|
19
|
+
"@niq.run/niq-linux-arm64": "0.1.0",
|
|
20
|
+
"@niq.run/niq-linux-x64": "0.1.0",
|
|
21
|
+
"@niq.run/niq-win32-x64": "0.1.0",
|
|
22
|
+
"@niq.run/niq-win32-arm64": "0.1.0"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=14"
|
|
26
|
+
}
|
|
27
|
+
}
|