dev-orchestrator-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.
Files changed (3) hide show
  1. package/README.md +39 -0
  2. package/package.json +20 -0
  3. package/run.js +50 -0
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # dev-orchestrator-cli (`devorch`)
2
+
3
+ The Dev Orchestrator command-line client. `devorch` is a self-contained .NET single-file binary driven
4
+ entirely by the API's OpenAPI document (the single source of truth) — no .NET runtime required on the host.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm i -g dev-orchestrator-cli
10
+ devorch --help
11
+ ```
12
+
13
+ The binary for your platform is delivered as an [`optionalDependencies`](https://docs.npmjs.com/cli/configuring-npm/package-json#optionaldependencies)
14
+ sub-package (`@devorch/cli-<os>-<cpu>`) constrained by `os`/`cpu`, so npm downloads **only** the one that
15
+ matches your machine. Do **not** install with `--no-optional` / `--omit=optional` — that skips the binary.
16
+
17
+ Supported platforms: `win32-x64`, `linux-x64`. (macOS `darwin-x64`/`darwin-arm64` ship once code-signed.)
18
+
19
+ > .NET SDK users can instead use the NuGet channel: `dotnet tool install -g dev-orchestrator-cli`
20
+ > (same `devorch` command).
21
+
22
+ ## Usage
23
+
24
+ ```bash
25
+ devorch --base-url http://localhost:8700 health # or DEVORCH_API_BASE
26
+ devorch login # caches a bearer token under ~/.devorch/
27
+ devorch whoami
28
+ devorch projects list
29
+ devorch types project-status list
30
+ ```
31
+
32
+ `--base-url` defaults to `http://localhost:8700` (override via the flag or `DEVORCH_API_BASE`).
33
+
34
+ ## How it's built
35
+
36
+ `run.js` (this package's `bin`) detects `process.platform`/`process.arch`, resolves the matching
37
+ `@devorch/cli-<os>-<cpu>` sub-package's binary, and execs it — forwarding all arguments and the exit code.
38
+ The binaries are produced by `scripts/publish-cli.*` (`dotnet publish` self-contained single-file per RID)
39
+ and assembled into sub-packages by `scripts/pack-cli-npm.*`.
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "dev-orchestrator-cli",
3
+ "version": "0.1.0",
4
+ "description": "Dev Orchestrator CLI (devorch) — a self-contained .NET client driven by the API's OpenAPI document. Installs the prebuilt binary for your platform via optionalDependencies.",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "devorch": "run.js"
8
+ },
9
+ "files": [
10
+ "run.js",
11
+ "README.md"
12
+ ],
13
+ "optionalDependencies": {
14
+ "@devorch/cli-win32-x64": "0.1.0",
15
+ "@devorch/cli-linux-x64": "0.1.0"
16
+ },
17
+ "engines": {
18
+ "node": ">=18"
19
+ }
20
+ }
package/run.js ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Launcher for the Dev Orchestrator CLI (`devorch`).
5
+ //
6
+ // The real program is a self-contained .NET single-file binary. To keep installs small, each platform's
7
+ // binary ships in its own optionalDependencies sub-package (`@devorch/cli-<os>-<cpu>`) constrained by
8
+ // `os`/`cpu`, so npm downloads ONLY the one matching the host (the esbuild / Azure Functions Core Tools
9
+ // pattern). This thin wrapper resolves that binary and execs it, forwarding argv and the exit code.
10
+
11
+ const { spawnSync } = require('node:child_process');
12
+ const fs = require('node:fs');
13
+
14
+ const { platform, arch } = process;
15
+ const pkg = `@devorch/cli-${platform}-${arch}`;
16
+ const binName = platform === 'win32' ? 'devorch.exe' : 'devorch';
17
+
18
+ let binPath;
19
+ try {
20
+ // Resolve through the sub-package's own export so it works regardless of hoisting layout.
21
+ binPath = require.resolve(`${pkg}/bin/${binName}`);
22
+ } catch {
23
+ console.error(
24
+ `devorch: no prebuilt binary for ${platform}-${arch}.\n` +
25
+ `Expected the optional dependency ${pkg} to be installed. ` +
26
+ `Supported platforms: win32-x64, linux-x64 (macOS coming once code-signed).\n` +
27
+ `If you installed with --no-optional / --omit=optional, reinstall without it.`,
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ // Ensure the binary is executable on unix. npm preserves file modes from the packing host, but a tarball
33
+ // built on Windows (or any path that strips modes) ships the binary mode 0644 → spawn would EACCES. This
34
+ // idempotent chmod makes the install work regardless of where it was packed. Best-effort: if it fails
35
+ // (e.g. a read-only install), fall through — the binary may already be executable.
36
+ if (platform !== 'win32') {
37
+ try {
38
+ fs.chmodSync(binPath, 0o755);
39
+ } catch {
40
+ /* best-effort */
41
+ }
42
+ }
43
+
44
+ const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
45
+ if (result.error) {
46
+ console.error(`devorch: failed to launch ${binPath}: ${result.error.message}`);
47
+ process.exit(1);
48
+ }
49
+ // spawnSync returns null status when the child was killed by a signal; surface a non-zero code.
50
+ process.exit(result.status === null ? 1 : result.status);