agentics-cli 0.1.4

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/run.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'child_process';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
6
+ import { existsSync } from 'fs';
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+
10
+ function getPlatform() {
11
+ const platform = process.platform;
12
+ const arch = process.arch;
13
+
14
+ let os;
15
+ switch (platform) {
16
+ case 'darwin':
17
+ os = 'darwin';
18
+ break;
19
+ case 'linux':
20
+ os = 'linux';
21
+ break;
22
+ case 'win32':
23
+ os = 'windows';
24
+ break;
25
+ default:
26
+ throw new Error(`Unsupported platform: ${platform}`);
27
+ }
28
+
29
+ let cpu;
30
+ switch (arch) {
31
+ case 'x64':
32
+ cpu = 'amd64';
33
+ break;
34
+ case 'arm64':
35
+ cpu = 'arm64';
36
+ break;
37
+ default:
38
+ throw new Error(`Unsupported architecture: ${arch}`);
39
+ }
40
+
41
+ return { os, cpu };
42
+ }
43
+
44
+ function getBinaryName() {
45
+ const { os, cpu } = getPlatform();
46
+ const ext = os === 'windows' ? '.exe' : '';
47
+ return `AgenticsInference-${os}-${cpu}${ext}`;
48
+ }
49
+
50
+ function run() {
51
+ const binaryName = getBinaryName();
52
+ const binaryPath = join(__dirname, binaryName);
53
+
54
+ if (!existsSync(binaryPath)) {
55
+ console.error(`Binary not found: ${binaryPath}`);
56
+ console.error('Please reinstall the package: npm install -g @agentics/inference');
57
+ process.exit(1);
58
+ }
59
+
60
+ const child = spawn(binaryPath, process.argv.slice(2), {
61
+ stdio: 'inherit',
62
+ env: process.env
63
+ });
64
+
65
+ child.on('error', (err) => {
66
+ console.error(`Failed to start: ${err.message}`);
67
+ process.exit(1);
68
+ });
69
+
70
+ child.on('exit', (code) => {
71
+ process.exit(code ?? 0);
72
+ });
73
+ }
74
+
75
+ run();
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "agentics-cli",
3
+ "version": "0.1.4",
4
+ "description": "Agentics Inference CLI - AI-powered terminal interface with multi-model support",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://gitlab.com/agentics-ai/agentics-cli.git"
10
+ },
11
+ "homepage": "https://agentics.co.za",
12
+ "author": "Agentics <connor@agentics.co.za>",
13
+ "keywords": [
14
+ "ai",
15
+ "cli",
16
+ "inference",
17
+ "agentics",
18
+ "llm",
19
+ "openai",
20
+ "anthropic",
21
+ "terminal",
22
+ "chat",
23
+ "agent",
24
+ "tts",
25
+ "stt",
26
+ "voice"
27
+ ],
28
+ "bin": {
29
+ "agentics-cli": "bin/run.js",
30
+ "ai": "bin/run.js"
31
+ },
32
+ "files": [
33
+ "bin",
34
+ "scripts"
35
+ ],
36
+ "scripts": {
37
+ "postinstall": "node scripts/postinstall.js"
38
+ },
39
+ "os": [
40
+ "darwin",
41
+ "linux",
42
+ "win32"
43
+ ],
44
+ "cpu": [
45
+ "x64",
46
+ "arm64"
47
+ ],
48
+ "engines": {
49
+ "node": ">=16"
50
+ }
51
+ }
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { chmod } from 'fs/promises';
4
+ import { existsSync } from 'fs';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'path';
7
+ import { execSync } from 'child_process';
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const binDir = join(__dirname, '..', 'bin');
11
+
12
+ async function postinstall() {
13
+ const unpackScript = join(binDir, 'unpack.sh');
14
+ if (existsSync(unpackScript)) {
15
+ try {
16
+ execSync(`bash "${unpackScript}"`, { stdio: 'inherit' });
17
+ } catch (err) {
18
+ }
19
+ }
20
+
21
+ const binaries = [
22
+ 'AgenticsInference-windows-amd64.exe',
23
+ 'AgenticsInference-windows-arm64.exe',
24
+ 'AgenticsInference-darwin-amd64',
25
+ 'AgenticsInference-darwin-arm64',
26
+ 'AgenticsInference-linux-amd64',
27
+ 'AgenticsInference-linux-arm64'
28
+ ];
29
+
30
+ for (const binary of binaries) {
31
+ const binaryPath = join(binDir, binary);
32
+ if (existsSync(binaryPath)) {
33
+ try {
34
+ await chmod(binaryPath, 0o755);
35
+ } catch (err) {
36
+ }
37
+ }
38
+ }
39
+
40
+ console.log('⚡ Agentics Inference CLI installed successfully!');
41
+ console.log(' Run "agentics-inference" or "ai" to get started.');
42
+ }
43
+
44
+ postinstall().catch(console.error);