@holdyourvoice/hyv 2.8.2 → 2.8.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holdyourvoice/hyv",
3
- "version": "2.8.2",
3
+ "version": "2.8.4",
4
4
  "description": "Free local AI writing scan for cursor & claude. MCP server, 220+ pattern detection, voice profiles. npx @holdyourvoice/hyv welcome",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "chalk": "^4.1.2",
44
44
  "commander": "^12.1.0",
45
- "glob": "^11.0.0",
45
+ "glob": "^13.0.6",
46
46
  "open": "^8.4.2"
47
47
  },
48
48
  "devDependencies": {
@@ -51,10 +51,33 @@ function writeAgentsMarker(hyvDir, pkgVersion) {
51
51
  return markerPath;
52
52
  }
53
53
 
54
+ function onboardingPath(hyvDir) {
55
+ return path.join(hyvDir, 'onboarding-complete.json');
56
+ }
57
+
58
+ function hasCompletedOnboarding(hyvDir) {
59
+ try {
60
+ return fs.existsSync(onboardingPath(hyvDir));
61
+ } catch {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ function markOnboardingComplete(hyvDir, pkgVersion) {
67
+ if (!fs.existsSync(hyvDir)) fs.mkdirSync(hyvDir, { recursive: true });
68
+ fs.writeFileSync(
69
+ onboardingPath(hyvDir),
70
+ JSON.stringify({ version: pkgVersion, completed_at: new Date().toISOString() }, null, 2)
71
+ );
72
+ }
73
+
54
74
  module.exports = {
55
75
  readPkgVersion,
56
76
  readAgentsMarker,
57
77
  shouldUpgradeAgent,
58
78
  copyAgent,
59
79
  writeAgentsMarker,
80
+ onboardingPath,
81
+ hasCompletedOnboarding,
82
+ markOnboardingComplete,
60
83
  };
@@ -5,15 +5,19 @@
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
7
  const os = require('os');
8
- const readline = require('readline');
9
-
10
8
  const home = os.homedir();
11
9
  const isWin = process.platform === 'win32';
12
10
  const pkgDir = path.resolve(__dirname, '..');
13
11
  const quiet = process.env.HYV_POSTINSTALL_QUIET === '1' || process.argv.includes('--quiet');
14
12
  const hyvDir = path.join(home, '.hyv');
15
13
  const agentsMarker = path.join(hyvDir, 'agents-version.json');
16
- const { readPkgVersion, copyAgent, writeAgentsMarker } = require('./postinstall-lib');
14
+ const {
15
+ readPkgVersion,
16
+ copyAgent,
17
+ writeAgentsMarker,
18
+ hasCompletedOnboarding,
19
+ markOnboardingComplete,
20
+ } = require('./postinstall-lib');
17
21
 
18
22
  const pkgVersion = readPkgVersion(pkgDir);
19
23
 
@@ -119,21 +123,23 @@ if (configured.length > 0) {
119
123
  print('');
120
124
  }
121
125
 
122
- // Optional interactive demo (TTY only, non-quiet)
123
- if (!quiet && process.stdin.isTTY) {
124
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
125
- rl.question(' See quick free demo? (y/N) ', (answer) => {
126
- rl.close();
127
- if (answer.trim().toLowerCase() === 'y') {
128
- try {
129
- const { execSync } = require('child_process');
130
- execSync('node "' + path.join(pkgDir, 'dist', 'index.js') + '" welcome', {
131
- stdio: 'inherit',
132
- env: process.env,
133
- });
134
- } catch {
135
- print(' (run: hyv welcome)');
136
- }
137
- }
138
- });
126
+ // First install onboarding during install when npm shows script output; else first `hyv` runs it
127
+ const canShowOnboarding =
128
+ process.stdout.isTTY || process.env.npm_config_foreground_scripts === 'true';
129
+
130
+ if (!quiet && !hasCompletedOnboarding(hyvDir) && canShowOnboarding) {
131
+ print('');
132
+ print(' starting onboarding...');
133
+ print('');
134
+ try {
135
+ const { execSync } = require('child_process');
136
+ execSync('node "' + path.join(pkgDir, 'dist', 'index.js') + '" welcome', {
137
+ stdio: 'inherit',
138
+ env: { ...process.env, HYV_POSTINSTALL_ONBOARDING: '1' },
139
+ });
140
+ markOnboardingComplete(hyvDir, pkgVersion);
141
+ } catch {
142
+ print(' finish setup: hyv welcome');
143
+ print('');
144
+ }
139
145
  }