@startrust/trustcode 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/trustcode.js +58 -0
  2. package/package.json +27 -0
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const fs = require("node:fs");
6
+ const { spawnSync } = require("node:child_process");
7
+
8
+ // platform-arch -> platform package directory name (under the @startrust scope).
9
+ // Keep in sync with release.yml's build matrix and scripts/set-version.mjs.
10
+ const PACKAGES = {
11
+ "linux-x64": "trustcode-linux-x64",
12
+ "linux-arm64": "trustcode-linux-arm64",
13
+ "win32-x64": "trustcode-win32-x64",
14
+ "win32-arm64": "trustcode-win32-arm64",
15
+ "darwin-x64": "trustcode-darwin-x64",
16
+ "darwin-arm64": "trustcode-darwin-arm64",
17
+ };
18
+
19
+ function fail(message) {
20
+ process.stderr.write(`trustcode: ${message}\n`);
21
+ process.exit(1);
22
+ }
23
+
24
+ function resolveBinary() {
25
+ const key = `${process.platform}-${process.arch}`;
26
+ const dir = PACKAGES[key];
27
+ if (!dir) {
28
+ fail(
29
+ `unsupported platform ${key}. ` +
30
+ `Prebuilt binaries are available for: ${Object.keys(PACKAGES).join(", ")}.`
31
+ );
32
+ }
33
+ const exe = process.platform === "win32" ? "trustcode.exe" : "trustcode";
34
+
35
+ // 1. installed as an optional dependency (the published layout).
36
+ try {
37
+ return require.resolve(`@startrust/${dir}/bin/${exe}`);
38
+ } catch (_) {
39
+ /* fall through */
40
+ }
41
+ // 2. sibling package in this repo (local development).
42
+ const sibling = path.join(__dirname, "..", "..", dir, "bin", exe);
43
+ if (fs.existsSync(sibling)) {
44
+ return sibling;
45
+ }
46
+
47
+ fail(
48
+ `the prebuilt binary for ${key} is not installed.\n` +
49
+ ` expected package: @startrust/${dir}\n` +
50
+ ` reinstall with: npm install @startrust/trustcode`
51
+ );
52
+ }
53
+
54
+ const result = spawnSync(resolveBinary(), process.argv.slice(2), { stdio: "inherit" });
55
+ if (result.error) {
56
+ fail(`failed to launch binary: ${result.error.message}`);
57
+ }
58
+ process.exit(result.status === null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@startrust/trustcode",
3
+ "version": "0.1.0",
4
+ "description": "Verifiable code intelligence for AI agents — every answer comes with the evidence that proves it.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Startrust/trustcode.git"
9
+ },
10
+ "bin": {
11
+ "trustcode": "bin/trustcode.js"
12
+ },
13
+ "files": [
14
+ "bin/"
15
+ ],
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "optionalDependencies": {
20
+ "@startrust/trustcode-linux-x64": "0.1.0",
21
+ "@startrust/trustcode-linux-arm64": "0.1.0",
22
+ "@startrust/trustcode-win32-x64": "0.1.0",
23
+ "@startrust/trustcode-win32-arm64": "0.1.0",
24
+ "@startrust/trustcode-darwin-x64": "0.1.0",
25
+ "@startrust/trustcode-darwin-arm64": "0.1.0"
26
+ }
27
+ }