cruma 0.0.0-stage → 1.0.14

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,4 @@
1
- # Temporary Holding Version
1
+ # Cruma
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
+ Install and run the Cruma tunnel agent with `npx -y cruma proxy http 3000` or
4
+ `cruma mcp`.
package/bin/cruma.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { run } from "../lib/launcher.js";
4
+
5
+ run(process.argv.slice(2));
@@ -0,0 +1,64 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+
5
+ const require = createRequire(import.meta.url);
6
+ const LAUNCHER_MANIFEST = require("../package.json");
7
+
8
+ export function platformKey(platform, architecture) {
9
+ return `${platform}-${architecture}`;
10
+ }
11
+
12
+ export function selectPackage(platform, architecture, optionalDependencies = LAUNCHER_MANIFEST.optionalDependencies) {
13
+ const packageName = `@cruma-io/cli-${platformKey(platform, architecture)}`;
14
+
15
+ if (optionalDependencies[packageName] === undefined) {
16
+ throw new Error(
17
+ `Cruma does not support ${platform}/${architecture}. Supported platforms: ${Object.keys(optionalDependencies).map((dependency) => dependency.replace("@cruma-io/cli-", "")).join(", ")}.`
18
+ );
19
+ }
20
+
21
+ return packageName;
22
+ }
23
+
24
+ export function binaryPath(platform, architecture) {
25
+ const packageName = selectPackage(platform, architecture);
26
+ let manifestPath;
27
+
28
+ try {
29
+ manifestPath = require.resolve(`${packageName}/package.json`);
30
+ } catch {
31
+ throw new Error(
32
+ `The ${packageName} package is not installed for ${platform}/${architecture}. Reinstall cruma with npm.`
33
+ );
34
+ }
35
+
36
+ const manifest = require(manifestPath);
37
+ return join(dirname(manifestPath), manifest.crumaBinary);
38
+ }
39
+
40
+ export function run(argumentsToForward, environment = process.env) {
41
+ let executable;
42
+
43
+ try {
44
+ executable = binaryPath(process.platform, process.arch);
45
+ } catch (error) {
46
+ console.error(`cruma: ${error.message}`);
47
+ process.exitCode = 1;
48
+ return;
49
+ }
50
+
51
+ const result = spawnSync(executable, argumentsToForward, {
52
+ env: environment,
53
+ stdio: "inherit"
54
+ });
55
+
56
+ if (result.error !== undefined) {
57
+ console.error(`cruma: unable to start bundled agent: ${result.error.message}`);
58
+ process.exitCode = 1;
59
+ } else if (result.signal !== null) {
60
+ process.kill(process.pid, result.signal);
61
+ } else {
62
+ process.exitCode = result.status ?? 1;
63
+ }
64
+ }
package/package.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "cruma",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.14",
4
+ "type": "module",
5
+ "description": "Cruma tunnel agent",
6
+ "license": "UNLICENSED",
7
+ "bin": {
8
+ "cruma": "bin/cruma.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "lib",
13
+ "README.md"
14
+ ],
15
+ "optionalDependencies": {
16
+ "@cruma-io/cli-darwin-arm64": "1.0.14",
17
+ "@cruma-io/cli-linux-arm64": "1.0.14",
18
+ "@cruma-io/cli-linux-x64": "1.0.14",
19
+ "@cruma-io/cli-win32-x64": "1.0.14"
20
+ }
21
+ }