mmwaa 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.
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { existsSync, statSync, readFileSync } = require("node:fs");
4
+ const { join } = require("node:path");
5
+ const { spawnSync } = require("node:child_process");
6
+ const { createHash } = require("node:crypto");
7
+
8
+ const packageJson = require("../package.json");
9
+ const { targets, requiredArtifacts: required } = require("./targets");
10
+
11
+ const vendorDir = join(__dirname, "..", "vendor");
12
+ const missing = required.filter((name) => {
13
+ const path = join(vendorDir, name);
14
+ return !existsSync(path) || statSync(path).size === 0;
15
+ });
16
+
17
+ if (missing.length > 0) {
18
+ console.error(`waa: package is missing release artifacts: ${missing.join(", ")}`);
19
+ console.error("Run scripts/build-release.sh <version> and scripts/prepare-npm-package.sh <version> before npm publish.");
20
+ process.exit(1);
21
+ }
22
+
23
+ // Verify each vendored binary against the bundled SHA256SUMS manifest so a
24
+ // corrupted or swapped binary is caught before publish rather than by users.
25
+ const expectedSums = new Map(
26
+ readFileSync(join(vendorDir, "SHA256SUMS"), "utf8")
27
+ .split("\n")
28
+ .map((line) => line.trim())
29
+ .filter(Boolean)
30
+ .map((line) => {
31
+ const [hash, name] = line.split(/\s+/);
32
+ return [name, hash];
33
+ })
34
+ );
35
+
36
+ const mismatched = required
37
+ .filter((name) => name !== "SHA256SUMS")
38
+ .flatMap((name) => {
39
+ const want = expectedSums.get(name);
40
+ if (!want) {
41
+ return [`${name} (no SHA256SUMS entry)`];
42
+ }
43
+ const got = createHash("sha256").update(readFileSync(join(vendorDir, name))).digest("hex");
44
+ return got === want ? [] : [`${name} (expected ${want}, got ${got})`];
45
+ });
46
+
47
+ if (mismatched.length > 0) {
48
+ console.error(`waa: vendored binaries do not match SHA256SUMS: ${mismatched.join("; ")}`);
49
+ console.error("Re-run scripts/build-release.sh <version> and scripts/prepare-npm-package.sh <version>.");
50
+ process.exit(1);
51
+ }
52
+
53
+ // Probe the binary for THIS host against the package version so a stale or
54
+ // mis-stamped build is caught before publish. `waa version` prints
55
+ // "waa <version> ..." (internal/version.Summary).
56
+ const currentTarget = targets[`${process.platform}-${process.arch}`];
57
+ if (currentTarget) {
58
+ const binaryPath = join(vendorDir, currentTarget);
59
+ const result = spawnSync(binaryPath, ["version"], { encoding: "utf8" });
60
+ const output = `${result.stdout}${result.stderr}`;
61
+ if (result.status !== 0 || !output.includes(`waa ${packageJson.version}`)) {
62
+ console.error(`waa: ${currentTarget} version does not match package ${packageJson.version}`);
63
+ console.error(output.trim());
64
+ process.exit(1);
65
+ }
66
+ }
package/bin/targets.js ADDED
@@ -0,0 +1,16 @@
1
+ // Single source of truth for the platform -> bundled-binary mapping shared by
2
+ // the launcher (waa.js) and the prepublish guard (check-package.js). Keep this
3
+ // list in step with the GOOS/GOARCH matrix in scripts/cross-cc.sh.
4
+ const targets = {
5
+ "darwin-arm64": "waa-darwin-arm64",
6
+ "darwin-x64": "waa-darwin-amd64",
7
+ "linux-arm64": "waa-linux-arm64",
8
+ "linux-x64": "waa-linux-amd64",
9
+ "win32-x64": "waa-windows-amd64.exe"
10
+ };
11
+
12
+ // The artifacts a complete package must vendor: every mapped binary plus the
13
+ // checksum manifest used to verify them.
14
+ const requiredArtifacts = [...new Set(Object.values(targets)), "SHA256SUMS"];
15
+
16
+ module.exports = { targets, requiredArtifacts };
package/bin/waa.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("node:child_process");
4
+ const { existsSync } = require("node:fs");
5
+ const { join } = require("node:path");
6
+
7
+ const { targets } = require("./targets");
8
+
9
+ const target = `${process.platform}-${process.arch}`;
10
+ const executable = targets[target];
11
+
12
+ if (!executable) {
13
+ console.error(`waa: unsupported platform ${target}`);
14
+ process.exit(1);
15
+ }
16
+
17
+ const binaryPath = join(__dirname, "..", "vendor", executable);
18
+ if (!existsSync(binaryPath)) {
19
+ console.error(`waa: missing bundled binary ${executable}`);
20
+ console.error("Run the release packaging script before publishing this package.");
21
+ process.exit(1);
22
+ }
23
+
24
+ const child = spawn(binaryPath, process.argv.slice(2), {
25
+ stdio: "inherit",
26
+ env: process.env
27
+ });
28
+
29
+ child.on("error", (error) => {
30
+ console.error(`waa: failed to start ${binaryPath}: ${error.message}`);
31
+ process.exit(1);
32
+ });
33
+
34
+ child.on("exit", (code, signal) => {
35
+ if (signal) {
36
+ process.kill(process.pid, signal);
37
+ return;
38
+ }
39
+ process.exit(code ?? 0);
40
+ });
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "mmwaa",
3
+ "version": "0.1.0",
4
+ "description": "Zero-config launcher for the waa WhatsApp automation CLI + MCP server",
5
+ "bin": {
6
+ "waa": "bin/waa.js"
7
+ },
8
+ "scripts": {
9
+ "prepublishOnly": "node bin/check-package.js"
10
+ },
11
+ "files": [
12
+ "bin/",
13
+ "vendor/"
14
+ ],
15
+ "keywords": [
16
+ "mcp",
17
+ "whatsapp",
18
+ "claude",
19
+ "cli"
20
+ ],
21
+ "license": "UNLICENSED",
22
+ "private": false,
23
+ "engines": {
24
+ "node": ">=18"
25
+ }
26
+ }
@@ -0,0 +1,5 @@
1
+ 5fe0559d790896e441e95361717cfed514465bef159240e0edf2bcf933a17aa4 waa-darwin-amd64
2
+ 45b8055ce0fb069496f94608b1836e6bf6cf95a01fdfb597868b82d944355116 waa-darwin-arm64
3
+ b3264ad34b66148e7ee0b560b0ade52bf12431d969ef0a26bdb0cf5fdac2dfca waa-linux-amd64
4
+ dd2e00240702340533cf2dc449bba58eb4b87751cf3c3f569ffba80859004ad4 waa-linux-arm64
5
+ 8b330d50f284f00ffd1a5f85ebd49a9dd19a2f72b54d1be65581bf24cdce86dd waa-windows-amd64.exe
Binary file
Binary file
Binary file
Binary file
Binary file