@buun_group/dna 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 (4) hide show
  1. package/README.md +51 -0
  2. package/bin/dna +58 -0
  3. package/install.js +47 -0
  4. package/package.json +38 -0
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @buun_group/dna
2
+
3
+ **DESTROY.NETWORK Agent CLI** — privacy-first disposable email automation from the command line.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @buun_group/dna
9
+ ```
10
+
11
+ Pre-built binaries are available for:
12
+
13
+ - Linux x64 / arm64
14
+ - macOS x64 / arm64 (Apple Silicon)
15
+ - Windows x64
16
+
17
+ No Go toolchain required.
18
+
19
+ ## Usage
20
+
21
+ ```bash
22
+ # Show help
23
+ dna --help
24
+
25
+ # Authenticate
26
+ dna login
27
+
28
+ # Create a disposable inbox
29
+ dna inbox create
30
+
31
+ # List messages
32
+ dna inbox messages <address>
33
+ ```
34
+
35
+ ## How It Works
36
+
37
+ This package installs a platform-specific binary via `optionalDependencies`. npm automatically downloads only the binary matching your OS and architecture.
38
+
39
+ ## Building from Source
40
+
41
+ If you have Go installed, you can build directly:
42
+
43
+ ```bash
44
+ git clone https://github.com/buun-group/destroy-network
45
+ cd destroy-network/packages/destroy-agent-cli
46
+ go build -o dna .
47
+ ```
48
+
49
+ ## License
50
+
51
+ MIT
package/bin/dna ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+ const { platform, arch } = process;
7
+
8
+ const PLATFORMS = {
9
+ "linux-x64": "@buun_group/dna-linux-x64",
10
+ "linux-arm64": "@buun_group/dna-linux-arm64",
11
+ "darwin-x64": "@buun_group/dna-darwin-x64",
12
+ "darwin-arm64": "@buun_group/dna-darwin-arm64",
13
+ "win32-x64": "@buun_group/dna-win32-x64",
14
+ };
15
+
16
+ const key = `${platform}-${arch}`;
17
+ const pkg = PLATFORMS[key];
18
+
19
+ if (!pkg) {
20
+ console.error(
21
+ `Unsupported platform: ${platform}-${arch}\n` +
22
+ `dna supports: ${Object.keys(PLATFORMS).join(", ")}`
23
+ );
24
+ process.exit(1);
25
+ }
26
+
27
+ const ext = platform === "win32" ? ".exe" : "";
28
+ const npmDir = pkg.replace("@buun_group/", "");
29
+ let binaryPath;
30
+
31
+ // Try require.resolve first (works when installed via npm)
32
+ try {
33
+ binaryPath = require.resolve(`${pkg}/bin/dna${ext}`);
34
+ } catch {
35
+ // Fallback to local dev path (for testing before publish)
36
+ const localPath = path.join(__dirname, "..", "npm", npmDir, "bin", `dna${ext}`);
37
+ if (fs.existsSync(localPath)) {
38
+ binaryPath = localPath;
39
+ } else {
40
+ console.error(
41
+ `Could not find the dna binary for ${platform}-${arch}.\n` +
42
+ `The platform package ${pkg} may not have been installed.\n` +
43
+ `Try reinstalling: npm install -g @buun_group/dna`
44
+ );
45
+ process.exit(1);
46
+ }
47
+ }
48
+
49
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
50
+ stdio: "inherit",
51
+ });
52
+
53
+ if (result.error) {
54
+ console.error(`Failed to execute dna: ${result.error.message}`);
55
+ process.exit(1);
56
+ }
57
+
58
+ process.exitCode = result.status;
package/install.js ADDED
@@ -0,0 +1,47 @@
1
+ const path = require("path");
2
+ const fs = require("fs");
3
+ const { platform, arch } = process;
4
+
5
+ const PLATFORMS = {
6
+ "linux-x64": "@buun_group/dna-linux-x64",
7
+ "linux-arm64": "@buun_group/dna-linux-arm64",
8
+ "darwin-x64": "@buun_group/dna-darwin-x64",
9
+ "darwin-arm64": "@buun_group/dna-darwin-arm64",
10
+ "win32-x64": "@buun_group/dna-win32-x64",
11
+ };
12
+
13
+ const key = `${platform}-${arch}`;
14
+ const pkg = PLATFORMS[key];
15
+
16
+ if (!pkg) {
17
+ console.warn(
18
+ `warn: @buun_group/dna does not support ${platform}-${arch}.\n` +
19
+ `Supported platforms: ${Object.keys(PLATFORMS).join(", ")}\n` +
20
+ `You can build from source: https://github.com/buun-group/destroy-network`
21
+ );
22
+ process.exit(0);
23
+ }
24
+
25
+ const ext = platform === "win32" ? ".exe" : "";
26
+ const npmDir = pkg.replace("@buun_group/", "");
27
+
28
+ let found = false;
29
+ try {
30
+ require.resolve(`${pkg}/bin/dna${ext}`);
31
+ found = true;
32
+ } catch {
33
+ // Check local dev path
34
+ const localPath = path.join(__dirname, "npm", npmDir, "bin", `dna${ext}`);
35
+ found = fs.existsSync(localPath);
36
+ }
37
+
38
+ if (!found) {
39
+ console.warn(
40
+ `warn: The platform package ${pkg} was not installed.\n` +
41
+ `This can happen if your package manager doesn't support optionalDependencies with os/cpu filters.\n\n` +
42
+ `To fix this, install the platform package directly:\n` +
43
+ ` npm install ${pkg}\n\n` +
44
+ `Or build from source:\n` +
45
+ ` https://github.com/buun-group/destroy-network`
46
+ );
47
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@buun_group/dna",
3
+ "version": "0.1.0",
4
+ "description": "DESTROY.NETWORK Agent CLI — privacy-first disposable email automation",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "dna": "bin/dna"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node install.js"
11
+ },
12
+ "optionalDependencies": {
13
+ "@buun_group/dna-linux-x64": "0.1.0",
14
+ "@buun_group/dna-linux-arm64": "0.1.0",
15
+ "@buun_group/dna-darwin-x64": "0.1.0",
16
+ "@buun_group/dna-darwin-arm64": "0.1.0",
17
+ "@buun_group/dna-win32-x64": "0.1.0"
18
+ },
19
+ "files": [
20
+ "bin",
21
+ "install.js",
22
+ "README.md"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/buun-group/destroy-network"
30
+ },
31
+ "keywords": [
32
+ "dna",
33
+ "destroy-network",
34
+ "disposable-email",
35
+ "cli",
36
+ "agent"
37
+ ]
38
+ }