molt-cli 1.0.1 → 1.0.2
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/cli.js +10 -2
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -120,10 +120,16 @@ function signMessage(message, privateKeyBase64) {
|
|
|
120
120
|
|
|
121
121
|
function computeProofOfWork(publicKey) {
|
|
122
122
|
let nonce = 0;
|
|
123
|
+
const startTime = Date.now();
|
|
123
124
|
while (true) {
|
|
124
125
|
const hash = crypto.createHash('sha256').update(publicKey + nonce).digest('hex');
|
|
125
|
-
if (hash.startsWith('
|
|
126
|
+
if (hash.startsWith('000000')) return nonce; // 6 zeros ≈ 5-15 seconds
|
|
126
127
|
nonce++;
|
|
128
|
+
// Safety: log progress every 5M hashes
|
|
129
|
+
if (nonce % 5000000 === 0) {
|
|
130
|
+
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
131
|
+
process.stdout.write(`\r Mining proof-of-work... ${(nonce / 1000000).toFixed(0)}M hashes (${elapsed}s)`);
|
|
132
|
+
}
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -858,7 +864,9 @@ async function cmdInstall(skillName) {
|
|
|
858
864
|
console.log(` ${C.dim}Installed to: ${C.cyan}${path.relative(process.cwd(), destDir) || destDir}${C.reset}`);
|
|
859
865
|
console.log();
|
|
860
866
|
} catch (err) {
|
|
861
|
-
|
|
867
|
+
// Clear any active spinners before showing error
|
|
868
|
+
process.stdout.write('\r\x1b[K');
|
|
869
|
+
errorMsg(err.error || err.message || 'Install failed', err.hint);
|
|
862
870
|
}
|
|
863
871
|
}
|
|
864
872
|
|