@brickhouse-tech/sync-agents 0.1.17 → 0.2.1

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 CHANGED
@@ -18,7 +18,11 @@ or globally:
18
18
  npm install -g @brickhouse-tech/sync-agents
19
19
  ```
20
20
 
21
- ### Standalone (no npm required)
21
+ ### Standalone (no npm required) — deprecated
22
+
23
+ > **Deprecated.** The bash script is kept as a fallback for unsupported
24
+ > triples but will be removed in a future major. Prefer the npm install
25
+ > above; it ships native Go binaries via per-platform optional packages.
22
26
 
23
27
  ```bash
24
28
  curl -fsSL https://raw.githubusercontent.com/brickhouse-tech/sync-agents/main/src/sh/sync-agents.sh -o /usr/local/bin/sync-agents
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ // Launcher: prefer the Go binary shipped via the matching platform package
3
+ // (@brickhouse-tech/sync-agents-<os>-<arch>); fall back to the bash script
4
+ // at src/sh/sync-agents.sh so the package never bricks on an unsupported
5
+ // triple.
6
+
7
+ const { spawnSync } = require("node:child_process");
8
+ const path = require("node:path");
9
+ const fs = require("node:fs");
10
+
11
+ const platformPkg = `@brickhouse-tech/sync-agents-${process.platform}-${process.arch}`;
12
+ const exe = process.platform === "win32" ? "sync-agents.exe" : "sync-agents";
13
+
14
+ function resolveGoBinary() {
15
+ try {
16
+ const pkgJson = require.resolve(`${platformPkg}/package.json`);
17
+ const candidate = path.join(path.dirname(pkgJson), "bin", exe);
18
+ if (fs.existsSync(candidate)) return candidate;
19
+ } catch {
20
+ // platform package not installed (npm skipped it via os/cpu mismatch
21
+ // or it failed as an optionalDependency); fall through to bash.
22
+ }
23
+ return null;
24
+ }
25
+
26
+ function fallbackShellScript() {
27
+ return path.join(__dirname, "..", "src", "sh", "sync-agents.sh");
28
+ }
29
+
30
+ const target = resolveGoBinary() ?? fallbackShellScript();
31
+ const isShell = target.endsWith(".sh");
32
+
33
+ const result = spawnSync(isShell ? "bash" : target, isShell ? [target, ...process.argv.slice(2)] : process.argv.slice(2), {
34
+ stdio: "inherit",
35
+ });
36
+
37
+ if (result.error) {
38
+ console.error(`sync-agents: failed to exec ${target}: ${result.error.message}`);
39
+ process.exit(1);
40
+ }
41
+ process.exit(result.status ?? 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brickhouse-tech/sync-agents",
3
- "version": "0.1.17",
3
+ "version": "0.2.1",
4
4
  "description": "Simple scripts to DRY up common agent interactions across multiple LLM providers.",
5
5
  "keywords": [
6
6
  "agents",
@@ -20,11 +20,19 @@
20
20
  },
21
21
  "author": "Nicholas McCready",
22
22
  "bin": {
23
- "sync-agents": "src/sh/sync-agents.sh"
23
+ "sync-agents": "bin/sync-agents.js"
24
24
  },
25
25
  "files": [
26
+ "bin/sync-agents.js",
26
27
  "src/**/*"
27
28
  ],
29
+ "optionalDependencies": {
30
+ "@brickhouse-tech/sync-agents-darwin-arm64": "0.2.1",
31
+ "@brickhouse-tech/sync-agents-darwin-x64": "0.2.1",
32
+ "@brickhouse-tech/sync-agents-linux-arm64": "0.2.1",
33
+ "@brickhouse-tech/sync-agents-linux-x64": "0.2.1",
34
+ "@brickhouse-tech/sync-agents-win32-x64": "0.2.1"
35
+ },
28
36
  "overrides": {
29
37
  "file-type": ">=22",
30
38
  "picomatch": ">=4.0.4"
@@ -34,7 +42,9 @@
34
42
  "test": "npx concurrently --names \"sh,go\" -c \"cyan,magenta\" \"npm run test:sh\" \"npm run test:go\"",
35
43
  "test:sh": "npx bats test/",
36
44
  "test:go": "make test",
37
- "prepare": "make install"
45
+ "prepare": "make install",
46
+ "prepack": "node scripts/sync-optional-deps.js",
47
+ "bootstrap:publish": "bash scripts/bootstrap-platform-publish.sh"
38
48
  },
39
49
  "devDependencies": {
40
50
  "@commitlint/cli": "^20",
@@ -1,4 +1,14 @@
1
1
  #!/usr/bin/env bash
2
+ # ----------------------------------------------------------------------------
3
+ # DEPRECATED — bash implementation of sync-agents.
4
+ #
5
+ # The Go binary shipped via per-platform npm packages is the supported
6
+ # implementation. This shell script remains only as:
7
+ # - the fallback path in bin/sync-agents.js for unsupported triples
8
+ # - the standalone curl install in README (also deprecated)
9
+ # Scheduled for removal in a future major after platform-package install
10
+ # data shows the fallback is unused. Bug fixes go into go/, not here.
11
+ # ----------------------------------------------------------------------------
2
12
  set -euo pipefail
3
13
 
4
14
  AGENTS_DIR=".agents"