@ngocsangairvds/vsaf 3.2.13 → 3.2.14

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/global.js +33 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngocsangairvds/vsaf",
3
- "version": "3.2.13",
3
+ "version": "3.2.14",
4
4
  "description": "improve confluence format",
5
5
  "keywords": ["claude", "claude-code", "ai", "sdlc", "framework", "bmad", "gitnexus", "superpowers"],
6
6
  "bin": {
package/src/global.js CHANGED
@@ -87,16 +87,19 @@ function installVdsCliwrapper(vdsRoot) {
87
87
  fs.mkdirSync(wrapperDir, { recursive: true });
88
88
  fs.writeFileSync(wrapperPath, [
89
89
  '@echo off',
90
+ 'setlocal',
90
91
  `set "ROOT=${vdsRoot}"`,
91
92
  `set "VENV=%ROOT%\\.venv"`,
92
93
  `if exist "%USERPROFILE%\\.vds\\.env" (`,
93
- ` for /f "usebackq tokens=*" %%a in ("%USERPROFILE%\\.vds\\.env") do set "%%a"`,
94
+ ` for /f "usebackq eol=# tokens=1,* delims==" %%a in ("%USERPROFILE%\\.vds\\.env") do (`,
95
+ ` if not "%%a"=="" if not "%%b"=="" set "%%a=%%b"`,
96
+ ` )`,
94
97
  `)`,
95
98
  `"%VENV%\\Scripts\\vds-cli.exe" %*`,
99
+ 'endlocal',
96
100
  ].join('\r\n'));
97
101
  ok(`vds-cli wrapper → ${wrapperPath}`);
98
- const inPath = (process.env.PATH || '').split(';').some(p => p.toLowerCase() === wrapperDir.toLowerCase());
99
- if (!inPath) warn(`Thêm vào PATH: ${wrapperDir}`);
102
+ ensureWindowsPath(wrapperDir);
100
103
  } else {
101
104
  const wrapperDir = path.join(os.homedir(), '.local', 'bin');
102
105
  const wrapperPath = path.join(wrapperDir, 'vds-cli');
@@ -118,6 +121,33 @@ function installVdsCliwrapper(vdsRoot) {
118
121
  }
119
122
  }
120
123
 
124
+ function ensureWindowsPath(wrapperDir) {
125
+ const { execSync } = require('child_process');
126
+ try {
127
+ const currentUserPath = (execSync(
128
+ `powershell -NoProfile -Command "[Environment]::GetEnvironmentVariable('Path','User')"`,
129
+ { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }
130
+ ) || '').trim();
131
+
132
+ const segments = currentUserPath.split(';').filter(Boolean);
133
+ const target = wrapperDir.replace(/\\+$/, '').toLowerCase();
134
+ if (segments.some(p => p.replace(/\\+$/, '').toLowerCase() === target)) {
135
+ ok(`PATH đã có ${wrapperDir}`);
136
+ return;
137
+ }
138
+
139
+ const newPath = currentUserPath ? `${currentUserPath};${wrapperDir}` : wrapperDir;
140
+ execSync(
141
+ `powershell -NoProfile -Command "[Environment]::SetEnvironmentVariable('Path', $env:VSAF_NEW_PATH, 'User')"`,
142
+ { stdio: ['ignore', 'pipe', 'pipe'], env: { ...process.env, VSAF_NEW_PATH: newPath } }
143
+ );
144
+ ok(`Đã thêm ${wrapperDir} vào user PATH`);
145
+ warn('Mở terminal mới để PATH có hiệu lực.');
146
+ } catch {
147
+ warn(`Không thể tự thêm PATH. Vui lòng thêm thủ công: ${wrapperDir}`);
148
+ }
149
+ }
150
+
121
151
  async function setupVdsScriptsMcp() {
122
152
  step('VDS Scripts MCP');
123
153