onepipeline-cli 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/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # onepipeline-cli
2
+
3
+ The `onepipeline` command, as a prebuilt binary.
4
+
5
+ ```bash
6
+ npm install -g onepipeline-cli
7
+ onepipeline --help
8
+ ```
9
+
10
+ The binary ships inside a per-platform package that npm selects by `os`/`cpu`, so
11
+ there is no compile step and no Rust toolchain to install. The same binary is on
12
+ [PyPI](https://pypi.org/project/onepipeline-cli/) (`pip install
13
+ onepipeline-cli`) and [crates.io](https://crates.io/crates/onepipeline)
14
+ (`cargo install onepipeline`).
15
+
16
+ See [the repository](https://github.com/nickderobertis/onepipeline) for what it
17
+ does and the contract it implements.
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ // Launcher for the `onepipeline` command installed from the
3
+ // `onepipeline-cli` npm package.
4
+ //
5
+ // Like the PyPI wheels (maturin `bindings = "bin"`, see pyproject.toml), the npm
6
+ // distribution carries the *prebuilt* Rust binary — no Rust toolchain, no
7
+ // compile, no download at install time. The platform-specific binary ships
8
+ // inside a per-platform package (`onepipeline-cli-<platform>-<arch>`) declared
9
+ // in this package's `optionalDependencies`; npm installs only the one whose
10
+ // `os`/`cpu` match the host, and this shim resolves it and execs it with the
11
+ // caller's argv.
12
+ //
13
+ // This file is committed source; the version and the optionalDependency versions
14
+ // are stamped from Cargo.toml at publish time by scripts/npm-build.mjs, which
15
+ // also generates the per-platform packages from the release binaries.
16
+
17
+ const path = require("node:path");
18
+ const { spawnSync } = require("node:child_process");
19
+
20
+ // process.platform-process.arch -> the platform package that carries the binary.
21
+ // The keys mirror the Rust target matrix in .github/workflows/release.yml, the
22
+ // TARGETS table in scripts/npm-build.mjs, and the optionalDependencies in
23
+ // package.json; keep the four in lockstep.
24
+ const PACKAGES = {
25
+ "linux-x64": "onepipeline-cli-linux-x64",
26
+ "linux-arm64": "onepipeline-cli-linux-arm64",
27
+ "darwin-x64": "onepipeline-cli-darwin-x64",
28
+ "darwin-arm64": "onepipeline-cli-darwin-arm64",
29
+ "win32-x64": "onepipeline-cli-win32-x64",
30
+ };
31
+
32
+ // Every failure here is a failed install, so say what to do about it rather than
33
+ // only what went wrong.
34
+ const OTHER_INSTALLS =
35
+ "Install another way instead: 'pip install onepipeline-cli', or " +
36
+ "'cargo install onepipeline --locked'.";
37
+
38
+ function fail(message) {
39
+ process.stderr.write(`onepipeline: ${message}\n`);
40
+ process.exit(1);
41
+ }
42
+
43
+ function binaryPath() {
44
+ const key = `${process.platform}-${process.arch}`;
45
+ const pkg = PACKAGES[key];
46
+ // llmlint: ignore-block[changed_behavior_has_e2e] reaching this branch means running
47
+ // where no prebuilt package exists, and a test could only get there by lying to node
48
+ // about process.platform — which would prove the lie. The sibling branches are driven
49
+ // for real by npm/test/launcher.test.mjs, and npm's own os/cpu fields keep a user from
50
+ // installing a platform package this map does not name.
51
+ if (!pkg) {
52
+ fail(
53
+ `unsupported platform ${key}. Prebuilt binaries exist for: ` +
54
+ `${Object.keys(PACKAGES).join(", ")}. ${OTHER_INSTALLS}`,
55
+ );
56
+ }
57
+ // llmlint: ignore-end[changed_behavior_has_e2e]
58
+
59
+ const binName = process.platform === "win32" ? "onepipeline.exe" : "onepipeline";
60
+ try {
61
+ // Resolve the platform package's manifest, then locate the binary beside it.
62
+ // Resolving package.json (rather than the binary file directly) is portable
63
+ // across Node resolution modes and does not require an `exports` entry for a
64
+ // non-JS asset.
65
+ const manifest = require.resolve(`${pkg}/package.json`);
66
+ return path.join(path.dirname(manifest), "bin", binName);
67
+ } catch (_err) {
68
+ return fail(
69
+ `the platform package ${pkg} is not installed. This usually means npm ` +
70
+ "skipped optional dependencies (e.g. --no-optional / --omit=optional) " +
71
+ "or the install was for a different platform. Reinstall with optional " +
72
+ `dependencies enabled. ${OTHER_INSTALLS}`,
73
+ );
74
+ }
75
+ }
76
+
77
+ const result = spawnSync(binaryPath(), process.argv.slice(2), { stdio: "inherit" });
78
+
79
+ if (result.error) {
80
+ fail(`failed to launch the onepipeline binary: ${result.error.message}`);
81
+ }
82
+
83
+ // Re-raise a terminating signal so callers observe the true cause; otherwise
84
+ // propagate the child's exit code verbatim — the contract assigns meaning to 1
85
+ // and 2, and a caller reads them.
86
+ if (result.signal) {
87
+ process.kill(process.pid, result.signal);
88
+ }
89
+ process.exit(result.status === null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "onepipeline-cli",
3
+ "version": "0.1.0",
4
+ "description": "Execute a task DAG over oneagentgraph and onevcs, merging their event streams into one.",
5
+ "keywords": [
6
+ "orchestration",
7
+ "dag",
8
+ "agents",
9
+ "cli",
10
+ "ndjson"
11
+ ],
12
+ "homepage": "https://github.com/nickderobertis/onepipeline",
13
+ "bugs": "https://github.com/nickderobertis/onepipeline/issues",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/nickderobertis/onepipeline.git"
17
+ },
18
+ "license": "MIT",
19
+ "author": "Nick DeRobertis",
20
+ "bin": {
21
+ "onepipeline": "bin/onepipeline.js"
22
+ },
23
+ "files": [
24
+ "bin/onepipeline.js"
25
+ ],
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "optionalDependencies": {
30
+ "onepipeline-cli-linux-x64": "0.1.0",
31
+ "onepipeline-cli-linux-arm64": "0.1.0",
32
+ "onepipeline-cli-darwin-x64": "0.1.0",
33
+ "onepipeline-cli-darwin-arm64": "0.1.0",
34
+ "onepipeline-cli-win32-x64": "0.1.0"
35
+ }
36
+ }