@ngocsangairvds/vsaf 4.0.12 → 4.0.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.
- package/package.json +3 -2
- package/packages/cli/dist/commands/init.d.ts +1 -5
- package/packages/cli/dist/commands/init.d.ts.map +1 -1
- package/packages/cli/dist/commands/init.js +4 -18
- package/packages/cli/dist/commands/init.js.map +1 -1
- package/scripts/postinstall.js +73 -0
- package/skills/vds-skill/install-deps.mjs +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngocsangairvds/vsaf",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.14",
|
|
4
4
|
"description": "is it ready to use ?",
|
|
5
5
|
"main": "packages/core/dist/index.js",
|
|
6
6
|
"types": "packages/core/dist/index.d.ts",
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"packages/core/dist",
|
|
22
22
|
"packages/cli/dist",
|
|
23
|
+
"scripts",
|
|
23
24
|
"workflows",
|
|
24
25
|
"commands",
|
|
25
26
|
"skills"
|
|
26
27
|
],
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "npm run build --workspaces",
|
|
29
|
-
"postinstall": "node
|
|
30
|
+
"postinstall": "node scripts/postinstall.js",
|
|
30
31
|
"prepack": "cp package.json package.json.bak && node -e \"const f='package.json',j=JSON.parse(require('fs').readFileSync(f));delete j.workspaces;require('fs').writeFileSync(f,JSON.stringify(j,null,2)+'\\n')\"",
|
|
31
32
|
"postpack": "mv package.json.bak package.json",
|
|
32
33
|
"test": "vitest run",
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
/** Skill pack to auto-install. Default: 'sdlc'. Pass false to skip. */
|
|
3
|
-
pack?: string | false;
|
|
4
|
-
}
|
|
5
|
-
export declare function execInit(projectPath: string, options?: InitOptions): Promise<void>;
|
|
1
|
+
export declare function execInit(projectPath: string): Promise<void>;
|
|
6
2
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAiBA,wBAAsB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCjE"}
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.execInit = execInit;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
-
const skill_js_1 = require("./skill.js");
|
|
7
|
-
const install_js_1 = require("./install.js");
|
|
8
6
|
const DEFAULT_CONFIG = `provider: claude
|
|
9
7
|
model: sonnet
|
|
10
8
|
isolation:
|
|
@@ -18,30 +16,16 @@ isolation:
|
|
|
18
16
|
- .vsaf/storage
|
|
19
17
|
max_workspaces: 5
|
|
20
18
|
`;
|
|
21
|
-
async function execInit(projectPath
|
|
19
|
+
async function execInit(projectPath) {
|
|
22
20
|
const vsafDir = (0, path_1.join)(projectPath, '.vsaf');
|
|
23
21
|
if ((0, fs_1.existsSync)(vsafDir)) {
|
|
24
22
|
throw new Error(`.vsaf/ already exists at ${projectPath}. Remove it first to reinitialize.`);
|
|
25
23
|
}
|
|
24
|
+
// Create .vsaf/ directory structure
|
|
26
25
|
(0, fs_1.mkdirSync)((0, path_1.join)(vsafDir, 'workflows'), { recursive: true });
|
|
27
26
|
(0, fs_1.mkdirSync)((0, path_1.join)(vsafDir, 'commands'), { recursive: true });
|
|
28
27
|
(0, fs_1.mkdirSync)((0, path_1.join)(vsafDir, 'storage'), { recursive: true });
|
|
29
28
|
(0, fs_1.writeFileSync)((0, path_1.join)(vsafDir, 'config.yaml'), DEFAULT_CONFIG, 'utf-8');
|
|
30
|
-
// Auto-install skill pack (default: sdlc)
|
|
31
|
-
const packName = options?.pack !== false ? (options?.pack ?? 'sdlc') : null;
|
|
32
|
-
if (packName) {
|
|
33
|
-
const packDir = (0, skill_js_1.resolveSource)(packName);
|
|
34
|
-
const packInfo = (0, skill_js_1.resolvePackInfo)(packName, projectPath);
|
|
35
|
-
const skillsDir = (0, path_1.join)(projectPath, '.claude', 'skills');
|
|
36
|
-
(0, install_js_1.deploySkills)(packDir, packName, packInfo.skillNames, skillsDir, {});
|
|
37
|
-
if (packInfo.bundledNames.length > 0) {
|
|
38
|
-
(0, install_js_1.deploySkills)(packDir, packName, packInfo.bundledNames, skillsDir, { noPrefix: true });
|
|
39
|
-
}
|
|
40
|
-
const prefixedNames = packInfo.skillNames
|
|
41
|
-
.filter(n => n !== 'setup')
|
|
42
|
-
.map(n => `${packName}-${n}`);
|
|
43
|
-
(0, skill_js_1.skillInit)(packName, projectPath, prefixedNames, { workflows: packInfo.workflows });
|
|
44
|
-
}
|
|
45
29
|
// Create .mcp.json for MCP server registration
|
|
46
30
|
const mcpPath = (0, path_1.join)(projectPath, '.mcp.json');
|
|
47
31
|
const vsafServer = { type: 'stdio', command: 'vsaf', args: ['mcp'] };
|
|
@@ -73,5 +57,7 @@ async function execInit(projectPath, options) {
|
|
|
73
57
|
(0, fs_1.writeFileSync)(mcpPath, JSON.stringify(existing, null, 2) + '\n', 'utf-8');
|
|
74
58
|
}
|
|
75
59
|
}
|
|
60
|
+
console.log(`\n[vsaf] Initialized .vsaf/ at ${projectPath}`);
|
|
61
|
+
console.log('[vsaf] Next: vsaf install sdlc (deploy skills + dependencies)\n');
|
|
76
62
|
}
|
|
77
63
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;A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vsaf/core workspace link
|
|
5
|
+
*
|
|
6
|
+
* Monorepo workspace links are stripped during `npm pack` (prepack removes
|
|
7
|
+
* "workspaces" from package.json). This script recreates the link so that
|
|
8
|
+
* `require('@vsaf/core')` works after `npm install -g`.
|
|
9
|
+
*
|
|
10
|
+
* Strategy (in order):
|
|
11
|
+
* 1. symlink (macOS/Linux) or junction (Windows — no admin needed)
|
|
12
|
+
* 2. cpSync fallback (copy dist/ contents)
|
|
13
|
+
* 3. Fail with clear instructions
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
const nsDir = path.resolve(cwd, 'node_modules', '@vsaf');
|
|
21
|
+
const target = path.resolve(nsDir, 'core');
|
|
22
|
+
const source = path.resolve(cwd, 'packages', 'core', 'dist');
|
|
23
|
+
|
|
24
|
+
// Skip if source doesn't exist (e.g. fresh clone before build)
|
|
25
|
+
if (!fs.existsSync(source)) {
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Ensure @vsaf/ namespace directory
|
|
30
|
+
fs.mkdirSync(nsDir, { recursive: true });
|
|
31
|
+
|
|
32
|
+
// Clean existing link/dir
|
|
33
|
+
try { fs.rmSync(target, { recursive: true, force: true }); } catch {}
|
|
34
|
+
|
|
35
|
+
// Attempt 1: symlink (dir on Unix, junction on Windows)
|
|
36
|
+
try {
|
|
37
|
+
const type = process.platform === 'win32' ? 'junction' : 'dir';
|
|
38
|
+
fs.symlinkSync(source, target, type);
|
|
39
|
+
process.exit(0);
|
|
40
|
+
} catch (e1) {
|
|
41
|
+
// Attempt 2: copy
|
|
42
|
+
try {
|
|
43
|
+
fs.cpSync(source, target, { recursive: true });
|
|
44
|
+
process.exit(0);
|
|
45
|
+
} catch (e2) {
|
|
46
|
+
// Both failed — show clear instructions
|
|
47
|
+
console.error('\n' + '='.repeat(60));
|
|
48
|
+
console.error(' VSAF postinstall failed: cannot link @vsaf/core');
|
|
49
|
+
console.error('='.repeat(60));
|
|
50
|
+
console.error(`\n Symlink error: ${e1.message}`);
|
|
51
|
+
console.error(` Copy error: ${e2.message}`);
|
|
52
|
+
|
|
53
|
+
if (process.platform === 'win32') {
|
|
54
|
+
console.error('\n Windows fix (choose one):');
|
|
55
|
+
console.error(' 1. Enable Developer Mode:');
|
|
56
|
+
console.error(' Settings > Update & Security > For Developers > Developer Mode ON');
|
|
57
|
+
console.error(' Then re-run: npm install -g @ngocsangairvds/vsaf');
|
|
58
|
+
console.error('');
|
|
59
|
+
console.error(' 2. Run as Administrator:');
|
|
60
|
+
console.error(' Right-click terminal > "Run as administrator"');
|
|
61
|
+
console.error(' Then re-run: npm install -g @ngocsangairvds/vsaf');
|
|
62
|
+
console.error('');
|
|
63
|
+
console.error(' 3. Manual copy:');
|
|
64
|
+
console.error(` xcopy /E /I "${source}" "${target}"`);
|
|
65
|
+
} else {
|
|
66
|
+
console.error('\n Fix: check file permissions on node_modules/');
|
|
67
|
+
console.error(` Manual: cp -r "${source}" "${target}"`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.error('\n' + '='.repeat(60) + '\n');
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -288,7 +288,13 @@ try {
|
|
|
288
288
|
log('✅', 'Broken shim removed');
|
|
289
289
|
} catch (e) {
|
|
290
290
|
log('⚠️', `Cannot auto-remove shim (${e.code || e.message})`);
|
|
291
|
-
|
|
291
|
+
if (process.platform === 'win32') {
|
|
292
|
+
log(' ', 'Fix: open cmd as Administrator, then run:');
|
|
293
|
+
log(' ', ` del "${shimPath}"`);
|
|
294
|
+
log(' ', ' vsaf install vds-skill');
|
|
295
|
+
} else {
|
|
296
|
+
log(' ', `Fix: rm "${shimPath}" then re-run: vsaf install vds-skill`);
|
|
297
|
+
}
|
|
292
298
|
}
|
|
293
299
|
} catch {
|
|
294
300
|
// No shim found — that's fine
|