@ihr360cli-v2/ihr-cli 0.0.0-stage → 1.0.46

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 CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # @ihr360cli-v2/ihr-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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-v2/ihr-cli@beta
14
+ ```
15
+
16
+ Pin a version:
17
+
18
+ ```bash
19
+ npm install -g @ihr360cli-v2/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
+ - Linux ARM64 (`linux-arm64`)
42
+ - Windows x64 (`win32-x64`)
43
+
44
+ Windows ARM64 is not published.
45
+
46
+ ## License
47
+
48
+ UNLICENSED. Internal iHR360 distribution.
49
+
50
+ ## After install
51
+
52
+ `npm install -g` ships the CLI only. Then run:
53
+
54
+ ```bash
55
+ ihr-cli skill setup --yes
56
+ ```
57
+
58
+ Or install both in one step:
59
+
60
+ ```bash
61
+ npx @ihr360cli-v2/ihr-cli@latest install --yes
62
+ ```
package/bin/ihr-cli.js ADDED
@@ -0,0 +1,141 @@
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 DEFAULT_ROOT_PACKAGE_NAME = "@ihr360cli-v2/ihr-cli";
9
+
10
+ function rootPackageName() {
11
+ try {
12
+ const manifest = require("../package.json");
13
+ const name = String(manifest.name || "").trim();
14
+ if (/^@[a-z0-9][a-z0-9._-]*\/ihr-cli$/.test(name)) return name;
15
+ } catch (error) {
16
+ // The source template has no package.json next to it; keep the official default.
17
+ }
18
+ return DEFAULT_ROOT_PACKAGE_NAME;
19
+ }
20
+
21
+ const ROOT_PACKAGE_NAME = rootPackageName();
22
+ const PACKAGE_SCOPE = ROOT_PACKAGE_NAME.slice(0, ROOT_PACKAGE_NAME.indexOf("/"));
23
+
24
+ const PACKAGE_MAP = {
25
+ "linux-x64": `${PACKAGE_SCOPE}/ihr-cli-linux-x64`,
26
+ "linux-arm64": `${PACKAGE_SCOPE}/ihr-cli-linux-arm64`,
27
+ "darwin-x64": `${PACKAGE_SCOPE}/ihr-cli-darwin-x64`,
28
+ "darwin-arm64": `${PACKAGE_SCOPE}/ihr-cli-darwin-arm64`,
29
+ "win32-x64": `${PACKAGE_SCOPE}/ihr-cli-win32-x64`,
30
+ };
31
+
32
+ function platformKey(platform = process.platform, arch = process.arch) {
33
+ return `${platform}-${arch}`;
34
+ }
35
+
36
+ function platformPackageName(platform = process.platform, arch = process.arch) {
37
+ const name = PACKAGE_MAP[platformKey(platform, arch)];
38
+ if (!name) {
39
+ throw new Error(
40
+ `Unsupported platform: ${platform}/${arch}. Supported: ${Object.keys(PACKAGE_MAP).join(", ")}`
41
+ );
42
+ }
43
+ return name;
44
+ }
45
+
46
+ function binaryName(platform = process.platform) {
47
+ return platform === "win32" ? "ihr-cli.exe" : "ihr-cli";
48
+ }
49
+
50
+ function packageVersion() {
51
+ try {
52
+ const manifest = require("../package.json");
53
+ return String(manifest.version || "").trim();
54
+ } catch (error) {
55
+ return "";
56
+ }
57
+ }
58
+
59
+ function missingNativeMessage(name) {
60
+ const version = packageVersion();
61
+ const spec = version ? `${ROOT_PACKAGE_NAME}@${version}` : ROOT_PACKAGE_NAME;
62
+ const pkg = version ? `${name}@${version}` : name;
63
+ return (
64
+ `Missing native package ${pkg}. ` +
65
+ "npm skipped this optional package, leaving a broken install that will not self-heal. " +
66
+ `Reinstall the same version: npm install -g ${spec}`
67
+ );
68
+ }
69
+
70
+ function nativePackageCandidates(name, baseDir) {
71
+ const packageRoot = baseDir || path.join(__dirname, "..");
72
+ const scopeDir = path.dirname(packageRoot);
73
+ const shortName = name.split("/")[1];
74
+ return [
75
+ path.join(packageRoot, "node_modules", name),
76
+ path.join(scopeDir, shortName),
77
+ path.join(scopeDir, "..", name),
78
+ ];
79
+ }
80
+
81
+ function resolveBinary(opts = {}) {
82
+ const name = platformPackageName(opts.platform, opts.arch);
83
+ const binFile = binaryName(opts.platform);
84
+ const searchFrom = opts.baseDir || path.join(__dirname, "..");
85
+ const candidates = nativePackageCandidates(name, searchFrom);
86
+ try {
87
+ candidates.push(
88
+ path.dirname(require.resolve(`${name}/package.json`, { paths: [searchFrom] }))
89
+ );
90
+ } catch (error) {
91
+ // optionalDependencies may be hoisted as a scoped sibling; try filesystem paths first.
92
+ }
93
+ for (const pkgRoot of candidates) {
94
+ const bin = path.join(pkgRoot, "bin", binFile);
95
+ if (fs.existsSync(bin)) {
96
+ return bin;
97
+ }
98
+ }
99
+ throw new Error(missingNativeMessage(name));
100
+ }
101
+
102
+ function run(argv = process.argv.slice(2), opts = {}) {
103
+ const bin = resolveBinary(opts);
104
+ const result = spawnSync(bin, argv, {
105
+ stdio: "inherit",
106
+ windowsHide: false,
107
+ });
108
+ if (result.error) {
109
+ console.error(result.error.message);
110
+ process.exit(1);
111
+ }
112
+ if (result.signal) {
113
+ try {
114
+ process.kill(process.pid, result.signal);
115
+ } catch (error) {
116
+ process.exit(1);
117
+ }
118
+ return;
119
+ }
120
+ process.exit(result.status === null ? 1 : result.status);
121
+ }
122
+
123
+ module.exports = {
124
+ PACKAGE_MAP,
125
+ ROOT_PACKAGE_NAME,
126
+ platformPackageName,
127
+ binaryName,
128
+ packageVersion,
129
+ missingNativeMessage,
130
+ resolveBinary,
131
+ run,
132
+ };
133
+
134
+ if (require.main === module) {
135
+ try {
136
+ run();
137
+ } catch (error) {
138
+ console.error(error.message);
139
+ process.exit(1);
140
+ }
141
+ }
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@ihr360cli-v2/ihr-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.46",
4
+ "description": "iHR360 command-line interface",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "ihr-cli": "bin/ihr-cli.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "scripts/",
12
+ "README.md"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "os": [
18
+ "darwin",
19
+ "linux",
20
+ "win32"
21
+ ],
22
+ "cpu": [
23
+ "x64",
24
+ "arm64"
25
+ ],
26
+ "optionalDependencies": {
27
+ "@ihr360cli-v2/ihr-cli-linux-x64": "1.0.46",
28
+ "@ihr360cli-v2/ihr-cli-linux-arm64": "1.0.46",
29
+ "@ihr360cli-v2/ihr-cli-darwin-x64": "1.0.46",
30
+ "@ihr360cli-v2/ihr-cli-darwin-arm64": "1.0.46",
31
+ "@ihr360cli-v2/ihr-cli-win32-x64": "1.0.46"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+ssh://git@git.ihr360.com/ihr360/ihr-cli.git"
39
+ },
40
+ "keywords": [
41
+ "ihr360",
42
+ "ihr-cli",
43
+ "cli"
44
+ ],
45
+ "scripts": {
46
+ "postinstall": "node scripts/postinstall.js"
47
+ }
48
+ }
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { resolveBinary } = require("../bin/ihr-cli.js");
5
+
6
+ try {
7
+ resolveBinary();
8
+ } catch (error) {
9
+ console.error(error.message);
10
+ process.exit(1);
11
+ }