@ihr360cli/ihr-cli 1.0.28-beta.15

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.
Files changed (3) hide show
  1. package/README.md +47 -0
  2. package/bin/ihr-cli.js +103 -0
  3. package/package.json +43 -0
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @ihr360cli/ihr-cli
2
+
3
+ iHR360 command-line interface.
4
+
5
+ This package installs the `ihr-cli` binary for the current platform. It does
6
+ **not** install Agent Skills.
7
+
8
+ ## Install
9
+
10
+ Beta:
11
+
12
+ ```bash
13
+ npm install -g @ihr360cli/ihr-cli@beta
14
+ ```
15
+
16
+ Pin a version:
17
+
18
+ ```bash
19
+ npm install -g @ihr360cli/ihr-cli@1.0.28-beta.15
20
+ ```
21
+
22
+ ## After install
23
+
24
+ ```bash
25
+ ihr-cli version
26
+ ihr-cli config init --env qa2
27
+ ```
28
+
29
+ If you also need Skills for Codex / Claude / WorkBuddy, use the existing
30
+ installer:
31
+
32
+ ```bash
33
+ curl --http1.1 -fsSL https://cdn-txtoqiniu.ihr360.com/ihr-cli/install-beta.sh | bash -s -- --channel beta --components cli,skills --yes
34
+ ```
35
+
36
+ ## Supported platforms
37
+
38
+ - macOS Intel (`darwin-x64`)
39
+ - macOS Apple Silicon (`darwin-arm64`)
40
+ - Linux x64 (`linux-x64`)
41
+ - Windows x64 (`win32-x64`)
42
+
43
+ Linux ARM64 and Windows ARM64 are not published.
44
+
45
+ ## License
46
+
47
+ UNLICENSED. Internal iHR360 distribution.
package/bin/ihr-cli.js ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("child_process");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+
8
+ const PACKAGE_MAP = {
9
+ "linux-x64": "@ihr360cli/ihr-cli-linux-x64",
10
+ "darwin-x64": "@ihr360cli/ihr-cli-darwin-x64",
11
+ "darwin-arm64": "@ihr360cli/ihr-cli-darwin-arm64",
12
+ "win32-x64": "@ihr360cli/ihr-cli-win32-x64",
13
+ };
14
+
15
+ function platformKey(platform = process.platform, arch = process.arch) {
16
+ return `${platform}-${arch}`;
17
+ }
18
+
19
+ function platformPackageName(platform = process.platform, arch = process.arch) {
20
+ const name = PACKAGE_MAP[platformKey(platform, arch)];
21
+ if (!name) {
22
+ throw new Error(
23
+ `Unsupported platform: ${platform}/${arch}. Supported: ${Object.keys(PACKAGE_MAP).join(", ")}`
24
+ );
25
+ }
26
+ return name;
27
+ }
28
+
29
+ function binaryName(platform = process.platform) {
30
+ return platform === "win32" ? "ihr-cli.exe" : "ihr-cli";
31
+ }
32
+
33
+ function nativePackageCandidates(name, baseDir) {
34
+ const packageRoot = baseDir || path.join(__dirname, "..");
35
+ const scopeDir = path.dirname(packageRoot);
36
+ const shortName = name.split("/")[1];
37
+ return [
38
+ path.join(packageRoot, "node_modules", name),
39
+ path.join(scopeDir, shortName),
40
+ path.join(scopeDir, "..", name),
41
+ ];
42
+ }
43
+
44
+ function resolveBinary(opts = {}) {
45
+ const name = platformPackageName(opts.platform, opts.arch);
46
+ const binFile = binaryName(opts.platform);
47
+ const searchFrom = opts.baseDir || path.join(__dirname, "..");
48
+ const candidates = nativePackageCandidates(name, searchFrom);
49
+ try {
50
+ candidates.push(
51
+ path.dirname(require.resolve(`${name}/package.json`, { paths: [searchFrom] }))
52
+ );
53
+ } catch (error) {
54
+ // optionalDependencies may be hoisted as a scoped sibling; try filesystem paths first.
55
+ }
56
+ for (const pkgRoot of candidates) {
57
+ const bin = path.join(pkgRoot, "bin", binFile);
58
+ if (fs.existsSync(bin)) {
59
+ return bin;
60
+ }
61
+ }
62
+ throw new Error(
63
+ `Missing native package ${name}. Reinstall with: npm install -g @ihr360cli/ihr-cli@beta`
64
+ );
65
+ }
66
+
67
+ function run(argv = process.argv.slice(2), opts = {}) {
68
+ const bin = resolveBinary(opts);
69
+ const result = spawnSync(bin, argv, {
70
+ stdio: "inherit",
71
+ windowsHide: false,
72
+ });
73
+ if (result.error) {
74
+ console.error(result.error.message);
75
+ process.exit(1);
76
+ }
77
+ if (result.signal) {
78
+ try {
79
+ process.kill(process.pid, result.signal);
80
+ } catch (error) {
81
+ process.exit(1);
82
+ }
83
+ return;
84
+ }
85
+ process.exit(result.status === null ? 1 : result.status);
86
+ }
87
+
88
+ module.exports = {
89
+ PACKAGE_MAP,
90
+ platformPackageName,
91
+ binaryName,
92
+ resolveBinary,
93
+ run,
94
+ };
95
+
96
+ if (require.main === module) {
97
+ try {
98
+ run();
99
+ } catch (error) {
100
+ console.error(error.message);
101
+ process.exit(1);
102
+ }
103
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@ihr360cli/ihr-cli",
3
+ "version": "1.0.28-beta.15",
4
+ "description": "iHR360 command-line interface",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "ihr-cli": "bin/ihr-cli.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "README.md"
12
+ ],
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "os": [
17
+ "darwin",
18
+ "linux",
19
+ "win32"
20
+ ],
21
+ "cpu": [
22
+ "x64",
23
+ "arm64"
24
+ ],
25
+ "optionalDependencies": {
26
+ "@ihr360cli/ihr-cli-linux-x64": "1.0.28-beta.15",
27
+ "@ihr360cli/ihr-cli-darwin-x64": "1.0.28-beta.15",
28
+ "@ihr360cli/ihr-cli-darwin-arm64": "1.0.28-beta.15",
29
+ "@ihr360cli/ihr-cli-win32-x64": "1.0.28-beta.15"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+ssh://git@git.ihr360.com/ihr360/ihr-cli.git"
37
+ },
38
+ "keywords": [
39
+ "ihr360",
40
+ "ihr-cli",
41
+ "cli"
42
+ ]
43
+ }