@msawake/helioscode 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.
Files changed (2) hide show
  1. package/bin/hc.js +81 -0
  2. package/package.json +26 -0
package/bin/hc.js ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ // hc.js — runtime shim for @msawake/helioscode
3
+ //
4
+ // Resolves the correct platform package, then spawns the pre-compiled binary
5
+ // with the user's arguments. Follows the same pattern as esbuild and @swc/core.
6
+ //
7
+ // The binary inside each platform package lives at:
8
+ // bin/hc (POSIX)
9
+ // bin/hc.exe (Windows)
10
+
11
+ 'use strict';
12
+
13
+ const { spawnSync } = require('child_process');
14
+ const path = require('path');
15
+
16
+ // ---------------------------------------------------------------------------
17
+ // Platform → package mapping
18
+ // ---------------------------------------------------------------------------
19
+ const PLATFORM_MAP = {
20
+ 'darwin-arm64': { pkg: '@msawake/helioscode-darwin-arm64', bin: 'bin/hc' },
21
+ 'darwin-x64': { pkg: '@msawake/helioscode-darwin-x64', bin: 'bin/hc' },
22
+ 'linux-x64': { pkg: '@msawake/helioscode-linux-x64', bin: 'bin/hc' },
23
+ 'linux-arm64': { pkg: '@msawake/helioscode-linux-arm64', bin: 'bin/hc' },
24
+ 'win32-x64': { pkg: '@msawake/helioscode-win32-x64', bin: 'bin/hc.exe' },
25
+ };
26
+
27
+ const key = `${process.platform}-${process.arch}`;
28
+ const entry = PLATFORM_MAP[key];
29
+
30
+ if (!entry) {
31
+ process.stderr.write(
32
+ `hc: unsupported platform: ${process.platform}/${process.arch}\n` +
33
+ `\n` +
34
+ `Pre-compiled binaries are available for:\n` +
35
+ ` darwin/arm64, darwin/x64, linux/x64, linux/arm64, win32/x64\n` +
36
+ `\n` +
37
+ `Install via curl instead:\n` +
38
+ ` curl -fsSL https://storage.googleapis.com/hub-ally-code-dev-cli-releases/install.sh | bash\n`
39
+ );
40
+ process.exit(1);
41
+ }
42
+
43
+ // ---------------------------------------------------------------------------
44
+ // Resolve the binary path inside the platform package
45
+ // ---------------------------------------------------------------------------
46
+ let binaryPath;
47
+ try {
48
+ // require.resolve finds the package.json of the platform package, then we
49
+ // navigate to the binary relative to that package root.
50
+ const pkgJsonPath = require.resolve(`${entry.pkg}/package.json`);
51
+ binaryPath = path.join(path.dirname(pkgJsonPath), entry.bin);
52
+ } catch (err) {
53
+ process.stderr.write(
54
+ `hc: could not find platform package ${entry.pkg}\n` +
55
+ `\n` +
56
+ `This usually means the optional dependency was not installed.\n` +
57
+ `Try reinstalling: npm install @msawake/helioscode\n` +
58
+ `\n` +
59
+ `Or install via curl:\n` +
60
+ ` curl -fsSL https://storage.googleapis.com/hub-ally-code-dev-cli-releases/install.sh | bash\n`
61
+ );
62
+ process.exit(1);
63
+ }
64
+
65
+ // ---------------------------------------------------------------------------
66
+ // Spawn the binary, inheriting stdio so the terminal behaves normally
67
+ // ---------------------------------------------------------------------------
68
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
69
+ stdio: 'inherit',
70
+ // Pass through the full environment so the binary sees PATH, HOME, etc.
71
+ env: process.env,
72
+ });
73
+
74
+ if (result.error) {
75
+ process.stderr.write(
76
+ `hc: failed to spawn binary at ${binaryPath}: ${result.error.message}\n`
77
+ );
78
+ process.exit(1);
79
+ }
80
+
81
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@msawake/helioscode",
3
+ "version": "0.1.0",
4
+ "description": "Helios Code — AI-powered software engineering CLI",
5
+ "bin": {
6
+ "hc": "bin/hc.js"
7
+ },
8
+ "files": [
9
+ "bin/"
10
+ ],
11
+ "optionalDependencies": {
12
+ "@msawake/helioscode-darwin-arm64": "0.1.0",
13
+ "@msawake/helioscode-darwin-x64": "0.1.0",
14
+ "@msawake/helioscode-linux-x64": "0.1.0",
15
+ "@msawake/helioscode-linux-arm64": "0.1.0",
16
+ "@msawake/helioscode-win32-x64": "0.1.0"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "license": "UNLICENSED",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://bitbucket.org/i2tic/ally-code"
25
+ }
26
+ }