@thaloz/t3 0.0.0-stage → 0.0.47
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 +18 -2
- package/bin/thz.js +21 -0
- package/dist/bin.mjs +27 -0
- package/package.json +25 -4
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Thaloz Code CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Connect a worker to your Thaloz account:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx @thaloz/t3@latest connect
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Follow the browser sign-in and accept background-service setup to keep the worker online.
|
|
10
|
+
For a permanent command:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install -g @thaloz/t3@latest
|
|
14
|
+
thz connect
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Use `@thaloz/t3@nightly` for QA builds. Node and npm are required for
|
|
18
|
+
installation; the worker runtime is bundled. Supported platforms are Apple Silicon
|
|
19
|
+
macOS, Linux x64, and Windows x64. This package uses Thaloz Connect.
|
package/bin/thz.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const { constants } = require("node:os");
|
|
5
|
+
const { dirname, join } = require("node:path");
|
|
6
|
+
const supported = ["darwin-arm64","linux-x64","win32-x64"];
|
|
7
|
+
const key = process.platform + "-" + process.arch;
|
|
8
|
+
let packageDir;
|
|
9
|
+
try {
|
|
10
|
+
packageDir = dirname(require.resolve("@thaloz/t3-" + key + "/package.json"));
|
|
11
|
+
} catch {
|
|
12
|
+
process.stderr.write("thz: no Thaloz CLI build is installed for " + key + ".\nSupported platforms: " + supported.join(", ") + ".\nReinstall @thaloz/t3 to restore its optional dependency.\n");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const executable = join(packageDir, process.platform === "win32" ? "t3.exe" : "t3");
|
|
16
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
|
|
17
|
+
if (result.error) {
|
|
18
|
+
process.stderr.write("thz: " + result.error.message + "\n");
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
process.exit(result.status ?? 128 + (constants.signals[result.signal] || 1));
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { constants } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const executableName = process.platform === "win32" ? "t3.exe" : "t3";
|
|
7
|
+
const executable = join(dirname(require.resolve("@thaloz/t3-" + process.platform + "-" + process.arch + "/package.json")), executableName);
|
|
8
|
+
const ipc = process.send !== undefined;
|
|
9
|
+
const child = spawn(executable, process.argv.slice(2), {
|
|
10
|
+
stdio: ipc ? ["inherit", "inherit", "inherit", "ipc"] : "inherit",
|
|
11
|
+
});
|
|
12
|
+
const fail = (error) => {
|
|
13
|
+
if (!error) return;
|
|
14
|
+
process.stderr.write("thz: " + error.message + "\n");
|
|
15
|
+
child.kill("SIGTERM");
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
};
|
|
18
|
+
if (ipc) {
|
|
19
|
+
process.on("message", (message) => { if (child.connected) child.send(message, fail); });
|
|
20
|
+
child.on("message", (message) => { if (process.connected) process.send(message, fail); });
|
|
21
|
+
process.on("disconnect", () => { if (child.connected) child.disconnect(); });
|
|
22
|
+
}
|
|
23
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
24
|
+
process.on(signal, () => child.kill(signal));
|
|
25
|
+
}
|
|
26
|
+
child.on("error", (error) => { fail(error); process.exit(1); });
|
|
27
|
+
child.on("exit", (code, signal) => process.exit(code ?? 128 + (constants.signals[signal] || 1)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thaloz/t3",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.47",
|
|
4
|
+
"description": "Thaloz Code CLI. Installs the self-contained executable for this platform.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Thaloz/thz-t3code",
|
|
9
|
+
"directory": "apps/server"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"thz": "./bin/thz.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@thaloz/t3-darwin-arm64": "0.0.47",
|
|
20
|
+
"@thaloz/t3-linux-x64": "0.0.47",
|
|
21
|
+
"@thaloz/t3-win32-x64": "0.0.47"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
}
|
|
27
|
+
}
|