@amxv/agentbox 0.1.7 → 0.1.9

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
@@ -21,12 +21,36 @@ The npm package includes prebuilt binaries for:
21
21
  - macOS x64
22
22
  - Linux arm64
23
23
  - Linux x64
24
+ - Windows arm64
24
25
  - Windows x64
25
26
 
26
27
  Unsupported OS and CPU combinations fail during install with a clear error.
27
28
 
29
+ On Windows, the installer keeps only the native Windows payload for the current CPU after installation, so macOS/Linux binaries do not remain in the installed package.
30
+
28
31
  ## First Use
29
32
 
33
+ ### PowerShell (Windows)
34
+
35
+ ```powershell
36
+ $env:AGENTBOX_BASE_URL = "https://your-agentbox.example.com"
37
+ $env:AGENTBOX_API_KEY = "YOUR_API_KEY"
38
+
39
+ agentbox doctor
40
+ agentbox list
41
+ agentbox search "design"
42
+ agentbox create "Design thread" --message "Please implement this." --format markdown
43
+ ```
44
+
45
+ Save a reusable profile:
46
+
47
+ ```powershell
48
+ agentbox profiles add prod --base-url https://your-agentbox.example.com --api-key YOUR_API_KEY --activate
49
+ agentbox doctor
50
+ ```
51
+
52
+ ### macOS / Linux
53
+
30
54
  Use environment variables for a quick one-off session:
31
55
 
32
56
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amxv/agentbox",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Install the Agentbox Go CLI from npm.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -15,7 +15,8 @@
15
15
  "LICENSE"
16
16
  ],
17
17
  "scripts": {
18
- "install": "node ./scripts/install.js"
18
+ "install": "node ./scripts/install.js",
19
+ "test": "node --test ./test/*.test.mjs"
19
20
  },
20
21
  "publishConfig": {
21
22
  "access": "public"
@@ -0,0 +1,60 @@
1
+ import { chmodSync, copyFileSync, existsSync, mkdirSync, rmSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+
4
+ export function installTargets(packageRoot) {
5
+ const binDir = join(packageRoot, "bin");
6
+ return {
7
+ "darwin-arm64": { source: join(packageRoot, "vendor", "darwin-arm64", "agentbox"), dest: join(binDir, "agentbox") },
8
+ "darwin-x64": { source: join(packageRoot, "vendor", "darwin-amd64", "agentbox"), dest: join(binDir, "agentbox") },
9
+ "linux-arm64": { source: join(packageRoot, "vendor", "linux-arm64", "agentbox"), dest: join(binDir, "agentbox") },
10
+ "linux-x64": { source: join(packageRoot, "vendor", "linux-amd64", "agentbox"), dest: join(binDir, "agentbox") },
11
+ "win32-x64": {
12
+ source: join(packageRoot, "vendor", "windows-amd64", "agentbox.exe"),
13
+ dest: join(binDir, "agentbox.exe")
14
+ },
15
+ "win32-arm64": {
16
+ source: join(packageRoot, "vendor", "windows-arm64", "agentbox.exe"),
17
+ dest: join(binDir, "agentbox.exe")
18
+ }
19
+ };
20
+ }
21
+
22
+ export function installNativeBinary(packageRoot, platform, arch) {
23
+ const targets = installTargets(packageRoot);
24
+ const key = `${platform}-${arch}`;
25
+ const target = targets[key];
26
+
27
+ if (!target) {
28
+ throw new Error(
29
+ [
30
+ `Unsupported platform for @amxv/agentbox: ${platform}/${arch}.`,
31
+ "Supported targets: darwin/arm64, darwin/x64, linux/arm64, linux/x64, windows/arm64, windows/x64."
32
+ ].join(" ")
33
+ );
34
+ }
35
+
36
+ if (!existsSync(target.source)) {
37
+ throw new Error(`Missing packaged binary: ${target.source}. The release artifacts are incomplete.`);
38
+ }
39
+
40
+ const binDir = dirname(target.dest);
41
+ mkdirSync(binDir, { recursive: true });
42
+ rmSync(join(binDir, "agentbox"), { force: true });
43
+ rmSync(join(binDir, "agentbox.exe"), { force: true });
44
+ copyFileSync(target.source, target.dest);
45
+
46
+ // Keep only this machine's native payload after install. The published npm
47
+ // tarball remains self-contained for every platform, while an installed
48
+ // package no longer wastes disk space on binaries for other operating
49
+ // systems and CPU architectures.
50
+ for (const [candidateKey, candidate] of Object.entries(targets)) {
51
+ if (candidateKey === key) continue;
52
+ rmSync(dirname(candidate.source), { recursive: true, force: true });
53
+ }
54
+
55
+ if (platform !== "win32") {
56
+ chmodSync(target.dest, 0o755);
57
+ }
58
+
59
+ return { key, ...target };
60
+ }
@@ -1,45 +1,12 @@
1
- import { chmodSync, copyFileSync, existsSync, mkdirSync, rmSync } from "node:fs";
2
1
  import { dirname, join } from "node:path";
3
2
  import { fileURLToPath } from "node:url";
3
+ import { installNativeBinary } from "./install-lib.js";
4
4
 
5
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
6
6
  const packageRoot = join(__dirname, "..");
7
- const binDir = join(packageRoot, "bin");
8
-
9
- const targets = {
10
- "darwin-arm64": { source: join(packageRoot, "vendor", "darwin-arm64", "agentbox"), dest: join(binDir, "agentbox") },
11
- "darwin-x64": { source: join(packageRoot, "vendor", "darwin-amd64", "agentbox"), dest: join(binDir, "agentbox") },
12
- "linux-arm64": { source: join(packageRoot, "vendor", "linux-arm64", "agentbox"), dest: join(binDir, "agentbox") },
13
- "linux-x64": { source: join(packageRoot, "vendor", "linux-amd64", "agentbox"), dest: join(binDir, "agentbox") },
14
- "win32-x64": {
15
- source: join(packageRoot, "vendor", "windows-amd64", "agentbox.exe"),
16
- dest: join(binDir, "agentbox.exe")
17
- }
18
- };
19
-
20
- const key = `${process.platform}-${process.arch}`;
21
- const target = targets[key];
22
-
23
- if (!target) {
24
- console.error(
25
- [
26
- `Unsupported platform for @amxv/agentbox: ${process.platform}/${process.arch}.`,
27
- "Supported targets: darwin/arm64, darwin/x64, linux/arm64, linux/x64, windows/x64."
28
- ].join(" ")
29
- );
7
+ try {
8
+ installNativeBinary(packageRoot, process.platform, process.arch);
9
+ } catch (error) {
10
+ console.error(error instanceof Error ? error.message : String(error));
30
11
  process.exit(1);
31
12
  }
32
-
33
- if (!existsSync(target.source)) {
34
- console.error(`Missing packaged binary: ${target.source}. The release artifacts are incomplete.`);
35
- process.exit(1);
36
- }
37
-
38
- mkdirSync(binDir, { recursive: true });
39
- rmSync(join(binDir, "agentbox"), { force: true });
40
- rmSync(join(binDir, "agentbox.exe"), { force: true });
41
- copyFileSync(target.source, target.dest);
42
-
43
- if (process.platform !== "win32") {
44
- chmodSync(target.dest, 0o755);
45
- }
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@amxv/agentbox",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "targets": [
5
5
  {
6
6
  "dir": "darwin-arm64",
@@ -31,6 +31,12 @@
31
31
  "goos": "windows",
32
32
  "goarch": "amd64",
33
33
  "binary": "agentbox.exe"
34
+ },
35
+ {
36
+ "dir": "windows-arm64",
37
+ "goos": "windows",
38
+ "goarch": "arm64",
39
+ "binary": "agentbox.exe"
34
40
  }
35
41
  ]
36
42
  }
Binary file