mmwaa 0.1.8 → 0.1.10
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,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Decision 0012 couples the release target matrix across THREE files that must
|
|
4
|
+
// move together: scripts/cross-cc.sh (WAA_TARGETS_DEFAULT — the canonical
|
|
5
|
+
// GOOS/GOARCH build matrix), scripts/prepare-npm-package.sh (the artifacts it
|
|
6
|
+
// vendors into this package), and bin/targets.js (the launcher's
|
|
7
|
+
// platform->binary map). Nothing made them agree, so adding a target to the
|
|
8
|
+
// build matrix while forgetting targets.js shipped a release that built and
|
|
9
|
+
// vendored a binary the launcher could never select — that platform's users
|
|
10
|
+
// got "unsupported" from a release that looked complete. This guard derives the
|
|
11
|
+
// expected artifact + launcher entries from the canonical matrix and fails the
|
|
12
|
+
// release if either of the other two files disagrees. Treats cross-cc.sh as the
|
|
13
|
+
// single source of truth (it is sh-native and sourced by the build scripts, so
|
|
14
|
+
// it cannot be derived from node without making the build depend on node).
|
|
15
|
+
|
|
16
|
+
const { readFileSync } = require("node:fs");
|
|
17
|
+
const { join } = require("node:path");
|
|
18
|
+
|
|
19
|
+
const { targets, requiredArtifacts } = require("./targets");
|
|
20
|
+
|
|
21
|
+
const repoRoot = join(__dirname, "..", "..", "..");
|
|
22
|
+
const crossCcPath = join(repoRoot, "scripts", "cross-cc.sh");
|
|
23
|
+
const prepareNpmPath = join(repoRoot, "scripts", "prepare-npm-package.sh");
|
|
24
|
+
|
|
25
|
+
// GOOS/GOARCH -> Node process.platform/process.arch. These are the only values
|
|
26
|
+
// the build matrix can contain; an unmapped one means the matrix grew a target
|
|
27
|
+
// this guard (and the launcher) has no mapping for, which is itself the drift
|
|
28
|
+
// we want to catch loudly rather than guess past.
|
|
29
|
+
const platformForGoos = { darwin: "darwin", linux: "linux", windows: "win32" };
|
|
30
|
+
const archForGoarch = { amd64: "x64", arm64: "arm64" };
|
|
31
|
+
|
|
32
|
+
const errors = [];
|
|
33
|
+
|
|
34
|
+
// Parse the canonical matrix: WAA_TARGETS_DEFAULT="os/arch os/arch ...".
|
|
35
|
+
const crossCc = readFileSync(crossCcPath, "utf8");
|
|
36
|
+
const matrixMatch = crossCc.match(/WAA_TARGETS_DEFAULT="([^"]*)"/);
|
|
37
|
+
if (!matrixMatch) {
|
|
38
|
+
console.error(`check-targets: could not find WAA_TARGETS_DEFAULT in ${crossCcPath}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const matrix = matrixMatch[1].trim().split(/\s+/).filter(Boolean);
|
|
42
|
+
|
|
43
|
+
// Derive the expected artifact names and launcher map from the canonical matrix,
|
|
44
|
+
// using the SAME name shape as scripts/build-release.sh (waa-<os>-<arch>[.exe]).
|
|
45
|
+
const expectedBinaries = [];
|
|
46
|
+
const expectedTargets = {};
|
|
47
|
+
for (const entry of matrix) {
|
|
48
|
+
const [goos, goarch] = entry.split("/");
|
|
49
|
+
const platform = platformForGoos[goos];
|
|
50
|
+
const arch = archForGoarch[goarch];
|
|
51
|
+
if (!platform || !arch) {
|
|
52
|
+
errors.push(`cross-cc.sh matrix entry ${entry} has no Node platform/arch mapping in check-targets.js`);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const binary = `waa-${goos}-${goarch}${goos === "windows" ? ".exe" : ""}`;
|
|
56
|
+
expectedBinaries.push(binary);
|
|
57
|
+
expectedTargets[`${platform}-${arch}`] = binary;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const sortedJoin = (values) => [...new Set(values)].sort().join(", ");
|
|
61
|
+
const setEqual = (a, b) => sortedJoin(a) === sortedJoin(b);
|
|
62
|
+
|
|
63
|
+
// 1. targets.js launcher map must match the matrix exactly (keys and binaries).
|
|
64
|
+
const targetEntries = Object.entries(targets);
|
|
65
|
+
const expectedEntries = Object.entries(expectedTargets);
|
|
66
|
+
if (
|
|
67
|
+
!setEqual(Object.keys(targets), Object.keys(expectedTargets)) ||
|
|
68
|
+
targetEntries.some(([key, binary]) => expectedTargets[key] !== binary) ||
|
|
69
|
+
targetEntries.length !== expectedEntries.length
|
|
70
|
+
) {
|
|
71
|
+
errors.push(
|
|
72
|
+
`bin/targets.js map [${sortedJoin(targetEntries.map(([k, v]) => `${k}=>${v}`))}] ` +
|
|
73
|
+
`does not match the cross-cc.sh matrix [${sortedJoin(expectedEntries.map(([k, v]) => `${k}=>${v}`))}]`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 2. targets.js requiredArtifacts must be every expected binary plus SHA256SUMS.
|
|
78
|
+
const expectedArtifacts = [...expectedBinaries, "SHA256SUMS"];
|
|
79
|
+
if (!setEqual(requiredArtifacts, expectedArtifacts)) {
|
|
80
|
+
errors.push(
|
|
81
|
+
`bin/targets.js requiredArtifacts [${sortedJoin(requiredArtifacts)}] ` +
|
|
82
|
+
`does not match the expected set [${sortedJoin(expectedArtifacts)}]`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 3. prepare-npm-package.sh must vendor exactly the expected binaries (it lists
|
|
87
|
+
// them as literal waa-<os>-<arch> tokens in its artifact/copy block).
|
|
88
|
+
const prepareNpm = readFileSync(prepareNpmPath, "utf8");
|
|
89
|
+
const vendoredBinaries = prepareNpm.match(/waa-[a-z0-9]+-[a-z0-9]+(?:\.exe)?/g) || [];
|
|
90
|
+
if (!setEqual(vendoredBinaries, expectedBinaries)) {
|
|
91
|
+
errors.push(
|
|
92
|
+
`scripts/prepare-npm-package.sh vendors [${sortedJoin(vendoredBinaries)}] ` +
|
|
93
|
+
`but the cross-cc.sh matrix expects [${sortedJoin(expectedBinaries)}]`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (!prepareNpm.includes("SHA256SUMS")) {
|
|
97
|
+
errors.push("scripts/prepare-npm-package.sh does not reference SHA256SUMS");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (errors.length > 0) {
|
|
101
|
+
console.error("waa: release target matrix is out of sync across the three files coupled by decision 0012:");
|
|
102
|
+
for (const error of errors) {
|
|
103
|
+
console.error(` - ${error}`);
|
|
104
|
+
}
|
|
105
|
+
console.error("Update scripts/cross-cc.sh, scripts/prepare-npm-package.sh, and bin/targets.js together.");
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
console.log(`check-targets: release target matrix consistent across cross-cc.sh, prepare-npm-package.sh, targets.js (${matrix.join(" ")})`);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mmwaa",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Zero-config launcher for the waa WhatsApp automation CLI + MCP server",
|
|
5
5
|
"bin": {
|
|
6
6
|
"waa": "bin/waa.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"prepublishOnly": "node bin/check-package.js"
|
|
9
|
+
"prepublishOnly": "node bin/check-targets.js && node bin/check-package.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"bin/",
|
package/vendor/SHA256SUMS
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
414635a9c07cc9d37f90de3cfa6b18ca9ede0adc50163cbd740a9e67bea57bc9 waa-darwin-amd64
|
|
2
|
+
8997d4391cb251bf2085a8a876fd069387c473a8945121bfc764b851b2712de7 waa-darwin-arm64
|
|
3
|
+
003594788c58d1b2732f7e12965a1879b2fcf3b08733210f5f79d59fe7ece4a4 waa-linux-amd64
|
|
4
|
+
ecf8352427f1ecfefb06aeda06c8bc7a95e4bdb35c480de85e72a1d5e48e7709 waa-linux-arm64
|
|
5
|
+
0503c8d73bbd26eca2e8bad1bb9dca0f31a63af8c1e9119f056d86dda4f9e21a waa-windows-amd64.exe
|
package/vendor/waa-darwin-amd64
CHANGED
|
Binary file
|
package/vendor/waa-darwin-arm64
CHANGED
|
Binary file
|
package/vendor/waa-linux-amd64
CHANGED
|
Binary file
|
package/vendor/waa-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|