@telagod/nocode 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.
package/bin/nocode ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const { spawn } = require("child_process");
6
+ const path = require("path");
7
+ const fs = require("fs");
8
+
9
+ const PLATFORM_PACKAGES = {
10
+ "linux-x64": "@telagod/nocode-linux-x64",
11
+ "darwin-x64": "@telagod/nocode-darwin-x64",
12
+ "darwin-arm64": "@telagod/nocode-darwin-arm64",
13
+ };
14
+
15
+ function getBinaryPath() {
16
+ const platform = process.platform;
17
+ const arch = process.arch === "arm64" ? "arm64" : "x64";
18
+ const key = `${platform}-${arch}`;
19
+ const pkg = PLATFORM_PACKAGES[key];
20
+
21
+ if (!pkg) {
22
+ console.error(
23
+ `Unsupported platform: ${platform}-${arch}\n` +
24
+ `Supported: ${Object.keys(PLATFORM_PACKAGES).join(", ")}`
25
+ );
26
+ process.exit(1);
27
+ }
28
+
29
+ // Resolve the platform sub-package directory
30
+ let pkgDir;
31
+ try {
32
+ pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
33
+ } catch {
34
+ console.error(
35
+ `Platform package ${pkg} is not installed.\n` +
36
+ `Try: npm install -g @telagod/nocode`
37
+ );
38
+ process.exit(1);
39
+ }
40
+
41
+ const bin = path.join(pkgDir, "bin", "nocode");
42
+ if (!fs.existsSync(bin)) {
43
+ console.error(`Binary not found at ${bin}`);
44
+ process.exit(1);
45
+ }
46
+
47
+ return bin;
48
+ }
49
+
50
+ const bin = getBinaryPath();
51
+ const child = spawn(bin, process.argv.slice(2), {
52
+ stdio: "inherit",
53
+ env: process.env,
54
+ });
55
+
56
+ // Forward signals to the child process
57
+ for (const sig of ["SIGINT", "SIGTERM", "SIGHUP"]) {
58
+ process.on(sig, () => child.kill(sig));
59
+ }
60
+
61
+ child.on("exit", (code, signal) => {
62
+ if (signal) {
63
+ process.kill(process.pid, signal);
64
+ } else {
65
+ process.exit(code ?? 1);
66
+ }
67
+ });
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@telagod/nocode",
3
+ "version": "0.1.0",
4
+ "description": "Terminal-native AI coding assistant built in Rust",
5
+ "license": "MIT",
6
+ "author": "telagod",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/telagod/nocode"
10
+ },
11
+ "bin": {
12
+ "nocode": "bin/nocode"
13
+ },
14
+ "files": ["bin/", "scripts/"],
15
+ "scripts": {
16
+ "postinstall": "node scripts/postinstall.js"
17
+ },
18
+ "optionalDependencies": {
19
+ "@telagod/nocode-linux-x64": "0.1.0",
20
+ "@telagod/nocode-darwin-x64": "0.1.0",
21
+ "@telagod/nocode-darwin-arm64": "0.1.0"
22
+ },
23
+ "engines": {
24
+ "node": ">=16"
25
+ }
26
+ }
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ // Verify the correct platform package was installed.
6
+ // If not, print a helpful message instead of failing silently at runtime.
7
+
8
+ const os = require("os");
9
+
10
+ const PLATFORMS = {
11
+ "linux-x64": "@telagod/nocode-linux-x64",
12
+ "darwin-x64": "@telagod/nocode-darwin-x64",
13
+ "darwin-arm64": "@telagod/nocode-darwin-arm64",
14
+ };
15
+
16
+ const key = `${os.platform()}-${os.arch()}`;
17
+ const pkg = PLATFORMS[key];
18
+
19
+ if (!pkg) {
20
+ console.warn(
21
+ `[nocode] Warning: no prebuilt binary for ${key}. ` +
22
+ `You may need to build from source.`
23
+ );
24
+ process.exit(0);
25
+ }
26
+
27
+ try {
28
+ require.resolve(`${pkg}/package.json`);
29
+ } catch {
30
+ console.warn(
31
+ `[nocode] Warning: platform package ${pkg} was not installed. ` +
32
+ `The 'nocode' command may not work. Try reinstalling.`
33
+ );
34
+ }