@metaphi-ai/hum 0.1.2

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/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@metaphi-ai/hum",
3
+ "version": "0.1.2",
4
+ "description": "Hum — हम. Human and model, one harness. A coding agent for your terminal.",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "bin": { "hum": "bin/hum.js" },
8
+ "files": ["bin", "dist", "scripts"],
9
+ "scripts": { "postinstall": "node scripts/postinstall.js" },
10
+ "engines": { "node": ">=18" },
11
+ "repository": { "type": "git", "url": "https://github.com/metaphi-labs/hum-cli" }
12
+ }
@@ -0,0 +1,23 @@
1
+ // Make sure the engine is installed: `hum-engine` on PATH (uv tool install hum-cli).
2
+ // Quiet when it already is; installs uv first when it is missing; never fails the npm install.
3
+ import { execSync, spawnSync } from 'node:child_process';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+
7
+ const which = (cmd) => spawnSync(process.platform === 'win32' ? 'where' : 'which', [cmd], { stdio: 'ignore' }).status === 0;
8
+ const local = path.join(os.homedir(), '.local', 'bin');
9
+ const sh = (cmd) => { try { execSync(cmd, { stdio: 'inherit', env: { ...process.env, PATH: `${local}${path.delimiter}${process.env.PATH || ''}` } }); return true; } catch { return false; } };
10
+
11
+ if (which('hum-engine') || spawnSync(path.join(local, 'hum-engine'), ['--help'], { stdio: 'ignore' }).status === 0) {
12
+ process.exit(0);
13
+ }
14
+ console.log('hum: installing the engine (uv tool install hum-cli) …');
15
+ if (!which('uv') && spawnSync(path.join(local, 'uv'), ['--version'], { stdio: 'ignore' }).status !== 0) {
16
+ const ok = process.platform === 'win32'
17
+ ? sh('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"')
18
+ : sh('curl -LsSf https://astral.sh/uv/install.sh | sh');
19
+ if (!ok) { console.log('hum: could not install uv; install it from https://astral.sh/uv then run: uv tool install hum-cli'); process.exit(0); }
20
+ }
21
+ if (!sh('uv tool install --quiet hum-cli')) {
22
+ console.log('hum: engine install failed; run manually: uv tool install hum-cli');
23
+ }