@holdyourvoice/hyv 2.8.0 → 2.8.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/CHANGELOG.md +5 -0
- package/package.json +2 -1
- package/scripts/postinstall-lib.js +60 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable CLI changes. Also mirrored to [holdyourvoice.com/changelog](https://holdyourvoice.com/changelog) for user-facing releases.
|
|
4
4
|
|
|
5
|
+
## [2.8.1] — 2026-06-12
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- `postinstall-lib.js` now included in published tarball — `npm install` no longer fails on postinstall
|
|
9
|
+
|
|
5
10
|
## [2.8.0] — 2026-06-12
|
|
6
11
|
|
|
7
12
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holdyourvoice/hyv",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Hold Your Voice — voice gate layer for AI workflows. make your ai agent sound exactly like you! includes 220+ AI pattern detection engine.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"files": [
|
|
52
52
|
"dist/",
|
|
53
53
|
"scripts/postinstall.js",
|
|
54
|
+
"scripts/postinstall-lib.js",
|
|
54
55
|
"scripts/check-no-duplicates.js",
|
|
55
56
|
"assets/",
|
|
56
57
|
"skills/",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* postinstall-lib.js — testable agent copy helpers (used by postinstall.js)
|
|
3
|
+
*/
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
function readPkgVersion(pkgDir) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(fs.readFileSync(path.join(pkgDir, 'package.json'), 'utf-8')).version;
|
|
10
|
+
} catch {
|
|
11
|
+
return 'unknown';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function readAgentsMarker(markerPath) {
|
|
16
|
+
try {
|
|
17
|
+
if (!fs.existsSync(markerPath)) return null;
|
|
18
|
+
return JSON.parse(fs.readFileSync(markerPath, 'utf-8'));
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function shouldUpgradeAgent(destFile, markerPath, pkgVersion) {
|
|
25
|
+
try {
|
|
26
|
+
if (!fs.existsSync(markerPath)) return !fs.existsSync(destFile);
|
|
27
|
+
const marker = readAgentsMarker(markerPath);
|
|
28
|
+
return !marker || marker.version !== pkgVersion;
|
|
29
|
+
} catch {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function copyAgent(src, dest, markerPath, pkgVersion) {
|
|
35
|
+
if (!fs.existsSync(src)) return { copied: false, reason: 'missing-src' };
|
|
36
|
+
if (!shouldUpgradeAgent(dest, markerPath, pkgVersion) && fs.existsSync(dest)) {
|
|
37
|
+
return { copied: false, reason: 'up-to-date' };
|
|
38
|
+
}
|
|
39
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
40
|
+
fs.copyFileSync(src, dest);
|
|
41
|
+
return { copied: true, reason: fs.existsSync(dest) ? 'upgraded' : 'created' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function writeAgentsMarker(hyvDir, pkgVersion) {
|
|
45
|
+
const markerPath = path.join(hyvDir, 'agents-version.json');
|
|
46
|
+
if (!fs.existsSync(hyvDir)) fs.mkdirSync(hyvDir, { recursive: true });
|
|
47
|
+
fs.writeFileSync(
|
|
48
|
+
markerPath,
|
|
49
|
+
JSON.stringify({ version: pkgVersion, updated_at: new Date().toISOString() }, null, 2)
|
|
50
|
+
);
|
|
51
|
+
return markerPath;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
readPkgVersion,
|
|
56
|
+
readAgentsMarker,
|
|
57
|
+
shouldUpgradeAgent,
|
|
58
|
+
copyAgent,
|
|
59
|
+
writeAgentsMarker,
|
|
60
|
+
};
|