viepilot 3.9.0 → 3.9.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 CHANGED
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ---
11
11
 
12
+ ## [3.9.1] - 2026-05-25
13
+
14
+ ### Fixed
15
+ - BUG-031: `vp-tools hooks install` wrote wrong hook path (`~/.viepilot/hooks/
16
+ brainstorm-staleness.cjs`) which does not exist; corrected to
17
+ `{adapter.viepilotDir}/lib/hooks/brainstorm-staleness.cjs`; Stop hook no longer
18
+ exits non-zero each turn
19
+ - BUG-031: `vp-tools hooks install` (re-run) now detects and removes stale wrong-path
20
+ entries from settings.json before writing the correct entry
21
+
22
+ ---
23
+
12
24
  ## [3.9.0] - 2026-05-24
13
25
 
14
26
  ### Changed
package/bin/vp-tools.cjs CHANGED
@@ -1007,7 +1007,7 @@ ${colors.cyan}Examples:${colors.reset}
1007
1007
  matcher: {},
1008
1008
  hooks: [{
1009
1009
  type: 'command',
1010
- command: `node ${path.join(home, '.viepilot', 'hooks', 'brainstorm-staleness.cjs')}`
1010
+ command: `node ${path.join(adapter.viepilotDir(home), 'lib', 'hooks', 'brainstorm-staleness.cjs')}`
1011
1011
  }]
1012
1012
  }]
1013
1013
  }
@@ -1024,7 +1024,7 @@ ${colors.cyan}Examples:${colors.reset}
1024
1024
  }
1025
1025
  const home = os.homedir();
1026
1026
  const configPath = adapter.hooks.configFile(home);
1027
- const hookCommand = `node ${path.join(home, '.viepilot', 'hooks', 'brainstorm-staleness.cjs')}`;
1027
+ const hookCommand = `node ${path.join(adapter.viepilotDir(home), 'lib', 'hooks', 'brainstorm-staleness.cjs')}`;
1028
1028
 
1029
1029
  // Read existing settings.json (create if missing)
1030
1030
  let settings = {};
@@ -1032,15 +1032,22 @@ ${colors.cyan}Examples:${colors.reset}
1032
1032
  try { settings = JSON.parse(fs.readFileSync(configPath, 'utf8')); } catch (_e) { settings = {}; }
1033
1033
  }
1034
1034
 
1035
- // Merge hook entry — idempotent check
1035
+ // Merge hook entry — migration + idempotent check
1036
1036
  if (!settings.hooks) settings.hooks = {};
1037
1037
  if (!settings.hooks.Stop) settings.hooks.Stop = [];
1038
1038
 
1039
+ // Step A: remove any stale entry with the OLD wrong path
1040
+ const wrongPath = `node ${path.join(home, '.viepilot', 'hooks', 'brainstorm-staleness.cjs')}`;
1041
+ settings.hooks.Stop = settings.hooks.Stop.filter((entry) =>
1042
+ !(Array.isArray(entry.hooks) &&
1043
+ entry.hooks.some((h) => h.type === 'command' && h.command === wrongPath))
1044
+ );
1045
+
1046
+ // Step B: idempotent check for correct path
1039
1047
  const alreadyInstalled = settings.hooks.Stop.some((entry) =>
1040
1048
  Array.isArray(entry.hooks) &&
1041
1049
  entry.hooks.some((h) => h.type === 'command' && h.command === hookCommand)
1042
1050
  );
1043
-
1044
1051
  if (alreadyInstalled) {
1045
1052
  console.log(formatSuccess('ViePilot staleness hook already installed.'));
1046
1053
  console.log(` Config: ${configPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viepilot",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "**Autonomous Vibe Coding Framework / Bộ khung phát triển tự động có kiểm soát**",
5
5
  "main": "index.js",
6
6
  "bin": {