@sdotwinter/openclaw-deterministic 0.17.0 → 0.17.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/bin/install.js +4 -10
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const os = require("os");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const crypto = require("crypto");
|
|
7
6
|
|
|
8
7
|
// -----------------------------
|
|
9
8
|
// Args
|
|
@@ -91,10 +90,6 @@ function timestamp() {
|
|
|
91
90
|
return new Date().toISOString().replace(/:/g, "-");
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
function sha256(content) {
|
|
95
|
-
return crypto.createHash("sha256").update(content).digest("hex");
|
|
96
|
-
}
|
|
97
|
-
|
|
98
93
|
function backupSnapshot(pathsToBackup) {
|
|
99
94
|
if (DRY_RUN) {
|
|
100
95
|
console.log("[DRY-RUN] Would create backup snapshot.");
|
|
@@ -124,12 +119,11 @@ function backupSnapshot(pathsToBackup) {
|
|
|
124
119
|
function copyWithVersionStamp(src, dest) {
|
|
125
120
|
const raw = readFile(src);
|
|
126
121
|
const clean = raw.replace(/^\uFEFF/, "");
|
|
127
|
-
const hash = sha256(clean);
|
|
128
|
-
|
|
129
|
-
const stamped = `${VERSION_STAMP}
|
|
130
|
-
<!-- Canonical-Hash: SHA256:${hash} -->
|
|
131
122
|
|
|
132
|
-
|
|
123
|
+
// IMPORTANT:
|
|
124
|
+
// Do NOT generate or modify canonical hash.
|
|
125
|
+
// Template already contains canonical hash header.
|
|
126
|
+
const stamped = `${VERSION_STAMP}\n${clean}`;
|
|
133
127
|
|
|
134
128
|
writeFile(dest, stamped);
|
|
135
129
|
|