graphcoder 0.0.0 → 0.0.106
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 +27 -1
- package/bin/graphcoder.js +121 -3
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
# graphcoder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Graphcoder CLI.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun add -g graphcoder
|
|
9
|
+
# or
|
|
10
|
+
npm install -g graphcoder
|
|
11
|
+
# or
|
|
12
|
+
pnpm add -g graphcoder
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Pin a specific version:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
bun add -g graphcoder@0.0.107
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The platform binary ships in a per-machine package (`graphcoder-darwin-arm64`,
|
|
22
|
+
`graphcoder-linux-x64`, …) selected automatically via `os`/`cpu`, so only the
|
|
23
|
+
binary for your platform is downloaded.
|
|
24
|
+
|
|
25
|
+
## Run
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
graphcoder doctor
|
|
29
|
+
```
|
package/bin/graphcoder.js
CHANGED
|
@@ -1,4 +1,122 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Umbrella launcher for the `graphcoder` npm package.
|
|
5
|
+
//
|
|
6
|
+
// The real binary ships in a per-platform package (graphcoder-<target>) listed
|
|
7
|
+
// under optionalDependencies. The package manager installs only the one whose
|
|
8
|
+
// "os"/"cpu" match the current machine; this shim resolves it and execs the
|
|
9
|
+
// bundled SEA binary, passing through argv/stdio/exit code and signals.
|
|
10
|
+
//
|
|
11
|
+
// Authored as a plain-CJS template under lib/install/npm/. The release pipeline
|
|
12
|
+
// stamps the matching version into package.json's version + optionalDependencies
|
|
13
|
+
// before publishing. Keep this file dependency-free: it runs from the published
|
|
14
|
+
// package with nothing but Node's stdlib available.
|
|
15
|
+
|
|
16
|
+
const { spawn } = require("node:child_process");
|
|
17
|
+
const path = require("node:path");
|
|
18
|
+
|
|
19
|
+
// Maps Node's process.platform/process.arch to a Graphcoder release target id.
|
|
20
|
+
// The target ids are also the per-platform package name suffixes
|
|
21
|
+
// (graphcoder-<target>) and match RELEASE_TARGET_IDS in @graphcoder/install.
|
|
22
|
+
function detectTarget(platform, arch) {
|
|
23
|
+
const normalizedArch = arch === "arm64" ? "arm64" : "x64";
|
|
24
|
+
if (platform === "darwin") return normalizedArch === "arm64" ? "darwin-arm64" : "darwin-x64";
|
|
25
|
+
if (platform === "linux") return normalizedArch === "arm64" ? "linux-arm64" : "linux-x64";
|
|
26
|
+
// Windows on arm64 is not a published target yet.
|
|
27
|
+
if (platform === "win32") return normalizedArch === "arm64" ? null : "windows-x64";
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function exeNameForPlatform(platform) {
|
|
32
|
+
return platform === "win32" ? "graphcoder.exe" : "graphcoder";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Resolves the absolute path to the platform binary, or returns a structured
|
|
36
|
+
// reason when it can't (so callers can print actionable guidance). Exported for
|
|
37
|
+
// tests; see lib/install/npm/graphcoder.test.ts.
|
|
38
|
+
function resolveBinary(opts) {
|
|
39
|
+
const platform = opts.platform;
|
|
40
|
+
const arch = opts.arch;
|
|
41
|
+
const requireResolve = opts.requireResolve;
|
|
42
|
+
|
|
43
|
+
const target = detectTarget(platform, arch);
|
|
44
|
+
if (target === null) {
|
|
45
|
+
return { ok: false, reason: "unsupported", platform, arch };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const pkg = "graphcoder-" + target;
|
|
49
|
+
let pkgJsonPath;
|
|
50
|
+
try {
|
|
51
|
+
pkgJsonPath = requireResolve(pkg + "/package.json");
|
|
52
|
+
} catch (_err) {
|
|
53
|
+
return { ok: false, reason: "missing", pkg, target };
|
|
54
|
+
}
|
|
55
|
+
const binaryPath = path.join(path.dirname(pkgJsonPath), exeNameForPlatform(platform));
|
|
56
|
+
return { ok: true, pkg, target, binaryPath };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function fail(message) {
|
|
60
|
+
process.stderr.write("graphcoder: " + message + "\n");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function main() {
|
|
65
|
+
const resolution = resolveBinary({
|
|
66
|
+
platform: process.platform,
|
|
67
|
+
arch: process.arch,
|
|
68
|
+
requireResolve: require.resolve,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (!resolution.ok) {
|
|
72
|
+
if (resolution.reason === "unsupported") {
|
|
73
|
+
fail(
|
|
74
|
+
"unsupported platform " +
|
|
75
|
+
resolution.platform +
|
|
76
|
+
"-" +
|
|
77
|
+
resolution.arch +
|
|
78
|
+
". Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, windows-x64.",
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
fail(
|
|
82
|
+
"the platform package '" +
|
|
83
|
+
resolution.pkg +
|
|
84
|
+
"' is not installed.\n" +
|
|
85
|
+
"This usually means optional dependencies were skipped during install.\n" +
|
|
86
|
+
"Reinstall without --no-optional (e.g. `bun add -g graphcoder` or `npm i -g graphcoder`).",
|
|
87
|
+
);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const child = spawn(resolution.binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
92
|
+
|
|
93
|
+
child.on("error", (err) => {
|
|
94
|
+
fail("failed to launch binary at " + resolution.binaryPath + ": " + err.message);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Forward termination signals so Ctrl-C and friends reach the real process.
|
|
98
|
+
const forward = (signal) => {
|
|
99
|
+
try {
|
|
100
|
+
child.kill(signal);
|
|
101
|
+
} catch (_err) {
|
|
102
|
+
// child may have already exited; ignore.
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
process.on("SIGINT", () => forward("SIGINT"));
|
|
106
|
+
process.on("SIGTERM", () => forward("SIGTERM"));
|
|
107
|
+
|
|
108
|
+
child.on("exit", (code, signal) => {
|
|
109
|
+
if (signal) {
|
|
110
|
+
// Re-raise the signal so our exit status reflects how the child died.
|
|
111
|
+
process.kill(process.pid, signal);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
process.exit(code === null ? 1 : code);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = { detectTarget, exeNameForPlatform, resolveBinary };
|
|
119
|
+
|
|
120
|
+
if (require.main === module) {
|
|
121
|
+
main();
|
|
122
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphcoder",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Graphcoder CLI
|
|
3
|
+
"version": "0.0.106",
|
|
4
|
+
"description": "Graphcoder CLI — install with your package manager (bun add -g graphcoder).",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
+
"homepage": "https://graphcoder.ai",
|
|
6
7
|
"bin": {
|
|
7
8
|
"graphcoder": "bin/graphcoder.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
11
|
"bin",
|
|
11
12
|
"README.md"
|
|
12
|
-
]
|
|
13
|
+
],
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"graphcoder-darwin-arm64": "0.0.106",
|
|
16
|
+
"graphcoder-darwin-x64": "0.0.106",
|
|
17
|
+
"graphcoder-linux-x64": "0.0.106",
|
|
18
|
+
"graphcoder-linux-arm64": "0.0.106",
|
|
19
|
+
"graphcoder-windows-x64": "0.0.106"
|
|
20
|
+
}
|
|
13
21
|
}
|