@amsterdamdatalabs/adl-agent-control 0.1.4

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/adl.js +38 -0
  2. package/package.json +13 -0
package/bin/adl.js ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ // adl npm wrapper bin: resolves the platform package for this machine (one
3
+ // of the optionalDependencies of @amsterdamdatalabs/adl-agent-control) and
4
+ // execs its binary. Platform packages carry os/cpu fields so npm only ever
5
+ // installs the one that matches.
6
+ //
7
+ // Copied from adl-agent-id's packaging/wrapper-bin.js (proven pattern) with
8
+ // the package/binary names swapped: repo and npm scope are
9
+ // adl-agent-control, the installed command stays `adl`.
10
+ const { spawnSync } = require('node:child_process');
11
+
12
+ function platformPackage() {
13
+ const os = process.platform; // darwin | linux
14
+ const arch = process.arch; // arm64 | x64
15
+ if ((os !== 'darwin' && os !== 'linux') || (arch !== 'arm64' && arch !== 'x64')) {
16
+ throw new Error(`adl: no prebuilt binary for ${os}/${arch}`);
17
+ }
18
+ return `@amsterdamdatalabs/adl-agent-control-${os}-${arch}`;
19
+ }
20
+
21
+ let pkgDir;
22
+ try {
23
+ pkgDir = require.resolve(`${platformPackage()}/package.json`);
24
+ } catch {
25
+ console.error(
26
+ `adl: platform package ${platformPackage()} is not installed.\n` +
27
+ 'Reinstall: npm install -g @amsterdamdatalabs/adl-agent-control'
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ const bin = require('node:path').join(require('node:path').dirname(pkgDir), 'bin', 'adl');
33
+ const r = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
34
+ if (r.error) {
35
+ console.error(`adl: failed to run ${bin}: ${r.error.message}`);
36
+ process.exit(1);
37
+ }
38
+ process.exit(r.status === null ? 1 : r.status);
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@amsterdamdatalabs/adl-agent-control",
3
+ "version": "0.1.4",
4
+ "description": "adl — the front door for agents to Azure DevOps (identity, run, pr/wit/build). See docs/architecture/cli-design.md.",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "adl": "bin/adl.js"
8
+ },
9
+ "optionalDependencies": {
10
+ "@amsterdamdatalabs/adl-agent-control-darwin-arm64": "0.1.4",
11
+ "@amsterdamdatalabs/adl-agent-control-linux-x64": "0.1.4"
12
+ }
13
+ }